SPU2: clang-format, spu close before cdvd and remove unused refs

This commit is contained in:
Gauvain 'GovanifY' Roussel-Tarbouriech 2020-10-01 08:04:10 +02:00 committed by refractionpcsx2
parent b11ad72473
commit 655748f2d9
9 changed files with 1504 additions and 1342 deletions

View File

@ -82,7 +82,8 @@ static void _rcntSet( int cntidx )
// that into account. Adding the difference from that cycle count to the current one
// will do the trick!
if( counter.mode & IOPCNT_STOPPED || counter.rate == PSXHBLANK) return;
if (counter.mode & IOPCNT_STOPPED || counter.rate == PSXHBLANK)
return;
// check for special cases where the overflow or target has just passed
// (we probably missed it because we're doing/checking other things)
@ -102,7 +103,8 @@ static void _rcntSet( int cntidx )
}
//if((counter.mode & 0x10) == 0 || psxCounters[i].target > 0xffff) continue;
if( counter.target & IOPCNT_FUTURE_TARGET ) return;
if (counter.target & IOPCNT_FUTURE_TARGET)
return;
c = (s64)((counter.target - counter.count) * counter.rate) - (psxRegs.cycle - counter.sCycleT);
c += psxRegs.cycle - psxNextsCounter; // adjust for time passed since last rcntUpdate();
@ -115,17 +117,20 @@ static void _rcntSet( int cntidx )
}
void psxRcntInit() {
void psxRcntInit()
{
int i;
memzero(psxCounters);
for (i=0; i<3; i++) {
for (i = 0; i < 3; i++)
{
psxCounters[i].rate = 1;
psxCounters[i].mode |= 0x0400;
psxCounters[i].target = IOPCNT_FUTURE_TARGET;
}
for (i=3; i<6; i++) {
for (i = 3; i < 6; i++)
{
psxCounters[i].rate = 1;
psxCounters[i].mode |= 0x0400;
psxCounters[i].target = IOPCNT_FUTURE_TARGET;
@ -159,16 +164,19 @@ void psxRcntInit() {
psxNextsCounter = psxRegs.cycle;
}
static bool __fastcall _rcntFireInterrupt(int i, bool isOverflow) {
static bool __fastcall _rcntFireInterrupt(int i, bool isOverflow)
{
bool ret;
if (psxCounters[i].mode & 0x400) { //IRQ fired
if (psxCounters[i].mode & 0x400)
{ //IRQ fired
//DevCon.Warning("Counter %d %s IRQ Fired count %x", i, isOverflow ? "Overflow" : "Target", psxCounters[i].count);
psxHu32(0x1070) |= psxCounters[i].interrupt;
iopTestIntc();
ret = true;
}
else {
else
{
//DevCon.Warning("Counter %d IRQ not fired count %x", i, psxCounters[i].count);
ret = false;
if (!(psxCounters[i].mode & 0x40)) //One shot
@ -178,10 +186,12 @@ static bool __fastcall _rcntFireInterrupt(int i, bool isOverflow) {
}
}
if (psxCounters[i].mode & 0x80) { //Toggle mode
if (psxCounters[i].mode & 0x80)
{ //Toggle mode
psxCounters[i].mode ^= 0x400; // Interrupt flag inverted
}
else {
else
{
psxCounters[i].mode &= ~0x0400; // Interrupt flag set low
}
@ -189,7 +199,8 @@ static bool __fastcall _rcntFireInterrupt(int i, bool isOverflow) {
}
static void __fastcall _rcntTestTarget(int i)
{
if( psxCounters[i].count < psxCounters[i].target ) return;
if (psxCounters[i].count < psxCounters[i].target)
return;
PSXCNT_LOG("IOP Counter[%d] target 0x%I64x >= 0x%I64x (mode: %x)",
i, psxCounters[i].count, psxCounters[i].target, psxCounters[i].mode);
@ -209,33 +220,35 @@ static void __fastcall _rcntTestTarget( int i )
}
else
psxCounters[i].target |= IOPCNT_FUTURE_TARGET;
}
static __fi void _rcntTestOverflow(int i)
{
u64 maxTarget = (i < 3) ? 0xffff : 0xfffffffful;
if( psxCounters[i].count <= maxTarget ) return;
if (psxCounters[i].count <= maxTarget)
return;
PSXCNT_LOG("IOP Counter[%d] overflow 0x%I64x >= 0x%I64x (mode: %x)",
i, psxCounters[i].count, maxTarget, psxCounters[i].mode);
if (!(psxCounters[i].mode & 0x40)) //One shot, whichever condition is met first
{
if (psxCounters[i].target < IOPCNT_FUTURE_TARGET) { //Target didn't trigger so we can overflow
if (psxCounters[i].target < IOPCNT_FUTURE_TARGET)
{ //Target didn't trigger so we can overflow
// Overflow interrupt
if ((psxCounters[i].mode & IOPCNT_INT_OVERFLOW)) {
if ((psxCounters[i].mode & IOPCNT_INT_OVERFLOW))
{
if (_rcntFireInterrupt(i, true))
psxCounters[i].mode |= 0x1000; // Overflow flag
}
}
psxCounters[i].target |= IOPCNT_FUTURE_TARGET;
}
else
{
// Overflow interrupt
if ((psxCounters[i].mode & IOPCNT_INT_OVERFLOW)) {
if ((psxCounters[i].mode & IOPCNT_INT_OVERFLOW))
{
if (_rcntFireInterrupt(i, true))
psxCounters[i].mode |= 0x1000; // Overflow flag
}
@ -248,9 +261,6 @@ static __fi void _rcntTestOverflow( int i )
// the counter value, and thus should not be flagged until after an overflow)
psxCounters[i].count -= maxTarget;
}
/*
@ -288,7 +298,8 @@ Gate:
static void _psxCheckStartGate(int i)
{
if(!(psxCounters[i].mode & IOPCNT_ENABLE_GATE)) return; //Ignore Gate
if (!(psxCounters[i].mode & IOPCNT_ENABLE_GATE))
return; //Ignore Gate
switch ((psxCounters[i].mode & 0x6) >> 1)
{
@ -296,7 +307,8 @@ static void _psxCheckStartGate( int i )
// get the current count at the time of stoppage:
psxCounters[i].count = (i < 3) ?
psxRcntRcount16( i ) : psxRcntRcount32( i );
psxRcntRcount16(i) :
psxRcntRcount32(i);
psxCounters[i].mode |= IOPCNT_STOPPED;
return;
@ -319,7 +331,8 @@ static void _psxCheckStartGate( int i )
static void _psxCheckEndGate(int i)
{
if(!(psxCounters[i].mode & IOPCNT_ENABLE_GATE)) return; //Ignore Gate
if (!(psxCounters[i].mode & IOPCNT_ENABLE_GATE))
return; //Ignore Gate
switch ((psxCounters[i].mode & 0x6) >> 1)
{
@ -332,7 +345,8 @@ static void _psxCheckEndGate(int i)
case 0x2: //GATE_ON_Clear_OFF_Start - start counting on gate start, stop on gate end
psxCounters[i].count = (i < 3) ?
psxRcntRcount16( i ) : psxRcntRcount32( i );
psxRcntRcount16(i) :
psxRcntRcount32(i);
psxCounters[i].mode |= IOPCNT_STOPPED;
return; // do not set the counter
@ -408,15 +422,19 @@ void psxVBlankStart()
{
cdvdVsync();
iopIntcIrq(0);
if(psxvblankgate & (1 << 1)) psxCheckStartGate16(1);
if(psxvblankgate & (1 << 3)) psxCheckStartGate32(3);
if (psxvblankgate & (1 << 1))
psxCheckStartGate16(1);
if (psxvblankgate & (1 << 3))
psxCheckStartGate32(3);
}
void psxVBlankEnd()
{
iopIntcIrq(11);
if(psxvblankgate & (1 << 1)) psxCheckEndGate16(1);
if(psxvblankgate & (1 << 3)) psxCheckEndGate32(3);
if (psxvblankgate & (1 << 1))
psxCheckEndGate16(1);
if (psxvblankgate & (1 << 3))
psxCheckEndGate32(3);
}
void psxRcntUpdate()
@ -437,15 +455,19 @@ void psxRcntUpdate()
// We can't check the ALTSOURCE flag because the PSXCLOCK source *should*
// be counted here.
if( psxCounters[i].mode & IOPCNT_STOPPED ) continue;
if (psxCounters[i].mode & IOPCNT_STOPPED)
continue;
if ((psxCounters[i].mode & 0x40) && !(psxCounters[i].mode & 0x80)) { //Repeat IRQ mode Pulsed, resets a few cycles after the interrupt, this should do.
if ((psxCounters[i].mode & 0x40) && !(psxCounters[i].mode & 0x80))
{ //Repeat IRQ mode Pulsed, resets a few cycles after the interrupt, this should do.
psxCounters[i].mode |= 0x400;
}
if( psxCounters[i].rate == PSXHBLANK ) continue;
if (psxCounters[i].rate == PSXHBLANK)
continue;
if( change <= 0 ) continue;
if (change <= 0)
continue;
psxCounters[i].count += change / psxCounters[i].rate;
if (psxCounters[i].rate != 1)
@ -465,8 +487,10 @@ void psxRcntUpdate()
{
// don't do target/oveflow checks for hblankers. Those
// checks are done when the counters are updated.
if( psxCounters[i].rate == PSXHBLANK ) continue;
if( psxCounters[i].mode & IOPCNT_STOPPED ) continue;
if (psxCounters[i].rate == PSXHBLANK)
continue;
if (psxCounters[i].mode & IOPCNT_STOPPED)
continue;
_rcntTestTarget(i);
_rcntTestOverflow(i);
@ -487,7 +511,8 @@ void psxRcntUpdate()
psxCounters[6].sCycleT = psxRegs.cycle;
psxCounters[6].CycleT = psxCounters[6].rate;
}
else c -= difference;
else
c -= difference;
psxNextCounter = c;
if (DEV9async)
{
@ -504,11 +529,14 @@ void psxRcntUpdate()
psxCounters[7].sCycleT = psxRegs.cycle;
psxCounters[7].CycleT = psxCounters[7].rate;
}
else c -= difference;
if (c < psxNextCounter) psxNextCounter = c;
else
c -= difference;
if (c < psxNextCounter)
psxNextCounter = c;
}
for (i=0; i<6; i++) _rcntSet( i );
for (i = 0; i < 6; i++)
_rcntSet(i);
}
//////////////////////////////////////////////////////////////////////////////////////////
@ -530,10 +558,12 @@ void psxRcntWcount16(int index, u16 value)
}
psxCounters[index].count = value & 0xffff;
if ((psxCounters[index].mode & 0x400) || (psxCounters[index].mode & 0x40)) {
if ((psxCounters[index].mode & 0x400) || (psxCounters[index].mode & 0x40))
{
psxCounters[index].target &= 0xffff;
}
if (value > psxCounters[index].target) {//Count already higher than Target
if (value > psxCounters[index].target)
{ //Count already higher than Target
// DevCon.Warning("16bit Count already higher than target");
psxCounters[index].target |= IOPCNT_FUTURE_TARGET;
}
@ -559,10 +589,12 @@ void psxRcntWcount32(int index, u32 value)
}
psxCounters[index].count = value;
if ((psxCounters[index].mode & 0x400) || (psxCounters[index].mode & 0x40)) { //IRQ not triggered (one shot) or toggle
if ((psxCounters[index].mode & 0x400) || (psxCounters[index].mode & 0x40))
{ //IRQ not triggered (one shot) or toggle
psxCounters[index].target &= 0xffffffff;
}
if (value > psxCounters[index].target) {//Count already higher than Target
if (value > psxCounters[index].target)
{ //Count already higher than Target
//DevCon.Warning("32bit Count already higher than target");
psxCounters[index].target |= IOPCNT_FUTURE_TARGET;
}
@ -582,31 +614,40 @@ __fi void psxRcntWmode16(int index, u32 value)
counter.mode = value;
counter.mode |= 0x0400; //IRQ Enable
if (value & (1 << 4)) {
if (value & (1 << 4))
{
irqmode += 1;
}
if (value & (1 << 5)) {
if (value & (1 << 5))
{
irqmode += 2;
}
if (value & (1 << 7)) {
if (value & (1 << 7))
{
PSXCNT_LOG("16 Counter %d Toggle IRQ on %s", index, (irqmode & 3) == 1 ? "Target" : ((irqmode & 3) == 2 ? "Overflow" : "Target and Overflow"));
}
else
{
PSXCNT_LOG("16 Counter %d Pulsed IRQ on %s", index, (irqmode & 3) == 1 ? "Target" : ((irqmode & 3) == 2 ? "Overflow" : "Target and Overflow"));
}
if (!(value & (1 << 6))) {
if (!(value & (1 << 6)))
{
PSXCNT_LOG("16 Counter %d One Shot", index);
}
else {
else
{
PSXCNT_LOG("16 Counter %d Repeat", index);
}
if (index == 2)
{
switch (value & 0x200)
{
case 0x000: psxCounters[2].rate = 1; break;
case 0x200: psxCounters[2].rate = 8; break;
case 0x000:
psxCounters[2].rate = 1;
break;
case 0x200:
psxCounters[2].rate = 8;
break;
jNO_DEFAULT;
}
@ -663,23 +704,28 @@ __fi void psxRcntWmode32( int index, u32 value )
counter.mode = value;
counter.mode |= 0x0400; //IRQ enable
if (value & (1 << 4)) {
if (value & (1 << 4))
{
irqmode += 1;
}
if (value & (1 << 5)) {
if (value & (1 << 5))
{
irqmode += 2;
}
if (value & (1 << 7)) {
if (value & (1 << 7))
{
PSXCNT_LOG("32 Counter %d Toggle IRQ on %s", index, (irqmode & 3) == 1 ? "Target" : ((irqmode & 3) == 2 ? "Overflow" : "Target and Overflow"));
}
else
{
PSXCNT_LOG("32 Counter %d Pulsed IRQ on %s", index, (irqmode & 3) == 1 ? "Target" : ((irqmode & 3) == 2 ? "Overflow" : "Target and Overflow"));
}
if (!(value & (1 << 6))) {
if (!(value & (1 << 6)))
{
PSXCNT_LOG("32 Counter %d One Shot", index);
}
else {
else
{
PSXCNT_LOG("32 Counter %d Repeat", index);
}
if (index == 3)
@ -695,16 +741,25 @@ __fi void psxRcntWmode32( int index, u32 value )
counter.mode |= IOPCNT_STOPPED;
psxvblankgate |= 1 << 3;
}
else psxvblankgate &= ~(1<<3);
else
psxvblankgate &= ~(1 << 3);
}
else
{
switch (value & 0x6000)
{
case 0x0000: counter.rate = 1; break;
case 0x2000: counter.rate = 8; break;
case 0x4000: counter.rate = 16; break;
case 0x6000: counter.rate = 256; break;
case 0x0000:
counter.rate = 1;
break;
case 0x2000:
counter.rate = 8;
break;
case 0x4000:
counter.rate = 16;
break;
case 0x6000:
counter.rate = 256;
break;
}
// Need to set a rate and target
@ -745,7 +800,8 @@ void psxRcntWtarget32(int index, u32 value)
//DevCon.Warning("IOP Counter[%d] writeTarget32 = %lx mode %x", index, value, psxCounters[index].mode);
psxCounters[index].target = value;
if (!(psxCounters[index].mode & 0x80)) { //Toggle mode
if (!(psxCounters[index].mode & 0x80))
{ //Toggle mode
psxCounters[index].mode |= 0x0400; // Interrupt flag set low
}
// protect the target from an early arrival.
@ -801,7 +857,8 @@ u32 psxRcntRcount32(int index)
u64 psxRcntCycles(int index)
{
if(psxCounters[index].mode & IOPCNT_STOPPED || psxCounters[index].rate == PSXHBLANK ) return psxCounters[index].count;
if (psxCounters[index].mode & IOPCNT_STOPPED || psxCounters[index].rate == PSXHBLANK)
return psxCounters[index].count;
return (u64)(psxCounters[index].count + (u32)((psxRegs.cycle - psxCounters[index].sCycleT) / psxCounters[index].rate));
}

View File

@ -43,12 +43,6 @@ namespace soundtouch
#include "Pcsx2Defs.h"
#include "Pcsx2Types.h"
namespace VersionInfo
{
static const u8 Release = 2;
static const u8 Revision = 0; // increase that with each version
} // namespace VersionInfo
//////////////////////////////////////////////////////////////////////////
// Override Win32 min/max macros with the STL's type safe and macro
// free varieties (much safer!)

View File

@ -60,7 +60,8 @@ SysCoreThread::SysCoreThread()
SysCoreThread::~SysCoreThread()
{
try {
try
{
SysCoreThread::Cancel();
}
DESTRUCTOR_CATCHALL
@ -87,7 +88,8 @@ void SysCoreThread::OnStart()
void SysCoreThread::Start()
{
if( !GetCorePlugins().AreLoaded() ) return;
if (!GetCorePlugins().AreLoaded())
return;
GetCorePlugins().Init();
SPU2init();
_parent::Start();
@ -150,9 +152,11 @@ void SysCoreThread::Reset()
// real differences are applied.
void SysCoreThread::ApplySettings(const Pcsx2Config& src)
{
if( src == EmuConfig ) return;
if (src == EmuConfig)
return;
if( !pxAssertDev( IsPaused(), "CoreThread is not paused; settings cannot be applied." ) ) return;
if (!pxAssertDev(IsPaused(), "CoreThread is not paused; settings cannot be applied."))
return;
m_resetRecompilers = (src.Cpu != EmuConfig.Cpu) || (src.Gamefixes != EmuConfig.Gamefixes) || (src.Speedhacks != EmuConfig.Speedhacks);
m_resetProfilers = (src.Profiler != EmuConfig.Profiler);
@ -163,7 +167,8 @@ void SysCoreThread::ApplySettings( const Pcsx2Config& src )
void SysCoreThread::UploadStateCopy(const VmStateBuffer& copy)
{
if( !pxAssertDev( IsPaused(), "CoreThread is not paused; new VM state cannot be uploaded." ) ) return;
if (!pxAssertDev(IsPaused(), "CoreThread is not paused; new VM state cannot be uploaded."))
return;
memLoadingState loadme(copy);
loadme.FreezeAll();
@ -280,12 +285,15 @@ void SysCoreThread::ExecuteTaskInThread()
m_mxcsr_saved.bitmask = _mm_getcsr();
PCSX2_PAGEFAULT_PROTECT {
while(true) {
PCSX2_PAGEFAULT_PROTECT
{
while (true)
{
StateCheckInThread();
DoCpuExecute();
}
} PCSX2_PAGEFAULT_EXCEPT;
}
PCSX2_PAGEFAULT_EXCEPT;
}
void SysCoreThread::OnSuspendInThread()
@ -317,9 +325,9 @@ void SysCoreThread::OnCleanupInThread()
R3000A::ioman::reset();
// FIXME: temporary workaround for deadlock on exit, which actually should be a crash
vu1Thread.WaitVU();
SPU2close();
DoCDVDclose();
FWclose();
SPU2close();
GetCorePlugins().Close();
GetCorePlugins().Shutdown();
SPU2shutdown();
@ -330,4 +338,3 @@ void SysCoreThread::OnCleanupInThread()
m_ExecMode = ExecMode_NoThreadYet;
}

View File

@ -71,7 +71,8 @@ public:
protected:
void InvokeEvent()
{
if( m_method ) (CoreThread.*m_method)();
if (m_method)
(CoreThread.*m_method)();
}
};
@ -83,14 +84,16 @@ static void PostCoreStatus( CoreThreadStatus pevt )
// --------------------------------------------------------------------------------------
// AppCoreThread Implementations
// --------------------------------------------------------------------------------------
AppCoreThread::AppCoreThread() : SysCoreThread()
AppCoreThread::AppCoreThread()
: SysCoreThread()
{
m_resetCdvd = false;
}
AppCoreThread::~AppCoreThread()
{
try {
try
{
_parent::Cancel(); // use parent's, skips thread affinity check.
}
DESTRUCTOR_CATCHALL
@ -141,7 +144,8 @@ static void _Suspend()
void AppCoreThread::Suspend(bool isBlocking)
{
if (IsClosed()) return;
if (IsClosed())
return;
if (IsSelf())
{
@ -175,7 +179,8 @@ void AppCoreThread::ChangeCdvdSource()
}
CDVD_SourceType cdvdsrc(g_Conf->CdvdSource);
if( cdvdsrc == CDVDsys_GetSourceType() ) return;
if (cdvdsrc == CDVDsys_GetSourceType())
return;
// Fast change of the CDVD source only -- a Pause will suffice.
@ -188,7 +193,8 @@ void AppCoreThread::ChangeCdvdSource()
void Pcsx2App::SysApplySettings()
{
if( AppRpc_TryInvoke(&Pcsx2App::SysApplySettings) ) return;
if (AppRpc_TryInvoke(&Pcsx2App::SysApplySettings))
return;
CoreThread.ApplySettings(g_Conf->EmuOptions);
CDVD_SourceType cdvdsrc(g_Conf->CdvdSource);
@ -224,8 +230,10 @@ void AppCoreThread::OnPauseDebug()
// Load Game Settings found in database
// (game fixes, round modes, clamp modes, etc...)
// Returns number of gamefixes set
static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) {
if( !game.IsOk() ) return 0;
static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game)
{
if (!game.IsOk())
return 0;
int gf = 0;
@ -251,7 +259,8 @@ static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) {
}
}
if (game.keyExists("eeClampMode")) {
if (game.keyExists("eeClampMode"))
{
int clampMode = game.getInt("eeClampMode");
PatchesCon->WriteLn("(GameDB) Changing EE/FPU clamp mode [mode=%d]", clampMode);
dest.Cpu.Recompiler.fpuOverflow = (clampMode >= 1);
@ -260,7 +269,8 @@ static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) {
gf++;
}
if (game.keyExists("vuClampMode")) {
if (game.keyExists("vuClampMode"))
{
int clampMode = game.getInt("vuClampMode");
PatchesCon->WriteLn("(GameDB) Changing VU0/VU1 clamp mode [mode=%d]", clampMode);
dest.Cpu.Recompiler.vuOverflow = (clampMode >= 1);
@ -270,7 +280,8 @@ static int loadGameSettings(Pcsx2Config& dest, const Game_Data& game) {
}
if (game.keyExists("mvuFlagSpeedHack")) {
if (game.keyExists("mvuFlagSpeedHack"))
{
bool vuFlagHack = game.getInt("mvuFlagSpeedHack") ? 1 : 0;
PatchesCon->WriteLn("(GameDB) Changing mVU flag speed hack [mode=%d]", vuFlagHack);
dest.Speedhacks.vuFlagHack = vuFlagHack;
@ -384,7 +395,8 @@ static void _ApplySettings( const Pcsx2Config& src, Pcsx2Config& fixup )
bool ingame = (ElfCRC && (g_GameLoading || g_GameStarted));
if (ingame)
gameCRC.Printf(L"%8.8x", ElfCRC);
if (ingame && !DiscSerial.IsEmpty()) gameSerial = L" [" + DiscSerial + L"]";
if (ingame && !DiscSerial.IsEmpty())
gameSerial = L" [" + DiscSerial + L"]";
const wxString newGameKey(ingame ? SysGetDiscID() : SysGetBiosDiscID());
const bool verbose(newGameKey != curGameKey && ingame);
@ -509,8 +521,10 @@ void AppCoreThread::ApplySettings( const Pcsx2Config& src )
static int localc = 0;
RecursionGuard guard(localc);
if( guard.IsReentrant() ) return;
if( fixup == EmuConfig ) return;
if (guard.IsReentrant())
return;
if (fixup == EmuConfig)
return;
if (m_ExecMode >= ExecMode_Opened)
{
@ -611,7 +625,8 @@ void AppCoreThread::ExecuteTaskInThread()
void AppCoreThread::DoCpuExecute()
{
try {
try
{
_parent::DoCpuExecute();
}
catch (BaseR5900Exception& ex)
@ -656,7 +671,8 @@ void BaseSysExecEvent_ScopedCore::_post_and_wait( IScopedCoreThread& core )
switch (m_resume->WaitForResult())
{
case ScopedCore_BlockingResume:
if( m_sync ) m_sync->ClearResult();
if (m_sync)
m_sync->ClearResult();
core.AllowResume();
break;
@ -741,7 +757,8 @@ void BaseScopedCoreThread::DisallowResume()
void BaseScopedCoreThread::DoResume()
{
if( m_alreadyStopped ) return;
if (m_alreadyStopped)
return;
if (!GetSysExecutorThread().IsSelf())
{
//DbgCon.WriteLn("(ScopedCoreThreadPause) Threaded Scope Created!");
@ -758,7 +775,8 @@ void BaseScopedCoreThread::DoResume()
bool BaseScopedCoreThread::PostToSysExec(BaseSysExecEvent_ScopedCore* msg)
{
std::unique_ptr<BaseSysExecEvent_ScopedCore> smsg(msg);
if( !smsg || GetSysExecutorThread().IsSelf()) return false;
if (!smsg || GetSysExecutorThread().IsSelf())
return false;
msg->SetSyncState(m_sync);
msg->SetResumeStates(m_sync_resume, m_mtx_resume);
@ -791,8 +809,10 @@ ScopedCoreThreadClose::ScopedCoreThreadClose()
ScopedCoreThreadClose::~ScopedCoreThreadClose()
{
if( m_alreadyScoped ) return;
try {
if (m_alreadyScoped)
return;
try
{
_parent::DoResume();
ScopedCore_IsFullyClosed = false;
}
@ -808,7 +828,8 @@ ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse
return;
}
if( !abuse_me ) abuse_me = new SysExecEvent_CoreThreadPause();
if (!abuse_me)
abuse_me = new SysExecEvent_CoreThreadPause();
if (!PostToSysExec(abuse_me))
{
m_alreadyStopped = CoreThread.IsPaused();
@ -821,8 +842,10 @@ ScopedCoreThreadPause::ScopedCoreThreadPause( BaseSysExecEvent_ScopedCore* abuse
ScopedCoreThreadPause::~ScopedCoreThreadPause()
{
if( m_alreadyScoped ) return;
try {
if (m_alreadyScoped)
return;
try
{
_parent::DoResume();
ScopedCore_IsPaused = false;
}
@ -843,10 +866,12 @@ ScopedCoreThreadPopup::ScopedCoreThreadPopup()
void ScopedCoreThreadPopup::AllowResume()
{
if( m_scoped_core ) m_scoped_core->AllowResume();
if (m_scoped_core)
m_scoped_core->AllowResume();
}
void ScopedCoreThreadPopup::DisallowResume()
{
if( m_scoped_core ) m_scoped_core->DisallowResume();
if (m_scoped_core)
m_scoped_core->DisallowResume();
}

View File

@ -49,9 +49,12 @@ KeyAcceleratorCode::KeyAcceleratorCode( const wxKeyEvent& evt )
keycode = evt.GetKeyCode();
if( evt.AltDown() ) Alt();
if( evt.CmdDown() ) Cmd();
if( evt.ShiftDown() ) Shift();
if (evt.AltDown())
Alt();
if (evt.CmdDown())
Cmd();
if (evt.ShiftDown())
Shift();
}
wxString KeyAcceleratorCode::ToString() const
@ -62,8 +65,8 @@ wxString KeyAcceleratorCode::ToString() const
(cmd ? wxACCEL_CMD : 0) |
(shift ? wxACCEL_SHIFT : 0) |
(alt ? wxACCEL_ALT : 0),
keycode
).ToString();
keycode)
.ToString();
}
LimiterModeType g_LimiterMode = Limit_Nominal;
@ -75,10 +78,13 @@ namespace Implementations
g_Conf->EmuOptions.GS.FrameSkipEnable = !g_Conf->EmuOptions.GS.FrameSkipEnable;
SetGSConfig().FrameSkipEnable = g_Conf->EmuOptions.GS.FrameSkipEnable;
if( EmuConfig.GS.FrameSkipEnable ) {
if (EmuConfig.GS.FrameSkipEnable)
{
OSDlog(Color_StrongRed, true, "(FrameSkipping) Enabled.");
OSDlog(Color_StrongRed, true, " FrameDraws=%d, FrameSkips=%d", g_Conf->EmuOptions.GS.FramesToDraw, g_Conf->EmuOptions.GS.FramesToSkip);
} else {
}
else
{
OSDlog(Color_StrongRed, true, "(FrameSkipping) Disabled.");
}
}
@ -186,10 +192,20 @@ namespace Implementations
art = AspectRatio_4_3;
switch (art)
{
case AspectRatio_Stretch: art = AspectRatio_4_3; arts = "4:3"; break;
case AspectRatio_4_3: art = AspectRatio_16_9; arts = "16:9"; break;
case AspectRatio_16_9: art = AspectRatio_Stretch; arts = "Stretch"; break;
default: break;
case AspectRatio_Stretch:
art = AspectRatio_4_3;
arts = "4:3";
break;
case AspectRatio_4_3:
art = AspectRatio_16_9;
arts = "16:9";
break;
case AspectRatio_16_9:
art = AspectRatio_Stretch;
arts = "Stretch";
break;
default:
break;
}
OSDlog(Color_StrongBlue, true, "(GSwindow) Aspect ratio: %s", arts);
@ -203,26 +219,30 @@ namespace Implementations
OSDlog(Color_StrongBlue, true, "(GSwindow) Offset: x=%f, y=%f", x, y);
UpdateImagePosition();
}
void GSwindow_OffsetYplus(){
void GSwindow_OffsetYplus()
{
SetOffset(g_Conf->GSWindow.OffsetX.ToFloat(), g_Conf->GSWindow.OffsetY.ToFloat() + 1);
}
void GSwindow_OffsetYminus(){
void GSwindow_OffsetYminus()
{
SetOffset(g_Conf->GSWindow.OffsetX.ToFloat(), g_Conf->GSWindow.OffsetY.ToFloat() - 1);
}
void GSwindow_OffsetXplus(){
void GSwindow_OffsetXplus()
{
SetOffset(g_Conf->GSWindow.OffsetX.ToFloat() + 1, g_Conf->GSWindow.OffsetY.ToFloat());
}
void GSwindow_OffsetXminus(){
void GSwindow_OffsetXminus()
{
SetOffset(g_Conf->GSWindow.OffsetX.ToFloat() - 1, g_Conf->GSWindow.OffsetY.ToFloat());
}
void GSwindow_OffsetReset(){
void GSwindow_OffsetReset()
{
SetOffset(0, 0);
}
@ -267,22 +287,26 @@ namespace Implementations
void GSwindow_ZoomIn()
{
float z = g_Conf->GSWindow.Zoom.ToFloat();
if( z==0 ) z = 100;
if (z == 0)
z = 100;
z++;
SetZoom(z);
}
void GSwindow_ZoomOut()
{
float z = g_Conf->GSWindow.Zoom.ToFloat();
if( z==0 ) z = 100;
if (z == 0)
z = 100;
z--;
SetZoom(z);
}
void GSwindow_ZoomToggle()
{
float z = g_Conf->GSWindow.Zoom.ToFloat();
if( z==100 ) z = 0;
else z = 100;
if (z == 100)
z = 0;
else
z = 100;
SetZoom(z);
}
@ -291,7 +315,8 @@ namespace Implementations
void Sys_Suspend()
{
GSFrame* gsframe = wxGetApp().GetGsFramePtr();
if (gsframe && gsframe->IsShown() && gsframe->IsFullScreen()) {
if (gsframe && gsframe->IsShown() && gsframe->IsFullScreen())
{
// On some cases, probably due to driver bugs, if we don't exit fullscreen then
// the content stays on screen. Try to prevent that by first exiting fullscreen,
// but don't update the internal PCSX2 state/config, and PCSX2 will restore
@ -304,7 +329,8 @@ namespace Implementations
CoreThread.Suspend();
gsframe = wxGetApp().GetGsFramePtr(); // just in case suspend removes this window
if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc) {
if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc)
{
// When we run with --nogui, PCSX2 only knows to exit when the gs window closes.
// However, by default suspend just hides the gs window, so PCSX2 will not exit
// and there will also be no way to exit it even if no windows are left.
@ -411,7 +437,6 @@ namespace Implementations
Text = GetGSStateFilename();
}
#endif
}
void Sys_RecordingToggle()
@ -618,7 +643,7 @@ namespace Implementations
States_LoadSlot(9);
}
#endif
}
} // namespace Implementations
// --------------------------------------------------------------------------------------
// CommandDeclarations table
@ -630,91 +655,104 @@ namespace Implementations
static const GlobalCommandDescriptor CommandDeclarations[] =
{
{ "States_FreezeCurrentSlot",
{
"States_FreezeCurrentSlot",
States_FreezeCurrentSlot,
pxL("Save state"),
pxL("Saves the virtual machine state to the current slot."),
false,
},
{ "States_DefrostCurrentSlot",
{
"States_DefrostCurrentSlot",
States_DefrostCurrentSlot,
pxL("Load state"),
pxL("Loads a virtual machine state from the current slot."),
false,
},
{ "States_DefrostCurrentSlotBackup",
{
"States_DefrostCurrentSlotBackup",
States_DefrostCurrentSlotBackup,
pxL("Load State Backup"),
pxL("Loads virtual machine state backup for current slot."),
false,
},
{ "States_CycleSlotForward",
{
"States_CycleSlotForward",
States_CycleSlotForward,
pxL("Cycle to next slot"),
pxL("Cycles the current save slot in +1 fashion!"),
false,
},
{ "States_CycleSlotBackward",
{
"States_CycleSlotBackward",
States_CycleSlotBackward,
pxL("Cycle to prev slot"),
pxL("Cycles the current save slot in -1 fashion!"),
false,
},
{ "Frameskip_Toggle",
{
"Frameskip_Toggle",
Implementations::Frameskip_Toggle,
NULL,
NULL,
false,
},
{ "Framelimiter_TurboToggle",
{
"Framelimiter_TurboToggle",
Implementations::Framelimiter_TurboToggle,
NULL,
NULL,
false,
},
{ "Framelimiter_SlomoToggle",
{
"Framelimiter_SlomoToggle",
Implementations::Framelimiter_SlomoToggle,
NULL,
NULL,
false,
},
{ "Framelimiter_MasterToggle",
{
"Framelimiter_MasterToggle",
Implementations::Framelimiter_MasterToggle,
NULL,
NULL,
false,
},
{ "GSwindow_CycleAspectRatio",
{
"GSwindow_CycleAspectRatio",
Implementations::GSwindow_CycleAspectRatio,
NULL,
NULL,
true,
},
{ "GSwindow_ZoomIn",
{
"GSwindow_ZoomIn",
Implementations::GSwindow_ZoomIn,
NULL,
NULL,
false,
},
{ "GSwindow_ZoomOut",
{
"GSwindow_ZoomOut",
Implementations::GSwindow_ZoomOut,
NULL,
NULL,
false,
},
{ "GSwindow_ZoomToggle",
{
"GSwindow_ZoomToggle",
Implementations::GSwindow_ZoomToggle,
NULL,
NULL,
@ -731,48 +769,55 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
{"GSwindow_OffsetXplus", Implementations::GSwindow_OffsetXplus, NULL, NULL, false},
{"GSwindow_OffsetReset", Implementations::GSwindow_OffsetReset, NULL, NULL, false},
{ "Sys_SuspendResume",
{
"Sys_SuspendResume",
Implementations::Sys_SuspendResume,
NULL,
NULL,
false,
},
{ "Sys_TakeSnapshot",
{
"Sys_TakeSnapshot",
Implementations::Sys_TakeSnapshot,
NULL,
NULL,
false,
},
{ "Sys_RenderswitchToggle",
{
"Sys_RenderswitchToggle",
Implementations::Sys_RenderToggle,
NULL,
NULL,
false,
},
{ "Sys_LoggingToggle",
{
"Sys_LoggingToggle",
Implementations::Sys_LoggingToggle,
NULL,
NULL,
false,
},
{ "Sys_FreezeGS",
{
"Sys_FreezeGS",
Implementations::Sys_FreezeGS,
NULL,
NULL,
false,
},
{ "Sys_RecordingToggle",
{
"Sys_RecordingToggle",
Implementations::Sys_RecordingToggle,
NULL,
NULL,
false,
},
{ "FullscreenToggle",
{
"FullscreenToggle",
Implementations::FullscreenToggle,
NULL,
NULL,
@ -806,8 +851,7 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
#endif
// Command Declarations terminator:
// (must always be last in list!!)
{ NULL }
};
{NULL}};
void AcceleratorDictionary::Map(const KeyAcceleratorCode& _acode, const char* searchfor)
{
@ -823,7 +867,8 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
{
// ini file contains alternative parsable key combination for current 'searchfor'.
acode = codeParser;
if (acode.keycode >= 'A' && acode.keycode <= 'Z') {
if (acode.keycode >= 'A' && acode.keycode <= 'Z')
{
// Note that this needs to match the key event codes at Pcsx2App::PadKeyDispatch
// Our canonical representation is the char code (at lower case if
// applicable) with a separate modifier indicator, including shift.
@ -833,7 +878,8 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
// So we only need to change upper case letters to lower case.
acode.keycode += 'a' - 'A';
}
if (_acode.ToString() != acode.ToString()) {
if (_acode.ToString() != acode.ToString())
{
Console.WriteLn(Color_StrongGreen, L"Overriding '%s': assigning %s (instead of %s)",
WX_STR(fromUTF8(searchfor)), WX_STR(acode.ToString()), WX_STR(_acode.ToString()));
}
@ -857,8 +903,7 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
Console.Warning(
L"Kbd Accelerator '%s' is mapped multiple times.\n"
L"\t'Command %s' is being replaced by '%s'",
WX_STR(acode.ToString()), WX_STR(fromUTF8( result->Id )), WX_STR(fromUTF8( searchfor ))
);
WX_STR(acode.ToString()), WX_STR(fromUTF8(result->Id)), WX_STR(fromUTF8(searchfor)));
}
std::unordered_map<std::string, const GlobalCommandDescriptor*>::const_iterator acceleratorIter(wxGetApp().GlobalCommands->find(searchfor));
@ -869,12 +914,12 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
if (result == NULL)
{
Console.Warning(L"Kbd Accelerator '%s' is mapped to unknown command '%s'",
WX_STR(acode.ToString()), WX_STR(fromUTF8( searchfor ))
);
WX_STR(acode.ToString()), WX_STR(fromUTF8(searchfor)));
}
else
{
if (!strcmp("Sys_TakeSnapshot", searchfor)) {
if (!strcmp("Sys_TakeSnapshot", searchfor))
{
// Sys_TakeSnapshot is special in a bad way. On its own it creates a screenshot
// but GSdx also checks whether shift or ctrl are held down, and for each of
// them it does a different thing (gs dumps). So we need to map a shortcut and
@ -885,26 +930,31 @@ void AcceleratorDictionary::Map( const KeyAcceleratorCode& _acode, const char *s
// and ctrl held together, but PCSX2 traditionally mapped f8, shift-f8 and ctrl-shift-f8
// to Sys_TakeSnapshot, so let's not change it - we'll keep adding only shift and
// ctrl-shift to the base shortcut.
if (acode.cmd || acode.shift) {
if (acode.cmd || acode.shift)
{
Console.Error(L"Cannot map %s to Sys_TakeSnapshot - must not include Shift or Ctrl - these modifiers will be added automatically.",
WX_STR(acode.ToString()));
}
else {
KeyAcceleratorCode shifted(acode); shifted.Shift();
KeyAcceleratorCode controlledShifted(shifted); controlledShifted.Cmd();
else
{
KeyAcceleratorCode shifted(acode);
shifted.Shift();
KeyAcceleratorCode controlledShifted(shifted);
controlledShifted.Cmd();
operator[](acode.val32) = result;
operator[](shifted.val32) = result;
operator[](controlledShifted.val32) = result;
if (_acode.val32 != acode.val32) { // overriding default
if (_acode.val32 != acode.val32)
{ // overriding default
Console.WriteLn(Color_Green, L"Sys_TakeSnapshot: automatically mapping also %s and %s",
WX_STR(shifted.ToString()),
WX_STR(controlledShifted.ToString())
);
WX_STR(controlledShifted.ToString()));
}
}
}
else {
else
{
operator[](acode.val32) = result;
}
}
@ -925,7 +975,8 @@ KeyAcceleratorCode AcceleratorDictionary::findKeycodeWithCommandId(const char* c
void Pcsx2App::BuildCommandHash()
{
if( !GlobalCommands ) GlobalCommands = std::unique_ptr<CommandDictionary>(new CommandDictionary);
if (!GlobalCommands)
GlobalCommands = std::unique_ptr<CommandDictionary>(new CommandDictionary);
const GlobalCommandDescriptor* curcmd = CommandDeclarations;
while (curcmd->Invoke != NULL)
@ -939,7 +990,8 @@ void Pcsx2App::InitDefaultGlobalAccelerators()
{
typedef KeyAcceleratorCode AAC;
if( !GlobalAccels ) GlobalAccels = std::unique_ptr<AcceleratorDictionary>(new AcceleratorDictionary);
if (!GlobalAccels)
GlobalAccels = std::unique_ptr<AcceleratorDictionary>(new AcceleratorDictionary);
// Why do we even have those here? all of them seem to be overridden
// by GSPanel::m_Accels ( GSPanel::InitDefaultAccelerators() )

View File

@ -79,9 +79,15 @@ void MainEmuFrame::UpdateCdvdSrcSelection()
switch (g_Conf->CdvdSource)
{
case CDVD_SourceType::Iso: cdsrc = MenuId_Src_Iso; break;
case CDVD_SourceType::Disc: cdsrc = MenuId_Src_Disc; break;
case CDVD_SourceType::NoDisc: cdsrc = MenuId_Src_NoDisc; break;
case CDVD_SourceType::Iso:
cdsrc = MenuId_Src_Iso;
break;
case CDVD_SourceType::Disc:
cdsrc = MenuId_Src_Disc;
break;
case CDVD_SourceType::NoDisc:
cdsrc = MenuId_Src_NoDisc;
break;
jNO_DEFAULT
}
@ -99,12 +105,13 @@ bool MainEmuFrame::Destroy()
wxWindowList::const_iterator
i = wxTopLevelWindows.begin(),
end = wxTopLevelWindows.end();
i != end; ++i
)
i != end; ++i)
{
wxTopLevelWindow* const win = wx_static_cast(wxTopLevelWindow*, *i);
if (win == this) continue;
if (win->GetParent() != this) continue;
if (win == this)
continue;
if (win->GetParent() != this)
continue;
win->Destroy();
}
@ -122,7 +129,8 @@ bool MainEmuFrame::Destroy()
//
void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
{
if( IsBeingDeleted() ) return;
if (IsBeingDeleted())
return;
CoreThread.Suspend();
@ -142,7 +150,6 @@ void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
// however. --air
//evt.Veto( true );
}
sApp.OnMainFrameClosed(GetId());
@ -157,7 +164,8 @@ void MainEmuFrame::OnCloseWindow(wxCloseEvent& evt)
void MainEmuFrame::OnMoveAround(wxMoveEvent& evt)
{
if( IsBeingDeleted() || !IsVisible() || IsIconized() ) return;
if (IsBeingDeleted() || !IsVisible() || IsIconized())
return;
// Uncomment this when doing logger stress testing (and then move the window around
// while the logger spams itself)
@ -174,7 +182,8 @@ void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
// out using 'lastpos' here. :)
static wxPoint lastpos(wxDefaultCoord, wxDefaultCoord);
if( lastpos == evt.GetPosition() ) return;
if (lastpos == evt.GetPosition())
return;
lastpos = evt.GetPosition();
if (g_Conf->ProgLogBox.AutoDock)
@ -289,8 +298,7 @@ void MainEmuFrame::InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf )
{
conf.DisplaySize.Set(
std::min(std::max(conf.DisplaySize.GetWidth(), 160), wxGetDisplayArea().GetWidth()),
std::min( std::max( conf.DisplaySize.GetHeight(), 160 ), wxGetDisplayArea().GetHeight() )
);
std::min(std::max(conf.DisplaySize.GetHeight(), 160), wxGetDisplayArea().GetHeight()));
if (conf.AutoDock)
{
@ -305,7 +313,8 @@ void MainEmuFrame::InitLogBoxPosition( AppConfig::ConsoleLogOptions& conf )
void MainEmuFrame::DispatchEvent(const PluginEventType& plugin_evt)
{
if( !pxAssertMsg( GetMenuBar()!=NULL, "Mainframe menu bar is NULL!" ) ) return;
if (!pxAssertMsg(GetMenuBar() != NULL, "Mainframe menu bar is NULL!"))
return;
//ApplyCoreStatus();
@ -323,7 +332,8 @@ void MainEmuFrame::DispatchEvent( const PluginEventType& plugin_evt )
void MainEmuFrame::DispatchEvent(const CoreThreadStatus& status)
{
if( !pxAssertMsg( GetMenuBar()!=NULL, "Mainframe menu bar is NULL!" ) ) return;
if (!pxAssertMsg(GetMenuBar() != NULL, "Mainframe menu bar is NULL!"))
return;
ApplyCoreStatus();
}
@ -399,7 +409,6 @@ void MainEmuFrame::CreatePcsx2Menu()
m_menuSys.Append(MenuId_Exit, _("E&xit"),
AddAppName(_("Closing %s may be hazardous to your health")));
}
void MainEmuFrame::CreateCdvdMenu()
@ -569,9 +578,12 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
else
{
// beta / development editions, which feature revision number and compile date.
if (strlen(GIT_REV) > 5) {
if (strlen(GIT_REV) > 5)
{
wintitle.Printf(L"%s %s", pxGetAppName().c_str(), GIT_REV);
} else {
}
else
{
wintitle.Printf(L"%s %d.%d.%d-%lld%s (git)", pxGetAppName().c_str(), PCSX2_VersionHi, PCSX2_VersionMid,
PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString);
}
@ -637,7 +649,8 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
MainEmuFrame::~MainEmuFrame()
{
try {
try
{
if (m_RestartEmuOnDelete)
{
sApp.SetExitOnFrameDelete(false);
@ -784,13 +797,15 @@ void MainEmuFrame::CommitPreset_noTrigger()
g_Conf->EmuOptions.EnablePatches = menubar.IsChecked(MenuId_EnablePatches);
}
static void AppendShortcutToMenuOption( wxMenuItem& item, wxString keyCodeStr ) {
static void AppendShortcutToMenuOption(wxMenuItem& item, wxString keyCodeStr)
{
wxString text = item.GetItemLabel();
const size_t tabPos = text.rfind(L'\t');
item.SetItemLabel(text.Mid(0, tabPos) + L"\t" + keyCodeStr);
}
void MainEmuFrame::AppendKeycodeNamesToMenuOptions() {
void MainEmuFrame::AppendKeycodeNamesToMenuOptions()
{
AppendShortcutToMenuOption(*m_menuSys.FindChildItem(MenuId_Sys_LoadStates), wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_DefrostCurrentSlot").toTitleizedString());
AppendShortcutToMenuOption(*m_menuSys.FindChildItem(MenuId_Sys_SaveStates), wxGetApp().GlobalAccels->findKeycodeWithCommandId("States_FreezeCurrentSlot").toTitleizedString());
@ -819,7 +834,8 @@ void MainEmuFrame::enableRecordingMenuItem(MenuIdentifiers menuId, bool enable)
void PerPluginMenuInfo::Populate(PluginsEnum_t pid)
{
if( !pxAssert(pid < PluginId_Count) ) return;
if (!pxAssert(pid < PluginId_Count))
return;
PluginId = pid;
@ -840,8 +856,7 @@ void PerPluginMenuInfo::Populate( PluginsEnum_t pid )
// Populate options from the plugin here.
MyMenu.Append(GetPluginMenuId_Settings(PluginId), _("&Plugin Settings..."),
wxsFormat( _("Opens the %s plugin's advanced settings dialog."), tbl_PluginInfo[pid].GetShortname().c_str() )
);
wxsFormat(_("Opens the %s plugin's advanced settings dialog."), tbl_PluginInfo[pid].GetShortname().c_str()));
}
// deletes menu items belonging to (created by) the plugin. Leaves menu items created
@ -864,9 +879,9 @@ void PerPluginMenuInfo::OnUnloaded()
void PerPluginMenuInfo::OnLoaded()
{
if( !CorePlugins.IsLoaded(PluginId) ) return;
if (!CorePlugins.IsLoaded(PluginId))
return;
MyMenu.SetLabel(GetPluginMenuId_Name(PluginId),
CorePlugins.GetName( PluginId ) + L" " + CorePlugins.GetVersion( PluginId )
);
CorePlugins.GetName(PluginId) + L" " + CorePlugins.GetVersion(PluginId));
MyMenu.Enable(GetPluginMenuId_Settings(PluginId), true);
}

View File

@ -52,7 +52,11 @@ public:
PluginsEnum_t PluginId;
public:
PerPluginMenuInfo() : MyMenu(*new wxMenu()), PluginId (PluginId_Count) {}
PerPluginMenuInfo()
: MyMenu(*new wxMenu())
, PluginId(PluginId_Count)
{
}
virtual ~PerPluginMenuInfo() = default;
@ -68,8 +72,8 @@ public:
// InvokeMenuCommand_OnSysStateUnlocked
// --------------------------------------------------------------------------------------
class InvokeMenuCommand_OnSysStateUnlocked
: public IEventListener_SysState
, public BaseDeletableObject
: public IEventListener_SysState,
public BaseDeletableObject
{
protected:
MenuIdentifiers m_menu_cmd;

View File

@ -113,13 +113,13 @@ void MainEmuFrame::RemoveCdvdMenu()
void MainEmuFrame::Menu_ResetAllSettings_Click(wxCommandEvent& event)
{
if( IsBeingDeleted() || m_RestartEmuOnDelete ) return;
if (IsBeingDeleted() || m_RestartEmuOnDelete)
return;
{
ScopedCoreThreadPopup suspender;
if (!Msgbox::OkCancel(pxsFmt(
pxE( L"This command clears %s settings and allows you to re-run the First-Time Wizard. You will need to manually restart %s after this operation.\n\nWARNING!! Click OK to delete *ALL* settings for %s and force-close the app, losing any current emulation progress. Are you absolutely sure?\n\n(note: settings for plugins are unaffected)"
), WX_STR(pxGetAppName()), WX_STR(pxGetAppName()), WX_STR(pxGetAppName()) ),
pxE(L"This command clears %s settings and allows you to re-run the First-Time Wizard. You will need to manually restart %s after this operation.\n\nWARNING!! Click OK to delete *ALL* settings for %s and force-close the app, losing any current emulation progress. Are you absolutely sure?\n\n(note: settings for plugins are unaffected)"), WX_STR(pxGetAppName()), WX_STR(pxGetAppName()), WX_STR(pxGetAppName())),
_("Reset all settings?")))
{
suspender.AllowResume();
@ -232,7 +232,8 @@ wxWindowID SwapOrReset_Disc( wxWindow* owner, IScopedCoreThread& core, const wxS
wxWindowID SwapOrReset_CdvdSrc(wxWindow* owner, CDVD_SourceType newsrc)
{
if(newsrc == g_Conf->CdvdSource) return wxID_CANCEL;
if (newsrc == g_Conf->CdvdSource)
return wxID_CANCEL;
wxWindowID result = wxID_CANCEL;
ScopedCoreThreadPopup core;
@ -245,8 +246,7 @@ wxWindowID SwapOrReset_CdvdSrc( wxWindow* owner, CDVD_SourceType newsrc )
CDVD_SourceLabels[enum_cast(g_Conf->CdvdSource)], CDVD_SourceLabels[enum_cast(newsrc)]);
dialog += dialog.Heading(changeMsg + L"\n\n" +
_("Do you want to swap discs or boot the new image (system reset)?")
);
_("Do you want to swap discs or boot the new image (system reset)?"));
result = pxIssueConfirmation(dialog, MsgButtons().Reset().Cancel().Custom(_("Swap Disc"), "swap"));
@ -284,7 +284,8 @@ static wxString JoinFiletypes( const wxChar** src )
wxString dest;
while (*src != NULL)
{
if( *src[0] == 0 ) continue;
if (*src[0] == 0)
continue;
if (!dest.IsEmpty())
dest += L";";
@ -307,8 +308,7 @@ bool MainEmuFrame::_DoSelectIsoBrowser( wxString& result )
{
static const wxChar* isoSupportedTypes[] =
{
L"iso", L"mdf", L"nrg", L"bin", L"img", NULL
};
L"iso", L"mdf", L"nrg", L"bin", L"img", NULL};
const wxString isoSupportedLabel(JoinString(isoSupportedTypes, L" "));
const wxString isoSupportedList(JoinFiletypes(isoSupportedTypes));
@ -376,8 +376,7 @@ void MainEmuFrame::_DoBootCdvd()
wxDialogWithHelpers dialog(this, _("ISO file not found!"));
dialog += dialog.Heading(
_("An error occurred while trying to open the file:") + wxString(L"\n\n") + g_Conf->CurrentIso + L"\n\n" +
_("Error: The configured ISO file does not exist. Click OK to select a new ISO source for CDVD.")
);
_("Error: The configured ISO file does not exist. Click OK to select a new ISO source for CDVD."));
pxIssueConfirmation(dialog, MsgButtons().OK());
@ -419,9 +418,15 @@ void MainEmuFrame::Menu_CdvdSource_Click( wxCommandEvent &event )
switch (event.GetId())
{
case MenuId_Src_Iso: newsrc = CDVD_SourceType::Iso; break;
case MenuId_Src_Disc: newsrc = CDVD_SourceType::Disc; break;
case MenuId_Src_NoDisc: newsrc = CDVD_SourceType::NoDisc; break;
case MenuId_Src_Iso:
newsrc = CDVD_SourceType::Iso;
break;
case MenuId_Src_Disc:
newsrc = CDVD_SourceType::Disc;
break;
case MenuId_Src_NoDisc:
newsrc = CDVD_SourceType::NoDisc;
break;
jNO_DEFAULT
}
@ -557,7 +562,8 @@ void MainEmuFrame::Menu_EnableRecordingTools_Click(wxCommandEvent& event)
{
if (!Msgbox::OkCancel(_("Please be aware that PCSX2's input recording features are still very much a work-in-progress.\n"
"As a result, there may be unforeseen bugs, performance implications and instability with certain games.\n\n"
"These tools are provided as-is and should be enabled under your own discretion."), "Enabling Input Recording"))
"These tools are provided as-is and should be enabled under your own discretion."),
"Enabling Input Recording"))
{
checked = false;
m_GameSettingsSubmenu.FindChildItem(MenuId_EnableInputRecording)->Check(false);
@ -696,7 +702,8 @@ protected:
void MainEmuFrame::Menu_SuspendResume_Click(wxCommandEvent& event)
{
if( !SysHasValidState() ) return;
if (!SysHasValidState())
return;
// Disable the menu item. The state of the menu is indeterminate until the core thread
// has responded (it updates status after the plugins are loaded and emulation has
@ -879,7 +886,6 @@ void MainEmuFrame::VideoCaptureUpdate()
if (GetMainFramePtr() && needsMainFrameEnable)
GetMainFramePtr()->Enable();
}
else
{

View File

@ -252,7 +252,8 @@ public:
{
int size = 0;
freezeData fP = {0, NULL};
if(SPU2freeze( FREEZE_SIZE, &fP)==0) {
if (SPU2freeze(FREEZE_SIZE, &fP) == 0)
{
size = fP.size;
writer.PrepBlock(size);
SPU2DoFreezeOut(writer.GetBlockPtr());
@ -289,8 +290,7 @@ static const std::unique_ptr<BaseSavestateEntry> SavestateEntries[] = {
std::unique_ptr<BaseSavestateEntry>(new PluginSavestateEntry(PluginId_GS)),
std::unique_ptr<BaseSavestateEntry>(new PluginSavestateEntry(PluginId_PAD)),
std::unique_ptr<BaseSavestateEntry>(new PluginSavestateEntry(PluginId_USB)),
std::unique_ptr<BaseSavestateEntry>(new PluginSavestateEntry( PluginId_DEV9 ))
};
std::unique_ptr<BaseSavestateEntry>(new PluginSavestateEntry(PluginId_DEV9))};
// It's bad mojo to have savestates trying to read and write from the same file at the
// same time. To prevent that we use this mutex lock, which is used by both the
@ -371,8 +371,7 @@ protected:
SavestateEntries[i]->FreezeOut(saveme);
m_dest_list->Add(ArchiveEntry(SavestateEntries[i]->GetFilename())
.SetDataIndex(startpos)
.SetDataSize( saveme.GetCurrentPos() - startpos )
);
.SetDataSize(saveme.GetCurrentPos() - startpos));
}
UI_EnableStateActions();
@ -562,7 +561,8 @@ protected:
Threading::pxTestCancel();
std::unique_ptr<wxZipEntry> entry(gzreader->GetNextEntry());
if (!entry) break;
if (!entry)
break;
if (entry->GetName().CmpNoCase(EntryFilename_StateVersion) == 0)
{
@ -609,7 +609,8 @@ protected:
bool throwIt = false;
for (uint i = 0; i < ArraySize(SavestateEntries); ++i)
{
if (foundEntry[i]) continue;
if (foundEntry[i])
continue;
if (SavestateEntries[i]->IsRequired())
{
@ -633,7 +634,8 @@ protected:
for (uint i = 0; i < ArraySize(SavestateEntries); ++i)
{
if (!foundEntry[i]) continue;
if (!foundEntry[i])
continue;
Threading::pxTestCancel();