random cleanup and changes
This commit is contained in:
parent
3a04ad3132
commit
d745e9df04
@ -1,9 +1,10 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "scheduler.hpp"
|
|
||||||
#include "game/game.hpp"
|
|
||||||
|
|
||||||
#include "arxan.hpp"
|
#include "arxan.hpp"
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
@ -2,18 +2,19 @@
|
|||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "auth.hpp"
|
#include "auth.hpp"
|
||||||
#include "component/command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "network.hpp"
|
#include "network.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "steam/steam.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
#include <utils/smbios.hpp>
|
#include <utils/smbios.hpp>
|
||||||
#include <utils/info_string.hpp>
|
#include <utils/info_string.hpp>
|
||||||
#include <utils/cryptography.hpp>
|
#include <utils/cryptography.hpp>
|
||||||
|
|
||||||
#include "game/game.hpp"
|
|
||||||
#include "steam/steam.hpp"
|
|
||||||
|
|
||||||
namespace auth
|
namespace auth
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -249,9 +250,9 @@ namespace auth
|
|||||||
utils::hook::set(0x12D93C_b, 0xC3);
|
utils::hook::set(0x12D93C_b, 0xC3);
|
||||||
}
|
}
|
||||||
|
|
||||||
command::add("guid", []()
|
command::add("guid", []
|
||||||
{
|
{
|
||||||
printf("Your guid: %llX\n", steam::SteamUser()->GetSteamID().bits);
|
console::info("Your guid: %llX\n", steam::SteamUser()->GetSteamID().bits);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
|
@ -29,10 +29,10 @@ namespace bots
|
|||||||
void bot_team_join(const int entity_num)
|
void bot_team_join(const int entity_num)
|
||||||
{
|
{
|
||||||
const game::scr_entref_t entref{static_cast<uint16_t>(entity_num), 0};
|
const game::scr_entref_t entref{static_cast<uint16_t>(entity_num), 0};
|
||||||
scheduler::once([entref]()
|
scheduler::once([entref]
|
||||||
{
|
{
|
||||||
scripting::notify(entref, "luinotifyserver", {"team_select", 2});
|
scripting::notify(entref, "luinotifyserver", {"team_select", 2});
|
||||||
scheduler::once([entref]()
|
scheduler::once([entref]
|
||||||
{
|
{
|
||||||
auto* _class = utils::string::va("class%d", utils::cryptography::random::get_integer() % 5);
|
auto* _class = utils::string::va("class%d", utils::cryptography::random::get_integer() % 5);
|
||||||
scripting::notify(entref, "luinotifyserver", {"class_select", _class});
|
scripting::notify(entref, "luinotifyserver", {"class_select", _class});
|
||||||
@ -65,7 +65,7 @@ namespace bots
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
add_bot();
|
add_bot();
|
||||||
}, scheduler::pipeline::server, 100ms);
|
}, scheduler::pipeline::server, 100ms);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "command.hpp"
|
||||||
|
#include "dvars.hpp"
|
||||||
#include "localized_strings.hpp"
|
#include "localized_strings.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "command.hpp"
|
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "dvars.hpp"
|
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
|
@ -34,9 +34,8 @@ namespace bullet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bg_surface_penetration = dvars::register_float("bg_surfacePenetration", 0.0f,
|
bg_surface_penetration = dvars::register_float("bg_surfacePenetration", 0.0f, 0.0f, std::numeric_limits<float>::max(), 0,
|
||||||
0.0f, std::numeric_limits<float>::max(), 0,
|
"Set to a value greater than 0 to override the bullet surface penetration depth");
|
||||||
"Set to a value greater than 0 to override the surface penetration depth");
|
|
||||||
|
|
||||||
bg_get_surface_penetration_depth_hook.create(0x2E1110_b, &bg_get_surface_penetration_depth_stub);
|
bg_get_surface_penetration_depth_hook.create(0x2E1110_b, &bg_get_surface_penetration_depth_stub);
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
|
||||||
#include "game/dvars.hpp"
|
|
||||||
#include "game/scripting/execution.hpp"
|
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
#include "dvars.hpp"
|
||||||
#include "game_console.hpp"
|
#include "game_console.hpp"
|
||||||
#include "fastfiles.hpp"
|
#include "fastfiles.hpp"
|
||||||
#include "filesystem.hpp"
|
#include "filesystem.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "logfile.hpp"
|
#include "logfile.hpp"
|
||||||
#include "dvars.hpp"
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
#include "game/scripting/execution.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "console.hpp"
|
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "rcon.hpp"
|
#include "rcon.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace console
|
|||||||
{
|
{
|
||||||
static thread_local char buffer[0x1000];
|
static thread_local char buffer[0x1000];
|
||||||
|
|
||||||
const auto count = _vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer), message, *ap);
|
const auto count = vsnprintf_s(buffer, _TRUNCATE, message, *ap);
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
|
@ -138,7 +138,7 @@ namespace dedicated
|
|||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
command::execute("map_rotate");
|
command::execute("map_rotate");
|
||||||
}, scheduler::main, 3s);
|
}, scheduler::main, 3s);
|
||||||
@ -313,7 +313,7 @@ namespace dedicated
|
|||||||
{
|
{
|
||||||
if (game::Live_SyncOnlineDataFlags(0) == 32 && game::Sys_IsDatabaseReady2())
|
if (game::Live_SyncOnlineDataFlags(0) == 32 && game::Sys_IsDatabaseReady2())
|
||||||
{
|
{
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
command::execute("xstartprivateparty", true);
|
command::execute("xstartprivateparty", true);
|
||||||
command::execute("disconnect", true); // 32 -> 0
|
command::execute("disconnect", true); // 32 -> 0
|
||||||
@ -324,7 +324,7 @@ namespace dedicated
|
|||||||
return scheduler::cond_continue;
|
return scheduler::cond_continue;
|
||||||
}, scheduler::pipeline::main, 1s);
|
}, scheduler::pipeline::main, 1s);
|
||||||
|
|
||||||
scheduler::on_game_initialized([]()
|
scheduler::on_game_initialized([]
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "game/game.hpp"
|
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include <utils\string.hpp>
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
|
||||||
|
#include <utils/string.hpp>
|
||||||
|
|
||||||
namespace dedicated_info
|
namespace dedicated_info
|
||||||
{
|
{
|
||||||
@ -16,7 +19,7 @@ namespace dedicated_info
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::loop([]()
|
scheduler::loop([]
|
||||||
{
|
{
|
||||||
auto* sv_running = game::Dvar_FindVar("sv_running");
|
auto* sv_running = game::Dvar_FindVar("sv_running");
|
||||||
if (!sv_running || !sv_running->current.enabled || (*game::mp::svs_clients) == nullptr)
|
if (!sv_running || !sv_running->current.enabled || (*game::mp::svs_clients) == nullptr)
|
||||||
@ -25,9 +28,9 @@ namespace dedicated_info
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* const sv_hostname = game::Dvar_FindVar("sv_hostname");
|
const auto sv_hostname = game::Dvar_FindVar("sv_hostname");
|
||||||
auto* const sv_maxclients = game::Dvar_FindVar("sv_maxclients");
|
const auto sv_maxclients = game::Dvar_FindVar("sv_maxclients");
|
||||||
auto* const mapname = game::Dvar_FindVar("mapname");
|
const auto mapname = game::Dvar_FindVar("mapname");
|
||||||
|
|
||||||
auto bot_count = 0;
|
auto bot_count = 0;
|
||||||
auto client_count = 0;
|
auto client_count = 0;
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
|
||||||
#include <utils/thread.hpp>
|
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "game/demonware/servers/lobby_server.hpp"
|
#include "game/demonware/servers/lobby_server.hpp"
|
||||||
#include "game/demonware/servers/auth3_server.hpp"
|
#include "game/demonware/servers/auth3_server.hpp"
|
||||||
#include "game/demonware/servers/stun_server.hpp"
|
#include "game/demonware/servers/stun_server.hpp"
|
||||||
#include "game/demonware/servers/umbrella_server.hpp"
|
#include "game/demonware/servers/umbrella_server.hpp"
|
||||||
#include "game/demonware/server_registry.hpp"
|
#include "game/demonware/server_registry.hpp"
|
||||||
#include <game/dvars.hpp>
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
#include <utils/thread.hpp>
|
||||||
|
|
||||||
#define TCP_BLOCKING true
|
#define TCP_BLOCKING true
|
||||||
#define UDP_BLOCKING false
|
#define UDP_BLOCKING false
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "scheduler.hpp"
|
|
||||||
#include "game/game.hpp"
|
|
||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "discord.hpp"
|
||||||
|
#include "materials.hpp"
|
||||||
#include "network.hpp"
|
#include "network.hpp"
|
||||||
#include "party.hpp"
|
#include "party.hpp"
|
||||||
#include "materials.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "discord.hpp"
|
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
#include "game/ui_scripting/execution.hpp"
|
#include "game/ui_scripting/execution.hpp"
|
||||||
|
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
@ -58,16 +58,12 @@ namespace discord
|
|||||||
static char details[0x80] = {0};
|
static char details[0x80] = {0};
|
||||||
const auto map = game::Dvar_FindVar("mapname")->current.string;
|
const auto map = game::Dvar_FindVar("mapname")->current.string;
|
||||||
const auto key = utils::string::va("PRESENCE_%s%s", SELECT_VALUE("SP_", ""), map);
|
const auto key = utils::string::va("PRESENCE_%s%s", SELECT_VALUE("SP_", ""), map);
|
||||||
const char* mapname = nullptr;
|
const char* mapname = map;
|
||||||
|
|
||||||
if (game::DB_XAssetExists(game::ASSET_TYPE_LOCALIZE, key) && !game::DB_IsXAssetDefault(game::ASSET_TYPE_LOCALIZE, key))
|
if (game::DB_XAssetExists(game::ASSET_TYPE_LOCALIZE, key) && !game::DB_IsXAssetDefault(game::ASSET_TYPE_LOCALIZE, key))
|
||||||
{
|
{
|
||||||
mapname = game::UI_SafeTranslateString(key);
|
mapname = game::UI_SafeTranslateString(key);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
mapname = map;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game::environment::is_mp())
|
if (game::environment::is_mp())
|
||||||
{
|
{
|
||||||
@ -80,7 +76,6 @@ namespace discord
|
|||||||
clean_hostname, sizeof(clean_hostname));
|
clean_hostname, sizeof(clean_hostname));
|
||||||
auto max_clients = party::server_client_count();
|
auto max_clients = party::server_client_count();
|
||||||
|
|
||||||
// When true, we are in Private Match
|
|
||||||
if (game::SV_Loaded())
|
if (game::SV_Loaded())
|
||||||
{
|
{
|
||||||
strcpy_s(clean_hostname, "Private Match");
|
strcpy_s(clean_hostname, "Private Match");
|
||||||
@ -227,12 +222,17 @@ namespace discord
|
|||||||
handlers.joinGame = join_game;
|
handlers.joinGame = join_game;
|
||||||
handlers.joinRequest = join_request;
|
handlers.joinRequest = join_request;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handlers.joinGame = nullptr;
|
||||||
|
handlers.joinRequest = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
Discord_Initialize("947125042930667530", &handlers, 1, nullptr);
|
Discord_Initialize("947125042930667530", &handlers, 1, nullptr);
|
||||||
|
|
||||||
scheduler::once(download_default_avatar, scheduler::pipeline::async);
|
scheduler::once(download_default_avatar, scheduler::pipeline::async);
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
scheduler::once(update_discord, scheduler::pipeline::async);
|
scheduler::once(update_discord, scheduler::pipeline::async);
|
||||||
scheduler::loop(update_discord, scheduler::pipeline::async, 5s);
|
scheduler::loop(update_discord, scheduler::pipeline::async, 5s);
|
||||||
@ -270,15 +270,12 @@ namespace discord
|
|||||||
|
|
||||||
static void join_game(const char* join_secret)
|
static void join_game(const char* join_secret)
|
||||||
{
|
{
|
||||||
console::info("Discord: Join game called with join secret: %s\n", join_secret);
|
scheduler::once([=]
|
||||||
|
|
||||||
std::string secret = join_secret;
|
|
||||||
scheduler::once([=]()
|
|
||||||
{
|
{
|
||||||
game::netadr_s target{};
|
game::netadr_s target{};
|
||||||
if (game::NET_StringToAdr(secret.data(), &target))
|
if (game::NET_StringToAdr(join_secret, &target))
|
||||||
{
|
{
|
||||||
console::info("Discord: Connecting to server: %s\n", secret.data());
|
console::info("Discord: Connecting to server: %s\n", join_secret);
|
||||||
party::connect(target);
|
party::connect(target);
|
||||||
}
|
}
|
||||||
}, scheduler::pipeline::main);
|
}, scheduler::pipeline::main);
|
||||||
@ -286,7 +283,7 @@ namespace discord
|
|||||||
|
|
||||||
static void join_request(const DiscordUser* request)
|
static void join_request(const DiscordUser* request)
|
||||||
{
|
{
|
||||||
console::info("Discord: join_request from %s (%s)\n", request->username, request->userId);
|
console::info("Discord: Join request from %s (%s)\n", request->username, request->userId);
|
||||||
|
|
||||||
if (game::Com_InFrontend() || !ui_scripting::lui_running())
|
if (game::Com_InFrontend() || !ui_scripting::lui_running())
|
||||||
{
|
{
|
||||||
@ -299,7 +296,7 @@ namespace discord
|
|||||||
std::string discriminator = request->discriminator;
|
std::string discriminator = request->discriminator;
|
||||||
std::string username = request->username;
|
std::string username = request->username;
|
||||||
|
|
||||||
scheduler::once([=]()
|
scheduler::once([=]
|
||||||
{
|
{
|
||||||
const ui_scripting::table request_table{};
|
const ui_scripting::table request_table{};
|
||||||
request_table.set("avatar", avatar);
|
request_table.set("avatar", avatar);
|
||||||
|
@ -71,7 +71,7 @@ namespace download
|
|||||||
static_cast<double>(total));
|
static_cast<double>(total));
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::once([=]()
|
scheduler::once([=]
|
||||||
{
|
{
|
||||||
ui_scripting::notify("mod_download_progress",
|
ui_scripting::notify("mod_download_progress",
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ namespace download
|
|||||||
|
|
||||||
void menu_error(const std::string& error)
|
void menu_error(const std::string& error)
|
||||||
{
|
{
|
||||||
scheduler::once([=]()
|
scheduler::once([=]
|
||||||
{
|
{
|
||||||
party::menu_error(error);
|
party::menu_error(error);
|
||||||
}, scheduler::pipeline::lui);
|
}, scheduler::pipeline::lui);
|
||||||
@ -102,7 +102,7 @@ namespace download
|
|||||||
{
|
{
|
||||||
if (download_active())
|
if (download_active())
|
||||||
{
|
{
|
||||||
scheduler::schedule([=]()
|
scheduler::schedule([=]
|
||||||
{
|
{
|
||||||
if (!download_active())
|
if (!download_active())
|
||||||
{
|
{
|
||||||
@ -128,14 +128,12 @@ namespace download
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::once([=]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
const ui_scripting::table mod_data_table{};
|
|
||||||
|
|
||||||
ui_scripting::notify("mod_download_start", {});
|
ui_scripting::notify("mod_download_start", {});
|
||||||
}, scheduler::pipeline::lui);
|
}, scheduler::pipeline::lui);
|
||||||
|
|
||||||
scheduler::once([=]()
|
scheduler::once([=]
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
const auto _0 = gsl::finally(&mark_unactive);
|
const auto _0 = gsl::finally(&mark_unactive);
|
||||||
@ -148,7 +146,7 @@ namespace download
|
|||||||
|
|
||||||
for (const auto& file : files)
|
for (const auto& file : files)
|
||||||
{
|
{
|
||||||
scheduler::once([=]()
|
scheduler::once([=]
|
||||||
{
|
{
|
||||||
const ui_scripting::table data_table{};
|
const ui_scripting::table data_table{};
|
||||||
data_table.set("name", file.name.data());
|
data_table.set("name", file.name.data());
|
||||||
@ -192,12 +190,12 @@ namespace download
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
ui_scripting::notify("mod_download_done", {});
|
ui_scripting::notify("mod_download_done", {});
|
||||||
}, scheduler::pipeline::lui);
|
}, scheduler::pipeline::lui);
|
||||||
|
|
||||||
scheduler::once([=]()
|
scheduler::once([target]
|
||||||
{
|
{
|
||||||
party::connect(target);
|
party::connect(target);
|
||||||
}, scheduler::pipeline::main);
|
}, scheduler::pipeline::main);
|
||||||
@ -216,11 +214,10 @@ namespace download
|
|||||||
globals_.abort = true;
|
globals_.abort = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
ui_scripting::notify("mod_download_done", {});
|
ui_scripting::notify("mod_download_done", {});
|
||||||
party::menu_error("Download for server mod has been cancelled.");
|
party::menu_error("Download for server mod has been cancelled.");
|
||||||
}, scheduler::pipeline::lui);
|
}, scheduler::pipeline::lui);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/info_string.hpp>
|
#include <utils/info_string.hpp>
|
||||||
|
|
||||||
namespace download
|
namespace download
|
||||||
|
@ -135,7 +135,7 @@ namespace dvar_cheats
|
|||||||
utils::hook::nop(0x1861D4_b, 8); // let our stub handle zero-source sets
|
utils::hook::nop(0x1861D4_b, 8); // let our stub handle zero-source sets
|
||||||
utils::hook::jump(0x1861DF_b, get_dvar_flag_checks_stub(), true); // check extra dvar flags when setting values
|
utils::hook::jump(0x1861DF_b, get_dvar_flag_checks_stub(), true); // check extra dvar flags when setting values
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
dvars::register_bool("sv_cheats", false, game::DvarFlags::DVAR_FLAG_REPLICATED,
|
dvars::register_bool("sv_cheats", false, game::DvarFlags::DVAR_FLAG_REPLICATED,
|
||||||
"Allow cheat commands and dvars on this server");
|
"Allow cheat commands and dvars on this server");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "dvars.hpp"
|
#include "dvars.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "system_check.hpp"
|
|
||||||
#include "scheduler.hpp"
|
|
||||||
|
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
#include "system_check.hpp"
|
||||||
|
#include "version.hpp"
|
||||||
|
|
||||||
|
#include "game/dvars.hpp"
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
@ -13,10 +16,6 @@
|
|||||||
|
|
||||||
#include <exception/minidump.hpp>
|
#include <exception/minidump.hpp>
|
||||||
|
|
||||||
#include <version.hpp>
|
|
||||||
|
|
||||||
#include "game/dvars.hpp"
|
|
||||||
|
|
||||||
namespace exception
|
namespace exception
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
@ -246,7 +245,7 @@ namespace exception
|
|||||||
SetUnhandledExceptionFilter(exception_filter);
|
SetUnhandledExceptionFilter(exception_filter);
|
||||||
utils::hook::jump(SetUnhandledExceptionFilter, set_unhandled_exception_filter_stub, true);
|
utils::hook::jump(SetUnhandledExceptionFilter, set_unhandled_exception_filter_stub, true);
|
||||||
|
|
||||||
scheduler::on_game_initialized([]()
|
scheduler::on_game_initialized([]
|
||||||
{
|
{
|
||||||
is_initialized() = true;
|
is_initialized() = true;
|
||||||
});
|
});
|
||||||
@ -255,7 +254,7 @@ namespace exception
|
|||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
dvars::cg_legacyCrashHandling = dvars::register_bool("cg_legacyCrashHandling",
|
dvars::cg_legacyCrashHandling = dvars::register_bool("cg_legacyCrashHandling",
|
||||||
false, game::DVAR_FLAG_SAVED, "Disable new crash handling");
|
false, game::DVAR_FLAG_SAVED, "Toggle new crash handling");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "game/dvars.hpp"
|
|
||||||
|
|
||||||
#include "fastfiles.hpp"
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
#include "fastfiles.hpp"
|
||||||
#include "filesystem.hpp"
|
#include "filesystem.hpp"
|
||||||
|
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/concurrency.hpp>
|
#include <utils/concurrency.hpp>
|
||||||
#include <utils/io.hpp>
|
#include <utils/io.hpp>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "fonts.hpp"
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
|
#include "fonts.hpp"
|
||||||
#include "filesystem.hpp"
|
#include "filesystem.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "dvars.hpp"
|
||||||
#include "fps.hpp"
|
#include "fps.hpp"
|
||||||
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "game/dvars.hpp"
|
#include "game/dvars.hpp"
|
||||||
#include "dvars.hpp"
|
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
#include <component/scheduler.hpp>
|
|
||||||
|
|
||||||
namespace fps
|
namespace fps
|
||||||
{
|
{
|
||||||
|
@ -89,8 +89,7 @@ namespace gsc
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string source_buffer;
|
std::string source_buffer;
|
||||||
const auto rawfile_gsc_exists = read_script_file(real_name + ".gsc", &source_buffer);
|
if (!read_script_file(real_name + ".gsc", &source_buffer) || source_buffer.empty())
|
||||||
if (!rawfile_gsc_exists || source_buffer.empty())
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -98,17 +97,12 @@ namespace gsc
|
|||||||
if (game::DB_XAssetExists(game::ASSET_TYPE_SCRIPTFILE, file_name) &&
|
if (game::DB_XAssetExists(game::ASSET_TYPE_SCRIPTFILE, file_name) &&
|
||||||
!game::DB_IsXAssetDefault(game::ASSET_TYPE_SCRIPTFILE, file_name))
|
!game::DB_IsXAssetDefault(game::ASSET_TYPE_SCRIPTFILE, file_name))
|
||||||
{
|
{
|
||||||
// filter out developer rawfiles that won't compile
|
// filter out gsc rawfiles that contain developer code (has ScriptFile counterparts for ship, won't compile either)
|
||||||
if ((real_name.starts_with("maps/createfx") || real_name.starts_with("maps/createart") || real_name.starts_with("maps/mp"))
|
if ((real_name.starts_with("maps/createfx") || real_name.starts_with("maps/createart") || real_name.starts_with("maps/mp"))
|
||||||
&& (real_name.ends_with("_fx") || real_name.ends_with("_fog") || real_name.ends_with("_hdr")))
|
&& (real_name.ends_with("_fx") || real_name.ends_with("_fog") || real_name.ends_with("_hdr")))
|
||||||
{
|
{
|
||||||
return game::DB_FindXAssetHeader(game::ASSET_TYPE_SCRIPTFILE, file_name, false).scriptfile;
|
return game::DB_FindXAssetHeader(game::ASSET_TYPE_SCRIPTFILE, file_name, false).scriptfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rawfile_gsc_exists)
|
|
||||||
{
|
|
||||||
return game::DB_FindXAssetHeader(game::ASSET_TYPE_SCRIPTFILE, file_name, false).scriptfile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::uint8_t> data;
|
std::vector<std::uint8_t> data;
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
#include "game/game.hpp"
|
|
||||||
#include <game/dvars.hpp>
|
|
||||||
|
|
||||||
namespace map_rotation
|
namespace map_rotation
|
||||||
{
|
{
|
||||||
@ -82,14 +86,12 @@ namespace map_rotation
|
|||||||
auto* const dvar = game::Dvar_FindVar("sv_autoPriority");
|
auto* const dvar = game::Dvar_FindVar("sv_autoPriority");
|
||||||
if (dvar && dvar->current.enabled)
|
if (dvar && dvar->current.enabled)
|
||||||
{
|
{
|
||||||
scheduler::on_game_initialized([]()
|
scheduler::on_game_initialized([]
|
||||||
{
|
{
|
||||||
//printf("=======================setting OLD priority=======================\n");
|
|
||||||
SetPriorityClass(GetCurrentProcess(), previous_priority);
|
SetPriorityClass(GetCurrentProcess(), previous_priority);
|
||||||
}, scheduler::pipeline::main, 1s);
|
}, scheduler::pipeline::main, 1s);
|
||||||
|
|
||||||
previous_priority = GetPriorityClass(GetCurrentProcess());
|
previous_priority = GetPriorityClass(GetCurrentProcess());
|
||||||
//printf("=======================setting NEW priority=======================\n");
|
|
||||||
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +121,7 @@ namespace map_rotation
|
|||||||
change_process_priority();
|
change_process_priority();
|
||||||
if (!game::SV_MapExists(value.data()))
|
if (!game::SV_MapExists(value.data()))
|
||||||
{
|
{
|
||||||
printf("map_rotation: '%s' map doesn't exist!\n", value.data());
|
console::info("map_rotation: '%s' map doesn't exist!\n", value.data());
|
||||||
launch_default_map();
|
launch_default_map();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -128,7 +130,7 @@ namespace map_rotation
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Invalid map rotation key: %s\n", key.data());
|
console::info("Invalid map rotation key: %s\n", key.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +139,7 @@ namespace map_rotation
|
|||||||
|
|
||||||
void trigger_map_rotation()
|
void trigger_map_rotation()
|
||||||
{
|
{
|
||||||
scheduler::schedule([]()
|
scheduler::schedule([]
|
||||||
{
|
{
|
||||||
if (game::CL_IsCgameInitialized())
|
if (game::CL_IsCgameInitialized())
|
||||||
{
|
{
|
||||||
@ -160,7 +162,7 @@ namespace map_rotation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduler::once([]()
|
scheduler::once([]
|
||||||
{
|
{
|
||||||
dvars::register_string("sv_mapRotation", "", game::DVAR_FLAG_NONE, "");
|
dvars::register_string("sv_mapRotation", "", game::DVAR_FLAG_NONE, "");
|
||||||
dvars::register_string("sv_mapRotationCurrent", "", game::DVAR_FLAG_NONE, "");
|
dvars::register_string("sv_mapRotationCurrent", "", game::DVAR_FLAG_NONE, "");
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "dvars.hpp"
|
#include "dvars.hpp"
|
||||||
|
|
||||||
#include "game/dvars.hpp"
|
#include "game/dvars.hpp"
|
||||||
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
@ -33,7 +34,7 @@ namespace network
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string_view data(message->data + offset, message->cursize - offset);
|
const std::string data(message->data + offset, message->cursize - offset);
|
||||||
|
|
||||||
handler->second(*address, data);
|
handler->second(*address, data);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -302,11 +303,10 @@ namespace network
|
|||||||
utils::hook::set<int>(0x4F1E25_b, max_packet_size);
|
utils::hook::set<int>(0x4F1E25_b, max_packet_size);
|
||||||
|
|
||||||
// ignore built in "print" oob command and add in our own
|
// ignore built in "print" oob command and add in our own
|
||||||
utils::hook::set<uint8_t>(0x12F817_b, 0xEB);
|
utils::hook::set<std::uint8_t>(0x12F817_b, 0xEB);
|
||||||
on("print", [](const game::netadr_s&, const std::string_view& data)
|
on("print", [](const game::netadr_s&, const std::string& data)
|
||||||
{
|
{
|
||||||
const std::string message{data};
|
console::info("%s\n", data.data());
|
||||||
console::info("%s\n", message.data());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Use our own socket since the game's socket doesn't work with non localhost addresses
|
// Use our own socket since the game's socket doesn't work with non localhost addresses
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
namespace network
|
namespace network
|
||||||
{
|
{
|
||||||
using callback = std::function<void(const game::netadr_s&, const std::string_view&)>;
|
using callback = std::function<void(const game::netadr_s&, const std::string&)>;
|
||||||
|
|
||||||
void on(const std::string& command, const callback& callback);
|
void on(const std::string& command, const callback& callback);
|
||||||
void send(const game::netadr_s& address, const std::string& command, const std::string& data = {}, char separator = ' ');
|
void send(const game::netadr_s& address, const std::string& command, const std::string& data = {}, char separator = ' ');
|
||||||
|
@ -486,11 +486,6 @@ namespace party
|
|||||||
return connect_state.host;
|
return connect_state.host;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string get_state_challenge()
|
|
||||||
{
|
|
||||||
return connect_state.challenge;
|
|
||||||
}
|
|
||||||
|
|
||||||
void start_map(const std::string& mapname, bool dev)
|
void start_map(const std::string& mapname, bool dev)
|
||||||
{
|
{
|
||||||
if (game::Live_SyncOnlineDataFlags(0) > 32)
|
if (game::Live_SyncOnlineDataFlags(0) > 32)
|
||||||
@ -770,7 +765,7 @@ namespace party
|
|||||||
|
|
||||||
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
||||||
utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
||||||
printf("%s -> %i: %s\n", name, client_num, message.data());
|
console::info("%s -> %i: %s\n", name, client_num, message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
command::add("tellraw", [](const command::params& params)
|
command::add("tellraw", [](const command::params& params)
|
||||||
@ -785,7 +780,7 @@ namespace party
|
|||||||
|
|
||||||
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
game::SV_GameSendServerCommand(client_num, game::SV_CMD_CAN_IGNORE,
|
||||||
utils::string::va("%c \"%s\"", 84, message.data()));
|
utils::string::va("%c \"%s\"", 84, message.data()));
|
||||||
printf("%i: %s\n", client_num, message.data());
|
console::info("%i: %s\n", client_num, message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
command::add("say", [](const command::params& params)
|
command::add("say", [](const command::params& params)
|
||||||
@ -800,7 +795,7 @@ namespace party
|
|||||||
|
|
||||||
game::SV_GameSendServerCommand(
|
game::SV_GameSendServerCommand(
|
||||||
-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
-1, game::SV_CMD_CAN_IGNORE, utils::string::va("%c \"%s: %s\"", 84, name, message.data()));
|
||||||
printf("%s: %s\n", name, message.data());
|
console::info("%s: %s\n", name, message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
command::add("sayraw", [](const command::params& params)
|
command::add("sayraw", [](const command::params& params)
|
||||||
@ -814,15 +809,15 @@ namespace party
|
|||||||
|
|
||||||
game::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE,
|
game::SV_GameSendServerCommand(-1, game::SV_CMD_CAN_IGNORE,
|
||||||
utils::string::va("%c \"%s\"", 84, message.data()));
|
utils::string::va("%c \"%s\"", 84, message.data()));
|
||||||
printf("%s\n", message.data());
|
console::info("%s\n", message.data());
|
||||||
});
|
});
|
||||||
|
|
||||||
network::on("getInfo", [](const game::netadr_s& target, const std::string_view& data)
|
network::on("getInfo", [](const game::netadr_s& target, const std::string& data)
|
||||||
{
|
{
|
||||||
const auto mapname = get_dvar_string("mapname");
|
const auto mapname = get_dvar_string("mapname");
|
||||||
|
|
||||||
utils::info_string info{};
|
utils::info_string info;
|
||||||
info.set("challenge", std::string{data});
|
info.set("challenge", data);
|
||||||
info.set("gamename", "H1");
|
info.set("gamename", "H1");
|
||||||
info.set("hostname", get_dvar_string("sv_hostname"));
|
info.set("hostname", get_dvar_string("sv_hostname"));
|
||||||
info.set("gametype", get_dvar_string("g_gametype"));
|
info.set("gametype", get_dvar_string("g_gametype"));
|
||||||
@ -871,9 +866,9 @@ namespace party
|
|||||||
network::send(target, "infoResponse", info.build(), '\n');
|
network::send(target, "infoResponse", info.build(), '\n');
|
||||||
});
|
});
|
||||||
|
|
||||||
network::on("infoResponse", [](const game::netadr_s& target, const std::string_view& data)
|
network::on("infoResponse", [](const game::netadr_s& target, const std::string& data)
|
||||||
{
|
{
|
||||||
const utils::info_string info{data};
|
const utils::info_string info(data);
|
||||||
server_list::handle_info_response(target, info);
|
server_list::handle_info_response(target, info);
|
||||||
|
|
||||||
if (connect_state.host != target)
|
if (connect_state.host != target)
|
||||||
|
@ -12,7 +12,6 @@ namespace party
|
|||||||
|
|
||||||
void clear_sv_motd();
|
void clear_sv_motd();
|
||||||
game::netadr_s get_state_host();
|
game::netadr_s get_state_host();
|
||||||
std::string get_state_challenge();
|
|
||||||
int server_client_count();
|
int server_client_count();
|
||||||
|
|
||||||
int get_client_num_by_name(const std::string& name);
|
int get_client_num_by_name(const std::string& name);
|
||||||
|
@ -491,7 +491,7 @@ namespace server_list
|
|||||||
scheduler::loop(do_frame_work, scheduler::pipeline::main);
|
scheduler::loop(do_frame_work, scheduler::pipeline::main);
|
||||||
scheduler::loop(check_refresh, scheduler::pipeline::lui, 10ms);
|
scheduler::loop(check_refresh, scheduler::pipeline::lui, 10ms);
|
||||||
|
|
||||||
network::on("getServersResponse", [](const game::netadr_s& target, const std::string_view& data)
|
network::on("getServersResponse", [](const game::netadr_s& target, const std::string& data)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> _(mutex);
|
std::lock_guard<std::mutex> _(mutex);
|
||||||
@ -503,7 +503,7 @@ namespace server_list
|
|||||||
master_state.requesting = false;
|
master_state.requesting = false;
|
||||||
|
|
||||||
std::optional<size_t> start{};
|
std::optional<size_t> start{};
|
||||||
for (size_t i = 0; i + 6 < data.size(); ++i)
|
for (std::size_t i = 0; i + 6 < data.size(); ++i)
|
||||||
{
|
{
|
||||||
if (data[i + 6] == '\\')
|
if (data[i + 6] == '\\')
|
||||||
{
|
{
|
||||||
@ -527,8 +527,8 @@ namespace server_list
|
|||||||
game::netadr_s address{};
|
game::netadr_s address{};
|
||||||
address.type = game::NA_IP;
|
address.type = game::NA_IP;
|
||||||
address.localNetID = game::NS_CLIENT1;
|
address.localNetID = game::NS_CLIENT1;
|
||||||
memcpy(&address.ip[0], data.data() + i + 0, 4);
|
std::memcpy(&address.ip[0], data.data() + i + 0, 4);
|
||||||
memcpy(&address.port, data.data() + i + 4, 2);
|
std::memcpy(&address.port, data.data() + i + 4, 2);
|
||||||
|
|
||||||
master_state.queued_servers[address] = 0;
|
master_state.queued_servers[address] = 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "gsc/script_extension.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
@ -7,34 +10,6 @@
|
|||||||
|
|
||||||
namespace slowmotion
|
namespace slowmotion
|
||||||
{
|
{
|
||||||
namespace
|
|
||||||
{
|
|
||||||
void scr_cmd_set_slow_motion()
|
|
||||||
{
|
|
||||||
if (game::Scr_GetNumParam() < 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int duration = 1000;
|
|
||||||
float end = 1.0f;
|
|
||||||
const float start = game::Scr_GetFloat(0);
|
|
||||||
|
|
||||||
if (game::Scr_GetNumParam() >= 2)
|
|
||||||
{
|
|
||||||
end = game::Scr_GetFloat(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game::Scr_GetNumParam() >= 3)
|
|
||||||
{
|
|
||||||
duration = static_cast<int>(game::Scr_GetFloat(2) * 1000.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
game::SV_SetConfigstring(10, utils::string::va("%i %i %g %g", *game::mp::gameTime, duration, start, end));
|
|
||||||
game::Com_SetSlowMotion(start, end, duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -45,7 +20,22 @@ namespace slowmotion
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::hook::jump(0x43D2E0_b, scr_cmd_set_slow_motion);
|
gsc::function::add("setslowmotion", [](const gsc::function_args& args)
|
||||||
|
{
|
||||||
|
if (args.size() == 0)
|
||||||
|
{
|
||||||
|
return scripting::script_value{};
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto start = args[0].as<float>();
|
||||||
|
const auto end = (args.size() > 0 ? args[1].as<float>() : 1.0f);
|
||||||
|
const auto duration = (args.size() > 1 ? args[2].as<int>() : 1) * 1000;
|
||||||
|
|
||||||
|
game::SV_SetConfigstring(10, utils::string::va("%i %i %g %g", *game::mp::gameTime, duration, start, end));
|
||||||
|
game::Com_SetSlowMotion(start, end, duration);
|
||||||
|
|
||||||
|
return scripting::script_value{};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
#include "arxan.hpp"
|
#include "arxan.hpp"
|
||||||
|
|
||||||
#include <utils/nt.hpp>
|
|
||||||
#include <utils/flags.hpp>
|
|
||||||
#include <utils/string.hpp>
|
|
||||||
#include <utils/binary_resource.hpp>
|
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "steam/interface.hpp"
|
#include "steam/interface.hpp"
|
||||||
#include "steam/steam.hpp"
|
#include "steam/steam.hpp"
|
||||||
|
|
||||||
|
#include <utils/nt.hpp>
|
||||||
|
#include <utils/flags.hpp>
|
||||||
|
#include <utils/string.hpp>
|
||||||
|
#include <utils/binary_resource.hpp>
|
||||||
|
|
||||||
namespace steam_proxy
|
namespace steam_proxy
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "system_check.hpp"
|
|
||||||
#include "arxan.hpp"
|
#include "arxan.hpp"
|
||||||
|
#include "system_check.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "scheduler.hpp"
|
|
||||||
#include "dvars.hpp"
|
|
||||||
#include "updater.hpp"
|
|
||||||
#include "fastfiles.hpp"
|
#include "fastfiles.hpp"
|
||||||
#include "game/ui_scripting/execution.hpp"
|
#include "dvars.hpp"
|
||||||
|
#include "scheduler.hpp"
|
||||||
#include "version.h"
|
#include "updater.hpp"
|
||||||
|
#include "version.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "game/dvars.hpp"
|
#include "game/dvars.hpp"
|
||||||
|
#include "game/ui_scripting/execution.hpp"
|
||||||
|
|
||||||
#include <utils/concurrency.hpp>
|
#include <utils/concurrency.hpp>
|
||||||
#include <utils/cryptography.hpp>
|
#include <utils/cryptography.hpp>
|
||||||
|
@ -10,6 +10,7 @@ namespace videos
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
utils::hook::detour playvid_hook;
|
utils::hook::detour playvid_hook;
|
||||||
|
|
||||||
std::unordered_map<std::string, std::string> video_replaces;
|
std::unordered_map<std::string, std::string> video_replaces;
|
||||||
|
|
||||||
void playvid(const char* name, const int a2, const int a3)
|
void playvid(const char* name, const int a2, const int a3)
|
||||||
|
@ -12,37 +12,34 @@ namespace virtuallobby
|
|||||||
{
|
{
|
||||||
game::dvar_t* virtual_lobby_fovscale;
|
game::dvar_t* virtual_lobby_fovscale;
|
||||||
|
|
||||||
void* get_get_fovscale_stub()
|
void get_get_fovscale_stub(utils::hook::assembler& a)
|
||||||
{
|
{
|
||||||
return utils::hook::assemble([](utils::hook::assembler& a)
|
const auto ret = a.newLabel();
|
||||||
{
|
const auto original = a.newLabel();
|
||||||
const auto ret = a.newLabel();
|
|
||||||
const auto original = a.newLabel();
|
|
||||||
|
|
||||||
a.pushad64();
|
a.pushad64();
|
||||||
a.mov(rax, qword_ptr(0x2999CE8_b)); // virtualLobbyInFiringRange
|
a.mov(rax, qword_ptr(0x2999CE8_b)); // virtualLobbyInFiringRange
|
||||||
a.cmp(byte_ptr(rax, 0x10), 1);
|
a.cmp(byte_ptr(rax, 0x10), 1);
|
||||||
a.je(original);
|
a.je(original);
|
||||||
a.call_aligned(game::VirtualLobby_Loaded);
|
a.call_aligned(game::VirtualLobby_Loaded);
|
||||||
a.cmp(al, 0);
|
a.cmp(al, 0);
|
||||||
a.je(original);
|
a.je(original);
|
||||||
|
|
||||||
// virtuallobby
|
// virtuallobby
|
||||||
a.popad64();
|
a.popad64();
|
||||||
a.mov(rax, ptr(reinterpret_cast<int64_t>(&virtual_lobby_fovscale)));
|
a.mov(rax, ptr(reinterpret_cast<int64_t>(&virtual_lobby_fovscale)));
|
||||||
a.jmp(ret);
|
a.jmp(ret);
|
||||||
|
|
||||||
// original
|
// original
|
||||||
a.bind(original);
|
a.bind(original);
|
||||||
a.popad64();
|
a.popad64();
|
||||||
a.mov(rax, qword_ptr(0x14C4EC8_b));
|
a.mov(rax, qword_ptr(0x14C4EC8_b));
|
||||||
a.jmp(ret);
|
a.jmp(ret);
|
||||||
|
|
||||||
a.bind(ret);
|
a.bind(ret);
|
||||||
a.mov(rdi, rax);
|
a.mov(rdi, rax);
|
||||||
a.mov(ecx, 8);
|
a.mov(ecx, 8);
|
||||||
a.jmp(0x104545_b);
|
a.jmp(0x104545_b);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +56,7 @@ namespace virtuallobby
|
|||||||
virtual_lobby_fovscale = dvars::register_float_hashed("virtualLobby_fovScale", 0.7f, 0.0f, 2.0f,
|
virtual_lobby_fovscale = dvars::register_float_hashed("virtualLobby_fovScale", 0.7f, 0.0f, 2.0f,
|
||||||
game::DVAR_FLAG_SAVED, "Field of view scaled for the virtual lobby");
|
game::DVAR_FLAG_SAVED, "Field of view scaled for the virtual lobby");
|
||||||
|
|
||||||
utils::hook::jump(0x104539_b, get_get_fovscale_stub(), true);
|
utils::hook::jump(0x104539_b, utils::hook::assemble(get_get_fovscale_stub), true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
|
||||||
|
|
||||||
#include "console.hpp"
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
|
#include "console.hpp"
|
||||||
#include "fastfiles.hpp"
|
#include "fastfiles.hpp"
|
||||||
|
|
||||||
#include "utils/hook.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
namespace weapon
|
namespace weapon
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user