More authentic variable/function names

This commit is contained in:
Clownacy 2020-04-16 13:48:15 +01:00
parent 47740fe88d
commit 8a9f70875c
3 changed files with 20 additions and 19 deletions

View file

@ -442,7 +442,7 @@ name = "CortBox2"
addr = 0x40CA80 addr = 0x40CA80
[[func]] [[func]]
name = "DummiedOutLogFunction" name = "out"
addr = 0x40CB30 addr = 0x40CB30
[[func]] [[func]]
@ -791,7 +791,7 @@ name = "PutFramePerSecound"
addr = 0x412370 addr = 0x412370
[[func]] [[func]]
name = "GetFramePerSecound" name = "CountFramePerSecound"
addr = 0x4123A0 addr = 0x4123A0
[[func]] [[func]]

View file

@ -51,6 +51,7 @@ static const char *lpWindowName = "\x93\xB4\x8C\x41\x95\xA8\x8C\xEA"; // '洞窟
static const char *lpWindowName = "Cave Story ~ Doukutsu Monogatari"; static const char *lpWindowName = "Cave Story ~ Doukutsu Monogatari";
#endif #endif
// The original name for this function is unknown
void SetWindowName(HWND hWnd) void SetWindowName(HWND hWnd)
{ {
char window_name[0x100]; char window_name[0x100];
@ -64,36 +65,36 @@ void PutFramePerSecound(void)
{ {
if (bFps) if (bFps)
{ {
const unsigned long fps = GetFramePerSecound(); const unsigned long fps = CountFramePerSecound();
PutNumber4(WINDOW_WIDTH - 40, 8, fps, FALSE); PutNumber4(WINDOW_WIDTH - 40, 8, fps, FALSE);
} }
} }
unsigned long GetFramePerSecound(void) unsigned long CountFramePerSecound(void)
{ {
unsigned long current_tick; unsigned long current_tick; // The original name for this variable is unknown
static BOOL need_new_base_tick = TRUE; static BOOL first = TRUE;
static unsigned long frames_this_second; static unsigned long max_count;
static unsigned long current_frame; static unsigned long count;
static unsigned long base_tick; static unsigned long wait;
if (need_new_base_tick) if (first)
{ {
base_tick = GetTickCount(); wait = GetTickCount();
need_new_base_tick = FALSE; first = FALSE;
} }
current_tick = GetTickCount(); current_tick = GetTickCount();
++current_frame; ++count;
if (base_tick + 1000 <= current_tick) if (wait + 1000 <= current_tick)
{ {
base_tick += 1000; wait += 1000;
frames_this_second = current_frame; max_count = count;
current_frame = 0; count = 0;
} }
return frames_this_second; return max_count;
} }
// TODO - Inaccurate stack frame // TODO - Inaccurate stack frame

View file

@ -9,6 +9,6 @@ extern HWND ghWnd;
extern BOOL bFullscreen; extern BOOL bFullscreen;
void PutFramePerSecound(void); void PutFramePerSecound(void);
unsigned long GetFramePerSecound(void); unsigned long CountFramePerSecound(void);
BOOL SystemTask(void); BOOL SystemTask(void);