Mercurial > repos > blastem
comparison blastem.c @ 1581:7121daaa48c2
Fix drag and drop when using Nuklear UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 02 May 2018 00:03:22 -0700 |
parents | a051d8ee4528 |
children | a74db49fa6b1 |
comparison
equal
deleted
inserted
replaced
1580:ea7d5ced2415 | 1581:7121daaa48c2 |
---|---|
97 *buffer = dst; | 97 *buffer = dst; |
98 | 98 |
99 return readsize; | 99 return readsize; |
100 } | 100 } |
101 | 101 |
102 uint32_t load_rom_zip(char *filename, void **dst) | 102 uint32_t load_rom_zip(const char *filename, void **dst) |
103 { | 103 { |
104 static const char *valid_exts[] = {"bin", "md", "gen", "sms", "rom"}; | 104 static const char *valid_exts[] = {"bin", "md", "gen", "sms", "rom"}; |
105 const uint32_t num_exts = sizeof(valid_exts)/sizeof(*valid_exts); | 105 const uint32_t num_exts = sizeof(valid_exts)/sizeof(*valid_exts); |
106 zip_file *z = zip_open(filename); | 106 zip_file *z = zip_open(filename); |
107 if (!z) { | 107 if (!z) { |
130 } | 130 } |
131 zip_close(z); | 131 zip_close(z); |
132 return 0; | 132 return 0; |
133 } | 133 } |
134 | 134 |
135 uint32_t load_rom(char * filename, void **dst, system_type *stype) | 135 uint32_t load_rom(const char * filename, void **dst, system_type *stype) |
136 { | 136 { |
137 uint8_t header[10]; | 137 uint8_t header[10]; |
138 char *ext = path_extension(filename); | 138 char *ext = path_extension(filename); |
139 if (!strcasecmp(ext, "zip")) { | 139 if (!strcasecmp(ext, "zip")) { |
140 free(ext); | 140 free(ext); |
282 render_config_updated(); | 282 render_config_updated(); |
283 } | 283 } |
284 | 284 |
285 static void on_drag_drop(const char *filename) | 285 static void on_drag_drop(const char *filename) |
286 { | 286 { |
287 if (current_system->next_rom) { | 287 if (current_system) { |
288 free(current_system->next_rom); | 288 if (current_system->next_rom) { |
289 } | 289 free(current_system->next_rom); |
290 current_system->next_rom = strdup(filename); | 290 } |
291 current_system->request_exit(current_system); | 291 current_system->next_rom = strdup(filename); |
292 if (menu_system && menu_system->type == SYSTEM_GENESIS) { | 292 current_system->request_exit(current_system); |
293 genesis_context *gen = (genesis_context *)menu_system; | 293 if (menu_system && menu_system->type == SYSTEM_GENESIS) { |
294 if (gen->extra) { | 294 genesis_context *gen = (genesis_context *)menu_system; |
295 menu_context *menu = gen->extra; | 295 if (gen->extra) { |
296 menu->external_game_load = 1; | 296 menu_context *menu = gen->extra; |
297 } else { | 297 menu->external_game_load = 1; |
298 puts("No extra"); | 298 } |
299 } | 299 } |
300 } else { | 300 } else { |
301 puts("no menu"); | 301 init_system_with_media(filename, SYSTEM_UNKNOWN); |
302 } | 302 } |
303 #ifndef DISABLE_NUKLEAR | |
304 if (is_nuklear_active()) { | |
305 show_play_view(); | |
306 } | |
307 #endif | |
303 } | 308 } |
304 | 309 |
305 static system_media cart, lock_on; | 310 static system_media cart, lock_on; |
306 void reload_media(void) | 311 void reload_media(void) |
307 { | 312 { |
333 lock_on.size = load_rom(lock_on_path, &lock_on.buffer, NULL); | 338 lock_on.size = load_rom(lock_on_path, &lock_on.buffer, NULL); |
334 } | 339 } |
335 | 340 |
336 static uint32_t opts = 0; | 341 static uint32_t opts = 0; |
337 static uint8_t force_region = 0; | 342 static uint8_t force_region = 0; |
338 void init_system_with_media(char *path, system_type force_stype) | 343 void init_system_with_media(const char *path, system_type force_stype) |
339 { | 344 { |
340 if (game_system) { | 345 if (game_system) { |
341 game_system->persist_save(game_system); | 346 game_system->persist_save(game_system); |
342 //swap to game context arena and mark all allocated pages in it free | 347 //swap to game context arena and mark all allocated pages in it free |
343 if (current_system == menu_system) { | 348 if (current_system == menu_system) { |