diff --git a/pcsx2/Config.h b/pcsx2/Config.h index 1e0eda777d..8af382f019 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -302,12 +302,15 @@ extern SessionOverrideFlags g_Session; #define CHECK_VU1REC (!g_Session.ForceDisableVU1rec && EmuConfig.Cpu.Recompiler.EnableVU1) //------------ SPECIAL GAME FIXES!!! --------------- +#define NUM_OF_GAME_FIXES 7 + #define CHECK_VUADDSUBHACK (EmuConfig.Gamefixes.VuAddSubHack) // Special Fix for Tri-ace games, they use an encryption algorithm that requires VU addi opcode to be bit-accurate. #define CHECK_FPUCOMPAREHACK (EmuConfig.Gamefixes.FpuCompareHack) // Special Fix for Digimon Rumble Arena 2, fixes spinning/hanging on intro-menu. #define CHECK_VUCLIPFLAGHACK (EmuConfig.Gamefixes.VuClipFlagHack) // Special Fix for Persona games, maybe others. It's to do with the VU clip flag (again). #define CHECK_FPUMULHACK (EmuConfig.Gamefixes.FpuMulHack) // Special Fix for Tales of Destiny hangs. -#define CHECK_DMAEXECHACK (false) //sVU-only, ignored // Special Fix for Fatal Frame; breaks Gust and Tri-Ace games. +#define CHECK_DMAEXECHACK (EmuConfig.Gamefixes.DMAExeHack) // Special Fix for Fatal Frame; breaks Gust and Tri-Ace games. #define CHECK_XGKICKHACK (EmuConfig.Gamefixes.XgKickHack) // Special Fix for Erementar Gerad, adds more delay to VU XGkick instructions. Corrects the color of some graphics. +#define CHECK_MPEGHACK (EmuConfig.Gamefixes.MpegHack) // Special Fix for Mana Khemia 1; breaks Digital Devil Saga. //------------ Advanced Options!!! --------------- #define CHECK_VU_OVERFLOW (EmuConfig.Cpu.vuOverflow) diff --git a/pcsx2/IPU/mpeg2lib/Mpeg.cpp b/pcsx2/IPU/mpeg2lib/Mpeg.cpp index 8a5254b150..3c8cc3451c 100644 --- a/pcsx2/IPU/mpeg2lib/Mpeg.cpp +++ b/pcsx2/IPU/mpeg2lib/Mpeg.cpp @@ -203,7 +203,7 @@ static __forceinline int get_coded_block_pattern(decoder_t * const decoder) tab = CBP_7 + (UBITS(decoder->bitstream_buf, 7) - 16); else tab = CBP_9 + UBITS(decoder->bitstream_buf, 9); - + DUMPBITS(decoder->bitstream_buf, decoder->bitstream_bits, tab->len); return tab->cbp; } @@ -361,7 +361,7 @@ normal_code: /* escape code */ i += UBITS(bit_buf << 6, 6) - 64; - + if (i >= 64) break; /* illegal, check needed to avoid buffer overflow */ j = scan[i]; @@ -881,14 +881,14 @@ entry_2: /* escape code */ i += UBITS(bit_buf << 6, 6) - 64; - + if (i >= 64) break; /* illegal, check needed to avoid buffer overflow */ j = scan[i]; DUMPBITS(bit_buf, bits, 12); NEEDBITS(bit_buf, bits, bit_ptr); val = SBITS(bit_buf, 8); - + if (!(val & 0x7f)) { DUMPBITS(bit_buf, bits, 8); @@ -957,14 +957,14 @@ static void __fastcall slice_intra_DCT(decoder_t * const decoder, const int cc, NEEDBITS(decoder->bitstream_buf, decoder->bitstream_bits, decoder->bitstream_ptr); /* Get the intra DC coefficient and inverse quantize it */ - if (cc == 0) + if (cc == 0) decoder->dc_dct_pred[0] += get_luma_dc_dct_diff(decoder); - else + else decoder->dc_dct_pred[cc] += get_chroma_dc_dct_diff(decoder); decoder->DCTblock[0] = decoder->dc_dct_pred[cc] << (3 - decoder->intra_dc_precision); - if (decoder->mpeg1) + if (decoder->mpeg1) { get_mpeg1_intra_block(decoder); } @@ -987,9 +987,9 @@ static void __fastcall slice_non_intra_DCT(decoder_t * const decoder, int last; memzero_obj(decoder->DCTblock); - if (decoder->mpeg1) + if (decoder->mpeg1) last = get_mpeg1_non_intra_block(decoder); - else + else last = get_non_intra_block(decoder); mpeg2_idct_add(last, decoder->DCTblock, dest, stride); @@ -1231,7 +1231,7 @@ void mpeg2sliceIDEC(void* pdone) { g_pIPU0Pointer += read * 16; g_nIPU0Data -= read; - + } } @@ -1240,7 +1240,7 @@ void mpeg2sliceIDEC(void* pdone) NEEDBITS(decoder->bitstream_buf, decoder->bitstream_bits, decoder->bitstream_ptr); mba_inc = 0; - + while (1) { if (decoder->bitstream_buf >= 0x10000000) @@ -1267,10 +1267,8 @@ void mpeg2sliceIDEC(void* pdone) default: /* end of slice/frame, or error? */ { - #ifdef ALWAYS_RESUME_BEFORE_EXITING - if (!resumed) so_resume(); - #endif - + if ((!resumed) && (CHECK_MPEGHACK)) so_resume(); + finishmpeg2sliceIDEC(decoder); *(int*)pdone = 1; @@ -1284,7 +1282,7 @@ void mpeg2sliceIDEC(void* pdone) if (mba_inc) { - decoder->dc_dct_pred[0] = + decoder->dc_dct_pred[0] = decoder->dc_dct_pred[1] = decoder->dc_dct_pred[2] = 128 << decoder->intra_dc_precision; @@ -1297,9 +1295,7 @@ void mpeg2sliceIDEC(void* pdone) } } - #ifdef ALWAYS_RESUME_BEFORE_EXITING - if (!resumed) so_resume(); - #endif + if ((!resumed) && (CHECK_MPEGHACK)) so_resume(); finishmpeg2sliceIDEC(decoder); @@ -1326,7 +1322,7 @@ void mpeg2_slice(void* pdone) if (decoder->dcr) { - decoder->dc_dct_pred[0] = + decoder->dc_dct_pred[0] = decoder->dc_dct_pred[1] = decoder->dc_dct_pred[2] = 128 << decoder->intra_dc_precision; } @@ -1371,7 +1367,7 @@ void mpeg2_slice(void* pdone) } //Send The MacroBlock via DmaIpuFrom - + size = 0; // Reset ipuRegs->ctrl.SCD = 0; coded_block_pattern = decoder->coded_block_pattern; diff --git a/pcsx2/Paths.h b/pcsx2/Paths.h index 15c79a4891..42c7a3c531 100644 --- a/pcsx2/Paths.h +++ b/pcsx2/Paths.h @@ -93,7 +93,7 @@ public: // ------------------------------------------------------------------------ void AssignCwd( const wxString& volume = wxEmptyString ) { wxFileName::AssignCwd( volume ); } - bool SetCwd() { wxFileName::SetCwd(); } + bool SetCwd() { return wxFileName::SetCwd(); } // wxWidgets is missing the const qualifier for this one! Shame! void Rmdir(); diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index 87c9a0924f..fe6862e80f 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -47,7 +47,7 @@ void Pcsx2Config::ProfilerOptions::LoadSave( IniInterface& ini ) { ProfilerOptions defaults; IniScopedGroup path( ini, L"Profiler" ); - + IniBitBool( Enabled ); IniBitBool( RecBlocks_EE ); IniBitBool( RecBlocks_IOP ); @@ -59,14 +59,14 @@ void Pcsx2Config::RecompilerOptions::LoadSave( IniInterface& ini ) { RecompilerOptions defaults; IniScopedGroup path( ini, L"Recompiler" ); - + IniBitBool( EnableEE ); IniBitBool( EnableIOP ); IniBitBool( EnableVU0 ); IniBitBool( EnableVU1 ); } -Pcsx2Config::CpuOptions::CpuOptions() : +Pcsx2Config::CpuOptions::CpuOptions() : bitset( 0 ) , sseMXCSR( DEFAULT_sseMXCSR ) , sseVUMXCSR( DEFAULT_sseVUMXCSR ) @@ -111,7 +111,7 @@ void Pcsx2Config::VideoOptions::LoadSave( IniInterface& ini ) { VideoOptions defaults; IniScopedGroup path( ini, L"Video" ); - + IniEntry( EnableFrameLimiting ); IniEntry( EnableFrameSkipping ); @@ -134,14 +134,16 @@ void Pcsx2Config::GamefixOptions::LoadSave( IniInterface& ini ) IniBitBool( VuClipFlagHack ); IniBitBool( FpuCompareHack ); IniBitBool( FpuMulHack ); + IniBitBool( DMAExeHack ); IniBitBool( XgKickHack ); + IniBitBool( MpegHack ); } Pcsx2Config::Pcsx2Config() : bitset( 0 ) { } - + void Pcsx2Config::LoadSave( IniInterface& ini ) { Pcsx2Config defaults; diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 53a6710c9e..8f152db11d 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -791,6 +791,7 @@ void PluginManager::Open( PluginsEnum_t pid ) case PluginId_USB: result = OpenPlugin_USB(); break; case PluginId_FW: result = OpenPlugin_FW(); break; case PluginId_DEV9: result = OpenPlugin_DEV9(); break; + jNO_DEFAULT; } if( !result ) throw Exception::PluginOpenError( pid ); diff --git a/pcsx2/R5900.h b/pcsx2/R5900.h index 6314972c19..fa84be41ab 100644 --- a/pcsx2/R5900.h +++ b/pcsx2/R5900.h @@ -19,7 +19,9 @@ #pragma once ////////////////////////////////////////////////////////////////////////////////////////// +#ifndef __LINUX__ #pragma region Recompiler Stuffs +#endif // This code section contains recompiler vars that are used in "shared" code. Placing // them in iR5900.h would mean having to include that into more files than I care to @@ -40,7 +42,9 @@ namespace Exception explicit RecompilerReset() { } }; } +#ifndef __LINUX__ #pragma endregion +#endif ////////////////////////////////////////////////////////////////////////////////////////// // EE Bios function name tables. @@ -77,7 +81,7 @@ union PERFregs { { union { - struct + struct { u32 pad0:1; // LSB should always be zero (or undefined) u32 EXL0:1; // enable PCR0 during Level 1 exception handling @@ -93,11 +97,11 @@ union PERFregs { u32 S1:1; // enable PCR1 during Supervisor mode execution u32 U1:1; // enable PCR1 during User-mode execution u32 Event1:5; // PCR1 event counter (all values except 1 ignored at this time) - + u32 Reserved:11; u32 CTE:1; // Counter enable bit, no counting if set to zero. } b; - + u32 val; } pccr; @@ -116,7 +120,7 @@ union CP0regs { u32 IE:1; // Bit 0: Interrupt Enable flag. u32 EXL:1; // Bit 1: Exception Level, set on any exception not covered by ERL. u32 ERL:1; // Bit 2: Error level, set on Resetm NMI, perf/debug exceptions. - u32 KSU:2; // Bits 3-4: Kernel [clear] / Supervisor [set] mode + u32 KSU:2; // Bits 3-4: Kernel [clear] / Supervisor [set] mode u32 unused0:3; u32 IM:8; // Bits 10-15: Interrupt mask (bits 12,13,14 are unused) u32 EIE:1; // Bit 16: IE bit enabler. When cleared, ints are disabled regardless of IE status. @@ -182,7 +186,7 @@ union FPRreg { struct fpuRegisters { FPRreg fpr[32]; // 32bit floating point registers u32 fprc[32]; // 32bit floating point control registers - FPRreg ACC; // 32 bit accumulator + FPRreg ACC; // 32 bit accumulator u32 ACCflag; // an internal accumulator overflow flag }; @@ -218,10 +222,10 @@ struct tlbs #define _PC_ cpuRegs.pc // The next PC to be executed - only used in this header and R3000A.h -#define _Funct_ ((cpuRegs.code ) & 0x3F) // The funct part of the instruction register -#define _Rd_ ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register -#define _Rt_ ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register -#define _Rs_ ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register +#define _Funct_ ((cpuRegs.code ) & 0x3F) // The funct part of the instruction register +#define _Rd_ ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register +#define _Rt_ ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register +#define _Rs_ ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register #define _Sa_ ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register #define _Im_ ((u16)cpuRegs.code) // The immediate part of the instruction register #define _Target_ (cpuRegs.code & 0x03ffffff) // The target part of the instruction register diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index 6100ff88c6..23bc20fe2b 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -53,9 +53,14 @@ void SysDetect() { using namespace Console; +#ifdef __LINUX__ + // Haven't rigged up getting the svn version yet... --arcum42 + Notice("PCSX2 %d.%d.%d - compiled on " __DATE__, params PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo); +#else Notice("PCSX2 %d.%d.%d.r%d %s - compiled on " __DATE__, params PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? "(modded)" : "" ); +#endif Notice("Savestate version: %x", params g_SaveVersion); cpudetectInit(); diff --git a/pcsx2/System.h b/pcsx2/System.h index 1fbe6f034a..471467d41b 100644 --- a/pcsx2/System.h +++ b/pcsx2/System.h @@ -67,7 +67,7 @@ extern CoreEmuThread* g_EmuThread; extern void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * ); extern void __fastcall InstallLinuxExceptionHandler(); extern void __fastcall ReleaseLinuxExceptionHandler(); - static void NTFS_CompressFile( const wxString& file, bool compressStatus=true ) {} + static void __unused NTFS_CompressFile( const wxString& file, bool compressStatus=true ) {} # define PCSX2_MEM_PROTECT_BEGIN() InstallLinuxExceptionHandler() # define PCSX2_MEM_PROTECT_END() ReleaseLinuxExceptionHandler() diff --git a/pcsx2/gui/App.h b/pcsx2/gui/App.h index 9af93189b1..23063dd18c 100644 --- a/pcsx2/gui/App.h +++ b/pcsx2/gui/App.h @@ -64,7 +64,7 @@ enum MenuIdentifiers MenuId_Boot_Recent, // Menu populated with recent source bootings MenuId_SkipBiosToggle, // enables the Bios Skip speedhack - + MenuId_Emu_Pause, // suspends/resumes active emulation, retains plugin states MenuId_Emu_Close, // Closes the emulator (states are preserved) MenuId_Emu_Reset, // Issues a complete reset (wipes preserved states) @@ -139,7 +139,7 @@ public: wxASSERT( whee != NULL ); m_window.Disable(); } - + ~ScopedWindowDisable() { m_window.Enable(); @@ -230,7 +230,7 @@ public: void OnInitCmdLine( wxCmdLineParser& parser ); bool OnCmdLineParsed( wxCmdLineParser& parser ); bool PrepForExit(); - + #ifdef __WXDEBUG__ void OnAssertFailure( const wxChar *file, int line, const wxChar *func, const wxChar *cond, const wxChar *msg ); #endif @@ -272,13 +272,13 @@ public: void ProgramLog_CountMsg() { - if( m_ProgramLogBox == NULL ) return; + if ((wxTheApp == NULL) || ( m_ProgramLogBox == NULL )) return; m_ProgramLogBox->CountMessage(); } void ProgramLog_PostEvent( wxEvent& evt ) { - if( m_ProgramLogBox == NULL ) return; + if ((wxTheApp == NULL) || ( m_ProgramLogBox == NULL )) return; m_ProgramLogBox->GetEventHandler()->AddPendingEvent( evt ); } @@ -317,7 +317,7 @@ class AppEmuThread : public CoreEmuThread public: AppEmuThread( const wxString& elf_file=wxEmptyString ); virtual ~AppEmuThread() { } - + virtual void Resume(); protected: diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index af88ebddd0..51ab3c2176 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -274,7 +274,7 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): m_menubar.Append( &m_menuMisc, _("Misc") ); m_menubar.Append( &m_menuDebug, _("Debug") ); SetMenuBar( &m_menubar ); - + // ------------------------------------------------------------------------ wxSize backsize( m_background.GetSize() ); @@ -282,16 +282,26 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): wxString wintitle; if( PCSX2_VersionLo & 1 ) { +#ifdef __LINUX__ + // Linux isn't set up for svn version numbers yet. + wintitle.Printf( _("PCSX2 %d.%d.%d (svn) %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, + wxString::FromUTF8(__DATE__).c_str() ); +#else // Odd versions: beta / development editions, which feature revision number and compile date. wintitle.Printf( _("PCSX2 %d.%d.%d.%d%s (svn) %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString, wxString::FromUTF8(__DATE__).c_str() ); +#endif } else { +#ifdef __LINUX__ + wintitle.Printf( _("PCSX2 %d.%d.%d"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo); +#else // evens: stable releases, with a simpler title. wintitle.Printf( _("PCSX2 %d.%d.%d %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_MODS ? _("(modded)") : wxEmptyString ); +#endif } SetTitle( wintitle ); diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index 21dedfbaf8..f2ebba936b 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -20,6 +20,7 @@ #include "ConfigurationPanels.h" using namespace wxHelpers; +static wxCheckBox* game_fix_checkbox[NUM_OF_GAME_FIXES]; Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : BaseApplicableConfigPanel( &parent, idealWidth) @@ -28,16 +29,28 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here.") ); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); - AddCheckBox( groupSizer, _("VU Add Hack - for Tri-Ace games!") ); - AddCheckBox( groupSizer, _( "VU Clip Flag Hack - for Persona games, maybe others.") ); - AddCheckBox( groupSizer, _("FPU Compare Hack - for Digimon Rumble Arena 2.") ); - AddCheckBox( groupSizer, _("FPU Multiply Hack - for Tales of Destiny.") ); - AddCheckBox( groupSizer, _("DMA Execution Hack - for Fatal Frame.") ); - AddCheckBox( groupSizer, _("VU XGkick Hack - for Erementar Gerad.") ); + game_fix_checkbox[0] = &AddCheckBox( groupSizer, _("VU Add Hack - for Tri-Ace games!") ); + game_fix_checkbox[0]->SetValue(EmuConfig.Gamefixes.VuAddSubHack); + + game_fix_checkbox[1] = &AddCheckBox( groupSizer, _( "VU Clip Flag Hack - for Persona games, maybe others.") ); + game_fix_checkbox[1]->SetValue(EmuConfig.Gamefixes.VuClipFlagHack); + + game_fix_checkbox[2] = &AddCheckBox( groupSizer, _("FPU Compare Hack - for Digimon Rumble Arena 2.") ); + game_fix_checkbox[2]->SetValue(EmuConfig.Gamefixes.FpuCompareHack); + + game_fix_checkbox[3] = &AddCheckBox( groupSizer, _("FPU Multiply Hack - for Tales of Destiny.") ); + game_fix_checkbox[3]->SetValue(EmuConfig.Gamefixes.FpuMulHack); + + game_fix_checkbox[4] = &AddCheckBox( groupSizer, _("DMA Execution Hack - for Fatal Frame.") ); + game_fix_checkbox[4]->SetValue(EmuConfig.Gamefixes.DMAExeHack); + + game_fix_checkbox[5] = &AddCheckBox( groupSizer, _("VU XGkick Hack - for Erementar Gerad.") ); + game_fix_checkbox[5]->SetValue(EmuConfig.Gamefixes.XgKickHack); // I may as well add this, since these aren't hooked in yet. If the consensus is against it, // I'll remove it. - AddCheckBox( groupSizer, _("MPEG Hack - for Mana Khemia 1.") ); + game_fix_checkbox[6] = &AddCheckBox( groupSizer, _("MPEG Hack - for Mana Khemia 1.") ); + game_fix_checkbox[6]->SetValue(EmuConfig.Gamefixes.MpegHack); mainSizer.Add( &groupSizer, wxSizerFlags().Centre() ); @@ -50,7 +63,27 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) : } +// There's a better way to do this. This was quicker to hack in, though, and can always be replaced later. +static void set_game_fix(int num, bool status) +{ + switch (num) + { + case 0: EmuConfig.Gamefixes.VuAddSubHack = status; break; + case 1: EmuConfig.Gamefixes.VuClipFlagHack = status; break; + case 2: EmuConfig.Gamefixes.FpuCompareHack = status; break; + case 3: EmuConfig.Gamefixes.FpuMulHack = status; break; + case 4: EmuConfig.Gamefixes.DMAExeHack = status; break; + case 5: EmuConfig.Gamefixes.XgKickHack = status; break; + case 6: EmuConfig.Gamefixes.MpegHack = status; break; + default: break; + } + return; +} + void Panels::GameFixesPanel::Apply( AppConfig& conf ) { - + for (int i = 0; i < NUM_OF_GAME_FIXES; i++) + { + set_game_fix(i, game_fix_checkbox[i]->GetValue()); + } } diff --git a/pcsx2/gui/Panels/MiscPanelStuff.cpp b/pcsx2/gui/Panels/MiscPanelStuff.cpp index 34c47386ca..1668c3686b 100644 --- a/pcsx2/gui/Panels/MiscPanelStuff.cpp +++ b/pcsx2/gui/Panels/MiscPanelStuff.cpp @@ -131,7 +131,7 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow& parent, int id m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() ); s_boxer.AddSpacer( 4 ); m_radio_cwd = &AddRadioButton( s_boxer, _("Current working folder (intended for developer use only)"), _("Location: ") + wxGetCwd(), - _("This setting requires administration privlidges from your operating system.") ); + _("This setting requires administration privileges from your operating system.") ); s_boxer.AddSpacer( 4 ); SetSizer( &s_boxer );