Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ASpoonPlaysGames committed Feb 14, 2024
2 parents 41ead31 + fc63948 commit 5cb3d3c
Show file tree
Hide file tree
Showing 42 changed files with 1,709 additions and 810 deletions.
20 changes: 17 additions & 3 deletions primedev/Northstar.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ add_library(
"client/debugoverlay.cpp"
"client/demofixes.cpp"
"client/diskvmtfixes.cpp"
"client/entity_client_tools.cpp"
"client/languagehooks.cpp"
"client/latencyflex.cpp"
"client/localchatwriter.cpp"
Expand All @@ -35,7 +36,9 @@ add_library(
"core/math/bits.h"
"core/math/color.cpp"
"core/math/color.h"
"core/math/math_pfns.h"
"core/math/vector.h"
"core/math/vplane.h"
"core/hooks.cpp"
"core/hooks.h"
"core/macros.h"
Expand All @@ -47,6 +50,8 @@ add_library(
"core/sourceinterface.h"
"core/tier0.cpp"
"core/tier0.h"
"core/tier1.cpp"
"core/tier1.h"
"dedicated/dedicated.cpp"
"dedicated/dedicated.h"
"dedicated/dedicatedlogtoclient.cpp"
Expand Down Expand Up @@ -78,11 +83,16 @@ add_library(
"mods/modmanager.h"
"mods/modsavefiles.cpp"
"mods/modsavefiles.h"
"plugins/plugin_abi.h"
"plugins/pluginbackend.cpp"
"plugins/pluginbackend.h"
"plugins/interfaces/interface.h"
"plugins/interfaces/interface.cpp"
"plugins/interfaces/sys/ISys.h"
"plugins/interfaces/sys/ISys.cpp"
"plugins/interfaces/IPluginId.h"
"plugins/interfaces/IPluginCallbacks.h"
"plugins/plugins.cpp"
"plugins/plugins.h"
"plugins/pluginmanager.h"
"plugins/pluginmanager.cpp"
"scripts/client/clientchathooks.cpp"
"scripts/client/cursorposition.cpp"
"scripts/client/scriptbrowserhooks.cpp"
Expand All @@ -105,6 +115,10 @@ add_library(
"server/auth/serverauthentication.cpp"
"server/auth/serverauthentication.h"
"server/alltalk.cpp"
"server/ai_helper.cpp"
"server/ai_helper.h"
"server/ai_navmesh.cpp"
"server/ai_navmesh.h"
"server/buildainfile.cpp"
"server/r2server.cpp"
"server/r2server.h"
Expand Down
5 changes: 5 additions & 0 deletions primedev/client/cdll_client_int.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#include "toolframework/itoolentity.h"

inline IClientTools* g_pClientTools = nullptr;
69 changes: 21 additions & 48 deletions primedev/client/debugoverlay.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "debugoverlay.h"

#include "dedicated/dedicated.h"
#include "tier1/cvar.h"
#include "core/math/vector.h"
#include "server/ai_helper.h"

AUTOHOOK_INIT()

Expand Down Expand Up @@ -122,48 +125,13 @@ struct OverlaySphere_t : public OverlayBase_t
bool m_bWireframe;
};

typedef bool (*OverlayBase_t__IsDeadType)(OverlayBase_t* a1);
static OverlayBase_t__IsDeadType OverlayBase_t__IsDead;
typedef void (*OverlayBase_t__DestroyOverlayType)(OverlayBase_t* a1);
static OverlayBase_t__DestroyOverlayType OverlayBase_t__DestroyOverlay;
static bool (*OverlayBase_t__IsDead)(OverlayBase_t* a1);
static void (*OverlayBase_t__DestroyOverlay)(OverlayBase_t* a1);

static ConVar* Cvar_enable_debug_overlays;

LPCRITICAL_SECTION s_OverlayMutex;

// Render Line
typedef void (*RenderLineType)(const Vector3& v1, const Vector3& v2, Color c, bool bZBuffer);
static RenderLineType RenderLine;

// Render box
typedef void (*RenderBoxType)(
const Vector3& vOrigin, const QAngle& angles, const Vector3& vMins, const Vector3& vMaxs, Color c, bool bZBuffer, bool bInsideOut);
static RenderBoxType RenderBox;

// Render wireframe box
static RenderBoxType RenderWireframeBox;

// Render swept box
typedef void (*RenderWireframeSweptBoxType)(
const Vector3& vStart, const Vector3& vEnd, const QAngle& angles, const Vector3& vMins, const Vector3& vMaxs, Color c, bool bZBuffer);
RenderWireframeSweptBoxType RenderWireframeSweptBox;

// Render Triangle
typedef void (*RenderTriangleType)(const Vector3& p1, const Vector3& p2, const Vector3& p3, Color c, bool bZBuffer);
static RenderTriangleType RenderTriangle;

// Render Axis
typedef void (*RenderAxisType)(const Vector3& vOrigin, float flScale, bool bZBuffer);
static RenderAxisType RenderAxis;

// I dont know
typedef void (*RenderUnknownType)(const Vector3& vUnk, float flUnk, bool bUnk);
static RenderUnknownType RenderUnknown;

// Render Sphere
typedef void (*RenderSphereType)(const Vector3& vCenter, float flRadius, int nTheta, int nPhi, Color c, bool bZBuffer);
static RenderSphereType RenderSphere;

OverlayBase_t** s_pOverlays;

int* g_nRenderTickCount;
Expand Down Expand Up @@ -317,24 +285,29 @@ void, __fastcall, (bool bRender))
}
}

if (bRender && Cvar_enable_debug_overlays->GetBool())
{
g_pAIHelper->DrawNavmeshPolys();
}

LeaveCriticalSection(s_OverlayMutex);
}

ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", DebugOverlay, ConVar, (CModule module))
{
AUTOHOOK_DISPATCH()

OverlayBase_t__IsDead = module.Offset(0xACAC0).RCast<OverlayBase_t__IsDeadType>();
OverlayBase_t__DestroyOverlay = module.Offset(0xAB680).RCast<OverlayBase_t__DestroyOverlayType>();

RenderLine = module.Offset(0x192A70).RCast<RenderLineType>();
RenderBox = module.Offset(0x192520).RCast<RenderBoxType>();
RenderWireframeBox = module.Offset(0x193DA0).RCast<RenderBoxType>();
RenderWireframeSweptBox = module.Offset(0x1945A0).RCast<RenderWireframeSweptBoxType>();
RenderTriangle = module.Offset(0x193940).RCast<RenderTriangleType>();
RenderAxis = module.Offset(0x1924D0).RCast<RenderAxisType>();
RenderSphere = module.Offset(0x194170).RCast<RenderSphereType>();
RenderUnknown = module.Offset(0x1924E0).RCast<RenderUnknownType>();
OverlayBase_t__IsDead = module.Offset(0xACAC0).RCast<decltype(OverlayBase_t__IsDead)>();
OverlayBase_t__DestroyOverlay = module.Offset(0xAB680).RCast<decltype(OverlayBase_t__DestroyOverlay)>();

RenderLine = module.Offset(0x192A70).RCast<decltype(RenderLine)>();
RenderBox = module.Offset(0x192520).RCast<decltype(RenderBox)>();
RenderWireframeBox = module.Offset(0x193DA0).RCast<decltype(RenderWireframeBox)>();
RenderWireframeSweptBox = module.Offset(0x1945A0).RCast<decltype(RenderWireframeSweptBox)>();
RenderTriangle = module.Offset(0x193940).RCast<decltype(RenderTriangle)>();
RenderAxis = module.Offset(0x1924D0).RCast<decltype(RenderAxis)>();
RenderSphere = module.Offset(0x194170).RCast<decltype(RenderSphere)>();
RenderUnknown = module.Offset(0x1924E0).RCast<decltype(RenderUnknown)>();

s_OverlayMutex = module.Offset(0x10DB0A38).RCast<LPCRITICAL_SECTION>();

Expand Down
28 changes: 28 additions & 0 deletions primedev/client/debugoverlay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

// Render Line
inline void (*RenderLine)(const Vector3& v1, const Vector3& v2, Color c, bool bZBuffer);

// Render box
inline void (*RenderBox)(
const Vector3& vOrigin, const QAngle& angles, const Vector3& vMins, const Vector3& vMaxs, Color c, bool bZBuffer, bool bInsideOut);

// Render wireframe box
inline void (*RenderWireframeBox)(
const Vector3& vOrigin, const QAngle& angles, const Vector3& vMins, const Vector3& vMaxs, Color c, bool bZBuffer, bool bInsideOut);

// Render swept box
inline void (*RenderWireframeSweptBox)(
const Vector3& vStart, const Vector3& vEnd, const QAngle& angles, const Vector3& vMins, const Vector3& vMaxs, Color c, bool bZBuffer);

// Render Triangle
inline void (*RenderTriangle)(const Vector3& p1, const Vector3& p2, const Vector3& p3, Color c, bool bZBuffer);

// Render Axis
inline void (*RenderAxis)(const Vector3& vOrigin, float flScale, bool bZBuffer);

// I dont know
inline void (*RenderUnknown)(const Vector3& vUnk, float flUnk, bool bUnk);

// Render Sphere
inline void (*RenderSphere)(const Vector3& vCenter, float flRadius, int nTheta, int nPhi, Color c, bool bZBuffer);
13 changes: 13 additions & 0 deletions primedev/client/entity_client_tools.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "toolframework/itoolentity.h"
#include "client/cdll_client_int.h"
#include "core/tier1.h"

class CClientTools : public IClientTools
{
public:
};

ON_DLL_LOAD("client.dll", ClientClientTools, (CModule module))
{
g_pClientTools = Sys_GetFactoryPtr("client.dll", "VCLIENTTOOLS001").RCast<IClientTools*>();
}
6 changes: 3 additions & 3 deletions primedev/core/hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "dedicated/dedicated.h"
#include "plugins/pluginbackend.h"
#include "plugins/pluginmanager.h"

#include <iostream>
#include <wchar.h>
Expand Down Expand Up @@ -417,7 +417,7 @@ HMODULE, WINAPI, (LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags))
if (moduleAddress)
{
CallLoadLibraryACallbacks(lpLibFileName, moduleAddress);
InformPluginsDLLLoad(fs::path(lpLibFileName), moduleAddress);
g_pPluginManager->InformDllLoad(moduleAddress, fs::path(lpLibFileName));
}

return moduleAddress;
Expand Down Expand Up @@ -459,7 +459,7 @@ HMODULE, WINAPI, (LPCWSTR lpLibFileName))
if (moduleAddress)
{
CallLoadLibraryWCallbacks(lpLibFileName, moduleAddress);
InformPluginsDLLLoad(fs::path(lpLibFileName), moduleAddress);
g_pPluginManager->InformDllLoad(moduleAddress, fs::path(lpLibFileName));
}

return moduleAddress;
Expand Down
7 changes: 7 additions & 0 deletions primedev/core/math/math_pfns.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

inline float FastSqrt(float x)
{
__m128 root = _mm_sqrt_ss(_mm_load_ss(&x));
return *(reinterpret_cast<float*>(&root));
}
Loading

0 comments on commit 5cb3d3c

Please sign in to comment.