Mercurial > repos > blastem
comparison blastem.c @ 1931:374a5ae694e8 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 18 Apr 2020 11:42:53 -0700 |
parents | 49f65d240299 30f2821ffd65 |
children | 2c1c88cd1a3f |
comparison
equal
deleted
inserted
replaced
1843:13abdc98379e | 1931:374a5ae694e8 |
---|---|
9 #include <ctype.h> | 9 #include <ctype.h> |
10 | 10 |
11 #include "system.h" | 11 #include "system.h" |
12 #include "68kinst.h" | 12 #include "68kinst.h" |
13 #include "m68k_core.h" | 13 #include "m68k_core.h" |
14 #ifdef USE_NATIVE | 14 #ifndef NEW_CORE |
15 #include "z80_to_x86.h" | 15 #include "z80_to_x86.h" |
16 #else | 16 #else |
17 #include "z80.h" | 17 #include "z80.h" |
18 #endif | 18 #endif |
19 #include "mem.h" | 19 #include "mem.h" |
265 char *savedir_template = tern_find_path(config, "ui\0save_path\0", TVAL_PTR).ptrval; | 265 char *savedir_template = tern_find_path(config, "ui\0save_path\0", TVAL_PTR).ptrval; |
266 if (!savedir_template) { | 266 if (!savedir_template) { |
267 savedir_template = "$USERDATA/blastem/$ROMNAME"; | 267 savedir_template = "$USERDATA/blastem/$ROMNAME"; |
268 } | 268 } |
269 tern_node *vars = tern_insert_ptr(NULL, "ROMNAME", media->name); | 269 tern_node *vars = tern_insert_ptr(NULL, "ROMNAME", media->name); |
270 vars = tern_insert_ptr(vars, "ROMDIR", media->dir); | |
270 vars = tern_insert_ptr(vars, "HOME", get_home_dir()); | 271 vars = tern_insert_ptr(vars, "HOME", get_home_dir()); |
271 vars = tern_insert_ptr(vars, "EXEDIR", get_exe_dir()); | 272 vars = tern_insert_ptr(vars, "EXEDIR", get_exe_dir()); |
272 vars = tern_insert_ptr(vars, "USERDATA", (char *)get_userdata_dir()); | 273 vars = tern_insert_ptr(vars, "USERDATA", (char *)get_userdata_dir()); |
273 char *save_dir = replace_vars(savedir_template, vars, 1); | 274 char *save_dir = replace_vars(savedir_template, vars, 1); |
274 tern_free(vars); | 275 tern_free(vars); |
341 } | 342 } |
342 #endif | 343 #endif |
343 } | 344 } |
344 | 345 |
345 static system_media cart, lock_on; | 346 static system_media cart, lock_on; |
347 const system_media *current_media(void) | |
348 { | |
349 return &cart; | |
350 } | |
351 | |
346 void reload_media(void) | 352 void reload_media(void) |
347 { | 353 { |
348 if (!current_system) { | 354 if (!current_system) { |
349 return; | 355 return; |
350 } | 356 } |
380 static uint8_t force_region = 0; | 386 static uint8_t force_region = 0; |
381 void init_system_with_media(const char *path, system_type force_stype) | 387 void init_system_with_media(const char *path, system_type force_stype) |
382 { | 388 { |
383 if (game_system) { | 389 if (game_system) { |
384 game_system->persist_save(game_system); | 390 game_system->persist_save(game_system); |
385 #ifdef USE_NATIVE | 391 #ifndef NEW_CORE |
386 //swap to game context arena and mark all allocated pages in it free | 392 //swap to game context arena and mark all allocated pages in it free |
387 if (current_system == menu_system) { | 393 if (current_system == menu_system) { |
388 current_system->arena = set_current_arena(game_system->arena); | 394 current_system->arena = set_current_arena(game_system->arena); |
389 } | 395 } |
390 mark_all_free(); | 396 mark_all_free(); |
391 #endif | 397 #endif |
392 game_system->free_context(game_system); | 398 game_system->free_context(game_system); |
393 #ifdef USE_NATIVE | 399 #ifndef NEW_CORE |
394 } else if(current_system) { | 400 } else if(current_system) { |
395 //start a new arena and save old one in suspended system context | 401 //start a new arena and save old one in suspended system context |
396 current_system->arena = start_new_arena(); | 402 current_system->arena = start_new_arena(); |
397 #endif | 403 #endif |
398 } | 404 } |
459 //allow debugging the menu | 465 //allow debugging the menu |
460 if (argv[i][2] == 'm') { | 466 if (argv[i][2] == 'm') { |
461 debug_target = 1; | 467 debug_target = 1; |
462 } | 468 } |
463 break; | 469 break; |
464 #ifdef USE_NATIVE | 470 #ifndef NEW_CORE |
465 case 'D': | 471 case 'D': |
466 gdb_remote_init(); | 472 gdb_remote_init(); |
467 dtype = DEBUGGER_GDB; | 473 dtype = DEBUGGER_GDB; |
468 start_in_debugger = 1; | 474 start_in_debugger = 1; |
469 break; | 475 break; |
690 current_system = game_system; | 696 current_system = game_system; |
691 current_system->debugger_type = dtype; | 697 current_system->debugger_type = dtype; |
692 current_system->enter_debugger = start_in_debugger && menu == debug_target; | 698 current_system->enter_debugger = start_in_debugger && menu == debug_target; |
693 current_system->start_context(current_system, statefile); | 699 current_system->start_context(current_system, statefile); |
694 } else if (menu && game_system) { | 700 } else if (menu && game_system) { |
695 #ifdef USE_NATIVE | 701 #ifndef NEW_CORE |
696 current_system->arena = set_current_arena(game_system->arena); | 702 current_system->arena = set_current_arena(game_system->arena); |
697 #endif | 703 #endif |
698 current_system = game_system; | 704 current_system = game_system; |
699 menu = 0; | 705 menu = 0; |
700 current_system->resume_context(current_system); | 706 current_system->resume_context(current_system); |
702 if (use_nuklear) { | 708 if (use_nuklear) { |
703 #ifndef DISABLE_NUKLEAR | 709 #ifndef DISABLE_NUKLEAR |
704 ui_idle_loop(); | 710 ui_idle_loop(); |
705 #endif | 711 #endif |
706 } else { | 712 } else { |
707 #ifdef USE_NATIVE | 713 #ifndef NEW_CORE |
708 current_system->arena = set_current_arena(menu_system->arena); | 714 current_system->arena = set_current_arena(menu_system->arena); |
709 #endif | 715 #endif |
710 current_system = menu_system; | 716 current_system = menu_system; |
711 menu = 1; | 717 menu = 1; |
712 } | 718 } |