Mercurial > repos > blastem
comparison sms.c @ 2202:ee6d30c56eeb
Add separate model/IO selection settings for SMS/GG
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 22 Aug 2022 22:56:05 -0700 |
parents | f11f4399d64b |
children | 0d1d5dccdd28 |
comparison
equal
deleted
inserted
replaced
2201:2f8984ff5c85 | 2202:ee6d30c56eeb |
---|---|
1 #include <string.h> | 1 #include <string.h> |
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <stddef.h> | 3 #include <stddef.h> |
4 #include "config.h" | |
4 #include "sms.h" | 5 #include "sms.h" |
5 #include "blastem.h" | 6 #include "blastem.h" |
6 #include "render.h" | 7 #include "render.h" |
7 #include "util.h" | 8 #include "util.h" |
8 #include "debug.h" | 9 #include "debug.h" |
668 memory_map[1] = (memmap_chunk){0xC000, 0x10000, sizeof(sms->ram)-1, 0, 0, .flags = MMAP_READ|MMAP_WRITE|MMAP_CODE, .buffer = sms->ram}; | 669 memory_map[1] = (memmap_chunk){0xC000, 0x10000, sizeof(sms->ram)-1, 0, 0, .flags = MMAP_READ|MMAP_WRITE|MMAP_CODE, .buffer = sms->ram}; |
669 }; | 670 }; |
670 sms->header.info.map = malloc(sizeof(memmap_chunk) * sms->header.info.map_chunks); | 671 sms->header.info.map = malloc(sizeof(memmap_chunk) * sms->header.info.map_chunks); |
671 memcpy(sms->header.info.map, memory_map, sizeof(memmap_chunk) * sms->header.info.map_chunks); | 672 memcpy(sms->header.info.map, memory_map, sizeof(memmap_chunk) * sms->header.info.map_chunks); |
672 z80_options *zopts = malloc(sizeof(z80_options)); | 673 z80_options *zopts = malloc(sizeof(z80_options)); |
673 uint8_t vdp_type = strcasecmp(media->extension, "gg") ? VDP_GENESIS : VDP_GAMEGEAR; | 674 uint8_t is_gamegear = !strcasecmp(media->extension, "gg"); |
674 if (vdp_type == VDP_GAMEGEAR) { | 675 tern_node *model_def = is_gamegear ? tern_find_node(get_systems_config(), "gg") : get_model(config, SYSTEM_SMS); |
676 char *vdp_str = tern_find_ptr(model_def, "vdp"); | |
677 uint8_t vdp_type = is_gamegear ? VDP_GENESIS : VDP_GAMEGEAR; | |
678 if (vdp_str) { | |
679 if (!strcmp(vdp_str, "sms1")) { | |
680 vdp_type = VDP_SMS; | |
681 } else if (!strcmp(vdp_str, "sms2")) { | |
682 vdp_type = VDP_SMS2; | |
683 } else if (!strcmp(vdp_str, "tms9918a")) { | |
684 vdp_type = VDP_TMS9918A; | |
685 } else if (!strcmp(vdp_str, "gamegear")) { | |
686 vdp_type = VDP_GAMEGEAR; | |
687 } else if (!strcmp(vdp_str, "genesis")) { | |
688 vdp_type = VDP_GENESIS; | |
689 } else { | |
690 warning("Unrecognized VDP type %s\n", vdp_str); | |
691 } | |
692 } | |
693 if (is_gamegear) { | |
675 init_z80_opts(zopts, sms->header.info.map, sms->header.info.map_chunks, io_gg, 6, 15, 0xFF); | 694 init_z80_opts(zopts, sms->header.info.map, sms->header.info.map_chunks, io_gg, 6, 15, 0xFF); |
676 sms->start_button_region = 0xC0; | 695 sms->start_button_region = 0xC0; |
677 } else { | 696 } else { |
678 init_z80_opts(zopts, sms->header.info.map, sms->header.info.map_chunks, io_map, 4, 15, 0xFF); | 697 init_z80_opts(zopts, sms->header.info.map, sms->header.info.map_chunks, io_map, 4, 15, 0xFF); |
679 } | 698 } |