[XAM] Cleanup XamGetCachedTitleName
This commit is contained in:
@@ -172,25 +172,26 @@ DECLARE_XAM_EXPORT1(XamBuildXamResourceLocator, kNone, kImplemented);
|
||||
|
||||
dword_result_t XamGetCachedTitleName_entry(dword_t title_id,
|
||||
dword_t title_name_address,
|
||||
lpdword_t title_name_size_ptr) {
|
||||
if (!title_name_address || !title_name_size_ptr) {
|
||||
lpdword_t title_name_length_ptr) {
|
||||
char16_t* title_name_ptr =
|
||||
kernel_state()->memory()->TranslateVirtual<char16_t*>(title_name_address);
|
||||
|
||||
if (!title_id) {
|
||||
*title_name_ptr = 0;
|
||||
*title_name_length_ptr = 1;
|
||||
|
||||
return X_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
assert_false(title_id != kernel_state()->title_id());
|
||||
|
||||
char16_t* title_name_ptr =
|
||||
kernel_state()->memory()->TranslateVirtual<char16_t*>(title_name_address);
|
||||
|
||||
std::u16string title_name = xe::to_utf16(
|
||||
kernel_state()->emulator()->game_info_database()->GetTitleName());
|
||||
|
||||
size_t title_name_size = string_util::size_in_bytes(title_name, true);
|
||||
xe::string_util::copy_and_swap_truncating(title_name_ptr, title_name,
|
||||
title_name.size() + 1);
|
||||
|
||||
string_util::copy_and_swap_truncating(title_name_ptr, title_name,
|
||||
title_name_size);
|
||||
|
||||
*title_name_size_ptr = static_cast<uint32_t>(title_name_size);
|
||||
*title_name_length_ptr = title_name.size() + 1;
|
||||
|
||||
return X_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user