[Patches+TLAC] Force toon (NPR1; option in launcher + press F9 to toggle)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "../../FileSystem/ConfigFile.h"
|
||||
#include "../GameState.h"
|
||||
#include "../Pause.h"
|
||||
#include "../../Utils.h"
|
||||
|
||||
const std::string KEY_CONFIG_FILE_NAME = "keyconfig.ini";
|
||||
|
||||
@@ -344,6 +345,9 @@ namespace TLAC::Components
|
||||
if (keyboard->IsIntervalTapped(VK_SPACE))
|
||||
inputKey = 0x20;
|
||||
|
||||
if (keyboard->IsIntervalTapped(VK_F9))
|
||||
toggleNpr1();
|
||||
|
||||
if (keyboard->IsDoubleTapped(VK_ESCAPE))
|
||||
*(bool*)SHOULD_EXIT_BOOL_ADDRESS = true;
|
||||
|
||||
@@ -435,4 +439,30 @@ namespace TLAC::Components
|
||||
if ((*(unsigned char*)0x14CD93A98) == 0) (*(unsigned char*)0x14CD93A98)++;
|
||||
}
|
||||
}
|
||||
|
||||
void InputEmulator::toggleNpr1()
|
||||
{
|
||||
switch(*(byte*)0x0000000140502FC6)
|
||||
{
|
||||
case 0xC3: // default -> force on
|
||||
InjectCode((void*)0x0000000140502FC0, { 0xC7, 0x05, 0x6E });
|
||||
InjectCode((void*)0x0000000140502FC6, { 0x01, 0x00, 0x00, 0x00, 0xC3 });
|
||||
*(byte*)0x00000001411AD638 = 1;
|
||||
|
||||
printf("[TLAC] NPR1 forced\n");
|
||||
break;
|
||||
case 0x01: // default -> force off
|
||||
InjectCode((void*)0x0000000140502FC0, { 0xC7, 0x05, 0x6E });
|
||||
InjectCode((void*)0x0000000140502FC6, { 0x00, 0x00, 0x00, 0x00, 0xC3 });
|
||||
*(byte*)0x00000001411AD638 = 0;
|
||||
|
||||
printf("[TLAC] NPR1 disabled\n");
|
||||
break;
|
||||
default: // force off -> default
|
||||
InjectCode((void*)0x0000000140502FC0, { 0x89, 0x0D, 0x72 });
|
||||
InjectCode((void*)0x0000000140502FC6, { 0xC3, 0xCC, 0xCC, 0xCC, 0xCC });
|
||||
|
||||
printf("[TLAC] NPR1 restored\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,5 +110,6 @@ namespace TLAC::Components
|
||||
void SetMetaButtons();
|
||||
|
||||
void addCoin();
|
||||
void toggleNpr1();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@
|
||||
<ClInclude Include="Utilities\Stopwatch.h" />
|
||||
<ClInclude Include="Utilities\Vec2.h" />
|
||||
<ClInclude Include="Utilities\Vec3.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Components\CameraController.cpp" />
|
||||
@@ -224,6 +225,7 @@
|
||||
<ClCompile Include="Utilities\Stopwatch.cpp" />
|
||||
<ClCompile Include="Utilities\Vec2.cpp" />
|
||||
<ClCompile Include="Utilities\Vec3.cpp" />
|
||||
<ClCompile Include="Utils.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -213,6 +213,9 @@
|
||||
<ClInclude Include="Input\Bindings\GuBinding.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@@ -362,5 +365,8 @@
|
||||
<ClCompile Include="Input\Bindings\GuBinding.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "Utils.h"
|
||||
#include <Windows.h>
|
||||
|
||||
void InjectCode(void* address, const std::vector<uint8_t> data)
|
||||
{
|
||||
const size_t byteCount = data.size() * sizeof(uint8_t);
|
||||
|
||||
DWORD oldProtect;
|
||||
VirtualProtect(address, byteCount, PAGE_EXECUTE_READWRITE, &oldProtect);
|
||||
memcpy(address, data.data(), byteCount);
|
||||
VirtualProtect(address, byteCount, oldProtect, nullptr);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
void InjectCode(void* address, const std::vector<uint8_t> data);
|
||||
Reference in New Issue
Block a user