Android: Fix up showing menu
This commit is contained in:
parent
d3f4132770
commit
0dc1fa7f45
|
@ -5,7 +5,7 @@ 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.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;
|
||||||
|
@ -32,7 +32,7 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
|
|
||||||
public GameMenuHandler( Activity activity, GameLifecycleHandler LifecycleHandler )
|
public GameMenuHandler( Activity activity, GameLifecycleHandler LifecycleHandler )
|
||||||
{
|
{
|
||||||
/*mActivity = activity;
|
mActivity = activity;
|
||||||
mLifecycleHandler = LifecycleHandler;
|
mLifecycleHandler = LifecycleHandler;
|
||||||
|
|
||||||
final ImageButton MenuButton = (ImageButton)activity.findViewById( R.id.gameMenu );
|
final ImageButton MenuButton = (ImageButton)activity.findViewById( R.id.gameMenu );
|
||||||
|
@ -43,9 +43,9 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
{
|
{
|
||||||
/*Boolean GamePaused = NativeExports.SettingsLoadBool(SettingsID.GameRunning_CPU_Paused.getValue());
|
Boolean GamePaused = NativeExports.SettingsLoadBool(SettingsID.GameRunning_CPU_Paused.toString());
|
||||||
Boolean RecordExecutionTimes = NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordExecutionTimes.getValue());
|
Boolean RecordExecutionTimes = NativeExports.SettingsLoadBool(SettingsID.Debugger_RecordExecutionTimes.toString());
|
||||||
Boolean ShowDebugMenu = NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.getValue());
|
Boolean ShowDebugMenu = NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.toString());
|
||||||
|
|
||||||
if (!RecordExecutionTimes)
|
if (!RecordExecutionTimes)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
popupMenu.setOnMenuItemClickListener(menuHandler);
|
popupMenu.setOnMenuItemClickListener(menuHandler);
|
||||||
popupMenu.inflate(R.menu.game_activity);
|
popupMenu.inflate(R.menu.game_activity);
|
||||||
|
|
||||||
int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.getValue());
|
int CurrentSaveState = NativeExports.SettingsLoadDword(SettingsID.Game_CurrentSaveState.toString());
|
||||||
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_SaveState, LanguageStringID.ANDROID_MENU_SAVESTATE);
|
||||||
|
@ -82,10 +82,10 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
menu.findItem(R.id.menuItem_DumpFunctionTimes).setVisible(RecordExecutionTimes);
|
menu.findItem(R.id.menuItem_DumpFunctionTimes).setVisible(RecordExecutionTimes);
|
||||||
menu.findItem(R.id.menuItem_DebuggingMenu).setVisible(ShowDebugMenu);
|
menu.findItem(R.id.menuItem_DebuggingMenu).setVisible(ShowDebugMenu);
|
||||||
|
|
||||||
String SaveDirectory = NativeExports.SettingsLoadString(SettingsID.Directory_InstantSave.getValue());
|
String SaveDirectory = NativeExports.SettingsLoadString(SettingsID.Directory_InstantSave.toString());
|
||||||
if ( NativeExports.SettingsLoadBool(SettingsID.Setting_UniqueSaveDir.getValue()))
|
if ( NativeExports.SettingsLoadBool(SettingsID.Setting_UniqueSaveDir.toString()))
|
||||||
{
|
{
|
||||||
SaveDirectory += "/" + NativeExports.SettingsLoadString(SettingsID.Game_UniqueSaveDir.getValue());
|
SaveDirectory += "/" + NativeExports.SettingsLoadString(SettingsID.Game_UniqueSaveDir.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSaveAuto, 0);
|
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSaveAuto, 0);
|
||||||
|
@ -99,9 +99,9 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave8, 8);
|
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave8, 8);
|
||||||
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave9, 9);
|
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave9, 9);
|
||||||
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave10, 10);
|
FixSaveStateMenu(SaveDirectory, CurrentSaveState, menu, R.id.menuItem_CurrentSave10, 10);
|
||||||
popupMenu.show();*/
|
popupMenu.show();
|
||||||
/*}
|
}
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onMenuItemClick(MenuItem item)
|
public boolean onMenuItemClick(MenuItem item)
|
||||||
|
@ -122,39 +122,39 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
case R.id.menuItem_LoadState:
|
case R.id.menuItem_LoadState:
|
||||||
NativeExports.ExternalEvent(SystemEvent.SysEvent_LoadMachineState.getValue());
|
NativeExports.ExternalEvent(SystemEvent.SysEvent_LoadMachineState.getValue());
|
||||||
break;
|
break;
|
||||||
/*case R.id.menuItem_CurrentSaveAuto:
|
case R.id.menuItem_CurrentSaveAuto:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 0);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 0);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave1:
|
case R.id.menuItem_CurrentSave1:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 1);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 1);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave2:
|
case R.id.menuItem_CurrentSave2:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 2);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 2);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave3:
|
case R.id.menuItem_CurrentSave3:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 3);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 3);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave4:
|
case R.id.menuItem_CurrentSave4:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 4);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 4);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave5:
|
case R.id.menuItem_CurrentSave5:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 5);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 5);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave6:
|
case R.id.menuItem_CurrentSave6:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 6);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 6);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave7:
|
case R.id.menuItem_CurrentSave7:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 7);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 7);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave8:
|
case R.id.menuItem_CurrentSave8:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 8);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 8);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave9:
|
case R.id.menuItem_CurrentSave9:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 9);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 9);
|
||||||
break;
|
break;
|
||||||
case R.id.menuItem_CurrentSave10:
|
case R.id.menuItem_CurrentSave10:
|
||||||
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.getValue(), 10);
|
NativeExports.SettingsSaveDword(SettingsID.Game_CurrentSaveState.toString(), 10);
|
||||||
break;*/
|
break;
|
||||||
case R.id.menuItem_pause:
|
case R.id.menuItem_pause:
|
||||||
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_FromMenu.getValue());
|
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_FromMenu.getValue());
|
||||||
break;
|
break;
|
||||||
|
@ -195,12 +195,12 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
@SuppressLint("SimpleDateFormat")
|
@SuppressLint("SimpleDateFormat")
|
||||||
private void FixSaveStateMenu(String SaveDirectory, int CurrentSaveState,Menu menu, int MenuId, int SaveSlot )
|
private void FixSaveStateMenu(String SaveDirectory, int CurrentSaveState,Menu menu, int MenuId, int SaveSlot )
|
||||||
{
|
{
|
||||||
/*MenuItem item = menu.findItem(MenuId);
|
MenuItem item = menu.findItem(MenuId);
|
||||||
if (CurrentSaveState == SaveSlot)
|
if (CurrentSaveState == SaveSlot)
|
||||||
{
|
{
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
}
|
}
|
||||||
String SaveFileName = SaveDirectory + "/" + NativeExports.SettingsLoadString(SettingsID.Rdb_GoodName.getValue()) + ".pj";
|
String SaveFileName = SaveDirectory + "/" + NativeExports.SettingsLoadString(SettingsID.Rdb_GoodName.toString()) + ".pj";
|
||||||
String Timestamp = "";
|
String Timestamp = "";
|
||||||
if (SaveSlot != 0)
|
if (SaveSlot != 0)
|
||||||
{
|
{
|
||||||
|
@ -219,12 +219,12 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
}
|
}
|
||||||
String SlotName = SaveSlot == 0 ? Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVEAUTO) :
|
String SlotName = SaveSlot == 0 ? Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVEAUTO) :
|
||||||
Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVESLOT) + " " + SaveSlot;
|
Strings.GetString(LanguageStringID.ANDROID_MENU_CURRENTSAVESLOT) + " " + SaveSlot;
|
||||||
item.setTitle(SlotName + Timestamp);*/
|
item.setTitle(SlotName + Timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectGameSpeed()
|
private void SelectGameSpeed()
|
||||||
{
|
{
|
||||||
/*NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_AppLostActive.getValue());
|
NativeExports.ExternalEvent( SystemEvent.SysEvent_PauseCPU_AppLostActive.getValue());
|
||||||
final int MAX_SPEED = 300;
|
final int MAX_SPEED = 300;
|
||||||
final int MIN_SPEED = 10;
|
final int MIN_SPEED = 10;
|
||||||
final int initial = (NativeExports.GetSpeed() * 100) / NativeExports.GetBaseSpeed();
|
final int initial = (NativeExports.GetSpeed() * 100) / NativeExports.GetBaseSpeed();
|
||||||
|
@ -291,6 +291,6 @@ public class GameMenuHandler implements PopupMenu.OnMenuItemClickListener, Popup
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
NativeExports.ExternalEvent( SystemEvent.SysEvent_ResumeCPU_AppGainedActive.getValue());
|
NativeExports.ExternalEvent( SystemEvent.SysEvent_ResumeCPU_AppGainedActive.getValue());
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,10 @@ public class NativeExports
|
||||||
public static native void RefreshRomDir(String RomDir, boolean Recursive);
|
public static native void RefreshRomDir(String RomDir, boolean Recursive);
|
||||||
public static native void ExternalEvent(int Type);
|
public static native void ExternalEvent(int Type);
|
||||||
public static native byte[] GetString(int StringId);
|
public static native byte[] GetString(int StringId);
|
||||||
|
|
||||||
|
public static native void SetSpeed(int Speed);
|
||||||
|
public static native int GetSpeed();
|
||||||
|
public static native int GetBaseSpeed();
|
||||||
|
|
||||||
public static native void onSurfaceCreated();
|
public static native void onSurfaceCreated();
|
||||||
public static native void onSurfaceChanged(int width, int height);
|
public static native void onSurfaceChanged(int width, int height);
|
||||||
|
|
Loading…
Reference in New Issue