From 346960b012e0897d17de2a5008d7a8e33f7acd81 Mon Sep 17 00:00:00 2001 From: Andreas Maerten <24669514+Yimura@users.noreply.github.com> Date: Sun, 2 Jul 2023 00:52:36 +0200 Subject: [PATCH] refactor!: General changes (#1578) - Removed try catch from main.cpp for better error logging - Added migration code to the YimMenu folder - Renamed globals to settings - refactor!: changed symlink --- BigBaseV2.lnk | Bin 2091 -> 0 bytes YimMenu.lnk | Bin 0 -> 2094 bytes src/byte_patch_manager.hpp | 8 +- src/common.hpp | 2 +- src/core/{globals.cpp => settings.cpp} | 2 +- src/core/{globals.hpp => settings.hpp} | 0 .../assign_physical_index.cpp | 1 - src/main.cpp | 266 +++++++++--------- src/script_function.cpp | 2 +- src/services/orbital_drone/orbital_drone.cpp | 1 - src/util/migrate.hpp | 17 ++ 11 files changed, 154 insertions(+), 145 deletions(-) delete mode 100644 BigBaseV2.lnk create mode 100644 YimMenu.lnk rename src/core/{globals.cpp => settings.cpp} (98%) rename src/core/{globals.hpp => settings.hpp} (100%) create mode 100644 src/util/migrate.hpp diff --git a/BigBaseV2.lnk b/BigBaseV2.lnk deleted file mode 100644 index 0a51d5fb059a3f0b3f4d826b5609ca6f19adf112..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2091 zcmd^AZAepL6h2d)QBHZ>&o(Y8P|wzdo|<*nT<)9LMQP(S*hegszg z)5pxj68exJp`bF%!hVc?6@5UF1VI!S(T5;W5!G{UYoh(Ae*2E+yyu?tzRx-Dx$n-c zA|j104U(u|mE=5}Hi@**S9dq|oZRzN^YC)_vNp^=bgwgcR-N!`eyvYQSyN7V4p&b4 zMrC!Eqb1=x@x8(LJ|FAy>BDViw66KKxiI=vGvQi#r2?iEtvmf3K}QEDO1WfrdY##1 zQW*z5{ikM-RhAuMRD>m(vvE`W#bb9YG~3+wzMwa8@9T>*A-}c7mAKo`e|=viWl{#> z40>*~4SR}?8nCBYWtyeR5fQh<$VxJP4iXWU*=^)c#vS%Ni)+c#EQafwLN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z8zBLLb9d6W)ST<(O@e#ScHY* z3Jb{!i{a5W#Gxc%4ZX5%!m5mgRj~#j3`E$f5Uth%d`89M6#|E~zC?kS!Edf$;ms*f z-<4l>9TsJMJpn1(9Q@7Q@t-(}RaDmDtZCK2gqmv7I=_zkx7&^3*{~Pz&QM@0u(GLy zQ6#A;0goq}>}Ux#XaP^kfJ5xzg56u_8J)fiLPmfbS{Ndja(PVzXfw=Jw zzHm2?g>DiB>;?8nvl!@oSVu$004mJb$Fq2fqgeQ2F|sup^BDM4k~JQF6|7OvD(FSI zgb4?uaw>Xf(}I0&I9>AVT0V6tVE5on91KrV(ELo$qLi&3#6+6_ZvcH1GS}MMR5>Q& zM3>Uoh=m3xOHq+9GNLV)qCQ-$`O{t)rPIFx-n%#BG_R`wj;W*gL}X&)OW*siX)t3v zXw(4v7T&-y@iqTb|G!)0S{X4rp;Yq$^vKPrcj~R$PHmF1J@ItiX4ngPgBCDe{XF6H zxRr9R_noqBr>vUoEcpQ1ZEFrMAa?ZJ!Xg_7FNw#C%(base_dir); auto logger_instance = std::make_unique("YimMenu", file_manager_instance->get_project_file("./cout.log")); @@ -61,171 +62,164 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) std::srand(std::chrono::system_clock::now().time_since_epoch().count()); - try - { - LOG(INFO) << "Yim's Menu Initializing"; - LOGF(INFO, "Git Info\n\tBranch:\t{}\n\tHash:\t{}\n\tDate:\t{}", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE); + LOG(INFO) << "Yim's Menu Initializing"; + LOGF(INFO, "Git Info\n\tBranch:\t{}\n\tHash:\t{}\n\tDate:\t{}", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE); - auto thread_pool_instance = std::make_unique(); - LOG(INFO) << "Thread pool initialized."; + auto thread_pool_instance = std::make_unique(); + LOG(INFO) << "Thread pool initialized."; - g.init(file_manager_instance->get_project_file("./settings.json")); - LOG(INFO) << "Settings Loaded."; + g.init(file_manager_instance->get_project_file("./settings.json")); + LOG(INFO) << "Settings Loaded."; - auto pointers_instance = std::make_unique(); - LOG(INFO) << "Pointers initialized."; + auto pointers_instance = std::make_unique(); + LOG(INFO) << "Pointers initialized."; - auto byte_patch_manager_instance = std::make_unique(); - LOG(INFO) << "Byte Patch Manager initialized."; + auto byte_patch_manager_instance = std::make_unique(); + LOG(INFO) << "Byte Patch Manager initialized."; - auto renderer_instance = std::make_unique(); - LOG(INFO) << "Renderer initialized."; - auto gui_instance = std::make_unique(); + auto renderer_instance = std::make_unique(); + LOG(INFO) << "Renderer initialized."; + auto gui_instance = std::make_unique(); - auto fiber_pool_instance = std::make_unique(11); - LOG(INFO) << "Fiber pool initialized."; + auto fiber_pool_instance = std::make_unique(11); + LOG(INFO) << "Fiber pool initialized."; - g_translation_service.init(); - LOG(INFO) << "Translation Service initialized."; + g_translation_service.init(); + LOG(INFO) << "Translation Service initialized."; - auto hooking_instance = std::make_unique(); - LOG(INFO) << "Hooking initialized."; + auto hooking_instance = std::make_unique(); + LOG(INFO) << "Hooking initialized."; - auto context_menu_service_instance = std::make_unique(); - auto custom_text_service_instance = std::make_unique(); - auto globals_service_instace = std::make_unique(); - auto mobile_service_instance = std::make_unique(); - auto notification_service_instance = std::make_unique(); - auto pickup_service_instance = std::make_unique(); - auto player_service_instance = std::make_unique(); - auto gta_data_service_instance = std::make_unique(); - auto model_preview_service_instance = std::make_unique(); - auto handling_service_instance = std::make_unique(); - auto gui_service_instance = std::make_unique(); - auto script_patcher_service_instance = std::make_unique(); - auto player_database_service_instance = std::make_unique(); - auto hotkey_service_instance = std::make_unique(); - auto matchmaking_service_instance = std::make_unique(); - auto api_service_instance = std::make_unique(); - auto tunables_service_instance = std::make_unique(); - auto script_connection_service_instance = std::make_unique(); - LOG(INFO) << "Registered service instances..."; + auto context_menu_service_instance = std::make_unique(); + auto custom_text_service_instance = std::make_unique(); + auto globals_service_instace = std::make_unique(); + auto mobile_service_instance = std::make_unique(); + auto notification_service_instance = std::make_unique(); + auto pickup_service_instance = std::make_unique(); + auto player_service_instance = std::make_unique(); + auto gta_data_service_instance = std::make_unique(); + auto model_preview_service_instance = std::make_unique(); + auto handling_service_instance = std::make_unique(); + auto gui_service_instance = std::make_unique(); + auto script_patcher_service_instance = std::make_unique(); + auto player_database_service_instance = std::make_unique(); + auto hotkey_service_instance = std::make_unique(); + auto matchmaking_service_instance = std::make_unique(); + auto api_service_instance = std::make_unique(); + auto tunables_service_instance = std::make_unique(); + auto script_connection_service_instance = std::make_unique(); + LOG(INFO) << "Registered service instances..."; - g_script_mgr.add_script(std::make_unique