[Android] Add force gfx reset

This commit is contained in:
zilmar 2016-09-26 20:51:55 +10:00
parent b04a170f0e
commit 3bc178ee78
8 changed files with 48 additions and 13 deletions

View File

@ -23,7 +23,6 @@
android:key="Debugger_LimitFPS" android:key="Debugger_LimitFPS"
android:summary="@string/LimitFPS_summary" android:summary="@string/LimitFPS_summary"
android:title="@string/LimitFPS_title" /> android:title="@string/LimitFPS_title" />
<CheckBoxPreference <CheckBoxPreference
android:key="Debugger_CpuUsage" android:key="Debugger_CpuUsage"
android:summary="@string/CpuUsage_summary" android:summary="@string/CpuUsage_summary"
@ -37,6 +36,10 @@
android:entryValues="@array/DisplaySpeed_values" android:entryValues="@array/DisplaySpeed_values"
android:key="Debugger_DisplaySpeedType" android:key="Debugger_DisplaySpeedType"
android:title="@string/DisplaySpeedDisplay" /> android:title="@string/DisplaySpeedDisplay" />
<CheckBoxPreference
android:key="Plugin_ForceGfxReset"
android:summary="@string/ForceGfxReset_summary"
android:title="@string/ForceGfxReset_title" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/logging" > <PreferenceCategory android:title="@string/logging" >
<Preference <Preference

View File

@ -253,6 +253,7 @@ public enum SettingsID
Plugin_UseHleGfx, Plugin_UseHleGfx,
Plugin_UseHleAudio, Plugin_UseHleAudio,
Plugin_EnableAudio, Plugin_EnableAudio,
Plugin_ForceGfxReset,
Logging_GenerateLog, Logging_GenerateLog,
Logging_LogRDRamRegisters, Logging_LogRDRamRegisters,

View File

@ -51,6 +51,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
sharedPrefs.edit().clear() sharedPrefs.edit().clear()
.putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.getValue())) .putBoolean("audio_Enabled",NativeExports.SettingsLoadBool(SettingsID.Plugin_EnableAudio.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_GenerateLogFiles",NativeExports.SettingsLoadBool(SettingsID.Debugger_GenerateLogFiles.getValue()))
@ -120,6 +121,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, new SettingsFragment()).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_placeholder, new SettingsFragment()).commit();
} }
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("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_GenerateLogFiles")) { NativeExports.SettingsSaveBool(SettingsID.Debugger_GenerateLogFiles.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)); }

View File

@ -59,6 +59,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
m_CheatsSlectionChanged(false), m_CheatsSlectionChanged(false),
m_SyncCpu(SyncSystem) m_SyncCpu(SyncSystem)
{ {
WriteTrace(TraceN64System, TraceDebug, "Start");
uint32_t gameHertz = g_Settings->LoadDword(Game_ScreenHertz); uint32_t gameHertz = g_Settings->LoadDword(Game_ScreenHertz);
if (gameHertz == 0) if (gameHertz == 0)
{ {
@ -97,6 +98,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
m_Recomp = new CRecompiler(m_Reg, m_Profile, m_EndEmulation); m_Recomp = new CRecompiler(m_Reg, m_Profile, m_EndEmulation);
} }
} }
WriteTrace(TraceN64System, TraceDebug, "Done");
} }
CN64System::~CN64System() CN64System::~CN64System()
@ -316,6 +318,10 @@ bool CN64System::RunFileImage(const char * FileLoc)
} }
} }
} }
else
{
WriteTrace(TraceN64System, TraceError, "Failed to create CN64System");
}
} }
else else
{ {
@ -624,6 +630,7 @@ void CN64System::PluginReset()
void CN64System::Reset(bool bInitReg, bool ClearMenory) void CN64System::Reset(bool bInitReg, bool ClearMenory)
{ {
WriteTrace(TraceN64System, TraceDebug, "Start (bInitReg: %s, ClearMenory: %s)", bInitReg ? "true" : "false", ClearMenory ? "true" : "false");
g_Settings->SaveBool(GameRunning_InReset, true); g_Settings->SaveBool(GameRunning_InReset, true);
RefreshGameSettings(); RefreshGameSettings();
m_Audio.Reset(); m_Audio.Reset();
@ -664,12 +671,21 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
{ {
m_Recomp->Reset(); m_Recomp->Reset();
} }
if (m_Plugins) { m_Plugins->GameReset(); } if (m_Plugins && g_Settings->LoadBool(GameRunning_CPU_Running))
{
if (g_Settings->LoadBool(Plugin_ForceGfxReset))
{
m_Plugins->Reset(this);
}
m_Plugins->RomClosed();
m_Plugins->RomOpened();
}
if (m_SyncCPU) if (m_SyncCPU)
{ {
m_SyncCPU->Reset(bInitReg, ClearMenory); m_SyncCPU->Reset(bInitReg, ClearMenory);
} }
g_Settings->SaveBool(GameRunning_InReset, true); g_Settings->SaveBool(GameRunning_InReset, true);
WriteTrace(TraceN64System, TraceDebug, "Done");
} }
bool CN64System::SetActiveSystem(bool bActive) bool CN64System::SetActiveSystem(bool bActive)
@ -680,6 +696,7 @@ bool CN64System::SetActiveSystem(bool bActive)
if (bActive && g_System == this) if (bActive && g_System == this)
{ {
WriteTrace(TraceN64System, TraceDebug, "Done (Res: true)");
return true; return true;
} }
@ -721,6 +738,8 @@ bool CN64System::SetActiveSystem(bool bActive)
{ {
if (!m_MMU_VM.Initialize()) if (!m_MMU_VM.Initialize())
{ {
WriteTrace(TraceN64System, TraceWarning, "MMU failed to Initialize");
WriteTrace(TraceN64System, TraceDebug, "Done (Res: false)");
return false; return false;
} }
bReset = true; bReset = true;
@ -758,6 +777,8 @@ bool CN64System::SetActiveSystem(bool bActive)
if (!bRes) if (!bRes)
{ {
WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed"); WriteTrace(TraceN64System, TraceError, "g_Plugins->Initiate Failed");
WriteTrace(TraceN64System, TraceDebug, "Done (Res: false)");
return false;
} }
} }
@ -1072,7 +1093,6 @@ void CN64System::SyncCPU(CN64System * const SecondCPU)
bool ErrorFound = false; bool ErrorFound = false;
m_SyncCount += 1; m_SyncCount += 1;
//WriteTraceF(TraceError,"SyncCPU PC = %08X",m_Reg.m_PROGRAM_COUNTER);
g_SystemTimer->UpdateTimers(); g_SystemTimer->UpdateTimers();
#ifdef TEST_SP_TRACKING #ifdef TEST_SP_TRACKING
@ -2036,7 +2056,6 @@ void CN64System::RefreshScreen()
uint32_t VI_INTR_TIME = 500000; uint32_t VI_INTR_TIME = 500000;
if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RefreshScreen); } if (bShowCPUPer()) { CPU_UsageAddr = m_CPU_Usage.StartTimer(Timer_RefreshScreen); }
//if (bProfiling) { ProfilingAddr = m_Profile.StartTimer(Timer_RefreshScreen); }
//Calculate how many cycles to next refresh //Calculate how many cycles to next refresh
if (m_Reg.VI_V_SYNC_REG == 0) if (m_Reg.VI_V_SYNC_REG == 0)
@ -2069,7 +2088,6 @@ void CN64System::RefreshScreen()
} }
if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_UpdateScreen); } if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_UpdateScreen); }
// if (bProfiling) { m_Profile.StartTimer(Timer_UpdateScreen); }
__except_try() __except_try()
{ {

View File

@ -108,7 +108,7 @@ bool CGfxPlugin::LoadFunctions(void)
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window) bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
{ {
WriteTrace(TraceGFXPlugin, TraceDebug, "Starting"); WriteTrace(TraceGFXPlugin, TraceDebug, "Start");
if (m_Initialized) if (m_Initialized)
{ {
Close(Window); Close(Window);
@ -259,7 +259,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
pjutil::DynLibCallDllMain(); pjutil::DynLibCallDllMain();
#endif #endif
WriteTrace(TraceGFXPlugin, TraceDebug, "InitiateGFX done (res: %s)", m_Initialized ? "true" : "false"); WriteTrace(TraceGFXPlugin, TraceDebug, "Done (res: %s)", m_Initialized ? "true" : "false");
return m_Initialized; return m_Initialized;
} }

View File

@ -192,7 +192,9 @@ void CPlugins::DestroyGfxPlugin(void)
{ {
return; return;
} }
WriteTrace(TraceGFXPlugin, TraceInfo, "Start"); WriteTrace(TraceGFXPlugin, TraceDebug, "before close");
m_Gfx->Close(m_MainWindow);
WriteTrace(TraceGFXPlugin, TraceInfo, "deleting");
delete m_Gfx; delete m_Gfx;
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted"); WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted");
m_Gfx = NULL; m_Gfx = NULL;
@ -324,14 +326,18 @@ bool CPlugins::Reset(CN64System * System)
bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0; bool bRspChange = _stricmp(m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str()) != 0;
bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; bool bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
#ifdef ANDROID
//this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround if (g_Settings->LoadBool(Plugin_ForceGfxReset))
bGfxChange = true; {
#endif //this is a hack and should not be here, glide64 is not correctly freeing something on restart, this needs to be fixed but this is a short term workaround
bGfxChange = true;
}
//if GFX and Audio has changed we also need to force reset of RSP //if GFX and Audio has changed we also need to force reset of RSP
if (bGfxChange || bAudioChange) if (bGfxChange || bAudioChange)
{
bRspChange = true; bRspChange = true;
}
if (bGfxChange) { DestroyGfxPlugin(); } if (bGfxChange) { DestroyGfxPlugin(); }
if (bAudioChange) { DestroyAudioPlugin(); } if (bAudioChange) { DestroyAudioPlugin(); }

View File

@ -258,6 +258,7 @@ enum SettingID
Plugin_UseHleGfx, Plugin_UseHleGfx,
Plugin_UseHleAudio, Plugin_UseHleAudio,
Plugin_EnableAudio, Plugin_EnableAudio,
Plugin_ForceGfxReset,
Logging_GenerateLog, Logging_GenerateLog,
Logging_LogRDRamRegisters, Logging_LogRDRamRegisters,

View File

@ -359,7 +359,11 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true)); AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true));
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false)); AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false));
AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true)); AddHandler(Plugin_EnableAudio, new CSettingTypeApplication("Audio", "Enable Audio", true));
#ifdef ANDROID
AddHandler(Plugin_ForceGfxReset, new CSettingTypeApplication("Plugin", "Force Gfx Reset", true));
#else
AddHandler(Plugin_ForceGfxReset, new CSettingTypeApplication("Plugin", "Force Gfx Reset", false));
#endif
//Logging //Logging
AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false)); AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false));
AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false)); AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false));