Start adding mouse and scope support.
This commit is contained in:
parent
5a599d4cf2
commit
b24bb82d0c
|
@ -52,6 +52,7 @@ unsigned (*psnes_library_revision_minor)(void);
|
||||||
unsigned (*psnes_library_revision_major)(void);
|
unsigned (*psnes_library_revision_major)(void);
|
||||||
|
|
||||||
bool (*psnes_load_cartridge_normal)(const char*, const uint8_t*, unsigned);
|
bool (*psnes_load_cartridge_normal)(const char*, const uint8_t*, unsigned);
|
||||||
|
void (*psnes_set_controller_port_device)(bool, unsigned);
|
||||||
|
|
||||||
unsigned (*psnes_serialize_size)(void);
|
unsigned (*psnes_serialize_size)(void);
|
||||||
bool (*psnes_serialize)(uint8_t*, unsigned);
|
bool (*psnes_serialize)(uint8_t*, unsigned);
|
||||||
|
@ -85,6 +86,7 @@ static void load_dynamic(void)
|
||||||
SYM(snes_library_revision_major);
|
SYM(snes_library_revision_major);
|
||||||
SYM(snes_run);
|
SYM(snes_run);
|
||||||
SYM(snes_load_cartridge_normal);
|
SYM(snes_load_cartridge_normal);
|
||||||
|
SYM(snes_set_controller_port_device);
|
||||||
SYM(snes_serialize_size);
|
SYM(snes_serialize_size);
|
||||||
SYM(snes_serialize);
|
SYM(snes_serialize);
|
||||||
SYM(snes_unserialize);
|
SYM(snes_unserialize);
|
||||||
|
@ -112,6 +114,7 @@ static void set_statics(void)
|
||||||
SSYM(snes_library_revision_major);
|
SSYM(snes_library_revision_major);
|
||||||
SSYM(snes_run);
|
SSYM(snes_run);
|
||||||
SSYM(snes_load_cartridge_normal);
|
SSYM(snes_load_cartridge_normal);
|
||||||
|
SSYM(snes_set_controller_port_device);
|
||||||
SSYM(snes_serialize_size);
|
SSYM(snes_serialize_size);
|
||||||
SSYM(snes_serialize);
|
SSYM(snes_serialize);
|
||||||
SSYM(snes_unserialize);
|
SSYM(snes_unserialize);
|
||||||
|
|
|
@ -35,6 +35,7 @@ extern unsigned (*psnes_library_revision_minor)(void);
|
||||||
extern unsigned (*psnes_library_revision_major)(void);
|
extern unsigned (*psnes_library_revision_major)(void);
|
||||||
|
|
||||||
extern bool (*psnes_load_cartridge_normal)(const char*, const uint8_t*, unsigned);
|
extern bool (*psnes_load_cartridge_normal)(const char*, const uint8_t*, unsigned);
|
||||||
|
extern void (*psnes_set_controller_port_device)(bool, unsigned);
|
||||||
|
|
||||||
extern unsigned (*psnes_serialize_size)(void);
|
extern unsigned (*psnes_serialize_size)(void);
|
||||||
extern bool (*psnes_serialize)(uint8_t*, unsigned);
|
extern bool (*psnes_serialize)(uint8_t*, unsigned);
|
||||||
|
|
|
@ -83,6 +83,9 @@ struct global
|
||||||
bool audio_active;
|
bool audio_active;
|
||||||
bool video_active;
|
bool video_active;
|
||||||
|
|
||||||
|
bool has_mouse;
|
||||||
|
bool has_scope;
|
||||||
|
|
||||||
FILE *rom_file;
|
FILE *rom_file;
|
||||||
char config_path[256];
|
char config_path[256];
|
||||||
|
|
||||||
|
|
20
ssnes.c
20
ssnes.c
|
@ -239,6 +239,8 @@ static void print_help(void)
|
||||||
puts("\t-s/--save: Path for save file (*.srm). Required when rom is input from stdin");
|
puts("\t-s/--save: Path for save file (*.srm). Required when rom is input from stdin");
|
||||||
puts("\t-t/--savestate: Path to use for save states. If not selected, *.state will be assumed.");
|
puts("\t-t/--savestate: Path to use for save states. If not selected, *.state will be assumed.");
|
||||||
puts("\t-c/--config: Path for config file." SSNES_DEFAULT_CONF_PATH_STR);
|
puts("\t-c/--config: Path for config file." SSNES_DEFAULT_CONF_PATH_STR);
|
||||||
|
puts("\t-m/--mouse: Connect a virtual mouse into port 2 of the SNES.");
|
||||||
|
puts("\t-p/--scope: Connect a virtual SuperScope into port 2 of the SNES.");
|
||||||
|
|
||||||
#ifdef HAVE_FFMPEG
|
#ifdef HAVE_FFMPEG
|
||||||
puts("\t-r/--record: Path to record video file. Settings for video/audio codecs are found in config file.");
|
puts("\t-r/--record: Path to record video file. Settings for video/audio codecs are found in config file.");
|
||||||
|
@ -262,6 +264,8 @@ static void parse_input(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{ "verbose", 0, NULL, 'v' },
|
{ "verbose", 0, NULL, 'v' },
|
||||||
{ "config", 0, NULL, 'c' },
|
{ "config", 0, NULL, 'c' },
|
||||||
|
{ "mouse", 0, NULL, 'm' },
|
||||||
|
{ "scope", 0, NULL, 'p' },
|
||||||
{ "savestate", 1, NULL, 't' },
|
{ "savestate", 1, NULL, 't' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
@ -274,7 +278,7 @@ static void parse_input(int argc, char *argv[])
|
||||||
#define FFMPEG_RECORD_ARG
|
#define FFMPEG_RECORD_ARG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char optstring[] = "hs:vc:t:" FFMPEG_RECORD_ARG;
|
char optstring[] = "hs:vc:t:m" FFMPEG_RECORD_ARG;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
int c = getopt_long(argc, argv, optstring, opts, &option_index);
|
int c = getopt_long(argc, argv, optstring, opts, &option_index);
|
||||||
|
@ -300,6 +304,14 @@ static void parse_input(int argc, char *argv[])
|
||||||
g_extern.verbose = true;
|
g_extern.verbose = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'm':
|
||||||
|
g_extern.has_mouse = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
g_extern.has_scope = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
strncpy(g_extern.config_path, optarg, sizeof(g_extern.config_path) - 1);
|
strncpy(g_extern.config_path, optarg, sizeof(g_extern.config_path) - 1);
|
||||||
break;
|
break;
|
||||||
|
@ -408,6 +420,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
free(rom_buf);
|
free(rom_buf);
|
||||||
|
|
||||||
|
if (g_extern.has_mouse)
|
||||||
|
psnes_set_controller_port_device(1, SNES_DEVICE_MOUSE);
|
||||||
|
else if (g_extern.has_scope)
|
||||||
|
psnes_set_controller_port_device(1, SNES_DEVICE_SUPER_SCOPE);
|
||||||
|
|
||||||
|
|
||||||
unsigned serial_size = psnes_serialize_size();
|
unsigned serial_size = psnes_serialize_size();
|
||||||
uint8_t *serial_data = malloc(serial_size);
|
uint8_t *serial_data = malloc(serial_size);
|
||||||
if (serial_data == NULL)
|
if (serial_data == NULL)
|
||||||
|
|
Loading…
Reference in New Issue