Fix III, vc build, crash if no language translation file found

This commit is contained in:
Grinch_ 2022-02-12 13:29:49 +06:00
parent 45e665396d
commit ba8db05ba1
4 changed files with 99 additions and 151 deletions

View File

@ -1,149 +1,87 @@
{ {
"Custom": {}, "Custom": {},
"Main": { "Main": {
"BlackSmoke": "Dummy", "prt_blood": "Dummy",
"Cooler": "Dummy", "prt_boatsplash": "Dummy",
"Flame": "Dummy", "prt_bubbles": "Dummy",
"Flash": "Dummy", "prt_cardebris": "Dummy",
"Nitro": "Dummy", "prt_collisionsmoke": "Dummy",
"Nitrocenter": "Dummy", "prt_glass": "Dummy",
"ParticleEmitter": "Dummy", "prt_gunshell": "Dummy",
"Smoke": "Dummy", "prt_sand": "Dummy",
"Spray": "Dummy", "prt_sand2": "Dummy",
"WS_factorysmoke": "Dummy", "prt_smokeII_3_expand": "Dummy",
"WhiteSmoke": "Dummy", "prt_smoke_huge": "Dummy",
"bigdust": "Dummy", "prt_spark": "Dummy",
"biglass": "Dummy", "prt_spark2": "Dummy",
"bigsplash": "Dummy", "prt_splash": "Dummy",
"blood_cloud": "Dummy", "prt_wake": "Dummy",
"blood_heli": "Dummy", "prt_watersplash": "Dummy",
"blood_spatter": "Dummy", "prt_wheeldirt": "Dummy",
"boat_prop": "Dummy", "boat_prop": "Dummy",
"bubbles": "Dummy", "camflash": "Dummy",
"camflash": "Dummy", "exhale": "Dummy",
"carwashspray": "Dummy", "explosion_fuel_car": "Dummy",
"cement": "Dummy", "explosion_large": "Dummy",
"chunks": "Dummy", "explosion_medium": "Dummy",
"cigarette_smoke": "Dummy", "explosion_molotov": "Dummy",
"circles": "Dummy", "explosion_small": "Dummy",
"cloudfast": "Dummy", "explosion_tiny": "Dummy",
"coke": "Dummy", "extinguisher": "Dummy",
"coke_puff": "Dummy", "fire": "Dummy",
"coke_trail": "Dummy", "fire_bike": "Dummy",
"debris": "Dummy", "fire_car": "Dummy",
"debris1": "Dummy", "fire_large": "Dummy",
"debris2": "Dummy", "fire_med": "Dummy",
"debris3": "Dummy", "flamethrower": "Dummy",
"debris4": "Dummy", "gunflash": "Dummy",
"debris5": "Dummy", "gunsmoke": "Dummy",
"droplets": "Dummy", "heli_dust": "Dummy",
"dust": "Dummy", "jetpack": "Dummy",
"evergreen": "Dummy", "jetthrust": "Dummy",
"exhale": "Dummy", "molotov_flame": "Dummy",
"explosion": "Dummy", "nitro": "Dummy",
"explosion_barrel": "Dummy", "overheat_car": "Dummy",
"explosion_crate": "Dummy", "overheat_car_electric": "Dummy",
"explosion_door": "Dummy", "riot_smoke": "Dummy",
"explosion_fuel_car": "Dummy", "spraycan": "Dummy",
"explosion_large": "Dummy", "tank_fire": "Dummy",
"explosion_medium": "Dummy", "teargas": "Dummy",
"explosion_molotov": "Dummy", "teargasAD": "Dummy",
"explosion_small": "Dummy", "water_hydrant": "Dummy",
"explosion_tiny": "Dummy", "water_ripples": "Dummy",
"extinguisher": "Dummy", "water_speed": "Dummy",
"fag_smoke": "Dummy", "water_splash": "Dummy",
"fire": "Dummy", "water_splsh_big": "Dummy",
"fire_bike": "Dummy", "water_splsh_sml": "Dummy",
"fire_car": "Dummy", "water_swim": "Dummy",
"fire_large": "Dummy", "cigarette_smoke": "Dummy",
"fire_med": "Dummy", "flame": "Dummy",
"flamethrower": "Dummy", "insects": "Dummy",
"flameyflames": "Dummy", "smoke30lit": "Dummy",
"flare": "Dummy", "smoke30m": "Dummy",
"flash": "Dummy", "smoke50lit": "Dummy",
"flys": "Dummy", "vent": "Dummy",
"froosh": "Dummy", "vent2": "Dummy",
"gasholding": "Dummy", "waterfall_end": "Dummy",
"gunflash": "Dummy", "water_fnt_tme": "Dummy",
"gunsmoke": "Dummy", "water_fountain": "Dummy",
"heathaze": "Dummy", "tree_hit_fir": "Dummy",
"heli_dust": "Dummy", "tree_hit_palm": "Dummy",
"hydrant_gush": "Dummy", "blood_heli": "Dummy",
"hydrant_splash": "Dummy", "carwashspray": "Dummy",
"impact": "Dummy", "cement": "Dummy",
"insects": "Dummy", "cloudfast": "Dummy",
"jetpack": "Dummy", "coke_puff": "Dummy",
"jetthrust": "Dummy", "coke_trail": "Dummy",
"lickyflames": "Dummy", "explosion_barrel": "Dummy",
"lumpygreyshit": "Dummy", "explosion_crate": "Dummy",
"molotov_flame": "Dummy", "explosion_door": "Dummy",
"newfirecar": "Dummy", "petrolcan": "Dummy",
"newfirecarbig": "Dummy", "puke": "Dummy",
"nitro": "Dummy", "shootlight": "Dummy",
"normal": "Dummy", "smoke_flare": "Dummy",
"overheat_car": "Dummy", "wallbust": "Dummy",
"overheat_car_electric": "Dummy", "ws_factorysmoke": "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"
} }
} }

View File

@ -368,13 +368,19 @@ void Menu::ShowPage()
ImGui::Spacing(); ImGui::Spacing();
static int selected = Locale::GetCurrentLocaleIndex(); static int selected = Locale::GetCurrentLocaleIndex();
if (Ui::ListBox(TEXT("Menu.Language"), Locale::GetLocaleList(), selected)) static std::vector<std::string>& 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(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem(TEXT("Menu.Overlay"))) if (ImGui::BeginTabItem(TEXT("Menu.Overlay")))

View File

@ -76,8 +76,8 @@
#include "fontmgr.h" #include "fontmgr.h"
#include "locale.h" #include "locale.h"
#define TEXT(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").c_str() #define TEXT_S(x) Locale::GetText(x,"Unknown##"x).c_str()
using namespace plugin; using namespace plugin;

View File

@ -95,7 +95,9 @@ project "CheatMenuIII"
"../src/visual.cpp", "../src/visual.cpp",
"../src/filehandler.h", "../src/filehandler.h",
"../src/filehandler.cpp", "../src/filehandler.cpp",
"../src/dllmain.cpp" "../src/dllmain.cpp",
"../src/locale.h",
"../src/locale.cpp"
} }
includedirs { includedirs {
PSDK_DIR .. "/plugin_III/", PSDK_DIR .. "/plugin_III/",
@ -187,7 +189,9 @@ project "CheatMenuVC"
"../src/filehandler.cpp", "../src/filehandler.cpp",
"../src/hotkeys.h", "../src/hotkeys.h",
"../src/hotkeys.cpp", "../src/hotkeys.cpp",
"../src/dllmain.cpp" "../src/dllmain.cpp",
"../src/locale.h",
"../src/locale.cpp"
} }
includedirs { includedirs {
PSDK_DIR .. "/plugin_vc/", PSDK_DIR .. "/plugin_vc/",