Fix refresh on rom hacks going to mods menu

This commit is contained in:
Agent X 2024-07-08 21:14:36 -04:00
parent b6df4176f4
commit 273807b2eb
1 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,7 @@ static struct DjuiFlowLayout* sModLayout = NULL;
static struct DjuiThreePanel* sDescriptionPanel = NULL;
static struct DjuiText* sTooltip = NULL;
static bool sWarned = false;
static bool sRomHacks = false;
void djui_panel_host_mods_create(struct DjuiBase* caller);
@ -119,13 +120,15 @@ static void djui_panel_host_mods_destroy(struct DjuiBase* base) {
}
void djui_panel_host_mods_create(struct DjuiBase* caller) {
bool isRomHacks = caller != NULL ? caller->tag != 0 : false;
if (caller != NULL) {
sRomHacks = caller->tag != 0;
}
mods_update_selectable();
djui_panel_host_mods_description_create();
struct DjuiThreePanel* panel = djui_panel_menu_create(
isRomHacks ? DLANG(HOST_MODS, ROMHACKS) : DLANG(HOST_MODS, MODS),
sRomHacks ? DLANG(HOST_MODS, ROMHACKS) : DLANG(HOST_MODS, MODS),
true);
struct DjuiBase* body = djui_three_panel_get_body(panel);
@ -135,7 +138,7 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
struct DjuiBase* layoutBase = &paginated->layout->base;
for (int i = 0; i < gLocalMods.entryCount; i++) {
struct Mod* mod = gLocalMods.entries[i];
if (isRomHacks != (mod->incompatible && strstr(mod->incompatible, "romhack"))) {
if (sRomHacks != (mod->incompatible && strstr(mod->incompatible, "romhack"))) {
continue;
}
struct DjuiCheckbox* checkbox = djui_checkbox_create(layoutBase, mod->name, &mod->enabled, djui_mod_checkbox_on_value_change);