From f62c8c875e5002286ccf252be3379aebd5f6c021 Mon Sep 17 00:00:00 2001 From: Andreas Maerten <24669514+Yimura@users.noreply.github.com> Date: Tue, 23 Jul 2024 08:47:38 +0200 Subject: [PATCH] fix(FontMgr): also keep in mind game language when generating font texture (#2892) --- .gitattributes | 2 + src/core/data/language_codes.hpp | 37 ++- src/core/settings.hpp | 5 +- src/gta/enums.hpp | 44 +++- src/gta_pointers.hpp | 3 +- src/lua/bindings/network.cpp | 32 +-- src/pointers.cpp | 2 +- src/renderer/font_mgr.cpp | 123 +++++----- src/renderer/font_mgr.hpp | 16 +- .../matchmaking/matchmaking_service.cpp | 19 +- .../translation_service.cpp | 26 +- src/views/network/view_session_browser.cpp | 49 ++-- src/views/network/view_spoofing.cpp | 8 +- src/views/players/player/player_info.cpp | 231 ++++++++++-------- src/views/settings/view_settings.cpp | 10 +- 15 files changed, 333 insertions(+), 274 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..acc01d8b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Ignore all differences in line endings +* -crlf diff --git a/src/core/data/language_codes.hpp b/src/core/data/language_codes.hpp index 5b7ec67d..81bd3268 100644 --- a/src/core/data/language_codes.hpp +++ b/src/core/data/language_codes.hpp @@ -1,26 +1,21 @@ #pragma once +#include "gta/enums.hpp" namespace big { - struct LanguageType - { - uint32_t id; - const char name[32]; + const std::map languages = { + {eGameLanguage::ENGLISH, "English"}, + {eGameLanguage::FRENCH, "French"}, + {eGameLanguage::GERMAN, "German"}, + {eGameLanguage::ITALIAN, "Italian"}, + {eGameLanguage::SPANISH, "Spanish (Spain)"}, + {eGameLanguage::BRAZILIAN_PORTUGUESE, "Portuguese (Brazil)"}, + {eGameLanguage::POLISH, "Polish"}, + {eGameLanguage::RUSSIAN, "Russian"}, + {eGameLanguage::KOREAN, "Korean"}, + {eGameLanguage::TRADITIONAL_CHINESE, "Chinese (Traditional)"}, + {eGameLanguage::JAPANESE, "Japanese"}, + {eGameLanguage::MEXICAN_SPANISH, "Spanish (Mexico)"}, + {eGameLanguage::SIMPLIFIED_CHINESE, "Chinese (Simpified)"}, }; - - const LanguageType languages[] = { - {0, "English"}, - {1, "French"}, - {2, "German"}, - {3, "Italian"}, - {4, "Spanish (Spain)"}, - {5, "Portuguese (Brazil)"}, - {6, "Polish"}, - {7, "Russian"}, - {8, "Korean"}, - {9, "Chinese (Traditional)"}, - {10, "Japanese"}, - {11, "Spanish (Mexico)"}, - {12, "Chinese (Simpified)"}, - }; -} \ No newline at end of file +} diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 99fab3b3..bcfcabc4 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -2,6 +2,7 @@ #include "backend/reactions/interloper_reaction.hpp" #include "backend/reactions/reaction.hpp" #include "core/data/hud_colors.hpp" +#include "core/data/language_codes.hpp" #include "core/data/ptfx_effects.hpp" #include "enums.hpp" #include "file_manager.hpp" @@ -723,7 +724,7 @@ namespace big bool spoof_session_region_type = false; int session_region_type = 0; bool spoof_session_language = false; - int session_language = 0; + eGameLanguage session_language = eGameLanguage::ENGLISH; bool spoof_session_player_count = false; int session_player_count = 25; int spoof_session_bad_sport_status = 0; @@ -1053,7 +1054,7 @@ namespace big int region_filter = 0; bool language_filter_enabled = false; - int language_filter = 0; + eGameLanguage language_filter = eGameLanguage::ENGLISH; bool pool_filter_enabled = false; int pool_filter = 0; diff --git a/src/gta/enums.hpp b/src/gta/enums.hpp index 9b20cf10..84c4497f 100644 --- a/src/gta/enums.hpp +++ b/src/gta/enums.hpp @@ -3,6 +3,24 @@ constexpr auto MAX_PLAYERS = 32; +enum class eGameLanguage : int +{ + ENGLISH, + FRENCH, + GERMAN, + ITALIAN, + SPANISH, + BRAZILIAN_PORTUGUESE, + POLISH, + RUSSIAN, + KOREAN, + TRADITIONAL_CHINESE, + JAPANESE, + MEXICAN_SPANISH, + SIMPLIFIED_CHINESE +}; +NLOHMANN_JSON_SERIALIZE_ENUM(eGameLanguage, {{eGameLanguage::ENGLISH, "english"}, {eGameLanguage::FRENCH, "french"}, {eGameLanguage::GERMAN, "german"}, {eGameLanguage::ITALIAN, "italian"}, {eGameLanguage::SPANISH, "spanish"}, {eGameLanguage::BRAZILIAN_PORTUGUESE, "brazilian_portuguese"}, {eGameLanguage::POLISH, "polish"}, {eGameLanguage::RUSSIAN, "russian"}, {eGameLanguage::KOREAN, "korean"}, {eGameLanguage::TRADITIONAL_CHINESE, "traditional_chinese"}, {eGameLanguage::JAPANESE, "japanese"}, {eGameLanguage::MEXICAN_SPANISH, "mexican_spanish"}, {eGameLanguage::SIMPLIFIED_CHINESE, "simplified_chinese"}}) + enum class ControllerInputs : uint32_t { INPUT_NEXT_CAMERA, @@ -1976,18 +1994,18 @@ enum class eTaskTypeIndex enum class eTaskFlags { ParachuteWhenCoordThresholdIsReached = 1 << 3, - CamShakeOnFall = 1 << 4, - PlayRagdollAnim = 1 << 5, - PlayDiveAnim = 1 << 7, - NoFallAnimation = 1 << 10, - NoSlowFall = 1 << 11, - Unk12 = 1 << 12, - SuperJump = 1 << 15, - LandOnJump = 1 << 16, - BeastJump = 1 << 17, - BeastJumpWithSuper = SuperJump | BeastJump, - GracefulLanding = NoFallAnimation | NoSlowFall | Unk12 | LandOnJump, - RagdollOnFall = BeastJump | PlayRagdollAnim + CamShakeOnFall = 1 << 4, + PlayRagdollAnim = 1 << 5, + PlayDiveAnim = 1 << 7, + NoFallAnimation = 1 << 10, + NoSlowFall = 1 << 11, + Unk12 = 1 << 12, + SuperJump = 1 << 15, + LandOnJump = 1 << 16, + BeastJump = 1 << 17, + BeastJumpWithSuper = SuperJump | BeastJump, + GracefulLanding = NoFallAnimation | NoSlowFall | Unk12 | LandOnJump, + RagdollOnFall = BeastJump | PlayRagdollAnim }; enum class eDoorId @@ -2121,4 +2139,4 @@ enum PedRelationships : int Wanted, Hate, Indifferent = 255 -}; \ No newline at end of file +}; diff --git a/src/gta_pointers.hpp b/src/gta_pointers.hpp index b5c8d290..b4637839 100644 --- a/src/gta_pointers.hpp +++ b/src/gta_pointers.hpp @@ -1,5 +1,6 @@ #pragma once #include "function_types.hpp" +#include "gta/enums.hpp" #include @@ -284,7 +285,7 @@ namespace big functions::handle_chat_message m_handle_chat_message; - int* m_language; + eGameLanguage* m_language; functions::update_language m_update_language; PVOID m_model_spawn_bypass; diff --git a/src/lua/bindings/network.cpp b/src/lua/bindings/network.cpp index 01a80a9c..3fb81669 100644 --- a/src/lua/bindings/network.cpp +++ b/src/lua/bindings/network.cpp @@ -12,6 +12,7 @@ #include "util/session.hpp" #include "util/system.hpp" #include "util/teleport.hpp" + #include