forked from alterware/s1-mod
init
This commit is contained in:
73
src/client/game/game.hpp
Normal file
73
src/client/game/game.hpp
Normal file
@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include "structs.hpp"
|
||||
#include "launcher/launcher.hpp"
|
||||
|
||||
#define SELECT_VALUE(sp, mp) (game::environment::is_sp() ? (sp) : (mp))
|
||||
|
||||
#define SERVER_CD_KEY "s1-mod-CD-Key"
|
||||
|
||||
namespace game
|
||||
{
|
||||
namespace environment
|
||||
{
|
||||
launcher::mode get_mode();
|
||||
launcher::mode get_real_mode();
|
||||
|
||||
bool is_sp();
|
||||
bool is_mp();
|
||||
bool is_dedi();
|
||||
|
||||
void set_mode(launcher::mode mode);
|
||||
|
||||
std::string get_string();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class symbol
|
||||
{
|
||||
public:
|
||||
symbol(const size_t sp_address, const size_t mp_address)
|
||||
: sp_object_(reinterpret_cast<T*>(sp_address))
|
||||
, mp_object_(reinterpret_cast<T*>(mp_address))
|
||||
{
|
||||
}
|
||||
|
||||
T* get() const
|
||||
{
|
||||
if (environment::is_sp())
|
||||
{
|
||||
return sp_object_;
|
||||
}
|
||||
|
||||
return mp_object_;
|
||||
}
|
||||
|
||||
operator T*() const
|
||||
{
|
||||
return this->get();
|
||||
}
|
||||
|
||||
T* operator->() const
|
||||
{
|
||||
return this->get();
|
||||
}
|
||||
|
||||
private:
|
||||
T* sp_object_;
|
||||
T* mp_object_;
|
||||
};
|
||||
|
||||
[[nodiscard]] int Cmd_Argc();
|
||||
[[nodiscard]] const char* Cmd_Argv(int index);
|
||||
|
||||
[[nodiscard]] int SV_Cmd_Argc();
|
||||
[[nodiscard]] const char* SV_Cmd_Argv(int index);
|
||||
|
||||
[[nodiscard]] bool VirtualLobby_Loaded();
|
||||
|
||||
[[nodiscard]] bool is_headless();
|
||||
void show_error(const std::string& text, const std::string& title = "Error");
|
||||
}
|
||||
|
||||
#include "symbols.hpp"
|
Reference in New Issue
Block a user