I18N: Switch to getting categories by index instead of by string lookup

Also gets rid of the shared_ptr usage, and generally makes things nicer.

Needed for later config refactorings, good to get in early.
This commit is contained in:
Henrik Rydgård
2023-04-06 00:34:50 +02:00
parent 07b8b6f35a
commit ee6234ecb6
65 changed files with 535 additions and 516 deletions

View File

@@ -2651,7 +2651,7 @@ void FramebufferManagerCommon::UpdateFramebufUsage(VirtualFramebuffer *vfb) {
}
void FramebufferManagerCommon::ShowScreenResolution() {
auto gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
std::ostringstream messageStream;
messageStream << gr->T("Internal Resolution") << ": ";

View File

@@ -284,7 +284,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, bool isOverride) {
}
if (filenameWarning) {
auto err = GetI18NCategory("Error");
auto err = GetI18NCategory(I18NCat::ERRORS);
System_NotifyUserMessage(err->T("textures.ini filenames may not be cross-platform (banned characters)"), 6.0f);
}

View File

@@ -87,7 +87,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
if (g_Config.bHardwareTessellation) {
// Disable hardware tessellation bacause DX9 is still unsupported.
ERROR_LOG(G3D, "Hardware Tessellation is unsupported, falling back to software tessellation");
auto gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
System_NotifyUserMessage(gr->T("Turn off Hardware Tessellation - unsupported"), 2.5f, 0xFF3030FF);
}
}

View File

@@ -600,7 +600,7 @@ VSShader *ShaderManagerDX9::ApplyShader(bool useHWTransform, bool useHWTessellat
vs = new VSShader(device_, VSID, codeBuffer_, useHWTransform);
}
if (!vs || vs->Failed()) {
auto gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
if (!vs) {
// TODO: Report this?
ERROR_LOG(G3D, "Shader generation failed, falling back to software transform");

View File

@@ -121,7 +121,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
// Disable hardware tessellation if device is unsupported.
if (!drawEngine_.SupportsHWTessellation()) {
ERROR_LOG(G3D, "Hardware Tessellation is unsupported, falling back to software tessellation");
auto gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
System_NotifyUserMessage(gr->T("Turn off Hardware Tessellation - unsupported"), 2.5f, 0xFF3030FF);
}
}

View File

@@ -800,7 +800,7 @@ Shader *ShaderManagerGLES::ApplyVertexShader(bool useHWTransform, bool useHWTess
// Vertex shader not in cache. Let's compile it.
vs = CompileVertexShader(*VSID);
if (!vs || vs->Failed()) {
auto gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
ERROR_LOG(G3D, "Vertex shader generation failed, falling back to software transform");
if (!g_Config.bHideSlowWarnings) {
System_NotifyUserMessage(gr->T("hardware transform error - falling back to software"), 2.5f, 0xFF3030FF);

View File

@@ -148,7 +148,7 @@ void TextureCacheGLES::StartFrame() {
lowMemoryMode_ = true;
decimationCounter_ = 0;
auto err = GetI18NCategory("Error");
auto err = GetI18NCategory(I18NCat::ERRORS);
if (standardScaleFactor_ > 1) {
System_NotifyUserMessage(err->T("Warning: Video memory FULL, reducing upscaling and switching to slow caching mode"), 2.0f);
} else {

View File

@@ -511,7 +511,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
// TODO: We should stall the GPU here and wipe things out of memory.
// As is, it will almost definitely fail the second time, but next frame it may recover.
auto err = GetI18NCategory("Error");
auto err = GetI18NCategory(I18NCat::ERRORS);
if (plan.scaleFactor > 1) {
System_NotifyUserMessage(err->T("Warning: Video memory FULL, reducing upscaling and switching to slow caching mode"), 2.0f);
} else {