From fc6a7c47d56907bf5084024212eb349b21af23f9 Mon Sep 17 00:00:00 2001 From: John Peterson Date: Sun, 22 Feb 2009 04:24:53 +0000 Subject: [PATCH] Core Stop and Start: Fixed stop and start again by avoiding FreeLibrary() of the OpenGL plugin, and avoiding a crash in its ShutDown() function. You need to use SETUP_FREE_PLUGIN_ON_BOOT to compile with this option that works on my system. Also, I noticed that I don't need the SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG anymore, I can now delete the g_EmuThread without having it hanging in its waiting function. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2356 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Setup.h | 3 +- Source/Core/Core/Src/Core.cpp | 14 +++-- Source/Core/Core/Src/PluginManager.cpp | 2 + Source/Core/DolphinWX/Src/FrameTools.cpp | 7 +-- Source/Core/InputCommon/Src/SDL.cpp | 2 + Source/MusicMod.sln | 12 ++-- .../Plugin_DSP_HLE/Src/UCodes/UCodes.cpp | 10 ++-- .../Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp | 18 +++++- Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 57 +++++++++++++++---- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp | 18 +++--- 10 files changed, 98 insertions(+), 45 deletions(-) diff --git a/Source/Core/Common/Src/Setup.h b/Source/Core/Common/Src/Setup.h index 06f70e1c18..ae7eb63637 100644 --- a/Source/Core/Common/Src/Setup.h +++ b/Source/Core/Common/Src/Setup.h @@ -39,7 +39,8 @@ // This may fix a problem with Stop and Start that I described in the comments to revision 2,139 //#define SETUP_FREE_PLUGIN_ON_BOOT -// Use Stop when rendering to a child window +/* This will avoid deleting the g_EmuThread after Stop, that may hang when we are rendering to a child + window, however, I didn't seem to need this any more */ //#define SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG // Build with playback rerecording options diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 8651d5c4ef..82e7eec1ac 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -229,22 +229,26 @@ void Stop() // - Hammertime! // If dual core mode, the CPU thread should immediately exit here. - // The quit is to get it out of its message loop // Should be moved inside the plugin. - if (_CoreParameter.bUseDualCore) CPluginManager::GetInstance().GetVideo()->Video_ExitLoop(); + /* Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest + of the commands in this function */ + + /* The quit is to get it out of its message loop. There is no guarantee of when this will occur though. + And since we have no while(GetMessage()) loop we can't wait for this to happen, or say exactly when + the loop has ended */ #ifdef _WIN32 - PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0); + PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0); #endif Core::StopTrace(); LogManager::Shutdown(); Host_SetWaitCursor(false); #ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG - /* I have to use this to avoid the hangings, it seems harmless and it works so I'm - okay with it */ + /* This may hang when we are rendering to a child window, but currently it doesn't, at least + not on my system, but I'll leave this option for a while anyway */ if (GetParent((HWND)g_pWindowHandle) == NULL) #endif delete g_EmuThread; // Wait for emuthread to close. diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index c3f0e84476..d646c7d6a5 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -72,6 +72,7 @@ #include "FileUtil.h" #include "StringUtil.h" #include "ConsoleWindow.h" +#include "Setup.h" // Create the plugin manager class CPluginManager CPluginManager::m_Instance; @@ -214,6 +215,7 @@ void CPluginManager::ShutdownPlugins() #endif } + if (m_dsp) { m_dsp->Shutdown(); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 138d947c37..1d2356e25f 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -519,10 +519,9 @@ void CFrame::DoStop() { Core::Stop(); - /* This is needed to let GetState() == CORE_UNINITIALIZED together with the - "delete g_pThread" in Core.cpp. Todo: Please feel free to fix it some other way. */ - //PanicAlert("%i", (int)bRenderToMain); - #ifdef _WIN32 + /* This is needed together with the option to not "delete g_EmuThread" in Core.cpp, because then + we have to wait a moment before GetState() == CORE_UNINITIALIZED so that UpdateGUI() works */ + #ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG if (bRenderToMain) while(Core::GetState() != Core::CORE_UNINITIALIZED) Sleep(10); #endif diff --git a/Source/Core/InputCommon/Src/SDL.cpp b/Source/Core/InputCommon/Src/SDL.cpp index 4dd49598db..067a467e17 100644 --- a/Source/Core/InputCommon/Src/SDL.cpp +++ b/Source/Core/InputCommon/Src/SDL.cpp @@ -206,6 +206,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in Console::Print( "Pad | Number:%i Enabled:%i Handle:%i\n" "Main Stick | X:%03i Y:%03i\n" + "C Stick | X:%03i Y:%03i\n" "Trigger | Type:%s DigitalL:%i DigitalR:%i AnalogL:%03i AnalogR:%03i HalfPress:%i\n" "Buttons | A:%i X:%i\n" "D-Pad | Type:%s Hat:%i U:%i D:%i\n" @@ -214,6 +215,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in Controller, _PadMapping.enabled, _PadState.joy, _PadState.axis[InputCommon::CTL_MAIN_X], _PadState.axis[InputCommon::CTL_MAIN_Y], + _PadState.axis[InputCommon::CTL_SUB_X], _PadState.axis[InputCommon::CTL_SUB_Y], (_PadMapping.triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"), _PadState.buttons[InputCommon::CTL_L_SHOULDER], _PadState.buttons[InputCommon::CTL_R_SHOULDER], diff --git a/Source/MusicMod.sln b/Source/MusicMod.sln index e40cfc1f6c..57e50f6aad 100644 --- a/Source/MusicMod.sln +++ b/Source/MusicMod.sln @@ -58,13 +58,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D ProjectSection(ProjectDependencies) = postProject {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} - {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0} - {8D612734-FAA5-4B8A-804F-4DEA2367D495} = {8D612734-FAA5-4B8A-804F-4DEA2367D495} {71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C} {33546D62-7F34-4EA6-A88E-D538B36E16BF} = {33546D62-7F34-4EA6-A88E-D538B36E16BF} {3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63} {95CCAABC-7062-47C4-B8C1-A064DD5F16FF} = {95CCAABC-7062-47C4-B8C1-A064DD5F16FF} + {521498BE-6089-4780-8223-E67C22F4E068} = {521498BE-6089-4780-8223-E67C22F4E068} {29C2ABC1-ADA5-42CD-A5FC-96022D52A510} = {29C2ABC1-ADA5-42CD-A5FC-96022D52A510} {4D3CD4C5-412B-4B49-9B1B-A68A2A129C77} = {4D3CD4C5-412B-4B49-9B1B-A68A2A129C77} {F0B874CB-4476-4199-9315-8343D05AE684} = {F0B874CB-4476-4199-9315-8343D05AE684} @@ -255,6 +254,7 @@ Global {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Debug|Win32.ActiveCfg = Debug|Win32 {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Debug|x64.ActiveCfg = Debug|x64 {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 + {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|Win32.Build.0 = DebugFast|Win32 {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.DebugFast|x64.ActiveCfg = DebugFast|x64 {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release JITIL|Win32.ActiveCfg = Release|Win32 {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}.Release JITIL|x64.ActiveCfg = Release|x64 @@ -334,6 +334,7 @@ Global {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Debug|Win32.ActiveCfg = Debug|Win32 {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Debug|x64.ActiveCfg = Debug|x64 {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 + {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.DebugFast|Win32.Build.0 = DebugFast|Win32 {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.DebugFast|x64.ActiveCfg = DebugFast|x64 {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Release JITIL|Win32.ActiveCfg = Release|Win32 {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}.Release JITIL|x64.ActiveCfg = Release|x64 @@ -367,13 +368,11 @@ Global {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Debug|Win32.ActiveCfg = Debug|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Debug|x64.ActiveCfg = Debug|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|Win32.Build.0 = DebugFast|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.DebugFast|x64.ActiveCfg = DebugFast|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|Win32.ActiveCfg = Release|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.ActiveCfg = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.Build.0 = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.ActiveCfg = Release|Win32 - {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -401,13 +400,13 @@ Global {521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.ActiveCfg = Debug|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Debug|x64.Build.0 = Debug|x64 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|Win32.Build.0 = DebugFast|Win32 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.ActiveCfg = DebugFast|x64 {521498BE-6089-4780-8223-E67C22F4E068}.DebugFast|x64.Build.0 = DebugFast|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release JITIL|Win32.ActiveCfg = Release|Win32 {521498BE-6089-4780-8223-E67C22F4E068}.Release JITIL|x64.ActiveCfg = Release|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release JITIL|x64.Build.0 = Release|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.ActiveCfg = Release|Win32 + {521498BE-6089-4780-8223-E67C22F4E068}.Release|Win32.Build.0 = Release|Win32 {521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.ActiveCfg = Release|x64 {521498BE-6089-4780-8223-E67C22F4E068}.Release|x64.Build.0 = Release|x64 {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -445,7 +444,6 @@ Global {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.Debug|x64.ActiveCfg = Debug|x64 {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.Debug|x64.Build.0 = Debug|x64 {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.DebugFast|Win32.Build.0 = DebugFast|Win32 {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.DebugFast|x64.ActiveCfg = DebugFast|x64 {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.DebugFast|x64.Build.0 = DebugFast|x64 {95CCAABC-7062-47C4-B8C1-A064DD5F16FF}.Release JITIL|Win32.ActiveCfg = Release|Win32 @@ -459,7 +457,6 @@ Global {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.Debug|x64.ActiveCfg = Debug|x64 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.Debug|x64.Build.0 = Debug|x64 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.DebugFast|Win32.Build.0 = DebugFast|Win32 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.DebugFast|x64.ActiveCfg = DebugFast|x64 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.DebugFast|x64.Build.0 = DebugFast|x64 {0B72B5D6-5D72-4391-84A7-9CCA5392668A}.Release JITIL|Win32.ActiveCfg = Release|Win32 @@ -473,7 +470,6 @@ Global {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Debug|x64.ActiveCfg = Debug|x64 {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Debug|x64.Build.0 = Debug|x64 {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 - {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|Win32.Build.0 = DebugFast|Win32 {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|x64.ActiveCfg = DebugFast|x64 {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.DebugFast|x64.Build.0 = DebugFast|x64 {0D14F1E9-490B-4A2D-A4EF-0535E8B3C718}.Release JITIL|Win32.ActiveCfg = Release|Win32 diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp index 43c57e82ac..e066896663 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCodes.cpp @@ -44,7 +44,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0xd73338cf: // IPL case 0x42f64ac4: // Luigi (after fix) case 0x4be6a5cb: // AC, Pikmin (after fix) - printf("JAC ucode chosen"); + Console::Print("JAC ucode chosen\n"); return new CUCode_Jac(_rMailHandler); case 0x3ad3b7ac: // Naruto3 @@ -56,20 +56,20 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2, // Zelda:OOT, Tony hawk, viewtiful joe case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080 - printf("AX ucode chosen, yay!"); + Console::Print("AX ucode chosen, yay!\n"); return new CUCode_AX(_rMailHandler); case 0x6CA33A6D: // DK Jungle Beat case 0x86840740: // zelda case 0x56d36052: // mario case 0x2fcdf1ec: // mariokart, zelda 4 swords - printf("Zelda ucode chosen"); + Console::Print("Zelda ucode chosen\n"); return new CUCode_Zelda(_rMailHandler); // WII CRCs case 0x6c3f6f94: // zelda - PAL case 0xd643001f: // mario galaxy - PAL - printf("Zelda Wii ucode chosen"); + Console::Print("Zelda Wii ucode chosen\n"); return new CUCode_Zelda(_rMailHandler); case 0x5ef56da3: // AX demo @@ -78,7 +78,7 @@ IUCode* UCodeFactory(u32 _CRC, CMailHandler& _rMailHandler) case 0xadbc06bd: // Elebits case 0xb7eb9a9c: // Wii Pikmin - JAP case 0x4cc52064: // Bleach: Versus Crusade - printf("Wii - AXWii chosen"); + Console::Print("Wii - AXWii chosen\n"); return new CUCode_AXWii(_rMailHandler, _CRC); default: diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 4d03b09f82..7196d1438a 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -73,11 +73,19 @@ ConfigDialog::ConfigDialog(wxWindow *parent, wxWindowID id, const wxString &titl // --------------- ConfigDialog::~ConfigDialog() { + Console::Print("ConfigDialog Closed\n"); } void ConfigDialog::OnClose(wxCloseEvent& event) { - // notice that we don't run wxEntryCleanup(); here so the dll will still be loaded g_Config.Save(); + + Console::Print("OnClose\n"); + + // notice that we don't run wxEntryCleanup(); here so the dll will still be loaded + /* JP: Yes, it seems like Close() does not do that. It only runs EndModal() or something + similar to hide the window. And I don't understand the "Window deletion overview" on + the wxWidgets website. Destroy() doesn't run the destructor either. */ + //wxEntryCleanup(); //EndModal(0); // Allow wxWidgets to close and unload the window @@ -86,7 +94,13 @@ void ConfigDialog::OnClose(wxCloseEvent& event) void ConfigDialog::CloseClick(wxCommandEvent& WXUNUSED (event)) { - Close(); + Console::Print("CloseClick\n"); + + g_Config.Save(); + + wxEntryCleanup(); + + //Close(); } /////////////////////////////// diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index d1055ca63c..b6814b7adf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -50,6 +50,7 @@ #include "XFBConvert.h" #include "TextureConverter.h" #include "OnScreenDisplay.h" +#include "Setup.h" #include "VideoState.h" /////////////////////////////////////////////// @@ -96,8 +97,27 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { } +// This is used for the fuctions right below here, in DllConfig() +#if defined(HAVE_WX) && HAVE_WX + WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); + extern HINSTANCE g_hInstance; +#endif + void DllConfig(HWND _hParent) { + #if defined(HAVE_WX) && HAVE_WX + // This is needed because now we use wxEntryCleanup() when closing the configuration window + if (!wxTheApp || !wxTheApp->CallOnInit()) + { + wxSetInstance((HINSTANCE)g_hInstance); + int argc = 0; + char **argv = NULL; + wxEntryStart(argc, argv); + } + #endif + + //Console::Open(); + #if defined(_WIN32) wxWindow *win = new wxWindow(); win->SetHWND((WXHWND)_hParent); @@ -205,6 +225,8 @@ void DllConfig(HWND _hParent) void Initialize(void *init) { + //Console::Open(); + frameCount = 0; SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init; g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it @@ -276,20 +298,29 @@ void Video_Prepare(void) void Shutdown(void) { - Fifo_Shutdown(); - TextureConverter::Shutdown(); - VertexLoaderManager::Shutdown(); - VertexShaderCache::Shutdown(); - VertexShaderManager::Shutdown(); - PixelShaderManager::Shutdown(); - PixelShaderCache::Shutdown(); - VertexManager::Shutdown(); - TextureMngr::Shutdown(); - OpcodeDecoder_Shutdown(); - Renderer::Shutdown(); - OpenGL_Shutdown(); + Fifo_Shutdown(); + TextureConverter::Shutdown(); + VertexLoaderManager::Shutdown(); + VertexShaderCache::Shutdown(); + VertexShaderManager::Shutdown(); + PixelShaderManager::Shutdown(); + PixelShaderCache::Shutdown(); + VertexManager::Shutdown(); + // This cause some kind of crash, at least in the Release build and with this setup option + // If there wasn't so little explanations and comments in this code I would be more interested + // in trying to fix this function, now I'll just leave it like this, because it works + #ifndef SETUP_FREE_PLUGIN_ON_BOOT + TextureMngr::Shutdown(); + #endif + OpcodeDecoder_Shutdown(); + Renderer::Shutdown(); + OpenGL_Shutdown(); } + +////////////////////////////////////////////////////////////////////////////////////////// +// Enter and exit the video loop +// ŻŻŻŻŻŻŻŻŻŻŻŻŻ void Video_EnterLoop() { Fifo_EnterLoop(g_VideoInitialize); @@ -299,6 +330,8 @@ void Video_ExitLoop() { Fifo_ExitLoop(); } +///////////////////////// + void DebugLog(const char* _fmt, ...) { diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 2551a28df0..f9bdaa08a6 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -241,7 +241,7 @@ void Initialize(void *init) { // Debugging #ifdef SHOW_PAD_STATUS - Console::Open(100); + Console::Open(110); m_hConsole = Console::GetHwnd(); #endif Console::Print("Initialize: %i\n", SDL_WasInit(0)); @@ -483,6 +483,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) _pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->triggerLeft = TriggerValue; } + // no the digital L button is not pressed, but the analog left trigger is else if(TriggerLeft > 0) _pPADStatus->triggerLeft = TriggerLeft; @@ -492,6 +493,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) _pPADStatus->button |= PAD_TRIGGER_R; _pPADStatus->triggerRight = TriggerValue; } + // no the digital R button is not pressed, but the analog right trigger is else if(TriggerRight > 0) _pPADStatus->triggerRight = TriggerRight; @@ -561,20 +563,20 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) // Show the status of all connected pads if ((LastPad == 0 && _numPAD == 0) || _numPAD < LastPad) Console::ClearScreen(); LastPad = _numPAD; + Console::ClearScreen(); Console::Print( "Pad | Number:%i Enabled:%i Handle:%i\n" - "Trigger | StatusLeft:%04x StatusRight:%04x TriggerLeft:%04x TriggerRight:%04x TriggerValue:%i\n" - "Buttons | Overall:%i X:%i\n" + "Trigger | StatusL:%04x StatusR:%04x TriggerL:%04x TriggerR:%04x TriggerValue:%i\n" + "Buttons | Overall:%i A:%i X:%i\n" "======================================================\n", _numPAD, PadMapping[_numPAD].enabled, PadState[_numPAD].joy, - PadState[_numPAD].buttons[InputCommon::CTL_L_SHOULDER], PadState[_numPAD].buttons[InputCommon::CTL_R_SHOULDER], PadState[_numPAD].halfpress, + _pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue, - (PadMapping[_numPAD].triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"), - _pPADStatus->triggerLeft, _pPADStatus->triggerRight, TriggerLeft, TriggerRight, TriggerValue, - - _pPADStatus->button, PadState[_numPAD].buttons[InputCommon::CTL_X_BUTTON] + _pPADStatus->button, + PadState[_numPAD].buttons[InputCommon::CTL_A_BUTTON], + PadState[_numPAD].buttons[InputCommon::CTL_X_BUTTON] ); */ }