Browse Source

Configuration: Android GUI update & bug fix

LouYihua 7 years ago
parent
commit
4125fbcdc3

+ 12 - 28
android/app/src/main/cpp/android_jni.cpp

@@ -114,9 +114,8 @@ JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_saveConfigFile
 EXTERN_C_LINKAGE
 JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigBoolean(JNIEnv *env, jclass cls, jstring j_str, jboolean defval)
 {
-    ConfigValue value;
-    std::string name = jstring_to_utf8(env, j_str);
-    return PAL_GetConfigItem(name.c_str(), &value, defval) ? value.bValue : JNI_FALSE;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? PAL_GetConfigBoolean(item, defval) : JNI_FALSE;
 }
 
 /*
@@ -127,9 +126,8 @@ JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigBoole
 EXTERN_C_LINKAGE
 JNIEXPORT int JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigInt(JNIEnv *env, jclass cls, jstring j_str, jboolean defval)
 {
-    ConfigValue value;
-    std::string name = jstring_to_utf8(env, j_str);
-    return PAL_GetConfigItem(name.c_str(), &value, defval) ? value.iValue : JNI_FALSE;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? (int)PAL_GetConfigNumber(item, defval) : 0;
 }
 
 /*
@@ -140,9 +138,8 @@ JNIEXPORT int JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigInt(JNIEnv
 EXTERN_C_LINKAGE
 JNIEXPORT jstring JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigString(JNIEnv *env, jclass cls, jstring j_str, jboolean defval)
 {
-    ConfigValue value;
-    std::string name = jstring_to_utf8(env, j_str);
-    return PAL_GetConfigItem(name.c_str(), &value, defval) ? env->NewStringUTF(value.sValue) : nullptr;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? env->NewStringUTF(PAL_GetConfigString(item, defval)) : nullptr;
 }
 
 /*
@@ -153,9 +150,8 @@ JNIEXPORT jstring JNICALL Java_io_github_sdlpal_SettingsActivity_getConfigString
 EXTERN_C_LINKAGE
 JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_setConfigBoolean(JNIEnv *env, jclass cls, jstring j_str, jboolean val)
 {
-    ConfigValue value = { (LPCSTR)(val ? TRUE : FALSE) };
-    std::string name = jstring_to_utf8(env, j_str);
-    return PAL_SetConfigItem(name.c_str(), &value) ? JNI_TRUE : JNI_FALSE;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? PAL_SetConfigBoolean(item, val ? TRUE : FALSE) : JNI_FALSE;
 }
 
 /*
@@ -166,9 +162,8 @@ JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_setConfigBoole
 EXTERN_C_LINKAGE
 JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_setConfigInt(JNIEnv *env, jclass cls, jstring j_str, int val)
 {
-    ConfigValue value = { (LPCSTR)val };
-    std::string name = jstring_to_utf8(env, j_str);
-    return PAL_SetConfigItem(name.c_str(), &value) ? JNI_TRUE : JNI_FALSE;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? PAL_SetConfigNumber(item, (long)val) : JNI_FALSE;
 }
 
 /*
@@ -179,10 +174,8 @@ JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_setConfigInt(J
 EXTERN_C_LINKAGE
 JNIEXPORT jboolean JNICALL Java_io_github_sdlpal_SettingsActivity_setConfigString(JNIEnv *env, jclass cls, jstring j_str, jstring v_str)
 {
-    std::string name = jstring_to_utf8(env, j_str);
-    std::string val = jstring_to_utf8(env, v_str);
-    ConfigValue value = { val.c_str() };
-    return PAL_SetConfigItem(name.c_str(), &value) ? JNI_TRUE : JNI_FALSE;
+    PALCFG_ITEM item = PAL_ConfigIndex(jstring_to_utf8(env, j_str).c_str());
+    return item >= 0 ? PAL_SetConfigString(item, v_str ? jstring_to_utf8(env, v_str).c_str() : nullptr) : JNI_FALSE;
 }
 
 EXTERN_C_LINKAGE
@@ -246,15 +239,6 @@ UTIL_BasePath(
     return g_basepath.c_str();
 }
 
-EXTERN_C_LINKAGE
-LPCSTR
-UTIL_SavePath(
-   VOID
-)
-{
-    return g_basepath.c_str();
-}
-
 EXTERN_C_LINKAGE
 LPCSTR
 UTIL_ConfigPath(

+ 1 - 1
android/app/src/main/cpp/pal_config.h

@@ -27,7 +27,7 @@
 # define PAL_CONFIG_H
 
 # define PAL_PREFIX            UTIL_BasePath()
-# define PAL_SAVE_PREFIX       UTIL_SavePath()
+# define PAL_SAVE_PREFIX       UTIL_BasePath()
 # define PAL_CONFIG_PREFIX     UTIL_ConfigPath()
 # define PAL_HAS_TOUCH         1
 # define PAL_DEFAULT_WINDOW_WIDTH   320

+ 47 - 20
android/app/src/main/java/io/github/sdlpal/SettingsActivity.java

@@ -10,11 +10,14 @@ import android.support.v7.widget.Toolbar;
 import  android.support.v7.app.AlertDialog;
 import android.view.View;
 import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
 import android.widget.CompoundButton;
 import android.widget.EditText;
 import android.widget.SeekBar;
 import android.widget.Spinner;
 
+import java.util.ArrayList;
+
 public class SettingsActivity extends AppCompatActivity {
 
     public static native boolean loadConfigFile();
@@ -26,15 +29,13 @@ public class SettingsActivity extends AppCompatActivity {
     public static native boolean setConfigInt(String item, int value);
     public static native boolean setConfigString(String item, String value);
 
-    private static final String FullScreen = "FullScreen";
     private static final String KeepAspectRatio = "KeepAspectRatio";
     private static final String LaunchSetting = "LaunchSetting";
     private static final String Stereo = "Stereo";
-    private static final String UseEmbeddedFonts = "UseEmbeddedFonts";
     private static final String UseSurroundOPL = "UseSurroundOPL";
     private static final String UseTouchOverlay = "UseTouchOverlay";
     private static final String AudioBufferSize = "AudioBufferSize";
-    private static final String CodePage = "CodePage";
+    private static final String LogLevel = "LogLevel";
     private static final String OPLSampleRate = "OPLSampleRate";
     private static final String ResampleQuality = "ResampleQuality";
     private static final String SampleRate = "SampleRate";
@@ -44,6 +45,8 @@ public class SettingsActivity extends AppCompatActivity {
     private static final String GamePath = "GamePath";
     private static final String SavePath = "SavePath";
     private static final String MessageFileName = "MessageFileName";
+    private static final String LogFileName = "LogFileName";
+    private static final String FontFileName = "FontFileName";
     private static final String MusicFormat = "Music";
     private static final String OPLFormat = "OPL";
 
@@ -63,11 +66,24 @@ public class SettingsActivity extends AppCompatActivity {
         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
         setSupportActionBar(toolbar);
 
-        ((SwitchCompat)findViewById(R.id.swCustomLang)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+        ((SwitchCompat)findViewById(R.id.swMsgFile)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                findViewById(R.id.edMsgFile).setVisibility(isChecked ? View.VISIBLE : View.GONE);
+            }
+        });
+
+        ((SwitchCompat)findViewById(R.id.swFontFile)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                findViewById(R.id.edFontFile).setVisibility(isChecked ? View.VISIBLE : View.GONE);
+            }
+        });
+
+        ((SwitchCompat)findViewById(R.id.swLogFile)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                findViewById(R.id.swGameLang).setVisibility(isChecked ? View.GONE : View.VISIBLE);
-                findViewById(R.id.edLangFile).setVisibility(isChecked ? View.VISIBLE : View.GONE);
+                findViewById(R.id.edLogFile).setVisibility(isChecked ? View.VISIBLE : View.GONE);
             }
         });
 
@@ -152,7 +168,9 @@ public class SettingsActivity extends AppCompatActivity {
     protected void setDefaults() {
         String sdcardState = Environment.getExternalStorageState();
 
-        findViewById(R.id.edLangFile).setVisibility(View.GONE);
+        findViewById(R.id.edMsgFile).setVisibility(View.GONE);
+        findViewById(R.id.edFontFile).setVisibility(View.GONE);
+        findViewById(R.id.edLogFile).setVisibility(View.GONE);
         findViewById(R.id.layoutOPL).setVisibility(View.VISIBLE);
 
         ((SeekBar)findViewById(R.id.sbMusVol)).setProgress(getConfigInt(MusicVolume, true));
@@ -164,16 +182,19 @@ public class SettingsActivity extends AppCompatActivity {
         } else {
             ((EditText)findViewById(R.id.edFolder)).setText("/sdcard/sdlpal/");
         }
-        ((EditText)findViewById(R.id.edLangFile)).setText("");
+        ((EditText)findViewById(R.id.edMsgFile)).setText("");
+        ((EditText)findViewById(R.id.edFontFile)).setText("");
+        ((EditText)findViewById(R.id.edLogFile)).setText("");
 
-        ((SwitchCompat)findViewById(R.id.swEmbedFont)).setChecked(getConfigBoolean(UseEmbeddedFonts, true));
-        ((SwitchCompat)findViewById(R.id.swCustomLang)).setChecked(false);
-        ((SwitchCompat)findViewById(R.id.swGameLang)).setChecked(getConfigInt(CodePage, true) != 0);
+        ((SwitchCompat)findViewById(R.id.swMsgFile)).setChecked(false);
+        ((SwitchCompat)findViewById(R.id.swFontFile)).setChecked(false);
+        ((SwitchCompat)findViewById(R.id.swLogFile)).setChecked(false);
         ((SwitchCompat)findViewById(R.id.swTouch)).setChecked(getConfigBoolean(UseTouchOverlay, true));
         ((SwitchCompat)findViewById(R.id.swAspect)).setChecked(getConfigBoolean(KeepAspectRatio, true));
         ((SwitchCompat)findViewById(R.id.swSurround)).setChecked(getConfigBoolean(UseSurroundOPL, true));
         ((SwitchCompat)findViewById(R.id.swStereo)).setChecked(getConfigBoolean(Stereo, true));
 
+        ((AppCompatSpinner)findViewById(R.id.spLogLevel)).setSelection(getConfigInt(LogLevel, true));
         ((AppCompatSpinner)findViewById(R.id.spSample)).setSelection(findMatchedIntIndex(getConfigInt(SampleRate, true), AudioSampleRates, 2));    // 44100Hz
         ((AppCompatSpinner)findViewById(R.id.spBuffer)).setSelection(findMatchedIntIndex(getConfigInt(AudioBufferSize, true), AudioBufferSizes, 1));    // 1024
         ((AppCompatSpinner)findViewById(R.id.spCDFmt)).setSelection(findMatchedStringIndex(getConfigString(CDFormat, true), CDFormats, 1));     // OGG
@@ -184,25 +205,30 @@ public class SettingsActivity extends AppCompatActivity {
 
 
     protected void resetConfigs() {
-        findViewById(R.id.edLangFile).setVisibility(View.GONE);
+        findViewById(R.id.edMsgFile).setVisibility(View.GONE);
+        findViewById(R.id.edFontFile).setVisibility(View.GONE);
+        findViewById(R.id.edLogFile).setVisibility(View.GONE);
         findViewById(R.id.layoutOPL).setVisibility(View.VISIBLE);
 
         ((SeekBar)findViewById(R.id.sbMusVol)).setProgress(getConfigInt(MusicVolume, false));
         ((SeekBar)findViewById(R.id.sbSFXVol)).setProgress(getConfigInt(SoundVolume, false));
         ((SeekBar)findViewById(R.id.sbQuality)).setProgress(getConfigInt(ResampleQuality, false)); // Best quality
 
-        String langFile = getConfigString(MessageFileName, false);
+        String msgFile, fontFile, logFile;
         ((EditText)findViewById(R.id.edFolder)).setText(getConfigString(GamePath, false));
-        ((EditText)findViewById(R.id.edLangFile)).setText(langFile);
+        ((EditText)findViewById(R.id.edMsgFile)).setText(msgFile = getConfigString(MessageFileName, false));
+        ((EditText)findViewById(R.id.edFontFile)).setText(fontFile = getConfigString(FontFileName, false));
+        ((EditText)findViewById(R.id.edLogFile)).setText(logFile = getConfigString(LogFileName, false));
 
-        ((SwitchCompat)findViewById(R.id.swEmbedFont)).setChecked(getConfigBoolean(UseEmbeddedFonts, false));
-        ((SwitchCompat)findViewById(R.id.swCustomLang)).setChecked(langFile != null && !langFile.isEmpty());
-        ((SwitchCompat)findViewById(R.id.swGameLang)).setChecked(getConfigInt(CodePage, false) != 0);
+        ((SwitchCompat)findViewById(R.id.swMsgFile)).setChecked(msgFile != null && !msgFile.isEmpty());
+        ((SwitchCompat)findViewById(R.id.swFontFile)).setChecked(fontFile != null && !fontFile.isEmpty());
+        ((SwitchCompat)findViewById(R.id.swLogFile)).setChecked(logFile != null && !logFile.isEmpty());
         ((SwitchCompat)findViewById(R.id.swTouch)).setChecked(getConfigBoolean(UseTouchOverlay, false));
         ((SwitchCompat)findViewById(R.id.swAspect)).setChecked(getConfigBoolean(KeepAspectRatio, false));
         ((SwitchCompat)findViewById(R.id.swSurround)).setChecked(getConfigBoolean(UseSurroundOPL, false));
         ((SwitchCompat)findViewById(R.id.swStereo)).setChecked(getConfigBoolean(Stereo, false));
 
+        ((AppCompatSpinner)findViewById(R.id.spLogLevel)).setSelection(getConfigInt(LogLevel, false));
         ((AppCompatSpinner)findViewById(R.id.spSample)).setSelection(findMatchedIntIndex(getConfigInt(SampleRate, false), AudioSampleRates, 2));    // 44100Hz
         ((AppCompatSpinner)findViewById(R.id.spBuffer)).setSelection(findMatchedIntIndex(getConfigInt(AudioBufferSize, false), AudioBufferSizes, 1));    // 1024
         ((AppCompatSpinner)findViewById(R.id.spCDFmt)).setSelection(findMatchedStringIndex(getConfigString(CDFormat, false), CDFormats, 1));     // OGG
@@ -231,15 +257,16 @@ public class SettingsActivity extends AppCompatActivity {
 
         setConfigString(GamePath, ((EditText)findViewById(R.id.edFolder)).getText().toString());
         setConfigString(SavePath, ((EditText)findViewById(R.id.edFolder)).getText().toString());
-        setConfigString(MessageFileName, ((EditText)findViewById(R.id.edLangFile)).getText().toString());
+        setConfigString(MessageFileName, ((SwitchCompat)findViewById(R.id.swMsgFile)).isChecked() ? ((EditText)findViewById(R.id.edMsgFile)).getText().toString() : null);
+        setConfigString(FontFileName, ((SwitchCompat)findViewById(R.id.swFontFile)).isChecked() ? ((EditText)findViewById(R.id.edFontFile)).getText().toString() : null);
+        setConfigString(LogFileName, ((SwitchCompat)findViewById(R.id.swLogFile)).isChecked() ? ((EditText)findViewById(R.id.edLogFile)).getText().toString() : null);
 
-        setConfigBoolean(UseEmbeddedFonts, ((SwitchCompat)findViewById(R.id.swEmbedFont)).isChecked());
-        setConfigInt(CodePage, ((SwitchCompat)findViewById(R.id.swGameLang)).isChecked() ? 1 : 0);
         setConfigBoolean(UseTouchOverlay, ((SwitchCompat)findViewById(R.id.swTouch)).isChecked());
         setConfigBoolean(KeepAspectRatio, ((SwitchCompat)findViewById(R.id.swAspect)).isChecked());
         setConfigBoolean(UseSurroundOPL, ((SwitchCompat)findViewById(R.id.swSurround)).isChecked());
         setConfigBoolean(Stereo, ((SwitchCompat)findViewById(R.id.swStereo)).isChecked());
 
+        setConfigInt(LogLevel, ((AppCompatSpinner)findViewById(R.id.spLogLevel)).getSelectedItemPosition());
         setConfigInt(SampleRate, Integer.parseInt((String)((AppCompatSpinner)findViewById(R.id.spSample)).getSelectedItem()));
         setConfigInt(AudioBufferSize, Integer.parseInt((String)((AppCompatSpinner)findViewById(R.id.spBuffer)).getSelectedItem()));
         setConfigString(CDFormat, (String)((AppCompatSpinner)findViewById(R.id.spCDFmt)).getSelectedItem());

+ 34 - 26
android/app/src/main/res/layout/content_settings.xml

@@ -20,7 +20,6 @@
             >
 
             <TextView
-                android:id="@+id/tvFolder"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="@string/label_folder"
@@ -38,37 +37,55 @@
                 tools:layout_editor_absoluteY="16dp" />
 
             <android.support.v7.widget.SwitchCompat
-                android:id="@+id/swEmbedFont"
+                android:id="@+id/swMsgFile"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/action_embedded_font"
+                android:text="@string/action_usemsgfile"
                 tools:layout_editor_absoluteX="8dp"
-                tools:layout_editor_absoluteY="121dp" />
+                tools:layout_editor_absoluteY="191dp" />
+
+            <EditText
+                android:id="@+id/edMsgFile"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:ems="10"
+                android:inputType="textUri" />
 
             <android.support.v7.widget.SwitchCompat
-                android:id="@+id/swCustomLang"
+                android:id="@+id/swFontFile"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/action_custom_lang"
-                tools:layout_editor_absoluteX="8dp"
-                tools:layout_editor_absoluteY="191dp" />
+                android:text="@string/action_usefontfile" />
+
+            <EditText
+                android:id="@+id/edFontFile"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:ems="10"
+                android:inputType="textUri" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/label_loglevel" />
+
+            <android.support.v7.widget.AppCompatSpinner
+                android:id="@+id/spLogLevel"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:entries="@array/log_level" />
 
             <android.support.v7.widget.SwitchCompat
-                android:id="@+id/swGameLang"
+                android:id="@+id/swLogFile"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:text="@string/action_lang"
-                android:textOff="@string/switch_traditional"
-                android:textOn="@string/switch_simplified"
-                app:showText="true"
-                tools:layout_editor_absoluteX="8dp"
-                tools:layout_editor_absoluteY="155dp" />
+                android:text="@string/action_uselogfile" />
 
             <EditText
-                android:id="@+id/edLangFile"
+                android:id="@+id/edLogFile"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_weight="1"
                 android:ems="10"
                 android:inputType="textUri" />
 
@@ -97,7 +114,6 @@
                 tools:layout_editor_absoluteY="311dp" />
 
             <TextView
-                android:id="@+id/tvMusVol"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_musvol" />
@@ -109,7 +125,6 @@
                 android:max="100" />
 
             <TextView
-                android:id="@+id/tvSFXVol"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_sfxvol" />
@@ -121,7 +136,6 @@
                 android:max="100" />
 
             <TextView
-                android:id="@+id/tvQuality"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_quality" />
@@ -133,7 +147,6 @@
                 android:max="4" />
 
             <TextView
-                android:id="@+id/tvSample"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_audrate" />
@@ -145,7 +158,6 @@
                 android:entries="@array/audio_rate"/>
 
             <TextView
-                android:id="@+id/tvBuffer"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_bufsize" />
@@ -157,7 +169,6 @@
                 android:entries="@array/buffer_size" />
 
             <TextView
-                android:id="@+id/tvCDFmt"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_cdfmt" />
@@ -169,7 +180,6 @@
                 android:entries="@array/cd_format" />
 
             <TextView
-                android:id="@+id/tvMusFmt"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/label_musfmt" />
@@ -187,7 +197,6 @@
                 android:orientation="vertical">
 
                 <TextView
-                    android:id="@+id/tvOPLRate"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/label_oplrate" />
@@ -199,7 +208,6 @@
                     android:entries="@array/opl_rate" />
 
                 <TextView
-                    android:id="@+id/tvOPL"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/label_opl" />

+ 10 - 0
android/app/src/main/res/values-zh-rTW/arrays.xml

@@ -0,0 +1,10 @@
+<resources>
+    <string-array name="log_level">
+        <item>詳細</item>
+        <item>調試</item>
+        <item>信息</item>
+        <item>警告</item>
+        <item>錯誤</item>
+        <item>致命</item>
+    </string-array>
+</resources>

+ 4 - 5
android/app/src/main/res/values-zh-rTW/strings.xml

@@ -2,16 +2,12 @@
 <resources>
     <string name="label_folder">游戏资源所在文件夹:</string>
     <string name="action_browse">瀏覽</string>
-    <string name="action_embedded_font">使用遊戲資源內置字體</string>
     <string name="action_aspect">保持縱橫比</string>
     <string name="label_bufsize">音訊緩衝區大小</string>
     <string name="label_musfmt">背景音樂格式</string>
     <string name="action_default">默認設定</string>
     <string name="action_finish">完成設定</string>
     <string name="label_cdfmt">CD 音軌格式</string>
-    <string name="switch_traditional">繁</string>
-    <string name="action_lang">遊戲資源語言</string>
-    <string name="action_custom_lang">自訂語言檔案</string>
     <string name="label_quality">音訊品質</string>
     <string name="label_audrate">音訊輸出取樣速率</string>
     <string name="action_stereo">立體聲</string>
@@ -25,6 +21,9 @@
     <string name="msg_crash">上次程式異常退出,已顯示設定頁供您檢查設定是否正確。</string>
     <string name="msg_empty">必須指定遊戲資源檔案夾!</string>
     <string name="msg_exit">您的設定已保存,下次啟動時將直接開始遊戲。在遊戲中,您可以通過遊戲系統功能表的返回設定選項回到本設定頁面。</string>
-    <string name="switch_simplified">簡</string>
     <string name="action_restore">撤銷修改</string>
+    <string name="label_loglevel">日誌記錄級別</string>
+    <string name="action_usefontfile">自訂字體檔案</string>
+    <string name="action_usemsgfile">自訂語言檔案</string>
+    <string name="action_uselogfile">記錄到檔案</string>
 </resources>

+ 10 - 0
android/app/src/main/res/values-zh/arrays.xml

@@ -0,0 +1,10 @@
+<resources>
+    <string-array name="log_level">
+        <item>详细</item>
+        <item>调试</item>
+        <item>信息</item>
+        <item>警告</item>
+        <item>错误</item>
+        <item>致命</item>
+    </string-array>
+</resources>

+ 4 - 5
android/app/src/main/res/values-zh/strings.xml

@@ -2,11 +2,7 @@
 <resources>
     <string name="label_folder">游戏资源所在文件夹:</string>
     <string name="action_browse">浏览</string>
-    <string name="action_embedded_font">使用游戏资源内置字体</string>
     <string name="title_settings">设置模式</string>
-    <string name="action_custom_lang">自定义语言文件</string>
-    <string name="action_lang">游戏资源语言</string>
-    <string name="switch_traditional">繁</string>
     <string name="action_touch">启用触屏辅助</string>
     <string name="action_aspect">保持纵横比</string>
     <string name="action_default">默认设置</string>
@@ -25,6 +21,9 @@
     <string name="msg_crash">上次程序异常退出,已显示设置页供您检查设置是否正确。</string>
     <string name="msg_empty">必须指定游戏资源文件夹!</string>
     <string name="msg_exit">您的设置已保存,下次启动时将直接开始游戏。在游戏中,您可以通过游戏系统菜单中的返回设置选项回到本设置页面。</string>
-    <string name="switch_simplified">简</string>
     <string name="action_restore">撤销修改</string>
+    <string name="label_loglevel">日志记录级别</string>
+    <string name="action_uselogfile">记录到文件</string>
+    <string name="action_usemsgfile">自定义语言文件</string>
+    <string name="action_usefontfile">自定义字体文件</string>
 </resources>

+ 14 - 6
android/app/src/main/res/values/arrays.xml

@@ -1,34 +1,42 @@
 <resources>
-    <string-array name="audio_rate">
+    <string-array name="audio_rate" translatable="false">
         <item>11025</item>
         <item>22050</item>
         <item>44100</item>
     </string-array>
-    <string-array name="buffer_size">
+    <string-array name="buffer_size" translatable="false">
         <item>512</item>
         <item>1024</item>
         <item>2048</item>
         <item>4096</item>
         <item>8192</item>
     </string-array>
-    <string-array name="cd_format">
+    <string-array name="cd_format" translatable="false">
         <item>MP3</item>
         <item>OGG</item>
     </string-array>
-    <string-array name="music_format">
+    <string-array name="music_format" translatable="false">
         <item>MIDI</item>
         <item>RIX</item>
         <item>MP3</item>
         <item>OGG</item>
     </string-array>
-    <string-array name="opl_type">
+    <string-array name="opl_type" translatable="false">
         <item>DOSBOX</item>
         <item>MAME</item>
         <item>DOSBOXNEW</item>
     </string-array>
-    <string-array name="opl_rate">
+    <string-array name="opl_rate" translatable="false">
         <item>12429</item>
         <item>24858</item>
         <item>49716</item>
     </string-array>
+    <string-array name="log_level">
+        <item>Verbose</item>
+        <item>Debug</item>
+        <item>Informational</item>
+        <item>Warning</item>
+        <item>Error</item>
+        <item>Fatal</item>
+    </string-array>
 </resources>

+ 4 - 5
android/app/src/main/res/values/strings.xml

@@ -2,12 +2,7 @@
     <string name="app_name" translatable="false">SDLPal</string>
     <string name="label_folder">Game resource folder:</string>
     <string name="action_browse">Browse</string>
-    <string name="action_embedded_font">Using embedded font</string>
     <string name="title_settings">Settings</string>
-    <string name="action_custom_lang">Use language file</string>
-    <string name="action_lang">Game language</string>
-    <string name="switch_traditional">CHT</string>
-    <string name="switch_simplified">CHS</string>
     <string name="action_touch">Enable touch overlay</string>
     <string name="action_aspect">Keep aspect ratio</string>
     <string name="action_stereo">Stereo</string>
@@ -27,4 +22,8 @@
     <string name="msg_exit">Settings have been saved and the game will be started on next launch. You can use the main menu option inside the game to return to this page.</string>
     <string name="msg_crash">The program is abnormally terminated last time. The setting page has been launched for you. Please check if there are any incorrect settings.</string>
     <string name="msg_empty">The game resource folder must be specified!</string>
+    <string name="label_loglevel">Logging level</string>
+    <string name="action_usemsgfile">Customized message file</string>
+    <string name="action_usefontfile">Customized font file</string>
+    <string name="action_uselogfile">Log to file</string>
 </resources>

+ 32 - 0
palcfg.c

@@ -648,6 +648,20 @@ PAL_GetConfigBoolean(
 	return gConfigItems[item].Type == PALCFG_BOOLEAN ? PAL_GetConfigItem(item, default_value).bValue : FALSE;
 }
 
+long
+PAL_GetConfigNumber(
+	PALCFG_ITEM item,
+	BOOL        default_value
+)
+{
+	switch (gConfigItems[item].Type)
+	{
+	case PALCFG_INTEGER:  return (long)PAL_GetConfigItem(item, default_value).iValue;
+	case PALCFG_UNSIGNED: return (long)PAL_GetConfigItem(item, default_value).uValue;
+	default:              return 0;
+	}
+}
+
 int
 PAL_GetConfigInteger(
 	PALCFG_ITEM item,
@@ -693,6 +707,24 @@ PAL_SetConfigBoolean(
 	}
 }
 
+BOOL
+PAL_SetConfigNumber(
+	PALCFG_ITEM item,
+	long        value
+)
+{
+	if (gConfigItems[item].Type == PALCFG_INTEGER || gConfigItems[item].Type == PALCFG_UNSIGNED)
+	{
+		ConfigValue val = { (const char *)(intptr_t)value };
+		PAL_SetConfigItem(item, val);
+		return TRUE;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
 BOOL
 PAL_SetConfigInteger(
 	PALCFG_ITEM item,

+ 12 - 0
palcfg.h

@@ -262,6 +262,12 @@ PAL_GetConfigBoolean(
 	BOOL        default_value
 );
 
+long
+PAL_GetConfigNumber(
+	PALCFG_ITEM item,
+	BOOL        default_value
+);
+
 int
 PAL_GetConfigInteger(
 	PALCFG_ITEM item,
@@ -286,6 +292,12 @@ PAL_SetConfigBoolean(
 	BOOL        value
 );
 
+BOOL
+PAL_SetConfigNumber(
+	PALCFG_ITEM item,
+	long        value
+);
+
 BOOL
 PAL_SetConfigInteger(
 	PALCFG_ITEM item,