Add 10 or more mod warning

This commit is contained in:
Agent X 2023-11-21 19:49:35 -05:00
parent 0b66a50a00
commit ff53377644
14 changed files with 35 additions and 2 deletions

View file

@ -174,6 +174,7 @@ HOST = "Hostovat"
[HOST_MODS]
ROMHACKS = "ROMHACKY"
MODS = "MODY"
WARNING = "\\#ffffa0\\Varování:\\#dcdcdc\\ Máte povoleno 10 nebo více módů, vypněte prosím některé, abyste zabránili nestabilitě nebo zpoždění."
[HOST_SAVE]
SAVE_TITLE = "UKLADACI SLOT"

View file

@ -174,6 +174,7 @@ HOST = "Organisator"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Waarschuwing:\\#dcdcdc\\ Je hebt 10 of meer mods ingeschakeld, schakel er een paar uit om instabiliteit of lag te voorkomen."
[HOST_SAVE]
SAVE_TITLE = "OPSLAAN"

View file

@ -174,6 +174,7 @@ HOST = "Host"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Warning:\\#dcdcdc\\ You have 10 or more mods enabled, please disable some to prevent instability or lag."
[HOST_SAVE]
SAVE_TITLE = "SAVE"

View file

@ -174,6 +174,7 @@ HOST = "Héberger"
[HOST_MODS]
ROMHACKS = "ROM-HACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Avertissement :\\#dcdcdc\\ Vous avez 10 mods ou plus activés, veuillez en désactiver certains pour éviter l'instabilité ou le lag."
[HOST_SAVE]
SAVE_TITLE = "SAUVEGARDE"

View file

@ -174,6 +174,7 @@ HOST = "Hosten"
[HOST_MODS]
ROMHACKS = "ROM-HACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Warnung:\\#dcdcdc\\ Du hast 10 oder mehr Mods aktiviert, bitte deaktiviere einige, um Instabilität oder Lag zu vermeiden."
[HOST_SAVE]
SAVE_TITLE = "SPEICHERN"

View file

@ -172,6 +172,7 @@ HOST = "Crea"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Attenzione:\\#dcdcdc\\ Sono state attivate 10 o più mod, disabilitarne alcune per evitare instabilità o lag."
[HOST_SAVE]
SAVE_TITLE = "SALVATAGGIO"

View file

@ -158,6 +158,7 @@ HOST = "Hostuj"
[HOST_MODS]
ROMHACKS = "ROMHACKI"
MODS = "MODY"
WARNING = "\\#ffffa0\\Ostrzeżenie:\\#dcdcdc\\ Masz włączonych 10 lub więcej modów, wyłącz niektóre, aby zapobiec niestabilności lub opóźnieniom."
[HOST_SAVE]
SAVE_TITLE = "ZAPISY"

View file

@ -174,6 +174,7 @@ HOST = "Hostear"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Aviso:\\#dcdcdc\\ Tens 10 ou mais mods activados, desactiva alguns para evitar instabilidade ou atraso."
[HOST_SAVE]
SAVE_TITLE = "SALVAR"

View file

@ -173,6 +173,7 @@ HOST = "Хост"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Внимание:\\#dcdcdc\\ У вас включено 10 или более модов, пожалуйста, отключите некоторые из них, чтобы предотвратить нестабильность или лаги."
[HOST_SAVE]
SAVE_TITLE = "SAVE"

View file

@ -174,6 +174,7 @@ HOST = "Crear"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Advertencia:\\#dcdcdc\\ Tienes 10 o más mods activados, por favor desactiva algunos para prevenir inestabilidad o lag."
[HOST_SAVE]
SAVE_TITLE = "RANURAS DE\nGUARDADO"

View file

@ -174,6 +174,7 @@ HOST = "Crear"
[HOST_MODS]
ROMHACKS = "ROMHACKS"
MODS = "MODS"
WARNING = "\\#ffffa0\\Advertencia:\\#dcdcdc\\ Tienes 10 o más mods activados, por favor desactiva algunos para prevenir inestabilidad o lag."
[HOST_SAVE]
SAVE_TITLE = "RANURAS DE\nGUARDADO"

View file

@ -18,6 +18,7 @@ static struct DjuiFlowLayout* sModLayout = NULL;
static struct DjuiThreePanel* sDescriptionPanel = NULL;
static struct DjuiText* sTooltip = NULL;
static s64 sTag = 0;
static bool sWarned = false;
void djui_panel_host_mods_create(struct DjuiBase* caller);
@ -73,6 +74,15 @@ static void djui_mod_checkbox_on_hover_end(UNUSED struct DjuiBase* base) {
static void djui_mod_checkbox_on_value_change(UNUSED struct DjuiBase* base) {
mods_update_selectable();
if (mods_get_enabled_count() >= 10) {
if (!sWarned) {
sWarned = true;
djui_popup_create(DLANG(HOST_MODS, WARNING), 3);
}
} else {
sWarned = false;
}
u16 index = 0;
struct DjuiBaseChild* node = sModLayout->base.child;
while (node != NULL) {

View file

@ -25,7 +25,7 @@ void mods_get_main_mod_name(char* destination, u32 maxSize) {
struct Mod* picked = NULL;
size_t pickedSize = 0;
for (unsigned int i = 0; i < gLocalMods.entryCount; i++) {
for (u16 i = 0; i < gLocalMods.entryCount; i++) {
struct Mod* mod = gLocalMods.entries[i];
if (!mod->enabled) { continue; }
size_t size = mod_get_lua_size(mod);
@ -38,12 +38,23 @@ void mods_get_main_mod_name(char* destination, u32 maxSize) {
snprintf(destination, maxSize, "%s", picked ? picked->name : "Super Mario 64");
}
u16 mods_get_enabled_count(void) {
u16 enabled = 0;
for (u16 i = 0; i < gLocalMods.entryCount; i++) {
if (!gLocalMods.entries[i]->enabled) { continue; }
enabled++;
}
return enabled;
}
static void mods_local_store_enabled(void) {
assert(sLocalEnabledPaths == NULL);
struct LocalEnabledPath* prev = NULL;
struct Mods* mods = &gLocalMods;
for (int i = 0; i < mods->entryCount; i ++) {
for (u16 i = 0; i < mods->entryCount; i ++) {
if (!mods->entries[i]->enabled) { continue; }
struct LocalEnabledPath* n = calloc(1, sizeof(struct LocalEnabledPath));

View file

@ -23,6 +23,7 @@ extern struct Mods gActiveMods;
extern char gRemoteModsBasePath[];
void mods_get_main_mod_name(char* destination, u32 maxSize);
u16 mods_get_enabled_count(void);
bool mods_generate_remote_base_path(void);
void mods_activate(struct Mods* mods);
void mods_clear(struct Mods* mods);