mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Fullbright and patches
This commit is contained in:
parent
73a3cc7f61
commit
2e22126560
@ -133,6 +133,9 @@ namespace patches
|
||||
{
|
||||
// Use name dvar
|
||||
live_get_local_client_name_hook.create(0x1404D47F0, &live_get_local_client_name);
|
||||
|
||||
utils::hook::set<uint8_t>(0x1400058C0, 0xC3); // ValidateMetaData
|
||||
utils::hook::set<uint8_t>(0x140005B10, 0xC3); // ^
|
||||
}
|
||||
|
||||
static void patch_sp()
|
||||
|
60
src/client/component/renderer.cpp
Normal file
60
src/client/component/renderer.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "utils/hook.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
namespace renderer
|
||||
{
|
||||
namespace
|
||||
{
|
||||
static auto technique = game::TECHNIQUE_UNLIT;
|
||||
|
||||
utils::hook::detour r_init_draw_method_hook;
|
||||
utils::hook::detour r_update_front_end_dvar_options_hook;
|
||||
|
||||
void r_init_draw_method_stub()
|
||||
{
|
||||
game::gfxDrawMethod->drawScene = game::GFX_DRAW_SCENE_STANDARD;
|
||||
game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.enabled ? technique : game::TECHNIQUE_LIT;
|
||||
game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.enabled ? technique : game::TECHNIQUE_EMISSIVE;
|
||||
game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.enabled ? technique : 182;
|
||||
}
|
||||
|
||||
bool r_update_front_end_dvar_options_stub()
|
||||
{
|
||||
if (dvars::r_fullbright->modified)
|
||||
{
|
||||
dvars::r_fullbright->modified = false;
|
||||
game::R_SyncRenderThread();
|
||||
|
||||
game::gfxDrawMethod->drawScene = game::GFX_DRAW_SCENE_STANDARD;
|
||||
game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.enabled ? technique : game::TECHNIQUE_LIT;
|
||||
game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.enabled ? technique : game::TECHNIQUE_EMISSIVE;
|
||||
game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.enabled ? technique : 182;
|
||||
}
|
||||
|
||||
return r_update_front_end_dvar_options_hook.invoke<bool>();
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
void post_unpack() override
|
||||
{
|
||||
if (game::environment::is_dedi())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dvars::r_fullbright = game::Dvar_RegisterBool("r_fullbright", false, 1, "Toggles rendering without lighting");
|
||||
|
||||
r_init_draw_method_hook.create(SELECT_VALUE(0x14046C150, 0x140588B00), &r_init_draw_method_stub);
|
||||
r_update_front_end_dvar_options_hook.create(SELECT_VALUE(0x1404A5330, 0x1405C3AE0), &r_update_front_end_dvar_options_stub);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
REGISTER_COMPONENT(renderer::component)
|
@ -42,7 +42,7 @@ namespace steam_proxy
|
||||
#ifndef DEV_BUILD
|
||||
try
|
||||
{
|
||||
this->start_mod("\xF0\x9F\x91\xBB" " S1-Mod:"s + (game::environment::is_sp() ? "Singleplayer" : "Multiplayer"), game::environment::is_sp() ? 209650 : 209660);
|
||||
this->start_mod("\xF0\x9F\x91\xBB" " S1-Mod: "s + (game::environment::is_sp() ? "Singleplayer" : "Multiplayer"), game::environment::is_sp() ? 209650 : 209660);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
@ -15,6 +15,8 @@ namespace dvars
|
||||
game::dvar_t* con_inputDvarInactiveValueColor = nullptr;
|
||||
game::dvar_t* con_inputCmdMatchColor = nullptr;
|
||||
|
||||
game::dvar_t* r_fullbright = nullptr;
|
||||
|
||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
|
||||
{
|
||||
if (domain.vector.min == -FLT_MAX)
|
||||
|
@ -15,6 +15,8 @@ namespace dvars
|
||||
extern game::dvar_t* con_inputDvarInactiveValueColor;
|
||||
extern game::dvar_t* con_inputCmdMatchColor;
|
||||
|
||||
extern game::dvar_t* r_fullbright;
|
||||
|
||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);
|
||||
std::string dvar_get_domain(const game::dvar_type type, const game::dvar_limits& domain);
|
||||
}
|
||||
|
@ -728,6 +728,26 @@ namespace game
|
||||
Glyph* glyphs;
|
||||
};
|
||||
|
||||
enum GfxDrawSceneMethod
|
||||
{
|
||||
GFX_DRAW_SCENE_STANDARD = 0x0,
|
||||
};
|
||||
|
||||
enum MaterialTechniqueType
|
||||
{
|
||||
TECHNIQUE_UNLIT = 8,
|
||||
TECHNIQUE_EMISSIVE = 9,
|
||||
TECHNIQUE_LIT = 13,
|
||||
};
|
||||
|
||||
struct GfxDrawMethod_s
|
||||
{
|
||||
int drawScene;
|
||||
int baseTechType;
|
||||
int emissiveTechType;
|
||||
int forceTechType;
|
||||
};
|
||||
|
||||
struct client_t
|
||||
{
|
||||
|
||||
|
@ -58,6 +58,7 @@ namespace game
|
||||
WEAK symbol<void(const char*, int, Font_s*, float, float, float, float, float, const float*, int, int, char)>
|
||||
R_AddCmdDrawTextWithCursor{ 0x1404A35E0, 0x1405C1D10 };
|
||||
WEAK symbol<Font_s* (const char* font)> R_RegisterFont{ 0x140481F90, 0x14059F3C0 };
|
||||
WEAK symbol<void()> R_SyncRenderThread{ 0x1404A4D60, 0x1405C34F0 };
|
||||
WEAK symbol<int(const char* text, int maxChars, Font_s* font)> R_TextWidth{ 0x140482270, 0x14059F6B0 };
|
||||
|
||||
WEAK symbol<ScreenPlacement* ()> ScrPlace_GetViewPlacement{ 0x14014FA70, 0x14023CB50 };
|
||||
@ -91,6 +92,8 @@ namespace game
|
||||
WEAK symbol<int> svs_numclients{ 0, 0x1496C4B0C };
|
||||
WEAK symbol<client_t> svs_clients{ 0, 0x1496C4B10 };
|
||||
|
||||
WEAK symbol<GfxDrawMethod_s> gfxDrawMethod{ 0x14CDFAFE8, 0x14D80FD98 };
|
||||
|
||||
namespace mp
|
||||
{
|
||||
WEAK symbol<gentity_s> g_entities{ 0, 0x144758C70 };
|
||||
|
Loading…
Reference in New Issue
Block a user