Skip to content
Permalink
Browse files
New API for force the loading of a specific ROM file from script
  • Loading branch information
pocomane committed Apr 13, 2020
1 parent 48c970d commit c01647237d6ab1338b34c8e3c9cf26ba8be30f8f
Showing with 18 additions and 0 deletions.
  1. +6 −0 input.cpp
  2. +10 −0 user_io.cpp
  3. +2 −0 user_io.h
@@ -2875,6 +2875,11 @@ void cmd_user_key(char*cmd)
user_io_kbd(key, press);
}

void cmd_force_file(char*cmd)
{
user_io_force_file(cmd);
}

struct cmdentry
{
const char * name;
@@ -2895,6 +2900,7 @@ void handle_MiSTer_cmd(char*cmd)
{"enable_io", cmd_en_io},
{"enable_osd", cmd_en_osd},
{"fb_cmd", video_cmd},
{"force_file", cmd_force_file},
{"fpga_set", cmd_fpga_set},
{"load_core", cmd_load_rbf},
{"user_joy", cmd_user_joy},
@@ -1779,11 +1779,21 @@ static int process_ss(const char *rom_name)
return 1;
}

static char force_file[1024] = {0};
int user_io_force_file(const char* name)
{
strncpy(force_file, name, sizeof(force_file));
force_file[sizeof(force_file)-1] = '\0';
return 0;
}

int user_io_file_tx(const char* name, unsigned char index, char opensave, char mute, char composite)
{
fileTYPE f = {};
static uint8_t buf[4096];

if (force_file[0] != '\0') name = force_file;

if (!FileOpen(&f, name, mute)) return 0;

unsigned long bytes2send = f.size;
@@ -261,6 +261,8 @@ void user_io_check_reset(unsigned short modifiers, char useKeys);

void user_io_rtc_reset();

int user_io_force_file(const char *);

const char* get_rbf_dir();
const char* get_rbf_name();
const char* get_rbf_path();

0 comments on commit c016472

Please sign in to comment.