From ba8db05ba11dd450c931f6a39bdfee4ec7e199bf Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Sat, 12 Feb 2022 13:29:49 +0600 Subject: [PATCH] Fix III, vc build, crash if no language translation file found --- resource/CheatMenuSA/json/particle.json | 226 +++++++++--------------- src/menu.cpp | 12 +- src/pch.h | 4 +- tools/premake5.lua | 8 +- 4 files changed, 99 insertions(+), 151 deletions(-) diff --git a/resource/CheatMenuSA/json/particle.json b/resource/CheatMenuSA/json/particle.json index 3e4023e..3d7aa35 100644 --- a/resource/CheatMenuSA/json/particle.json +++ b/resource/CheatMenuSA/json/particle.json @@ -1,149 +1,87 @@ { "Custom": {}, "Main": { - "BlackSmoke": "Dummy", - "Cooler": "Dummy", - "Flame": "Dummy", - "Flash": "Dummy", - "Nitro": "Dummy", - "Nitrocenter": "Dummy", - "ParticleEmitter": "Dummy", - "Smoke": "Dummy", - "Spray": "Dummy", - "WS_factorysmoke": "Dummy", - "WhiteSmoke": "Dummy", - "bigdust": "Dummy", - "biglass": "Dummy", - "bigsplash": "Dummy", - "blood_cloud": "Dummy", - "blood_heli": "Dummy", - "blood_spatter": "Dummy", - "boat_prop": "Dummy", - "bubbles": "Dummy", - "camflash": "Dummy", - "carwashspray": "Dummy", - "cement": "Dummy", - "chunks": "Dummy", - "cigarette_smoke": "Dummy", - "circles": "Dummy", - "cloudfast": "Dummy", - "coke": "Dummy", - "coke_puff": "Dummy", - "coke_trail": "Dummy", - "debris": "Dummy", - "debris1": "Dummy", - "debris2": "Dummy", - "debris3": "Dummy", - "debris4": "Dummy", - "debris5": "Dummy", - "droplets": "Dummy", - "dust": "Dummy", - "evergreen": "Dummy", - "exhale": "Dummy", - "explosion": "Dummy", - "explosion_barrel": "Dummy", - "explosion_crate": "Dummy", - "explosion_door": "Dummy", - "explosion_fuel_car": "Dummy", - "explosion_large": "Dummy", - "explosion_medium": "Dummy", - "explosion_molotov": "Dummy", - "explosion_small": "Dummy", - "explosion_tiny": "Dummy", - "extinguisher": "Dummy", - "fag_smoke": "Dummy", - "fire": "Dummy", - "fire_bike": "Dummy", - "fire_car": "Dummy", - "fire_large": "Dummy", - "fire_med": "Dummy", - "flamethrower": "Dummy", - "flameyflames": "Dummy", - "flare": "Dummy", - "flash": "Dummy", - "flys": "Dummy", - "froosh": "Dummy", - "gasholding": "Dummy", - "gunflash": "Dummy", - "gunsmoke": "Dummy", - "heathaze": "Dummy", - "heli_dust": "Dummy", - "hydrant_gush": "Dummy", - "hydrant_splash": "Dummy", - "impact": "Dummy", - "insects": "Dummy", - "jetpack": "Dummy", - "jetthrust": "Dummy", - "lickyflames": "Dummy", - "lumpygreyshit": "Dummy", - "molotov_flame": "Dummy", - "newfirecar": "Dummy", - "newfirecarbig": "Dummy", - "nitro": "Dummy", - "normal": "Dummy", - "overheat_car": "Dummy", - "overheat_car_electric": "Dummy", - "palm": "Dummy", - "petrolcan": "Dummy", - "planeclouds": "Dummy", - "propellor": "Dummy", - "prt_blood": "Dummy", - "prt_boatsplash": "Dummy", - "prt_bubble": "Dummy", - "prt_cardebris": "Dummy", - "prt_collisionsmoke": "Dummy", - "prt_glass": "Dummy", - "prt_gunshell": "Dummy", - "prt_sand": "Dummy", - "prt_sand2": "Dummy", - "prt_smokeII_3_expand": "Dummy", - "prt_smoke_huge": "Dummy", - "prt_spark": "Dummy", - "prt_spark_2": "Dummy", - "prt_splash": "Dummy", - "prt_wake": "Dummy", - "prt_watersplash": "Dummy", - "prt_wheeldirt": "Dummy", - "puke": "Dummy", - "redsmoke": "Dummy", - "riot_smoke": "Dummy", - "sand": "Dummy", - "shootlight": "Dummy", - "smoke": "Dummy", - "smoke1": "Dummy", - "smoke30lit": "Dummy", - "smoke30m": "Dummy", - "smoke50lit": "Dummy", - "smoke_flare": "Dummy", - "smokefaster": "Dummy", - "smokeydef": "Dummy", - "smoother": "Dummy", - "sparkles": "Dummy", - "sparks": "Dummy", - "spew": "Dummy", - "splash": "Dummy", - "sploosh": "Dummy", - "splosion": "Dummy", - "spray": "Dummy", - "spraycan": "Dummy", - "tank_fire": "Dummy", - "teargas": "Dummy", - "teargasAD": "Dummy", - "tree_hit_fir": "Dummy", - "tree_hit_palm": "Dummy", - "vent": "Dummy", - "vent2": "Dummy", - "wallbust": "Dummy", - "water": "Dummy", - "water_fnt_tme": "Dummy", - "water_fountain": "Dummy", - "water_hydrant": "Dummy", - "water_ripples": "Dummy", - "water_speed": "Dummy", - "water_splash": "Dummy", - "water_splash_big": "Dummy", - "water_splsh_sml": "Dummy", - "water_swim": "Dummy", - "waterfall_end": "Dummy" +"prt_blood": "Dummy", +"prt_boatsplash": "Dummy", +"prt_bubbles": "Dummy", +"prt_cardebris": "Dummy", +"prt_collisionsmoke": "Dummy", +"prt_glass": "Dummy", +"prt_gunshell": "Dummy", +"prt_sand": "Dummy", +"prt_sand2": "Dummy", +"prt_smokeII_3_expand": "Dummy", +"prt_smoke_huge": "Dummy", +"prt_spark": "Dummy", +"prt_spark2": "Dummy", +"prt_splash": "Dummy", +"prt_wake": "Dummy", +"prt_watersplash": "Dummy", +"prt_wheeldirt": "Dummy", +"boat_prop": "Dummy", +"camflash": "Dummy", +"exhale": "Dummy", +"explosion_fuel_car": "Dummy", +"explosion_large": "Dummy", +"explosion_medium": "Dummy", +"explosion_molotov": "Dummy", +"explosion_small": "Dummy", +"explosion_tiny": "Dummy", +"extinguisher": "Dummy", +"fire": "Dummy", +"fire_bike": "Dummy", +"fire_car": "Dummy", +"fire_large": "Dummy", +"fire_med": "Dummy", +"flamethrower": "Dummy", +"gunflash": "Dummy", +"gunsmoke": "Dummy", +"heli_dust": "Dummy", +"jetpack": "Dummy", +"jetthrust": "Dummy", +"molotov_flame": "Dummy", +"nitro": "Dummy", +"overheat_car": "Dummy", +"overheat_car_electric": "Dummy", +"riot_smoke": "Dummy", +"spraycan": "Dummy", +"tank_fire": "Dummy", +"teargas": "Dummy", +"teargasAD": "Dummy", +"water_hydrant": "Dummy", +"water_ripples": "Dummy", +"water_speed": "Dummy", +"water_splash": "Dummy", +"water_splsh_big": "Dummy", +"water_splsh_sml": "Dummy", +"water_swim": "Dummy", +"cigarette_smoke": "Dummy", +"flame": "Dummy", +"insects": "Dummy", +"smoke30lit": "Dummy", +"smoke30m": "Dummy", +"smoke50lit": "Dummy", +"vent": "Dummy", +"vent2": "Dummy", +"waterfall_end": "Dummy", +"water_fnt_tme": "Dummy", +"water_fountain": "Dummy", +"tree_hit_fir": "Dummy", +"tree_hit_palm": "Dummy", +"blood_heli": "Dummy", +"carwashspray": "Dummy", +"cement": "Dummy", +"cloudfast": "Dummy", +"coke_puff": "Dummy", +"coke_trail": "Dummy", +"explosion_barrel": "Dummy", +"explosion_crate": "Dummy", +"explosion_door": "Dummy", +"petrolcan": "Dummy", +"puke": "Dummy", +"shootlight": "Dummy", +"smoke_flare": "Dummy", +"wallbust": "Dummy", +"ws_factorysmoke": "Dummy" } } diff --git a/src/menu.cpp b/src/menu.cpp index b20a8c8..8df79fe 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -368,13 +368,19 @@ void Menu::ShowPage() ImGui::Spacing(); static int selected = Locale::GetCurrentLocaleIndex(); - if (Ui::ListBox(TEXT("Menu.Language"), Locale::GetLocaleList(), selected)) + static std::vector& vec = Locale::GetLocaleList(); + + if (vec.size() > 0) { - if (Locale::SetLocale(selected) != Locale::eReturnCodes::SUCCESS) + if (Ui::ListBox(TEXT("Menu.Language"), vec, selected)) { - SetHelpMessage(TEXT("Menu.LanguageChangeFailed")); + if (Locale::SetLocale(selected) != Locale::eReturnCodes::SUCCESS) + { + SetHelpMessage(TEXT("Menu.LanguageChangeFailed")); + } } } + ImGui::EndTabItem(); } if (ImGui::BeginTabItem(TEXT("Menu.Overlay"))) diff --git a/src/pch.h b/src/pch.h index 427bb62..f723a8a 100644 --- a/src/pch.h +++ b/src/pch.h @@ -76,8 +76,8 @@ #include "fontmgr.h" #include "locale.h" -#define TEXT(x) Locale::GetText(x, "Unknown").c_str() -#define TEXT_S(x) Locale::GetText(x,"Unknown").c_str() +#define TEXT(x) Locale::GetText(x, "Unknown##"x).c_str() +#define TEXT_S(x) Locale::GetText(x,"Unknown##"x).c_str() using namespace plugin; diff --git a/tools/premake5.lua b/tools/premake5.lua index d46aa69..f52fba2 100644 --- a/tools/premake5.lua +++ b/tools/premake5.lua @@ -95,7 +95,9 @@ project "CheatMenuIII" "../src/visual.cpp", "../src/filehandler.h", "../src/filehandler.cpp", - "../src/dllmain.cpp" + "../src/dllmain.cpp", + "../src/locale.h", + "../src/locale.cpp" } includedirs { PSDK_DIR .. "/plugin_III/", @@ -187,7 +189,9 @@ project "CheatMenuVC" "../src/filehandler.cpp", "../src/hotkeys.h", "../src/hotkeys.cpp", - "../src/dllmain.cpp" + "../src/dllmain.cpp", + "../src/locale.h", + "../src/locale.cpp" } includedirs { PSDK_DIR .. "/plugin_vc/",