CodeWindow: Fixed the Unlimited JIT Cache option

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1816 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-01-07 07:35:12 +00:00
parent 47f4e5005e
commit f50746cf0e
4 changed files with 155 additions and 161 deletions

View File

@ -71,6 +71,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
MAX_NUM_BLOCKS = 65536*2;
if (Core::g_CoreStartupParameter.bJITUnlimitedCache)
{
SuccessAlert("Your game was started with an unlimited JIT cache");
MAX_NUM_BLOCKS = 65536*8;
}

View File

@ -111,12 +111,28 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
// Menu tooltips
EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow)
// Menu bar
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // CPU Mode
EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_LOGWINDOW, CCodeWindow::OnToggleLogWindow) // Views
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleRegisterWindow)
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleBreakPointWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleMemoryWindow)
@ -124,21 +140,6 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleSoundWindow)
EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleVideoWindow)
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter) // CPU Mode
EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnAutomaticStart) // CPU Mode
EVT_MENU(IDM_JITUNLIMITED, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
@ -154,7 +155,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu)
EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
// toolbar
// Toolbar
EVT_MENU(IDM_DEBUG_GO, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep)
@ -433,16 +434,17 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
} // don't have any else, just ignore it
}
// ===================================================================
// Create CPU Mode and Views menus
// ---------------
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
// =======================================================================================
// Windows
// ---------------
// Create menu
pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
{
// --------------------------------
// CPU Mode
// -------------
wxMenu* pCoreMenu = new wxMenu;
wxMenuItem* interpreter = pCoreMenu->Append(IDM_INTERPRETER, _T("&Interpreter core")
@ -470,7 +472,9 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
#ifdef JIT_OFF_OPTIONS
pCoreMenu->AppendSeparator();
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"),
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing"),
_T("Avoid any involuntary JIT cache clearing, this may prevent Zelda TP from crashing."
" [This option must be selected before a game is started.]"
),
wxITEM_CHECK);
pCoreMenu->AppendSeparator();
jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"),
@ -492,9 +496,11 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
// dualcore->Check(_LocalCoreStartupParameter.bUseDualCore);
pMenuBar->Append(pCoreMenu, _T("&CPU Mode"));
}
// -----------------
{
// --------------------------------
// Views
// ---------------
wxMenu* pDebugDialogs = new wxMenu;
if (LogManager::Enabled())
@ -522,8 +528,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pVideo->Check(bVideoWindow);
pMenuBar->Append(pDebugDialogs, _T("&Views"));
}
// ===============
// -----------------
CreateSymbolsMenu();
@ -594,56 +599,29 @@ bool CCodeWindow::AutomaticStart()
{
return GetMenuBar()->IsChecked(IDM_AUTOMATICSTART);
}
bool CCodeWindow::UnlimitedJITCache()
{
return GetMenuBar()->IsChecked(IDM_JITUNLIMITED);
}
// =========================
// =======================================================================================
// CPU Mode
// CPU Mode and JIT Menu
// --------------
void CCodeWindow::OnInterpreter(wxCommandEvent& event)
{
if (Core::GetState() != Core::CORE_RUN) {
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
} else {
event.Skip();
wxMessageBox(_T("Please pause the emulator before changing mode."));
}
}
void CCodeWindow::OnAutomaticStart(wxCommandEvent& event)
{ switch(event.GetId())
{
case IDM_BOOTTOPAUSE:
bBootToPause = !bBootToPause;
break;
case IDM_AUTOMATICSTART:
bAutomaticStart = !bAutomaticStart;
break;
}
}
void CCodeWindow::OnJITOff(wxCommandEvent& event)
{
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
// we disallow changing the status here because it will be reset to the defult when BootCore()
// creates the SCoreStartupParameter as a game is loaded
GetMenuBar()->Check(event.GetId(),!event.IsChecked());
wxMessageBox(_T("Please start a game before changing mode."));
}
else
{
if (Core::GetState() != Core::CORE_RUN)
void CCodeWindow::OnCPUMode(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_JITUNLIMITED:
Core::g_CoreStartupParameter.bJITUnlimitedCache = event.IsChecked();
jit.ClearCache(); // allow InitCache() even after the game has started
GetMenuBar()->Enable(event.GetId(),!event.IsChecked());
return; // avoid a second jit.ClearCache
case IDM_INTERPRETER:
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT); break;
case IDM_BOOTTOPAUSE:
bBootToPause = !bBootToPause; return;
case IDM_AUTOMATICSTART:
bAutomaticStart = !bAutomaticStart; return;
case IDM_JITOFF:
Core::g_CoreStartupParameter.bJITOff = event.IsChecked(); break;
case IDM_JITLSOFF:
@ -667,27 +645,20 @@ void CCodeWindow::OnJITOff(wxCommandEvent& event)
case IDM_JITSROFF:
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked(); break;
}
// Clear the JIT cache to enable these changes
jit.ClearCache();
}
else
{
//event.Skip(); // this doesn't work
GetMenuBar()->Check(event.GetId(),!event.IsChecked());
wxMessageBox(_T("Please pause the emulator before changing mode."));
}
}
}
void CCodeWindow::OnJitMenu(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_CLEARCODECACHE:
jit.ClearCache();
break;
case IDM_LOGINSTRUCTIONS:
PPCTables::LogCompiledInstructions();
break;
PPCTables::LogCompiledInstructions(); break;
case IDM_CLEARCODECACHE:
jit.ClearCache(); break;
}
}
// =====================================
@ -888,7 +859,11 @@ void CCodeWindow::Update()
// --------------
void CCodeWindow::UpdateButtonStates()
{
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
bool Running = (Core::GetState() == Core::CORE_RUN);
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
wxToolBar* toolBar = GetToolBar();
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
toolBar->EnableTool(IDM_DEBUG_GO, false);
@ -917,6 +892,24 @@ void CCodeWindow::UpdateButtonStates()
toolBar->EnableTool(IDM_SKIP, true);
}
}
// Enabled or disable menu items
GetMenuBar()->Enable(IDM_INTERPRETER, Pause); // CPU Mode
GetMenuBar()->Enable(IDM_JITUNLIMITED, !Initialized);
GetMenuBar()->Enable(IDM_JITOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSLXZOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSLWZOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSLBZXOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSFOFF, Pause);
GetMenuBar()->Enable(IDM_JITLSPOFF, Pause);
GetMenuBar()->Enable(IDM_JITFPOFF, Pause);
GetMenuBar()->Enable(IDM_JITIOFF, Pause);
GetMenuBar()->Enable(IDM_JITPOFF, Pause);
GetMenuBar()->Enable(IDM_JITSROFF, Pause);
GetMenuBar()->Enable(IDM_CLEARCODECACHE, Pause); // JIT Menu
}
void CCodeWindow::RecreateToolbar()
@ -933,7 +926,6 @@ void CCodeWindow::RecreateToolbar()
PopulateToolbar(theToolBar);
SetToolBar(theToolBar);
}
// =============
@ -973,7 +965,7 @@ void CCodeWindow::OnStatusBar(wxMenuEvent& event)
may not be entirely stable. So we leave them out of debug builds. I could for example
get it to crash at wxWindowBase::DoHitTest(), that may be fixed in wxWidgets 2.9.0. */
#if !defined(_DEBUG) || defined(DEBUGFAST)
DoTip(pMenuBar->GetHelpString(event.GetId()));
//DoTip(pMenuBar->GetHelpString(event.GetId()));
#endif
}
void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event)
@ -982,7 +974,7 @@ void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event)
#if !defined(_DEBUG) || defined(DEBUGFAST)
// The IDM_ADDRBOX id seems to come with this outside the toolbar
if(event.GetId() != IDM_ADDRBOX) DoTip(wxEmptyString);
//if(event.GetId() != IDM_ADDRBOX) DoTip(wxEmptyString);
#endif
}
// =============

View File

@ -61,6 +61,7 @@ class CCodeWindow
bool UseInterpreter();
bool BootToPause();
bool AutomaticStart();
bool UnlimitedJITCache();
//bool UseDualCore(); // not used
void JumpToAddress(u32 _Address);
@ -204,8 +205,7 @@ class CCodeWindow
void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event);
void OnInterpreter(wxCommandEvent& event); // cpu mode menu
void OnAutomaticStart(wxCommandEvent& event);
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event);
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter);

View File

@ -88,6 +88,7 @@ bool BootCore(const std::string& _rFilename)
StartUp.bUseJIT = !g_pCodeWindow->UseInterpreter();
StartUp.bBootToPause = g_pCodeWindow->BootToPause();
StartUp.bAutomaticStart = g_pCodeWindow->AutomaticStart();
StartUp.bJITUnlimitedCache = g_pCodeWindow->UnlimitedJITCache();
}
else
{