Permalink
Browse files

Prep for Pixel Shaders Disable Hack

- Implements error checking/default value enforcement on registry reads
- Adds a new option (currently does nothing) for enabling the hack.
  • Loading branch information...
LukeUsher committed Jan 10, 2018
1 parent 262ab1b commit d2edfb10b9d577094dba6789703bece079c3f804
View
Binary file not shown.
View
@@ -127,16 +127,16 @@ BEGIN
END
POPUP "&Settings"
BEGIN
MENUITEM "Config &Controller...", ID_SETTINGS_CONFIG_CONTROLLER
MENUITEM "Config &Controller...", ID_SETTINGS_CONFIG_CONTROLLER
MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO
MENUITEM "Config &Audio...", ID_SETTINGS_CONFIG_AUDIO
MENUITEM SEPARATOR
MENUITEM "Use XInput", ID_SETTINGS_XINPUT
MENUITEM SEPARATOR
POPUP "&HLE Cache"
BEGIN
MENUITEM "&Clear entire HLE Cache", ID_CACHE_CLEARHLECACHE_ALL
MENUITEM "&Rescan title HLE Cache", ID_CACHE_CLEARHLECACHE_CURRENT
MENUITEM "&Clear entire HLE Cache", ID_CACHE_CLEARHLECACHE_ALL
MENUITEM "&Rescan title HLE Cache", ID_CACHE_CLEARHLECACHE_CURRENT
END
MENUITEM SEPARATOR
POPUP "&LLE (Experimental)"
@@ -145,6 +145,10 @@ BEGIN
MENUITEM "LLE &APU", ID_EMULATION_LLE_APU
MENUITEM "LLE &GPU", ID_EMULATION_LLE_GPU
END
POPUP "Hacks"
BEGIN
MENUITEM "Disable Pixel Shaders", ID_HACKS_DISABLEPIXELSHADERS
END
END
POPUP "E&mulation"
BEGIN
@@ -232,11 +236,6 @@ BEGIN
PUSHBUTTON "Click to configure all input...",IDC_CONFIGURE_ALL,6,102,210,14,BS_FLAT
END
/////////////////////////////////////////////////////////////////////////////
//
// Video Configuration
//
IDD_VIDEO_CFG DIALOGEX 0, 0, 259, 121
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Video Configuration"
@@ -256,31 +255,23 @@ BEGIN
LTEXT "Other Options:",IDC_STATIC,21,71,49,8,0,WS_EX_RIGHT
CONTROL "Enable Hardware YUV Overlays",IDC_CV_HARDWAREYUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,84,123,11
END
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// Audio Configuration
//
IDD_AUDIO_CFG DIALOGEX 0, 0, 259, 121
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Audio Configuration"
FONT 8, "Verdana", 0, 0, 0x1
BEGIN
COMBOBOX IDC_AC_AUDIO_ADAPTER, 76, 12, 173, 100, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable PCM", IDC_AC_PCM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 46, 65, 10
CONTROL "Enable XADPCM", IDC_AC_XADPCM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 59, 123, 11
CONTROL "Enable Unknown Codec", IDC_AC_UNKNOWN_CODEC, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 72, 98, 10
CONTROL "Use Legacy Audio Hack", IDC_AC_LEGACY_AUDIO_HACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 76, 33, 98, 10
PUSHBUTTON "Cancel", IDC_AC_CANCEL, 146, 102, 50, 14, BS_FLAT
PUSHBUTTON "Accept", IDC_AC_ACCEPT, 206, 102, 50, 14, BS_FLAT
GROUPBOX "DirectSound Configuration", IDC_STATIC, 4, 1, 250, 98, BS_CENTER
LTEXT "Audio Adapter:", IDC_STATIC, 13, 14, 57, 8, 0, WS_EX_RIGHT
LTEXT "Other Options:", IDC_STATIC, 13, 33, 57, 8, 0, WS_EX_RIGHT
COMBOBOX IDC_AC_AUDIO_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable PCM",IDC_AC_PCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,46,65,10
CONTROL "Enable XADPCM",IDC_AC_XADPCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,59,123,11
CONTROL "Enable Unknown Codec",IDC_AC_UNKNOWN_CODEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,72,98,10
CONTROL "Use Legacy Audio Hack",IDC_AC_LEGACY_AUDIO_HACK,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,76,33,98,10
PUSHBUTTON "Cancel",IDC_AC_CANCEL,146,102,50,14,BS_FLAT
PUSHBUTTON "Accept",IDC_AC_ACCEPT,206,102,50,14,BS_FLAT
GROUPBOX "DirectSound Configuration",IDC_STATIC,4,1,250,98,BS_CENTER
LTEXT "Audio Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT
END
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
View
@@ -1,6 +1,5 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by C:\Users\lukeu\Desktop\Projects\Xbox\Cxbx-Reloaded\resource\Cxbx.rc
//
#define IDI_CXBX 101
#define IDB_SPLASH 102
@@ -102,14 +101,16 @@
#define ID_CACHE_CLEARHLECACHE_ALL 40084
#define ID_CACHE_CLEARHLECACHE_CURRENT 40085
#define ID_SETTINGS_XINPUT 40086
#define ID_SETTINGS_HACKS 40087
#define ID_HACKS_DISABLEPIXELSHADERS 40088
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40087
#define _APS_NEXT_COMMAND_VALUE 40089
#define _APS_NEXT_CONTROL_VALUE 1058
#define _APS_NEXT_SYMED_VALUE 104
#endif
View
@@ -131,26 +131,55 @@ WndMain::WndMain(HINSTANCE x_hInstance) :
if(RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Cxbx-Reloaded", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
{
LONG result = ERROR_SUCCESS;
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "LLEFLAGS", NULL, &dwType, (PBYTE)&m_FlagsLLE, &dwSize);
result = RegQueryValueEx(hKey, "LLEFLAGS", NULL, &dwType, (PBYTE)&m_FlagsLLE, &dwSize);
if (result != ERROR_SUCCESS) {
m_FlagsLLE = 0;
}
dwType = REG_DWORD; dwSize = sizeof(DWORD);
result = RegQueryValueEx(hKey, "XInputEnabled", NULL, &dwType, (PBYTE)&m_XInputEnabled, &dwSize);
if (result != ERROR_SUCCESS) {
m_XInputEnabled = 0;
}
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "XInputEnabled", NULL, &dwType, (PBYTE)&m_XInputEnabled, &dwSize);
result = RegQueryValueEx(hKey, "HackDisablePixelShaders", NULL, &dwType, (PBYTE)&m_DisablePixelShaders, &dwSize);
if (result != ERROR_SUCCESS) {
m_DisablePixelShaders = 0;
}
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "CxbxDebug", NULL, &dwType, (PBYTE)&m_CxbxDebug, &dwSize);
result = RegQueryValueEx(hKey, "CxbxDebug", NULL, &dwType, (PBYTE)&m_CxbxDebug, &dwSize);
if (result != ERROR_SUCCESS) {
m_CxbxDebug = DebugMode::DM_NONE;
}
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "KrnlDebug", NULL, &dwType, (PBYTE)&m_KrnlDebug, &dwSize);
result = RegQueryValueEx(hKey, "KrnlDebug", NULL, &dwType, (PBYTE)&m_KrnlDebug, &dwSize);
if (result != ERROR_SUCCESS) {
m_KrnlDebug = DebugMode::DM_NONE;
}
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegQueryValueEx(hKey, "RecentXbe", NULL, &dwType, (PBYTE)&m_dwRecentXbe, &dwSize);
result = RegQueryValueEx(hKey, "RecentXbe", NULL, &dwType, (PBYTE)&m_dwRecentXbe, &dwSize);
if (result != ERROR_SUCCESS) {
m_dwRecentXbe = 0;
}
dwType = REG_SZ; dwSize = MAX_PATH; LONG lErrCodeCxbxDebugFilename;
dwType = REG_SZ; dwSize = MAX_PATH; ULONG lErrCodeCxbxDebugFilename;
lErrCodeCxbxDebugFilename = RegQueryValueEx(hKey, "CxbxDebugFilename", NULL, &dwType, (PBYTE)m_CxbxDebugFilename, &dwSize);
if (lErrCodeCxbxDebugFilename != ERROR_SUCCESS) {
m_CxbxDebugFilename = "";
}
dwType = REG_SZ; dwSize = MAX_PATH; LONG lErrCodeKrnlDebugFilename;
lErrCodeKrnlDebugFilename = RegQueryValueEx(hKey, "KrnlDebugFilename", NULL, &dwType, (PBYTE)m_KrnlDebugFilename, &dwSize);
if (lErrCodeKrnlDebugFilename != ERROR_SUCCESS) {
m_KrnlDebugFilename = "";
}
// Prevent using an incorrect path from the registry if the debug folders have been moved
if (m_CxbxDebug == DM_FILE)
@@ -228,7 +257,11 @@ WndMain::WndMain(HINSTANCE x_hInstance) :
m_szRecentXbe[v] = (char*)calloc(1, MAX_PATH);
dwType = REG_SZ; dwSize = MAX_PATH;
RegQueryValueEx(hKey, buffer, NULL, &dwType, (PBYTE)m_szRecentXbe[v], &dwSize);
result = RegQueryValueEx(hKey, buffer, NULL, &dwType, (PBYTE)m_szRecentXbe[v], &dwSize);
if (result != ERROR_SUCCESS) {
m_szRecentXbe[v] = "";
}
}
RegCloseKey(hKey);
@@ -268,6 +301,9 @@ WndMain::~WndMain()
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegSetValueEx(hKey, "XInputEnabled", 0, dwType, (PBYTE)&m_XInputEnabled, dwSize);
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegSetValueEx(hKey, "HackDisablePixelShaders", 0, dwType, (PBYTE)&m_DisablePixelShaders, dwSize);
dwType = REG_DWORD; dwSize = sizeof(DWORD);
RegSetValueEx(hKey, "CxbxDebug", 0, dwType, (PBYTE)&m_CxbxDebug, dwSize);
@@ -1177,6 +1213,11 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
StopEmulation();
break;
case ID_HACKS_DISABLEPIXELSHADERS:
m_DisablePixelShaders = !m_DisablePixelShaders;
RefreshMenus();
break;
case ID_HELP_ABOUT:
{
ShowAboutDialog(hwnd);
@@ -1571,6 +1612,9 @@ void WndMain::RefreshMenus()
chk_flag = (m_XInputEnabled) ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(settings_menu, ID_SETTINGS_XINPUT, chk_flag);
chk_flag = (m_DisablePixelShaders) ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(settings_menu, ID_HACKS_DISABLEPIXELSHADERS, chk_flag);
}
// emulation menu
@@ -1906,6 +1950,9 @@ void WndMain::StartEmulation(HWND hwndParent)
// register XInput flags with emulator process
g_EmuShared->SetXInputEnabled(&m_XInputEnabled);
// register Hacks with emulator process
g_EmuShared->SetDisablePixelShaders(&m_DisablePixelShaders);
// shell exe
{
GetModuleFileName(NULL, szBuffer, MAX_PATH);
View
@@ -188,10 +188,15 @@ class WndMain : public Wnd
int m_FlagsLLE;
// ******************************************************************
// * XInout Enabled Flag
// * XInput Enabled Flag
// ******************************************************************
int m_XInputEnabled;
// ******************************************************************
// * Hack Flags
// ******************************************************************
int m_DisablePixelShaders;
// ******************************************************************
// * debug output filenames
// ******************************************************************
View
@@ -486,6 +486,12 @@ void PrintCurrentConfigurationLog()
printf("Unknown Codec is %s\n", XBAudioConf.GetUnknownCodec() ? "enabled" : "disabled");
}
// Print Enabled Hacks
{
printf("--------------------------- HACKS CONFIG ---------------------------\n");
printf("Disable Pixel Shaders: %s\n", g_DisablePixelShaders == 0 ? "enabled" : "disabled");
}
printf("------------------------- END OF CONFIG LOG ------------------------\n");
}
@@ -877,6 +883,13 @@ __declspec(noreturn) void CxbxKrnlInit
g_XInputEnabled = !!XInputEnabled;
}
// Process Hacks
{
int HackEnabled = 0;
g_EmuShared->GetDisablePixelShaders(&HackEnabled);
g_DisablePixelShaders = !!HackEnabled;
}
#ifdef _DEBUG_PRINT_CURRENT_CONF
PrintCurrentConfigurationLog();
#endif
View
@@ -70,6 +70,7 @@ volatile thread_local bool g_bEmuException = false;
volatile bool g_bEmuSuspended = false;
volatile bool g_bPrintfOn = true;
bool g_XInputEnabled = false;
bool g_DisablePixelShaders = false;
// Delta added to host SystemTime, used in xboxkrnl::KeQuerySystemTime and xboxkrnl::NtSetSystemTime
LARGE_INTEGER HostSystemTimeDelta = {};
View
@@ -108,4 +108,7 @@ typedef struct DUMMY_KERNEL
IMAGE_SECTION_HEADER SectionHeader;
} *PDUMMY_KERNEL;
extern bool g_DisablePixelShaders;
#endif
View
@@ -106,6 +106,12 @@ class EmuShared : public Mutex
void GetXInputEnabled(int* value) { Lock(); *value = m_XInputEnabled; Unlock(); }
void SetXInputEnabled(int* value) { Lock(); m_XInputEnabled = *value; Unlock(); }
// ******************************************************************
// * Hack Flag Accessors
// ******************************************************************
void GetDisablePixelShaders(int* value) { Lock(); *value = m_DisablePixelShaders; Unlock(); }
void SetDisablePixelShaders(int* value) { Lock(); m_DisablePixelShaders = *value; Unlock(); }
// ******************************************************************
// * MSpF/Benchmark values Accessors
// ******************************************************************
@@ -147,6 +153,7 @@ class EmuShared : public Mutex
char m_XbePath[MAX_PATH];
int m_FlagsLLE;
int m_XInputEnabled;
int m_DisablePixelShaders;
float m_MSpF;
float m_FPS;
bool m_bMultiXbe;

0 comments on commit d2edfb1

Please sign in to comment.