Use t6-gsc-utils as a base.

This commit is contained in:
JezuzLizard
2023-03-23 19:58:53 -07:00
parent e5b1504c1c
commit 011bb0c554
40 changed files with 2556 additions and 0 deletions

32
src/game/game.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <stdinc.hpp>
#include "game.hpp"
#include <utils/hook.hpp>
namespace game
{
gamemode current = reinterpret_cast<const char*>(0x88A5DC) != "CoDWaW.exe"s
? gamemode::multiplayer
: gamemode::singleplayer;
namespace environment
{
bool t4mp()
{
return current == gamemode::multiplayer;
}
bool t4sp()
{
return current == gamemode::singleplayer;
}
}
namespace plutonium
{
bool is_up_to_date()
{
return true;
}
}
}

66
src/game/game.hpp Normal file
View File

@ -0,0 +1,66 @@
#pragma once
#include "structs.hpp"
#define SELECT(mp, sp) (game::environment::t4mp() ? mp : sp)
namespace game
{
enum gamemode
{
multiplayer,
singleplayer,
none
};
extern gamemode current;
namespace environment
{
bool t4mp();
bool t4sp();
}
template <typename T>
class symbol
{
public:
symbol(const size_t t4mp, const size_t t4sp)
: t4mp_(reinterpret_cast<T*>(t4mp))
, t4sp_(reinterpret_cast<T*>(t4sp))
{
}
T* get() const
{
if (environment::t4mp())
{
return t4mp_;
}
return t4sp_;
}
void set(const size_t ptr)
{
this->t4mp_ = reinterpret_cast<T*>(ptr);
this->t4sp_ = reinterpret_cast<T*>(ptr);
}
operator T* () const
{
return this->get();
}
T* operator->() const
{
return this->get();
}
private:
T* t4mp_;
T* t4sp_;
};
}
#include "symbols.hpp"

9
src/game/structs.hpp Normal file
View File

@ -0,0 +1,9 @@
#pragma once
namespace game
{
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
}

15
src/game/symbols.hpp Normal file
View File

@ -0,0 +1,15 @@
#pragma once
#define WEAK __declspec(selectany)
namespace game
{
// Functions
// Variables
namespace plutonium
{
WEAK symbol<int(const char* fmt, ...)> printf{0, 0};
}
}