[Android] Start to use project64 language functionality

This commit is contained in:
zilmar 2016-12-20 18:55:28 +11:00
parent c29d6612cb
commit 7cb6d2f5c0
20 changed files with 410 additions and 287 deletions

View File

@ -23,12 +23,12 @@
android:id="@+id/logo" android:id="@+id/logo"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:contentDescription="@string/info"
android:focusable="false" android:focusable="false"
android:clickable="false" android:clickable="false"
android:src="@drawable/icon" /> android:src="@drawable/icon" />
<TextView <TextView
android:id="@+id/app_name_full"
android:textSize="29sp" android:textSize="29sp"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
@ -37,18 +37,17 @@
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/app_name_full"
android:onClick="onAppNameClick" android:onClick="onAppNameClick"
android:clickable="true" android:clickable="true"
/> />
</RelativeLayout> </RelativeLayout>
<TextView <TextView
android:id="@+id/about_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:gravity="center" android:gravity="center"
android:text="@string/about_text"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
@ -60,6 +59,12 @@
android:text="@string/about_copyright" android:text="@string/about_copyright"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView
android:id="@+id/Project64_authors"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="12sp" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -67,12 +72,6 @@
android:gravity="center" android:gravity="center"
android:text="@string/authors" android:text="@string/authors"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/Project64_authors"
android:textSize="12sp" />
<TextView <TextView
android:id="@+id/main_link" android:id="@+id/main_link"

View File

@ -5,10 +5,9 @@
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
android:id="@+id/text1" android:id="@+id/scanRomsDialog_selectDir"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/scanRomsDialog_selectDir"
android:padding="10dp" android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
@ -21,11 +20,10 @@
</ListView> </ListView>
<CheckBox <CheckBox
android:id="@+id/checkBox1" android:id="@+id/ScanRecursively"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:padding="10dp" />
android:text="@string/scanRomsDialog_scanRecursively" />
<RelativeLayout <RelativeLayout
android:id="@+id/linearLayoutButtons" android:id="@+id/linearLayoutButtons"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -6,7 +6,6 @@
<item <item
android:id="@+id/menuItem_gameDir" android:id="@+id/menuItem_gameDir"
android:icon="@drawable/ic_folder" android:icon="@drawable/ic_folder"
android:title="@string/menuItem_gameDir"
project64:showAsAction="always|collapseActionView" project64:showAsAction="always|collapseActionView"
tools:ignore="UnusedAttribute"/> tools:ignore="UnusedAttribute"/>
</menu> </menu>

View File

@ -4,18 +4,14 @@
<item <item
android:id="@+id/menuItem_settings" android:id="@+id/menuItem_settings"
android:icon="@drawable/ic_settings" android:icon="@drawable/ic_settings"/>
android:title="@string/menuItem_settings"/>
<item <item
android:id="@+id/menuItem_forum" android:id="@+id/menuItem_forum"
android:icon="@drawable/ic_forum" android:icon="@drawable/ic_forum" />
android:title="@string/menuItem_forum" />
<item <item
android:id="@+id/menuItem_reportBug" android:id="@+id/menuItem_reportBug"
android:icon="@drawable/ic_bug" android:icon="@drawable/ic_bug" />
android:title="@string/menuItem_reportBug" />
<item <item
android:id="@+id/menuItem_about" android:id="@+id/menuItem_about"
android:icon="@drawable/ic_about" android:icon="@drawable/ic_about" />
android:title="@string/menuItem_about" />
</menu> </menu>

View File

@ -1,58 +1,35 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" > xmlns:tools="http://schemas.android.com/tools" >
<item <item android:id="@+id/menuItem_SaveState"/>
android:id="@+id/menuItem_SaveState" <item android:id="@+id/menuItem_LoadState"/>
android:title="@string/menuItem_SaveState"> <item android:id="@+id/menuItem_CurrentSaveState" >
</item>
<item
android:id="@+id/menuItem_LoadState"
android:title="@string/menuItem_LoadState">
</item>
<item
android:id="@+id/menuItem_CurrentSaveState"
android:title="@string/menuItem_CurrentSaveState">
<menu> <menu>
<group android:checkableBehavior="single"> <group android:checkableBehavior="single">
<item android:id="@+id/menuItem_CurrentSaveAuto" android:title="@string/menuItem_CurrentSaveAuto" /> <item android:id="@+id/menuItem_CurrentSaveAuto"/>
<item android:id="@+id/menuItem_CurrentSave1" android:title="@string/menuItem_CurrentSave1" /> <item android:id="@+id/menuItem_CurrentSave1"/>
<item android:id="@+id/menuItem_CurrentSave2" android:title="@string/menuItem_CurrentSave2" /> <item android:id="@+id/menuItem_CurrentSave2"/>
<item android:id="@+id/menuItem_CurrentSave3" android:title="@string/menuItem_CurrentSave3" /> <item android:id="@+id/menuItem_CurrentSave3"/>
<item android:id="@+id/menuItem_CurrentSave4" android:title="@string/menuItem_CurrentSave4" /> <item android:id="@+id/menuItem_CurrentSave4"/>
<item android:id="@+id/menuItem_CurrentSave5" android:title="@string/menuItem_CurrentSave5" /> <item android:id="@+id/menuItem_CurrentSave5"/>
<item android:id="@+id/menuItem_CurrentSave6" android:title="@string/menuItem_CurrentSave6" /> <item android:id="@+id/menuItem_CurrentSave6"/>
<item android:id="@+id/menuItem_CurrentSave7" android:title="@string/menuItem_CurrentSave7" /> <item android:id="@+id/menuItem_CurrentSave7"/>
<item android:id="@+id/menuItem_CurrentSave8" android:title="@string/menuItem_CurrentSave8" /> <item android:id="@+id/menuItem_CurrentSave8"/>
<item android:id="@+id/menuItem_CurrentSave9" android:title="@string/menuItem_CurrentSave9" /> <item android:id="@+id/menuItem_CurrentSave9"/>
<item android:id="@+id/menuItem_CurrentSave10" android:title="@string/menuItem_CurrentSave10" /> <item android:id="@+id/menuItem_CurrentSave10"/>
</group> </group>
</menu> </menu>
</item> </item>
<item <item android:id="@+id/menuItem_GameSpeed" />
android:id="@+id/menuItem_GameSpeed" <item android:id="@+id/menuItem_settings" />
android:title="@string/menuItem_GameSpeed"> <item android:id="@+id/menuItem_DebuggingMenu" >
</item>
<item
android:id="@+id/menuItem_settings"
android:title="@string/menuItem_settings"/>
<item
android:id="@+id/menuItem_DebuggingMenu"
android:title="@string/menuItem_DebuggingOptions">
<menu> <menu>
<item android:id="@+id/menuItem_ResetFunctionTimes" android:title="@string/menuItem_ResetFunctionTimes" /> <item android:id="@+id/menuItem_ResetFunctionTimes" />
<item android:id="@+id/menuItem_DumpFunctionTimes" android:title="@string/menuItem_DumpFunctionTimes" /> <item android:id="@+id/menuItem_DumpFunctionTimes" />
</menu> </menu>
</item> </item>
<item <item android:id="@+id/menuItem_pause" />
android:id="@+id/menuItem_pause" <item android:id="@+id/menuItem_resume" />
android:title="@string/menuItem_pause"/> <item android:id="@+id/menuItem_HardReset" />
<item <item android:id="@+id/menuItem_EndEmulation" />
android:id="@+id/menuItem_resume"
android:title="@string/menuItem_resume"/>
<item
android:id="@+id/menuItem_HardReset"
android:title="@string/menuItem_ConsoleReset"/>
<item
android:id="@+id/menuItem_EndEmulation"
android:title="@string/menuItem_EndEmulation"/>
</menu> </menu>

View File

@ -15,4 +15,21 @@
<string name="ScanRomsActivity_title" translatable="false">@string/app_name</string> <string name="ScanRomsActivity_title" translatable="false">@string/app_name</string>
<string name="GameActivity_title" translatable="false">@string/app_name</string> <string name="GameActivity_title" translatable="false">@string/app_name</string>
<!-- About -->
<string name="about_link" translatable="false"> &lt;a href=&quot;www.pj64-emu.com&quot;&gt;www.pj64-emu.com&lt;/a&gt;</string>
<string name="about_copyright" translatable="false">Copyleft &#169; 1998&#8211;2016 by Project64.\n</string>
<string name="authors" translatable="false">Zilmar, Jabo, Smiff, Gent, Jahra!n, Witten, RadeonUser, Trotterwatch, pixi, Azimer, Gonetz, cxd4, AmbientMalice, LegendOfDragoon, Nekokabu, Lithium64, death-droid, LuigiBlood, dsx.</string>
<!-- Seek Bar Preference -->
<string name="seekBarPreference_summary" translatable="false">%1$d %2$s</string>
<!-- Settings -->
<string-array name="trace_severity_values" translatable="false">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
</string-array>
</resources> </resources>

View File

@ -1,78 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- In-Game Menu -->
<string name="menuItem_SaveState">Save State</string>
<string name="menuItem_LoadState">Load State</string>
<string name="menuItem_EndEmulation">End Emulation</string>
<string name="menuItem_pause">Pause</string>
<string name="menuItem_resume">Resume</string>
<string name="menuItem_GameSpeed">Game Speed</string>
<string name="menuItem_CurrentSaveState">Current Save State…</string>
<string name="menuItem_CurrentSaveAuto">Auto</string>
<string name="menuItem_CurrentSave1">Slot 1</string>
<string name="menuItem_CurrentSave2">Slot 2</string>
<string name="menuItem_CurrentSave3">Slot 3</string>
<string name="menuItem_CurrentSave4">Slot 4</string>
<string name="menuItem_CurrentSave5">Slot 5</string>
<string name="menuItem_CurrentSave6">Slot 6</string>
<string name="menuItem_CurrentSave7">Slot 7</string>
<string name="menuItem_CurrentSave8">Slot 8</string>
<string name="menuItem_CurrentSave9">Slot 9</string>
<string name="menuItem_CurrentSave10">Slot 10</string>
<string name="menuItem_ConsoleReset">Reset</string>
<string name="menuItem_DebuggingOptions">Debugging Options</string>
<string name="menuItem_ResetFunctionTimes">Reset Function Times</string>
<string name="menuItem_DumpFunctionTimes">Dump Function Times</string>
<!-- Menu Activity -->
<string name="menuItem_search">Search</string>
<string name="menuItem_refreshRoms">Refresh ROMs</string>
<string name="menuItem_gameDir">Game Dir</string>
<string name="menuItem_settings">Settings</string>
<string name="menuItem_about">About</string>
<string name="menuItem_appVersion">App version</string>
<string name="menuItem_hardwareInfo">Hardware info</string>
<string name="menuItem_forum">Help/Forum</string>
<string name="menuItem_reportBug">Report Issue</string>
<string name="content_description_app_loading_image">App loading image</string>
<!-- ************************************************************************** -->
<!-- Toast Messages -->
<!-- Developers: Follow punctuation and grammar as shown below -->
<!-- ************************************************************************** -->
<!-- Something happening (typically use '-ing' and '…') --> <!-- Something happening (typically use '-ing' and '…') -->
<string name="toast_launchingEmulator">Launching emulator…</string>
<string name="toast_canceling">Canceling…</string> <string name="toast_canceling">Canceling…</string>
<string name="toast_pleaseWait">Please wait…</string> <string name="toast_pleaseWait">Please wait…</string>
<!-- Something happened (use '.') -->
<string name="toast_sdInaccessible">SD card not accessible (disconnect USB cable and try again).</string>
<string name="actionShare_title">Share</string>
<string name="categoryLibrary_title">Library</string>
<string name="categoryDisplay_title">Display</string>
<string name="categoryAudio_title">Audio</string>
<string name="categoryData_title">Data</string>
<!-- About -->
<string name="info">Information</string>
<string name="app_name_full">Project64 for Android</string>
<string name="licence">License</string>
<string name="revision">Revision</string>
<string name="about">About</string>
<string name="about_text">Project64 for Android™ is a port of the windows version of project64. The Android™ version can play most N64 games.</string>
<string name="Project64_authors">Project64 Authors.</string>
<string name="about_link" translatable="false"> &lt;a href=&quot;www.pj64-emu.com&quot;&gt;www.pj64-emu.com&lt;/a&gt;</string>
<string name="about_copyright" translatable="false">Copyleft &#169; 1998&#8211;2016 by Project64.\n</string>
<string name="authors" translatable="false">Zilmar, Jabo, Smiff, Gent, Jahra!n, Witten, RadeonUser, Trotterwatch, pixi, Azimer, Gonetz, cxd4, AmbientMalice, LegendOfDragoon, Nekokabu, Lithium64, death-droid, LuigiBlood, dsx.</string>
<!-- Gallery sections -->
<string name="galleryRecentlyPlayed">Recently played</string>
<string name="galleryLibrary">Games</string>
<!-- Seek Bar Preference -->
<string name="seekBarPreference_summary">%1$d %2$s</string>
<!-- Input Mapping --> <!-- Input Mapping -->
<string name="inputMapActivity_popupMessage">Press a button, key, or joystick to map…\n\nCurrent mappings:\n%1$s</string> <string name="inputMapActivity_popupMessage">Press a button, key, or joystick to map…\n\nCurrent mappings:\n%1$s</string>
<string name="inputMapActivity_popupUnmap">Unmap</string> <string name="inputMapActivity_popupUnmap">Unmap</string>
@ -125,8 +56,8 @@
<string name="debuggerEnabled_summary">Enable/Disable extra options to try and debug why games do not work</string> <string name="debuggerEnabled_summary">Enable/Disable extra options to try and debug why games do not work</string>
<string name="BlockLinking_title">Advanced Block Linking</string> <string name="BlockLinking_title">Advanced Block Linking</string>
<string name="BlockLinking_summary">Precompile blocks together</string> <string name="BlockLinking_summary">Precompile blocks together</string>
<string name="GenerateLogFiles_title">Generate Log Files</string> <string name="RecordRecompilerAsm_title">Record Recompiler Asm</string>
<string name="GenerateLogFiles_summary">Log recompiler code</string> <string name="RecordRecompilerAsm_summary">Create a log file of the asm generated</string>
<string name="logging">Logging</string> <string name="logging">Logging</string>
<string name="project64core">Project64 Core</string> <string name="project64core">Project64 Core</string>
<string name="AudioPlugin">Audio Plugin</string> <string name="AudioPlugin">Audio Plugin</string>
@ -183,6 +114,8 @@
<string name="ForceGfxReset_summary">Always reload GFX plugin</string> <string name="ForceGfxReset_summary">Always reload GFX plugin</string>
<string name="PreAllocSyncMem_title">Pre Alloc Sync Mem</string> <string name="PreAllocSyncMem_title">Pre Alloc Sync Mem</string>
<string name="PreAllocSyncMem_summary">Allocate sync memory at startup</string> <string name="PreAllocSyncMem_summary">Allocate sync memory at startup</string>
<string name="DebugLanguage_title">Debug Language</string>
<string name="DebugLanguage_summary">Show the number id for the language string</string>
<string name="touchscreenScale_title">Button scale</string> <string name="touchscreenScale_title">Button scale</string>
<string name="touchscreenLayout_title">Touchscreen layout</string> <string name="touchscreenLayout_title">Touchscreen layout</string>
<string name="gamepad_summary">Configure gamepad to use in game</string> <string name="gamepad_summary">Configure gamepad to use in game</string>
@ -221,14 +154,6 @@
<item>@string/TraceDebug</item> <item>@string/TraceDebug</item>
<item>@string/TraceVerbose</item> <item>@string/TraceVerbose</item>
</string-array> </string-array>
<string-array name="trace_severity_values" translatable="false">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
</string-array>
<!-- Confirmation Dialogs --> <!-- Confirmation Dialogs -->
<string name="confirmResetGame_title">Reset game?</string> <string name="confirmResetGame_title">Reset game?</string>
@ -245,21 +170,5 @@
<string name="assetExtractor_failed">Error extracting app data.\nPlease unplug USB cable, reboot device, and re-launch app.\nFor help, please visit %1$s.</string> <string name="assetExtractor_failed">Error extracting app data.\nPlease unplug USB cable, reboot device, and re-launch app.\nFor help, please visit %1$s.</string>
<!-- Game Directory Dialog --> <!-- Game Directory Dialog -->
<string name="scanRomsDialog_selectDir">Select an folder to scan</string>
<string name="scanRomsDialog_scanRecursively">Include subdirectories</string>
<!-- ROM Scanning -->
<string name="scanning_title">Scanning…</string> <string name="scanning_title">Scanning…</string>
<string name="scanning_directories">Directories</string>
<string name="scanning_internal_memory">Internal memory</string>
<!-- ROM information calculation -->
<string name="cacheRomInfo_searching">Searching…</string>
<string name="cacheRomInfo_computingMD5">Computing MD5…</string>
<string name="cacheRomInfo_searchingDB">Searching ROM database…</string>
<string name="cacheRomInfo_refreshingUI">Refreshing UI…</string>
<!-- Path Preference -->
<string name="pathPreference_parentFolder">Parent folder</string>
</resources> </resources>

View File

@ -11,9 +11,9 @@
android:summary="@string/debuggerEnabled_summary" android:summary="@string/debuggerEnabled_summary"
android:title="@string/debuggerEnabled_title" /> android:title="@string/debuggerEnabled_title" />
<CheckBoxPreference <CheckBoxPreference
android:key="Debugger_GenerateLogFiles" android:key="Debugger_RecordRecompilerAsm"
android:summary="@string/GenerateLogFiles_summary" android:summary="@string/RecordRecompilerAsm_summary"
android:title="@string/GenerateLogFiles_title" /> android:title="@string/RecordRecompilerAsm_title" />
<CheckBoxPreference <CheckBoxPreference
android:key="Debugger_LimitFPS" android:key="Debugger_LimitFPS"
android:summary="@string/LimitFPS_summary" android:summary="@string/LimitFPS_summary"
@ -34,6 +34,10 @@
android:key="PreAllocSyncMem" android:key="PreAllocSyncMem"
android:summary="@string/PreAllocSyncMem_summary" android:summary="@string/PreAllocSyncMem_summary"
android:title="@string/PreAllocSyncMem_title" /> android:title="@string/PreAllocSyncMem_title" />
<CheckBoxPreference
android:key="Debugger_DebugLanguage"
android:summary="@string/DebugLanguage_summary"
android:title="@string/DebugLanguage_title" />
<PreferenceCategory android:title="@string/logging" > <PreferenceCategory android:title="@string/logging" >
<Preference <Preference
android:title="@string/project64core" android:title="@string/project64core"

View File

@ -13,8 +13,10 @@ package emu.project64;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.util.Strings;
import emu.project64.util.Utility; import emu.project64.util.Utility;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TabLayout; import android.support.design.widget.TabLayout;
@ -58,7 +60,7 @@ public class AboutActivity extends AppCompatActivity
WebView webView = (WebView)findViewById(R.id.webview); WebView webView = (WebView)findViewById(R.id.webview);
List<View> lists = Arrays.asList(aboutMain, webView); List<View> lists = Arrays.asList(aboutMain, webView);
String[] titles = new String[] {getString(R.string.about), getString(R.string.licence)}; String[] titles = new String[] {Strings.GetString(LanguageStringID.ANDROID_ABOUT), Strings.GetString(LanguageStringID.ANDROID_ABOUT_LICENCE)};
ViewPager viewPager = (ViewPager) findViewById(R.id.pager); ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
viewPager.setOffscreenPageLimit(MODE_TOTAL-1); viewPager.setOffscreenPageLimit(MODE_TOTAL-1);
viewPager.setAdapter(new AboutPagerAdapter(lists, titles)); viewPager.setAdapter(new AboutPagerAdapter(lists, titles));
@ -69,6 +71,15 @@ public class AboutActivity extends AppCompatActivity
TextView link = (TextView)findViewById(R.id.main_link); TextView link = (TextView)findViewById(R.id.main_link);
link.setText(Html.fromHtml(getString(R.string.about_link))); link.setText(Html.fromHtml(getString(R.string.about_link)));
TextView app_name_full = (TextView)findViewById(R.id.app_name_full);
app_name_full.setText(Strings.GetString(LanguageStringID.ANDROID_ABOUT_APP_NAME));
TextView about_text = (TextView)findViewById(R.id.about_text);
about_text.setText(Strings.GetString(LanguageStringID.ANDROID_ABOUT_TEXT));
TextView Project64_authors = (TextView)findViewById(R.id.Project64_authors);
Project64_authors.setText(Strings.GetString(LanguageStringID.ANDROID_ABOUT_PJ64_AUTHORS));
webView.loadData(Utility.readAsset("licence.htm", ""), "text/html", "UTF8"); webView.loadData(Utility.readAsset("licence.htm", ""), "text/html", "UTF8");
} }

View File

@ -31,12 +31,14 @@ import emu.project64.inAppPurchase.IabHelper.IabAsyncInProgressException;
import emu.project64.inAppPurchase.IabResult; import emu.project64.inAppPurchase.IabResult;
import emu.project64.inAppPurchase.Inventory; import emu.project64.inAppPurchase.Inventory;
import emu.project64.inAppPurchase.Purchase; import emu.project64.inAppPurchase.Purchase;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent; import emu.project64.jni.SystemEvent;
import emu.project64.jni.UISettingID; import emu.project64.jni.UISettingID;
import emu.project64.settings.GameSettingsActivity; import emu.project64.settings.GameSettingsActivity;
import emu.project64.settings.SettingsActivity; import emu.project64.settings.SettingsActivity;
import emu.project64.util.Strings;
import emu.project64.util.Utility; import emu.project64.util.Utility;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
@ -224,7 +226,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
// Configure the navigation drawer // Configure the navigation drawer
mDrawerLayout = (DrawerLayout) findViewById( R.id.drawerLayout ); mDrawerLayout = (DrawerLayout) findViewById( R.id.drawerLayout );
mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, toolbar, 0, 0 ); mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, toolbar, 0, 0 );
mDrawerLayout.setDrawerListener( mDrawerToggle ); mDrawerLayout.addDrawerListener( mDrawerToggle );
// Configure the list in the navigation drawer // Configure the list in the navigation drawer
mDrawerList = (MenuListView) findViewById( R.id.drawerNavigation ); mDrawerList = (MenuListView) findViewById( R.id.drawerNavigation );
@ -238,6 +240,15 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
GalleryActivity.this.onOptionsItemSelected( menuItem ); GalleryActivity.this.onOptionsItemSelected( menuItem );
} }
}); });
UpdateLanguage();
}
void UpdateLanguage()
{
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_settings, LanguageStringID.ANDROID_SETTINGS);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_forum, LanguageStringID.ANDROID_FORUM);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_reportBug, LanguageStringID.ANDROID_REPORT_BUG);
Strings.SetMenuTitle(mDrawerList.getMenu(), R.id.menuItem_about, LanguageStringID.ANDROID_ABOUT);
} }
// Enables or disables the "please wait" screen. // Enables or disables the "please wait" screen.
@ -427,6 +438,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
public boolean onCreateOptionsMenu( Menu menu ) public boolean onCreateOptionsMenu( Menu menu )
{ {
getMenuInflater().inflate( R.menu.gallery_activity, menu ); getMenuInflater().inflate( R.menu.gallery_activity, menu );
Strings.SetMenuTitle(menu, R.id.menuItem_gameDir, LanguageStringID.ANDROID_GAMEDIR);
return super.onCreateOptionsMenu( menu ); return super.onCreateOptionsMenu( menu );
} }
@ -745,10 +757,10 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
if (mRecentItems.size() > 0) if (mRecentItems.size() > 0)
{ {
items.add( new GalleryItem( this, getString( R.string.galleryRecentlyPlayed ) ) ); items.add( new GalleryItem( this, Strings.GetString(LanguageStringID.ANDROID_GALLERY_RECENTLYPLAYED)));
items.addAll( mRecentItems ); items.addAll( mRecentItems );
items.add( new GalleryItem( this, getString( R.string.galleryLibrary ) ) ); items.add( new GalleryItem( this, Strings.GetString(LanguageStringID.ANDROID_GALLERY_LIBRARY)));
} }
Collections.sort( mGalleryItems, new GalleryItem.NameComparator() ); Collections.sort( mGalleryItems, new GalleryItem.NameComparator() );
items.addAll( mGalleryItems ); items.addAll( mGalleryItems );
@ -1008,6 +1020,15 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
this.startActivity( intent ); this.startActivity( intent );
} }
public static void LanguageChanged()
{
if (mActiveGalleryActivity != null)
{
mActiveGalleryActivity.finish();
mActiveGalleryActivity.startActivity( mActiveGalleryActivity.getIntent() );
}
}
public static void RomListReset () public static void RomListReset ()
{ {
mGalleryItems = new ArrayList<GalleryItem>(); mGalleryItems = new ArrayList<GalleryItem>();

View File

@ -115,6 +115,11 @@ public class MenuListView extends ExpandableListView
} ); } );
} }
public Menu getMenu()
{
return mListData;
}
public void reload() public void reload()
{ {
mAdapter.notifyDataSetChanged(); mAdapter.notifyDataSetChanged();

View File

@ -15,9 +15,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import emu.project64.R; import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.util.FileUtil; import emu.project64.util.FileUtil;
import emu.project64.util.Strings;
import android.content.Intent; import android.content.Intent;
import android.content.Context; import android.content.Context;
import android.text.Html; import android.text.Html;
@ -45,7 +47,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
private List<CharSequence> mNames; private List<CharSequence> mNames;
private List<String> mPaths; private List<String> mPaths;
private CheckBox mCheckBox1; private CheckBox mScanRecursively;
private Button mCancelButton; private Button mCancelButton;
private Button mOkButton; private Button mOkButton;
@ -65,12 +67,16 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
mCurrentPath = CurrentPath; mCurrentPath = CurrentPath;
} }
} }
TextView selectDir = (TextView)findViewById(R.id.scanRomsDialog_selectDir);
selectDir.setText(Strings.GetString(LanguageStringID.ANDROID_SELECTDIR));
// Set check box state // Set check box state
mCheckBox1 = (CheckBox) findViewById( R.id.checkBox1 ); mScanRecursively = (CheckBox) findViewById( R.id.ScanRecursively );
mCheckBox1.setChecked( NativeExports.SettingsLoadBool(SettingsID.RomList_GameDirRecursive.getValue()) ); mScanRecursively.setChecked( NativeExports.SettingsLoadBool(SettingsID.RomList_GameDirRecursive.getValue()) );
mScanRecursively.setText(Strings.GetString(LanguageStringID.ANDROID_INCLUDE_SUBDIRECTORIES));
mCancelButton = (Button) findViewById( R.id.buttonCancel ); mCancelButton = (Button) findViewById( R.id.buttonCancel );
mCancelButton.setText(Strings.GetString(LanguageStringID.ANDROID_CANCEL));
mCancelButton.setOnClickListener(new View.OnClickListener() mCancelButton.setOnClickListener(new View.OnClickListener()
{ {
public void onClick(View v) public void onClick(View v)
@ -81,6 +87,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
}); });
mOkButton = (Button) findViewById( R.id.buttonOk ); mOkButton = (Button) findViewById( R.id.buttonOk );
mOkButton.setText(Strings.GetString(LanguageStringID.ANDROID_OK));
mOkButton.setOnClickListener(new View.OnClickListener() mOkButton.setOnClickListener(new View.OnClickListener()
{ {
public void onClick(View v) public void onClick(View v)
@ -88,7 +95,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
Intent data = new Intent(); Intent data = new Intent();
data.putExtra(GAME_DIR_PATH, mCurrentPath.getPath()); data.putExtra(GAME_DIR_PATH, mCurrentPath.getPath());
data.putExtra(GAME_DIR_RECURSIVELY, mCheckBox1.isChecked()); data.putExtra(GAME_DIR_RECURSIVELY, mScanRecursively.isChecked());
ScanRomsActivity.this.setResult(RESULT_OK, data); ScanRomsActivity.this.setResult(RESULT_OK, data);
ScanRomsActivity.this.finish(); ScanRomsActivity.this.finish();
} }
@ -110,7 +117,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
{ {
if (path.startsWith(directory)) if (path.startsWith(directory))
{ {
String BaseDir = TextUtils.equals(AndroidDevice.EXTERNAL_PUBLIC_DIRECTORY, directory) ? getString(R.string.scanning_internal_memory) : new File(directory).getName(); String BaseDir = TextUtils.equals(AndroidDevice.EXTERNAL_PUBLIC_DIRECTORY, directory) ? Strings.GetString(LanguageStringID.ANDROID_INTERNAL_MEMORY) : new File(directory).getName();
path = BaseDir + path.substring(directory.length()); path = BaseDir + path.substring(directory.length());
break; break;
} }
@ -121,13 +128,13 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
} }
else else
{ {
setTitle( getString(R.string.scanning_directories) ); setTitle( Strings.GetString(LanguageStringID.ANDROID_DIRECTORIES) );
mPaths = StorageDirectories; mPaths = StorageDirectories;
for( String directory : mPaths ) for( String directory : mPaths )
{ {
if (TextUtils.equals(AndroidDevice.EXTERNAL_PUBLIC_DIRECTORY, directory)) if (TextUtils.equals(AndroidDevice.EXTERNAL_PUBLIC_DIRECTORY, directory))
{ {
mNames.add( Html.fromHtml( "<b>" + getString(R.string.scanning_internal_memory) + "</b>" ) ); mNames.add( Html.fromHtml( "<b>" + Strings.GetString(LanguageStringID.ANDROID_INTERNAL_MEMORY) + "</b>" ) );
} }
else else
{ {
@ -261,7 +268,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
String name = names.get( position ).toString(); String name = names.get( position ).toString();
if( name.equals( ".." ) ) if( name.equals( ".." ) )
{ {
text1.setText( R.string.pathPreference_parentFolder ); text1.setText( Strings.GetString(LanguageStringID.ANDROID_PARENTFOLDER) );
icon.setVisibility( View.VISIBLE ); icon.setVisibility( View.VISIBLE );
icon.setImageResource( R.drawable.ic_arrow_u ); icon.setImageResource( R.drawable.ic_arrow_u );
} }

View File

@ -15,10 +15,12 @@ import java.sql.Date;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import emu.project64.R; import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID; import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent; import emu.project64.jni.SystemEvent;
import emu.project64.settings.SettingsActivity; import emu.project64.settings.SettingsActivity;
import emu.project64.util.Strings;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@ -70,6 +72,20 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue()); int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue());
Menu menu = popupMenu.getMenu(); Menu menu = popupMenu.getMenu();
Strings.SetMenuTitle(menu, R.id.menuItem_SaveState, LanguageStringID.ANDROID_MENU_SAVESTATE);
Strings.SetMenuTitle(menu, R.id.menuItem_LoadState, LanguageStringID.ANDROID_MENU_LOADSTATE);
Strings.SetMenuTitle(menu, R.id.menuItem_CurrentSaveState, LanguageStringID.ANDROID_MENU_CURRENTSAVESTATE);
Strings.SetMenuTitle(menu, R.id.menuItem_CurrentSaveAuto, LanguageStringID.ANDROID_MENU_CURRENTSAVESTATE);
Strings.SetMenuTitle(menu, R.id.menuItem_GameSpeed, LanguageStringID.ANDROID_MENU_GAMESPEED);
Strings.SetMenuTitle(menu, R.id.menuItem_settings, LanguageStringID.ANDROID_MENU_SETTINGS);
Strings.SetMenuTitle(menu, R.id.menuItem_DebuggingMenu, LanguageStringID.ANDROID_MENU_DEBUGGINGOPTIONS);
Strings.SetMenuTitle(menu, R.id.menuItem_ResetFunctionTimes, LanguageStringID.ANDROID_MENU_RESETFUNCTIONTIMES);
Strings.SetMenuTitle(menu, R.id.menuItem_DumpFunctionTimes, LanguageStringID.ANDROID_MENU_DUMPFUNCTIONTIMES);
Strings.SetMenuTitle(menu, R.id.menuItem_pause, LanguageStringID.ANDROID_MENU_PAUSE);
Strings.SetMenuTitle(menu, R.id.menuItem_resume, LanguageStringID.ANDROID_MENU_RESUME);
Strings.SetMenuTitle(menu, R.id.menuItem_HardReset, LanguageStringID.ANDROID_MENU_CONSOLERESET);
Strings.SetMenuTitle(menu, R.id.menuItem_EndEmulation, LanguageStringID.ANDROID_MENU_ENDEMULATION);
menu.findItem(R.id.menuItem_pause).setVisible(GamePaused ? false : true); menu.findItem(R.id.menuItem_pause).setVisible(GamePaused ? false : true);
menu.findItem(R.id.menuItem_resume).setVisible(GamePaused ? true : false); menu.findItem(R.id.menuItem_resume).setVisible(GamePaused ? true : false);
menu.findItem(R.id.menuItem_ResetFunctionTimes).setVisible(RecordExecutionTimes); menu.findItem(R.id.menuItem_ResetFunctionTimes).setVisible(RecordExecutionTimes);
@ -211,7 +227,8 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
{ {
Timestamp = new SimpleDateFormat(" [yyyy/MM/dd HH:mm]").format(new Date(LastModified)); Timestamp = new SimpleDateFormat(" [yyyy/MM/dd HH:mm]").format(new Date(LastModified));
} }
String SlotName = SaveSlot == 0 ? "Auto" : "Slot " + SaveSlot; String SlotName = SaveSlot == 0 ? Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVEAUTO) :
Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVESLOT) + " " + SaveSlot;
item.setTitle(SlotName + Timestamp); item.setTitle(SlotName + Timestamp);
} }
@ -246,7 +263,7 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
}); });
Builder builder = new Builder(mActivity); Builder builder = new Builder(mActivity);
builder.setTitle(mActivity.getText( R.string.menuItem_GameSpeed )); builder.setTitle(Strings.GetString(LanguageStringID.ANDROID_MENU_GAMESPEED));
builder.setPositiveButton("Cancel", null); builder.setPositiveButton("Cancel", null);
builder.setNeutralButton("OK", null); builder.setNeutralButton("OK", null);
builder.setNegativeButton("Reset", null); builder.setNegativeButton("Reset", null);

View File

@ -11,6 +11,7 @@
package emu.project64.settings; package emu.project64.settings;
import emu.project64.AndroidDevice; import emu.project64.AndroidDevice;
import emu.project64.GalleryActivity;
import emu.project64.R; import emu.project64.R;
import emu.project64.jni.AudioSettingID; import emu.project64.jni.AudioSettingID;
import emu.project64.jni.NativeExports; import emu.project64.jni.NativeExports;
@ -59,11 +60,12 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
.putBoolean("Plugin_ForceGfxReset",NativeExports.SettingsLoadBool(SettingsID.Plugin_ForceGfxReset.getValue())) .putBoolean("Plugin_ForceGfxReset",NativeExports.SettingsLoadBool(SettingsID.Plugin_ForceGfxReset.getValue()))
.putBoolean("UserInterface_BasicMode",NativeExports.SettingsLoadBool(SettingsID.UserInterface_BasicMode.getValue())) .putBoolean("UserInterface_BasicMode",NativeExports.SettingsLoadBool(SettingsID.UserInterface_BasicMode.getValue()))
.putBoolean("Debugger_Enabled",NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.getValue())) .putBoolean("Debugger_Enabled",NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.getValue()))
.putBoolean("Debugger_GenerateLogFiles",NativeExports.SettingsLoadBool(SettingsID.Debugger_GenerateLogFiles.getValue())) .putBoolean("Debugger_RecordRecompilerAsm",NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordRecompilerAsm.getValue()))
.putBoolean("Debugger_LimitFPS",NativeExports.SettingsLoadBool(SettingsID.GameRunning_LimitFPS.getValue())) .putBoolean("Debugger_LimitFPS",NativeExports.SettingsLoadBool(SettingsID.GameRunning_LimitFPS.getValue()))
.putBoolean("Debugger_DisplaySpeed",NativeExports.SettingsLoadBool(SettingsID.UserInterface_DisplayFrameRate.getValue())) .putBoolean("Debugger_DisplaySpeed",NativeExports.SettingsLoadBool(SettingsID.UserInterface_DisplayFrameRate.getValue()))
.putBoolean("Debugger_CpuUsage",NativeExports.SettingsLoadBool(SettingsID.UserInterface_ShowCPUPer.getValue())) .putBoolean("Debugger_CpuUsage",NativeExports.SettingsLoadBool(SettingsID.UserInterface_ShowCPUPer.getValue()))
.putBoolean("Debugger_RecordExecutionTimes",NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordExecutionTimes.getValue())) .putBoolean("Debugger_RecordExecutionTimes",NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordExecutionTimes.getValue()))
.putBoolean("Debugger_DebugLanguage",NativeExports.SettingsLoadBool(SettingsID.Debugger_DebugLanguage.getValue()))
.putString("Debugger_DisplaySpeedType",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.UserInterface_FrameDisplayType.getValue()))) .putString("Debugger_DisplaySpeedType",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.UserInterface_FrameDisplayType.getValue())))
.putString("Debugger_TraceMD5",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceMD5.getValue()))) .putString("Debugger_TraceMD5",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceMD5.getValue())))
.putString("Debugger_TraceThread",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceThread.getValue()))) .putString("Debugger_TraceThread",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceThread.getValue())))
@ -130,13 +132,18 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
getSupportFragmentManager().popBackStackImmediate(); getSupportFragmentManager().popBackStackImmediate();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, new SettingsFragment()).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, new SettingsFragment()).commit();
} }
else if (key.equals("Debugger_DebugLanguage"))
{
NativeExports.SettingsSaveBool(SettingsID.Debugger_DebugLanguage.getValue(), sharedPreferences.getBoolean(key,false));
GalleryActivity.LanguageChanged();
}
else if (key.equals("touchscreenScale")) { NativeExports.UISettingsSaveDword(UISettingID.TouchScreen_ButtonScale.getValue(), sharedPreferences.getInt(key, 100)); } else if (key.equals("touchscreenScale")) { NativeExports.UISettingsSaveDword(UISettingID.TouchScreen_ButtonScale.getValue(), sharedPreferences.getInt(key, 100)); }
else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); } else if (key.equals("touchscreenLayout")) { NativeExports.UISettingsSaveString(UISettingID.TouchScreen_Layout.getValue(), sharedPreferences.getString(key, "Analog")); }
else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("audio_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_EnableAudio.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Plugin_ForceGfxReset")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_ForceGfxReset.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Plugin_ForceGfxReset")) { NativeExports.SettingsSaveBool(SettingsID.Plugin_ForceGfxReset.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("PreAllocSyncMem")) { NativeExports.SettingsSaveBool(SettingsID.Setting_PreAllocSyncMem.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_Enabled.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_Enabled")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_Enabled.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_GenerateLogFiles")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_GenerateLogFiles.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_RecordRecompilerAsm")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_RecordRecompilerAsm.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_CpuUsage")) { NativeExports.SettingsSaveBool(SettingsID.UserInterface_ShowCPUPer.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_CpuUsage")) { NativeExports.SettingsSaveBool(SettingsID.UserInterface_ShowCPUPer.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_RecordExecutionTimes")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_RecordExecutionTimes.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_RecordExecutionTimes")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_RecordExecutionTimes.getValue(), sharedPreferences.getBoolean(key,false)); }
else if (key.equals("Debugger_LimitFPS")) { NativeExports.SettingsSaveBool(SettingsID.GameRunning_LimitFPS.getValue(), sharedPreferences.getBoolean(key,false)); } else if (key.equals("Debugger_LimitFPS")) { NativeExports.SettingsSaveBool(SettingsID.GameRunning_LimitFPS.getValue(), sharedPreferences.getBoolean(key,false)); }
@ -149,50 +156,17 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
else if (key.equals("Debugger_TraceUnknown")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUnknown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceUnknown")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUnknown.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceAppInit")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAppInit.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceAppInit")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAppInit.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceAppCleanup")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAppCleanup.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceAppCleanup")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAppCleanup.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceN64System")) else if (key.equals("Debugger_TraceN64System")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceN64System.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
{ else if (key.equals("Debugger_TracePlugins")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TracePlugins.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceN64System.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); else if (key.equals("Debugger_TraceGFXPlugin")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceGFXPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
} else if (key.equals("Debugger_TraceAudioPlugin")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAudioPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TracePlugins")) else if (key.equals("Debugger_TraceControllerPlugin")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceControllerPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
{ else if (key.equals("Debugger_TraceRSPPlugin")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRSPPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
NativeExports.SettingsSaveDword(SettingsID.Debugger_TracePlugins.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); else if (key.equals("Debugger_TraceRSP")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRSP.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
} else if (key.equals("Debugger_TraceAudio")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAudio.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceGFXPlugin")) else if (key.equals("Debugger_TraceRegisterCache")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRegisterCache.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
{ else if (key.equals("Debugger_TraceRecompiler")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRecompiler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceGFXPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); else if (key.equals("Debugger_TraceTLB")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceTLB.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
}
else if (key.equals("Debugger_TraceAudioPlugin"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAudioPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceControllerPlugin"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceControllerPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceRSPPlugin"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRSPPlugin.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceRSP"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRSP.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceAudio"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceAudio.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceRegisterCache"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRegisterCache.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceRecompiler"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRecompiler.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceTLB"))
{
NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceTLB.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1")));
}
else if (key.equals("Debugger_TraceProtectedMEM")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceProtectedMEM.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceProtectedMEM")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceProtectedMEM.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceUserInterface")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUserInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceUserInterface")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceUserInterface.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }
else if (key.equals("Debugger_TraceRomList")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRomList.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); } else if (key.equals("Debugger_TraceRomList")) { NativeExports.SettingsSaveDword(SettingsID.Debugger_TraceRomList.getValue(), Integer.valueOf(sharedPreferences.getString(key, "1"))); }

View File

@ -10,8 +10,14 @@
****************************************************************************/ ****************************************************************************/
package emu.project64.util; package emu.project64.util;
import java.nio.charset.Charset;
import java.util.List; import java.util.List;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports;
import android.view.Menu;
import android.view.MenuItem;
public class Strings public class Strings
{ {
static public boolean startsWith(String[] array, String text) static public boolean startsWith(String[] array, String text)
@ -37,4 +43,20 @@ public class Strings
} }
return -1; return -1;
} }
static public String GetString(LanguageStringID StringId)
{
byte[] bytes = NativeExports.GetString(StringId.getValue());
return (bytes.length > 0 ? new String(bytes, Charset.forName("UTF8")) : new String("#" + Integer.toString(StringId.getValue()) + "#"));
}
static public void SetMenuTitle(Menu menu, int MenuItemID, LanguageStringID StringId)
{
MenuItem menuitem = menu.findItem(MenuItemID);
if (menuitem == null)
{
return;
}
menuitem.setTitle(GetString(StringId));
}
} }

View File

@ -517,3 +517,45 @@
#2055# "Graphics LLE is not for general use!!!\nIt is advisable that you only use this for testing and not for playing games.\n\nChange to graphics LLE?" #2055# "Graphics LLE is not for general use!!!\nIt is advisable that you only use this for testing and not for playing games.\n\nChange to graphics LLE?"
#2056# "Audio High-Level Emulation" #2056# "Audio High-Level Emulation"
#2057# "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?" #2057# "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?"
/*********************************************************************************
* Android *
*********************************************************************************/
#3000# "Settings"
#3001# "Help/Forum"
#3002# "Report Issue"
#3003# "About"
#3004# "Recently played"
#3005# "Games"
#3006# "Game Dir"
#3007# "Select an folder to scan"
#3008# "Include subdirectories"
#3009# "Parent folder"
#3010# "Directories"
#3011# "Internal memory"
#3012# "Scanning..."
#3013# "OK"
#3014# "Cancel"
#3015# "Information"
#3016# "Project64 for Android"
#3017# "License"
#3018# "Revision"
#3019# "Project64 for Android\u2122 is a port of the windows version of project64.The Android\u2122 version can play most N64 games."
#3020# "Project64 Authors."
//In game menu
#3100# "Settings"
#3101# "Save State"
#3102# "Load State"
#3103# "End Emulation"
#3104# "Pause"
#3105# "Resume"
#3106# "Game Speed"
#3107# "Current Save State..."
#3108# "Auto"
#3109# "Slot"
#3110# "Reset"
#3111# "Debugging Options"
#3112# "Reset Function Times"
#3113# "Dump Function Times"

View File

@ -443,6 +443,27 @@ EXPORT void CALL Java_emu_project64_jni_NativeExports_ResetApplicationSettings(J
WriteTrace(TraceUserInterface, TraceDebug, "Done"); WriteTrace(TraceUserInterface, TraceDebug, "Done");
} }
EXPORT jbyteArray CALL Java_emu_project64_jni_NativeExports_GetString(JNIEnv* env, jclass cls, int StringID)
{
WriteTrace(TraceUserInterface, TraceDebug, "start (StringID: %d)", StringID);
jbyteArray result = NULL;
if (g_Lang)
{
std::string ResultStr = g_Lang->GetString((LanguageStringID)StringID);
result = env->NewByteArray(ResultStr.length());
if (result)
{
env->SetByteArrayRegion(result, 0, ResultStr.length(), (const jbyte *)ResultStr.c_str());
}
}
else
{
WriteTrace(TraceUserInterface, TraceWarning, "g_Lang not set");
}
WriteTrace(TraceUserInterface, TraceDebug, "Done");
return result;
}
EXPORT void CALL Java_emu_project64_jni_NativeExports_SetSpeed(JNIEnv* env, jclass cls, int Speed) EXPORT void CALL Java_emu_project64_jni_NativeExports_SetSpeed(JNIEnv* env, jclass cls, int Speed)
{ {
WriteTrace(TraceUserInterface, TraceDebug, "start (Speed: %d)", Speed); WriteTrace(TraceUserInterface, TraceDebug, "start (Speed: %d)", Speed);

View File

@ -79,9 +79,9 @@ enum LanguageStringID
MENU_CHEAT = 130, MENU_CHEAT = 130,
MENU_GS_BUTTON = 131, MENU_GS_BUTTON = 131,
MENU_RESUME = 132, MENU_RESUME = 132,
MENU_RESET_SOFT = 133, //added in build 1.7.50 MENU_RESET_SOFT = 133,
MENU_RESET_HARD = 134, //added in build 1.7.50 MENU_RESET_HARD = 134,
MENU_SWAPDISK = 135, //added in build 2.2.???? MENU_SWAPDISK = 135,
//Options Menu //Options Menu
MENU_OPTIONS = 140, MENU_OPTIONS = 140,
@ -535,19 +535,60 @@ enum LanguageStringID
MSG_DEL_TITLE = 2042, MSG_DEL_TITLE = 2042,
MSG_CHEAT_NAME_IN_USE = 2043, MSG_CHEAT_NAME_IN_USE = 2043,
MSG_MAX_CHEATS = 2044, MSG_MAX_CHEATS = 2044,
MSG_PLUGIN_INIT = 2045, //Added in pj64 1.6 MSG_PLUGIN_INIT = 2045,
MSG_NO_SHORTCUT_SEL = 2046, //Added in pj64 1.6 MSG_NO_SHORTCUT_SEL = 2046,
MSG_NO_MENUITEM_SEL = 2047, //Added in pj64 1.6 MSG_NO_MENUITEM_SEL = 2047,
MSG_MENUITEM_ASSIGNED = 2048, //Added in pj64 1.6 MSG_MENUITEM_ASSIGNED = 2048,
MSG_NO_SEL_SHORTCUT = 2049, //Added in pj64 1.6 MSG_NO_SEL_SHORTCUT = 2049,
MSG_WAITING_FOR_START = 2050, //Added in pj64 1.7 MSG_WAITING_FOR_START = 2050,
MSG_INVALID_EXE = 2051, //Added in pj64 1.7 MSG_INVALID_EXE = 2051,
MSG_INVALID_EXE_TITLE = 2052, //Added in pj64 1.7 MSG_INVALID_EXE_TITLE = 2052,
MSG_7Z_FILE_NOT_FOUND = 2053, //Added in pj64 1.7 MSG_7Z_FILE_NOT_FOUND = 2053,
MSG_SET_LLE_GFX_TITLE = 2054, //Added in pj64 1.7 MSG_SET_LLE_GFX_TITLE = 2054,
MSG_SET_LLE_GFX_MSG = 2055, //Added in pj64 1.7 MSG_SET_LLE_GFX_MSG = 2055,
MSG_SET_HLE_AUD_TITLE = 2056, //Added in pj64 1.7 MSG_SET_HLE_AUD_TITLE = 2056,
MSG_SET_HLE_AUD_MSG = 2057, //Added in pj64 1.7 MSG_SET_HLE_AUD_MSG = 2057,
/*********************************************************************************
* Android *
*********************************************************************************/
ANDROID_SETTINGS = 3000,
ANDROID_FORUM = 3001,
ANDROID_REPORT_BUG = 3002,
ANDROID_ABOUT = 3003,
ANDROID_GALLERY_RECENTLYPLAYED = 3004,
ANDROID_GALLERY_LIBRARY = 3005,
ANDROID_GAMEDIR = 3006,
ANDROID_SELECTDIR = 3007,
ANDROID_INCLUDE_SUBDIRECTORIES = 3008,
ANDROID_PARENTFOLDER = 3009,
ANDROID_DIRECTORIES = 3010,
ANDROID_INTERNAL_MEMORY = 3011,
ANDROID_TITLE = 3012,
ANDROID_OK = 3013,
ANDROID_CANCEL = 3014,
ANDROID_ABOUT_INFO = 3015,
ANDROID_ABOUT_APP_NAME = 3016,
ANDROID_ABOUT_LICENCE = 3017,
ANDROID_ABOUT_REVISION = 3018,
ANDROID_ABOUT_TEXT = 3019,
ANDROID_ABOUT_PJ64_AUTHORS = 3020,
//In game menu
ANDROID_MENU_SETTINGS = 3100,
ANDROID_MENU_SAVESTATE = 3101,
ANDROID_MENU_LOADSTATE = 3102,
ANDROID_MENU_ENDEMULATION = 3103,
ANDROID_MENU_PAUSE = 3104,
ANDROID_MENU_RESUME = 3105,
ANDROID_MENU_GAMESPEED = 3106,
ANDROID_MENU_CURRENTSAVESTATE = 3107,
ANDROID_MENU_CURRENTSAVEAUTO = 3108,
ANDROID_MENU_CURRENTSAVESLOT = 3109,
ANDROID_MENU_CONSOLERESET = 3110,
ANDROID_MENU_DEBUGGINGOPTIONS = 3111,
ANDROID_MENU_RESETFUNCTIONTIMES = 3112,
ANDROID_MENU_DUMPFUNCTIONTIMES = 3113,
}; };
#include "Multilanguage/LanguageClass.h" #include "Multilanguage/LanguageClass.h"

View File

@ -516,6 +516,47 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(MSG_SET_LLE_GFX_MSG, "Graphics LLE is not for general use!!!\nIt is advisable that you only use this for testing and not for playing games.\n\nChange to graphics LLE?"); DEF_STR(MSG_SET_LLE_GFX_MSG, "Graphics LLE is not for general use!!!\nIt is advisable that you only use this for testing and not for playing games.\n\nChange to graphics LLE?");
DEF_STR(MSG_SET_HLE_AUD_TITLE, "Audio High-Level Emulation"); DEF_STR(MSG_SET_HLE_AUD_TITLE, "Audio High-Level Emulation");
DEF_STR(MSG_SET_HLE_AUD_MSG, "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?"); DEF_STR(MSG_SET_HLE_AUD_MSG, "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?");
/*********************************************************************************
* Android *
*********************************************************************************/
DEF_STR(ANDROID_SETTINGS, "Settings");
DEF_STR(ANDROID_FORUM, "Help/Forum");
DEF_STR(ANDROID_REPORT_BUG, "Report Issue");
DEF_STR(ANDROID_ABOUT, "About");
DEF_STR(ANDROID_GALLERY_RECENTLYPLAYED, "Recently played");
DEF_STR(ANDROID_GALLERY_LIBRARY, "Games");
DEF_STR(ANDROID_GAMEDIR, "Game Dir");
DEF_STR(ANDROID_SELECTDIR, "Select an folder to scan");
DEF_STR(ANDROID_INCLUDE_SUBDIRECTORIES, "Include subdirectories");
DEF_STR(ANDROID_PARENTFOLDER, "Parent folder");
DEF_STR(ANDROID_DIRECTORIES, "Directories");
DEF_STR(ANDROID_INTERNAL_MEMORY, "Internal memory");
DEF_STR(ANDROID_TITLE, "Scanning...");
DEF_STR(ANDROID_OK, "OK");
DEF_STR(ANDROID_CANCEL, "Cancel");
DEF_STR(ANDROID_ABOUT_INFO, "Information");
DEF_STR(ANDROID_ABOUT_APP_NAME, "Project64 for Android");
DEF_STR(ANDROID_ABOUT_LICENCE, "License");
DEF_STR(ANDROID_ABOUT_REVISION, "Revision");
DEF_STR(ANDROID_ABOUT_TEXT, "Project64 for Android\u2122 is a port of the windows version of project64.The Android\u2122 version can play most N64 games.");
DEF_STR(ANDROID_ABOUT_PJ64_AUTHORS, "Project64 Authors.");
//In game menu
DEF_STR(ANDROID_MENU_SETTINGS, "Settings");
DEF_STR(ANDROID_MENU_SAVESTATE, "Save State");
DEF_STR(ANDROID_MENU_LOADSTATE, "Load State");
DEF_STR(ANDROID_MENU_ENDEMULATION, "End Emulation");
DEF_STR(ANDROID_MENU_PAUSE, "Pause");
DEF_STR(ANDROID_MENU_RESUME, "Resume");
DEF_STR(ANDROID_MENU_GAMESPEED, "Game Speed");
DEF_STR(ANDROID_MENU_CURRENTSAVESTATE, "Current Save State...");
DEF_STR(ANDROID_MENU_CURRENTSAVEAUTO, "Auto");
DEF_STR(ANDROID_MENU_CURRENTSAVESLOT, "Slot");
DEF_STR(ANDROID_MENU_CONSOLERESET, "Reset");
DEF_STR(ANDROID_MENU_DEBUGGINGOPTIONS, "Debugging Options");
DEF_STR(ANDROID_MENU_RESETFUNCTIONTIMES, "Reset Function Times");
DEF_STR(ANDROID_MENU_DUMPFUNCTIONTIMES, "Dump Function Times");
} }
CLanguage::CLanguage() : CLanguage::CLanguage() :
@ -526,6 +567,15 @@ CLanguage::CLanguage() :
if (g_Settings) if (g_Settings)
{ {
m_SelectedLanguage = g_Settings->LoadStringVal(Setting_CurrentLanguage); m_SelectedLanguage = g_Settings->LoadStringVal(Setting_CurrentLanguage);
g_Settings->RegisterChangeCB(Debugger_DebugLanguage, this, (CSettings::SettingChangedFunc)StaticResetStrings);
}
}
CLanguage::~CLanguage()
{
if (g_Settings)
{
g_Settings->UnregisterChangeCB(Debugger_DebugLanguage, this, (CSettings::SettingChangedFunc)StaticResetStrings);
} }
} }
@ -759,6 +809,11 @@ bool CLanguage::IsCurrentLang(LanguageFile & File)
return false; return false;
} }
void CLanguage::ResetStrings(void)
{
m_CurrentStrings.clear();
}
#ifdef _WIN32 #ifdef _WIN32
const std::wstring wGS(LanguageStringID StringID) const std::wstring wGS(LanguageStringID StringID)
{ {

View File

@ -31,6 +31,7 @@ class CLanguage
{ {
public: public:
CLanguage(); CLanguage();
~CLanguage();
const std::string & GetString(LanguageStringID StringID); const std::string & GetString(LanguageStringID StringID);
LanguageList & GetLangList(void); LanguageList & GetLangList(void);
@ -43,6 +44,13 @@ private:
CLanguage(const CLanguage&); // Disable copy constructor CLanguage(const CLanguage&); // Disable copy constructor
CLanguage& operator=(const CLanguage&); // Disable assignment CLanguage& operator=(const CLanguage&); // Disable assignment
static void StaticResetStrings(CLanguage * _this)
{
_this->ResetStrings();
}
void ResetStrings(void);
std::string m_SelectedLanguage; std::string m_SelectedLanguage;
const std::string m_emptyString; const std::string m_emptyString;