Some fixes

This commit is contained in:
Federico Cecchetto 2022-08-30 23:30:55 +02:00
parent 3bd8e8cd3c
commit 4e1aab66b2
2 changed files with 12 additions and 5 deletions

View File

@ -56,9 +56,11 @@ namespace gsc
return true;
}
const auto asset = game::DB_FindXAssetHeader(game::ASSET_TYPE_RAWFILE, name.data(), false);
if (asset.rawfile)
const auto name_str = name.data();
if (game::DB_XAssetExists(game::ASSET_TYPE_RAWFILE, name_str) &&
!game::DB_IsXAssetDefault(game::ASSET_TYPE_RAWFILE, name_str))
{
const auto asset = game::DB_FindXAssetHeader(game::ASSET_TYPE_RAWFILE, name.data(), false);
const auto len = game::DB_GetRawFileLen(asset.rawfile);
data->resize(len);
game::DB_GetRawBuffer(asset.rawfile, data->data(), len);
@ -275,15 +277,19 @@ namespace gsc
{
for (auto frame = game::scr_VmPub->function_frame; frame != game::scr_VmPub->function_frame_start; --frame)
{
const auto pos = frame == game::scr_VmPub->function_frame
? game::scr_function_stack->pos
: frame->fs.pos;
const auto function = find_function(frame->fs.pos);
if (function.has_value())
{
console::warn("\tat function \"%s\" in file \"%s.gsc\"",
function.value().first.data(), function.value().second.data(), frame->fs.pos);
function.value().first.data(), function.value().second.data());
}
else
{
console::warn("\tat unknown location", frame->fs.pos);
console::warn("\tat unknown location %p", pos);
}
}
}

View File

@ -49,6 +49,7 @@ namespace game
WEAK symbol<void(void* levelLoad, const char* name,
const unsigned int allocFlags, const unsigned __int64 sizeEst)> DB_LevelLoadAddZone{0x1404145D0};
WEAK symbol<int(game::XAssetType type, const char* name)> DB_IsXAssetDefault{0x1404143C0};
WEAK symbol<int(game::XAssetType type, const char* name)> DB_XAssetExists{0x140417FD0};
WEAK symbol<dvar_t*(const char* name)> Dvar_FindVar{0x140618F90};
WEAK symbol<dvar_t*(int hash)> Dvar_FindMalleableVar{0x140618F00};