From 86f3a2d9e749623bafdbe94ad9b6f24fb6880949 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Wed, 13 May 2015 16:57:32 +0200 Subject: [PATCH] Small optimization. --- t5exp/PatchT5.cpp | 11 +++++------ t5exp/T5.cpp | 6 ++++++ t5exp/{XModel.h => T5.h} | 24 +++++++++++++++++++++++- t5exp/XModelExport.cpp | 21 +++++---------------- t5exp/stdinc.h | 7 +++++-- t5exp/t5exp.vcxproj | 3 ++- t5exp/t5exp.vcxproj.filters | 7 +++++-- t5exp/t5exp.vcxproj.user | 4 ++-- 8 files changed, 53 insertions(+), 30 deletions(-) create mode 100644 t5exp/T5.cpp rename t5exp/{XModel.h => T5.h} (93%) diff --git a/t5exp/PatchT5.cpp b/t5exp/PatchT5.cpp index 0d7bb17..b1f9694 100644 --- a/t5exp/PatchT5.cpp +++ b/t5exp/PatchT5.cpp @@ -1,13 +1,11 @@ #include "stdinc.h" -typedef void(__cdecl * DB_LoadXAssets_t)(XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); -DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x4359A0; - void XModelExport(const char* name); void DumpStuff() { XModelExport("t5_weapon_ak74u_viewmodel"); + XModelExport("t5_weapon_galil_viewmodel"); } void RunStuff() @@ -36,13 +34,14 @@ void Sys_RunInit() // Custom command line *(char**)0x403683 = "+set dedicated 1"; - //nop(0x456E03, 5); - *(BYTE*)0x46EA60 = 0xC3; - // Hook random frame function. FastFiles will all be loaded then. call(0x86C785, RunStuff, PATCH_CALL); // Don't initialize network stuff + *(BYTE*)0x46EA60 = 0xC3; + + // Ignore dedi authentication nop(0x4ED3E8, 5); + *(BYTE*)0x5AFD60 = 0xC3; *(BYTE*)0x5D4500 = 0xC3; } \ No newline at end of file diff --git a/t5exp/T5.cpp b/t5exp/T5.cpp new file mode 100644 index 0000000..6c1a86e --- /dev/null +++ b/t5exp/T5.cpp @@ -0,0 +1,6 @@ +#include "stdinc.h" + +Com_Printf_t Com_Printf = (Com_Printf_t)0x4126C0; +DB_FindXAssetHeader_t DB_FindXAssetHeader = (DB_FindXAssetHeader_t)0x493A60; +DB_LoadXAssets_t DB_LoadXAssets = (DB_LoadXAssets_t)0x4359A0; +SL_ConvertToString_t SL_ConvertToString = (SL_ConvertToString_t)0x624C70; \ No newline at end of file diff --git a/t5exp/XModel.h b/t5exp/T5.h similarity index 93% rename from t5exp/XModel.h rename to t5exp/T5.h index 9071aa2..0b4ccce 100644 --- a/t5exp/XModel.h +++ b/t5exp/T5.h @@ -1,5 +1,7 @@ #include +typedef float vec3_t[3]; + struct DObjAnimMat { float quat[4]; @@ -562,7 +564,7 @@ struct XModel float maxs[3]; __int16 numLods; __int16 collLod; - + union { XModelStreamInfo streamInfo; @@ -634,3 +636,23 @@ struct XZoneInfo int allocFlags; int freeFlags; }; + + +enum scriptInstance_t +{ + SCRIPTINSTANCE_SERVER = 0x0, + SCRIPTINSTANCE_CLIENT = 0x1, + SCRIPT_INSTANCE_MAX = 0x2, +}; + +typedef void(__cdecl * Com_Printf_t)(int channel, const char *fmt, ...); +extern Com_Printf_t Com_Printf; + +typedef void *(__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char *name, bool errorIfMissing, int waitTime); +extern DB_FindXAssetHeader_t DB_FindXAssetHeader; + +typedef void(__cdecl * DB_LoadXAssets_t)(XZoneInfo *zoneInfo, unsigned int zoneCount, int sync); +extern DB_LoadXAssets_t DB_LoadXAssets; + +typedef const char *(__cdecl * SL_ConvertToString_t)(unsigned int stringValue, scriptInstance_t inst); +extern SL_ConvertToString_t SL_ConvertToString; diff --git a/t5exp/XModelExport.cpp b/t5exp/XModelExport.cpp index b012f28..43bca4c 100644 --- a/t5exp/XModelExport.cpp +++ b/t5exp/XModelExport.cpp @@ -1,20 +1,4 @@ #include "stdinc.h" -#include - -typedef float vec3_t[3]; - -enum scriptInstance_t -{ - SCRIPTINSTANCE_SERVER = 0x0, - SCRIPTINSTANCE_CLIENT = 0x1, - SCRIPT_INSTANCE_MAX = 0x2, -}; - -typedef void *(__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char *name, bool errorIfMissing, int waitTime); -DB_FindXAssetHeader_t DB_FindXAssetHeader = (DB_FindXAssetHeader_t)0x493A60; - -typedef const char *(__cdecl * SL_ConvertToString_t)(unsigned int stringValue, scriptInstance_t inst); -SL_ConvertToString_t SL_ConvertToString = (SL_ConvertToString_t)0x624C70; Stream* Buffer = 0; @@ -346,6 +330,11 @@ void XModelExport(const char* name) { fwrite(_Buffer.Data(), _Buffer.Size(), 1, fp); fclose(fp); + Com_Printf(0, "File '%s' written\n", _name.c_str()); + } + else + { + Com_Printf(0, "Unable to write file '%s'\n", _name.c_str()); } } } \ No newline at end of file diff --git a/t5exp/stdinc.h b/t5exp/stdinc.h index acf808f..7d81c0a 100644 --- a/t5exp/stdinc.h +++ b/t5exp/stdinc.h @@ -3,6 +3,9 @@ #define _CRT_SECURE_NO_WARNINGS #define WIN32_LEAN_AND_MEAN #include +#include + #include "Hooking.h" -#include "XModel.h" -#include "Stream.h" \ No newline at end of file +#include "Stream.h" + +#include "T5.h" \ No newline at end of file diff --git a/t5exp/t5exp.vcxproj b/t5exp/t5exp.vcxproj index 7b654bc..feaa3d4 100644 --- a/t5exp/t5exp.vcxproj +++ b/t5exp/t5exp.vcxproj @@ -89,7 +89,7 @@ - + @@ -104,6 +104,7 @@ + diff --git a/t5exp/t5exp.vcxproj.filters b/t5exp/t5exp.vcxproj.filters index cfe0bb9..0e6a96c 100644 --- a/t5exp/t5exp.vcxproj.filters +++ b/t5exp/t5exp.vcxproj.filters @@ -33,6 +33,9 @@ Quelldateien + + Quelldateien + @@ -41,10 +44,10 @@ Headerdateien - + Headerdateien - + Headerdateien diff --git a/t5exp/t5exp.vcxproj.user b/t5exp/t5exp.vcxproj.user index 92e564b..e9eb4b8 100644 --- a/t5exp/t5exp.vcxproj.user +++ b/t5exp/t5exp.vcxproj.user @@ -1,12 +1,12 @@  - t5exp.exe + BlackOpsMP.exe D:\Games\SteamLibrary\steamapps\common\Call of Duty Black Ops\ WindowsLocalDebugger - t5exp.exe + BlackOpsMP.exe D:\Games\SteamLibrary\steamapps\common\Call of Duty Black Ops\ WindowsLocalDebugger