Added Copy EFB hotkey to OpenGL plugin (to be able to easily switch back and forth during emulation). Added Unlimited JIT cache option to debugger. It may fix the Zelda TP crashes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1243 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2008-11-22 16:46:12 +00:00
parent 36bf2fedf6
commit f0596fee55
16 changed files with 492 additions and 411 deletions

View File

@ -37,14 +37,16 @@ struct SCoreStartupParameter
// flags
bool bEnableDebugging;
bool bUseJIT;
bool bJITOff;
bool bJITLoadStoreOff;
bool bJITUnlimitedCache, bJITOff; // JIT
bool bJITLoadStoreOff, bJITLoadStorelXzOff, bJITLoadStorelwzOff, bJITLoadStorelbzxOff;
bool bJITLoadStoreFloatingOff;
bool bJITLoadStorePairedOff;
bool bJITFloatingPointOff;
bool bJITIntegerOff;
bool bJITPairedOff;
bool bJITSystemRegistersOff;
bool bUseDualCore;
bool bSkipIdle;
bool bNTSC;

View File

@ -50,11 +50,13 @@ namespace Jit64
enum
{
CODE_SIZE = 1024*1024*8,
//CODE_SIZE = 1024*1024*8,
GEN_SIZE = 4096,
TRAMPOLINE_SIZE = 1024*1024,
MAX_NUM_BLOCKS = 65536,
//MAX_NUM_BLOCKS = 65536,
};
int CODE_SIZE = 1024*1024*8; // nonconstant to be able to have an option for it
int MAX_NUM_BLOCKS = 65536;
static u8 **blockCodePointers; // cut these in half and force below 2GB?
@ -75,6 +77,12 @@ namespace Jit64
void InitCache()
{
if(Core::g_CoreStartupParameter.bJITUnlimitedCache)
{
CODE_SIZE *= 8;
MAX_NUM_BLOCKS *= 8;
}
codeCache = (u8*)AllocateExecutableMemory(CODE_SIZE);
genFunctions = (u8*)AllocateExecutableMemory(GEN_SIZE);
trampolineCache = (u8*)AllocateExecutableMemory(TRAMPOLINE_SIZE);
@ -103,6 +111,8 @@ namespace Jit64
numBlocks = 0;
}
/* This clears the JIT cache. It's called from JitCache.cpp when the JIT cache
is full and when saving and loading states */
void ClearCache()
{
Core::DisplayMessage("Cleared code cache.", 3000);
@ -165,6 +175,10 @@ namespace Jit64
if (GetCodePtr() >= codeCache + CODE_SIZE - 0x10000 || numBlocks >= MAX_NUM_BLOCKS - 1)
{
LOG(DYNA_REC, "JIT cache full - clearing.")
if(Core::g_CoreStartupParameter.bJITUnlimitedCache)
{
PanicAlert("What? JIT cache still full - clearing.");
}
ClearCache();
}

View File

@ -55,7 +55,8 @@ namespace Jit64
void lbzx(UGeckoInstruction inst)
{
#ifdef JIT_OFF_OPTIONS
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff)
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff
|| Core::g_CoreStartupParameter.bJITLoadStorelbzxOff)
{Default(inst); return;} // turn off from debugger
#endif
INSTRUCTION_START;
@ -80,11 +81,12 @@ namespace Jit64
void lXz(UGeckoInstruction inst)
{
#ifdef JIT_OFF_OPTIONS
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff)
if(Core::g_CoreStartupParameter.bJITOff || Core::g_CoreStartupParameter.bJITLoadStoreOff
|| Core::g_CoreStartupParameter.bJITLoadStorelXzOff)
{Default(inst); return;} // turn off from debugger
#endif
INSTRUCTION_START;
int d = inst.RD;
int a = inst.RA;
@ -125,10 +127,16 @@ namespace Jit64
int accessSize;
switch (inst.OPCD)
{
case 32: accessSize = 32; break; //lwz
case 32:
accessSize = 32;
if(Core::g_CoreStartupParameter.bJITLoadStorelwzOff) {Default(inst); return;}
break; //lwz
case 40: accessSize = 16; break; //lhz
case 34: accessSize = 8; break; //lbz
default: _assert_msg_(DYNA_REC, 0, "lXz: invalid access size"); return;
default:
//_assert_msg_(DYNA_REC, 0, "lXz: invalid access size");
PanicAlert("lXz: invalid access size");
return;
}
//Still here? Do regular path.

View File

@ -92,14 +92,18 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleVideoWindow)
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnInterpreter) // CPU Mode
EVT_MENU(IDM_JITUNLIMITED, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITOFF, CCodeWindow::OnJITOff)
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnJITLSOff)
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnJITLSFOff)
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnJITLSPOff)
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnJITFPOff)
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnJITIOff)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnJITPOff)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnJITSROff)
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)
@ -335,29 +339,19 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pCoreMenu->AppendSeparator();
#ifdef JIT_OFF_OPTIONS
jitunlimited = pCoreMenu->Append(IDM_JITUNLIMITED, _T("&Unlimited JIT Cache"), wxEmptyString, wxITEM_CHECK);
pCoreMenu->AppendSeparator();
jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"), wxEmptyString, wxITEM_CHECK);
jitoff->Check(_LocalCoreStartupParameter.bJITOff);
jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"), wxEmptyString, wxITEM_CHECK);
jitlsoff->Check(_LocalCoreStartupParameter.bJITLoadStoreOff);
jitlslbzxoff = pCoreMenu->Append(IDM_JITLSLBZXOFF, _T(" &JIT LoadStore lbzx off"), wxEmptyString, wxITEM_CHECK);
jitlslxzoff = pCoreMenu->Append(IDM_JITLSLXZOFF, _T(" &JIT LoadStore lXz off"), wxEmptyString, wxITEM_CHECK);
jitlslwzoff = pCoreMenu->Append(IDM_JITLSLWZOFF, _T(" &JIT LoadStore lwz off"), wxEmptyString, wxITEM_CHECK);
jitlspoff = pCoreMenu->Append(IDM_JITLSFOFF, _T("&JIT LoadStore Floating off"), wxEmptyString, wxITEM_CHECK);
jitlspoff->Check(_LocalCoreStartupParameter.bJITLoadStoreFloatingOff);
jitlsfoff = pCoreMenu->Append(IDM_JITLSPOFF, _T("&JIT LoadStore Paired off"), wxEmptyString, wxITEM_CHECK);
jitlsfoff->Check(_LocalCoreStartupParameter.bJITLoadStorePairedOff);
jitfpoff = pCoreMenu->Append(IDM_JITFPOFF, _T("&JIT FloatingPoint off"), wxEmptyString, wxITEM_CHECK);
jitfpoff->Check(_LocalCoreStartupParameter.bJITFloatingPointOff);
jitioff = pCoreMenu->Append(IDM_JITIOFF, _T("&JIT Integer off"), wxEmptyString, wxITEM_CHECK);
jitioff->Check(_LocalCoreStartupParameter.bJITIntegerOff);
jitpoff = pCoreMenu->Append(IDM_JITPOFF, _T("&JIT Paired off"), wxEmptyString, wxITEM_CHECK);
jitpoff->Check(_LocalCoreStartupParameter.bJITPairedOff);
jitsroff = pCoreMenu->Append(IDM_JITSROFF, _T("&JIT SystemRegisters off"), wxEmptyString, wxITEM_CHECK);
jitsroff->Check(_LocalCoreStartupParameter.bJITSystemRegistersOff);
#endif
// wxMenuItem* dualcore = pDebugMenu->Append(IDM_DUALCORE, _T("&DualCore"), wxEmptyString, wxITEM_CHECK);
@ -459,43 +453,58 @@ void CCodeWindow::OnInterpreter(wxCommandEvent& event)
wxMessageBox(_T("Please pause the emulator before changing mode."));
}
}
void CCodeWindow::DoJITOff(wxCommandEvent& event, wxMenuItem* a, bool& b)
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
a->Check(!a->IsChecked());
GetMenuBar()->Check(event.GetId(),!event.IsChecked());
wxMessageBox(_T("Please start a game before changing mode."));
} else {
if (Core::GetState() != Core::CORE_RUN)
{
b = !b;
switch (event.GetId())
{
case IDM_JITUNLIMITED:
Core::g_CoreStartupParameter.bJITUnlimitedCache = event.IsChecked();
Jit64::ClearCache(); // allow InitCache() even after the game has started
Jit64::InitCache();
GetMenuBar()->Enable(event.GetId(),!event.IsChecked());
break;
case IDM_JITOFF:
Core::g_CoreStartupParameter.bJITOff = event.IsChecked(); break;
case IDM_JITLSOFF:
Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked(); break;
case IDM_JITLSLXZOFF:
Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked(); break;
case IDM_JITLSLWZOFF:
Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked(); break;
case IDM_JITLSLBZXOFF:
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked(); break;
case IDM_JITLSFOFF:
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked(); break;
case IDM_JITLSPOFF:
Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked(); break;
case IDM_JITFPOFF:
Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked(); break;
case IDM_JITIOFF:
Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked(); break;
case IDM_JITPOFF:
Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked(); break;
case IDM_JITSROFF:
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked(); break;
}
Jit64::ClearCache();
} else {
//event.Skip(); // this doesn't work
a->Check(!a->IsChecked());
GetMenuBar()->Check(event.GetId(),!event.IsChecked());
wxMessageBox(_T("Please pause the emulator before changing mode."));
}
}
}
void CCodeWindow::OnJITOff(wxCommandEvent& event) {DoJITOff(event, jitoff,
Core::g_CoreStartupParameter.bJITOff);}
void CCodeWindow::OnJITLSOff(wxCommandEvent& event) {DoJITOff(event, jitlsoff,
Core::g_CoreStartupParameter.bJITLoadStoreOff);}
void CCodeWindow::OnJITLSFOff(wxCommandEvent& event) {DoJITOff(event, jitlsoff,
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff);}
void CCodeWindow::OnJITLSPOff(wxCommandEvent& event) {DoJITOff(event, jitlsoff,
Core::g_CoreStartupParameter.bJITLoadStorePairedOff);}
void CCodeWindow::OnJITFPOff(wxCommandEvent& event) {DoJITOff(event, jitfpoff,
Core::g_CoreStartupParameter.bJITFloatingPointOff);}
void CCodeWindow::OnJITIOff(wxCommandEvent& event) {DoJITOff(event, jitioff,
Core::g_CoreStartupParameter.bJITIntegerOff);}
void CCodeWindow::OnJITPOff(wxCommandEvent& event) {DoJITOff(event, jitpoff,
Core::g_CoreStartupParameter.bJITPairedOff);}
void CCodeWindow::OnJITSROff(wxCommandEvent& event) {DoJITOff(event, jitsroff,
Core::g_CoreStartupParameter.bJITSystemRegistersOff);}
// ==============
@ -970,7 +979,7 @@ void CCodeWindow::OnToggleVideoWindow(wxCommandEvent& event)
{
bool show = GetMenuBar()->IsChecked(event.GetId());
//GetMenuBar()->Check(event.GetId(), false); // Turn off
IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE);
ini.Set("ShowOnStart", "VideoWindow", show);

View File

@ -79,14 +79,15 @@ class CCodeWindow
IDM_CALLSLIST,
IDM_SYMBOLLIST,
IDM_INTERPRETER,
IDM_JITOFF, // jit
IDM_JITLSOFF,
IDM_JITLSPOFF,
IDM_JITLSFOFF,
IDM_JITUNLIMITED, IDM_JITOFF, // jit
IDM_JITLSOFF, IDM_JITLSLXZOFF, IDM_JITLSLWZOFF, IDM_JITLSLBZXOFF,
IDM_JITLSPOFF, IDM_JITLSFOFF,
IDM_JITIOFF,
IDM_JITFPOFF,
IDM_JITPOFF,
IDM_JITSROFF,
IDM_DUALCORE,
IDM_LOGWINDOW,
IDM_REGISTERWINDOW,
@ -129,8 +130,8 @@ class CCodeWindow
CMemoryWindow* m_MemoryWindow;
CJitWindow* m_JitWindow;
wxMenuItem* jitoff;
wxMenuItem* jitlsoff;
wxMenuItem* jitunlimited, *jitoff;
wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff;
wxMenuItem* jitlspoff;
wxMenuItem* jitlsfoff;
wxMenuItem* jitfpoff;
@ -175,15 +176,7 @@ class CCodeWindow
void OnProfilerMenu(wxCommandEvent& event);
void OnInterpreter(wxCommandEvent& event); // cpu mode menu
void OnJITOff(wxCommandEvent& event);
void OnJITLSOff(wxCommandEvent& event);
void OnJITLSPOff(wxCommandEvent& event);
void OnJITLSFOff(wxCommandEvent& event);
void OnJITFPOff(wxCommandEvent& event);
void OnJITIOff(wxCommandEvent& event);
void OnJITPOff(wxCommandEvent& event);
void OnJITSROff(wxCommandEvent& event);
void DoJITOff(wxCommandEvent& event, wxMenuItem* a, bool& b);
void OnJITOff(wxCommandEvent& event);
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter);

View File

@ -613,12 +613,19 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event)
void CFrame::OnKeyDown(wxKeyEvent& event)
{
// Toggle fullscreen from Alt + Enter or Esc
if (((event.GetKeyCode() == WXK_RETURN) && (event.GetModifiers() == wxMOD_ALT)) ||
(event.GetKeyCode() == WXK_ESCAPE))
{
ShowFullScreen(!IsFullScreen());
UpdateGUI();
}
#ifdef _WIN32
else if(event.GetKeyCode() == 'E') // Send this to the video plugin WndProc
{
PostMessage((HWND)Core::GetWindowHandle(), WM_KEYDOWN, event.GetKeyCode(), 0);
}
#endif
else
{
event.Skip();