Skip to content

Commit

Permalink
R5900: Minor clean up (no functional change)
Browse files Browse the repository at this point in the history
* Rename some variables as the previous names didn't make much sense.

* Convert unnecessary int data types to bool.
  • Loading branch information
ssakash committed Aug 8, 2016
1 parent 16affc9 commit e738acb
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions pcsx2/x86/ix86-32/iR5900-32.cpp
Expand Up @@ -569,7 +569,7 @@ static __aligned16 u8 manual_counter[Ps2MemSize::MainRam >> 12];
static std::atomic<bool> eeRecIsReset(false);
static std::atomic<bool> eeRecNeedsReset(false);
static bool eeCpuExecuting = false;
static int g_resetEeScalingStats = 0;
static bool g_resetEeScalingStats = false;
static int g_patchesNeedRedo = 0;

////////////////////////////////////////////////////
Expand Down Expand Up @@ -606,8 +606,7 @@ static void recResetRaw()
recConstBufPtr = recConstBuf;

g_branch = 0;
g_resetEeScalingStats = 1;

g_resetEeScalingStats = true;
g_patchesNeedRedo = 1;
}

Expand Down Expand Up @@ -957,16 +956,16 @@ void iFlushCall(int flushtype)
// s_nBlockCycles is 3 bit fixed point. Divide by 8 when done!
// Scaling blocks under 40 cycles seems to produce countless problem, so let's try to avoid them.

#define DEFAULT_SCALING_UNSANITIZED() (s_nBlockCycles >> 3) /* unsanitized sinec we don't check if 0 */
#define DEFAULT_SCALED_BLOCKS() (s_nBlockCycles >> 3)

static u32 scaleblockcycles_calc()
static u32 scaleblockcycles_calculation()
{
bool lowcycles = (s_nBlockCycles <= 40);
s8 cyclerate = EmuConfig.Speedhacks.EECycleRate;
u32 scale_cycles = 0;

if (cyclerate == 0 || lowcycles || cyclerate < -99 || cyclerate > 2)
scale_cycles = DEFAULT_SCALING_UNSANITIZED(); // Default cycle rate, could be 0
scale_cycles = DEFAULT_SCALED_BLOCKS();

else if (cyclerate > 0)
scale_cycles = s_nBlockCycles >> (3 + cyclerate);
Expand All @@ -982,24 +981,26 @@ static u32 scaleblockcycles_calc()
return (scale_cycles < 1) ? 1 : scale_cycles;
}

static u32 scaleblockcycles() {
u32 scaled = scaleblockcycles_calc();
static u32 scaleblockcycles()
{
u32 scaled = scaleblockcycles_calculation();

#if 0 /* Enable this to get some runtime statistics about the scaling result in practuce */
static u32 scaled_overal = 0, unscaled_overal = 0;
if (g_resetEeScalingStats) {
scaled_overal = unscaled_overal = 0;
g_resetEeScalingStats = 0;
#if 0 // Enable this to get some runtime statistics about the scaling result in practice
static u32 scaled_overall = 0, unscaled_overall = 0;
if (g_resetEeScalingStats)
{
scaled_overall = unscaled_overall = 0;
g_resetEeScalingStats = false;
}
u32 unscaled = DEFAULT_SCALING_UNSANITIZED();
u32 unscaled = DEFAULT_SCALED_BLOCKS();
if (!unscaled) unscaled = 1;

scaled_overal += scaled;
unscaled_overal += unscaled;
float ratio = (float)unscaled_overal / scaled_overal;
scaled_overall += scaled;
unscaled_overall += unscaled;
float ratio = static_cast<float>(unscaled_overall) / scaled_overall;

DevCon.WriteLn(L"Unscaled overal: %d, scaled overal: %d, relative EE clock speed: %d %%",
unscaled_overal, scaled_overal, (int)(100 * ratio));
DevCon.WriteLn(L"Unscaled overall: %d, scaled overall: %d, relative EE clock speed: %d %%",
unscaled_overall, scaled_overall, static_cast<int>(100 * ratio));
#endif

return scaled;
Expand Down

0 comments on commit e738acb

Please sign in to comment.