Sprite Draw Limit release
This commit is contained in:
@@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AFTModsShared", "src\AFTMod
|
||||
{65707AD3-568A-4FE9-A75E-BDBF3D5EFC88} = {65707AD3-568A-4FE9-A75E-BDBF3D5EFC88}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpriteDrawLimit", "src\SpriteDrawLimit\SpriteDrawLimit.vcxproj", "{87D41F20-B8C6-43BB-A89D-3A1979928613}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -33,6 +35,10 @@ Global
|
||||
{BCF448EA-DCFF-49AF-97FF-361204C69358}.Debug|x64.Build.0 = Debug|x64
|
||||
{BCF448EA-DCFF-49AF-97FF-361204C69358}.Release|x64.ActiveCfg = Release|x64
|
||||
{BCF448EA-DCFF-49AF-97FF-361204C69358}.Release|x64.Build.0 = Release|x64
|
||||
{87D41F20-B8C6-43BB-A89D-3A1979928613}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{87D41F20-B8C6-43BB-A89D-3A1979928613}.Debug|x64.Build.0 = Debug|x64
|
||||
{87D41F20-B8C6-43BB-A89D-3A1979928613}.Release|x64.ActiveCfg = Release|x64
|
||||
{87D41F20-B8C6-43BB-A89D-3A1979928613}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "winres.h"
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,1,0,0
|
||||
PRODUCTVERSION 0,1,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x0L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000904b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "Sprite Draw Limit plugin for PDAFT 7.10"
|
||||
VALUE "FileVersion", "0.1.0.0"
|
||||
VALUE "InternalName", "SpriteDrawLimit"
|
||||
VALUE "LegalCopyright", "korenkonder (C) 2024"
|
||||
VALUE "OriginalFilename", "SpriteDrawLimit.dll"
|
||||
VALUE "ProductName", "SpriteDrawLimit"
|
||||
VALUE "ProductVersion", "0.1.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x9, 1200
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{87d41f20-b8c6-43bb-a89d-3a1979928613}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>SpriteDrawLimit</TargetName>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\debug\SpriteDrawLimit\</IntDir>
|
||||
<TargetExt>.dva</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>SpriteDrawLimit</TargetName>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\release\SpriteDrawLimit\</IntDir>
|
||||
<TargetExt>.dva</TargetExt>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)extern\src</AdditionalIncludeDirectories>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<CallingConvention>FastCall</CallingConvention>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<ObjectFileName>$(IntDir)/%(RelativeDir)</ObjectFileName>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<UseFullPaths>false</UseFullPaths>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)extern\lib;$(SolutionDir)lib\debugopt\</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>detours.lib;syelog.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4098 /ignore:4099 /ignore:4286 %(AdditionalOptions)</AdditionalOptions>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)extern\src</AdditionalIncludeDirectories>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<CallingConvention>FastCall</CallingConvention>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
<FunctionLevelLinking>
|
||||
</FunctionLevelLinking>
|
||||
<ObjectFileName>$(IntDir)/%(RelativeDir)</ObjectFileName>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<RuntimeTypeInfo>
|
||||
</RuntimeTypeInfo>
|
||||
<UseFullPaths>false</UseFullPaths>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>26812</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)extern\lib;$(SolutionDir)lib\release\</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>detours.lib;syelog.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalOptions>/ignore:4098 /ignore:4099 /ignore:4286 %(AdditionalOptions)</AdditionalOptions>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="SpriteDrawLimit.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="sprite.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="sprite.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="common.asm" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,148 @@
|
||||
EXTERN ?originalspr__calc_sprite_texture_param_mid1@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__calc_sprite_texture_param_mid2@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_scale_mid@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_vertex_array_pos@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_vertex_array_uv@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_vertex_array_color@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_kind_arrow_b@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_kind_arrow_ab@@3P6AXXZEA : QWORD
|
||||
EXTERN ?originalspr__draw_sprite_mid_spr_kind_triangle@@3P6AXXZEA : QWORD
|
||||
|
||||
EXTERN ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA : QWORD
|
||||
|
||||
.CODE
|
||||
?implOfspr__calc_sprite_texture_param_mid1@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov rax, [rbx+0B0h]
|
||||
lea rdx, [rax+rax*2]
|
||||
mov rax, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rax+8]
|
||||
lea rax, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__calc_sprite_texture_param_mid1@@3P6AXXZEA
|
||||
?implOfspr__calc_sprite_texture_param_mid1@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__calc_sprite_texture_param_mid2@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov rax, [rbx+0B0h]
|
||||
lea rdx, [rax+rax*2]
|
||||
mov rax, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rax+8]
|
||||
lea rax, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__calc_sprite_texture_param_mid2@@3P6AXXZEA
|
||||
?implOfspr__calc_sprite_texture_param_mid2@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_scale_mid@@YAXXZ PROC PUBLIC
|
||||
push rax
|
||||
push rdx
|
||||
|
||||
mov rax, [rbx+0B0h]
|
||||
lea rdx, [rax+rax*2]
|
||||
mov rax, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rax+8]
|
||||
lea rcx, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rax
|
||||
jmp ?originalspr__draw_sprite_scale_mid@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_scale_mid@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_pos@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov r9, [rbx+0B0h]
|
||||
lea rdx, [r9+r9*2]
|
||||
mov r9, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [r9+8]
|
||||
lea r9, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_vertex_array_pos@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_pos@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_uv@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov r9, [rbx+0B0h]
|
||||
lea rdx, [r9+r9*2]
|
||||
mov r9, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [r9+8]
|
||||
lea r9, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_vertex_array_uv@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_uv@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_color@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov r9, [rbx+0B0h]
|
||||
lea rdx, [r9+r9*2]
|
||||
mov r9, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [r9+8]
|
||||
lea r9, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_vertex_array_color@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_vertex_array_color@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_kind_arrow_b@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov rbx, [rbx+0B0h]
|
||||
lea rdx, [rbx+rbx*2]
|
||||
mov rbx, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rbx+8]
|
||||
lea rbx, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_kind_arrow_b@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_kind_arrow_b@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_kind_arrow_ab@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov rbx, [rbx+0B0h]
|
||||
lea rdx, [rbx+rbx*2]
|
||||
mov rbx, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rbx+8]
|
||||
lea rbx, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_kind_arrow_ab@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_kind_arrow_ab@@YAXXZ ENDP
|
||||
|
||||
?implOfspr__draw_sprite_mid_spr_kind_triangle@@YAXXZ PROC PUBLIC
|
||||
push rcx
|
||||
push rdx
|
||||
|
||||
mov rbx, [rbx+0B0h]
|
||||
lea rdx, [rbx+rbx*2]
|
||||
mov rbx, ?sprite_vertex_data@@3AEAUSpriteVertexData@spr@@EA
|
||||
mov rcx, [rbx+8]
|
||||
lea rbx, [rcx+rdx*8]
|
||||
|
||||
pop rdx
|
||||
pop rcx
|
||||
jmp ?originalspr__draw_sprite_mid_spr_kind_triangle@@3P6AXXZEA
|
||||
?implOfspr__draw_sprite_mid_spr_kind_triangle@@YAXXZ ENDP
|
||||
END
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "sprite.hpp"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
bool APIENTRY DllMain(HMODULE handle, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
printf("[Sprite Draw Limit] Current version - v0.1.0.0\n");
|
||||
printf("[Sprite Draw Limit] Attach\n");
|
||||
printf("[Sprite Draw Limit] Patching memory\n");
|
||||
sprite_draw_limit_patch();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) LPCWSTR GetPluginName(void) {
|
||||
return L"Sprite Draw Limit";
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) LPCWSTR GetPluginDescription(void) {
|
||||
return L"Sprite Draw Limit Plugin by korenkonder";
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) LPCWSTR GetBuildDate(void) {
|
||||
return L"v0.1.0.0";
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "sprite.hpp"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <Helpers.h>
|
||||
|
||||
#define FASTCALL __fastcall
|
||||
|
||||
namespace spr {
|
||||
struct SpriteVertex {
|
||||
float_t pos[3]; // vec3
|
||||
float_t uv[2]; // vec2
|
||||
uint32_t color; // color4u8
|
||||
};
|
||||
|
||||
static_assert(sizeof(spr::SpriteVertex) == 0x18, "\"spr::SpriteVertex\" struct should have a size of 0x18");
|
||||
|
||||
struct SpriteVertexData {
|
||||
size_t max_count;
|
||||
spr::SpriteVertex* array;
|
||||
};
|
||||
}
|
||||
|
||||
static void* (*_operator_new)(size_t) = (void* (*)(size_t))0x000000014084530C;
|
||||
static void(*_operator_delete)(void*) = (void(*)(void*))0x0000000140845378;
|
||||
|
||||
spr::SpriteVertexData& sprite_vertex_data = *(spr::SpriteVertexData*)0x000000014CC62480;
|
||||
|
||||
const size_t sprite_vertex_array_max_count = 0x2000;
|
||||
spr::SpriteVertex* sprite_vertex_array = (spr::SpriteVertex*)0x000000014CC62480;
|
||||
|
||||
size_t& sprite_vertex_array_count = *(size_t*)0x000000014CC611B0;
|
||||
|
||||
HOOK(void, FASTCALL, spr__calc_sprite_texture_param_mid1, 0x0000000140638DD0);
|
||||
HOOK(void, FASTCALL, spr__calc_sprite_texture_param_mid2, 0x0000000140638DF6);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_scale_mid, 0x0000000140639DB7);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_vertex_array_pos, 0x000000014063A961);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_vertex_array_uv, 0x000000014063A97C);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_vertex_array_color, 0x000000014063A99B);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_kind_arrow_b, 0x000000014063AB7B);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_kind_arrow_ab, 0x000000014063ABCC);
|
||||
HOOK(void, FASTCALL, spr__draw_sprite_mid_spr_kind_triangle, 0x000000014063AC8D);
|
||||
|
||||
HOOK(void, FASTCALL, spr__SprArgs__SetVertexArray, 0x000000014063F040,
|
||||
__int64 This, spr::SpriteVertex* vertex_array, size_t num_vertex) {
|
||||
if (!sprite_vertex_data.array)
|
||||
sprite_vertex_data.array = (spr::SpriteVertex*)_operator_new(
|
||||
sizeof(spr::SpriteVertex) * sprite_vertex_data.max_count);
|
||||
|
||||
if (sprite_vertex_array_count + num_vertex >= sprite_vertex_data.max_count) {
|
||||
while (sprite_vertex_array_count + num_vertex >= sprite_vertex_data.max_count)
|
||||
sprite_vertex_data.max_count *= 2;
|
||||
|
||||
spr::SpriteVertex* _sprite_vertex_array = (spr::SpriteVertex*)_operator_new(
|
||||
sizeof(spr::SpriteVertex) * sprite_vertex_data.max_count);
|
||||
memmove(_sprite_vertex_array, sprite_vertex_data.array,
|
||||
sizeof(spr::SpriteVertex) * sprite_vertex_array_count);
|
||||
_operator_delete(sprite_vertex_data.array);
|
||||
sprite_vertex_data.array = _sprite_vertex_array;
|
||||
}
|
||||
|
||||
*(size_t*)(This + 0xB8) = num_vertex;
|
||||
|
||||
*(size_t*)(This + 0xB0) = sprite_vertex_array_count;
|
||||
memmove(sprite_vertex_data.array + *(size_t*)(This + 0xB0),
|
||||
vertex_array, sizeof(spr::SpriteVertex) * num_vertex);
|
||||
|
||||
sprite_vertex_array_count += num_vertex;
|
||||
}
|
||||
|
||||
HOOK(void, FASTCALL, sprite_manager_clear, 0x000000014063F860) {
|
||||
if (sprite_vertex_data.array)
|
||||
_operator_delete(sprite_vertex_data.array);
|
||||
originalsprite_manager_clear();
|
||||
}
|
||||
|
||||
void sprite_draw_limit_patch() {
|
||||
sprite_vertex_data.array = 0;
|
||||
sprite_vertex_data.max_count = sprite_vertex_array_max_count;
|
||||
|
||||
WRITE_NOP_7(0x0000000140638DD0);
|
||||
WRITE_NOP_7(0x0000000140638DF6);
|
||||
WRITE_NOP_7(0x0000000140639DB7);
|
||||
WRITE_NOP_7(0x000000014063A961);
|
||||
WRITE_NOP_7(0x000000014063A97C);
|
||||
WRITE_NOP_7(0x000000014063A99B);
|
||||
WRITE_NOP_7(0x000000014063AB7B);
|
||||
WRITE_NOP_7(0x000000014063ABCC);
|
||||
WRITE_NOP_7(0x000000014063AC8D);
|
||||
|
||||
INSTALL_HOOK(spr__calc_sprite_texture_param_mid1);
|
||||
INSTALL_HOOK(spr__calc_sprite_texture_param_mid2);
|
||||
INSTALL_HOOK(spr__draw_sprite_scale_mid);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_vertex_array_pos);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_vertex_array_uv);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_vertex_array_color);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_kind_arrow_b);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_kind_arrow_ab);
|
||||
INSTALL_HOOK(spr__draw_sprite_mid_spr_kind_triangle);
|
||||
INSTALL_HOOK(spr__SprArgs__SetVertexArray);
|
||||
INSTALL_HOOK(sprite_manager_clear);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
extern void sprite_draw_limit_patch();
|
||||
Reference in New Issue
Block a user