diff --git a/resource/Cxbx.aps b/resource/Cxbx.aps index b39263e4b..ee759b60d 100644 Binary files a/resource/Cxbx.aps and b/resource/Cxbx.aps differ diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc index 1e797b579..4595da16f 100644 --- a/resource/Cxbx.rc +++ b/resource/Cxbx.rc @@ -127,7 +127,7 @@ 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 @@ -135,8 +135,8 @@ BEGIN 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)" @@ -149,6 +149,8 @@ BEGIN POPUP "E&mulation" BEGIN MENUITEM "&Start\tF5", ID_EMULATION_START, GRAYED + MENUITEM "Start with &Debugger...", ID_EMULATION_STARTDEBUG + MENUITEM SEPARATOR MENUITEM "S&top\tF6", ID_EMULATION_STOP, GRAYED END POPUP "&Help" @@ -232,11 +234,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 +253,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 -///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/src/Cxbx/ResCxbx.h b/src/Cxbx/ResCxbx.h index 3d721bd67..fb18755fb 100644 --- a/src/Cxbx/ResCxbx.h +++ b/src/Cxbx/ResCxbx.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by C:\Users\lukeu\Desktop\Projects\Xbox\Cxbx-Reloaded\resource\Cxbx.rc +// Used by S:\GitHub\Cxbx-Reloaded\resource\Cxbx.rc // #define IDI_CXBX 101 #define IDB_SPLASH 102 @@ -102,6 +102,7 @@ #define ID_CACHE_CLEARHLECACHE_ALL 40084 #define ID_CACHE_CLEARHLECACHE_CURRENT 40085 #define ID_SETTINGS_XINPUT 40086 +#define ID_EMULATION_STARTDEBUG 40087 #define IDC_STATIC -1 // Next default values for new objects @@ -109,7 +110,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 130 -#define _APS_NEXT_COMMAND_VALUE 40087 +#define _APS_NEXT_COMMAND_VALUE 40088 #define _APS_NEXT_CONTROL_VALUE 1058 #define _APS_NEXT_SYMED_VALUE 104 #endif diff --git a/src/Cxbx/WndMain.cpp b/src/Cxbx/WndMain.cpp index 8320b665e..9835f5a89 100644 --- a/src/Cxbx/WndMain.cpp +++ b/src/Cxbx/WndMain.cpp @@ -1169,8 +1169,18 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP RefreshMenus(); break; - case ID_EMULATION_START: - StartEmulation(hwnd); + case ID_EMULATION_START: + if (m_Xbe != nullptr) + { + StartEmulation(hwnd); + } + break; + + case ID_EMULATION_STARTDEBUG: + if (m_Xbe != nullptr) + { + StartEmulation(hwnd, true); + } break; case ID_EMULATION_STOP: @@ -1580,6 +1590,9 @@ void WndMain::RefreshMenus() // enable emulation start EnableMenuItem(emul_menu, ID_EMULATION_START, MF_BYCOMMAND | MF_WhenXbeLoadedNotRunning); + // enable emulation with debugging + EnableMenuItem(emul_menu, ID_EMULATION_STARTDEBUG, MF_BYCOMMAND | MF_WhenXbeLoadedNotRunning); + // enable emulation stop EnableMenuItem(emul_menu, ID_EMULATION_STOP, MF_BYCOMMAND | MF_WhenXbeLoadedAndRunning); } @@ -1893,7 +1906,7 @@ void WndMain::SaveXbeAs() } // start emulation -void WndMain::StartEmulation(HWND hwndParent) +void WndMain::StartEmulation(HWND hwndParent, bool WithLocalDebugger /*= false*/) { char szBuffer[MAX_PATH]; @@ -1920,16 +1933,39 @@ void WndMain::StartEmulation(HWND hwndParent) char szArgsBuffer[4096]; snprintf(szArgsBuffer, 4096, "/load \"%s\" %d %d \"%s\"", m_XbeFilename, (int)hwndParent, (int)m_KrnlDebug, m_KrnlDebugFilename); - if((int)ShellExecute(NULL, "open", szExeFileName, szArgsBuffer, szBuffer, SW_SHOWDEFAULT) <= 32) + if (WithLocalDebugger) { - MessageBox(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.", "Cxbx-Reloaded", MB_ICONSTOP | MB_OK); + // TODO: Set a configuration variable for this. For now it will be within the same folder as Cxbx.exe + const char* szDebugger = "CxbxDebugger.exe"; - printf("WndMain: %s shell failed.\n", m_Xbe->m_szAsciiTitle); + char szDbgArgsBuffer[4096]; + snprintf(szDbgArgsBuffer, 4096, "%s %s", szExeFileName, szArgsBuffer); + + if ((int)ShellExecute(NULL, "open", szDebugger, szDbgArgsBuffer, szBuffer, SW_SHOWDEFAULT) <= 32) + { + MessageBox(m_hwnd, "Failed to start emulation with the debugger.\n\nYou will need to build CxbxDebugger manually.", "Cxbx-Reloaded", MB_ICONSTOP | MB_OK); + + printf("WndMain: %s debugger shell failed.\n", m_Xbe->m_szAsciiTitle); + } + else + { + m_bIsStarted = true; + printf("WndMain: %s emulation started with debugger.\n", m_Xbe->m_szAsciiTitle); + } } else { - m_bIsStarted = true; - printf("WndMain: %s emulation started.\n", m_Xbe->m_szAsciiTitle); + if ((int)ShellExecute(NULL, "open", szExeFileName, szArgsBuffer, szBuffer, SW_SHOWDEFAULT) <= 32) + { + MessageBox(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.", "Cxbx-Reloaded", MB_ICONSTOP | MB_OK); + + printf("WndMain: %s shell failed.\n", m_Xbe->m_szAsciiTitle); + } + else + { + m_bIsStarted = true; + printf("WndMain: %s emulation started.\n", m_Xbe->m_szAsciiTitle); + } } } } diff --git a/src/Cxbx/WndMain.h b/src/Cxbx/WndMain.h index a7b7c3540..14fc0b454 100644 --- a/src/Cxbx/WndMain.h +++ b/src/Cxbx/WndMain.h @@ -68,7 +68,7 @@ class WndMain : public Wnd // ****************************************************************** // * start emulation // ****************************************************************** - void StartEmulation(HWND hwndParent); + void StartEmulation(HWND hwndParent, bool WithLocalDebugger = false); // ****************************************************************** // * stop emulation (close existing child window)