int lcdWidth = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_WIDTH ) );
int lcdHeight = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_HEIGHT ) );
- EmulatorUI dbiContents = loadDbi( lcdWidth, lcdHeight );
+ String argSkinPath = (String) argsMap.get( ArgsConstants.SKIN_PATH );
+ EmulatorUI dbiContents = loadDbi( argSkinPath, lcdWidth, lcdHeight );
if ( null == dbiContents ) {
logger.severe( "Fail to load dbi file." );
return;
}
- SkinLogLevel skinLogLevel = SkinLogLevel.TRACE;
+ SkinLogLevel skinLogLevel = SkinLogLevel.DEBUG;
if( !StringUtil.isEmpty( logLevel ) ) {
}
- private static EmulatorUI loadDbi( int lcdWidth, int lcdHeight ) {
+ private static EmulatorUI loadDbi( String argSkinPath, int lcdWidth, int lcdHeight ) {
- String skinPath = ImageRegistry.getSkinPath( lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
+ String skinPath = ImageRegistry.getSkinPath( argSkinPath, lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
FileInputStream fis = null;
EmulatorUI emulatorUI = null;
}
-}
\ No newline at end of file
+}
public static final String VM_PATH = "vm.path";
public static final String LOG_LEVEL = "log.level";
public static final String NET_BASE_PORT = "net.baseport";
+ public static final String SKIN_PATH = "skin.path";
}
-
+
public interface PropertiesConstants {
public static final String WINDOW_X = "window.x";
public static final String WINDOW_Y = "window.y";
int lcdWidth = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_WIDTH ) );
int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
+ String skinPath = (String) config.getArg( ArgsConstants.SKIN_PATH );
this.resolutionWidth = lcdWidth;
this.resolutionHeight = lcdHeight;
this.skinImageMap = new HashMap<String, Image>();
this.iconMap = new HashMap<String, Image>();
- init();
+ init(skinPath);
}
- public static String getSkinPath( int lcdWidth, int lcdHeight ) {
- String skinPath = ".." + File.separator + SKIN_FOLDER + File.separator + IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
- return skinPath;
+ public static String getSkinPath( String argSkinPath, int lcdWidth, int lcdHeight ) {
+ String skinPath = ".." + File.separator + SKIN_FOLDER + File.separator +
+ IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
+
+ if (argSkinPath == null) {
+ return skinPath;
+ }
+
+ File f = new File(argSkinPath);
+ if (f.isDirectory() == false) {
+ return skinPath;
+ }
+
+ return argSkinPath;
}
- private void init() {
+ private void init(String argSkinPath) {
- String skinPath = getSkinPath( resolutionWidth, resolutionHeight );
+ String skinPath = getSkinPath( argSkinPath, resolutionWidth, resolutionHeight );
RotationsType rotations = dbiContents.getRotations();
List<RotationType> rotationList = rotations.getRotation();
*/
public class SkinUtil {
+ public static final int DEFAULT_SCALE = 50; // 1/2x
public static final int SCALE_CONVERTER = 100;
public static final String EMULATOR_PREFIX = "emulator";
public static int getValidScale( EmulatorConfig config ) {
- int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
- int defaultScale = SkinUtil.getDefaultScale( lcdHeight );
-
- int storedScale = config.getPropertyInt( PropertiesConstants.WINDOW_SCALE, defaultScale );
+ int storedScale = config.getPropertyInt( PropertiesConstants.WINDOW_SCALE, DEFAULT_SCALE );
if ( !SkinUtil.isValidScale( storedScale ) ) {
- return defaultScale;
+ return DEFAULT_SCALE;
}else {
return storedScale;
}
}
- public static int getDefaultScale( int lcdHeight ) {
- int defaultScale = 100;
- if ( 800 < lcdHeight ) {
- defaultScale = 50;
- }
- return defaultScale;
- }
-
public static boolean isValidScale( int scale ) {
if ( 100 == scale || 75 == scale || 50 == scale || 25 == scale ) {
return true;