diswitch.c: Fix crash issues and and cleanup

- Partial rewrite to clean up dipswitch struct to prevent potential crashes
- Fix problems on vs games without dipswitch to cause core to crash
- Create dipswitch struct based on new core options layout
This commit is contained in:
retro-wertz
2019-07-21 09:57:03 +08:00
parent c310050084
commit be1d0a3dac
3 changed files with 552 additions and 400 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,9 @@
#include <libretro.h>
void set_dipswitch_variables(unsigned *index, struct retro_core_option_definition *vars);
size_t set_dipswitch_variables(unsigned current_index, struct retro_core_option_definition *vars);
void update_dipswitch(void);
void DPSW_Cleanup(void);
extern retro_environment_t environ_cb;

View File

@@ -759,7 +759,8 @@ static void set_variables(void)
}
/* Append dipswitch settings to core options if available */
set_dipswitch_variables(&index, option_defs_us);
index += set_dipswitch_variables(index, option_defs_us);
option_defs_us[index] = option_defs_empty;
libretro_set_core_options(environ_cb);
}
@@ -987,6 +988,7 @@ void retro_deinit (void)
ps2 = NULL;
#endif
libretro_supports_bitmasks = false;
DPSW_Cleanup();
}
void retro_reset(void)