From d1bece510730ce732cebb1d489754d6acbca38c8 Mon Sep 17 00:00:00 2001 From: schellingb <14200249+schellingb@users.noreply.github.com> Date: Sun, 8 Sep 2024 01:10:29 +0900 Subject: [PATCH] Rename Property::Changeable::OnlyByConfigProgram to 'Fixed' to better convey its use --- dosbox_pure_libretro.cpp | 6 +++--- dosbox_pure_osd.h | 2 +- dosbox_pure_run.h | 10 +++++----- include/setup.h | 4 ++-- src/dos/dos_programs.cpp | 6 +++--- src/misc/programs.cpp | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dosbox_pure_libretro.cpp b/dosbox_pure_libretro.cpp index 75d2a885..b6090a26 100644 --- a/dosbox_pure_libretro.cpp +++ b/dosbox_pure_libretro.cpp @@ -2643,7 +2643,7 @@ static bool check_variables(bool is_startup = false) DBP_ASSERT(prop); std::string tmpval; const char* old_val = (prop->Get_type() == Value::V_STRING ? (const char*)prop->GetValue() : (tmpval = prop->GetValue().ToString()).c_str()); - if (!section || !strcmp(new_value, old_val) || prop->getChange() == Property::Changeable::OnlyByConfigProgram) return false; + if (!section || !strcmp(new_value, old_val) || prop->getChange() == Property::Changeable::Fixed) return false; bool reInitSection = (dbp_state != DBPSTATE_BOOT); if (disallow_in_game && dbp_game_running) @@ -2958,7 +2958,7 @@ static void init_dosbox_load_dosboxconf(const std::string& cfg, Section*& ref_au if (section == ref_autoexec) ref_autoexec = NULL; // skip our default autoexec if ((loc = line.find('=')) == std::string::npos) continue; trim(line.erase(loc)); - if (Property* p = section->GetProp(line.c_str())) p->OnChangedByConfigProgram(); + if (Property* p = section->GetProp(line.c_str())) p->MarkFixed(); } } } @@ -3161,7 +3161,7 @@ static void init_dosbox(bool firsttime, bool forcemenu = false, bool reinit = fa Property* prop = sec->GetProp("midiconfig"); sec->ExecuteDestroy(false); prop->SetValue(mountedMidi); - prop->OnChangedByConfigProgram(); + prop->MarkFixed(); sec->ExecuteInit(false); } diff --git a/dosbox_pure_osd.h b/dosbox_pure_osd.h index 5e3cbfa7..4b8a7d2b 100644 --- a/dosbox_pure_osd.h +++ b/dosbox_pure_osd.h @@ -1306,7 +1306,7 @@ struct DBP_PureMenuState : DBP_MenuState else if (ok_type == IT_BOOTIMG) { // Machine property was fixed by dbp_reboot_machine or DOSBOX.CONF and cannot be modified here, so automatically boot the image as is (RES_NONE check is for GoToSubMenu) - if (control->GetProp("dosbox", "machine")->getChange() == Property::Changeable::OnlyByConfigProgram) + if (control->GetProp("dosbox", "machine")->getChange() == Property::Changeable::Fixed) { if (res != RES_NONE) goto handle_result; else goto top_menu; } list.clear(); list.emplace_back(IT_NONE, INFO_HEADER, "Select Boot System Mode"); diff --git a/dosbox_pure_run.h b/dosbox_pure_run.h index 0a6de4ae..690414d5 100644 --- a/dosbox_pure_run.h +++ b/dosbox_pure_run.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Bernhard Schelling + * Copyright (C) 2020-2024 Bernhard Schelling * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -274,7 +274,7 @@ struct DBP_Run section->HandleInputline("cputype=pentium_slow"); if (retro_get_variable("dosbox_pure_bootos_forcenormal", "false")[0] == 't') section->HandleInputline("core=normal"); section->ExecuteInit(false); - section->GetProp("cputype")->OnChangedByConfigProgram(); + section->GetProp("cputype")->MarkFixed(); if (dbp_content_year < 1993 && (CPU_CycleAutoAdjust || (CPU_AutoDetermineMode & (CPU_AUTODETERMINE_CYCLES|(CPU_AUTODETERMINE_CYCLES<GetProp("dosbox", "machine") : NULL); - if (startup.reboot || dbp_game_running || (bootImgMachine && info != *(const char*)bootImgMachine->GetValue() && bootImgMachine->getChange() != Property::Changeable::OnlyByConfigProgram)) + if (startup.reboot || dbp_game_running || (bootImgMachine && info != *(const char*)bootImgMachine->GetValue() && bootImgMachine->getChange() != Property::Changeable::Fixed)) { startup.reboot = false; if (mode == RUN_BOOTIMG) dbp_reboot_machine = (info ? (char)info : *(const char*)bootImgMachine->GetValue()); @@ -405,7 +405,7 @@ struct DBP_Run (((val += '^') += (yml_key[7] == 't' ? 'M' : 'S')).append(p, (fs > bs ? (fs - p) : bs ? (bs - p) : 0)) += CROSS_FILESPLIT).append(Val, (size_t)(ValX - Val)); Property* prop = control->GetProp("midi", "midiconfig"); prop->SetValue(val); - prop->OnChangedByConfigProgram(); + prop->MarkFixed(); val.assign("intelligent"); } else @@ -416,7 +416,7 @@ struct DBP_Run } Property* prop = control->GetProp(db_section, db_key); bool res = (prop->SetValue(val) && !strcasecmp(prop->GetValue().ToString().c_str(), val.c_str())); - if (res) prop->OnChangedByConfigProgram(); + if (res) prop->MarkFixed(); va_end(ap); return res; } diff --git a/include/setup.h b/include/setup.h index 3beba33c..8e13c18b 100644 --- a/include/setup.h +++ b/include/setup.h @@ -129,7 +129,7 @@ class Property { #ifndef C_DBP_LIBRETRO struct Changeable { enum Value {Always, WhenIdle,OnlyAtStart};}; #else - struct Changeable { enum Value {Always, WhenIdle, OnlyAtStart, OnlyByConfigProgram};}; + struct Changeable { enum Value {Always, WhenIdle, OnlyAtStart, Fixed};}; #endif const std::string propname; @@ -150,7 +150,7 @@ class Property { Value::Etype Get_type(){return default_value.type;} Changeable::Value getChange() {return change;} #ifdef C_DBP_LIBRETRO - void OnChangedByConfigProgram(){const_cast(change)=Changeable::OnlyByConfigProgram;} + void MarkFixed(){const_cast(change)=Changeable::Fixed;} #endif protected: diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index dcb390bb..ccbdb52c 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -710,9 +710,9 @@ class BOOT : public Program { strcpy(test,"ems=false"); dos_sec->HandleInputline(test); #ifdef C_DBP_LIBRETRO - dos_sec->GetProp("umb")->OnChangedByConfigProgram(); - dos_sec->GetProp("xms")->OnChangedByConfigProgram(); - dos_sec->GetProp("ems")->OnChangedByConfigProgram(); + dos_sec->GetProp("umb")->MarkFixed(); + dos_sec->GetProp("xms")->MarkFixed(); + dos_sec->GetProp("ems")->MarkFixed(); #endif dos_sec->ExecuteInit(false); } diff --git a/src/misc/programs.cpp b/src/misc/programs.cpp index 013d7119..8d0baabe 100644 --- a/src/misc/programs.cpp +++ b/src/misc/programs.cpp @@ -777,7 +777,7 @@ void CONFIG::Run(void) { #ifdef C_DBP_LIBRETRO else { Property* p = tsec->GetProp(pvars[1].c_str()); - if (p) p->OnChangedByConfigProgram(); + if (p) p->MarkFixed(); } #endif tsec->ExecuteInit(false);