Skip to content

Commit

Permalink
Added settings and pool patch error message was reversed
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegmd committed Dec 18, 2020
1 parent d756f27 commit d4d4817
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Options::Options(HMODULE aModule)
this->PatchAsyncCompute = config.value("disable_async_compute", this->PatchAsyncCompute);
this->PatchAntialiasing = config.value("disable_antialiasing", this->PatchAntialiasing);
this->DumpGameOptions = config.value("dump_game_options", this->DumpGameOptions);
this->Console = config.value("console", this->Console);
}

nlohmann::json config;
Expand All @@ -68,6 +69,7 @@ Options::Options(HMODULE aModule)
config["disable_async_compute"] = this->PatchAsyncCompute;
config["disable_antialiasing"] = this->PatchAntialiasing;
config["dump_game_options"] = this->DumpGameOptions;
config["console"] = this->Console;

std::ofstream o(configPath);
o << config.dump(4) << std::endl;
Expand Down
1 change: 1 addition & 0 deletions src/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct Options
bool PatchAntialiasing{ false };
bool PatchSkipStartMenu{ true };
bool DumpGameOptions{ false };
bool Console{ true };
float CPUMemoryPoolFraction{ 0.5f };
float GPUMemoryPoolFraction{ 1.f };
std::filesystem::path Path;
Expand Down
24 changes: 14 additions & 10 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,24 @@ void Initialize(HMODULE mod)
if (options.DumpGameOptions)
OptionsInitPatch(&image);

Overlay::Initialize(&image);
if(options.Console)
Overlay::Initialize(&image);

MH_EnableHook(MH_ALL_HOOKS);

std::thread t([]()
{
if (kiero::init(kiero::RenderType::D3D12) != kiero::Status::Success)
if (options.Console)
{
std::thread t([]()
{
spdlog::error("Kiero failed!");
}
else
Overlay::Get().Hook();
});
t.detach();
if (kiero::init(kiero::RenderType::D3D12) != kiero::Status::Success)
{
spdlog::error("Kiero failed!");
}
else
Overlay::Get().Hook();
});
t.detach();
}

spdlog::default_logger()->flush();
}
Expand Down
2 changes: 1 addition & 1 deletion src/pool_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void PoolPatch(Image* apImage)
if (RealRegisterPoolOptions)
{
const auto result = MH_CreateHook(RealRegisterPoolOptions, &RegisterPoolOptions, reinterpret_cast<void**>(&RealRegisterPoolOptions));
spdlog::info("\tPool patch: {}", result ? "success":"error");
spdlog::info("\tPool patch: {}", result == MH_OK ? "success":"error");
}
else
spdlog::info("\tPool patch: failed");
Expand Down

0 comments on commit d4d4817

Please sign in to comment.