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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,5 +14,22 @@
<string name="ControllerProfileActivity_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>
<!-- 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>

View File

@ -1,77 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<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 -->
<!-- ************************************************************************** -->
<resources>
<!-- Something happening (typically use '-ing' and '…') -->
<string name="toast_launchingEmulator">Launching emulator…</string>
<string name="toast_canceling">Canceling…</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 -->
<string name="inputMapActivity_popupMessage">Press a button, key, or joystick to map…\n\nCurrent mappings:\n%1$s</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="BlockLinking_title">Advanced Block Linking</string>
<string name="BlockLinking_summary">Precompile blocks together</string>
<string name="GenerateLogFiles_title">Generate Log Files</string>
<string name="GenerateLogFiles_summary">Log recompiler code</string>
<string name="RecordRecompilerAsm_title">Record Recompiler Asm</string>
<string name="RecordRecompilerAsm_summary">Create a log file of the asm generated</string>
<string name="logging">Logging</string>
<string name="project64core">Project64 Core</string>
<string name="AudioPlugin">Audio Plugin</string>
@ -183,6 +114,8 @@
<string name="ForceGfxReset_summary">Always reload GFX plugin</string>
<string name="PreAllocSyncMem_title">Pre Alloc Sync Mem</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="touchscreenLayout_title">Touchscreen layout</string>
<string name="gamepad_summary">Configure gamepad to use in game</string>
@ -221,14 +154,6 @@
<item>@string/TraceDebug</item>
<item>@string/TraceVerbose</item>
</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 -->
<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>
<!-- 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_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>

View File

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

View File

@ -13,8 +13,10 @@ package emu.project64;
import java.util.Arrays;
import java.util.List;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID;
import emu.project64.util.Strings;
import emu.project64.util.Utility;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
@ -58,7 +60,7 @@ public class AboutActivity extends AppCompatActivity
WebView webView = (WebView)findViewById(R.id.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.setOffscreenPageLimit(MODE_TOTAL-1);
viewPager.setAdapter(new AboutPagerAdapter(lists, titles));
@ -69,6 +71,15 @@ public class AboutActivity extends AppCompatActivity
TextView link = (TextView)findViewById(R.id.main_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");
}

View File

@ -31,12 +31,14 @@ import emu.project64.inAppPurchase.IabHelper.IabAsyncInProgressException;
import emu.project64.inAppPurchase.IabResult;
import emu.project64.inAppPurchase.Inventory;
import emu.project64.inAppPurchase.Purchase;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent;
import emu.project64.jni.UISettingID;
import emu.project64.settings.GameSettingsActivity;
import emu.project64.settings.SettingsActivity;
import emu.project64.util.Strings;
import emu.project64.util.Utility;
import android.annotation.TargetApi;
import android.app.Activity;
@ -224,7 +226,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
// Configure the navigation drawer
mDrawerLayout = (DrawerLayout) findViewById( R.id.drawerLayout );
mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, toolbar, 0, 0 );
mDrawerLayout.setDrawerListener( mDrawerToggle );
mDrawerLayout.addDrawerListener( mDrawerToggle );
// Configure the list in the navigation drawer
mDrawerList = (MenuListView) findViewById( R.id.drawerNavigation );
@ -238,6 +240,15 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
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.
@ -427,6 +438,7 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
public boolean onCreateOptionsMenu( Menu menu )
{
getMenuInflater().inflate( R.menu.gallery_activity, menu );
Strings.SetMenuTitle(menu, R.id.menuItem_gameDir, LanguageStringID.ANDROID_GAMEDIR);
return super.onCreateOptionsMenu( menu );
}
@ -745,10 +757,10 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
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.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() );
items.addAll( mGalleryItems );
@ -1008,6 +1020,15 @@ public class GalleryActivity extends AppCompatActivity implements IabBroadcastLi
this.startActivity( intent );
}
public static void LanguageChanged()
{
if (mActiveGalleryActivity != null)
{
mActiveGalleryActivity.finish();
mActiveGalleryActivity.startActivity( mActiveGalleryActivity.getIntent() );
}
}
public static void RomListReset ()
{
mGalleryItems = new ArrayList<GalleryItem>();

View File

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

View File

@ -15,9 +15,11 @@ import java.util.ArrayList;
import java.util.List;
import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID;
import emu.project64.util.FileUtil;
import emu.project64.util.Strings;
import android.content.Intent;
import android.content.Context;
import android.text.Html;
@ -42,13 +44,13 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
private static final String NAMESPACE = ScanRomsActivity.class.getCanonicalName() + ".";
public static final String GAME_DIR_PATH = NAMESPACE + "GAME_DIR_PATH";
public static final String GAME_DIR_RECURSIVELY = NAMESPACE + "GAME_DIR_RECURSIVELY";
private List<CharSequence> mNames;
private List<String> mPaths;
private CheckBox mCheckBox1;
private CheckBox mScanRecursively;
private Button mCancelButton;
private Button mOkButton;
private File mCurrentPath = null;
public final static String EXTERNAL_PUBLIC_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
@ -59,44 +61,49 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
setContentView(R.layout.scan_roms_activity);
if (NativeExports.SettingsLoadBool(SettingsID.RomList_GameDirUseSelected.getValue()))
{
File CurrentPath = new File(NativeExports.SettingsLoadString(SettingsID.RomList_GameDir.getValue()));
if (CurrentPath.exists() && CurrentPath.isDirectory())
{
mCurrentPath = CurrentPath;
}
File CurrentPath = new File(NativeExports.SettingsLoadString(SettingsID.RomList_GameDir.getValue()));
if (CurrentPath.exists() && CurrentPath.isDirectory())
{
mCurrentPath = CurrentPath;
}
}
TextView selectDir = (TextView)findViewById(R.id.scanRomsDialog_selectDir);
selectDir.setText(Strings.GetString(LanguageStringID.ANDROID_SELECTDIR));
// Set check box state
mCheckBox1 = (CheckBox) findViewById( R.id.checkBox1 );
mCheckBox1.setChecked( NativeExports.SettingsLoadBool(SettingsID.RomList_GameDirRecursive.getValue()) );
mScanRecursively = (CheckBox) findViewById( R.id.ScanRecursively );
mScanRecursively.setChecked( NativeExports.SettingsLoadBool(SettingsID.RomList_GameDirRecursive.getValue()) );
mScanRecursively.setText(Strings.GetString(LanguageStringID.ANDROID_INCLUDE_SUBDIRECTORIES));
mCancelButton = (Button) findViewById( R.id.buttonCancel );
mCancelButton.setText(Strings.GetString(LanguageStringID.ANDROID_CANCEL));
mCancelButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
public void onClick(View v)
{
ScanRomsActivity.this.setResult(RESULT_CANCELED, null);
ScanRomsActivity.this.finish();
}
});
mOkButton = (Button) findViewById( R.id.buttonOk );
mOkButton.setOnClickListener(new View.OnClickListener()
mOkButton.setText(Strings.GetString(LanguageStringID.ANDROID_OK));
mOkButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
public void onClick(View v)
{
Intent data = new Intent();
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.finish();
}
});
PopulateFileList();
}
private void PopulateFileList()
{
// Get the filenames and absolute paths
@ -110,31 +117,31 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
{
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());
break;
}
}
setTitle( path );
FileUtil.populate( mCurrentPath, true, true, true, mNames, mPaths );
mOkButton.setEnabled(true);
mOkButton.setEnabled(true);
}
else
{
setTitle( getString(R.string.scanning_directories) );
setTitle( Strings.GetString(LanguageStringID.ANDROID_DIRECTORIES) );
mPaths = StorageDirectories;
for( String directory : mPaths )
{
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
{
mNames.add( Html.fromHtml( "<b>" + new File(directory).getName() + "</b>" ) );
}
}
mOkButton.setEnabled(false);
mOkButton.setEnabled(false);
}
ListView listView1 = (ListView) findViewById( R.id.listView1 );
ArrayAdapter<String> adapter = createScanRomsAdapter( this, mPaths, mNames );
@ -145,13 +152,13 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
@Override
public void onItemClick( AdapterView<?> parent, View view, int position, long id )
{
mCurrentPath = mPaths.get( position ) != null ? new File(mPaths.get( position )) : null;
mCurrentPath = mPaths.get( position ) != null ? new File(mPaths.get( position )) : null;
PopulateFileList();
}
/**
* An interface that simplifies the population of list items.
*
*
* @param <T> The type of the data to be wrapped.
* @see ScanRomsActivity#createAdapter(Context, List, int, int, ListItemPopulator)
*/
@ -159,10 +166,10 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
{
public void onPopulateListItem( T item, int position, View view );
}
/**
* An interface that simplifies the population of list items having two text fields and an icon.
*
*
* @param <T> The type of the data to be wrapped.
* @see ScanRomsActivity#createAdapter(Context, List, ListItemTwoTextIconPopulator)
*/
@ -171,17 +178,17 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
public void onPopulateListItem( T item, int position, TextView text1, TextView text2,
ImageView icon );
}
/**
* Create a {@link ListAdapter} where each list item has a specified layout.
*
*
* @param <T> The type of the data to be wrapped.
* @param context The current context.
* @param items The data source for the list items.
* @param layoutResId The layout resource to be used for each list item.
* @param textResId The {@link TextView} resource within the layout to be populated by default.
* @param populator The object to populate the fields in each list item.
*
*
* @return An adapter that can be used to create list dialogs.
*/
public static <T> ArrayAdapter<T> createAdapter( Context context, List<T> items,
@ -203,13 +210,13 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
{
row = (View) convertView;
}
populator.onPopulateListItem( getItem( position ), position, row );
return row;
}
@Override
public boolean isEnabled(int position)
public boolean isEnabled(int position)
{
T item = getItem( position );
if (item != null)
@ -221,15 +228,15 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
}
};
}
/**
* Create a {@link ListAdapter} where each list item has two text fields and an icon.
*
*
* @param <T> The type of the data to be wrapped.
* @param context The activity context.
* @param items The data source for list items.
* @param populator The object to populate the fields in each list item.
*
*
* @return An adapter that can be used to create list dialogs.
*/
public static <T> ArrayAdapter<T> createAdapter( Context context, List<T> items,
@ -248,7 +255,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
}
} );
}
public static ArrayAdapter<String> createScanRomsAdapter( Context context, List<String> paths,
final List<CharSequence> names )
{
@ -261,7 +268,7 @@ public class ScanRomsActivity extends AppCompatActivity implements OnItemClickLi
String name = names.get( position ).toString();
if( name.equals( ".." ) )
{
text1.setText( R.string.pathPreference_parentFolder );
text1.setText( Strings.GetString(LanguageStringID.ANDROID_PARENTFOLDER) );
icon.setVisibility( View.VISIBLE );
icon.setImageResource( R.drawable.ic_arrow_u );
}

View File

@ -15,10 +15,12 @@ import java.sql.Date;
import java.text.SimpleDateFormat;
import emu.project64.R;
import emu.project64.jni.LanguageStringID;
import emu.project64.jni.NativeExports;
import emu.project64.jni.SettingsID;
import emu.project64.jni.SystemEvent;
import emu.project64.settings.SettingsActivity;
import emu.project64.util.Strings;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
@ -70,6 +72,20 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue());
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_resume).setVisible(GamePaused ? true : false);
menu.findItem(R.id.menuItem_ResetFunctionTimes).setVisible(RecordExecutionTimes);
@ -211,10 +227,11 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
{
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);
}
private void SelectGameSpeed()
{
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_AppLostActive.getValue());
@ -225,7 +242,7 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
final SeekBar seek = (SeekBar) layout.findViewById( R.id.seekbar );
final TextView text = (TextView) layout.findViewById( R.id.textFeedback );
final String finalFormat = "%1$d %%";
text.setText( String.format( finalFormat, initial ) );
seek.setMax( MAX_SPEED - MIN_SPEED );
seek.setProgress( initial - MIN_SPEED );
@ -235,24 +252,24 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
{
text.setText( String.format( finalFormat, progress + MIN_SPEED ) );
}
public void onStartTrackingTouch( SeekBar seekBar )
{
}
public void onStopTrackingTouch( SeekBar seekBar )
{
}
});
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.setNeutralButton("OK", null);
builder.setNegativeButton("Reset", null);
builder.setCancelable(false);
builder.setView(layout);
final AlertDialog dialog = builder.create();
dialog.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener( new View.OnClickListener()

View File

@ -11,6 +11,7 @@
package emu.project64.settings;
import emu.project64.AndroidDevice;
import emu.project64.GalleryActivity;
import emu.project64.R;
import emu.project64.jni.AudioSettingID;
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("UserInterface_BasicMode",NativeExports.SettingsLoadBool(SettingsID.UserInterface_BasicMode.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_DisplaySpeed",NativeExports.SettingsLoadBool(SettingsID.UserInterface_DisplayFrameRate.getValue()))
.putBoolean("Debugger_CpuUsage",NativeExports.SettingsLoadBool(SettingsID.UserInterface_ShowCPUPer.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_TraceMD5",String.valueOf(NativeExports.SettingsLoadDword(SettingsID.Debugger_TraceMD5.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().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("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("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("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_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)); }
@ -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_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_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")));
}
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_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_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"))); }
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_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_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"))); }

View File

@ -10,8 +10,14 @@
****************************************************************************/
package emu.project64.util;
import java.nio.charset.Charset;
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
{
static public boolean startsWith(String[] array, String text)
@ -37,4 +43,20 @@ public class Strings
}
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?"
#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?"
/*********************************************************************************
* 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");
}
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)
{
WriteTrace(TraceUserInterface, TraceDebug, "start (Speed: %d)", Speed);

View File

@ -79,9 +79,9 @@ enum LanguageStringID
MENU_CHEAT = 130,
MENU_GS_BUTTON = 131,
MENU_RESUME = 132,
MENU_RESET_SOFT = 133, //added in build 1.7.50
MENU_RESET_HARD = 134, //added in build 1.7.50
MENU_SWAPDISK = 135, //added in build 2.2.????
MENU_RESET_SOFT = 133,
MENU_RESET_HARD = 134,
MENU_SWAPDISK = 135,
//Options Menu
MENU_OPTIONS = 140,
@ -535,19 +535,60 @@ enum LanguageStringID
MSG_DEL_TITLE = 2042,
MSG_CHEAT_NAME_IN_USE = 2043,
MSG_MAX_CHEATS = 2044,
MSG_PLUGIN_INIT = 2045, //Added in pj64 1.6
MSG_NO_SHORTCUT_SEL = 2046, //Added in pj64 1.6
MSG_NO_MENUITEM_SEL = 2047, //Added in pj64 1.6
MSG_MENUITEM_ASSIGNED = 2048, //Added in pj64 1.6
MSG_NO_SEL_SHORTCUT = 2049, //Added in pj64 1.6
MSG_WAITING_FOR_START = 2050, //Added in pj64 1.7
MSG_INVALID_EXE = 2051, //Added in pj64 1.7
MSG_INVALID_EXE_TITLE = 2052, //Added in pj64 1.7
MSG_7Z_FILE_NOT_FOUND = 2053, //Added in pj64 1.7
MSG_SET_LLE_GFX_TITLE = 2054, //Added in pj64 1.7
MSG_SET_LLE_GFX_MSG = 2055, //Added in pj64 1.7
MSG_SET_HLE_AUD_TITLE = 2056, //Added in pj64 1.7
MSG_SET_HLE_AUD_MSG = 2057, //Added in pj64 1.7
MSG_PLUGIN_INIT = 2045,
MSG_NO_SHORTCUT_SEL = 2046,
MSG_NO_MENUITEM_SEL = 2047,
MSG_MENUITEM_ASSIGNED = 2048,
MSG_NO_SEL_SHORTCUT = 2049,
MSG_WAITING_FOR_START = 2050,
MSG_INVALID_EXE = 2051,
MSG_INVALID_EXE_TITLE = 2052,
MSG_7Z_FILE_NOT_FOUND = 2053,
MSG_SET_LLE_GFX_TITLE = 2054,
MSG_SET_LLE_GFX_MSG = 2055,
MSG_SET_HLE_AUD_TITLE = 2056,
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"

View File

@ -440,7 +440,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(STR_SHORTCUT_SAVESLOT, "Save Slots");
/*********************************************************************************
* Support Window *
* Support Window *
*********************************************************************************/
DEF_STR(MSG_SUPPORT_TITLE, "Support Project64");
DEF_STR(MSG_SUPPORT_INFO, "Project64 is a software package designed to emulate a Nintendo64 video game system on a Microsoft Windows based PC. This allows you to play real N64 software in much the same way as it would be on the original hardware system.\n\nIf you like Project64 and have gotten some value out of it then please support project64 as either a thank you, or your desire to see it continually improved.\n\nIf you have supported project64:");
@ -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_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?");
/*********************************************************************************
* 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() :
@ -526,6 +567,15 @@ CLanguage::CLanguage() :
if (g_Settings)
{
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);
}
}
@ -541,7 +591,7 @@ bool CLanguage::LoadCurrentStrings(void)
}
LanguageList LangList = GetLangList();
stdstr Filename;
stdstr Filename;
//Find the file name of the current language
for (LanguageList::iterator Language = LangList.begin(); Language != LangList.end(); Language++)
@ -759,6 +809,11 @@ bool CLanguage::IsCurrentLang(LanguageFile & File)
return false;
}
void CLanguage::ResetStrings(void)
{
m_CurrentStrings.clear();
}
#ifdef _WIN32
const std::wstring wGS(LanguageStringID StringID)
{

View File

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