mirror of https://github.com/PCSX2/pcsx2.git
Revered Misc.cpp and vssprintf.cpp from r904. See r904 comments for details.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@911 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
47759b0a46
commit
7cf7a118b7
260
pcsx2/Misc.cpp
260
pcsx2/Misc.cpp
|
@ -420,7 +420,7 @@ char *ParseLang(char *id) {
|
||||||
char* mystrlwr( char* string )
|
char* mystrlwr( char* string )
|
||||||
{
|
{
|
||||||
assert( string != NULL );
|
assert( string != NULL );
|
||||||
while ( 0 != ( *string++ = (char)tolower( *string ) ) ) ;
|
while ( 0 != ( *string++ = (char)tolower( *string ) ) );
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,99 +493,102 @@ void CycleFrameLimit(int dir)
|
||||||
|
|
||||||
void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
|
void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
|
||||||
{
|
{
|
||||||
assert(fkey >= 1 && fkey <= 12 );
|
assert(fkey >= 1 && fkey <= 12 );
|
||||||
|
|
||||||
switch(fkey) {
|
switch(fkey)
|
||||||
case 1:
|
{
|
||||||
try
|
case 1:
|
||||||
{
|
try
|
||||||
gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll();
|
{
|
||||||
HostGui::ResetMenuSlots();
|
gzSavingState( SaveState::GetFilename( StatesC ) ).FreezeAll();
|
||||||
}
|
HostGui::ResetMenuSlots();
|
||||||
catch( Exception::BaseException& ex )
|
}
|
||||||
{
|
catch( Exception::BaseException& ex )
|
||||||
// 99% of the time this is a file permission error and the
|
{
|
||||||
// cpu state is intact so just display a passive msg to console.
|
// 99% of the time this is a file permission error and the
|
||||||
|
// cpu state is intact so just display a passive msg to console.
|
||||||
|
|
||||||
Console::Error( _( "Error > Could not save state to slot %d" ), params StatesC );
|
Console::Error( _( "Error > Could not save state to slot %d" ), params StatesC );
|
||||||
Console::Error( ex.cMessage() );
|
Console::Error( ex.cMessage() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if( keymod->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;
|
||||||
|
|
||||||
Console::Notice( _( " > Selected savestate slot %d" ), params StatesC);
|
Console::Notice( _( " > Selected savestate slot %d" ), params StatesC);
|
||||||
|
|
||||||
if( GSchangeSaveState != NULL )
|
if( GSchangeSaveState != NULL )
|
||||||
GSchangeSaveState(StatesC, SaveState::GetFilename(StatesC).c_str());
|
GSchangeSaveState(StatesC, SaveState::GetFilename(StatesC).c_str());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
gzLoadingState joe( SaveState::GetFilename( StatesC ) ); // throws exception on version mismatch
|
gzLoadingState joe( SaveState::GetFilename( StatesC ) ); // throws exception on version mismatch
|
||||||
cpuReset();
|
cpuReset();
|
||||||
SysClearExecutionCache();
|
SysClearExecutionCache();
|
||||||
joe.FreezeAll();
|
joe.FreezeAll();
|
||||||
}
|
}
|
||||||
catch( Exception::StateLoadError_Recoverable& )
|
catch( Exception::StateLoadError_Recoverable& )
|
||||||
{
|
{
|
||||||
// At this point the cpu hasn't been reset, so we can return
|
// At this point the cpu hasn't been reset, so we can return
|
||||||
// control to the user safely... (and silently)
|
// control to the user safely... (and silently)
|
||||||
}
|
}
|
||||||
catch( Exception::FileNotFound& )
|
catch( Exception::FileNotFound& )
|
||||||
{
|
{
|
||||||
Console::Notice( _("Saveslot %d cannot be loaded; slot does not exist (file not found)"), params StatesC );
|
Console::Notice( _("Saveslot %d cannot be loaded; slot does not exist (file not found)"), params StatesC );
|
||||||
}
|
}
|
||||||
catch( Exception::RuntimeError& ex )
|
catch( Exception::RuntimeError& ex )
|
||||||
{
|
{
|
||||||
// This is the bad one. Chances are the cpu has been reset, so emulation has
|
// This is the bad one. Chances are the cpu has been reset, so emulation has
|
||||||
// to be aborted. Sorry user! We'll give you some info for your trouble:
|
// to be aborted. Sorry user! We'll give you some info for your trouble:
|
||||||
|
|
||||||
Console::Error( _("An error occured while trying to load saveslot %d"), params StatesC );
|
Console::Error( _("An error occured while trying to load saveslot %d"), params StatesC );
|
||||||
Console::Error( ex.cMessage() );
|
Console::Error( ex.cMessage() );
|
||||||
Msgbox::Alert(
|
Msgbox::Alert(
|
||||||
"Pcsx2 encountered an error while trying to load the savestate\n"
|
"Pcsx2 encountered an error while trying to load the savestate\n"
|
||||||
"and emulation had to be aborted." );
|
"and emulation had to be aborted." );
|
||||||
|
|
||||||
ClosePlugins( true );
|
ClosePlugins( true );
|
||||||
|
|
||||||
throw Exception::CpuStateShutdown(
|
throw Exception::CpuStateShutdown(
|
||||||
"Saveslot load failed; PS2 emulated state had to be shut down." ); // let the GUI handle the error "gracefully"
|
"Saveslot load failed; PS2 emulated state had to be shut down." ); // let the GUI handle the error "gracefully"
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
CycleFrameLimit(keymod->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
|
||||||
case 8:
|
case 8:
|
||||||
GSmakeSnapshot( SNAPSHOTS_DIR "/" );
|
GSmakeSnapshot( SNAPSHOTS_DIR "/" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9: //gsdx "on the fly" renderer switching
|
case 9: //gsdx "on the fly" renderer switching
|
||||||
if (!renderswitch) {
|
if (!renderswitch)
|
||||||
StateRecovery::MakeGsOnly();
|
{
|
||||||
g_EmulationInProgress = false;
|
StateRecovery::MakeGsOnly();
|
||||||
CloseGS();
|
g_EmulationInProgress = false;
|
||||||
renderswitch = true; //go to dx9 sw
|
CloseGS();
|
||||||
StateRecovery::Recover();
|
renderswitch = true; //go to dx9 sw
|
||||||
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
StateRecovery::Recover();
|
||||||
}
|
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
||||||
else {
|
}
|
||||||
StateRecovery::MakeGsOnly();
|
else
|
||||||
g_EmulationInProgress = false;
|
{
|
||||||
CloseGS();
|
StateRecovery::MakeGsOnly();
|
||||||
renderswitch = false; //return to default renderer
|
g_EmulationInProgress = false;
|
||||||
StateRecovery::Recover();
|
CloseGS();
|
||||||
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
renderswitch = false; //return to default renderer
|
||||||
}
|
StateRecovery::Recover();
|
||||||
break;
|
HostGui::BeginExecution(); //also sets g_EmulationInProgress to true later
|
||||||
|
}
|
||||||
|
break;
|
||||||
#ifdef PCSX2_DEVBUILD
|
#ifdef PCSX2_DEVBUILD
|
||||||
case 10:
|
case 10:
|
||||||
// There's likely a better way to implement this, but this seemed useful.
|
// There's likely a better way to implement this, but this seemed useful.
|
||||||
|
@ -599,55 +602,60 @@ void ProcessFKeys(int fkey, struct KeyModifiers *keymod)
|
||||||
GSprintf(10,"Logging Disabled.");
|
GSprintf(10,"Logging Disabled.");
|
||||||
|
|
||||||
break;
|
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
|
{
|
||||||
char name[256], *tok;
|
// only take the first two words
|
||||||
string gsText;
|
char name[256], *tok;
|
||||||
|
string gsText;
|
||||||
|
|
||||||
tok = strtok(strgametitle, " ");
|
tok = strtok(strgametitle, " ");
|
||||||
sprintf(name, "%s_", mystrlwr(tok));
|
sprintf(name, "%s_", mystrlwr(tok));
|
||||||
tok = strtok(NULL, " ");
|
|
||||||
if( tok != NULL ) strcat(name, tok);
|
tok = strtok(NULL, " ");
|
||||||
|
if( tok != NULL ) strcat(name, tok);
|
||||||
|
|
||||||
|
ssprintf( gsText, "%s.%d.gs", name, StatesC);
|
||||||
ssprintf( gsText, "%s.%d.gs", name, StatesC);
|
Text = Path::Combine( SSTATES_DIR, gsText );
|
||||||
Text = Path::Combine( SSTATES_DIR, gsText );
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
Text = GetGSStateFilename();
|
Text = GetGSStateFilename();
|
||||||
|
}
|
||||||
SaveGSState(Text);
|
|
||||||
}
|
SaveGSState(Text);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if( keymod->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;
|
{
|
||||||
if( mtgsThread != NULL ) {
|
g_Pcsx2Recording ^= 1;
|
||||||
mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
|
|
||||||
}
|
if( mtgsThread != NULL )
|
||||||
else {
|
mtgsThread->SendSimplePacket(GS_RINGTYPE_RECORD, g_Pcsx2Recording, 0, 0);
|
||||||
if( GSsetupRecording != NULL ) GSsetupRecording(g_Pcsx2Recording, NULL);
|
else if( GSsetupRecording != NULL )
|
||||||
}
|
GSsetupRecording(g_Pcsx2Recording, NULL);
|
||||||
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
|
|
||||||
}
|
if( SPU2setupRecording != NULL ) SPU2setupRecording(g_Pcsx2Recording, NULL);
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _memset16_unaligned( void* dest, u16 data, size_t size )
|
void _memset16_unaligned( void* dest, u16 data, size_t size )
|
||||||
|
|
|
@ -460,7 +460,7 @@ static void cropzeros(char *buffer)
|
||||||
stop = buffer--;
|
stop = buffer--;
|
||||||
while (*buffer == '0') buffer--;
|
while (*buffer == '0') buffer--;
|
||||||
if (*buffer == '.') buffer--;
|
if (*buffer == '.') buffer--;
|
||||||
while (*++buffer = *stop++) ;
|
while (*++buffer = *stop++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,12 +135,9 @@
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions="NDEBUG"
|
PreprocessorDefinitions="NDEBUG"
|
||||||
StringPooling="true"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
SmallerTypeCheck="false"
|
SmallerTypeCheck="false"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
EnableFunctionLevelLinking="false"
|
|
||||||
UsePrecompiledHeader="2"
|
UsePrecompiledHeader="2"
|
||||||
PrecompiledHeaderThrough="PrecompiledHeader.h"
|
PrecompiledHeaderThrough="PrecompiledHeader.h"
|
||||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||||
|
|
Loading…
Reference in New Issue