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 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));
return;

View File

@ -25,7 +25,7 @@ namespace loot
int loot_getitemquantity_stub(const game::ControllerIndex_t controller_index, const game::eModes mode,
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);
}
@ -41,7 +41,7 @@ namespace loot
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
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))
{
return 1;
@ -52,7 +52,7 @@ namespace loot
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;
}
@ -62,7 +62,7 @@ namespace loot
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;
}
@ -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)
{
if (dvar_cg_unlockall_attachments->current.enabled)
if (dvar_cg_unlockall_attachments->current.value.enabled)
{
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)
{
if (dvar_cg_unlockall_attachments->current.enabled)
if (dvar_cg_unlockall_attachments->current.value.enabled)
{
return false;
}
@ -112,7 +112,7 @@ namespace loot
bg_unlockablesisattachmentslotlocked_hook.create(0x1426A86D0_g, bg_unlockablesisattachmentslotlocked_stub);
scheduler::once([]() {
if (dvar_cg_unlockall_loot->current.enabled)
if (dvar_cg_unlockall_loot->current.value.enabled)
{
game::Dvar_SetFromStringByName("ui_enableAllHeroes", "1", true);
}

View File

@ -84,7 +84,7 @@ namespace network
socket_set_blocking(s, false);
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{};
server_addr.sin_family = AF_INET;

View File

@ -673,70 +673,54 @@ namespace game
struct dvar_t;
union DvarValue
struct DvarValue
{
bool enabled;
int integer;
uint32_t unsignedInt;
int64_t integer64;
uint64_t unsignedInt64;
float value;
vec4_t vector;
const char* string;
byte color[4];
};
struct $7034703ED3857507327AE195CCA24A71
{
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 {
bool enabled;
int integer;
uint32_t unsignedInt;
int64_t integer64;
uint64_t unsignedInt64;
float value;
vec4_t vector;
const char* string;
byte color[4];
const dvar_t* indirect[3];
} value;
uint64_t encryptedValue;
};
union DvarLimits
{
$7034703ED3857507327AE195CCA24A71 enumeration;
$5AC0CC375C7A91894540A0C75867866C integer;
$FCEE86E78F1A35297637B00F6DD148A3 integer64;
$28DE879AA85D5F4AA5DF9392CB197229 unsignedInt64;
$D2B45DCE3C73414E1DE8E10A2D52B392 value;
$97F25DA469865168FD08682F42882F2A vector;
struct {
int stringCount;
const char** strings;
} enumeration;
struct {
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
{
dvarStrHash_t name;
char _pad[0x4];
const char* debugName;
const char* description;
unsigned int flags;

View File

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