Unverified Commit 50e30a48 authored by Tony's avatar Tony Committed by GitHub
Browse files

Merge pull request #419 from sonninnos/master

Maintenance
parents 21f17246 41c46e84
Pipeline #57337 passed with stages
in 165 minutes and 10 seconds
......@@ -4263,55 +4263,57 @@ error:
}
}
void retro_set_environment(retro_environment_t cb)
static const struct retro_controller_description joyport_controllers[] =
{
environ_cb = cb;
retro_set_paths();
free_vice_carts();
retro_set_core_options();
{ "Joystick", RETRO_DEVICE_VICE_JOYSTICK },
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
{ NULL, 0 }
};
/* Controller ports */
static const struct retro_controller_description p1_controllers[] = {
{ "Joystick", RETRO_DEVICE_VICE_JOYSTICK },
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
};
static const struct retro_controller_description p2_controllers[] = {
{ "Joystick", RETRO_DEVICE_VICE_JOYSTICK },
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
};
static const struct retro_controller_description p3_controllers[] = {
{ "Joystick", RETRO_DEVICE_VICE_JOYSTICK },
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
};
static const struct retro_controller_description p4_controllers[] = {
{ "Joystick", RETRO_DEVICE_VICE_JOYSTICK },
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
};
static const struct retro_controller_description p5_controllers[] = {
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
};
static const struct retro_controller_description nonport_controllers[] =
{
{ "Keyboard", RETRO_DEVICE_VICE_KEYBOARD },
{ "None", RETRO_DEVICE_NONE },
{ NULL, 0 }
};
static const struct retro_controller_info ports[] = {
{ p1_controllers, 3 }, /* port 1 */
{ p2_controllers, 3 }, /* port 2 */
{ p3_controllers, 3 }, /* port 3 */
{ p4_controllers, 3 }, /* port 4 */
{ p5_controllers, 2 }, /* port 5 */
static void retro_set_inputs(void)
{
unsigned i;
const struct retro_controller_info ports[] =
{
{ joyport_controllers, 4 },
{ joyport_controllers, 4 },
{ joyport_controllers, 4 },
{ joyport_controllers, 4 },
{ nonport_controllers, 3 },
{ nonport_controllers, 3 },
{ NULL, 0 }
};
cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);
/* Reset analog device types to RetroPad */
for (i = 0; i < RETRO_DEVICES; i++)
if (retro_devices[i] == RETRO_DEVICE_ANALOG)
retro_devices[i] = RETRO_DEVICE_JOYPAD;
}
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
retro_set_paths();
free_vice_carts();
retro_set_core_options();
retro_set_inputs();
bool support_no_game = true;
cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &support_no_game);
environ_cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &support_no_game);
static struct retro_led_interface led_interface;
cb(RETRO_ENVIRONMENT_GET_LED_INTERFACE, &led_interface);
environ_cb(RETRO_ENVIRONMENT_GET_LED_INTERFACE, &led_interface);
if (led_interface.set_led_state)
led_state_cb = led_interface.set_led_state;
}
......
......@@ -27,9 +27,8 @@ char* strleft(const char* str, int len);
char* strright(const char* str, int len);
bool strstartswith(const char* str, const char* start);
bool strendswith(const char* str, const char* end);
char *path_remove_program(char *path);
void path_join(char* out, const char* basedir, const char* filename);
char* path_join_dup(const char* basedir, const char* filename);
char *path_remove_program(char *path);
/* VICE helpers */
extern int log_resources_set_int(const char *name, int value);
......
......@@ -136,6 +136,18 @@ int retro_ui_get_pointer_state(int *px, int *py, unsigned int *pbuttons)
return 1;
}
static void statusbar_text_show(const char *format, ...)
{
unsigned char statusbar_temp[RETRO_PATH_MAX] = {0};
va_list args;
va_start(args, format);
vsnprintf(statusbar_temp, sizeof(statusbar_temp), format, args);
snprintf(statusbar_text, sizeof(statusbar_text), "%c %-98s", (' ' | 0x80), statusbar_temp);
va_end(args);
imagename_timer = 50;
}
void emu_function(int function)
{
char tmp_str[20] = {0};
......@@ -160,9 +172,7 @@ void emu_function(int function)
/* Lock current port */
cur_port_locked = true;
/* Statusbar notification */
snprintf(statusbar_text, sizeof(statusbar_text), "%c Port %-48d",
(' ' | 0x80), cur_port);
imagename_timer = 50;
statusbar_text_show("%s %d", "Port", cur_port);
break;
case EMU_RESET:
emu_reset(-1);
......@@ -175,17 +185,12 @@ void emu_function(int function)
case 2: snprintf(tmp_str, sizeof(tmp_str), "Hard reset"); break;
case 3: snprintf(tmp_str, sizeof(tmp_str), "Freeze"); break;
}
snprintf(statusbar_text, sizeof(statusbar_text), "%c %-98s",
(' ' | 0x80), tmp_str);
imagename_timer = 50;
statusbar_text_show("%s", tmp_str);
break;
case EMU_FREEZE:
emu_reset(3);
/* Statusbar notification */
snprintf(tmp_str, sizeof(tmp_str), "Freeze");
snprintf(statusbar_text, sizeof(statusbar_text), "%c %-98s",
(' ' | 0x80), tmp_str);
imagename_timer = 50;
statusbar_text_show("%s", "Freeze");
break;
case EMU_ASPECT_RATIO:
if (opt_aspect_ratio == 0)
......@@ -197,9 +202,9 @@ void emu_function(int function)
/* Lock aspect ratio */
opt_aspect_ratio_locked = true;
/* Statusbar notification */
snprintf(statusbar_text, sizeof(statusbar_text), "%c Pixel Aspect %-40s",
(' ' | 0x80), (opt_aspect_ratio == 1) ? "PAL" : (opt_aspect_ratio == 2) ? "NTSC" : "1:1");
imagename_timer = 50;
statusbar_text_show("%s %s",
"Pixel Aspect",
(opt_aspect_ratio == 1) ? "PAL" : (opt_aspect_ratio == 2) ? "NTSC" : "1:1");
break;
case EMU_ZOOM_MODE:
if (zoom_mode_id == 0 && opt_zoom_mode_id == 0)
......@@ -209,18 +214,18 @@ void emu_function(int function)
else if (zoom_mode_id == 0)
zoom_mode_id = opt_zoom_mode_id;
/* Statusbar notification */
snprintf(statusbar_text, sizeof(statusbar_text), "%c Zoom Mode %-43s",
(' ' | 0x80), (zoom_mode_id) ? "ON" : "OFF");
imagename_timer = 50;
statusbar_text_show("%s %s",
"Zoom Mode",
(zoom_mode_id) ? "ON" : "OFF");
break;
case EMU_TURBO_FIRE:
retro_turbo_fire = !retro_turbo_fire;
/* Lock turbo fire */
turbo_fire_locked = true;
/* Statusbar notification */
snprintf(statusbar_text, sizeof(statusbar_text), "%c Turbo Fire %-42s",
(' ' | 0x80), (retro_turbo_fire) ? "ON" : "OFF");
imagename_timer = 50;
statusbar_text_show("%s %s",
"Turbo Fire",
(retro_turbo_fire) ? "ON" : "OFF");
break;
case EMU_SAVE_DISK:
dc_save_disk_toggle(dc, false, true);
......@@ -232,9 +237,9 @@ void emu_function(int function)
case EMU_DATASETTE_HOTKEYS:
datasette_hotkeys = !datasette_hotkeys;
/* Statusbar notification */
snprintf(statusbar_text, sizeof(statusbar_text), "%c Datasette Hotkeys %-35s",
(' ' | 0x80), (datasette_hotkeys) ? "ON" : "OFF");
imagename_timer = 50;
statusbar_text_show("%s %s",
"Datasette Hotkeys",
(datasette_hotkeys) ? "ON" : "OFF");
break;
case EMU_DATASETTE_STOP:
......
#ifndef LIBRETRO_MAPPER_H
#define LIBRETRO_MAPPER_H
#define RETRO_DEVICES 5
#define RETRO_DEVICES 6
#define RETRO_DEVICE_VICE_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1)
#define RETRO_DEVICE_VICE_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0)
#define RETRO_DEVICE_VICE_KEYBOARD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 0)
#define RETRO_DEVICE_ID_JOYPAD_LR 16
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment