MDX: Exposed P4IO Buffer Filling Mode to Spicecfg (#463)

## Description of change
Extension of #460 
An option was exposed to `spicecfg` (`P4IOBufferMode`) for toggling
between the Thread and Backfill buffer fill implementations from the
prior PR.

## Testing
- Verified the option properly toggled between the two implementations
This commit is contained in:
cchike
2025-12-19 02:14:10 -08:00
committed by GitHub
parent a09905792d
commit 42d8bbc92f
5 changed files with 39 additions and 9 deletions
+4 -9
View File
@@ -53,17 +53,12 @@ static struct {
static bool STATUS_BUFFER_FREEZE = false;
typedef enum {
THREAD_MODE = 0,
BACKFILL_MODE = 1
} MDXFBufferFillMode;
/* Decides which method to use for populating ring buffer entries for "padding". Could possibly be made configurable through spicecfg.
/* Decides which method to use for populating ring buffer entries for "padding". Overwritten in spicecfg using P4IO Buffer Algorithm option.
THREAD_MODE: Spins a thread running at THREAD_REFRESH_RATE_HZ which periodically fills the ring buffer with auxiliary entries. Falls back on BACKFILL_MODE
if the game's refresh rate is fast enough to forego starting the thread.
BACKFILL_MODE: On every update cycle, fill the ring buffer with entries for the last known state BACKFILL_INTERVAL_MS apart from each other
from the time of the last entry to the current time before adding the entry for the current state. */
static const MDXFBufferFillMode BUFFER_FILL_MODE = THREAD_MODE;
acio::MDXFBufferFillMode acio::MDXF_BUFFER_FILL_MODE = acio::THREAD_MODE;
typedef enum {
ARKMDXP4_POLL = 0,
@@ -270,7 +265,7 @@ static bool __cdecl ac_io_mdxf_update_control_status_buffer_impl(int node, MDXFP
if (!IS_MDXF_ACTIVE) {
IS_MDXF_ACTIVE = true;
}
if (BUFFER_FILL_MODE == THREAD_MODE) {
if (acio::MDXF_BUFFER_FILL_MODE == acio::THREAD_MODE) {
count_calls_from_game();
}
}
@@ -463,7 +458,7 @@ void acio::MDXFModule::attach() {
}
acio::MDXFModule::~MDXFModule() {
if (BUFFER_FILL_MODE == THREAD_MODE) {
if (acio::MDXF_BUFFER_FILL_MODE == acio::THREAD_MODE) {
mdxf_thread_stop();
}
}