From b98e4b9b12a437690dff03c81e87627f4969c6e0 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sat, 20 Feb 2010 10:45:49 +0000 Subject: [PATCH] Add an enable game fixes checkbox that behaves the same as the enable speed hacks checkbox, for ui consistancy. (Defaults to off, so if you are currently using game fixes, you'll need to go in and check it.) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2614 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/HwRead.cpp | 4 +-- pcsx2/Interpreter.cpp | 2 +- pcsx2/gui/AppConfig.cpp | 2 ++ pcsx2/gui/AppConfig.h | 1 + pcsx2/gui/AppCoreThread.cpp | 4 ++- pcsx2/gui/Panels/ConfigurationPanels.h | 3 +++ pcsx2/gui/Panels/GameFixesPanel.cpp | 35 ++++++++++++++++++++++++-- plugins/GSnull/Registers.h | 12 ++++----- plugins/zerogs/opengl/GS.h | 34 ++++++++++++++----------- plugins/zerogs/opengl/targets.cpp | 2 +- plugins/zerogs/opengl/zerogs.cpp | 2 +- 11 files changed, 71 insertions(+), 30 deletions(-) diff --git a/pcsx2/HwRead.cpp b/pcsx2/HwRead.cpp index 254505a929..4db491a33d 100644 --- a/pcsx2/HwRead.cpp +++ b/pcsx2/HwRead.cpp @@ -112,7 +112,7 @@ __forceinline mem16_t hwRead16(u32 mem) u16 ret; // TODO re-implement this warning along with a *complete* logging of all hw activity. - // (implementation should be modelled after thee iopHWRead/iopHwWrite files) + // (implementation should be modelled after the iopHWRead/iopHwWrite files) if( mem >= IPU_CMD && mem < D0_CHCR ) return psHu8(mem); // Console.Warning("Unexpected hwRead16 from 0x%x", mem); @@ -143,7 +143,7 @@ __forceinline mem16_t hwRead16(u32 mem) { case SBUS_F240: ret = psHu16(mem) | 0x0102; - psHu32(mem) &= ~0x4000; // not commented out like in bit mode? + psHu32(mem) &= ~0x4000; // not commented out like in bit mode? break; case SBUS_F260: diff --git a/pcsx2/Interpreter.cpp b/pcsx2/Interpreter.cpp index 49287200d1..bf2538e557 100644 --- a/pcsx2/Interpreter.cpp +++ b/pcsx2/Interpreter.cpp @@ -392,7 +392,7 @@ static void intExecuteBiosStub() { g_EEFreezeRegs = false; - // We need to be weary of events that could occur during vsyncs, which means + // We need to be wary of events that could occur during vsyncs, which means // making sure to exit this function for ExitCpuExecute. The calling function // will update UI status, and then re-enter if the bios stub execution criteria // wasn't met yet. diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index c9864c907b..0b88ef4136 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -335,6 +335,7 @@ AppConfig::AppConfig() McdEnableNTFS = true; EnableSpeedHacks = false; + EnableGameFixes = false; CdvdSource = CDVDsrc_Iso; @@ -405,6 +406,7 @@ void AppConfig::LoadSaveRootItems( IniInterface& ini ) IniEntry( CurrentELF ); IniEntry( EnableSpeedHacks ); + IniEntry( EnableGameFixes ); ini.EnumEntry( L"CdvdSource", CdvdSource, CDVD_SourceLabels, defaults.CdvdSource ); } diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index 8d043990db..42286e3477 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -187,6 +187,7 @@ public: // Master toggle for enabling or disabling all speedhacks in one fail-free swoop. // (the toggle is applied when a new EmuConfig is sent through AppCoreThread::ApplySettings) bool EnableSpeedHacks; + bool EnableGameFixes; wxString CurrentIso; wxString CurrentELF; diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index f0e5890148..0a0290a991 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -173,7 +173,7 @@ void AppCoreThread::StateCheckInThread() // To simplify settings application rules and re-entry conditions, the main App's implementation // of ApplySettings requires that the caller manually ensure that the thread has been properly -// suspended. If the thread has mot been suspended, this call will fail *silently*. +// suspended. If the thread has not been suspended, this call will fail *silently*. void AppCoreThread::ApplySettings( const Pcsx2Config& src ) { //if( m_ExecMode != ExecMode_Closed ) return; @@ -181,6 +181,8 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src ) Pcsx2Config fixup( src ); if( !g_Conf->EnableSpeedHacks ) fixup.Speedhacks = Pcsx2Config::SpeedhackOptions(); + if( !g_Conf->EnableGameFixes ) + fixup.Gamefixes = Pcsx2Config::GamefixOptions(); // Re-entry guard protects against cases where code wants to manually set core settings // which are not part of g_Conf. The subsequent call to apply g_Conf settings (which is diff --git a/pcsx2/gui/Panels/ConfigurationPanels.h b/pcsx2/gui/Panels/ConfigurationPanels.h index 9b99e6cfaa..bdfab67c4f 100644 --- a/pcsx2/gui/Panels/ConfigurationPanels.h +++ b/pcsx2/gui/Panels/ConfigurationPanels.h @@ -309,10 +309,13 @@ namespace Panels { protected: pxCheckBox* m_checkbox[NUM_OF_GAME_FIXES]; + pxCheckBox* m_check_Enable; public: GameFixesPanel( wxWindow* parent ); virtual ~GameFixesPanel() throw() { } + void EnableStuff(); + void OnEnable_Toggled( wxCommandEvent& evt ); void Apply(); void AppStatusEvent_OnSettingsApplied(); }; diff --git a/pcsx2/gui/Panels/GameFixesPanel.cpp b/pcsx2/gui/Panels/GameFixesPanel.cpp index b6da395cf6..ed71289830 100644 --- a/pcsx2/gui/Panels/GameFixesPanel.cpp +++ b/pcsx2/gui/Panels/GameFixesPanel.cpp @@ -19,6 +19,7 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : BaseApplicableConfigPanel( parent ) { + *this += new pxStaticHeading( this, _("Some games need special settings.\nEnable them here.")); wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") ); @@ -68,33 +69,63 @@ Panels::GameFixesPanel::GameFixesPanel( wxWindow* parent ) : groupSizer += (m_checkbox[i] = new pxCheckBox( this, check_text[i].label )); m_checkbox[i]->SetToolTip( check_text[i].tooltip ); } - + + m_check_Enable = new pxCheckBox( this, _("Enable game fixes"), + _("(Warning, can cause compatibility or performance issues!)")); + m_check_Enable->SetToolTip(_("The safest way to make sure that all game fixes are completely disabled.")); + m_check_Enable ->SetValue( g_Conf->EnableGameFixes ); + *this += groupSizer | wxSF.Centre(); + *this += m_check_Enable; *this += new pxStaticHeading( this, pxE( ".Panels:Gamefixes:Compat Warning", L"Enabling game fixes can cause compatibility or performance issues in other games. You " L"will need to turn off fixes manually when changing games." )); - + Connect( m_check_Enable->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GameFixesPanel::OnEnable_Toggled ) ); + EnableStuff(); + AppStatusEvent_OnSettingsApplied(); } // I could still probably get rid of the for loop, but I think this is clearer. void Panels::GameFixesPanel::Apply() { + g_Conf->EnableGameFixes = m_check_Enable->GetValue(); + Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); for (int i = 0; i < NUM_OF_GAME_FIXES; i++) { if (m_checkbox[i]->GetValue()) + { opts.bitset |= (1 << i); + } else + { opts.bitset &= ~(1 << i); + } } } +void Panels::GameFixesPanel::EnableStuff() +{ + for (int i = 0; i < NUM_OF_GAME_FIXES; i++) + { + m_checkbox[i]->Enable(m_check_Enable->GetValue()); + } +} + +void Panels::GameFixesPanel::OnEnable_Toggled( wxCommandEvent& evt ) +{ + EnableStuff(); + evt.Skip(); +} + void Panels::GameFixesPanel::AppStatusEvent_OnSettingsApplied() { const Pcsx2Config::GamefixOptions& opts( g_Conf->EmuOptions.Gamefixes ); for( int i=0; iSetValue( !!(opts.bitset & (1 << i)) ); + } } diff --git a/plugins/GSnull/Registers.h b/plugins/GSnull/Registers.h index 123ab2b8a2..a08acb7937 100644 --- a/plugins/GSnull/Registers.h +++ b/plugins/GSnull/Registers.h @@ -140,8 +140,12 @@ union name \ { \ u64 _u64; \ u32 _u32[2]; \ + /*void operator = (const GSVector4i& v) {GSVector4i::storel(this, v);} \ + bool operator == (const union name& r) const {return ((GSVector4i)r).eq(*this);} \ + bool operator != (const union name& r) const {return !((GSVector4i)r).eq(*this);} \ + operator GSVector4i() const {return GSVector4i::loadl(this);}*/ \ struct { \ - + #define REG128(name)\ union name \ { \ @@ -411,14 +415,8 @@ REG_SET_END #define SET_GIF_REG(gifTag, iRegNo, uiValue) \ {((GIFTag*)&gifTag)->u64[1] |= (((uiValue) & 0xf) << ((iRegNo) << 2));} -#ifdef _M_AMD64 -#define GET_GIF_REG(tag, reg) \ - (((tag).u64[1] >> ((reg) << 2)) & 0xf) -#else #define GET_GIF_REG(tag, reg) \ (((tag).u32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf) -#endif - // // GIFTag diff --git a/plugins/zerogs/opengl/GS.h b/plugins/zerogs/opengl/GS.h index da49f59fde..b126253cd1 100644 --- a/plugins/zerogs/opengl/GS.h +++ b/plugins/zerogs/opengl/GS.h @@ -485,22 +485,26 @@ extern int g_GameSettings; extern GSconf conf; extern int ppf; -#define PSMCT32 0 -#define PSMCT24 1 -#define PSMCT16 2 -#define PSMCT16S 10 -#define PSMT8 19 -#define PSMT4 20 -#define PSMT8H 27 -#define PSMT4HL 36 -#define PSMT4HH 44 -#define PSMT32Z 48 -#define PSMT24Z 49 -#define PSMT16Z 50 -#define PSMT16SZ 58 +// PSM values +// PSM types == Texture Storage Format +enum PSM_value{ + PSMCT32 = 0, // 000000 + PSMCT24 = 1, // 000001 + PSMCT16 = 2, // 000010 + PSMCT16S = 10, // 001010 + PSMT8 = 19, // 010011 + PSMT4 = 20, // 010100 + PSMT8H = 27, // 011011 + PSMT4HL = 36, // 100100 + PSMT4HH = 44, // 101100 + PSMT32Z = 48, // 110000 + PSMT24Z = 49, // 110001 + PSMT16Z = 50, // 110010 + PSMT16SZ = 58, // 111010 +}; -#define PSMT_ISCLUT(psm) (((psm)&0x7)>2) -#define PSMT_IS16BIT(psm) (((psm)&7)==2||((psm)&7)==10) +static __forceinline bool PSMT_ISCLUT(u32 psm) { return ((psm & 0x7) > 2);} +static __forceinline bool PSMT_IS16BIT(u32 psm) { return ((psm & 0x7) == 2);} typedef struct { int nloop; diff --git a/plugins/zerogs/opengl/targets.cpp b/plugins/zerogs/opengl/targets.cpp index c006084981..b5bbf7fee8 100644 --- a/plugins/zerogs/opengl/targets.cpp +++ b/plugins/zerogs/opengl/targets.cpp @@ -793,7 +793,7 @@ bool ZeroGS::CDepthTarget::Create(const frameInfo& frame) if( !CRenderTarget::Create(frame) ) return false; - if( psm == 0x31 ) fbm = 0xff000000; + if( psm == PSMT24Z ) fbm = 0xff000000; else fbm = 0; assert( glGetError() == GL_NO_ERROR ); diff --git a/plugins/zerogs/opengl/zerogs.cpp b/plugins/zerogs/opengl/zerogs.cpp index e6252755f7..f28cc3ab09 100644 --- a/plugins/zerogs/opengl/zerogs.cpp +++ b/plugins/zerogs/opengl/zerogs.cpp @@ -707,7 +707,7 @@ void ZeroGS::VB::CheckFrame(int tbp) f.fbh = prndr->fbh; f.psm = zbuf.psm; - if( zbuf.psm == 0x31 ) f.fbm = 0xff000000; + if( zbuf.psm == PSMT24Z ) f.fbm = 0xff000000; else f.fbm = 0; CDepthTarget* pnewdepth = (CDepthTarget*)s_DepthRTs.GetTarg(f, CRenderTargetMngr::TO_DepthBuffer|CRenderTargetMngr::TO_StrictHeight| (zbuf.zmsk?CRenderTargetMngr::TO_Virtual:0), GET_MAXHEIGHT(zbuf.zbp, gsfb.fbw, 0));