1.0 branch: Merged in miscellaneous changes from trunk. Lots of changes in GSdx need Linux side verification before they can get in!

git-svn-id: http://pcsx2.googlecode.com/svn/branches/1.0.0@5242 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-05-30 11:54:59 +00:00
parent e27c7c4434
commit e31b0755d0
6 changed files with 120 additions and 58 deletions

View File

@ -869,8 +869,9 @@ bool AppConfig::IsOkApplyPreset(int n)
//Console.WriteLn("Applying Preset %d ...", n); //Console.WriteLn("Applying Preset %d ...", n);
//Have some original and default values at hand to be used later. //Have some original and default values at hand to be used later.
Pcsx2Config::GSOptions original_GS = EmuOptions.GS; Pcsx2Config::GSOptions original_GS = EmuOptions.GS;
AppConfig::FramerateOptions original_Framerate = Framerate; AppConfig::FramerateOptions original_Framerate = Framerate;
Pcsx2Config::SpeedhackOptions original_SpeedHacks = EmuOptions.Speedhacks;
AppConfig default_AppConfig; AppConfig default_AppConfig;
Pcsx2Config default_Pcsx2Config; Pcsx2Config default_Pcsx2Config;
@ -880,7 +881,7 @@ bool AppConfig::IsOkApplyPreset(int n)
// 2. The panels should not apply values which the presets don't control if the value is initiated by a preset. // 2. The panels should not apply values which the presets don't control if the value is initiated by a preset.
// Currently controlled by the presets: // Currently controlled by the presets:
// - AppConfig: Framerate (except turbo/slowmo factors), EnableSpeedHacks, EnableGameFixes. // - AppConfig: Framerate (except turbo/slowmo factors), EnableSpeedHacks, EnableGameFixes.
// - EmuOptions: Cpu, Gamefixes, SpeedHacks, EnablePatches, GS (except for FrameLimitEnable, VsyncEnable and ManagedVsync). // - EmuOptions: Cpu, Gamefixes, SpeedHacks (except mtvu), EnablePatches, GS (except for FrameLimitEnable, VsyncEnable and ManagedVsync).
// //
// This essentially currently covers all the options on all the panels except for framelimiter which isn't // This essentially currently covers all the options on all the panels except for framelimiter which isn't
// controlled by the presets, and the entire GSWindow panel which also isn't controlled by presets // controlled by the presets, and the entire GSWindow panel which also isn't controlled by presets
@ -908,7 +909,8 @@ bool AppConfig::IsOkApplyPreset(int n)
EmuOptions.Gamefixes = default_Pcsx2Config.Gamefixes; EmuOptions.Gamefixes = default_Pcsx2Config.Gamefixes;
EmuOptions.Speedhacks = default_Pcsx2Config.Speedhacks; EmuOptions.Speedhacks = default_Pcsx2Config.Speedhacks;
EmuOptions.Speedhacks.bitset = 0; //Turn off individual hacks to make it visually clear they're not used. EmuOptions.Speedhacks.bitset = 0; //Turn off individual hacks to make it visually clear they're not used.
EmuOptions.Speedhacks.vuThread = original_SpeedHacks.vuThread; // MTVU is not modified by presets
EnableSpeedHacks = true;
//Actual application of current preset over the base settings which all presets use (mostly pcsx2's default values). //Actual application of current preset over the base settings which all presets use (mostly pcsx2's default values).
//The presets themselves might need some voodoo tuning to be even more useful. Currently they mostly modify Speedhacks. //The presets themselves might need some voodoo tuning to be even more useful. Currently they mostly modify Speedhacks.
@ -936,7 +938,6 @@ bool AppConfig::IsOkApplyPreset(int n)
//EmuOptions.Gamefixes.EETimingHack = true; //EmuOptions.Gamefixes.EETimingHack = true;
case 1 : //Recommended speed hacks. case 1 : //Recommended speed hacks.
EnableSpeedHacks = true;
EmuOptions.Speedhacks.IntcStat = true; EmuOptions.Speedhacks.IntcStat = true;
EmuOptions.Speedhacks.WaitLoop = true; EmuOptions.Speedhacks.WaitLoop = true;
EmuOptions.Speedhacks.vuFlagHack = true; EmuOptions.Speedhacks.vuFlagHack = true;

View File

@ -516,6 +516,12 @@ GSPanel* GSFrame::GetViewport()
void GSFrame::OnUpdateTitle( wxTimerEvent& evt ) void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
{ {
#ifdef __LINUX__
// Important Linux note: When the title is set in fullscreen the window is redrawn. Unfortunately
// an intermediate white screen appears too which leads to a very annoying flickering.
if (IsFullScreen()) return;
#endif
double fps = wxGetApp().FpsManager.GetFramerate(); double fps = wxGetApp().FpsManager.GetFramerate();
char gsDest[128]; char gsDest[128];

View File

@ -269,9 +269,7 @@ Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow* parent )
void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse ) void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse )
{ {
//Console.WriteLn("SpeedHacksPanel::EnableStuff: Using %s", configToUse?"Object":"NULL");
if( !configToUse ) configToUse = g_Conf; if( !configToUse ) configToUse = g_Conf;
//Console.WriteLn("SpeedHacksPanel::EnableStuff: EnabledPresets: %s", configToUse->EnablePresets?"true":"false");
wxSizerItemList& items( s_table->GetChildren() ); wxSizerItemList& items( s_table->GetChildren() );
wxSizerItemList::iterator it = items.begin(); wxSizerItemList::iterator it = items.begin();
@ -279,7 +277,7 @@ void Panels::SpeedHacksPanel::EnableStuff( AppConfig* configToUse )
while( it != end ) while( it != end )
{ {
(*it)->GetWindow()->Enable( m_check_Enable->GetValue() && !configToUse->EnablePresets); (*it)->GetWindow()->Enable( m_check_Enable->GetValue());
++it; ++it;
} }
} }
@ -295,19 +293,22 @@ void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, int fl
const bool enabled = configToApply.EnableSpeedHacks; const bool enabled = configToApply.EnableSpeedHacks;
Pcsx2Config::SpeedhackOptions& opts=configToApply.EmuOptions.Speedhacks; Pcsx2Config::SpeedhackOptions& opts=configToApply.EmuOptions.Speedhacks;
m_check_Enable ->SetValue( !!enabled ); m_check_Enable ->SetValue( !!enabled ).Enable(!configToApply.EnablePresets);
m_slider_eecycle ->SetValue( opts.EECycleRate + 1 ); m_slider_eecycle ->SetValue( opts.EECycleRate + 1 );
m_slider_vustealer ->SetValue( opts.VUCycleSteal ); m_slider_vustealer ->SetValue( opts.VUCycleSteal );
m_slider_eecycle->Enable(!configToApply.EnablePresets);
m_slider_vustealer->Enable(!configToApply.EnablePresets);
SetEEcycleSliderMsg(); SetEEcycleSliderMsg();
SetVUcycleSliderMsg(); SetVUcycleSliderMsg();
m_check_vuFlagHack ->SetValue(opts.vuFlagHack); m_check_vuFlagHack ->SetValue(opts.vuFlagHack).Enable(!configToApply.EnablePresets);
m_check_vuThread ->SetValue(opts.vuThread); if( !(flags & AppConfig::APPLY_FLAG_FROM_PRESET) )
m_check_intc ->SetValue(opts.IntcStat); m_check_vuThread ->SetValue(opts.vuThread);
m_check_waitloop ->SetValue(opts.WaitLoop); m_check_intc ->SetValue(opts.IntcStat).Enable(!configToApply.EnablePresets);
m_check_fastCDVD ->SetValue(opts.fastCDVD); m_check_waitloop ->SetValue(opts.WaitLoop).Enable(!configToApply.EnablePresets);
m_check_fastCDVD ->SetValue(opts.fastCDVD).Enable(!configToApply.EnablePresets);
EnableStuff( &configToApply ); EnableStuff( &configToApply );
@ -315,8 +316,6 @@ void Panels::SpeedHacksPanel::ApplyConfigToGui( AppConfig& configToApply, int fl
Layout(); Layout();
//Console.WriteLn("SpeedHacksPanel::ApplyConfigToGui: EnabledPresets: %s", configToApply.EnablePresets?"true":"false"); //Console.WriteLn("SpeedHacksPanel::ApplyConfigToGui: EnabledPresets: %s", configToApply.EnablePresets?"true":"false");
this->Enable(!configToApply.EnablePresets);
} }

View File

@ -16,14 +16,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
// These enums & structures are copied from GSdx, which got them from sp2dev 0.4.0.
// sp2dev is Copyright (C) 2002 Terratron Technologies Inc. All Rights Reserved.
// http://window.terratron.com/~sosman/ps2linux/
//
// Gsdx is Copyright (C) 2007-2009 Gabest All Rights Reserved.
// http://www.gabest.org
//
#ifndef __REGISTERS_H__ #ifndef __REGISTERS_H__
#define __REGISTERS_H__ #define __REGISTERS_H__
@ -578,15 +570,6 @@ REG64_SET(GSReg)
GSRegSMODE2 SMODE2; GSRegSMODE2 SMODE2;
REG_SET_END REG_SET_END
//
// sps2tags.h
//
#define SET_GIF_REG(gifTag, iRegNo, uiValue) \
{((GIFTag*)&gifTag)->u64[1] |= (((uiValue) & 0xf) << ((iRegNo) << 2));}
#define GET_GIF_REG(tag, reg) \
(((tag).u32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
// //
// GIFTag // GIFTag

View File

@ -1,26 +1,37 @@
@echo off @echo off
set source=DynaCrcHack.c set source=DynaCrcHack.c
set tcc=tcc\tcc
@cd /D "%~d1%~p1" > nul pushd "%~dp0"
if not exist tcc\tcc.exe ( if exist %tcc%.exe goto pre
echo.
echo Missing ^<this-folder^>\tcc\tcc.exe rem local tcc not found, try to invoke a global tcc
echo. set tcc=tcc
echo Please download TCC 0.9.25 for windows from http://bellard.org/tcc/ %tcc% utils\ding.c -luser32 -o utils\ding.exe >nul 2>nul
echo and extract the package to ^<this-folder^>\tcc if %errorlevel% == 0 (
echo. echo.
pause echo Using globally installed tcc ...
goto end echo.
) else (
echo.
echo Missing ^<this-folder^>\tcc\tcc.exe
echo.
echo Please download TCC 0.9.25 for windows from http://bellard.org/tcc/
echo and extract the package to ^<this-folder^>\tcc
echo.
pause
goto end
) )
if not exist utils\waitForChange.exe tcc\tcc utils\waitForChange.c -o utils\waitForChange.exe :pre
if not exist utils\ding.exe tcc\tcc utils\ding.c -luser32 -o utils\ding.exe if not exist utils\waitForChange.exe %tcc% utils\waitForChange.c -o utils\waitForChange.exe
if not exist utils\ding.exe %tcc% utils\ding.c -luser32 -o utils\ding.exe
:start :start
echo Compiling ... echo Compiling ...
echo. echo.
tcc\tcc -shared -Wall %source% %tcc% -shared -Wall %source%
if %errorlevel% == 0 ( if %errorlevel% == 0 (
echo -^> OK echo -^> OK
utils\ding 2 utils\ding 2
@ -38,4 +49,5 @@ echo.
goto start goto start
:end :end
popd

View File

@ -28,11 +28,13 @@
version 1.1 - initial release version 1.1 - initial release
Version 1.2 - better GSdx integration, Bugfix. Version 1.2 - better GSdx integration, Bugfix.
Version 1.4 - Configuration, few utils, Cleanups (dll API is unchanged) Version 1.4 - Configuration, few utils, Cleanups (dll API is unchanged)
version 1.5 - Supports CRC passed from GSdx and util IsCRC(crc1 [, crc2, ...])
\*----------------------------------------------------------*/ \*----------------------------------------------------------*/
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
//some common tokens not available in C //some common tokens not available in C
@ -53,7 +55,7 @@ enum GS_PSM{PSM_PSMCT32=0,PSM_PSMCT24=1,PSM_PSMCT16=2,PSM_PSMCT16S=10,PSM_PSMT8=
#define skip (*pSkip) #define skip (*pSkip)
#define GSUtil_HasSharedBits(a,b,c,d) sharedBits #define GSUtil_HasSharedBits(a,b,c,d) sharedBits
#define GSC_AnyGame(a,b) _GSC_AnyGame() #define GSC_AnyGame(a,b) _GSC_AnyGame()
GSFrameInfo fi; int* pSkip; uint32 g_crc_region; uint32 sharedBits; GSFrameInfo fi; int* pSkip; uint32 g_crc_region; uint32 sharedBits; uint32 g_crc;
//utils //utils
const int MODE_3_DELAY = 750; // ms const int MODE_3_DELAY = 750; // ms
@ -61,7 +63,11 @@ void dprintf(const char* format, ...);
void dings(const int n); void dings(const int n);
bool isCornerTriggered(); bool isCornerTriggered();
bool IsIn(const DWORD val, ...); bool IsIn(const DWORD val, ...);
#define END 0x72951413 // END is a magic number, if we have such CRC - meh
#define END (0x72951413)
#define IsCRC(...) (g_crc!=END && IsIn(g_crc, __VA_ARGS__, END))
// C99 syntax for variadic macro: #define FOO(fmt, ...) printf(fmt, __VA_ARGS__) // empty list not supported
// empty list is possible by suppressing prior comma by using ##__VA_ARGS__
// ---------- Configuration --------------------------------- // ---------- Configuration ---------------------------------
@ -85,7 +91,7 @@ bool GSC_AnyGame( const GSFrameInfo& fi, int& skip )
{ {
//Example: MGS3 CRC hack copied directly from GSState.cpp (see the Notes section exceptions): //Example: MGS3 CRC hack copied directly from GSState.cpp (see the Notes section exceptions):
if( IsCRC(0x086273D2, 0x26A6E286, 0x9F185CE1) ){ // 3 first MGS3 CRCs from GSCrc.c
if(skip == 0) if(skip == 0)
{ {
if(fi.TME && fi.FBP == 0x02000 && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 == 0x00000 || fi.TBP0 == 0x01000) && fi.TPSM == PSM_PSMCT24) if(fi.TME && fi.FBP == 0x02000 && fi.FPSM == PSM_PSMCT32 && (fi.TBP0 == 0x00000 || fi.TBP0 == 0x01000) && fi.TPSM == PSM_PSMCT24)
@ -120,17 +126,22 @@ bool GSC_AnyGame( const GSFrameInfo& fi, int& skip )
return true; return true;
} }
return true;
}
/*********** Dynamic CRC hack code ends here *****************/ /*********** Dynamic CRC hack code ends here *****************/
// Prints to the Debugger's output window or to DebugView ( http://technet.microsoft.com/en-us/sysinternals/bb896647 ) // Prints to the Debugger's output window or to DebugView ( http://technet.microsoft.com/en-us/sysinternals/bb896647 )
void dprintf( const char* format, ...) void dprintf( const char* format, ...)
{ {
#define BUFSIZ 2048 #define _BUFSIZ 2048
char buffer[BUFSIZ]; char buffer[_BUFSIZ];
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
if( 0 > vsnprintf( buffer, BUFSIZ, format, args ) ) if( 0 > vsnprintf( buffer, _BUFSIZ, format, args ) )
sprintf( buffer, "%s","<too-long-to-print>\n" ); sprintf( buffer, "%s","<too-long-to-print>\n" );
OutputDebugString( buffer ); OutputDebugString( buffer );
va_end( args ); va_end( args );
@ -200,24 +211,70 @@ bool preProcess_isAbort()
} }
DWORD WINAPI thread_PrintStats( LPVOID lpParam );
typedef struct _stats { uint32 overall, changed, skipped, nextPrint;} Stats;
#define DLL_EXPORT __declspec(dllexport) #define DLL_EXPORT __declspec(dllexport)
#define CRC_HACK DynamicCrcHack #define CRC_HACK DynamicCrcHack2
#define CRC_HACK_OLD DynamicCrcHack
#if INITIAL_MODE == 0 #if INITIAL_MODE == 0
#define CRC_HACK Voldemort #define CRC_HACK Voldemort2
#define CRC_HACK_OLD Voldemort
#endif #endif
DLL_EXPORT bool CRC_HACK (uint32 FBP, uint32 FPSM, uint32 FBMSK, uint32 TBP0, uint32 TPSM, uint32 TZTST, DLL_EXPORT bool CRC_HACK (uint32 FBP, uint32 FPSM, uint32 FBMSK, uint32 TBP0, uint32 TPSM, uint32 TZTST,
uint32 TME, int* _pSkip, uint32 _g_crc_region, uint32 _sharedBits) uint32 TME, int* _pSkip, uint32 _g_crc_region, uint32 _sharedBits, uint32 _crc)
{ {
static Stats stat={overall:0, changed:0, skipped:0, nextPrint:0};
DWORD now=GetTickCount();
if(stat.nextPrint <= now){
dprintf("DH: Overall: %5d, skipped: %5d, actions:%5d\n", stat.overall, stat.skipped, stat.changed);
stat.overall=stat.changed=stat.skipped=0;
stat.nextPrint=now+1000;
}
stat.overall++;
if(preProcess_isAbort()) // Process dings if required if(preProcess_isAbort()) // Process dings if required
return true; // Abort hack depending on mode return true; // Abort hack depending on mode
fi.FBP=FBP; fi.FPSM=FPSM; fi.FBMSK=FBMSK; fi.TBP0=TBP0; fi.TPSM=TPSM; fi.TZTST=TZTST; fi.TME=TME; fi.FBP=FBP; fi.FPSM=FPSM; fi.FBMSK=FBMSK; fi.TBP0=TBP0; fi.TPSM=TPSM; fi.TZTST=TZTST; fi.TME=TME;
pSkip=_pSkip; g_crc_region=_g_crc_region; sharedBits=_sharedBits; pSkip=_pSkip; g_crc_region=_g_crc_region; sharedBits=_sharedBits; g_crc = _crc;
return _GSC_AnyGame(); int pre=skip;
bool res=_GSC_AnyGame();
int post=skip;
if(skip) stat.skipped++;
if(post!=pre) stat.changed++;
return res;
} }
DLL_EXPORT bool CRC_HACK_OLD (uint32 FBP, uint32 FPSM, uint32 FBMSK, uint32 TBP0, uint32 TPSM, uint32 TZTST,
uint32 TME, int* _pSkip, uint32 _g_crc_region, uint32 _sharedBits)
{
return CRC_HACK(FBP, FPSM, FBMSK, TBP0, TPSM, TZTST, TME,_pSkip, _g_crc_region,_sharedBits, END);
}
char* v[]={
"DLL_PROCESS_DETACH",
"DLL_PROCESS_ATTACH",
"DLL_THREAD_ATTACH",
"DLL_THREAD_DETACH"
};
BOOL WINAPI DllMain (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason<4)
dprintf("DllMain: %s\n", v[dwReason]);
else
dprintf("DllMain: %d\n", dwReason);
return TRUE;
}
/*-------------------- Notes- -------------------------------*\ /*-------------------- Notes- -------------------------------*\
1. If required, Use CRC_<region> instead of CRC::<region> (e.g. CRC_US instead of CRC::US) 1. If required, Use CRC_<region> instead of CRC::<region> (e.g. CRC_US instead of CRC::US)
@ -230,6 +287,10 @@ DLL_EXPORT bool CRC_HACK (uint32 FBP, uint32 FPSM, uint32 FBMSK, uint32 TBP0, ui
3. When copying the code back to GSState.cpp, remember to restore CRC::.. and GSUtil::... 3. When copying the code back to GSState.cpp, remember to restore CRC::.. and GSUtil::...
4. GSdx v5215 onwards also sends the CRC of the game (even if it's not defined at GSdx).
You can test the CRC using IsCRC(0x12345678) or, for few CRCs: IsCRC(0x12345678, 0x87654321, ...)
NOTE: with GSdx v5214 and before: IsCRC(...) always returns false.
\*----------------------------------------------------------*/ \*----------------------------------------------------------*/
/* --------------- Usage instructions --------------------------------------------*\ /* --------------- Usage instructions --------------------------------------------*\