Merge pull request #140 from XLabsProject/release/v1.0.1

Release v1.0.1
This commit is contained in:
Maurice Heumann 2021-04-26 09:54:58 +02:00 committed by GitHub
commit f0819cb048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 642 additions and 277 deletions

View File

@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [v1.0.1] - 2021-04-26
### Added
- Move the chat [#99](https://github.com/XLabsProject/s1x-client/issues/99)
- Reduce AntiVirus false positives [#127](https://github.com/XLabsProject/s1x-client/issues/127)
- Increase timeout time (when connecting?) [#139](https://github.com/XLabsProject/s1x-client/issues/139)
### Fixed
- Campaign fails to launch in new debug builds [#116](https://github.com/XLabsProject/s1x-client/issues/116)
- VirtualLobby firing range FOV/FOV scale messed up [#135](https://github.com/XLabsProject/s1x-client/issues/135)
### Pull Requests
- Update scripting [#95](https://github.com/XLabsProject/s1x-client/pull/95) ([@Joelrau](https://github.com/Joelrau))
- Fixed hooks in set dvars [#100](https://github.com/XLabsProject/s1x-client/pull/100) ([@diamante0018](https://github.com/diamante0018))
- hooked dvar register vector2, modified cg_hudChatPosition and matched... [#103](https://github.com/XLabsProject/s1x-client/pull/103) ([@diamante0018](https://github.com/diamante0018))
- I missed flags in vector 2 yesterday. [#110](https://github.com/XLabsProject/s1x-client/pull/110) ([@diamante0018](https://github.com/diamante0018))
- use dvar flags enum everywhere for extra clarity and cohesion. also s... [#115](https://github.com/XLabsProject/s1x-client/pull/115) ([@diamante0018](https://github.com/diamante0018))
- Update patches.cpp [#119](https://github.com/XLabsProject/s1x-client/pull/119) ([@diamante0018](https://github.com/diamante0018))
- /reconnect changes [#122](https://github.com/XLabsProject/s1x-client/pull/122) ([@mjkzy](https://github.com/mjkzy))
- Use custom fov/fovscale when virtual lobby is enabled. [#133](https://github.com/XLabsProject/s1x-client/pull/133) ([@Joelrau](https://github.com/Joelrau))
- filter. (tested on mp) [#134](https://github.com/XLabsProject/s1x-client/pull/134) ([@diamante0018](https://github.com/diamante0018))
- reverted to old if statement [#136](https://github.com/XLabsProject/s1x-client/pull/136) ([@diamante0018](https://github.com/diamante0018))
- Fix firing range fov [#137](https://github.com/XLabsProject/s1x-client/pull/137) ([@Joelrau](https://github.com/Joelrau))
- Don't patch virtuallobby if game isn't multiplayer [#138](https://github.com/XLabsProject/s1x-client/pull/138) ([@Joelrau](https://github.com/Joelrau))
## [v1.0.0] - 2021-04-20
### Added
@ -63,7 +91,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Discord RPC - party size + party size max [#59](https://github.com/XLabsProject/s1x-client/pull/59) ([@mjkzy](https://github.com/mjkzy))
- discord presence - host name address [#64](https://github.com/XLabsProject/s1x-client/pull/64) ([@mjkzy](https://github.com/mjkzy))
[Unreleased]: https://github.com/XLabsProject/s1x-client/compare/v1.0.0...HEAD
[Unreleased]: https://github.com/XLabsProject/s1x-client/compare/v1.0.1...HEAD
[v1.0.1]: https://github.com/XLabsProject/s1x-client/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/XLabsProject/s1x-client/compare/v0.0.2...v1.0.0

2
deps/WinToast vendored

@ -1 +1 @@
Subproject commit a21decbe81b66890f27f1f697577d0c3a9982e0e
Subproject commit 8abb85b44cb2100dba45c3f3f8fe981fcf300b71

2
deps/rapidjson vendored

@ -1 +1 @@
Subproject commit 47b837e14ab5712fade68e0b00768ff95c120966
Subproject commit e0f68a435610e70ab5af44fc6a90523d69b210b3

View File

@ -248,11 +248,14 @@ end
flags {"NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks"}
buildoptions {"/GL"}
linkoptions { "/IGNORE:4702", "/LTCG" }
configuration "windows"
defines {"_WINDOWS", "WIN32"}
configuration "Release"
optimize "Speed"
optimize "Size"
defines {"NDEBUG"}

View File

@ -8,6 +8,7 @@
#include "server_list.hpp"
#include "game/game.hpp"
#include "game/scripting/execution.hpp"
#include <utils/hook.hpp>
#include <utils/string.hpp>
@ -26,23 +27,18 @@ namespace bots
return false;
}
void bot_team_join(unsigned int entity_num)
void bot_team_join(const unsigned int entity_num)
{
scheduler::once([entity_num]()
const game::scr_entref_t entref{static_cast<uint16_t>(entity_num), 0};
scheduler::once([entref]()
{
// auto-assign
game::SV_ExecuteClientCommand(&game::mp::svs_clients[entity_num],
utils::string::va("lui 125 2 %i",
*game::mp::sv_serverId_value), false);
scheduler::once([entity_num]()
scripting::notify(entref, "luinotifyserver", {"team_select", 2});
scheduler::once([entref]()
{
// select class ( they don't select it? )
game::SV_ExecuteClientCommand(&game::mp::svs_clients[entity_num],
utils::string::va("lui 9 %i %i", (rand() % (104 - 100 + 1) + 100),
*game::mp::sv_serverId_value), false);
}, scheduler::pipeline::server, 1s);
}, scheduler::pipeline::server, 1s);
auto* _class = utils::string::va("class%d", utils::cryptography::random::get_integer() % 5);
scripting::notify(entref, "luinotifyserver", {"class_select", _class});
}, scheduler::pipeline::server, 2s);
}, scheduler::pipeline::server, 2s);
}
void spawn_bot(const int entity_num)
@ -50,7 +46,7 @@ namespace bots
game::SV_SpawnTestClient(&game::mp::g_entities[entity_num]);
if (game::Com_GetCurrentCoDPlayMode() == game::CODPLAYMODE_CORE)
{
//bot_team_join(entity_num); // super bugger rn
bot_team_join(entity_num);
}
}

View File

@ -325,7 +325,7 @@ namespace command
{
if (params.size() < 2)
{
console::info("listassetpool <poolnumber>: list all the assets in the specified pool\n");
console::info("listassetpool <poolnumber> [filter]: list all the assets in the specified pool\n");
for (auto i = 0; i < game::XAssetType::ASSET_TYPE_COUNT; i++)
{
@ -344,13 +344,20 @@ namespace command
console::info("Listing assets in pool %s\n", game::g_assetNames[type]);
enum_assets(type, [type](const game::XAssetHeader header)
const std::string filter = params.get(2);
enum_assets(type, [type, filter](const game::XAssetHeader header)
{
const auto asset = game::XAsset{ type, header };
const auto* const asset_name = game::DB_GetXAssetName(&asset);
//const auto entry = game::DB_FindXAssetEntry(type, asset_name);
//TODO: display which zone the asset is from
console::info("%s\n", asset_name);
if (!filter.empty() && !game_console::match_compare(filter, asset_name, false))
{
return;
}
console::info("%s\n", asset_name);
}, true);
}
});

View File

@ -157,10 +157,10 @@ namespace dedicated
}
// Register dedicated dvar
game::Dvar_RegisterBool("dedicated", 1, game::DVAR_FLAG_READ, "Dedicated server");
game::Dvar_RegisterBool("dedicated", true, game::DVAR_FLAG_READ, "Dedicated server");
// Add lanonly mode
game::Dvar_RegisterBool("sv_lanOnly", 0, game::DVAR_FLAG_NONE, "Don't send heartbeat");
game::Dvar_RegisterBool("sv_lanOnly", false, game::DVAR_FLAG_NONE, "Don't send heartbeat");
// Disable VirtualLobby
dvars::override::Dvar_RegisterBool("virtualLobbyEnabled", false, game::DVAR_FLAG_NONE | game::DVAR_FLAG_READ);

View File

@ -30,7 +30,8 @@ namespace dedicated_info
auto* const sv_maxclients = game::Dvar_FindVar("sv_maxclients");
auto* const mapname = game::Dvar_FindVar("mapname");
auto clientCount = 0;
auto bot_count = 0;
auto client_count = 0;
for (auto i = 0; i < sv_maxclients->current.integer; i++)
{
@ -39,7 +40,11 @@ namespace dedicated_info
if (client->header.state >= 1 && self && self->client)
{
clientCount++;
client_count++;
if (game::SV_BotIsBot(i))
{
++bot_count;
}
}
}
@ -49,9 +54,9 @@ namespace dedicated_info
utils::string::strip(sv_hostname->current.string, cleaned_hostname.data(),
static_cast<int>(strlen(sv_hostname->current.string)) + 1);
console::set_title(utils::string::va("%s on %s [%d/%d]", cleaned_hostname.data(),
mapname->current.string, clientCount,
sv_maxclients->current.integer));
console::set_title(utils::string::va("%s on %s [%d/%d] (%d)", cleaned_hostname.data(),
mapname->current.string, client_count,
sv_maxclients->current.integer, bot_count));
}, scheduler::pipeline::main, 1s);
}
};

View File

@ -26,6 +26,24 @@ namespace dvars
float max{};
};
struct dvar_vector2 : dvar_base
{
float x{};
float y{};
float min{};
float max{};
};
struct dvar_vector3 : dvar_base
{
float x{};
float y{};
float z{};
float min{};
float max{};
};
struct dvar_int : dvar_base
{
int value{};
@ -92,6 +110,8 @@ namespace dvars
static std::unordered_map<std::string, dvar_float> register_float_overrides;
static std::unordered_map<std::string, dvar_int> register_int_overrides;
static std::unordered_map<std::string, dvar_string> register_string_overrides;
static std::unordered_map<std::string, dvar_vector2> register_vector2_overrides;
static std::unordered_map<std::string, dvar_vector3> register_vector3_overrides;
static std::unordered_map<std::string, bool> set_bool_overrides;
static std::unordered_map<std::string, float> set_float_overrides;
@ -144,6 +164,33 @@ namespace dvars
register_string_overrides[name] = std::move(values);
}
void Dvar_RegisterVector2(const std::string& name, float x, float y, float min, float max,
const unsigned int flags, const std::string& description)
{
dvar_vector2 values;
values.x = x;
values.y = y;
values.min = min;
values.max = max;
values.flags = flags;
values.description = description;
register_vector2_overrides[name] = std::move(values);
}
void Dvar_RegisterVector3(const std::string& name, float x, float y, float z, float min,
float max, const unsigned int flags, const std::string& description)
{
dvar_vector3 values;
values.x = x;
values.y = y;
values.z = z;
values.min = min;
values.max = max;
values.flags = flags;
values.description = description;
register_vector3_overrides[name] = std::move(values);
}
void Dvar_SetBool(const std::string& name, const bool value)
{
set_bool_overrides[name] = value;
@ -169,6 +216,8 @@ namespace dvars
utils::hook::detour dvar_register_float_hook;
utils::hook::detour dvar_register_int_hook;
utils::hook::detour dvar_register_string_hook;
utils::hook::detour dvar_register_vector2_hook;
utils::hook::detour dvar_register_vector3_hook;
utils::hook::detour dvar_set_bool_hook;
utils::hook::detour dvar_set_float_hook;
@ -233,6 +282,41 @@ namespace dvars
return dvar_register_string_hook.invoke<game::dvar_t*>(name, value, flags, description);
}
game::dvar_t* dvar_register_vector2(const char* name, float x, float y, float min, float max,
unsigned int flags, const char* description)
{
auto* var = find_dvar(override::register_vector2_overrides, name);
if (var)
{
x = var->x;
y = var->y;
min = var->min;
max = var->max;
flags = var->flags;
description = var->description.data();
}
return dvar_register_vector2_hook.invoke<game::dvar_t*>(name, x, y, min, max, flags, description);
}
game::dvar_t* dvar_register_vector3(const char* name, float x, float y, float z, float min,
float max, unsigned int flags, const char* description)
{
auto* var = find_dvar(override::register_vector3_overrides, name);
if (var)
{
x = var->x;
y = var->y;
z = var->z;
min = var->min;
max = var->max;
flags = var->flags;
description = var->description.data();
}
return dvar_register_vector3_hook.invoke<game::dvar_t*>(name, x, y, z, min, max, flags, description);
}
void dvar_set_bool(game::dvar_t* dvar, bool boolean)
{
const auto disabled = find_dvar(disable::set_bool_disables, dvar->name);
@ -310,9 +394,11 @@ namespace dvars
dvar_register_float_hook.create(SELECT_VALUE(0x140371C20, 0x1404C0FB0), &dvar_register_float);
dvar_register_int_hook.create(SELECT_VALUE(0x140371CF0, 0x1404C1080), &dvar_register_int);
dvar_register_string_hook.create(SELECT_VALUE(0x140372050, 0x1404C1450), &dvar_register_string);
dvar_register_vector2_hook.create(SELECT_VALUE(0x140372120, 0x1404C1520), &dvar_register_vector2);
dvar_register_vector3_hook.create(SELECT_VALUE(0x140372230, 0x1404C1600), &dvar_register_vector3);
dvar_set_int_hook.create(SELECT_VALUE(0x140372B70, 0x1404C1F30), &dvar_set_bool);
dvar_set_int_hook.create(SELECT_VALUE(0x140373420, 0x1404C2A10), &dvar_set_float);
dvar_set_bool_hook.create(SELECT_VALUE(0x140372B70, 0x1404C1F30), &dvar_set_bool);
dvar_set_float_hook.create(SELECT_VALUE(0x140373420, 0x1404C2A10), &dvar_set_float);
dvar_set_int_hook.create(SELECT_VALUE(0x1403738D0, 0x1404C2F40), &dvar_set_int);
dvar_set_string_hook.create(SELECT_VALUE(0x140373DE0, 0x1404C3610), &dvar_set_string);
}

View File

@ -12,10 +12,12 @@ namespace dvars
namespace override
{
void Dvar_RegisterBool(const std::string& name, bool value, unsigned int flags, const std::string& description = "");
void Dvar_RegisterFloat(const std::string& name, float value, float min, float max, unsigned int flags, const std::string& description = "");
void Dvar_RegisterInt(const std::string& name, int value, int min, int max, unsigned int flags, const std::string& description = "");
void Dvar_RegisterString(const std::string& name, const std::string& value, unsigned int flags, const std::string& description = "");
void Dvar_RegisterBool(const std::string& name, bool value, const unsigned int flags, const std::string& description = "");
void Dvar_RegisterFloat(const std::string& name, float value, float min, float max, const unsigned int flags, const std::string& description = "");
void Dvar_RegisterInt(const std::string& name, int value, int min, int max, const unsigned int flags, const std::string& description = "");
void Dvar_RegisterString(const std::string& name, const std::string& value, const unsigned int flags, const std::string& description = "");
void Dvar_RegisterVector2(const std::string& name, float x, float y, float min, float max, const unsigned int flags, const std::string& description = "");
void Dvar_RegisterVector3(const std::string& name, float x, float y, float z, float min, float max, const unsigned int flags, const std::string& description = "");
void Dvar_SetBool(const std::string& name, bool boolean);
void Dvar_SetFloat(const std::string& name, float fl);

View File

@ -110,7 +110,7 @@ namespace exception
{
display_error_dialog();
}
// TODO: Add a limit for dedi restarts
if (game::environment::is_dedi())
{
@ -124,7 +124,8 @@ namespace exception
++recovery_data.recovery_counts;
game::Com_Error(game::ERR_DROP, "Fatal error (0x%08X) at 0x%p.\nA minidump has been written.\n\n"
"S1x has tried to recover your game, but it might not run stable anymore.\n\n"
"Make sure to update your graphics card drivers and install operating system updates!",
"Make sure to update your graphics card drivers and install operating system updates!\n"
"Closing or restarting Steam might also help.",
exception_data.code, exception_data.address);
}
else
@ -250,7 +251,9 @@ namespace exception
void post_unpack() override
{
dvars::cg_legacyCrashHandling = game::Dvar_RegisterBool("cg_legacyCrashHandling", false, game::DVAR_FLAG_SAVED, "Disable new crash handling");
dvars::cg_legacyCrashHandling = game::Dvar_RegisterBool("cg_legacyCrashHandling", false,
game::DVAR_FLAG_SAVED,
"Disable new crash handling");
}
};
}

View File

@ -44,7 +44,7 @@ namespace filesystem
void post_unpack() override
{
// Set fs_basegame
dvars::override::Dvar_RegisterString("fs_basegame", "s1x", 2048);
dvars::override::Dvar_RegisterString("fs_basegame", "s1x", game::DVAR_FLAG_WRITE);
}
};
}

View File

@ -140,7 +140,7 @@ namespace fps
void cg_draw_fps_register_stub(const char* name, const char** _enum, const int value, unsigned int /*flags*/,
const char* desc)
{
game::Dvar_RegisterEnum(name, _enum, value, 0x1, desc);
game::Dvar_RegisterEnum(name, _enum, value, game::DVAR_FLAG_SAVED, desc);
}
}
@ -167,7 +167,7 @@ namespace fps
scheduler::loop(cg_draw_fps, scheduler::pipeline::renderer);
if (game::environment::is_mp())
{
game::Dvar_RegisterInt("cg_drawPing", 0, 0, 1, 0, "Choose to draw ping");
game::Dvar_RegisterInt("cg_drawPing", 0, 0, 1, game::DVAR_FLAG_SAVED, "Choose to draw ping");
scheduler::loop(cg_draw_ping, scheduler::pipeline::renderer);
}
}

View File

@ -383,7 +383,14 @@ namespace game_console
void print(const int type, const std::string& data)
{
if (game::environment::is_dedi())
try
{
if (game::environment::is_dedi())
{
return;
}
}
catch (std::exception&)
{
return;
}
@ -739,33 +746,33 @@ namespace game_console
// add our dvars
dvars::con_inputBoxColor = game::Dvar_RegisterVec4("con_inputBoxColor", 0.2f, 0.2f, 0.2f, 0.9f, 0.0f, 1.0f,
1,
game::DVAR_FLAG_SAVED,
"color of console input box");
dvars::con_inputHintBoxColor = game::Dvar_RegisterVec4("con_inputHintBoxColor", 0.3f, 0.3f, 0.3f, 1.0f,
0.0f, 1.0f,
1, "color of console input hint box");
game::DVAR_FLAG_SAVED, "color of console input hint box");
dvars::con_outputBarColor = game::Dvar_RegisterVec4("con_outputBarColor", 0.5f, 0.5f, 0.5f, 0.6f, 0.0f,
1.0f, 1,
1.0f, game::DVAR_FLAG_SAVED,
"color of console output bar");
dvars::con_outputSliderColor = game::Dvar_RegisterVec4("con_outputSliderColor", 1.0f, 0.8f, 0.0f, 1.0f,
0.0f, 1.0f,
1, "color of console output slider");
game::DVAR_FLAG_SAVED, "color of console output slider");
dvars::con_outputWindowColor = game::Dvar_RegisterVec4("con_outputWindowColor", 0.25f, 0.25f, 0.25f, 0.85f,
0.0f,
1.0f, 1, "color of console output window");
1.0f, game::DVAR_FLAG_SAVED, "color of console output window");
dvars::con_inputDvarMatchColor = game::Dvar_RegisterVec4("con_inputDvarMatchColor", 1.0f, 1.0f, 0.8f, 1.0f,
0.0f,
1.0f, 1, "color of console matched dvar");
1.0f, game::DVAR_FLAG_SAVED, "color of console matched dvar");
dvars::con_inputDvarValueColor = game::Dvar_RegisterVec4("con_inputDvarValueColor", 1.0f, 1.0f, 0.8f, 1.0f,
0.0f,
1.0f, 1, "color of console matched dvar value");
1.0f, game::DVAR_FLAG_SAVED, "color of console matched dvar value");
dvars::con_inputDvarInactiveValueColor = game::Dvar_RegisterVec4(
"con_inputDvarInactiveValueColor", 0.8f, 0.8f,
0.8f, 1.0f, 0.0f, 1.0f, 1,
0.8f, 1.0f, 0.0f, 1.0f, game::DVAR_FLAG_SAVED,
"color of console inactive dvar value");
dvars::con_inputCmdMatchColor = game::Dvar_RegisterVec4("con_inputCmdMatchColor", 0.80f, 0.80f, 1.0f, 1.0f,
0.0f,
1.0f, 1, "color of console matched command");
1.0f, game::DVAR_FLAG_SAVED, "color of console matched command");
}
};
}

View File

@ -24,6 +24,20 @@ namespace logger
console::error(buffer);
}
void print_com_error(int, const char* msg, ...)
{
char buffer[2048];
va_list ap;
va_start(ap, msg);
vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, msg, ap);
va_end(ap);
console::error(buffer);
}
void print_warning(const char* msg, ...)
{
char buffer[2048];
@ -129,6 +143,8 @@ namespace logger
nullsub_56();
sub_1400E7420();
utils::hook::call(0x1404D8543, print_com_error);
}
};
}

View File

@ -17,6 +17,11 @@ namespace lui
{
if (!game::environment::is_mp()) return;
#ifdef _DEBUG
// Enable development menus (causes issues in sp)
utils::hook::set<uint32_t>(SELECT_VALUE(0x1400B4ABC, 0x140109FAC), 1);
#endif
command::add("lui_open", [](const command::params& params)
{
if (params.size() <= 1)

View File

@ -148,8 +148,8 @@ namespace map_rotation
scheduler::once([]()
{
game::Dvar_RegisterString("sv_mapRotation", "", 0, "");
game::Dvar_RegisterString("sv_mapRotationCurrent", "", 0, "");
game::Dvar_RegisterString("sv_mapRotation", "", game::DVAR_FLAG_NONE, "");
game::Dvar_RegisterString("sv_mapRotationCurrent", "", game::DVAR_FLAG_NONE, "");
}, scheduler::pipeline::main);
command::add("map_rotate", &perform_map_rotation);

View File

@ -103,11 +103,11 @@ namespace network
get_callbacks()[utils::string::to_lower(command)] = callback;
}
void dw_send_to_stub(const unsigned int size, const char* src, game::netadr_s* a3)
int dw_send_to_stub(const int size, const char* src, game::netadr_s* a3)
{
sockaddr s = {};
game::NetadrToSockadr(a3, &s);
sendto(*game::query_socket, src, size - 2, 0, &s, 16);
return sendto(*game::query_socket, src, size, 0, &s, 16) >= 0;
}
void send(const game::netadr_s& address, const std::string& command, const std::string& data, const char separator)
@ -122,13 +122,21 @@ namespace network
void send_data(const game::netadr_s& address, const std::string& data)
{
auto size = static_cast<int>(data.size());
if (address.type == game::NA_LOOPBACK)
{
game::NET_SendLoopPacket(game::NS_CLIENT1, static_cast<int>(data.size()), data.data(), &address);
// TODO: Fix this for loopback
if (size > 1280)
{
console::error("Packet was too long. Truncated!\n");
size = 1280;
}
game::NET_SendLoopPacket(game::NS_CLIENT1, size, data.data(), &address);
}
else
{
game::Sys_SendPacket(static_cast<int>(data.size()), data.data(), &address);
game::Sys_SendPacket(size, data.data(), &address);
}
}
@ -187,6 +195,7 @@ namespace network
// redirect dw_sendto to raw socket
//utils::hook::jump(0x1404D850A, reinterpret_cast<void*>(0x1404D849A));
utils::hook::call(0x1404D851F, dw_send_to_stub);
utils::hook::jump(game::Sys_SendPacket, dw_send_to_stub);
// intercept command handling
utils::hook::jump(0x14020A175, utils::hook::assemble(handle_command_stub), true);
@ -233,16 +242,17 @@ namespace network
utils::hook::call(0x140439D98, &net_compare_address);
// increase cl_maxpackets
dvars::override::Dvar_RegisterInt("cl_maxpackets", 1000, 1, 1000, 0x1);
dvars::override::Dvar_RegisterInt("cl_maxpackets", 1000, 1, 1000, game::DVAR_FLAG_SAVED);
// increase snaps
dvars::override::Dvar_RegisterInt("sv_remote_client_snapshot_msec", 33, 33, 100, 0);
dvars::override::Dvar_RegisterInt("sv_remote_client_snapshot_msec", 33, 33, 100, game::DVAR_FLAG_NONE);
// ignore impure client
utils::hook::jump(0x14043AC0D, reinterpret_cast<void*>(0x14043ACA3));
// don't send checksum
utils::hook::set<uint8_t>(0x1404D84C0, 0);
utils::hook::set<uint8_t>(0x1404D8519, 0);
// don't read checksum
utils::hook::jump(0x1404D842B, 0x1404D8453);
@ -255,9 +265,16 @@ namespace network
utils::hook::call(0x1404D7A3D, register_netport_stub);
utils::hook::call(0x1404D7E28, register_netport_stub);
// increase allowed packet size
const auto max_packet_size = 0x20000;
utils::hook::set<int>(0x1403DADE6, max_packet_size);
utils::hook::set<int>(0x1403DAE20, max_packet_size);
utils::hook::set<int>(0x1403DAD14, max_packet_size);
utils::hook::set<int>(0x1403DAD35, max_packet_size);
// ignore built in "print" oob command and add in our own
utils::hook::set<uint8_t>(0x14020A723, 0xEB);
on("print", [](const game::netadr_s& addr, const std::string_view& data)
on("print", [](const game::netadr_s&, const std::string_view& data)
{
const std::string message{data};
console::info(message.data());

View File

@ -22,6 +22,7 @@ namespace party
{
game::netadr_s host{};
std::string challenge{};
bool hostDefined{false};
} connect_state;
std::string sv_motd;
@ -186,6 +187,7 @@ namespace party
connect_state.host = target;
connect_state.challenge = utils::cryptography::random::get_challenge();
connect_state.hostDefined = true;
network::send(target, "getInfo", connect_state.challenge);
}
@ -307,6 +309,16 @@ namespace party
}
});
command::add("reconnect", [](const command::params& argument)
{
if (!connect_state.hostDefined)
{
console::info("Cannot connect to server.\n");
return;
}
connect(connect_state.host);
});
command::add("connect", [](const command::params& argument)
{
if (argument.size() != 2)

View File

@ -59,7 +59,7 @@ namespace patches
game::Dvar_RegisterString("name", get_login_username().data(), game::DVAR_FLAG_SAVED, "Player name.");
// Disable data validation error popup
game::Dvar_RegisterInt("data_validation_allow_drop", 0, 0, 0, 0, "");
game::Dvar_RegisterInt("data_validation_allow_drop", 0, 0, 0, game::DVAR_FLAG_NONE, "");
}
return com_register_dvars_hook.invoke<void>();
@ -158,6 +158,10 @@ namespace patches
}
else
{
scheduler::once([]()
{
command::execute("reconnect");
}, scheduler::pipeline::main, 1s);
game::Com_Error(game::ERR_DROP, error, arg1);
}
}
@ -285,8 +289,8 @@ namespace patches
utils::hook::set<uint8_t>(0x14019B9B9, 0xEB);
// some anti tamper thing that kills performance
dvars::override::Dvar_RegisterInt("dvl", 0, 0, 0, game::DVAR_FLAG_NONE);
dvars::override::Dvar_RegisterInt("dvl", 0, 0, 0, game::DVAR_FLAG_READ);
// unlock safeArea_*
utils::hook::jump(0x140219F5E, 0x140219F67);
utils::hook::jump(0x140219F80, 0x140219F8E);
@ -294,6 +298,15 @@ namespace patches
dvars::override::Dvar_RegisterFloat("safeArea_adjusted_vertical", 1, 0, 1, game::DVAR_FLAG_SAVED);
dvars::override::Dvar_RegisterFloat("safeArea_horizontal", 1, 0, 1, game::DVAR_FLAG_SAVED);
dvars::override::Dvar_RegisterFloat("safeArea_vertical", 1, 0, 1, game::DVAR_FLAG_SAVED);
// move chat position on the screen above menu splashes
dvars::override::Dvar_RegisterVector2("cg_hudChatPosition", 5, 170, 0, 640, game::DVAR_FLAG_SAVED);
// Massively increate timeouts
dvars::override::Dvar_RegisterInt("cl_timeout", 90, 90, 1800, game::DVAR_FLAG_NONE); // Seems unused
dvars::override::Dvar_RegisterInt("sv_timeout", 90, 90, 1800, game::DVAR_FLAG_NONE); // 30 - 0 - 1800
dvars::override::Dvar_RegisterInt("cl_connectTimeout", 120, 120, 1800, game::DVAR_FLAG_NONE); // Seems unused
dvars::override::Dvar_RegisterInt("sv_connectTimeout", 120, 120, 1800, game::DVAR_FLAG_NONE); // 60 - 0 - 1800
}
static void patch_sp()

View File

@ -0,0 +1,32 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include <utils/hook.hpp>
#include "game/game.hpp"
namespace security
{
namespace
{
void set_cached_playerdata_stub(const int localclient, const int index1, const int index2)
{
if (index1 >= 0 && index1 < 18 && index2 >= 0 && index2 < 42)
{
reinterpret_cast<void(*)(int, int, int)>(0x140536A60)(localclient, index1, index2);
}
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
if (game::environment::is_sp()) return;
// Patch vulnerability in PlayerCards_SetCachedPlayerData
utils::hook::call(0x1401BB909, set_cached_playerdata_stub);
}
};
}
REGISTER_COMPONENT(security::component)

View File

@ -121,7 +121,19 @@ namespace steam_proxy
this->client_utils_ = this->client_engine_.invoke<void*>(14, this->steam_pipe_); // GetIClientUtils
}
void start_mod(const std::string& title, size_t app_id)
void start_mod(const std::string& title, const size_t app_id)
{
__try
{
this->start_mod_unsafe(title, app_id);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
this->do_cleanup();
}
}
void start_mod_unsafe(const std::string& title, size_t app_id)
{
if (!this->client_utils_ || !this->client_user_) return;
@ -149,6 +161,18 @@ namespace steam_proxy
&game_id.bits, title.data(), 0, 0, 0);
}
void do_cleanup()
{
this->client_engine_ = nullptr;
this->client_user_ = nullptr;
this->client_utils_ = nullptr;
this->steam_pipe_ = nullptr;
this->global_user_ = nullptr;
this->steam_client_module_ = utils::nt::library{nullptr};
}
void clean_up_on_error()
{
scheduler::schedule([this]()
@ -164,15 +188,7 @@ namespace steam_proxy
return scheduler::cond_continue;
}
this->client_engine_ = nullptr;
this->client_user_ = nullptr;
this->client_utils_ = nullptr;
this->steam_pipe_ = nullptr;
this->global_user_ = nullptr;
this->steam_client_module_ = utils::nt::library{nullptr};
this->do_cleanup();
return scheduler::cond_end;
});
}

View File

@ -0,0 +1,97 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "game/game.hpp"
#include <utils/hook.hpp>
namespace virtuallobby
{
namespace
{
game::dvar_t* virtualLobby_fov;
game::dvar_t* virtualLobby_fovscale;
const auto get_fov_stub = utils::hook::assemble([](utils::hook::assembler& a)
{
const auto ret = a.newLabel();
const auto original = a.newLabel();
a.pushad64();
a.mov(rax, qword_ptr(0x147B753C0)); // virtualLobbyInFiringRange
a.cmp(byte_ptr(rax, 0x10), 1);
a.je(original);
a.call_aligned(game::VirtualLobby_Loaded);
a.cmp(al, 0);
a.je(original);
// virtuallobby
a.popad64();
a.mov(rax, ptr(reinterpret_cast<int64_t>(&virtualLobby_fov)));
a.jmp(ret);
// original
a.bind(original);
a.popad64();
a.mov(rax, qword_ptr(0x140BA7180));
a.jmp(ret);
a.bind(ret);
a.mov(ecx, dword_ptr(rsp, 0x78));
a.movss(xmm6, dword_ptr(rax, 0x10));
a.jmp(0x1401D5B0B);
});
const auto get_fovscale_stub = utils::hook::assemble([](utils::hook::assembler& a)
{
const auto ret = a.newLabel();
const auto original = a.newLabel();
a.pushad64();
a.mov(rax, qword_ptr(0x147B753C0)); // virtualLobbyInFiringRange
a.cmp(byte_ptr(rax, 0x10), 1);
a.je(original);
a.call_aligned(game::VirtualLobby_Loaded);
a.cmp(al, 0);
a.je(original);
// virtuallobby
a.popad64();
a.mov(rax, ptr(reinterpret_cast<int64_t>(&virtualLobby_fovscale)));
a.jmp(ret);
// original
a.bind(original);
a.popad64();
a.mov(rax, qword_ptr(0x140BA7188));
a.jmp(ret);
a.bind(ret);
a.mov(rcx, 0x1414C1700);
a.jmp(0x1401D5CB8);
});
}
class component final : public component_interface
{
public:
void post_unpack() override
{
if (!game::environment::is_mp())
{
return;
}
virtualLobby_fov = game::Dvar_RegisterFloat("virtualLobby_fov", 40.0f, 1.0f, 170.0f, game::DVAR_FLAG_SAVED, "Field of view for the virtual lobby");
virtualLobby_fovscale = game::Dvar_RegisterFloat("virtualLobby_fovScale", 1.0f, 0.0f, 2.0f, game::DVAR_FLAG_SAVED, "Field of view scaled for the virtual lobby");
utils::hook::nop(0x1401D5AFB, 16);
utils::hook::jump(0x1401D5AFB, get_fov_stub, true);
utils::hook::nop(0x1401D5CAA, 14);
utils::hook::jump(0x1401D5CAA, get_fovscale_stub, true);
}
};
}
REGISTER_COMPONENT(virtuallobby::component)

View File

@ -26,6 +26,11 @@ namespace scripting
this->add();
}
entity::entity(game::scr_entref_t entref)
: entity(game::FindEntityId(entref.entnum, entref.classnum))
{
}
entity::~entity()
{
this->release();

View File

@ -9,6 +9,7 @@ namespace scripting
public:
entity();
entity(unsigned int entity_id);
entity(game::scr_entref_t entref);
entity(const entity& other);
entity(entity&& other) noexcept;

View File

@ -115,7 +115,7 @@ namespace scripting
script_value get_custom_field(const entity& entity, const std::string& field)
{
auto fields = custom_fields[entity.get_entity_id()];
auto& fields = custom_fields[entity.get_entity_id()];
const auto _field = fields.find(field);
if (_field != fields.end())
{

View File

@ -27,15 +27,15 @@ namespace scripting
{"setdvar", 51},
{"setdynamicdvar", 52},
{"setdvarifuninitialized", 53},
{"setdvar2", 54},
{"setdvarifuninitialized2", 55},
{"setdevdvar", 54},
{"setdevdvarifuninitialized", 55},
{"getdvar", 56},
{"getdvarint", 57},
{"getdvarfloat", 58},
{"getdvarvector", 59},
{"gettime", 60},
{"getutc", 61},
{"sub_1403156a0", 62},
{"getradiometricunit", 62},
{"getentbynum", 63},
{"getweaponmodel", 64},
{"setsunlight", 68},
@ -50,11 +50,11 @@ namespace scripting
{"animhasnotetrack", 99},
{"getnotetracktimes", 100},
{"spawn", 101},
{"sub_140314710", 103},
{"spawnloopingsound", 103},
{"bullettrace", 104},
{"getstartorigin", 108},
{"getstartangles", 109},
{"sub_1403104d0", 112},
{"magicgrenademanual", 112},
{"sub_140311ad0", 117},
{"sub_140311d80", 118},
{"sub_140311d90", 119},
@ -154,9 +154,9 @@ namespace scripting
{"stricmp", 288},
{"ambientplay", 289},
{"getuavstrengthmax", 290},
{"ishairrunning", 291},
{"getuavstrengthlevelneutral", 291},
{"getuavstrengthlevelshowenemyfastsweep", 292},
{"getuavstrengthmax2", 293},
{"getuavstrengthlevelshowenemydirectional", 293},
{"blockteamradar", 294},
{"unblockteamradar", 295},
{"isteamradarblocked", 296},
@ -178,7 +178,7 @@ namespace scripting
{"getmatchrulesdata", 312},
{"isusingmatchrulesdata", 313},
{"kickplayer", 314},
{"ishairrunning2", 315},
{"issplitscreen", 315},
{"setmapcenter", 316},
{"setgameendtime", 317},
{"visionsetnaked", 318},
@ -290,17 +290,17 @@ namespace scripting
{"weaponisauto", 429},
{"weaponissemiauto", 430},
{"weaponisboltaction", 431},
{"sub_14030bfc0", 432},
{"weaponinheritsperks", 432},
{"weaponburstcount", 433},
{"weapontype", 434},
{"weaponclass", 435},
{"getnextarraykey", 436},
{"sortbydistance", 437},
{"tablelookup", 438},
{"tablelookupistringbyrow", 439},
{"tablelookupbyrow", 439},
{"tablelookupistring", 440},
{"tablelookuprownum", 441},
{"sub_14030f490", 442},
{"tablelookupistringbyrow", 441},
{"tablelookuprownum", 442},
{"tableexists", 443},
{"getmissileowner", 444},
{"magicbullet", 445},
@ -322,8 +322,8 @@ namespace scripting
{"isglassdestroyed", 467},
{"destroyglass", 468},
{"deleteglass", 469},
{"sub_14030f410", 470},
{"sub_14030f440", 471},
{"getentchannelscount", 470},
{"getentchannelname", 471},
{"objective_add", 472},
{"objective_delete", 473},
{"objective_state", 474},
@ -393,7 +393,7 @@ namespace scripting
{"getscriptablearray", 560},
{"clearfog", 561},
{"setleveldopplerpreset", 562},
{"sub_140321c30", 564},
{"isusinghdr", 564},
{"sub_140321c40", 565},
{"sub_140311a40", 567},
{"sub_14030ec50", 568},
@ -410,8 +410,8 @@ namespace scripting
{"invertangles", 587},
{"rotatevectorinverted", 588},
{"calculatestartorientation", 589},
{"sub_140338900", 590},
{"sub_140310b20", 592},
{"droptoground", 590},
{"precachelaser", 592},
{"getcsplinecount", 593},
{"getcsplinepointcount", 594},
{"getcsplinelength", 595},
@ -444,8 +444,8 @@ namespace scripting
{"sub_140310ec0", 641},
{"sub_14031bae0", 642},
{"sub_14031c2b0", 643},
{"sub_140043610", 644},
{"sub_14032e7a0", 645},
{"isalliedsentient", 644},
{"istestclient", 645},
{"sub_1402d2850", 646},
{"sub_140311ff0", 648},
{"sub_140312040", 649},
@ -456,19 +456,19 @@ namespace scripting
{"sub_14030e5c0", 655},
{"sub_14031fda0", 657},
{"sub_140317140", 658},
{"sub_14030fd70", 659},
{"sub_140310210", 660},
{"sub_140310370", 661},
{"sub_14032fba0", 662},
{"sub_14032fca0", 663},
{"isremovedentity", 659},
{"tablegetrowcount", 660},
{"tablegetcolumncount", 661},
{"batteryusepershot", 662},
{"batteryreqtouse", 663},
{"sub_14030e700", 664},
{"getentityweaponname", 666},
{"sub_14031fc20", 667},
{"sub_140318030", 668},
{"sub_140318a90", 669},
{"sub_140318560", 670},
{"sub_140328f10", 671},
{"sub_14030ca90", 673},
{"deployriotshield", 668},
{"validatecostume", 669},
{"randomcostume", 670},
{"shootblank", 671},
{"debugstringtostring", 673},
{"sub_140319680", 675},
{"playcinematicforall", 679},
{"preloadcinematicforall", 680},
@ -477,17 +477,17 @@ namespace scripting
{"sub_14031ca40", 683},
{"sub_14031e1f0", 684},
{"sub_140321880", 685},
{"sub_140329610", 687},
{"lootservicestarttrackingplaytime", 687},
{"sub_1403297b0", 688},
{"sub_1403298d0", 689},
{"sub_14032acf0", 690},
{"lootservicevalidateplaytime", 689},
{"recordbreadcrumbdataforplayer", 690},
{"sub_140317df0", 691},
{"debugprint", 693},
{"sysprint", 693},
{"sub_140337920", 694},
{"sub_140321ae0", 697},
{"sub_140314a40", 698},
{"sub_140314c30", 699},
{"sub_14032aea0", 701},
{"isonlinegame", 698},
{"issystemlink", 699},
{"getstanceandmotionstateforplayer", 701},
{"sub_1402d3540", 702},
{"sub_1402d35b0", 703},
{"sub_140332a70", 704},
@ -495,26 +495,26 @@ namespace scripting
{"getplaylistname", 706},
{"getlocaltime", 707},
{"sub_14032c820", 708},
{"sub_14032c2a0", 710},
{"sub_1402d34d0", 711},
{"sub_1402d33f0", 712},
{"sub_14032dad0", 713},
{"sub_14032dc40", 714},
{"sub_140318270", 716},
{"getchallengeid", 710},
{"nodegetremotemissilename", 711},
{"nodehasremotemissileset", 712},
{"remotemissileenttracetooriginpassed", 713},
{"bombingruntracepassed", 714},
{"handlepickupdeployedriotshield", 716},
{"sub_14032c6b0", 717},
{"sub_140318ad0", 718},
{"getcostumefromtable", 718},
{"sub_1402d3460", 720},
{"sub_14032c2d0", 722},
{"sub_140332620", 723},
{"sub_140332610", 724},
{"sub_1402d3630", 725},
{"getchallenerewarditem", 722},
{"setentplayerxuidforemblem", 723},
{"resetentplayerxuidforemblems", 724},
{"nodesetremotemissilename", 725},
{"sub_14031aa80", 726},
{"sub_14031ead0", 727},
{"sub_140328010", 728},
{"iszombie", 728},
{"sub_14031b670", 729},
{"sub_14031d3f0", 730},
{"sub_14031e670", 731},
{"sub_140339100", 732},
{"getactiveplayerlist", 732},
{"sub_140319200", 733},
{"sub_140331e00", 734},
};
@ -528,29 +528,29 @@ namespace scripting
{"playerhide", 32773},
{"playershow", 32774},
{"showtoplayer", 32775},
{"sub_14032ae00", 32776},
{"sub_14032ae60", 32777},
{"threatdetectedtoplayer", 32776},
{"clearthreatdetected", 32777},
{"enableplayeruse", 32778},
{"disableplayeruse", 32779},
{"sub_14032cd60", 32780},
{"sub_14032cc80", 32781},
{"enableammogeneration", 32780},
{"disableammogeneration", 32781},
{"makescrambler", 32782},
{"makeportableradar", 32783},
{"clearscrambler", 32784},
{"clearportableradar", 32785},
{"sub_14032e080", 32786},
{"placespawnpoint", 32786},
{"setteamfortrigger", 32787},
{"clientclaimtrigger", 32788},
{"clientreleasetrigger", 32789},
{"releaseclaimedtrigger", 32790},
{"isusingonlinedataoffline", 32791},
{"getrestedtime", 32792},
{"sub_140328cd0", 32793},
{"sendleaderboards", 32793},
{"isonladder", 32794},
{"getcorpseanim", 32795},
{"playerforcedeathanim", 32796},
{"attach", 32797},
{"sub_14032d110", 32803},
{"startragdoll", 32803},
{"thermaldrawenable", 32809},
{"detach", 32810},
{"detachall", 32811},
@ -559,8 +559,8 @@ namespace scripting
{"getattachtagname", 32814},
{"gethighestnodestance", 32820},
{"doesnodeallowstance", 32821},
{"sub_140316310", 32835},
{"sub_140316590", 32836},
{"getlightcolor", 32835},
{"setlightcolor", 32836},
{"getattachignorecollision", 32839},
{"hidepart", 32840},
{"hidepartallinstances", 32841},
@ -578,15 +578,15 @@ namespace scripting
{"connectpaths", 32856},
{"disconnectnode", 32857},
{"connectnode", 32858},
{"sub_14031fc50", 32868},
{"digitaldistortsetparams", 32868},
{"setmode", 32869},
{"getmode", 32870},
{"islinked", 32872},
{"enablelinkto", 32873},
{"sub_14031dee0", 32876},
{"sub_14031d9a0", 32877},
{"sub_14031e390", 32878},
{"sub_14031e1c0", 32879},
{"setpitch", 32876},
{"scalepitch", 32877},
{"setvolume", 32878},
{"scalevolume", 32879},
{"playsound", 32884},
{"playloopsound", 32885},
{"getnormalhealth", 32891},
@ -637,8 +637,8 @@ namespace scripting
{"setcontents", 32958},
{"makeusable", 32959},
{"makeunusable", 32960},
{"sub_14031c420", 32961},
{"sub_14031c9c0", 32962},
{"makeglobalusable", 32961},
{"makeglobalunusable", 32962},
{"settext", 32970},
{"setmaterial", 32972},
{"settargetent", 32973},
@ -656,9 +656,9 @@ namespace scripting
{"setwaypointedgestyle_rotatingicon", 32985},
{"setcursorhint", 32986},
{"sethintstring", 32987},
{"sub_140328620", 32988},
{"setsecondaryhintstring", 32988},
{"forceusehinton", 32989},
{"sub_1403208f0", 32990},
{"forceusehintoff", 32990},
{"makesoft", 32991},
{"makehard", 32992},
{"entitywillneverchange", 32993},
@ -672,7 +672,7 @@ namespace scripting
{"remotecontrolturretoff", 33001},
{"shootturret", 33002},
{"getturretowner", 33003},
{"sub_1402df4d0", 33017},
{"giveachievement", 33017},
{"sub_1402ddb00", 33022},
{"sub_1402ddcc0", 33023},
{"setsentryowner", 33027},
@ -683,11 +683,11 @@ namespace scripting
{"cleartargetentity", 33032},
{"getturrettarget", 33033},
{"setplayerspread", 33034},
{"sub_140320350", 33035},
{"sub_1403204d0", 33036},
{"sub_1402dd450", 33048},
{"sub_1402dd5c0", 33049},
{"sub_1402dd8c0", 33050},
{"setaispread", 33035},
{"setsuppressiontime", 33036},
{"allowstand", 33048},
{"allowcrouch", 33049},
{"allowprone", 33050},
{"sub_1402dd9e0", 33051},
{"isthrowinggrenade", 33068},
{"isfiring", 33069},
@ -730,12 +730,12 @@ namespace scripting
{"fadeoutshellshock", 33157},
{"setdepthoffield", 33158},
{"setviewmodeldepthoffield", 33159},
{"sub_140313930", 33160},
{"setmotionblurmovescale", 33160},
{"getnegotiationstartnode", 33181},
{"getnegotiationendnode", 33182},
{"getnegotiationnextnode", 33183},
{"sub_1403139f0", 33197},
{"sub_140313a00", 33198},
{"setmotionblurturnscale", 33197},
{"setmotionblurzoomscale", 33198},
{"viewkick", 33199},
{"localtoworldcoords", 33200},
{"getentitynumber", 33201},
@ -777,8 +777,8 @@ namespace scripting
{"setlocalplayerprofiledata", 33295},
{"remotecamerasoundscapeon", 33296},
{"remotecamerasoundscapeoff", 33297},
{"sub_140320ce0", 33298},
{"sub_140320da0", 33299},
{"setmotiontrackervisible", 33298},
{"getmotiontrackervisible", 33299},
{"worldpointinreticle_circle", 33300},
{"worldpointinreticle_rect", 33301},
{"getpointinbounds", 33302},
@ -856,7 +856,7 @@ namespace scripting
{"cloneplayer", 33393},
{"istalking", 33394},
{"allowspectateteam", 33395},
{"sub_1402e86c0", 33396},
{"forcespectatepov", 33396},
{"getguid", 33397},
{"physicslaunchserver", 33398},
{"physicslaunchserveritem", 33399},
@ -932,7 +932,7 @@ namespace scripting
{"setcarddisplayslot", 33477},
{"kc_regweaponforfxremoval", 33478},
{"laststandrevive", 33479},
{"sub_1402e5b30", 33480},
{"laststand", 33480},
{"setspectatedefaults", 33481},
{"getthirdpersoncrosshairoffset", 33482},
{"disableweaponpickup", 33483},
@ -950,8 +950,8 @@ namespace scripting
{"visionsetthermalforplayer", 33495},
{"visionsetpainforplayer", 33496},
{"setblurforplayer", 33497},
{"sub_1402e18d0", 33498},
{"sub_1402e18f0", 33499},
{"getplayerweaponmodel", 33498},
{"getplayerknifemodel", 33499},
{"notifyonplayercommand", 33501},
{"canmantle", 33502},
{"forcemantle", 33503},
@ -963,7 +963,7 @@ namespace scripting
{"weaponlockfinalize", 33509},
{"weaponlockfree", 33510},
{"weaponlocktargettooclose", 33511},
{"usinggamepad", 33512},
{"issplitscreenplayerprimary", 33512},
{"markforeyeson", 33513},
{"issighted", 33514},
{"getsightedplayers", 33515},
@ -989,8 +989,8 @@ namespace scripting
{"clientspawnsighttracepassed", 33535},
{"allowads", 33536},
{"allowjump", 33537},
{"sub_1402ddc20", 33538},
{"sub_1402dde30", 33539},
{"allowladder", 33538},
{"allowmantle", 33539},
{"allowsprint", 33540},
{"setspreadoverride", 33541},
{"resetspreadoverride", 33542},
@ -1054,13 +1054,13 @@ namespace scripting
{"setviewmodel", 33603},
{"setoffhandprimaryclass", 33604},
{"getoffhandprimaryclass", 33605},
{"forcethirdpersonwhenfollowing", 33610},
{"disableforcethirdpersonwhenfollowing", 33611},
{"sub_1402e4c70", 33612},
{"sub_14032dff0", 33610},
{"sub_14032e040", 33611},
{"enablemousesteer", 33612},
{"setscriptmoverkillcam", 33613},
{"sub_1402dd960", 33614},
{"sub_14032dd30", 33615},
{"sub_14032de40", 33616},
{"usinggamepad", 33614},
{"forcethirdpersonwhenfollowing", 33615},
{"disableforcethirdpersonwhenfollowing", 33616},
{"botsetflag", 33617},
{"botsetstance", 33618},
{"botsetscriptmove", 33619},
@ -1137,28 +1137,28 @@ namespace scripting
{"setviewheight", 33696},
{"claimnode", 33697},
{"relinquishclaimednode", 33698},
{"sub_1402ef370", 33699},
{"sub_1402ef420", 33700},
{"setradarping", 33699},
{"visitfxent", 33700},
{"sub_1402ef480", 33701},
{"sub_1402ef4e0", 33702},
{"sub_1402dd560", 33704},
{"sub_1402dd590", 33705},
{"sub_1402e4b80", 33714},
{"sub_1402e4090", 33715},
{"sub_1402e42b0", 33716},
{"allowhighjump", 33714},
{"isjumping", 33715},
{"ishighjumping", 33716},
{"sub_140529a10", 33717},
{"sub_140529a20", 33718},
{"sub_14032d4b0", 33719},
{"sub_14030f7e0", 33720},
{"sub_14030b590", 33721},
{"sub_14030baa0", 33722},
{"sub_1402dd820", 33723},
{"getbraggingright", 33719},
{"getmodelfromentity", 33720},
{"getweaponheatlevel", 33721},
{"isweaponoverheated", 33722},
{"isshiftbuttonpresseddown", 33723},
{"sub_14052be00", 33724},
{"sub_14052beb0", 33725},
{"sub_14052bf30", 33726},
{"sub_1402e0580", 33728},
{"sub_1402e06e0", 33729},
{"sub_1402e0980", 33730},
{"lightsetforplayer", 33728},
{"lightsetoverrideenableforplayer", 33729},
{"lightsetoverridedisableforplayer", 33730},
{"sub_140333c10", 33731},
{"sub_140043710", 33732},
{"sub_14052b420", 33733},
@ -1210,7 +1210,7 @@ namespace scripting
{"enablemissileboosting", 33817},
{"canspawntestclient", 33818},
{"spawntestclient", 33819},
{"sub_1402e6700", 33820},
{"loadcustomizationplayerview", 33820},
{"setgrenadethrowscale", 33821},
{"setgrenadecookscale", 33822},
{"setplanesplineid", 33823},
@ -1241,17 +1241,17 @@ namespace scripting
{"setfxkilldefondelete", 33853},
{"sub_1402e1b80", 33856},
{"sub_140310fb0", 33858},
{"sub_1402ddf40", 33859},
{"challengenotification", 33859},
{"sub_140528300", 33860},
{"sub_14052bff0", 33861},
{"sub_140317af0", 33862},
{"sub_1402e2710", 33863},
{"sub_140319b60", 33866},
{"sub_14030c040", 33867},
{"sub_14030c190", 33868},
{"sub_1402dc8f0", 33869},
{"linktosynchronizedparent", 33862},
{"getclientomnvar", 33863},
{"getcacplayerdataforgroup", 33866},
{"cloakingenable", 33867},
{"cloakingdisable", 33868},
{"getunnormalizedcameramovement", 33869},
{"sub_14031edf0", 33870},
{"sub_14031fd30", 33871},
{"isturretoverheated", 33871},
{"sub_14052c170", 33872},
{"sub_14052c190", 33873},
{"sub_14052c1b0", 33874},
@ -1269,8 +1269,8 @@ namespace scripting
{"isoffhandweaponreadytothrow", 33893},
{"makecollidewithitemclip", 33895},
{"visionsetpostapplyforplayer", 33897},
{"sub_140334e90", 33898},
{"sub_140335040", 33899},
{"setlookattarget", 33898},
{"clearlookattarget", 33899},
{"sub_14052c250", 33907},
{"sub_14052c290", 33908},
{"sub_14052c2f0", 33909},
@ -1278,48 +1278,48 @@ namespace scripting
{"sub_14052c360", 33911},
{"sub_14031c170", 33912},
{"sub_14031c590", 33913},
{"sub_1402e0390", 33914},
{"setclienttriggervisionset", 33914},
{"sub_1402e41c0", 33917},
{"sub_1402e43b0", 33918},
{"sub_14052b4d0", 33919},
{"sub_14052b550", 33920},
{"sub_1402de630", 33921},
{"sub_1402deb60", 33922},
{"sub_14030fbd0", 33923},
{"sub_1402dcef0", 33925},
{"sub_1402dcd60", 33926},
{"showviewmodel", 33921},
{"hideviewmodel", 33922},
{"setpickupweapon", 33923},
{"allowpowerslide", 33925},
{"allowhighjumpdrop", 33926},
{"sub_1404045e0", 33927},
{"sub_1405297e0", 33928},
{"sub_14052c200", 33929},
{"sub_140403ef0", 33930},
{"clearentity", 33930},
{"sub_140334a40", 33931},
{"sub_1402dcc10", 33933},
{"allowdodge", 33933},
{"sub_140529860", 33934},
{"sub_1405297f0", 33935},
{"setminimapvisible", 33935},
{"sub_1402e0a90", 33936},
{"sub_1402e0bc0", 33937},
{"sub_1402e0cf0", 33938},
{"sub_14031c840", 33940},
{"sub_140329c80", 33941},
{"sub_14032a100", 33942},
{"sub_14032e850", 33946},
{"sub_140328dd0", 33947},
{"sub_1402e3680", 33948},
{"setplayermech", 33940},
{"setdamagecallbackon", 33941},
{"finishentitydamage", 33942},
{"designatefoftarget", 33946},
{"sethintstringvisibleonlytoowner", 33947},
{"notifyonplayercommandremove", 33948},
{"sub_1402e3bf0", 33949},
{"sub_1402dcb40", 33950},
{"sub_14032e8c0", 33951},
{"sub_14032eab0", 33952},
{"sub_14032ec40", 33953},
{"sub_14032ef70", 33954},
{"sub_14032f290", 33955},
{"sub_14032f960", 33956},
{"sub_14032f4c0", 33957},
{"sub_140327b20", 33958},
{"sub_140327f80", 33959},
{"sub_14032fef0", 33960},
{"sub_140312340", 33961},
{"sub_140312c40", 33962},
{"sub_140312e80", 33963},
{"allowboostjump", 33950},
{"batterydischargebegin", 33951},
{"batterydischargeend", 33952},
{"batterydischargeonce", 33953},
{"batterygetcharge", 33954},
{"batterysetcharge", 33955},
{"batteryfullrecharge", 33956},
{"batterygetsize", 33957},
{"batterysetdischargescale", 33958},
{"batterygetdischargerate", 33959},
{"batteryisinuse", 33960},
{"enablephysicaldepthoffieldscripting", 33961},
{"disablephysicaldepthoffieldscripting", 33962},
{"setphysicaldepthoffield", 33963},
{"sub_140313860", 33964},
{"sub_14052a560", 33965},
{"sub_140321790", 33966},
@ -1327,24 +1327,24 @@ namespace scripting
{"sub_1402dda50", 33968},
{"sub_14052ac50", 33969},
{"sub_14052ad50", 33970},
{"sub_1402e6c20", 33971},
{"setdemigod", 33971},
{"sub_140310840", 33972},
{"sub_140317430", 33978},
{"setcostumemodels", 33978},
{"sub_140529e00", 33979},
{"sub_140313510", 33980},
{"sub_140334be0", 33981},
{"sub_1403204e0", 33982},
{"sub_1402e0a30", 33983},
{"sub_1402e0b60", 33984},
{"sub_1402e6ca0", 33985},
{"sub_1402e7060", 33986},
{"sub_1402e13f0", 33987},
{"sub_1402e17a0", 33988},
{"sub_1403290c0", 33989},
{"sub_140312710", 33990},
{"scriptmodelpauseanim", 33981},
{"digitaldistortsetmaterial", 33982},
{"disableoffhandsecondaryweapons", 33983},
{"enableoffhandsecondaryweapons", 33984},
{"canplaceriotshield", 33985},
{"setriotshieldfailhint", 33986},
{"enabledetonate", 33987},
{"getdetonateenabled", 33988},
{"playergetuseent", 33989},
{"refreshshieldmodels", 33990},
{"sub_14052c3a0", 33991},
{"locret_140406a70", 33993},
{"sub_1402e46b0", 33994},
{"getgravity", 33994},
{"sub_140529560", 33997},
{"sub_140529650", 33998},
{"setcommonplayerdatareservedint", 33999},
@ -1353,74 +1353,74 @@ namespace scripting
{"getcommonplayerdatareservedint", 34002},
{"sub_1402e8a20", 34003},
{"sub_14052c3c0", 34004},
{"sub_1403143d0", 34005},
{"sub_1403145c0", 34006},
{"sub_1403122f0", 34007},
{"sub_1403123d0", 34008},
{"addsoundmutedevice", 34005},
{"removesoundmutedevice", 34006},
{"clientaddsoundsubmix", 34007},
{"clientclearsoundsubmix", 34008},
{"sub_140312520", 34009},
{"sub_140312ba0", 34010},
{"sub_140312bf0", 34011},
{"sub_140312cb0", 34012},
{"sub_140312df0", 34013},
{"sub_140312ff0", 34014},
{"sub_1402e3d20", 34016},
{"sub_140334560", 34017},
{"isusingoffhand", 34016},
{"physicsstop", 34017},
{"sub_14031b9e0", 34018},
{"sub_14031e3c0", 34023},
{"sub_1402ef8a0", 34024},
{"sub_14052c400", 34025},
{"sub_14031a1a0", 34026},
{"sub_1402e1700", 34027},
{"initwaterclienttrigger", 34026},
{"getcurrentweaponmodelname", 34027},
{"sub_14031f000", 34028},
{"setignorefoliagesightingme", 34030},
{"sub_140317940", 34031},
{"loadcostumemodels", 34031},
{"sub_14030cd90", 34036},
{"sub_14030b1c0", 34038},
{"sub_140322450", 34039},
{"sub_14030c2f0", 34040},
{"iscloaked", 34040},
{"sub_140528bc0", 34041},
{"sub_140528cf0", 34042},
{"sub_14031fb80", 34043},
{"sub_140320180", 34044},
{"sub_14031e7d0", 34045},
{"sub_14031eab0", 34046},
{"selfieaccessselfievalidflaginplayerdef", 34045},
{"selfieaccessselfiecustomassetsarestreamed", 34046},
{"sub_14031ede0", 34048},
{"sub_14031eeb0", 34049},
{"selfiescreenshottaken", 34049},
{"sub_14031f190", 34050},
{"sub_140319de0", 34052},
{"sub_140319580", 34053},
{"sub_1402e8800", 34054},
{"sub_140329180", 34055},
{"sub_140329240", 34056},
{"setmissilecoasting", 34053},
{"setmlgspectator", 34054},
{"gettotalmpxp", 34055},
{"turretsetgroundaimentity", 34056},
{"sub_140318610", 34057},
{"sub_140317760", 34058},
{"sub_14032e9a0", 34059},
{"sub_140320830", 34060},
{"sub_140329bc0", 34061},
{"sub_14032e370", 34062},
{"sub_14032c510", 34063},
{"sub_14032ac40", 34064},
{"sub_1402e6a80", 34065},
{"consumereinforcement", 34063},
{"ghost", 34064},
{"loadweapons", 34065},
{"sub_1402e0e80", 34067},
{"sub_1402ef290", 34068},
{"sub_140328d20", 34069},
{"sub_14032dbf0", 34070},
{"sub_14032dce0", 34071},
{"setwaypointiconfadeatcenter", 34068},
{"setreinforcementhintstrings", 34069},
{"playgoliathentryanim", 34070},
{"playgoliathtoidleanim", 34071},
{"sub_140312210", 34072},
{"sub_140312280", 34073},
{"sub_140321660", 34074},
{"sub_1402e3ec0", 34075},
{"sub_140319690", 34076},
{"playlocalannouncersound", 34075},
{"setmissilespecialclipmask", 34076},
{"sub_140527c40", 34077},
{"sub_140527c60", 34078},
{"sub_1402e4400", 34079},
{"sub_1402e4640", 34080},
{"isdodging", 34079},
{"ispowersliding", 34080},
{"sub_140320ab0", 34081},
{"sub_14032c720", 34082},
{"getcurrentping", 34082},
{"sub_1402eeb60", 34083},
{"sub_140329390", 34084},
{"sub_140317000", 34085},
{"sub_140317020", 34086},
{"gethordeplayerdata", 34085},
{"sethordeplayerdata", 34086},
{"sub_1402dcbc0", 34087},
{"sub_14031a0b0", 34088},
{"sub_1403198a0", 34089},
@ -1428,18 +1428,18 @@ namespace scripting
{"sub_1402e7d80", 34092},
{"sub_140404f00", 34093},
{"issplitscreenplayer2", 34095},
{"sub_140317b50", 34096},
{"sub_140318c60", 34097},
{"setowneroriginal", 34096},
{"getlinkedtagname", 34097},
{"sub_14032de80", 34098},
{"sub_14032dfb0", 34099},
{"sub_1402ef300", 34100},
{"sub_1402e6b00", 34101},
{"setwaypointaerialtargeting", 34100},
{"worldweaponsloaded", 34101},
{"sub_140320aa0", 34102},
{"sub_14031ef00", 34103},
{"sub_1402e6a10", 34104},
{"sub_1402e5c10", 34105},
{"sub_14031f870", 34106},
{"sub_140329750", 34107},
{"usetriggertouchcheckstance", 34103},
{"onlystreamactiveweapon", 34104},
{"precachekillcamiconforweapon", 34105},
{"selfierequestupdate", 34106},
{"getclanwarsbonus", 34107},
{"sub_140406810", 34108},
{"sub_1404051d0", 34109},
{"sub_140406340", 34110},
@ -1454,8 +1454,8 @@ namespace scripting
{"sub_140333550", 34119},
{"sub_140403fe0", 34120},
{"sub_140320360", 34121},
{"sub_1402dc850", 34122},
{"sub_140329830", 34123},
{"canhighjump", 34122},
{"setprestigemastery", 34123},
{"sub_140403f50", 34124},
{"sub_14030c7b0", 34125},
{"sub_1403206b0", 34126},

View File

@ -2,10 +2,15 @@
#include "../event.hpp"
#pragma warning(push)
#pragma warning(disable: 4702)
#define SOL_ALL_SAFETIES_ON 1
#define SOL_PRINT_ERRORS 0
#include <sol/sol.hpp>
#pragma warning(pop)
#include "scheduler.hpp"
#include "event_handler.hpp"

View File

@ -2,6 +2,8 @@
#include "error.hpp"
#include "../execution.hpp"
#include "component/console.hpp"
namespace scripting::lua
{
namespace
@ -22,12 +24,12 @@ namespace scripting::lua
{
if (!result.valid())
{
printf("************** Script execution error **************\n");
console::error("************** Script execution error **************\n");
const sol::error err = result;
printf("%s\n", err.what());
console::error("%s\n", err.what());
printf("****************************************************\n");
console::error("****************************************************\n");
notify_error();
}

View File

@ -81,6 +81,10 @@ namespace game
Dvar_RegisterInt{0x140371CF0, 0x1404C1080};
WEAK symbol<dvar_t*(const char* dvarName, const char* value, unsigned int flags, const char* description)>
Dvar_RegisterString{0x140372050, 0x1404C1450};
WEAK symbol<dvar_t* (const char* dvarName, float x, float y, float min, float max,
unsigned int flags, const char* description)> Dvar_RegisterVec2{0x140372120, 0x1404C1520};
WEAK symbol<dvar_t* (const char* dvarName, float x, float y, float z, float min, float max,
unsigned int flags, const char* description)> Dvar_RegisterVec3{0x140372230, 0x1404C1600};
WEAK symbol<dvar_t*(const char* dvarName, float x, float y, float z, float w, float min, float max,
unsigned int flags, const char* description)> Dvar_RegisterVec4{0x140372430, 0x1404C1800};
@ -90,7 +94,8 @@ namespace game
WEAK symbol<void(void* buffer)> FS_FreeFile{0x140362380, 0x1404AF370};
WEAK symbol<void()> GScr_LoadConsts{0x140283970, 0x1403479C0};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int name)> FindVariable{0x1403166D0, 0x1403F2DC0};
WEAK symbol<unsigned int(unsigned int parentId, unsigned int name)> FindVariable{0x1403165D0, 0x1403F2DC0};
WEAK symbol<unsigned int(int entnum, unsigned int classnum)> FindEntityId{0x1403166D0, 0x1403F2CC0};
WEAK symbol<scr_string_t(unsigned int parentId, unsigned int id)> GetVariableName{0x1403170E0, 0x1403F37F0};
WEAK symbol<void(VariableValue* result, unsigned int classnum, int entnum, int offset)> GetEntityFieldValue{
0x14031AAD0, 0x1403F72A0