mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* Initialize CPylon::m_Language to "english". * Make sure cvar change callback is always setting values instead of returning out early.
52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
#include "core/stdafx.h"
|
|
#include "tier1/utlvector.h"
|
|
#include "localize/localize.h"
|
|
#include "pluginsystem/modsystem.h"
|
|
|
|
bool Localize_LoadLocalizationFileLists(CLocalize* thisptr)
|
|
{
|
|
v_CLocalize__LoadLocalizationFileLists(thisptr);
|
|
|
|
const CUtlVector<CModSystem::ModInstance_t*>&
|
|
modList = g_pModSystem->GetModList();
|
|
|
|
FOR_EACH_VEC(modList, i)
|
|
{
|
|
const CModSystem::ModInstance_t* mod =
|
|
modList.Element(i);
|
|
|
|
if (!mod->IsEnabled())
|
|
continue;
|
|
|
|
FOR_EACH_VEC(mod->m_LocalizationFiles, j)
|
|
{
|
|
const char* localizationFile = mod->m_LocalizationFiles.Element(j).Get();
|
|
|
|
if (!v_CLocalize__AddFile(thisptr, localizationFile, "PLATFORM"))
|
|
Warning(eDLL_T::ENGINE, "Failed to add localization file '%s'\n", localizationFile);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Localize_IsLanguageSupported(const char* pLocaleName)
|
|
{
|
|
for (int i = 0; i < SDK_ARRAYSIZE(g_LanguageNames); ++i)
|
|
{
|
|
if (strcmp(pLocaleName, g_LanguageNames[i]) == NULL)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void VLocalize::Attach() const
|
|
{
|
|
DetourAttach((LPVOID*)&v_CLocalize__LoadLocalizationFileLists, &Localize_LoadLocalizationFileLists);
|
|
}
|
|
|
|
void VLocalize::Detach() const
|
|
{
|
|
DetourDetach((LPVOID*)&v_CLocalize__LoadLocalizationFileLists, &Localize_LoadLocalizationFileLists);
|
|
} |