New Feature: Press TAB to toggle the framelimiter on/off (as a substitute for hitting F4 several times). Usable as a "turbo" feature, similar to other emus.

Many minor code cleanups to logging and constants.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@595 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-02-25 01:36:06 +00:00
parent 070f38c136
commit 2110018e58
12 changed files with 84 additions and 74 deletions

View File

@ -400,13 +400,13 @@ static __forceinline void frameLimit()
static __forceinline void VSyncStart(u32 sCycle)
{
EECNT_LOG( "///////// EE COUNTER VSYNC START \\\\\\\\\\ (frame: %d)\n", iFrame );
EECNT_LOG( "///////// EE COUNTER VSYNC START \\\\\\\\\\\\\\\\\\\\ (frame: %d)\n", iFrame );
vSyncDebugStuff(); // EE Profiling and Debug code
if ((CSRw & 0x8)) GSCSRr|= 0x8;
if (!(GSIMR&0x800)) gsIrq();
hwIntcIrq(2);
hwIntcIrq(INTC_VBLANK_S);
psxVBlankStart();
if (gates) rcntStartGate(true, sCycle); // Counters Start Gate code
@ -434,7 +434,7 @@ static __forceinline void VSyncStart(u32 sCycle)
static __forceinline void VSyncEnd(u32 sCycle)
{
EECNT_LOG( "///////// EE COUNTER VSYNC END \\\\\\\\\\ (frame: %d)\n", iFrame );
EECNT_LOG( "///////// EE COUNTER VSYNC END \\\\\\\\\\\\\\\\\\\\ (frame: %d)\n", iFrame );
iFrame++;
@ -450,7 +450,7 @@ static __forceinline void VSyncEnd(u32 sCycle)
vu1MicroDisableSkip();
}
hwIntcIrq(3); // HW Irq
hwIntcIrq(INTC_VBLANK_E); // HW Irq
psxVBlankEnd(); // psxCounters vBlank End
if (gates) rcntEndGate(true, sCycle); // Counters End Gate Code
frameLimit(); // limit FPS

View File

@ -199,7 +199,7 @@ void __fastcall WriteFIFO_page_7(u32 mem, const mem128_t *value)
// All addresses in this page map to 0x7000 and 0x7010:
mem &= 0x10;
IPU_LOG( "WriteFIFO/IPU, addr=0x%x", params mem );
IPU_LOG( "WriteFIFO/IPU, addr=0x%x\n", params mem );
if( mem == 0 )
{

View File

@ -507,7 +507,7 @@ void __fastcall gsWrite128_generic( u32 mem, const mem128_t* value )
{
const u32* const srcval32 = (u32*)value;
GIF_LOG("GS Write64 at %8.8lx with data %8.8x_%8.8x_%8.8x_%8.8x \n", mem,
GIF_LOG("GS Write128 at %8.8lx with data %8.8x_%8.8x_%8.8x_%8.8x \n", mem,
srcval32[3], srcval32[2], srcval32[1], srcval32[0]);
const uint masked_mem = mem & 0x13ff;
@ -582,7 +582,7 @@ __forceinline u64 gsRead64(u32 mem)
}
void gsIrq() {
hwIntcIrq(0);
hwIntcIrq(INTC_GS);
}
void gsSyncLimiterLostTime( s32 deltaTime )

View File

@ -218,7 +218,7 @@ static __forceinline mem32_t __hwRead32_page_0F( u32 mem, bool intchack )
break;
case 0xf010:
HW_LOG("INTC_MASK Read32, value=0x%x", psHu32(INTC_MASK));
HW_LOG("INTC_MASK Read32, value=0x%x\n", psHu32(INTC_MASK));
break;
case 0xf130: // 0x1000f130

View File

@ -269,13 +269,12 @@ __forceinline u64 ipuRead64(u32 mem)
#ifdef PCSX2_DEVBUILD
if( mem == 0x10002010 ) {
SysPrintf("reading 64bit IPU ctrl\n");
Console::Notice("reading 64bit IPU ctrl");
}
if( mem == 0x10002020 ) {
SysPrintf("reading 64bit IPU top\n");
Console::Notice("reading 64bit IPU top");
}
#endif
switch (mem){
case 0x10002000: // IPU_CMD

View File

@ -728,6 +728,10 @@ void KeyEvent(keyEvent* ev)
}
break;
case XK_Tab:
CycleFrameLimit(0);
break;
case XK_Escape:
signal(SIGINT, SIG_DFL);
signal(SIGPIPE, SIG_DFL);

View File

@ -516,6 +516,66 @@ static void GetGSStateFilename( string& dest )
Path::Combine( dest, SSTATES_DIR, gsText );
}
void CycleFrameLimit(int dir)
{
const char* limitMsg;
u32 newOptions;
u32 curFrameLimit = Config.Options & PCSX2_FRAMELIMIT_MASK;
u32 newFrameLimit;
static u32 oldFrameLimit = PCSX2_FRAMELIMIT_LIMIT;
if( dir == 0 ) {
// turn off limit or restore previous limit mode
if (curFrameLimit) {
oldFrameLimit = curFrameLimit;
newFrameLimit = 0;
} else
newFrameLimit = oldFrameLimit;
} else if (dir > 0) {
// next
newFrameLimit = (curFrameLimit + PCSX2_FRAMELIMIT_LIMIT) & PCSX2_FRAMELIMIT_MASK;
} else {
// previous
newFrameLimit = (curFrameLimit + PCSX2_FRAMELIMIT_VUSKIP) & PCSX2_FRAMELIMIT_MASK;
}
newOptions = (Config.Options & ~PCSX2_FRAMELIMIT_MASK) | newFrameLimit;
gsResetFrameSkip();
switch(newFrameLimit) {
case PCSX2_FRAMELIMIT_NORMAL:
limitMsg = "None/Normal";
break;
case PCSX2_FRAMELIMIT_LIMIT:
limitMsg = "Limit";
break;
case PCSX2_FRAMELIMIT_SKIP:
case PCSX2_FRAMELIMIT_VUSKIP:
if( GSsetFrameSkip == NULL )
{
newOptions &= ~PCSX2_FRAMELIMIT_MASK;
Console::Notice("Notice: GS Plugin does not support frameskipping.");
limitMsg = "None/Normal";
}
else
{
// When enabling Skipping we have to make sure Skipper (GS) and Limiter (EE)
// are properly synchronized.
gsDynamicSkipEnable();
limitMsg = ((newOptions & PCSX2_FRAMELIMIT_MASK) == PCSX2_FRAMELIMIT_SKIP) ? "Skip" : "VUSkip";
}
break;
}
Threading::AtomicExchange( Config.Options, newOptions );
Console::Notice("Frame Limit Mode Changed: %s", params limitMsg );
// [Air]: Do we really want to save runtime changes to frameskipping?
//SaveConfig();
}
void ProcessFKeys(int fkey, int shift)
{
string Text;
@ -590,53 +650,7 @@ void ProcessFKeys(int fkey, int shift)
break;
case 4:
{
const char* limitMsg;
u32 newOptions;
// cycle
if( shift ) {
// previous
newOptions = (Config.Options&~PCSX2_FRAMELIMIT_MASK)|(((Config.Options&PCSX2_FRAMELIMIT_MASK)+PCSX2_FRAMELIMIT_VUSKIP)&PCSX2_FRAMELIMIT_MASK);
}
else {
// next
newOptions = (Config.Options&~PCSX2_FRAMELIMIT_MASK)|(((Config.Options&PCSX2_FRAMELIMIT_MASK)+PCSX2_FRAMELIMIT_LIMIT)&PCSX2_FRAMELIMIT_MASK);
}
gsResetFrameSkip();
switch(newOptions & PCSX2_FRAMELIMIT_MASK) {
case PCSX2_FRAMELIMIT_NORMAL:
limitMsg = "None/Normal";
break;
case PCSX2_FRAMELIMIT_LIMIT:
limitMsg = "Limit";
break;
case PCSX2_FRAMELIMIT_SKIP:
case PCSX2_FRAMELIMIT_VUSKIP:
if( GSsetFrameSkip == NULL )
{
newOptions &= ~PCSX2_FRAMELIMIT_MASK;
Console::Notice("Notice: GS Plugin does not support frameskipping.");
limitMsg = "None/Normal";
}
else
{
// When enabling Skipping we have to make sure Skipper (GS) and Limiter (EE)
// are properly synchronized.
gsDynamicSkipEnable();
limitMsg = ((newOptions & PCSX2_FRAMELIMIT_MASK) == PCSX2_FRAMELIMIT_SKIP) ? "Skip" : "VUSkip";
}
break;
}
Threading::AtomicExchange( Config.Options, newOptions );
Console::Notice("Frame Limit Mode Changed: %s", params limitMsg );
// [Air]: Do we really want to save runtime changes to frameskipping?
//SaveConfig();
}
CycleFrameLimit(shift ? -1 : 1);
break;
// note: VK_F5-VK_F7 are reserved for GS

View File

@ -184,6 +184,7 @@ void SaveGSState(const string& file);
void LoadGSState(const string& file);
char *ParseLang(char *id);
void CycleFrameLimit(int dir);
void ProcessFKeys(int fkey, int shift); // processes fkey related commands value 1-12
#define DIRENTRY_SIZE 16

View File

@ -592,7 +592,7 @@ void vifMFIFOInterrupt()
{
if(vif1.irq && vif1.tag.size == 0) {
vif1Regs->stat|= VIF1_STAT_INT;
hwIntcIrq(5);
hwIntcIrq(INTC_VIF1);
--vif1.irq;
if(vif1Regs->stat & (VIF1_STAT_VSS|VIF1_STAT_VIS|VIF1_STAT_VFS))
{

View File

@ -257,7 +257,7 @@ void __fastcall memRead32(u32 mem, u32 *out) { *out = vtlb_memRead32( mem ); }
// Error / TLB Miss Handlers
//
// Generates a VtlbMiss Exception
// Generates a tlbMiss Exception
static __forceinline void vtlb_Miss(u32 addr,u32 mode)
{
Console::Error("vtlb miss : addr 0x%X, mode %d", params addr,mode);
@ -270,7 +270,7 @@ static __forceinline void vtlb_Miss(u32 addr,u32 mode)
}
// Just dies a horrible death for now.
//
// Eventually should generate a BusError exception.
static __forceinline void vtlb_BusError(u32 addr,u32 mode)
{
Console::Error("vtlb bus error : addr 0x%X, mode %d\n",params addr,mode);

View File

@ -668,6 +668,10 @@ static void __fastcall KeyEvent(keyEvent* ev)
}
break;
case VK_TAB:
CycleFrameLimit(0);
break;
case VK_ESCAPE:
#ifdef PCSX2_DEVBUILD
if( g_SaveGSStream >= 3 ) {

View File

@ -227,16 +227,13 @@ int hwConstRead32(u32 x86reg, u32 mem)
iFlushCall(0);
PUSH32I(0);
CALLFunc((uptr)rcntRcount);
EECNT_LOG("Counter 0 count read = %x\n", rcntRcount(0));
ADD32ItoR(ESP, 4);
return 1;
case 0x10000010:
_eeReadConstMem32(x86reg, (uptr)&counters[0].mode);
EECNT_LOG("Counter 0 mode read = %x\n", counters[0].modeval);
return 0;
case 0x10000020:
_eeReadConstMem32(x86reg, (uptr)&counters[0].target);
EECNT_LOG("Counter 0 target read = %x\n", counters[0].target);
return 0;
case 0x10000030:
_eeReadConstMem32(x86reg, (uptr)&counters[0].hold);
@ -246,16 +243,13 @@ int hwConstRead32(u32 x86reg, u32 mem)
iFlushCall(0);
PUSH32I(1);
CALLFunc((uptr)rcntRcount);
EECNT_LOG("Counter 1 count read = %x\n", rcntRcount(1));
ADD32ItoR(ESP, 4);
return 1;
case 0x10000810:
_eeReadConstMem32(x86reg, (uptr)&counters[1].mode);
EECNT_LOG("Counter 1 mode read = %x\n", counters[1].modeval);
return 0;
case 0x10000820:
_eeReadConstMem32(x86reg, (uptr)&counters[1].target);
EECNT_LOG("Counter 1 target read = %x\n", counters[1].target);
return 0;
case 0x10000830:
_eeReadConstMem32(x86reg, (uptr)&counters[1].hold);
@ -265,16 +259,13 @@ int hwConstRead32(u32 x86reg, u32 mem)
iFlushCall(0);
PUSH32I(2);
CALLFunc((uptr)rcntRcount);
EECNT_LOG("Counter 2 count read = %x\n", rcntRcount(2));
ADD32ItoR(ESP, 4);
return 1;
case 0x10001010:
_eeReadConstMem32(x86reg, (uptr)&counters[2].mode);
EECNT_LOG("Counter 2 mode read = %x\n", counters[2].modeval);
return 0;
case 0x10001020:
_eeReadConstMem32(x86reg, (uptr)&counters[2].target);
EECNT_LOG("Counter 2 target read = %x\n", counters[2].target);
return 0;
case 0x10001030:
// fixme: Counters[2].hold and Counters[3].hold are never assigned values
@ -286,16 +277,13 @@ int hwConstRead32(u32 x86reg, u32 mem)
iFlushCall(0);
PUSH32I(3);
CALLFunc((uptr)rcntRcount);
EECNT_LOG("Counter 3 count read = %x\n", rcntRcount(3));
ADD32ItoR(ESP, 4);
return 1;
case 0x10001810:
_eeReadConstMem32(x86reg, (uptr)&counters[3].mode);
EECNT_LOG("Counter 3 mode read = %x\n", counters[3].modeval);
return 0;
case 0x10001820:
_eeReadConstMem32(x86reg, (uptr)&counters[3].target);
EECNT_LOG("Counter 3 target read = %x\n", counters[3].target);
return 0;
case 0x10001830:
// fixme: Counters[2].hold and Counters[3].hold are never assigned values