patches from p0

This commit is contained in:
starfrost013
2025-01-14 00:01:04 +00:00
parent e2d875b75f
commit cefc313a39
4 changed files with 21 additions and 17 deletions

View File

@@ -266,14 +266,17 @@ static int32_t log_cycles = 0;
static int seen = 0;
static int suppr_seen = 1;
// Functions only used in this translation unit
void pclog_ensure_stdlog_open(void);
#endif
/*
Ensures STDLOG is open for pclog_ex and pclog_ex_cyclic
*/
void
pclog_ensure_stdlog_open()
void pclog_ensure_stdlog_open(void)
{
#ifndef RELEASE_BUILD
if (stdlog == NULL) {
if (log_path[0] != '\0') {
stdlog = plat_fopen(log_path, "w");
@@ -282,6 +285,7 @@ pclog_ensure_stdlog_open()
} else
stdlog = stdout;
}
#endif
}
/*
@@ -399,7 +403,7 @@ pclog_ex_cyclic(const char* fmt, va_list ap)
{
// *very important* to prevent out of bounds index
uint32_t real_index = index % LOG_SIZE_BUFFER_CYCLIC_LINES;
fprintf(stdlog, "%s", temp);
fprintf(stdlog, "%s", cyclic_buff[real_index]);
}

View File

@@ -47,7 +47,7 @@ So I decided to create this timer that is completely separate from the CPU Core.
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <86Box\86box.h>
#include <86box/86box.h>
#ifdef _WIN32
#include <Windows.h>
@@ -63,7 +63,7 @@ typedef struct rivatimer_s
double value; // The current value of the rivatimer
bool running; // Is this RivaTimer running?
struct rivatimer_s* next; // Next RivaTimer
void (*callback)(); // Callback to call on fire
void (*callback)(double real_time); // Callback to call on fire
#ifdef _WIN32
LARGE_INTEGER starting_time; // Starting time.
#else
@@ -72,11 +72,11 @@ typedef struct rivatimer_s
double time; // Accumulated time in uS.
} 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));
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_stop(rivatimer_t* rivatimer_ptr);
double rivatimer_get_time(rivatimer_t* rivatimer_ptr);

View File

@@ -4,7 +4,7 @@
#include <wchar.h>
#include <86box/86box.h>
#include <86box/timer.h>
#include <86Box/nv/vid_nv_rivatimer.h>
#include <86box/nv/vid_nv_rivatimer.h>
uint64_t TIMER_USEC;
uint32_t timer_target;

View File

@@ -22,7 +22,7 @@ Since Windows XP, QueryPerformanceCounter and QueryPerformanceFrequency cannot f
*/
#include <86Box/nv/vid_nv_rivatimer.h>
#include <86box/nv/vid_nv_rivatimer.h>
#ifdef _WIN32
LARGE_INTEGER performance_frequency;
@@ -34,7 +34,7 @@ rivatimer_t* rivatimer_tail; // The tail of the rivatimer list.
/* Functions only used in this translation unit */
bool rivatimer_really_exists(rivatimer_t* rivatimer); // Determine if a rivatimer really exists in the linked list.
void rivatimer_init()
void rivatimer_init(void)
{
// Destroy all the rivatimers.
rivatimer_t* rivatimer_ptr = rivatimer_head;
@@ -120,7 +120,7 @@ bool rivatimer_really_exists(rivatimer_t* rivatimer)
void rivatimer_destroy(rivatimer_t* 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
if (rivatimer_ptr == rivatimer_head)
@@ -162,7 +162,7 @@ void rivatimer_destroy(rivatimer_t* rivatimer_ptr)
rivatimer_ptr = NULL; //explicitly set to null
}
void rivatimer_update_all()
void rivatimer_update_all(void)
{
rivatimer_t* rivatimer_ptr = rivatimer_head;
@@ -221,7 +221,7 @@ void rivatimer_update_all()
void rivatimer_start(rivatimer_t* 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)
fatal("rivatimer_start: Zero period!");
@@ -239,7 +239,7 @@ void rivatimer_start(rivatimer_t* rivatimer_ptr)
void rivatimer_stop(rivatimer_t* 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->time = 0;
@@ -249,7 +249,7 @@ void rivatimer_stop(rivatimer_t* rivatimer_ptr)
double rivatimer_get_time(rivatimer_t* 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;
}
@@ -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))
{
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)
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)
{
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;
}