Skip to content

Commit

Permalink
Add Property::IsFixed
Browse files Browse the repository at this point in the history
  • Loading branch information
schellingb committed Sep 7, 2024
1 parent d1bece5 commit 912dd46
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 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::Fixed) return false;
if (!section || !strcmp(new_value, old_val) || prop->IsFixed()) return false;

bool reInitSection = (dbp_state != DBPSTATE_BOOT);
if (disallow_in_game && dbp_game_running)
Expand Down
3 changes: 1 addition & 2 deletions dosbox_pure_osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +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::Fixed)
{ if (res != RES_NONE) goto handle_result; else goto top_menu; }
if (control->GetProp("dosbox", "machine")->IsFixed()) { if (res != RES_NONE) goto handle_result; else goto top_menu; }
list.clear();
list.emplace_back(IT_NONE, INFO_HEADER, "Select Boot System Mode");
list.emplace_back(IT_NONE);
Expand Down
2 changes: 1 addition & 1 deletion dosbox_pure_run.h
Original file line number Diff line number Diff line change
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::Fixed))
if (startup.reboot || dbp_game_running || (bootImgMachine && info != *(const char*)bootImgMachine->GetValue() && !bootImgMachine->IsFixed()))
{
startup.reboot = false;
if (mode == RUN_BOOTIMG) dbp_reboot_machine = (info ? (char)info : *(const char*)bootImgMachine->GetValue());
Expand Down
3 changes: 2 additions & 1 deletion include/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class Property {
Value::Etype Get_type(){return default_value.type;}
Changeable::Value getChange() {return change;}
#ifdef C_DBP_LIBRETRO
void MarkFixed(){const_cast<Changeable::Value&>(change)=Changeable::Fixed;}
inline void MarkFixed(){const_cast<Changeable::Value&>(change)=Changeable::Fixed;}
inline bool IsFixed(){return change==Changeable::Fixed;}
#endif

protected:
Expand Down

0 comments on commit 912dd46

Please sign in to comment.