mirror of https://github.com/PCSX2/pcsx2.git
Fiddle with ProcessFKeys a bit, and hack in a key to turn logging on and off(F10).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@891 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
3b570f8a2b
commit
b44d1590ca
|
@ -74,6 +74,7 @@ namespace R3000A
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
|
||||||
extern u32 varLog;
|
extern u32 varLog;
|
||||||
|
extern bool enableLogging;
|
||||||
|
|
||||||
void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...);
|
void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...);
|
||||||
void __Log( const char* fmt, ... );
|
void __Log( const char* fmt, ... );
|
||||||
|
|
|
@ -291,12 +291,6 @@ void OnStates_SaveOther(GtkMenuItem *menuitem, gpointer user_data)
|
||||||
gdk_window_raise(FileSel->window);
|
gdk_window_raise(FileSel->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Quick macros for checking shift, control, alt, and caps lock. */
|
|
||||||
#define SHIFT_EVT(evt) ((evt == XK_Shift_L) || (evt == XK_Shift_R))
|
|
||||||
#define CTRL_EVT(evt) ((evt == XK_Control_L) || (evt == XK_Control_L))
|
|
||||||
#define ALT_EVT(evt) ((evt == XK_Alt_L) || (evt == XK_Alt_R))
|
|
||||||
#define CAPS_LOCK_EVT(evt) (evt == XK_Caps_Lock)
|
|
||||||
|
|
||||||
bool SysInit()
|
bool SysInit()
|
||||||
{
|
{
|
||||||
if (sinit) return true;
|
if (sinit) return true;
|
||||||
|
@ -450,22 +444,34 @@ namespace HostGui
|
||||||
SysExecute();
|
SysExecute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quick macros for checking shift, control, alt, and caps lock. */
|
||||||
|
#define SHIFT_EVT(evt) ((evt == XK_Shift_L) || (evt == XK_Shift_R))
|
||||||
|
#define CTRL_EVT(evt) ((evt == XK_Control_L) || (evt == XK_Control_R))
|
||||||
|
#define ALT_EVT(evt) ((evt == XK_Alt_L) || (evt == XK_Alt_R))
|
||||||
|
#define CAPS_LOCK_EVT(evt) (evt == XK_Caps_Lock)
|
||||||
|
|
||||||
void __fastcall KeyEvent(keyEvent* ev)
|
void __fastcall KeyEvent(keyEvent* ev)
|
||||||
{
|
{
|
||||||
static int shift = 0;
|
struct KeyModifiers *keymod = &keymodifiers;
|
||||||
|
|
||||||
if (ev == NULL) return;
|
if (ev == NULL) return;
|
||||||
|
|
||||||
if (GSkeyEvent != NULL) GSkeyEvent(ev);
|
if (ev->evt == KEYRELEASE)
|
||||||
|
{
|
||||||
|
if (SHIFT_EVT(ev->key)) keymod->shift = FALSE;
|
||||||
|
if (CTRL_EVT(ev->key)) keymod->control = FALSE;
|
||||||
|
if (ALT_EVT(ev->key)) keymod->alt = FALSE;
|
||||||
|
if (CAPS_LOCK_EVT(ev->key)) keymod->capslock = FALSE;
|
||||||
|
GSkeyEvent(ev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->evt == KEYPRESS)
|
if (ev->evt == KEYPRESS)
|
||||||
{
|
{
|
||||||
if (SHIFT_EVT(ev->key))
|
if (SHIFT_EVT(ev->key)) keymod->shift = TRUE;
|
||||||
shift = 1;
|
if (CTRL_EVT(ev->key)) keymod->control = TRUE;
|
||||||
if (CAPS_LOCK_EVT(ev->key))
|
if (ALT_EVT(ev->key)) keymod->alt = TRUE;
|
||||||
{
|
if (CAPS_LOCK_EVT(ev->key)) keymod->capslock = TRUE;
|
||||||
//Set up anything we want to happen while caps lock is down.
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ev->key)
|
switch (ev->key)
|
||||||
{
|
{
|
||||||
|
@ -483,7 +489,7 @@ namespace HostGui
|
||||||
case XK_F12:
|
case XK_F12:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProcessFKeys(ev->key - XK_F1 + 1, shift);
|
ProcessFKeys(ev->key - XK_F1 + 1, keymod);
|
||||||
}
|
}
|
||||||
catch (Exception::CpuStateShutdown&)
|
catch (Exception::CpuStateShutdown&)
|
||||||
{
|
{
|
||||||
|
@ -531,17 +537,7 @@ namespace HostGui
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ev->evt == KEYRELEASE)
|
|
||||||
{
|
|
||||||
if (SHIFT_EVT(ev->key))
|
|
||||||
shift = 0;
|
|
||||||
if (CAPS_LOCK_EVT(ev->key))
|
|
||||||
{
|
|
||||||
//Release caps lock
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -51,6 +51,8 @@ char CdromId[12];
|
||||||
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
|
static int g_Pcsx2Recording = 0; // true 1 if recording video and sound
|
||||||
bool renderswitch = 0;
|
bool renderswitch = 0;
|
||||||
|
|
||||||
|
struct KeyModifiers keymodifiers = {false, false, false, false};
|
||||||
|
|
||||||
#define NUM_STATES 10
|
#define NUM_STATES 10
|
||||||
int StatesC = 0;
|
int StatesC = 0;
|
||||||
|
|
||||||
|
@ -489,11 +491,12 @@ void CycleFrameLimit(int dir)
|
||||||
//SaveConfig();
|
//SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessFKeys(int fkey, int shift)
|
void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
|
||||||
{
|
{
|
||||||
assert(fkey >= 1 && fkey <= 12 );
|
assert(fkey >= 1 && fkey <= 12 );
|
||||||
|
|
||||||
switch(fkey) {
|
switch(fkey)
|
||||||
|
{
|
||||||
case 1:
|
case 1:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -511,7 +514,7 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if( shift )
|
if( keymod->shift )
|
||||||
StatesC = (StatesC+NUM_STATES-1) % NUM_STATES;
|
StatesC = (StatesC+NUM_STATES-1) % NUM_STATES;
|
||||||
else
|
else
|
||||||
StatesC = (StatesC+1) % NUM_STATES;
|
StatesC = (StatesC+1) % NUM_STATES;
|
||||||
|
@ -558,7 +561,7 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
CycleFrameLimit(shift ? -1 : 1);
|
CycleFrameLimit(keymod->shift ? -1 : 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// note: VK_F5-VK_F7 are reserved for GS
|
// note: VK_F5-VK_F7 are reserved for GS
|
||||||
|
@ -567,7 +570,8 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: //gsdx "on the fly" renderer switching
|
case 9: //gsdx "on the fly" renderer switching
|
||||||
if (!renderswitch) {
|
if (!renderswitch)
|
||||||
|
{
|
||||||
StateRecovery::MakeGsOnly();
|
StateRecovery::MakeGsOnly();
|
||||||
g_EmulationInProgress = false;
|
g_EmulationInProgress = false;
|
||||||
CloseGS();
|
CloseGS();
|
||||||
|
@ -575,7 +579,8 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
StateRecovery::Recover();
|
StateRecovery::Recover();
|
||||||
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
StateRecovery::MakeGsOnly();
|
StateRecovery::MakeGsOnly();
|
||||||
g_EmulationInProgress = false;
|
g_EmulationInProgress = false;
|
||||||
CloseGS();
|
CloseGS();
|
||||||
|
@ -585,21 +590,35 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
|
case 10:
|
||||||
|
// There's likely a better way to implement this, but this seemed useful.
|
||||||
|
// I might add turning EE, VU0, and VU1 recs on and off by hotkey at some point, too.
|
||||||
|
// --arcum42
|
||||||
|
enableLogging = !enableLogging;
|
||||||
|
|
||||||
|
if (enableLogging)
|
||||||
|
GSprintf(10, "Logging Enabled.");
|
||||||
|
else
|
||||||
|
GSprintf(10,"Logging Disabled.");
|
||||||
|
|
||||||
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
if( mtgsThread != NULL ) {
|
if( mtgsThread != NULL )
|
||||||
|
{
|
||||||
Console::Notice( "Cannot make gsstates in MTGS mode" );
|
Console::Notice( "Cannot make gsstates in MTGS mode" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string Text;
|
string Text;
|
||||||
if( strgametitle[0] != 0 ) {
|
if( strgametitle[0] != 0 )
|
||||||
|
{
|
||||||
// only take the first two words
|
// only take the first two words
|
||||||
char name[256], *tok;
|
char name[256], *tok;
|
||||||
string gsText;
|
string gsText;
|
||||||
|
|
||||||
tok = strtok(strgametitle, " ");
|
tok = strtok(strgametitle, " ");
|
||||||
sprintf(name, "%s_", mystrlwr(tok));
|
sprintf(name, "%s_", mystrlwr(tok));
|
||||||
|
|
||||||
tok = strtok(NULL, " ");
|
tok = strtok(NULL, " ");
|
||||||
if( tok != NULL ) strcat(name, tok);
|
if( tok != NULL ) strcat(name, tok);
|
||||||
|
|
||||||
|
@ -607,7 +626,9 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
Text = Path::Combine( SSTATES_DIR, gsText );
|
Text = Path::Combine( SSTATES_DIR, gsText );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Text = GetGSStateFilename();
|
Text = GetGSStateFilename();
|
||||||
|
}
|
||||||
|
|
||||||
SaveGSState(Text);
|
SaveGSState(Text);
|
||||||
}
|
}
|
||||||
|
@ -615,20 +636,22 @@ void ProcessFKeys(int fkey, int shift)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if( shift ) {
|
if( keymod->shift )
|
||||||
|
{
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
iDumpRegisters(cpuRegs.pc, 0);
|
iDumpRegisters(cpuRegs.pc, 0);
|
||||||
Console::Notice("hardware registers dumped EE:%x, IOP:%x\n", params cpuRegs.pc, psxRegs.pc);
|
Console::Notice("hardware registers dumped EE:%x, IOP:%x\n", params cpuRegs.pc, psxRegs.pc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
g_Pcsx2Recording ^= 1;
|
g_Pcsx2Recording ^= 1;
|
||||||
if( mtgsThread != NULL ) {
|
|
||||||
|
if( mtgsThread != NULL )
|
||||||
mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
|
mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
|
||||||
}
|
else if( GSsetupRecording != NULL )
|
||||||
else {
|
GSsetupRecording(g_Pcsx2Recording, NULL);
|
||||||
if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL);
|
|
||||||
}
|
|
||||||
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
|
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
11
pcsx2/Misc.h
11
pcsx2/Misc.h
|
@ -19,6 +19,15 @@
|
||||||
#ifndef __MISC_H__
|
#ifndef __MISC_H__
|
||||||
#define __MISC_H__
|
#define __MISC_H__
|
||||||
|
|
||||||
|
struct KeyModifiers
|
||||||
|
{
|
||||||
|
bool control;
|
||||||
|
bool alt;
|
||||||
|
bool shift;
|
||||||
|
bool capslock;
|
||||||
|
};
|
||||||
|
extern struct KeyModifiers keymodifiers;
|
||||||
|
|
||||||
// Per ChickenLiver, this is being used to pass the GS plugins window handle to the Pad plugins.
|
// Per ChickenLiver, this is being used to pass the GS plugins window handle to the Pad plugins.
|
||||||
// So a rename to pDisplay is in the works, but it will not, in fact, be removed.
|
// So a rename to pDisplay is in the works, but it will not, in fact, be removed.
|
||||||
extern uptr pDsp; //Used in GS, MTGS, Plugins, Misc
|
extern uptr pDsp; //Used in GS, MTGS, Plugins, Misc
|
||||||
|
@ -55,7 +64,7 @@ extern u64 GetCPUTicks();
|
||||||
extern u64 GetTickFrequency();
|
extern u64 GetTickFrequency();
|
||||||
|
|
||||||
// Used in Misc,and Windows/Linux files.
|
// Used in Misc,and Windows/Linux files.
|
||||||
extern void ProcessFKeys(int fkey, int shift); // processes fkey related commands value 1-12
|
extern void ProcessFKeys(int fkey, struct KeyModifiers *keymod); // processes fkey related commands value 1-12
|
||||||
extern int IsBIOS(const char *filename, char *description);
|
extern int IsBIOS(const char *filename, char *description);
|
||||||
|
|
||||||
char *ParseLang(char *id);
|
char *ParseLang(char *id);
|
||||||
|
|
|
@ -38,6 +38,7 @@ FILE *emuLog;
|
||||||
|
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
u32 varLog;
|
u32 varLog;
|
||||||
|
bool enableLogging = TRUE;
|
||||||
|
|
||||||
// these used by the depreciated _old_Log only
|
// these used by the depreciated _old_Log only
|
||||||
u16 logProtocol;
|
u16 logProtocol;
|
||||||
|
@ -52,8 +53,10 @@ int connected=0;
|
||||||
void __Log( const char* fmt, ... )
|
void __Log( const char* fmt, ... )
|
||||||
{
|
{
|
||||||
char tmp[2024];
|
char tmp[2024];
|
||||||
|
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
|
if (!enableLogging) return;
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
|
|
||||||
// concatenate the log message after the prefix:
|
// concatenate the log message after the prefix:
|
||||||
|
@ -123,6 +126,9 @@ static __forceinline void _vSourceLog( u16 protocol, u8 source, u32 cpuPc, u32 c
|
||||||
void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...)
|
void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list list;
|
va_list list;
|
||||||
|
|
||||||
|
if (!enableLogging) return;
|
||||||
|
|
||||||
va_start(list, fmt);
|
va_start(list, fmt);
|
||||||
_vSourceLog( protocol, source, cpuPc, cpuCycle, fmt, list );
|
_vSourceLog( protocol, source, cpuPc, cpuCycle, fmt, list );
|
||||||
va_end(list);
|
va_end(list);
|
||||||
|
@ -133,6 +139,7 @@ void SourceLog( u16 protocol, u8 source, u32 cpuPc, u32 cpuCycle, const char *fm
|
||||||
bool SrcLog_##unit( const char* fmt, ... ) \
|
bool SrcLog_##unit( const char* fmt, ... ) \
|
||||||
{ \
|
{ \
|
||||||
va_list list; \
|
va_list list; \
|
||||||
|
if (!enableLogging) return false; \
|
||||||
va_start( list, fmt ); \
|
va_start( list, fmt ); \
|
||||||
_vSourceLog( protocol, source, \
|
_vSourceLog( protocol, source, \
|
||||||
(source == 'E') ? cpuRegs.pc : psxRegs.pc, \
|
(source == 'E') ? cpuRegs.pc : psxRegs.pc, \
|
||||||
|
|
|
@ -386,14 +386,19 @@ namespace HostGui
|
||||||
|
|
||||||
void __fastcall KeyEvent( keyEvent* ev )
|
void __fastcall KeyEvent( keyEvent* ev )
|
||||||
{
|
{
|
||||||
static int shiftkey = 0;
|
struct KeyModifiers *keymod = &keymodifiers;
|
||||||
|
|
||||||
if (ev == NULL) return;
|
if (ev == NULL) return;
|
||||||
if (ev->evt == KEYRELEASE)
|
if (ev->evt == KEYRELEASE)
|
||||||
{
|
{
|
||||||
switch (ev->key)
|
switch (ev->key)
|
||||||
{
|
{
|
||||||
case VK_SHIFT: shiftkey = 0; break;
|
case VK_SHIFT: keymod->shift = FALSE; break;
|
||||||
|
case VK_CONTROL: keymod->control = FALSE; break;
|
||||||
|
/* They couldn't just name this something simple, like VK_ALT */
|
||||||
|
case VK_MENU: keymod->alt = FALSE; break;
|
||||||
|
case VK_CAPITAL: keymod->capslock = FALSE; break;
|
||||||
|
|
||||||
}
|
}
|
||||||
GSkeyEvent(ev); return;
|
GSkeyEvent(ev); return;
|
||||||
}
|
}
|
||||||
|
@ -402,14 +407,17 @@ namespace HostGui
|
||||||
|
|
||||||
switch (ev->key)
|
switch (ev->key)
|
||||||
{
|
{
|
||||||
case VK_SHIFT: shiftkey = 1; break;
|
case VK_SHIFT: keymod->shift = TRUE; break;
|
||||||
|
case VK_CONTROL: keymod->control = TRUE; break;
|
||||||
|
case VK_MENU: keymod->alt = TRUE; break;
|
||||||
|
case VK_CAPITAL: keymod->capslock = TRUE; break;
|
||||||
|
|
||||||
case VK_F1: case VK_F2: case VK_F3: case VK_F4:
|
case VK_F1: case VK_F2: case VK_F3: case VK_F4:
|
||||||
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
|
case VK_F5: case VK_F6: case VK_F7: case VK_F8:
|
||||||
case VK_F9: case VK_F10: case VK_F11: case VK_F12:
|
case VK_F9: case VK_F10: case VK_F11: case VK_F12:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProcessFKeys(ev->key-VK_F1 + 1, shiftkey);
|
ProcessFKeys(ev->key-VK_F1 + 1, keymod);
|
||||||
}
|
}
|
||||||
catch( Exception::CpuStateShutdown& )
|
catch( Exception::CpuStateShutdown& )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue