diff --git a/input/connect/joypad_connection.c b/input/connect/joypad_connection.c index 6c108ed2d4..e49d5ca19e 100644 --- a/input/connect/joypad_connection.c +++ b/input/connect/joypad_connection.c @@ -198,7 +198,7 @@ void legacy_pad_connection_pad_deregister(joypad_connection_t *pad_list, pad_con for(i = 0; !joypad_is_end_of_list(&pad_list[i]); i++) { if(pad_list[i].connection == pad_data) { - input_autoconfigure_disconnect(i, iface->get_name(pad_data)); + input_autoconfigure_disconnect(i, iface ? iface->get_name(pad_data) : NULL); memset(&pad_list[i], 0, sizeof(joypad_connection_t)); return; } @@ -211,7 +211,7 @@ void pad_connection_pad_deregister(joypad_connection_t *joyconn, int i; int slot; - if(!iface->multi_pad) + if(!iface || !iface->multi_pad) { legacy_pad_connection_pad_deregister(joyconn, iface, pad_data); return; diff --git a/input/drivers_joypad/wiiu/kpad_driver.c b/input/drivers_joypad/wiiu/kpad_driver.c index 96aca4a233..aa3efeeeef 100644 --- a/input/drivers_joypad/wiiu/kpad_driver.c +++ b/input/drivers_joypad/wiiu/kpad_driver.c @@ -149,8 +149,15 @@ static void kpad_register(unsigned channel, uint8_t device_type) { int slot; - kpad_deregister(channel); - slot = get_slot_for_channel(channel); + if(device_type == WIIMOTE_TYPE_NONE) { + kpad_deregister(channel); + return; + } + + slot = joypad_state.kpad.channel_slot_map[channel]; + if(slot < 0) { + slot = get_slot_for_channel(channel); + } if (slot < 0) { @@ -158,8 +165,10 @@ static void kpad_register(unsigned channel, uint8_t device_type) return; } - joypad_state.kpad.wiimotes[channel].type = device_type; - joypad_state.pads[slot].input_driver = &kpad_driver; + joypad_state.kpad.wiimotes[channel].type = device_type; + joypad_state.kpad.channel_slot_map[channel] = slot; + joypad_state.pads[slot].input_driver = &kpad_driver; + joypad_state.pads[slot].connected = true; input_pad_connect(slot, &kpad_driver); } } @@ -232,8 +241,9 @@ static void kpad_poll(void) if (result == 0) { joypad_state.kpad.poll_failures[channel]++; - if (joypad_state.kpad.poll_failures[channel] > 5) + if (joypad_state.kpad.poll_failures[channel] > 5) { kpad_deregister(channel); + } continue; } joypad_state.kpad.poll_failures[channel] = 0; diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj index a92016690d..17e2721408 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.pbxproj @@ -55,6 +55,8 @@ D27C508A2228360D00113BC0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D27C50892228360D00113BC0 /* AudioToolbox.framework */; }; D27C508B2228361D00113BC0 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D27C50872228360000113BC0 /* AVFoundation.framework */; }; D27C508C2228362700113BC0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D27C50892228360D00113BC0 /* AudioToolbox.framework */; }; + F0B12390270D73A90006E60F /* connect in Resources */ = {isa = PBXBuildFile; fileRef = F0B1238F270D73A90006E60F /* connect */; }; + F0B12391270D73A90006E60F /* connect in Resources */ = {isa = PBXBuildFile; fileRef = F0B1238F270D73A90006E60F /* connect */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -532,6 +534,7 @@ A9020FA64527ED74C836B41D /* cocoa_gl_ctx_metal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = cocoa_gl_ctx_metal.m; sourceTree = ""; }; D27C50872228360000113BC0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; D27C50892228360D00113BC0 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + F0B1238F270D73A90006E60F /* connect */ = {isa = PBXFileReference; lastKnownFileType = folder; path = connect; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1197,6 +1200,7 @@ 05C5D53220E3DD0900654EE4 /* input */ = { isa = PBXGroup; children = ( + F0B1238F270D73A90006E60F /* connect */, 05C5D57520E3DD0900654EE4 /* common */, 05C5D53520E3DD0900654EE4 /* drivers */, 05C5D56E20E3DD0900654EE4 /* drivers_hid */, @@ -1526,6 +1530,7 @@ 05422E402140C8DB00F09961 /* retroarch.icns in Resources */, 9254B33825FA72F100A1E0DA /* assets.zip in Resources */, 0502387C2179713000789627 /* MainMenu_Metal.xib in Resources */, + F0B12391270D73A90006E60F /* connect in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1537,6 +1542,7 @@ 84DD5EB81A89F1C7007336C1 /* retroarch.icns in Resources */, 9254B33125FA0BA300A1E0DA /* assets.zip in Resources */, A90209ED44A1161587F10CA4 /* MainMenu_Metal.xib in Resources */, + F0B12390270D73A90006E60F /* connect in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1704,11 +1710,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_ENTITLEMENTS = RetroArch.entitlements; - CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - DEVELOPMENT_TEAM = UK699V5ZS8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; @@ -1741,11 +1747,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CODE_SIGN_ENTITLEMENTS = RetroArch.entitlements; - CODE_SIGN_IDENTITY = "Developer ID Application"; + CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UK699V5ZS8; + DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = YES; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/pkg/apple/RetroArch_Metal.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/pkg/apple/RetroArch_Metal.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings index 0c67376eba..f9b0d7c5ea 100644 --- a/pkg/apple/RetroArch_Metal.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ b/pkg/apple/RetroArch_Metal.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -1,5 +1,8 @@ - + + PreviewsEnabled + + diff --git a/retroarch.c b/retroarch.c index b8b1c67cb7..d5a4053f8f 100644 --- a/retroarch.c +++ b/retroarch.c @@ -262,8 +262,8 @@ #define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) slock_lock((runloop_st)->msg_queue_lock) #define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) slock_unlock((runloop_st)->msg_queue_lock) #else -#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) -#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) +#define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) (void)(runloop_st) +#define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) (void)(runloop_st) #endif /* Custom forward declarations */ @@ -5793,14 +5793,13 @@ static bool command_event_disk_control_append_image( rarch_system_info_t *sys_info, const char *path) { - runloop_state_t *runloop_st = &runloop_state; input_driver_state_t *input_st = input_state_get_ptr(); if ( !sys_info || !disk_control_append_image(&sys_info->disk_control, path)) return false; #ifdef HAVE_THREADS - if (runloop_st->use_sram) + if (runloop_state.use_sram) autosave_deinit(); #endif @@ -16924,8 +16923,6 @@ static void do_runahead( #else const bool have_dynamic = false; #endif - runloop_state_t - *runloop_st = &runloop_state; video_driver_state_t *video_st = video_state_get_ptr(); uint64_t frame_count = video_st->frame_count; @@ -17015,10 +17012,10 @@ static void do_runahead( core_run(); RUNAHEAD_RESUME_VIDEO(p_rarch); - if ( runloop_st->input_is_dirty + if ( runloop_state.input_is_dirty || p_rarch->runahead_force_input_dirty) { - runloop_st->input_is_dirty = false; + runloop_state.input_is_dirty = false; if (!runahead_save_state(p_rarch)) { @@ -19053,12 +19050,12 @@ static void retroarch_fail(struct rarch_state *p_rarch, bool retroarch_main_quit(void) { - struct rarch_state *p_rarch = &rarch_st; runloop_state_t *runloop_st = &runloop_state; video_driver_state_t*video_st = video_state_get_ptr(); settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); #ifdef HAVE_DISCORD + struct rarch_state *p_rarch = &rarch_st; discord_state_t *discord_st = &p_rarch->discord_st; if (discord_is_inited) { @@ -21229,9 +21226,9 @@ bool core_unset_netplay_callbacks(void) bool core_set_cheat(retro_ctx_cheat_info_t *info) { - struct rarch_state *p_rarch = &rarch_st; runloop_state_t *runloop_st = &runloop_state; #if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) + struct rarch_state *p_rarch = &rarch_st; settings_t *settings = config_get_ptr(); bool run_ahead_enabled = false; unsigned run_ahead_frames = 0; @@ -21267,9 +21264,9 @@ bool core_set_cheat(retro_ctx_cheat_info_t *info) bool core_reset_cheat(void) { - struct rarch_state *p_rarch = &rarch_st; runloop_state_t *runloop_st = &runloop_state; #if defined(HAVE_RUNAHEAD) && (defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)) + struct rarch_state *p_rarch = &rarch_st; settings_t *settings = config_get_ptr(); bool run_ahead_enabled = false; unsigned run_ahead_frames = 0;