maint: dump changes
This commit is contained in:
@@ -71,10 +71,9 @@ namespace gsc
|
||||
return scripting::get_token(id);
|
||||
}
|
||||
|
||||
void get_unknown_function_error(const char* code_pos)
|
||||
void get_unknown_function_error(char* code_pos)
|
||||
{
|
||||
const auto function = find_function(code_pos);
|
||||
if (function.has_value())
|
||||
if (const auto function = find_function(code_pos); function.has_value())
|
||||
{
|
||||
const auto& pos = function.value();
|
||||
unknown_function_error = std::format(
|
||||
@@ -97,7 +96,7 @@ namespace gsc
|
||||
);
|
||||
}
|
||||
|
||||
void compile_error_stub(const char* code_pos, [[maybe_unused]] const char* msg)
|
||||
void compile_error_stub(char* code_pos, [[maybe_unused]] const char* msg)
|
||||
{
|
||||
get_unknown_function_error(code_pos);
|
||||
game::Com_Error(game::ERR_DROP, "script link error\n%s", unknown_function_error.data());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "game/scripting/functions.hpp"
|
||||
|
||||
@@ -8,7 +9,6 @@
|
||||
#include <utils/string.hpp>
|
||||
|
||||
#include "component/console.hpp"
|
||||
#include "component/scripting.hpp"
|
||||
#include "component/notifies.hpp"
|
||||
#include "component/command.hpp"
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace gsc
|
||||
|
||||
void* func_table[0x1000];
|
||||
|
||||
const game::dvar_t* developer_script = nullptr;
|
||||
|
||||
namespace
|
||||
{
|
||||
#define RVA(ptr) static_cast<std::uint32_t>(reinterpret_cast<std::size_t>(ptr) - 0x140000000)
|
||||
@@ -135,7 +133,7 @@ namespace gsc
|
||||
|
||||
void vm_error_stub(int mark_pos)
|
||||
{
|
||||
if (!developer_script->current.enabled && !force_error_print)
|
||||
if (!dvars::com_developer_script->current.enabled && !force_error_print)
|
||||
{
|
||||
utils::hook::invoke<void>(0x1404E4D00, mark_pos);
|
||||
return;
|
||||
@@ -284,8 +282,6 @@ namespace gsc
|
||||
return;
|
||||
}
|
||||
|
||||
developer_script = game::Dvar_RegisterBool("developer_script", false, game::DVAR_FLAG_NONE, "Enable developer script comments");
|
||||
|
||||
utils::hook::nop(0x14043BBBE + 5, 2);
|
||||
utils::hook::call(0x14043BBBE, vm_call_builtin_function);
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ namespace gsc
|
||||
{
|
||||
extern void* func_table[0x1000];
|
||||
|
||||
extern const game::dvar_t* developer_script;
|
||||
|
||||
void add_function(const std::string& name, game::BuiltinFunction function);
|
||||
|
||||
void scr_error(const char* error);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/hook.hpp>
|
||||
@@ -10,7 +11,6 @@
|
||||
#include "component/filesystem.hpp"
|
||||
#include "component/console.hpp"
|
||||
#include "component/scripting.hpp"
|
||||
#include "component/fastfiles.hpp"
|
||||
|
||||
#include "script_loading.hpp"
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace gsc
|
||||
std::unordered_map<std::string, game::ScriptFile*> loaded_scripts;
|
||||
utils::memory::allocator script_allocator;
|
||||
|
||||
const game::dvar_t* developer_script;
|
||||
|
||||
void clear()
|
||||
{
|
||||
main_handles.clear();
|
||||
@@ -266,11 +264,19 @@ namespace gsc
|
||||
|
||||
void scr_begin_load_scripts_stub()
|
||||
{
|
||||
const auto comp_mode = developer_script->current.enabled ?
|
||||
xsk::gsc::build::dev :
|
||||
xsk::gsc::build::prod;
|
||||
auto build = xsk::gsc::build::prod;
|
||||
|
||||
gsc_ctx->init(comp_mode, []([[maybe_unused]] auto const* ctx, const auto& included_path) -> std::pair<xsk::gsc::buffer, std::vector<std::uint8_t>>
|
||||
if ((*dvars::com_developer) && (*dvars::com_developer)->current.integer > 0)
|
||||
{
|
||||
build = static_cast<xsk::gsc::build>(static_cast<unsigned int>(build) | static_cast<unsigned int>(xsk::gsc::build::dev_maps));
|
||||
}
|
||||
|
||||
if (dvars::com_developer_script && dvars::com_developer_script->current.enabled)
|
||||
{
|
||||
build = static_cast<xsk::gsc::build>(static_cast<unsigned int>(build) | static_cast<unsigned int>(xsk::gsc::build::dev_blocks));
|
||||
}
|
||||
|
||||
gsc_ctx->init(build, []([[maybe_unused]] auto const* ctx, const auto& included_path) -> std::pair<xsk::gsc::buffer, std::vector<std::uint8_t>>
|
||||
{
|
||||
const auto script_name = std::filesystem::path(included_path).replace_extension().string();
|
||||
|
||||
@@ -331,13 +337,15 @@ namespace gsc
|
||||
|
||||
void post_unpack() override
|
||||
{
|
||||
dvars::com_developer = reinterpret_cast<game::dvar_t**>(SELECT_VALUE(0x141603850, 0x1419A9700));
|
||||
|
||||
// Load our scripts with an uncompressed stack
|
||||
utils::hook::call(SELECT_VALUE(0x1403DC8F0, 0x140437940), db_get_raw_buffer_stub);
|
||||
|
||||
utils::hook::call(SELECT_VALUE(0x14032D1E0, 0x1403CCED9), scr_begin_load_scripts_stub); // GScr_LoadScripts
|
||||
utils::hook::call(SELECT_VALUE(0x14032D345, 0x1403CD08D), scr_end_load_scripts_stub); // GScr_LoadScripts
|
||||
|
||||
developer_script = game::Dvar_RegisterBool("developer_script", false, game::DVAR_FLAG_NONE, "Enable developer script comments");
|
||||
dvars::com_developer_script = game::Dvar_RegisterBool("developer_script", false, game::DVAR_FLAG_NONE, "Enable developer script comments");
|
||||
|
||||
if (game::environment::is_sp())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user