diff --git a/.gitignore b/.gitignore index 9548027..f111530 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ archives/ build/ tools/pack/ +archive/ .gitignore CheatMenuVC.7z CheatMenuIII.7z diff --git a/resource/common/fonts/text.ttf b/resource/common/fonts/text.ttf deleted file mode 100644 index 6a25d04..0000000 Binary files a/resource/common/fonts/text.ttf and /dev/null differ diff --git a/src/d3dhook.cpp b/src/d3dhook.cpp index 54ec201..1b94ba6 100644 --- a/src/d3dhook.cpp +++ b/src/d3dhook.cpp @@ -139,8 +139,8 @@ void D3dHook::ProcessFrame(void* ptr) ImGui_ImplWin32_EnableDpiAwareness(); // Loading fonts - io.FontDefault = FontMgr::Load("text", 1.1f); - FontMgr::Load("title", 2.0f); + io.FontDefault = FontMgr::Load("text", "C:/Windows/Fonts/ARIALUNI.TTF", 1.15f); + FontMgr::Load("title", PLUGIN_PATH((char*)FILE_NAME "/fonts/title.ttf"), 2.0f); io.IniFilename = nullptr; io.LogFilename = nullptr; diff --git a/src/defines.h b/src/defines.h index 0604bce..1b279ce 100644 --- a/src/defines.h +++ b/src/defines.h @@ -9,7 +9,7 @@ #define MENU_NAME "Cheat Menu" #define MENU_VERSION_NUMBER "3.3" #define MENU_VERSION MENU_VERSION_NUMBER"-beta" -#define BUILD_NUMBER "20220618" +#define BUILD_NUMBER "20220620" #define MENU_TITLE MENU_NAME " v" MENU_VERSION #ifdef GTASA diff --git a/src/fontmgr.cpp b/src/fontmgr.cpp index 52290a9..e5c8fc4 100644 --- a/src/fontmgr.cpp +++ b/src/fontmgr.cpp @@ -1,11 +1,11 @@ #include "fontmgr.h" #include "pch.h" -ImFont* FontMgr::Get(const char* fontName) +ImFont* FontMgr::Get(const char* fontID) { for (auto &data : m_vecFonts) { - if (!strcmp(data.m_path.c_str(), fontName)) + if (!strcmp(data.m_ID.c_str(), fontID)) { return data.m_pFont; } @@ -39,16 +39,14 @@ const ImWchar* FontMgr::GetGlyphRanges() return &ranges[0]; } -ImFont* FontMgr::Load(const char* fontName, float fontMul) +ImFont* FontMgr::Load(const char* fontID, const char* path, float fontMul) { ImGuiIO& io = ImGui::GetIO(); size_t fontSize = static_cast(screen::GetScreenHeight() / 54.85f) * fontMul; - std::string fullPath = std::format("{}{}.ttf", PLUGIN_PATH((char*)FILE_NAME "/fonts/"), fontName); - ImFont *pFont = io.Fonts->AddFontFromFileTTF(fullPath.c_str(), fontSize, NULL, GetGlyphRanges()); + ImFont *pFont = io.Fonts->AddFontFromFileTTF(path, fontSize, NULL, GetGlyphRanges()); - m_vecFonts.push_back({pFont, fontSize, fontMul, std::string(fontName)}); + m_vecFonts.push_back({pFont, fontSize, fontMul, std::string(fontID), std::string(path)}); io.Fonts->Build(); - return pFont; } @@ -65,8 +63,7 @@ void FontMgr::ReloadAll() for (auto &data : m_vecFonts) { size_t fontSize = static_cast(screen::GetScreenHeight() / 54.85f) * data.m_fMul; - std::string fullPath = PLUGIN_PATH((char*)FILE_NAME "/fonts/") + data.m_path + ".ttf"; - data.m_pFont = io.Fonts->AddFontFromFileTTF(fullPath.c_str(), data.m_nSize, NULL, GetGlyphRanges()); + data.m_pFont = io.Fonts->AddFontFromFileTTF(data.m_path.c_str(), data.m_nSize, NULL, GetGlyphRanges()); } io.FontDefault = Get("text"); io.Fonts->Build(); diff --git a/src/fontmgr.h b/src/fontmgr.h index 0e776ef..5ce4ada 100644 --- a/src/fontmgr.h +++ b/src/fontmgr.h @@ -12,6 +12,7 @@ private: ImFont *m_pFont; size_t m_nSize; float m_fMul; + std::string m_ID; std::string m_path; }; static inline std::vector m_vecFonts; @@ -21,10 +22,10 @@ public: FontMgr(FontMgr&) = delete; // Returns font pointer from name - static ImFont* Get(const char* fontName); + static ImFont* Get(const char* fontID); // Loads a font into memory - static ImFont* Load(const char* fontName, float fontMul = 1.0f); + static ImFont* Load(const char* fontID, const char* path = 0, float fontMul = 1.0f); // Get the glyph ranges for our needed fonts static const ImWchar* GetGlyphRanges(); diff --git a/tools/PackAll.bat b/tools/PackAll.bat index 3ebc755..b1d6836 100644 --- a/tools/PackAll.bat +++ b/tools/PackAll.bat @@ -39,6 +39,6 @@ xcopy /s %folderpath% "pack\%~1\" /K /D /H /Y xcopy /s "..\resource\common\" "pack\%~1\" /K /D /H /Y @REM Guessing we have 7zip installed already, well I have -"C:\Program Files\7-Zip\7z.exe" a -t7z %archivePath% ".\pack\*" +"C:\Program Files\7-Zip\7z.exe" a -t7z %archivePath% ".\pack\*" -mx=9 -v7M @REM ------------------------------------------------------