mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 12:07:46 +08:00
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
This commit is contained in:
parent
f1f5d4f6c0
commit
346960b012
BIN
BigBaseV2.lnk
BIN
BigBaseV2.lnk
Binary file not shown.
BIN
YimMenu.lnk
Normal file
BIN
YimMenu.lnk
Normal file
Binary file not shown.
@ -54,7 +54,7 @@
|
||||
|
||||
#include "logger/logger.hpp"
|
||||
|
||||
#include "core/globals.hpp"
|
||||
#include "core/settings.hpp"
|
||||
#include "gta/natives.hpp"
|
||||
#include "ped/CPed.hpp"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "globals.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
#include "thread_pool.hpp"
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "core/data/admin_rids.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "hooking.hpp"
|
||||
|
12
src/main.cpp
12
src/main.cpp
@ -1,7 +1,6 @@
|
||||
#include "backend/backend.hpp"
|
||||
#include "byte_patch_manager.hpp"
|
||||
#include "common.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "hooking.hpp"
|
||||
@ -33,6 +32,7 @@
|
||||
#include "services/vehicle/handling_service.hpp"
|
||||
#include "services/vehicle/vehicle_control_service.hpp"
|
||||
#include "thread_pool.hpp"
|
||||
#include "util/migrate.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
@ -52,7 +52,8 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
std::this_thread::sleep_for(100ms);
|
||||
|
||||
std::filesystem::path base_dir = std::getenv("appdata");
|
||||
base_dir /= "BigBaseV2";
|
||||
base_dir /= "YimMenu";
|
||||
do_migration(base_dir);
|
||||
auto file_manager_instance = std::make_unique<file_manager>(base_dir);
|
||||
|
||||
auto logger_instance = std::make_unique<logger>("YimMenu", file_manager_instance->get_project_file("./cout.log"));
|
||||
@ -61,8 +62,6 @@ 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);
|
||||
|
||||
@ -221,11 +220,6 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID)
|
||||
|
||||
thread_pool_instance.reset();
|
||||
LOG(INFO) << "Thread pool uninitialized.";
|
||||
}
|
||||
catch (std::exception const& ex)
|
||||
{
|
||||
LOG(WARNING) << ex.what();
|
||||
}
|
||||
|
||||
LOG(INFO) << "Farewell!";
|
||||
logger_instance->destroy();
|
||||
|
@ -116,7 +116,7 @@ namespace big
|
||||
call(thread, gta_util::find_script_program(m_script), args);
|
||||
|
||||
delete[] stack;
|
||||
delete[](uint8_t*) thread; // without the cast it ends up calling the destructor which leads to some pretty funny crashes
|
||||
delete[] (uint8_t*)thread; // without the cast it ends up calling the destructor which leads to some pretty funny crashes
|
||||
}
|
||||
|
||||
void script_function::operator()(std::initializer_list<std::uint64_t> args)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "orbital_drone.hpp"
|
||||
|
||||
#include "backend/bool_command.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
17
src/util/migrate.hpp
Normal file
17
src/util/migrate.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <filesystem>
|
||||
|
||||
namespace big
|
||||
{
|
||||
void do_migration(const std::filesystem::path& current_dir)
|
||||
{
|
||||
std::filesystem::path old_dir = std::getenv("appdata");
|
||||
old_dir /= "BigBaseV2";
|
||||
|
||||
if (exists(old_dir) && !exists(current_dir))
|
||||
{
|
||||
LOG(INFO) << "YimMenu folder does not exist, migrating to new folder.";
|
||||
std::filesystem::copy(old_dir, current_dir, std::filesystem::copy_options::recursive);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user