mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
vm::ptr for u8/char types, mem_list_ptr_t removed
This commit is contained in:
parent
ebc4fa3e81
commit
a8cfefac07
31 changed files with 208 additions and 362 deletions
|
|
@ -18,12 +18,12 @@
|
|||
//Module cellL10n(0x001e, cellL10n_init);
|
||||
Module *cellL10n = nullptr;
|
||||
|
||||
int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t utf8_len)
|
||||
int UTF16stoUTF8s(vm::ptr<const be_t<u16>> utf16, mem64_t utf16_len, vm::ptr<char> utf8, mem64_t utf8_len)
|
||||
{
|
||||
cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
|
||||
utf16.GetAddr(), utf16_len.GetAddr(), utf8.GetAddr(), utf8_len.GetAddr());
|
||||
utf16.addr(), utf16_len.GetAddr(), utf8.addr(), utf8_len.GetAddr());
|
||||
|
||||
std::u16string wstr =(char16_t*)Memory.VirtualToRealAddr(utf16.GetAddr());
|
||||
std::u16string wstr =(char16_t*)utf16.get_ptr();
|
||||
wstr.resize(utf16_len.GetValue()); // TODO: Is this really the role of utf16_len in this function?
|
||||
#ifdef _MSC_VER
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
||||
|
|
@ -36,14 +36,14 @@ int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t
|
|||
}
|
||||
|
||||
utf8_len = str.size();
|
||||
Memory.WriteString(utf8, str.c_str());
|
||||
Memory.WriteString(utf8.addr(), str);
|
||||
#endif
|
||||
return ConversionOK;
|
||||
}
|
||||
|
||||
int jstrchk(mem8_ptr_t jstr)
|
||||
int jstrchk(vm::ptr<const char> jstr)
|
||||
{
|
||||
cellL10n->Warning("jstrchk(jstr_addr=0x%x) -> utf8", jstr.GetAddr());
|
||||
cellL10n->Warning("jstrchk(jstr_addr=0x%x) -> utf8", jstr.addr());
|
||||
|
||||
return L10N_STR_UTF8;
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@ int _L10nConvertStr(int src_code, const void *src, size_t * src_len, int dst_cod
|
|||
|
||||
if (target.length() > *dst_len) return DSTExhausted;
|
||||
|
||||
Memory.WriteString(dst, target.c_str());
|
||||
Memory.WriteString(dst.addr(), target);
|
||||
|
||||
return ConversionOK;
|
||||
}
|
||||
|
|
@ -283,11 +283,11 @@ int _L10nConvertStr(int src_code, const void* src, size_t * src_len, int dst_cod
|
|||
#endif
|
||||
|
||||
//TODO: Check the code in emulation. If support for UTF8/UTF16/UTF32/UCS2/UCS4 should use wider chars.. awful.
|
||||
int L10nConvertStr(int src_code, mem8_ptr_t src, mem64_t src_len, int dst_code, mem8_ptr_t dst, mem64_t dst_len)
|
||||
int L10nConvertStr(int src_code, vm::ptr<const void> src, mem32_t src_len, int dst_code, vm::ptr<void> dst, mem32_t dst_len)
|
||||
{
|
||||
cellL10n->Todo("L10nConvertStr(src_code=%d,src=0x%x,src_len=%ld,dst_code=%d,dst=0x%x,dst_len=%ld)",
|
||||
src_code, src.GetAddr(), src_len.GetValue(), dst_code, dst.GetAddr(), dst_len.GetValue());
|
||||
cellL10n->Todo("L10nConvertStr: 1st char at dst: %x(Hex)", *((char*)Memory.VirtualToRealAddr(src.GetAddr())));
|
||||
src_code, src.addr(), src_len.GetValue(), dst_code, dst.addr(), dst_len.GetValue());
|
||||
cellL10n->Todo("L10nConvertStr: 1st char at dst: %x(Hex)", *((char*)src.get_ptr()));
|
||||
#ifdef _MSC_VER
|
||||
unsigned int srcCode = 0, dstCode = 0; //OEM code pages
|
||||
bool src_page_converted = _L10nCodeParse(src_code, srcCode); //Check if code is in list.
|
||||
|
|
@ -298,14 +298,14 @@ int L10nConvertStr(int src_code, mem8_ptr_t src, mem64_t src_len, int dst_code,
|
|||
return ConverterUnknown;
|
||||
|
||||
//if (strnlen_s((char*)src, *src_len) != *src_len) return SRCIllegal;
|
||||
std::string wrapped_source = (char*)Memory.VirtualToRealAddr(src.GetAddr());
|
||||
std::string wrapped_source = (char*)src.get_ptr();
|
||||
//std::string wrapped_source((char*)src);
|
||||
if (wrapped_source.length() != src_len.GetValue()) return SRCIllegal;
|
||||
std::string target = _OemToOem(srcCode, dstCode, wrapped_source);
|
||||
|
||||
if (target.length() > dst_len.GetValue()) return DSTExhausted;
|
||||
|
||||
Memory.WriteString(dst, target.c_str());
|
||||
Memory.WriteString(dst.addr(), target);
|
||||
|
||||
return ConversionOK;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue