MCPcopy Create free account
hub / github.com/RPCSX/rpcsx / _sys_snprintf

Function _sys_snprintf

ps3fw/sys_libc_.cpp:517–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517s32 _sys_snprintf(ppu_thread& ppu, vm::ptr<char> dst, u32 count,
518 vm::cptr<char> fmt, ppu_va_args_t va_args)
519{
520 sysPrxForUser.warning("_sys_snprintf(dst=*0x%x, count=%d, fmt=%s, ...)", dst,
521 count, fmt);
522
523 std::string result = ps3_fmt(ppu, fmt, va_args.count);
524
525 if (!count)
526 {
527 return 0; // ???
528 }
529 else
530 {
531 count = static_cast<u32>(std::min<usz>(count - 1, result.size()));
532
533 std::memcpy(dst.get_ptr(), result.c_str(), count);
534 dst[count] = 0;
535 return count;
536 }
537}
538
539error_code _sys_printf(ppu_thread& ppu, vm::cptr<char> fmt,
540 ppu_va_args_t va_args)

Callers

nothing calls this directly

Calls 4

ps3_fmtFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
get_ptrMethod · 0.45

Tested by

no test coverage detected