Don't punch me in the face, and also fix the compilation, and also fix a stupid bug in log replay.

This commit is contained in:
starfrost013
2025-01-12 19:07:27 +00:00
parent 6eaec5b756
commit 55f476617d
3 changed files with 11 additions and 12 deletions

View File

@@ -271,8 +271,7 @@ static int suppr_seen = 1;
/* /*
Ensures STDLOG is open for pclog_ex and pclog_ex_cyclic Ensures STDLOG is open for pclog_ex and pclog_ex_cyclic
*/ */
void void pclog_ensure_stdlog_open()
pclog_ensure_stdlog_open()
{ {
if (stdlog == NULL) { if (stdlog == NULL) {
if (log_path[0] != '\0') { if (log_path[0] != '\0') {
@@ -399,7 +398,7 @@ pclog_ex_cyclic(const char* fmt, va_list ap)
{ {
// *very important* to prevent out of bounds index // *very important* to prevent out of bounds index
uint32_t real_index = index % LOG_SIZE_BUFFER_CYCLIC_LINES; uint32_t real_index = index % LOG_SIZE_BUFFER_CYCLIC_LINES;
fprintf(stdlog, "%s", temp); fprintf(stdlog, "%s", cyclic_buff[real_index]);
} }

View File

@@ -63,7 +63,7 @@ typedef struct rivatimer_s
double value; // The current value of the rivatimer double value; // The current value of the rivatimer
bool running; // Is this RivaTimer running? bool running; // Is this RivaTimer running?
struct rivatimer_s* next; // Next RivaTimer struct rivatimer_s* next; // Next RivaTimer
void (*callback)(); // Callback to call on fire void (*callback)(void); // Callback to call on fire
#ifdef _WIN32 #ifdef _WIN32
LARGE_INTEGER starting_time; // Starting time. LARGE_INTEGER starting_time; // Starting time.
#else #else
@@ -72,11 +72,11 @@ typedef struct rivatimer_s
double time; // Accumulated time in uS. double time; // Accumulated time in uS.
} rivatimer_t; } rivatimer_t;
void rivatimer_init(); // Initialise the Rivatimer. void rivatimer_init(void); // Initialise the Rivatimer.
rivatimer_t* rivatimer_create(double period, void (*callback)(double real_time)); rivatimer_t* rivatimer_create(double period, void (*callback)(double real_time));
void rivatimer_destroy(rivatimer_t* rivatimer_ptr); void rivatimer_destroy(rivatimer_t* rivatimer_ptr);
void rivatimer_update_all(); void rivatimer_update_all(void);
void rivatimer_start(rivatimer_t* rivatimer_ptr); void rivatimer_start(rivatimer_t* rivatimer_ptr);
void rivatimer_stop(rivatimer_t* rivatimer_ptr); void rivatimer_stop(rivatimer_t* rivatimer_ptr);
double rivatimer_get_time(rivatimer_t* rivatimer_ptr); double rivatimer_get_time(rivatimer_t* rivatimer_ptr);

View File

@@ -120,7 +120,7 @@ bool rivatimer_really_exists(rivatimer_t* rivatimer)
void rivatimer_destroy(rivatimer_t* rivatimer_ptr) void rivatimer_destroy(rivatimer_t* rivatimer_ptr)
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_destroy: The timer was already destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_destroy: The timer was already destroyed, or never existed in the first place.");
// Case: We are destroying the head // Case: We are destroying the head
if (rivatimer_ptr == rivatimer_head) if (rivatimer_ptr == rivatimer_head)
@@ -221,7 +221,7 @@ void rivatimer_update_all()
void rivatimer_start(rivatimer_t* rivatimer_ptr) void rivatimer_start(rivatimer_t* rivatimer_ptr)
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_start: The timer has been destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_start: The timer has been destroyed, or never existed in the first place.");
if (rivatimer_ptr->period <= 0) if (rivatimer_ptr->period <= 0)
fatal("rivatimer_start: Zero period!"); fatal("rivatimer_start: Zero period!");
@@ -239,7 +239,7 @@ void rivatimer_start(rivatimer_t* rivatimer_ptr)
void rivatimer_stop(rivatimer_t* rivatimer_ptr) void rivatimer_stop(rivatimer_t* rivatimer_ptr)
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_stop: The timer has been destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_stop: The timer has been destroyed, or never existed in the first place.");
rivatimer_ptr->running = false; rivatimer_ptr->running = false;
rivatimer_ptr->time = 0; rivatimer_ptr->time = 0;
@@ -249,7 +249,7 @@ void rivatimer_stop(rivatimer_t* rivatimer_ptr)
double rivatimer_get_time(rivatimer_t* rivatimer_ptr) double rivatimer_get_time(rivatimer_t* rivatimer_ptr)
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_get_time: The timer has been destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_get_time: The timer has been destroyed, or never existed in the first place.");
return rivatimer_ptr->time; return rivatimer_ptr->time;
} }
@@ -257,7 +257,7 @@ double rivatimer_get_time(rivatimer_t* rivatimer_ptr)
void rivatimer_set_callback(rivatimer_t* rivatimer_ptr, void (*callback)(double real_time)) void rivatimer_set_callback(rivatimer_t* rivatimer_ptr, void (*callback)(double real_time))
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_set_callback: The timer has been destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_set_callback: The timer has been destroyed, or never existed in the first place.");
if (!callback) if (!callback)
fatal("rivatimer_set_callback: No callback!"); fatal("rivatimer_set_callback: No callback!");
@@ -268,7 +268,7 @@ void rivatimer_set_callback(rivatimer_t* rivatimer_ptr, void (*callback)(double
void rivatimer_set_period(rivatimer_t* rivatimer_ptr, double period) void rivatimer_set_period(rivatimer_t* rivatimer_ptr, double period)
{ {
if (!rivatimer_really_exists(rivatimer_ptr)) if (!rivatimer_really_exists(rivatimer_ptr))
fatal("rivatimer_set_period: The timer has been destroyed, or never existed in the first place. Punch starfrost in the face"); fatal("rivatimer_set_period: The timer has been destroyed, or never existed in the first place.");
rivatimer_ptr->period = period; rivatimer_ptr->period = period;
} }