Dont load localized zone on custom maps
This commit is contained in:
parent
7ca9eeffa1
commit
4e348abaf1
@ -57,8 +57,17 @@ 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 mapname = game::UI_SafeTranslateString(
|
const auto key = utils::string::va("PRESENCE_%s%s", SELECT_VALUE("SP_", ""), map);
|
||||||
utils::string::va("PRESENCE_%s%s", SELECT_VALUE("SP_", ""), map));
|
const char* mapname = nullptr;
|
||||||
|
|
||||||
|
if (game::DB_XAssetExists(game::ASSET_TYPE_LOCALIZE, key) && !game::DB_IsXAssetDefault(game::ASSET_TYPE_LOCALIZE, key))
|
||||||
|
{
|
||||||
|
mapname = game::UI_SafeTranslateString(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapname = map;
|
||||||
|
}
|
||||||
|
|
||||||
if (game::environment::is_mp())
|
if (game::environment::is_mp())
|
||||||
{
|
{
|
||||||
|
@ -313,6 +313,29 @@ namespace fastfiles
|
|||||||
|
|
||||||
utils::hook::invoke<void>(0x39CA90_b, a1);
|
utils::hook::invoke<void>(0x39CA90_b, a1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void db_level_load_add_zone_stub(void* load, const char* name, const unsigned int alloc_flags,
|
||||||
|
const size_t size_est)
|
||||||
|
{
|
||||||
|
auto is_builtin_map = false;
|
||||||
|
for (auto map = &game::maps[0]; map->unk; ++map)
|
||||||
|
{
|
||||||
|
if (!std::strcmp(map->name, name))
|
||||||
|
{
|
||||||
|
is_builtin_map = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_builtin_map)
|
||||||
|
{
|
||||||
|
game::DB_LevelLoadAddZone(load, name, alloc_flags, size_est);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
game::DB_LevelLoadAddZone(load, name, alloc_flags | game::DB_ZONE_CUSTOM, size_est);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exists(const std::string& zone)
|
bool exists(const std::string& zone)
|
||||||
@ -402,6 +425,9 @@ namespace fastfiles
|
|||||||
{
|
{
|
||||||
utils::hook::nop(0x398061_b, 15);
|
utils::hook::nop(0x398061_b, 15);
|
||||||
utils::hook::jump(0x398061_b, utils::hook::assemble(mp::skip_extra_zones_stub), true);
|
utils::hook::jump(0x398061_b, utils::hook::assemble(mp::skip_extra_zones_stub), true);
|
||||||
|
|
||||||
|
// dont load localized zone for custom maps
|
||||||
|
utils::hook::call(0x394A99_b, db_level_load_add_zone_stub);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent mod.ff from loading lua files
|
// prevent mod.ff from loading lua files
|
||||||
|
@ -1536,6 +1536,13 @@ namespace game
|
|||||||
unsigned int data;
|
unsigned int data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct map_t
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
int id;
|
||||||
|
int unk;
|
||||||
|
};
|
||||||
|
|
||||||
namespace mp
|
namespace mp
|
||||||
{
|
{
|
||||||
struct cachedSnapshot_t
|
struct cachedSnapshot_t
|
||||||
|
@ -182,6 +182,8 @@ namespace game
|
|||||||
WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x0, 0x0};
|
WEAK symbol<int(XAssetType type)> DB_GetXAssetTypeSize{0x0, 0x0};
|
||||||
WEAK symbol<XAssetHeader(XAssetType type, const char* name,
|
WEAK symbol<XAssetHeader(XAssetType type, const char* name,
|
||||||
int createDefault)> DB_FindXAssetHeader{0x1F1120, 0x3950C0};
|
int createDefault)> DB_FindXAssetHeader{0x1F1120, 0x3950C0};
|
||||||
|
WEAK symbol<void(void* levelLoad, const char* name,
|
||||||
|
const unsigned int allocFlags, const unsigned __int64 sizeEst)> DB_LevelLoadAddZone{0x0, 0x396B50};
|
||||||
|
|
||||||
WEAK symbol<int(XAssetType type, const char* name)> DB_IsXAssetDefault{0x1F25A0, 0x3968C0};
|
WEAK symbol<int(XAssetType type, const char* name)> DB_IsXAssetDefault{0x1F25A0, 0x3968C0};
|
||||||
WEAK symbol<int(XAssetType type, const char* name)> DB_XAssetExists{0x1F6290, 0x39B7B0};
|
WEAK symbol<int(XAssetType type, const char* name)> DB_XAssetExists{0x1F6290, 0x39B7B0};
|
||||||
@ -277,7 +279,7 @@ namespace game
|
|||||||
// TODO: move to dvars.cpp when done
|
// TODO: move to dvars.cpp when done
|
||||||
WEAK symbol<dvar_t> fs_gameDirVal{0x0, 0x2EC86B8};
|
WEAK symbol<dvar_t> fs_gameDirVal{0x0, 0x2EC86B8};
|
||||||
|
|
||||||
WEAK symbol<int> g_poolSize{0x0, 0x0};
|
WEAK symbol<int> g_poolSize{0x0, 0x10B3C80};
|
||||||
WEAK symbol<int> g_compressor{0x2574804, 0x3962804};
|
WEAK symbol<int> g_compressor{0x2574804, 0x3962804};
|
||||||
|
|
||||||
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xBD80E00, 0xB138180};
|
WEAK symbol<scrVarGlob_t> scr_VarGlob{0xBD80E00, 0xB138180};
|
||||||
@ -301,6 +303,8 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<int> level_time{0x56DBAA0, 0x7361F9C};
|
WEAK symbol<int> level_time{0x56DBAA0, 0x7361F9C};
|
||||||
|
|
||||||
|
WEAK symbol<map_t> maps{0x7CE5A0, 0x926C80};
|
||||||
|
|
||||||
namespace mp
|
namespace mp
|
||||||
{
|
{
|
||||||
WEAK symbol<gentity_s> g_entities{0x0, 0x71F19E0};
|
WEAK symbol<gentity_s> g_entities{0x0, 0x71F19E0};
|
||||||
|
Loading…
Reference in New Issue
Block a user