Fix dvar_t struct.

Update references to DvarValue struct.
This commit is contained in:
Michael 2023-03-14 14:32:08 -04:00
parent 85794fd992
commit 8da07b8c1d
5 changed files with 48 additions and 64 deletions

View File

@ -19,7 +19,7 @@ namespace dedicated_info
auto server_name = game::get_dvar_string("live_steam_server_name"); auto server_name = game::get_dvar_string("live_steam_server_name");
auto clean_server_name = game::I_CleanStr(server_name.data()); auto clean_server_name = game::I_CleanStr(server_name.data());
if (!sv_running || !sv_running->current.enabled) if (!sv_running || !sv_running->current.value.enabled)
{ {
console::set_title(utils::string::va("%s - not running", clean_server_name)); console::set_title(utils::string::va("%s - not running", clean_server_name));
return; return;

View File

@ -25,7 +25,7 @@ namespace loot
int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode, int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode,
const int item_id) const int item_id)
{ {
if (!dvar_cg_unlockall_loot->current.enabled) if (!dvar_cg_unlockall_loot->current.value.enabled)
{ {
return loot_getitemquantity_hook.invoke<int>(controller_index, mode, item_id); return loot_getitemquantity_hook.invoke<int>(controller_index, mode, item_id);
} }
@ -41,7 +41,7 @@ namespace loot
int liveinventory_getitemquantity_stub(const game::ControllerIndex_t controller_index, const int item_id) int liveinventory_getitemquantity_stub(const game::ControllerIndex_t controller_index, const int item_id)
{ {
// Item id's for extra CaC slots, CWL camo's and paid specialist outfits // Item id's for extra CaC slots, CWL camo's and paid specialist outfits
if (dvar_cg_unlockall_loot->current.enabled && (item_id == 99003 || item_id >= 99018 && item_id <= 99021 || item_id == 99025|| if (dvar_cg_unlockall_loot->current.value.enabled && (item_id == 99003 || item_id >= 99018 && item_id <= 99021 || item_id == 99025||
item_id >= 90047 && item_id <= 90064)) item_id >= 90047 && item_id <= 90064))
{ {
return 1; return 1;
@ -52,7 +52,7 @@ namespace loot
bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controller_index) bool liveinventory_areextraslotspurchased_stub(const game::ControllerIndex_t controller_index)
{ {
if (dvar_cg_unlockall_loot->current.enabled) if (dvar_cg_unlockall_loot->current.value.enabled)
{ {
return true; return true;
} }
@ -62,7 +62,7 @@ namespace loot
bool bg_unlockablesisitempurchased_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index) bool bg_unlockablesisitempurchased_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index)
{ {
if (dvar_cg_unlockall_purchases->current.enabled) if (dvar_cg_unlockall_purchases->current.value.enabled)
{ {
return true; return true;
} }
@ -72,7 +72,7 @@ namespace loot
bool bg_unlockablesisitemattachmentlocked_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index, int attachment_num) bool bg_unlockablesisitemattachmentlocked_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index, int attachment_num)
{ {
if (dvar_cg_unlockall_attachments->current.enabled) if (dvar_cg_unlockall_attachments->current.value.enabled)
{ {
return false; return false;
} }
@ -82,7 +82,7 @@ namespace loot
bool bg_unlockablesisattachmentslotlocked_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index, int attachment_slot_index) bool bg_unlockablesisattachmentslotlocked_stub(game::eModes mode, const game::ControllerIndex_t controller_index, int item_index, int attachment_slot_index)
{ {
if (dvar_cg_unlockall_attachments->current.enabled) if (dvar_cg_unlockall_attachments->current.value.enabled)
{ {
return false; return false;
} }
@ -112,7 +112,7 @@ namespace loot
bg_unlockablesisattachmentslotlocked_hook.create(0x1426A86D0_g, bg_unlockablesisattachmentslotlocked_stub); bg_unlockablesisattachmentslotlocked_hook.create(0x1426A86D0_g, bg_unlockablesisattachmentslotlocked_stub);
scheduler::once([]() { scheduler::once([]() {
if (dvar_cg_unlockall_loot->current.enabled) if (dvar_cg_unlockall_loot->current.value.enabled)
{ {
game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true); game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true);
} }

View File

@ -84,7 +84,7 @@ namespace network
socket_set_blocking(s, false); socket_set_blocking(s, false);
const auto address = htonl(INADDR_ANY); const auto address = htonl(INADDR_ANY);
auto port = static_cast<uint16_t>(game::Dvar_FindVar("net_port")->current.integer); auto port = static_cast<uint16_t>(game::Dvar_FindVar("net_port")->current.value.integer);
sockaddr_in server_addr{}; sockaddr_in server_addr{};
server_addr.sin_family = AF_INET; server_addr.sin_family = AF_INET;

View File

@ -673,8 +673,9 @@ namespace game
struct dvar_t; struct dvar_t;
union DvarValue struct DvarValue
{ {
union {
bool enabled; bool enabled;
int integer; int integer;
uint32_t unsignedInt; uint32_t unsignedInt;
@ -684,59 +685,42 @@ namespace game
vec4_t vector; vec4_t vector;
const char* string; const char* string;
byte color[4]; byte color[4];
}; const dvar_t* indirect[3];
} value;
struct $7034703ED3857507327AE195CCA24A71 uint64_t encryptedValue;
{
int stringCount;
const char** strings;
};
struct $5AC0CC375C7A91894540A0C75867866C
{
int min;
int max;
};
struct $FCEE86E78F1A35297637B00F6DD148A3
{
int64_t min;
int64_t max;
};
struct $28DE879AA85D5F4AA5DF9392CB197229
{
uint64_t min;
uint64_t max;
};
struct $D2B45DCE3C73414E1DE8E10A2D52B392
{
float min;
float max;
};
struct $97F25DA469865168FD08682F42882F2A
{
vec_t min;
vec_t max;
}; };
union DvarLimits union DvarLimits
{ {
$7034703ED3857507327AE195CCA24A71 enumeration; struct {
$5AC0CC375C7A91894540A0C75867866C integer; int stringCount;
$FCEE86E78F1A35297637B00F6DD148A3 integer64; const char** strings;
$28DE879AA85D5F4AA5DF9392CB197229 unsignedInt64; } enumeration;
$D2B45DCE3C73414E1DE8E10A2D52B392 value; struct {
$97F25DA469865168FD08682F42882F2A vector; int min;
int max;
} integer;
struct {
int64_t min;
int64_t max;
} integer64;
struct {
uint64_t min;
uint64_t max;
} unsignedInt64;
struct {
float min;
float max;
} value;
struct {
vec_t min;
vec_t max;
} vector;
}; };
struct dvar_t struct dvar_t
{ {
dvarStrHash_t name; dvarStrHash_t name;
char _pad[0x4];
const char* debugName; const char* debugName;
const char* description; const char* description;
unsigned int flags; unsigned int flags;

View File

@ -24,6 +24,6 @@ namespace game
return {}; return {};
} }
return dvar->current.integer; return dvar->current.value.integer;
} }
} }