From 3b377ba45b6cb60627f3f3718286f12fcc8cbb5c Mon Sep 17 00:00:00 2001 From: GEEKiDoS Date: Wed, 18 Dec 2024 22:17:10 +0800 Subject: [PATCH] fix game start --- src/client/loader/loader.cpp | 2 +- src/client/loader/loader.hpp | 2 +- src/client/main.cpp | 19 +++---------------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/client/loader/loader.cpp b/src/client/loader/loader.cpp index c35ca76..c8cab04 100644 --- a/src/client/loader/loader.cpp +++ b/src/client/loader/loader.cpp @@ -6,7 +6,7 @@ #include #include -utils::nt::library loader::load_library(const std::string& filename) const +utils::nt::library loader::load_library(const std::wstring& filename) const { const auto target = utils::nt::library::load(filename); if (!target) diff --git a/src/client/loader/loader.hpp b/src/client/loader/loader.hpp index d22f992..1f62be4 100644 --- a/src/client/loader/loader.hpp +++ b/src/client/loader/loader.hpp @@ -4,7 +4,7 @@ class loader final { public: - utils::nt::library load_library(const std::string& filename) const; + utils::nt::library load_library(const std::wstring& filename) const; void set_import_resolver(const std::function& resolver); diff --git a/src/client/main.cpp b/src/client/main.cpp index 0fd8c0f..d12a6a9 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -92,21 +92,8 @@ FARPROC load_binary(const launcher::game game) return component_loader::load_import(library, function); }); - std::string binary; - switch (game) - { - case launcher::game::iidx: - binary = "bm2dx.exe"; - break; - case launcher::game::sdvx: - binary = "sv6c.exe"; - break; - case launcher::game::gitadora: - binary = "gitadora.exe"; - break; - default: - throw std::runtime_error("Unsupported game!"); - } + std::wstring binary = game::environment::gamemeta::get_gamemeta(game) + .get_game_module_path(); auto mod = loader.load_library(binary); game::environment::set_module(mod); @@ -126,7 +113,7 @@ bool try_set_game_environment(launcher::game game) auto modules_path = game_path / (game == launcher::game::iidx ? "app" : "modules"); SetCurrentDirectoryW(game_path.wstring().data()); - AddDllDirectory(modules_path.wstring().data()); + SetDllDirectoryW(modules_path.wstring().data()); return true; }