Merge branch 'fedddddd:develop' into locale
This commit is contained in:
commit
f5436c63f5
@ -17,7 +17,6 @@ namespace discord
|
||||
DiscordRichPresence discord_presence;
|
||||
std::string state;
|
||||
std::optional<std::string> details{};
|
||||
std::optional<std::string> image{};
|
||||
|
||||
void update_discord()
|
||||
{
|
||||
@ -27,7 +26,6 @@ namespace discord
|
||||
{
|
||||
state = {};
|
||||
details.reset();
|
||||
image.reset();
|
||||
|
||||
discord_presence.details = game::UI_SafeTranslateString("MENU_MAIN_MENU");
|
||||
discord_presence.state = "";
|
||||
@ -39,19 +37,14 @@ namespace discord
|
||||
}
|
||||
else
|
||||
{
|
||||
static char map[0x1000] = {0};
|
||||
if (image.has_value())
|
||||
const char* base_mapname = nullptr;
|
||||
auto* map = game::Dvar_FindVar("mapname")->current.string;
|
||||
if (game::Com_IsAddonMap(map, &base_mapname))
|
||||
{
|
||||
strncpy_s(map, image.value().data(), sizeof(map));
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto mapname = game::Dvar_FindVar("mapname")->current.string;
|
||||
strncpy_s(map, mapname, sizeof(map));
|
||||
map = base_mapname;
|
||||
}
|
||||
|
||||
const auto mapname = game::UI_SafeTranslateString(utils::string::va("PRESENCE_SP_%s", map));
|
||||
|
||||
discord_presence.largeImageKey = map;
|
||||
|
||||
if (details.has_value())
|
||||
@ -124,16 +117,6 @@ namespace discord
|
||||
update_discord();
|
||||
}, scheduler::pipeline::async);
|
||||
});
|
||||
|
||||
command::add("setdiscordimage", [](const command::params& params)
|
||||
{
|
||||
const std::string image_ = params.join(1);
|
||||
scheduler::once([=]()
|
||||
{
|
||||
image = image_;
|
||||
update_discord();
|
||||
}, scheduler::pipeline::async);
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -110,9 +110,7 @@ namespace fastfiles
|
||||
if (localized)
|
||||
{
|
||||
const auto language = game::SEH_GetCurrentLanguageCode();
|
||||
try_load_zone(language + "_"s + name, false);
|
||||
|
||||
if (language != "eng"s)
|
||||
if (!try_load_zone(language + "_"s + name, false) && language != "eng"s)
|
||||
{
|
||||
try_load_zone("eng_" + name, false);
|
||||
}
|
||||
@ -327,17 +325,12 @@ namespace fastfiles
|
||||
if (localized)
|
||||
{
|
||||
const auto language = game::SEH_GetCurrentLanguageCode();
|
||||
const auto eng_name = "eng_"s + name;
|
||||
const auto lang_name = language + "_"s + name;
|
||||
|
||||
if (fastfiles::exists(lang_name))
|
||||
{
|
||||
add_custom_level_load_zone(load, lang_name.data(), false, size_est);
|
||||
}
|
||||
else if (fastfiles::exists(eng_name))
|
||||
{
|
||||
add_custom_level_load_zone(load, eng_name.data(), false, size_est);
|
||||
}
|
||||
}
|
||||
|
||||
game::DB_LevelLoadAddZone(load, name, game::DB_ZONE_GAME | game::DB_ZONE_CUSTOM, size_est);
|
||||
|
@ -306,6 +306,24 @@ namespace gsc
|
||||
}
|
||||
}
|
||||
|
||||
void builtin_call_error()
|
||||
{
|
||||
const auto pos = game::scr_function_stack->pos;
|
||||
const auto function_id = *reinterpret_cast<std::uint16_t*>(
|
||||
reinterpret_cast<size_t>(pos - 2));
|
||||
|
||||
if (function_id > 0x1000)
|
||||
{
|
||||
console::warn("in call to builtin method \"%s\"",
|
||||
xsk::gsc::h2::resolver::method_name(function_id).data());
|
||||
}
|
||||
else
|
||||
{
|
||||
console::warn("in call to builtin function \"%s\"",
|
||||
xsk::gsc::h2::resolver::function_name(function_id).data());
|
||||
}
|
||||
}
|
||||
|
||||
bool force_error_print = false;
|
||||
void* vm_error_stub(void* a1)
|
||||
{
|
||||
@ -317,19 +335,26 @@ namespace gsc
|
||||
console::warn("*********** script runtime error *************\n");
|
||||
|
||||
const auto opcode_id = *reinterpret_cast<std::uint8_t*>(0x14BAA93E8);
|
||||
const auto opcode = get_opcode_name(opcode_id);
|
||||
const std::string error_str = gsc_error.has_value()
|
||||
? utils::string::va(": %s", gsc_error.value().data())
|
||||
: "";
|
||||
if (opcode.has_value())
|
||||
if ((opcode_id >= 0x1A && opcode_id <= 0x20) || (opcode_id >= 0xA9 && opcode_id <= 0xAF))
|
||||
{
|
||||
console::warn("while processing instruction %s%s\n",
|
||||
opcode.value().data(), error_str.data());
|
||||
builtin_call_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
console::warn("while processing instruction 0x%X%s\n",
|
||||
opcode_id, error_str.data());
|
||||
const auto opcode = get_opcode_name(opcode_id);
|
||||
const std::string error_str = gsc_error.has_value()
|
||||
? utils::string::va(": %s", gsc_error.value().data())
|
||||
: "";
|
||||
if (opcode.has_value())
|
||||
{
|
||||
console::warn("while processing instruction %s%s\n",
|
||||
opcode.value().data(), error_str.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
console::warn("while processing instruction 0x%X%s\n",
|
||||
opcode_id, error_str.data());
|
||||
}
|
||||
}
|
||||
|
||||
force_error_print = false;
|
||||
|
@ -33,6 +33,7 @@ namespace game
|
||||
WEAK symbol<void(char const* finalMessage)> Com_Shutdown{0x1405A62C0};
|
||||
WEAK symbol<void()> Com_Quit_f{0x1405A50D0};
|
||||
WEAK symbol<bool()> Com_InFrontend{0x140328BD0};
|
||||
WEAK symbol<bool(const char* mapName, const char** pBaseMapName)> Com_IsAddonMap{0x140609570};
|
||||
WEAK symbol<void()> Quit{0x1405A52A0};
|
||||
|
||||
WEAK symbol<void(XAssetType type, void(__cdecl* func)(game::XAssetHeader, void*), const void* inData, bool includeOverride)>
|
||||
|
Loading…
x
Reference in New Issue
Block a user