From 257afe0cd36a1a6269e06bf86c20dd7d8ff84bd6 Mon Sep 17 00:00:00 2001 From: bicarus-dev <202771338+bicarus-dev@users.noreply.github.com> Date: Fri, 9 May 2025 09:47:38 -0700 Subject: [PATCH] loveplus: remove log spam (#326) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Link to GitHub Issue, if one exists n/a ## Description of change Remove spammy logging in LP ## Testing It works 👍 --- src/spice2x/games/loveplus/loveplus.cpp | 17 +++++++++++++++++ src/spice2x/games/loveplus/loveplus.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/spice2x/games/loveplus/loveplus.cpp b/src/spice2x/games/loveplus/loveplus.cpp index c8d30e7..20021dd 100644 --- a/src/spice2x/games/loveplus/loveplus.cpp +++ b/src/spice2x/games/loveplus/loveplus.cpp @@ -123,7 +123,23 @@ namespace games::loveplus { return lp_args.data(); } + static bool lp_spam_remover(void *user, const std::string &data, logger::Style style, std::string &out) { + if (data.empty() || data[0] != '[') { + return false; + } + if (data.find("> [INFO] err_code: 0, err_title: , err_str:") != std::string::npos) { + out = ""; + return true; + } + return false; + } + LovePlusGame::LovePlusGame() : Game("LovePlus") { + logger::hook_add(lp_spam_remover, nullptr); + } + + LovePlusGame::~LovePlusGame() { + logger::hook_remove(lp_spam_remover, this); } void LovePlusGame::attach() { @@ -168,6 +184,7 @@ namespace games::loveplus { // get command line hook HMODULE lpac = libutils::try_library("lpac.dll"); detour::iat("GetCommandLineA", GetCommandLineA_hook, lpac); + } void LovePlusGame::detach() { diff --git a/src/spice2x/games/loveplus/loveplus.h b/src/spice2x/games/loveplus/loveplus.h index c4ab927..7377f06 100644 --- a/src/spice2x/games/loveplus/loveplus.h +++ b/src/spice2x/games/loveplus/loveplus.h @@ -12,6 +12,7 @@ namespace games::loveplus { class LovePlusGame : public games::Game { public: LovePlusGame(); + virtual ~LovePlusGame() override; virtual void attach() override; virtual void detach() override; };