diff --git a/Core/Config.cpp b/Core/Config.cpp index 9b5cfe94b5..ae887f2cba 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -55,8 +55,8 @@ void CConfig::Load(const char *iniFileName) general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false); IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU"); - cpu->Get("Core", &iCpuCore, 2); - cpu->Get("FastMemory", &bFastMemory, false); + cpu->Get("Jit", &bJit, true); + cpu->Get("FastMemory", &bFastMemory, true); IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics"); graphics->Get("ShowFPSCounter", &bShowFPSCounter, false); @@ -117,7 +117,7 @@ void CConfig::Save() general->Set("CurrentDirectory", currentDirectory); general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad); IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU"); - cpu->Set("Core", iCpuCore); + cpu->Set("Jit", bJit); cpu->Set("FastMemory", bFastMemory); IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics"); diff --git a/Core/Config.h b/Core/Config.h index e14cfe06d4..de54372064 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -48,7 +48,7 @@ public: // Core bool bIgnoreBadMemAccess; bool bFastMemory; - int iCpuCore; + bool bJit; // GFX bool bDisplayFramebuffer; diff --git a/Core/CoreParameter.h b/Core/CoreParameter.h index 0ff37be9ed..3357fc027d 100644 --- a/Core/CoreParameter.h +++ b/Core/CoreParameter.h @@ -22,7 +22,6 @@ enum CPUCore { CPU_INTERPRETER, - CPU_FASTINTERPRETER, // unsafe, a bit faster than INTERPRETER CPU_JIT, }; diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index 7fbaa7c974..478d2c99e5 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -143,11 +143,7 @@ int MIPSState::RunLoopUntil(u64 globalTicks) MIPSComp::jit->RunLoopUntil(globalTicks); break; - case CPU_FASTINTERPRETER: // For jit-less platforms. Crashier than INTERPRETER. - return MIPSInterpret_RunFastUntil(globalTicks); - case CPU_INTERPRETER: - // INFO_LOG(CPU, "Entering run loop for %i ticks, pc=%08x", (int)globalTicks, mipsr4k.pc); return MIPSInterpret_RunUntil(globalTicks); } return 1; diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index ea58c8de4c..06e30466c3 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -1016,124 +1016,6 @@ static inline void DelayBranchTo(MIPSState *curMips, u32 where) curMips->inDelaySlot = true; } -// Optimized interpreter loop that shortcuts the most common instructions. -// For slow platforms without JITs. -#define SIMM16 (s32)(s16)(op & 0xFFFF) -#define UIMM16 (u32)(u16)(op & 0xFFFF) -#define SUIMM16 (u32)(s32)(s16)(op & 0xFFFF) -int MIPSInterpret_RunFastUntil(u64 globalTicks) -{ - MIPSState *curMips = currentMIPS; - while (coreState == CORE_RUNNING) - { - CoreTiming::Advance(); - - while (curMips->downcount >= 0 && coreState == CORE_RUNNING) // TODO: Try to get rid of the latter check - { - again: - bool wasInDelaySlot = curMips->inDelaySlot; - u32 op = Memory::ReadUnchecked_U32(curMips->pc); - switch (op >> 29) - { - case 0x0: - { - int imm = (s16)(op&0xFFFF) << 2; - int rs = _RS; - int rt = _RT; - u32 addr = curMips->pc + imm + 4; - switch (op >> 26) - { - case 4: if (R(rt) == R(rs)) DelayBranchTo(curMips, addr); else curMips->pc += 4; break; //beq - case 5: if (R(rt) != R(rs)) DelayBranchTo(curMips, addr); else curMips->pc += 4; break; //bne - case 6: if ((s32)R(rs) <= 0) DelayBranchTo(curMips, addr); else curMips->pc += 4; break; //blez - case 7: if ((s32)R(rs) > 0) DelayBranchTo(curMips, addr); else curMips->pc += 4; break; //bgtz - default: - goto interpret; - } - } - break; - - case 0x1: - { - int rt = _RT; - int rs = _RS; - switch (op >> 26) - { - case 8: R(rt) = R(rs) + SIMM16; break; //addi - case 9: R(rt) = R(rs) + SIMM16; break; //addiu - case 10: R(rt) = (s32)R(rs) < SIMM16; break; //slti - case 11: R(rt) = R(rs) < SUIMM16; break; //sltiu - case 12: R(rt) = R(rs) & UIMM16; break; //andi - case 13: R(rt) = R(rs) | UIMM16; break; //ori - case 14: R(rt) = R(rs) ^ UIMM16; break; //xori - case 15: R(rt) = UIMM16 << 16; break; //lui - default: - goto interpret; - } - currentMIPS->pc += 4; - } - break; - - case 0x4: - { - int rt = _RT; - int rs = _RS; - int imm = (s16)(op & 0xFFFF); - u32 addr = R(rs) + imm; - switch (op >> 26) - { - case 32: R(rt) = (u32)(s32)(s8) Memory::ReadUnchecked_U8(addr); break; //lb - case 33: R(rt) = (u32)(s32)(s16)Memory::ReadUnchecked_U16(addr); break; //lh - case 35: R(rt) = Memory::ReadUnchecked_U32(addr); break; //lw - case 36: R(rt) = Memory::ReadUnchecked_U8(addr); break; //lbu - case 37: R(rt) = Memory::ReadUnchecked_U16(addr); break; //lhu - default: - goto interpret; - } - currentMIPS->pc += 4; - } - break; - - case 0x5: - { - int rt = _RT; - int rs = _RS; - int imm = (s16)(op & 0xFFFF); - u32 addr = R(rs) + imm; - switch (op >> 26) - { - case 40: Memory::WriteUnchecked_U8(R(rt), addr); break; //sb - case 41: Memory::WriteUnchecked_U16(R(rt), addr); break; //sh - case 43: Memory::WriteUnchecked_U32(R(rt), addr); break; //sw - default: - goto interpret; - } - currentMIPS->pc += 4; - } - break; - - default: - interpret: - MIPSInterpret(op); - } - - if (curMips->inDelaySlot) - { - // The reason we have to check this is the delay slot hack in Int_Syscall. - if (wasInDelaySlot) - { - curMips->pc = curMips->nextPC; - curMips->inDelaySlot = false; - } - curMips->downcount -= 1; - goto again; - } - } - } - return 1; -} - - const char *MIPSGetName(u32 op) { static const char *noname = "unk"; diff --git a/Core/MIPS/MIPSTables.h b/Core/MIPS/MIPSTables.h index 9c15072b53..2d71bc73d1 100644 --- a/Core/MIPS/MIPSTables.h +++ b/Core/MIPS/MIPSTables.h @@ -57,7 +57,6 @@ void MIPSCompileOp(u32 op); void MIPSDisAsm(u32 op, u32 pc, char *out, bool tabsToSpaces = false); u32 MIPSGetInfo(u32 op); void MIPSInterpret(u32 op); //only for those rare ones -int MIPSInterpret_RunFastUntil(u64 globalTicks); int MIPSInterpret_RunUntil(u64 globalTicks); MIPSInterpretFunc MIPSGetInterpretFunc(u32 op); diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index ee2370c0da..d174cdb7e1 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -83,7 +83,7 @@ inline void ReadFromHardware(T &var, const u32 address) } else { - if (g_Config.iCpuCore == CPU_JIT) { + if (g_Config.bJit) { WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x", address); } else { WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); @@ -115,7 +115,7 @@ inline void WriteToHardware(u32 address, const T data) } else { - if (g_Config.iCpuCore == CPU_JIT) { + if (g_Config.bJit) { WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x", address); } else { WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index cd38e3ead5..ac7e4fc153 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -68,7 +68,7 @@ DWORD TheThread(LPVOID x) coreParameter.fileToStart = fileToStart; coreParameter.enableSound = true; coreParameter.gpuCore = GPU_GLES; - coreParameter.cpuCore = (CPUCore)g_Config.iCpuCore; + coreParameter.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER; coreParameter.enableDebugging = true; coreParameter.printfEmuLog = false; coreParameter.headLess = false; diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 8db545ffd4..b99eb0edbd 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -452,15 +452,11 @@ namespace MainWindow break; case ID_CPU_DYNAREC: - g_Config.iCpuCore = CPU_JIT; + g_Config.bJit = true; UpdateMenus(); break; case ID_CPU_INTERPRETER: - g_Config.iCpuCore = CPU_INTERPRETER; - UpdateMenus(); - break; - case ID_CPU_FASTINTERPRETER: - g_Config.iCpuCore = CPU_FASTINTERPRETER; + g_Config.bJit = false; UpdateMenus(); break; @@ -701,9 +697,8 @@ namespace MainWindow // CHECK(ID_OPTIONS_EMULATESYSCALL,g_bEmulateSyscall); CHECKITEM(ID_OPTIONS_DISPLAYRAWFRAMEBUFFER, g_Config.bDisplayFramebuffer); CHECKITEM(ID_OPTIONS_IGNOREILLEGALREADS,g_Config.bIgnoreBadMemAccess); - CHECKITEM(ID_CPU_INTERPRETER,g_Config.iCpuCore == CPU_INTERPRETER); - CHECKITEM(ID_CPU_FASTINTERPRETER,g_Config.iCpuCore == CPU_FASTINTERPRETER); - CHECKITEM(ID_CPU_DYNAREC,g_Config.iCpuCore == CPU_JIT); + CHECKITEM(ID_CPU_INTERPRETER,g_Config.bJit == true); + CHECKITEM(ID_CPU_DYNAREC,g_Config.bJit == false); CHECKITEM(ID_OPTIONS_BUFFEREDRENDERING, g_Config.bBufferedRendering); CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats); CHECKITEM(ID_OPTIONS_WIREFRAME, g_Config.bDrawWireframe); @@ -731,7 +726,6 @@ namespace MainWindow EnableMenuItem(menu,ID_FILE_QUICKLOADSTATE,!enable); EnableMenuItem(menu,ID_CPU_DYNAREC,enable); EnableMenuItem(menu,ID_CPU_INTERPRETER,enable); - EnableMenuItem(menu,ID_CPU_FASTINTERPRETER,enable); EnableMenuItem(menu,ID_DVD_INSERTISO,enable); EnableMenuItem(menu,ID_FILE_BOOTBIOS,enable); EnableMenuItem(menu,ID_EMULATION_STOP,!enable); diff --git a/Windows/main.cpp b/Windows/main.cpp index b568189d07..48fce377a6 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -76,15 +76,11 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin switch (__argv[i][1]) { case 'j': - g_Config.iCpuCore = CPU_JIT; + g_Config.bJit = true; g_Config.bSaveSettings = false; break; case 'i': - g_Config.iCpuCore = CPU_INTERPRETER; - g_Config.bSaveSettings = false; - break; - case 'f': - g_Config.iCpuCore = CPU_FASTINTERPRETER; + g_Config.bJit = false; g_Config.bSaveSettings = false; break; case 'l': @@ -163,8 +159,8 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin EmuThread_Start(fileToStart); } - else - MainWindow::BrowseAndBoot(); + // else + // MainWindow::BrowseAndBoot(); if (fileToStart != NULL && stateToLoad != NULL) SaveState::Load(stateToLoad); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index ae0ec17aca..e0a82cd7f4 100644 Binary files a/Windows/ppsspp.rc and b/Windows/ppsspp.rc differ diff --git a/android/jni/EmuScreen.cpp b/android/jni/EmuScreen.cpp index 875dff43ed..b3eb28e4fb 100644 --- a/android/jni/EmuScreen.cpp +++ b/android/jni/EmuScreen.cpp @@ -47,7 +47,7 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) INFO_LOG(BOOT, "Starting up hardware."); CoreParameter coreParam; - coreParam.cpuCore = (CPUCore)g_Config.iCpuCore; + coreParam.cpuCore = g_Config.bJit ? CPU_JIT : CPU_INTERPRETER; coreParam.gpuCore = GPU_GLES; coreParam.enableSound = g_Config.bEnableSound; coreParam.fileToStart = fileToStart; diff --git a/android/jni/MenuScreens.cpp b/android/jni/MenuScreens.cpp index 56b78410bf..0ac9a4e6ee 100644 --- a/android/jni/MenuScreens.cpp +++ b/android/jni/MenuScreens.cpp @@ -314,11 +314,9 @@ void SettingsScreen::render() { UICheckBox(GEN_ID, x, y += stride, "Draw using Stream VBO", ALIGN_TOPLEFT, &g_Config.bUseVBO); UICheckBox(GEN_ID, x, y += stride, "Vertex Cache", ALIGN_TOPLEFT, &g_Config.bVertexCache); - bool useJit = g_Config.iCpuCore == CPU_JIT; - UICheckBox(GEN_ID, x, y += stride, "JIT (Dynarec)", ALIGN_TOPLEFT, &useJit); - if (g_Config.iCpuCore == CPU_JIT) - UICheckBox(GEN_ID, x + 450, y, "Fastmem (may crash)", ALIGN_TOPLEFT, &g_Config.bFastMemory); - g_Config.iCpuCore = useJit ? CPU_JIT : CPU_INTERPRETER; + UICheckBox(GEN_ID, x, y += stride, "JIT (Dynarec)", ALIGN_TOPLEFT, &g_Config.bJit); + if (g_Config.bJit) + UICheckBox(GEN_ID, x + 450, y, "Fastmem (may be unstable)", ALIGN_TOPLEFT, &g_Config.bFastMemory); // ui_draw2d.DrawText(UBUNTU48, "much faster JIT coming later", x, y+=50, 0xcFFFFFFF, ALIGN_LEFT); UICheckBox(GEN_ID, x, y += stride, "On-screen Touch Controls", ALIGN_TOPLEFT, &g_Config.bShowTouchControls); if (g_Config.bShowTouchControls) { diff --git a/android/jni/NativeApp.cpp b/android/jni/NativeApp.cpp index a5fbc3a1a4..7bde05e9d2 100644 --- a/android/jni/NativeApp.cpp +++ b/android/jni/NativeApp.cpp @@ -201,15 +201,11 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co gfxLog = true; break; case 'j': - g_Config.iCpuCore = CPU_JIT; - g_Config.bSaveSettings = false; - break; - case 'f': - g_Config.iCpuCore = CPU_FASTINTERPRETER; + g_Config.bJit = true; g_Config.bSaveSettings = false; break; case 'i': - g_Config.iCpuCore = CPU_INTERPRETER; + g_Config.bJit = false; g_Config.bSaveSettings = false; break; case '-': diff --git a/native b/native index 3caced8524..f5e7bd5a9c 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 3caced8524c06cabcf968942a7780d80337de7bf +Subproject commit f5e7bd5a9c3e4b39a4eac71b577f06ad54f2bc96