Clear the jit cache when toggling debug stats.

This way we can bypass that check normally, for speed.
This commit is contained in:
Unknown W. Brackets 2013-11-02 13:33:27 -07:00
parent 732ae13ebb
commit 5328e213a6
6 changed files with 31 additions and 16 deletions

View File

@ -41,6 +41,7 @@
#include "Core/HLE/sceCtrl.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/Debugger/SymbolMap.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "UI/OnScreenDisplay.h"
#include "UI/ui_atlas.h"
@ -187,6 +188,11 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
else if (!strcmp(message, "gpu dump next frame")) {
if (gpu) gpu->DumpNextFrame();
}
if (!strcmp(message, "clear jit")) {
if (MIPSComp::jit) {
MIPSComp::jit->ClearCache();
}
}
}
//tiltInputCurve implements a smooth deadzone as described here:

View File

@ -37,6 +37,7 @@
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/Reporting.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "android/jni/TestRunner.h"
#include "GPU/GPUInterface.h"
#include "Common/KeyMap.h"
@ -58,6 +59,7 @@ void GameSettingsScreen::CreateViews() {
GameInfo *info = g_gameInfoCache.GetInfo(gamePath_, true);
cap60FPS_ = g_Config.iForceMaxEmulatedFPS == 60;
showDebugStats_ = g_Config.bShowDebugStats;
iAlternateSpeedPercent_ = 3;
for (int i = 0; i < 8; i++) {
@ -181,7 +183,7 @@ void GameSettingsScreen::CreateViews() {
#endif
};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS Counter"), fpsChoices, 0, ARRAY_SIZE(fpsChoices), gs, screenManager()));
graphicsSettings->Add(new CheckBox(&g_Config.bShowDebugStats, gs->T("Show Debug Statistics")));
graphicsSettings->Add(new CheckBox(&showDebugStats_, gs->T("Show Debug Statistics")));
// Developer tools are not accessible ingame, so it goes here.
graphicsSettings->Add(new ItemHeader(gs->T("Debugging")));
@ -375,6 +377,13 @@ void GameSettingsScreen::update(InputState &input) {
UIScreen::update(input);
g_Config.iForceMaxEmulatedFPS = cap60FPS_ ? 60 : 0;
g_Config.iFpsLimit = alternateSpeedTable[iAlternateSpeedPercent_];
if (g_Config.bShowDebugStats != showDebugStats_) {
// This affects the jit.
if (MIPSComp::jit) {
MIPSComp::jit->ClearCache();
}
g_Config.bShowDebugStats = showDebugStats_;
}
}
void GameSettingsScreen::sendMessage(const char *message, const char *value) {

View File

@ -74,6 +74,7 @@ private:
bool cap60FPS_;
int iAlternateSpeedPercent_;
bool enableReports_;
bool showDebugStats_;
};
/*

View File

@ -843,22 +843,10 @@ UI::EventReturn GamePauseScreen::OnCwCheat(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnLanguageChange(UI::EventParams &e) {
RecreateViews();
if (host) {
host->UpdateUI();
}
return UI::EVENT_DONE;
}
void GamePauseScreen::sendMessage(const char *message, const char *value) {
// Since the language message isn't allowed to be in native, we have to have add this
// to every screen which directly inherits from UIScreen(which are few right now, luckily).
I18NCategory *de = GetI18NCategory("Developer");
if (!strcmp(message, "language screen")) {
auto langScreen = new NewLanguageScreen(de->T("Language"));
langScreen->OnChoice.Handle(this, &GamePauseScreen::OnLanguageChange);
screenManager()->push(langScreen);
if (!strcmp(message, "language")) {
screenManager()->RecreateAllViews();
}
}

View File

@ -32,6 +32,7 @@
#include "UI/MainScreen.h"
#include "Core/Config.h"
#include "Core/System.h"
#include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/HLE/sceUtility.h"
#include "Common/CPUDetect.h"
@ -48,7 +49,6 @@
#include "gfx_es2/gl_state.h"
#include "util/random/rng.h"
#include "Core/HLE/sceUtility.h"
#include "UI/ui_atlas.h"
static const int symbols[4] = {
@ -94,12 +94,21 @@ void DrawBackground(float alpha) {
}
}
void HandleCommonMessages(const char *message, const char *value, ScreenManager *manager) {
if (!strcmp(message, "clear jit")) {
if (MIPSComp::jit) {
MIPSComp::jit->ClearCache();
}
}
}
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
dc.Flush();
}
void UIScreenWithBackground::sendMessage(const char *message, const char *value) {
HandleCommonMessages(message, value, screenManager());
I18NCategory *de = GetI18NCategory("Developer");
if (!strcmp(message, "language screen")) {
auto langScreen = new NewLanguageScreen(de->T("Language"));
@ -132,6 +141,7 @@ void UIDialogScreenWithBackground::DrawBackground(UIContext &dc) {
}
void UIDialogScreenWithBackground::sendMessage(const char *message, const char *value) {
HandleCommonMessages(message, value, screenManager());
I18NCategory *de = GetI18NCategory("Developer");
if (!strcmp(message, "language screen")) {
auto langScreen = new NewLanguageScreen(de->T("Language"));

View File

@ -1255,6 +1255,7 @@ namespace MainWindow
case ID_DEBUG_SHOWDEBUGSTATISTICS:
g_Config.bShowDebugStats = !g_Config.bShowDebugStats;
NativeMessageReceived("clear jit", "");
break;
case ID_OPTIONS_HARDWARETRANSFORM: