vm::ptr<char> formatting

This commit is contained in:
Nekotekina 2016-08-11 02:29:59 +03:00
parent 8c8242345e
commit fc56e70172
23 changed files with 198 additions and 165 deletions

View file

@ -201,25 +201,20 @@ namespace sce_libc_func
void printf(ARMv7Thread& cpu, vm::cptr<char> fmt, arm_va_args_t va_args)
{
sceLibc.warning("printf(fmt=*0x%x)", fmt);
sceLibc.trace("*** *fmt = '%s'", fmt.get_ptr());
const std::string& result = arm_fmt(cpu, fmt, va_args.count);
sceLibc.trace("*** -> '%s'", result);
sceLibc.warning("printf(fmt=%s, ...)", fmt);
if (g_tty)
{
g_tty.write(result);
g_tty.write(arm_fmt(cpu, fmt, va_args.count));
}
}
void sprintf(ARMv7Thread& cpu, vm::ptr<char> str, vm::cptr<char> fmt, arm_va_args_t va_args)
{
sceLibc.warning("sprintf(str=*0x%x, fmt=*0x%x)", str, fmt);
sceLibc.trace("*** *fmt = '%s'", fmt.get_ptr());
sceLibc.warning("sprintf(str=*0x%x, fmt=%s, ...)", str, fmt);
const std::string& result = arm_fmt(cpu, fmt, va_args.count);
sceLibc.trace("*** -> '%s'", result);
sceLibc.trace("sprintf() -> '%s'", result);
::memcpy(str.get_ptr(), result.c_str(), result.size() + 1);
}