Skip to content

Commit

Permalink
Rename Property::Changeable::OnlyByConfigProgram to 'Fixed' to better…
Browse files Browse the repository at this point in the history
… convey its use
  • Loading branch information
schellingb committed Sep 7, 2024
1 parent 352deef commit d1bece5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions dosbox_pure_libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}
}
}
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion dosbox_pure_osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 5 additions & 5 deletions dosbox_pure_run.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<<CPU_AUTODETERMINE_SHIFT))))) DBP_SetCyclesByYear(1993, 1993);

RunBatchFile(new BatchFileBoot(!is_install ? 'C' : 'A'));
Expand Down Expand Up @@ -336,7 +336,7 @@ struct DBP_Run
}

Property* bootImgMachine = (mode == RUN_BOOTIMG && info ? control->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());
Expand Down Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions include/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<Changeable::Value&>(change)=Changeable::OnlyByConfigProgram;}
void MarkFixed(){const_cast<Changeable::Value&>(change)=Changeable::Fixed;}
#endif

protected:
Expand Down
6 changes: 3 additions & 3 deletions src/dos/dos_programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/misc/programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d1bece5

Please sign in to comment.