diff --git a/lang/Czech.ini b/lang/Czech.ini index 8afcf414..ca466291 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -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" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index fbaac39a..f4518932 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -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" diff --git a/lang/English.ini b/lang/English.ini index 6b52bc51..b664c73b 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -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" diff --git a/lang/French.ini b/lang/French.ini index 312f8518..e98052c1 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -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" diff --git a/lang/German.ini b/lang/German.ini index 5afa5f42..0e2eb33e 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -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" diff --git a/lang/Italian.ini b/lang/Italian.ini index a0e16aa1..60c1585a 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -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" diff --git a/lang/Polish.ini b/lang/Polish.ini index 7c59befe..b2974b9a 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -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" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index e35cceeb..a28c0671 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -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" diff --git a/lang/Russian.ini b/lang/Russian.ini index 53258653..dbaeabc5 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -173,6 +173,7 @@ HOST = "Хост" [HOST_MODS] ROMHACKS = "ROMHACKS" MODS = "MODS" +WARNING = "\\#ffffa0\\Внимание:\\#dcdcdc\\ У вас включено 10 или более модов, пожалуйста, отключите некоторые из них, чтобы предотвратить нестабильность или лаги." [HOST_SAVE] SAVE_TITLE = "SAVE" diff --git a/lang/SpanishES.ini b/lang/SpanishES.ini index 5d14ff44..1492a9ce 100644 --- a/lang/SpanishES.ini +++ b/lang/SpanishES.ini @@ -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" diff --git a/lang/SpanishUS.ini b/lang/SpanishUS.ini index fdb1ebb5..7d5bb46a 100644 --- a/lang/SpanishUS.ini +++ b/lang/SpanishUS.ini @@ -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" diff --git a/src/pc/djui/djui_panel_host_mods.c b/src/pc/djui/djui_panel_host_mods.c index 5cf91385..28635095 100644 --- a/src/pc/djui/djui_panel_host_mods.c +++ b/src/pc/djui/djui_panel_host_mods.c @@ -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) { diff --git a/src/pc/mods/mods.c b/src/pc/mods/mods.c index 363fd35f..a9eb2055 100644 --- a/src/pc/mods/mods.c +++ b/src/pc/mods/mods.c @@ -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)); diff --git a/src/pc/mods/mods.h b/src/pc/mods/mods.h index 3560e125..a9c557f2 100644 --- a/src/pc/mods/mods.h +++ b/src/pc/mods/mods.h @@ -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);