[Kernel] Use user_language value as the slot to retrieve STFS strings from

This commit is contained in:
emoose 2020-01-11 18:35:10 +00:00
parent ec06bd16ad
commit 6ca721d40a
3 changed files with 18 additions and 3 deletions

View File

@ -20,6 +20,8 @@
#include "xenia/vfs/devices/host_path_device.h"
#include "xenia/vfs/devices/stfs_container_device.h"
DECLARE_int32(user_language);
namespace xe {
namespace kernel {
namespace xam {
@ -113,7 +115,7 @@ std::vector<XCONTENT_DATA> ContentManager::ListContent(uint32_t device_id,
content_data.content_type =
static_cast<uint32_t>(header->metadata.content_type);
content_data.display_name =
header->metadata.get_display_name(XLanguage::kEnglish);
header->metadata.get_display_name((XLanguage)cvars::user_language);
// TODO: select localized display name
// some games may expect different ones depending on language setting.
map->Close();
@ -196,7 +198,8 @@ X_RESULT ContentManager::CreateContent(std::string root_name,
vfs::StfsHeader* header = new vfs::StfsHeader();
// TODO: set title_id, title_name & publisher from XDBF info
header->metadata.content_type = (xe::vfs::XContentType)data.content_type;
header->metadata.set_display_name(data.display_name, XLanguage::kEnglish);
header->metadata.set_display_name(data.display_name,
(XLanguage)cvars::user_language);
// TODO: set display name locale that's currently in use
fwrite(header, sizeof(vfs::StfsHeader), 1, file);
fclose(file);

View File

@ -206,6 +206,9 @@ struct XContentMetadata {
std::wstring get_display_name(XLanguage lang) {
uint32_t lang_id = (uint32_t)lang;
lang_id--;
if (lang_id >= 12) {
lang_id = 0; // no room for this lang, store in english slot..
}
wchar_t* str = 0;
if (lang_id >= 0 && lang_id < 9) {
@ -226,6 +229,9 @@ struct XContentMetadata {
std::wstring get_description(XLanguage lang) {
uint32_t lang_id = (uint32_t)lang;
lang_id--;
if (lang_id >= 12) {
lang_id = 0; // no room for this lang, store in english slot..
}
wchar_t* str = 0;
if (lang_id >= 0 && lang_id < 9) {
@ -263,6 +269,9 @@ struct XContentMetadata {
bool set_display_name(const std::wstring& value, XLanguage lang) {
uint32_t lang_id = (uint32_t)lang;
lang_id--;
if (lang_id >= 12) {
lang_id = 0; // no room for this lang, store in english slot..
}
wchar_t* str = 0;
if (lang_id >= 0 && lang_id < 9) {
@ -281,6 +290,9 @@ struct XContentMetadata {
bool set_description(const std::wstring& value, XLanguage lang) {
uint32_t lang_id = (uint32_t)lang;
lang_id--;
if (lang_id >= 12) {
lang_id = 0; // no room for this lang, store in english slot..
}
wchar_t* str = 0;
if (lang_id >= 0 && lang_id < 9) {

View File

@ -366,7 +366,7 @@ enum class XLanguage : uint32_t {
kItalian,
kKorean,
kTChinese,
kUnknown9, // unused?
kPortuguese,
kUnknown10, // unused?
kPolish,
kRussian,