# HG changeset patch # User Michael Pavone # Date 1581878795 28800 # Node ID 5433252329fbf6f9f124176ebe76138ec07313fd # Parent 93960907807a3797cba4f6522fd8d4f077df7719 Set version reg and TAS behavior based on model config diff -r 93960907807a -r 5433252329fb config.c --- a/config.c Sun Feb 16 10:33:20 2020 -0800 +++ b/config.c Sun Feb 16 10:46:35 2020 -0800 @@ -6,6 +6,7 @@ #include "tern.h" #include "util.h" #include "paths.h" +#include "config.h" #include #include #include @@ -334,6 +335,6 @@ tern_node *get_model(tern_node *config, system_type stype) { - char *model = tern_find_path_default(config, "system\0model\0", (tern_val){.ptrval = "md1va3"}, TVAL_PTR); + char *model = tern_find_path_default(config, "system\0model\0", (tern_val){.ptrval = "md1va3"}, TVAL_PTR).ptrval; return tern_find_node(get_systems_config(), model); } diff -r 93960907807a -r 5433252329fb genesis.c --- a/genesis.c Sun Feb 16 10:33:20 2020 -0800 +++ b/genesis.c Sun Feb 16 10:46:35 2020 -0800 @@ -18,6 +18,7 @@ #include "saves.h" #include "bindings.h" #include "jcart.h" +#include "config.h" #define MCLKS_NTSC 53693175 #define MCLKS_PAL 53203395 @@ -1405,6 +1406,11 @@ gen->header.type = SYSTEM_GENESIS; gen->header.info = *rom; set_region(gen, rom, force_region); + tern_node *model = get_model(config, SYSTEM_GENESIS); + uint8_t tmss = !strcmp(tern_find_ptr_default(model, "tmss", "off"), "on"); + if (tmss) { + gen->version_reg |= 1; + } gen->vdp = init_vdp_context(gen->version_reg & 0x40); gen->vdp->system = &gen->header; @@ -1504,8 +1510,9 @@ m68k_options *opts = malloc(sizeof(m68k_options)); init_m68k_opts(opts, rom->map, rom->map_chunks, MCLKS_PER_68K); - //TODO: make this configurable - opts->gen.flags |= M68K_OPT_BROKEN_READ_MODIFY; + if (!strcmp(tern_find_ptr_default(model, "tas", "broken"), "broken")) { + opts->gen.flags |= M68K_OPT_BROKEN_READ_MODIFY; + } gen->m68k = init_68k_context(opts, NULL); gen->m68k->system = gen; opts->address_log = (system_opts & OPT_ADDRESS_LOG) ? fopen("address.log", "w") : NULL;