mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Code base refactor + major performance and readability improvement. Read description for details.
* Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable. * Document most functions with valve style 'Purpose' blocks. * Rename variables to match the rest of the codebase and Valve's naming convention. * Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK. * Obtain globals or pointers directly instead of waiting for runtime initialized data. * Dynamically search for all functions and globals (this doesn't count for dedicated yet!). * Initialize most in-SDK variables. * Move certain prints and other utilities under ConVars to reduce verbosity and increase performance. * Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future. * Type global var pointers appropriately if class or type is known and implemented. * Forward declare 'CClient' class to avoid having 2 'g_pClient' copies. * Add IDA's pseudo definitions for easier prototyping with decompiled assembly code. * RPAK decompress Command callback implementation. * Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\'). * VPK decompress Command callback implementation. * Move CRC32 ands Adler32 to implementation files. * Server will print out more details about the connecting client. * Upgrade ImGui lib to v1.86. * Don't compile id3dx.h for dedicated. * Don't compile id3dx.cpp for dedicated * Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console * Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors. * Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up. * Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
This commit is contained in:
parent
262365b733
commit
d5b2e58dae
71
apex.sln
71
apex.sln
@ -1,71 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30621.155
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r5launcher", "r5launcher\r5launcher.vcxproj", "{18F8C75E-3844-4AA6-AB93-980A08253519}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r5dev", "r5dev\r5dev.vcxproj", "{28CC6B4F-7A95-4933-ADA9-65E38D48516D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r5dedicated", "r5dedicated\r5dedicated.vcxproj", "{71988D92-343C-49AB-B52B-0AE0E83B0401}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Minhook", "external\minhook\libMinHook.vcxproj", "{F142A341-5EE0-442D-A15F-98AE9B48DBAE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r5net", "r5net\r5net.vcxproj", "{F04BE619-0326-4FF1-B06B-FBE882E04D5E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x64.Build.0 = Debug|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x86.Build.0 = Debug|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x64.ActiveCfg = Release|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x64.Build.0 = Release|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x86.ActiveCfg = Release|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x86.Build.0 = Release|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x64.Build.0 = Debug|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x64.ActiveCfg = Release|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x64.Build.0 = Release|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x86.Build.0 = Release|Win32
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Debug|x64.Build.0 = Debug|x64
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Debug|x86.Build.0 = Debug|Win32
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Release|x64.ActiveCfg = Release|x64
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Release|x64.Build.0 = Release|x64
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Release|x86.ActiveCfg = Release|Win32
|
||||
{71988D92-343C-49AB-B52B-0AE0E83B0401}.Release|x86.Build.0 = Release|Win32
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Debug|x64.Build.0 = Debug|x64
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Release|x64.ActiveCfg = Release|x64
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Release|x64.Build.0 = Release|x64
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F142A341-5EE0-442D-A15F-98AE9B48DBAE}.Release|x86.Build.0 = Release|Win32
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Debug|x64.Build.0 = Debug|x64
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Release|x64.ActiveCfg = Release|x64
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Release|x64.Build.0 = Release|x64
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{F04BE619-0326-4FF1-B06B-FBE882E04D5E}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5E5FE02E-6BCE-4BAF-9948-C56476039C3C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
51
detours.sln
Normal file
51
detours.sln
Normal file
@ -0,0 +1,51 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31808.319
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "r5devdll", "r5dev\r5dev.vcxproj", "{28CC6B4F-7A95-4933-ADA9-65E38D48516D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdklauncher", "r5dev\sdklauncher.vcxproj", "{18F8C75E-3844-4AA6-AB93-980A08253519}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dedicated", "r5dev\dedicated.vcxproj", "{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x64.Build.0 = Debug|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Debug|x86.Build.0 = Debug|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x64.ActiveCfg = Release|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x64.Build.0 = Release|x64
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x86.ActiveCfg = Release|Win32
|
||||
{28CC6B4F-7A95-4933-ADA9-65E38D48516D}.Release|x86.Build.0 = Release|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x64.Build.0 = Debug|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Debug|x86.Build.0 = Debug|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x64.ActiveCfg = Release|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x64.Build.0 = Release|x64
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x86.ActiveCfg = Release|Win32
|
||||
{18F8C75E-3844-4AA6-AB93-980A08253519}.Release|x86.Build.0 = Release|Win32
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Release|x64.Build.0 = Release|x64
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{ED2C50B3-7C2C-4E44-988E-DAA059F72B9C}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5E5FE02E-6BCE-4BAF-9948-C56476039C3C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
external/detours/libs/detours.lib
vendored
BIN
external/detours/libs/detours.lib
vendored
Binary file not shown.
BIN
external/detours/libs/detours.pdb
vendored
BIN
external/detours/libs/detours.pdb
vendored
Binary file not shown.
BIN
external/detours/libs/detours_trace.lib
vendored
BIN
external/detours/libs/detours_trace.lib
vendored
Binary file not shown.
BIN
external/detours/libs/syelog.lib
vendored
BIN
external/detours/libs/syelog.lib
vendored
Binary file not shown.
185
external/minhook/include/MinHook.h
vendored
185
external/minhook/include/MinHook.h
vendored
@ -1,185 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__)
|
||||
#error MinHook supports only x86 and x64 systems.
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// MinHook Error Codes.
|
||||
typedef enum MH_STATUS
|
||||
{
|
||||
// Unknown error. Should not be returned.
|
||||
MH_UNKNOWN = -1,
|
||||
|
||||
// Successful.
|
||||
MH_OK = 0,
|
||||
|
||||
// MinHook is already initialized.
|
||||
MH_ERROR_ALREADY_INITIALIZED,
|
||||
|
||||
// MinHook is not initialized yet, or already uninitialized.
|
||||
MH_ERROR_NOT_INITIALIZED,
|
||||
|
||||
// The hook for the specified target function is already created.
|
||||
MH_ERROR_ALREADY_CREATED,
|
||||
|
||||
// The hook for the specified target function is not created yet.
|
||||
MH_ERROR_NOT_CREATED,
|
||||
|
||||
// The hook for the specified target function is already enabled.
|
||||
MH_ERROR_ENABLED,
|
||||
|
||||
// The hook for the specified target function is not enabled yet, or already
|
||||
// disabled.
|
||||
MH_ERROR_DISABLED,
|
||||
|
||||
// The specified pointer is invalid. It points the address of non-allocated
|
||||
// and/or non-executable region.
|
||||
MH_ERROR_NOT_EXECUTABLE,
|
||||
|
||||
// The specified target function cannot be hooked.
|
||||
MH_ERROR_UNSUPPORTED_FUNCTION,
|
||||
|
||||
// Failed to allocate memory.
|
||||
MH_ERROR_MEMORY_ALLOC,
|
||||
|
||||
// Failed to change the memory protection.
|
||||
MH_ERROR_MEMORY_PROTECT,
|
||||
|
||||
// The specified module is not loaded.
|
||||
MH_ERROR_MODULE_NOT_FOUND,
|
||||
|
||||
// The specified function is not found.
|
||||
MH_ERROR_FUNCTION_NOT_FOUND
|
||||
}
|
||||
MH_STATUS;
|
||||
|
||||
// Can be passed as a parameter to MH_EnableHook, MH_DisableHook,
|
||||
// MH_QueueEnableHook or MH_QueueDisableHook.
|
||||
#define MH_ALL_HOOKS NULL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Initialize the MinHook library. You must call this function EXACTLY ONCE
|
||||
// at the beginning of your program.
|
||||
MH_STATUS WINAPI MH_Initialize(VOID);
|
||||
|
||||
// Uninitialize the MinHook library. You must call this function EXACTLY
|
||||
// ONCE at the end of your program.
|
||||
MH_STATUS WINAPI MH_Uninitialize(VOID);
|
||||
|
||||
// Creates a hook for the specified target function, in disabled state.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function, which will be
|
||||
// overridden by the detour function.
|
||||
// pDetour [in] A pointer to the detour function, which will override
|
||||
// the target function.
|
||||
// ppOriginal [out] A pointer to the trampoline function, which will be
|
||||
// used to call the original target function.
|
||||
// This parameter can be NULL.
|
||||
MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
|
||||
|
||||
// Creates a hook for the specified API function, in disabled state.
|
||||
// Parameters:
|
||||
// pszModule [in] A pointer to the loaded module name which contains the
|
||||
// target function.
|
||||
// pszProcName [in] A pointer to the target function name, which will be
|
||||
// overridden by the detour function.
|
||||
// pDetour [in] A pointer to the detour function, which will override
|
||||
// the target function.
|
||||
// ppOriginal [out] A pointer to the trampoline function, which will be
|
||||
// used to call the original target function.
|
||||
// This parameter can be NULL.
|
||||
MH_STATUS WINAPI MH_CreateHookApi(
|
||||
LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal);
|
||||
|
||||
// Creates a hook for the specified API function, in disabled state.
|
||||
// Parameters:
|
||||
// pszModule [in] A pointer to the loaded module name which contains the
|
||||
// target function.
|
||||
// pszProcName [in] A pointer to the target function name, which will be
|
||||
// overridden by the detour function.
|
||||
// pDetour [in] A pointer to the detour function, which will override
|
||||
// the target function.
|
||||
// ppOriginal [out] A pointer to the trampoline function, which will be
|
||||
// used to call the original target function.
|
||||
// This parameter can be NULL.
|
||||
// ppTarget [out] A pointer to the target function, which will be used
|
||||
// with other functions.
|
||||
// This parameter can be NULL.
|
||||
MH_STATUS WINAPI MH_CreateHookApiEx(
|
||||
LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget);
|
||||
|
||||
// Removes an already created hook.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function.
|
||||
MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
|
||||
|
||||
// Enables an already created hook.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function.
|
||||
// If this parameter is MH_ALL_HOOKS, all created hooks are
|
||||
// enabled in one go.
|
||||
MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
|
||||
|
||||
// Disables an already created hook.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function.
|
||||
// If this parameter is MH_ALL_HOOKS, all created hooks are
|
||||
// disabled in one go.
|
||||
MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
|
||||
|
||||
// Queues to enable an already created hook.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function.
|
||||
// If this parameter is MH_ALL_HOOKS, all created hooks are
|
||||
// queued to be enabled.
|
||||
MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
|
||||
|
||||
// Queues to disable an already created hook.
|
||||
// Parameters:
|
||||
// pTarget [in] A pointer to the target function.
|
||||
// If this parameter is MH_ALL_HOOKS, all created hooks are
|
||||
// queued to be disabled.
|
||||
MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
|
||||
|
||||
// Applies all queued changes in one go.
|
||||
MH_STATUS WINAPI MH_ApplyQueued(VOID);
|
||||
|
||||
// Translates the MH_STATUS to its name as a string.
|
||||
const char * WINAPI MH_StatusToString(MH_STATUS status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
173
external/minhook/libMinHook.vcxproj
vendored
173
external/minhook/libMinHook.vcxproj
vendored
@ -1,173 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\buffer.c" />
|
||||
<ClCompile Include="src\hde\hde32.c" />
|
||||
<ClCompile Include="src\hde\hde64.c" />
|
||||
<ClCompile Include="src\hook.c" />
|
||||
<ClCompile Include="src\trampoline.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\MinHook.h" />
|
||||
<ClInclude Include="src\buffer.h" />
|
||||
<ClInclude Include="src\hde\hde32.h" />
|
||||
<ClInclude Include="src\hde\hde64.h" />
|
||||
<ClInclude Include="src\hde\pstdint.h" />
|
||||
<ClInclude Include="src\hde\table32.h" />
|
||||
<ClInclude Include="src\hde\table64.h" />
|
||||
<ClInclude Include="src\trampoline.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{F142A341-5EE0-442D-A15F-98AE9B48DBAE}</ProjectGuid>
|
||||
<RootNamespace>libMinHook</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Minhook</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)lib\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)lib\$(Configuration)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)build\$(ProjectName)\$(Configuration)</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)lib\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)lib\$(Configuration)</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)build\$(ProjectName)\$(Configuration)</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName).x86</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName).x86</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName).x64</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName).x64</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;STRICT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;STRICT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STRICT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STRICT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
57
external/minhook/libMinHook.vcxproj.filters
vendored
57
external/minhook/libMinHook.vcxproj.filters
vendored
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\buffer.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\hook.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\trampoline.c">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\hde\hde32.c">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\hde\hde64.c">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\buffer.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\trampoline.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hde\hde32.h">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hde\hde64.h">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hde\pstdint.h">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hde\table32.h">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\hde\table64.h">
|
||||
<Filter>src\hde</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\MinHook.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{62eb648f-1c53-4909-8805-77a8cdc6f408}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\hde">
|
||||
<UniqueIdentifier>{161a8d4e-b988-418b-a31e-d089ae0e9e22}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="include">
|
||||
<UniqueIdentifier>{dd59bf86-2fa2-4576-bb49-7b65617b67a5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
312
external/minhook/src/buffer.c
vendored
312
external/minhook/src/buffer.c
vendored
@ -1,312 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "buffer.h"
|
||||
|
||||
// Size of each memory block. (= page size of VirtualAlloc)
|
||||
#define MEMORY_BLOCK_SIZE 0x1000
|
||||
|
||||
// Max range for seeking a memory block. (= 1024MB)
|
||||
#define MAX_MEMORY_RANGE 0x40000000
|
||||
|
||||
// Memory protection flags to check the executable address.
|
||||
#define PAGE_EXECUTE_FLAGS \
|
||||
(PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY)
|
||||
|
||||
// Memory slot.
|
||||
typedef struct _MEMORY_SLOT
|
||||
{
|
||||
union
|
||||
{
|
||||
struct _MEMORY_SLOT *pNext;
|
||||
UINT8 buffer[MEMORY_SLOT_SIZE];
|
||||
};
|
||||
} MEMORY_SLOT, *PMEMORY_SLOT;
|
||||
|
||||
// Memory block info. Placed at the head of each block.
|
||||
typedef struct _MEMORY_BLOCK
|
||||
{
|
||||
struct _MEMORY_BLOCK *pNext;
|
||||
PMEMORY_SLOT pFree; // First element of the free slot list.
|
||||
UINT usedCount;
|
||||
} MEMORY_BLOCK, *PMEMORY_BLOCK;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Global Variables:
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// First element of the memory block list.
|
||||
PMEMORY_BLOCK g_pMemoryBlocks;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
VOID InitializeBuffer(VOID)
|
||||
{
|
||||
// Nothing to do for now.
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
VOID UninitializeBuffer(VOID)
|
||||
{
|
||||
PMEMORY_BLOCK pBlock = g_pMemoryBlocks;
|
||||
g_pMemoryBlocks = NULL;
|
||||
|
||||
while (pBlock)
|
||||
{
|
||||
PMEMORY_BLOCK pNext = pBlock->pNext;
|
||||
VirtualFree(pBlock, 0, MEM_RELEASE);
|
||||
pBlock = pNext;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
static LPVOID FindPrevFreeRegion(LPVOID pAddress, LPVOID pMinAddr, DWORD dwAllocationGranularity)
|
||||
{
|
||||
ULONG_PTR tryAddr = (ULONG_PTR)pAddress;
|
||||
|
||||
// Round down to the allocation granularity.
|
||||
tryAddr -= tryAddr % dwAllocationGranularity;
|
||||
|
||||
// Start from the previous allocation granularity multiply.
|
||||
tryAddr -= dwAllocationGranularity;
|
||||
|
||||
while (tryAddr >= (ULONG_PTR)pMinAddr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0)
|
||||
break;
|
||||
|
||||
if (mbi.State == MEM_FREE)
|
||||
return (LPVOID)tryAddr;
|
||||
|
||||
if ((ULONG_PTR)mbi.AllocationBase < dwAllocationGranularity)
|
||||
break;
|
||||
|
||||
tryAddr = (ULONG_PTR)mbi.AllocationBase - dwAllocationGranularity;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
static LPVOID FindNextFreeRegion(LPVOID pAddress, LPVOID pMaxAddr, DWORD dwAllocationGranularity)
|
||||
{
|
||||
ULONG_PTR tryAddr = (ULONG_PTR)pAddress;
|
||||
|
||||
// Round down to the allocation granularity.
|
||||
tryAddr -= tryAddr % dwAllocationGranularity;
|
||||
|
||||
// Start from the next allocation granularity multiply.
|
||||
tryAddr += dwAllocationGranularity;
|
||||
|
||||
while (tryAddr <= (ULONG_PTR)pMaxAddr)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
if (VirtualQuery((LPVOID)tryAddr, &mbi, sizeof(mbi)) == 0)
|
||||
break;
|
||||
|
||||
if (mbi.State == MEM_FREE)
|
||||
return (LPVOID)tryAddr;
|
||||
|
||||
tryAddr = (ULONG_PTR)mbi.BaseAddress + mbi.RegionSize;
|
||||
|
||||
// Round up to the next allocation granularity.
|
||||
tryAddr += dwAllocationGranularity - 1;
|
||||
tryAddr -= tryAddr % dwAllocationGranularity;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static PMEMORY_BLOCK GetMemoryBlock(LPVOID pOrigin)
|
||||
{
|
||||
PMEMORY_BLOCK pBlock;
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
ULONG_PTR minAddr;
|
||||
ULONG_PTR maxAddr;
|
||||
|
||||
SYSTEM_INFO si;
|
||||
GetSystemInfo(&si);
|
||||
minAddr = (ULONG_PTR)si.lpMinimumApplicationAddress;
|
||||
maxAddr = (ULONG_PTR)si.lpMaximumApplicationAddress;
|
||||
|
||||
// pOrigin ± 512MB
|
||||
if ((ULONG_PTR)pOrigin > MAX_MEMORY_RANGE && minAddr < (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE)
|
||||
minAddr = (ULONG_PTR)pOrigin - MAX_MEMORY_RANGE;
|
||||
|
||||
if (maxAddr > (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE)
|
||||
maxAddr = (ULONG_PTR)pOrigin + MAX_MEMORY_RANGE;
|
||||
|
||||
// Make room for MEMORY_BLOCK_SIZE bytes.
|
||||
maxAddr -= MEMORY_BLOCK_SIZE - 1;
|
||||
#endif
|
||||
|
||||
// Look the registered blocks for a reachable one.
|
||||
for (pBlock = g_pMemoryBlocks; pBlock != NULL; pBlock = pBlock->pNext)
|
||||
{
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
// Ignore the blocks too far.
|
||||
if ((ULONG_PTR)pBlock < minAddr || (ULONG_PTR)pBlock >= maxAddr)
|
||||
continue;
|
||||
#endif
|
||||
// The block has at least one unused slot.
|
||||
if (pBlock->pFree != NULL)
|
||||
return pBlock;
|
||||
}
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
// Alloc a new block above if not found.
|
||||
{
|
||||
LPVOID pAlloc = pOrigin;
|
||||
while ((ULONG_PTR)pAlloc >= minAddr)
|
||||
{
|
||||
pAlloc = FindPrevFreeRegion(pAlloc, (LPVOID)minAddr, si.dwAllocationGranularity);
|
||||
if (pAlloc == NULL)
|
||||
break;
|
||||
|
||||
pBlock = (PMEMORY_BLOCK)VirtualAlloc(
|
||||
pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
if (pBlock != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Alloc a new block below if not found.
|
||||
if (pBlock == NULL)
|
||||
{
|
||||
LPVOID pAlloc = pOrigin;
|
||||
while ((ULONG_PTR)pAlloc <= maxAddr)
|
||||
{
|
||||
pAlloc = FindNextFreeRegion(pAlloc, (LPVOID)maxAddr, si.dwAllocationGranularity);
|
||||
if (pAlloc == NULL)
|
||||
break;
|
||||
|
||||
pBlock = (PMEMORY_BLOCK)VirtualAlloc(
|
||||
pAlloc, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
if (pBlock != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// In x86 mode, a memory block can be placed anywhere.
|
||||
pBlock = (PMEMORY_BLOCK)VirtualAlloc(
|
||||
NULL, MEMORY_BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
#endif
|
||||
|
||||
if (pBlock != NULL)
|
||||
{
|
||||
// Build a linked list of all the slots.
|
||||
PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBlock + 1;
|
||||
pBlock->pFree = NULL;
|
||||
pBlock->usedCount = 0;
|
||||
do
|
||||
{
|
||||
pSlot->pNext = pBlock->pFree;
|
||||
pBlock->pFree = pSlot;
|
||||
pSlot++;
|
||||
} while ((ULONG_PTR)pSlot - (ULONG_PTR)pBlock <= MEMORY_BLOCK_SIZE - MEMORY_SLOT_SIZE);
|
||||
|
||||
pBlock->pNext = g_pMemoryBlocks;
|
||||
g_pMemoryBlocks = pBlock;
|
||||
}
|
||||
|
||||
return pBlock;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
LPVOID AllocateBuffer(LPVOID pOrigin)
|
||||
{
|
||||
PMEMORY_SLOT pSlot;
|
||||
PMEMORY_BLOCK pBlock = GetMemoryBlock(pOrigin);
|
||||
if (pBlock == NULL)
|
||||
return NULL;
|
||||
|
||||
// Remove an unused slot from the list.
|
||||
pSlot = pBlock->pFree;
|
||||
pBlock->pFree = pSlot->pNext;
|
||||
pBlock->usedCount++;
|
||||
#ifdef _DEBUG
|
||||
// Fill the slot with INT3 for debugging.
|
||||
memset(pSlot, 0xCC, sizeof(MEMORY_SLOT));
|
||||
#endif
|
||||
return pSlot;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
VOID FreeBuffer(LPVOID pBuffer)
|
||||
{
|
||||
PMEMORY_BLOCK pBlock = g_pMemoryBlocks;
|
||||
PMEMORY_BLOCK pPrev = NULL;
|
||||
ULONG_PTR pTargetBlock = ((ULONG_PTR)pBuffer / MEMORY_BLOCK_SIZE) * MEMORY_BLOCK_SIZE;
|
||||
|
||||
while (pBlock != NULL)
|
||||
{
|
||||
if ((ULONG_PTR)pBlock == pTargetBlock)
|
||||
{
|
||||
PMEMORY_SLOT pSlot = (PMEMORY_SLOT)pBuffer;
|
||||
#ifdef _DEBUG
|
||||
// Clear the released slot for debugging.
|
||||
memset(pSlot, 0x00, sizeof(MEMORY_SLOT));
|
||||
#endif
|
||||
// Restore the released slot to the list.
|
||||
pSlot->pNext = pBlock->pFree;
|
||||
pBlock->pFree = pSlot;
|
||||
pBlock->usedCount--;
|
||||
|
||||
// Free if unused.
|
||||
if (pBlock->usedCount == 0)
|
||||
{
|
||||
if (pPrev)
|
||||
pPrev->pNext = pBlock->pNext;
|
||||
else
|
||||
g_pMemoryBlocks = pBlock->pNext;
|
||||
|
||||
VirtualFree(pBlock, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
pPrev = pBlock;
|
||||
pBlock = pBlock->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
BOOL IsExecutableAddress(LPVOID pAddress)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mi;
|
||||
VirtualQuery(pAddress, &mi, sizeof(mi));
|
||||
|
||||
return (mi.State == MEM_COMMIT && (mi.Protect & PAGE_EXECUTE_FLAGS));
|
||||
}
|
42
external/minhook/src/buffer.h
vendored
42
external/minhook/src/buffer.h
vendored
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Size of each memory slot.
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define MEMORY_SLOT_SIZE 64
|
||||
#else
|
||||
#define MEMORY_SLOT_SIZE 32
|
||||
#endif
|
||||
|
||||
VOID InitializeBuffer(VOID);
|
||||
VOID UninitializeBuffer(VOID);
|
||||
LPVOID AllocateBuffer(LPVOID pOrigin);
|
||||
VOID FreeBuffer(LPVOID pBuffer);
|
||||
BOOL IsExecutableAddress(LPVOID pAddress);
|
324
external/minhook/src/hde/hde32.c
vendored
324
external/minhook/src/hde/hde32.c
vendored
@ -1,324 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 32 C
|
||||
* Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(_M_IX86) || defined(__i386__)
|
||||
|
||||
#include <string.h>
|
||||
#include "hde32.h"
|
||||
#include "table32.h"
|
||||
|
||||
unsigned int hde32_disasm(const void *code, hde32s *hs)
|
||||
{
|
||||
uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;
|
||||
uint8_t *ht = hde32_table, m_mod, m_reg, m_rm, disp_size = 0;
|
||||
|
||||
memset(hs, 0, sizeof(hde32s));
|
||||
|
||||
for (x = 16; x; x--)
|
||||
switch (c = *p++) {
|
||||
case 0xf3:
|
||||
hs->p_rep = c;
|
||||
pref |= PRE_F3;
|
||||
break;
|
||||
case 0xf2:
|
||||
hs->p_rep = c;
|
||||
pref |= PRE_F2;
|
||||
break;
|
||||
case 0xf0:
|
||||
hs->p_lock = c;
|
||||
pref |= PRE_LOCK;
|
||||
break;
|
||||
case 0x26: case 0x2e: case 0x36:
|
||||
case 0x3e: case 0x64: case 0x65:
|
||||
hs->p_seg = c;
|
||||
pref |= PRE_SEG;
|
||||
break;
|
||||
case 0x66:
|
||||
hs->p_66 = c;
|
||||
pref |= PRE_66;
|
||||
break;
|
||||
case 0x67:
|
||||
hs->p_67 = c;
|
||||
pref |= PRE_67;
|
||||
break;
|
||||
default:
|
||||
goto pref_done;
|
||||
}
|
||||
pref_done:
|
||||
|
||||
hs->flags = (uint32_t)pref << 23;
|
||||
|
||||
if (!pref)
|
||||
pref |= PRE_NONE;
|
||||
|
||||
if ((hs->opcode = c) == 0x0f) {
|
||||
hs->opcode2 = c = *p++;
|
||||
ht += DELTA_OPCODES;
|
||||
} else if (c >= 0xa0 && c <= 0xa3) {
|
||||
if (pref & PRE_67)
|
||||
pref |= PRE_66;
|
||||
else
|
||||
pref &= ~PRE_66;
|
||||
}
|
||||
|
||||
opcode = c;
|
||||
cflags = ht[ht[opcode / 4] + (opcode % 4)];
|
||||
|
||||
if (cflags == C_ERROR) {
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
cflags = 0;
|
||||
if ((opcode & -3) == 0x24)
|
||||
cflags++;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
if (cflags & C_GROUP) {
|
||||
uint16_t t;
|
||||
t = *(uint16_t *)(ht + (cflags & 0x7f));
|
||||
cflags = (uint8_t)t;
|
||||
x = (uint8_t)(t >> 8);
|
||||
}
|
||||
|
||||
if (hs->opcode2) {
|
||||
ht = hde32_table + DELTA_PREFIXES;
|
||||
if (ht[ht[opcode / 4] + (opcode % 4)] & pref)
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
}
|
||||
|
||||
if (cflags & C_MODRM) {
|
||||
hs->flags |= F_MODRM;
|
||||
hs->modrm = c = *p++;
|
||||
hs->modrm_mod = m_mod = c >> 6;
|
||||
hs->modrm_rm = m_rm = c & 7;
|
||||
hs->modrm_reg = m_reg = (c & 0x3f) >> 3;
|
||||
|
||||
if (x && ((x << m_reg) & 0x80))
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
|
||||
if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) {
|
||||
uint8_t t = opcode - 0xd9;
|
||||
if (m_mod == 3) {
|
||||
ht = hde32_table + DELTA_FPU_MODRM + t*8;
|
||||
t = ht[m_reg] << m_rm;
|
||||
} else {
|
||||
ht = hde32_table + DELTA_FPU_REG;
|
||||
t = ht[t] << m_reg;
|
||||
}
|
||||
if (t & 0x80)
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
}
|
||||
|
||||
if (pref & PRE_LOCK) {
|
||||
if (m_mod == 3) {
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
} else {
|
||||
uint8_t *table_end, op = opcode;
|
||||
if (hs->opcode2) {
|
||||
ht = hde32_table + DELTA_OP2_LOCK_OK;
|
||||
table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK;
|
||||
} else {
|
||||
ht = hde32_table + DELTA_OP_LOCK_OK;
|
||||
table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK;
|
||||
op &= -2;
|
||||
}
|
||||
for (; ht != table_end; ht++)
|
||||
if (*ht++ == op) {
|
||||
if (!((*ht << m_reg) & 0x80))
|
||||
goto no_lock_error;
|
||||
else
|
||||
break;
|
||||
}
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
no_lock_error:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (hs->opcode2) {
|
||||
switch (opcode) {
|
||||
case 0x20: case 0x22:
|
||||
m_mod = 3;
|
||||
if (m_reg > 4 || m_reg == 1)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
case 0x21: case 0x23:
|
||||
m_mod = 3;
|
||||
if (m_reg == 4 || m_reg == 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
}
|
||||
} else {
|
||||
switch (opcode) {
|
||||
case 0x8c:
|
||||
if (m_reg > 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
case 0x8e:
|
||||
if (m_reg == 1 || m_reg > 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_mod == 3) {
|
||||
uint8_t *table_end;
|
||||
if (hs->opcode2) {
|
||||
ht = hde32_table + DELTA_OP2_ONLY_MEM;
|
||||
table_end = ht + sizeof(hde32_table) - DELTA_OP2_ONLY_MEM;
|
||||
} else {
|
||||
ht = hde32_table + DELTA_OP_ONLY_MEM;
|
||||
table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM;
|
||||
}
|
||||
for (; ht != table_end; ht += 2)
|
||||
if (*ht++ == opcode) {
|
||||
if ((*ht++ & pref) && !((*ht << m_reg) & 0x80))
|
||||
goto error_operand;
|
||||
else
|
||||
break;
|
||||
}
|
||||
goto no_error_operand;
|
||||
} else if (hs->opcode2) {
|
||||
switch (opcode) {
|
||||
case 0x50: case 0xd7: case 0xf7:
|
||||
if (pref & (PRE_NONE | PRE_66))
|
||||
goto error_operand;
|
||||
break;
|
||||
case 0xd6:
|
||||
if (pref & (PRE_F2 | PRE_F3))
|
||||
goto error_operand;
|
||||
break;
|
||||
case 0xc5:
|
||||
goto error_operand;
|
||||
}
|
||||
goto no_error_operand;
|
||||
} else
|
||||
goto no_error_operand;
|
||||
|
||||
error_operand:
|
||||
hs->flags |= F_ERROR | F_ERROR_OPERAND;
|
||||
no_error_operand:
|
||||
|
||||
c = *p++;
|
||||
if (m_reg <= 1) {
|
||||
if (opcode == 0xf6)
|
||||
cflags |= C_IMM8;
|
||||
else if (opcode == 0xf7)
|
||||
cflags |= C_IMM_P66;
|
||||
}
|
||||
|
||||
switch (m_mod) {
|
||||
case 0:
|
||||
if (pref & PRE_67) {
|
||||
if (m_rm == 6)
|
||||
disp_size = 2;
|
||||
} else
|
||||
if (m_rm == 5)
|
||||
disp_size = 4;
|
||||
break;
|
||||
case 1:
|
||||
disp_size = 1;
|
||||
break;
|
||||
case 2:
|
||||
disp_size = 2;
|
||||
if (!(pref & PRE_67))
|
||||
disp_size <<= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_mod != 3 && m_rm == 4 && !(pref & PRE_67)) {
|
||||
hs->flags |= F_SIB;
|
||||
p++;
|
||||
hs->sib = c;
|
||||
hs->sib_scale = c >> 6;
|
||||
hs->sib_index = (c & 0x3f) >> 3;
|
||||
if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1))
|
||||
disp_size = 4;
|
||||
}
|
||||
|
||||
p--;
|
||||
switch (disp_size) {
|
||||
case 1:
|
||||
hs->flags |= F_DISP8;
|
||||
hs->disp.disp8 = *p;
|
||||
break;
|
||||
case 2:
|
||||
hs->flags |= F_DISP16;
|
||||
hs->disp.disp16 = *(uint16_t *)p;
|
||||
break;
|
||||
case 4:
|
||||
hs->flags |= F_DISP32;
|
||||
hs->disp.disp32 = *(uint32_t *)p;
|
||||
break;
|
||||
}
|
||||
p += disp_size;
|
||||
} else if (pref & PRE_LOCK)
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
|
||||
if (cflags & C_IMM_P66) {
|
||||
if (cflags & C_REL32) {
|
||||
if (pref & PRE_66) {
|
||||
hs->flags |= F_IMM16 | F_RELATIVE;
|
||||
hs->imm.imm16 = *(uint16_t *)p;
|
||||
p += 2;
|
||||
goto disasm_done;
|
||||
}
|
||||
goto rel32_ok;
|
||||
}
|
||||
if (pref & PRE_66) {
|
||||
hs->flags |= F_IMM16;
|
||||
hs->imm.imm16 = *(uint16_t *)p;
|
||||
p += 2;
|
||||
} else {
|
||||
hs->flags |= F_IMM32;
|
||||
hs->imm.imm32 = *(uint32_t *)p;
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (cflags & C_IMM16) {
|
||||
if (hs->flags & F_IMM32) {
|
||||
hs->flags |= F_IMM16;
|
||||
hs->disp.disp16 = *(uint16_t *)p;
|
||||
} else if (hs->flags & F_IMM16) {
|
||||
hs->flags |= F_2IMM16;
|
||||
hs->disp.disp16 = *(uint16_t *)p;
|
||||
} else {
|
||||
hs->flags |= F_IMM16;
|
||||
hs->imm.imm16 = *(uint16_t *)p;
|
||||
}
|
||||
p += 2;
|
||||
}
|
||||
if (cflags & C_IMM8) {
|
||||
hs->flags |= F_IMM8;
|
||||
hs->imm.imm8 = *p++;
|
||||
}
|
||||
|
||||
if (cflags & C_REL32) {
|
||||
rel32_ok:
|
||||
hs->flags |= F_IMM32 | F_RELATIVE;
|
||||
hs->imm.imm32 = *(uint32_t *)p;
|
||||
p += 4;
|
||||
} else if (cflags & C_REL8) {
|
||||
hs->flags |= F_IMM8 | F_RELATIVE;
|
||||
hs->imm.imm8 = *p++;
|
||||
}
|
||||
|
||||
disasm_done:
|
||||
|
||||
if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) {
|
||||
hs->flags |= F_ERROR | F_ERROR_LENGTH;
|
||||
hs->len = 15;
|
||||
}
|
||||
|
||||
return (unsigned int)hs->len;
|
||||
}
|
||||
|
||||
#endif // defined(_M_IX86) || defined(__i386__)
|
105
external/minhook/src/hde/hde32.h
vendored
105
external/minhook/src/hde/hde32.h
vendored
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 32
|
||||
* Copyright (c) 2006-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
* hde32.h: C/C++ header file
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HDE32_H_
|
||||
#define _HDE32_H_
|
||||
|
||||
/* stdint.h - C99 standard header
|
||||
* http://en.wikipedia.org/wiki/stdint.h
|
||||
*
|
||||
* if your compiler doesn't contain "stdint.h" header (for
|
||||
* example, Microsoft Visual C++), you can download file:
|
||||
* http://www.azillionmonkeys.com/qed/pstdint.h
|
||||
* and change next line to:
|
||||
* #include "pstdint.h"
|
||||
*/
|
||||
#include "pstdint.h"
|
||||
|
||||
#define F_MODRM 0x00000001
|
||||
#define F_SIB 0x00000002
|
||||
#define F_IMM8 0x00000004
|
||||
#define F_IMM16 0x00000008
|
||||
#define F_IMM32 0x00000010
|
||||
#define F_DISP8 0x00000020
|
||||
#define F_DISP16 0x00000040
|
||||
#define F_DISP32 0x00000080
|
||||
#define F_RELATIVE 0x00000100
|
||||
#define F_2IMM16 0x00000800
|
||||
#define F_ERROR 0x00001000
|
||||
#define F_ERROR_OPCODE 0x00002000
|
||||
#define F_ERROR_LENGTH 0x00004000
|
||||
#define F_ERROR_LOCK 0x00008000
|
||||
#define F_ERROR_OPERAND 0x00010000
|
||||
#define F_PREFIX_REPNZ 0x01000000
|
||||
#define F_PREFIX_REPX 0x02000000
|
||||
#define F_PREFIX_REP 0x03000000
|
||||
#define F_PREFIX_66 0x04000000
|
||||
#define F_PREFIX_67 0x08000000
|
||||
#define F_PREFIX_LOCK 0x10000000
|
||||
#define F_PREFIX_SEG 0x20000000
|
||||
#define F_PREFIX_ANY 0x3f000000
|
||||
|
||||
#define PREFIX_SEGMENT_CS 0x2e
|
||||
#define PREFIX_SEGMENT_SS 0x36
|
||||
#define PREFIX_SEGMENT_DS 0x3e
|
||||
#define PREFIX_SEGMENT_ES 0x26
|
||||
#define PREFIX_SEGMENT_FS 0x64
|
||||
#define PREFIX_SEGMENT_GS 0x65
|
||||
#define PREFIX_LOCK 0xf0
|
||||
#define PREFIX_REPNZ 0xf2
|
||||
#define PREFIX_REPX 0xf3
|
||||
#define PREFIX_OPERAND_SIZE 0x66
|
||||
#define PREFIX_ADDRESS_SIZE 0x67
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
typedef struct {
|
||||
uint8_t len;
|
||||
uint8_t p_rep;
|
||||
uint8_t p_lock;
|
||||
uint8_t p_seg;
|
||||
uint8_t p_66;
|
||||
uint8_t p_67;
|
||||
uint8_t opcode;
|
||||
uint8_t opcode2;
|
||||
uint8_t modrm;
|
||||
uint8_t modrm_mod;
|
||||
uint8_t modrm_reg;
|
||||
uint8_t modrm_rm;
|
||||
uint8_t sib;
|
||||
uint8_t sib_scale;
|
||||
uint8_t sib_index;
|
||||
uint8_t sib_base;
|
||||
union {
|
||||
uint8_t imm8;
|
||||
uint16_t imm16;
|
||||
uint32_t imm32;
|
||||
} imm;
|
||||
union {
|
||||
uint8_t disp8;
|
||||
uint16_t disp16;
|
||||
uint32_t disp32;
|
||||
} disp;
|
||||
uint32_t flags;
|
||||
} hde32s;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* __cdecl */
|
||||
unsigned int hde32_disasm(const void *code, hde32s *hs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _HDE32_H_ */
|
333
external/minhook/src/hde/hde64.c
vendored
333
external/minhook/src/hde/hde64.c
vendored
@ -1,333 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 64 C
|
||||
* Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
|
||||
#include <string.h>
|
||||
#include "hde64.h"
|
||||
#include "table64.h"
|
||||
|
||||
unsigned int hde64_disasm(const void *code, hde64s *hs)
|
||||
{
|
||||
uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;
|
||||
uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0;
|
||||
uint8_t op64 = 0;
|
||||
|
||||
memset(hs, 0, sizeof(hde64s));
|
||||
|
||||
for (x = 16; x; x--)
|
||||
switch (c = *p++) {
|
||||
case 0xf3:
|
||||
hs->p_rep = c;
|
||||
pref |= PRE_F3;
|
||||
break;
|
||||
case 0xf2:
|
||||
hs->p_rep = c;
|
||||
pref |= PRE_F2;
|
||||
break;
|
||||
case 0xf0:
|
||||
hs->p_lock = c;
|
||||
pref |= PRE_LOCK;
|
||||
break;
|
||||
case 0x26: case 0x2e: case 0x36:
|
||||
case 0x3e: case 0x64: case 0x65:
|
||||
hs->p_seg = c;
|
||||
pref |= PRE_SEG;
|
||||
break;
|
||||
case 0x66:
|
||||
hs->p_66 = c;
|
||||
pref |= PRE_66;
|
||||
break;
|
||||
case 0x67:
|
||||
hs->p_67 = c;
|
||||
pref |= PRE_67;
|
||||
break;
|
||||
default:
|
||||
goto pref_done;
|
||||
}
|
||||
pref_done:
|
||||
|
||||
hs->flags = (uint32_t)pref << 23;
|
||||
|
||||
if (!pref)
|
||||
pref |= PRE_NONE;
|
||||
|
||||
if ((c & 0xf0) == 0x40) {
|
||||
hs->flags |= F_PREFIX_REX;
|
||||
if ((hs->rex_w = (c & 0xf) >> 3) && (*p & 0xf8) == 0xb8)
|
||||
op64++;
|
||||
hs->rex_r = (c & 7) >> 2;
|
||||
hs->rex_x = (c & 3) >> 1;
|
||||
hs->rex_b = c & 1;
|
||||
if (((c = *p++) & 0xf0) == 0x40) {
|
||||
opcode = c;
|
||||
goto error_opcode;
|
||||
}
|
||||
}
|
||||
|
||||
if ((hs->opcode = c) == 0x0f) {
|
||||
hs->opcode2 = c = *p++;
|
||||
ht += DELTA_OPCODES;
|
||||
} else if (c >= 0xa0 && c <= 0xa3) {
|
||||
op64++;
|
||||
if (pref & PRE_67)
|
||||
pref |= PRE_66;
|
||||
else
|
||||
pref &= ~PRE_66;
|
||||
}
|
||||
|
||||
opcode = c;
|
||||
cflags = ht[ht[opcode / 4] + (opcode % 4)];
|
||||
|
||||
if (cflags == C_ERROR) {
|
||||
error_opcode:
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
cflags = 0;
|
||||
if ((opcode & -3) == 0x24)
|
||||
cflags++;
|
||||
}
|
||||
|
||||
x = 0;
|
||||
if (cflags & C_GROUP) {
|
||||
uint16_t t;
|
||||
t = *(uint16_t *)(ht + (cflags & 0x7f));
|
||||
cflags = (uint8_t)t;
|
||||
x = (uint8_t)(t >> 8);
|
||||
}
|
||||
|
||||
if (hs->opcode2) {
|
||||
ht = hde64_table + DELTA_PREFIXES;
|
||||
if (ht[ht[opcode / 4] + (opcode % 4)] & pref)
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
}
|
||||
|
||||
if (cflags & C_MODRM) {
|
||||
hs->flags |= F_MODRM;
|
||||
hs->modrm = c = *p++;
|
||||
hs->modrm_mod = m_mod = c >> 6;
|
||||
hs->modrm_rm = m_rm = c & 7;
|
||||
hs->modrm_reg = m_reg = (c & 0x3f) >> 3;
|
||||
|
||||
if (x && ((x << m_reg) & 0x80))
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
|
||||
if (!hs->opcode2 && opcode >= 0xd9 && opcode <= 0xdf) {
|
||||
uint8_t t = opcode - 0xd9;
|
||||
if (m_mod == 3) {
|
||||
ht = hde64_table + DELTA_FPU_MODRM + t*8;
|
||||
t = ht[m_reg] << m_rm;
|
||||
} else {
|
||||
ht = hde64_table + DELTA_FPU_REG;
|
||||
t = ht[t] << m_reg;
|
||||
}
|
||||
if (t & 0x80)
|
||||
hs->flags |= F_ERROR | F_ERROR_OPCODE;
|
||||
}
|
||||
|
||||
if (pref & PRE_LOCK) {
|
||||
if (m_mod == 3) {
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
} else {
|
||||
uint8_t *table_end, op = opcode;
|
||||
if (hs->opcode2) {
|
||||
ht = hde64_table + DELTA_OP2_LOCK_OK;
|
||||
table_end = ht + DELTA_OP_ONLY_MEM - DELTA_OP2_LOCK_OK;
|
||||
} else {
|
||||
ht = hde64_table + DELTA_OP_LOCK_OK;
|
||||
table_end = ht + DELTA_OP2_LOCK_OK - DELTA_OP_LOCK_OK;
|
||||
op &= -2;
|
||||
}
|
||||
for (; ht != table_end; ht++)
|
||||
if (*ht++ == op) {
|
||||
if (!((*ht << m_reg) & 0x80))
|
||||
goto no_lock_error;
|
||||
else
|
||||
break;
|
||||
}
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
no_lock_error:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (hs->opcode2) {
|
||||
switch (opcode) {
|
||||
case 0x20: case 0x22:
|
||||
m_mod = 3;
|
||||
if (m_reg > 4 || m_reg == 1)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
case 0x21: case 0x23:
|
||||
m_mod = 3;
|
||||
if (m_reg == 4 || m_reg == 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
}
|
||||
} else {
|
||||
switch (opcode) {
|
||||
case 0x8c:
|
||||
if (m_reg > 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
case 0x8e:
|
||||
if (m_reg == 1 || m_reg > 5)
|
||||
goto error_operand;
|
||||
else
|
||||
goto no_error_operand;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_mod == 3) {
|
||||
uint8_t *table_end;
|
||||
if (hs->opcode2) {
|
||||
ht = hde64_table + DELTA_OP2_ONLY_MEM;
|
||||
table_end = ht + sizeof(hde64_table) - DELTA_OP2_ONLY_MEM;
|
||||
} else {
|
||||
ht = hde64_table + DELTA_OP_ONLY_MEM;
|
||||
table_end = ht + DELTA_OP2_ONLY_MEM - DELTA_OP_ONLY_MEM;
|
||||
}
|
||||
for (; ht != table_end; ht += 2)
|
||||
if (*ht++ == opcode) {
|
||||
if (*ht++ & pref && !((*ht << m_reg) & 0x80))
|
||||
goto error_operand;
|
||||
else
|
||||
break;
|
||||
}
|
||||
goto no_error_operand;
|
||||
} else if (hs->opcode2) {
|
||||
switch (opcode) {
|
||||
case 0x50: case 0xd7: case 0xf7:
|
||||
if (pref & (PRE_NONE | PRE_66))
|
||||
goto error_operand;
|
||||
break;
|
||||
case 0xd6:
|
||||
if (pref & (PRE_F2 | PRE_F3))
|
||||
goto error_operand;
|
||||
break;
|
||||
case 0xc5:
|
||||
goto error_operand;
|
||||
}
|
||||
goto no_error_operand;
|
||||
} else
|
||||
goto no_error_operand;
|
||||
|
||||
error_operand:
|
||||
hs->flags |= F_ERROR | F_ERROR_OPERAND;
|
||||
no_error_operand:
|
||||
|
||||
c = *p++;
|
||||
if (m_reg <= 1) {
|
||||
if (opcode == 0xf6)
|
||||
cflags |= C_IMM8;
|
||||
else if (opcode == 0xf7)
|
||||
cflags |= C_IMM_P66;
|
||||
}
|
||||
|
||||
switch (m_mod) {
|
||||
case 0:
|
||||
if (pref & PRE_67) {
|
||||
if (m_rm == 6)
|
||||
disp_size = 2;
|
||||
} else
|
||||
if (m_rm == 5)
|
||||
disp_size = 4;
|
||||
break;
|
||||
case 1:
|
||||
disp_size = 1;
|
||||
break;
|
||||
case 2:
|
||||
disp_size = 2;
|
||||
if (!(pref & PRE_67))
|
||||
disp_size <<= 1;
|
||||
}
|
||||
|
||||
if (m_mod != 3 && m_rm == 4) {
|
||||
hs->flags |= F_SIB;
|
||||
p++;
|
||||
hs->sib = c;
|
||||
hs->sib_scale = c >> 6;
|
||||
hs->sib_index = (c & 0x3f) >> 3;
|
||||
if ((hs->sib_base = c & 7) == 5 && !(m_mod & 1))
|
||||
disp_size = 4;
|
||||
}
|
||||
|
||||
p--;
|
||||
switch (disp_size) {
|
||||
case 1:
|
||||
hs->flags |= F_DISP8;
|
||||
hs->disp.disp8 = *p;
|
||||
break;
|
||||
case 2:
|
||||
hs->flags |= F_DISP16;
|
||||
hs->disp.disp16 = *(uint16_t *)p;
|
||||
break;
|
||||
case 4:
|
||||
hs->flags |= F_DISP32;
|
||||
hs->disp.disp32 = *(uint32_t *)p;
|
||||
}
|
||||
p += disp_size;
|
||||
} else if (pref & PRE_LOCK)
|
||||
hs->flags |= F_ERROR | F_ERROR_LOCK;
|
||||
|
||||
if (cflags & C_IMM_P66) {
|
||||
if (cflags & C_REL32) {
|
||||
if (pref & PRE_66) {
|
||||
hs->flags |= F_IMM16 | F_RELATIVE;
|
||||
hs->imm.imm16 = *(uint16_t *)p;
|
||||
p += 2;
|
||||
goto disasm_done;
|
||||
}
|
||||
goto rel32_ok;
|
||||
}
|
||||
if (op64) {
|
||||
hs->flags |= F_IMM64;
|
||||
hs->imm.imm64 = *(uint64_t *)p;
|
||||
p += 8;
|
||||
} else if (!(pref & PRE_66)) {
|
||||
hs->flags |= F_IMM32;
|
||||
hs->imm.imm32 = *(uint32_t *)p;
|
||||
p += 4;
|
||||
} else
|
||||
goto imm16_ok;
|
||||
}
|
||||
|
||||
|
||||
if (cflags & C_IMM16) {
|
||||
imm16_ok:
|
||||
hs->flags |= F_IMM16;
|
||||
hs->imm.imm16 = *(uint16_t *)p;
|
||||
p += 2;
|
||||
}
|
||||
if (cflags & C_IMM8) {
|
||||
hs->flags |= F_IMM8;
|
||||
hs->imm.imm8 = *p++;
|
||||
}
|
||||
|
||||
if (cflags & C_REL32) {
|
||||
rel32_ok:
|
||||
hs->flags |= F_IMM32 | F_RELATIVE;
|
||||
hs->imm.imm32 = *(uint32_t *)p;
|
||||
p += 4;
|
||||
} else if (cflags & C_REL8) {
|
||||
hs->flags |= F_IMM8 | F_RELATIVE;
|
||||
hs->imm.imm8 = *p++;
|
||||
}
|
||||
|
||||
disasm_done:
|
||||
|
||||
if ((hs->len = (uint8_t)(p-(uint8_t *)code)) > 15) {
|
||||
hs->flags |= F_ERROR | F_ERROR_LENGTH;
|
||||
hs->len = 15;
|
||||
}
|
||||
|
||||
return (unsigned int)hs->len;
|
||||
}
|
||||
|
||||
#endif // defined(_M_X64) || defined(__x86_64__)
|
112
external/minhook/src/hde/hde64.h
vendored
112
external/minhook/src/hde/hde64.h
vendored
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 64
|
||||
* Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
* hde64.h: C/C++ header file
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HDE64_H_
|
||||
#define _HDE64_H_
|
||||
|
||||
/* stdint.h - C99 standard header
|
||||
* http://en.wikipedia.org/wiki/stdint.h
|
||||
*
|
||||
* if your compiler doesn't contain "stdint.h" header (for
|
||||
* example, Microsoft Visual C++), you can download file:
|
||||
* http://www.azillionmonkeys.com/qed/pstdint.h
|
||||
* and change next line to:
|
||||
* #include "pstdint.h"
|
||||
*/
|
||||
#include "pstdint.h"
|
||||
|
||||
#define F_MODRM 0x00000001
|
||||
#define F_SIB 0x00000002
|
||||
#define F_IMM8 0x00000004
|
||||
#define F_IMM16 0x00000008
|
||||
#define F_IMM32 0x00000010
|
||||
#define F_IMM64 0x00000020
|
||||
#define F_DISP8 0x00000040
|
||||
#define F_DISP16 0x00000080
|
||||
#define F_DISP32 0x00000100
|
||||
#define F_RELATIVE 0x00000200
|
||||
#define F_ERROR 0x00001000
|
||||
#define F_ERROR_OPCODE 0x00002000
|
||||
#define F_ERROR_LENGTH 0x00004000
|
||||
#define F_ERROR_LOCK 0x00008000
|
||||
#define F_ERROR_OPERAND 0x00010000
|
||||
#define F_PREFIX_REPNZ 0x01000000
|
||||
#define F_PREFIX_REPX 0x02000000
|
||||
#define F_PREFIX_REP 0x03000000
|
||||
#define F_PREFIX_66 0x04000000
|
||||
#define F_PREFIX_67 0x08000000
|
||||
#define F_PREFIX_LOCK 0x10000000
|
||||
#define F_PREFIX_SEG 0x20000000
|
||||
#define F_PREFIX_REX 0x40000000
|
||||
#define F_PREFIX_ANY 0x7f000000
|
||||
|
||||
#define PREFIX_SEGMENT_CS 0x2e
|
||||
#define PREFIX_SEGMENT_SS 0x36
|
||||
#define PREFIX_SEGMENT_DS 0x3e
|
||||
#define PREFIX_SEGMENT_ES 0x26
|
||||
#define PREFIX_SEGMENT_FS 0x64
|
||||
#define PREFIX_SEGMENT_GS 0x65
|
||||
#define PREFIX_LOCK 0xf0
|
||||
#define PREFIX_REPNZ 0xf2
|
||||
#define PREFIX_REPX 0xf3
|
||||
#define PREFIX_OPERAND_SIZE 0x66
|
||||
#define PREFIX_ADDRESS_SIZE 0x67
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
typedef struct {
|
||||
uint8_t len;
|
||||
uint8_t p_rep;
|
||||
uint8_t p_lock;
|
||||
uint8_t p_seg;
|
||||
uint8_t p_66;
|
||||
uint8_t p_67;
|
||||
uint8_t rex;
|
||||
uint8_t rex_w;
|
||||
uint8_t rex_r;
|
||||
uint8_t rex_x;
|
||||
uint8_t rex_b;
|
||||
uint8_t opcode;
|
||||
uint8_t opcode2;
|
||||
uint8_t modrm;
|
||||
uint8_t modrm_mod;
|
||||
uint8_t modrm_reg;
|
||||
uint8_t modrm_rm;
|
||||
uint8_t sib;
|
||||
uint8_t sib_scale;
|
||||
uint8_t sib_index;
|
||||
uint8_t sib_base;
|
||||
union {
|
||||
uint8_t imm8;
|
||||
uint16_t imm16;
|
||||
uint32_t imm32;
|
||||
uint64_t imm64;
|
||||
} imm;
|
||||
union {
|
||||
uint8_t disp8;
|
||||
uint16_t disp16;
|
||||
uint32_t disp32;
|
||||
} disp;
|
||||
uint32_t flags;
|
||||
} hde64s;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* __cdecl */
|
||||
unsigned int hde64_disasm(const void *code, hde64s *hs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _HDE64_H_ */
|
39
external/minhook/src/hde/pstdint.h
vendored
39
external/minhook/src/hde/pstdint.h
vendored
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// Integer types for HDE.
|
||||
typedef INT8 int8_t;
|
||||
typedef INT16 int16_t;
|
||||
typedef INT32 int32_t;
|
||||
typedef INT64 int64_t;
|
||||
typedef UINT8 uint8_t;
|
||||
typedef UINT16 uint16_t;
|
||||
typedef UINT32 uint32_t;
|
||||
typedef UINT64 uint64_t;
|
73
external/minhook/src/hde/table32.h
vendored
73
external/minhook/src/hde/table32.h
vendored
@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 32 C
|
||||
* Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#define C_NONE 0x00
|
||||
#define C_MODRM 0x01
|
||||
#define C_IMM8 0x02
|
||||
#define C_IMM16 0x04
|
||||
#define C_IMM_P66 0x10
|
||||
#define C_REL8 0x20
|
||||
#define C_REL32 0x40
|
||||
#define C_GROUP 0x80
|
||||
#define C_ERROR 0xff
|
||||
|
||||
#define PRE_ANY 0x00
|
||||
#define PRE_NONE 0x01
|
||||
#define PRE_F2 0x02
|
||||
#define PRE_F3 0x04
|
||||
#define PRE_66 0x08
|
||||
#define PRE_67 0x10
|
||||
#define PRE_LOCK 0x20
|
||||
#define PRE_SEG 0x40
|
||||
#define PRE_ALL 0xff
|
||||
|
||||
#define DELTA_OPCODES 0x4a
|
||||
#define DELTA_FPU_REG 0xf1
|
||||
#define DELTA_FPU_MODRM 0xf8
|
||||
#define DELTA_PREFIXES 0x130
|
||||
#define DELTA_OP_LOCK_OK 0x1a1
|
||||
#define DELTA_OP2_LOCK_OK 0x1b9
|
||||
#define DELTA_OP_ONLY_MEM 0x1cb
|
||||
#define DELTA_OP2_ONLY_MEM 0x1da
|
||||
|
||||
unsigned char hde32_table[] = {
|
||||
0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,
|
||||
0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f,
|
||||
0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3,
|
||||
0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa,
|
||||
0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90,
|
||||
0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f,
|
||||
0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d,
|
||||
0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59,
|
||||
0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,
|
||||
0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0,
|
||||
0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01,
|
||||
0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11,
|
||||
0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8,
|
||||
0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca,
|
||||
0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff,
|
||||
0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03,
|
||||
0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,
|
||||
0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f,
|
||||
0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a,
|
||||
0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,
|
||||
0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a,
|
||||
0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06,
|
||||
0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06,
|
||||
0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
|
||||
0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08,
|
||||
0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,
|
||||
0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,
|
||||
0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,
|
||||
0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,
|
||||
0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,
|
||||
0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,
|
||||
0xe7,0x08,0x00,0xf0,0x02,0x00
|
||||
};
|
74
external/minhook/src/hde/table64.h
vendored
74
external/minhook/src/hde/table64.h
vendored
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Hacker Disassembler Engine 64 C
|
||||
* Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#define C_NONE 0x00
|
||||
#define C_MODRM 0x01
|
||||
#define C_IMM8 0x02
|
||||
#define C_IMM16 0x04
|
||||
#define C_IMM_P66 0x10
|
||||
#define C_REL8 0x20
|
||||
#define C_REL32 0x40
|
||||
#define C_GROUP 0x80
|
||||
#define C_ERROR 0xff
|
||||
|
||||
#define PRE_ANY 0x00
|
||||
#define PRE_NONE 0x01
|
||||
#define PRE_F2 0x02
|
||||
#define PRE_F3 0x04
|
||||
#define PRE_66 0x08
|
||||
#define PRE_67 0x10
|
||||
#define PRE_LOCK 0x20
|
||||
#define PRE_SEG 0x40
|
||||
#define PRE_ALL 0xff
|
||||
|
||||
#define DELTA_OPCODES 0x4a
|
||||
#define DELTA_FPU_REG 0xfd
|
||||
#define DELTA_FPU_MODRM 0x104
|
||||
#define DELTA_PREFIXES 0x13c
|
||||
#define DELTA_OP_LOCK_OK 0x1ae
|
||||
#define DELTA_OP2_LOCK_OK 0x1c6
|
||||
#define DELTA_OP_ONLY_MEM 0x1d8
|
||||
#define DELTA_OP2_ONLY_MEM 0x1e7
|
||||
|
||||
unsigned char hde64_table[] = {
|
||||
0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5,
|
||||
0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1,
|
||||
0xa1,0xa1,0xb1,0xa5,0xa5,0xa6,0xc0,0xc0,0xd7,0xda,0xe0,0xc0,0xe4,0xc0,0xea,
|
||||
0xea,0xe0,0xe0,0x98,0xc8,0xee,0xf1,0xa5,0xd3,0xa5,0xa5,0xa1,0xea,0x9e,0xc0,
|
||||
0xc0,0xc2,0xc0,0xe6,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0xab,
|
||||
0x8b,0x90,0x64,0x5b,0x5b,0x5b,0x5b,0x5b,0x92,0x5b,0x5b,0x76,0x90,0x92,0x92,
|
||||
0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x6a,0x73,0x90,
|
||||
0x5b,0x52,0x52,0x52,0x52,0x5b,0x5b,0x5b,0x5b,0x77,0x7c,0x77,0x85,0x5b,0x5b,
|
||||
0x70,0x5b,0x7a,0xaf,0x76,0x76,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
|
||||
0x5b,0x5b,0x86,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xd5,0x03,0xcc,0x01,0xbc,
|
||||
0x03,0xf0,0x03,0x03,0x04,0x00,0x50,0x50,0x50,0x50,0xff,0x20,0x20,0x20,0x20,
|
||||
0x01,0x01,0x01,0x01,0xc4,0x02,0x10,0xff,0xff,0xff,0x01,0x00,0x03,0x11,0xff,
|
||||
0x03,0xc4,0xc6,0xc8,0x02,0x10,0x00,0xff,0xcc,0x01,0x01,0x01,0x00,0x00,0x00,
|
||||
0x00,0x01,0x01,0x03,0x01,0xff,0xff,0xc0,0xc2,0x10,0x11,0x02,0x03,0x01,0x01,
|
||||
0x01,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x10,
|
||||
0x10,0x10,0x10,0x02,0x10,0x00,0x00,0xc6,0xc8,0x02,0x02,0x02,0x02,0x06,0x00,
|
||||
0x04,0x00,0x02,0xff,0x00,0xc0,0xc2,0x01,0x01,0x03,0x03,0x03,0xca,0x40,0x00,
|
||||
0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0xff,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,
|
||||
0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,
|
||||
0xff,0x40,0x40,0x40,0x40,0x41,0x49,0x40,0x40,0x40,0x40,0x4c,0x42,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x4f,0x44,0x53,0x40,0x40,0x40,0x44,0x57,0x43,
|
||||
0x5c,0x40,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x64,0x66,0x6e,0x6b,0x40,0x40,0x6a,0x46,0x40,0x40,0x44,0x46,0x40,
|
||||
0x40,0x5b,0x44,0x40,0x40,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x01,0x06,
|
||||
0x06,0x02,0x06,0x06,0x00,0x06,0x00,0x0a,0x0a,0x00,0x00,0x00,0x02,0x07,0x07,
|
||||
0x06,0x02,0x0d,0x06,0x06,0x06,0x0e,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
|
||||
0x04,0x04,0x05,0x06,0x06,0x06,0x00,0x00,0x00,0x0e,0x00,0x00,0x08,0x00,0x10,
|
||||
0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,0x86,0x00,
|
||||
0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,0xf8,0xbb,
|
||||
0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,0xc4,0xff,
|
||||
0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,0x13,0x09,
|
||||
0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,0xb2,0xff,
|
||||
0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08,
|
||||
0x00,0xf0,0x02,0x00
|
||||
};
|
906
external/minhook/src/hook.c
vendored
906
external/minhook/src/hook.c
vendored
@ -1,906 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../include/MinHook.h"
|
||||
#include "buffer.h"
|
||||
#include "trampoline.h"
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
#endif
|
||||
|
||||
// Initial capacity of the HOOK_ENTRY buffer.
|
||||
#define INITIAL_HOOK_CAPACITY 32
|
||||
|
||||
// Initial capacity of the thread IDs buffer.
|
||||
#define INITIAL_THREAD_CAPACITY 128
|
||||
|
||||
// Special hook position values.
|
||||
#define INVALID_HOOK_POS UINT_MAX
|
||||
#define ALL_HOOKS_POS UINT_MAX
|
||||
|
||||
// Freeze() action argument defines.
|
||||
#define ACTION_DISABLE 0
|
||||
#define ACTION_ENABLE 1
|
||||
#define ACTION_APPLY_QUEUED 2
|
||||
|
||||
// Thread access rights for suspending/resuming threads.
|
||||
#define THREAD_ACCESS \
|
||||
(THREAD_SUSPEND_RESUME | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION | THREAD_SET_CONTEXT)
|
||||
|
||||
// Hook information.
|
||||
typedef struct _HOOK_ENTRY
|
||||
{
|
||||
LPVOID pTarget; // Address of the target function.
|
||||
LPVOID pDetour; // Address of the detour or relay function.
|
||||
LPVOID pTrampoline; // Address of the trampoline function.
|
||||
UINT8 backup[8]; // Original prologue of the target function.
|
||||
|
||||
UINT8 patchAbove : 1; // Uses the hot patch area.
|
||||
UINT8 isEnabled : 1; // Enabled.
|
||||
UINT8 queueEnable : 1; // Queued for enabling/disabling when != isEnabled.
|
||||
|
||||
UINT nIP : 4; // Count of the instruction boundaries.
|
||||
UINT8 oldIPs[8]; // Instruction boundaries of the target function.
|
||||
UINT8 newIPs[8]; // Instruction boundaries of the trampoline function.
|
||||
} HOOK_ENTRY, *PHOOK_ENTRY;
|
||||
|
||||
// Suspended threads for Freeze()/Unfreeze().
|
||||
typedef struct _FROZEN_THREADS
|
||||
{
|
||||
LPDWORD pItems; // Data heap
|
||||
UINT capacity; // Size of allocated data heap, items
|
||||
UINT size; // Actual number of data items
|
||||
} FROZEN_THREADS, *PFROZEN_THREADS;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Global Variables:
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// Spin lock flag for EnterSpinLock()/LeaveSpinLock().
|
||||
volatile LONG g_isLocked = FALSE;
|
||||
|
||||
// Private heap handle. If not NULL, this library is initialized.
|
||||
HANDLE g_hHeap = NULL;
|
||||
|
||||
// Hook entries.
|
||||
struct
|
||||
{
|
||||
PHOOK_ENTRY pItems; // Data heap
|
||||
UINT capacity; // Size of allocated data heap, items
|
||||
UINT size; // Actual number of data items
|
||||
} g_hooks;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Returns INVALID_HOOK_POS if not found.
|
||||
static UINT FindHookEntry(LPVOID pTarget)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0; i < g_hooks.size; ++i)
|
||||
{
|
||||
if ((ULONG_PTR)pTarget == (ULONG_PTR)g_hooks.pItems[i].pTarget)
|
||||
return i;
|
||||
}
|
||||
|
||||
return INVALID_HOOK_POS;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static PHOOK_ENTRY AddHookEntry()
|
||||
{
|
||||
if (g_hooks.pItems == NULL)
|
||||
{
|
||||
g_hooks.capacity = INITIAL_HOOK_CAPACITY;
|
||||
g_hooks.pItems = (PHOOK_ENTRY)HeapAlloc(
|
||||
g_hHeap, 0, g_hooks.capacity * sizeof(HOOK_ENTRY));
|
||||
if (g_hooks.pItems == NULL)
|
||||
return NULL;
|
||||
}
|
||||
else if (g_hooks.size >= g_hooks.capacity)
|
||||
{
|
||||
PHOOK_ENTRY p = (PHOOK_ENTRY)HeapReAlloc(
|
||||
g_hHeap, 0, g_hooks.pItems, (g_hooks.capacity * 2) * sizeof(HOOK_ENTRY));
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
g_hooks.capacity *= 2;
|
||||
g_hooks.pItems = p;
|
||||
}
|
||||
|
||||
return &g_hooks.pItems[g_hooks.size++];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static void DeleteHookEntry(UINT pos)
|
||||
{
|
||||
if (pos < g_hooks.size - 1)
|
||||
g_hooks.pItems[pos] = g_hooks.pItems[g_hooks.size - 1];
|
||||
|
||||
g_hooks.size--;
|
||||
|
||||
if (g_hooks.capacity / 2 >= INITIAL_HOOK_CAPACITY && g_hooks.capacity / 2 >= g_hooks.size)
|
||||
{
|
||||
PHOOK_ENTRY p = (PHOOK_ENTRY)HeapReAlloc(
|
||||
g_hHeap, 0, g_hooks.pItems, (g_hooks.capacity / 2) * sizeof(HOOK_ENTRY));
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
g_hooks.capacity /= 2;
|
||||
g_hooks.pItems = p;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static DWORD_PTR FindOldIP(PHOOK_ENTRY pHook, DWORD_PTR ip)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
if (pHook->patchAbove && ip == ((DWORD_PTR)pHook->pTarget - sizeof(JMP_REL)))
|
||||
return (DWORD_PTR)pHook->pTarget;
|
||||
|
||||
for (i = 0; i < pHook->nIP; ++i)
|
||||
{
|
||||
if (ip == ((DWORD_PTR)pHook->pTrampoline + pHook->newIPs[i]))
|
||||
return (DWORD_PTR)pHook->pTarget + pHook->oldIPs[i];
|
||||
}
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
// Check relay function.
|
||||
if (ip == (DWORD_PTR)pHook->pDetour)
|
||||
return (DWORD_PTR)pHook->pTarget;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static DWORD_PTR FindNewIP(PHOOK_ENTRY pHook, DWORD_PTR ip)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0; i < pHook->nIP; ++i)
|
||||
{
|
||||
if (ip == ((DWORD_PTR)pHook->pTarget + pHook->oldIPs[i]))
|
||||
return (DWORD_PTR)pHook->pTrampoline + pHook->newIPs[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static void ProcessThreadIPs(HANDLE hThread, UINT pos, UINT action)
|
||||
{
|
||||
// If the thread suspended in the overwritten area,
|
||||
// move IP to the proper address.
|
||||
|
||||
CONTEXT c;
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
DWORD64 *pIP = &c.Rip;
|
||||
#else
|
||||
DWORD *pIP = &c.Eip;
|
||||
#endif
|
||||
UINT count;
|
||||
|
||||
c.ContextFlags = CONTEXT_CONTROL;
|
||||
if (!GetThreadContext(hThread, &c))
|
||||
return;
|
||||
|
||||
if (pos == ALL_HOOKS_POS)
|
||||
{
|
||||
pos = 0;
|
||||
count = g_hooks.size;
|
||||
}
|
||||
else
|
||||
{
|
||||
count = pos + 1;
|
||||
}
|
||||
|
||||
for (; pos < count; ++pos)
|
||||
{
|
||||
PHOOK_ENTRY pHook = &g_hooks.pItems[pos];
|
||||
BOOL enable;
|
||||
DWORD_PTR ip;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_DISABLE:
|
||||
enable = FALSE;
|
||||
break;
|
||||
|
||||
case ACTION_ENABLE:
|
||||
enable = TRUE;
|
||||
break;
|
||||
|
||||
default: // ACTION_APPLY_QUEUED
|
||||
enable = pHook->queueEnable;
|
||||
break;
|
||||
}
|
||||
if (pHook->isEnabled == enable)
|
||||
continue;
|
||||
|
||||
if (enable)
|
||||
ip = FindNewIP(pHook, *pIP);
|
||||
else
|
||||
ip = FindOldIP(pHook, *pIP);
|
||||
|
||||
if (ip != 0)
|
||||
{
|
||||
*pIP = ip;
|
||||
SetThreadContext(hThread, &c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static VOID EnumerateThreads(PFROZEN_THREADS pThreads)
|
||||
{
|
||||
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
if (hSnapshot != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
THREADENTRY32 te;
|
||||
te.dwSize = sizeof(THREADENTRY32);
|
||||
if (Thread32First(hSnapshot, &te))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (te.dwSize >= (FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(DWORD))
|
||||
&& te.th32OwnerProcessID == GetCurrentProcessId()
|
||||
&& te.th32ThreadID != GetCurrentThreadId())
|
||||
{
|
||||
if (pThreads->pItems == NULL)
|
||||
{
|
||||
pThreads->capacity = INITIAL_THREAD_CAPACITY;
|
||||
pThreads->pItems
|
||||
= (LPDWORD)HeapAlloc(g_hHeap, 0, pThreads->capacity * sizeof(DWORD));
|
||||
if (pThreads->pItems == NULL)
|
||||
break;
|
||||
}
|
||||
else if (pThreads->size >= pThreads->capacity)
|
||||
{
|
||||
LPDWORD p = (LPDWORD)HeapReAlloc(
|
||||
g_hHeap, 0, pThreads->pItems, (pThreads->capacity * 2) * sizeof(DWORD));
|
||||
if (p == NULL)
|
||||
{
|
||||
HeapFree(g_hHeap, 0, pThreads->pItems);
|
||||
pThreads->pItems = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
pThreads->capacity *= 2;
|
||||
pThreads->pItems = p;
|
||||
}
|
||||
pThreads->pItems[pThreads->size++] = te.th32ThreadID;
|
||||
}
|
||||
|
||||
te.dwSize = sizeof(THREADENTRY32);
|
||||
} while (Thread32Next(hSnapshot, &te));
|
||||
}
|
||||
CloseHandle(hSnapshot);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static MH_STATUS Freeze(PFROZEN_THREADS pThreads, UINT pos, UINT action)
|
||||
{
|
||||
pThreads->pItems = NULL;
|
||||
pThreads->capacity = 0;
|
||||
pThreads->size = 0;
|
||||
EnumerateThreads(pThreads);
|
||||
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
if (pThreads->pItems != NULL)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0; i < pThreads->size; ++i)
|
||||
{
|
||||
HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]);
|
||||
if (hThread != NULL)
|
||||
{
|
||||
SuspendThread(hThread);
|
||||
ProcessThreadIPs(hThread, pos, action);
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_MEMORY_ALLOC;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static VOID Unfreeze(PFROZEN_THREADS pThreads)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0; i < pThreads->size; ++i)
|
||||
{
|
||||
HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]);
|
||||
if (hThread != NULL)
|
||||
{
|
||||
ResumeThread(hThread);
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(g_hHeap, 0, pThreads->pItems);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static MH_STATUS EnableHookLL(UINT pos, BOOL enable)
|
||||
{
|
||||
PHOOK_ENTRY pHook = &g_hooks.pItems[pos];
|
||||
DWORD oldProtect;
|
||||
SIZE_T patchSize = sizeof(JMP_REL);
|
||||
LPBYTE pPatchTarget = (LPBYTE)pHook->pTarget;
|
||||
|
||||
if (pHook->patchAbove)
|
||||
{
|
||||
pPatchTarget -= sizeof(JMP_REL);
|
||||
patchSize += sizeof(JMP_REL_SHORT);
|
||||
}
|
||||
|
||||
if (!VirtualProtect(pPatchTarget, patchSize, PAGE_EXECUTE_READWRITE, &oldProtect))
|
||||
return MH_ERROR_MEMORY_PROTECT;
|
||||
|
||||
if (enable)
|
||||
{
|
||||
PJMP_REL pJmp = (PJMP_REL)pPatchTarget;
|
||||
pJmp->opcode = 0xE9;
|
||||
pJmp->operand = (UINT32)((LPBYTE)pHook->pDetour - (pPatchTarget + sizeof(JMP_REL)));
|
||||
|
||||
if (pHook->patchAbove)
|
||||
{
|
||||
PJMP_REL_SHORT pShortJmp = (PJMP_REL_SHORT)pHook->pTarget;
|
||||
pShortJmp->opcode = 0xEB;
|
||||
pShortJmp->operand = (UINT8)(0 - (sizeof(JMP_REL_SHORT) + sizeof(JMP_REL)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pHook->patchAbove)
|
||||
memcpy(pPatchTarget, pHook->backup, sizeof(JMP_REL) + sizeof(JMP_REL_SHORT));
|
||||
else
|
||||
memcpy(pPatchTarget, pHook->backup, sizeof(JMP_REL));
|
||||
}
|
||||
|
||||
VirtualProtect(pPatchTarget, patchSize, oldProtect, &oldProtect);
|
||||
|
||||
// Just-in-case measure.
|
||||
FlushInstructionCache(GetCurrentProcess(), pPatchTarget, patchSize);
|
||||
|
||||
pHook->isEnabled = enable;
|
||||
pHook->queueEnable = enable;
|
||||
|
||||
return MH_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static MH_STATUS EnableAllHooksLL(BOOL enable)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
UINT i, first = INVALID_HOOK_POS;
|
||||
|
||||
for (i = 0; i < g_hooks.size; ++i)
|
||||
{
|
||||
if (g_hooks.pItems[i].isEnabled != enable)
|
||||
{
|
||||
first = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (first != INVALID_HOOK_POS)
|
||||
{
|
||||
FROZEN_THREADS threads;
|
||||
status = Freeze(&threads, ALL_HOOKS_POS, enable ? ACTION_ENABLE : ACTION_DISABLE);
|
||||
if (status == MH_OK)
|
||||
{
|
||||
for (i = first; i < g_hooks.size; ++i)
|
||||
{
|
||||
if (g_hooks.pItems[i].isEnabled != enable)
|
||||
{
|
||||
status = EnableHookLL(i, enable);
|
||||
if (status != MH_OK)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Unfreeze(&threads);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static VOID EnterSpinLock(VOID)
|
||||
{
|
||||
SIZE_T spinCount = 0;
|
||||
|
||||
// Wait until the flag is FALSE.
|
||||
while (InterlockedCompareExchange(&g_isLocked, TRUE, FALSE) != FALSE)
|
||||
{
|
||||
// No need to generate a memory barrier here, since InterlockedCompareExchange()
|
||||
// generates a full memory barrier itself.
|
||||
|
||||
// Prevent the loop from being too busy.
|
||||
if (spinCount < 32)
|
||||
Sleep(0);
|
||||
else
|
||||
Sleep(1);
|
||||
|
||||
spinCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static VOID LeaveSpinLock(VOID)
|
||||
{
|
||||
// No need to generate a memory barrier here, since InterlockedExchange()
|
||||
// generates a full memory barrier itself.
|
||||
|
||||
InterlockedExchange(&g_isLocked, FALSE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_Initialize(VOID)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap == NULL)
|
||||
{
|
||||
g_hHeap = HeapCreate(0, 0, 0);
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
// Initialize the internal function buffer.
|
||||
InitializeBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_Uninitialize(VOID)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
status = EnableAllHooksLL(FALSE);
|
||||
if (status == MH_OK)
|
||||
{
|
||||
// Free the internal function buffer.
|
||||
|
||||
// HeapFree is actually not required, but some tools detect a false
|
||||
// memory leak without HeapFree.
|
||||
|
||||
UninitializeBuffer();
|
||||
|
||||
HeapFree(g_hHeap, 0, g_hooks.pItems);
|
||||
HeapDestroy(g_hHeap);
|
||||
|
||||
g_hHeap = NULL;
|
||||
|
||||
g_hooks.pItems = NULL;
|
||||
g_hooks.capacity = 0;
|
||||
g_hooks.size = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
if (IsExecutableAddress(pTarget) && IsExecutableAddress(pDetour))
|
||||
{
|
||||
UINT pos = FindHookEntry(pTarget);
|
||||
if (pos == INVALID_HOOK_POS)
|
||||
{
|
||||
LPVOID pBuffer = AllocateBuffer(pTarget);
|
||||
if (pBuffer != NULL)
|
||||
{
|
||||
TRAMPOLINE ct;
|
||||
|
||||
ct.pTarget = pTarget;
|
||||
ct.pDetour = pDetour;
|
||||
ct.pTrampoline = pBuffer;
|
||||
if (CreateTrampolineFunction(&ct))
|
||||
{
|
||||
PHOOK_ENTRY pHook = AddHookEntry();
|
||||
if (pHook != NULL)
|
||||
{
|
||||
pHook->pTarget = ct.pTarget;
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
pHook->pDetour = ct.pRelay;
|
||||
#else
|
||||
pHook->pDetour = ct.pDetour;
|
||||
#endif
|
||||
pHook->pTrampoline = ct.pTrampoline;
|
||||
pHook->patchAbove = ct.patchAbove;
|
||||
pHook->isEnabled = FALSE;
|
||||
pHook->queueEnable = FALSE;
|
||||
pHook->nIP = ct.nIP;
|
||||
memcpy(pHook->oldIPs, ct.oldIPs, ARRAYSIZE(ct.oldIPs));
|
||||
memcpy(pHook->newIPs, ct.newIPs, ARRAYSIZE(ct.newIPs));
|
||||
|
||||
// Back up the target function.
|
||||
|
||||
if (ct.patchAbove)
|
||||
{
|
||||
memcpy(
|
||||
pHook->backup,
|
||||
(LPBYTE)pTarget - sizeof(JMP_REL),
|
||||
sizeof(JMP_REL) + sizeof(JMP_REL_SHORT));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(pHook->backup, pTarget, sizeof(JMP_REL));
|
||||
}
|
||||
|
||||
if (ppOriginal != NULL)
|
||||
*ppOriginal = pHook->pTrampoline;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
if (status != MH_OK)
|
||||
{
|
||||
FreeBuffer(pBuffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_ALREADY_CREATED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_EXECUTABLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
UINT pos = FindHookEntry(pTarget);
|
||||
if (pos != INVALID_HOOK_POS)
|
||||
{
|
||||
if (g_hooks.pItems[pos].isEnabled)
|
||||
{
|
||||
FROZEN_THREADS threads;
|
||||
status = Freeze(&threads, pos, ACTION_DISABLE);
|
||||
if (status == MH_OK)
|
||||
{
|
||||
status = EnableHookLL(pos, FALSE);
|
||||
|
||||
Unfreeze(&threads);
|
||||
}
|
||||
}
|
||||
|
||||
if (status == MH_OK)
|
||||
{
|
||||
FreeBuffer(g_hooks.pItems[pos].pTrampoline);
|
||||
DeleteHookEntry(pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_CREATED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static MH_STATUS EnableHook(LPVOID pTarget, BOOL enable)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
if (pTarget == MH_ALL_HOOKS)
|
||||
{
|
||||
status = EnableAllHooksLL(enable);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT pos = FindHookEntry(pTarget);
|
||||
if (pos != INVALID_HOOK_POS)
|
||||
{
|
||||
if (g_hooks.pItems[pos].isEnabled != enable)
|
||||
{
|
||||
FROZEN_THREADS threads;
|
||||
status = Freeze(&threads, pos, ACTION_ENABLE);
|
||||
if (status == MH_OK)
|
||||
{
|
||||
status = EnableHookLL(pos, enable);
|
||||
|
||||
Unfreeze(&threads);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = enable ? MH_ERROR_ENABLED : MH_ERROR_DISABLED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_CREATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget)
|
||||
{
|
||||
return EnableHook(pTarget, TRUE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget)
|
||||
{
|
||||
return EnableHook(pTarget, FALSE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static MH_STATUS QueueHook(LPVOID pTarget, BOOL queueEnable)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
if (pTarget == MH_ALL_HOOKS)
|
||||
{
|
||||
UINT i;
|
||||
for (i = 0; i < g_hooks.size; ++i)
|
||||
g_hooks.pItems[i].queueEnable = queueEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT pos = FindHookEntry(pTarget);
|
||||
if (pos != INVALID_HOOK_POS)
|
||||
{
|
||||
g_hooks.pItems[pos].queueEnable = queueEnable;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_CREATED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget)
|
||||
{
|
||||
return QueueHook(pTarget, TRUE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget)
|
||||
{
|
||||
return QueueHook(pTarget, FALSE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_ApplyQueued(VOID)
|
||||
{
|
||||
MH_STATUS status = MH_OK;
|
||||
UINT i, first = INVALID_HOOK_POS;
|
||||
|
||||
EnterSpinLock();
|
||||
|
||||
if (g_hHeap != NULL)
|
||||
{
|
||||
for (i = 0; i < g_hooks.size; ++i)
|
||||
{
|
||||
if (g_hooks.pItems[i].isEnabled != g_hooks.pItems[i].queueEnable)
|
||||
{
|
||||
first = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (first != INVALID_HOOK_POS)
|
||||
{
|
||||
FROZEN_THREADS threads;
|
||||
status = Freeze(&threads, ALL_HOOKS_POS, ACTION_APPLY_QUEUED);
|
||||
if (status == MH_OK)
|
||||
{
|
||||
for (i = first; i < g_hooks.size; ++i)
|
||||
{
|
||||
PHOOK_ENTRY pHook = &g_hooks.pItems[i];
|
||||
if (pHook->isEnabled != pHook->queueEnable)
|
||||
{
|
||||
status = EnableHookLL(i, pHook->queueEnable);
|
||||
if (status != MH_OK)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Unfreeze(&threads);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status = MH_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
LeaveSpinLock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_CreateHookApiEx(
|
||||
LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour,
|
||||
LPVOID *ppOriginal, LPVOID *ppTarget)
|
||||
{
|
||||
HMODULE hModule;
|
||||
LPVOID pTarget;
|
||||
|
||||
hModule = GetModuleHandleW(pszModule);
|
||||
if (hModule == NULL)
|
||||
return MH_ERROR_MODULE_NOT_FOUND;
|
||||
|
||||
pTarget = (LPVOID)GetProcAddress(hModule, pszProcName);
|
||||
if (pTarget == NULL)
|
||||
return MH_ERROR_FUNCTION_NOT_FOUND;
|
||||
|
||||
if(ppTarget != NULL)
|
||||
*ppTarget = pTarget;
|
||||
|
||||
return MH_CreateHook(pTarget, pDetour, ppOriginal);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
MH_STATUS WINAPI MH_CreateHookApi(
|
||||
LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal)
|
||||
{
|
||||
return MH_CreateHookApiEx(pszModule, pszProcName, pDetour, ppOriginal, NULL);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
const char * WINAPI MH_StatusToString(MH_STATUS status)
|
||||
{
|
||||
#define MH_ST2STR(x) \
|
||||
case x: \
|
||||
return #x;
|
||||
|
||||
switch (status) {
|
||||
MH_ST2STR(MH_UNKNOWN)
|
||||
MH_ST2STR(MH_OK)
|
||||
MH_ST2STR(MH_ERROR_ALREADY_INITIALIZED)
|
||||
MH_ST2STR(MH_ERROR_NOT_INITIALIZED)
|
||||
MH_ST2STR(MH_ERROR_ALREADY_CREATED)
|
||||
MH_ST2STR(MH_ERROR_NOT_CREATED)
|
||||
MH_ST2STR(MH_ERROR_ENABLED)
|
||||
MH_ST2STR(MH_ERROR_DISABLED)
|
||||
MH_ST2STR(MH_ERROR_NOT_EXECUTABLE)
|
||||
MH_ST2STR(MH_ERROR_UNSUPPORTED_FUNCTION)
|
||||
MH_ST2STR(MH_ERROR_MEMORY_ALLOC)
|
||||
MH_ST2STR(MH_ERROR_MEMORY_PROTECT)
|
||||
MH_ST2STR(MH_ERROR_MODULE_NOT_FOUND)
|
||||
MH_ST2STR(MH_ERROR_FUNCTION_NOT_FOUND)
|
||||
}
|
||||
|
||||
#undef MH_ST2STR
|
||||
|
||||
return "(unknown)";
|
||||
}
|
320
external/minhook/src/trampoline.c
vendored
320
external/minhook/src/trampoline.c
vendored
@ -1,320 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
#endif
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#include "./hde/hde64.h"
|
||||
typedef hde64s HDE;
|
||||
#define HDE_DISASM(code, hs) hde64_disasm(code, hs)
|
||||
#else
|
||||
#include "./hde/hde32.h"
|
||||
typedef hde32s HDE;
|
||||
#define HDE_DISASM(code, hs) hde32_disasm(code, hs)
|
||||
#endif
|
||||
|
||||
#include "trampoline.h"
|
||||
#include "buffer.h"
|
||||
|
||||
// Maximum size of a trampoline function.
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
#define TRAMPOLINE_MAX_SIZE (MEMORY_SLOT_SIZE - sizeof(JMP_ABS))
|
||||
#else
|
||||
#define TRAMPOLINE_MAX_SIZE MEMORY_SLOT_SIZE
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
static BOOL IsCodePadding(LPBYTE pInst, UINT size)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
if (pInst[0] != 0x00 && pInst[0] != 0x90 && pInst[0] != 0xCC)
|
||||
return FALSE;
|
||||
|
||||
for (i = 1; i < size; ++i)
|
||||
{
|
||||
if (pInst[i] != pInst[0])
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
BOOL CreateTrampolineFunction(PTRAMPOLINE ct)
|
||||
{
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
CALL_ABS call = {
|
||||
0xFF, 0x15, 0x00000002, // FF15 00000002: CALL [RIP+8]
|
||||
0xEB, 0x08, // EB 08: JMP +10
|
||||
0x0000000000000000ULL // Absolute destination address
|
||||
};
|
||||
JMP_ABS jmp = {
|
||||
0xFF, 0x25, 0x00000000, // FF25 00000000: JMP [RIP+6]
|
||||
0x0000000000000000ULL // Absolute destination address
|
||||
};
|
||||
JCC_ABS jcc = {
|
||||
0x70, 0x0E, // 7* 0E: J** +16
|
||||
0xFF, 0x25, 0x00000000, // FF25 00000000: JMP [RIP+6]
|
||||
0x0000000000000000ULL // Absolute destination address
|
||||
};
|
||||
#else
|
||||
CALL_REL call = {
|
||||
0xE8, // E8 xxxxxxxx: CALL +5+xxxxxxxx
|
||||
0x00000000 // Relative destination address
|
||||
};
|
||||
JMP_REL jmp = {
|
||||
0xE9, // E9 xxxxxxxx: JMP +5+xxxxxxxx
|
||||
0x00000000 // Relative destination address
|
||||
};
|
||||
JCC_REL jcc = {
|
||||
0x0F, 0x80, // 0F8* xxxxxxxx: J** +6+xxxxxxxx
|
||||
0x00000000 // Relative destination address
|
||||
};
|
||||
#endif
|
||||
|
||||
UINT8 oldPos = 0;
|
||||
UINT8 newPos = 0;
|
||||
ULONG_PTR jmpDest = 0; // Destination address of an internal jump.
|
||||
BOOL finished = FALSE; // Is the function completed?
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
UINT8 instBuf[16];
|
||||
#endif
|
||||
|
||||
ct->patchAbove = FALSE;
|
||||
ct->nIP = 0;
|
||||
|
||||
do
|
||||
{
|
||||
HDE hs;
|
||||
UINT copySize;
|
||||
LPVOID pCopySrc;
|
||||
ULONG_PTR pOldInst = (ULONG_PTR)ct->pTarget + oldPos;
|
||||
ULONG_PTR pNewInst = (ULONG_PTR)ct->pTrampoline + newPos;
|
||||
|
||||
copySize = HDE_DISASM((LPVOID)pOldInst, &hs);
|
||||
if (hs.flags & F_ERROR)
|
||||
return FALSE;
|
||||
|
||||
pCopySrc = (LPVOID)pOldInst;
|
||||
if (oldPos >= sizeof(JMP_REL))
|
||||
{
|
||||
// The trampoline function is long enough.
|
||||
// Complete the function with the jump to the target function.
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
jmp.address = pOldInst;
|
||||
#else
|
||||
jmp.operand = (UINT32)(pOldInst - (pNewInst + sizeof(jmp)));
|
||||
#endif
|
||||
pCopySrc = &jmp;
|
||||
copySize = sizeof(jmp);
|
||||
|
||||
finished = TRUE;
|
||||
}
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
else if ((hs.modrm & 0xC7) == 0x05)
|
||||
{
|
||||
// Instructions using RIP relative addressing. (ModR/M = 00???101B)
|
||||
|
||||
// Modify the RIP relative address.
|
||||
PUINT32 pRelAddr;
|
||||
|
||||
// Avoid using memcpy to reduce the footprint.
|
||||
#ifndef _MSC_VER
|
||||
memcpy(instBuf, (LPBYTE)pOldInst, copySize);
|
||||
#else
|
||||
__movsb(instBuf, (LPBYTE)pOldInst, copySize);
|
||||
#endif
|
||||
pCopySrc = instBuf;
|
||||
|
||||
// Relative address is stored at (instruction length - immediate value length - 4).
|
||||
pRelAddr = (PUINT32)(instBuf + hs.len - ((hs.flags & 0x3C) >> 2) - 4);
|
||||
*pRelAddr
|
||||
= (UINT32)((pOldInst + hs.len + (INT32)hs.disp.disp32) - (pNewInst + hs.len));
|
||||
|
||||
// Complete the function if JMP (FF /4).
|
||||
if (hs.opcode == 0xFF && hs.modrm_reg == 4)
|
||||
finished = TRUE;
|
||||
}
|
||||
#endif
|
||||
else if (hs.opcode == 0xE8)
|
||||
{
|
||||
// Direct relative CALL
|
||||
ULONG_PTR dest = pOldInst + hs.len + (INT32)hs.imm.imm32;
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
call.address = dest;
|
||||
#else
|
||||
call.operand = (UINT32)(dest - (pNewInst + sizeof(call)));
|
||||
#endif
|
||||
pCopySrc = &call;
|
||||
copySize = sizeof(call);
|
||||
}
|
||||
else if ((hs.opcode & 0xFD) == 0xE9)
|
||||
{
|
||||
// Direct relative JMP (EB or E9)
|
||||
ULONG_PTR dest = pOldInst + hs.len;
|
||||
|
||||
if (hs.opcode == 0xEB) // isShort jmp
|
||||
dest += (INT8)hs.imm.imm8;
|
||||
else
|
||||
dest += (INT32)hs.imm.imm32;
|
||||
|
||||
// Simply copy an internal jump.
|
||||
if ((ULONG_PTR)ct->pTarget <= dest
|
||||
&& dest < ((ULONG_PTR)ct->pTarget + sizeof(JMP_REL)))
|
||||
{
|
||||
if (jmpDest < dest)
|
||||
jmpDest = dest;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
jmp.address = dest;
|
||||
#else
|
||||
jmp.operand = (UINT32)(dest - (pNewInst + sizeof(jmp)));
|
||||
#endif
|
||||
pCopySrc = &jmp;
|
||||
copySize = sizeof(jmp);
|
||||
|
||||
// Exit the function if it is not in the branch.
|
||||
finished = (pOldInst >= jmpDest);
|
||||
}
|
||||
}
|
||||
else if ((hs.opcode & 0xF0) == 0x70
|
||||
|| (hs.opcode & 0xFC) == 0xE0
|
||||
|| (hs.opcode2 & 0xF0) == 0x80)
|
||||
{
|
||||
// Direct relative Jcc
|
||||
ULONG_PTR dest = pOldInst + hs.len;
|
||||
|
||||
if ((hs.opcode & 0xF0) == 0x70 // Jcc
|
||||
|| (hs.opcode & 0xFC) == 0xE0) // LOOPNZ/LOOPZ/LOOP/JECXZ
|
||||
dest += (INT8)hs.imm.imm8;
|
||||
else
|
||||
dest += (INT32)hs.imm.imm32;
|
||||
|
||||
// Simply copy an internal jump.
|
||||
if ((ULONG_PTR)ct->pTarget <= dest
|
||||
&& dest < ((ULONG_PTR)ct->pTarget + sizeof(JMP_REL)))
|
||||
{
|
||||
if (jmpDest < dest)
|
||||
jmpDest = dest;
|
||||
}
|
||||
else if ((hs.opcode & 0xFC) == 0xE0)
|
||||
{
|
||||
// LOOPNZ/LOOPZ/LOOP/JCXZ/JECXZ to the outside are not supported.
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT8 cond = ((hs.opcode != 0x0F ? hs.opcode : hs.opcode2) & 0x0F);
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
// Invert the condition in x64 mode to simplify the conditional jump logic.
|
||||
jcc.opcode = 0x71 ^ cond;
|
||||
jcc.address = dest;
|
||||
#else
|
||||
jcc.opcode1 = 0x80 | cond;
|
||||
jcc.operand = (UINT32)(dest - (pNewInst + sizeof(jcc)));
|
||||
#endif
|
||||
pCopySrc = &jcc;
|
||||
copySize = sizeof(jcc);
|
||||
}
|
||||
}
|
||||
else if ((hs.opcode & 0xFE) == 0xC2)
|
||||
{
|
||||
// RET (C2 or C3)
|
||||
|
||||
// Complete the function if not in a branch.
|
||||
finished = (pOldInst >= jmpDest);
|
||||
}
|
||||
|
||||
// Can't alter the instruction length in a branch.
|
||||
if (pOldInst < jmpDest && copySize != hs.len)
|
||||
return FALSE;
|
||||
|
||||
// Trampoline function is too large.
|
||||
if ((newPos + copySize) > TRAMPOLINE_MAX_SIZE)
|
||||
return FALSE;
|
||||
|
||||
// Trampoline function has too many instructions.
|
||||
if (ct->nIP >= ARRAYSIZE(ct->oldIPs))
|
||||
return FALSE;
|
||||
|
||||
ct->oldIPs[ct->nIP] = oldPos;
|
||||
ct->newIPs[ct->nIP] = newPos;
|
||||
ct->nIP++;
|
||||
|
||||
// Avoid using memcpy to reduce the footprint.
|
||||
#ifndef _MSC_VER
|
||||
memcpy((LPBYTE)ct->pTrampoline + newPos, pCopySrc, copySize);
|
||||
#else
|
||||
__movsb((LPBYTE)ct->pTrampoline + newPos, (LPBYTE)pCopySrc, copySize);
|
||||
#endif
|
||||
newPos += copySize;
|
||||
oldPos += hs.len;
|
||||
}
|
||||
while (!finished);
|
||||
|
||||
// Is there enough place for a long jump?
|
||||
if (oldPos < sizeof(JMP_REL)
|
||||
&& !IsCodePadding((LPBYTE)ct->pTarget + oldPos, sizeof(JMP_REL) - oldPos))
|
||||
{
|
||||
// Is there enough place for a short jump?
|
||||
if (oldPos < sizeof(JMP_REL_SHORT)
|
||||
&& !IsCodePadding((LPBYTE)ct->pTarget + oldPos, sizeof(JMP_REL_SHORT) - oldPos))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Can we place the long jump above the function?
|
||||
if (!IsExecutableAddress((LPBYTE)ct->pTarget - sizeof(JMP_REL)))
|
||||
return FALSE;
|
||||
|
||||
if (!IsCodePadding((LPBYTE)ct->pTarget - sizeof(JMP_REL), sizeof(JMP_REL)))
|
||||
return FALSE;
|
||||
|
||||
ct->patchAbove = TRUE;
|
||||
}
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
// Create a relay function.
|
||||
jmp.address = (ULONG_PTR)ct->pDetour;
|
||||
|
||||
ct->pRelay = (LPBYTE)ct->pTrampoline + newPos;
|
||||
memcpy(ct->pRelay, &jmp, sizeof(jmp));
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
105
external/minhook/src/trampoline.h
vendored
105
external/minhook/src/trampoline.h
vendored
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
* Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
// Structs for writing x86/x64 instructions.
|
||||
|
||||
// 8-bit relative jump.
|
||||
typedef struct _JMP_REL_SHORT
|
||||
{
|
||||
UINT8 opcode; // EB xx: JMP +2+xx
|
||||
UINT8 operand;
|
||||
} JMP_REL_SHORT, *PJMP_REL_SHORT;
|
||||
|
||||
// 32-bit direct relative jump/call.
|
||||
typedef struct _JMP_REL
|
||||
{
|
||||
UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx
|
||||
UINT32 operand; // Relative destination address
|
||||
} JMP_REL, *PJMP_REL, CALL_REL;
|
||||
|
||||
// 64-bit indirect absolute jump.
|
||||
typedef struct _JMP_ABS
|
||||
{
|
||||
UINT8 opcode0; // FF25 00000000: JMP [+6]
|
||||
UINT8 opcode1;
|
||||
UINT32 dummy;
|
||||
UINT64 address; // Absolute destination address
|
||||
} JMP_ABS, *PJMP_ABS;
|
||||
|
||||
// 64-bit indirect absolute call.
|
||||
typedef struct _CALL_ABS
|
||||
{
|
||||
UINT8 opcode0; // FF15 00000002: CALL [+6]
|
||||
UINT8 opcode1;
|
||||
UINT32 dummy0;
|
||||
UINT8 dummy1; // EB 08: JMP +10
|
||||
UINT8 dummy2;
|
||||
UINT64 address; // Absolute destination address
|
||||
} CALL_ABS;
|
||||
|
||||
// 32-bit direct relative conditional jumps.
|
||||
typedef struct _JCC_REL
|
||||
{
|
||||
UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx
|
||||
UINT8 opcode1;
|
||||
UINT32 operand; // Relative destination address
|
||||
} JCC_REL;
|
||||
|
||||
// 64bit indirect absolute conditional jumps that x64 lacks.
|
||||
typedef struct _JCC_ABS
|
||||
{
|
||||
UINT8 opcode; // 7* 0E: J** +16
|
||||
UINT8 dummy0;
|
||||
UINT8 dummy1; // FF25 00000000: JMP [+6]
|
||||
UINT8 dummy2;
|
||||
UINT32 dummy3;
|
||||
UINT64 address; // Absolute destination address
|
||||
} JCC_ABS;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct _TRAMPOLINE
|
||||
{
|
||||
LPVOID pTarget; // [In] Address of the target function.
|
||||
LPVOID pDetour; // [In] Address of the detour function.
|
||||
LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function.
|
||||
|
||||
#if defined(_M_X64) || defined(__x86_64__)
|
||||
LPVOID pRelay; // [Out] Address of the relay function.
|
||||
#endif
|
||||
BOOL patchAbove; // [Out] Should use the hot patch area?
|
||||
UINT nIP; // [Out] Number of the instruction boundaries.
|
||||
UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function.
|
||||
UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function.
|
||||
} TRAMPOLINE, *PTRAMPOLINE;
|
||||
|
||||
BOOL CreateTrampolineFunction(PTRAMPOLINE ct);
|
19
license/lzham/LICENSE.txt
Normal file
19
license/lzham/LICENSE.txt
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2009-2011 Richard Geldreich, Jr. <richgel99@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -1,8 +0,0 @@
|
||||
Tsuda Kageyu <tsuda.kageyu@gmail.com>
|
||||
Creator, maintainer
|
||||
|
||||
Michael Maltsev <leahcimmar@gmail.com>
|
||||
Added "Queue" functions. A lot of bug fixes.
|
||||
|
||||
Andrey Unis <uniskz@gmail.com>
|
||||
Rewrote the hook engine in plain C.
|
@ -1,81 +0,0 @@
|
||||
MinHook - The Minimalistic API Hooking Library for x64/x86
|
||||
Copyright (C) 2009-2017 Tsuda Kageyu.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
================================================================================
|
||||
Portions of this software are Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
================================================================================
|
||||
Hacker Disassembler Engine 32 C
|
||||
Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Hacker Disassembler Engine 64 C
|
||||
Copyright (c) 2008-2009, Vyacheslav Patkov.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,97 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
#include "opcodes.h"
|
||||
#include "console.h"
|
||||
|
||||
//#############################################################################
|
||||
// INITIALIZATION
|
||||
//#############################################################################
|
||||
|
||||
void SetupConsole()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Create the console window
|
||||
if (AllocConsole() == FALSE)
|
||||
{
|
||||
OutputDebugString("Failed to create console window!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Set the window title
|
||||
FILE* sBuildTxt;
|
||||
CHAR sBuildBuf[1024] = { 0 };
|
||||
|
||||
fopen_s(&sBuildTxt, "build.txt", "r");
|
||||
if (sBuildTxt)
|
||||
{
|
||||
while (fgets(sBuildBuf, sizeof(sBuildBuf), sBuildTxt) != NULL)
|
||||
{
|
||||
fclose(sBuildTxt);
|
||||
}
|
||||
}
|
||||
SetConsoleTitle(sBuildBuf);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Open input/output streams
|
||||
FILE* fDummy;
|
||||
freopen_s(&fDummy, "CONIN$", "r", stdin);
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stdout);
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stderr);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Create a worker thread to process console commands
|
||||
DWORD threadId0;
|
||||
DWORD __stdcall ProcessConsoleWorker(LPVOID);
|
||||
HANDLE hThread0 = CreateThread(NULL, 0, ProcessConsoleWorker, NULL, 0, &threadId0);
|
||||
|
||||
if (hThread0)
|
||||
{
|
||||
printf("THREAD ID: %ld\n\n", threadId0);
|
||||
CloseHandle(hThread0);
|
||||
}
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// WORKER THREAD
|
||||
//#############################################################################
|
||||
|
||||
DWORD __stdcall ProcessConsoleWorker(LPVOID)
|
||||
{
|
||||
// Loop forever
|
||||
while (true)
|
||||
{
|
||||
std::string sCommand;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Get the user input on the debug console
|
||||
printf(">");
|
||||
std::getline(std::cin, sCommand);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Engine toggles
|
||||
if (sCommand == "toggle net") { Hooks::ToggleNetTrace(); continue; }
|
||||
if (sCommand == "toggle dev") { Hooks::ToggleDevCommands(); continue; }
|
||||
if (sCommand == "toggle fal") { g_bReturnAllFalse = !g_bReturnAllFalse; continue; }
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Debug toggles
|
||||
if (sCommand == "pattern test") { PrintHAddress(); /*PrintOAddress();*/ continue; }
|
||||
if (sCommand == "console test") { g_bDebugConsole = !g_bDebugConsole; continue; }
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Exec toggles
|
||||
if (sCommand == "1") { addr_CommandExecute(NULL, "exec autoexec_dev"); }
|
||||
if (sCommand == "2") { g_bDebugLoading = !g_bDebugLoading; continue; }
|
||||
if (sCommand == "3") { SetCHostState(); continue; } // TEST
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Execute the command in the r5 SQVM
|
||||
addr_CommandExecute(NULL, sCommand.c_str());
|
||||
sCommand.clear();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Sleep and loop
|
||||
Sleep(50);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
|
||||
void SetupConsole();
|
||||
void ToggleDevCommands();
|
@ -1,36 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
CSourceAppSystemGroup_CreateFn originalCSourceAppSystemGroup_Create = nullptr;
|
||||
}
|
||||
auto g_bIsDedicated = (uint8_t*)0x162C61208;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sets 'EbisuSDK' globals required in certain engine callbacks.
|
||||
//-----------------------------------------------------------------------------
|
||||
void HEbisuSDK_Init()
|
||||
{
|
||||
auto ofs000 = (uint8_t*)0x1634F1690;
|
||||
auto ofs001 = (uint8_t*)0x1634F16B0;
|
||||
auto ofs002 = (uint8_t*)0x1634F1695;
|
||||
auto ofs003 = (uint8_t*)0x1634F30D8;
|
||||
auto ofs004 = (uint8_t*)0x1634F31D8;
|
||||
|
||||
*(char*)(ofs000) = (char)0x1; // <-- | 1st EbisuSDK boolean to be checked.
|
||||
*(char*)(ofs001) = (char)0x1; // <-- | 2nd EbisuSDK boolean to be checked.
|
||||
*(char*)(ofs002) = (char)0x1; // <-- | 3rd EbisuSDK boolean to be checked.
|
||||
*(char*)(ofs003) = (char)0x1; // <-- | Gets tested on listenserver for certain ConCommands.
|
||||
*(char*)(ofs004) = (char)0x0; // <-- | TODO: enforces Necleus cvars when not equal to NULL.
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook 'SourceAppSystemGroup::Create' and set m_bIsDedicated to true.
|
||||
//-----------------------------------------------------------------------------
|
||||
char __fastcall Hooks::CSourceAppSystemGroup_Create(__int64 a1)
|
||||
{
|
||||
*g_bIsDedicated = 1; // HAS TO BE HERE!!!
|
||||
HEbisuSDK_Init();
|
||||
return originalCSourceAppSystemGroup_Create(a1);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
IsPersistenceDataAvailableFn originalIsPersistenceDataAvailable = nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sets the persistence var in the playerstruct to ready for each client
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Hooks::IsPersistenceDataAvailable(__int64 thisptr, int client)
|
||||
{
|
||||
static bool isPersistenceVarSet[256];
|
||||
|
||||
// TODO: Maybe not hardcode
|
||||
std::uintptr_t playerStructBase = 0x16073B200;
|
||||
std::uintptr_t playerStructSize = 0x4A4C0;
|
||||
std::uintptr_t persistenceVar = 0x5BC;
|
||||
|
||||
std::uintptr_t targetPlayerStruct = playerStructBase + client * playerStructSize;
|
||||
|
||||
*(char*)(targetPlayerStruct + persistenceVar) = (char)0x5;
|
||||
|
||||
if (!isPersistenceVarSet[client])
|
||||
{
|
||||
printf("\n");
|
||||
printf("##################################################\n");
|
||||
printf("] SETTING PERSISTENCE VAR FOR CLIENT #%d\n", client);
|
||||
printf("##################################################\n");
|
||||
printf("\n");
|
||||
isPersistenceVarSet[client] = true;
|
||||
}
|
||||
|
||||
return originalIsPersistenceDataAvailable(thisptr, client);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "dllmain.h"
|
||||
#include "hooks.h"
|
||||
#include "console.h"
|
||||
|
||||
//#############################################################################
|
||||
// INITIALIZATION
|
||||
//#############################################################################
|
||||
|
||||
void InitializeR5Dedicated()
|
||||
{
|
||||
SetupConsole();
|
||||
Hooks::InstallHooks();
|
||||
Hooks::DedicatedPatch();
|
||||
printf("+-----------------------------------------------------------------------------+\n");
|
||||
printf("| R5 DEDICATED SERVER --------------------------------------------------- |\n");
|
||||
printf("+-----------------------------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void TerminateR5Dedicated()
|
||||
{
|
||||
FreeConsole();
|
||||
Hooks::RemoveHooks();
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// ENTRYPOINT
|
||||
//#############################################################################
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
InitializeR5Dedicated();
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
TerminateR5Dedicated();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
__declspec(dllexport) void DummyExport()
|
||||
{
|
||||
// Required for detours.
|
||||
}
|
@ -1,422 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/* Enumerations */
|
||||
enum class D3D11DeviceVTbl : short
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface = 0,
|
||||
AddRef = 1,
|
||||
Release = 2,
|
||||
|
||||
// ID3D11Device
|
||||
CreateBuffer = 3,
|
||||
CreateTexture1D = 4,
|
||||
CreateTexture2D = 5,
|
||||
CreateTexture3D = 6,
|
||||
CreateShaderResourceView = 7,
|
||||
CreateUnorderedAccessView = 8,
|
||||
CreateRenderTargetView = 9,
|
||||
CreateDepthStencilView = 10,
|
||||
CreateInputLayout = 11,
|
||||
CreateVertexShader = 12,
|
||||
CreateGeometryShader = 13,
|
||||
CreateGeometryShaderWithStreamOutput = 14,
|
||||
CreatePixelShader = 15,
|
||||
CreateHullShader = 16,
|
||||
CreateDomainShader = 17,
|
||||
CreateComputeShader = 18,
|
||||
CreateClassLinkage = 19,
|
||||
CreateBlendState = 20,
|
||||
CreateDepthStencilState = 21,
|
||||
CreateRasterizerState = 22,
|
||||
CreateSamplerState = 23,
|
||||
CreateQuery = 24,
|
||||
CreatePredicate = 25,
|
||||
CreateCounter = 26,
|
||||
CreateDeferredContext = 27,
|
||||
OpenSharedResource = 28,
|
||||
CheckFormatSupport = 29,
|
||||
CheckMultisampleQualityLevels = 30,
|
||||
CheckCounterInfo = 31,
|
||||
CheckCounter = 32,
|
||||
CheckFeatureSupport = 33,
|
||||
GetPrivateData = 34,
|
||||
SetPrivateData = 35,
|
||||
SetPrivateDataInterface = 36,
|
||||
GetFeatureLevel = 37,
|
||||
GetCreationFlags = 38,
|
||||
GetDeviceRemovedReason = 39,
|
||||
GetImmediateContext = 40,
|
||||
SetExceptionMode = 41,
|
||||
GetExceptionMode = 42,
|
||||
};
|
||||
|
||||
enum class DXGISwapChainVTbl : short
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface = 0,
|
||||
AddRef = 1,
|
||||
Release = 2,
|
||||
|
||||
// IDXGIObject
|
||||
SetPrivateData = 3,
|
||||
SetPrivateDataInterface = 4,
|
||||
GetPrivateData = 5,
|
||||
GetParent = 6,
|
||||
|
||||
// IDXGIDeviceSubObject
|
||||
GetDevice = 7,
|
||||
|
||||
// IDXGISwapChain
|
||||
Present = 8,
|
||||
GetBuffer = 9,
|
||||
SetFullscreenState = 10,
|
||||
GetFullscreenState = 11,
|
||||
GetDesc = 12,
|
||||
ResizeBuffers = 13,
|
||||
ResizeTarget = 14,
|
||||
GetContainingOutput = 15,
|
||||
GetFrameStatistics = 16,
|
||||
GetLastPresentCount = 17,
|
||||
};
|
||||
|
||||
#define MAX_SPLITSCREEN_CLIENT_BITS 2
|
||||
#define MAX_SPLITSCREEN_CLIENTS ( 1 << MAX_SPLITSCREEN_CLIENT_BITS ) // 4
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_JOYSTICKS = MAX_SPLITSCREEN_CLIENTS,
|
||||
MOUSE_BUTTON_COUNT = 5,
|
||||
};
|
||||
|
||||
enum JoystickAxis_t
|
||||
{
|
||||
JOY_AXIS_X = 0,
|
||||
JOY_AXIS_Y,
|
||||
JOY_AXIS_Z,
|
||||
JOY_AXIS_R,
|
||||
JOY_AXIS_U,
|
||||
JOY_AXIS_V,
|
||||
MAX_JOYSTICK_AXES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JOYSTICK_MAX_BUTTON_COUNT = 32,
|
||||
JOYSTICK_POV_BUTTON_COUNT = 4,
|
||||
JOYSTICK_AXIS_BUTTON_COUNT = MAX_JOYSTICK_AXES * 2,
|
||||
};
|
||||
|
||||
#define JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_BUTTON + ((_joystick) * JOYSTICK_MAX_BUTTON_COUNT) + (_button) )
|
||||
#define JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_POV_BUTTON + ((_joystick) * JOYSTICK_POV_BUTTON_COUNT) + (_button) )
|
||||
#define JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_AXIS_BUTTON + ((_joystick) * JOYSTICK_AXIS_BUTTON_COUNT) + (_button) )
|
||||
|
||||
#define JOYSTICK_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
#define JOYSTICK_POV_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
#define JOYSTICK_AXIS_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
|
||||
enum ButtonCode_t
|
||||
{
|
||||
BUTTON_CODE_INVALID = -1,
|
||||
BUTTON_CODE_NONE = 0,
|
||||
|
||||
KEY_FIRST = 0,
|
||||
|
||||
KEY_NONE = KEY_FIRST,
|
||||
KEY_0,
|
||||
KEY_1,
|
||||
KEY_2,
|
||||
KEY_3,
|
||||
KEY_4,
|
||||
KEY_5,
|
||||
KEY_6,
|
||||
KEY_7,
|
||||
KEY_8,
|
||||
KEY_9,
|
||||
KEY_A,
|
||||
KEY_B,
|
||||
KEY_C,
|
||||
KEY_D,
|
||||
KEY_E,
|
||||
KEY_F,
|
||||
KEY_G,
|
||||
KEY_H,
|
||||
KEY_I,
|
||||
KEY_J,
|
||||
KEY_K,
|
||||
KEY_L,
|
||||
KEY_M,
|
||||
KEY_N,
|
||||
KEY_O,
|
||||
KEY_P,
|
||||
KEY_Q,
|
||||
KEY_R,
|
||||
KEY_S,
|
||||
KEY_T,
|
||||
KEY_U,
|
||||
KEY_V,
|
||||
KEY_W,
|
||||
KEY_X,
|
||||
KEY_Y,
|
||||
KEY_Z,
|
||||
KEY_PAD_0,
|
||||
KEY_PAD_1,
|
||||
KEY_PAD_2,
|
||||
KEY_PAD_3,
|
||||
KEY_PAD_4,
|
||||
KEY_PAD_5,
|
||||
KEY_PAD_6,
|
||||
KEY_PAD_7,
|
||||
KEY_PAD_8,
|
||||
KEY_PAD_9,
|
||||
KEY_PAD_DIVIDE,
|
||||
KEY_PAD_MULTIPLY,
|
||||
KEY_PAD_MINUS,
|
||||
KEY_PAD_PLUS,
|
||||
KEY_PAD_ENTER,
|
||||
KEY_PAD_DECIMAL,
|
||||
KEY_LBRACKET,
|
||||
KEY_RBRACKET,
|
||||
KEY_SEMICOLON,
|
||||
KEY_APOSTROPHE,
|
||||
KEY_BACKQUOTE,
|
||||
KEY_COMMA,
|
||||
KEY_PERIOD,
|
||||
KEY_SLASH,
|
||||
KEY_BACKSLASH,
|
||||
KEY_MINUS,
|
||||
KEY_EQUAL,
|
||||
KEY_ENTER,
|
||||
KEY_SPACE,
|
||||
KEY_BACKSPACE,
|
||||
KEY_TAB,
|
||||
KEY_CAPSLOCK,
|
||||
KEY_NUMLOCK,
|
||||
KEY_ESCAPE,
|
||||
KEY_SCROLLLOCK,
|
||||
KEY_INSERT,
|
||||
KEY_DELETE,
|
||||
KEY_HOME,
|
||||
KEY_END,
|
||||
KEY_PAGEUP,
|
||||
KEY_PAGEDOWN,
|
||||
KEY_BREAK,
|
||||
KEY_LSHIFT,
|
||||
KEY_RSHIFT,
|
||||
KEY_LALT,
|
||||
KEY_RALT,
|
||||
KEY_LCONTROL,
|
||||
KEY_RCONTROL,
|
||||
KEY_LWIN,
|
||||
KEY_RWIN,
|
||||
KEY_APP,
|
||||
KEY_UP,
|
||||
KEY_LEFT,
|
||||
KEY_DOWN,
|
||||
KEY_RIGHT,
|
||||
KEY_F1,
|
||||
KEY_F2,
|
||||
KEY_F3,
|
||||
KEY_F4,
|
||||
KEY_F5,
|
||||
KEY_F6,
|
||||
KEY_F7,
|
||||
KEY_F8,
|
||||
KEY_F9,
|
||||
KEY_F10,
|
||||
KEY_F11,
|
||||
KEY_F12,
|
||||
KEY_CAPSLOCKTOGGLE,
|
||||
KEY_NUMLOCKTOGGLE,
|
||||
KEY_SCROLLLOCKTOGGLE,
|
||||
|
||||
KEY_LAST = KEY_SCROLLLOCKTOGGLE,
|
||||
KEY_COUNT = KEY_LAST - KEY_FIRST + 1,
|
||||
|
||||
// Mouse
|
||||
MOUSE_FIRST = KEY_LAST + 1,
|
||||
|
||||
MOUSE_LEFT = MOUSE_FIRST,
|
||||
MOUSE_RIGHT,
|
||||
MOUSE_MIDDLE,
|
||||
MOUSE_4,
|
||||
MOUSE_5,
|
||||
MOUSE_WHEEL_UP, // A fake button which is 'pressed' and 'released' when the wheel is moved up
|
||||
MOUSE_WHEEL_DOWN, // A fake button which is 'pressed' and 'released' when the wheel is moved down
|
||||
|
||||
MOUSE_LAST = MOUSE_WHEEL_DOWN,
|
||||
MOUSE_COUNT = MOUSE_LAST - MOUSE_FIRST + 1,
|
||||
|
||||
// Joystick
|
||||
JOYSTICK_FIRST = MOUSE_LAST + 1,
|
||||
|
||||
JOYSTICK_FIRST_BUTTON = JOYSTICK_FIRST,
|
||||
JOYSTICK_LAST_BUTTON = JOYSTICK_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_MAX_BUTTON_COUNT - 1),
|
||||
JOYSTICK_FIRST_POV_BUTTON,
|
||||
JOYSTICK_LAST_POV_BUTTON = JOYSTICK_POV_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_POV_BUTTON_COUNT - 1),
|
||||
JOYSTICK_FIRST_AXIS_BUTTON,
|
||||
JOYSTICK_LAST_AXIS_BUTTON = JOYSTICK_AXIS_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_AXIS_BUTTON_COUNT - 1),
|
||||
|
||||
JOYSTICK_LAST = JOYSTICK_LAST_AXIS_BUTTON,
|
||||
|
||||
BUTTON_CODE_LAST,
|
||||
BUTTON_CODE_COUNT = BUTTON_CODE_LAST - KEY_FIRST + 1,
|
||||
|
||||
// Helpers for XBox 360
|
||||
KEY_XBUTTON_UP = JOYSTICK_FIRST_POV_BUTTON, // POV buttons
|
||||
KEY_XBUTTON_RIGHT,
|
||||
KEY_XBUTTON_DOWN,
|
||||
KEY_XBUTTON_LEFT,
|
||||
|
||||
KEY_XBUTTON_A = JOYSTICK_FIRST_BUTTON, // Buttons
|
||||
KEY_XBUTTON_B,
|
||||
KEY_XBUTTON_X,
|
||||
KEY_XBUTTON_Y,
|
||||
KEY_XBUTTON_LEFT_SHOULDER,
|
||||
KEY_XBUTTON_RIGHT_SHOULDER,
|
||||
KEY_XBUTTON_BACK,
|
||||
KEY_XBUTTON_START,
|
||||
KEY_XBUTTON_STICK1,
|
||||
KEY_XBUTTON_STICK2,
|
||||
KEY_XBUTTON_INACTIVE_START,
|
||||
|
||||
KEY_XSTICK1_RIGHT = JOYSTICK_FIRST_AXIS_BUTTON, // XAXIS POSITIVE
|
||||
KEY_XSTICK1_LEFT, // XAXIS NEGATIVE
|
||||
KEY_XSTICK1_DOWN, // YAXIS POSITIVE
|
||||
KEY_XSTICK1_UP, // YAXIS NEGATIVE
|
||||
KEY_XBUTTON_LTRIGGER, // ZAXIS POSITIVE
|
||||
KEY_XBUTTON_RTRIGGER, // ZAXIS NEGATIVE
|
||||
KEY_XSTICK2_RIGHT, // UAXIS POSITIVE
|
||||
KEY_XSTICK2_LEFT, // UAXIS NEGATIVE
|
||||
KEY_XSTICK2_DOWN, // VAXIS POSITIVE
|
||||
KEY_XSTICK2_UP, // VAXIS NEGATIVE
|
||||
};
|
||||
|
||||
// Buttons are not confirmed to be the same. They have been always the same throughout the source engine. Lets hope they did not change them.
|
||||
|
||||
enum KeyValuesTypes
|
||||
{
|
||||
TYPE_NONE = 0x0,
|
||||
TYPE_STRING = 0x1,
|
||||
TYPE_INT = 0x2,
|
||||
TYPE_FLOAT = 0x3,
|
||||
TYPE_PTR = 0x4,
|
||||
TYPE_WSTRING = 0x5,
|
||||
TYPE_COLOR = 0x6,
|
||||
TYPE_UINT64 = 0x7,
|
||||
TYPE_COMPILED_INT_BYTE = 0x8,
|
||||
TYPE_COMPILED_INT_0 = 0x9,
|
||||
TYPE_COMPILED_INT_1 = 0xA,
|
||||
TYPE_NUMTYPES = 0xB,
|
||||
};
|
||||
|
||||
enum ClientFrameStage_t
|
||||
{
|
||||
FRAME_UNDEFINED = -1, // (haven't run any frames yet)
|
||||
FRAME_START,
|
||||
|
||||
// A network packet is being recieved
|
||||
FRAME_NET_UPDATE_START,
|
||||
// Data has been received and we're going to start calling PostDataUpdate
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
|
||||
// Data has been received and we've called PostDataUpdate on all data recipients
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
|
||||
// We've received all packets, we can now do interpolation, prediction, etc..
|
||||
FRAME_NET_UPDATE_END,
|
||||
|
||||
// We're about to start rendering the scene
|
||||
FRAME_RENDER_START,
|
||||
// We've finished rendering the scene.
|
||||
FRAME_RENDER_END,
|
||||
|
||||
FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE
|
||||
};
|
||||
|
||||
enum HostStates_t
|
||||
{
|
||||
HS_NEW_GAME = 0x0,
|
||||
HS_LOAD_GAME = 0x1,
|
||||
HS_CHANGE_LEVEL_SP = 0x2,
|
||||
HS_CHANGE_LEVEL_MP = 0x3,
|
||||
HS_RUN = 0x4,
|
||||
HS_GAME_SHUTDOWN = 0x5,
|
||||
HS_SHUTDOWN = 0x6,
|
||||
HS_RESTART = 0x7,
|
||||
};
|
||||
|
||||
enum SIGNONSTATE
|
||||
{
|
||||
SIGNONSTATE_NONE = 0, // no state yet; about to connect
|
||||
SIGNONSTATE_CHALLENGE = 1, // client challenging server; all OOB packets
|
||||
SIGNONSTATE_CONNECTED = 2, // client is connected to server; netchans ready
|
||||
SIGNONSTATE_NEW = 3, // just got serverinfo and string tables
|
||||
SIGNONSTATE_PRESPAWN = 4, // received signon buffers
|
||||
SIGNONSTATE_GETTING_DATA = 5, // getting persistence data I assume?
|
||||
SIGNONSTATE_SPAWN = 6, // ready to receive entity packets
|
||||
SIGNONSTATE_FIRST_SNAP = 7, // ???
|
||||
SIGNONSTATE_FULL = 8, // we are fully connected; first non-delta packet received
|
||||
SIGNONSTATE_CHANGELEVEL = 9, // server is changing level; please wait
|
||||
};
|
||||
|
||||
enum FileWarningLevel_t
|
||||
{
|
||||
FILESYSTEM_WARNING = -1,
|
||||
FILESYSTEM_WARNING_QUIET = 0,
|
||||
FILESYSTEM_WARNING_REPORTUNCLOSED,
|
||||
FILESYSTEM_WARNING_REPORTUSAGE,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_READ,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_READWRITE,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_ASYNC
|
||||
};
|
||||
|
||||
#define FCVAR_NONE 0
|
||||
|
||||
// Command to ConVars and ConCommands
|
||||
// ConVar Systems
|
||||
#define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc.
|
||||
#define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined.
|
||||
#define FCVAR_GAMEDLL (1<<2) // defined by the game DLL
|
||||
#define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL
|
||||
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out.
|
||||
|
||||
// ConVar only
|
||||
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc
|
||||
#define FCVAR_NOTIFY (1<<8) // notifies players when changed
|
||||
#define FCVAR_USERINFO (1<<9) // changes the client's info string
|
||||
|
||||
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
|
||||
#define FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS (1<<10) // When on concommands this allows remote clients to execute this cmd on the server.
|
||||
// We are changing the default behavior of concommands to disallow execution by remote clients without
|
||||
// this flag due to the number existing concommands that can lag or crash the server when clients abuse them.
|
||||
|
||||
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar
|
||||
|
||||
// It's a ConVar that's shared between the client and the server.
|
||||
// At signon, the values of all such ConVars are sent from the server to the client (skipped for local
|
||||
// client, of course )
|
||||
// If a change is requested it must come from the console (i.e., no remote client changes)
|
||||
// If a value is changed while a server is active, it's replicated to all connected clients
|
||||
#define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time
|
||||
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
|
||||
#define FCVAR_SS (1<<15) // causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated
|
||||
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
|
||||
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
|
||||
#define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players
|
||||
#define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars avaliable to customers
|
||||
#define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload
|
||||
#define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload
|
||||
|
||||
#define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server
|
||||
#define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread
|
||||
#define FCVAR_ARCHIVE_GAMECONSOLE (1<<24) // cvar written to config.cfg on the Xbox
|
||||
|
||||
#define FCVAR_SERVER_CAN_EXECUTE (1<<28)// the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd.
|
||||
#define FCVAR_SERVER_CANNOT_QUERY (1<<29)// If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue).
|
||||
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
|
||||
|
||||
#define MAX_PLAYERS 128 // Max R5 players.
|
@ -1,470 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "enums.h"
|
||||
#include "gameclasses.h"
|
||||
|
||||
// Need this for a re-factor later.
|
||||
// Interface* interfaces = *reinterpret_cast<Interface**>(0x167F4FA48);
|
||||
|
||||
// for (Interface* current = interfaces; current; current = reinterpret_cast<Interface*>(current->NextInterfacePtr))
|
||||
// {
|
||||
// printf("%s: %p\n", current->InterfaceName, current->InterfacePtr);
|
||||
// }
|
||||
|
||||
namespace GameGlobals
|
||||
{
|
||||
bool IsInitialized = false;
|
||||
CHostState* HostState = nullptr;
|
||||
CInputSystem* InputSystem = nullptr;
|
||||
CCVar* Cvar = nullptr;
|
||||
CClient* Client = nullptr;
|
||||
BanList* BanSystem = new BanList();
|
||||
|
||||
CKeyValuesSystem* KeyValuesSystem = nullptr;
|
||||
KeyValues** PlaylistKeyValues = nullptr;
|
||||
|
||||
std::vector<std::string> allPlaylists = { "none" };
|
||||
|
||||
namespace CustomCommandVariations
|
||||
{
|
||||
|
||||
void Kick_Callback(CCommand* cmd)
|
||||
{
|
||||
std::int32_t argSize = *(std::int32_t*)((std::uintptr_t)cmd + 0x4);
|
||||
if (argSize < 2) // Do we atleast have 2 arguments?
|
||||
return;
|
||||
|
||||
CCommand& cmdReference = *cmd; // Get reference.
|
||||
const char* firstArg = cmdReference[1]; // Get first arg.
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* client = GameGlobals::Client->GetClientInstance(i); // Get client instance.
|
||||
if (!client)
|
||||
continue;
|
||||
|
||||
if (!client->GetNetChan()) // Netchan valid?
|
||||
continue;
|
||||
|
||||
void* clientNamePtr = (void**)(((std::uintptr_t)client->GetNetChan()) + 0x1A8D); // Get client name from netchan.
|
||||
std::string clientName((char*)clientNamePtr, 32); // Get full name.
|
||||
|
||||
if (clientName.empty()) // Empty name?
|
||||
continue;
|
||||
|
||||
if (strcmp(firstArg, clientName.c_str()) != 0) // Our wanted name?
|
||||
continue;
|
||||
|
||||
DisconnectClient(client, "Kicked from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
}
|
||||
|
||||
void KickID_Callback(CCommand* cmd)
|
||||
{
|
||||
static auto HasOnlyDigits = [](const std::string& string)
|
||||
{
|
||||
for (const char& character : string)
|
||||
{
|
||||
if (std::isdigit(character) == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
std::int32_t argSize = *(std::int32_t*)((std::uintptr_t)cmd + 0x4);
|
||||
if (argSize < 2) // Do we atleast have 2 arguments?
|
||||
return;
|
||||
|
||||
CCommand& cmdReference = *cmd; // Get reference.
|
||||
std::string firstArg = cmdReference[1]; // Get first arg.
|
||||
|
||||
try
|
||||
{
|
||||
bool onlyDigits = HasOnlyDigits(firstArg); // Only has digits?
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* client = GameGlobals::Client->GetClientInstance(i); // Get client instance.
|
||||
if (!client)
|
||||
continue;
|
||||
|
||||
if (!client->GetNetChan()) // Netchan valid?
|
||||
continue;
|
||||
|
||||
std::string finalIPAddress = "null"; // If this stays null they modified the packet somehow.
|
||||
MemoryAddress ipAddressField = MemoryAddress(((std::uintptr_t)client->GetNetChan()) + 0x1AC0); // Get client ip from netchan.
|
||||
if (ipAddressField)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::to_string(ipAddressField.GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x1).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x2).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x3).GetValue<std::uint8_t>());
|
||||
|
||||
finalIPAddress = ss.str();
|
||||
}
|
||||
|
||||
if (onlyDigits)
|
||||
{
|
||||
std::int64_t ID = static_cast<std::int64_t>(std::stoll(firstArg));
|
||||
if (ID > MAX_PLAYERS) // Is it a possible originID?
|
||||
{
|
||||
std::int64_t originID = client->m_iOriginID;
|
||||
if (originID != ID) // See if they match.
|
||||
continue;
|
||||
}
|
||||
else // If its not try by userID.
|
||||
{
|
||||
std::int64_t clientID = static_cast<std::int64_t>(client->m_iUserID + 1); // Get UserID + 1.
|
||||
if (clientID != ID) // See if they match.
|
||||
continue;
|
||||
}
|
||||
|
||||
DisconnectClient(client, "Kicked from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (firstArg.compare(finalIPAddress) != NULL) // Do the string equal?
|
||||
continue;
|
||||
|
||||
DisconnectClient(client, "Kicked from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cout << "Kick UID asked for a userID or originID :( You can get the userID with the 'status' command. Error: " << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Unban_Callback(CCommand* cmd)
|
||||
{
|
||||
static auto HasOnlyDigits = [](const std::string& string)
|
||||
{
|
||||
for (const char& character : string)
|
||||
{
|
||||
if (std::isdigit(character) == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
std::int32_t argSize = *(std::int32_t*)((std::uintptr_t)cmd + 0x4);
|
||||
if (argSize < 2) // Do we atleast have 2 arguments?
|
||||
return;
|
||||
|
||||
CCommand& cmdReference = *cmd; // Get reference.
|
||||
|
||||
try
|
||||
{
|
||||
const char* firstArg = cmdReference[1];
|
||||
if (HasOnlyDigits(firstArg)) // Check if we have an ip address or origin ID.
|
||||
{
|
||||
GameGlobals::BanSystem->DeleteEntry("noIP", std::stoll(firstArg)); // Delete ban entry.
|
||||
GameGlobals::BanSystem->Save(); // Save modified vector to file.
|
||||
}
|
||||
else
|
||||
{
|
||||
GameGlobals::BanSystem->DeleteEntry(firstArg, 1); // Delete ban entry.
|
||||
GameGlobals::BanSystem->Save(); // Save modified vector to file.
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cout << "Unban Error: " << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ReloadBanList_Callback(CCommand* cmd)
|
||||
{
|
||||
GameGlobals::BanSystem->Load(); // Reload banlist.
|
||||
}
|
||||
|
||||
void Ban_Callback(CCommand* cmd)
|
||||
{
|
||||
std::int32_t argSize = *(std::int32_t*)((std::uintptr_t)cmd + 0x4);
|
||||
if (argSize < 2) // Do we atleast have 2 arguments?
|
||||
return;
|
||||
|
||||
CCommand& cmdReference = *cmd; // Get reference.
|
||||
const char* firstArg = cmdReference[1]; // Get first arg.
|
||||
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* client = GameGlobals::Client->GetClientInstance(i); // Get client instance.
|
||||
if (!client)
|
||||
continue;
|
||||
|
||||
if (!client->GetNetChan()) // Netchan valid?
|
||||
continue;
|
||||
|
||||
void* clientNamePtr = (void**)(((std::uintptr_t)client->GetNetChan()) + 0x1A8D); // Get client name from netchan.
|
||||
std::string clientName((char*)clientNamePtr, 32); // Get full name.
|
||||
|
||||
if (clientName.empty()) // Empty name?
|
||||
continue;
|
||||
|
||||
if (strcmp(firstArg, clientName.c_str()) != 0) // Our wanted name?
|
||||
continue;
|
||||
|
||||
std::string finalIPAddress = "null"; // If this stays null they modified the packet somehow.
|
||||
MemoryAddress ipAddressField = MemoryAddress(((std::uintptr_t)client->GetNetChan()) + 0x1AC0); // Get client ip from netchan.
|
||||
if (ipAddressField && ipAddressField.GetValue<int>() != 0x0)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::to_string(ipAddressField.GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x1).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x2).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x3).GetValue<std::uint8_t>());
|
||||
|
||||
finalIPAddress = ss.str();
|
||||
}
|
||||
|
||||
GameGlobals::BanSystem->AddEntry(finalIPAddress, client->m_iOriginID); // Add ban entry.
|
||||
GameGlobals::BanSystem->Save(); // Save ban list.
|
||||
DisconnectClient(client, "Banned from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
}
|
||||
|
||||
void BanID_Callback(CCommand* cmd)
|
||||
{
|
||||
static auto HasOnlyDigits = [](const std::string& string)
|
||||
{
|
||||
for (const char& character : string)
|
||||
{
|
||||
if (std::isdigit(character) == 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
std::int32_t argSize = *(std::int32_t*)((std::uintptr_t)cmd + 0x4);
|
||||
if (argSize < 2) // Do we atleast have 2 arguments?
|
||||
return;
|
||||
|
||||
CCommand& cmdReference = *cmd; // Get reference.
|
||||
std::string firstArg = cmdReference[1];
|
||||
|
||||
try
|
||||
{
|
||||
bool onlyDigits = HasOnlyDigits(firstArg); // Only has digits?
|
||||
for (int i = 0; i < MAX_PLAYERS; i++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* client = GameGlobals::Client->GetClientInstance(i); // Get client instance.
|
||||
if (!client)
|
||||
continue;
|
||||
|
||||
if (!client->GetNetChan()) // Netchan valid?
|
||||
continue;
|
||||
|
||||
std::string finalIPAddress = "null"; // If this stays null they modified the packet somehow.
|
||||
MemoryAddress ipAddressField = MemoryAddress(((std::uintptr_t)client->GetNetChan()) + 0x1AC0); // Get client ip from netchan.
|
||||
if (ipAddressField)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::to_string(ipAddressField.GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x1).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x2).GetValue<std::uint8_t>()) << "."
|
||||
<< std::to_string(ipAddressField.Offset(0x3).GetValue<std::uint8_t>());
|
||||
|
||||
finalIPAddress = ss.str();
|
||||
}
|
||||
|
||||
if (onlyDigits)
|
||||
{
|
||||
std::int64_t ID = static_cast<std::int64_t>(std::stoll(firstArg));
|
||||
if (ID > MAX_PLAYERS) // Is it a possible originID?
|
||||
{
|
||||
std::int64_t originID = client->m_iOriginID;
|
||||
if (originID != ID) // See if they match.
|
||||
continue;
|
||||
}
|
||||
else // If its not try by userID.
|
||||
{
|
||||
std::int64_t clientID = static_cast<std::int64_t>(client->m_iUserID + 1); // Get UserID + 1.
|
||||
if (clientID != ID) // See if they match.
|
||||
continue;
|
||||
}
|
||||
|
||||
GameGlobals::BanSystem->AddEntry(finalIPAddress, client->m_iOriginID); // Add ban entry.
|
||||
GameGlobals::BanSystem->Save(); // Save ban list.
|
||||
DisconnectClient(client, "Banned from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (firstArg.compare(finalIPAddress) != NULL) // Do the string equal?
|
||||
continue;
|
||||
|
||||
GameGlobals::BanSystem->AddEntry(finalIPAddress, client->m_iOriginID); // Add ban entry.
|
||||
GameGlobals::BanSystem->Save(); // Save ban list.
|
||||
DisconnectClient(client, "Banned from Server", 0, 1); // Disconnect client.
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cout << "Banid Error: " << e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NullHostNames()
|
||||
{
|
||||
const char* hostnameArray[] =
|
||||
{
|
||||
"pin_telemetry_hostname",
|
||||
"assetdownloads_hostname",
|
||||
"users_hostname",
|
||||
"persistence_hostname",
|
||||
"speechtotexttoken_hostname",
|
||||
"communities_hostname",
|
||||
"persistenceDef_hostname",
|
||||
"party_hostname",
|
||||
"speechtotext_hostname",
|
||||
"serverReports_hostname",
|
||||
"subscription_hostname",
|
||||
"steamlink_hostname",
|
||||
"staticfile_hostname",
|
||||
"matchmaking_hostname",
|
||||
"skill_hostname",
|
||||
"publication_hostname",
|
||||
"stats_hostname"
|
||||
};
|
||||
|
||||
for (int i = 0; i < 17; i++)
|
||||
{
|
||||
const char* name = hostnameArray[i];
|
||||
Cvar->FindVar(name)->m_pzsCurrentValue = "0.0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
void InitGameGlobals()
|
||||
{
|
||||
HostState = reinterpret_cast<CHostState*>(0x141736120); // Get CHostState from memory.
|
||||
InputSystem = *reinterpret_cast<CInputSystem**>(0x14D40B380); // Get IInputSystem from memory.
|
||||
Cvar = *reinterpret_cast<CCVar**>(0x14D40B348); // Get CCVar from memory.
|
||||
//KeyValuesSystem = reinterpret_cast<CKeyValuesSystem*>(0x141F105C0); // Get CKeyValuesSystem from memory.
|
||||
//PlaylistKeyValues = reinterpret_cast<KeyValues**>(0x16705B980); // Get the KeyValue for the playlist file.
|
||||
//Client = reinterpret_cast<CClient*>(0x16073B200);
|
||||
|
||||
//NullHostNames(); // Null all hostnames.
|
||||
//InitAllCommandVariations(); // Initialize our custom ConVars.
|
||||
//*(char*)addr_m_bRestrictServerCommands = true; // Restrict commands.
|
||||
//void* disconnect = Cvar->FindCommand("disconnect");
|
||||
//*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
|
||||
//std::thread t1(InitPlaylist); // Start thread to grab playlists.
|
||||
//t1.detach(); // Detach thread from current one.
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
|
||||
void InitPlaylist()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if ((*PlaylistKeyValues))
|
||||
{
|
||||
KeyValues* playlists = (*PlaylistKeyValues)->FindKey("Playlists", false); // Find playlists key.
|
||||
if (playlists)
|
||||
{
|
||||
allPlaylists.clear();
|
||||
for (KeyValues* dat = playlists->m_pSub; dat != nullptr; dat = dat->m_pPeer) // Parse through all sub keys.
|
||||
{
|
||||
allPlaylists.push_back(dat->GetName()); // Get all playlist names.
|
||||
}
|
||||
|
||||
break; // Break if playlist got filled.
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
}
|
||||
|
||||
void InitAllCommandVariations()
|
||||
{
|
||||
void* KickConCommand = CreateCustomConCommand("kick", "Kick a client from the Server via name. | Usage: kick (name).", 0, CustomCommandVariations::Kick_Callback, nullptr);
|
||||
void* KickIDConCommand = CreateCustomConCommand("kickid", "Kick a client from the Server via userID or originID | Usage: kickid (originID/userID)", 0, CustomCommandVariations::KickID_Callback, nullptr);
|
||||
void* UnbanConCommand = CreateCustomConCommand("unban", "Unbans a client from the Server via IP or originID | Usage: unban (originID/ipAddress)", 0, CustomCommandVariations::Unban_Callback, nullptr);
|
||||
void* ReloadBanListConCommand = CreateCustomConCommand("reloadbanlist", "Reloads the ban list from disk.", 0, CustomCommandVariations::ReloadBanList_Callback, nullptr);
|
||||
void* BanConCommand = CreateCustomConCommand("ban", "Bans a client from the Server via name. | Usage: ban (name)", 0, CustomCommandVariations::Ban_Callback, nullptr);
|
||||
void* BanIDConCommand = CreateCustomConCommand("banid", "Bans a client from the Server via originID, userID or IP | Usage: banid (originID/ipAddress/userID)", 0, CustomCommandVariations::BanID_Callback, nullptr);
|
||||
}
|
||||
|
||||
void* CreateCustomConCommand(const char* name, const char* helpString, int flags, void* callback, void* callbackAfterExecution)
|
||||
{
|
||||
static MemoryAddress ConCommandVtable = MemoryAddress(0x14136BD70);
|
||||
static MemoryAddress NullSub = MemoryAddress(0x1401B3280);
|
||||
static MemoryAddress CallbackCompletion = MemoryAddress(0x1401E3990);
|
||||
static MemoryAddress RegisterConCommand = MemoryAddress(0x14046F470);
|
||||
|
||||
void* command = reinterpret_cast<void*>(addr_MemAlloc_Wrapper(0x68)); // Allocate new memory with StdMemAlloc else we crash.
|
||||
memset(command, 0, 0x68); // Set all to null.
|
||||
std::uintptr_t commandPtr = reinterpret_cast<std::uintptr_t>(command); // To ptr.
|
||||
|
||||
*(void**)commandPtr = ConCommandVtable.RCast<void*>(); // 0x0 to ConCommand vtable.
|
||||
*(const char**)(commandPtr + 0x18) = name; // 0x18 to ConCommand Name.
|
||||
*(const char**)(commandPtr + 0x20) = helpString; // 0x20 to ConCommand help string.
|
||||
*(std::int32_t*)(commandPtr + 0x38) = flags; // 0x38 to ConCommand Flags.
|
||||
*(void**)(commandPtr + 0x40) = NullSub.RCast<void*>(); // 0x40 Nullsub since every concommand has it.
|
||||
*(void**)(commandPtr + 0x50) = callback; // 0x50 has function callback.
|
||||
*(std::int32_t*)(commandPtr + 0x60) = 2; // 0x60 Set to use callback and newcommand callback.
|
||||
|
||||
if (callbackAfterExecution) // Do we wanna have a callback after execution?
|
||||
{
|
||||
*(void**)(commandPtr + 0x58) = callbackAfterExecution; // 0x58 to our callback after execution.
|
||||
}
|
||||
else
|
||||
{
|
||||
*(void**)(commandPtr + 0x58) = CallbackCompletion.RCast<void*>(); // 0x58 nullsub.
|
||||
}
|
||||
|
||||
RegisterConCommand.RCast<void(*)(void*)>()((void*)commandPtr); // Register command in ConVarAccessor.
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
ConVar* CreateCustomConVar(const char* name, const char* defaultValue, int flags, const char* helpString, bool bMin, float fMin, bool bMax, float fMax, void* callback, void* unk)
|
||||
{
|
||||
static MemoryAddress ConVarVtable = MemoryAddress(0x14046FB50).Offset(0x12).ResolveRelativeAddress(); // Get vtable ptr for ConVar table.
|
||||
static MemoryAddress ICvarVtable = MemoryAddress(0x14046FB50).Offset(0x29).ResolveRelativeAddress(); // Get vtable ptr for ICvar table.
|
||||
static MemoryAddress CreateConVar = MemoryAddress(0x140470540); // Get CreateConvar address.
|
||||
|
||||
ConVar* allocatedConvar = reinterpret_cast<ConVar*>(addr_MemAlloc_Wrapper(0xA0)); // Allocate new memory with StdMemAlloc else we crash.
|
||||
memset(allocatedConvar, 0, 0xA0); // Set all to null.
|
||||
std::uintptr_t cvarPtr = reinterpret_cast<std::uintptr_t>(allocatedConvar); // To ptr.
|
||||
|
||||
*(void**)(cvarPtr + 0x40) = ICvarVtable.RCast<void*>(); // 0x40 to ICvar table.
|
||||
*(void**)cvarPtr = ConVarVtable.RCast<void*>(); // 0x0 to ConVar vtable.
|
||||
|
||||
CreateConVar.RCast<void(*)(ConVar*, const char*, const char*, int, const char*, bool, float, bool, float, void*, void*)>() // Call to create ConVar.
|
||||
(allocatedConvar, name, defaultValue, flags, helpString, bMin, fMin, bMax, fMax, callback, unk);
|
||||
|
||||
return allocatedConvar; // Return allocated ConVar.
|
||||
}
|
||||
|
||||
void DisconnectClient(CClient* client, const char* reason, unsigned __int8 unk1, char unk2)
|
||||
{
|
||||
if (!client) // Client valid?
|
||||
return;
|
||||
|
||||
if (std::strlen(reason) == NULL) // Is reason null?
|
||||
return;
|
||||
|
||||
if (!client->GetNetChan())
|
||||
return;
|
||||
|
||||
addr_NetChan_Shutdown(client->GetNetChan(), reason, unk1, unk2); // Shutdown netchan.
|
||||
client->GetNetChan() = nullptr; // Null netchan.
|
||||
MemoryAddress(0x140302FD0).RCast<void(*)(CClient*)>()(client); // Reset CClient instance for client.
|
||||
}
|
||||
}
|
||||
|
||||
#pragma region KeyValues
|
||||
const char* KeyValues::GetName()
|
||||
{
|
||||
return GameGlobals::KeyValuesSystem->GetStringForSymbol(MAKE_3_BYTES_FROM_1_AND_2(m_iKeyNameCaseSensitive, m_iKeyNameCaseSensitive2));
|
||||
}
|
||||
#pragma endregion
|
@ -1,487 +0,0 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
#include "enums.h"
|
||||
#include "banlist.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Classes and Structs
|
||||
class CInputSystem
|
||||
{
|
||||
public:
|
||||
void EnableInput(bool bEnabled)// @0x14039F100 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CInputSystem*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[10](this, bEnabled);
|
||||
}
|
||||
|
||||
void EnableMessagePump(bool bEnabled) // @0x14039F110 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CInputSystem*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[11](this, bEnabled);
|
||||
}
|
||||
|
||||
bool IsButtonDown(ButtonCode_t Button) // @0x1403A0140 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = bool(__thiscall*)(CInputSystem*, ButtonCode_t);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[13](this, Button);
|
||||
}
|
||||
|
||||
private:
|
||||
char pad_0000[16]; //0x0000
|
||||
public:
|
||||
bool m_bEnabled; //0x0010 IsInputEnabled variable.
|
||||
bool m_bPumpEnabled; //0x0011 EnabledMessagePump variable.
|
||||
};
|
||||
|
||||
typedef int HKeySymbol;
|
||||
|
||||
#define MAKE_3_BYTES_FROM_1_AND_2( x1, x2 ) (( (( std::uint16_t )x2) << 8 ) | (std::uint8_t)(x1))
|
||||
|
||||
class CKeyValuesSystem // VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
public:
|
||||
|
||||
void RegisterSizeofKeyValues(__int64 size) //@0x1413AA1F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, __int64);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[0](this, size);
|
||||
}
|
||||
|
||||
void* AllocKeyValuesMemory(__int64 size) // @0x1413AA1F8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void* (__thiscall*)(CKeyValuesSystem*, __int64);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[1](this, size);
|
||||
}
|
||||
|
||||
void FreeKeyValuesMemory(void* pMem) // @0x1413AA200 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, void*);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[2](this, pMem);
|
||||
}
|
||||
|
||||
HKeySymbol GetSymbolForString(const char* name, bool bCreate) // @0x1413AA208 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = HKeySymbol(__thiscall*)(CKeyValuesSystem*, const char*, bool);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[3](this, name, bCreate);
|
||||
}
|
||||
|
||||
const char* GetStringForSymbol(HKeySymbol symbol) // @0x1413AA210 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = const char* (__thiscall*)(CKeyValuesSystem*, HKeySymbol);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[4](this, symbol);
|
||||
}
|
||||
|
||||
// void __fastcall CKeyValuesSystem::FreeKeyValuesMemory(CKeyValuesSystem* this_arg, void* ptr_mem_arg)
|
||||
// {
|
||||
// __int64* v2; // rax
|
||||
// __int64 v4; // rax
|
||||
// __int64* v5; // rax
|
||||
//
|
||||
// v2 = qword_14D40B538;
|
||||
// if (!qword_14D40B538)
|
||||
// {
|
||||
// v2 = sub_140462930();
|
||||
// qword_14D40B538 = v2;
|
||||
// }
|
||||
// v4 = (*(*v2 + 48))(v2, ptr_mem_arg);
|
||||
// if (v4 > 0)
|
||||
// CKeyValuesSystem::m_pMemPool -= v4;
|
||||
// v5 = qword_14D40B538;
|
||||
// if (!qword_14D40B538)
|
||||
// {
|
||||
// v5 = sub_140462930();
|
||||
// qword_14D40B538 = v5;
|
||||
// }
|
||||
// (*(*v5 + 40))(v5, ptr_mem_arg);
|
||||
// }
|
||||
|
||||
// GetMemPool return a global variable called m_pMemPool it gets modified by AllocKeyValuesMemory and FreeKeyValuesMemory above you can see where the find it in FreeKeyValuesMemory.
|
||||
void* GetMemPool() // @0x1413AA228 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
return reinterpret_cast<void*>(0x14D412768); // May need to dereference is once more not sure right now.
|
||||
}
|
||||
|
||||
void SetKeyValuesExpressionSymbol(const char* name, bool bValue) // @0x1413AA230 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, const char*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[8](this, name, bValue);
|
||||
}
|
||||
|
||||
bool GetKeyValuesExpressionSymbol(const char* name) // @0x1413AA238 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = bool(__thiscall*)(CKeyValuesSystem*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[9](this, name);
|
||||
}
|
||||
|
||||
HKeySymbol GetSymbolForStringCaseSensitive(HKeySymbol& hCaseInsensitiveSymbol, const char* name, bool bCreate) // @0x1413AA240 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = HKeySymbol(__thiscall*)(CKeyValuesSystem*, HKeySymbol&, const char*, bool);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[10](this, hCaseInsensitiveSymbol, name, bCreate);
|
||||
}
|
||||
|
||||
// Datatypes aren't accurate. But full fill the actual byte distance.
|
||||
public:
|
||||
void* vtable; // 0x0000
|
||||
__int64 m_iMaxKeyValuesSize; // 0x0008
|
||||
private:
|
||||
char gap10[240]; // 0x0010
|
||||
public:
|
||||
__int32 m_KvConditionalSymbolTable; // 0x0100
|
||||
private:
|
||||
char gap104[4]; // 0x0104
|
||||
public:
|
||||
__int64 field_108; // 0x0108
|
||||
private:
|
||||
char gap110[32]; // 0x0110
|
||||
public:
|
||||
int m_mutex; // 0x0130
|
||||
};
|
||||
|
||||
class KeyValues
|
||||
{
|
||||
public:
|
||||
|
||||
KeyValues* FindKey(const char* keyName, bool bCreate)
|
||||
{
|
||||
static auto func = reinterpret_cast<KeyValues*(__thiscall*)(KeyValues*, const char*, bool)>(addr_KeyValues_FindKey);
|
||||
return func(this, keyName, bCreate);
|
||||
}
|
||||
|
||||
const char* GetName();
|
||||
|
||||
int GetInt(const char* keyName, int defaultValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, false);
|
||||
|
||||
if (!dat)
|
||||
return defaultValue;
|
||||
|
||||
switch (dat->m_iDataType)
|
||||
{
|
||||
case TYPE_STRING:
|
||||
return atoi(dat->m_sValue);
|
||||
case TYPE_FLOAT:
|
||||
return static_cast<int>(m_flValue());
|
||||
case TYPE_WSTRING:
|
||||
return _wtoi(dat->m_wsValue);
|
||||
case TYPE_UINT64:
|
||||
return 0;
|
||||
default:
|
||||
return dat->m_iValue();
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
void SetInt(const char* keyName, int iValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, true);
|
||||
if (dat)
|
||||
{
|
||||
dat->m_iValue() = iValue;
|
||||
dat->m_iDataType = TYPE_INT;
|
||||
}
|
||||
}
|
||||
|
||||
void SetFloat(const char* keyName, float flValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, true);
|
||||
if (dat)
|
||||
{
|
||||
dat->m_flValue() = flValue;
|
||||
dat->m_iDataType = TYPE_FLOAT;
|
||||
}
|
||||
}
|
||||
|
||||
// Compiler makes it so m_Value shares the offset spot with m_flValue that why we cast it like this.
|
||||
float& m_flValue()
|
||||
{
|
||||
static __int32 offset = 0x18;
|
||||
return *(float*)((std::uintptr_t)this + offset);
|
||||
}
|
||||
|
||||
int& m_iValue()
|
||||
{
|
||||
static __int32 offset = 0x18;
|
||||
return *(int*)((std::uintptr_t)this + offset);
|
||||
}
|
||||
|
||||
public:
|
||||
unsigned __int32 m_iKeyName : 24; // 0x0000
|
||||
unsigned __int32 m_iKeyNameCaseSensitive : 8; // 0x0003
|
||||
char* m_sValue; // 0x0008
|
||||
wchar_t* m_wsValue; // 0x0010
|
||||
int m_Value; // 0x0018
|
||||
private:
|
||||
char gap1C[12]; // 0x0020
|
||||
public:
|
||||
char m_iDataType; // 0x0028
|
||||
unsigned __int16 m_iKeyNameCaseSensitive2; // 0x002A
|
||||
KeyValues* m_pPeer; // 0x0030
|
||||
KeyValues* m_pSub; // 0x0038
|
||||
KeyValues* m_pChain; // 0x0040
|
||||
};
|
||||
|
||||
struct Vector3 // Implement the proper class of this at some point.
|
||||
{
|
||||
float x; // 0x0000
|
||||
float y; // 0x0004
|
||||
float z; // 0x0008
|
||||
};
|
||||
|
||||
struct QAngle // Implement the proper class of this at some point.
|
||||
{
|
||||
float pitch; //0x0000
|
||||
float yaw; // 0x0004
|
||||
float roll; // 0x0008
|
||||
};
|
||||
|
||||
class CHostState
|
||||
{
|
||||
public:
|
||||
int m_iCurrentState; //0x0000
|
||||
int m_iNextState; //0x0004
|
||||
Vector3 m_vecLocation; //0x0008
|
||||
QAngle m_angLocation; //0x0014
|
||||
char m_levelName[64]; //0x0020
|
||||
char m_mapGroupName[256]; //0x0060
|
||||
char m_landMarkName[256]; //0x0160
|
||||
float m_flShortFrameTime; //0x0260
|
||||
bool m_bActiveGame; //0x0264
|
||||
bool m_bRememberLocation; //0x0265
|
||||
bool m_bBackgroundLevel; //0x0266
|
||||
bool m_bWaitingForConnection; //0x0267
|
||||
bool m_bSplitScreenConnect; //0x0268
|
||||
bool m_bGameHasShutDownAndFlushedMemory; //0x0269
|
||||
bool m_bWorkshopMapDownloadPending; //0x026A
|
||||
};
|
||||
|
||||
class CHLClient
|
||||
{
|
||||
public:
|
||||
void FrameStageNotify(ClientFrameStage_t curStage) // @0x1405C0740 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CHLClient*, ClientFrameStage_t);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[58](this, curStage); /* 48 83 EC 28 89 15 ? ? ? ? */
|
||||
}
|
||||
};
|
||||
|
||||
class CClient
|
||||
{
|
||||
public:
|
||||
inline CClient* GetClientInstance(int index)
|
||||
{
|
||||
return (CClient*)(std::uintptr_t)(0x16073B200 + (index * (std::uintptr_t)0x4A4C0));
|
||||
}
|
||||
|
||||
void*& GetNetChan()
|
||||
{
|
||||
return m_nNetChannel;
|
||||
}
|
||||
private:
|
||||
char pad_0000[16]; //0x0000
|
||||
public:
|
||||
int m_iUserID; //0x0010
|
||||
private:
|
||||
char pad_0014[908]; //0x0014
|
||||
public:
|
||||
void* m_nNetChannel; //0x03A0
|
||||
private:
|
||||
char pad_03A8[8]; //0x03A8
|
||||
public:
|
||||
int m_iSignonstate; //0x03B0
|
||||
private:
|
||||
char pad_03B4[4]; //0x03B4
|
||||
public:
|
||||
std::int64_t m_iOriginID; //0x03B8
|
||||
private:
|
||||
char pad_03C0[303360]; //0x03C0
|
||||
};
|
||||
|
||||
class CCommand
|
||||
{
|
||||
private:
|
||||
enum
|
||||
{
|
||||
COMMAND_MAX_ARGC = 64,
|
||||
COMMAND_MAX_LENGTH = 512,
|
||||
};
|
||||
|
||||
public:
|
||||
CCommand() = delete;
|
||||
|
||||
inline int MaxCommandLength()
|
||||
{
|
||||
return COMMAND_MAX_LENGTH - 1;
|
||||
}
|
||||
|
||||
inline int64_t ArgC() const
|
||||
{
|
||||
return m_nArgc;
|
||||
}
|
||||
|
||||
inline const char** ArgV() const
|
||||
{
|
||||
return m_nArgc ? (const char**)m_ppArgv : NULL;
|
||||
}
|
||||
|
||||
inline const char* ArgS() const
|
||||
{
|
||||
return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : "";
|
||||
}
|
||||
|
||||
inline const char* GetCommandString() const
|
||||
{
|
||||
return m_nArgc ? m_pArgSBuffer : "";
|
||||
}
|
||||
|
||||
inline const char* Arg(int nIndex) const
|
||||
{
|
||||
// FIXME: Many command handlers appear to not be particularly careful
|
||||
// about checking for valid argc range. For now, we're going to
|
||||
// do the extra check and return an empty string if it's out of range
|
||||
if (nIndex < 0 || nIndex >= m_nArgc)
|
||||
return "";
|
||||
return m_ppArgv[nIndex];
|
||||
}
|
||||
|
||||
inline const char* operator[](int nIndex) const
|
||||
{
|
||||
return Arg(nIndex);
|
||||
}
|
||||
|
||||
private:
|
||||
std::int64_t m_nArgc;
|
||||
std::int64_t m_nArgv0Size;
|
||||
char m_pArgSBuffer[COMMAND_MAX_LENGTH];
|
||||
char m_pArgvBuffer[COMMAND_MAX_LENGTH];
|
||||
const char* m_ppArgv[COMMAND_MAX_ARGC];
|
||||
};
|
||||
|
||||
class ConCommandBase
|
||||
{
|
||||
public:
|
||||
void* m_pConCommandBaseVTable; //0x0000
|
||||
ConCommandBase* m_pNext; //0x0008
|
||||
bool m_bRegistered; //0x0010
|
||||
private:
|
||||
char pad_0011[7]; //0x0011
|
||||
public:
|
||||
const char* m_pszName; //0x0018
|
||||
const char* m_pszHelpString; //0x0020
|
||||
private:
|
||||
char pad_0028[16]; //0x0028
|
||||
public:
|
||||
__int32 m_nFlags; //0x0038
|
||||
private:
|
||||
char pad_003C[4]; //0x003C
|
||||
}; //Size: 0x0038
|
||||
|
||||
class ConVar
|
||||
{
|
||||
public:
|
||||
ConCommandBase m_ConCommandBase; // 0x0000
|
||||
void* m_pConVarVTable; //0x0040
|
||||
ConVar* m_pParent; //0x0048
|
||||
const char* n_pszDefaultValue; //0x0050
|
||||
const char* m_pzsCurrentValue; //0x0058
|
||||
__int64 m_iStringLength; //0x0060
|
||||
float m_flValue; //0x0068
|
||||
int m_iValue; //0x006C
|
||||
bool m_bHasMin; //0x0070
|
||||
float m_flMinValue; //0x0074
|
||||
bool m_bHasMax; //0x0078
|
||||
float m_flMaxValue; //0x007C
|
||||
char pad_0080[32]; //0x0080
|
||||
}; //Size: 0x00A0
|
||||
|
||||
class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function.
|
||||
{
|
||||
public:
|
||||
virtual void SetFirst(void) = 0; //0
|
||||
virtual void Next(void) = 0; //1
|
||||
virtual bool IsValid(void) = 0; //2
|
||||
virtual ConCommandBase* Get(void) = 0; //3
|
||||
};
|
||||
|
||||
class CCVar
|
||||
{
|
||||
public:
|
||||
ConCommandBase* FindCommandBase(const char* szCommandName) // @0x1405983A0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = ConCommandBase*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[14](this, szCommandName);
|
||||
}
|
||||
|
||||
ConVar* FindVar(const char* szVarName) // @0x1405983B0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = ConVar*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[16](this, szVarName);
|
||||
}
|
||||
|
||||
void* /*Implement ConCommand class.*/ FindCommand(const char* szCommandName) // @0x1405983F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[18](this, szCommandName);
|
||||
}
|
||||
|
||||
CCVarIteratorInternal* FactoryInternalIterator() // @0x140597C10 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = CCVarIteratorInternal*(__thiscall*)(CCVar*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[41](this);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, ConCommandBase*> DumpToMap()
|
||||
{
|
||||
std::stringstream ss;
|
||||
CCVarIteratorInternal* itint = FactoryInternalIterator(); // Allocatd new InternalIterator.
|
||||
|
||||
std::unordered_map<std::string, ConCommandBase*> allConVars;
|
||||
|
||||
for (itint->SetFirst(); itint->IsValid(); itint->Next()) // Loop through all instances.
|
||||
{
|
||||
ConCommandBase* command = itint->Get();
|
||||
const char* commandName = command->m_pszName;
|
||||
allConVars[commandName] = command;
|
||||
}
|
||||
|
||||
return allConVars;
|
||||
}
|
||||
};
|
||||
|
||||
struct Interface
|
||||
{
|
||||
__int64 (*InterfacePtr)(void);
|
||||
const char* InterfaceName;
|
||||
__int64* NextInterfacePtr;
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Game Globals
|
||||
namespace GameGlobals
|
||||
{
|
||||
// Class Instances
|
||||
extern CHostState* HostState;
|
||||
extern CInputSystem* InputSystem;
|
||||
extern CCVar* Cvar;
|
||||
extern KeyValues** PlaylistKeyValues;
|
||||
extern CKeyValuesSystem* KeyValuesSystem;
|
||||
extern CClient* Client;
|
||||
extern BanList* BanSystem;
|
||||
|
||||
// Var
|
||||
ConVar* CreateCustomConVar(const char* name, const char* defaultValue, int flags, const char* helpString, bool bMin, float fMin, bool bMax, float fMax, void* callback, void* unk);
|
||||
void* CreateCustomConCommand(const char* name, const char* helpString, int flags, void* callback, void* callbackAfterExecution);
|
||||
|
||||
// Init
|
||||
void InitGameGlobals();
|
||||
void InitAllCommandVariations();
|
||||
void InitPlaylist();
|
||||
|
||||
extern std::vector<std::string> allPlaylists;
|
||||
extern bool IsInitialized;
|
||||
|
||||
// Utility
|
||||
void DisconnectClient(CClient* client, const char* reason, unsigned __int8 unk1, char unk2);
|
||||
}
|
@ -1,165 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
#include "opcodes.h"
|
||||
#include "gameclasses.h"
|
||||
|
||||
void Hooks::InstallHooks()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Minhook
|
||||
MH_Initialize();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook SourceAppSystemGroup functions
|
||||
MH_CreateHook(addr_CSourceAppSystemGroup_Create, &Hooks::CSourceAppSystemGroup_Create, reinterpret_cast<void**>(&originalCSourceAppSystemGroup_Create));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook Squirrel functions
|
||||
MH_CreateHook(addr_SQVM_Print, &Hooks::SQVM_Print, NULL);
|
||||
MH_CreateHook(addr_SQVM_LoadRson, &Hooks::SQVM_LoadRson, reinterpret_cast<void**>(&originalSQVM_LoadRson));
|
||||
MH_CreateHook(addr_SQVM_LoadScript, &Hooks::SQVM_LoadScript, reinterpret_cast<void**>(&originalSQVM_LoadScript));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook Game Functions
|
||||
// MH_CreateHook(addr_CHLClient_FrameStageNotify, &Hooks::FrameStageNotify, reinterpret_cast<void**>(&originalFrameStageNotify));
|
||||
MH_CreateHook(addr_CVEngineServer_IsPersistenceDataAvailable, &Hooks::IsPersistenceDataAvailable, reinterpret_cast<void**>(&originalIsPersistenceDataAvailable));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook Netchan functions
|
||||
MH_CreateHook(addr_NET_ReceiveDatagram, &Hooks::NET_ReceiveDatagram, reinterpret_cast<void**>(&originalNET_ReceiveDatagram));
|
||||
MH_CreateHook(addr_NET_SendDatagram, &Hooks::NET_SendDatagram, reinterpret_cast<void**>(&originalNET_SendDatagram));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook ConVar | ConCommand functions.
|
||||
MH_CreateHook(addr_ConVar_IsFlagSet, &Hooks::ConVar_IsFlagSet, NULL);
|
||||
MH_CreateHook(addr_ConCommand_IsFlagSet, &Hooks::ConCommand_IsFlagSet, NULL);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook Utility functions
|
||||
MH_CreateHook(addr_MSG_EngineError, &Hooks::MSG_EngineError, reinterpret_cast<void**>(&originalMSG_EngineError));
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable SourceAppSystemGroup hooks
|
||||
MH_EnableHook(addr_CSourceAppSystemGroup_Create);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable Squirrel hooks
|
||||
MH_EnableHook(addr_SQVM_Print);
|
||||
MH_EnableHook(addr_SQVM_LoadRson);
|
||||
MH_EnableHook(addr_SQVM_LoadScript);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable Game hooks
|
||||
MH_EnableHook(addr_CHLClient_FrameStageNotify);
|
||||
MH_EnableHook(addr_CVEngineServer_IsPersistenceDataAvailable);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enable ConVar | ConCommand hooks
|
||||
MH_EnableHook(addr_ConVar_IsFlagSet);
|
||||
MH_EnableHook(addr_ConCommand_IsFlagSet);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Enabled Utility hooks
|
||||
MH_EnableHook(addr_MSG_EngineError);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Set global variables
|
||||
GameGlobals::InitGameGlobals();
|
||||
}
|
||||
|
||||
void Hooks::RemoveHooks()
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Hook SourceAppSystemGroup functions
|
||||
MH_RemoveHook(addr_CSourceAppSystemGroup_Create);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Unhook Squirrel functions
|
||||
MH_RemoveHook(addr_SQVM_Print);
|
||||
MH_RemoveHook(addr_SQVM_LoadRson);
|
||||
MH_RemoveHook(addr_SQVM_LoadScript);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Unhook Game Functions
|
||||
MH_RemoveHook(addr_CHLClient_FrameStageNotify);
|
||||
MH_RemoveHook(addr_CVEngineServer_IsPersistenceDataAvailable);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Unhook Netchan functions
|
||||
MH_RemoveHook(addr_NET_ReceiveDatagram);
|
||||
MH_RemoveHook(addr_NET_SendDatagram);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Unhook ConVar | ConCommand functions.
|
||||
MH_RemoveHook(addr_ConVar_IsFlagSet);
|
||||
MH_RemoveHook(addr_ConCommand_IsFlagSet);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Unhook Utility functions
|
||||
MH_RemoveHook(addr_MSG_EngineError);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Reset Minhook
|
||||
MH_Uninitialize();
|
||||
}
|
||||
|
||||
//#################################################################################
|
||||
// TOGGLES
|
||||
//#################################################################################
|
||||
|
||||
void Hooks::ToggleDevCommands()
|
||||
{
|
||||
static bool bDev = true;;
|
||||
|
||||
if (!bDev)
|
||||
{
|
||||
MH_EnableHook(addr_ConVar_IsFlagSet);
|
||||
MH_EnableHook(addr_ConCommand_IsFlagSet);
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>>| DEVONLY COMMANDS ACTIVATED |<<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MH_DisableHook(addr_ConVar_IsFlagSet);
|
||||
MH_DisableHook(addr_ConCommand_IsFlagSet);
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>| DEVONLY COMMANDS DEACTIVATED |<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
bDev = !bDev;
|
||||
}
|
||||
|
||||
void Hooks::ToggleNetTrace()
|
||||
{
|
||||
static bool bNet = true;
|
||||
|
||||
if (!bNet)
|
||||
{
|
||||
MH_EnableHook(addr_NET_ReceiveDatagram);
|
||||
MH_EnableHook(addr_NET_SendDatagram);
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>>| NETCHANNEL TRACE ACTIVATED |<<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
MH_DisableHook(addr_NET_ReceiveDatagram);
|
||||
MH_DisableHook(addr_NET_SendDatagram);
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>| NETCHANNEL TRACE DEACTIVATED |<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
bNet = !bNet;
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
// Define the signatures or offsets to be searched and hooked
|
||||
namespace
|
||||
{
|
||||
Module r5_patterns = Module("r5apex.exe"); // Create module class instance.
|
||||
|
||||
#pragma region CSourceAppSystemGroup
|
||||
FUNC_AT_ADDRESS(addr_CSourceAppSystemGroup_Create, char(*)(__int64), r5_patterns.PatternSearch("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B F9 E8 ? ? ? ? 33 C9").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Console
|
||||
/*0x140202090*/
|
||||
FUNC_AT_ADDRESS(addr_CommandExecute, void(*)(void*, const char*), r5_patterns.PatternSearch("48 89 5C 24 ? 57 48 83 EC 20 48 8D 0D ? ? ? ? 41 8B D8").GetPtr());
|
||||
|
||||
/*0x14046FE90*/
|
||||
FUNC_AT_ADDRESS(addr_ConVar_IsFlagSet, bool(*)(int**, int), r5_patterns.PatternSearch("48 8B 41 48 85 50 38").GetPtr());
|
||||
|
||||
/*0x14046F490*/
|
||||
FUNC_AT_ADDRESS(addr_ConCommand_IsFlagSet, bool(*)(int*, int), r5_patterns.PatternSearch("85 51 38 0F 95 C0 C3").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Squirrel
|
||||
/*0x141057FD0*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_Print, void*, r5_patterns.PatternSearch("83 F8 01 48 8D 3D ? ? ? ?").OffsetSelf(0x3).FollowNearCallSelf(0x3, 0x7).GetPtr());
|
||||
|
||||
//DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x48\x89\x4C\x24\x08\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // For S0 and S1
|
||||
|
||||
/*0x141055630*/
|
||||
// For anything S2 and above (current S8
|
||||
FUNC_AT_ADDRESS(addr_SQVM_LoadScript, bool(*)(void*, const char*, const char*, int), r5_patterns.PatternSearch("48 8B C4 48 89 48 08 55 41 56 48 8D 68").GetPtr());
|
||||
|
||||
/*0x140C957E0*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_LoadRson, int(*)(const char*), r5_patterns.PatternSearch("4C 8B DC 49 89 5B 08 57 48 81 EC A0 00 00 00 33").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
/*0x1402655F0*/
|
||||
FUNC_AT_ADDRESS(addr_NET_ReceiveDatagram, bool(*)(int, void*, bool), r5_patterns.PatternSearch("48 89 74 24 18 48 89 7C 24 20 55 41 54 41 55 41 56 41 57 48 8D AC 24 50 EB").GetPtr());
|
||||
|
||||
/*0x1402662D0*/
|
||||
FUNC_AT_ADDRESS(addr_NET_SendDatagram, int(*)(SOCKET, const char*, int, int), r5_patterns.PatternSearch("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ? 05 ? ?").GetPtr());
|
||||
|
||||
/*0x14025F190*/
|
||||
FUNC_AT_ADDRESS(addr_NetChan_Shutdown, void(*)(void*, const char*, unsigned __int8, char), r5_patterns.StringSearch("Disconnect by server.\n").FindPatternSelf("E8 ? ? ? ? 4C 89 B3 ? ? ? ?", MemoryAddress::Direction::DOWN).FollowNearCallSelf().GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CHLClient
|
||||
/*0x1405C0740*/
|
||||
FUNC_AT_ADDRESS(addr_CHLClient_FrameStageNotify, void(*)(void* rcx, int curStage), r5_patterns.PatternSearch("48 83 EC 28 89 15 ?? ?? ?? ??").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CClientState
|
||||
/*0x1418223E4*/
|
||||
FUNC_AT_ADDRESS(addr_m_bRestrictServerCommands, void*, r5_patterns.StringSearch("DevShotGenerator_Init()").FindPatternSelf("88 05", MemoryAddress::Direction::UP).ResolveRelativeAddressSelf(0x2).OffsetSelf(0x2).GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CVEngineServer
|
||||
/*0x140315CF0*/
|
||||
FUNC_AT_ADDRESS(addr_CVEngineServer_IsPersistenceDataAvailable, bool(*)(__int64, int), r5_patterns.PatternSearch("3B 15 ?? ?? ?? ?? 7D 33").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Utility
|
||||
/*0x140295600*/
|
||||
FUNC_AT_ADDRESS(addr_MSG_EngineError, int(*)(char*, va_list), r5_patterns.PatternSearch("48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 00 00 48 8B DA").GetPtr());
|
||||
|
||||
/*0x1401B31C0*/
|
||||
FUNC_AT_ADDRESS(addr_MemAlloc_Wrapper, void* (*)(__int64), r5_patterns.StringSearch("ConversionModeMenu").FindPatternSelf("E8 ? ? ? ? 48", MemoryAddress::Direction::UP).FollowNearCallSelf().GetPtr());
|
||||
#pragma endregion
|
||||
// Un-used atm.
|
||||
// DWORD64 p_KeyValues_FindKey = /*1404744E0*/ reinterpret_cast<DWORD64>(PatternScan("r5apex.exe", "40 56 57 41 57 48 81 EC ?? ?? ?? ?? 45"));
|
||||
|
||||
#pragma region KeyValues
|
||||
/*0x1404744E0*/
|
||||
FUNC_AT_ADDRESS(addr_KeyValues_FindKey, void* (*)(void*, const char*, bool), r5_patterns.PatternSearch("40 56 57 41 57 48 81 EC ?? ?? ?? ?? 45").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
|
||||
void PrintHAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
PRINT_ADDRESS("CSourceAppSystemGroup::Create", addr_CSourceAppSystemGroup_Create);
|
||||
PRINT_ADDRESS("CommandExecute", addr_CommandExecute);
|
||||
PRINT_ADDRESS("ConVar_IsFlagSet", addr_ConVar_IsFlagSet);
|
||||
PRINT_ADDRESS("ConCommand_IsFlagSet", addr_ConCommand_IsFlagSet);
|
||||
PRINT_ADDRESS("SQVM_Print", addr_SQVM_Print);
|
||||
PRINT_ADDRESS("SQVM_LoadScript", addr_SQVM_LoadScript);
|
||||
PRINT_ADDRESS("SQVM_LoadRson", addr_SQVM_LoadRson);
|
||||
PRINT_ADDRESS("NET_ReceiveDatagram", addr_NET_ReceiveDatagram);
|
||||
PRINT_ADDRESS("NET_SendDatagram ", addr_NET_SendDatagram);
|
||||
PRINT_ADDRESS("NetChan_Shutdown ", addr_NetChan_Shutdown);
|
||||
PRINT_ADDRESS("CHLClient::FrameStageNotify", addr_CHLClient_FrameStageNotify);
|
||||
PRINT_ADDRESS("CVEngineServer::IsPersistenceDataAvailable", addr_CVEngineServer_IsPersistenceDataAvailable);
|
||||
PRINT_ADDRESS("MSG_EngineError", addr_MSG_EngineError);
|
||||
PRINT_ADDRESS("MemAlloc_Wrapper", addr_MemAlloc_Wrapper);
|
||||
PRINT_ADDRESS("KeyValues_FindKey", addr_KeyValues_FindKey);
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
// TODO implement error handling when sigscan fails or result is 0
|
||||
}
|
||||
}
|
||||
|
||||
inline bool g_bDebugLoading = false;
|
||||
inline bool g_bReturnAllFalse = false;
|
||||
inline bool g_bDebugConsole = false;
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
#pragma region CSourceAppSystemGroup
|
||||
char __fastcall CSourceAppSystemGroup_Create(__int64 a1);
|
||||
|
||||
using CSourceAppSystemGroup_CreateFn = char(*)(__int64);
|
||||
extern CSourceAppSystemGroup_CreateFn originalCSourceAppSystemGroup_Create;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CHLClient
|
||||
// void __fastcall FrameStageNotify(CHLClient* rcx, ClientFrameStage_t curStage);
|
||||
|
||||
// using FrameStageNotifyFn = void(__fastcall*)(CHLClient*, ClientFrameStage_t);
|
||||
// extern FrameStageNotifyFn originalFrameStageNotify;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Squirrel
|
||||
void* SQVM_Print(void* sqvm, char* fmt, ...);
|
||||
__int64 SQVM_LoadRson(const char* rson_name);
|
||||
bool SQVM_LoadScript(void* sqvm, const char* script_path, const char* script_name, int flag);
|
||||
|
||||
using SQVM_LoadRsonFn = __int64(*)(const char*);
|
||||
extern SQVM_LoadRsonFn originalSQVM_LoadRson;
|
||||
|
||||
using SQVM_LoadScriptFn = bool(*)(void*, const char*, const char*, int);
|
||||
extern SQVM_LoadScriptFn originalSQVM_LoadScript;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CVEngineServer
|
||||
bool IsPersistenceDataAvailable(__int64 thisptr, int client);
|
||||
|
||||
using IsPersistenceDataAvailableFn = bool(*)(__int64, int);
|
||||
extern IsPersistenceDataAvailableFn originalIsPersistenceDataAvailable;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
bool NET_ReceiveDatagram(int sock, void* inpacket, bool raw);
|
||||
unsigned int NET_SendDatagram(SOCKET s, const char* buf, int len, int flags);
|
||||
|
||||
using NET_ReceiveDatagramFn = bool(*)(int, void*, bool);
|
||||
extern NET_ReceiveDatagramFn originalNET_ReceiveDatagram;
|
||||
|
||||
using NET_SendDatagramFn = unsigned int(*)(SOCKET, const char*, int, int);
|
||||
extern NET_SendDatagramFn originalNET_SendDatagram;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ConVar
|
||||
bool ConVar_IsFlagSet(int** cvar, int flag);
|
||||
bool ConCommand_IsFlagSet(int* cmd, int flag);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Utility
|
||||
int MSG_EngineError(char* fmt, va_list args);
|
||||
|
||||
using MSG_EngineErrorFn = int(*)(char*, va_list);
|
||||
extern MSG_EngineErrorFn originalMSG_EngineError;
|
||||
#pragma endregion
|
||||
|
||||
void InstallHooks();
|
||||
void RemoveHooks();
|
||||
void ToggleNetTrace();
|
||||
void ToggleDevCommands();
|
||||
void DedicatedPatch();
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: test each ConVar query before setting the cvar
|
||||
// Input : **cvar - flag
|
||||
// Output : true if change is not permitted, false if permitted
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool Hooks::ConVar_IsFlagSet(int** cvar, int flag)
|
||||
{
|
||||
int real_flags = *(*(cvar + (72 / (sizeof(void*)))) + (56 / sizeof(int)));
|
||||
if (g_bDebugConsole)
|
||||
{
|
||||
printf("--------------------------------------------------\n");
|
||||
printf(" Flaged: %08X\n", real_flags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY
|
||||
real_flags &= 0xFFFFBFFD;
|
||||
if (g_bDebugConsole)
|
||||
{
|
||||
printf(" Masked: %08X\n", real_flags);
|
||||
printf(" Verify: %08X\n", flag);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (flag & 0x80000) { return true; }
|
||||
|
||||
if (!g_bReturnAllFalse)
|
||||
{
|
||||
return (real_flags & flag) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: test each ConCommand query before execution
|
||||
// Input : *cmd - flag
|
||||
// Output : true if execution is not permitted, false if permitted
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool Hooks::ConCommand_IsFlagSet(int* cmd, int flag)
|
||||
{
|
||||
int real_flags = *((cmd + (56 / sizeof(int))));
|
||||
if (g_bDebugConsole)
|
||||
{
|
||||
printf("--------------------------------------------------\n");
|
||||
printf(" Flaged: %08X\n", real_flags);
|
||||
}
|
||||
// Mask off FCVAR_CHEATS and FCVAR_DEVELOPMENTONLY
|
||||
real_flags &= 0xFFFFBFFD;
|
||||
if (g_bDebugConsole)
|
||||
{
|
||||
printf(" Masked: %08X\n", real_flags);
|
||||
printf(" Verify: %08X\n", flag);
|
||||
printf("--------------------------------------------------\n");
|
||||
}
|
||||
if (flag & 0x80000) { return true; }
|
||||
|
||||
if (!g_bReturnAllFalse)
|
||||
{
|
||||
return(real_flags & flag) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
MSG_EngineErrorFn originalMSG_EngineError = nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Engine Error message box
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int Hooks::MSG_EngineError(char* fmt, va_list args)
|
||||
{
|
||||
printf("\nENGINE ERROR #####################################\n");
|
||||
vprintf(fmt, args);
|
||||
|
||||
return originalMSG_EngineError(fmt, args);
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
NET_ReceiveDatagramFn originalNET_ReceiveDatagram = nullptr;
|
||||
NET_SendDatagramFn originalNET_SendDatagram = nullptr;
|
||||
}
|
||||
|
||||
typedef unsigned __int64 QWORD;
|
||||
|
||||
struct __declspec(align(8)) netpacket_t
|
||||
{
|
||||
DWORD family_maybe;
|
||||
sockaddr_in sin;
|
||||
WORD sin_port;
|
||||
BYTE gap16;
|
||||
BYTE byte17;
|
||||
DWORD source;
|
||||
double received;
|
||||
unsigned __int8* data;
|
||||
QWORD label;
|
||||
BYTE byte38;
|
||||
QWORD qword40;
|
||||
QWORD qword48;
|
||||
BYTE gap50[8];
|
||||
QWORD qword58;
|
||||
QWORD qword60;
|
||||
QWORD qword68;
|
||||
int less_than_12;
|
||||
DWORD wiresize;
|
||||
BYTE gap78[8];
|
||||
QWORD qword80;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook and log the receive datagram
|
||||
//-----------------------------------------------------------------------------
|
||||
bool Hooks::NET_ReceiveDatagram(int sock, void* inpacket, bool raw)
|
||||
{
|
||||
bool result = originalNET_ReceiveDatagram(sock, inpacket, raw);
|
||||
if (result)
|
||||
{
|
||||
int i = NULL;
|
||||
netpacket_t* pkt = (netpacket_t*)inpacket;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Log received packet data
|
||||
HexDump("[+] NET_ReceiveDatagram", 0, &pkt->data[i], pkt->wiresize);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook and log send datagram
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int Hooks::NET_SendDatagram(SOCKET s, const char* buf, int len, int flags)
|
||||
{
|
||||
unsigned int result = originalNET_SendDatagram(s, buf, len, flags);
|
||||
if (result)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Log transmitted packet data
|
||||
HexDump("[+] NET_SendDatagram", 0, buf, len);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
inline HANDLE GameProcess = GetCurrentProcess();
|
||||
void SetCHostState();
|
||||
|
||||
namespace
|
||||
{
|
||||
Module r5_op = Module("r5apex.exe"); // Create module class instance.
|
||||
|
||||
#pragma region Origin
|
||||
/*0x14032EEA0*/
|
||||
MemoryAddress Origin_Init = r5_op.PatternSearch("48 83 EC 28 80 3D ? ? ? 23 ? 0F 85 ? 02 ?");
|
||||
|
||||
/*0x140330290*/
|
||||
MemoryAddress Origin_SetState = r5_op.PatternSearch("48 81 EC 58 04 ? ? 80 3D ? ? ? ? ? 0F 84");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Engine
|
||||
/*0x14043FB90*/
|
||||
MemoryAddress dst002 = r5_op.PatternSearch("48 89 4C 24 08 56 41 55 48 81 EC 68 03 ? ? 4C");
|
||||
|
||||
/*0x14022A4A0*/
|
||||
MemoryAddress dst004 = r5_op.PatternSearch("48 83 EC 38 0F 29 74 24 20 48 89 5C 24 40 48 8B");
|
||||
|
||||
/*0x140238DA0*/
|
||||
MemoryAddress Host_NewGame = r5_op.PatternSearch("48 8B C4 ? 41 54 41 ? 48 81 EC ? ? ? ? F2");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
/*0x14030D000*/
|
||||
MemoryAddress CServer_Auth = r5_op.PatternSearch("40 55 57 41 55 41 57 48 8D AC 24 ? ? ? ?");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region FairFight
|
||||
/*0x140303AE0*/
|
||||
MemoryAddress FairFight_Init = r5_op.PatternSearch("40 53 48 83 EC 20 8B 81 B0 03 ? ? 48 8B D9 C6");
|
||||
#pragma endregion
|
||||
|
||||
|
||||
// TODO: create patterns instead and rename to function names.
|
||||
// Renderer
|
||||
MemoryAddress r0 = 0x00000001402FE280; //
|
||||
MemoryAddress gCShaderGlue__Init = 0x00000001403B3A50; //
|
||||
MemoryAddress gMatSync = 0x00000001403DEE90; //
|
||||
MemoryAddress gCMaterialSystem__MatsysMode_Init = 0x00000001403BD120; //
|
||||
MemoryAddress r4 = 0x0000000140404380; //
|
||||
MemoryAddress r5 = 0x000000014040D850; //
|
||||
MemoryAddress r6 = 0x0000000140413260; //
|
||||
MemoryAddress r7 = 0x00000001404093F0; //
|
||||
MemoryAddress r8 = 0x00000001403D2E60; //
|
||||
MemoryAddress d3d11init = 0x000000014043CDF0; //
|
||||
|
||||
// Engine
|
||||
MemoryAddress gHost_Init_0 = 0x0000000140236E40; // main Host_Init()?
|
||||
MemoryAddress e1 = 0x0000000140FB2F10; // also used by CServerGameDLL
|
||||
MemoryAddress addr_CEngine_Frame = 0x00000001402970E0;
|
||||
MemoryAddress e3 = 0x0000000140231C00;
|
||||
MemoryAddress e4 = 0x0000000140BE1970;
|
||||
MemoryAddress e5 = 0x0000000140DBBAF0;
|
||||
MemoryAddress e6 = 0x0000000140DBE610;
|
||||
MemoryAddress e7 = 0x000000014044AFA0;
|
||||
MemoryAddress e8 = 0x000000014027EC50; // RenderFrame?
|
||||
MemoryAddress gCEngineAPI__Init = 0x0000000140342FB0; //
|
||||
MemoryAddress gCEngineAPI__ModInit = 0x0000000140343DE0; //
|
||||
MemoryAddress gCEngineAPI__Connect = 0x0000000140342BA0; //
|
||||
MemoryAddress gCEngineAPI__OnStartup = 0x0000000140343860; //
|
||||
MemoryAddress gCSourceAppSystemGroup__Create = 0x000000014044AFA0; //
|
||||
MemoryAddress gCShaderSystem__Init = 0x00000001403DF870; //
|
||||
MemoryAddress gInitMaterialSystem = 0x000000014024B390; //
|
||||
MemoryAddress gCVideoMode_Common__DrawStartupGraphic = 0x000000014027F0F0; //
|
||||
MemoryAddress gShaderDispatch = 0x00000001403EE5C0;
|
||||
MemoryAddress gShaderCreate = 0x00000001403ECD00; //
|
||||
MemoryAddress gTextureCreate = 0x00000001403EDCD0;
|
||||
|
||||
MemoryAddress gCShaderSystem__9 = 0x00000001403DFC30;
|
||||
MemoryAddress gBSP_LUMP_INIT = 0x00000001402546F0; // BSP.
|
||||
|
||||
|
||||
MemoryAddress e9 = 0x00000001404066E0;
|
||||
MemoryAddress e10 = 0x00000001403B49E0; // CMaterialGlue?
|
||||
|
||||
// SERVER
|
||||
MemoryAddress gHost_Init_1 = 0x0000000140237B00; // server Host_Init()?
|
||||
MemoryAddress s1 = 0x0000000140231C00; // _Host_RunFrame() with inlined CFrameTimer::MarkFrame()?
|
||||
MemoryAddress s2 = 0x00000001402312A0; // server HeartBeat? (baseserver.cpp)
|
||||
MemoryAddress s3 = 0x0000000140FB36D0; // TEMP??
|
||||
|
||||
// CLIENT
|
||||
MemoryAddress gHost_Init_2 = 0x0000000140236640; // client Host_Init()?
|
||||
MemoryAddress gCGame__CreateGameWindow = 0x0000000140299100; //
|
||||
MemoryAddress c2 = 0x00000001403F4360; // 1403DF870 --> 1403F4360
|
||||
MemoryAddress c3 = 0x00000001403F8A80; // 1403DF870 --> 1403F8A40
|
||||
MemoryAddress gCHLClient__1000 = 0x00000001405C27B0; // CHLClient + 1000
|
||||
MemoryAddress gCHLClient__HudMessage = 0x00000001405BAC00; // CHudMessage
|
||||
MemoryAddress c6 = 0x00000001403CA2D0; //
|
||||
|
||||
// VGUI
|
||||
MemoryAddress gCEngineVGui__Init = 0x0000000140282E40; // jumptable
|
||||
MemoryAddress gCEngineVGui__OnLevelLoadingStarted = 0x00000001402830D0;
|
||||
MemoryAddress SCR_BeginLoadingPlaque = 0x000000014023E870;
|
||||
|
||||
|
||||
void PrintOAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
PRINT_ADDRESS("Origin_Init", Origin_Init.GetPtr());
|
||||
PRINT_ADDRESS("Origin_SetState", Origin_SetState.GetPtr());
|
||||
PRINT_ADDRESS("dst002", dst002.GetPtr());
|
||||
PRINT_ADDRESS("dst004", dst004.GetPtr());
|
||||
PRINT_ADDRESS("Host_NewGame", Host_NewGame.GetPtr());
|
||||
PRINT_ADDRESS("CServer_Auth", CServer_Auth.GetPtr());
|
||||
PRINT_ADDRESS("FairFight_Init", FairFight_Init.GetPtr());
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
|
||||
// TODO implement error handling when sigscan fails or result is 0
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
#include "pch.h"
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
#pragma message("[DEDICATED] pre-compiling headers.\n")
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Prevent winsock2 redefinition.
|
||||
#include <windows.h>
|
||||
#include <minhook.h>
|
||||
#include <WinSock2.h>
|
||||
#include <thread>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <filesystem>
|
||||
#include <sstream>
|
||||
#include <shlobj.h>
|
||||
#include <objbase.h>
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <Psapi.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
// Our headers
|
||||
|
||||
#include "spdlog.h"
|
||||
#include "sinks/basic_file_sink.h"
|
||||
#include "sinks/stdout_sinks.h"
|
||||
#include "sinks/ostream_sink.h"
|
||||
#include "utility.h"
|
||||
#include "httplib.h"
|
||||
#include "json.hpp"
|
||||
|
||||
#include "address.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FUNC_AT_ADDRESS(name, funcbody, addr) \
|
||||
using _##name = funcbody; \
|
||||
_##name name = (funcbody)addr \
|
||||
|
||||
#define PRINT_ADDRESS(name, address) std::cout << name << ": " << std::hex << std::uppercase << address << std::endl;
|
@ -1,4 +0,0 @@
|
||||
LIBRARY dedicated
|
||||
|
||||
EXPORTS
|
||||
DummyExport @1
|
@ -1,318 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<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>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{71988d92-343c-49ab-b52b-0ae0e83b0401}</ProjectGuid>
|
||||
<RootNamespace>r5dedicated</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<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|Win32'">
|
||||
<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)'=='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|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>dedicated</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>dedicated</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>dedicated</TargetName>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)external\minhook\include;$(SolutionDir)external\spdlog\include;$(SolutionDir)shared\include;$(SolutionDir)r5dedicated;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(SolutionDir)external\minhook\lib\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>dedicated</TargetName>
|
||||
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)external\minhook\include;$(SolutionDir)external\spdlog\include;$(SolutionDir)shared\include;$(SolutionDir)r5dedicated;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)external\minhook\lib\$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(LibraryPath)</LibraryPath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>Minhook.x64.lib</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>r5dedicated.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>if not EXIST $(SolutionDir)external\minhook\lib\$(Configuration)\Minhook.x64.lib (
|
||||
"$(DevEnvDir)devenv" "$(SolutionDir)apex.sln" /Rebuild $(Configuration) /project "$(SolutionDir)external\minhook\libMinHook.vcxproj"
|
||||
)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<StringPooling>true</StringPooling>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>Minhook.x64.lib</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>r5dedicated.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>if not EXIST $(SolutionDir)external\minhook\lib\$(Configuration)\Minhook.x64.lib (
|
||||
"$(DevEnvDir)devenv" "$(SolutionDir)apex.sln" /Rebuild $(Configuration) /project "$(SolutionDir)external\minhook\libMinHook.vcxproj"
|
||||
)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\shared\utility.cpp" />
|
||||
<ClCompile Include="console.cpp" />
|
||||
<ClCompile Include="csourceappsystemgroup.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="gameclasses.cpp" />
|
||||
<ClCompile Include="hooks.cpp" />
|
||||
<ClCompile Include="iconvar.cpp" />
|
||||
<ClCompile Include="msgbox.cpp" />
|
||||
<ClCompile Include="net.cpp" />
|
||||
<ClCompile Include="opcodes.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cvengineserver.cpp" />
|
||||
<ClCompile Include="sqvm.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\external\minhook\include\MinHook.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\async.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\async_logger-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\async_logger.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\argv.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\env.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\helpers-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\helpers.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\common-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\common.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\backtracer-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\backtracer.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\circular_q.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\console_globals.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\file_helper-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\file_helper.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\fmt_helper.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg_buffer-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg_buffer.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\mpmc_blocking_q.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\null_mutex.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\os-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\os.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\periodic_worker-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\periodic_worker.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\registry-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\registry.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\synchronous_factory.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\tcp_client-windows.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\tcp_client.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\thread_pool-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\thread_pool.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\details\windows_include.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bin_to_hex.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\args.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\chrono.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\color.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\compile.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\core.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\format-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\format.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\locale.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\os.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\ostream.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\printf.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\ranges.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\xchar.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\chrono.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\fmt.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\ostr.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\xchar.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\formatter.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\fwd.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\logger-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\logger.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\pattern_formatter-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\pattern_formatter.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\android_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ansicolor_sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ansicolor_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\base_sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\base_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\basic_file_sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\basic_file_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\daily_file_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\dist_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\dup_filter_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\hourly_file_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\mongo_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\msvc_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\null_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ostream_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\qt_sinks.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ringbuffer_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\rotating_file_sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\rotating_file_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_color_sinks-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_color_sinks.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_sinks-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_sinks.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\syslog_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\systemd_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\tcp_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\wincolor_sink-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\wincolor_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\win_eventlog_sink.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\spdlog-inl.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\spdlog.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\stopwatch.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\tweakme.h" />
|
||||
<ClInclude Include="..\external\spdlog\include\version.h" />
|
||||
<ClInclude Include="..\shared\include\address.h" />
|
||||
<ClInclude Include="..\shared\include\httplib.h" />
|
||||
<ClInclude Include="..\shared\include\json.hpp" />
|
||||
<ClInclude Include="..\shared\include\utility.h" />
|
||||
<ClInclude Include="console.h" />
|
||||
<ClInclude Include="dllmain.h" />
|
||||
<ClInclude Include="enums.h" />
|
||||
<ClInclude Include="gameclasses.h" />
|
||||
<ClInclude Include="hooks.h" />
|
||||
<ClInclude Include="opcodes.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="r5dedicated.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,450 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="core">
|
||||
<UniqueIdentifier>{b5a2491a-0f04-4b55-bc24-bbdd9cd6fc2e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared">
|
||||
<UniqueIdentifier>{ef65ed91-551f-4f5d-b2a9-efc26e1af0f6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks">
|
||||
<UniqueIdentifier>{22b58a18-d1d7-4e3e-b5de-d9338f3177d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="core\include">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="shared\include">
|
||||
<UniqueIdentifier>{a0165b58-06b1-4b6a-b5d1-5d643517ad14}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="core\resource">
|
||||
<UniqueIdentifier>{35b40ed1-12bd-4bcf-9c05-5a42a0096619}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries">
|
||||
<UniqueIdentifier>{a7199092-e8a9-49fa-97e1-b2d0ea21001b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog">
|
||||
<UniqueIdentifier>{bd5aef1a-dad8-45a0-85f2-82bc8f86bed8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include">
|
||||
<UniqueIdentifier>{c947552e-2623-4672-b3fa-3b50fe819628}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include\cfg">
|
||||
<UniqueIdentifier>{19dd0a10-5185-4b03-9466-693b86a17dff}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include\details">
|
||||
<UniqueIdentifier>{cb271201-f518-4dc4-9ab4-5d7f6a54c175}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include\fmt">
|
||||
<UniqueIdentifier>{12259d0c-172a-4a26-a1d4-5d784f4c3d25}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include\fmt\bundled">
|
||||
<UniqueIdentifier>{13bdf72b-f7c0-4658-9899-932f31d03da7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\spdlog\include\sinks">
|
||||
<UniqueIdentifier>{eaefe9b7-d14d-48b6-878a-53a5ada7454b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\minhook">
|
||||
<UniqueIdentifier>{245e8064-9b24-4631-9326-340dfb761fde}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="shared\libraries\minhook\include">
|
||||
<UniqueIdentifier>{485b5648-149f-4664-a961-be9cd520e9e3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\include">
|
||||
<UniqueIdentifier>{31cdde4d-3641-497c-9b34-20d3d7c89d87}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\cvengineserver">
|
||||
<UniqueIdentifier>{338a4fb7-7519-4628-9206-679d33824965}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\iconvar">
|
||||
<UniqueIdentifier>{06affed3-5a59-4b95-88ca-72d92c91909b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\netchannel">
|
||||
<UniqueIdentifier>{05e6e9a7-801b-49b0-9c5a-21c4868befb7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\other">
|
||||
<UniqueIdentifier>{cc424eef-0c7a-4fb0-9d84-30bf8db2e253}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\squirrel">
|
||||
<UniqueIdentifier>{74afa89f-72af-4e13-aa90-70f7a1957154}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="hooks\csourceappsystemgroup">
|
||||
<UniqueIdentifier>{9381fa63-cf89-4980-8e5a-bf6e43cb2283}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="r5-sdk">
|
||||
<UniqueIdentifier>{7fd080e8-390a-430b-a94c-e19c5792bf10}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="r5-sdk\src">
|
||||
<UniqueIdentifier>{e7e154b6-398e-42f9-bfb9-e80cd306254e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="r5-sdk\include">
|
||||
<UniqueIdentifier>{3c89e0ef-e415-4a91-86b7-2a04a5f03340}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\shared\include\address.h">
|
||||
<Filter>shared\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\shared\include\httplib.h">
|
||||
<Filter>shared\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\shared\include\json.hpp">
|
||||
<Filter>shared\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\shared\include\utility.h">
|
||||
<Filter>shared\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="console.h">
|
||||
<Filter>core\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>core\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dllmain.h">
|
||||
<Filter>core\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\async.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\async_logger-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\async_logger.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\common-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\common.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\formatter.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fwd.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\logger-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\logger.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\pattern_formatter-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\pattern_formatter.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\spdlog-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\spdlog.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\stopwatch.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\tweakme.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\version.h">
|
||||
<Filter>shared\libraries\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\argv.h">
|
||||
<Filter>shared\libraries\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\env.h">
|
||||
<Filter>shared\libraries\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\helpers-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\cfg\helpers.h">
|
||||
<Filter>shared\libraries\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\backtracer-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\backtracer.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\circular_q.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\console_globals.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\file_helper-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\file_helper.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\fmt_helper.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg_buffer-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\log_msg_buffer.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\mpmc_blocking_q.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\null_mutex.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\os-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\os.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\periodic_worker-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\periodic_worker.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\registry-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\registry.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\synchronous_factory.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\tcp_client-windows.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\tcp_client.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\thread_pool-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\thread_pool.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\details\windows_include.h">
|
||||
<Filter>shared\libraries\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bin_to_hex.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\chrono.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\fmt.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\ostr.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\xchar.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\args.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\chrono.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\color.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\compile.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\core.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\format-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\format.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\locale.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\os.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\ostream.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\printf.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\ranges.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\fmt\bundled\xchar.h">
|
||||
<Filter>shared\libraries\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\android_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ansicolor_sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ansicolor_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\base_sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\base_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\basic_file_sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\basic_file_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\daily_file_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\dist_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\dup_filter_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\hourly_file_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\mongo_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\msvc_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\null_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ostream_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\qt_sinks.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\ringbuffer_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\rotating_file_sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\rotating_file_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_color_sinks-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_color_sinks.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_sinks-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\stdout_sinks.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\syslog_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\systemd_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\tcp_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\wincolor_sink-inl.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\wincolor_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\spdlog\include\sinks\win_eventlog_sink.h">
|
||||
<Filter>shared\libraries\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\external\minhook\include\MinHook.h">
|
||||
<Filter>shared\libraries\minhook\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="hooks.h">
|
||||
<Filter>hooks\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="opcodes.h">
|
||||
<Filter>hooks\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="gameclasses.h">
|
||||
<Filter>r5-sdk\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="enums.h">
|
||||
<Filter>r5-sdk\include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="console.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="net.cpp">
|
||||
<Filter>hooks\netchannel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cvengineserver.cpp">
|
||||
<Filter>hooks\cvengineserver</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sqvm.cpp">
|
||||
<Filter>hooks\squirrel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="msgbox.cpp">
|
||||
<Filter>hooks\other</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\shared\utility.cpp">
|
||||
<Filter>shared</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="iconvar.cpp">
|
||||
<Filter>hooks\iconvar</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="opcodes.cpp">
|
||||
<Filter>hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="hooks.cpp">
|
||||
<Filter>hooks</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="csourceappsystemgroup.cpp">
|
||||
<Filter>hooks\csourceappsystemgroup</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gameclasses.cpp">
|
||||
<Filter>r5-sdk\src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="r5dedicated.def">
|
||||
<Filter>core\resource</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,114 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
SQVM_LoadRsonFn originalSQVM_LoadRson = nullptr;
|
||||
SQVM_LoadScriptFn originalSQVM_LoadScript = nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: prints the output of each VM to the console
|
||||
//---------------------------------------------------------------------------------
|
||||
void* Hooks::SQVM_Print(void* sqvm, char* fmt, ...)
|
||||
{
|
||||
int vmIdx = *(int*)((std::uintptr_t)sqvm + 0x18);
|
||||
|
||||
static char buf[1024];
|
||||
static std::string vmType[3] = { "Script(S):", "Script(C):", "Script(U):" };
|
||||
|
||||
static auto wconsole = spdlog::stdout_logger_mt("sqvm_wconsole"); // windows console
|
||||
|
||||
std::string vmStr = vmType[vmIdx].c_str();
|
||||
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
buf[sizeof(buf) - 1] = 0;
|
||||
va_end(args);
|
||||
|
||||
vmStr.append(buf);
|
||||
wconsole->debug(vmStr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: loads the include file from the mods directory
|
||||
//---------------------------------------------------------------------------------
|
||||
__int64 Hooks::SQVM_LoadRson(const char* rson_name)
|
||||
{
|
||||
char filepath[MAX_PATH] = { 0 };
|
||||
sprintf_s(filepath, MAX_PATH, "platform\\%s", rson_name);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Flip forward slashes in filepath to windows-style backslash
|
||||
for (int i = 0; i < strlen(filepath); i++)
|
||||
{
|
||||
if (filepath[i] == '/')
|
||||
{
|
||||
filepath[i] = '\\';
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Returns the new path if the rson exists on the disk
|
||||
if (FileExists(filepath) && originalSQVM_LoadRson(rson_name))
|
||||
{
|
||||
printf("\n");
|
||||
printf("##################################################\n");
|
||||
printf("] '%s'\n", filepath);
|
||||
printf("##################################################\n");
|
||||
printf("\n");
|
||||
|
||||
return originalSQVM_LoadRson(filepath);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
printf("##################################################\n");
|
||||
printf("] '%s'\n", rson_name);
|
||||
printf("##################################################\n");
|
||||
printf("\n");
|
||||
|
||||
return originalSQVM_LoadRson(rson_name);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: loads the script file from the mods directory
|
||||
//---------------------------------------------------------------------------------
|
||||
bool Hooks::SQVM_LoadScript(void* sqvm, const char* script_path, const char* script_name, int flag)
|
||||
{
|
||||
char filepath[MAX_PATH] = { 0 };
|
||||
sprintf_s(filepath, MAX_PATH, "platform\\%s", script_path);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Flip forward slashes in filepath to windows-style backslash
|
||||
for (int i = 0; i < strlen(filepath); i++)
|
||||
{
|
||||
if (filepath[i] == '/')
|
||||
{
|
||||
filepath[i] = '\\';
|
||||
}
|
||||
}
|
||||
if (g_bDebugLoading)
|
||||
{
|
||||
printf(" [+] Loading SQVM Script '%s' ...\n", filepath);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Returns true if the script exists on the disk
|
||||
if (FileExists(filepath) && originalSQVM_LoadScript(sqvm, filepath, script_name, flag))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (g_bDebugLoading)
|
||||
{
|
||||
printf(" [!] FAILED. Try SP / VPK for '%s'\n", filepath);
|
||||
}
|
||||
|
||||
return originalSQVM_LoadScript(sqvm, script_path, script_name, flag);
|
||||
}
|
339
r5dev/bsplib/bsplib.cpp
Normal file
339
r5dev/bsplib/bsplib.cpp
Normal file
@ -0,0 +1,339 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "common/psuedodefs.h"
|
||||
#include "bsplib/bsplib.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: calculates the view frustum culling data per static prop
|
||||
//-----------------------------------------------------------------------------
|
||||
__int64 __fastcall HCalcPropStaticFrustumCulling(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, __int64 a5, __int64 a6, __int64 a7)
|
||||
{
|
||||
//float v9; // xmm6_4
|
||||
//char v10; // r13
|
||||
//float v11; // xmm7_4
|
||||
//__int64 v12; // rsi
|
||||
//__int64 v13; // rdx
|
||||
//__int64 v14; // rbx
|
||||
//unsigned __int8 v15; // r8
|
||||
//const char* v16; // rax
|
||||
//int v17; // eax
|
||||
//char v18; // dl
|
||||
//bool v19; // cc
|
||||
//char v20; // al
|
||||
//__int16 v21; // ax
|
||||
//__int64 v22; // rax
|
||||
//__m128 v23; // xmm9
|
||||
//__m128 v24; // xmm10
|
||||
//__m128 v25; // xmm11
|
||||
//unsigned __int64 v26; // rbx
|
||||
//__m128 v27; // xmm0
|
||||
//__m128 v28; // xmm8
|
||||
//__int64 v29; // rax
|
||||
//__int64 v30; // rcx
|
||||
//__int64 v31; // xmm1_8
|
||||
//int v32; // er8
|
||||
//__m128 v33; // xmm0
|
||||
//__int64 v34; // rcx
|
||||
//unsigned __int64 v35; // rdx
|
||||
//__int64 v36; // rax
|
||||
//__int64 v37; // rax
|
||||
//unsigned __int64 v38; // rcx
|
||||
//__int64 v39; // rax
|
||||
//unsigned __int64 v40; // rcx
|
||||
//__int64 v41; // rax
|
||||
//float v42; // xmm2_4
|
||||
//__int64 v43; // rbx
|
||||
//float v44; // xmm2_4
|
||||
//float v45; // xmm4_4
|
||||
//__m128i v46; // xmm1
|
||||
//__m128i v47; // xmm2
|
||||
//__m128i v48; // xmm3
|
||||
//unsigned int v49; // eax
|
||||
//float v50; // xmm0_4
|
||||
//float v51; // xmm2_4
|
||||
//float v52; // xmm1_4
|
||||
//float v53; // xmm2_4
|
||||
//unsigned __int8 v54; // si
|
||||
//__int64 v55; // rax
|
||||
//__int64 v56; // rcx
|
||||
//int v57; // eax
|
||||
//__int64 v58; // rcx
|
||||
//int v59; // edx
|
||||
//__int64 v60; // rax
|
||||
//__int64 v61; // r13
|
||||
//int v62; // eax
|
||||
//unsigned __int64 v63; // r13
|
||||
//__int64 v64; // rdx
|
||||
//int v65; // er14
|
||||
//unsigned __int64 v66; // rdi
|
||||
//__int64 v67; // r13
|
||||
//__int64 v68; // r15
|
||||
//void** v69; // rbx
|
||||
//__int64 v70; // rcx
|
||||
//__int64 result; // rax
|
||||
//__m128 v72; // [rsp+38h] [rbp-D0h] BYREF
|
||||
//__int64 v73; // [rsp+48h] [rbp-C0h]
|
||||
//__int64 v74; // [rsp+50h] [rbp-B8h]
|
||||
//__m128 v75; // [rsp+58h] [rbp-B0h] BYREF
|
||||
//__int64 v76; // [rsp+68h] [rbp-A0h]
|
||||
//__int64 v77; // [rsp+78h] [rbp-90h]
|
||||
//__m128 v78[3]; // [rsp+88h] [rbp-80h] BYREF
|
||||
//char Destination[376]; // [rsp+B8h] [rbp-50h] BYREF
|
||||
//__int64 v80; // [rsp+278h] [rbp+170h]
|
||||
//int v83; // [rsp+288h] [rbp+180h]
|
||||
//int v84; // [rsp+290h] [rbp+188h]
|
||||
//__int64 v85; // [rsp+298h] [rbp+190h]
|
||||
//__int64 v86; // [rsp+2A8h] [rbp+1A0h]
|
||||
|
||||
//v9 = 1.0;
|
||||
//v10 = a4;
|
||||
//*(_QWORD*)(a1 + 20) = *(_QWORD*)a5;
|
||||
//*(_DWORD*)(a1 + 28) = *(_DWORD*)(a5 + 8);
|
||||
//*(_DWORD*)(a1 + 8) = a4;
|
||||
//v11 = *(float*)(a5 + 24);
|
||||
//v12 = a4 >> 1;
|
||||
//*(float*)(a1 + 12) = 1.0 / (float)(v11 * v11);
|
||||
//v13 = *(unsigned __int16*)(a7 + 320);
|
||||
//*(_WORD*)a1 = v13;
|
||||
//v14 = (*(__int64(__fastcall**)(__int64, __int64, _QWORD))(*(_QWORD*)qword_14D40B328 + 104i64))(qword_14D40B328, v13, 0i64);
|
||||
//v85 = v14;
|
||||
//if ((*(_BYTE*)(v14 + 156) & 0x10) == 0 && dword_1696A9D20 < 100)
|
||||
// ++dword_1696A9D20;
|
||||
//v15 = *(_BYTE*)(a5 + 30);
|
||||
//if (v15 > 2u && (unsigned __int8)(v15 - 6) > 2u)
|
||||
//{
|
||||
// v16 = (const char*)(*((__int64(__fastcall**)(void**, __int64))g_CModelLoader + 4))(&g_CModelLoader, a7);
|
||||
// strncpy_s(Destination, v16, 0x104ui64);
|
||||
// v15 = 0;
|
||||
//}
|
||||
//v17 = *(unsigned __int8*)(a5 + 32);
|
||||
//*(_BYTE*)(a1 + 4) = v17;
|
||||
//v18 = v17;
|
||||
//v19 = v17 < *(_DWORD*)(v14 + 228);
|
||||
//*(_BYTE*)(a1 + 5) = v15;
|
||||
//if (!v19)
|
||||
// v18 = 0;
|
||||
//*(_BYTE*)(a1 + 4) = v18;
|
||||
//v20 = *(_BYTE*)(a5 + 31);
|
||||
//if ((v20 & 4) != 0)
|
||||
//{
|
||||
// v15 |= 0x40u;
|
||||
// *(_BYTE*)(a1 + 5) = v15;
|
||||
// v20 = *(_BYTE*)(a5 + 31);
|
||||
//}
|
||||
//if ((v20 & 8) != 0)
|
||||
//{
|
||||
// v15 |= 0x20u;
|
||||
// *(_BYTE*)(a1 + 5) = v15;
|
||||
// v20 = *(_BYTE*)(a5 + 31);
|
||||
//}
|
||||
//if ((v20 & 0x30) != 16)
|
||||
// *(_BYTE*)(a1 + 5) = v15 | 0x10;
|
||||
//v21 = 0;
|
||||
//if (*(_WORD*)(a5 + 34) != 0xFFFF)
|
||||
// v21 = *(_WORD*)(a5 + 34);
|
||||
//*(_WORD*)(a1 + 2) = v21;
|
||||
//sub_1404365A0(v78, a5, a5 + 12, 0);
|
||||
//v22 = qword_141744EA8;
|
||||
//v23 = v78[0];
|
||||
//v24 = v78[1];
|
||||
//v25 = v78[2];
|
||||
//v26 = (unsigned __int64)(unsigned int)v12 << 6;
|
||||
//*(__m128*)(v26 + qword_141744EA8) = v78[0];
|
||||
//*(__m128*)(v26 + v22 + 16) = v24;
|
||||
//*(__m128*)(v26 + v22 + 32) = v25;
|
||||
//v27 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(*(_DWORD*)(a5 + 52)), (__m128i)0i64), (__m128i)0i64)), (__m128)xmmword_1415BD270);
|
||||
//v75 = v27;
|
||||
//*(double*)v27.m128_u64 = _mm_castsi128_ps(sub_140270130(&v75));
|
||||
//v28 = v27;
|
||||
//*(__m128*)(v26 + qword_141744EA8 + 48) = v27;
|
||||
//((void(__fastcall*)(void***, __int64, __int64*, char*))off_141731448[10])(&off_141731448, a7, (long long*)&v72, (char*)&v72 + 12);
|
||||
//sub_14028F170((unsigned int)&v75, (unsigned int)&v75.m128_u32[3], (__m128*)v78, (__m128i*)&v72, (__m128i*)&v72 + 12);
|
||||
//v29 = qword_141744EA0;
|
||||
//v30 = 3 * v12;
|
||||
//v31 = v76;
|
||||
//*(__m128*)(qword_141744EA0 + 8 * v30) = v75;
|
||||
//*(_QWORD*)(v29 + 8 * v30 + 16) = v31;
|
||||
//if ((v10 & 1) != 0)
|
||||
//{
|
||||
// v32 = dword_141744EBC;
|
||||
// v33 = v72;
|
||||
// *(_DWORD*)a2 = *(_DWORD*)(a6 + 48);
|
||||
// *(_DWORD*)(a2 + 4) = *(_DWORD*)(a6 + 52);
|
||||
// *(_QWORD*)(a2 + 8) = 0i64;
|
||||
// v34 = 3i64 * (unsigned int)(v32 + v12);
|
||||
// v35 = (unsigned __int64)(unsigned int)(v32 + v12) << 6;
|
||||
// v36 = qword_141744EA0;
|
||||
// *(__m128*)(qword_141744EA0 + 8 * v34) = v33;
|
||||
// *(_QWORD*)(v36 + 8 * v34 + 16) = v73;
|
||||
// v37 = qword_141744EA8;
|
||||
// v38 = (unsigned __int64)(unsigned int)(v12 + 2 * v32) << 6;
|
||||
// *(__m128*)(v35 + qword_141744EA8) = v23;
|
||||
// *(__m128*)(v35 + v37 + 16) = v24;
|
||||
// *(__m128*)(v35 + v37 + 32) = v25;
|
||||
// *(__m128*)(v35 + qword_141744EA8 + 48) = v28;
|
||||
// v39 = qword_141744EA8;
|
||||
// *(__m128*)(v38 + qword_141744EA8) = v23;
|
||||
// *(__m128*)(v38 + v39 + 16) = v24;
|
||||
// *(__m128*)(v38 + v39 + 32) = v25;
|
||||
// *(__m128*)(v38 + qword_141744EA8 + 48) = v28;
|
||||
// v40 = (unsigned __int64)(unsigned int)(v32 + v12 + 2 * v32) << 6;
|
||||
// *(__m128*)(v40 + qword_141744EA8 + 48) = v28;
|
||||
// v41 = qword_141744EA8;
|
||||
// *(__m128*)(v40 + qword_141744EA8) = *(__m128*)a6;
|
||||
// *(__m128*)(v40 + v41 + 16) = *(__m128*)(a6 + 16);
|
||||
// *(__m128*)(v40 + v41 + 32) = *(__m128*)(a6 + 32);
|
||||
//}
|
||||
//v42 = *(float*)(a5 + 36);
|
||||
//v43 = v85;
|
||||
//if (v42 <= 0.0)
|
||||
//{
|
||||
// if ((*(_DWORD*)(v85 + 156) & 0x800) != 0)
|
||||
// {
|
||||
// v42 = 227023.36;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// v44 = *(float*)(v85 + 364);
|
||||
// if (v44 <= 0.0)
|
||||
// v42 = fmaxf(
|
||||
// (float)((float)(sqrtf(
|
||||
// (float)((float)((float)(*(float*)&v72 - *((float*)&v72 + 3)) * (float)(*(float*)&v72 - *((float*)&v72 + 3)))
|
||||
// + (float)((float)(*((float*)&v72 + 1) - *(float*)&v73) * (float)(*((float*)&v72 + 1) - *(float*)&v73)))
|
||||
// + (float)((float)(*((float*)&v72 + 2) - *((float*)&v73 + 1)) * (float)(*((float*)&v72 + 2) - *((float*)&v73 + 1))))
|
||||
// * 0.5)
|
||||
// * v11)
|
||||
// * g_pCvar->FindVar("model_defaultFadeDistScale")->m_pParent->m_flValue,
|
||||
// g_pCvar->FindVar("model_defaultFadeDistMin")->m_pParent->m_flValue);
|
||||
// else
|
||||
// v42 = v44 * v11;
|
||||
// }
|
||||
//}
|
||||
//v45 = fmaxf(v42, 100.0);
|
||||
//*(float*)(a1 + 16) = v45 * v45;
|
||||
//v46 = (__m128i) * (unsigned int*)(v85 + 368);
|
||||
//if (*(float*)v46.m128i_i32 <= 0.0)
|
||||
//{
|
||||
// LOWORD(v49) = 0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// *(float*)v46.m128i_i32 = *(float*)v46.m128i_i32 * *(float*)v46.m128i_i32;
|
||||
// v47 = v46;
|
||||
// *(float*)v47.m128i_i32 = fmaxf(*(float*)v46.m128i_i32, 1.0004883);
|
||||
// v48 = v47;
|
||||
// *(float*)v48.m128i_i32 = fminf(*(float*)v47.m128i_i32, 4293918700.0);
|
||||
// v49 = (unsigned int)(_mm_cvtsi128_si32(v48) - 1065351168) >> 12;
|
||||
//}
|
||||
//*(_WORD*)(a1 + 6) = v49;
|
||||
//v50 = *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1) + 8)
|
||||
// - *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1) + 20);
|
||||
//v51 = *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1) + 4)
|
||||
// - *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1) + 16);
|
||||
//v52 = *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1))
|
||||
// - *(float*)(qword_141744EA0 + 24 * ((unsigned __int64)*(unsigned int*)(a1 + 8) >> 1) + 12);
|
||||
//v53 = (float)((float)(v51 * v51) + (float)(v52 * v52)) + (float)(v50 * v50);
|
||||
//if (v45 >= 227023.363449684)
|
||||
// v9 = g_pCvar->FindVar("staticProp_no_fade_scalar")->m_pParent->m_flValue;
|
||||
//v54 = 0;
|
||||
//*(float*)(qword_141744E88 + 8i64 * a3) = v9 * (float)(1.0 / (float)(v53 * g_pCvar->FindVar("staticProp_gather_size_weight")->m_pParent->m_flValue));
|
||||
//v55 = qword_141744E88;
|
||||
//*(_BYTE*)(qword_141744E88 + 8i64 * a3 + 4) &= 0xFEu;
|
||||
//*(_BYTE*)(v55 + 8i64 * a3 + 4) |= v45 >= 227023.363449684;
|
||||
//v56 = *(_QWORD*)(*(__int64(__fastcall**)(__int64, _QWORD))(*(_QWORD*)qword_14D40B328 + 160i64))(qword_14D40B328, *(unsigned __int16*)(a7 + 320));
|
||||
//v57 = *(unsigned __int16*)(a5 + 32);
|
||||
//v77 = v56;
|
||||
//v58 = v85 + *(int*)(v85 + 232) + 2i64 * v57 * *(_DWORD*)(v85 + 224);
|
||||
//v59 = 0;
|
||||
//v86 = v58;
|
||||
//v84 = 0;
|
||||
//if (*(int*)(v85 + 236) <= 0)
|
||||
// return 0i64;
|
||||
//v60 = 0i64;
|
||||
//v74 = 0i64;
|
||||
//do
|
||||
//{
|
||||
// v61 = v60 + *(int*)(v43 + 240);
|
||||
// v62 = 0;
|
||||
// v63 = v43 + v61;
|
||||
// v83 = 0;
|
||||
// v75.m128_u64[0] = v63;
|
||||
// if (*(int*)(v63 + 4) > 0)
|
||||
// {
|
||||
// v64 = 0i64;
|
||||
// v80 = 0i64;
|
||||
// do
|
||||
// {
|
||||
// v65 = 0;
|
||||
// v66 = v63 + v64 + *(int*)(v63 + 12);
|
||||
// if (*(int*)(v66 + 76) > 0)
|
||||
// {
|
||||
// v67 = v77;
|
||||
// v68 = 0i64;
|
||||
// do
|
||||
// {
|
||||
// v69 = *(void***)(v67 + 8i64 * *(__int16*)(v58 + 2i64 * *(int*)(v68 + *(int*)(v66 + 80) + v66)));
|
||||
// if (!(*((unsigned __int8(__fastcall**)(void**)) * v69 + 86))(v69))
|
||||
// {
|
||||
// if (!(*((unsigned __int8(__fastcall**)(void**)) * v69 + 32))(v69) && (*((unsigned __int8(__fastcall**)(void**)) * v69 + 31))(v69))
|
||||
// {
|
||||
// v70 = 0i64;
|
||||
// if (dword_141744EE8)
|
||||
// {
|
||||
// while (off_141744E70[v70 + 16] != v69)
|
||||
// {
|
||||
// v70 = (unsigned int)(v70 + 1);
|
||||
// if ((unsigned int)v70 >= dword_141744EE8)
|
||||
// goto LABEL_42;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LABEL_42:
|
||||
// off_141744E70[(unsigned int)dword_141744EE8++ + 16] = v69;
|
||||
// }
|
||||
// }
|
||||
// if ((*((unsigned __int8(__fastcall**)(void**)) * v69 + 21))(v69) && (*((unsigned int(__fastcall**)(void**, __int64)) * v69 + 18))(v69, 1i64))
|
||||
// *(_BYTE*)(a1 + 5) |= 0x80u;
|
||||
// if (!(*((unsigned __int8(__fastcall**)(void**)) * v69 + 48))(v69) && (*((unsigned int(__fastcall**)(void**, __int64)) * v69 + 18))(v69, 21844i64))
|
||||
// v54 |= 2u;
|
||||
// v54 |= (*((unsigned __int8(__fastcall**)(void**)) * v69 + 48))(v69) != 0;
|
||||
// }
|
||||
// v58 = v86;
|
||||
// ++v65;
|
||||
// v68 += 92i64;
|
||||
// } while (v65 < *(_DWORD*)(v66 + 76));
|
||||
// v63 = v75.m128_u64[0];
|
||||
// v62 = v83;
|
||||
// v64 = v80;
|
||||
// }
|
||||
// ++v62;
|
||||
// v64 += 136i64;
|
||||
// v83 = v62;
|
||||
// v80 = v64;
|
||||
// } while (v62 < *(_DWORD*)(v63 + 4));
|
||||
// v43 = v85;
|
||||
// v59 = v84;
|
||||
// }
|
||||
// ++v59;
|
||||
// v60 = v74 + 16;
|
||||
// v84 = v59;
|
||||
// v74 += 16i64;
|
||||
//} while (v59 < *(_DWORD*)(v43 + 236));
|
||||
//result = v54;
|
||||
//if (v54)
|
||||
// *(_BYTE*)(a1 + 5) &= 0x7Fu;
|
||||
//return result;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BspLib_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&CalcPropStaticFrustumCulling, &HCalcPropStaticFrustumCulling);
|
||||
}
|
||||
|
||||
void BspLib_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&CalcPropStaticFrustumCulling, &HCalcPropStaticFrustumCulling);
|
||||
}
|
45
r5dev/bsplib/bsplib.h
Normal file
45
r5dev/bsplib/bsplib.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
namespace
|
||||
{
|
||||
//static auto g_CModelLoader = ADDRESS(0x14173B210).RCast<void*>();
|
||||
|
||||
//static auto dword_1696A9D20 = ADDRESS(0x14D40B328).RCast<std::uint32_t>();
|
||||
//static auto dword_141744EE8 = ADDRESS(0x141744EE8).RCast<std::uint32_t>();
|
||||
//static auto dword_141744EBC = ADDRESS(0x141744EBC).RCast<std::uint32_t>();
|
||||
|
||||
//static auto qword_14D40B328 = ADDRESS(0x14D40B328).RCast<std::uint32_t>();
|
||||
//static auto qword_141744EA8 = ADDRESS(0x141744EA8).RCast<std::uint32_t>();
|
||||
//static auto qword_141744EA0 = ADDRESS(0x141744EA0).RCast<std::uint32_t>();
|
||||
//static auto qword_141744E88 = ADDRESS(0x141744E88).RCast<std::uint32_t>();
|
||||
|
||||
//static auto off_141744E70 = ADDRESS(0x141744E70).RCast<void**>();
|
||||
//static auto off_141731448 = ADDRESS(0x141744EA8).RCast<void**>();
|
||||
|
||||
//__m128 xmmword_1415BD270 = _mm_castsi128_ps(_mm_set_epi32(0x3B808081, 0x3B808081, 0x3B808081, 0x3B808081)); // xmmword_1415BD270
|
||||
|
||||
//static auto sub_1404365A0 = ADDRESS(0x1404365A0).RCast<void** (*)(__m128*, long long, long long, double)>(); // Prototype is most likely incorrect: 'local variable allocation has failed, the output may be wrong!'
|
||||
//static auto sub_140270130 = ADDRESS(0x140270130).RCast<__m128 (*)(__m128*)>();
|
||||
//static auto sub_14028F170 = ADDRESS(0x14028F170).RCast<const __m128i* (*)(__int64, __int64, __m128*, const __m128i*, const __m128i*)>();
|
||||
|
||||
ADDRESS p_CalcPropStaticFrustumCulling = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x8B\xC4\x44\x89\x40\x18\x48\x89\x50\x10\x55", "xxxxxxxxxxxx");
|
||||
__int64 (*CalcPropStaticFrustumCulling)(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, __int64 a5, __int64 a6, __int64 a7) = (__int64 (*)(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, __int64 a5, __int64 a6, __int64 a7))p_CalcPropStaticFrustumCulling.GetPtr(); /*48 8B C4 44 89 40 18 48 89 50 10 55*/
|
||||
}
|
||||
|
||||
__int64 __fastcall HCalcPropStaticFrustumCulling(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4, __int64 a5, __int64 a6, __int64 a7);
|
||||
|
||||
void BspLib_Attach();
|
||||
void BspLib_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HBspLib : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: CalcPropStaticFrustumCulling : 0x" << std::hex << std::uppercase << p_CalcPropStaticFrustumCulling.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HBspLib);
|
13
r5dev/client/IVEngineClient.cpp
Normal file
13
r5dev/client/IVEngineClient.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
//=============================================================================//
|
||||
//
|
||||
// Purpose: Interface the engine exposes to the game DLL
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "tier0/basetypes.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
|
||||
//#ifdef GAMEDLL_S3
|
||||
bool* m_bRestrictServerCommands = reinterpret_cast<bool*>(g_mGameDll.StringSearch("DevShotGenerator_Init()").FindPatternSelf("88 05", ADDRESS::Direction::UP).ResolveRelativeAddressSelf(0x2).OffsetSelf(0x2).GetPtr());
|
||||
//#endif
|
25
r5dev/client/IVEngineClient.h
Normal file
25
r5dev/client/IVEngineClient.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CVENGINECLIENT ================================================================================================================================================== */
|
||||
ADDRESS p_IVEngineClient_CommandExecute = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x57\x48\x83\xEC\x20\x48\x8D\x0D\x27\x61\xa5\x1E\x41\x8B\xD8", "xxxx?xxxxxxxx????xxx");
|
||||
void (*IVEngineClient_CommandExecute)(void* self, const char* cmd) = (void (*)(void*, const char*))p_IVEngineClient_CommandExecute.GetPtr(); /*48 89 5C 24 ?? 57 48 83 EC 20 48 8D 0D ?? ?? ?? ?? 41 8B D8*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern bool* m_bRestrictServerCommands;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HVEngineClient : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: IVEngineClient::CommandExecute : 0x" << std::hex << std::uppercase << p_IVEngineClient_CommandExecute.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: m_bRestrictServerCommands : 0x" << std::hex << std::uppercase << m_bRestrictServerCommands << std::setw(0) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HVEngineClient);
|
133
r5dev/client/cdll_engine_int.cpp
Normal file
133
r5dev/client/cdll_engine_int.cpp
Normal file
@ -0,0 +1,133 @@
|
||||
#include "core/stdafx.h"
|
||||
/*****************************************************************************/
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier0/IConVar.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
#include "client/client.h"
|
||||
#include "client/cdll_engine_int.h"
|
||||
#include "public/include/bansystem.h"
|
||||
#include "engine/net_chan.h"
|
||||
#include "vpc/keyvalues.h"
|
||||
/*****************************************************************************/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t frameStage)
|
||||
{
|
||||
switch (frameStage)
|
||||
{
|
||||
case ClientFrameStage_t::FRAME_START: // FrameStageNotify gets called every frame by CEngine::Frame with the stage being FRAME_START. We can use this to check/set global variables.
|
||||
{
|
||||
static bool bInitialized = false;
|
||||
if (!bInitialized)
|
||||
{
|
||||
IConVar_ClearHostNames();
|
||||
ConCommand_InitConCommand();
|
||||
CKeyValueSystem_Init();
|
||||
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg");
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg");
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg");
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
HNET_GenerateKey();
|
||||
}
|
||||
g_pCvar->FindVar("net_usesocketsforloopback")->m_pParent->m_iValue = 1;
|
||||
|
||||
bInitialized = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ClientFrameStage_t::FRAME_NET_UPDATE_POSTDATAUPDATE_END:
|
||||
{
|
||||
if (g_pBanSystem->IsRefuseListValid())
|
||||
{
|
||||
for (int i = 0; i < g_pBanSystem->vsvrefuseList.size(); i++) // Loop through vector.
|
||||
{
|
||||
for (int c = 0; c < MAX_PLAYERS; c++) // Loop through all possible client instances.
|
||||
{
|
||||
CClient* client = g_pClient->GetClientInstance(c); // Get client instance.
|
||||
if (!client)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!client->GetNetChan()) // Netchan valid?
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int clientID = g_pClient->m_iUserID + 1; // Get UserID + 1.
|
||||
if (clientID != g_pBanSystem->vsvrefuseList[i].second) // See if they match.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NET_DisconnectClient(g_pClient, c, g_pBanSystem->vsvrefuseList[i].first.c_str(), 0, 1);
|
||||
g_pBanSystem->DeleteConnectionRefuse(clientID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
PatchNetVarConVar();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHLClient_FrameStageNotify(rcx, (int)frameStage);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void PatchNetVarConVar()
|
||||
{
|
||||
CHAR sConvarPtr[] = "\x72\x3a\x73\x76\x72\x75\x73\x7a\x7a\x03\x04";
|
||||
PCHAR curr = sConvarPtr;
|
||||
while (*curr)
|
||||
{
|
||||
*curr ^= 'B';
|
||||
++curr;
|
||||
}
|
||||
|
||||
std::int64_t nCvarAddr = 0;
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::string(sConvarPtr);
|
||||
ss >> nCvarAddr;
|
||||
void* pCvar = reinterpret_cast<void*>(nCvarAddr);
|
||||
|
||||
if (*reinterpret_cast<std::uint8_t*>(pCvar) == 144)
|
||||
{
|
||||
std::uint8_t padding[] =
|
||||
{
|
||||
0x48, 0x8B, 0x45, 0x58, 0xC7, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
void* pCallback = nullptr;
|
||||
VirtualAlloc(pCallback, 10, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
memcpy(pCallback, (void*)padding, 9);
|
||||
reinterpret_cast<void(*)()>(pCallback)();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CHLClient_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&CHLClient_FrameStageNotify, &HFrameStageNotify);
|
||||
}
|
||||
|
||||
void CHLClient_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&CHLClient_FrameStageNotify, &HFrameStageNotify);
|
||||
}
|
74
r5dev/client/cdll_engine_int.h
Normal file
74
r5dev/client/cdll_engine_int.h
Normal file
@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
|
||||
|
||||
enum class ClientFrameStage_t : int
|
||||
{
|
||||
FRAME_UNDEFINED = -1, // (haven't run any frames yet)
|
||||
FRAME_START,
|
||||
|
||||
// A network packet is being recieved
|
||||
FRAME_NET_UPDATE_START,
|
||||
// Data has been received and we're going to start calling PostDataUpdate
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
|
||||
// Data has been received and we've called PostDataUpdate on all data recipients
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
|
||||
// We've received all packets, we can now do interpolation, prediction, etc..
|
||||
FRAME_NET_UPDATE_END,
|
||||
|
||||
// We're about to start rendering the scene
|
||||
FRAME_RENDER_START,
|
||||
// We've finished rendering the scene.
|
||||
FRAME_RENDER_END,
|
||||
|
||||
FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE
|
||||
};
|
||||
|
||||
class CHLClient
|
||||
{
|
||||
public:
|
||||
void FrameStageNotify(ClientFrameStage_t curStage) // @0x1405C0740 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CHLClient*, ClientFrameStage_t);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[58](this, curStage); /*48 83 EC 28 89 15 ?? ?? ?? ??*/
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CHLCLIENT ======================================================================================================================================================= */
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
ADDRESS p_CHLClient_FrameStageNotify = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x38\x89\x15\x00\x00\x00\x00", "xxxxxx????");
|
||||
void (*CHLClient_FrameStageNotify)(void* rcx, int curStage) = (void(*)(void*, int))p_CHLClient_FrameStageNotify.GetPtr(); /*48 83 EC 38 89 15 ?? ?? ?? ??*/
|
||||
|
||||
ADDRESS p_CHLClient_PostInit = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\x3D\x00\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00\x48\x89\x05\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00", "xxx?????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????xxx????");
|
||||
void* (*CHLClient_PostInit)() = (void* (*)())p_CHLClient_PostInit.GetPtr(); /*48 83 3D ? ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ? 48 89 05 ? ? ? ? 48 8D 05 ? ? ? ?*/
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
ADDRESS p_CHLClient_FrameStageNotify = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x28\x89\x15\x00\x00\x00\x00", "xxxxxx????");
|
||||
void (*CHLClient_FrameStageNotify)(void* rcx, int curStage) = (void(*)(void*, int))p_CHLClient_FrameStageNotify.GetPtr(); /*48 83 EC 28 89 15 ?? ?? ?? ??*/
|
||||
|
||||
ADDRESS p_CHLClient_PostInit = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x28\x48\x83\x3D\x00\x00\x00\x00\x00\x48\x8D\x05\x00\x00\x00\x00", "xxxxxxx?????xxx????");
|
||||
void* (*CHLClient_PostInit)() = (void* (*)())p_CHLClient_PostInit.GetPtr(); /*48 83 EC 28 48 83 3D ? ? ? ? ? 48 8D 05 ? ? ? ?*/
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void __fastcall HFrameStageNotify(CHLClient* rcx, ClientFrameStage_t curStage);
|
||||
void PatchNetVarConVar();
|
||||
|
||||
void CHLClient_Attach();
|
||||
void CHLClient_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HDll_Engine_Int : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: CHLClient::FrameStageNotify : 0x" << std::hex << std::uppercase << p_CHLClient_FrameStageNotify.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: CHLClient::PostInit : 0x" << std::hex << std::uppercase << p_CHLClient_PostInit.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HDll_Engine_Int);
|
5
r5dev/client/client.cpp
Normal file
5
r5dev/client/client.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "client/client.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
CClient* g_pClient = reinterpret_cast<CClient*>(p_IVEngineServer_PersistenceAvailable.FindPatternSelf("48 8D 0D", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr());
|
69
r5dev/client/client.h
Normal file
69
r5dev/client/client.h
Normal file
@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
#include "server/IVEngineServer.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class CClient;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern CClient* g_pClient;
|
||||
|
||||
namespace
|
||||
{
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
const std::uintptr_t g_dwCClientSize = 0x4A440;
|
||||
const std::uintptr_t g_dwPersistenceVar = 0x5B4;
|
||||
const std::uintptr_t g_dwCClientPadding = 303232;
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
const std::uintptr_t g_dwCClientSize = 0x4A4C0;
|
||||
const std::uintptr_t g_dwPersistenceVar = 0x5BC;
|
||||
const std::uintptr_t g_dwCClientPadding = 303360;
|
||||
#endif
|
||||
}
|
||||
|
||||
class CClient
|
||||
{
|
||||
public:
|
||||
inline CClient* GetClientInstance(int nIndex)
|
||||
{
|
||||
return (CClient*)(std::uintptr_t)(g_pClient + (nIndex * g_dwCClientSize));
|
||||
}
|
||||
|
||||
void*& GetNetChan()
|
||||
{
|
||||
return m_nNetChannel;
|
||||
}
|
||||
private:
|
||||
char pad_0000[16]; //0x0000
|
||||
public:
|
||||
int m_iUserID; //0x0010
|
||||
private:
|
||||
char pad_0014[908]; //0x0014
|
||||
public:
|
||||
void* m_nNetChannel; //0x03A0
|
||||
private:
|
||||
char pad_03A8[8]; //0x03A8
|
||||
public:
|
||||
int m_iSignonstate; //0x03B0
|
||||
private:
|
||||
char pad_03B4[4]; //0x03B4
|
||||
public:
|
||||
std::int64_t m_iOriginID; //0x03B8
|
||||
private:
|
||||
char pad_03C0[g_dwCClientPadding]; //0x03C0
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HClient : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| VAR: g_pClient : 0x" << std::hex << std::uppercase << g_pClient << std::setw(0) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HClient);
|
@ -1,14 +1,12 @@
|
||||
#include "pch.h"
|
||||
#include "hooks.h"
|
||||
#include "enums.h"
|
||||
#include "opcodes.h"
|
||||
#include "gameclasses.h"
|
||||
#include "core/stdafx.h"
|
||||
#include "common/opcodes.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* _opcodes.cpp
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
void Hooks::DedicatedPatch()
|
||||
#ifdef DEDICATED
|
||||
void Dedicated_Init()
|
||||
{
|
||||
*(uintptr_t*)0x14D415040 = 0x1417304E8;
|
||||
*(uintptr_t*)0x14B37C3C0 = 0x141F10CA0;
|
||||
@ -110,6 +108,11 @@ void Hooks::DedicatedPatch()
|
||||
//s1.Offset(0x1C6).Patch({ 0xE9, 0xAD, 0x11, 0x00, 0x00 }); // JNE --> JMP | Return early in _Host_RunFrame() for debugging perposes.
|
||||
//s1.Offset(0x1010).Patch({ 0xEB, 0x14 }); // JNE --> JMP | Return early in _Host_RunFrame() for debugging perposes.
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// RUNTIME: HOST_NEWGAME
|
||||
//-------------------------------------------------------------------------
|
||||
Host_NewGame.Offset(0x637).Patch({ 0xE9, 0xC1, 0x00, 0x00, 0x00 }); // JNE --> JMP | Prevent connect localhost from being executed in Host_NewGame.
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// RUNTIME: EBISUSDK
|
||||
//-------------------------------------------------------------------------
|
||||
@ -163,35 +166,92 @@ void Hooks::DedicatedPatch()
|
||||
gShaderDispatch.Offset(0x62).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 }); // CAL --> NOP | Prevent memory allocation and population for shader assets.
|
||||
|
||||
// UNKNOWN ----------------------------------------------------------------
|
||||
MemoryAddress t8 = 0x00000001403C0480;
|
||||
ADDRESS t8 = 0x00000001403C0480;
|
||||
t8.Patch({ 0xC3 }); // Return from unknown call during ChangeLevel. [LATE]
|
||||
MemoryAddress t9 = 0x00000001403EE420;
|
||||
ADDRESS t9 = 0x00000001403EE420;
|
||||
t9.Patch({ 0xC3 }); // Return from unknown call during ChangeLevel. [EARLY]
|
||||
//-------------------------------------------------------------------------
|
||||
// RUNTIME BLOCK
|
||||
//-------------------------------------------------------------------------
|
||||
MemoryAddress t0 = 0x00000001401D71E0;
|
||||
ADDRESS t0 = 0x00000001401D71E0;
|
||||
t0.Patch({ 0xC3 });
|
||||
MemoryAddress t1 = 0x0000000140456B50;
|
||||
ADDRESS t1 = 0x0000000140456B50;
|
||||
t1.Offset(0x292).Patch({ 0xE9, 0xEE, 0x00, 0x00, 0x00 });
|
||||
MemoryAddress t2 = 0x0000000140238DA0;
|
||||
ADDRESS t2 = 0x0000000140238DA0;
|
||||
t2.Offset(0x4E0).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
MemoryAddress t3 = 0x0000000140312D80;
|
||||
ADDRESS t3 = 0x0000000140312D80;
|
||||
//t3.Offset(0xB3).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
MemoryAddress t4 = 0x0000000140312D80; // Patch Additional shader preloading.
|
||||
ADDRESS t4 = 0x0000000140312D80; // Patch Additional shader preloading.
|
||||
//t4.Offset(0xB3).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
MemoryAddress t5 = 0x00000001403BBFD0;
|
||||
ADDRESS t5 = 0x00000001403BBFD0;
|
||||
t5.Offset(0x7D8).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
//-------------------------------------------------------------------------
|
||||
// END RUNTIME BLOCK
|
||||
//-------------------------------------------------------------------------
|
||||
}
|
||||
#endif // DEDICATED
|
||||
|
||||
// TEST
|
||||
void SetCHostState()
|
||||
void RuntimePtc_Init() /* .TEXT */
|
||||
{
|
||||
static std::string ServerMap = std::string();
|
||||
ServerMap = "mp_rr_canyonlands_64k_x_64k";
|
||||
strncpy_s(GameGlobals::HostState->m_levelName, ServerMap.c_str(), 64); // Copy new map into hoststate levelname. 64 is size of m_levelname.
|
||||
GameGlobals::HostState->m_iNextState = HostStates_t::HS_NEW_GAME; // Force CHostState::FrameUpdate to start a server.
|
||||
#ifdef DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// JNZ --> JMP | Prevent OriginSDK from initializing on the server
|
||||
Origin_Init.Offset(0x0B).Patch({ 0xE9, 0x63, 0x02, 0x00, 0x00, 0x00 });
|
||||
Origin_SetState.Offset(0x0E).Patch({ 0xE9, 0xCB, 0x03, 0x00, 0x00, 0x00 });
|
||||
#endif // DEDICATED
|
||||
//-------------------------------------------------------------------------
|
||||
// JNE --> JMP | Allow games to be loaded without the optional texture streaming file
|
||||
//WriteProcessMemory(GameProcess, LPVOID(dst002 + 0x8E5), "\xEB\x19", 2, NULL);
|
||||
//-------------------------------------------------------------------------
|
||||
// JNE --> JMP | Prevent connect command from crashing by invalid call to UI function
|
||||
dst003.Offset(0x1D6).Patch({ 0xEB, 0x27 });
|
||||
//-------------------------------------------------------------------------
|
||||
// JA --> JMP | Prevent FairFight anti-cheat from initializing on the
|
||||
FairFight_Init.Offset(0x61).Patch({ 0xE9, 0xED, 0x00, 0x00, 0x00, 0x00 });
|
||||
}
|
||||
|
||||
void RuntimePtc_Toggle() /* .TEXT */
|
||||
{
|
||||
static bool g_nop = true;
|
||||
|
||||
if (g_nop)
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
// CALL --> NOP | Allow some maps to be loaded by nopping out a call in LoadProp function
|
||||
//WriteProcessMemory(GameProcess, LPVOID(dst007 + 0x5E8), "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90", 11, NULL);
|
||||
|
||||
dst007.Offset(0x5E8).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// CALL --> NOP | Disable the viewmodel rendered to avoid a crash from a certain entity in desertlands_mu1
|
||||
//WriteProcessMemory(GameProcess, LPVOID(dst008 + 0x67), "\x90\x90\x90\x90\x90", 5, NULL);
|
||||
dst008.Offset(0x67).Patch({ 0x90, 0x90, 0x90, 0x90, 0x90 });
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>>>| TEXT OPCODES OVERWRITTEN |<<<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
//-------------------------------------------------------------------------
|
||||
// NOP --> CALL | Recover function DST007
|
||||
//WriteProcessMemory(GameProcess, LPVOID(dst007 + 0x5E8), "\x48\x8B\x03\xFF\x90\xB0\x02\x00\x00\x84\xC0", 11, NULL);
|
||||
|
||||
dst007.Offset(0x5E8).Patch({ 0x48, 0x8B, 0x03, 0xFF, 0x90, 0xB0, 0x02, 0x00, 0x00, 0x84, 0xC0 });
|
||||
//-------------------------------------------------------------------------
|
||||
// NOP --> CALL | Recover function DST008
|
||||
//WriteProcessMemory(GameProcess, LPVOID(dst008 + 0x67), "\xE8\x54\xD8\xFF\xFF", 5, NULL);
|
||||
dst008.Offset(0x67).Patch({ 0xE8, 0x54, 0xD8, 0xFF, 0xFF });
|
||||
|
||||
printf("\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("|>>>>>>>>>>>>>>>| TEXT OPCODES RECOVERED |<<<<<<<<<<<<<<<|\n");
|
||||
printf("+--------------------------------------------------------+\n");
|
||||
printf("\n");
|
||||
}
|
||||
g_nop = !g_nop;
|
||||
}
|
119
r5dev/common/opcodes.h
Normal file
119
r5dev/common/opcodes.h
Normal file
@ -0,0 +1,119 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "public/include/utility.h"
|
||||
|
||||
void Dedicated_Init();
|
||||
void RuntimePtc_Init();
|
||||
void RuntimePtc_Toggle();
|
||||
|
||||
namespace
|
||||
{
|
||||
///* -------------- ORIGIN ------------------------------------------------------------------------------------------------------------------------------------------------ */
|
||||
ADDRESS Origin_Init = /*0x14032EEA0*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x83\xEC\x28\x80\x3D\x00\x00\x00\x23\x00\x0F\x85\x00\x02\x00", "xxxxxx???xxxx?xx");
|
||||
ADDRESS Origin_SetState = /*0x140330290*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x81\xEC\x58\x04\x00\x00\x80\x3D\x00\x00\x00\x00\x00\x0F\x84", "xxxxxxxxx????xxx");
|
||||
|
||||
///* -------------- ENGINE ------------------------------------------------------------------------------------------------------------------------------------------------ */
|
||||
//ADDRESS dst002 = /*0x14043FB90*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x89\x4C\x24\x08\x56\x41\x55\x48\x81\xEC\x68\x03\x00\x00\x4C", "xxxx?xxxxxxxxxxx");
|
||||
ADDRESS dst003 = /*0x14022A4A0*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x83\xEC\x38\x0F\x29\x74\x24\x20\x48\x89\x5C\x24\x40\x48\x8B", "xxxxxxxxxxxxxxxx");
|
||||
ADDRESS Host_NewGame = /*0x140238DA0*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x00\x41\x54\x41\x00\x48\x81\xEC\x00\x00\x00\x00\xF2", "xxx?xxx?xxx??xxx");
|
||||
|
||||
///* -------------- NETCHAN ----------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
//ADDRESS CServer_Auth = /*0x14030D000*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x40\x55\x57\x41\x55\x41\x57\x48\x8D\xAC\x24\x28\xFF\xFF\xFF\x48", "xxxxxxxxxxxxxxxx");
|
||||
|
||||
///* -------------- FAIRFIGHT --------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
ADDRESS FairFight_Init = /*0x140303AE0*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x40\x53\x48\x83\xEC\x20\x8B\x81\xB0\x03\x00\x00\x48\x8B\xD9\xC6", "xxxxxxxxxxxxxxxx");
|
||||
|
||||
///* -------------- OTHER ------------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
ADDRESS dst007 = /*0x14028F3B0*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x44\x89\x40\x18\x48\x89\x50\x10\x55\x53\x56\x57\x41", "xxxxxxxxxxxxxxxx");
|
||||
ADDRESS dst008 = /*0x140E3E110*/ FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x83\xEC\x78\x48\x8B\x84\x24\x00\x00\x00\x00\x4D\x8B\xD8\x00", "xxxxxxxx????xxx?");
|
||||
|
||||
//ADDRESS dst009 = FindPatternSIMD("r5apex.exe", (const unsigned char*)"\x48\x8B\xC4\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8B\xEC\x48\x83\xEC\x60", "xxxxxxxxxxxxxxxxxxx");
|
||||
|
||||
///* -------------- ------- ----------------------------------------------------------------------------------------------------------------------------------------------- */
|
||||
|
||||
namespace
|
||||
{
|
||||
// TODO: create patterns instead and rename to function names.
|
||||
// Renderer
|
||||
ADDRESS r0 = 0x00000001402FE280; //
|
||||
ADDRESS gCShaderGlue__Init = 0x00000001403B3A50; //
|
||||
ADDRESS gMatSync = 0x00000001403DEE90; //
|
||||
ADDRESS gCMaterialSystem__MatsysMode_Init = 0x00000001403BD120; //
|
||||
ADDRESS r4 = 0x0000000140404380; //
|
||||
ADDRESS r5 = 0x000000014040D850; //
|
||||
ADDRESS r6 = 0x0000000140413260; //
|
||||
ADDRESS r7 = 0x00000001404093F0; //
|
||||
ADDRESS r8 = 0x00000001403D2E60; //
|
||||
ADDRESS d3d11init = 0x000000014043CDF0; //
|
||||
|
||||
// Engine
|
||||
ADDRESS gHost_Init_0 = 0x0000000140236E40; // main Host_Init()?
|
||||
ADDRESS e1 = 0x0000000140FB2F10; // also used by CServerGameDLL
|
||||
ADDRESS addr_CEngine_Frame = 0x00000001402970E0;
|
||||
ADDRESS e3 = 0x0000000140231C00;
|
||||
ADDRESS e4 = 0x0000000140BE1970;
|
||||
ADDRESS e5 = 0x0000000140DBBAF0;
|
||||
ADDRESS e6 = 0x0000000140DBE610;
|
||||
ADDRESS e7 = 0x000000014044AFA0;
|
||||
ADDRESS e8 = 0x000000014027EC50; // RenderFrame?
|
||||
ADDRESS gCEngineAPI__Init = 0x0000000140342FB0; //
|
||||
ADDRESS gCEngineAPI__ModInit = 0x0000000140343DE0; //
|
||||
ADDRESS gCEngineAPI__Connect = 0x0000000140342BA0; //
|
||||
ADDRESS gCEngineAPI__OnStartup = 0x0000000140343860; //
|
||||
ADDRESS gCSourceAppSystemGroup__Create = 0x000000014044AFA0; //
|
||||
ADDRESS gCShaderSystem__Init = 0x00000001403DF870; //
|
||||
ADDRESS gInitMaterialSystem = 0x000000014024B390; //
|
||||
ADDRESS gCVideoMode_Common__DrawStartupGraphic = 0x000000014027F0F0; //
|
||||
ADDRESS gShaderDispatch = 0x00000001403EE5C0;
|
||||
ADDRESS gShaderCreate = 0x00000001403ECD00; //
|
||||
ADDRESS gTextureCreate = 0x00000001403EDCD0;
|
||||
|
||||
ADDRESS gCShaderSystem__9 = 0x00000001403DFC30;
|
||||
ADDRESS gBSP_LUMP_INIT = 0x00000001402546F0; // BSP.
|
||||
|
||||
|
||||
ADDRESS e9 = 0x00000001404066E0;
|
||||
ADDRESS e10 = 0x00000001403B49E0; // CMaterialGlue?
|
||||
|
||||
// SERVER
|
||||
ADDRESS gHost_Init_1 = 0x0000000140237B00; // server Host_Init()?
|
||||
ADDRESS s1 = 0x0000000140231C00; // _Host_RunFrame() with inlined CFrameTimer::MarkFrame()?
|
||||
ADDRESS s2 = 0x00000001402312A0; // server HeartBeat? (baseserver.cpp)
|
||||
ADDRESS s3 = 0x0000000140FB36D0; // TEMP??
|
||||
|
||||
// CLIENT
|
||||
ADDRESS gHost_Init_2 = 0x0000000140236640; // client Host_Init()?
|
||||
ADDRESS gCGame__CreateGameWindow = 0x0000000140299100; //
|
||||
ADDRESS c2 = 0x00000001403F4360; // 1403DF870 --> 1403F4360
|
||||
ADDRESS c3 = 0x00000001403F8A80; // 1403DF870 --> 1403F8A40
|
||||
ADDRESS gCHLClient__1000 = 0x00000001405C27B0; // CHLClient + 1000
|
||||
ADDRESS gCHLClient__HudMessage = 0x00000001405BAC00; // CHudMessage
|
||||
ADDRESS c6 = 0x00000001403CA2D0; //
|
||||
|
||||
// VGUI
|
||||
ADDRESS gCEngineVGui__Init = 0x0000000140282E40; // jumptable
|
||||
ADDRESS gCEngineVGui__OnLevelLoadingStarted = 0x00000001402830D0;
|
||||
ADDRESS SCR_BeginLoadingPlaque = 0x000000014023E870;
|
||||
}
|
||||
|
||||
|
||||
void PrintOAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
std::cout << "| Origin_Init : " << std::hex << std::uppercase << Origin_Init.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "| Origin_SetState : " << std::hex << std::uppercase << Origin_SetState.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
//std::cout << "| dst002 : " << std::hex << std::uppercase << dst002.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "| dst003 : " << std::hex << std::uppercase << dst003.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
//std::cout << "| Host_NewGame : " << std::hex << std::uppercase << Host_NewGame.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
//std::cout << "| CServer_Auth : " << std::hex << std::uppercase << CServer_Auth.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
std::cout << "| FairFight_Init : " << std::hex << std::uppercase << FairFight_Init.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
std::cout << "| dst007 : " << std::hex << std::uppercase << dst007.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "| dst008 : " << std::hex << std::uppercase << dst008.GetPtr() << std::setw(20) << " |" << std::endl;
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
}
|
19
r5dev/common/protocol.h
Normal file
19
r5dev/common/protocol.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* _protocol.h
|
||||
*-----------------------------------------------------------------------------*/
|
||||
|
||||
enum class SIGNONSTATE : int
|
||||
{
|
||||
SIGNONSTATE_NONE = 0, // no state yet; about to connect.
|
||||
SIGNONSTATE_CHALLENGE = 1, // client challenging server; all OOB packets.
|
||||
SIGNONSTATE_CONNECTED = 2, // client is connected to server; netchans ready.
|
||||
SIGNONSTATE_NEW = 3, // just got serverinfo and string tables.
|
||||
SIGNONSTATE_PRESPAWN = 4, // received signon buffers.
|
||||
SIGNONSTATE_GETTING_DATA = 5, // getting persistence data.
|
||||
SIGNONSTATE_SPAWN = 6, // ready to receive entity packets.
|
||||
SIGNONSTATE_FIRST_SNAP = 7, // received baseline snapshot.
|
||||
SIGNONSTATE_FULL = 8, // we are fully connected; first non-delta packet received.
|
||||
SIGNONSTATE_CHANGELEVEL = 9, // server is changing level; please wait.
|
||||
};
|
462
r5dev/common/psuedodefs.h
Normal file
462
r5dev/common/psuedodefs.h
Normal file
@ -0,0 +1,462 @@
|
||||
/*
|
||||
|
||||
This file contains definitions used in the Hex-Rays decompiler output.
|
||||
It has type definitions and convenience macros to make the
|
||||
output more readable.
|
||||
|
||||
Copyright (c) 2007-2020 Hex-Rays
|
||||
|
||||
*/
|
||||
|
||||
#ifndef HEXRAYS_DEFS_H
|
||||
#define HEXRAYS_DEFS_H
|
||||
|
||||
#if defined(__GNUC__)
|
||||
typedef long long ll;
|
||||
typedef unsigned long long ull;
|
||||
#define __int64 long long
|
||||
#define __int32 int
|
||||
#define __int16 short
|
||||
#define __int8 char
|
||||
#define MAKELL(num) num ## LL
|
||||
#define FMT_64 "ll"
|
||||
#elif defined(_MSC_VER)
|
||||
typedef __int64 ll;
|
||||
typedef unsigned __int64 ull;
|
||||
#define MAKELL(num) num ## i64
|
||||
#define FMT_64 "I64"
|
||||
#elif defined (__BORLANDC__)
|
||||
typedef __int64 ll;
|
||||
typedef unsigned __int64 ull;
|
||||
#define MAKELL(num) num ## i64
|
||||
#define FMT_64 "L"
|
||||
#else
|
||||
#error "unknown compiler"
|
||||
#endif
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned long ulong;
|
||||
|
||||
typedef char int8;
|
||||
typedef signed char sint8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef signed short sint16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef signed int sint32;
|
||||
typedef unsigned int uint32;
|
||||
typedef ll int64;
|
||||
typedef ll sint64;
|
||||
typedef ull uint64;
|
||||
|
||||
// Partially defined types. They are used when the decompiler does not know
|
||||
// anything about the type except its size.
|
||||
#define _BYTE uint8
|
||||
#define _WORD uint16
|
||||
#define _DWORD uint32
|
||||
#define _QWORD uint64
|
||||
#if !defined(_MSC_VER)
|
||||
#define _LONGLONG __int128
|
||||
#endif
|
||||
|
||||
// Non-standard boolean types. They are used when the decompiler cannot use
|
||||
// the standard "bool" type because of the size mistmatch but the possible
|
||||
// values are only 0 and 1. See also 'BOOL' type below.
|
||||
typedef int8 _BOOL1;
|
||||
typedef int16 _BOOL2;
|
||||
typedef int32 _BOOL4;
|
||||
typedef int64 _BOOL8;
|
||||
|
||||
#ifndef _WINDOWS_
|
||||
typedef int8 BYTE;
|
||||
typedef int16 WORD;
|
||||
typedef int32 DWORD;
|
||||
typedef int32 LONG;
|
||||
typedef int BOOL; // uppercase BOOL is usually 4 bytes
|
||||
#endif
|
||||
typedef int64 QWORD;
|
||||
#ifndef __cplusplus
|
||||
typedef int bool; // we want to use bool in our C programs
|
||||
#endif
|
||||
|
||||
#define __pure // pure function:
|
||||
// when given the same arguments, always returns the same value
|
||||
// has no side effects
|
||||
|
||||
// Non-returning function
|
||||
#if defined(__GNUC__)
|
||||
#define __noreturn __attribute__((noreturn))
|
||||
#else
|
||||
#define __noreturn __declspec(noreturn)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
// Some convenience macros to make partial accesses nicer
|
||||
#define LAST_IND(x,part_type) (sizeof(x)/sizeof(part_type) - 1)
|
||||
#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define LOW_IND(x,part_type) LAST_IND(x,part_type)
|
||||
# define HIGH_IND(x,part_type) 0
|
||||
#else
|
||||
# define HIGH_IND(x,part_type) LAST_IND(x,part_type)
|
||||
# define LOW_IND(x,part_type) 0
|
||||
#endif
|
||||
// first unsigned macros:
|
||||
#define BYTEn(x, n) (*((_BYTE*)&(x)+n))
|
||||
#define WORDn(x, n) (*((_WORD*)&(x)+n))
|
||||
#define DWORDn(x, n) (*((_DWORD*)&(x)+n))
|
||||
|
||||
#define LOBYTE(x) BYTEn(x,LOW_IND(x,_BYTE))
|
||||
#define LOWORD(x) WORDn(x,LOW_IND(x,_WORD))
|
||||
#define LODWORD(x) DWORDn(x,LOW_IND(x,_DWORD))
|
||||
#define HIBYTE(x) BYTEn(x,HIGH_IND(x,_BYTE))
|
||||
#define HIWORD(x) WORDn(x,HIGH_IND(x,_WORD))
|
||||
#define HIDWORD(x) DWORDn(x,HIGH_IND(x,_DWORD))
|
||||
#define BYTE1(x) BYTEn(x, 1) // byte 1 (counting from 0)
|
||||
#define BYTE2(x) BYTEn(x, 2)
|
||||
#define BYTE3(x) BYTEn(x, 3)
|
||||
#define BYTE4(x) BYTEn(x, 4)
|
||||
#define BYTE5(x) BYTEn(x, 5)
|
||||
#define BYTE6(x) BYTEn(x, 6)
|
||||
#define BYTE7(x) BYTEn(x, 7)
|
||||
#define BYTE8(x) BYTEn(x, 8)
|
||||
#define BYTE9(x) BYTEn(x, 9)
|
||||
#define BYTE10(x) BYTEn(x, 10)
|
||||
#define BYTE11(x) BYTEn(x, 11)
|
||||
#define BYTE12(x) BYTEn(x, 12)
|
||||
#define BYTE13(x) BYTEn(x, 13)
|
||||
#define BYTE14(x) BYTEn(x, 14)
|
||||
#define BYTE15(x) BYTEn(x, 15)
|
||||
#define WORD1(x) WORDn(x, 1)
|
||||
#define WORD2(x) WORDn(x, 2) // third word of the object, unsigned
|
||||
#define WORD3(x) WORDn(x, 3)
|
||||
#define WORD4(x) WORDn(x, 4)
|
||||
#define WORD5(x) WORDn(x, 5)
|
||||
#define WORD6(x) WORDn(x, 6)
|
||||
#define WORD7(x) WORDn(x, 7)
|
||||
|
||||
// now signed macros (the same but with sign extension)
|
||||
#define SBYTEn(x, n) (*((int8*)&(x)+n))
|
||||
#define SWORDn(x, n) (*((int16*)&(x)+n))
|
||||
#define SDWORDn(x, n) (*((int32*)&(x)+n))
|
||||
|
||||
#define SLOBYTE(x) SBYTEn(x,LOW_IND(x,int8))
|
||||
#define SLOWORD(x) SWORDn(x,LOW_IND(x,int16))
|
||||
#define SLODWORD(x) SDWORDn(x,LOW_IND(x,int32))
|
||||
#define SHIBYTE(x) SBYTEn(x,HIGH_IND(x,int8))
|
||||
#define SHIWORD(x) SWORDn(x,HIGH_IND(x,int16))
|
||||
#define SHIDWORD(x) SDWORDn(x,HIGH_IND(x,int32))
|
||||
#define SBYTE1(x) SBYTEn(x, 1)
|
||||
#define SBYTE2(x) SBYTEn(x, 2)
|
||||
#define SBYTE3(x) SBYTEn(x, 3)
|
||||
#define SBYTE4(x) SBYTEn(x, 4)
|
||||
#define SBYTE5(x) SBYTEn(x, 5)
|
||||
#define SBYTE6(x) SBYTEn(x, 6)
|
||||
#define SBYTE7(x) SBYTEn(x, 7)
|
||||
#define SBYTE8(x) SBYTEn(x, 8)
|
||||
#define SBYTE9(x) SBYTEn(x, 9)
|
||||
#define SBYTE10(x) SBYTEn(x, 10)
|
||||
#define SBYTE11(x) SBYTEn(x, 11)
|
||||
#define SBYTE12(x) SBYTEn(x, 12)
|
||||
#define SBYTE13(x) SBYTEn(x, 13)
|
||||
#define SBYTE14(x) SBYTEn(x, 14)
|
||||
#define SBYTE15(x) SBYTEn(x, 15)
|
||||
#define SWORD1(x) SWORDn(x, 1)
|
||||
#define SWORD2(x) SWORDn(x, 2)
|
||||
#define SWORD3(x) SWORDn(x, 3)
|
||||
#define SWORD4(x) SWORDn(x, 4)
|
||||
#define SWORD5(x) SWORDn(x, 5)
|
||||
#define SWORD6(x) SWORDn(x, 6)
|
||||
#define SWORD7(x) SWORDn(x, 7)
|
||||
|
||||
// Generate a pair of operands. S stands for 'signed'
|
||||
#define __SPAIR16__(high, low) (((int16) (high) << 8) | (uint8) (low))
|
||||
#define __SPAIR32__(high, low) (((int32) (high) << 16) | (uint16)(low))
|
||||
#define __SPAIR64__(high, low) (((int64) (high) << 32) | (uint32)(low))
|
||||
#define __SPAIR128__(high, low) (((int128) (high) << 64) | (uint64)(low))
|
||||
#define __PAIR16__(high, low) (((uint16) (high) << 8) | (uint8) (low))
|
||||
#define __PAIR32__(high, low) (((uint32) (high) << 16) | (uint16)(low))
|
||||
#define __PAIR64__(high, low) (((uint64) (high) << 32) | (uint32)(low))
|
||||
#define __PAIR128__(high, low) (((uint128)(high) << 64) | (uint64)(low))
|
||||
|
||||
// Helper functions to represent some assembly instructions.
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// compile time assertion
|
||||
#define __CASSERT_N0__(l) COMPILE_TIME_ASSERT_ ## l
|
||||
#define __CASSERT_N1__(l) __CASSERT_N0__(l)
|
||||
#define CASSERT(cnd) typedef char __CASSERT_N1__(__LINE__) [(cnd) ? 1 : -1]
|
||||
|
||||
// check that unsigned multiplication does not overflow
|
||||
template<class T> bool is_mul_ok(T count, T elsize)
|
||||
{
|
||||
CASSERT(T(-1) > 0); // make sure T is unsigned
|
||||
if ( elsize == 0 || count == 0 )
|
||||
return true;
|
||||
return count <= T(-1) / elsize;
|
||||
}
|
||||
|
||||
// multiplication that saturates (yields the biggest value) instead of overflowing
|
||||
// such a construct is useful in "operator new[]"
|
||||
template<class T> bool saturated_mul(T count, T elsize)
|
||||
{
|
||||
return is_mul_ok(count, elsize) ? count * elsize : T(-1);
|
||||
}
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
// memcpy() with determined behavoir: it always copies
|
||||
// from the start to the end of the buffer
|
||||
// note: it copies byte by byte, so it is not equivalent to, for example, rep movsd
|
||||
inline void *qmemcpy(void *dst, const void *src, size_t cnt)
|
||||
{
|
||||
char *out = (char *)dst;
|
||||
const char *in = (const char *)src;
|
||||
while ( cnt > 0 )
|
||||
{
|
||||
*out++ = *in++;
|
||||
--cnt;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
// rotate left
|
||||
template<class T> T __ROL__(T value, int count)
|
||||
{
|
||||
const uint nbits = sizeof(T) * 8;
|
||||
|
||||
if ( count > 0 )
|
||||
{
|
||||
count %= nbits;
|
||||
T high = value >> (nbits - count);
|
||||
if ( T(-1) < 0 ) // signed value
|
||||
high &= ~((T(-1) << count));
|
||||
value <<= count;
|
||||
value |= high;
|
||||
}
|
||||
else
|
||||
{
|
||||
count = -count % nbits;
|
||||
T low = value << (nbits - count);
|
||||
value >>= count;
|
||||
value |= low;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
inline uint8 __ROL1__(uint8 value, int count) { return __ROL__((uint8)value, count); }
|
||||
inline uint16 __ROL2__(uint16 value, int count) { return __ROL__((uint16)value, count); }
|
||||
inline uint32 __ROL4__(uint32 value, int count) { return __ROL__((uint32)value, count); }
|
||||
inline uint64 __ROL8__(uint64 value, int count) { return __ROL__((uint64)value, count); }
|
||||
inline uint8 __ROR1__(uint8 value, int count) { return __ROL__((uint8)value, -count); }
|
||||
inline uint16 __ROR2__(uint16 value, int count) { return __ROL__((uint16)value, -count); }
|
||||
inline uint32 __ROR4__(uint32 value, int count) { return __ROL__((uint32)value, -count); }
|
||||
inline uint64 __ROR8__(uint64 value, int count) { return __ROL__((uint64)value, -count); }
|
||||
|
||||
// the carry flag of a left shift
|
||||
template<class T> int8 __MKCSHL__(T value, uint count)
|
||||
{
|
||||
const uint nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
|
||||
return (value >> (nbits-count)) & 1;
|
||||
}
|
||||
|
||||
// the carry flag of a right shift
|
||||
template<class T> int8 __MKCSHR__(T value, uint count)
|
||||
{
|
||||
return (value >> (count-1)) & 1;
|
||||
}
|
||||
|
||||
// sign flag
|
||||
template<class T> int8 __SETS__(T x)
|
||||
{
|
||||
if ( sizeof(T) == 1 )
|
||||
return int8(x) < 0;
|
||||
if ( sizeof(T) == 2 )
|
||||
return int16(x) < 0;
|
||||
if ( sizeof(T) == 4 )
|
||||
return int32(x) < 0;
|
||||
return int64(x) < 0;
|
||||
}
|
||||
|
||||
// overflow flag of subtraction (x-y)
|
||||
template<class T, class U> int8 __OFSUB__(T x, U y)
|
||||
{
|
||||
if ( sizeof(T) < sizeof(U) )
|
||||
{
|
||||
U x2 = x;
|
||||
int8 sx = __SETS__(x2);
|
||||
return (sx ^ __SETS__(y)) & (sx ^ __SETS__(U(x2-y)));
|
||||
}
|
||||
else
|
||||
{
|
||||
T y2 = y;
|
||||
int8 sx = __SETS__(x);
|
||||
return (sx ^ __SETS__(y2)) & (sx ^ __SETS__(T(x-y2)));
|
||||
}
|
||||
}
|
||||
|
||||
// overflow flag of addition (x+y)
|
||||
template<class T, class U> int8 __OFADD__(T x, U y)
|
||||
{
|
||||
if ( sizeof(T) < sizeof(U) )
|
||||
{
|
||||
U x2 = x;
|
||||
int8 sx = __SETS__(x2);
|
||||
return ((1 ^ sx) ^ __SETS__(y)) & (sx ^ __SETS__(U(x2+y)));
|
||||
}
|
||||
else
|
||||
{
|
||||
T y2 = y;
|
||||
int8 sx = __SETS__(x);
|
||||
return ((1 ^ sx) ^ __SETS__(y2)) & (sx ^ __SETS__(T(x+y2)));
|
||||
}
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Carry_flag#Carry_flag_vs._borrow_flag
|
||||
#if defined(__ARM__) || defined(__PPC__)
|
||||
#define SUB_WITH_CARRY 1
|
||||
#else
|
||||
#define SUB_WITH_CARRY 0
|
||||
#endif
|
||||
|
||||
// carry flag of subtraction (x-y)
|
||||
template<class T, class U> int8 __CFSUB__(T x, U y)
|
||||
{
|
||||
int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
|
||||
bool res;
|
||||
if ( size == 1 )
|
||||
res = uint8(x) < uint8(y);
|
||||
else if ( size == 2 )
|
||||
res = uint16(x) < uint16(y);
|
||||
else if ( size == 4 )
|
||||
res = uint32(x) < uint32(y);
|
||||
else
|
||||
res = uint64(x) < uint64(y);
|
||||
#if SUB_WITH_CARRY
|
||||
res = !res;
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
// carry flag of addition (x+y)
|
||||
template<class T, class U> int8 __CFADD__(T x, U y)
|
||||
{
|
||||
int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
|
||||
if ( size == 1 )
|
||||
return uint8(x) > uint8(x+y);
|
||||
if ( size == 2 )
|
||||
return uint16(x) > uint16(x+y);
|
||||
if ( size == 4 )
|
||||
return uint32(x) > uint32(x+y);
|
||||
return uint64(x) > uint64(x+y);
|
||||
}
|
||||
|
||||
// carry flag of subtraction with carry
|
||||
template<class T, class U> int8 __CFSUB__(T x, U y, int8 cf)
|
||||
{
|
||||
#if SUB_WITH_CARRY
|
||||
cf = !cf;
|
||||
#endif
|
||||
return __CFADD__(y, cf) ^ __CFSUB(x, y + cf);
|
||||
}
|
||||
|
||||
// overflow flag of subtraction with carry
|
||||
template<class T, class U> int8 __OFSUB__(T x, U y, int8 cf)
|
||||
{
|
||||
#if SUB_WITH_CARRY
|
||||
cf = !cf;
|
||||
#endif
|
||||
return __OFADD__(y, cf) ^ __OFSUB(x, y + cf);
|
||||
}
|
||||
|
||||
inline uint8 abs8(int8 x) { return x >= 0 ? x : -x; }
|
||||
inline uint16 abs16(int16 x) { return x >= 0 ? x : -x; }
|
||||
inline uint32 abs32(int32 x) { return x >= 0 ? x : -x; }
|
||||
inline uint64 abs64(int64 x) { return x >= 0 ? x : -x; }
|
||||
//inline uint128 abs128(int128 x) { return x >= 0 ? x : -x; }
|
||||
|
||||
#include <string.h> // for memcpy
|
||||
#include <type_traits> // for enable_if
|
||||
|
||||
template <typename T, typename F>
|
||||
inline typename std::enable_if<sizeof(T) <= sizeof(F), T>::type __coerce(F f)
|
||||
{
|
||||
T t;
|
||||
memcpy(&t, &f, sizeof(T));
|
||||
return t;
|
||||
}
|
||||
#define COERCE_FLOAT(v) __coerce<float>(v)
|
||||
#define COERCE_DOUBLE(v) __coerce<double>(v)
|
||||
#define COERCE_LONG_DOUBLE(v) __coerce<long double>(v)
|
||||
#define COERCE_UNSIGNED_INT(v) __coerce<unsigned int>(v)
|
||||
#define COERCE_UNSIGNED_INT64(v) __coerce<uint64>(v)
|
||||
|
||||
#else // C++
|
||||
// For C, we just provide macros, they are not quite correct.
|
||||
#define __ROL__(x, y) __rotl__(x, y) // Rotate left
|
||||
#define __ROR__(x, y) __rotr__(x, y) // Rotate right
|
||||
#define __CFSHL__(x, y) invalid_operation // Generate carry flag for (x<<y)
|
||||
#define __CFSHR__(x, y) invalid_operation // Generate carry flag for (x>>y)
|
||||
#define __CFADD__(x, y) invalid_operation // Generate carry flag for (x+y)
|
||||
#define __CFSUB__(x, y) invalid_operation // Generate carry flag for (x-y)
|
||||
#define __OFADD__(x, y) invalid_operation // Generate overflow flag for (x+y)
|
||||
#define __OFSUB__(x, y) invalid_operation // Generate overflow flag for (x-y)
|
||||
|
||||
#define abs8(x) (int8) ((int8) (x) >= 0 ? (x) : -(x))
|
||||
#define abs16(x) (int16) ((int16) (x) >= 0 ? (x) : -(x))
|
||||
#define abs32(x) (int32) ((int32) (x) >= 0 ? (x) : -(x))
|
||||
#define abs64(x) (int64) ((int64) (x) >= 0 ? (x) : -(x))
|
||||
#define abs128(x) (int128)((int128)(x) >= 0 ? (x) : -(x))
|
||||
|
||||
#endif // C++
|
||||
|
||||
#if defined(__MIPS__)
|
||||
// traps for MIPS arithmetic operation
|
||||
void __noreturn __integer_oveflow(void); // SIGFPE/FPE_INTOVF
|
||||
void __noreturn __divide_by_zero(void); // SIGFPE/FPE_INTDIV
|
||||
void __noreturn __trap(uint16 trapcode); // SIGTRAP
|
||||
void __noreturn __break(uint16 code, uint16 subcode);
|
||||
#endif
|
||||
|
||||
// No definition for rcl/rcr because the carry flag is unknown
|
||||
#define __RCL__(x, y) invalid_operation // Rotate left thru carry
|
||||
#define __RCR__(x, y) invalid_operation // Rotate right thru carry
|
||||
#define __MKCRCL__(x, y) invalid_operation // Generate carry flag for a RCL
|
||||
#define __MKCRCR__(x, y) invalid_operation // Generate carry flag for a RCR
|
||||
#define __SETP__(x, y) invalid_operation // Generate parity flag for (x-y)
|
||||
|
||||
// In the decompilation listing there are some objects declared as _UNKNOWN
|
||||
// because we could not determine their types. Since the C compiler does not
|
||||
// accept void item declarations, we replace them by anything of our choice,
|
||||
// for example a char:
|
||||
|
||||
#define _UNKNOWN char
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
// The ADJ() macro is used for shifted pointers.
|
||||
// While compilers do not understand it, it makes the code more readable.
|
||||
// A shifted pointer is declared like this, for example:
|
||||
// char *__shifted(mystruct,8) p;
|
||||
// It means: while 'p' points to 'char', it also points to the middle of 'mystruct'.
|
||||
// More precisely, it is at the offset of 8 bytes from the beginning of 'mystruct'.
|
||||
//
|
||||
// The ADJ() macro performs the necessary adjustment.
|
||||
// The __parentof() and __deltaof() functions are made up, they do not exist.
|
||||
// __parentof() returns the parent structure type.
|
||||
// __deltaof() returns the shift amount.
|
||||
|
||||
#define ADJ(p) (__parentof(p) *)(p-__deltaof(p))
|
||||
|
||||
#endif // HEXRAYS_DEFS_H
|
@ -1,34 +1,43 @@
|
||||
#include "pch.h"
|
||||
#include "r5dev.h"
|
||||
#include "id3dx.h"
|
||||
#include "input.h"
|
||||
#include "hooks.h"
|
||||
#include "opcptc.h"
|
||||
#include "console.h"
|
||||
#include "core/stdafx.h"
|
||||
#include "core/r5dev.h"
|
||||
#include "core/init.h"
|
||||
/*****************************************************************************/
|
||||
#ifndef DEDICATED
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/input.h"
|
||||
#endif // !DEDICATED
|
||||
#include "windows/console.h"
|
||||
|
||||
//#############################################################################
|
||||
// INITIALIZATION
|
||||
//#############################################################################
|
||||
|
||||
void InitializeR5Dev()
|
||||
void R5Dev_Init()
|
||||
{
|
||||
SetupConsole();
|
||||
Hooks::InstallHooks();
|
||||
InstallOpcodes();
|
||||
g_GuiConfig.Load(); // Load gui config.
|
||||
SetupDXSwapChain();
|
||||
Console_Init();
|
||||
Systems_Init();
|
||||
|
||||
#ifndef DEDICATED
|
||||
Input_Init();
|
||||
DirectX_Init();
|
||||
#endif // !DEDICATED
|
||||
|
||||
spdlog::get("console")->set_pattern("%v");
|
||||
spdlog::info("+-----------------------------------------------------------------------------+\n");
|
||||
spdlog::info("| R5 DEV -- INITIALIZED ------------------------------------------------- |\n");
|
||||
spdlog::info("| R5 DEVELOPER CONSOLE -- INITIALIZED ----------------------------------- |\n");
|
||||
spdlog::info("+-----------------------------------------------------------------------------+\n");
|
||||
spdlog::get("console")->set_pattern("[%I:%M:%S:%e] [%L] %v");
|
||||
spdlog::get("console")->set_pattern("[%S.%e] %v");
|
||||
}
|
||||
|
||||
void TerminateR5Dev()
|
||||
void R5Dev_Shutdown()
|
||||
{
|
||||
RemoveDXHooks();
|
||||
Hooks::RemoveHooks();
|
||||
Systems_Shutdown();
|
||||
|
||||
#ifndef DEDICATED
|
||||
Input_Shutdown();
|
||||
DirectX_Shutdown();
|
||||
#endif // !DEDICATED
|
||||
|
||||
FreeConsole();
|
||||
}
|
||||
|
||||
@ -38,18 +47,17 @@ void TerminateR5Dev()
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
InitializeR5Dev();
|
||||
R5Dev_Init();
|
||||
break;
|
||||
}
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
TerminateR5Dev();
|
||||
R5Dev_Shutdown();
|
||||
break;
|
||||
}
|
||||
}
|
182
r5dev/core/init.cpp
Normal file
182
r5dev/core/init.cpp
Normal file
@ -0,0 +1,182 @@
|
||||
//=============================================================================//
|
||||
//
|
||||
// Purpose: Main systems initialization file
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "core/init.h"
|
||||
#include "common/opcodes.h"
|
||||
#include "tier0/ConCommand.h"
|
||||
#include "tier0/completion.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "tier0/IConVar.h"
|
||||
#include "vpc/IAppSystem.h"
|
||||
#include "vpc/keyvalues.h"
|
||||
#include "vpc/basefilesystem.h"
|
||||
#include "vpc/keyvalues.h"
|
||||
#include "launcher/IApplication.h"
|
||||
#include "ebisusdk/EbisuSDK.h"
|
||||
#include "vphysics/QHull.h"
|
||||
#include "bsplib/bsplib.h"
|
||||
#ifndef DEDICATED
|
||||
#include "vgui/CEngineVGui.h"
|
||||
#include "vgui/vgui_fpspanel.h"
|
||||
#include "vguimatsurface/MatSystemSurface.h"
|
||||
#include "client/cdll_engine_int.h"
|
||||
#endif // !DEDICATED
|
||||
#include "client/client.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
#include "server/server.h"
|
||||
#include "server/IVEngineServer.h"
|
||||
#include "squirrel/sqinit.h"
|
||||
#include "squirrel/sqapi.h"
|
||||
#include "squirrel/sqvm.h"
|
||||
#include "rtech/stryder.h"
|
||||
#include "engine/baseclient.h"
|
||||
#include "engine/host_state.h"
|
||||
#include "engine/net_chan.h"
|
||||
#include "engine/sys_dll.h"
|
||||
#include "engine/sys_dll2.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#ifndef DEDICATED
|
||||
#include "inputsystem/inputsystem.h"
|
||||
#include "windows/id3dx.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ██╗███╗ ██╗██╗████████╗██╗ █████╗ ██╗ ██╗███████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
|
||||
// ██║████╗ ██║██║╚══██╔══╝██║██╔══██╗██║ ██║╚══███╔╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
|
||||
// ██║██╔██╗ ██║██║ ██║ ██║███████║██║ ██║ ███╔╝ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
|
||||
// ██║██║╚██╗██║██║ ██║ ██║██╔══██║██║ ██║ ███╔╝ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
|
||||
// ██║██║ ╚████║██║ ██║ ██║██║ ██║███████╗██║███████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
|
||||
// ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Systems_Init()
|
||||
{
|
||||
// Begin the detour transaction to hook the the process
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Hook functions
|
||||
IApplication_Attach();
|
||||
CBaseClient_Attach();
|
||||
CBaseFileSystem_Attach();
|
||||
|
||||
//QHull_Attach();
|
||||
//BspLib_Attach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
CEngineVGui_Attach();
|
||||
CFPSPanel_Attach();
|
||||
CHLClient_Attach();
|
||||
#endif // !DEDICATED
|
||||
|
||||
CServer_Attach();
|
||||
|
||||
#ifdef DEDICATED
|
||||
CHostState_Attach(); // Dedicated only for now until backwards compatible with S1.
|
||||
#endif // DEDICATED
|
||||
|
||||
CNetChan_Attach();
|
||||
ConCommand_Attach();
|
||||
IConVar_Attach();
|
||||
CKeyValueSystem_Attach();
|
||||
IVEngineServer_Attach();
|
||||
SQAPI_Attach();
|
||||
SQVM_Attach();
|
||||
SysDll_Attach();
|
||||
SysUtils_Attach();
|
||||
|
||||
// Patch instructions
|
||||
RuntimePtc_Init();
|
||||
|
||||
// Commit the transaction
|
||||
if (DetourTransactionCommit() != NO_ERROR)
|
||||
{
|
||||
// Failed to hook into the process, terminate
|
||||
TerminateProcess(GetCurrentProcess(), 0xBAD0C0DE);
|
||||
}
|
||||
|
||||
IConVar_InitConVar();
|
||||
|
||||
#ifdef DEDICATED
|
||||
Dedicated_Init();
|
||||
#endif // DEDICATED
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ███████╗██╗ ██╗██╗ ██╗████████╗██████╗ ██████╗ ██╗ ██╗███╗ ██╗
|
||||
// ██╔════╝██║ ██║██║ ██║╚══██╔══╝██╔══██╗██╔═══██╗██║ ██║████╗ ██║
|
||||
// ███████╗███████║██║ ██║ ██║ ██║ ██║██║ ██║██║ █╗ ██║██╔██╗ ██║
|
||||
// ╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║███╗██║██║╚██╗██║
|
||||
// ███████║██║ ██║╚██████╔╝ ██║ ██████╔╝╚██████╔╝╚███╔███╔╝██║ ╚████║
|
||||
// ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═══╝
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Systems_Shutdown()
|
||||
{
|
||||
// Begin the detour transaction to unhook the the process
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Unhook functions
|
||||
IApplication_Detach();
|
||||
CBaseClient_Detach();
|
||||
CBaseFileSystem_Detach();
|
||||
|
||||
//QHull_Detach();
|
||||
//BspLib_Detach();
|
||||
|
||||
#ifndef DEDICATED
|
||||
CEngineVGui_Detach();
|
||||
CFPSPanel_Detach();
|
||||
CHLClient_Detach();
|
||||
#endif // !DEDICATED
|
||||
CServer_Detach();
|
||||
|
||||
#ifdef DEDICATED
|
||||
CHostState_Detach(); // Dedicated only for now until backwards compatible with S1.
|
||||
#endif // DEDICATED
|
||||
|
||||
CNetChan_Detach();
|
||||
ConCommand_Detach();
|
||||
IConVar_Detach();
|
||||
CKeyValueSystem_Detach();
|
||||
IVEngineServer_Detach();
|
||||
SQAPI_Detach();
|
||||
SQVM_Detach();
|
||||
SysDll_Detach();
|
||||
SysUtils_Detach();
|
||||
|
||||
// Commit the transaction
|
||||
DetourTransactionCommit();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// ██████╗ ███████╗███████╗██╗ ██╗██╗ ████████╗███████╗
|
||||
// ██╔══██╗██╔════╝██╔════╝██║ ██║██║ ╚══██╔══╝██╔════╝
|
||||
// ██████╔╝█████╗ ███████╗██║ ██║██║ ██║ ███████╗
|
||||
// ██╔══██╗██╔══╝ ╚════██║██║ ██║██║ ██║ ╚════██║
|
||||
// ██║ ██║███████╗███████║╚██████╔╝███████╗██║ ███████║
|
||||
// ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝ ╚══════╝
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
void PrintHAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
for (IDetour* pdetour : vdetour)
|
||||
{
|
||||
pdetour->debugp();
|
||||
}
|
||||
}
|
10
r5dev/core/init.h
Normal file
10
r5dev/core/init.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
namespace
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* ==== ------- ========================================================================================================================================================= */
|
||||
}
|
||||
|
||||
void Systems_Init();
|
||||
void Systems_Shutdown();
|
||||
void PrintHAddress();
|
23
r5dev/core/logdef.h
Normal file
23
r5dev/core/logdef.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// NETCHAN |
|
||||
inline auto g_spd_netchan_logger = spdlog::basic_logger_mt("netchan_logger", "platform\\logs\\net_trace.log");
|
||||
static std::ostringstream g_spd_net_p_oss;
|
||||
static auto g_spd_net_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_net_p_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// FILESYSTEM |
|
||||
static std::ostringstream fs_oss;
|
||||
static auto fs_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(fs_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// SQUIRREL PRINTF |
|
||||
inline std::ostringstream g_spd_sqvm_p_oss;
|
||||
inline auto g_spd_sqvm_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_sqvm_p_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// SQUIRREL WARNF |
|
||||
inline std::ostringstream g_spd_sqvm_w_oss;
|
||||
inline auto g_spd_sqvm_w_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_sqvm_w_oss);
|
||||
//-------------------------------------------------------------------------
|
||||
// SYSTEM PRINTF |
|
||||
inline std::ostringstream g_spd_sys_w_oss;
|
||||
inline auto g_spd_sys_p_ostream_sink = std::make_shared<spdlog::sinks::ostream_sink_st>(g_spd_sys_w_oss);
|
@ -1,12 +1,15 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by BuildVersion.rc
|
||||
// Used by r5dev.rc
|
||||
//
|
||||
#define PNG 256
|
||||
#define IDB_PNG1 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
1
r5dev/core/stdafx.cpp
Normal file
1
r5dev/core/stdafx.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "core/stdafx.h"
|
56
r5dev/core/stdafx.h
Normal file
56
r5dev/core/stdafx.h
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
#pragma message("Pre-compiling headers.\n")
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Prevent winsock2 redefinition.
|
||||
#include <windows.h>
|
||||
#include <WinSock2.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Psapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <objbase.h>
|
||||
#include <emmintrin.h>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <filesystem>
|
||||
|
||||
#if !defined(DEDICATED)
|
||||
#include <d3d11.h>
|
||||
#endif // !DEDICATED
|
||||
|
||||
#include "thirdparty/detours/include/detours.h"
|
||||
#include "thirdparty/detours/include/idetour.h"
|
||||
|
||||
#if !defined(DEDICATED)
|
||||
#include "thirdparty/imgui/include/imgui.h"
|
||||
#include "thirdparty/imgui/include/imgui_utility.h"
|
||||
#include "thirdparty/imgui/include/imgui_stdlib.h"
|
||||
#include "thirdparty/imgui/include/imgui_impl_dx11.h"
|
||||
#include "thirdparty/imgui/include/imgui_impl_win32.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
#include "thirdparty/spdlog/include/spdlog.h"
|
||||
#include "thirdparty/spdlog/include/sinks/basic_file_sink.h"
|
||||
#include "thirdparty/spdlog/include/sinks/stdout_sinks.h"
|
||||
#include "thirdparty/spdlog/include/sinks/ostream_sink.h"
|
||||
#include "public/include/utility.h"
|
||||
#include "public/include/memaddr.h"
|
||||
#include "public/include/httplib.h"
|
||||
#include "public/include/json.hpp"
|
||||
|
||||
#ifndef SDKLAUNCHER
|
||||
namespace
|
||||
{
|
||||
MODULE g_mGameDll = MODULE("r5apex.exe");
|
||||
MODULE g_mRadVideoToolsDll = MODULE("bink2w64.dll");
|
||||
MODULE g_mRadAudioDecoderDll = MODULE("binkawin64.dll");
|
||||
MODULE g_mRadAudioSystemDll = MODULE("mileswin64.dll");
|
||||
}
|
||||
#endif // SDKLAUNCHER
|
9
r5dev/cpp.hint
Normal file
9
r5dev/cpp.hint
Normal file
@ -0,0 +1,9 @@
|
||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define CIMGUI_API
|
||||
#define NULL
|
||||
#define NULL ((void *)0)
|
||||
#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
|
||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
||||
#define IM_FMTARGS(FMT)
|
377
r5dev/dedicated.vcxproj
Normal file
377
r5dev/dedicated.vcxproj
Normal file
@ -0,0 +1,377 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<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>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{ed2c50b3-7c2c-4e44-988e-daa059f72b9c}</ProjectGuid>
|
||||
<RootNamespace>dedicated</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<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|Win32'">
|
||||
<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)'=='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|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)r5dev\;$(IncludePath);</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)r5dev\thirdparty\detours\libs;$(SolutionDir)r5dev\thirdparty\lzham\libs;$(LibraryPath);</LibraryPath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(SolutionDir)r5dev\;$(IncludePath);</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)r5dev\thirdparty\detours\libs;$(SolutionDir)r5dev\thirdparty\lzham\libs;$(LibraryPath);</LibraryPath>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalOptions>/D DEDICATED %(AdditionalOptions)</AdditionalOptions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>core\stdafx.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>detours.lib;lzhamlib_x64D.lib;lzhamcomp_x64D.lib;lzhamdecomp_x64D.lib;d3d11.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>del "..\..\..\$(ProjectName)" && copy /Y "$(TargetPath)" "..\..\..\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalOptions>/D DEDICATED %(AdditionalOptions)</AdditionalOptions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>core\stdafx.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>detours.lib;lzhamlib_x64.lib;lzhamcomp_x64.lib;lzhamdecomp_x64.lib;d3d11.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>del "..\..\..\$(ProjectName)" && copy /Y "$(TargetPath)" "..\..\..\</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="bsplib\bsplib.h" />
|
||||
<ClInclude Include="client\client.h" />
|
||||
<ClInclude Include="client\IVEngineClient.h" />
|
||||
<ClInclude Include="common\opcodes.h" />
|
||||
<ClInclude Include="common\protocol.h" />
|
||||
<ClInclude Include="common\psuedodefs.h" />
|
||||
<ClInclude Include="core\init.h" />
|
||||
<ClInclude Include="core\logdef.h" />
|
||||
<ClInclude Include="core\r5dev.h" />
|
||||
<ClInclude Include="core\stdafx.h" />
|
||||
<ClInclude Include="ebisusdk\EbisuSDK.h" />
|
||||
<ClInclude Include="engine\baseclient.h" />
|
||||
<ClInclude Include="engine\baseclientstate.h" />
|
||||
<ClInclude Include="engine\host_state.h" />
|
||||
<ClInclude Include="engine\net_chan.h" />
|
||||
<ClInclude Include="engine\sys_dll.h" />
|
||||
<ClInclude Include="engine\sys_dll2.h" />
|
||||
<ClInclude Include="engine\sys_utils.h" />
|
||||
<ClInclude Include="launcher\IApplication.h" />
|
||||
<ClInclude Include="mathlib\adler32.h" />
|
||||
<ClInclude Include="mathlib\crc32.h" />
|
||||
<ClInclude Include="mathlib\IceKey.H" />
|
||||
<ClInclude Include="mathlib\parallel_for.h" />
|
||||
<ClInclude Include="mathlib\vector.h" />
|
||||
<ClInclude Include="networksystem\r5net.h" />
|
||||
<ClInclude Include="networksystem\serverlisting.h" />
|
||||
<ClInclude Include="networksystem\sm_protocol.h" />
|
||||
<ClInclude Include="public\include\memaddr.h" />
|
||||
<ClInclude Include="public\include\bansystem.h" />
|
||||
<ClInclude Include="public\include\binstream.h" />
|
||||
<ClInclude Include="public\include\httplib.h" />
|
||||
<ClInclude Include="public\include\json.hpp" />
|
||||
<ClInclude Include="public\include\utility.h" />
|
||||
<ClInclude Include="rtech\rtech.h" />
|
||||
<ClInclude Include="rtech\stryder.h" />
|
||||
<ClInclude Include="server\IVEngineServer.h" />
|
||||
<ClInclude Include="server\server.h" />
|
||||
<ClInclude Include="squirrel\sqapi.h" />
|
||||
<ClInclude Include="squirrel\sqinit.h" />
|
||||
<ClInclude Include="squirrel\sqvm.h" />
|
||||
<ClInclude Include="thirdparty\detours\include\detours.h" />
|
||||
<ClInclude Include="thirdparty\detours\include\detver.h" />
|
||||
<ClInclude Include="thirdparty\detours\include\idetour.h" />
|
||||
<ClInclude Include="thirdparty\detours\include\syelog.h" />
|
||||
<ClInclude Include="thirdparty\lzham\include\lzham.h" />
|
||||
<ClInclude Include="thirdparty\lzham\include\lzham_static_lib.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\async.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\async_logger-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\async_logger.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\argv.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\env.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\helpers-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\helpers.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\common-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\common.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\backtracer-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\backtracer.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\circular_q.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\console_globals.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\file_helper-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\file_helper.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\fmt_helper.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg_buffer-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg_buffer.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\mpmc_blocking_q.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\null_mutex.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\os-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\os.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\periodic_worker-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\periodic_worker.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\registry-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\registry.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\synchronous_factory.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\tcp_client-windows.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\tcp_client.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\thread_pool-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\thread_pool.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\windows_include.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bin_to_hex.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\args.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\chrono.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\color.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\compile.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\core.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\format-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\format.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\locale.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\os.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\ostream.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\printf.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\ranges.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\xchar.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\chrono.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\fmt.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\ostr.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\xchar.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\formatter.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\fwd.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\logger-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\logger.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\pattern_formatter-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\pattern_formatter.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\android_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ansicolor_sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ansicolor_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\base_sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\base_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\basic_file_sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\basic_file_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\daily_file_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\dist_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\dup_filter_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\hourly_file_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\mongo_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\msvc_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\null_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ostream_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\qt_sinks.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ringbuffer_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\rotating_file_sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\rotating_file_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_color_sinks-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_color_sinks.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_sinks-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_sinks.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\syslog_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\systemd_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\tcp_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\wincolor_sink-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\wincolor_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\win_eventlog_sink.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\spdlog-inl.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\spdlog.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\stopwatch.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\tweakme.h" />
|
||||
<ClInclude Include="thirdparty\spdlog\include\version.h" />
|
||||
<ClInclude Include="tier0\basetypes.h" />
|
||||
<ClInclude Include="tier0\ConCommand.h" />
|
||||
<ClInclude Include="tier0\completion.h" />
|
||||
<ClInclude Include="tier0\cvar.h" />
|
||||
<ClInclude Include="tier0\IConVar.h" />
|
||||
<ClInclude Include="tier0\interface.h" />
|
||||
<ClInclude Include="vpc\basefilesystem.h" />
|
||||
<ClInclude Include="vpc\IAppSystem.h" />
|
||||
<ClInclude Include="vpc\interfaces.h" />
|
||||
<ClInclude Include="vpc\keyvalues.h" />
|
||||
<ClInclude Include="vphysics\QHull.h" />
|
||||
<ClInclude Include="vpklib\packedstore.h" />
|
||||
<ClInclude Include="windows\console.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="bsplib\bsplib.cpp" />
|
||||
<ClCompile Include="client\client.cpp" />
|
||||
<ClCompile Include="client\IVEngineClient.cpp" />
|
||||
<ClCompile Include="common\opcodes.cpp" />
|
||||
<ClCompile Include="core\dllmain.cpp" />
|
||||
<ClCompile Include="core\init.cpp" />
|
||||
<ClCompile Include="core\stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ebisusdk\EbisuSDK.cpp" />
|
||||
<ClCompile Include="engine\baseclient.cpp" />
|
||||
<ClCompile Include="engine\baseclientstate.cpp" />
|
||||
<ClCompile Include="engine\host_state.cpp" />
|
||||
<ClCompile Include="engine\net_chan.cpp" />
|
||||
<ClCompile Include="engine\sys_dll.cpp" />
|
||||
<ClCompile Include="engine\sys_dll2.cpp" />
|
||||
<ClCompile Include="engine\sys_utils.cpp" />
|
||||
<ClCompile Include="launcher\IApplication.cpp" />
|
||||
<ClCompile Include="mathlib\adler32.cpp" />
|
||||
<ClCompile Include="mathlib\crc32.cpp" />
|
||||
<ClCompile Include="mathlib\IceKey.cpp" />
|
||||
<ClCompile Include="networksystem\r5net.cpp" />
|
||||
<ClCompile Include="public\bansystem.cpp" />
|
||||
<ClCompile Include="public\binstream.cpp" />
|
||||
<ClCompile Include="public\utility.cpp" />
|
||||
<ClCompile Include="rtech\rtech.cpp" />
|
||||
<ClCompile Include="rtech\stryder.cpp" />
|
||||
<ClCompile Include="server\IVEngineServer.cpp" />
|
||||
<ClCompile Include="server\server.cpp" />
|
||||
<ClCompile Include="squirrel\sqapi.cpp" />
|
||||
<ClCompile Include="squirrel\sqinit.cpp" />
|
||||
<ClCompile Include="squirrel\sqvm.cpp" />
|
||||
<ClCompile Include="tier0\ConCommand.cpp" />
|
||||
<ClCompile Include="tier0\completion.cpp" />
|
||||
<ClCompile Include="tier0\cvar.cpp" />
|
||||
<ClCompile Include="tier0\IConVar.cpp" />
|
||||
<ClCompile Include="vpc\basefilesystem.cpp" />
|
||||
<ClCompile Include="vpc\IAppSystem.cpp" />
|
||||
<ClCompile Include="vpc\keyvalues.cpp" />
|
||||
<ClCompile Include="vphysics\QHull.cpp" />
|
||||
<ClCompile Include="vpklib\packedstore.cpp" />
|
||||
<ClCompile Include="windows\console.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="r5dev.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
687
r5dev/dedicated.vcxproj.filters
Normal file
687
r5dev/dedicated.vcxproj.filters
Normal file
@ -0,0 +1,687 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="sdk">
|
||||
<UniqueIdentifier>{f97c7e9b-cc5e-4ec1-8c2a-19cf941b5c90}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\client">
|
||||
<UniqueIdentifier>{c9b133cf-3943-49c9-abb0-c6f9e83a696c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\common">
|
||||
<UniqueIdentifier>{f280958c-f362-4918-a1f3-ca66f4bf1ec6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\ebisusdk">
|
||||
<UniqueIdentifier>{00cd526c-e897-4d88-86e0-03612cfda456}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\engine">
|
||||
<UniqueIdentifier>{495a53fc-5055-4449-b42c-b7edc5e83466}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\launcher">
|
||||
<UniqueIdentifier>{08dd9239-516c-4b9f-8064-28bd127d9806}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\mathlib">
|
||||
<UniqueIdentifier>{a6ab59cc-8df3-4fbd-b94b-2ec6e83feea9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\networksystem">
|
||||
<UniqueIdentifier>{009673c6-839f-48d7-b2c6-eca9a6e606b1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\rtech">
|
||||
<UniqueIdentifier>{08acc045-15dd-469f-b717-35f1dd35c07c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\server">
|
||||
<UniqueIdentifier>{8786ae3f-91d3-4eb8-89b7-e2135d143faa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\squirrel">
|
||||
<UniqueIdentifier>{e88d652e-34a0-44a0-a886-8861315c5b4f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\tier0">
|
||||
<UniqueIdentifier>{9dc16eaa-182b-42ea-9524-8cc8421829b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\vpc">
|
||||
<UniqueIdentifier>{3792464a-e366-4bbb-86fa-35631e3748f2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\vphysics">
|
||||
<UniqueIdentifier>{a7be4dd8-3e52-4053-afa5-26faf833e5b7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="windows">
|
||||
<UniqueIdentifier>{3db73603-e800-4763-98dc-f3bf4c674261}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty">
|
||||
<UniqueIdentifier>{2b79f12d-1506-42e6-94a9-560891c0ff8c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\detours">
|
||||
<UniqueIdentifier>{1a595a55-8bcf-4c0f-8456-4669b8692ce5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\detours\include">
|
||||
<UniqueIdentifier>{7c06597f-4eda-4695-9d39-d7719ead774e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog">
|
||||
<UniqueIdentifier>{a0f19f1c-dfba-49b4-a9d1-2f7c353bf0d8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include">
|
||||
<UniqueIdentifier>{6c7f8ba7-fc42-49a3-b22d-c23098e75c0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include\sinks">
|
||||
<UniqueIdentifier>{903e9591-e043-4d78-970e-8246198f4d7f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include\fmt">
|
||||
<UniqueIdentifier>{4f304fe8-8e16-44c3-a173-cb47fb009e23}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include\fmt\bundled">
|
||||
<UniqueIdentifier>{2dd28355-d167-479b-8437-855a2186cbb8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include\details">
|
||||
<UniqueIdentifier>{86d45699-fa61-431d-920e-bfdb013b1918}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\spdlog\include\cfg">
|
||||
<UniqueIdentifier>{d4c6d6c0-05da-43ab-a6fc-f61ce721f870}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="core">
|
||||
<UniqueIdentifier>{8aacb674-0b73-41fa-94f0-98ba718289a9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\public">
|
||||
<UniqueIdentifier>{bbb7a170-37ae-4c76-b99a-8ebb924818ed}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\public\include">
|
||||
<UniqueIdentifier>{e1897f61-953e-4173-9c75-e59ca33929ea}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\vpklib">
|
||||
<UniqueIdentifier>{e7189077-ca26-4a4e-bb60-eec7e5a1bafc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\lzham">
|
||||
<UniqueIdentifier>{24c9de5d-3333-4464-acb2-41f950a879b8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="thirdparty\lzham\include">
|
||||
<UniqueIdentifier>{db372a17-c0de-4a8b-8aa8-9b3129cc5955}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="sdk\bsplib">
|
||||
<UniqueIdentifier>{8288ba1a-7609-42ef-af3b-850727635a99}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="client\client.h">
|
||||
<Filter>sdk\client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="client\IVEngineClient.h">
|
||||
<Filter>sdk\client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common\opcodes.h">
|
||||
<Filter>sdk\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common\protocol.h">
|
||||
<Filter>sdk\common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\init.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\logdef.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\r5dev.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="core\stdafx.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ebisusdk\EbisuSDK.h">
|
||||
<Filter>sdk\ebisusdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\baseclientstate.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\host_state.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\net_chan.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\sys_dll.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\sys_dll2.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\sys_utils.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="engine\baseclient.h">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="launcher\IApplication.h">
|
||||
<Filter>sdk\launcher</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mathlib\vector.h">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="networksystem\serverlisting.h">
|
||||
<Filter>sdk\networksystem</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="networksystem\sm_protocol.h">
|
||||
<Filter>sdk\networksystem</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\httplib.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\json.hpp">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\utility.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\memaddr.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\bansystem.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rtech\stryder.h">
|
||||
<Filter>sdk\rtech</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="rtech\rtech.h">
|
||||
<Filter>sdk\rtech</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="server\IVEngineServer.h">
|
||||
<Filter>sdk\server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="squirrel\sqapi.h">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="squirrel\sqvm.h">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\detours\include\detours.h">
|
||||
<Filter>thirdparty\detours\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\detours\include\detver.h">
|
||||
<Filter>thirdparty\detours\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\detours\include\idetour.h">
|
||||
<Filter>thirdparty\detours\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\detours\include\syelog.h">
|
||||
<Filter>thirdparty\detours\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\common-inl.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\formatter.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fwd.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\logger.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\logger-inl.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\pattern_formatter.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\pattern_formatter-inl.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\spdlog.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\spdlog-inl.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\stopwatch.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\tweakme.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\version.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\async.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\async_logger.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\async_logger-inl.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\common.h">
|
||||
<Filter>thirdparty\spdlog\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\dist_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\dup_filter_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\hourly_file_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\mongo_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\msvc_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\null_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ostream_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\qt_sinks.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ringbuffer_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\rotating_file_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\rotating_file_sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_color_sinks.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_color_sinks-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_sinks.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\stdout_sinks-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\syslog_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\systemd_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\tcp_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\win_eventlog_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\wincolor_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\wincolor_sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\android_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ansicolor_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\ansicolor_sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\base_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\base_sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\basic_file_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\basic_file_sink-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\sinks\daily_file_sink.h">
|
||||
<Filter>thirdparty\spdlog\include\sinks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bin_to_hex.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\chrono.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\fmt.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\ostr.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\xchar.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\compile.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\core.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\format.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\format-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\locale.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\os.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\ostream.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\printf.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\ranges.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\xchar.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\args.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\chrono.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\fmt\bundled\color.h">
|
||||
<Filter>thirdparty\spdlog\include\fmt\bundled</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\fmt_helper.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg_buffer.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg_buffer-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\log_msg-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\mpmc_blocking_q.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\null_mutex.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\os.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\os-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\periodic_worker.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\periodic_worker-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\registry.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\registry-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\synchronous_factory.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\tcp_client.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\tcp_client-windows.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\thread_pool.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\thread_pool-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\windows_include.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\backtracer.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\backtracer-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\circular_q.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\console_globals.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\file_helper.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\details\file_helper-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\details</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\env.h">
|
||||
<Filter>thirdparty\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\helpers.h">
|
||||
<Filter>thirdparty\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\helpers-inl.h">
|
||||
<Filter>thirdparty\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\spdlog\include\cfg\argv.h">
|
||||
<Filter>thirdparty\spdlog\include\cfg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\completion.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\cvar.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\IConVar.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\basetypes.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\ConCommand.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vpc\IAppSystem.h">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vpc\interfaces.h">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vpc\keyvalues.h">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vpc\basefilesystem.h">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vphysics\QHull.h">
|
||||
<Filter>sdk\vphysics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="windows\console.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="networksystem\r5net.h">
|
||||
<Filter>sdk\networksystem</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mathlib\IceKey.H">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mathlib\parallel_for.h">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="squirrel\sqinit.h">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="server\server.h">
|
||||
<Filter>sdk\server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tier0\interface.h">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mathlib\crc32.h">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vpklib\packedstore.h">
|
||||
<Filter>sdk\vpklib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public\include\binstream.h">
|
||||
<Filter>sdk\public\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\lzham\include\lzham.h">
|
||||
<Filter>thirdparty\lzham\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="thirdparty\lzham\include\lzham_static_lib.h">
|
||||
<Filter>thirdparty\lzham\include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mathlib\adler32.h">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="bsplib\bsplib.h">
|
||||
<Filter>sdk\bsplib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common\psuedodefs.h">
|
||||
<Filter>sdk\common</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="client\IVEngineClient.cpp">
|
||||
<Filter>sdk\client</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="client\client.cpp">
|
||||
<Filter>sdk\client</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="common\opcodes.cpp">
|
||||
<Filter>sdk\common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core\stdafx.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core\dllmain.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="core\init.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ebisusdk\EbisuSDK.cpp">
|
||||
<Filter>sdk\ebisusdk</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\host_state.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\net_chan.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\sys_dll.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\sys_dll2.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\sys_utils.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\baseclient.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="engine\baseclientstate.cpp">
|
||||
<Filter>sdk\engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="launcher\IApplication.cpp">
|
||||
<Filter>sdk\launcher</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="public\utility.cpp">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="public\bansystem.cpp">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rtech\stryder.cpp">
|
||||
<Filter>sdk\rtech</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="rtech\rtech.cpp">
|
||||
<Filter>sdk\rtech</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="server\IVEngineServer.cpp">
|
||||
<Filter>sdk\server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="squirrel\sqapi.cpp">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="squirrel\sqvm.cpp">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tier0\completion.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tier0\cvar.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tier0\IConVar.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tier0\ConCommand.cpp">
|
||||
<Filter>sdk\tier0</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vpc\IAppSystem.cpp">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vpc\keyvalues.cpp">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vpc\basefilesystem.cpp">
|
||||
<Filter>sdk\vpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vphysics\QHull.cpp">
|
||||
<Filter>sdk\vphysics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="windows\console.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="networksystem\r5net.cpp">
|
||||
<Filter>sdk\networksystem</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mathlib\IceKey.cpp">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="squirrel\sqinit.cpp">
|
||||
<Filter>sdk\squirrel</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="server\server.cpp">
|
||||
<Filter>sdk\server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vpklib\packedstore.cpp">
|
||||
<Filter>sdk\vpklib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="public\binstream.cpp">
|
||||
<Filter>sdk\public</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bsplib\bsplib.cpp">
|
||||
<Filter>sdk\bsplib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mathlib\adler32.cpp">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mathlib\crc32.cpp">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="r5dev.def" />
|
||||
</ItemGroup>
|
||||
</Project>
|
26
r5dev/ebisusdk/EbisuSDK.cpp
Normal file
26
r5dev/ebisusdk/EbisuSDK.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "ebisusdk/EbisuSDK.h"
|
||||
#include "client/client.h"
|
||||
#include "engine/sys_utils.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sets the EbisuSDK globals for dedicated to satisfy command callbacks
|
||||
//-----------------------------------------------------------------------------
|
||||
void HEbisuSDK_Init()
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
*(char*)g_bEbisuSDKInitialized.GetPtr() = (char)0x1; // <- 1st EbisuSDK
|
||||
*(char*)g_bEbisuSDKCvarInitialized.GetPtr() = (char)0x1; // <- 2nd EbisuSDK
|
||||
*(char*)g_qEbisuSDKCvarInitialized.GetPtr() = (char)0x1; // <- 3rd EbisuSDK
|
||||
#endif // DEDICATED
|
||||
}
|
||||
|
||||
void EbisuSDK_Attach()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
void EbisuSDK_Detach()
|
||||
{
|
||||
//
|
||||
}
|
64
r5dev/ebisusdk/EbisuSDK.h
Normal file
64
r5dev/ebisusdk/EbisuSDK.h
Normal file
@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier0/completion.h"
|
||||
#include "public/include/utility.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
ADDRESS p_EbisuSDK_Init_Tier0 = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x28\x80\x3D\x00\x00\x00\x00\x00\x0F\x85\x00\x02\x00\x00\x48\x89\x5C\x24\x20", "xxxxxx????xxx?xxxxxxxx").GetPtr();
|
||||
void(*EbisuSDK_Init_Tier0) = (void(*))p_EbisuSDK_Init_Tier0.GetPtr(); /*48 83 EC 28 80 3D ?? ?? ?? ?? 00 0F 85 ?? 02 00 00 48 89 5C 24 20*/
|
||||
|
||||
ADDRESS p_EbisuSDK_CVar_Init = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x57\x48\x83\xEC\x40\x83\x3D", "xxxxxxxx");
|
||||
void(*EbisuSDK_CVar_Init) = (void(*))p_EbisuSDK_CVar_Init.GetPtr(); /*40 57 48 83 EC 40 83 3D*/
|
||||
#else
|
||||
ADDRESS p_OriginGetErrorDescription = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x48\x83\xEC\x20\x8B\xD9\x48\x8D\x15\x00\x00\x00\x00", "xxxxxxxxxxx????").GetPtr();
|
||||
void(*OriginGetErrorDescription) = (void(*))p_OriginGetErrorDescription.GetPtr(); /*40 53 48 83 EC 20 8B D9 48 8D 15 ?? ?? ?? ??*/
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
#if defined (GAMEDLL_S1)
|
||||
ADDRESS g_bEbisuSDKInitialized = p_EbisuSDK_Init_Tier0.FindPatternSelf("80 3D ?? ?? ?? ?? 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_bEbisuSDKCvarInitialized = p_Map_Callback.FindPatternSelf("80 3D 8F 7C 1E 22 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_qEbisuSDKCvarInitialized = p_EbisuSDK_CVar_Init.FindPatternSelf("4C 89 05 C4 2B 0E 22", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr();
|
||||
#elif defined (GAMEDLL_S2)
|
||||
ADDRESS g_bEbisuSDKInitialized = p_EbisuSDK_Init_Tier0.FindPatternSelf("80 3D ?? ?? ?? ?? 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_bEbisuSDKCvarInitialized = p_Map_Callback.FindPatternSelf("80 3D 43 2D 41 22 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_qEbisuSDKCvarInitialized = p_EbisuSDK_CVar_Init.FindPatternSelf("4C 89 05 74 2D 32 22", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr();
|
||||
#elif defined (GAMEDLL_S3)
|
||||
ADDRESS g_bEbisuSDKInitialized = p_EbisuSDK_Init_Tier0.FindPatternSelf("80 3D ?? ?? ?? ?? 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_bEbisuSDKCvarInitialized = p_Map_Callback.FindPatternSelf("80 3D 23 54 2B 23 00", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).GetPtr();
|
||||
ADDRESS g_qEbisuSDKCvarInitialized = p_EbisuSDK_CVar_Init.FindPatternSelf("4C 89 05 B4 2C 1C 23", ADDRESS::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr();
|
||||
#endif // GAMEDLL_*
|
||||
#endif // DEDICATED
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void HEbisuSDK_Init();
|
||||
|
||||
void EbisuSDK_Attach();
|
||||
void EbisuSDK_Detach();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HEbisuSDK : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
std::cout << "| FUN: EbisuSDK_Init_Tier0 : 0x" << std::hex << std::uppercase << p_EbisuSDK_Init_Tier0.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: EbisuSDK_CVar_Init : 0x" << std::hex << std::uppercase << p_EbisuSDK_CVar_Init.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_bEbisuSDKInitialized : 0x" << std::hex << std::uppercase << g_bEbisuSDKInitialized.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_bEbisuSDKCvarInitialized : 0x" << std::hex << std::uppercase << g_bEbisuSDKCvarInitialized.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_qEbisuSDKCvarInitialized : 0x" << std::hex << std::uppercase << g_qEbisuSDKCvarInitialized.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
#else
|
||||
std::cout << "| FUN: OriginGetErrorDescription : 0x" << std::hex << std::uppercase << p_OriginGetErrorDescription.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
#endif // DEDICATED
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HEbisuSDK);
|
137
r5dev/ebisusdk/EbisuTypes.h
Normal file
137
r5dev/ebisusdk/EbisuTypes.h
Normal file
@ -0,0 +1,137 @@
|
||||
#pragma once
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// General errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR 0xA0000000
|
||||
#define ORIGIN_WARNING 0x40000000
|
||||
#define ORIGIN_ERROR_AREA_GENERAL 0x00000000
|
||||
#define ORIGIN_ERROR_AREA_SDK (1<<16)
|
||||
#define ORIGIN_ERROR_AREA_CORE (2<<16)
|
||||
#define ORIGIN_ERROR_AREA_IGO (3<<16)
|
||||
#define ORIGIN_ERROR_AREA_FRIENDS (4<<16)
|
||||
#define ORIGIN_ERROR_AREA_PRESENCE (5<<16)
|
||||
#define ORIGIN_ERROR_AREA_COMMERCE (6<<16)
|
||||
#define ORIGIN_ERROR_AREA_ACHIEVEMENTS (7<<16)
|
||||
#define ORIGIN_ERROR_AREA_LSX (8<<16)
|
||||
#define ORIGIN_ERROR_AREA_PROXY (9<<16)
|
||||
#define ORIGIN_ERROR_LEVEL_SHIFT 24
|
||||
#define ORIGIN_ERROR_LEVEL_MASK 0x0F000000
|
||||
#define ORIGIN_LEVEL_0 (0<<24)
|
||||
#define ORIGIN_LEVEL_1 (1<<24)
|
||||
#define ORIGIN_LEVEL_2 (2<<24)
|
||||
#define ORIGIN_LEVEL_3 (3<<24)
|
||||
#define ORIGIN_LEVEL_4 (4<<24)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Origin errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_SUCCESS 0
|
||||
#define ORIGIN_PENDING 1
|
||||
#define ORIGIN_ERROR_GENERAL -1
|
||||
#define ORIGIN_ERROR_INVALID_HANDLE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 0)
|
||||
#define ORIGIN_ERROR_OUT_OF_MEMORY (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_GENERAL + 1)
|
||||
#define ORIGIN_ERROR_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 2)
|
||||
#define ORIGIN_ERROR_INVALID_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 3)
|
||||
#define ORIGIN_ERROR_INVALID_ARGUMENT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 4)
|
||||
#define ORIGIN_ERROR_NO_CALLBACK_SPECIFIED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 5)
|
||||
#define ORIGIN_ERROR_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 6)
|
||||
#define ORIGIN_ERROR_TOO_MANY_VALUES_IN_LIST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 7)
|
||||
#define ORIGIN_ERROR_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 8)
|
||||
#define ORIGIN_ERROR_INVALID_PERSONA (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 9)
|
||||
#define ORIGIN_ERROR_NO_NETWORK (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 10)
|
||||
#define ORIGIN_ERROR_NO_SERVICE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 11)
|
||||
#define ORIGIN_ERROR_NOT_LOGGED_IN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 12)
|
||||
#define ORIGIN_ERROR_MANDATORY_ORIGIN_UPDATE_PENDING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 13)
|
||||
#define ORIGIN_ERROR_ACCOUNT_IN_USE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 14)
|
||||
#define ORIGIN_ERROR_TOO_MANY_INSTANCES (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 15)
|
||||
#define ORIGIN_ERROR_ALREADY_EXISTS (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_GENERAL + 16)
|
||||
#define ORIGIN_ERROR_INVALID_OPERATION (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 17)
|
||||
#define ORIGIN_ERROR_AGE_RESTRICTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 18)
|
||||
#define ORIGIN_ERROR_BANNED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 19)
|
||||
#define ORIGIN_ERROR_NOT_READY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 20)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// SDK errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR_SDK_NOT_INITIALIZED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_SDK + 0)
|
||||
#define ORIGIN_ERROR_SDK_INVALID_ALLOCATOR_DEALLOCATOR_COMBINATION (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 1)
|
||||
#define ORIGIN_ERROR_SDK_IS_RUNNING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2)
|
||||
#define ORIGIN_ERROR_SDK_NOT_ALL_RESOURCES_RELEASED (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_SDK + 3)
|
||||
#define ORIGIN_ERROR_SDK_INVALID_RESOURCE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4)
|
||||
#define ORIGIN_ERROR_SDK_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 5)
|
||||
#define ORIGIN_ERROR_SDK_INTERNAL_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 6)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// SDK warnings
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_WARNING_SDK_ALREADY_INITIALIZED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 1)
|
||||
#define ORIGIN_WARNING_SDK_STILL_RUNNING (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2)
|
||||
#define ORIGIN_WARNING_SDK_ENUMERATOR_IN_USE (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 3)
|
||||
#define ORIGIN_WARNING_SDK_ENUMERATOR_TERMINATED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Core errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR_CORE_NOTLOADED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 0)
|
||||
#define ORIGIN_ERROR_CORE_LOGIN_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 1)
|
||||
#define ORIGIN_ERROR_CORE_AUTHENTICATION_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 2
|
||||
#define ORIGIN_ERROR_CORE_SEND_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 4)
|
||||
#define ORIGIN_ERROR_CORE_RECEIVE_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 5)
|
||||
#define ORIGIN_ERROR_CORE_RESOURCE_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 6)
|
||||
#define ORIGIN_ERROR_CORE_INCOMPATIBLE_VERSION (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 7)
|
||||
#define ORIGIN_ERROR_CORE_NOT_INSTALLED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 8)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// In-game overlay errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_WARNING_IGO_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 0)
|
||||
#define ORIGIN_WARNING_IGO_SUPPORT_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 1)
|
||||
#define ORIGIN_ERROR_IGO_ILLEGAL_ANCHOR_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 2)
|
||||
#define ORIGIN_ERROR_IGO_ILLEGAL_DOCK_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 3)
|
||||
#define ORIGIN_ERROR_IGO_NOT_AVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 4)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Presence errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR_NO_MULTIPLAYER_ID (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PRESENCE + 0)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LSX errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR_LSX_INVALID_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 0)
|
||||
#define ORIGIN_ERROR_LSX_NO_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_LSX + 1)
|
||||
#define ORIGIN_ERROR_LSX_INVALID_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 2)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Commerce errors
|
||||
//-----------------------------------------------------------------------------
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 0)
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_CATALOG (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 1)
|
||||
#define ORIGIN_ERROR_COMMERCE_INVALID_REPLY (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 2)
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_CATEGORIES (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 3)
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_PRODUCTS (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 4)
|
||||
#define ORIGIN_ERROR_COMMERCE_UNDERAGE_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 5)
|
||||
#define ORIGIN_ERROR_COMMERCE_DEPRECATED_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 6)
|
||||
#define ORIGIN_ERROR_PROXY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 0)
|
||||
#define ORIGIN_SUCCESS_PROXY_OK (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 200)
|
||||
#define ORIGIN_SUCCESS_PROXY_CREATED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 201)
|
||||
#define ORIGIN_SUCCESS_PROXY_ACCEPTED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 202)
|
||||
#define ORIGIN_SUCCESS_PROXY_NON_AUTH_INFO (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 203)
|
||||
#define ORIGIN_SUCCESS_PROXY_NO_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 204)
|
||||
#define ORIGIN_SUCCESS_RESET_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 205)
|
||||
#define ORIGIN_SUCCESS_PARTIAL_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 206)
|
||||
#define ORIGIN_ERROR_PROXY_BAD_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 400)
|
||||
#define ORIGIN_ERROR_PROXY_UNAUTHORIZED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 401)
|
||||
#define ORIGIN_ERROR_PROXY_PAYMENT_REQUIRED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 402)
|
||||
#define ORIGIN_ERROR_PROXY_FORBIDDEN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 403)
|
||||
#define ORIGIN_ERROR_PROXY_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 404)
|
||||
#define ORIGIN_ERROR_PROXY_METHOD_NOT_ALLOWED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 405)
|
||||
#define ORIGIN_ERROR_PROXY_NOT_ACCEPTABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 406)
|
||||
#define ORIGIN_ERROR_PROXY_REQUEST_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 408)
|
||||
#define ORIGIN_ERROR_PROXY_CONFLICT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 409)
|
||||
#define ORIGIN_ERROR_PROXY_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 500)
|
||||
#define ORIGIN_ERROR_PROXY_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 501)
|
||||
#define ORIGIN_ERROR_PROXY_BAD_GATEWAY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 502)
|
||||
#define ORIGIN_ERROR_PROXY_SERVICE_UNAVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 503)
|
||||
#define ORIGIN_ERROR_PROXY_GATEWAY_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 504)
|
20
r5dev/engine/baseclient.cpp
Normal file
20
r5dev/engine/baseclient.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/baseclient.h"
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: throw away any residual garbage in the channel
|
||||
//---------------------------------------------------------------------------------
|
||||
std::int64_t* HCBaseClient_Clear(std::int64_t client)
|
||||
{
|
||||
return CBaseClient_Clear(client);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CBaseClient_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&CBaseClient_Clear, &HCBaseClient_Clear);
|
||||
}
|
||||
void CBaseClient_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&CBaseClient_Clear, &HCBaseClient_Clear);
|
||||
}
|
27
r5dev/engine/baseclient.h
Normal file
27
r5dev/engine/baseclient.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CBASECLIENT ===================================================================================================================================================== */
|
||||
ADDRESS p_CBaseClient_Clear = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x41\x56\x41\x57\x48\x83\xEC\x20\x48\x8B\xD9\x48\x89\x74", "xxxxxxxxxxxxxxxx");
|
||||
std::int64_t* (*CBaseClient_Clear)(std::int64_t client) = (std::int64_t * (*)(std::int64_t))p_CBaseClient_Clear.GetPtr(); /*40 53 41 56 41 57 48 83 EC 20 48 8B D9 48 89 74*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::int64_t* HCBaseClient_Clear(std::int64_t client);
|
||||
|
||||
void CBaseClient_Attach();
|
||||
void CBaseClient_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HBaseClient : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: CBaseClient::Clear : 0x" << std::hex << std::uppercase << p_CBaseClient_Clear.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HBaseClient);
|
9
r5dev/engine/baseclientstate.cpp
Normal file
9
r5dev/engine/baseclientstate.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
//===========================================================================//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/baseclientstate.h"
|
||||
//TODO
|
31
r5dev/engine/baseclientstate.h
Normal file
31
r5dev/engine/baseclientstate.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CCLIENTSTATE ==================================================================================================================================================== */
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
//ADDRESS p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x56\x57\x41\x57\x00\x81\xEC\x20\x04\x00\x00\x45\x0F\xB6\xF9\x00\x00\x00\x00\x8B\xF1\x48", "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/
|
||||
//void (*CClientState__CheckForResend)(std::int64_t a1, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6) = (void(*)(std::int64_t, const char*, std::int64_t, char, int, std::uint8_t*))p_CClientState__CheckForResend.GetPtr();
|
||||
#elif defined (GAMEDLL_S2)
|
||||
//ADDRESS p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x45\x0F\xB6", "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 45 0F B6*/
|
||||
//void (*CClientState__CheckForResend)(std::int64_t a1, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6) = (void(*)(std::int64_t, const char*, std::int64_t, char, int, std::uint8_t*))p_CClientState__CheckForResend.GetPtr();
|
||||
#elif defined (GAMEDLL_S3)
|
||||
//ADDRESS p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x32", "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 48 8B 32*/
|
||||
//void (*CClientState__CheckForResend)(std::int64_t a1, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6) = (void(*)(std::int64_t, const char*, std::int64_t, char, int, std::uint8_t*))p_CClientState__CheckForResend.GetPtr();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HClientState : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
//std::cout << "| FUN: CClientState::CheckForResend : 0x" << std::hex << std::uppercase << p_CClientState__CheckForResend.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
//std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HClientState);
|
244
r5dev/engine/host_state.cpp
Normal file
244
r5dev/engine/host_state.cpp
Normal file
@ -0,0 +1,244 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "engine/host_state.h"
|
||||
#include "engine/net_chan.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: state machine's main processing loop
|
||||
//-----------------------------------------------------------------------------
|
||||
void HCHostState_FrameUpdate(void* rcx, void* rdx, float time)
|
||||
{
|
||||
static auto setjmpFn = ADDRESS(0x141205460).RCast<std::int64_t(*)(jmp_buf, void*)>();
|
||||
static auto host_abortserver = ADDRESS(0x14B37C700).RCast<jmp_buf*>();
|
||||
static auto CHostState_InitFn = ADDRESS(0x14023E7D0).RCast<void(*)(CHostState*)>();
|
||||
static auto g_ServerAbortServer = ADDRESS(0x14B37CA22).RCast<char*>();
|
||||
static auto State_RunFn = ADDRESS(0x14023E870).RCast<void(*)(HostStates_t*, void*, float)>();
|
||||
static auto Cbuf_ExecuteFn = ADDRESS(0x14020D5C0).RCast<void(*)()>();
|
||||
static auto g_ServerGameClients = ADDRESS(0x14B383428).RCast<std::int64_t*>();
|
||||
static auto SV_InitGameDLLFn = ADDRESS(0x140308B90).RCast<void(*)()>();
|
||||
static auto g_CModelLoader = ADDRESS(0x14173B210).RCast<void*>();
|
||||
static auto CModelLoader_Map_IsValidFn = ADDRESS(0x1402562F0).RCast<bool(*)(void*, const char*)>();
|
||||
static auto Host_NewGameFn = ADDRESS(0x140238DA0).RCast<bool(*)(char*, char*, bool, bool, void*)>();
|
||||
static auto Host_Game_ShutdownFn = ADDRESS(0x14023EDA0).RCast<void(*)(CHostState*)>();
|
||||
static auto src_drawloading = ADDRESS(0x14B37D96B).RCast<char*>();
|
||||
static auto scr_engineevent_loadingstarted = ADDRESS(0x1666ED024).RCast<char*>();
|
||||
static auto gfExtendedError = ADDRESS(0x14B383391).RCast<char*>();
|
||||
static auto g_CEngineVGui = ADDRESS(0x141741310).RCast<void*>();
|
||||
static auto g_ServerDLL = ADDRESS(0x141732048).RCast<void**>();
|
||||
static auto Host_ChangelevelFn = ADDRESS(0x1402387B0).RCast<void(*)(bool, const char*, const char*)>();
|
||||
static auto CL_EndMovieFn = ADDRESS(0x1402C03D0).RCast<void(*)()>();
|
||||
static auto SendOfflineRequestToStryderFn = ADDRESS(0x14033D380).RCast<void(*)()>();
|
||||
static auto CEngine = ADDRESS(0X141741BA0).RCast<void*>();
|
||||
|
||||
static bool bInitialized = false;
|
||||
if (!bInitialized)
|
||||
{
|
||||
IConVar_ClearHostNames();
|
||||
ConCommand_InitConCommand();
|
||||
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec.cfg");
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_server.cfg");
|
||||
#ifndef DEDICATED
|
||||
IVEngineClient_CommandExecute(NULL, "exec autoexec_client.cfg");
|
||||
#endif // !DEDICATED
|
||||
|
||||
*(bool*)m_bRestrictServerCommands = true; // Restrict commands.
|
||||
void* disconnect = g_pCvar->FindCommand("disconnect");
|
||||
*(std::int32_t*)((std::uintptr_t)disconnect + 0x38) |= FCVAR_SERVER_CAN_EXECUTE; // Make sure server is not restricted to this.
|
||||
|
||||
if (net_userandomkey->m_pParent->m_iValue == 1)
|
||||
{
|
||||
HNET_GenerateKey();
|
||||
}
|
||||
|
||||
g_pCvar->FindVar("net_usesocketsforloopback")->m_pParent->m_iValue = 1;
|
||||
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
HostStates_t oldState{};
|
||||
void* placeHolder = nullptr;
|
||||
if (setjmpFn(*host_abortserver, placeHolder))
|
||||
{
|
||||
CHostState_InitFn(g_pHostState);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
*g_ServerAbortServer = true;
|
||||
|
||||
do
|
||||
{
|
||||
Cbuf_ExecuteFn();
|
||||
oldState = g_pHostState->m_iCurrentState;
|
||||
switch (g_pHostState->m_iCurrentState)
|
||||
{
|
||||
case HostStates_t::HS_NEW_GAME:
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_NEW_GAME | Loading level: '%s'\n", g_pHostState->m_levelName);
|
||||
|
||||
// Inlined CHostState::State_NewGame
|
||||
g_pHostState->m_bSplitScreenConnect = false;
|
||||
if (!g_ServerGameClients) // Init Game if it ain't valid.
|
||||
{
|
||||
SV_InitGameDLLFn();
|
||||
}
|
||||
|
||||
if (!CModelLoader_Map_IsValidFn(g_CModelLoader, g_pHostState->m_levelName) // Check if map is valid and if we can start a new game.
|
||||
|| !Host_NewGameFn(g_pHostState->m_levelName, nullptr, g_pHostState->m_bBackgroundLevel, g_pHostState->m_bSplitScreenConnect, nullptr) || !g_ServerGameClients)
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_NEW_GAME | Error: Map not valid.\n");
|
||||
// Inlined SCR_EndLoadingPlaque
|
||||
if (*src_drawloading)
|
||||
{
|
||||
*scr_engineevent_loadingstarted = 0;
|
||||
using HideLoadingPlaqueFn = void(*)(void*);
|
||||
(*reinterpret_cast<HideLoadingPlaqueFn**>(g_CEngineVGui))[36](g_CEngineVGui); // (*((void(__fastcall**)(void**))g_CEngineVGui + 36))(&g_CEngineVGui);// HideLoadingPlaque
|
||||
}
|
||||
else if (*gfExtendedError)
|
||||
{
|
||||
using ShowErrorMessageFn = void(*)(void*);
|
||||
(*reinterpret_cast<ShowErrorMessageFn**>(g_CEngineVGui))[35](g_CEngineVGui); // (*((void(__fastcall**)(void**))g_CEngineVGui + 35))(&g_CEngineVGui);// ShowErrorMessage
|
||||
}
|
||||
// End Inline SCR_EndLoadingPlaque
|
||||
|
||||
// Inlined CHostState::GameShutdown
|
||||
if (g_pHostState->m_bActiveGame)
|
||||
{
|
||||
using GameShutdownFn = void(*)(void*);
|
||||
(*reinterpret_cast<GameShutdownFn**>(g_ServerDLL))[9](g_ServerDLL); // (*(void(__fastcall**)(void*))(*(_QWORD*)g_ServerDLL + 72i64))(g_ServerDLL);// GameShutdown
|
||||
g_pHostState->m_bActiveGame = 0;
|
||||
}
|
||||
// End Inline CHostState::GameShutdown
|
||||
}
|
||||
|
||||
// Seems useless so nope.
|
||||
// if (g_CHLClient)
|
||||
// (*(void(__fastcall**)(__int64, _QWORD))(*(_QWORD*)g_CHLClient + 1000i64))(g_CHLClient, 0i64);
|
||||
|
||||
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
|
||||
|
||||
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
|
||||
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->m_pParent->m_iValue)
|
||||
{
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
|
||||
}
|
||||
|
||||
// End Inline CHostState::State_NewGame
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_CHANGE_LEVEL_SP:
|
||||
{
|
||||
g_pHostState->m_flShortFrameTime = 1.5; // Set frame time.
|
||||
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_CHANGE_LEVEL_SP | Changing singleplayer level to: '%s'\n", g_pHostState->m_levelName);
|
||||
|
||||
if (CModelLoader_Map_IsValidFn(g_CModelLoader, g_pHostState->m_levelName)) // Check if map is valid and if we can start a new game.
|
||||
{
|
||||
Host_ChangelevelFn(true, g_pHostState->m_levelName, g_pHostState->m_mapGroupName); // Call change level as singleplayer level.
|
||||
}
|
||||
else
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_CHANGE_LEVEL_SP | Error: Unable to find map: '%s'\n", g_pHostState->m_levelName);
|
||||
}
|
||||
|
||||
// Seems useless so nope.
|
||||
// if (g_CHLClient)
|
||||
// (*(void(__fastcall**)(__int64, _QWORD))(*(_QWORD*)g_CHLClient + 1000i64))(g_CHLClient, 0i64);
|
||||
|
||||
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
|
||||
|
||||
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
|
||||
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->m_pParent->m_iValue)
|
||||
{
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_CHANGE_LEVEL_MP:
|
||||
{
|
||||
g_pHostState->m_flShortFrameTime = 0.5; // Set frame time.
|
||||
using LevelShutdownFn = void(__thiscall*)(void*);
|
||||
(*reinterpret_cast<LevelShutdownFn**>(*g_ServerDLL))[8](g_ServerDLL); // (*(void (__fastcall **)(void *))(*(_QWORD *)server_dll_var + 64i64))(server_dll_var);// LevelShutdown
|
||||
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_CHANGE_LEVEL_MP | Changing multiplayer level to: '%s'\n", g_pHostState->m_levelName);
|
||||
|
||||
if (CModelLoader_Map_IsValidFn(g_CModelLoader, g_pHostState->m_levelName)) // Check if map is valid and if we can start a new game.
|
||||
{
|
||||
using EnabledProgressBarForNextLoadFn = void(*)(void*);
|
||||
(*reinterpret_cast<EnabledProgressBarForNextLoadFn**>(g_CEngineVGui))[31](g_CEngineVGui); // (*((void(__fastcall**)(void**))g_CEngineVGUI + 31))(&g_CEngineVGUI);// EnabledProgressBarForNextLoad
|
||||
Host_ChangelevelFn(false, g_pHostState->m_levelName, g_pHostState->m_mapGroupName); // Call change level as multiplayer level.
|
||||
}
|
||||
else
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_CHANGE_LEVEL_MP | Error: Unable to find map: '%s'\n", g_pHostState->m_levelName);
|
||||
}
|
||||
|
||||
// Seems useless so nope.
|
||||
// // if (g_CHLClient)
|
||||
// (*(void(__fastcall**)(__int64, _QWORD))(*(_QWORD*)g_CHLClient + 1000i64))(g_CHLClient, 0i64);
|
||||
|
||||
g_pHostState->m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
|
||||
|
||||
// If our next state isn't a shutdown or its a forced shutdown then set next state to run.
|
||||
if (g_pHostState->m_iNextState != HostStates_t::HS_SHUTDOWN || !g_pCvar->FindVar("host_hasIrreversibleShutdown")->m_pParent->m_iValue)
|
||||
{
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_RUN;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_RUN:
|
||||
{
|
||||
State_RunFn(&g_pHostState->m_iCurrentState, nullptr, time);
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_GAME_SHUTDOWN:
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_GAME_SHUTDOWN | Shutdown game\n");
|
||||
Host_Game_ShutdownFn(g_pHostState);
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_RESTART:
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_RESTART | Restarting client\n");
|
||||
CL_EndMovieFn();
|
||||
SendOfflineRequestToStryderFn(); // We have hostnames nulled anyway.
|
||||
*(std::int32_t*)((std::uintptr_t)CEngine + 0xC) = 3; //g_CEngine.vtable->SetNextState(&g_CEngine, DLL_RESTART);
|
||||
break;
|
||||
}
|
||||
case HostStates_t::HS_SHUTDOWN:
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "CHostState::FrameUpdate | CASE:HS_SHUTDOWN | Shutdown client\n");
|
||||
CL_EndMovieFn();
|
||||
SendOfflineRequestToStryderFn(); // We have hostnames nulled anyway.
|
||||
*(std::int32_t*)((std::uintptr_t)CEngine + 0xC) = 2; //g_CEngine.vtable->SetNextState(&g_CEngine, DLL_CLOSE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} while ((oldState != HostStates_t::HS_RUN || g_pHostState->m_iNextState == HostStates_t::HS_LOAD_GAME && g_pCvar->FindVar("g_single_frame_shutdown_for_reload_cvar")->m_pParent->m_iValue)
|
||||
&& oldState != HostStates_t::HS_SHUTDOWN
|
||||
&& oldState != HostStates_t::HS_RESTART);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CHostState_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&CHostState_FrameUpdate, &HCHostState_FrameUpdate);
|
||||
}
|
||||
|
||||
void CHostState_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&CHostState_FrameUpdate, &HCHostState_FrameUpdate);
|
||||
}
|
||||
|
||||
CHostState* g_pHostState = reinterpret_cast<CHostState*>(p_CHostState_FrameUpdate.FindPatternSelf("48 8D ?? ?? ?? ?? 01", ADDRESS::Direction::DOWN, 100).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr());;
|
65
r5dev/engine/host_state.h
Normal file
65
r5dev/engine/host_state.h
Normal file
@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
#include "mathlib/vector.h"
|
||||
|
||||
enum class HostStates_t : int
|
||||
{
|
||||
HS_NEW_GAME = 0x0,
|
||||
HS_LOAD_GAME = 0x1,
|
||||
HS_CHANGE_LEVEL_SP = 0x2,
|
||||
HS_CHANGE_LEVEL_MP = 0x3,
|
||||
HS_RUN = 0x4,
|
||||
HS_GAME_SHUTDOWN = 0x5,
|
||||
HS_SHUTDOWN = 0x6,
|
||||
HS_RESTART = 0x7,
|
||||
};
|
||||
|
||||
class CHostState
|
||||
{
|
||||
public:
|
||||
HostStates_t m_iCurrentState; //0x0000
|
||||
HostStates_t m_iNextState; //0x0004
|
||||
Vector3 m_vecLocation; //0x0008
|
||||
QAngle m_angLocation; //0x0014
|
||||
char m_levelName[64]; //0x0020
|
||||
char m_mapGroupName[256]; //0x0060
|
||||
char m_landMarkName[256]; //0x0160
|
||||
float m_flShortFrameTime; //0x0260
|
||||
bool m_bActiveGame; //0x0264
|
||||
bool m_bRememberLocation; //0x0265
|
||||
bool m_bBackgroundLevel; //0x0266
|
||||
bool m_bWaitingForConnection; //0x0267
|
||||
bool m_bSplitScreenConnect; //0x0268
|
||||
bool m_bGameHasShutDownAndFlushedMemory; //0x0269
|
||||
bool m_bWorkshopMapDownloadPending; //0x026A
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CHOSTSTATE ====================================================================================================================================================== */
|
||||
ADDRESS p_CHostState_FrameUpdate = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x20\xF3\x0F\x11\x54\x24\x18", "xxxxxxxxxxxxxxxx");
|
||||
void (*CHostState_FrameUpdate)(void* rcx, void* rdx, float time) = (void(*)(void*, void*, float))p_CHostState_FrameUpdate.GetPtr(); /*48 89 5C 24 08 48 89 6C 24 20 F3 0F 11 54 24 18*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void HCHostState_FrameUpdate(void* rcx, void* rdx, float time);
|
||||
|
||||
void CHostState_Attach();
|
||||
void CHostState_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern CHostState* g_pHostState;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HHostState : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: CHostState::FrameUpdate : 0x" << std::hex << std::uppercase << p_CHostState_FrameUpdate.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_pHostState : 0x" << std::hex << std::uppercase << g_pHostState << std::setw(0) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HHostState);
|
176
r5dev/engine/net_chan.cpp
Normal file
176
r5dev/engine/net_chan.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
//=============================================================================//
|
||||
//
|
||||
// Purpose: Netchannel system utilities
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "core/logdef.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "tier0/completion.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "engine/net_chan.h"
|
||||
#include "engine/baseclient.h"
|
||||
#include "server/IVEngineServer.h"
|
||||
|
||||
#ifndef DEDICATED
|
||||
#include "gameui/IConsole.h"
|
||||
#endif // !DEDICATED
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: shutdown netchannel
|
||||
//-----------------------------------------------------------------------------
|
||||
void NET_ShutDown(void* thisptr, const char* szReason, std::uint8_t a1, char a2)
|
||||
{
|
||||
DownloadPlaylists_Callback(); // Re-load playlist from disk after getting disconnected from the server.
|
||||
NET_ShutDown(thisptr, szReason, a1, a2);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook and log the receive datagram
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HNET_ReceiveDatagram(int iSocket, netpacket_s* pInpacket, bool bRaw)
|
||||
{
|
||||
bool result = NET_ReceiveDatagram(iSocket, pInpacket, bRaw);
|
||||
if (result)
|
||||
{
|
||||
// Log received packet data
|
||||
HexDump("[+] NET_ReceiveDatagram", 0, &pInpacket->data[NULL], pInpacket->wiresize);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook and log the send datagram
|
||||
//-----------------------------------------------------------------------------
|
||||
void* HNET_SendDatagram(SOCKET s, const char* szPayload, int iLenght, int nFlags)
|
||||
{
|
||||
void* result = NET_SendDatagram(s, szPayload, iLenght, nFlags);
|
||||
if (result)
|
||||
{
|
||||
// Log transmitted packet data
|
||||
HexDump("[+] NET_SendDatagram", 0, szPayload, iLenght);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sets the user specified encryption key
|
||||
//-----------------------------------------------------------------------------
|
||||
void HNET_SetKey(std::string svNetKey)
|
||||
{
|
||||
g_szNetKey.clear();
|
||||
g_szNetKey = svNetKey;
|
||||
|
||||
DevMsg(eDLL_T::ENGINE, "______________________________________________________________\n");
|
||||
DevMsg(eDLL_T::ENGINE, "] NET_KEY ----------------------------------------------------\n");
|
||||
DevMsg(eDLL_T::ENGINE, "] BASE64: '%s'\n", g_szNetKey.c_str());
|
||||
DevMsg(eDLL_T::ENGINE, "--------------------------------------------------------------\n");
|
||||
|
||||
NET_SetKey(g_pNetKey, g_szNetKey.c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: calculates and sets the encryption key
|
||||
//-----------------------------------------------------------------------------
|
||||
void HNET_GenerateKey()
|
||||
{
|
||||
g_szNetKey.clear();
|
||||
net_userandomkey->m_pParent->m_iValue = 1;
|
||||
|
||||
BCRYPT_ALG_HANDLE hAlgorithm;
|
||||
if (BCryptOpenAlgorithmProvider(&hAlgorithm, L"RNG", 0, 0) < 0)
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "Failed to open rng algorithm\n");
|
||||
return;
|
||||
}
|
||||
unsigned char pBuffer[0x10u];
|
||||
if (BCryptGenRandom(hAlgorithm, pBuffer, 0x10u, 0) < 0)
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "Failed to generate random data\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 0x10u; i++)
|
||||
{
|
||||
g_szNetKey += pBuffer[i];
|
||||
}
|
||||
|
||||
g_szNetKey = Base64Encode(g_szNetKey);
|
||||
|
||||
DevMsg(eDLL_T::ENGINE, "______________________________________________________________\n");
|
||||
DevMsg(eDLL_T::ENGINE, "] NET_KEY ----------------------------------------------------\n");
|
||||
DevMsg(eDLL_T::ENGINE, "] BASE64: '%s'\n", g_szNetKey.c_str());
|
||||
DevMsg(eDLL_T::ENGINE, "--------------------------------------------------------------\n");
|
||||
|
||||
NET_SetKey(g_pNetKey, g_szNetKey.c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: hook and log the client's signonstate to the console
|
||||
//-----------------------------------------------------------------------------
|
||||
void HNET_PrintFunc(const char* fmt, ...)
|
||||
{
|
||||
static char buf[1024];
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
buf[sizeof(buf) -1] = 0;
|
||||
va_end(args);
|
||||
|
||||
DevMsg(eDLL_T::CLIENT, "%s\n", buf);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: disconnect the client and shutdown netchannel
|
||||
//-----------------------------------------------------------------------------
|
||||
void NET_DisconnectClient(CClient* pClient, int nIndex, const char* szReason, uint8_t unk1, char unk2)
|
||||
{
|
||||
if (!pClient) // Client valid?
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (std::strlen(szReason) == NULL) // Is reason null?
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!pClient->GetNetChan())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NET_Shutdown(pClient->GetNetChan(), szReason, unk1, unk2); // Shutdown netchan.
|
||||
pClient->GetNetChan() = nullptr; // Null netchan.
|
||||
CBaseClient_Clear((std::int64_t)pClient); // Reset CClient instance for client.
|
||||
g_bIsPersistenceVarSet[nIndex] = false; // Reset Persistence var.
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CNetChan_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&NET_PrintFunc, &HNET_PrintFunc);
|
||||
}
|
||||
|
||||
void CNetChan_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&NET_PrintFunc, &HNET_PrintFunc);
|
||||
}
|
||||
|
||||
void CNetChan_Trace_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&NET_ReceiveDatagram, &HNET_ReceiveDatagram);
|
||||
DetourAttach((LPVOID*)&NET_SendDatagram, &HNET_SendDatagram);
|
||||
}
|
||||
|
||||
void CNetChan_Trace_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&NET_ReceiveDatagram, &HNET_ReceiveDatagram);
|
||||
DetourDetach((LPVOID*)&NET_SendDatagram, &HNET_SendDatagram);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
std::string g_szNetKey = "WDNWLmJYQ2ZlM0VoTid3Yg==";
|
||||
std::uintptr_t g_pNetKey = g_mGameDll.StringSearch("client:NetEncryption_NewKey").FindPatternSelf("48 8D ? ? ? ? ? 48 3B", ADDRESS::Direction::UP, 150).ResolveRelativeAddressSelf(0x3, 0x7).GetPtr();
|
95
r5dev/engine/net_chan.h
Normal file
95
r5dev/engine/net_chan.h
Normal file
@ -0,0 +1,95 @@
|
||||
#pragma once
|
||||
#include "core/stdafx.h"
|
||||
#include "tier0/basetypes.h"
|
||||
#include "common/protocol.h"
|
||||
#include "client/client.h"
|
||||
|
||||
typedef struct netpacket_s netpacket_t;
|
||||
typedef struct __declspec(align(8)) netpacket_s
|
||||
{
|
||||
DWORD family_maybe;
|
||||
sockaddr_in sin;
|
||||
WORD sin_port;
|
||||
char gap16;
|
||||
char byte17;
|
||||
DWORD source;
|
||||
double received;
|
||||
std::uint8_t* data;
|
||||
std::uint64_t label;
|
||||
BYTE byte38;
|
||||
std::uint64_t qword40;
|
||||
std::uint64_t qword48;
|
||||
BYTE gap50[8];
|
||||
std::uint64_t qword58;
|
||||
std::uint64_t qword60;
|
||||
std::uint64_t qword68;
|
||||
int less_than_12;
|
||||
DWORD wiresize;
|
||||
BYTE gap78[8];
|
||||
struct netpacket_s *pNext;
|
||||
} netpacket_t;
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== CNETCHAN ======================================================================================================================================================== */
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) || defined (GAMEDLL_S2)
|
||||
ADDRESS p_NET_Init = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x41\x54\x41\x56\x41\x57\x48\x81\xEC\xC0\x01\x00", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
void*(*NET_Init)(char a1) = (void* (*)(char))p_NET_Init.GetPtr(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 54 41 56 41 57 48 81 EC C0 01 00*/
|
||||
|
||||
ADDRESS p_NET_Shutdown = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x6C\x24\x18\x56\x57\x41\x56\x48\x83\xEC\x30\x83\xB9\xD8", "xxxxxxxxxxxxxxxx");
|
||||
void (*NET_Shutdown)(void* thisptr, const char* a0, std::uint8_t a1, char a2) = (void (*)(void*, const char*, std::uint8_t, char))p_NET_Shutdown.GetPtr(); /*48 89 6C 24 18 56 57 41 56 48 83 EC 30 83 B9 D8*/
|
||||
#elif defined (GAMEDLL_S3)
|
||||
ADDRESS p_NET_Init = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x41\x54\x41\x56\x41\x57\x48\x81\xEC\xF0\x01\x00", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
void* (*NET_Init)(char a1) = (void* (*)(char))p_NET_Init.GetPtr(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 48 89 7C 24 20 41 54 41 56 41 57 48 81 EC F0 01 00*/
|
||||
|
||||
ADDRESS p_NET_Shutdown = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x6C\x24\x18\x56\x57\x41\x56\x48\x83\xEC\x30\x83\xB9\xD0", "xxxxxxxxxxxxxxxx");
|
||||
void (*NET_Shutdown)(void* thisptr, const char* szReason, std::uint8_t a1, char a2) = (void (*)(void*, const char*, std::uint8_t, char))p_NET_Shutdown.GetPtr(); /*48 89 6C 24 18 56 57 41 56 48 83 EC 30 83 B9 D0*/
|
||||
#endif
|
||||
ADDRESS p_NET_SetKey = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x48\x83\xEC\x20\x48\x8B\xF9\x41\xB8", "xxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
void (*NET_SetKey)(std::uintptr_t pKey, const char* szHash) = (void (*)(std::uintptr_t, const char*))p_NET_SetKey.GetPtr(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 20 48 8B F9 41 B8*/
|
||||
|
||||
ADDRESS p_NET_ReceiveDatagram = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\xAC\x24\x50\xEB", "xxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
bool (*NET_ReceiveDatagram)(int iSocket, netpacket_s* pInpacket, bool bRaw) = (bool (*)(int, netpacket_s*, bool))p_NET_ReceiveDatagram.GetPtr(); /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/
|
||||
|
||||
ADDRESS p_NET_SendDatagram = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x57\x41\x56\x41\x57\x48\x81\xEC\x00\x05\x00\x00", "xxxxxxxxxxxxxxxxxxxxxxx?xxx");
|
||||
void*(*NET_SendDatagram)(SOCKET s, const char* szPayload, int iLenght, int nFlags) = (void*(*)(SOCKET, const char*, int, int))p_NET_SendDatagram.GetPtr(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ?? 05 00 00*/
|
||||
|
||||
ADDRESS p_NET_PrintFunc = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\xC3\x48", "xxxxxxxxxxxxxxxxx");
|
||||
void (*NET_PrintFunc)(const char* fmt) = (void(*)(const char*))p_NET_PrintFunc.GetPtr(); /*48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 C3 48*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool HNET_ReceiveDatagram(int iSocket, netpacket_s* pInpacket, bool bRaw);
|
||||
void* HNET_SendDatagram(SOCKET s, const char* szPayload, int iLenght, int nFlags);
|
||||
void HNET_SetKey(std::string svNetKey);
|
||||
void HNET_GenerateKey();
|
||||
void HNET_PrintFunc(const char* fmt, ...);
|
||||
void NET_DisconnectClient(CClient* pClient, int nIndex, const char* szReason, std::uint8_t unk1, char unk2);
|
||||
|
||||
void CNetChan_Attach();
|
||||
void CNetChan_Detach();
|
||||
void CNetChan_Trace_Attach();
|
||||
void CNetChan_Trace_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern std::string g_szNetKey;
|
||||
extern std::uintptr_t g_pNetKey;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HNetChan : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: NET_Init : 0x" << std::hex << std::uppercase << p_NET_Init.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: NET_Shutdown : 0x" << std::hex << std::uppercase << p_NET_Shutdown.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: NET_SetKey : 0x" << std::hex << std::uppercase << p_NET_SetKey.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: NET_ReceiveDatagram : 0x" << std::hex << std::uppercase << p_NET_ReceiveDatagram.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: NET_SendDatagram : 0x" << std::hex << std::uppercase << p_NET_SendDatagram.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: NET_PrintFunc : 0x" << std::hex << std::uppercase << p_NET_PrintFunc.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_pNetKey : 0x" << std::hex << std::uppercase << g_pNetKey << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HNetChan);
|
26
r5dev/engine/sys_dll.cpp
Normal file
26
r5dev/engine/sys_dll.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/sys_dll.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sys_Error_Internal
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
int HSys_Error_Internal(char* fmt, va_list args)
|
||||
{
|
||||
printf("\n_____________________________________________________________\n");
|
||||
printf("] ENGINE ERROR ################################################\n");
|
||||
vprintf(fmt, args);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
return Sys_Error_Internal(fmt, args);
|
||||
}
|
||||
|
||||
void SysDll_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&Sys_Error_Internal, &HSys_Error_Internal);
|
||||
}
|
||||
|
||||
void SysDll_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&Sys_Error_Internal, &HSys_Error_Internal);
|
||||
}
|
27
r5dev/engine/sys_dll.h
Normal file
27
r5dev/engine/sys_dll.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
namespace
|
||||
{
|
||||
/* ==== UTILITY ========================================================================================================================================================= */
|
||||
ADDRESS p_Sys_Error_Internal = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x81\xEC\x30\x08\x00\x00\x48\x8B\xDA\x48\x8B\xF9\xE8\x00\x00\x00\xFF\x33\xF6\x48", "xxxxxxxxxxxxxxxxxxxxxxxxx???xxxx");
|
||||
int (*Sys_Error_Internal)(char* fmt, va_list args) = (int (*)(char*, va_list))p_Sys_Error_Internal.GetPtr(); /*48 89 5C 24 08 48 89 74 24 10 57 48 81 EC 30 08 00 00 48 8B DA 48 8B F9 E8 ?? ?? ?? FF 33 F6 48*/
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int HSys_Error_Internal(char* fmt, va_list args);
|
||||
|
||||
void SysDll_Attach();
|
||||
void SysDll_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HSys_Dll : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: Sys_Error_Internal : 0x" << std::hex << std::uppercase << p_Sys_Error_Internal.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HSys_Dll);
|
3
r5dev/engine/sys_dll2.cpp
Normal file
3
r5dev/engine/sys_dll2.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/sys_dll.h"
|
||||
#include "engine/sys_dll2.h"
|
40
r5dev/engine/sys_dll2.h
Normal file
40
r5dev/engine/sys_dll2.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier0/interface.h"
|
||||
|
||||
class CEngineAPI
|
||||
{
|
||||
// TODO [ AMOS ]:
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
ADDRESS p_CEngineAPI_Connect = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x83\xEC\x28\x48\x8B\x05\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x85\xC0\x48\x89\x15", "xxxxxxx????xxx????xxxxxx");
|
||||
bool (*CEngineAPI_Connect)(CEngineAPI* thisptr, CreateInterfaceFn factory) = (bool (*)(CEngineAPI*, CreateInterfaceFn))p_CEngineAPI_Connect.GetPtr(); /*48 83 EC 28 48 8B 05 ? ? ? ? 48 8D 0D ? ? ? ? 48 85 C0 48 89 15 ? ? ? ?*/
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
ADDRESS p_PakFile_Init = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x5C\x24\x00\x48\x89\x6C\x24\x00\x44\x88\x44\x24\x00\x56\x57\x41\x54\x41\x56\x41\x57\x48\x83\xEC\x20", "xxxx?xxxx?xxxx?xxxxxxxxxxxx");
|
||||
int (*PakFile_Init)(char* buffer, char* source, char vpk_file) = (int (*)(char*, char*, char))p_PakFile_Init.GetPtr(); /*48 89 5C 24 ?? 48 89 6C 24 ?? 44 88 44 24 ?? 56 57 41 54 41 56 41 57 48 83 EC 20*/
|
||||
|
||||
ADDRESS g_pMapVPKCache = p_PakFile_Init.FindPatternSelf("4C 8D 35 ?? ?? ?? ?? 44", ADDRESS::Direction::DOWN, 250).OffsetSelf(0x3).ResolveRelativeAddressSelf().GetPtr();
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
ADDRESS p_PakFile_Init = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x44\x88\x44\x24\x00\x53\x55\x56\x57", "xxxx?xxxx");
|
||||
void (*PakFile_Init)(char* buffer, char* source, char vpk_file) = (void (*)(char*, char*, char))p_PakFile_Init.GetPtr(); /*44 88 44 24 ?? 53 55 56 57*/
|
||||
|
||||
ADDRESS g_pMapVPKCache = p_PakFile_Init.FindPatternSelf("48 8D 1D ?? ?? ?? ?? 4C", ADDRESS::Direction::DOWN, 250).OffsetSelf(0x3).ResolveRelativeAddressSelf().GetPtr();
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HSys_Dll2 : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: CEngineAPI_Connect : 0x" << std::hex << std::uppercase << p_CEngineAPI_Connect.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: PakFile_Init : 0x" << std::hex << std::uppercase << p_PakFile_Init.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| VAR: g_pMapVPKCache : 0x" << std::hex << std::uppercase << g_pMapVPKCache.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HSys_Dll2);
|
123
r5dev/engine/sys_utils.cpp
Normal file
123
r5dev/engine/sys_utils.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/logdef.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "vgui/CEngineVGui.h"
|
||||
#include "gameui/IConsole.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sys_Error
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void HSys_Error(char* fmt, ...)
|
||||
{
|
||||
static char buf[1024];
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
buf[sizeof(buf) -1] = 0;
|
||||
va_end(args);
|
||||
|
||||
DevMsg(eDLL_T::ENGINE, "%s\n", buf);
|
||||
Sys_Error(buf);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sys_Print
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void DevMsg(eDLL_T idx, const char* fmt, ...)
|
||||
{
|
||||
int vmIdx = (int)idx;
|
||||
static bool initialized = false;
|
||||
static char buf[1024];
|
||||
|
||||
static std::string vmType[7] = { "Native(S):", "Native(C):", "Native(U):", "Native(E):", "Native(F):", "Native(R):", "Native(M):" };
|
||||
|
||||
static auto iconsole = spdlog::stdout_logger_mt("sys_print_iconsole"); // in-game console.
|
||||
static auto wconsole = spdlog::stdout_logger_mt("sys_print_wconsole"); // windows console.
|
||||
static auto sqlogger = spdlog::basic_logger_mt("sys_print_logger", "platform\\logs\\sys_print.log"); // file logger.
|
||||
|
||||
std::string vmStr = vmType[vmIdx].c_str();
|
||||
|
||||
g_spd_sys_w_oss.str("");
|
||||
g_spd_sys_w_oss.clear();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
iconsole = std::make_shared<spdlog::logger>("sys_print_ostream", g_spd_sys_p_ostream_sink);
|
||||
iconsole->set_pattern("[%S.%e] %v");
|
||||
iconsole->set_level(spdlog::level::debug);
|
||||
wconsole->set_pattern("[%S.%e] %v");
|
||||
wconsole->set_level(spdlog::level::debug);
|
||||
sqlogger->set_pattern("[%S.%e] %v");
|
||||
sqlogger->set_level(spdlog::level::debug);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
|
||||
buf[sizeof(buf) - 1] = 0;
|
||||
va_end(args);
|
||||
|
||||
vmStr.append(buf);
|
||||
|
||||
iconsole->debug(vmStr);
|
||||
wconsole->debug(vmStr);
|
||||
sqlogger->debug(vmStr);
|
||||
|
||||
#ifndef DEDICATED
|
||||
std::string s = g_spd_sys_w_oss.str();
|
||||
const char* c = s.c_str();
|
||||
|
||||
g_pLogSystem.AddLog((LogType_t)eDLL_T::ENGINE, s);
|
||||
Items.push_back(Strdup((const char*)c));
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Sys_LoadAssetHelper
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
void* HSys_LoadAssetHelper(const CHAR* lpFileName, std::int64_t a2, LARGE_INTEGER* a3)
|
||||
{
|
||||
std::string mod_file;
|
||||
std::string base_file = lpFileName;
|
||||
const std::string mod_dir = "paks\\Win32\\";
|
||||
const std::string base_dir = "paks\\Win64\\";
|
||||
|
||||
if (strstr(lpFileName, base_dir.c_str()))
|
||||
{
|
||||
base_file.erase(0, 11); // Erase 'base_dir'.
|
||||
mod_file = mod_dir + base_file; // Prepend 'mod_dir'.
|
||||
|
||||
if (FileExists(mod_file.c_str()))
|
||||
{
|
||||
// Load decompressed pak files from 'mod_dir'.
|
||||
DevMsg(eDLL_T::RTECH, "Loading pak: '%s'\n", mod_file.c_str());
|
||||
return Sys_LoadAssetHelper(mod_file.c_str(), a2, a3);
|
||||
}
|
||||
}
|
||||
if (strstr(lpFileName, base_dir.c_str()))
|
||||
{
|
||||
DevMsg(eDLL_T::RTECH, "Loading pak: '%s'\n", lpFileName);
|
||||
}
|
||||
return Sys_LoadAssetHelper(lpFileName, a2, a3);
|
||||
}
|
||||
|
||||
void SysUtils_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&Sys_Error, &HSys_Error);
|
||||
DetourAttach((LPVOID*)&Sys_LoadAssetHelper, &HSys_LoadAssetHelper);
|
||||
}
|
||||
|
||||
void SysUtils_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&Sys_Error, &HSys_Error);
|
||||
DetourDetach((LPVOID*)&Sys_LoadAssetHelper, &HSys_LoadAssetHelper);
|
||||
}
|
53
r5dev/engine/sys_utils.h
Normal file
53
r5dev/engine/sys_utils.h
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include "tier0/basetypes.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
ADDRESS p_Sys_Error = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x4C\x24\x08\x48\x89\x54\x24\x10\x4C\x89\x44\x24\x18\x4C\x89\x4C\x24\x20\x53\x55\x41\x54\x41\x56\xB8\x58\x10\x00\x00\xE8", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
void (*Sys_Error)(char* fmt, ...) = (void (*)(char* fmt, ...))p_Sys_Error.GetPtr(); /*48 89 4C 24 08 48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 53 55 41 54 41 56 B8 58 10 00 00 E8*/
|
||||
|
||||
ADDRESS p_Sys_LoadAssetHelper = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x48\x89\x74\x24\x10\x48\x89\x7C\x24\x18\x41\x56\x48\x83\xEC\x40\x33", "xxxxxxxxxxxxxxxxx");
|
||||
void*(*Sys_LoadAssetHelper)(const CHAR* lpFileName, std::int64_t a2, LARGE_INTEGER* a3) = (void*(*)(const CHAR*, std::int64_t, LARGE_INTEGER*))p_Sys_LoadAssetHelper.GetPtr();/*48 89 74 24 10 48 89 7C 24 18 41 56 48 83 EC 40 33*/
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1) || defined (GAMEDLL_S2)
|
||||
ADDRESS p_MemAlloc_Wrapper = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x48\x83\xEC\x20\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\xD9\x48\x85\xC0\x75\x0C\xE8\x16", "xxxxxxxxx????xxxxxxxxxx");
|
||||
void* (*MemAlloc_Wrapper)(std::int64_t size) = (void* (*)(std::int64_t))p_MemAlloc_Wrapper.GetPtr(); /*40 53 48 83 EC 20 48 8B 05 ?? ?? ?? ?? 48 8B D9 48 85 C0 75 0C E8 16*/
|
||||
#elif defined (GAMEDLL_S3)
|
||||
ADDRESS p_MemAlloc_Wrapper = g_mGameDll.FindPatternSIMD((std::uint8_t*)"\x40\x53\x48\x83\xEC\x20\x48\x8B\x05\x6B\x83\x25\x0D\x48\x8B\xD9", "xxxxxxxxxxxxxxxx");
|
||||
void* (*MemAlloc_Wrapper)(std::int64_t size) = (void* (*)(std::int64_t))p_MemAlloc_Wrapper.GetPtr(); /*40 53 48 83 EC 20 48 8B 05 6B 83 25 0D 48 8B D9*/
|
||||
#endif
|
||||
/* ==== ------- ========================================================================================================================================================= */
|
||||
}
|
||||
|
||||
enum class eDLL_T : int
|
||||
{
|
||||
SERVER = 0, // Game DLL
|
||||
CLIENT = 1, // Game DLL
|
||||
UI = 2, // Game DLL
|
||||
ENGINE = 3, // Wrapper
|
||||
FS = 4, // File System
|
||||
RTECH = 5, // RTech API
|
||||
MS = 6 // Material System
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void HSys_Error(char* fmt, ...);
|
||||
void DevMsg(eDLL_T idx, const char* fmt, ...);
|
||||
|
||||
void SysUtils_Attach();
|
||||
void SysUtils_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class HSys_Utils : public IDetour
|
||||
{
|
||||
virtual void debugp()
|
||||
{
|
||||
std::cout << "| FUN: Sys_Error : 0x" << std::hex << std::uppercase << p_Sys_Error.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: Sys_LoadAssetHelper : 0x" << std::hex << std::uppercase << p_Sys_LoadAssetHelper.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "| FUN: MemAlloc_Wrapper : 0x" << std::hex << std::uppercase << p_MemAlloc_Wrapper.GetPtr() << std::setw(npad) << " |" << std::endl;
|
||||
std::cout << "+----------------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
REGISTER(HSys_Utils);
|
712
r5dev/gameui/IBrowser.cpp
Normal file
712
r5dev/gameui/IBrowser.cpp
Normal file
@ -0,0 +1,712 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/init.h"
|
||||
#include "core/resource.h"
|
||||
#include "tier0/IConVar.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "tier0/completion.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/console.h"
|
||||
#include "engine/net_chan.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "engine/host_state.h"
|
||||
#include "server/server.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
#include "networksystem/serverlisting.h"
|
||||
#include "networksystem/r5net.h"
|
||||
#include "vpc/keyvalues.h"
|
||||
#include "squirrel/sqinit.h"
|
||||
#include "gameui/IBrowser.h"
|
||||
|
||||
/******************************************************************************
|
||||
-------------------------------------------------------------------------------
|
||||
File : IBrowser.cpp
|
||||
Date : 09:06:2021
|
||||
Author : Sal
|
||||
Purpose: Implements the in-game server browser frontend
|
||||
-------------------------------------------------------------------------------
|
||||
History:
|
||||
- 09:06:2021 21:07 : Created by Sal
|
||||
- 25:07:2021 14:26 : Implement private servers connect dialog and password field
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
IBrowser::IBrowser()
|
||||
{
|
||||
memset(m_chServerConnStringBuffer, 0, sizeof(m_chServerConnStringBuffer));
|
||||
|
||||
std::string path = "stbsp";
|
||||
for (const auto& entry : std::filesystem::directory_iterator(path))
|
||||
{
|
||||
std::string filename = entry.path().string();
|
||||
int slashPos = filename.rfind("\\", std::string::npos);
|
||||
filename = filename.substr(static_cast<std::basic_string<char, std::char_traits<char>, std::allocator<char>>::size_type>(slashPos) + 1, std::string::npos);
|
||||
filename = filename.substr(0, filename.size() - 6);
|
||||
|
||||
auto it = mapArray.find(filename); // Find MapName in mapArray.
|
||||
if (it != mapArray.end())
|
||||
{
|
||||
m_vszMapsList.push_back(it->second);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_vszMapsList.push_back(filename);
|
||||
}
|
||||
}
|
||||
|
||||
m_szMatchmakingHostName = r5net_matchmaking_hostname->m_pzsCurrentValue;
|
||||
static std::thread hostingServerRequestThread([this]()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
UpdateHostingStatus();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
|
||||
}
|
||||
});
|
||||
|
||||
hostingServerRequestThread.detach();
|
||||
|
||||
/* Obtain handle to module */
|
||||
static HGLOBAL rcData = NULL;
|
||||
HMODULE handle;
|
||||
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)"unnamed", &handle);
|
||||
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(IDB_PNG1), MAKEINTRESOURCE(PNG));
|
||||
/* Obtain assets from 'rsrc' */
|
||||
if (rc != NULL)
|
||||
{ rcData = LoadResource(handle, rc); }
|
||||
else { assert(rc == NULL); }
|
||||
if (rcData != NULL) { m_vucLockedIconBlob = (std::vector<unsigned char>*)LockResource(rcData); }
|
||||
else { assert(rcData == NULL); }
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
IBrowser::~IBrowser()
|
||||
{
|
||||
//delete r5net;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: updates the hoster's status
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::UpdateHostingStatus()
|
||||
{
|
||||
if (!g_pHostState || !g_pCvar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
eHostingStatus = g_pHostState->m_bActiveGame ? EHostStatus::HOSTING : EHostStatus::NOT_HOSTING; // Are we hosting a server?
|
||||
switch (eHostingStatus)
|
||||
{
|
||||
case EHostStatus::NOT_HOSTING:
|
||||
{
|
||||
m_szHostRequestMessage.clear();
|
||||
m_iv4HostRequestMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
break;
|
||||
}
|
||||
case EHostStatus::HOSTING:
|
||||
{
|
||||
if (eServerVisibility == EServerVisibility::OFFLINE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (*g_nRemoteFunctionCallsChecksum == NULL) // Check if script checksum is valid yet.
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
switch (eServerVisibility)
|
||||
{
|
||||
|
||||
case EServerVisibility::HIDDEN:
|
||||
m_Server.bHidden = true;
|
||||
break;
|
||||
case EServerVisibility::PUBLIC:
|
||||
m_Server.bHidden = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SendHostingPostRequest();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: refreshes the server browser list with available servers
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::RefreshServerList()
|
||||
{
|
||||
static bool bThreadLocked = false;
|
||||
|
||||
m_vServerList.clear();
|
||||
m_szServerListMessage.clear();
|
||||
|
||||
if (!bThreadLocked)
|
||||
{
|
||||
std::thread t([this]()
|
||||
{
|
||||
DevMsg(eDLL_T::CLIENT, "Refreshing server list with string '%s'\n", r5net_matchmaking_hostname->m_pzsCurrentValue);
|
||||
bThreadLocked = true;
|
||||
m_vServerList = g_pR5net->GetServersList(m_szServerListMessage);
|
||||
bThreadLocked = false;
|
||||
});
|
||||
|
||||
t.detach();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: sends the hosting POST request to the comp server
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::SendHostingPostRequest()
|
||||
{
|
||||
m_szHostToken = std::string();
|
||||
DevMsg(eDLL_T::CLIENT, "Sending PostServerHost request\n");
|
||||
bool result = g_pR5net->PostServerHost(m_szHostRequestMessage, m_szHostToken,
|
||||
ServerListing{
|
||||
m_Server.svServerName,
|
||||
std::string(g_pHostState->m_levelName),
|
||||
"",
|
||||
g_pCvar->FindVar("hostport")->m_pzsCurrentValue,
|
||||
g_pCvar->FindVar("mp_gamemode")->m_pzsCurrentValue,
|
||||
m_Server.bHidden,
|
||||
std::to_string(*g_nRemoteFunctionCallsChecksum),
|
||||
|
||||
std::string(),
|
||||
g_szNetKey.c_str()
|
||||
}
|
||||
);
|
||||
|
||||
if (result)
|
||||
{
|
||||
m_iv4HostRequestMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
||||
std::stringstream msg;
|
||||
msg << "Broadcasting! ";
|
||||
if (!m_szHostToken.empty())
|
||||
{
|
||||
msg << "Share the following token for clients to connect: ";
|
||||
}
|
||||
m_szHostRequestMessage = msg.str().c_str();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iv4HostRequestMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the compmenu
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::CompMenu()
|
||||
{
|
||||
ImGui::BeginTabBar("CompMenu");
|
||||
if (ImGui::TabItemButton("Server Browser"))
|
||||
{
|
||||
SetSection(ESection::SERVER_BROWSER);
|
||||
}
|
||||
if (ImGui::TabItemButton("Host Server"))
|
||||
{
|
||||
SetSection(ESection::HOST_SERVER);
|
||||
}
|
||||
if (ImGui::TabItemButton("Settings"))
|
||||
{
|
||||
SetSection(ESection::SETTINGS);
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the server browser section
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::ServerBrowserSection()
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
m_imServerBrowserFilter.Draw();
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Refresh List"))
|
||||
{
|
||||
RefreshServerList();
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
ImGui::TextColored(ImVec4(1.00f, 0.00f, 0.00f, 1.00f), m_szServerListMessage.c_str());
|
||||
ImGui::Separator();
|
||||
|
||||
const float FooterHeight = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
ImGui::BeginChild("ServerListChild", { 0, -FooterHeight }, true, ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||
if (ImGui::BeginTable("##ServerBrowser_ServerList", 5, ImGuiTableFlags_Resizable))
|
||||
{
|
||||
ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthStretch, 20);
|
||||
ImGui::TableSetupColumn("Map", ImGuiTableColumnFlags_WidthStretch, 25);
|
||||
ImGui::TableSetupColumn("Port", ImGuiTableColumnFlags_WidthStretch, 5);
|
||||
ImGui::TableSetupColumn("Playlist", ImGuiTableColumnFlags_WidthStretch, 5);
|
||||
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch, 5);
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
for (ServerListing& server : m_vServerList)
|
||||
{
|
||||
const char* name = server.svServerName.c_str();
|
||||
const char* map = server.svMapName.c_str();
|
||||
const char* port = server.svPort.c_str();
|
||||
const char* playlist = server.svPlaylist.c_str();
|
||||
|
||||
if (m_imServerBrowserFilter.PassFilter(name)
|
||||
|| m_imServerBrowserFilter.PassFilter(map)
|
||||
|| m_imServerBrowserFilter.PassFilter(port))
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(name);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(map);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(port);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(playlist);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
std::string selectButtonText = "Connect##";
|
||||
selectButtonText += (server.svServerName + server.svIpAddress + server.svMapName);
|
||||
|
||||
if (ImGui::Button(selectButtonText.c_str()))
|
||||
{
|
||||
ConnectToServer(server.svIpAddress, server.svPort, server.svEncryptionKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth() / 4);
|
||||
{
|
||||
ImGui::InputTextWithHint("##ServerBrowser_ServerConnString", "Enter IP address or \"localhost\"", m_chServerConnStringBuffer, IM_ARRAYSIZE(m_chServerConnStringBuffer));
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::InputTextWithHint("##ServerBrowser_ServerEncKey", "Enter encryption key", m_chServerEncKeyBuffer, IM_ARRAYSIZE(m_chServerEncKeyBuffer));
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Connect##ServerBrowser_ConnectByIp", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.2, 18.5)))
|
||||
{
|
||||
ConnectToServer(m_chServerConnStringBuffer, m_chServerEncKeyBuffer);
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Private Servers##ServerBrowser_HiddenServersButton", ImVec2(ImGui::GetWindowContentRegionWidth() / 4.2, 18.5)))
|
||||
{
|
||||
ImGui::OpenPopup("Connect to Private Server##HiddenServersConnectModal");
|
||||
}
|
||||
HiddenServersModal();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the hidden private server modal
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::HiddenServersModal()
|
||||
{
|
||||
bool modalOpen = true;
|
||||
if (ImGui::BeginPopupModal("Connect to Private Server##HiddenServersConnectModal", &modalOpen))
|
||||
{
|
||||
ImGui::SetWindowSize(ImVec2(400.f, 200.f), ImGuiCond_Always);
|
||||
|
||||
if (!m_idLockedIcon)
|
||||
{
|
||||
bool ret = LoadTextureBuffer((unsigned char*)m_vucLockedIconBlob, 0x1000 /*TODO [ AMOS ]: Calculate size dynamically*/, &m_idLockedIcon, &m_nLockedIconWidth, &m_nLockedIconHeight);
|
||||
IM_ASSERT(ret);
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.00f, 0.00f, 0.00f, 0.00f)); // Override the style color for child bg.
|
||||
|
||||
ImGui::BeginChild("##HiddenServersConnectModal_IconParent", ImVec2(m_nLockedIconWidth, m_nLockedIconHeight));
|
||||
ImGui::Image(m_idLockedIcon, ImVec2(m_nLockedIconWidth, m_nLockedIconHeight)); // Display texture.
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::PopStyleColor(); // Pop the override for the child bg.
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Enter the token to connect");
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth()); // Override item width.
|
||||
ImGui::InputTextWithHint("##HiddenServersConnectModal_TokenInput", "Token", &m_szHiddenServerToken);
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::Dummy(ImVec2(ImGui::GetWindowContentRegionWidth(), 19.f)); // Place a dummy, basically making space inserting a blank element.
|
||||
|
||||
ImGui::TextColored(m_ivHiddenServerMessageColor, m_szHiddenServerRequestMessage.c_str());
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Connect##HiddenServersConnectModal_ConnectButton", ImVec2(ImGui::GetWindowContentRegionWidth() / 2, 24)))
|
||||
{
|
||||
m_szHiddenServerRequestMessage.clear();
|
||||
ServerListing server;
|
||||
bool result = g_pR5net->GetServerByToken(server, m_szHiddenServerRequestMessage, m_szHiddenServerToken); // Send token connect request.
|
||||
if (!server.svServerName.empty())
|
||||
{
|
||||
ConnectToServer(server.svIpAddress, server.svPort, server.svEncryptionKey); // Connect to the server
|
||||
m_szHiddenServerRequestMessage = "Found Server: " + server.svServerName;
|
||||
m_ivHiddenServerMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_szHiddenServerRequestMessage = "Error: " + m_szHiddenServerRequestMessage;
|
||||
m_ivHiddenServerMessageColor = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Close##HiddenServersConnectModal_CloseButton", ImVec2(ImGui::GetWindowContentRegionWidth() / 2, 24)))
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the host section
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::HostServerSection()
|
||||
{
|
||||
static std::string szServerNameErr = "";
|
||||
|
||||
ImGui::InputTextWithHint("##ServerHost_ServerName", "Server Name (Required)", &m_Server.svServerName);
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::BeginCombo("Playlist##ServerHost_PlaylistBox", m_Server.svPlaylist.c_str()))
|
||||
{
|
||||
for (auto& item : g_szAllPlaylists)
|
||||
{
|
||||
if (ImGui::Selectable(item.c_str(), item == m_Server.svPlaylist))
|
||||
{
|
||||
m_Server.svPlaylist = item;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Map##ServerHost_MapListBox", m_Server.svMapName.c_str()))
|
||||
{
|
||||
for (auto& item : m_vszMapsList)
|
||||
{
|
||||
if (ImGui::Selectable(item.c_str(), item == m_Server.svMapName))
|
||||
{
|
||||
m_Server.svMapName = item;
|
||||
for (auto it = mapArray.begin(); it != mapArray.end(); ++it)
|
||||
{
|
||||
if (it->second.compare(m_Server.svMapName) == NULL)
|
||||
{
|
||||
m_Server.svMapName = it->first;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Load Global Ban List##ServerHost_CheckCompBanDBCheckbox", &g_bCheckCompBanDB);
|
||||
ImGui::Spacing();
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Server Visiblity");
|
||||
|
||||
if (ImGui::SameLine(); ImGui::RadioButton("Offline##ServerHost_ServerChoice1", eServerVisibility == EServerVisibility::OFFLINE))
|
||||
{
|
||||
eServerVisibility = EServerVisibility::OFFLINE;
|
||||
}
|
||||
if (ImGui::SameLine(); ImGui::RadioButton("Hidden##ServerHost_ServerChoice2", eServerVisibility == EServerVisibility::HIDDEN))
|
||||
{
|
||||
eServerVisibility = EServerVisibility::HIDDEN;
|
||||
}
|
||||
if (ImGui::SameLine(); ImGui::RadioButton("Public##ServerHost_ServerChoice2", eServerVisibility == EServerVisibility::PUBLIC))
|
||||
{
|
||||
eServerVisibility = EServerVisibility::PUBLIC;
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
|
||||
if (!g_pHostState->m_bActiveGame)
|
||||
{
|
||||
if (ImGui::Button("Start Server##ServerHost_StartServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
szServerNameErr.clear();
|
||||
if (!m_Server.svServerName.empty() && !m_Server.svPlaylist.empty() && !m_Server.svMapName.empty())
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "Starting Server with name '%s', map '%s' and playlist '%s'\n", m_Server.svServerName.c_str(), m_Server.svMapName.c_str(), m_Server.svPlaylist.c_str());
|
||||
szServerNameErr = std::string();
|
||||
UpdateHostingStatus();
|
||||
|
||||
/*
|
||||
* Playlist gets parsed in two instances, first in LoadPlaylist all the neccessary values.
|
||||
* Then when you would normally call launchplaylist which calls StartPlaylist it would cmd call mp_gamemode which parses the gamemode specific part of the playlist..
|
||||
*/
|
||||
KeyValues_LoadPlaylist(m_Server.svPlaylist.c_str());
|
||||
std::stringstream cgmd;
|
||||
cgmd << "mp_gamemode " << m_Server.svPlaylist;
|
||||
ProcessCommand(cgmd.str().c_str());
|
||||
|
||||
// This is to avoid a race condition.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
std::stringstream cmd;
|
||||
cmd << "map " << m_Server.svMapName;
|
||||
ProcessCommand(cmd.str().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Server.svServerName.empty())
|
||||
{
|
||||
szServerNameErr = "No Server Name assigned.";
|
||||
}
|
||||
else if (m_Server.svPlaylist.empty())
|
||||
{
|
||||
szServerNameErr = "No Playlist assigned.";
|
||||
}
|
||||
else if (m_Server.svMapName.empty())
|
||||
{
|
||||
szServerNameErr = "'levelname' was empty.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Force Start##ServerHost_ForceStart", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
szServerNameErr.clear();
|
||||
if (!m_Server.svPlaylist.empty() && !m_Server.svMapName.empty())
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "Starting Server with map '%s' and playlist '%s'\n", m_Server.svMapName.c_str(), m_Server.svPlaylist.c_str());
|
||||
szServerNameErr = std::string();
|
||||
UpdateHostingStatus();
|
||||
|
||||
/*
|
||||
* Playlist gets parsed in two instances, first in LoadPlaylist all the neccessary values.
|
||||
* Then when you would normally call launchplaylist which calls StartPlaylist it would cmd call mp_gamemode which parses the gamemode specific part of the playlist..
|
||||
*/
|
||||
KeyValues_LoadPlaylist(m_Server.svPlaylist.c_str());
|
||||
std::stringstream cgmd;
|
||||
cgmd << "mp_gamemode " << m_Server.svPlaylist;
|
||||
ProcessCommand(cgmd.str().c_str());
|
||||
|
||||
// This is to avoid a race condition.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
|
||||
std::stringstream cmd;
|
||||
cmd << "map " << m_Server.svMapName;
|
||||
ProcessCommand(cmd.str().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Server.svPlaylist.empty())
|
||||
{
|
||||
szServerNameErr = "No Playlist assigned.";
|
||||
}
|
||||
else if (m_Server.svMapName.empty())
|
||||
{
|
||||
szServerNameErr = "'levelname' was empty.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::TextColored(ImVec4(1.00f, 0.00f, 0.00f, 1.00f), szServerNameErr.c_str());
|
||||
ImGui::TextColored(m_iv4HostRequestMessageColor, m_szHostRequestMessage.c_str());
|
||||
if (!m_szHostToken.empty())
|
||||
{
|
||||
ImGui::InputText("##ServerHost_HostToken", &m_szHostToken, ImGuiInputTextFlags_ReadOnly);
|
||||
}
|
||||
|
||||
if (g_pHostState->m_bActiveGame)
|
||||
{
|
||||
if (ImGui::Button("Reload Scripts##ServerHost_ReloadServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
DevMsg(eDLL_T::ENGINE, "Recompiling scripts\n");
|
||||
ProcessCommand("reparse_weapons");
|
||||
ProcessCommand("reload");
|
||||
}
|
||||
|
||||
if (ImGui::Button("Change Level##ServerHost_ChangeLevel", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
if (!m_Server.svMapName.empty())
|
||||
{
|
||||
strncpy_s(g_pHostState->m_levelName, m_Server.svMapName.c_str(), 64); // Copy new map into hoststate levelname. 64 is size of m_levelname.
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_CHANGE_LEVEL_MP; // Force CHostState::FrameUpdate to change the level.
|
||||
}
|
||||
else
|
||||
{
|
||||
szServerNameErr = "Failed to change level: 'levelname' was empty.";
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Stop Server##ServerHost_StopServerButton", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
ProcessCommand("LeaveMatch"); // TODO: use script callback instead.
|
||||
g_pHostState->m_iNextState = HostStates_t::HS_GAME_SHUTDOWN; // Force CHostState::FrameUpdate to shutdown the server for dedicated.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui::Button("Reload Playlist from Disk##ServerHost_ReloadPlaylist", ImVec2(ImGui::GetWindowSize().x, 32)))
|
||||
{
|
||||
DownloadPlaylists_Callback();
|
||||
CKeyValueSystem_InitPlaylist(); // Re-Init playlist.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the settings section
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::SettingsSection()
|
||||
{
|
||||
ImGui::InputTextWithHint("Hostname##MatchmakingServerString", "Matchmaking Server String", &m_szMatchmakingHostName);
|
||||
if (ImGui::Button("Update Hostname"))
|
||||
{
|
||||
r5net_matchmaking_hostname->m_pzsCurrentValue = m_szMatchmakingHostName.c_str();
|
||||
if (g_pR5net)
|
||||
{
|
||||
delete g_pR5net;
|
||||
g_pR5net = new R5Net::Client(r5net_matchmaking_hostname->m_pzsCurrentValue);
|
||||
}
|
||||
}
|
||||
ImGui::InputText("Netkey##SettingsSection_EncKey", (char*)g_szNetKey.c_str(), ImGuiInputTextFlags_ReadOnly);
|
||||
if (ImGui::Button("Regenerate Encryption Key##SettingsSection_RegenEncKey"))
|
||||
{
|
||||
RegenerateEncryptionKey();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the main browser frontend
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::Draw(const char* title, bool* bDraw)
|
||||
{
|
||||
if (!m_bThemeSet)
|
||||
{
|
||||
SetStyleVar();
|
||||
m_bThemeSet = true;
|
||||
}
|
||||
if (!ImGui::Begin(title, bDraw))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
if (*bDraw == NULL)
|
||||
{
|
||||
g_bShowBrowser = false;
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(840, 600), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetWindowPos(ImVec2(-500, 50), ImGuiCond_FirstUseEver);
|
||||
|
||||
ImGui::Begin(title, NULL, ImGuiWindowFlags_NoScrollbar);
|
||||
{
|
||||
CompMenu();
|
||||
|
||||
switch (eCurrentSection)
|
||||
{
|
||||
case ESection::SERVER_BROWSER:
|
||||
ServerBrowserSection();
|
||||
break;
|
||||
case ESection::HOST_SERVER:
|
||||
HostServerSection();
|
||||
break;
|
||||
case ESection::SETTINGS:
|
||||
SettingsSection();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: executes submitted commands in a separate thread
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::ProcessCommand(const char* command_line)
|
||||
{
|
||||
std::thread t(IVEngineClient_CommandExecute, this, command_line);
|
||||
t.detach(); // Detach from render thread.
|
||||
|
||||
// This is to avoid a race condition.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: connects to specified server
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::ConnectToServer(const std::string ip, const std::string port, const std::string encKey)
|
||||
{
|
||||
if (!encKey.empty())
|
||||
{
|
||||
ChangeEncryptionKeyTo(encKey);
|
||||
}
|
||||
|
||||
std::stringstream cmd;
|
||||
cmd << "connect " << ip << ":" << port;
|
||||
ProcessCommand(cmd.str().c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: connects to specified server
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::ConnectToServer(const std::string connString, const std::string encKey)
|
||||
{
|
||||
if (!encKey.empty())
|
||||
{
|
||||
ChangeEncryptionKeyTo(encKey);
|
||||
}
|
||||
|
||||
std::stringstream cmd;
|
||||
cmd << "connect " << connString;
|
||||
ProcessCommand(cmd.str().c_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: regenerates encryption key
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::RegenerateEncryptionKey()
|
||||
{
|
||||
HNET_GenerateKey();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: changes encryption key to specified one
|
||||
//-----------------------------------------------------------------------------
|
||||
void IBrowser::ChangeEncryptionKeyTo(const std::string str)
|
||||
{
|
||||
HNET_SetKey(str);
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// ENTRYPOINT
|
||||
//#############################################################################
|
||||
|
||||
IBrowser* g_pServerBrowser = nullptr;
|
||||
void DrawBrowser(bool* bDraw)
|
||||
{
|
||||
static IBrowser browser;
|
||||
static bool AssignPtr = []()
|
||||
{
|
||||
g_pServerBrowser = &browser;
|
||||
return true;
|
||||
} ();
|
||||
browser.Draw("Server Browser", bDraw);
|
||||
}
|
173
r5dev/gameui/IBrowser.h
Normal file
173
r5dev/gameui/IBrowser.h
Normal file
@ -0,0 +1,173 @@
|
||||
#pragma once
|
||||
#ifndef DEDICATED
|
||||
#include "networksystem/serverlisting.h"
|
||||
#include "networksystem/r5net.h"
|
||||
|
||||
void DrawBrowser(bool* bDraw);
|
||||
|
||||
class IBrowser
|
||||
{
|
||||
private:
|
||||
bool m_bThemeSet = false;
|
||||
public:
|
||||
IBrowser();
|
||||
~IBrowser();
|
||||
|
||||
////////////////////
|
||||
// Enums //
|
||||
////////////////////
|
||||
enum class ESection
|
||||
{
|
||||
SERVER_BROWSER,
|
||||
HOST_SERVER,
|
||||
SETTINGS
|
||||
} eCurrentSection = ESection::SERVER_BROWSER;
|
||||
|
||||
enum class EHostStatus
|
||||
{
|
||||
NOT_HOSTING,
|
||||
HOSTING
|
||||
} eHostingStatus = EHostStatus::NOT_HOSTING;
|
||||
|
||||
enum class EServerVisibility
|
||||
{
|
||||
OFFLINE,
|
||||
HIDDEN,
|
||||
PUBLIC
|
||||
} eServerVisibility = EServerVisibility::OFFLINE;
|
||||
|
||||
////////////////////
|
||||
// Server Browser //
|
||||
////////////////////
|
||||
public:
|
||||
std::vector<ServerListing> m_vServerList;
|
||||
ImGuiTextFilter m_imServerBrowserFilter;
|
||||
char m_chServerConnStringBuffer[256] = { 0 };
|
||||
char m_chServerEncKeyBuffer[30] = { 0 };
|
||||
std::string m_szServerListMessage = std::string();
|
||||
|
||||
std::map<std::string, std::string> mapArray =
|
||||
{
|
||||
{ "mp_rr_canyonlands_64k_x_64k", "King's Canyon Season 0" },
|
||||
{ "mp_rr_desertlands_64k_x_64k", "World's Edge Season 3" },
|
||||
{ "mp_rr_canyonlands_mu1", "King's Canyon Season 2" },
|
||||
{ "mp_rr_canyonlands_mu1_night", "King's Canyon Season 2 After Dark" },
|
||||
{ "mp_rr_desertlands_64k_x_64k_nx", "World's Edge Season 3 After Dark" },
|
||||
{ "mp_lobby", "Lobby Season 3" },
|
||||
{ "mp_rr_canyonlands_staging", "King's Canyon Firing Range" }
|
||||
};
|
||||
|
||||
////////////////////
|
||||
// Settings //
|
||||
////////////////////
|
||||
std::string m_szMatchmakingHostName;
|
||||
|
||||
////////////////////
|
||||
// Host Server //
|
||||
////////////////////
|
||||
ServerListing m_Server;
|
||||
std::vector<std::string> m_vszMapsList;
|
||||
std::string m_szHostRequestMessage = "";
|
||||
std::string m_szHostToken = "";
|
||||
ImVec4 m_iv4HostRequestMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
|
||||
////////////////////
|
||||
// Private Server //
|
||||
////////////////////
|
||||
std::string m_szHiddenServerToken = "";
|
||||
std::string m_szHiddenServerRequestMessage = "";
|
||||
ImVec4 m_ivHiddenServerMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
||||
|
||||
/* Texture */
|
||||
ID3D11ShaderResourceView* m_idLockedIcon = nullptr;
|
||||
int m_nLockedIconWidth = 0;
|
||||
int m_nLockedIconHeight = 0;
|
||||
std::vector<unsigned char>* m_vucLockedIconBlob;
|
||||
|
||||
void SetSection(ESection section)
|
||||
{
|
||||
eCurrentSection = section;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Style //
|
||||
////////////////////
|
||||
void SetStyleVar()
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImVec4* colors = style.Colors;
|
||||
|
||||
colors[ImGuiCol_Text] = ImVec4(0.81f, 0.81f, 0.81f, 1.00f);
|
||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.56f, 0.56f, 0.56f, 1.00f);
|
||||
colors[ImGuiCol_WindowBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PopupBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_Border] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.04f, 0.04f, 0.04f, 0.64f);
|
||||
colors[ImGuiCol_FrameBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f);
|
||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.19f, 0.19f, 1.00f);
|
||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.24f, 0.24f, 0.24f, 1.00f);
|
||||
colors[ImGuiCol_TitleBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
|
||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_CheckMark] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_Button] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
|
||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
colors[ImGuiCol_Header] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_Separator] = ImVec4(0.53f, 0.53f, 0.57f, 1.00f);
|
||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_Tab] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f);
|
||||
colors[ImGuiCol_TabHovered] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||
colors[ImGuiCol_TabActive] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||
|
||||
style.WindowBorderSize = 0.0f;
|
||||
style.FrameBorderSize = 1.0f;
|
||||
style.ChildBorderSize = 1.0f;
|
||||
style.PopupBorderSize = 1.0f;
|
||||
style.TabBorderSize = 1.0f;
|
||||
|
||||
style.WindowRounding = 2.5f;
|
||||
style.FrameRounding = 0.0f;
|
||||
style.ChildRounding = 0.0f;
|
||||
style.PopupRounding = 0.0f;
|
||||
style.TabRounding = 1.0f;
|
||||
style.ScrollbarRounding = 1.0f;
|
||||
|
||||
style.ItemSpacing = ImVec2(4, 4);
|
||||
style.WindowPadding = ImVec2(5, 5);
|
||||
}
|
||||
|
||||
void RefreshServerList();
|
||||
void SendHostingPostRequest();
|
||||
void CompMenu();
|
||||
void ServerBrowserSection();
|
||||
void SettingsSection();
|
||||
void HiddenServersModal();
|
||||
void HostServerSection();
|
||||
void Draw(const char* title, bool* bDraw);
|
||||
void UpdateHostingStatus();
|
||||
void ProcessCommand(const char* command_line);
|
||||
|
||||
void RegenerateEncryptionKey();
|
||||
void ChangeEncryptionKeyTo(const std::string str);
|
||||
|
||||
void ConnectToServer(const std::string ip, const std::string port, const std::string encKey);
|
||||
void ConnectToServer(const std::string connString, const std::string encKey);
|
||||
};
|
||||
|
||||
extern IBrowser* g_pServerBrowser;
|
||||
#endif
|
408
r5dev/gameui/IConsole.cpp
Normal file
408
r5dev/gameui/IConsole.cpp
Normal file
@ -0,0 +1,408 @@
|
||||
#include "core/stdafx.h"
|
||||
#include "core/init.h"
|
||||
#include "tier0/cvar.h"
|
||||
#include "windows/id3dx.h"
|
||||
#include "windows/console.h"
|
||||
#include "gameui/IConsole.h"
|
||||
#include "client/IVEngineClient.h"
|
||||
|
||||
/******************************************************************************
|
||||
-------------------------------------------------------------------------------
|
||||
File : IConsole.cpp
|
||||
Date : 18:07:2021
|
||||
Author : Kawe Mazidjatari
|
||||
Purpose: Implements the in-game console frontend
|
||||
-------------------------------------------------------------------------------
|
||||
History:
|
||||
- 15:06:2021 | 14:56 : Created by Kawe Mazidjatari
|
||||
- 07:08:2021 | 15:22 : Multithread 'CommandExecute' operations to prevent deadlock in render thread
|
||||
- 07:08:2021 | 15:25 : Fix a race condition that occured when detaching the 'CommandExecute' thread
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CConsole::CConsole()
|
||||
{
|
||||
ClearLog();
|
||||
memset(m_szInputBuf, 0, sizeof(m_szInputBuf));
|
||||
|
||||
m_nHistoryPos = -1;
|
||||
m_bAutoScroll = true;
|
||||
m_bScrollToBottom = false;
|
||||
m_bThemeSet = false;
|
||||
|
||||
m_ivCommands.push_back("CLEAR");
|
||||
m_ivCommands.push_back("HELP");
|
||||
m_ivCommands.push_back("HISTORY");
|
||||
AddLog("[DEBUG] THREAD ID: %ld\n", g_dThreadId);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CConsole::~CConsole()
|
||||
{
|
||||
ClearLog();
|
||||
for (int i = 0; i < m_ivHistory.Size; i++)
|
||||
{
|
||||
free(m_ivHistory[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: draws the console frontend
|
||||
//-----------------------------------------------------------------------------
|
||||
void CConsole::Draw(const char* title, bool* bDraw)
|
||||
{
|
||||
bool copy_to_clipboard = false;
|
||||
static auto iConsoleConfig = &g_pImGuiConfig->IConsole_Config;
|
||||
static auto iBrowserConfig = &g_pImGuiConfig->IBrowser_Config;
|
||||
|
||||
if (!m_bThemeSet)
|
||||
{
|
||||
SetStyleVar();
|
||||
m_bThemeSet = true;
|
||||
}
|
||||
if (iConsoleConfig->m_bAutoClear && Items.Size > iConsoleConfig->m_nAutoClearLimit) // Check if Auto-Clear is enabled and if its above our limit.
|
||||
{
|
||||
ClearLog();
|
||||
m_ivHistory.clear();
|
||||
}
|
||||
|
||||
//ImGui::ShowStyleEditor();
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(1000, 600), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetWindowPos(ImVec2(-1000, 50), ImGuiCond_FirstUseEver);
|
||||
|
||||
if (!ImGui::Begin(title, bDraw))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
if (*bDraw == NULL)
|
||||
{
|
||||
g_bShowConsole = false;
|
||||
}
|
||||
|
||||
// Reserve enough left-over height and width for 1 separator + 1 input text
|
||||
const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
|
||||
const float footer_width_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetWindowWidth();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginPopup("Options"))
|
||||
{
|
||||
ImGui::Checkbox("Auto-Scroll", &m_bAutoScroll);
|
||||
|
||||
if (ImGui::Checkbox("Auto-Clear", &iConsoleConfig->m_bAutoClear))
|
||||
{
|
||||
g_pImGuiConfig->Save();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(100);
|
||||
|
||||
if (ImGui::InputInt("Limit##AutoClearAfterCertainIndexCGameConsole", &iConsoleConfig->m_nAutoClearLimit))
|
||||
{
|
||||
g_pImGuiConfig->Save();
|
||||
}
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (ImGui::SmallButton("Clear"))
|
||||
{
|
||||
ClearLog();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
copy_to_clipboard = ImGui::SmallButton("Copy");
|
||||
|
||||
ImGui::Text("Console Hotkey:");
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Hotkey("##OpenIConsoleBind0", &iConsoleConfig->m_nBind0, ImVec2(80, 80)))
|
||||
{
|
||||
g_pImGuiConfig->Save();
|
||||
}
|
||||
|
||||
ImGui::Text("Browser Hotkey:");
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Hotkey("##OpenIBrowserBind0", &iBrowserConfig->m_nBind0, ImVec2(80, 80)))
|
||||
{
|
||||
g_pImGuiConfig->Save();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if (ImGui::Button("Options"))
|
||||
{
|
||||
ImGui::OpenPopup("Options");
|
||||
}
|
||||
ImGui::SameLine();
|
||||
m_itFilter.Draw("Filter [\"-incl,-excl\"] [\"error\"]", footer_width_to_reserve - 500);
|
||||
ImGui::Separator();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), true, ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 4.f, 6.f });
|
||||
if (copy_to_clipboard)
|
||||
{
|
||||
ImGui::LogToClipboard();
|
||||
}
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
if (!m_itFilter.PassFilter(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////
|
||||
ImVec4 color;
|
||||
bool has_color = false;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// General
|
||||
if (strstr(item, "[INFO]")) { color = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); has_color = true; }
|
||||
if (strstr(item, "[ERROR]")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "[DEBUG]")) { color = ImVec4(0.00f, 0.30f, 1.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "[WARNING]")) { color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f); has_color = true; }
|
||||
if (strncmp(item, "# ", 2) == 0) { color = ImVec4(1.00f, 0.80f, 0.60f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Script virtual machines per game dll
|
||||
if (strstr(item, "Script(S):")) { color = ImVec4(0.59f, 0.58f, 0.73f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Script(C):")) { color = ImVec4(0.59f, 0.58f, 0.63f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Script(U):")) { color = ImVec4(0.59f, 0.48f, 0.53f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Native per game dll
|
||||
if (strstr(item, "Native(S):")) { color = ImVec4(0.59f, 0.58f, 0.73f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Native(C):")) { color = ImVec4(0.59f, 0.58f, 0.63f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Native(U):")) { color = ImVec4(0.59f, 0.48f, 0.53f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Native per sys dll
|
||||
if (strstr(item, "Native(E):")) { color = ImVec4(0.70f, 0.70f, 0.70f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Native(F):")) { color = ImVec4(0.32f, 0.64f, 0.72f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Native(R):")) { color = ImVec4(0.36f, 0.70f, 0.35f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "Native(M):")) { color = ImVec4(0.75f, 0.41f, 0.67f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Callbacks
|
||||
//if (strstr(item, "CodeCallback_")) { color = ImVec4(0.00f, 0.30f, 1.00f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Squirrel VM script errors
|
||||
if (strstr(item, ".gnut")) { color = ImVec4(1.00f, 1.00f, 1.00f, 0.60f); has_color = true; }
|
||||
if (strstr(item, ".nut")) { color = ImVec4(1.00f, 1.00f, 1.00f, 0.60f); has_color = true; }
|
||||
if (strstr(item, "[CLIENT]")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "[SERVER]")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "[UI]")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "SCRIPT ERROR")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "SCRIPT COMPILE")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, ".gnut #")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, ".nut #")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "): -> ")) { color = ImVec4(1.00f, 0.00f, 0.00f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Squirrel VM script debug
|
||||
if (strstr(item, "CALLSTACK")) { color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f); has_color = true; }
|
||||
if (strstr(item, "LOCALS")) { color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f); has_color = true; }
|
||||
if (strstr(item, "*FUNCTION")) { color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f); has_color = true; }
|
||||
if (strstr(item, "DIAGPRINTS")) { color = ImVec4(1.00f, 1.00f, 0.00f, 0.80f); has_color = true; }
|
||||
if (strstr(item, " File : ")) { color = ImVec4(0.00f, 0.30f, 1.00f, 1.00f); has_color = true; }
|
||||
if (strstr(item, "<><>GRX<><>")) { color = ImVec4(0.00f, 0.30f, 1.00f, 1.00f); has_color = true; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Filters
|
||||
//if (strstr(item, ") -> ")) { color = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); has_color = true; }
|
||||
|
||||
if (has_color) { ImGui::PushStyleColor(ImGuiCol_Text, color); }
|
||||
ImGui::TextWrapped(item);
|
||||
if (has_color) { ImGui::PopStyleColor(); }
|
||||
}
|
||||
if (copy_to_clipboard) { ImGui::LogFinish(); }
|
||||
|
||||
if (m_bScrollToBottom || (m_bAutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) { ImGui::SetScrollHereY(1.0f); }
|
||||
m_bScrollToBottom = false;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::EndChild();
|
||||
ImGui::Separator();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Console
|
||||
bool reclaim_focus = false;
|
||||
ImGui::PushItemWidth(footer_width_to_reserve - 80);
|
||||
if (ImGui::IsWindowAppearing()) { ImGui::SetKeyboardFocusHere(); }
|
||||
ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory;
|
||||
|
||||
if (ImGui::InputText("##input", m_szInputBuf, IM_ARRAYSIZE(m_szInputBuf), input_text_flags, &TextEditCallbackStub, (void*)this))
|
||||
{
|
||||
char* s = m_szInputBuf;
|
||||
const char* replace = "";
|
||||
if (strstr(m_szInputBuf, "`")) { strcpy_s(s, sizeof(replace), replace); }
|
||||
Strtrim(s);
|
||||
if (s[0]) { ProcessCommand(s); }
|
||||
strcpy_s(s, sizeof(replace), replace);
|
||||
reclaim_focus = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Submit"))
|
||||
{
|
||||
char* s = m_szInputBuf;
|
||||
const char* replace = "";
|
||||
if (s[0]) { ProcessCommand(s); }
|
||||
strcpy_s(s, sizeof(replace), replace);
|
||||
reclaim_focus = true;
|
||||
}
|
||||
|
||||
// Auto-focus on window apparition.
|
||||
ImGui::SetItemDefaultFocus();
|
||||
|
||||
// Auto focus previous widget.
|
||||
if (reclaim_focus)
|
||||
{
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: executes submitted commands in a separate thread
|
||||
//-----------------------------------------------------------------------------
|
||||
void CConsole::ProcessCommand(const char* command_line)
|
||||
{
|
||||
AddLog("# %s\n", command_line);
|
||||
|
||||
std::thread t(IVEngineClient_CommandExecute, this, command_line);
|
||||
t.detach(); // Detach from render thread.
|
||||
|
||||
// This is to avoid a race condition.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
||||
m_nHistoryPos = -1;
|
||||
for (int i = m_ivHistory.Size - 1; i >= 0; i--)
|
||||
{
|
||||
if (Stricmp(m_ivHistory[i], command_line) == 0)
|
||||
{
|
||||
delete m_ivHistory[i];
|
||||
m_ivHistory.erase(m_ivHistory.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_ivHistory.push_back(Strdup(command_line));
|
||||
if (Stricmp(command_line, "CLEAR") == 0)
|
||||
{
|
||||
ClearLog();
|
||||
}
|
||||
else if (Stricmp(command_line, "HELP") == 0)
|
||||
{
|
||||
AddLog("Frontend commands:");
|
||||
for (int i = 0; i < m_ivCommands.Size; i++)
|
||||
{
|
||||
AddLog("- %s", m_ivCommands[i]);
|
||||
}
|
||||
|
||||
AddLog("Log types:");
|
||||
AddLog("Script(S): = Server (Script VM)");
|
||||
AddLog("Script(C): = Client (Script VM)");
|
||||
AddLog("Script(U): = UI (Script VM)");
|
||||
|
||||
AddLog("Native(S): = Server dll (Code)");
|
||||
AddLog("Native(C): = Client dll (code)");
|
||||
AddLog("Native(U): = UI dll (code)");
|
||||
|
||||
AddLog("Native(E): = Engine dll (code)");
|
||||
AddLog("Native(F): = FileSystem dll (code)");
|
||||
AddLog("Native(R): = RTech dll (code)");
|
||||
AddLog("Native(M): = MaterialSystem dll (code)");
|
||||
}
|
||||
else if (Stricmp(command_line, "HISTORY") == 0)
|
||||
{
|
||||
int first = m_ivHistory.Size - 10;
|
||||
for (int i = first > 0 ? first : 0; i < m_ivHistory.Size; i++)
|
||||
{
|
||||
AddLog("%3d: %s\n", i, m_ivHistory[i]);
|
||||
}
|
||||
}
|
||||
|
||||
m_bScrollToBottom = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: text edit callback
|
||||
//-----------------------------------------------------------------------------
|
||||
int CConsole::TextEditCallback(ImGuiInputTextCallbackData* data)
|
||||
{
|
||||
switch (data->EventFlag)
|
||||
{
|
||||
case ImGuiInputTextFlags_CallbackCompletion:
|
||||
{
|
||||
// Locate beginning of current word.
|
||||
const char* word_end = data->Buf + data->CursorPos;
|
||||
const char* word_start = word_end;
|
||||
while (word_start > data->Buf)
|
||||
{
|
||||
const char c = word_start[-1];
|
||||
if (c == ' ' || c == '\t' || c == ',' || c == ';')
|
||||
{
|
||||
break;
|
||||
}
|
||||
word_start--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ImGuiInputTextFlags_CallbackHistory:
|
||||
{
|
||||
const int prev_history_pos = m_nHistoryPos;
|
||||
if (data->EventKey == ImGuiKey_UpArrow)
|
||||
{
|
||||
if (m_nHistoryPos == -1) { m_nHistoryPos = m_ivHistory.Size - 1; }
|
||||
else if (m_nHistoryPos > 0) { m_nHistoryPos--; }
|
||||
}
|
||||
else if (data->EventKey == ImGuiKey_DownArrow)
|
||||
{
|
||||
if (m_nHistoryPos != -1)
|
||||
{
|
||||
if (++m_nHistoryPos >= m_ivHistory.Size)
|
||||
{
|
||||
m_nHistoryPos = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (prev_history_pos != m_nHistoryPos)
|
||||
{
|
||||
const char* history_str = (m_nHistoryPos >= 0) ? m_ivHistory[m_nHistoryPos] : "";
|
||||
data->DeleteChars(0, data->BufTextLen);
|
||||
data->InsertChars(0, history_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
// ENTRYPOINT
|
||||
//#############################################################################
|
||||
|
||||
CConsole* g_GameConsole = nullptr;
|
||||
void DrawConsole(bool* bDraw)
|
||||
{
|
||||
static CConsole console;
|
||||
static bool AssignPtr = []()
|
||||
{
|
||||
g_GameConsole = &console;
|
||||
return true;
|
||||
} ();
|
||||
console.Draw("Console", bDraw);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
@ -1,40 +1,42 @@
|
||||
#pragma once
|
||||
#include "gui_utility.h"
|
||||
#ifndef DEDICATED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization
|
||||
void DrawConsole(bool* bDraw);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
extern ImVector<char*> Items;
|
||||
inline ImVector<char*> Items;
|
||||
|
||||
class CGameConsole
|
||||
class CConsole
|
||||
{
|
||||
private:
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
char InputBuf[256] = { 0 };
|
||||
ImVector<const char*> Commands;
|
||||
ImVector<char*> History;
|
||||
int HistoryPos = -1;
|
||||
ImGuiTextFilter Filter;
|
||||
bool AutoScroll = true;
|
||||
bool ScrollToBottom = false;
|
||||
bool ThemeSet = false;
|
||||
char m_szInputBuf[256] = { 0 };
|
||||
ImVector<const char*> m_ivCommands;
|
||||
ImVector<char*> m_ivHistory;
|
||||
int m_nHistoryPos = -1;
|
||||
ImGuiTextFilter m_itFilter;
|
||||
bool m_bAutoScroll = true;
|
||||
bool m_bScrollToBottom = false;
|
||||
bool m_bThemeSet = false;
|
||||
|
||||
public:
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CGameConsole();
|
||||
~CGameConsole();
|
||||
CConsole();
|
||||
~CConsole();
|
||||
|
||||
void Draw(const char* title);
|
||||
void Draw(const char* title, bool* bDraw);
|
||||
void ProcessCommand(const char* command_line);
|
||||
void ExecCommand(const char* command_line);
|
||||
int TextEditCallback(ImGuiInputTextCallbackData* data);
|
||||
bool ShouldPrintToCommandPrompt() { return g_GuiConfig.CGameConsoleConfig.printCmd; };
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// History
|
||||
static int TextEditCallbackStub(ImGuiInputTextCallbackData* data)
|
||||
{
|
||||
CGameConsole* console = (CGameConsole*)data->UserData;
|
||||
CConsole* console = (CConsole*)data->UserData;
|
||||
return console->TextEditCallback(data);
|
||||
}
|
||||
|
||||
@ -42,9 +44,9 @@ public:
|
||||
// Utility
|
||||
void ClearLog()
|
||||
{
|
||||
for (int i = 0; i < Items.Size; i++) { free(Items[i]); }
|
||||
Items.clear();
|
||||
}
|
||||
|
||||
void AddLog(const char* fmt, ...) IM_FMTARGS(2)
|
||||
{
|
||||
char buf[1024];
|
||||
@ -118,4 +120,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
extern CGameConsole* g_GameConsole;
|
||||
extern CConsole* g_GameConsole;
|
||||
#endif // !DEDICATED
|
@ -1,163 +0,0 @@
|
||||
#pragma once
|
||||
#include "gui_utility.h"
|
||||
#include "r5net.h"
|
||||
|
||||
class CCompanion
|
||||
{
|
||||
private:
|
||||
bool ThemeSet = false;
|
||||
public:
|
||||
CCompanion();
|
||||
~CCompanion();
|
||||
|
||||
////////////////////
|
||||
// Enums //
|
||||
////////////////////
|
||||
enum class ESection {
|
||||
ServerBrowser,
|
||||
HostServer,
|
||||
Settings
|
||||
} CurrentSection = ESection::ServerBrowser;
|
||||
|
||||
enum class EHostStatus {
|
||||
NotHosting,
|
||||
Hosting
|
||||
} HostingStatus = EHostStatus::NotHosting;
|
||||
|
||||
enum class EServerVisibility {
|
||||
Offline,
|
||||
Hidden,
|
||||
Public
|
||||
} ServerVisibility = EServerVisibility::Offline;
|
||||
|
||||
////////////////////
|
||||
// Server Browser //
|
||||
////////////////////
|
||||
private:
|
||||
R5Net::Client* r5net = nullptr;
|
||||
public:
|
||||
R5Net::Client* GetR5Net() { return r5net; }
|
||||
|
||||
std::vector<ServerListing> ServerList;
|
||||
ImGuiTextFilter ServerBrowserFilter;
|
||||
char ServerConnStringBuffer[256] = { 0 };
|
||||
char ServerEncKeyBuffer[30] = { 0 };
|
||||
std::string ServerListMessage = std::string();
|
||||
|
||||
////////////////////
|
||||
// Settings //
|
||||
////////////////////
|
||||
std::string MatchmakingServerStringBuffer;
|
||||
|
||||
////////////////////
|
||||
// Host Server //
|
||||
////////////////////
|
||||
ServerListing MyServer;
|
||||
std::vector<std::string> MapsList;
|
||||
std::string HostRequestMessage = "";
|
||||
std::string HostToken = "";
|
||||
ImVec4 HostRequestMessageColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
bool StartAsDedi = false;
|
||||
bool OverridePlaylist = false;
|
||||
|
||||
////////////////////
|
||||
// Private Server //
|
||||
////////////////////
|
||||
std::string HiddenServerToken = "";
|
||||
std::string HiddenServerRequestMessage = "";
|
||||
ImVec4 HiddenServerMessageColor = ImVec4(0.00f, 1.00f, 0.00f, 1.00f);
|
||||
|
||||
/* Texture */
|
||||
ID3D11ShaderResourceView* ApexLockIcon = nullptr;
|
||||
int ApexLockIconWidth = 48;
|
||||
int ApexLockIconHeight = 48;
|
||||
|
||||
void SetSection(ESection section)
|
||||
{
|
||||
CurrentSection = section;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Style //
|
||||
////////////////////
|
||||
void SetStyleVar()
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImVec4* colors = style.Colors;
|
||||
|
||||
colors[ImGuiCol_Text] = ImVec4(0.81f, 0.81f, 0.81f, 1.00f);
|
||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.56f, 0.56f, 0.56f, 1.00f);
|
||||
colors[ImGuiCol_WindowBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PopupBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_Border] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.04f, 0.04f, 0.04f, 0.64f);
|
||||
colors[ImGuiCol_FrameBg] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f);
|
||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.19f, 0.19f, 1.00f);
|
||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.24f, 0.24f, 0.24f, 1.00f);
|
||||
colors[ImGuiCol_TitleBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
|
||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f);
|
||||
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_CheckMark] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrab] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_Button] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
|
||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
colors[ImGuiCol_Header] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_Separator] = ImVec4(0.53f, 0.53f, 0.57f, 1.00f);
|
||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.53f, 0.53f, 0.53f, 1.00f);
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.63f, 0.63f, 0.63f, 1.00f);
|
||||
colors[ImGuiCol_Tab] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f);
|
||||
colors[ImGuiCol_TabHovered] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||
colors[ImGuiCol_TabActive] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||
|
||||
style.WindowBorderSize = 0.0f;
|
||||
style.FrameBorderSize = 1.0f;
|
||||
style.ChildBorderSize = 1.0f;
|
||||
style.PopupBorderSize = 1.0f;
|
||||
style.TabBorderSize = 1.0f;
|
||||
|
||||
style.WindowRounding = 2.5f;
|
||||
style.FrameRounding = 0.0f;
|
||||
style.ChildRounding = 0.0f;
|
||||
style.PopupRounding = 0.0f;
|
||||
style.TabRounding = 1.0f;
|
||||
style.ScrollbarRounding = 1.0f;
|
||||
|
||||
style.ItemSpacing = ImVec2(4, 4);
|
||||
style.WindowPadding = ImVec2(5, 5);
|
||||
}
|
||||
|
||||
void RefreshServerList();
|
||||
void SendHostingPostRequest();
|
||||
void CompMenu();
|
||||
void ServerBrowserSection();
|
||||
void SettingsSection();
|
||||
void HiddenServersModal();
|
||||
void HostServerSection();
|
||||
void Draw(const char* title);
|
||||
void UpdateHostingStatus();
|
||||
void ProcessCommand(const char* command_line);
|
||||
void ExecCommand(const char* command_line);
|
||||
|
||||
void RegenerateEncryptionKey();
|
||||
void ChangeEncryptionKeyTo(const std::string str);
|
||||
|
||||
void ConnectToServer(const std::string ip, const std::string port, const std::string encKey);
|
||||
void ConnectToServer(const std::string connString, const std::string encKey);
|
||||
};
|
||||
|
||||
extern CCompanion* g_ServerBrowser;
|
||||
|
||||
extern bool g_CheckCompBanDB;
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization
|
||||
void SetupConsole();
|
@ -1,790 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/* Enumerations */
|
||||
enum class D3D11DeviceVTbl : short
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface = 0,
|
||||
AddRef = 1,
|
||||
Release = 2,
|
||||
|
||||
// ID3D11Device
|
||||
CreateBuffer = 3,
|
||||
CreateTexture1D = 4,
|
||||
CreateTexture2D = 5,
|
||||
CreateTexture3D = 6,
|
||||
CreateShaderResourceView = 7,
|
||||
CreateUnorderedAccessView = 8,
|
||||
CreateRenderTargetView = 9,
|
||||
CreateDepthStencilView = 10,
|
||||
CreateInputLayout = 11,
|
||||
CreateVertexShader = 12,
|
||||
CreateGeometryShader = 13,
|
||||
CreateGeometryShaderWithStreamOutput = 14,
|
||||
CreatePixelShader = 15,
|
||||
CreateHullShader = 16,
|
||||
CreateDomainShader = 17,
|
||||
CreateComputeShader = 18,
|
||||
CreateClassLinkage = 19,
|
||||
CreateBlendState = 20,
|
||||
CreateDepthStencilState = 21,
|
||||
CreateRasterizerState = 22,
|
||||
CreateSamplerState = 23,
|
||||
CreateQuery = 24,
|
||||
CreatePredicate = 25,
|
||||
CreateCounter = 26,
|
||||
CreateDeferredContext = 27,
|
||||
OpenSharedResource = 28,
|
||||
CheckFormatSupport = 29,
|
||||
CheckMultisampleQualityLevels = 30,
|
||||
CheckCounterInfo = 31,
|
||||
CheckCounter = 32,
|
||||
CheckFeatureSupport = 33,
|
||||
GetPrivateData = 34,
|
||||
SetPrivateData = 35,
|
||||
SetPrivateDataInterface = 36,
|
||||
GetFeatureLevel = 37,
|
||||
GetCreationFlags = 38,
|
||||
GetDeviceRemovedReason = 39,
|
||||
GetImmediateContext = 40,
|
||||
SetExceptionMode = 41,
|
||||
GetExceptionMode = 42,
|
||||
};
|
||||
|
||||
enum class DXGISwapChainVTbl : short
|
||||
{
|
||||
// IUnknown
|
||||
QueryInterface = 0,
|
||||
AddRef = 1,
|
||||
Release = 2,
|
||||
|
||||
// IDXGIObject
|
||||
SetPrivateData = 3,
|
||||
SetPrivateDataInterface = 4,
|
||||
GetPrivateData = 5,
|
||||
GetParent = 6,
|
||||
|
||||
// IDXGIDeviceSubObject
|
||||
GetDevice = 7,
|
||||
|
||||
// IDXGISwapChain
|
||||
Present = 8,
|
||||
GetBuffer = 9,
|
||||
SetFullscreenState = 10,
|
||||
GetFullscreenState = 11,
|
||||
GetDesc = 12,
|
||||
ResizeBuffers = 13,
|
||||
ResizeTarget = 14,
|
||||
GetContainingOutput = 15,
|
||||
GetFrameStatistics = 16,
|
||||
GetLastPresentCount = 17,
|
||||
};
|
||||
|
||||
#define MAX_SPLITSCREEN_CLIENT_BITS 2
|
||||
#define MAX_SPLITSCREEN_CLIENTS ( 1 << MAX_SPLITSCREEN_CLIENT_BITS ) // 4
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_JOYSTICKS = MAX_SPLITSCREEN_CLIENTS,
|
||||
MOUSE_BUTTON_COUNT = 5,
|
||||
};
|
||||
|
||||
enum JoystickAxis_t
|
||||
{
|
||||
JOY_AXIS_X = 0,
|
||||
JOY_AXIS_Y,
|
||||
JOY_AXIS_Z,
|
||||
JOY_AXIS_R,
|
||||
JOY_AXIS_U,
|
||||
JOY_AXIS_V,
|
||||
MAX_JOYSTICK_AXES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
JOYSTICK_MAX_BUTTON_COUNT = 32,
|
||||
JOYSTICK_POV_BUTTON_COUNT = 4,
|
||||
JOYSTICK_AXIS_BUTTON_COUNT = MAX_JOYSTICK_AXES * 2,
|
||||
};
|
||||
|
||||
#define JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_BUTTON + ((_joystick) * JOYSTICK_MAX_BUTTON_COUNT) + (_button) )
|
||||
#define JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_POV_BUTTON + ((_joystick) * JOYSTICK_POV_BUTTON_COUNT) + (_button) )
|
||||
#define JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) ( JOYSTICK_FIRST_AXIS_BUTTON + ((_joystick) * JOYSTICK_AXIS_BUTTON_COUNT) + (_button) )
|
||||
|
||||
#define JOYSTICK_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
#define JOYSTICK_POV_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_POV_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
#define JOYSTICK_AXIS_BUTTON( _joystick, _button ) ( (ButtonCode_t)JOYSTICK_AXIS_BUTTON_INTERNAL( _joystick, _button ) )
|
||||
|
||||
enum ButtonCode_t
|
||||
{
|
||||
BUTTON_CODE_INVALID = -1,
|
||||
BUTTON_CODE_NONE = 0,
|
||||
|
||||
KEY_FIRST = 0,
|
||||
|
||||
KEY_NONE = KEY_FIRST,
|
||||
KEY_0,
|
||||
KEY_1,
|
||||
KEY_2,
|
||||
KEY_3,
|
||||
KEY_4,
|
||||
KEY_5,
|
||||
KEY_6,
|
||||
KEY_7,
|
||||
KEY_8,
|
||||
KEY_9,
|
||||
KEY_A,
|
||||
KEY_B,
|
||||
KEY_C,
|
||||
KEY_D,
|
||||
KEY_E,
|
||||
KEY_F,
|
||||
KEY_G,
|
||||
KEY_H,
|
||||
KEY_I,
|
||||
KEY_J,
|
||||
KEY_K,
|
||||
KEY_L,
|
||||
KEY_M,
|
||||
KEY_N,
|
||||
KEY_O,
|
||||
KEY_P,
|
||||
KEY_Q,
|
||||
KEY_R,
|
||||
KEY_S,
|
||||
KEY_T,
|
||||
KEY_U,
|
||||
KEY_V,
|
||||
KEY_W,
|
||||
KEY_X,
|
||||
KEY_Y,
|
||||
KEY_Z,
|
||||
KEY_PAD_0,
|
||||
KEY_PAD_1,
|
||||
KEY_PAD_2,
|
||||
KEY_PAD_3,
|
||||
KEY_PAD_4,
|
||||
KEY_PAD_5,
|
||||
KEY_PAD_6,
|
||||
KEY_PAD_7,
|
||||
KEY_PAD_8,
|
||||
KEY_PAD_9,
|
||||
KEY_PAD_DIVIDE,
|
||||
KEY_PAD_MULTIPLY,
|
||||
KEY_PAD_MINUS,
|
||||
KEY_PAD_PLUS,
|
||||
KEY_PAD_ENTER,
|
||||
KEY_PAD_DECIMAL,
|
||||
KEY_LBRACKET,
|
||||
KEY_RBRACKET,
|
||||
KEY_SEMICOLON,
|
||||
KEY_APOSTROPHE,
|
||||
KEY_BACKQUOTE,
|
||||
KEY_COMMA,
|
||||
KEY_PERIOD,
|
||||
KEY_SLASH,
|
||||
KEY_BACKSLASH,
|
||||
KEY_MINUS,
|
||||
KEY_EQUAL,
|
||||
KEY_ENTER,
|
||||
KEY_SPACE,
|
||||
KEY_BACKSPACE,
|
||||
KEY_TAB,
|
||||
KEY_CAPSLOCK,
|
||||
KEY_NUMLOCK,
|
||||
KEY_ESCAPE,
|
||||
KEY_SCROLLLOCK,
|
||||
KEY_INSERT,
|
||||
KEY_DELETE,
|
||||
KEY_HOME,
|
||||
KEY_END,
|
||||
KEY_PAGEUP,
|
||||
KEY_PAGEDOWN,
|
||||
KEY_BREAK,
|
||||
KEY_LSHIFT,
|
||||
KEY_RSHIFT,
|
||||
KEY_LALT,
|
||||
KEY_RALT,
|
||||
KEY_LCONTROL,
|
||||
KEY_RCONTROL,
|
||||
KEY_LWIN,
|
||||
KEY_RWIN,
|
||||
KEY_APP,
|
||||
KEY_UP,
|
||||
KEY_LEFT,
|
||||
KEY_DOWN,
|
||||
KEY_RIGHT,
|
||||
KEY_F1,
|
||||
KEY_F2,
|
||||
KEY_F3,
|
||||
KEY_F4,
|
||||
KEY_F5,
|
||||
KEY_F6,
|
||||
KEY_F7,
|
||||
KEY_F8,
|
||||
KEY_F9,
|
||||
KEY_F10,
|
||||
KEY_F11,
|
||||
KEY_F12,
|
||||
KEY_CAPSLOCKTOGGLE,
|
||||
KEY_NUMLOCKTOGGLE,
|
||||
KEY_SCROLLLOCKTOGGLE,
|
||||
|
||||
KEY_LAST = KEY_SCROLLLOCKTOGGLE,
|
||||
KEY_COUNT = KEY_LAST - KEY_FIRST + 1,
|
||||
|
||||
// Mouse
|
||||
MOUSE_FIRST = KEY_LAST + 1,
|
||||
|
||||
MOUSE_LEFT = MOUSE_FIRST,
|
||||
MOUSE_RIGHT,
|
||||
MOUSE_MIDDLE,
|
||||
MOUSE_4,
|
||||
MOUSE_5,
|
||||
MOUSE_WHEEL_UP, // A fake button which is 'pressed' and 'released' when the wheel is moved up
|
||||
MOUSE_WHEEL_DOWN, // A fake button which is 'pressed' and 'released' when the wheel is moved down
|
||||
|
||||
MOUSE_LAST = MOUSE_WHEEL_DOWN,
|
||||
MOUSE_COUNT = MOUSE_LAST - MOUSE_FIRST + 1,
|
||||
|
||||
// Joystick
|
||||
JOYSTICK_FIRST = MOUSE_LAST + 1,
|
||||
|
||||
JOYSTICK_FIRST_BUTTON = JOYSTICK_FIRST,
|
||||
JOYSTICK_LAST_BUTTON = JOYSTICK_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_MAX_BUTTON_COUNT - 1),
|
||||
JOYSTICK_FIRST_POV_BUTTON,
|
||||
JOYSTICK_LAST_POV_BUTTON = JOYSTICK_POV_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_POV_BUTTON_COUNT - 1),
|
||||
JOYSTICK_FIRST_AXIS_BUTTON,
|
||||
JOYSTICK_LAST_AXIS_BUTTON = JOYSTICK_AXIS_BUTTON_INTERNAL(MAX_JOYSTICKS - 1, JOYSTICK_AXIS_BUTTON_COUNT - 1),
|
||||
|
||||
JOYSTICK_LAST = JOYSTICK_LAST_AXIS_BUTTON,
|
||||
|
||||
BUTTON_CODE_LAST,
|
||||
BUTTON_CODE_COUNT = BUTTON_CODE_LAST - KEY_FIRST + 1,
|
||||
|
||||
// Helpers for XBox 360
|
||||
KEY_XBUTTON_UP = JOYSTICK_FIRST_POV_BUTTON, // POV buttons
|
||||
KEY_XBUTTON_RIGHT,
|
||||
KEY_XBUTTON_DOWN,
|
||||
KEY_XBUTTON_LEFT,
|
||||
|
||||
KEY_XBUTTON_A = JOYSTICK_FIRST_BUTTON, // Buttons
|
||||
KEY_XBUTTON_B,
|
||||
KEY_XBUTTON_X,
|
||||
KEY_XBUTTON_Y,
|
||||
KEY_XBUTTON_LEFT_SHOULDER,
|
||||
KEY_XBUTTON_RIGHT_SHOULDER,
|
||||
KEY_XBUTTON_BACK,
|
||||
KEY_XBUTTON_START,
|
||||
KEY_XBUTTON_STICK1,
|
||||
KEY_XBUTTON_STICK2,
|
||||
KEY_XBUTTON_INACTIVE_START,
|
||||
|
||||
KEY_XSTICK1_RIGHT = JOYSTICK_FIRST_AXIS_BUTTON, // XAXIS POSITIVE
|
||||
KEY_XSTICK1_LEFT, // XAXIS NEGATIVE
|
||||
KEY_XSTICK1_DOWN, // YAXIS POSITIVE
|
||||
KEY_XSTICK1_UP, // YAXIS NEGATIVE
|
||||
KEY_XBUTTON_LTRIGGER, // ZAXIS POSITIVE
|
||||
KEY_XBUTTON_RTRIGGER, // ZAXIS NEGATIVE
|
||||
KEY_XSTICK2_RIGHT, // UAXIS POSITIVE
|
||||
KEY_XSTICK2_LEFT, // UAXIS NEGATIVE
|
||||
KEY_XSTICK2_DOWN, // VAXIS POSITIVE
|
||||
KEY_XSTICK2_UP, // VAXIS NEGATIVE
|
||||
};
|
||||
|
||||
// Buttons are not confirmed to be the same. They have been always the same throughout the source engine. Lets hope they did not change them.
|
||||
|
||||
enum KeyValuesTypes
|
||||
{
|
||||
TYPE_NONE = 0x0,
|
||||
TYPE_STRING = 0x1,
|
||||
TYPE_INT = 0x2,
|
||||
TYPE_FLOAT = 0x3,
|
||||
TYPE_PTR = 0x4,
|
||||
TYPE_WSTRING = 0x5,
|
||||
TYPE_COLOR = 0x6,
|
||||
TYPE_UINT64 = 0x7,
|
||||
TYPE_COMPILED_INT_BYTE = 0x8,
|
||||
TYPE_COMPILED_INT_0 = 0x9,
|
||||
TYPE_COMPILED_INT_1 = 0xA,
|
||||
TYPE_NUMTYPES = 0xB,
|
||||
};
|
||||
|
||||
enum ClientFrameStage_t
|
||||
{
|
||||
FRAME_UNDEFINED = -1, // (haven't run any frames yet)
|
||||
FRAME_START,
|
||||
|
||||
// A network packet is being recieved
|
||||
FRAME_NET_UPDATE_START,
|
||||
// Data has been received and we're going to start calling PostDataUpdate
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
|
||||
// Data has been received and we've called PostDataUpdate on all data recipients
|
||||
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
|
||||
// We've received all packets, we can now do interpolation, prediction, etc..
|
||||
FRAME_NET_UPDATE_END,
|
||||
|
||||
// We're about to start rendering the scene
|
||||
FRAME_RENDER_START,
|
||||
// We've finished rendering the scene.
|
||||
FRAME_RENDER_END,
|
||||
|
||||
FRAME_NET_FULL_FRAME_UPDATE_ON_REMOVE
|
||||
};
|
||||
|
||||
enum class HostStates_t : int
|
||||
{
|
||||
HS_NEW_GAME = 0x0,
|
||||
HS_LOAD_GAME = 0x1,
|
||||
HS_CHANGE_LEVEL_SP = 0x2,
|
||||
HS_CHANGE_LEVEL_MP = 0x3,
|
||||
HS_RUN = 0x4,
|
||||
HS_GAME_SHUTDOWN = 0x5,
|
||||
HS_SHUTDOWN = 0x6,
|
||||
HS_RESTART = 0x7,
|
||||
};
|
||||
|
||||
enum SIGNONSTATE
|
||||
{
|
||||
SIGNONSTATE_NONE = 0, // no state yet; about to connect
|
||||
SIGNONSTATE_CHALLENGE = 1, // client challenging server; all OOB packets
|
||||
SIGNONSTATE_CONNECTED = 2, // client is connected to server; netchans ready
|
||||
SIGNONSTATE_NEW = 3, // just got serverinfo and string tables
|
||||
SIGNONSTATE_PRESPAWN = 4, // received signon buffers
|
||||
SIGNONSTATE_GETTING_DATA = 5, // getting persistence data I assume?
|
||||
SIGNONSTATE_SPAWN = 6, // ready to receive entity packets
|
||||
SIGNONSTATE_FIRST_SNAP = 7, // ???
|
||||
SIGNONSTATE_FULL = 8, // we are fully connected; first non-delta packet received
|
||||
SIGNONSTATE_CHANGELEVEL = 9, // server is changing level; please wait
|
||||
};
|
||||
|
||||
enum FileWarningLevel_t
|
||||
{
|
||||
FILESYSTEM_WARNING = -1,
|
||||
FILESYSTEM_WARNING_QUIET = 0,
|
||||
FILESYSTEM_WARNING_REPORTUNCLOSED,
|
||||
FILESYSTEM_WARNING_REPORTUSAGE,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_READ,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_READWRITE,
|
||||
FILESYSTEM_WARNING_REPORTALLACCESSES_ASYNC
|
||||
};
|
||||
|
||||
#define FCVAR_NONE 0
|
||||
|
||||
// Command to ConVars and ConCommands
|
||||
// ConVar Systems
|
||||
#define FCVAR_UNREGISTERED (1<<0) // If this is set, don't add to linked list, etc.
|
||||
#define FCVAR_DEVELOPMENTONLY (1<<1) // Hidden in released products. Flag is removed automatically if ALLOW_DEVELOPMENT_CVARS is defined.
|
||||
#define FCVAR_GAMEDLL (1<<2) // defined by the game DLL
|
||||
#define FCVAR_CLIENTDLL (1<<3) // defined by the client DLL
|
||||
#define FCVAR_HIDDEN (1<<4) // Hidden. Doesn't appear in find or auto complete. Like DEVELOPMENTONLY, but can't be compiled out.
|
||||
|
||||
// ConVar only
|
||||
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
||||
#define FCVAR_ARCHIVE (1<<7) // set to cause it to be saved to vars.rc
|
||||
#define FCVAR_NOTIFY (1<<8) // notifies players when changed
|
||||
#define FCVAR_USERINFO (1<<9) // changes the client's info string
|
||||
|
||||
#define FCVAR_PRINTABLEONLY (1<<10) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
|
||||
#define FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS (1<<10) // When on concommands this allows remote clients to execute this cmd on the server.
|
||||
// We are changing the default behavior of concommands to disallow execution by remote clients without
|
||||
// this flag due to the number existing concommands that can lag or crash the server when clients abuse them.
|
||||
|
||||
#define FCVAR_UNLOGGED (1<<11) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
#define FCVAR_NEVER_AS_STRING (1<<12) // never try to print that cvar
|
||||
|
||||
// It's a ConVar that's shared between the client and the server.
|
||||
// At signon, the values of all such ConVars are sent from the server to the client (skipped for local
|
||||
// client, of course )
|
||||
// If a change is requested it must come from the console (i.e., no remote client changes)
|
||||
// If a value is changed while a server is active, it's replicated to all connected clients
|
||||
#define FCVAR_REPLICATED (1<<13) // server setting enforced on clients, TODO rename to FCAR_SERVER at some time
|
||||
#define FCVAR_CHEAT (1<<14) // Only useable in singleplayer / debug / multiplayer & sv_cheats
|
||||
#define FCVAR_SS (1<<15) // causes varnameN where N == 2 through max splitscreen slots for mod to be autogenerated
|
||||
#define FCVAR_DEMO (1<<16) // record this cvar when starting a demo file
|
||||
#define FCVAR_DONTRECORD (1<<17) // don't record these command in demofiles
|
||||
#define FCVAR_SS_ADDED (1<<18) // This is one of the "added" FCVAR_SS variables for the splitscreen players
|
||||
#define FCVAR_RELEASE (1<<19) // Cvars tagged with this are the only cvars avaliable to customers
|
||||
#define FCVAR_RELOAD_MATERIALS (1<<20) // If this cvar changes, it forces a material reload
|
||||
#define FCVAR_RELOAD_TEXTURES (1<<21) // If this cvar changes, if forces a texture reload
|
||||
|
||||
#define FCVAR_NOT_CONNECTED (1<<22) // cvar cannot be changed by a client that is connected to a server
|
||||
#define FCVAR_MATERIAL_SYSTEM_THREAD (1<<23) // Indicates this cvar is read from the material system thread
|
||||
#define FCVAR_ARCHIVE_GAMECONSOLE (1<<24) // cvar written to config.cfg on the Xbox
|
||||
|
||||
#define FCVAR_SERVER_CAN_EXECUTE (1<<28)// the server is allowed to execute this command on clients via ClientCommand/NET_StringCmd/CBaseClientState::ProcessStringCmd.
|
||||
#define FCVAR_SERVER_CANNOT_QUERY (1<<29)// If this is set, then the server is not allowed to query this cvar's value (via IServerPluginHelpers::StartQueryCvarValue).
|
||||
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
|
||||
|
||||
#define MAX_PLAYERS 128 // Max R5 players.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR 0xA0000000 ///< Add this to your error code to get an error. Bit 29 is set to distinguish Origin error codes from system error codes.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING 0x40000000 ///< Add this to your warning code to get a warning. Bit 29 is set to distinguish Origin warning codes from system warnings codes.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_GENERAL 0x00000000 ///< Add this to your error to get a general error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_SDK (1<<16) ///< Add this to your error to get an SDK error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_CORE (2<<16) ///< Add this to your error to get a core error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_IGO (3<<16) ///< Add this to your error to get an IGO error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_FRIENDS (4<<16) ///< Add this to your error to get a friends error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_PRESENCE (5<<16) ///< Add this to your error to get a presence error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_COMMERCE (6<<16) ///< Add this to your error to get a commerce error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_ACHIEVEMENTS (7<<16) ///< Add this to your error to get a achievement error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_LSX (8<<16) ///< Add this to your error to get an LSX error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AREA_PROXY (9<<16) ///< Add this to your error to get an Origin Proxy error.
|
||||
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_LEVEL_SHIFT 24 ///< [A description is required for this define]
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_LEVEL_MASK 0x0F000000 ///< The error level mask.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_LEVEL_0 (0<<24) ///< A severe error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_LEVEL_1 (1<<24) ///< A major error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_LEVEL_2 (2<<24) ///< A minor error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_LEVEL_3 (3<<24) ///< A trivial error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_LEVEL_4 (4<<24) ///< Every error.
|
||||
|
||||
/// @}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
/// $errors
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
|
||||
|
||||
/// \name Origin Error Codes
|
||||
/// These defines specify Origin-specific errors.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS 0 ///< The operation succeeded.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_PENDING 1 ///< The operation is still waiting to complete.
|
||||
|
||||
// General error codes
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_GENERAL -1 ///< An unspecified error has occured.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_INVALID_HANDLE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 0) ///< The provided handle is invalid.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_OUT_OF_MEMORY (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_GENERAL + 1) ///< Failed to allocate memory.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 2) ///< The function is not implemented.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_INVALID_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 3) ///< The specified user is not valid in this context, or the userId is invalid.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_INVALID_ARGUMENT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 4) ///< One or more arguments are invalid.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NO_CALLBACK_SPECIFIED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 5) ///< The asynchronous operation expected a callback, but no callback was specified.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 6) ///< The provided buffer doesn't have enough space to contain the requested data.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_TOO_MANY_VALUES_IN_LIST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 7) ///< We are currently only supporting one item in the list.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 8) ///< The requested item was not found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_INVALID_PERSONA (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 9) ///< The specified persona is not valid in this context, or the personaId is invalid.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NO_NETWORK (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 10) ///< No internet connection available.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NO_SERVICE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 11) ///< Origin services are unavailable.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NOT_LOGGED_IN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 12) ///< The user isn't logged in. No valid session is available.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_MANDATORY_ORIGIN_UPDATE_PENDING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 13) ///< There is a mandatory update pending for Origin, this will prevent origin from going online.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_ACCOUNT_IN_USE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 14) ///< The account is currently in use by another Origin instance.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_TOO_MANY_INSTANCES (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 15) ///< Too many instances of the OriginSDK created.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_ALREADY_EXISTS (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_GENERAL + 16) ///< The item already exists in the list.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_INVALID_OPERATION (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 17) ///< The requested operation cannot be performed.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_AGE_RESTRICTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 18) ///< The item has age restrictions.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_BANNED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 19) ///< The user is banned.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NOT_READY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 20) ///< The item is not ready.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name SDK Error Codes
|
||||
/// These defines specify Origin SDK-specific errors.
|
||||
/// @{
|
||||
|
||||
// Sdk error codes
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_NOT_INITIALIZED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_SDK + 0) ///< The Origin SDK was not running.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_INVALID_ALLOCATOR_DEALLOCATOR_COMBINATION (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 1) ///< Make sure that you provide both an allocator and a deallocator.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_IS_RUNNING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2) ///< The Origin SDK is running. This operation should only be done before the SDK is initialized or after the SDK is shutdown.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_NOT_ALL_RESOURCES_RELEASED (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_SDK + 3) ///< The game is still holding on to the resource handles. Call #OriginDestroyHandle on resources that are no longer needed.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_INVALID_RESOURCE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4) ///< The resource in the resource map is invalid. Memory corruption?
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 5) ///< The SDK experienced an internal error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_SDK_INTERNAL_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 6) ///< The internal buffer that the SDK is using is not big enough to receive the response. Inform OriginSDK Support.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name SDK Warning Codes
|
||||
/// These defines specify Origin SDK-specific warnings.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_SDK_ALREADY_INITIALIZED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 1) ///< The Origin SDK is already initialized.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_SDK_STILL_RUNNING (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2) ///< The Origin SDK is still running.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_SDK_ENUMERATOR_IN_USE (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 3) ///< The Enumerator associated with the handle was in use.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_SDK_ENUMERATOR_TERMINATED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4) ///< The Enumerator associated with the handle was not finished.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Core Error Codes
|
||||
/// These defines specify Origin Core-specific errors.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_NOTLOADED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 0) ///< The Origin desktop application is not loaded.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_LOGIN_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 1) ///< Origin couldn't authenticate with the Origin Servers.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_AUTHENTICATION_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 2) ///< Origin seems to be running, but the LSX Authentication Challenge failed. No communication with Core is possible.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_SEND_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 4) ///< Sending data to Origin failed.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_RECEIVE_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 5) ///< Receiving data from Origin failed.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_RESOURCE_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 6) ///< The requested resource could not be located.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_INCOMPATIBLE_VERSION (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 7) ///< The Origin version is too old to work with this SDK version.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_CORE_NOT_INSTALLED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 8) ///< The Origin installation couldn't be found.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name IGO Error and Warning Codes
|
||||
/// These defines specify In-game Overlay errors and warnings.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_IGO_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 0) ///< The IGO could not be loaded, so SDK functionality is degraded.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_WARNING_IGO_SUPPORT_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 1) ///< IGO support is not loaded, so SDK functionality is degraded.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_IGO_ILLEGAL_ANCHOR_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 2) ///< The combination of anchor point bits doesn't resolve to a proper dialog anchor point.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_IGO_ILLEGAL_DOCK_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 3) ///< The combination of dock point bits doesn't resolve to a proper dock point.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_IGO_NOT_AVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 4) ///< The IGO is not available.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Presence Error Codes
|
||||
/// These defines specify Origin Presence errors.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_NO_MULTIPLAYER_ID (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PRESENCE + 0) ///< It is not possible to set the presence to JOINABLE when no multiplayer Id is defined on the offer.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Friends Error Codes
|
||||
/// These defines specify Origin Friends errors.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_LSX_INVALID_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 0) ///< The LSX Decoder didn't expect this response.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_LSX_NO_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_LSX + 1) ///< The LSX server didn't respond within the set timeout.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_LSX_INVALID_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 2) ///< The LSX Decoder didn't expect this request.
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Commerce Error Codes
|
||||
/// These defines specify Origin Commerce errors.
|
||||
/// @{
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 0) ///< The store could not be found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_CATALOG (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 1) ///< The catalog could not be found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_INVALID_REPLY (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 2) ///< The server reply was not understood.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_CATEGORIES (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 3) ///< No categories were found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_NO_PRODUCTS (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 4) ///< No products were found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_UNDERAGE_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 5) ///< The user is under age and is blocked to perform this action.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_COMMERCE_DEPRECATED_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 6) ///< The user's OS is deprecated and is blocked to perform this action.
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
/// \name Origin Proxy Error Codes.
|
||||
/// These defines specify Origin Proxy errors.
|
||||
/// @{
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 0) ///< Base proxy error. You shouldn't get this error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PROXY_OK (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 200) ///< Server success: OK.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PROXY_CREATED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 201) ///< Server success: Created.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PROXY_ACCEPTED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 202) ///< Server success: Accepted.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PROXY_NON_AUTH_INFO (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 203) ///< Server success: Non-Authoritative Information.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PROXY_NO_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 204) ///< Server success: No Content.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_RESET_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 205) ///< Server success: Reset Content.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_SUCCESS_PARTIAL_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 206) ///< Server success: Partial Content.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_BAD_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 400) ///< Server error: Bad Request
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_UNAUTHORIZED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 401) ///< Server error: Unauthorized.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_PAYMENT_REQUIRED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 402) ///< Server error: Payment Required.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_FORBIDDEN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 403) ///< Server error: Forbidden.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 404) ///< Server error: Not found.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_METHOD_NOT_ALLOWED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 405) ///< Server error: Method not Allowed.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_NOT_ACCEPTABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 406) ///< Server error: Not Acceptable.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_REQUEST_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 408) ///< Server error: Request Timeout.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_CONFLICT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 409) ///< Server error: Conflict.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 500) ///< Server error: Internal Server Error.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 501) ///< Server error: Not Implemented.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_BAD_GATEWAY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 502) ///< Server error: Bad Gateway.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_SERVICE_UNAVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 503) ///< Server error: Service Unavailable.
|
||||
|
||||
/// \ingroup error
|
||||
#define ORIGIN_ERROR_PROXY_GATEWAY_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 504) ///< Server error: Gateway Timeout.
|
@ -1,521 +0,0 @@
|
||||
#pragma once
|
||||
#include "patterns.h"
|
||||
#include "banlist.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Classes and Structs
|
||||
|
||||
class CInputSystem
|
||||
{
|
||||
public:
|
||||
void EnableInput(bool bEnabled)// @0x14039F100 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CInputSystem*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[10](this, bEnabled);
|
||||
}
|
||||
|
||||
void EnableMessagePump(bool bEnabled) // @0x14039F110 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CInputSystem*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[11](this, bEnabled);
|
||||
}
|
||||
|
||||
bool IsButtonDown(ButtonCode_t Button) // @0x1403A0140 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = bool(__thiscall*)(CInputSystem*, ButtonCode_t);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[13](this, Button);
|
||||
}
|
||||
|
||||
private:
|
||||
char pad_0000[16]; //0x0000
|
||||
public:
|
||||
bool m_bEnabled; //0x0010 IsInputEnabled variable.
|
||||
bool m_bPumpEnabled; //0x0011 EnabledMessagePump variable.
|
||||
};
|
||||
|
||||
typedef int HKeySymbol;
|
||||
|
||||
#define MAKE_3_BYTES_FROM_1_AND_2( x1, x2 ) (( (( std::uint16_t )x2) << 8 ) | (std::uint8_t)(x1))
|
||||
|
||||
class CKeyValuesSystem // VTABLE @ 0x1413AA1E8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
public:
|
||||
|
||||
void RegisterSizeofKeyValues(std::int64_t size) //@0x1413AA1F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, std::int64_t);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[0](this, size);
|
||||
}
|
||||
|
||||
void* AllocKeyValuesMemory(std::int64_t size) // @0x1413AA1F8 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void* (__thiscall*)(CKeyValuesSystem*, std::int64_t);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[1](this, size);
|
||||
}
|
||||
|
||||
void FreeKeyValuesMemory(void* pMem) // @0x1413AA200 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, void*);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[2](this, pMem);
|
||||
}
|
||||
|
||||
HKeySymbol GetSymbolForString(const char* name, bool bCreate) // @0x1413AA208 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = HKeySymbol(__thiscall*)(CKeyValuesSystem*, const char*, bool);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[3](this, name, bCreate);
|
||||
}
|
||||
|
||||
const char* GetStringForSymbol(HKeySymbol symbol) // @0x1413AA210 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = const char* (__thiscall*)(CKeyValuesSystem*, HKeySymbol);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[4](this, symbol);
|
||||
}
|
||||
|
||||
// void __fastcall CKeyValuesSystem::FreeKeyValuesMemory(CKeyValuesSystem* this_arg, void* ptr_mem_arg)
|
||||
// {
|
||||
// __int64* v2; // rax
|
||||
// __int64 v4; // rax
|
||||
// __int64* v5; // rax
|
||||
//
|
||||
// v2 = qword_14D40B538;
|
||||
// if (!qword_14D40B538)
|
||||
// {
|
||||
// v2 = sub_140462930();
|
||||
// qword_14D40B538 = v2;
|
||||
// }
|
||||
// v4 = (*(*v2 + 48))(v2, ptr_mem_arg);
|
||||
// if (v4 > 0)
|
||||
// CKeyValuesSystem::m_pMemPool -= v4;
|
||||
// v5 = qword_14D40B538;
|
||||
// if (!qword_14D40B538)
|
||||
// {
|
||||
// v5 = sub_140462930();
|
||||
// qword_14D40B538 = v5;
|
||||
// }
|
||||
// (*(*v5 + 40))(v5, ptr_mem_arg);
|
||||
// }
|
||||
|
||||
// GetMemPool return a global variable called m_pMemPool it gets modified by AllocKeyValuesMemory and FreeKeyValuesMemory above you can see where the find it in FreeKeyValuesMemory.
|
||||
void* GetMemPool() // @0x1413AA228 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
return reinterpret_cast<void*>(0x14D412768); // May need to dereference is once more not sure right now.
|
||||
}
|
||||
|
||||
void SetKeyValuesExpressionSymbol(const char* name, bool bValue) // @0x1413AA230 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CKeyValuesSystem*, const char*, bool);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[8](this, name, bValue);
|
||||
}
|
||||
|
||||
bool GetKeyValuesExpressionSymbol(const char* name) // @0x1413AA238 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = bool(__thiscall*)(CKeyValuesSystem*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[9](this, name);
|
||||
}
|
||||
|
||||
HKeySymbol GetSymbolForStringCaseSensitive(HKeySymbol& hCaseInsensitiveSymbol, const char* name, bool bCreate) // @0x1413AA240 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = HKeySymbol(__thiscall*)(CKeyValuesSystem*, HKeySymbol&, const char*, bool);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[10](this, hCaseInsensitiveSymbol, name, bCreate);
|
||||
}
|
||||
|
||||
// Datatypes aren't accurate. But full fill the actual byte distance.
|
||||
public:
|
||||
void* vtable; // 0x0000
|
||||
std::int64_t m_iMaxKeyValuesSize; // 0x0008
|
||||
private:
|
||||
char gap10[240]; // 0x0010
|
||||
public:
|
||||
int m_KvConditionalSymbolTable; // 0x0100
|
||||
private:
|
||||
char gap104[4]; // 0x0104
|
||||
public:
|
||||
std::int64_t field_108; // 0x0108
|
||||
private:
|
||||
char gap110[32]; // 0x0110
|
||||
public:
|
||||
int m_mutex; // 0x0130
|
||||
};
|
||||
|
||||
class KeyValues
|
||||
{
|
||||
public:
|
||||
|
||||
KeyValues* FindKey(const char* keyName, bool bCreate)
|
||||
{
|
||||
static auto func = reinterpret_cast<KeyValues*(__thiscall*)(KeyValues*, const char*, bool)>(addr_KeyValues_FindKey);
|
||||
return func(this, keyName, bCreate);
|
||||
}
|
||||
|
||||
const char* GetName();
|
||||
|
||||
int GetInt(const char* keyName, int defaultValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, false);
|
||||
|
||||
if (!dat)
|
||||
return defaultValue;
|
||||
|
||||
switch (dat->m_iDataType)
|
||||
{
|
||||
case TYPE_STRING:
|
||||
return atoi(dat->m_sValue);
|
||||
case TYPE_FLOAT:
|
||||
return static_cast<int>(m_flValue());
|
||||
case TYPE_WSTRING:
|
||||
return _wtoi(dat->m_wsValue);
|
||||
case TYPE_UINT64:
|
||||
return 0;
|
||||
default:
|
||||
return dat->m_iValue();
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
void SetInt(const char* keyName, int iValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, true);
|
||||
if (dat)
|
||||
{
|
||||
dat->m_iValue() = iValue;
|
||||
dat->m_iDataType = TYPE_INT;
|
||||
}
|
||||
}
|
||||
|
||||
void SetFloat(const char* keyName, float flValue)
|
||||
{
|
||||
KeyValues* dat = FindKey(keyName, true);
|
||||
if (dat)
|
||||
{
|
||||
dat->m_flValue() = flValue;
|
||||
dat->m_iDataType = TYPE_FLOAT;
|
||||
}
|
||||
}
|
||||
|
||||
// Compiler makes it so m_Value shares the offset spot with m_flValue that why we cast it like this.
|
||||
float& m_flValue()
|
||||
{
|
||||
static __int32 offset = 0x18;
|
||||
return *(float*)((std::uintptr_t)this + offset);
|
||||
}
|
||||
|
||||
int& m_iValue()
|
||||
{
|
||||
static __int32 offset = 0x18;
|
||||
return *(int*)((std::uintptr_t)this + offset);
|
||||
}
|
||||
|
||||
public:
|
||||
unsigned __int32 m_iKeyName : 24; // 0x0000
|
||||
unsigned __int32 m_iKeyNameCaseSensitive : 8; // 0x0003
|
||||
char* m_sValue; // 0x0008
|
||||
wchar_t* m_wsValue; // 0x0010
|
||||
int m_Value; // 0x0018
|
||||
private:
|
||||
char gap1C[12]; // 0x0020
|
||||
public:
|
||||
char m_iDataType; // 0x0028
|
||||
unsigned __int16 m_iKeyNameCaseSensitive2; // 0x002A
|
||||
KeyValues* m_pPeer; // 0x0030
|
||||
KeyValues* m_pSub; // 0x0038
|
||||
KeyValues* m_pChain; // 0x0040
|
||||
};
|
||||
|
||||
struct Vector3 // Implement the proper class of this at some point.
|
||||
{
|
||||
float x; // 0x0000
|
||||
float y; // 0x0004
|
||||
float z; // 0x0008
|
||||
};
|
||||
|
||||
struct QAngle // Implement the proper class of this at some point.
|
||||
{
|
||||
float pitch; //0x0000
|
||||
float yaw; // 0x0004
|
||||
float roll; // 0x0008
|
||||
};
|
||||
|
||||
class CHostState
|
||||
{
|
||||
public:
|
||||
HostStates_t m_iCurrentState; //0x0000
|
||||
HostStates_t m_iNextState; //0x0004
|
||||
Vector3 m_vecLocation; //0x0008
|
||||
QAngle m_angLocation; //0x0014
|
||||
char m_levelName[64]; //0x0020
|
||||
char m_mapGroupName[256]; //0x0060
|
||||
char m_landMarkName[256]; //0x0160
|
||||
float m_flShortFrameTime; //0x0260
|
||||
bool m_bActiveGame; //0x0264
|
||||
bool m_bRememberLocation; //0x0265
|
||||
bool m_bBackgroundLevel; //0x0266
|
||||
bool m_bWaitingForConnection; //0x0267
|
||||
bool m_bSplitScreenConnect; //0x0268
|
||||
bool m_bGameHasShutDownAndFlushedMemory; //0x0269
|
||||
bool m_bWorkshopMapDownloadPending; //0x026A
|
||||
};
|
||||
|
||||
class CHLClient
|
||||
{
|
||||
public:
|
||||
void FrameStageNotify(ClientFrameStage_t curStage) // @0x1405C0740 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void(__thiscall*)(CHLClient*, ClientFrameStage_t);
|
||||
(*reinterpret_cast<OriginalFn**>(this))[58](this, curStage); /* 48 83 EC 28 89 15 ? ? ? ? */
|
||||
}
|
||||
};
|
||||
|
||||
class CClient
|
||||
{
|
||||
public:
|
||||
inline CClient* GetClientInstance(int index)
|
||||
{
|
||||
return (CClient*)(std::uintptr_t)(0x16073B200 + (index * (std::uintptr_t)0x4A4C0));
|
||||
}
|
||||
|
||||
void*& GetNetChan()
|
||||
{
|
||||
return m_nNetChannel;
|
||||
}
|
||||
private:
|
||||
char pad_0000[16]; //0x0000
|
||||
public:
|
||||
int m_iUserID; //0x0010
|
||||
private:
|
||||
char pad_0014[908]; //0x0014
|
||||
public:
|
||||
void* m_nNetChannel; //0x03A0
|
||||
private:
|
||||
char pad_03A8[8]; //0x03A8
|
||||
public:
|
||||
int m_iSignonstate; //0x03B0
|
||||
private:
|
||||
char pad_03B4[4]; //0x03B4
|
||||
public:
|
||||
std::int64_t m_iOriginID; //0x03B8
|
||||
private:
|
||||
char pad_03C0[303360]; //0x03C0
|
||||
};
|
||||
|
||||
class CCommand
|
||||
{
|
||||
private:
|
||||
enum
|
||||
{
|
||||
COMMAND_MAX_ARGC = 64,
|
||||
COMMAND_MAX_LENGTH = 512,
|
||||
};
|
||||
|
||||
public:
|
||||
CCommand() = delete;
|
||||
|
||||
inline int MaxCommandLength()
|
||||
{
|
||||
return COMMAND_MAX_LENGTH - 1;
|
||||
}
|
||||
|
||||
inline std::int64_t ArgC() const
|
||||
{
|
||||
return m_nArgc;
|
||||
}
|
||||
|
||||
inline const char** ArgV() const
|
||||
{
|
||||
return m_nArgc ? (const char**)m_ppArgv : NULL;
|
||||
}
|
||||
|
||||
inline const char* ArgS() const
|
||||
{
|
||||
return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : "";
|
||||
}
|
||||
|
||||
inline const char* GetCommandString() const
|
||||
{
|
||||
return m_nArgc ? m_pArgSBuffer : "";
|
||||
}
|
||||
|
||||
inline const char* Arg(int nIndex) const
|
||||
{
|
||||
// FIXME: Many command handlers appear to not be particularly careful
|
||||
// about checking for valid argc range. For now, we're going to
|
||||
// do the extra check and return an empty string if it's out of range
|
||||
if (nIndex < 0 || nIndex >= m_nArgc)
|
||||
return "";
|
||||
return m_ppArgv[nIndex];
|
||||
}
|
||||
|
||||
inline const char* operator[](int nIndex) const
|
||||
{
|
||||
return Arg(nIndex);
|
||||
}
|
||||
|
||||
private:
|
||||
std::int64_t m_nArgc;
|
||||
std::int64_t m_nArgv0Size;
|
||||
char m_pArgSBuffer[COMMAND_MAX_LENGTH];
|
||||
char m_pArgvBuffer[COMMAND_MAX_LENGTH];
|
||||
const char* m_ppArgv[COMMAND_MAX_ARGC];
|
||||
};
|
||||
|
||||
class ConCommandBase
|
||||
{
|
||||
public:
|
||||
void* m_pConCommandBaseVTable; //0x0000
|
||||
ConCommandBase* m_pNext; //0x0008
|
||||
bool m_bRegistered; //0x0010
|
||||
private:
|
||||
char pad_0011[7]; //0x0011
|
||||
public:
|
||||
const char* m_pszName; //0x0018
|
||||
const char* m_pszHelpString; //0x0020
|
||||
private:
|
||||
char pad_0028[16]; //0x0028
|
||||
public:
|
||||
int m_nFlags; //0x0038
|
||||
private:
|
||||
char pad_003C[4]; //0x003C
|
||||
}; //Size: 0x0038
|
||||
|
||||
class ConVar
|
||||
{
|
||||
public:
|
||||
ConCommandBase m_ConCommandBase; // 0x0000
|
||||
void* m_pConVarVTable; //0x0040
|
||||
ConVar* m_pParent; //0x0048
|
||||
const char* n_pszDefaultValue; //0x0050
|
||||
const char* m_pzsCurrentValue; //0x0058
|
||||
std::int64_t m_iStringLength; //0x0060
|
||||
float m_flValue; //0x0068
|
||||
int m_iValue; //0x006C
|
||||
bool m_bHasMin; //0x0070
|
||||
float m_flMinValue; //0x0074
|
||||
bool m_bHasMax; //0x0078
|
||||
float m_flMaxValue; //0x007C
|
||||
char pad_0080[32]; //0x0080
|
||||
}; //Size: 0x00A0
|
||||
|
||||
class CCVarIteratorInternal // Fully reversed table, just look at the virtual function table and rename the function.
|
||||
{
|
||||
public:
|
||||
virtual void SetFirst(void) = 0; //0
|
||||
virtual void Next(void) = 0; //1
|
||||
virtual bool IsValid(void) = 0; //2
|
||||
virtual ConCommandBase* Get(void) = 0; //3
|
||||
};
|
||||
|
||||
class CCVar
|
||||
{
|
||||
public:
|
||||
ConCommandBase* FindCommandBase(const char* szCommandName) // @0x1405983A0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = ConCommandBase*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[14](this, szCommandName);
|
||||
}
|
||||
|
||||
ConVar* FindVar(const char* szVarName) // @0x1405983B0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = ConVar*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[16](this, szVarName);
|
||||
}
|
||||
|
||||
void* /*Implement ConCommand class.*/ FindCommand(const char* szCommandName) // @0x1405983F0 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = void*(__thiscall*)(CCVar*, const char*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[18](this, szCommandName);
|
||||
}
|
||||
|
||||
CCVarIteratorInternal* FactoryInternalIterator() // @0x140597C10 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM
|
||||
{
|
||||
using OriginalFn = CCVarIteratorInternal*(__thiscall*)(CCVar*);
|
||||
return (*reinterpret_cast<OriginalFn**>(this))[41](this);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, ConCommandBase*> DumpToMap()
|
||||
{
|
||||
std::stringstream ss;
|
||||
CCVarIteratorInternal* itint = FactoryInternalIterator(); // Allocatd new InternalIterator.
|
||||
|
||||
std::unordered_map<std::string, ConCommandBase*> allConVars;
|
||||
|
||||
for (itint->SetFirst(); itint->IsValid(); itint->Next()) // Loop through all instances.
|
||||
{
|
||||
ConCommandBase* command = itint->Get();
|
||||
const char* commandName = command->m_pszName;
|
||||
allConVars[commandName] = command;
|
||||
}
|
||||
|
||||
return allConVars;
|
||||
}
|
||||
};
|
||||
|
||||
struct Interface
|
||||
{
|
||||
std::int64_t(*InterfacePtr)(void);
|
||||
const char* InterfaceName;
|
||||
std::int64_t* NextInterfacePtr;
|
||||
};
|
||||
|
||||
struct SQFuncRegistration
|
||||
{
|
||||
const char* scriptName; // 00
|
||||
const char* nativeName; // 08
|
||||
const char* helpString; // 10
|
||||
const char* retValType; // 18
|
||||
const char* argTypes; // 20
|
||||
std::int16_t unk28; // 28
|
||||
std::int16_t padding1; // 2A
|
||||
std::int32_t unk2c; // 2C
|
||||
std::int64_t unk30; // 30
|
||||
std::int32_t unk38; // 38
|
||||
std::int32_t padding2; // 3C
|
||||
std::int64_t unk40; // 40
|
||||
std::int64_t unk48; // 48
|
||||
std::int64_t unk50; // 50
|
||||
std::int32_t unk58; // 58
|
||||
std::int32_t padding3; // 5C
|
||||
void* funcPtr; // 60
|
||||
|
||||
SQFuncRegistration()
|
||||
{
|
||||
memset(this, 0, sizeof(SQFuncRegistration));
|
||||
this->padding2 = 6;
|
||||
}
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Game Globals
|
||||
|
||||
namespace GameGlobals
|
||||
{
|
||||
// Class Instances
|
||||
extern CHostState* HostState;
|
||||
extern CInputSystem* InputSystem;
|
||||
extern CCVar* Cvar;
|
||||
extern KeyValues** PlaylistKeyValues;
|
||||
extern CKeyValuesSystem* KeyValuesSystem;
|
||||
extern CClient* Client;
|
||||
extern BanList* BanSystem;
|
||||
|
||||
// Var
|
||||
ConVar* CreateCustomConVar(const char* name, const char* defaultValue, int flags, const char* helpString, bool bMin, float fMin, bool bMax, float fMax, void* callback, void* unk);
|
||||
void* CreateCustomConCommand(const char* name, const char* helpString, int flags, void* callback, void* callbackAfterExecution);
|
||||
|
||||
// Script
|
||||
void Script_RegisterFunction(void* sqvm, const char* name, const char* helpString, const char* retValType, const char* argTypes, void* funcPtr);
|
||||
void RegisterUIScriptFunctions(void* sqvm);
|
||||
void RegisterClientScriptFunctions(void* sqvm);
|
||||
void RegisterServerScriptFunctions(void* sqvm);
|
||||
|
||||
// Init
|
||||
void InitGameGlobals();
|
||||
void InitAllCommandVariations();
|
||||
void InitPlaylist();
|
||||
|
||||
|
||||
extern std::vector<std::string> allPlaylists;
|
||||
extern bool IsInitialized;
|
||||
|
||||
// Utility
|
||||
void DisconnectClient(CClient* client, const char* reason, unsigned __int8 unk1, char unk2);
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Internals
|
||||
int Stricmp(const char* s1, const char* s2);
|
||||
int Strnicmp(const char* s1, const char* s2, int n);
|
||||
char* Strdup(const char* s);
|
||||
void Strtrim(char* s);
|
||||
|
||||
class GuiConfig
|
||||
{
|
||||
public:
|
||||
struct
|
||||
{
|
||||
int bind1 = VK_OEM_3;
|
||||
int bind2 = VK_INSERT;
|
||||
int autoClearLimit = 300;
|
||||
bool autoClear = true;
|
||||
bool printCmd = false;
|
||||
} CGameConsoleConfig;
|
||||
|
||||
struct
|
||||
{
|
||||
int bind1 = VK_HOME;
|
||||
int bind2 = VK_F10;
|
||||
} CCompanionConfig;
|
||||
|
||||
void Load()
|
||||
{
|
||||
spdlog::debug("Loading the Gui Config..\n");
|
||||
std::filesystem::path path = std::filesystem::current_path() /= "gui.config"; // Get current path + gui.config
|
||||
|
||||
nlohmann::json in;
|
||||
try
|
||||
{
|
||||
std::ifstream configFile(path, std::ios::binary); // Parse config file.
|
||||
configFile >> in;
|
||||
configFile.close();
|
||||
|
||||
if (!in.is_null())
|
||||
{
|
||||
if (!in["config"].is_null())
|
||||
{
|
||||
// CGameConsole
|
||||
CGameConsoleConfig.bind1 = in["config"]["CGameConsole"]["bind1"].get<int>();
|
||||
CGameConsoleConfig.bind2 = in["config"]["CGameConsole"]["bind2"].get<int>();
|
||||
CGameConsoleConfig.autoClearLimit = in["config"]["CGameConsole"]["autoClearLimit"].get<int>();
|
||||
CGameConsoleConfig.autoClear = in["config"]["CGameConsole"]["autoClear"].get<bool>();
|
||||
CGameConsoleConfig.printCmd = in["config"]["CGameConsole"]["printCmd"].get<bool>();
|
||||
|
||||
// CCompanion
|
||||
CCompanionConfig.bind1 = in["config"]["CCompanion"]["bind1"].get<int>();
|
||||
CCompanionConfig.bind2 = in["config"]["CCompanion"]["bind2"].get<int>();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
spdlog::critical("Gui Config loading failed. Perhaps re-create it by messing with Options in CGameConsole. Reason: {}\n", ex.what());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
nlohmann::json out;
|
||||
|
||||
// CGameConsole
|
||||
out["config"]["CGameConsole"]["bind1"] = CGameConsoleConfig.bind1;
|
||||
out["config"]["CGameConsole"]["bind2"] = CGameConsoleConfig.bind2;
|
||||
out["config"]["CGameConsole"]["autoClearLimit"] = CGameConsoleConfig.autoClearLimit;
|
||||
out["config"]["CGameConsole"]["autoClear"] = CGameConsoleConfig.autoClear;
|
||||
out["config"]["CGameConsole"]["printCmd"] = CGameConsoleConfig.printCmd;
|
||||
|
||||
// CCompanion
|
||||
out["config"]["CCompanion"]["bind1"] = CCompanionConfig.bind1;
|
||||
out["config"]["CCompanion"]["bind2"] = CCompanionConfig.bind2;
|
||||
|
||||
std::filesystem::path path = std::filesystem::current_path() /= "gui.config"; // Get current path + gui.config
|
||||
std::ofstream outFile(path, std::ios::out | std::ios::trunc); // Write config file..
|
||||
|
||||
outFile << out.dump(4); // Dump it into config file..
|
||||
|
||||
outFile.close(); // Close the file handle.
|
||||
};
|
||||
};
|
||||
|
||||
extern GuiConfig g_GuiConfig;
|
@ -1,155 +0,0 @@
|
||||
#pragma once
|
||||
#include "patterns.h"
|
||||
#include "structs.h"
|
||||
#include "hooks.h"
|
||||
#include "gameclasses.h"
|
||||
#include "CCompanion.h"
|
||||
#include "CGameConsole.h"
|
||||
|
||||
inline bool g_bDebugLoading = false;
|
||||
inline bool g_bReturnAllFalse = false;
|
||||
inline bool g_bDebugConsole = false;
|
||||
extern bool g_bBlockInput;
|
||||
|
||||
namespace Hooks
|
||||
{
|
||||
#pragma region CHLClient
|
||||
void __fastcall FrameStageNotify(CHLClient* rcx, ClientFrameStage_t curStage);
|
||||
|
||||
using FrameStageNotifyFn = void(__fastcall*)(CHLClient*, ClientFrameStage_t);
|
||||
extern FrameStageNotifyFn originalFrameStageNotify;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Squirrel
|
||||
void* SQVM_Print(void* sqvm, char* fmt, ...);
|
||||
__int64 SQVM_Warning(void* sqvm, int a2, int a3, int* stringSize, void** string);
|
||||
__int64 SQVM_LoadRson(const char* rson_name);
|
||||
bool SQVM_LoadScript(void* sqvm, const char* script_path, const char* script_name, int flag);
|
||||
void SQVM_RegisterOriginFuncs(void* sqvm);
|
||||
void SQVM_RegisterCreatePlayerTasklist(void* sqvm);
|
||||
|
||||
using SQVM_WarningFn = __int64(*)(void*, int, int, int*, void**);
|
||||
extern SQVM_WarningFn originalSQVM_Warning;
|
||||
|
||||
using SQVM_LoadRsonFn = __int64(*)(const char*);
|
||||
extern SQVM_LoadRsonFn originalSQVM_LoadRson;
|
||||
|
||||
using SQVM_LoadScriptFn = bool(*)(void*, const char*, const char*, int);
|
||||
extern SQVM_LoadScriptFn originalSQVM_LoadScript;
|
||||
|
||||
using SQVM_RegisterOriginFuncsFn = void(*)(void*);
|
||||
extern SQVM_RegisterOriginFuncsFn originalSQVM_RegisterOriginFuncs;
|
||||
|
||||
using SQVM_RegisterCreatePlayerTasklistFn = void(*)(void*);
|
||||
extern SQVM_RegisterCreatePlayerTasklistFn originalSQVM_RegisterCreatePlayerTasklist;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CServer
|
||||
void* ConnectClient(void* thisptr, void* packet);
|
||||
|
||||
using ConnectClientFn = void* (*)(void*, void*);
|
||||
extern ConnectClientFn originalConnectClient;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CVEngineServer
|
||||
bool IsPersistenceDataAvailable(__int64 thisptr, int client);
|
||||
|
||||
using IsPersistenceDataAvailableFn = bool(*)(__int64, int);
|
||||
extern IsPersistenceDataAvailableFn originalIsPersistenceDataAvailable;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
bool NET_ReceiveDatagram(int sock, void* inpacket, bool raw);
|
||||
unsigned int NET_SendDatagram(SOCKET s, const char* buf, int len, int flags);
|
||||
void NET_PrintFunc(const char* fmt, ...);
|
||||
void NetChan_Shutdown(void* rcx, const char* reason, unsigned __int8 unk1, char unk2);
|
||||
|
||||
using NET_PrintFuncFn = void(*)(const char* fmt, ...);
|
||||
extern NET_PrintFuncFn originalNET_PrintFunc;
|
||||
|
||||
using NET_ReceiveDatagramFn = bool(*)(int, void*, bool);
|
||||
extern NET_ReceiveDatagramFn originalNET_ReceiveDatagram;
|
||||
|
||||
using NET_SendDatagramFn = unsigned int(*)(SOCKET, const char*, int, int);
|
||||
extern NET_SendDatagramFn originalNET_SendDatagram;
|
||||
using NetChan_ShutDown = void(*)(void*, const char*, unsigned __int8, char);
|
||||
extern NetChan_ShutDown originalNetChan_ShutDown;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ConVar
|
||||
bool ConVar_IsFlagSet(ConVar* cvar, int flag);
|
||||
bool ConCommand_IsFlagSet(ConCommandBase* cmd, int flag);
|
||||
|
||||
using ConVar_IsFlagSetFn = bool(*)(ConVar*, int);
|
||||
extern ConVar_IsFlagSetFn originalConVar_IsFlagSet;
|
||||
|
||||
using ConCommand_IsFlagSetFn = bool(*)(ConCommandBase*, int);
|
||||
extern ConCommand_IsFlagSetFn originalConCommand_IsFlagSet;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CMatSystemSurface
|
||||
void LockCursor(void* thisptr);
|
||||
|
||||
using LockCursorFn = void(*)(void*);
|
||||
extern LockCursorFn originalLockCursor;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region WinAPI
|
||||
BOOL WINAPI GetCursorPos(LPPOINT lpPoint);
|
||||
BOOL WINAPI SetCursorPos(int X, int Y);
|
||||
BOOL WINAPI ClipCursor(const RECT* lpRect);
|
||||
BOOL WINAPI ShowCursor(BOOL bShow);
|
||||
|
||||
using GetCursorPosFn = BOOL(WINAPI*)(LPPOINT);
|
||||
extern GetCursorPosFn originalGetCursorPos;
|
||||
|
||||
using SetCursorPosFn = BOOL(WINAPI*)(int, int);
|
||||
extern SetCursorPosFn originalSetCursorPos;
|
||||
|
||||
using ClipCursorFn = BOOL(WINAPI*)(const RECT*);
|
||||
extern ClipCursorFn originalClipCursor;
|
||||
|
||||
using ShowCursorFn = BOOL(WINAPI*)(BOOL);
|
||||
extern ShowCursorFn originalShowCursor;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region HostState
|
||||
void FrameUpdate(void* rcx, void* rdx, float time);
|
||||
|
||||
using FrameUpdateFn = void(*)(void*, void*, float);
|
||||
extern FrameUpdateFn originalFrameUpdate;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CEngineVGui
|
||||
int CEngineVGui_Paint(void* thisptr, int mode);
|
||||
|
||||
using CEngineVGui_PaintFn = int(*)(void*, int);
|
||||
extern CEngineVGui_PaintFn originalCEngineVGui_Paint;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region OriginSDK
|
||||
const char* OriginGetErrorDescription(std::uint32_t originCode);
|
||||
|
||||
using OriginGetErrorDescriptionWrapperFn = const char* (*)(std::uint32_t);
|
||||
extern OriginGetErrorDescriptionWrapperFn originalOriginGetErrorDescriptionWrapper;
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Other
|
||||
int MSG_EngineError(char* fmt, va_list args);
|
||||
bool LoadPlaylist(const char* playlist);
|
||||
|
||||
using MSG_EngineErrorFn = int(*)(char*, va_list);
|
||||
extern MSG_EngineErrorFn originalMSG_EngineError;
|
||||
|
||||
using LoadPlaylistFn = bool(*)(const char*);
|
||||
extern LoadPlaylistFn originalLoadPlaylist;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
void InstallHooks();
|
||||
void RemoveHooks();
|
||||
void ToggleNetTrace();
|
||||
extern bool bToggledNetTrace;
|
||||
void ToggleDevCommands();
|
||||
extern bool bToggledDevFlags;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization
|
||||
void SetupDXSwapChain();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Internals
|
||||
void PrintDXAddress();
|
||||
void InstallDXHooks();
|
||||
void RemoveDXHooks();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Handlers
|
||||
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
extern HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT nFlags);
|
||||
extern HRESULT __stdcall GetResizeBuffers(IDXGISwapChain* pSwapChain, UINT nBufferCount, UINT nWidth, UINT nHeight, DXGI_FORMAT dxFormat, UINT nSwapChainFlags);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
extern DWORD g_dThreadId;
|
||||
extern bool g_bShowConsole;
|
||||
extern bool g_bShowBrowser;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Utils
|
||||
bool LoadTextureFromByteArray(unsigned char* image_data, const int& image_width, const int& image_height, ID3D11ShaderResourceView** out_srv);
|
@ -1 +0,0 @@
|
||||
#pragma once
|
@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
enum class LogType_t : int
|
||||
{
|
||||
SCRIPT_SERVER,
|
||||
SCRIPT_CLIENT,
|
||||
SCRIPT_UI,
|
||||
SCRIPT_WARNING,
|
||||
NATIVE
|
||||
};
|
||||
|
||||
struct Log
|
||||
{
|
||||
Log(const std::string Message, const int Ticks, const LogType_t Type)
|
||||
{
|
||||
this->Message = Message;
|
||||
this->Ticks = Ticks;
|
||||
this->Type = Type;
|
||||
}
|
||||
std::string Message = "";
|
||||
int Ticks = 1024;
|
||||
LogType_t Type = LogType_t::NATIVE;
|
||||
};
|
||||
|
||||
class LogSystem
|
||||
{
|
||||
public:
|
||||
void AddLog(LogType_t type, std::string text);
|
||||
void Update();
|
||||
|
||||
private:
|
||||
std::array<int, 3> GetLogColorForType(LogType_t type);
|
||||
std::vector<Log> m_vLogs;
|
||||
};
|
||||
|
||||
extern LogSystem g_LogSystem;
|
@ -1,60 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
void InstallOpcodes();
|
||||
inline HANDLE GameProcess = GetCurrentProcess();
|
||||
|
||||
namespace
|
||||
{
|
||||
Module r5_op = Module("r5apex.exe"); // Create module class instance.
|
||||
|
||||
#pragma region Origin
|
||||
/*0x14032EEA0*/
|
||||
MemoryAddress Origin_Init = r5_op.PatternSearch("48 83 EC 28 80 3D ? ? ? 23 ? 0F 85 ? 02 ?");
|
||||
|
||||
/*0x140330290*/
|
||||
MemoryAddress Origin_SetState = r5_op.PatternSearch("48 81 EC 58 04 ? ? 80 3D ? ? ? ? ? 0F 84");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Engine
|
||||
/*0x14043FB90*/
|
||||
MemoryAddress dst002 = r5_op.PatternSearch("48 89 4C 24 08 56 41 55 48 81 EC 68 03 ? ? 4C");
|
||||
|
||||
/*0x14022A4A0*/
|
||||
MemoryAddress dst004 = r5_op.PatternSearch("48 83 EC 38 0F 29 74 24 20 48 89 5C 24 40 48 8B");
|
||||
|
||||
/*0x140238DA0*/
|
||||
MemoryAddress Host_NewGame = r5_op.PatternSearch("48 8B C4 ? 41 54 41 ? 48 81 EC ? ? ? ? F2");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
/*0x14030D000*/
|
||||
MemoryAddress CServer_Auth = r5_op.PatternSearch("40 55 57 41 55 41 57 48 8D AC 24 ? ? ? ?");
|
||||
/*0x1413336F0*/
|
||||
MemoryAddress NetChan_EncKey_DefaultAssign = r5_op.PatternSearch("E8 ? ? ? ? 48 8D 1D ? ? ? ? 4C 39 3D ? ? ? ?");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region FairFight
|
||||
/*0x140303AE0*/
|
||||
MemoryAddress FairFight_Init = r5_op.PatternSearch("40 53 48 83 EC 20 8B 81 B0 03 ? ? 48 8B D9 C6");
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Squirrel
|
||||
/*0x14105CCA0*/
|
||||
MemoryAddress Squirrel_CompileError = r5_op.StringSearch("%s SCRIPT COMPILE ERROR: %s").FindPatternSelf("48 89 5C", MemoryAddress::Direction::UP);
|
||||
#pragma endregion
|
||||
|
||||
void PrintOAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
PRINT_ADDRESS("Origin_Init", Origin_Init.GetPtr());
|
||||
PRINT_ADDRESS("Origin_SetState", Origin_SetState.GetPtr());
|
||||
PRINT_ADDRESS("dst002", dst002.GetPtr());
|
||||
PRINT_ADDRESS("dst004", dst004.GetPtr());
|
||||
PRINT_ADDRESS("Host_NewGame", Host_NewGame.GetPtr());
|
||||
PRINT_ADDRESS("CServer_Auth", CServer_Auth.GetPtr());
|
||||
PRINT_ADDRESS("NetChan_EncKey_DefaultAssign", NetChan_EncKey_DefaultAssign.GetPtr());
|
||||
PRINT_ADDRESS("FairFight_Init", FairFight_Init.GetPtr());
|
||||
PRINT_ADDRESS("Squirrel_CompileError", Squirrel_CompileError.GetPtr());
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
}
|
||||
}
|
@ -1,210 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Define the signatures or offsets to be searched and hooked
|
||||
namespace
|
||||
{
|
||||
Module r5_patterns = Module("r5apex.exe"); // Create module class instance.
|
||||
|
||||
#pragma region Console
|
||||
/*0x140202090*/
|
||||
FUNC_AT_ADDRESS(addr_CommandExecute, void(*)(void*, const char*), r5_patterns.PatternSearch("48 89 5C 24 ? 57 48 83 EC 20 48 8D 0D ? ? ? ? 41 8B D8").GetPtr());
|
||||
|
||||
/*0x14046FE90*/
|
||||
FUNC_AT_ADDRESS(addr_ConVar_IsFlagSet, bool(*)(int**, int), r5_patterns.PatternSearch("48 8B 41 48 85 50 38").GetPtr());
|
||||
|
||||
/*0x14046F490*/
|
||||
FUNC_AT_ADDRESS(addr_ConCommand_IsFlagSet, bool(*)(int*, int), r5_patterns.PatternSearch("85 51 38 0F 95 C0 C3").GetPtr());
|
||||
|
||||
/*0x140279CE0*/
|
||||
FUNC_AT_ADDRESS(addr_downloadPlaylists_Callback, void(*)(), r5_patterns.PatternSearch("33 C9 C6 05 ? ? ? ? ? E9 ? ? ? ?").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Squirrel
|
||||
/*0x141057FD0*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_Print, void*, r5_patterns.PatternSearch("83 F8 01 48 8D 3D ? ? ? ?").OffsetSelf(0x3).FollowNearCallSelf(0x3, 0x7).GetPtr());
|
||||
|
||||
/*0x14105F950*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_Warning, __int64(*)(__int64, int, int, const char*, std::size_t*), r5_patterns.PatternSearch("E8 ? ? ? ? 85 C0 0F 99 C3").FollowNearCallSelf().GetPtr());
|
||||
|
||||
/*0x140B1E55*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_Warning_ReturnAddr, void*, r5_patterns.PatternSearch("E8 ? ? ? ? 85 C0 0F 99 C3").OffsetSelf(0x5).GetPtr());
|
||||
|
||||
/*0x141061A50*/
|
||||
FUNC_AT_ADDRESS(addr_sq_pushstring, void(*)(void*, char*, __int64), r5_patterns.PatternSearch("E8 ? ? ? ? 8D 55 FE").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x141061CD0*/
|
||||
FUNC_AT_ADDRESS(addr_sq_pushbool, void(*)(void*, int), r5_patterns.PatternSearch("E8 ? ? ? ? 41 0F B6 17").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x141061C70*/
|
||||
FUNC_AT_ADDRESS(addr_sq_pushinteger, void(*)(void*, int), r5_patterns.PatternSearch("E8 ? ? ? ? 41 0F B7 17").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x141062040*/
|
||||
FUNC_AT_ADDRESS(addr_sq_newarray, void(*)(void*, int), r5_patterns.PatternSearch("E8 ? ? ? ? 49 63 F5").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x1410621F0*/
|
||||
FUNC_AT_ADDRESS(addr_sq_arrayappend, __int64(*)(void*, int), r5_patterns.PatternSearch("E8 ? ? ? ? 49 63 46 38").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x141061FB0*/
|
||||
FUNC_AT_ADDRESS(addr_sq_newtable, void(*)(void*), r5_patterns.PatternSearch("E8 ? ? ? ? 83 C6 04").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x141064250*/
|
||||
FUNC_AT_ADDRESS(addr_sq_newslot, __int64(*)(void*, int), r5_patterns.PatternSearch("E8 ? ? ? ? 49 63 46 18").FollowNearCall().GetPtr());
|
||||
|
||||
//DWORD64 p_SQVM_LoadScript = FindPattern("r5apex.exe", (const unsigned char*)"\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x48\x89\x4C\x24\x08\x55\x41\x54\x41\x55\x41\x56\x41\x57\x48\x8D\x6C", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // For S0 and S1
|
||||
|
||||
/*0x141055630*/
|
||||
// For anything S2 and above (current S8
|
||||
FUNC_AT_ADDRESS(addr_SQVM_LoadScript, bool(*)(void*, const char*, const char*, int), r5_patterns.PatternSearch("48 8B C4 48 89 48 08 55 41 56 48 8D 68").GetPtr());
|
||||
|
||||
/*0x140C957E0*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_LoadRson, int(*)(const char*), r5_patterns.PatternSearch("4C 8B DC 49 89 5B 08 57 48 81 EC A0 00 00 00 33").GetPtr());
|
||||
|
||||
/*0x140834A00*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_RegisterOriginFuncs, void(*)(void*), r5_patterns.PatternSearch("E8 ? ? ? ? 48 8B 0D ? ? ? ? 48 8D 15 ? ? ? ? E8 ? ? ? ? 48 8B 05 ? ? ? ? C7 05 ? ? ? ? ? ? ? ?").FollowNearCall().GetPtr());
|
||||
|
||||
/*0x140C06B20*/
|
||||
FUNC_AT_ADDRESS(addr_SQVM_RegisterCreatePlayerTasklist, void(*)(void*), r5_patterns.PatternSearch("E8 ? ? ? ? 48 8B 0D ? ? ? ? E8 ? ? ? ? 48 8B CB").FollowNearCall().GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region NetChannel
|
||||
/*0x1402655F0*/
|
||||
FUNC_AT_ADDRESS(addr_NET_PrintFunc, bool(*)(int, void*, bool), r5_patterns.PatternSearch("48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 C3 48").GetPtr());
|
||||
|
||||
/*0x1402655F0*/
|
||||
FUNC_AT_ADDRESS(addr_NET_ReceiveDatagram, bool(*)(int, void*, bool), r5_patterns.PatternSearch("48 89 74 24 18 48 89 7C 24 20 55 41 54 41 55 41 56 41 57 48 8D AC 24 50 EB").GetPtr());
|
||||
|
||||
/*0x1402662D0*/
|
||||
FUNC_AT_ADDRESS(addr_NET_SendDatagram, int(*)(SOCKET, const char*, int, int), r5_patterns.PatternSearch("48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ? 05 ? ?").GetPtr());
|
||||
|
||||
/*0x14025F190*/
|
||||
FUNC_AT_ADDRESS(addr_NetChan_Shutdown, void(*)(void*, const char*, unsigned __int8, char), r5_patterns.StringSearch("Disconnect by server.\n").FindPatternSelf("E8 ? ? ? ? 4C 89 B3 ? ? ? ?", MemoryAddress::Direction::DOWN).FollowNearCallSelf().GetPtr());
|
||||
|
||||
/*0x160686DC0*/
|
||||
MemoryAddress addr_NetChan_EncKeyPtr = r5_patterns.StringSearch("client:NetEncryption_NewKey").FindPatternSelf("48 8D ? ? ? ? ? 48 3B", MemoryAddress::Direction::UP, 150).ResolveRelativeAddressSelf(0x3, 0x7);
|
||||
char* addr_NetChan_EncKey = addr_NetChan_EncKeyPtr.Offset(0x12D0).RCast<char*>();
|
||||
|
||||
/*0x140263E70*/
|
||||
FUNC_AT_ADDRESS(addr_NetChan_SetEncKey, void(*)(uintptr_t, const char*), MemoryAddress(0x140263E70).GetPtr());
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CServer
|
||||
/*0x140310230*/
|
||||
FUNC_AT_ADDRESS(addr_CServer_RejectConnection, void(*)(void*, unsigned int, void*, const char*), r5_patterns.StringSearch("#CONNECTION_FAILED_RESERVATION_TIMEOUT").FindPatternSelf("E8", MemoryAddress::Direction::DOWN).FollowNearCallSelf().GetPtr());
|
||||
|
||||
/*0x14030D000*/
|
||||
FUNC_AT_ADDRESS(addr_CServer_ConnectClient, void*(*)(void*, void*), r5_patterns.StringSearch("dedi.connect.fail.total:1|c\n").FindPatternSelf("E8", MemoryAddress::Direction::UP).FollowNearCallSelf().GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CHLClient
|
||||
/*0x1405C0740*/
|
||||
FUNC_AT_ADDRESS(addr_CHLClient_FrameStageNotify, void(*)(void*, int), r5_patterns.PatternSearch("48 83 EC 28 89 15 ?? ?? ?? ??").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CClient
|
||||
/*0x140302FD0*/
|
||||
FUNC_AT_ADDRESS(addr_CClient_Clear, void(*)(__int64), r5_patterns.StringSearch("Disconnect by server.\n").FindPatternSelf("40", MemoryAddress::Direction::UP).GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CClientState
|
||||
/*0x1418223E4*/
|
||||
FUNC_AT_ADDRESS(addr_m_bRestrictServerCommands, void*, r5_patterns.StringSearch("DevShotGenerator_Init()").FindPatternSelf("88 05", MemoryAddress::Direction::UP).ResolveRelativeAddressSelf(0x2).OffsetSelf(0x2).GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CVEngineServer
|
||||
/*0x140315CF0*/
|
||||
FUNC_AT_ADDRESS(addr_CVEngineServer_IsPersistenceDataAvailable, bool(*)(__int64, int), r5_patterns.PatternSearch("3B 15 ?? ?? ?? ?? 7D 33").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CBaseFileSystem
|
||||
/*0x14038BE20*/
|
||||
FUNC_AT_ADDRESS(addr_CBaseFileSystem_FileSystemWarning, void(*)(void*, FileWarningLevel_t, const char*, ...), r5_patterns.PatternSearch("E8 ? ? ? ? 33 C0 80 3B 2A").FollowNearCallSelf().GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CMatSystemSurface
|
||||
/*0x140548A00*/
|
||||
FUNC_AT_ADDRESS(addr_CMatSystemSurface_LockCursor, void(*)(void*), MemoryAddress(0x140548A00).GetPtr()); // Maybe sigscan this via RTTI.
|
||||
|
||||
/*0x1405489C0*/
|
||||
FUNC_AT_ADDRESS(addr_CMatSystemSurface_UnlockCursor, void(*)(void*), MemoryAddress(0x1405489C0).GetPtr()); // Maybe sigscan this via RTTI.
|
||||
|
||||
/*0x140547900*/
|
||||
FUNC_AT_ADDRESS(addr_CMatSystemSurface_DrawColoredText, void(*)(void*, int, int, int, int, int, int, int, int, const char*, ...), MemoryAddress(0x140547900).GetPtr());
|
||||
#pragma region Utility
|
||||
/*0x140295600*/
|
||||
FUNC_AT_ADDRESS(addr_MSG_EngineError, int(*)(char*, va_list), r5_patterns.StringSearch("Engine Error").FindPatternSelf("48 89 ? ? ? 48 89", MemoryAddress::Direction::UP, 500).GetPtr());
|
||||
|
||||
/*0x1401B31C0*/
|
||||
FUNC_AT_ADDRESS(addr_MemAlloc_Wrapper, void*(*)(__int64), r5_patterns.StringSearch("ConversionModeMenu").FindPatternSelf("E8 ? ? ? ? 48", MemoryAddress::Direction::UP).FollowNearCallSelf().GetPtr());
|
||||
|
||||
/*0x14B37DE80 has current loaded playlist name*/
|
||||
/*0x1402790C0*/
|
||||
FUNC_AT_ADDRESS(addr_LoadPlaylist, bool(*)(const char*), r5_patterns.PatternSearch("E8 ? ? ? ? 80 3D ? ? ? ? ? 74 0C").FollowNearCallSelf().GetPtr());
|
||||
|
||||
/*0x1671060C0*/
|
||||
FUNC_AT_ADDRESS(addr_MapVPKCache, void*, r5_patterns.StringSearch("PrecacheMTVF").FindPatternSelf("48 8D 1D ? ? ? ? 4C", MemoryAddress::Direction::UP, 900).OffsetSelf(0x3).ResolveRelativeAddressSelf().GetPtr());
|
||||
|
||||
/*0x140278C50*/
|
||||
FUNC_AT_ADDRESS(addr_mp_gamemode_Callback, bool(*)(const char*), r5_patterns.StringSearch("Failed to load playlist data\n").FindPatternSelf("E8 ? ? ? ? B0 01", MemoryAddress::Direction::DOWN, 200).FollowNearCallSelf().GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region KeyValues
|
||||
/*0x1404744E0*/
|
||||
FUNC_AT_ADDRESS(addr_KeyValues_FindKey, void*(*)(void*, const char*, bool), r5_patterns.PatternSearch("40 56 57 41 57 48 81 EC ?? ?? ?? ?? 45").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CEngineVGui
|
||||
/*0x140283FD0*/
|
||||
FUNC_AT_ADDRESS(addr_CEngineVGui_Paint, int(*)(void*, int), r5_patterns.PatternSearch("41 55 41 56 48 83 EC 78 44 8B EA").GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
#pragma region OriginSDK
|
||||
/*0x1410A2D70*/
|
||||
FUNC_AT_ADDRESS(addr_OriginGetErrorDescription, const char*(*)(std::int32_t), r5_patterns.StringSearch("OriginGetErrorDescription entered").FindPatternSelf("40 53", MemoryAddress::Direction::UP).GetPtr());
|
||||
#pragma endregion
|
||||
|
||||
|
||||
void PrintHAddress() // Test the sigscan results
|
||||
{
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
PRINT_ADDRESS("CommandExecute", addr_CommandExecute);
|
||||
PRINT_ADDRESS("ConVar_IsFlagSet", addr_ConVar_IsFlagSet);
|
||||
PRINT_ADDRESS("ConCommand_IsFlagSet", addr_ConCommand_IsFlagSet);
|
||||
PRINT_ADDRESS("Downloadplaylists_Callback", addr_downloadPlaylists_Callback);
|
||||
PRINT_ADDRESS("MP_gamemode_Callback", addr_mp_gamemode_Callback);
|
||||
PRINT_ADDRESS("SQVM_Print", addr_SQVM_Print);
|
||||
PRINT_ADDRESS("SQVM_LoadScript", addr_SQVM_LoadScript);
|
||||
PRINT_ADDRESS("SQVM_LoadRson", addr_SQVM_LoadRson);
|
||||
PRINT_ADDRESS("SQVM_Warning", addr_SQVM_Warning);
|
||||
PRINT_ADDRESS("SQVM_Warning_ReturnAddr", addr_SQVM_Warning_ReturnAddr);
|
||||
PRINT_ADDRESS("SQVM_RegisterOriginFuncs", addr_SQVM_RegisterOriginFuncs);
|
||||
PRINT_ADDRESS("SQVM_RegisterCreatePlayerTasklist", addr_SQVM_RegisterCreatePlayerTasklist);
|
||||
PRINT_ADDRESS("sq_arrayappend", addr_sq_arrayappend);
|
||||
PRINT_ADDRESS("sq_newarray", addr_sq_newarray);
|
||||
PRINT_ADDRESS("sq_newslot", addr_sq_newslot);
|
||||
PRINT_ADDRESS("sq_newtable", addr_sq_newtable);
|
||||
PRINT_ADDRESS("sq_pushbool", addr_sq_pushbool);
|
||||
PRINT_ADDRESS("sq_pushinteger", addr_sq_pushinteger);
|
||||
PRINT_ADDRESS("sq_pushstring", addr_sq_pushstring);
|
||||
PRINT_ADDRESS("NET_PrintFunc", addr_NET_PrintFunc);
|
||||
PRINT_ADDRESS("NET_ReceiveDatagram", addr_NET_ReceiveDatagram);
|
||||
PRINT_ADDRESS("NET_SendDatagram ", addr_NET_SendDatagram);
|
||||
PRINT_ADDRESS("CClientState::m_bRestrictServerCommands", addr_m_bRestrictServerCommands);
|
||||
PRINT_ADDRESS("CClient::Clear", addr_CClient_Clear);
|
||||
PRINT_ADDRESS("INetChannel::Shutdown", addr_NetChan_Shutdown);
|
||||
PRINT_ADDRESS("INetChannel::SetEncryptionKey", addr_NetChan_SetEncKey);
|
||||
PRINT_ADDRESS("INetChannel::EncryptionKey", addr_NetChan_EncKey);
|
||||
PRINT_ADDRESS("CHLClient::FrameStageNotify", addr_CHLClient_FrameStageNotify);
|
||||
PRINT_ADDRESS("CVEngineServer::IsPersistenceDataAvailable", addr_CVEngineServer_IsPersistenceDataAvailable);
|
||||
PRINT_ADDRESS("CServer::ConnectClient", addr_CServer_ConnectClient);
|
||||
PRINT_ADDRESS("CServer::RejectConnection", addr_CServer_RejectConnection);
|
||||
PRINT_ADDRESS("CBaseFileSystem::FileSystemWarning", addr_CBaseFileSystem_FileSystemWarning);
|
||||
PRINT_ADDRESS("MSG_EngineError", addr_MSG_EngineError);
|
||||
PRINT_ADDRESS("LoadPlaylist", addr_LoadPlaylist);
|
||||
PRINT_ADDRESS("MapVPKCache", addr_MapVPKCache);
|
||||
PRINT_ADDRESS("MemAlloc_Wrapper", addr_MemAlloc_Wrapper);
|
||||
PRINT_ADDRESS("KeyValues::FindKey", addr_KeyValues_FindKey);
|
||||
std::cout << "+--------------------------------------------------------+" << std::endl;
|
||||
// TODO implement error handling when sigscan fails or result is 0
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user