Qt/overlays: Localize most rsx overlays

This commit is contained in:
Megamouse 2020-09-02 16:20:29 +02:00
parent fe9c61fe73
commit 460a933267
21 changed files with 244 additions and 34 deletions

View File

@ -1,5 +1,6 @@
add_library(rpcs3_emu
IdManager.cpp
localized_string.cpp
System.cpp
system_config.cpp
system_config_types.cpp

View File

@ -5,6 +5,8 @@
#include "overlay_utils.h"
#include "overlay_fonts.h"
#include "Emu/localized_string.h"
#include <string>
#include <vector>
#include <memory>
@ -442,6 +444,12 @@ namespace rsx
is_compiled = false;
}
virtual void set_text(localized_string_id id)
{
this->text = get_localized_u32string(id);
is_compiled = false;
}
virtual void set_font(const char* font_name, u16 font_size)
{
font_ref = fontmgr::get(font_name, font_size);
@ -1045,7 +1053,7 @@ namespace rsx
struct edit_text : public label
{
enum direction
enum class direction
{
up,
down,

View File

@ -33,7 +33,7 @@ namespace rsx
{
switch (dir)
{
case left:
case direction::left:
{
if (caret_position)
{
@ -42,7 +42,7 @@ namespace rsx
}
break;
}
case right:
case direction::right:
{
if (caret_position < text.length())
{
@ -51,7 +51,7 @@ namespace rsx
}
break;
}
case up:
case direction::up:
{
const size_t current_line_start = get_line_start(text, caret_position);
if (current_line_start == 0)
@ -70,7 +70,7 @@ namespace rsx
refresh();
break;
}
case down:
case direction::down:
{
const size_t current_line_end = get_line_end(text, caret_position);
if (current_line_end == text.length())

View File

@ -40,8 +40,8 @@ namespace rsx
m_accept_btn->set_pos(30, height + 20);
m_cancel_btn->set_pos(180, height + 20);
m_accept_btn->set_text("Select");
m_cancel_btn->set_text("Cancel");
m_accept_btn->set_text(localized_string_id::RSX_OVERLAYS_LIST_SELECT);
m_cancel_btn->set_text(localized_string_id::RSX_OVERLAYS_LIST_CANCEL);
m_accept_btn->set_font("Arial", 16);
m_cancel_btn->set_font("Arial", 16);

View File

@ -29,12 +29,12 @@ namespace rsx
progress_1.back_color = color4f(0.25f, 0.f, 0.f, 0.85f);
progress_2.back_color = color4f(0.25f, 0.f, 0.f, 0.85f);
btn_ok.set_text("Yes");
btn_ok.set_text(localized_string_id::RSX_OVERLAYS_MSG_DIALOG_YES);
btn_ok.set_size(140, 30);
btn_ok.set_pos(545, 420);
btn_ok.set_font("Arial", 16);
btn_cancel.set_text("No");
btn_cancel.set_text(localized_string_id::RSX_OVERLAYS_MSG_DIALOG_NO);
btn_cancel.set_size(140, 30);
btn_cancel.set_pos(685, 420);
btn_cancel.set_font("Arial", 16);
@ -197,13 +197,13 @@ namespace rsx
if (interactive)
{
btn_cancel.set_pos(585, btn_cancel.y);
btn_cancel.set_text("Cancel");
btn_cancel.set_text(localized_string_id::RSX_OVERLAYS_MSG_DIALOG_CANCEL);
cancel_only = true;
}
break;
case CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK:
btn_ok.set_pos(600, btn_ok.y);
btn_ok.set_text("OK");
btn_ok.set_text(localized_string_id::RSX_OVERLAYS_MSG_DIALOG_OK);
interactive = true;
ok_only = true;
break;

View File

@ -227,27 +227,27 @@ namespace rsx
m_btn_cancel.set_pos(frame_x, frame_y + frame_h + 10);
m_btn_cancel.set_size(140, 30);
m_btn_cancel.set_text("Cancel");
m_btn_cancel.set_text(localized_string_id::RSX_OVERLAYS_OSK_DIALOG_CANCEL);
m_btn_cancel.set_text_vertical_adjust(5);
m_btn_space.set_pos(frame_x + 100, frame_y + frame_h + 10);
m_btn_space.set_size(100, 30);
m_btn_space.set_text("Space");
m_btn_space.set_text(localized_string_id::RSX_OVERLAYS_OSK_DIALOG_SPACE);
m_btn_space.set_text_vertical_adjust(5);
m_btn_delete.set_pos(frame_x + 200, frame_y + frame_h + 10);
m_btn_delete.set_size(100, 30);
m_btn_delete.set_text("Backspace");
m_btn_delete.set_text(localized_string_id::RSX_OVERLAYS_OSK_DIALOG_BACKSPACE);
m_btn_delete.set_text_vertical_adjust(5);
m_btn_shift.set_pos(frame_x + 320, frame_y + frame_h + 10);
m_btn_shift.set_size(80, 30);
m_btn_shift.set_text("Shift");
m_btn_shift.set_text(localized_string_id::RSX_OVERLAYS_OSK_DIALOG_SHIFT);
m_btn_shift.set_text_vertical_adjust(5);
m_btn_accept.set_pos(frame_x + 400, frame_y + frame_h + 10);
m_btn_accept.set_size(100, 30);
m_btn_accept.set_text("Accept");
m_btn_accept.set_text(localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ACCEPT);
m_btn_accept.set_text_vertical_adjust(5);
m_update = true;
@ -662,12 +662,10 @@ namespace rsx
std::u32string osk_dialog::get_placeholder()
{
if (m_password_mode)
{
return U"[Enter Password]";
}
return U"[Enter Text]";
const localized_string_id id = m_password_mode
? localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ENTER_PASSWORD
: localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ENTER_TEXT;
return get_localized_u32string(id);
}
void osk_dialog::update()

View File

@ -90,7 +90,7 @@ namespace rsx
m_description->set_font("Arial", 20);
m_description->set_pos(20, 37);
m_description->set_text("Save Dialog");
m_description->set_text(localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_TITLE);
m_time_thingy->set_font("Arial", 14);
m_time_thingy->set_pos(1000, 30);
@ -176,15 +176,15 @@ namespace rsx
if (op >= 8)
{
m_description->set_text("Delete Save");
m_description->set_text(localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_DELETE);
}
else if (op & 1)
{
m_description->set_text("Load Save");
m_description->set_text(localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_LOAD);
}
else
{
m_description->set_text("Save");
m_description->set_text(localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_SAVE);
}
const bool newpos_head = listSet && listSet->newData && listSet->newData->iconPosition == CELL_SAVEDATA_ICONPOS_HEAD;

View File

@ -12,7 +12,7 @@ namespace rsx
const u16 pos_y = g_cfg.video.shader_compilation_hint.pos_y;
m_text.set_font("Arial", 16);
m_text.set_text("Compiling shaders");
m_text.set_text(localized_string_id::RSX_OVERLAYS_COMPILING_SHADERS);
m_text.auto_resize();
m_text.set_pos(pos_x, pos_y);

View File

@ -118,18 +118,18 @@ namespace rsx
image.set_raw_image(icon_info.get());
}
std::string trophy_message;
localized_string_id string_id = localized_string_id::INVALID;
switch (trophy.trophyGrade)
{
case SCE_NP_TROPHY_GRADE_BRONZE: trophy_message = "bronze"; break;
case SCE_NP_TROPHY_GRADE_SILVER: trophy_message = "silver"; break;
case SCE_NP_TROPHY_GRADE_GOLD: trophy_message = "gold"; break;
case SCE_NP_TROPHY_GRADE_PLATINUM: trophy_message = "platinum"; break;
case SCE_NP_TROPHY_GRADE_BRONZE: string_id = localized_string_id::RSX_OVERLAYS_TROPHY_BRONZE; break;
case SCE_NP_TROPHY_GRADE_SILVER: string_id = localized_string_id::RSX_OVERLAYS_TROPHY_SILVER; break;
case SCE_NP_TROPHY_GRADE_GOLD: string_id = localized_string_id::RSX_OVERLAYS_TROPHY_GOLD; break;
case SCE_NP_TROPHY_GRADE_PLATINUM: string_id = localized_string_id::RSX_OVERLAYS_TROPHY_PLATINUM; break;
default: break;
}
trophy_message = "You have earned the " + trophy_message + " trophy\n" + trophy.name;
text_view.set_text(trophy_message);
text_view.set_text(trophy.name);
text_view.set_text(get_localized_u32string(string_id) + text_view.text);
text_view.auto_resize();
// Resize background to cover the text

View File

@ -8,6 +8,8 @@
u64 get_system_time();
u64 get_guest_system_time();
enum class localized_string_id;
enum class system_state
{
running,
@ -49,6 +51,8 @@ struct EmuCallbacks
std::function<std::shared_ptr<class OskDialogBase>()> get_osk_dialog;
std::function<std::unique_ptr<class SaveDialogBase>()> get_save_dialog;
std::function<std::unique_ptr<class TrophyNotificationBase>()> get_trophy_notification_dialog;
std::function<std::string(localized_string_id)> get_localized_string;
std::function<std::u32string(localized_string_id)> get_localized_u32string;
};
class Emulator final

View File

@ -0,0 +1,13 @@
#include "stdafx.h"
#include "localized_string.h"
#include "System.h"
std::string get_localized_string(localized_string_id id)
{
return Emu.GetCallbacks().get_localized_string(id);
}
std::u32string get_localized_u32string(localized_string_id id)
{
return Emu.GetCallbacks().get_localized_u32string(id);
}

View File

@ -0,0 +1,34 @@
#pragma once
#include <string>
enum class localized_string_id
{
INVALID,
RSX_OVERLAYS_TROPHY_BRONZE,
RSX_OVERLAYS_TROPHY_SILVER,
RSX_OVERLAYS_TROPHY_GOLD,
RSX_OVERLAYS_TROPHY_PLATINUM,
RSX_OVERLAYS_COMPILING_SHADERS,
RSX_OVERLAYS_MSG_DIALOG_YES,
RSX_OVERLAYS_MSG_DIALOG_NO,
RSX_OVERLAYS_MSG_DIALOG_CANCEL,
RSX_OVERLAYS_MSG_DIALOG_OK,
RSX_OVERLAYS_SAVE_DIALOG_TITLE,
RSX_OVERLAYS_SAVE_DIALOG_DELETE,
RSX_OVERLAYS_SAVE_DIALOG_LOAD,
RSX_OVERLAYS_SAVE_DIALOG_SAVE,
RSX_OVERLAYS_OSK_DIALOG_ACCEPT,
RSX_OVERLAYS_OSK_DIALOG_CANCEL,
RSX_OVERLAYS_OSK_DIALOG_SPACE,
RSX_OVERLAYS_OSK_DIALOG_BACKSPACE,
RSX_OVERLAYS_OSK_DIALOG_SHIFT,
RSX_OVERLAYS_OSK_DIALOG_ENTER_TEXT,
RSX_OVERLAYS_OSK_DIALOG_ENTER_PASSWORD,
RSX_OVERLAYS_LIST_SELECT,
RSX_OVERLAYS_LIST_CANCEL,
};
std::string get_localized_string(localized_string_id id);
std::u32string get_localized_u32string(localized_string_id id);

View File

@ -100,6 +100,7 @@
<ClCompile Include="Emu\Io\KeyboardHandler.cpp" />
<ClCompile Include="Emu\Io\pad_config.cpp" />
<ClCompile Include="Emu\Io\pad_config_types.cpp" />
<ClCompile Include="Emu\localized_string.cpp" />
<ClCompile Include="Emu\NP\rpcn_config.cpp" />
<ClCompile Include="Emu\RSX\Overlays\overlay_osk_panel.cpp" />
<ClCompile Include="Emu\RSX\Overlays\overlay_utils.cpp" />
@ -488,6 +489,7 @@
<ClInclude Include="Emu\Io\Keyboard.h" />
<ClInclude Include="Emu\Io\pad_config.h" />
<ClInclude Include="Emu\Io\pad_config_types.h" />
<ClInclude Include="Emu\localized_string.h" />
<ClInclude Include="Emu\NP\generated\np2_structs_generated.h" />
<ClInclude Include="Emu\NP\np_handler.h" />
<ClInclude Include="Emu\NP\signaling_handler.h" />

View File

@ -968,6 +968,9 @@
<ClCompile Include="Emu\NP\rpcn_config.cpp">
<Filter>Emu\NP</Filter>
</ClCompile>
<ClCompile Include="Emu\localized_string.cpp">
<Filter>Emu</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Crypto\aes.h">
@ -1858,6 +1861,9 @@
<ClInclude Include="Emu\NP\rpcn_config.h">
<Filter>Emu\NP</Filter>
</ClInclude>
<ClInclude Include="Emu\localized_string.h">
<Filter>Emu</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Emu\RSX\Common\Interpreter\FragmentInterpreter.glsl">

View File

@ -98,6 +98,9 @@ void headless_application::InitializeCallbacks()
callbacks.on_stop = []() {};
callbacks.on_ready = []() {};
callbacks.get_localized_string = [](localized_string_id) -> std::string { return {}; };
callbacks.get_localized_u32string = [](localized_string_id) -> std::u32string { return {}; };
Emu.SetCallbacks(std::move(callbacks));
}

View File

@ -471,6 +471,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_localized_emu.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_log_frame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -766,6 +771,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_localized_emu.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_log_frame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -1081,6 +1091,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_localized_emu.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_log_frame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -1376,6 +1391,11 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_localized_emu.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_log_frame.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@ -1555,6 +1575,7 @@
<ClCompile Include="rpcs3qt\gui_application.cpp" />
<ClCompile Include="rpcs3qt\input_dialog.cpp" />
<ClCompile Include="rpcs3qt\localized.cpp" />
<ClCompile Include="rpcs3qt\localized_emu.cpp" />
<ClCompile Include="rpcs3qt\microphone_creator.cpp" />
<ClCompile Include="rpcs3qt\osk_dialog_frame.cpp" />
<ClCompile Include="rpcs3qt\pad_led_settings_dialog.cpp" />
@ -2388,6 +2409,24 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
</CustomBuild>
<CustomBuild Include="rpcs3qt\localized_emu.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DWITH_DISCORD_RPC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\release" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">Moc%27ing %(Identity)...</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">.\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">"$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\QTGeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -D_WINDOWS -DUNICODE -DWIN32 -DWIN64 -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WINEXTRAS_LIB -DQT_CONCURRENT_LIB -D%(PreprocessorDefinitions) "-I.\..\3rdparty\flatbuffers\include" "-I.\..\3rdparty\wolfssl" "-I.\..\3rdparty\curl\include" "-I.\..\3rdparty\libusb\libusb" "-I$(VULKAN_SDK)\Include" "-I.\..\3rdparty\XAudio2Redist\include" "-I$(QTDIR)\include" "-I$(QTDIR)\include\QtWidgets" "-I$(QTDIR)\include\QtGui" "-I$(QTDIR)\include\QtANGLE" "-I$(QTDIR)\include\QtCore" "-I.\debug" "-I$(QTDIR)\mkspecs\win32-msvc2015" "-I.\QTGeneratedFiles\$(ConfigurationName)" "-I.\QTGeneratedFiles" "-I$(QTDIR)\include\QtWinExtras" "-I$(QTDIR)\include\QtConcurrent"</Command>
</CustomBuild>
<ClInclude Include="rpcs3qt\stylesheets.h" />
<CustomBuild Include="rpcs3qt\skylander_dialog.h">
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">$(QTDIR)\bin\moc.exe;%(FullPath)</AdditionalInputs>

View File

@ -1090,6 +1090,21 @@
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_rpcn_settings_dialog.cpp">
<Filter>Generated Files\Debug - LLVM</Filter>
</ClCompile>
<ClCompile Include="rpcs3qt\localized_emu.cpp">
<Filter>Gui\settings</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release - LLVM\moc_localized_emu.cpp">
<Filter>Generated Files\Release - LLVM</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug\moc_localized_emu.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Release\moc_localized_emu.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="QTGeneratedFiles\Debug - LLVM\moc_localized_emu.cpp">
<Filter>Generated Files\Debug - LLVM</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Input\ds4_pad_handler.h">
@ -1415,6 +1430,9 @@
<CustomBuild Include="rpcs3qt\rpcn_settings_dialog.h">
<Filter>Gui\settings</Filter>
</CustomBuild>
<CustomBuild Include="rpcs3qt\localized_emu.h">
<Filter>Gui\settings</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<Image Include="rpcs3.ico" />

View File

@ -28,6 +28,7 @@
instruction_editor_dialog.cpp
kernel_explorer.cpp
localized.cpp
localized_emu.cpp
log_frame.cpp
main_window.cpp
memory_string_searcher.cpp

View File

@ -9,6 +9,7 @@
#include "gs_frame.h"
#include "gl_gs_frame.h"
#include "display_sleep_control.h"
#include "localized_emu.h"
#ifdef WITH_DISCORD_RPC
#include "_discord_utils.h"
@ -358,6 +359,16 @@ void gui_application::InitializeCallbacks()
}
};
callbacks.get_localized_string = [](localized_string_id id) -> std::string
{
return localized_emu::get_string(id);
};
callbacks.get_localized_u32string = [](localized_string_id id) -> std::u32string
{
return localized_emu::get_u32string(id);
};
Emu.SetCallbacks(std::move(callbacks));
}

View File

@ -0,0 +1,48 @@
#include <QString>
#include "localized_emu.h"
localized_emu::localized_emu()
{
}
QString localized_emu::translated(localized_string_id id)
{
switch (id)
{
case localized_string_id::RSX_OVERLAYS_TROPHY_BRONZE: return tr("You have earned the bronze trophy\n");
case localized_string_id::RSX_OVERLAYS_TROPHY_SILVER: return tr("You have earned the silver trophy\n");
case localized_string_id::RSX_OVERLAYS_TROPHY_GOLD: return tr("You have earned the gold trophy\n");
case localized_string_id::RSX_OVERLAYS_TROPHY_PLATINUM: return tr("You have earned the platinum trophy\n");
case localized_string_id::RSX_OVERLAYS_COMPILING_SHADERS: return tr("Compiling shaders");
case localized_string_id::RSX_OVERLAYS_MSG_DIALOG_YES: return tr("Yes");
case localized_string_id::RSX_OVERLAYS_MSG_DIALOG_NO: return tr("No");
case localized_string_id::RSX_OVERLAYS_MSG_DIALOG_CANCEL: return tr("Cancel");
case localized_string_id::RSX_OVERLAYS_MSG_DIALOG_OK: return tr("OK");
case localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_TITLE: return tr("Save Dialog");
case localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_DELETE: return tr("Delete Save");
case localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_LOAD: return tr("Load Save");
case localized_string_id::RSX_OVERLAYS_SAVE_DIALOG_SAVE: return tr("Save");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ACCEPT: return tr("Accept");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_CANCEL: return tr("Cancel");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_SPACE: return tr("Space");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_BACKSPACE: return tr("Backspace");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_SHIFT: return tr("Shift");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ENTER_TEXT: return tr("[Enter Text]");
case localized_string_id::RSX_OVERLAYS_OSK_DIALOG_ENTER_PASSWORD: return tr("[Enter Password]");
case localized_string_id::RSX_OVERLAYS_LIST_SELECT: return tr("Select");
case localized_string_id::RSX_OVERLAYS_LIST_CANCEL: return tr("Cancel");
case localized_string_id::INVALID: return tr("Invalid");
default: return tr("Unknown");
}
}
std::string localized_emu::get_string(localized_string_id id)
{
return translated(id).toStdString();
}
std::u32string localized_emu::get_u32string(localized_string_id id)
{
return translated(id).toStdU32String();
}

View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
#include <QObject>
#include "Emu/localized_string.h"
/**
* Localized emucore string collection class
* Due to special characters this file should stay in UTF-8 format
*/
class localized_emu : public QObject
{
Q_OBJECT
public:
localized_emu();
static std::string get_string(localized_string_id id);
static std::u32string get_u32string(localized_string_id id);
private:
static QString translated(localized_string_id id);
};