[Android] Add force gfx reset
This commit is contained in:
parent
b04a170f0e
commit
3bc178ee78
|
@ -23,7 +23,6 @@
|
|||
android:key="Debugger_LimitFPS"
|
||||
android:summary="@string/LimitFPS_summary"
|
||||
android:title="@string/LimitFPS_title" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="Debugger_CpuUsage"
|
||||
android:summary="@string/CpuUsage_summary"
|
||||
|
@ -37,6 +36,10 @@
|
|||
android:entryValues="@array/DisplaySpeed_values"
|
||||
android:key="Debugger_DisplaySpeedType"
|
||||
android:title="@string/DisplaySpeedDisplay" />
|
||||
<CheckBoxPreference
|
||||
android:key="Plugin_ForceGfxReset"
|
||||
android:summary="@string/ForceGfxReset_summary"
|
||||
android:title="@string/ForceGfxReset_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/logging" >
|
||||
<Preference
|
||||
|
|
|
@ -253,6 +253,7 @@ public enum SettingsID
|
|||
Plugin_UseHleGfx,
|
||||
Plugin_UseHleAudio,
|
||||
Plugin_EnableAudio,
|
||||
Plugin_ForceGfxReset,
|
||||
|
||||
Logging_GenerateLog,
|
||||
Logging_LogRDRamRegisters,
|
||||
|
|
|
@ -51,6 +51,7 @@ public class SettingsActivity extends AppCompatActivity implements SharedPrefere
|
|||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
sharedPrefs.edit().clear()
|
||||
.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("Debugger_Enabled",NativeExports.SettingsLoadBool(SettingsID.Debugger_Enabled.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();
|
||||
}
|
||||
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_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)); }
|
||||
|
|
|
@ -59,6 +59,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
|
|||
m_CheatsSlectionChanged(false),
|
||||
m_SyncCpu(SyncSystem)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Start");
|
||||
uint32_t gameHertz = g_Settings->LoadDword(Game_ScreenHertz);
|
||||
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);
|
||||
}
|
||||
}
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
CN64System::~CN64System()
|
||||
|
@ -316,6 +318,10 @@ bool CN64System::RunFileImage(const char * FileLoc)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceError, "Failed to create CN64System");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -624,6 +630,7 @@ void CN64System::PluginReset()
|
|||
|
||||
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);
|
||||
RefreshGameSettings();
|
||||
m_Audio.Reset();
|
||||
|
@ -664,12 +671,21 @@ void CN64System::Reset(bool bInitReg, bool ClearMenory)
|
|||
{
|
||||
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)
|
||||
{
|
||||
m_SyncCPU->Reset(bInitReg, ClearMenory);
|
||||
}
|
||||
g_Settings->SaveBool(GameRunning_InReset, true);
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
bool CN64System::SetActiveSystem(bool bActive)
|
||||
|
@ -680,6 +696,7 @@ bool CN64System::SetActiveSystem(bool bActive)
|
|||
|
||||
if (bActive && g_System == this)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done (Res: true)");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -721,6 +738,8 @@ bool CN64System::SetActiveSystem(bool bActive)
|
|||
{
|
||||
if (!m_MMU_VM.Initialize())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceWarning, "MMU failed to Initialize");
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done (Res: false)");
|
||||
return false;
|
||||
}
|
||||
bReset = true;
|
||||
|
@ -758,6 +777,8 @@ bool CN64System::SetActiveSystem(bool bActive)
|
|||
if (!bRes)
|
||||
{
|
||||
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;
|
||||
|
||||
m_SyncCount += 1;
|
||||
//WriteTraceF(TraceError,"SyncCPU PC = %08X",m_Reg.m_PROGRAM_COUNTER);
|
||||
g_SystemTimer->UpdateTimers();
|
||||
|
||||
#ifdef TEST_SP_TRACKING
|
||||
|
@ -2036,7 +2056,6 @@ void CN64System::RefreshScreen()
|
|||
uint32_t VI_INTR_TIME = 500000;
|
||||
|
||||
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
|
||||
if (m_Reg.VI_V_SYNC_REG == 0)
|
||||
|
@ -2069,7 +2088,6 @@ void CN64System::RefreshScreen()
|
|||
}
|
||||
|
||||
if (bShowCPUPer()) { m_CPU_Usage.StartTimer(Timer_UpdateScreen); }
|
||||
// if (bProfiling) { m_Profile.StartTimer(Timer_UpdateScreen); }
|
||||
|
||||
__except_try()
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ bool CGfxPlugin::LoadFunctions(void)
|
|||
|
||||
bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
||||
{
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Starting");
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "Start");
|
||||
if (m_Initialized)
|
||||
{
|
||||
Close(Window);
|
||||
|
@ -259,7 +259,7 @@ bool CGfxPlugin::Initiate(CN64System * System, RenderWindow * Window)
|
|||
pjutil::DynLibCallDllMain();
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,9 @@ void CPlugins::DestroyGfxPlugin(void)
|
|||
{
|
||||
return;
|
||||
}
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "Start");
|
||||
WriteTrace(TraceGFXPlugin, TraceDebug, "before close");
|
||||
m_Gfx->Close(m_MainWindow);
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "deleting");
|
||||
delete m_Gfx;
|
||||
WriteTrace(TraceGFXPlugin, TraceInfo, "m_Gfx deleted");
|
||||
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 bContChange = _stricmp(m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
if (g_Settings->LoadBool(Plugin_ForceGfxReset))
|
||||
{
|
||||
//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;
|
||||
#endif
|
||||
}
|
||||
|
||||
//if GFX and Audio has changed we also need to force reset of RSP
|
||||
if (bGfxChange || bAudioChange)
|
||||
{
|
||||
bRspChange = true;
|
||||
}
|
||||
|
||||
if (bGfxChange) { DestroyGfxPlugin(); }
|
||||
if (bAudioChange) { DestroyAudioPlugin(); }
|
||||
|
|
|
@ -258,6 +258,7 @@ enum SettingID
|
|||
Plugin_UseHleGfx,
|
||||
Plugin_UseHleAudio,
|
||||
Plugin_EnableAudio,
|
||||
Plugin_ForceGfxReset,
|
||||
|
||||
Logging_GenerateLog,
|
||||
Logging_LogRDRamRegisters,
|
||||
|
|
|
@ -359,7 +359,11 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Plugin_UseHleGfx, new CSettingTypeApplication("RSP", "HLE GFX", true));
|
||||
AddHandler(Plugin_UseHleAudio, new CSettingTypeApplication("RSP", "HLE Audio", false));
|
||||
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
|
||||
AddHandler(Logging_GenerateLog, new CSettingTypeApplication("Logging", "Generate Log Files", false));
|
||||
AddHandler(Logging_LogRDRamRegisters, new CSettingTypeApplication("Logging", "Log RDRam Registers", false));
|
||||
|
|
Loading…
Reference in New Issue