mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
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:
@@ -53,17 +53,12 @@ static struct {
|
|||||||
|
|
||||||
static bool STATUS_BUFFER_FREEZE = false;
|
static bool STATUS_BUFFER_FREEZE = false;
|
||||||
|
|
||||||
typedef enum {
|
/* Decides which method to use for populating ring buffer entries for "padding". Overwritten in spicecfg using P4IO Buffer Algorithm option.
|
||||||
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.
|
|
||||||
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
|
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.
|
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
|
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. */
|
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 {
|
typedef enum {
|
||||||
ARKMDXP4_POLL = 0,
|
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) {
|
if (!IS_MDXF_ACTIVE) {
|
||||||
IS_MDXF_ACTIVE = true;
|
IS_MDXF_ACTIVE = true;
|
||||||
}
|
}
|
||||||
if (BUFFER_FILL_MODE == THREAD_MODE) {
|
if (acio::MDXF_BUFFER_FILL_MODE == acio::THREAD_MODE) {
|
||||||
count_calls_from_game();
|
count_calls_from_game();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,7 +458,7 @@ void acio::MDXFModule::attach() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
acio::MDXFModule::~MDXFModule() {
|
acio::MDXFModule::~MDXFModule() {
|
||||||
if (BUFFER_FILL_MODE == THREAD_MODE) {
|
if (acio::MDXF_BUFFER_FILL_MODE == acio::THREAD_MODE) {
|
||||||
mdxf_thread_stop();
|
mdxf_thread_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,13 @@
|
|||||||
#include "../module.h"
|
#include "../module.h"
|
||||||
|
|
||||||
namespace acio {
|
namespace acio {
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
THREAD_MODE = 0,
|
||||||
|
BACKFILL_MODE = 1
|
||||||
|
} MDXFBufferFillMode;
|
||||||
|
|
||||||
|
extern MDXFBufferFillMode MDXF_BUFFER_FILL_MODE;
|
||||||
|
|
||||||
class MDXFModule : public ACIOModule {
|
class MDXFModule : public ACIOModule {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "api/modules/capture.h"
|
#include "api/modules/capture.h"
|
||||||
#include "acio/acio.h"
|
#include "acio/acio.h"
|
||||||
#include "acio/icca/icca.h"
|
#include "acio/icca/icca.h"
|
||||||
|
#include "acio/mdxf/mdxf.h"
|
||||||
#include "api/controller.h"
|
#include "api/controller.h"
|
||||||
#include "avs/automap.h"
|
#include "avs/automap.h"
|
||||||
#include "avs/core.h"
|
#include "avs/core.h"
|
||||||
@@ -1149,6 +1150,14 @@ int main_implementation(int argc, char *argv[]) {
|
|||||||
rawinput::RAWINPUT_REQUIRE_FOCUS = false;
|
rawinput::RAWINPUT_REQUIRE_FOCUS = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (options[launcher::Options::DDRP4IOBufferMode].is_active()) {
|
||||||
|
if (options[launcher::Options::DDRP4IOBufferMode].value_text() == "thread") {
|
||||||
|
acio::MDXF_BUFFER_FILL_MODE = acio::THREAD_MODE;
|
||||||
|
} else if (options[launcher::Options::DDRP4IOBufferMode].value_text() == "backfill") {
|
||||||
|
acio::MDXF_BUFFER_FILL_MODE = acio::BACKFILL_MODE;
|
||||||
|
}
|
||||||
|
// else - default (no value)
|
||||||
|
}
|
||||||
|
|
||||||
if (options[launcher::Options::MidiAlgoVer].is_active()) {
|
if (options[launcher::Options::MidiAlgoVer].is_active()) {
|
||||||
if (options[launcher::Options::MidiAlgoVer].value_text() == "legacy") {
|
if (options[launcher::Options::MidiAlgoVer].value_text() == "legacy") {
|
||||||
|
|||||||
@@ -2291,6 +2291,24 @@ static const std::vector<OptionDefinition> OPTION_DEFINITIONS = {
|
|||||||
.setting_name = "20",
|
.setting_name = "20",
|
||||||
.category = "I/O Options",
|
.category = "I/O Options",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// DDRP4IOBufferMode
|
||||||
|
.title = "DDR P4IO Buffer Algorithm",
|
||||||
|
.name = "ddrp4iobuffer",
|
||||||
|
.desc =
|
||||||
|
"Remember to restart after changing this value.\n\n"
|
||||||
|
"Sets the algorithm used to populate entries to the buffer of controller polls read by the game.\n\n"
|
||||||
|
"Thread: Starts a thread to periodically insert polls into the buffer (defaults to Backfill if game's refresh rate is at least 120Hz).\n\n"
|
||||||
|
"Backfill: Fills the buffer on each frame with last known state info at short regular intervals up to the current time, then writes the current state.\n\n"
|
||||||
|
"Only has an effect when emulating P4IO (arkmdxp4.dll)",
|
||||||
|
.type = OptionType::Enum,
|
||||||
|
.game_name = "Dance Dance Revolution",
|
||||||
|
.category = "Game Options (Advanced)",
|
||||||
|
.elements = {
|
||||||
|
{"thread", ""},
|
||||||
|
{"backfill", ""},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// InputRequiresFocus
|
// InputRequiresFocus
|
||||||
.title = "Input Requires Focus",
|
.title = "Input Requires Focus",
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ namespace launcher {
|
|||||||
IIDXRecDisable,
|
IIDXRecDisable,
|
||||||
MidiAlgoVer,
|
MidiAlgoVer,
|
||||||
MidiNoteSustain,
|
MidiNoteSustain,
|
||||||
|
DDRP4IOBufferMode,
|
||||||
InputRequiresFocus,
|
InputRequiresFocus,
|
||||||
NostalgiaPoke,
|
NostalgiaPoke,
|
||||||
ForceBackBufferCount,
|
ForceBackBufferCount,
|
||||||
|
|||||||
Reference in New Issue
Block a user