Partially aka. weapon stuff.
This commit is contained in:
parent
a016c17e8e
commit
10c8dc9ee0
@ -17,6 +17,7 @@ namespace Components
|
||||
Loader::Register(new Colors());
|
||||
Loader::Register(new D3D9Ex());
|
||||
Loader::Register(new Logger());
|
||||
Loader::Register(new Weapon());
|
||||
Loader::Register(new Window());
|
||||
Loader::Register(new Command());
|
||||
Loader::Register(new Console());
|
||||
|
@ -28,6 +28,7 @@ namespace Components
|
||||
#include "Modules\Colors.hpp"
|
||||
#include "Modules\D3D9Ex.hpp"
|
||||
#include "Modules\Logger.hpp"
|
||||
#include "Modules\Weapon.hpp"
|
||||
#include "Modules\Window.hpp"
|
||||
#include "Modules\Command.hpp"
|
||||
#include "Modules\Console.hpp"
|
||||
|
28
src/Components/Modules/Weapon.cpp
Normal file
28
src/Components/Modules/Weapon.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
Game::XAssetHeader Weapon::WeaponFileLoad(Game::XAssetType type, const char* filename)
|
||||
{
|
||||
Game::XAssetHeader header = { nullptr };
|
||||
|
||||
// Try loading raw weapon
|
||||
if (FileSystem::File(Utils::VA("weapons/mp/%s", filename)).Exists())
|
||||
{
|
||||
header.data = Game::BG_LoadWeaponDef_LoadObj(filename);
|
||||
}
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
Weapon::Weapon()
|
||||
{
|
||||
// Intercept weapon loading
|
||||
AssetHandler::OnFind(Game::XAssetType::ASSET_TYPE_WEAPON, Weapon::WeaponFileLoad);
|
||||
|
||||
// weapon asset existence check
|
||||
Utils::Hook::Nop(0x408228, 5); // find asset header
|
||||
Utils::Hook::Nop(0x408230, 5); // is asset default
|
||||
Utils::Hook::Nop(0x40823A, 2); // jump
|
||||
}
|
||||
}
|
12
src/Components/Modules/Weapon.hpp
Normal file
12
src/Components/Modules/Weapon.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
namespace Components
|
||||
{
|
||||
class Weapon : public Component
|
||||
{
|
||||
public:
|
||||
Weapon();
|
||||
const char* GetName() { return "Weapon"; };
|
||||
|
||||
private:
|
||||
static Game::XAssetHeader WeaponFileLoad(Game::XAssetType type, const char* filename);
|
||||
};
|
||||
}
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Game
|
||||
{
|
||||
BG_LoadWeaponDef_LoadObj_t BG_LoadWeaponDef_LoadObj = (BG_LoadWeaponDef_LoadObj_t)0x57B5F0;
|
||||
|
||||
Cbuf_AddText_t Cbuf_AddText = (Cbuf_AddText_t)0x404B20;
|
||||
|
||||
CL_GetClientName_t CL_GetClientName = (CL_GetClientName_t)0x4563D0;
|
||||
|
@ -1,6 +1,9 @@
|
||||
namespace Game
|
||||
{
|
||||
typedef void(__cdecl * Cbuf_AddText_t)(int a1, const char* cmd);
|
||||
typedef void*(__cdecl * BG_LoadWeaponDef_LoadObj_t)(const char* filename);
|
||||
extern BG_LoadWeaponDef_LoadObj_t BG_LoadWeaponDef_LoadObj;
|
||||
|
||||
typedef void(__cdecl * Cbuf_AddText_t)(int localClientNum, const char *text);
|
||||
extern Cbuf_AddText_t Cbuf_AddText;
|
||||
|
||||
typedef char*(__cdecl * CL_GetClientName_t)(int localClientNum, int index, char *buf, size_t size);
|
||||
|
@ -11,6 +11,7 @@ namespace Utils
|
||||
Hook() : Place(nullptr), Stub(nullptr), Initialized(false), Installed(false), UseJump(false), Protection(0) { ZeroMemory(Hook::Buffer, sizeof(Hook::Buffer)); }
|
||||
Hook(void* place, void* stub, bool useJump = true) : Hook() { Hook::Initialize(place, stub, useJump); }
|
||||
Hook(DWORD place, void* stub, bool useJump = true) : Hook((void*)place, stub, useJump) {}
|
||||
Hook(DWORD place, DWORD stub, bool useJump = true) : Hook((void*)place, (void*)stub, useJump) {}
|
||||
|
||||
~Hook();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user