Core: Use a shared_ptr for i18n categories.

This does not make them thread safe, but it reduces the chances of a crash
a bit (see #12594.)
This commit is contained in:
Unknown W. Brackets committed 2020-02-09 07:35:16 -08:00
1 parent a4ba5d4859
commit 5009698cc0
54 files changed
+244 -240

No files matched your search

+13 -13
View File
@@ -95,7 +95,7 @@ extern bool g_TakeScreenshot;
static void __EmuScreenVblank()
{
I18NCategory *sy = GetI18NCategory("System");
auto sy = GetI18NCategory("System");
if (frameStep_ && lastNumFlips != gpuStats.numFlips)
{
@@ -192,7 +192,7 @@ void EmuScreen::bootGame(const std::string &filename) {
if (!bootAllowStorage(filename))
return;
I18NCategory *sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory("Screen");
invalid_ = true;
@@ -267,17 +267,17 @@ void EmuScreen::bootGame(const std::string &filename) {
}
if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) {
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
host->NotifyUserMessage(gr->T("BufferedRenderingRequired", "Warning: This game requires Rendering Mode to be set to Buffered."), 15.0f);
}
if (PSP_CoreParameter().compat.flags().RequireBlockTransfer && g_Config.bBlockTransferGPU == false) {
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
host->NotifyUserMessage(gr->T("BlockTransferRequired", "Warning: This game requires Simulate Block Transfer Mode to be set to On."), 15.0f);
}
if (PSP_CoreParameter().compat.flags().RequireDefaultCPUClock && g_Config.iLockedCPUSpeed != 0) {
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
host->NotifyUserMessage(gr->T("DefaultCPUClockRequired", "Warning: This game requires the CPU clock to be set to default."), 15.0f);
}
@@ -293,7 +293,7 @@ void EmuScreen::bootComplete() {
NOTICE_LOG(BOOT, "Loading %s...", PSP_CoreParameter().fileToStart.c_str());
autoLoad();
I18NCategory *sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory("Screen");
#ifndef MOBILE_DEVICE
if (g_Config.bFirstRun) {
@@ -318,7 +318,7 @@ void EmuScreen::bootComplete() {
#endif
if (Core_GetPowerSaving()) {
I18NCategory *sy = GetI18NCategory("System");
auto sy = GetI18NCategory("System");
#ifdef __ANDROID__
osm.Show(sy->T("WARNING: Android battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving");
#else
@@ -474,7 +474,7 @@ bool EmuScreen::touch(const TouchInput &touch) {
}
void EmuScreen::onVKeyDown(int virtualKeyCode) {
I18NCategory *sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory("Screen");
switch (virtualKeyCode) {
case VIRTKEY_UNTHROTTLE:
@@ -635,7 +635,7 @@ void EmuScreen::onVKeyDown(int virtualKeyCode) {
}
void EmuScreen::onVKeyUp(int virtualKeyCode) {
I18NCategory *sc = GetI18NCategory("Screen");
auto sc = GetI18NCategory("Screen");
switch (virtualKeyCode) {
case VIRTKEY_UNTHROTTLE:
@@ -959,8 +959,8 @@ protected:
void EmuScreen::CreateViews() {
using namespace UI;
I18NCategory *sc = GetI18NCategory("Screen");
I18NCategory *dev = GetI18NCategory("Developer");
auto sc = GetI18NCategory("Screen");
auto dev = GetI18NCategory("Developer");
const Bounds &bounds = screenManager()->getUIContext()->GetBounds();
InitPadLayout(bounds.w, bounds.h);
@@ -1030,7 +1030,7 @@ void EmuScreen::CreateViews() {
}
UI::EventReturn EmuScreen::OnDevTools(UI::EventParams &params) {
I18NCategory *dev = GetI18NCategory("Developer");
auto dev = GetI18NCategory("Developer");
DevMenu *devMenu = new DevMenu(dev);
if (params.v)
devMenu->SetPopupOrigin(params.v);
@@ -1072,7 +1072,7 @@ void EmuScreen::update() {
quit_ = true;
return;
}
I18NCategory *err = GetI18NCategory("Error");
auto err = GetI18NCategory("Error");
std::string errLoadingFile = gamePath_ + "\n";
errLoadingFile.append(err->T("Error loading file", "Could not load game"));
errLoadingFile.append(" ");