Fix crash with weatherID changer

This commit is contained in:
Grinch_ 2022-03-18 13:23:43 +06:00
parent 9b5a5d3be9
commit 488035483c
10 changed files with 50 additions and 34 deletions

View File

@ -125,6 +125,7 @@
"GitHubRepo": "GitHub repo", "GitHubRepo": "GitHub repo",
"GodModeKey": "Toggle god mode", "GodModeKey": "Toggle god mode",
"Hotkeys": "Hotkeys", "Hotkeys": "Hotkeys",
"InvalidValue": "Invalid value",
"Language": "Language", "Language": "Language",
"LanguageChangeFailed": "Failed to change language!", "LanguageChangeFailed": "Failed to change language!",
"Name": "Name", "Name": "Name",
@ -460,6 +461,12 @@
"Watertight": "Watertight car", "Watertight": "Watertight car",
"WatertightTip": "Peds inside won't drown if the vehicle\nis submerged in water" "WatertightTip": "Peds inside won't drown if the vehicle\nis submerged in water"
}, },
"Updater":
{
"Failed" : "Failed to check for updates",
"Found" : "Update found",
"NotFound" : "No update found"
},
"Visual": { "Visual": {
"Ambient": "Ambient", "Ambient": "Ambient",
"AmbientBl": "Ambient bl", "AmbientBl": "Ambient bl",

View File

@ -23,7 +23,7 @@ void Animation::PlayCutscene(std::string& rootKey, std::string& cutsceneId, std:
{ {
if (Util::IsOnCutscene()) if (Util::IsOnCutscene())
{ {
SetHelpMessage(TEXT("Animation.CutsceneRunning"), false, false, false); SetHelpMessage(TEXT("Animation.CutsceneRunning"));
return; return;
} }

View File

@ -93,7 +93,7 @@ void CheatMenu::ProcessPages()
{ {
/* /*
* We don't want to be annoying and * We don't want to be annoying and
* show anniversary screen on every game start * show anniversary screen on game start
*/ */
bool flag = gConfig.GetValue("window.anniversaryShown", false); bool flag = gConfig.GetValue("window.anniversaryShown", false);
@ -200,18 +200,16 @@ void CheatMenu::Init()
return; return;
} }
ApplyStyle();
// Load menu settings // Load menu settings
m_nMenuPage = (eMenuPages)gConfig.GetValue("window.page", (size_t)eMenuPages::WELCOME); m_nMenuPage = (eMenuPages)gConfig.GetValue("window.page", (size_t)eMenuPages::WELCOME);
m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f); m_fMenuSize.x = gConfig.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f);
m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f); m_fMenuSize.y = gConfig.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f);
srand(CTimer::m_snTimeInMilliseconds); srand(CTimer::m_snTimeInMilliseconds);
ApplyStyle();
Locale::Init("CheatMenu/locale/", "English", "English"); Locale::Init("CheatMenu/locale/", "English", "English");
GenHeaderList();
CheatMenu::GenHeaderList();
// Init menu parts // Init menu parts
Animation::Init(); Animation::Init();
Game::Init(); Game::Init();

View File

@ -683,6 +683,15 @@ void Game::ShowPage()
static int weatherID = 0; static int weatherID = 0;
if (ImGui::InputInt(TEXT("Game.WeatherID"), &weatherID)) if (ImGui::InputInt(TEXT("Game.WeatherID"), &weatherID))
{ {
if (weatherID < 0)
{
weatherID = 255;
}
if (weatherID > 255)
{
weatherID = 0;
}
CWeather::OldWeatherType = weatherID; CWeather::OldWeatherType = weatherID;
CWeather::NewWeatherType = weatherID; CWeather::NewWeatherType = weatherID;
} }

View File

@ -262,7 +262,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
SetHelpMessage("Invalid value", false, false, false); SetHelpMessage(TEXT("Menu.InvalidValue"));
} }
} }
@ -279,7 +279,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
SetHelpMessage("Invalid value", false, false, false); SetHelpMessage(TEXT("Menu.InvalidValue"));
} }
} }
@ -304,7 +304,7 @@ void Menu::ProcessCommands()
} }
catch (...) catch (...)
{ {
SetHelpMessage("Invalid location", false, false, false); SetHelpMessage("Invalid location");
} }
} }
@ -317,7 +317,7 @@ void Menu::ProcessCommands()
{ {
std::string weapon = "-1"; std::string weapon = "-1";
Weapon::GiveWeaponToPlayer(weapon); Weapon::GiveWeaponToPlayer(weapon);
SetHelpMessage("Weapon given", false, false, false); SetHelpMessage("Weapon given");
} }
else else
{ {
@ -328,10 +328,10 @@ void Menu::ProcessCommands()
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1) if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
{ {
Weapon::GiveWeaponToPlayer(weapon_name); Weapon::GiveWeaponToPlayer(weapon_name);
SetHelpMessage("Weapon given", false, false, false); SetHelpMessage("Weapon given");
} }
else else
SetHelpMessage("Invalid command", false, false, false); SetHelpMessage("Invalid command");
} }
return; return;
@ -346,10 +346,10 @@ void Menu::ProcessCommands()
{ {
std::string smodel = std::to_string(model); std::string smodel = std::to_string(model);
Vehicle::SpawnVehicle(smodel); Vehicle::SpawnVehicle(smodel);
SetHelpMessage("Vehicle spawned", false, false, false); SetHelpMessage("Vehicle spawned");
} }
else else
SetHelpMessage("Invalid command", false, false, false); SetHelpMessage("Invalid command");
} }
#endif #endif
} }

View File

@ -43,7 +43,7 @@ void Updater::Process()
if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE) if (res == E_OUTOFMEMORY || res == INET_E_DOWNLOAD_FAILURE)
{ {
SetHelpMessage("Failed to check for updates", false, false, false); SetHelpMessage(TEXT("Updater.Failed"));
return; return;
} }
@ -61,12 +61,12 @@ void Updater::Process()
if (latestVer > MENU_VERSION_NUMBER) if (latestVer > MENU_VERSION_NUMBER)
{ {
SetHelpMessage("Update found", false, false, false); SetHelpMessage(TEXT("Updater.Found"));
curState = States::FOUND; curState = States::FOUND;
} }
else else
{ {
SetHelpMessage("No update found.", false, false, false); SetHelpMessage(TEXT("Updater.NotFound"));
Updater::curState = States::IDLE; Updater::curState = States::IDLE;
} }
} }

View File

@ -26,9 +26,11 @@ public:
static bool IsUpdateAvailable(); static bool IsUpdateAvailable();
/* /*
Just downloading file from a click counter site Just downloading counter.info file from GitHub repository
Redirects to the versioninfo.json file of github Initial plan was to add google analytics but people will freak
This probably shouldn't impose any privacy concerns? out about that (though every site has it in some form)
Pretty barebones but this shouldn't raise any concerns (i hope)
*/ */
static void IncrementDailyUsageCounter(); static void IncrementDailyUsageCounter();

View File

@ -42,7 +42,7 @@ void Vehicle::Init()
if (fixVeh.Pressed()) if (fixVeh.Pressed())
{ {
Util::FixVehicle(pVeh); Util::FixVehicle(pVeh);
SetHelpMessage("Vehicle fixed", false, false, false); SetHelpMessage("Vehicle fixed");
} }
if (vehEngine.Pressed()) if (vehEngine.Pressed())
@ -51,11 +51,11 @@ void Vehicle::Init()
if (state) if (state)
{ {
SetHelpMessage("Vehicle engine off", false, false, false); SetHelpMessage("Vehicle engine off");
} }
else else
{ {
SetHelpMessage("Vehicle engine on", false, false, false); SetHelpMessage("Vehicle engine on");
} }
#ifdef GTASA #ifdef GTASA
pVeh->m_nVehicleFlags.bEngineBroken = state; pVeh->m_nVehicleFlags.bEngineBroken = state;
@ -207,7 +207,7 @@ void Vehicle::AddComponent(const std::string& component, const bool display_mess
CStreaming::SetModelIsDeletable(icomp); CStreaming::SetModelIsDeletable(icomp);
if (display_message) if (display_message)
SetHelpMessage("Component added", false, false, false); SetHelpMessage("Component added");
} }
catch (...) catch (...)
{ {
@ -228,7 +228,7 @@ void Vehicle::RemoveComponent(const std::string& component, const bool display_m
if (display_message) if (display_message)
{ {
SetHelpMessage("Component removed", false, false, false); SetHelpMessage("Component removed");
} }
} }
catch (...) catch (...)
@ -263,7 +263,7 @@ int Vehicle::GetRandomTrainIdForModel(int model)
_end = 10; _end = 10;
break; break;
default: default:
SetHelpMessage("Invalid train model", false, false, false); SetHelpMessage("Invalid train model");
return -1; return -1;
} }
int id = Random(_start, _end); int id = Random(_start, _end);
@ -1028,7 +1028,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetColor"), ImVec2(Ui::GetSize()))) if (ImGui::Button(TEXT("Vehicle.ResetColor"), ImVec2(Ui::GetSize())))
{ {
Paint::ResetNodeColor(veh, m_Paint::m_Selected); Paint::ResetNodeColor(veh, m_Paint::m_Selected);
SetHelpMessage(TEXT("Vehicle.ResetColorMSG"), false, false, false); SetHelpMessage(TEXT("Vehicle.ResetColorMSG"));
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1098,7 +1098,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.RemoveNeon"), ImVec2(Ui::GetSize()))) if (ImGui::Button(TEXT("Vehicle.RemoveNeon"), ImVec2(Ui::GetSize())))
{ {
Neon::Remove(veh); Neon::Remove(veh);
SetHelpMessage(TEXT("Vehicle.RemoveNeonMSG"), false, false, false); SetHelpMessage(TEXT("Vehicle.RemoveNeonMSG"));
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1160,7 +1160,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetTexture"), ImVec2(Ui::GetSize()))) if (ImGui::Button(TEXT("Vehicle.ResetTexture"), ImVec2(Ui::GetSize())))
{ {
Paint::ResetNodeTexture(veh, m_Paint::m_Selected); Paint::ResetNodeTexture(veh, m_Paint::m_Selected);
SetHelpMessage(TEXT("Vehicle.ResetTextureMSG"), false, false, false); SetHelpMessage(TEXT("Vehicle.ResetTextureMSG"));
} }
ImGui::Spacing(); ImGui::Spacing();
@ -1242,7 +1242,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.ResetHandling"), ImVec2(Ui::GetSize(3)))) if (ImGui::Button(TEXT("Vehicle.ResetHandling"), ImVec2(Ui::GetSize(3))))
{ {
gHandlingDataMgr.LoadHandlingData(); gHandlingDataMgr.LoadHandlingData();
SetHelpMessage(TEXT("Vehicle.ResetHandlingMSG"), false, false, false); SetHelpMessage(TEXT("Vehicle.ResetHandlingMSG"));
} }
ImGui::SameLine(); ImGui::SameLine();
@ -1250,7 +1250,7 @@ void Vehicle::ShowPage()
if (ImGui::Button(TEXT("Vehicle.SaveFile"), ImVec2(Ui::GetSize(3)))) if (ImGui::Button(TEXT("Vehicle.SaveFile"), ImVec2(Ui::GetSize(3))))
{ {
FileHandler::GenerateHandlingFile(pHandlingData, m_VehicleIDE); FileHandler::GenerateHandlingFile(pHandlingData, m_VehicleIDE);
SetHelpMessage(TEXT("Vehicle.SaveFileMSG"), false, false, false); SetHelpMessage(TEXT("Vehicle.SaveFileMSG"));
} }
ImGui::SameLine(); ImGui::SameLine();

View File

@ -2,5 +2,5 @@
#define MENU_NAME "Cheat Menu" #define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "3.2" #define MENU_VERSION_NUMBER "3.2"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta" #define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20220316" #define BUILD_NUMBER "20220317"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION #define MENU_TITLE MENU_NAME " v" MENU_VERSION

View File

@ -625,7 +625,7 @@ void Visual::ShowPage()
if (ImGui::Button(TEXT("Visual.ResetTimecyc"), Ui::GetSize(2))) if (ImGui::Button(TEXT("Visual.ResetTimecyc"), Ui::GetSize(2)))
{ {
CTimeCycle::Initialise(); CTimeCycle::Initialise();
SetHelpMessage(TEXT("Visual.TimecycReset"), false, false, false); SetHelpMessage(TEXT("Visual.TimecycReset"));
} }
ImGui::Spacing(); ImGui::Spacing();