Add some funcs + fixes
This commit is contained in:
parent
9397537663
commit
d707648a41
@ -462,6 +462,31 @@ namespace database
|
||||
}
|
||||
|
||||
sys_set_folder_hook.create(0x140623830, sys_set_folder_stub);
|
||||
|
||||
command::add("extractFile", [](const command::params& params)
|
||||
{
|
||||
const std::string file = params.get(1);
|
||||
const auto fs_inst = game::DB_FSInitialize();
|
||||
const auto handle = fs_inst->vftbl->OpenFile(fs_inst, game::SF_ZONE, file.data());
|
||||
const auto _0 = gsl::finally([&]
|
||||
{
|
||||
if (handle != nullptr)
|
||||
{
|
||||
fs_inst->vftbl->Close(fs_inst, handle);
|
||||
}
|
||||
});
|
||||
|
||||
if (handle == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto size = fs_inst->vftbl->Size(fs_inst, handle);
|
||||
std::string buffer;
|
||||
buffer.resize(size);
|
||||
fs_inst->vftbl->Read(fs_inst, handle, 0, size, buffer.data());
|
||||
utils::io::write_file("bnet/" + file, buffer);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -456,7 +456,6 @@ namespace fastfiles
|
||||
{
|
||||
reallocate_xmodel_pool();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_XMODELSURFS, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_WEAPON, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_SOUND, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_LOADED_SOUND, 2>();
|
||||
reallocate_asset_pool_multiplier<game::ASSET_TYPE_XANIM, 2>();
|
||||
|
@ -370,6 +370,15 @@ namespace gsc
|
||||
|
||||
utils::hook::set<uint32_t>(0x14061EC72, size_0 + size_1);
|
||||
}
|
||||
|
||||
void add_function_name(const std::string& name, const std::uint16_t id)
|
||||
{
|
||||
const std::string_view name_ = utils::memory::get_allocator()->duplicate_string(name);
|
||||
auto& func_map = gsc_ctx->func_map();
|
||||
auto func_map_ = reinterpret_cast<std::unordered_map<std::string_view, uint16_t>*>(
|
||||
reinterpret_cast<size_t>(&func_map));
|
||||
func_map_->insert(std::make_pair(name_, id));
|
||||
}
|
||||
}
|
||||
|
||||
game::ScriptFile* find_script(game::XAssetType type, const char* name, int allow_create_default)
|
||||
@ -421,6 +430,8 @@ namespace gsc
|
||||
// increase script memory
|
||||
utils::hook::call(0x1405A4798, pmem_init_stub);
|
||||
|
||||
add_function_name("isusinghdr", 0x242);
|
||||
|
||||
scripting::on_shutdown([](bool free_scripts, bool post_shutdown)
|
||||
{
|
||||
if (free_scripts && post_shutdown)
|
||||
|
@ -515,6 +515,12 @@ namespace ui_scripting
|
||||
return json_to_lua(mod_stats::get(key));
|
||||
};
|
||||
|
||||
mods_stats_table["getor"] = [](const std::string& key, const script_value& default_value)
|
||||
{
|
||||
const auto json_default_value = lua_to_json(default_value);
|
||||
return json_to_lua(mod_stats::get(key, json_default_value));
|
||||
};
|
||||
|
||||
mods_stats_table["setstruct"] = [](const std::string& mapname,
|
||||
const std::string& key, const script_value& value)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user