mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Updates pt. 6
This commit is contained in:
parent
208815fd8e
commit
55ba05a1a3
@ -360,7 +360,8 @@ static void poll_iteration(void)
|
||||
#pragma mark Menus
|
||||
- (IBAction)showCoresDirectory:(id)sender
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openFile:BOXSTRING(g_settings.libretro_directory)];
|
||||
settings_t *settings = config_get_ptr();
|
||||
[[NSWorkspace sharedWorkspace] openFile:BOXSTRING(settings->libretro_directory)];
|
||||
}
|
||||
|
||||
- (IBAction)showPreferences:(id)sender
|
||||
|
@ -68,14 +68,15 @@ static RAScreen* get_chosen_screen(void)
|
||||
#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_6)
|
||||
return [NSScreen mainScreen];
|
||||
#else
|
||||
if (g_settings.video.monitor_index >= RAScreen.screens.count)
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (settings->video.monitor_index >= RAScreen.screens.count)
|
||||
{
|
||||
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
|
||||
return RAScreen.mainScreen;
|
||||
}
|
||||
|
||||
NSArray *screens = [RAScreen screens];
|
||||
return (RAScreen*)[screens objectAtIndex:g_settings.video.monitor_index];
|
||||
return (RAScreen*)[screens objectAtIndex:settings->video.monitor_index];
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -281,13 +282,16 @@ static void apple_gfx_ctx_update_window_title(void *data)
|
||||
static char buf[128], buf_fps[128];
|
||||
bool got_text = video_monitor_get_fps(buf, sizeof(buf),
|
||||
buf_fps, sizeof(buf_fps));
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
(void)got_text;
|
||||
|
||||
#ifdef OSX
|
||||
static const char* const text = buf; /* < Can't access buffer directly in the block */
|
||||
if (got_text)
|
||||
[[g_view window] setTitle:[NSString stringWithCString:text encoding:NSUTF8StringEncoding]];
|
||||
#endif
|
||||
if (g_settings.fps_show)
|
||||
if (settings->fps_show)
|
||||
rarch_main_msg_queue_push(buf_fps, 1, 1, false);
|
||||
}
|
||||
|
||||
|
@ -231,6 +231,8 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
|
||||
- (void)browseTo:(NSString*)path
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
self.path = path;
|
||||
self.title = self.path.lastPathComponent;
|
||||
|
||||
@ -241,7 +243,8 @@ static void file_action(enum file_action action, NSString* source, NSString* tar
|
||||
[self.sections addObject:[NSMutableArray arrayWithObject:i]];
|
||||
|
||||
/* List contents */
|
||||
struct string_list *contents = dir_list_new(self.path.UTF8String, g_settings.menu.navigation.browser.filter.supported_extensions_enable ? self.extensions.UTF8String : NULL, true);
|
||||
struct string_list *contents = dir_list_new(self.path.UTF8String,
|
||||
settings->menu.navigation.browser.filter.supported_extensions_enable ? self.extensions.UTF8String : NULL, true);
|
||||
|
||||
if (contents)
|
||||
{
|
||||
|
@ -18,18 +18,20 @@
|
||||
|
||||
static const char *android_joypad_name(unsigned pad)
|
||||
{
|
||||
return g_settings.input.device_names[pad];
|
||||
settings_t *settings = config_get_ptr();
|
||||
return settings->input.device_names[pad];
|
||||
}
|
||||
|
||||
static bool android_joypad_init(void)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
android_joypad_name(autoconf_pad),
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
android_joypad_name(autoconf_pad), 0, 0,
|
||||
|
@ -160,6 +160,7 @@ static void add_device(void* context, IOReturn result,
|
||||
char device_name[PATH_MAX_LENGTH];
|
||||
CFStringRef device_name_ref;
|
||||
CFNumberRef vendorID, productID;
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct pad_connection* connection = (struct pad_connection*)
|
||||
calloc(1, sizeof(*connection));
|
||||
|
||||
@ -199,8 +200,8 @@ static void add_device(void* context, IOReturn result,
|
||||
if (device_name[0] == '\0')
|
||||
return;
|
||||
|
||||
strlcpy(g_settings.input.device_names[connection->slot],
|
||||
device_name, sizeof(g_settings.input.device_names));
|
||||
strlcpy(settings->input.device_names[connection->slot],
|
||||
device_name, sizeof(settings->input.device_names));
|
||||
|
||||
input_config_autoconfigure_joypad(connection->slot,
|
||||
device_name, connection->v_id, connection->p_id, apple_hid_joypad.ident);
|
||||
|
@ -196,14 +196,16 @@ static const char *gx_joypad_name_static(unsigned pad)
|
||||
|
||||
static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
pad_type[port] = ptype;
|
||||
|
||||
if (!g_settings.input.autodetect_enable)
|
||||
if (!settings->input.autodetect_enable)
|
||||
return;
|
||||
|
||||
strlcpy(g_settings.input.device_names[port],
|
||||
strlcpy(settings->input.device_names[port],
|
||||
gx_joypad_name(port),
|
||||
sizeof(g_settings.input.device_names[port]));
|
||||
sizeof(settings->input.device_names[port]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(port,
|
||||
gx_joypad_name(port),
|
||||
@ -214,6 +216,7 @@ static void handle_hotplug(unsigned port, uint32_t ptype)
|
||||
static bool gx_joypad_init(void)
|
||||
{
|
||||
int autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
SYS_SetResetCallback(reset_cb);
|
||||
#ifdef HW_RVL
|
||||
@ -235,9 +238,9 @@ static bool gx_joypad_init(void)
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_PADS; autoconf_pad++)
|
||||
{
|
||||
pad_type[autoconf_pad] = WPAD_EXP_GAMECUBE;
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
gx_joypad_name_static(autoconf_pad),
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
gx_joypad_name_static(autoconf_pad),
|
||||
|
@ -76,6 +76,8 @@ static void poll_pad(struct linuxraw_joypad *pad)
|
||||
|
||||
static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *pad)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (pad->fd >= 0)
|
||||
return false;
|
||||
|
||||
@ -89,7 +91,7 @@ static bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *p
|
||||
*pad->ident = '\0';
|
||||
if (pad->fd >= 0)
|
||||
{
|
||||
if (ioctl(pad->fd, JSIOCGNAME(sizeof(g_settings.input.device_names[0])), pad->ident) >= 0)
|
||||
if (ioctl(pad->fd, JSIOCGNAME(sizeof(settings->input.device_names[0])), pad->ident) >= 0)
|
||||
{
|
||||
RARCH_LOG("[Joypad]: Found pad: %s on %s.\n", pad->ident, path);
|
||||
|
||||
@ -216,6 +218,7 @@ static void linuxraw_joypad_setup_notify(void)
|
||||
static bool linuxraw_joypad_init(void)
|
||||
{
|
||||
unsigned i;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
g_epoll = epoll_create(MAX_USERS + 1);
|
||||
if (g_epoll < 0)
|
||||
@ -229,8 +232,8 @@ static bool linuxraw_joypad_init(void)
|
||||
if (!pad)
|
||||
continue;
|
||||
|
||||
pad->fd = -1;
|
||||
pad->ident = g_settings.input.device_names[i];
|
||||
pad->fd = -1;
|
||||
pad->ident = settings->input.device_names[i];
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/input/js%u", i);
|
||||
|
||||
|
@ -108,13 +108,13 @@ static void parport_poll_pad(struct parport_joypad *pad)
|
||||
|
||||
static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad)
|
||||
{
|
||||
int i;
|
||||
int datadir = 1; /* read */
|
||||
char data;
|
||||
struct ppdev_frob_struct frob;
|
||||
bool set_control = false;
|
||||
int i;
|
||||
|
||||
int mode = IEEE1284_MODE_BYTE;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (pad->fd >= 0)
|
||||
return false;
|
||||
@ -179,7 +179,7 @@ static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad
|
||||
if (!set_control)
|
||||
RARCH_WARN("[Joypad]: Failed to clear nStrobe and nIRQ bits on %s\n", path);
|
||||
|
||||
strlcpy(pad->ident, path, sizeof(g_settings.input.device_names[0]));
|
||||
strlcpy(pad->ident, path, sizeof(settings->input.device_names[0]));
|
||||
|
||||
for (i = 0; i < PARPORT_NUM_BUTTONS; i++)
|
||||
pad->button_enable[i] = true;
|
||||
@ -231,6 +231,7 @@ static bool parport_joypad_init(void)
|
||||
bool found_disabled_button;
|
||||
char buf[PARPORT_NUM_BUTTONS * 3 + 1];
|
||||
char pin[3 + 1];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
memset(buf, 0, PARPORT_NUM_BUTTONS * 3 + 1);
|
||||
|
||||
@ -239,8 +240,8 @@ static bool parport_joypad_init(void)
|
||||
char path[PATH_MAX_LENGTH];
|
||||
struct parport_joypad *pad = &parport_pads[i];
|
||||
|
||||
pad->fd = -1;
|
||||
pad->ident = g_settings.input.device_names[i];
|
||||
pad->fd = -1;
|
||||
pad->ident = settings->input.device_names[i];
|
||||
|
||||
snprintf(path, sizeof(path), "/dev/parport%u", i);
|
||||
|
||||
|
@ -34,20 +34,22 @@ static INLINE int16_t convert_u8_to_s16(uint8_t val)
|
||||
|
||||
static const char *ps3_joypad_name(unsigned pad)
|
||||
{
|
||||
return g_settings.input.device_names[pad];
|
||||
settings_t *settings = config_get_ptr();
|
||||
return settings->input.device_names[pad];
|
||||
}
|
||||
|
||||
static bool ps3_joypad_init(void)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
cellPadInit(MAX_PADS);
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
"SixAxis Controller",
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
ps3_joypad_name(autoconf_pad),
|
||||
|
@ -27,12 +27,13 @@ static const char *psp_joypad_name(unsigned pad)
|
||||
static bool psp_joypad_init(void)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_PADS; autoconf_pad++)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
psp_joypad_name(autoconf_pad),
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
psp_joypad_name(autoconf_pad),
|
||||
|
@ -19,17 +19,19 @@
|
||||
|
||||
static const char *qnx_joypad_name(unsigned pad)
|
||||
{
|
||||
return g_settings.input.device_names[pad];
|
||||
settings_t *settings = config_get_ptr();
|
||||
return settings->input.device_names[pad];
|
||||
}
|
||||
|
||||
static bool qnx_joypad_init(void)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad], "None",
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
strlcpy(settings->input.device_names[autoconf_pad], "None",
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
qnx_joypad_name(autoconf_pad),
|
||||
|
@ -92,6 +92,7 @@ static void pad_connect(unsigned id)
|
||||
bool success = false;
|
||||
int32_t product = 0;
|
||||
int32_t vendor = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
SDL_JoystickGUID guid;
|
||||
@ -123,7 +124,7 @@ static void pad_connect(unsigned id)
|
||||
return;
|
||||
}
|
||||
|
||||
strlcpy(g_settings.input.device_names[id], pad_name(id), sizeof(g_settings.input.device_names[id]));
|
||||
strlcpy(settings->input.device_names[id], pad_name(id), sizeof(settings->input.device_names[id]));
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
guid = SDL_JoystickGetGUID(pad->joypad);
|
||||
@ -188,6 +189,7 @@ static void pad_connect(unsigned id)
|
||||
|
||||
static void pad_disconnect(unsigned id)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef HAVE_SDL2
|
||||
if (sdl_pads[id].haptic)
|
||||
SDL_HapticClose(sdl_pads[id].haptic);
|
||||
@ -205,7 +207,7 @@ static void pad_disconnect(unsigned id)
|
||||
RARCH_LOG("[SDL]: Joypad #%u disconnected.\n", id);
|
||||
}
|
||||
|
||||
g_settings.input.device_names[id][0] = '\0';
|
||||
settings->input.device_names[id][0] = '\0';
|
||||
|
||||
memset(&sdl_pads[id], 0, sizeof(sdl_pads[id]));
|
||||
}
|
||||
|
@ -315,6 +315,8 @@ static int find_vacant_pad(void)
|
||||
|
||||
static void free_pad(unsigned pad, bool hotplug)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (udev_pads[pad].fd >= 0)
|
||||
close(udev_pads[pad].fd);
|
||||
|
||||
@ -323,8 +325,8 @@ static void free_pad(unsigned pad, bool hotplug)
|
||||
*udev_pads[pad].ident = '\0';
|
||||
memset(&udev_pads[pad], 0, sizeof(udev_pads[pad]));
|
||||
|
||||
udev_pads[pad].fd = -1;
|
||||
udev_pads[pad].ident = g_settings.input.device_names[pad];
|
||||
udev_pads[pad].fd = -1;
|
||||
udev_pads[pad].ident = settings->input.device_names[pad];
|
||||
|
||||
/* Avoid autoconfig spam if we're reiniting driver. */
|
||||
/* TODO - implement VID/PID? */
|
||||
@ -345,8 +347,9 @@ static bool add_pad(struct udev_device *dev, unsigned p, int fd, const char *pat
|
||||
unsigned long absbit[NBITS(ABS_MAX)] = {0};
|
||||
unsigned long ffbit[NBITS(FF_MAX)] = {0};
|
||||
unsigned buttons = 0, axes = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (ioctl(fd, EVIOCGNAME(sizeof(g_settings.input.device_names[0])), pad->ident) < 0)
|
||||
if (ioctl(fd, EVIOCGNAME(sizeof(settings->input.device_names[0])), pad->ident) < 0)
|
||||
{
|
||||
RARCH_LOG("[udev]: Failed to get pad name.\n");
|
||||
return false;
|
||||
@ -515,11 +518,12 @@ static bool udev_joypad_init(void)
|
||||
struct udev_list_entry *devs = NULL;
|
||||
struct udev_list_entry *item = NULL;
|
||||
struct udev_enumerate *enumerate = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
udev_pads[i].fd = -1;
|
||||
udev_pads[i].ident = g_settings.input.device_names[i];
|
||||
udev_pads[i].ident = settings->input.device_names[i];
|
||||
}
|
||||
|
||||
g_udev = udev_new();
|
||||
|
@ -153,6 +153,7 @@ static bool winxinput_joypad_init(void)
|
||||
unsigned i, autoconf_pad;
|
||||
XINPUT_STATE dummy_state;
|
||||
const char *version = "1.4";
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
g_winxinput_dll = NULL;
|
||||
|
||||
@ -245,9 +246,9 @@ static bool winxinput_joypad_init(void)
|
||||
{
|
||||
if (pad_index_to_xuser_index(autoconf_pad) > -1)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
winxinput_joypad_name(autoconf_pad),
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
|
@ -35,12 +35,14 @@ static const char* const XBOX_CONTROLLER_NAMES[4] =
|
||||
|
||||
static const char *xdk_joypad_name(unsigned pad)
|
||||
{
|
||||
return g_settings.input.device_names[pad];
|
||||
settings_t *settings = config_get_ptr();
|
||||
return settings->input.device_names[pad];
|
||||
}
|
||||
|
||||
static bool xdk_joypad_init(void)
|
||||
{
|
||||
unsigned autoconf_pad;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
#ifdef _XBOX1
|
||||
XInitDevices(0, NULL);
|
||||
@ -63,9 +65,9 @@ static bool xdk_joypad_init(void)
|
||||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_USERS; autoconf_pad++)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
strlcpy(settings->input.device_names[autoconf_pad],
|
||||
"XInput Controller",
|
||||
sizeof(g_settings.input.device_names[autoconf_pad]));
|
||||
sizeof(settings->input.device_names[autoconf_pad]));
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(autoconf_pad,
|
||||
|
Loading…
x
Reference in New Issue
Block a user