Fix a potential issue when someone has a CPU core that isn't available on that host set in the INI file, it would just fail out. Now it defaults to interpreter.

This commit is contained in:
Ryan Houdek 2013-03-08 10:52:04 -06:00
parent be217bf096
commit f6d45ea461
3 changed files with 9 additions and 4 deletions

View File

@ -81,6 +81,7 @@ namespace JitInterface
default: default:
{ {
PanicAlert("Unrecognizable cpu_core: %d", core); PanicAlert("Unrecognizable cpu_core: %d", core);
jit = NULL;
return NULL; return NULL;
break; break;
} }

View File

@ -51,6 +51,3 @@ namespace JitInterface
extern bool bFakeVMEM; extern bool bFakeVMEM;
extern bool bMMU; extern bool bMMU;
#ifdef _M_ARM
#include "JitArm32/Jit.h"
#endif

View File

@ -161,13 +161,18 @@ void Init(int cpu_core)
switch (cpu_core) switch (cpu_core)
{ {
case 0: case 0:
{ {
cpu_core_base = interpreter; cpu_core_base = interpreter;
break; break;
} }
default: default:
cpu_core_base = JitInterface::InitJitCore(cpu_core); cpu_core_base = JitInterface::InitJitCore(cpu_core);
if (!cpu_core_base) // Handle Situations where JIT core isn't available
{
WARN_LOG(POWERPC, "Jit core %d not available. Defaulting to interpreter.", cpu_core);
cpu_core_base = interpreter;
}
break; break;
} }
@ -213,6 +218,8 @@ void SetMode(CoreMode new_mode)
case MODE_JIT: // Switching from interpreter to JIT. case MODE_JIT: // Switching from interpreter to JIT.
// Don't really need to do much. It'll work, the cache will refill itself. // Don't really need to do much. It'll work, the cache will refill itself.
cpu_core_base = JitInterface::GetCore(); cpu_core_base = JitInterface::GetCore();
if (!cpu_core_base) // Has a chance to not get a working JIT core if one isn't active on host
cpu_core_base = interpreter;
break; break;
} }
} }