diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index c1c07434ff..25578fb2f2 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -909,7 +909,7 @@ void gsReset() } else { - SysPrintf("GIF reset\n"); + Console::Notice( "GIF reset"); GSreset(); GSsetFrameSkip(0); } diff --git a/pcsx2/Hw.c b/pcsx2/Hw.c index 5cd4810ec8..5bf002c0d1 100644 --- a/pcsx2/Hw.c +++ b/pcsx2/Hw.c @@ -84,31 +84,29 @@ u8 hwRead8(u32 mem) { u8 ret; -#ifdef PCSX2_DEVBUILD if( mem >= 0x10000000 && mem < 0x10008000 ) - SysPrintf("hwRead8 to %x\n", mem); -#endif + DevCon::Notice("hwRead8 to %x", mem); - SPR_LOG("Hardware read 8bit at %lx, ret %lx\n", mem, psHu8(mem)); + SPR_LOG("Hardware read 8bit at %lx, ret %lx\n", mem, psHu8(mem)); // switch (mem) { // default: - if ((mem & 0xffffff0f) == 0x1000f200) { - if(mem == 0x1000f260) ret = 0; - else if(mem == 0x1000F240) { - ret = psHu32(mem); - //psHu32(mem) &= ~0x4000; - } - else ret = psHu32(mem); - return (u8)ret; - } - - if (mem < 0x10010000) - { - ret = psHu8(mem); - } - else ret = 0; - HW_LOG("Unknown Hardware Read 8 at %x\n",mem); + if ((mem & 0xffffff0f) == 0x1000f200) { + if(mem == 0x1000f260) ret = 0; + else if(mem == 0x1000F240) { + ret = psHu32(mem); + //psHu32(mem) &= ~0x4000; + } + else ret = psHu32(mem); + return (u8)ret; + } + + if (mem < 0x10010000) + { + ret = psHu8(mem); + } + else ret = 0; + HW_LOG("Unknown Hardware Read 8 at %x\n",mem); // break; // } @@ -119,11 +117,10 @@ u16 hwRead16(u32 mem) { u16 ret; -#ifdef PCSX2_DEVBUILD if( mem >= 0x10002000 && mem < 0x10008000 ) - SysPrintf("hwRead16 to %x\n", mem); -#endif - SPR_LOG("Hardware read 16bit at %lx, ret %lx\n", mem, psHu16(mem)); + Console::Notice("hwRead16 to %x", mem); + + SPR_LOG("Hardware read 16bit at %lx, ret %lx\n", mem, psHu16(mem)); switch (mem) { case 0x10000000: ret = (u16)rcntRcount(0); break; diff --git a/pcsx2/Plugins.c b/pcsx2/Plugins.c index 3893ab2dd6..fe98fb7eb3 100644 --- a/pcsx2/Plugins.c +++ b/pcsx2/Plugins.c @@ -624,6 +624,8 @@ int InitPlugins() { void ShutdownPlugins() { + ClosePlugins(); + // GS is a special case: It needs closed first usually. // (the GS isn't closed during emulation pauses) if( OpenStatus.GS ) @@ -632,8 +634,6 @@ void ShutdownPlugins() OpenStatus.GS = false; } - ClosePlugins(); - GSshutdown(); PAD1shutdown(); PAD2shutdown(); @@ -690,7 +690,8 @@ int OpenPlugins(const char* pTitleFilename) { GSdriverInfo info; int ret; - if (!loadp) return -1; + if ( !loadp ) + throw Exception::InvalidOperation( "OpenPlugins cannot be called while the plugin state is uninitialized." ); #ifndef _WIN32 // change dir so that CDVD can find its config file @@ -863,3 +864,17 @@ void ReleasePlugins() SysCloseLibrary(FWplugin); FWplugin = NULL; loadp = false; } + +void PluginsResetGS() +{ + if( OpenStatus.GS ) + { + gsClose(); + OpenStatus.GS = false; + } + + GSshutdown(); + + int ret = GSinit(); + if (ret != 0) { SysMessage (_("GSinit error: %d"), ret); } +} \ No newline at end of file diff --git a/pcsx2/Plugins.h b/pcsx2/Plugins.h index c6764f5f2c..5cbf4dd63d 100644 --- a/pcsx2/Plugins.h +++ b/pcsx2/Plugins.h @@ -38,4 +38,6 @@ void ClosePlugins(); // take effect. Use a manual set oc alls to ReleasePlugins and LoadPlugins for that. void ResetPlugins(); +void PluginsResetGS(); + #endif /* __PLUGINS_H__ */ diff --git a/pcsx2/windows/CpuDlg.c b/pcsx2/windows/CpuDlg.c index 7b901b63eb..c5c605653c 100644 --- a/pcsx2/windows/CpuDlg.c +++ b/pcsx2/windows/CpuDlg.c @@ -150,8 +150,12 @@ BOOL CALLBACK CpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) if( (Config.Options&PCSX2_GSMULTITHREAD) ^ (newopts&PCSX2_GSMULTITHREAD) ) { - // gotta shut down *all* the plugins. - ResetPlugins(); + // Need the MTGS setting to take effect, so close out the plugins: + PluginsResetGS(); + if( CHECK_MULTIGS ) + Console::Notice( "MTGS mode disabled.\n\tEnjoy the fruits of single-threaded simpicity." ); + else + Console::Notice( "MTGS mode enabled.\n\tWelcome to multi-threaded awesomeness." ); } Config.Options = newopts; } diff --git a/pcsx2/windows/WinMain.c b/pcsx2/windows/WinMain.c index a5f7a5ba9d..02de8bcf3a 100644 --- a/pcsx2/windows/WinMain.c +++ b/pcsx2/windows/WinMain.c @@ -1163,6 +1163,7 @@ LRESULT WINAPI MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_FILE_RUNCD: safe_free( g_RecoveryState ); + ResetPlugins(); RunExecute( NULL ); return FALSE; diff --git a/plugins/CDVDiso/src/CDVDiso.h b/plugins/CDVDiso/src/CDVDiso.h index f6916713be..cb32910275 100644 --- a/plugins/CDVDiso/src/CDVDiso.h +++ b/plugins/CDVDiso/src/CDVDiso.h @@ -103,6 +103,7 @@ extern _cdIso cdIso[8]; #define MSF2SECT(m,s,f) (((m)*60+(s)-2)*75+(f)) extern char IsoFile[256]; +extern char IsoCWD[256]; extern char CdDev[256]; extern int BlockDump; diff --git a/plugins/CDVDiso/src/CDVDisop.c b/plugins/CDVDiso/src/CDVDisop.c index d597bdb813..c58e09fb18 100644 --- a/plugins/CDVDiso/src/CDVDisop.c +++ b/plugins/CDVDiso/src/CDVDisop.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "CDVDiso.h" #include "Config.h" @@ -14,6 +15,7 @@ #endif char IsoFile[256]; +char IsoCWD[256]; char CdDev[256]; _cdIso cdIso[8]; diff --git a/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj b/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj index 0ddc01663b..54e74c9f10 100644 --- a/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj +++ b/plugins/CDVDiso/src/Win32/CDVDiso_vs2008.vcproj @@ -46,7 +46,7 @@ MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="1" - EnableFunctionLevelLinking="false" + EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" BrowseInformation="1" WarningLevel="3" @@ -310,6 +310,10 @@ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > + + #include #include +#include #include #include + #include "zlib/zlib.h" @@ -43,7 +45,14 @@ int _GetFile(char *out) { ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetActiveWindow(); - ofn.lpstrFilter = "Supported Formats\0*.bin;*.iso;*.img;*.nrg;*.mdf;*.Z;*.Z2;*.BZ2;*.dump\0Cd Iso Format (*.bin;*.iso;*.img;*.nrg;*.mdf)\0*.bin;*.iso;*.img;*.nrg;*.mdf\0Compressed Z Iso Format (*.Z;*.Z2)\0*.Z;*.Z2\0Compressed BZ Iso Format (*.BZ2)\0*.BZ2\0Block Dumps (*.dump)\0*.dump\0All Files\0*.*\0"; + ofn.lpstrFilter = + "Supported Formats\0*.bin;*.iso;*.img;*.nrg;*.mdf;*.Z;*.Z2;*.BZ2;*.dump\0" + "Cd Iso Format (*.bin;*.iso;*.img;*.nrg;*.mdf)\0" + "*.bin;*.iso;*.img;*.nrg;*.mdf\0" + "Compressed Z Iso Format (*.Z;*.Z2)\0" + "*.Z;*.Z2\0Compressed BZ Iso Format (*.BZ2)\0" + "*.BZ2\0Block Dumps (*.dump)\0*.dump\0All Files\0*.*\0"; + ofn.lpstrCustomFilter = NULL; ofn.nMaxCustFilter = 0; ofn.nFilterIndex = 1; @@ -54,9 +63,10 @@ int _GetFile(char *out) { ofn.nMaxFileTitle = MAXFILENAME; ofn.lpstrTitle = NULL; ofn.lpstrDefExt = NULL; - ofn.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR; + ofn.Flags = OFN_HIDEREADONLY; - if (GetOpenFileName ((LPOPENFILENAME)&ofn)) { + if(GetOpenFileName ((LPOPENFILENAME)&ofn)) + { strcpy(out, szFileName); return 1; } @@ -64,9 +74,40 @@ int _GetFile(char *out) { return 0; } -void CfgOpenFile() { +int _OpenFile( int saveConf ) { + + int retval = 0; + + // for saving the pcsx2 current working directory; + char* cwd_pcsx2 = _getcwd( NULL, MAXFILENAME ); + + if( IsoCWD[0] != 0 ) + _chdir( IsoCWD ); + if (_GetFile(IsoFile) == 1) - SaveConf(); + { + // Save the user's new cwd: + if( _getcwd( IsoCWD, MAXFILENAME ) == NULL ) + IsoCWD[0] = 0; + + if( saveConf ) + SaveConf(); + + retval = 1; + } + + // Restore Pcsx2's path. + if( cwd_pcsx2 != NULL ) + { + _chdir( cwd_pcsx2 ); + free( cwd_pcsx2 ); + cwd_pcsx2 = NULL; + } + return retval; +} + +void CfgOpenFile() { + _OpenFile( TRUE ); } void UpdZmode() { @@ -242,7 +283,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_SELECTISO: - if (_GetFile(IsoFile) == 1) + if( _OpenFile(FALSE) == 1 ) Edit_SetText(hIsoFile, IsoFile); return TRUE; @@ -261,6 +302,7 @@ BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) case IDCANCEL: EndDialog(hW, TRUE); return TRUE; + case IDOK: Edit_GetText(hIsoFile, IsoFile, 256); BlockDump = Button_GetCheck(hBlockDump); @@ -288,8 +330,8 @@ BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: - EndDialog(hW, FALSE); - return TRUE; + EndDialog(hW, TRUE); + return FALSE; } } return FALSE;