diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp index f34b04acfa..de371d7595 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp @@ -102,4 +102,8 @@ namespace AudioCommon return backends; } + + bool UseJIT() { + return ac_Config.m_EnableJIT; + } } diff --git a/Source/Core/AudioCommon/Src/AudioCommon.h b/Source/Core/AudioCommon/Src/AudioCommon.h index 6edb792004..68e15f2a19 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.h +++ b/Source/Core/AudioCommon/Src/AudioCommon.h @@ -60,6 +60,7 @@ namespace AudioCommon SoundStream *InitSoundStream(CMixer *mixer = NULL); void ShutdownSoundStream(); std::vector GetSoundBackends(); + bool UseJIT(); } #endif // _AUDIO_COMMON_H_ diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp index a186c5cbaf..f62e4b3863 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp @@ -22,6 +22,7 @@ AudioCommonConfig ac_Config; void AudioCommonConfig::Load(IniFile &file) { file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); + file.Get("Config", "EnableJIT", &m_EnableJIT, true); file.Get("Config", "Volume", &m_Volume, 75); #ifdef _WIN32 file.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND); @@ -38,6 +39,7 @@ void AudioCommonConfig::Load(IniFile &file) { void AudioCommonConfig::Set(IniFile &file) { file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); file.Set("Config", "EnableThrottle", m_EnableThrottle); + file.Set("Config", "EnableJIT", m_EnableJIT); file.Set("Config", "Backend", sBackend); file.Set("Config", "Volume", m_Volume); } diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.h b/Source/Core/AudioCommon/Src/AudioCommonConfig.h index fd15c9fd59..9f1d1f2915 100644 --- a/Source/Core/AudioCommon/Src/AudioCommonConfig.h +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.h @@ -33,6 +33,7 @@ struct AudioCommonConfig { bool m_EnableDTKMusic; bool m_EnableThrottle; + bool m_EnableJIT; int m_Volume; #ifdef __APPLE__ char sBackend[128]; diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp index 522a8a572a..ba471a336f 100644 --- a/Source/Core/Common/Src/ABI.cpp +++ b/Source/Core/Common/Src/ABI.cpp @@ -66,6 +66,13 @@ void XEmitter::ABI_CallFunction(void *func) { ABI_RestoreStack(0); } +void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) { + ABI_AlignStack(1 * 2); + PUSH(16, Imm16(param1)); + CALL(func); + ABI_RestoreStack(1 * 2); +} + void XEmitter::ABI_CallFunctionC(void *func, u32 param1) { ABI_AlignStack(1 * 4); PUSH(32, Imm32(param1)); @@ -182,7 +189,16 @@ void XEmitter::ABI_RestoreStack(unsigned int frameSize) { // Common functions void XEmitter::ABI_CallFunction(void *func) { - CALL(func); + // Far call + MOV(64, R(RAX), Imm64((u64)func));CALLptr(R(RAX)); + //CALL(func); +} + +void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) { + MOV(16, R(ABI_PARAM1), Imm16(param1)); + // Far call + MOV(64, R(RAX), Imm64((u64)func));CALLptr(R(RAX)); + //CALL(func); } void XEmitter::ABI_CallFunctionC(void *func, u32 param1) { diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h index dd11468580..e4d7013f87 100644 --- a/Source/Core/Common/Src/x64Emitter.h +++ b/Source/Core/Common/Src/x64Emitter.h @@ -590,6 +590,9 @@ public: // The difference between this and CALL is that this aligns the stack // where appropriate. void ABI_CallFunction(void *func); + + void ABI_CallFunctionC16(void *func, u16 param1); + // These only support u32 parameters, but that's enough for a lot of uses. // These will destroy the 1 or 2 first "parameter regs". void ABI_CallFunctionC(void *func, u32 param1);