From eedd32c8f98a6208b28e68579597bc6743e340a0 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Wed, 14 Feb 2024 13:38:52 -0500 Subject: [PATCH] siva: impl NanoTS_PTool_win8 hook --- sivahook/config.c | 11 +++++++++++ sivahook/config.h | 2 ++ sivahook/dllmain.c | 1 + sivahook/touch.c | 14 ++++++++++++++ sivahook/touch.h | 9 +++++++++ 5 files changed, 37 insertions(+) create mode 100644 sivahook/touch.c create mode 100644 sivahook/touch.h diff --git a/sivahook/config.c b/sivahook/config.c index 9e49872..a2e7e70 100644 --- a/sivahook/config.c +++ b/sivahook/config.c @@ -21,6 +21,16 @@ void siva_dll_config_load( filename); } +void touch_config_load( + struct touch_config *cfg, + const wchar_t *filename) +{ + assert(cfg != NULL); + assert(filename != NULL); + + cfg->enable = GetPrivateProfileIntW(L"touch", L"enable", 1, filename); +} + void siva_hook_config_load( struct siva_hook_config *cfg, const wchar_t *filename) @@ -31,4 +41,5 @@ void siva_hook_config_load( platform_config_load(&cfg->platform, filename); siva_dll_config_load(&cfg->dll, filename); gfx_config_load(&cfg->gfx, filename); + touch_config_load(&cfg->touch, filename); } \ No newline at end of file diff --git a/sivahook/config.h b/sivahook/config.h index 1813ac3..fde5aee 100644 --- a/sivahook/config.h +++ b/sivahook/config.h @@ -3,6 +3,7 @@ #include #include "sivahook/siva-dll.h" +#include "sivahook/touch.h" #include "platform/config.h" #include "gfxhook/config.h" @@ -12,6 +13,7 @@ struct siva_hook_config { struct platform_config platform; struct siva_dll_config dll; struct gfx_config gfx; + struct touch_config touch; }; void siva_hook_config_load( diff --git a/sivahook/dllmain.c b/sivahook/dllmain.c index 8ad1e2e..cd8a2f1 100644 --- a/sivahook/dllmain.c +++ b/sivahook/dllmain.c @@ -12,6 +12,7 @@ #include "sivahook/config.h" #include "sivahook/siva-dll.h" +#include "sivahook/touch.h" #include "sivahook/unity.h" #include "platform/platform.h" diff --git a/sivahook/touch.c b/sivahook/touch.c new file mode 100644 index 0000000..ebee25b --- /dev/null +++ b/sivahook/touch.c @@ -0,0 +1,14 @@ +#include +#include + +#include "sivahook/touch.h" +#include "hooklib/createprocess.h" + +HRESULT touch_hook_init(const struct touch_config *cfg) +{ + if (!cfg->enable) { + return S_FALSE; + } + + return createprocess_push_hook_a("NanoTS_PTool_win8.exe", "inject.exe -d -k sivahook.dll ", NULL, false); +} \ No newline at end of file diff --git a/sivahook/touch.h b/sivahook/touch.h new file mode 100644 index 0000000..8bdac47 --- /dev/null +++ b/sivahook/touch.h @@ -0,0 +1,9 @@ +#pragma once +#include +#include + +struct touch_config { + bool enable; +}; + +HRESULT touch_hook_init(const struct touch_config *cfg); \ No newline at end of file