mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Particle: add pak to load after effects
Future planned porting of effects assets will be moved into this rpak file. This pak file loads directly after effects.rpak is loaded, and only if it was loaded.
This commit is contained in:
parent
ff303d5de8
commit
d6cff51624
@ -68,6 +68,7 @@ add_subdirectory( inputsystem )
|
||||
add_subdirectory( filesystem )
|
||||
add_subdirectory( datacache )
|
||||
add_subdirectory( studiorender )
|
||||
add_subdirectory( particles )
|
||||
add_subdirectory( localize )
|
||||
add_subdirectory( engine )
|
||||
add_subdirectory( vguimatsurface )
|
||||
|
@ -113,6 +113,8 @@ target_link_libraries( ${PROJECT_NAME} PRIVATE
|
||||
"vgui"
|
||||
"rui"
|
||||
|
||||
"particles"
|
||||
|
||||
"d3d11.lib"
|
||||
"${THIRDPARTY_SOURCE_DIR}/nvapi/amd64/nvapi64.lib"
|
||||
)
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "vgui/vgui_fpspanel.h"
|
||||
#include "vgui/vgui_controls/RichText.h"
|
||||
#include "vguimatsurface/MatSystemSurface.h"
|
||||
#include "particles/particles.h"
|
||||
#include "engine/client/vengineclient_impl.h"
|
||||
#include "engine/client/cdll_engine_int.h"
|
||||
#include "engine/client/datablock_receiver.h"
|
||||
@ -573,6 +574,9 @@ void DetourRegister() // Register detour classes to be searched and hooked.
|
||||
REGISTER(VVGUIRichText); // REGISTER CLIENT ONLY!
|
||||
REGISTER(VMatSystemSurface);
|
||||
|
||||
// Particles
|
||||
REGISTER(VParticles);
|
||||
|
||||
// Client
|
||||
REGISTER(HVEngineClient);
|
||||
REGISTER(VDll_Engine_Int);
|
||||
|
13
src/particles/CMakeLists.txt
Normal file
13
src/particles/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
cmake_minimum_required( VERSION 3.16 )
|
||||
add_module( "lib" "particles" "vpc" ${FOLDER_CONTEXT} TRUE TRUE )
|
||||
|
||||
start_sources()
|
||||
|
||||
add_sources( SOURCE_GROUP "Runtime"
|
||||
"particles.cpp"
|
||||
"particles.h"
|
||||
)
|
||||
|
||||
end_sources()
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} PRIVATE "${ENGINE_SOURCE_DIR}/tier0/" "${ENGINE_SOURCE_DIR}/tier1/" )
|
34
src/particles/particles.cpp
Normal file
34
src/particles/particles.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
//===========================================================================//
|
||||
//
|
||||
// Purpose: particle system code
|
||||
//
|
||||
//===========================================================================//
|
||||
#include "tier0/commandline.h"
|
||||
#include "rtech/pak/pakstate.h"
|
||||
#include "particles.h"
|
||||
|
||||
static void ParticleSystem_Init()
|
||||
{
|
||||
// Call the original function to load the core particle files, and then
|
||||
// load our effects rpak afterwards to we can patch what is loaded in the
|
||||
// effects.rpak loaded by the engine.
|
||||
v_ParticleSystem_Init();
|
||||
|
||||
// This tells the engine to load the raw DMX files instead, which are
|
||||
// listed inside the particles_manifest.txt file as PCF files.
|
||||
const bool loadUnbaked = CommandLine()->FindParm("-tools") || CommandLine()->FindParm("-nobakedparticles");
|
||||
|
||||
if (!loadUnbaked || CommandLine()->FindParm("-bakedparticles"))
|
||||
{
|
||||
const char* const pakName = "effects_sdk.rpak";
|
||||
const PakHandle_t pakId = g_pakLoadApi->LoadAsyncAndWait(pakName, AlignedMemAlloc(), 3, nullptr);
|
||||
|
||||
if (pakId == PAK_INVALID_HANDLE)
|
||||
Error(eDLL_T::ENGINE, EXIT_FAILURE, "Failed to load pak file '%s'\n", pakName);
|
||||
}
|
||||
}
|
||||
|
||||
void VParticles::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourSetup(&v_ParticleSystem_Init, ParticleSystem_Init, bAttach);
|
||||
}
|
28
src/particles/particles.h
Normal file
28
src/particles/particles.h
Normal file
@ -0,0 +1,28 @@
|
||||
//===========================================================================//
|
||||
//
|
||||
// Purpose: particle system definitions
|
||||
//
|
||||
//===========================================================================//
|
||||
#ifndef PARTICLES_H
|
||||
#define PARTICLES_H
|
||||
|
||||
inline void (*v_ParticleSystem_Init)(void);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VParticles : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
LogFunAdr("ParticleSystem_Init", v_ParticleSystem_Init);
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
g_GameDll.FindPatternSIMD("48 89 4C 24 ?? 55 53 56 57 48 8D AC 24 ?? ?? ?? ?? 48 81 EC ?? ?? ?? ?? 33 F6").GetPtr(v_ParticleSystem_Init);
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // PARTICLES_H
|
Loading…
x
Reference in New Issue
Block a user