Merge pull request #1026 from LukeUsher/hack-use-all-cores
Add optional speedhack to use all available cores
This commit is contained in:
commit
3db17d01cc
Binary file not shown.
BIN
resource/Cxbx.rc
BIN
resource/Cxbx.rc
Binary file not shown.
|
@ -111,6 +111,7 @@
|
|||
#define ID_EMULATION_STARTDEBUGGER 40092
|
||||
#define ID_FPS 40096
|
||||
#define ID_HACKS_UNCAPFRAMERATE 40097
|
||||
#define ID_HACKS_RUNXBOXTHREADSONALLCORES 40098
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
|
|
|
@ -96,7 +96,8 @@ void WndMain::InitializeSettings() {
|
|||
RegDeleteValue(hKey, buffer);
|
||||
}
|
||||
RegDeleteValue(hKey, "CxbxDebug"); RegDeleteValue(hKey, "CxbxDebugFilename");
|
||||
RegDeleteValue(hKey, "HackDisablePixelShaders"); RegDeleteValue(hKey, "KrnlDebug");
|
||||
RegDeleteValue(hKey, "HackDisablePixelShaders"); RegDeleteValue(hKey, "HackUncapFrameRate");
|
||||
RegDeleteValue(hKey, "HackUseAllCores"); RegDeleteValue(hKey, "KrnlDebug");
|
||||
RegDeleteValue(hKey, "KrnlDebugFilename"); RegDeleteValue(hKey, "LLEFLAGS");
|
||||
RegDeleteValue(hKey, "RecentXbe"); RegDeleteValue(hKey, "XInputEnabled");
|
||||
|
||||
|
@ -183,6 +184,12 @@ WndMain::WndMain(HINSTANCE x_hInstance) :
|
|||
m_UncapFramerate = 0;
|
||||
}
|
||||
|
||||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
result = RegQueryValueEx(hKey, "HackUseAllCores", NULL, &dwType, (PBYTE)&m_UseAllCores, &dwSize);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
m_UseAllCores = 0;
|
||||
}
|
||||
|
||||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
result = RegQueryValueEx(hKey, "CxbxDebug", NULL, &dwType, (PBYTE)&m_CxbxDebug, &dwSize);
|
||||
if (result != ERROR_SUCCESS) {
|
||||
|
@ -336,6 +343,12 @@ WndMain::~WndMain()
|
|||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
RegSetValueEx(hKey, "HackDisablePixelShaders", 0, dwType, (PBYTE)&m_DisablePixelShaders, dwSize);
|
||||
|
||||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
RegSetValueEx(hKey, "HackUncapFrameRate", 0, dwType, (PBYTE)&m_UncapFramerate, dwSize);
|
||||
|
||||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
RegSetValueEx(hKey, "HackUseAllCores", 0, dwType, (PBYTE)&m_UseAllCores, dwSize);
|
||||
|
||||
dwType = REG_DWORD; dwSize = sizeof(DWORD);
|
||||
RegSetValueEx(hKey, "CxbxDebug", 0, dwType, (PBYTE)&m_CxbxDebug, dwSize);
|
||||
|
||||
|
@ -1293,6 +1306,11 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||
RefreshMenus();
|
||||
break;
|
||||
|
||||
case ID_HACKS_RUNXBOXTHREADSONALLCORES:
|
||||
m_UseAllCores = !m_UseAllCores;
|
||||
RefreshMenus();
|
||||
break;
|
||||
|
||||
|
||||
case ID_HELP_ABOUT:
|
||||
{
|
||||
|
@ -1718,6 +1736,9 @@ void WndMain::RefreshMenus()
|
|||
|
||||
chk_flag = (m_UncapFramerate) ? MF_CHECKED : MF_UNCHECKED;
|
||||
CheckMenuItem(settings_menu, ID_HACKS_UNCAPFRAMERATE, chk_flag);
|
||||
|
||||
chk_flag = (m_UseAllCores) ? MF_CHECKED : MF_UNCHECKED;
|
||||
CheckMenuItem(settings_menu, ID_HACKS_RUNXBOXTHREADSONALLCORES, chk_flag);
|
||||
}
|
||||
|
||||
// emulation menu
|
||||
|
@ -2090,6 +2111,7 @@ void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /
|
|||
// register Hacks with emulator process
|
||||
g_EmuShared->SetDisablePixelShaders(&m_DisablePixelShaders);
|
||||
g_EmuShared->SetUncapFramerate(&m_UncapFramerate);
|
||||
g_EmuShared->SetUseAllCores(&m_UseAllCores);
|
||||
|
||||
// shell exe
|
||||
{
|
||||
|
|
|
@ -215,6 +215,7 @@ class WndMain : public Wnd
|
|||
// ******************************************************************
|
||||
int m_DisablePixelShaders;
|
||||
int m_UncapFramerate;
|
||||
int m_UseAllCores;
|
||||
|
||||
// ******************************************************************
|
||||
// * debug output filenames
|
||||
|
|
|
@ -578,6 +578,7 @@ void PrintCurrentConfigurationLog()
|
|||
printf("--------------------------- HACKS CONFIG ---------------------------\n");
|
||||
printf("Disable Pixel Shaders: %s\n", g_DisablePixelShaders == 1 ? "On" : "Off");
|
||||
printf("Uncap Framerate: %s\n", g_UncapFramerate == 1 ? "On" : "Off");
|
||||
printf("Run Xbox threads on all cores: %s\n", g_UseAllCores == 1 ? "On" : "Off");
|
||||
}
|
||||
|
||||
printf("------------------------- END OF CONFIG LOG ------------------------\n");
|
||||
|
@ -1036,6 +1037,8 @@ __declspec(noreturn) void CxbxKrnlInit
|
|||
g_DisablePixelShaders = !!HackEnabled;
|
||||
g_EmuShared->GetUncapFramerate(&HackEnabled);
|
||||
g_UncapFramerate = !!HackEnabled;
|
||||
g_EmuShared->GetUseAllCores(&HackEnabled);
|
||||
g_UseAllCores = !!HackEnabled;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG_PRINT_CURRENT_CONF
|
||||
|
|
|
@ -66,6 +66,7 @@ volatile bool g_bPrintfOn = true;
|
|||
bool g_XInputEnabled = false;
|
||||
bool g_DisablePixelShaders = false;
|
||||
bool g_UncapFramerate = false;
|
||||
bool g_UseAllCores = false;
|
||||
|
||||
// Delta added to host SystemTime, used in xboxkrnl::KeQuerySystemTime and xboxkrnl::NtSetSystemTime
|
||||
LARGE_INTEGER HostSystemTimeDelta = {};
|
||||
|
|
|
@ -109,4 +109,5 @@ typedef struct DUMMY_KERNEL
|
|||
|
||||
extern bool g_DisablePixelShaders;
|
||||
extern bool g_UncapFramerate;
|
||||
extern bool g_UseAllCores;
|
||||
#endif
|
||||
|
|
|
@ -104,8 +104,10 @@ void InitXboxThread(DWORD_PTR cores)
|
|||
_controlfp(_PC_53, _MCW_PC); // Set Precision control to 53 bits (verified setting)
|
||||
_controlfp(_RC_NEAR, _MCW_RC); // Set Rounding control to near (unsure about this)
|
||||
|
||||
// Run this thread solely on the indicated core(s) :
|
||||
SetThreadAffinityMask(GetCurrentThread(), cores);
|
||||
if (!g_UseAllCores) {
|
||||
// Run this thread solely on the indicated core(s) :
|
||||
SetThreadAffinityMask(GetCurrentThread(), cores);
|
||||
}
|
||||
}
|
||||
|
||||
// PsCreateSystemThread proxy procedure
|
||||
|
|
|
@ -124,6 +124,8 @@ class EmuShared : public Mutex
|
|||
void SetDisablePixelShaders(int* value) { Lock(); m_DisablePixelShaders = *value; Unlock(); }
|
||||
void GetUncapFramerate(int* value) { Lock(); *value = m_UncapFramerate; Unlock(); }
|
||||
void SetUncapFramerate(int* value) { Lock(); m_UncapFramerate = *value; Unlock(); }
|
||||
void GetUseAllCores(int* value) { Lock(); *value = m_UseAllCores; Unlock(); }
|
||||
void SetUseAllCores(int* value) { Lock(); m_UseAllCores = *value; Unlock(); }
|
||||
|
||||
// ******************************************************************
|
||||
// * MSpF/Benchmark values Accessors
|
||||
|
@ -191,6 +193,7 @@ class EmuShared : public Mutex
|
|||
int m_XInputEnabled;
|
||||
int m_DisablePixelShaders;
|
||||
int m_UncapFramerate;
|
||||
int m_UseAllCores;
|
||||
float m_MSpF;
|
||||
float m_FPS;
|
||||
bool m_bMultiXbeFlag;
|
||||
|
|
Loading…
Reference in New Issue