1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

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

@ -65,7 +65,7 @@ s32 cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
s32 cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::cptr<char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font) s32 cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::cptr<char> fontPath, u32 subNum, s32 uniqueId, vm::ptr<CellFont> font)
{ {
cellFont.warning("cellFontOpenFontFile(library=*0x%x, fontPath=*0x%x, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontPath, subNum, uniqueId, font); cellFont.warning("cellFontOpenFontFile(library=*0x%x, fontPath=%s, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontPath, subNum, uniqueId, font);
fs::file f(vfs::get(fontPath.get_ptr())); fs::file f(vfs::get(fontPath.get_ptr()));
if (!f) if (!f)

View File

@ -14,7 +14,7 @@ logs::channel cellFs("cellFs", logs::level::notice);
s32 cellFsOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size) s32 cellFsOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size)
{ {
cellFs.warning("cellFsOpen(path=*0x%x, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx) -> sys_fs_open()", path, flags, fd, arg, size); cellFs.warning("cellFsOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx) -> sys_fs_open()", path, flags, fd, arg, size);
// TODO // TODO
@ -48,7 +48,7 @@ s32 cellFsClose(u32 fd)
s32 cellFsOpendir(vm::cptr<char> path, vm::ptr<u32> fd) s32 cellFsOpendir(vm::cptr<char> path, vm::ptr<u32> fd)
{ {
cellFs.warning("cellFsOpendir(path=*0x%x, fd=*0x%x) -> sys_fs_opendir()", path, fd); cellFs.warning("cellFsOpendir(path=%s, fd=*0x%x) -> sys_fs_opendir()", path, fd);
// TODO // TODO
@ -79,7 +79,7 @@ s32 cellFsClosedir(u32 fd)
s32 cellFsStat(vm::cptr<char> path, vm::ptr<CellFsStat> sb) s32 cellFsStat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
{ {
cellFs.warning("cellFsStat(path=*0x%x, sb=*0x%x) -> sys_fs_stat()", path, sb); cellFs.warning("cellFsStat(path=%s, sb=*0x%x) -> sys_fs_stat()", path, sb);
// TODO // TODO
@ -97,7 +97,7 @@ s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
s32 cellFsMkdir(vm::cptr<char> path, s32 mode) s32 cellFsMkdir(vm::cptr<char> path, s32 mode)
{ {
cellFs.warning("cellFsMkdir(path=*0x%x, mode=%#o) -> sys_fs_mkdir()", path, mode); cellFs.warning("cellFsMkdir(path=%s, mode=%#o) -> sys_fs_mkdir()", path, mode);
// TODO // TODO
@ -107,7 +107,7 @@ s32 cellFsMkdir(vm::cptr<char> path, s32 mode)
s32 cellFsRename(vm::cptr<char> from, vm::cptr<char> to) s32 cellFsRename(vm::cptr<char> from, vm::cptr<char> to)
{ {
cellFs.warning("cellFsRename(from=*0x%x, to=*0x%x) -> sys_fs_rename()", from, to); cellFs.warning("cellFsRename(from=%s, to=%s) -> sys_fs_rename()", from, to);
// TODO // TODO
@ -117,7 +117,7 @@ s32 cellFsRename(vm::cptr<char> from, vm::cptr<char> to)
s32 cellFsRmdir(vm::cptr<char> path) s32 cellFsRmdir(vm::cptr<char> path)
{ {
cellFs.warning("cellFsRmdir(path=*0x%x) -> sys_fs_rmdir()", path); cellFs.warning("cellFsRmdir(path=%s) -> sys_fs_rmdir()", path);
// TODO // TODO
@ -127,7 +127,7 @@ s32 cellFsRmdir(vm::cptr<char> path)
s32 cellFsUnlink(vm::cptr<char> path) s32 cellFsUnlink(vm::cptr<char> path)
{ {
cellFs.warning("cellFsUnlink(path=*0x%x) -> sys_fs_unlink()", path); cellFs.warning("cellFsUnlink(path=%s) -> sys_fs_unlink()", path);
// TODO // TODO
@ -170,7 +170,7 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_siz
s32 cellFsGetBlockSize(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size) s32 cellFsGetBlockSize(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size)
{ {
cellFs.warning("cellFsGetBlockSize(path=*0x%x, sector_size=*0x%x, block_size=*0x%x) -> sys_fs_get_block_size()", path, sector_size, block_size); cellFs.warning("cellFsGetBlockSize(path=%s, sector_size=*0x%x, block_size=*0x%x) -> sys_fs_get_block_size()", path, sector_size, block_size);
// TODO // TODO
@ -180,7 +180,7 @@ s32 cellFsGetBlockSize(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u6
s32 cellFsTruncate(vm::cptr<char> path, u64 size) s32 cellFsTruncate(vm::cptr<char> path, u64 size)
{ {
cellFs.warning("cellFsTruncate(path=*0x%x, size=0x%llx) -> sys_fs_truncate()", path, size); cellFs.warning("cellFsTruncate(path=%s, size=0x%llx) -> sys_fs_truncate()", path, size);
// TODO // TODO
@ -198,7 +198,7 @@ s32 cellFsFtruncate(u32 fd, u64 size)
s32 cellFsChmod(vm::cptr<char> path, s32 mode) s32 cellFsChmod(vm::cptr<char> path, s32 mode)
{ {
cellFs.warning("cellFsChmod(path=*0x%x, mode=%#o) -> sys_fs_chmod()", path, mode); cellFs.warning("cellFsChmod(path=%s, mode=%#o) -> sys_fs_chmod()", path, mode);
// TODO // TODO
@ -208,8 +208,7 @@ s32 cellFsChmod(vm::cptr<char> path, s32 mode)
s32 cellFsGetFreeSize(vm::cptr<char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count) s32 cellFsGetFreeSize(vm::cptr<char> path, vm::ptr<u32> block_size, vm::ptr<u64> block_count)
{ {
cellFs.warning("cellFsGetFreeSize(path=*0x%x, block_size=*0x%x, block_count=*0x%x)", path, block_size, block_count); cellFs.warning("cellFsGetFreeSize(path=%s, block_size=*0x%x, block_count=*0x%x)", path, block_size, block_count);
cellFs.warning("*** path = '%s'", path.get_ptr());
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks // TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
*block_size = 4096; // ? *block_size = 4096; // ?
@ -648,7 +647,7 @@ s32 sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
s32 cellFsSdataOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size) s32 cellFsSdataOpen(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, vm::cptr<void> arg, u64 size)
{ {
cellFs.notice("cellFsSdataOpen(path=*0x%x, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size); cellFs.notice("cellFsSdataOpen(path=%s, flags=%#o, fd=*0x%x, arg=*0x%x, size=0x%llx)", path, flags, fd, arg, size);
if (flags != CELL_FS_O_RDONLY) if (flags != CELL_FS_O_RDONLY)
{ {
@ -748,8 +747,7 @@ struct fs_aio_manager
s32 cellFsAioInit(vm::cptr<char> mount_point) s32 cellFsAioInit(vm::cptr<char> mount_point)
{ {
cellFs.warning("cellFsAioInit(mount_point=*0x%x)", mount_point); cellFs.warning("cellFsAioInit(mount_point=%s)", mount_point);
cellFs.warning("*** mount_point = '%s'", mount_point.get_ptr());
// TODO: create AIO thread (if not exists) for specified mount point // TODO: create AIO thread (if not exists) for specified mount point
fxm::get_always<fs_aio_manager>(); fxm::get_always<fs_aio_manager>();
@ -759,8 +757,7 @@ s32 cellFsAioInit(vm::cptr<char> mount_point)
s32 cellFsAioFinish(vm::cptr<char> mount_point) s32 cellFsAioFinish(vm::cptr<char> mount_point)
{ {
cellFs.warning("cellFsAioFinish(mount_point=*0x%x)", mount_point); cellFs.warning("cellFsAioFinish(mount_point=%s)", mount_point);
cellFs.warning("*** mount_point = '%s'", mount_point.get_ptr());
// TODO: delete existing AIO thread for specified mount point // TODO: delete existing AIO thread for specified mount point
@ -883,7 +880,7 @@ s32 cellFsChangeFileSizeWithoutAllocation()
s32 cellFsAllocateFileAreaWithoutZeroFill(vm::cptr<char> path, u64 size) s32 cellFsAllocateFileAreaWithoutZeroFill(vm::cptr<char> path, u64 size)
{ {
cellFs.warning("cellFsAllocateFileAreaWithoutZeroFill(path=*0x%x, size=0x%llx)", path, size); cellFs.warning("cellFsAllocateFileAreaWithoutZeroFill(path=%s, size=0x%llx)", path, size);
return sys_fs_truncate(path, size); return sys_fs_truncate(path, size);
} }

View File

@ -52,7 +52,7 @@ struct content_permission final
s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container) s32 cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellHddGameStatCallback> funcStat, u32 container)
{ {
cellGame.error("cellHddGameCheck(version=%d, dirName=*0x%x, errDialog=%d, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); cellGame.error("cellHddGameCheck(version=%d, dirName=%s, errDialog=%d, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
std::string dir = dirName.get_ptr(); std::string dir = dirName.get_ptr();
@ -248,7 +248,7 @@ ppu_error_code cellGamePatchCheck(vm::ptr<CellGameContentSize> size, vm::ptr<voi
ppu_error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellGameContentSize> size) ppu_error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellGameContentSize> size)
{ {
cellGame.warning("cellGameDataCheck(type=%d, dirName=*0x%x, size=*0x%x)", type, dirName, size); cellGame.warning("cellGameDataCheck(type=%d, dirName=%s, size=*0x%x)", type, dirName, size);
if ((type - 1) >= 3) if ((type - 1) >= 3)
{ {
@ -270,7 +270,7 @@ ppu_error_code cellGameDataCheck(u32 type, vm::cptr<char> dirName, vm::ptr<CellG
if (!fs::is_dir(vfs::get(dir))) if (!fs::is_dir(vfs::get(dir)))
{ {
cellGame.warning("cellGameDataCheck(): '%s' directory not found", dir.c_str()); cellGame.warning("cellGameDataCheck(): '%s' directory not found", dir);
return CELL_GAME_RET_NONE; return CELL_GAME_RET_NONE;
} }
@ -303,15 +303,13 @@ ppu_error_code cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentIn
const std::string& dir = "/dev_hdd0/game/" + prm->dir; const std::string& dir = "/dev_hdd0/game/" + prm->dir;
// Make temporary directory persistent // Make temporary directory persistent
fs::remove_all(vfs::get(dir)); if (!fs::exists(vfs::get(dir)) && fs::rename(vfs::get("/dev_hdd1/game/" + prm->dir), vfs::get(dir)))
if (fs::rename(vfs::get("/dev_hdd1/game/" + prm->dir), vfs::get(dir)))
{ {
cellGame.success("cellGameContentPermit(): created directory %s", dir); cellGame.success("cellGameContentPermit(): created directory %s", dir);
} }
else else
{ {
fmt::throw_exception("cellGameContentPermit(): failed to rename to %s", dir); fmt::throw_exception("cellGameContentPermit(): failed to initialize %s", dir);
} }
// Create PARAM.SFO // Create PARAM.SFO
@ -334,7 +332,7 @@ ppu_error_code cellGameContentPermit(vm::ptr<char[CELL_GAME_PATH_MAX]> contentIn
ppu_error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container) ppu_error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
{ {
cellGame.error("cellGameDataCheckCreate2(version=0x%x, dirName=*0x%x, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); cellGame.error("cellGameDataCheckCreate2(version=0x%x, dirName=%s, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1) if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1)
{ {
@ -422,7 +420,7 @@ ppu_error_code cellGameDataCheckCreate2(ppu_thread& ppu, u32 version, vm::cptr<c
s32 cellGameDataCheckCreate(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container) s32 cellGameDataCheckCreate(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, vm::ptr<CellGameDataStatCallback> funcStat, u32 container)
{ {
cellGame.warning("cellGameDataCheckCreate(version=0x%x, dirName=*0x%x, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container); cellGame.warning("cellGameDataCheckCreate(version=0x%x, dirName=%s, errDialog=0x%x, funcStat=*0x%x, container=%d)", version, dirName, errDialog, funcStat, container);
// TODO: almost identical, the only difference is that this function will always calculate the size of game data // TODO: almost identical, the only difference is that this function will always calculate the size of game data
return cellGameDataCheckCreate2(ppu, version, dirName, errDialog, funcStat, container); return cellGameDataCheckCreate2(ppu, version, dirName, errDialog, funcStat, container);
@ -620,7 +618,7 @@ s32 cellGameGetLocalWebContentPath()
ppu_error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<char> dirName) ppu_error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<char> dirName)
{ {
cellGame.warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName=*0x%x)", type, errNeedSizeKB, dirName); cellGame.warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName=%s)", type, errNeedSizeKB, dirName);
std::string errorName; std::string errorName;
switch (type) switch (type)
@ -646,7 +644,7 @@ ppu_error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<
if (dirName) if (dirName)
{ {
errorMsg += fmt::format("\nDirectory name: %s", dirName.get_ptr()); errorMsg += fmt::format("\nDirectory name: %s", dirName);
} }
const auto dlg = Emu.GetCallbacks().get_msg_dialog(); const auto dlg = Emu.GetCallbacks().get_msg_dialog();

View File

@ -17,7 +17,7 @@ s32 cellMsgDialogOpen()
s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam) s32 cellMsgDialogOpen2(u32 type, vm::cptr<char> msgString, vm::ptr<CellMsgDialogCallback> callback, vm::ptr<void> userData, vm::ptr<void> extParam)
{ {
cellSysutil.warning("cellMsgDialogOpen2(type=0x%x, msgString=*0x%x, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam); cellSysutil.warning("cellMsgDialogOpen2(type=0x%x, msgString=%s, callback=*0x%x, userData=*0x%x, extParam=*0x%x)", type, msgString, callback, userData, extParam);
if (!msgString || std::strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8) if (!msgString || std::strlen(msgString.get_ptr()) >= 0x200 || type & -0x33f8)
{ {
@ -249,17 +249,14 @@ s32 cellMsgDialogAbort()
return CELL_SYSUTIL_ERROR_BUSY; return CELL_SYSUTIL_ERROR_BUSY;
} }
if (!fxm::remove<MsgDialogBase>()) VERIFY(fxm::remove<MsgDialogBase>());
{
fmt::throw_exception("Failed to remove MsgDialog object" HERE);
}
return CELL_OK; return CELL_OK;
} }
s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr<char> msgString) s32 cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr<char> msgString)
{ {
cellSysutil.warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString=*0x%x)", progressBarIndex, msgString); cellSysutil.warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString=%s)", progressBarIndex, msgString);
const auto dlg = fxm::get<MsgDialogBase>(); const auto dlg = fxm::get<MsgDialogBase>();

View File

@ -13,7 +13,7 @@ enum
s32 cellOvisGetOverlayTableSize(vm::cptr<char> elf) s32 cellOvisGetOverlayTableSize(vm::cptr<char> elf)
{ {
cellOvis.todo("cellOvisGetOverlayTableSize(elf=*0x%x)", elf); cellOvis.todo("cellOvisGetOverlayTableSize(elf=%s)", elf);
return CELL_OK; return CELL_OK;
} }

View File

@ -71,14 +71,14 @@ s32 cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
s32 cellRtcParseDateTime(vm::ptr<CellRtcTick> pUtc, vm::cptr<char> pszDateTime) s32 cellRtcParseDateTime(vm::ptr<CellRtcTick> pUtc, vm::cptr<char> pszDateTime)
{ {
cellRtc.todo("cellRtcParseDateTime(pUtc=*0x%x, pszDateTime=*0x%x)", pUtc, pszDateTime); cellRtc.todo("cellRtcParseDateTime(pUtc=*0x%x, pszDateTime=%s)", pUtc, pszDateTime);
return CELL_OK; return CELL_OK;
} }
s32 cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::cptr<char> pszDateTime) s32 cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::cptr<char> pszDateTime)
{ {
cellRtc.todo("cellRtcParseRfc3339(pUtc=*0x%x, pszDateTime=*0x%x)", pUtc, pszDateTime); cellRtc.todo("cellRtcParseRfc3339(pUtc=*0x%x, pszDateTime=%s)", pUtc, pszDateTime);
return CELL_OK; return CELL_OK;
} }

View File

@ -786,7 +786,7 @@ s32 cellSailPlayerAddDescriptor(vm::ptr<CellSailPlayer> pSelf, vm::ptr<CellSailD
s32 cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType, vm::ptr<void> pMediaInfo, vm::cptr<char> pUri, vm::pptr<CellSailDescriptor> ppDesc) s32 cellSailPlayerCreateDescriptor(vm::ptr<CellSailPlayer> pSelf, s32 streamType, vm::ptr<void> pMediaInfo, vm::cptr<char> pUri, vm::pptr<CellSailDescriptor> ppDesc)
{ {
cellSail.todo("cellSailPlayerCreateDescriptor(pSelf=*0x%x, streamType=%d, pMediaInfo=*0x%x, pUri=*0x%x, ppDesc=**0x%x)", pSelf, streamType, pMediaInfo, pUri, ppDesc); cellSail.todo("cellSailPlayerCreateDescriptor(pSelf=*0x%x, streamType=%d, pMediaInfo=*0x%x, pUri=%s, ppDesc=**0x%x)", pSelf, streamType, pMediaInfo, pUri, ppDesc);
u32 descriptorAddress = vm::alloc(sizeof(CellSailDescriptor), vm::main); u32 descriptorAddress = vm::alloc(sizeof(CellSailDescriptor), vm::main);
auto descriptor = vm::ptr<CellSailDescriptor>::make(descriptorAddress); auto descriptor = vm::ptr<CellSailDescriptor>::make(descriptorAddress);

View File

@ -696,7 +696,7 @@ s32 cellSaveDataFixedLoad(ppu_thread& ppu, u32 version, PSetList setList, PSetBu
s32 cellSaveDataAutoSave2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, s32 cellSaveDataAutoSave2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf,
PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata) PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata)
{ {
cellSaveData.warning("cellSaveDataAutoSave2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", cellSaveData.warning("cellSaveDataAutoSave2(version=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null);
@ -705,7 +705,7 @@ s32 cellSaveDataAutoSave2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName,
s32 cellSaveDataAutoLoad2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, s32 cellSaveDataAutoLoad2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf,
PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata) PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata)
{ {
cellSaveData.warning("cellSaveDataAutoLoad2(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", cellSaveData.warning("cellSaveDataAutoLoad2(version=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); version, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, userdata, 0, vm::null);
@ -714,7 +714,7 @@ s32 cellSaveDataAutoLoad2(ppu_thread& ppu, u32 version, vm::cptr<char> dirName,
s32 cellSaveDataAutoSave(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, s32 cellSaveDataAutoSave(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf,
PFuncStat funcStat, PFuncFile funcFile, u32 container) PFuncStat funcStat, PFuncFile funcFile, u32 container)
{ {
cellSaveData.warning("cellSaveDataAutoSave(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x)", cellSaveData.warning("cellSaveDataAutoSave(version=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x)",
version, dirName, errDialog, setBuf, funcStat, funcFile, container); version, dirName, errDialog, setBuf, funcStat, funcFile, container);
return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, vm::null, 0, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, vm::null, 0, vm::null);
@ -723,7 +723,7 @@ s32 cellSaveDataAutoSave(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u
s32 cellSaveDataAutoLoad(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, s32 cellSaveDataAutoLoad(ppu_thread& ppu, u32 version, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf,
PFuncStat funcStat, PFuncFile funcFile, u32 container) PFuncStat funcStat, PFuncFile funcFile, u32 container)
{ {
cellSaveData.warning("cellSaveDataAutoLoad(version=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x)", cellSaveData.warning("cellSaveDataAutoLoad(version=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x)",
version, dirName, errDialog, setBuf, funcStat, funcFile, container); version, dirName, errDialog, setBuf, funcStat, funcFile, container);
return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, vm::null, 0, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 2, vm::null, 0, vm::null);
@ -801,7 +801,7 @@ s32 cellSaveDataUserFixedLoad(ppu_thread& ppu, u32 version, u32 userId, PSetList
s32 cellSaveDataUserAutoSave(ppu_thread& ppu, u32 version, u32 userId, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata) s32 cellSaveDataUserAutoSave(ppu_thread& ppu, u32 version, u32 userId, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata)
{ {
cellSaveData.error("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", cellSaveData.error("cellSaveDataUserAutoSave(version=%d, userId=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_SAVE, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);
@ -809,7 +809,7 @@ s32 cellSaveDataUserAutoSave(ppu_thread& ppu, u32 version, u32 userId, vm::cptr<
s32 cellSaveDataUserAutoLoad(ppu_thread& ppu, u32 version, u32 userId, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata) s32 cellSaveDataUserAutoLoad(ppu_thread& ppu, u32 version, u32 userId, vm::cptr<char> dirName, u32 errDialog, PSetBuf setBuf, PFuncStat funcStat, PFuncFile funcFile, u32 container, vm::ptr<void> userdata)
{ {
cellSaveData.error("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName=*0x%x, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)", cellSaveData.error("cellSaveDataUserAutoLoad(version=%d, userId=%d, dirName=%s, errDialog=%d, setBuf=*0x%x, funcStat=*0x%x, funcFile=*0x%x, container=0x%x, userdata=*0x%x)",
version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata); version, userId, dirName, errDialog, setBuf, funcStat, funcFile, container, userdata);
return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null); return savedata_op(ppu, SAVEDATA_OP_AUTO_LOAD, version, dirName, errDialog, vm::null, setBuf, vm::null, vm::null, funcStat, funcFile, container, 6, userdata, userId, vm::null);

View File

@ -1350,7 +1350,7 @@ s32 cellSpursAttributeSetMemoryContainerForSpuThread(vm::ptr<CellSpursAttribute>
/// Set the prefix for SPURS /// Set the prefix for SPURS
s32 cellSpursAttributeSetNamePrefix(vm::ptr<CellSpursAttribute> attr, vm::cptr<char> prefix, u32 size) s32 cellSpursAttributeSetNamePrefix(vm::ptr<CellSpursAttribute> attr, vm::cptr<char> prefix, u32 size)
{ {
cellSpurs.warning("cellSpursAttributeSetNamePrefix(attr=*0x%x, prefix=*0x%x, size=%d)", attr, prefix, size); cellSpurs.warning("cellSpursAttributeSetNamePrefix(attr=*0x%x, prefix=%s, size=%d)", attr, prefix, size);
if (!attr || !prefix) if (!attr || !prefix)
{ {
@ -2064,7 +2064,7 @@ s32 _cellSpursWorkloadAttributeInitialize(vm::ptr<CellSpursWorkloadAttribute> at
/// Set the name of a workload /// Set the name of a workload
s32 cellSpursWorkloadAttributeSetName(vm::ptr<CellSpursWorkloadAttribute> attr, vm::cptr<char> nameClass, vm::cptr<char> nameInstance) s32 cellSpursWorkloadAttributeSetName(vm::ptr<CellSpursWorkloadAttribute> attr, vm::cptr<char> nameClass, vm::cptr<char> nameInstance)
{ {
cellSpurs.warning("cellSpursWorkloadAttributeSetName(attr=*0x%x, nameClass=*0x%x, nameInstance=*0x%x)", attr, nameClass, nameInstance); cellSpurs.warning("cellSpursWorkloadAttributeSetName(attr=*0x%x, nameClass=%s, nameInstance=%s)", attr, nameClass, nameInstance);
if (!attr) if (!attr)
{ {
@ -3623,7 +3623,7 @@ s32 cellSpursCreateTaskWithAttribute()
s32 cellSpursTasksetAttributeSetName(vm::ptr<CellSpursTasksetAttribute> attr, vm::cptr<char> name) s32 cellSpursTasksetAttributeSetName(vm::ptr<CellSpursTasksetAttribute> attr, vm::cptr<char> name)
{ {
cellSpurs.warning("cellSpursTasksetAttributeSetName(attr=*0x%x, name=*0x%x)", attr, name); cellSpurs.warning("cellSpursTasksetAttributeSetName(attr=*0x%x, name=%s)", attr, name);
if (!attr || !name) if (!attr || !name)
{ {

View File

@ -103,28 +103,28 @@ s32 npDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
s32 sceNpDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path) s32 sceNpDrmIsAvailable(u32 k_licensee_addr, vm::cptr<char> drm_path)
{ {
sceNp.warning("sceNpDrmIsAvailable(k_licensee=*0x%x, drm_path=*0x%x)", k_licensee_addr, drm_path); sceNp.warning("sceNpDrmIsAvailable(k_licensee=*0x%x, drm_path=%s)", k_licensee_addr, drm_path);
return npDrmIsAvailable(k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path);
} }
s32 sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::cptr<char> drm_path) s32 sceNpDrmIsAvailable2(u32 k_licensee_addr, vm::cptr<char> drm_path)
{ {
sceNp.warning("sceNpDrmIsAvailable2(k_licensee=*0x%x, drm_path=*0x%x)", k_licensee_addr, drm_path); sceNp.warning("sceNpDrmIsAvailable2(k_licensee=*0x%x, drm_path=%s)", k_licensee_addr, drm_path);
return npDrmIsAvailable(k_licensee_addr, drm_path); return npDrmIsAvailable(k_licensee_addr, drm_path);
} }
s32 sceNpDrmVerifyUpgradeLicense(vm::cptr<char> content_id) s32 sceNpDrmVerifyUpgradeLicense(vm::cptr<char> content_id)
{ {
sceNp.todo("sceNpDrmVerifyUpgradeLicense(content_id=*0x%x)", content_id); sceNp.todo("sceNpDrmVerifyUpgradeLicense(content_id=%s)", content_id);
return CELL_OK; return CELL_OK;
} }
s32 sceNpDrmVerifyUpgradeLicense2(vm::cptr<char> content_id) s32 sceNpDrmVerifyUpgradeLicense2(vm::cptr<char> content_id)
{ {
sceNp.todo("sceNpDrmVerifyUpgradeLicense2(content_id=*0x%x)", content_id); sceNp.todo("sceNpDrmVerifyUpgradeLicense2(content_id=%s)", content_id);
return CELL_OK; return CELL_OK;
} }
@ -135,9 +135,9 @@ s32 sceNpDrmExecuteGamePurchase()
return CELL_OK; return CELL_OK;
} }
s32 sceNpDrmGetTimelimit(vm::ptr<const char> path, vm::ptr<u64> time_remain) s32 sceNpDrmGetTimelimit(vm::cptr<char> path, vm::ptr<u64> time_remain)
{ {
sceNp.warning("sceNpDrmGetTimelimit(path=*0x%x, time_remain=*0x%x)", path, time_remain); sceNp.warning("sceNpDrmGetTimelimit(path=%s, time_remain=*0x%x)", path, time_remain);
*time_remain = 0x7FFFFFFFFFFFFFFFULL; *time_remain = 0x7FFFFFFFFFFFFFFFULL;

View File

@ -19,7 +19,7 @@ struct HeapInfo
u32 _sys_heap_create_heap(vm::cptr<char> name, u32 arg2, u32 arg3, u32 arg4) u32 _sys_heap_create_heap(vm::cptr<char> name, u32 arg2, u32 arg3, u32 arg4)
{ {
sysPrxForUser.warning("_sys_heap_create_heap(name=*0x%x, arg2=0x%x, arg3=0x%x, arg4=0x%x)", name, arg2, arg3, arg4); sysPrxForUser.warning("_sys_heap_create_heap(name=%s, arg2=0x%x, arg3=0x%x, arg4=0x%x)", name, arg2, arg3, arg4);
return idm::make<HeapInfo>(name.get_ptr()); return idm::make<HeapInfo>(name.get_ptr());
} }

View File

@ -153,7 +153,7 @@ vm::ptr<void> _sys_memset(vm::ptr<void> dst, s32 value, u32 size)
{ {
sysPrxForUser.trace("_sys_memset(dst=*0x%x, value=%d, size=0x%x)", dst, value, size); sysPrxForUser.trace("_sys_memset(dst=*0x%x, value=%d, size=0x%x)", dst, value, size);
memset(dst.get_ptr(), value, size); std::memset(dst.get_ptr(), value, size);
return dst; return dst;
} }
@ -162,7 +162,7 @@ vm::ptr<void> _sys_memcpy(vm::ptr<void> dst, vm::cptr<void> src, u32 size)
{ {
sysPrxForUser.trace("_sys_memcpy(dst=*0x%x, src=*0x%x, size=0x%x)", dst, src, size); sysPrxForUser.trace("_sys_memcpy(dst=*0x%x, src=*0x%x, size=0x%x)", dst, src, size);
memcpy(dst.get_ptr(), src.get_ptr(), size); std::memcpy(dst.get_ptr(), src.get_ptr(), size);
return dst; return dst;
} }
@ -171,7 +171,7 @@ s32 _sys_memcmp(vm::cptr<void> buf1, vm::cptr<void> buf2, u32 size)
{ {
sysPrxForUser.trace("_sys_memcmp(buf1=*0x%x, buf2=*0x%x, size=%d)", buf1, buf2, size); sysPrxForUser.trace("_sys_memcmp(buf1=*0x%x, buf2=*0x%x, size=%d)", buf1, buf2, size);
return memcmp(buf1.get_ptr(), buf2.get_ptr(), size); return std::memcmp(buf1.get_ptr(), buf2.get_ptr(), size);
} }
s32 _sys_memchr() s32 _sys_memchr()
@ -183,88 +183,76 @@ vm::ptr<void> _sys_memmove(vm::ptr<void> dst, vm::cptr<void> src, u32 size)
{ {
sysPrxForUser.trace("_sys_memmove(dst=*0x%x, src=*0x%x, size=%d)", dst, src, size); sysPrxForUser.trace("_sys_memmove(dst=*0x%x, src=*0x%x, size=%d)", dst, src, size);
memmove(dst.get_ptr(), src.get_ptr(), size); std::memmove(dst.get_ptr(), src.get_ptr(), size);
return dst; return dst;
} }
s64 _sys_strlen(vm::cptr<char> str) s64 _sys_strlen(vm::cptr<char> str)
{ {
sysPrxForUser.trace("_sys_strlen(str=*0x%x)", str); sysPrxForUser.trace("_sys_strlen(str=%s)", str);
return strlen(str.get_ptr()); return std::strlen(str.get_ptr());
} }
s32 _sys_strcmp(vm::cptr<char> str1, vm::cptr<char> str2) s32 _sys_strcmp(vm::cptr<char> str1, vm::cptr<char> str2)
{ {
sysPrxForUser.trace("_sys_strcmp(str1=*0x%x, str2=*0x%x)", str1, str2); sysPrxForUser.trace("_sys_strcmp(str1=%s, str2=%s)", str1, str2);
return strcmp(str1.get_ptr(), str2.get_ptr()); return std::strcmp(str1.get_ptr(), str2.get_ptr());
} }
s32 _sys_strncmp(vm::cptr<char> str1, vm::cptr<char> str2, s32 max) s32 _sys_strncmp(vm::cptr<char> str1, vm::cptr<char> str2, s32 max)
{ {
sysPrxForUser.trace("_sys_strncmp(str1=*0x%x, str2=*0x%x, max=%d)", str1, str2, max); sysPrxForUser.trace("_sys_strncmp(str1=%s, str2=%s, max=%d)", str1, str2, max);
return strncmp(str1.get_ptr(), str2.get_ptr(), max); return std::strncmp(str1.get_ptr(), str2.get_ptr(), max);
} }
vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::cptr<char> source) vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::cptr<char> source)
{ {
sysPrxForUser.trace("_sys_strcat(dest=*0x%x, source=*0x%x)", dest, source); sysPrxForUser.trace("_sys_strcat(dest=*0x%x, source=%s)", dest, source);
if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) VERIFY(std::strcat(dest.get_ptr(), source.get_ptr()) == dest.get_ptr());
{
fmt::throw_exception("Unexpected strcat() result" HERE);
}
return dest; return dest;
} }
vm::cptr<char> _sys_strchr(vm::cptr<char> str, s32 ch) vm::cptr<char> _sys_strchr(vm::cptr<char> str, s32 ch)
{ {
sysPrxForUser.trace("_sys_strchr(str=*0x%x, ch=0x%x)", str, ch); sysPrxForUser.trace("_sys_strchr(str=%s, ch=0x%x)", str, ch);
return vm::cptr<char>::make(vm::get_addr(strchr(str.get_ptr(), ch))); return vm::cptr<char>::make(vm::get_addr(strchr(str.get_ptr(), ch)));
} }
vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::cptr<char> source, u32 len) vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::cptr<char> source, u32 len)
{ {
sysPrxForUser.trace("_sys_strncat(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); sysPrxForUser.trace("_sys_strncat(dest=*0x%x, source=%s, len=%d)", dest, source, len);
if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) VERIFY(std::strncat(dest.get_ptr(), source.get_ptr(), len) == dest.get_ptr());
{
fmt::throw_exception("Unexpected strncat() result" HERE);
}
return dest; return dest;
} }
vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::cptr<char> source) vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::cptr<char> source)
{ {
sysPrxForUser.trace("_sys_strcpy(dest=*0x%x, source=*0x%x)", dest, source); sysPrxForUser.trace("_sys_strcpy(dest=*0x%x, source=%s)", dest, source);
if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr()) VERIFY(std::strcpy(dest.get_ptr(), source.get_ptr()) == dest.get_ptr());
{
fmt::throw_exception("Unexpected strcpy() result" HERE);
}
return dest; return dest;
} }
vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::cptr<char> source, u32 len) vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::cptr<char> source, u32 len)
{ {
sysPrxForUser.trace("_sys_strncpy(dest=*0x%x, source=*0x%x, len=%d)", dest, source, len); sysPrxForUser.trace("_sys_strncpy(dest=*0x%x, source=%s, len=%d)", dest, source, len);
if (!dest || !source) if (!dest || !source)
{ {
return vm::null; return vm::null;
} }
if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr()) VERIFY(std::strncpy(dest.get_ptr(), source.get_ptr(), len) == dest.get_ptr());
{
fmt::throw_exception("Unexpected strncpy() result" HERE);
}
return dest; return dest;
} }
@ -314,12 +302,10 @@ s32 _sys_free(u32 addr)
s32 _sys_snprintf(ppu_thread& ppu, vm::ptr<char> dst, u32 count, vm::cptr<char> fmt, ppu_va_args_t va_args) s32 _sys_snprintf(ppu_thread& ppu, vm::ptr<char> dst, u32 count, vm::cptr<char> fmt, ppu_va_args_t va_args)
{ {
sysPrxForUser.warning("_sys_snprintf(dst=*0x%x, count=%d, fmt=*0x%x, ...)", dst, count, fmt); sysPrxForUser.warning("_sys_snprintf(dst=*0x%x, count=%d, fmt=%s, ...)", dst, count, fmt);
std::string result = ps3_fmt(ppu, fmt, va_args.count); std::string result = ps3_fmt(ppu, fmt, va_args.count);
sysPrxForUser.warning("*** '%s' -> '%s'", fmt.get_ptr(), result);
if (!count) if (!count)
{ {
return 0; // ??? return 0; // ???
@ -336,7 +322,7 @@ s32 _sys_snprintf(ppu_thread& ppu, vm::ptr<char> dst, u32 count, vm::cptr<char>
s32 _sys_printf(ppu_thread& ppu, vm::cptr<char> fmt, ppu_va_args_t va_args) s32 _sys_printf(ppu_thread& ppu, vm::cptr<char> fmt, ppu_va_args_t va_args)
{ {
sysPrxForUser.warning("_sys_printf(fmt=*0x%x, ...)", fmt); sysPrxForUser.warning("_sys_printf(fmt=%s, ...)", fmt);
if (g_tty) if (g_tty)
{ {

View File

@ -324,7 +324,7 @@ namespace sys_net
u32 inet_addr(vm::cptr<char> cp) u32 inet_addr(vm::cptr<char> cp)
{ {
libnet.warning("inet_addr(cp=*0x%x)", cp); libnet.warning("inet_addr(cp=%s)", cp);
return htonl(::inet_addr(cp.get_ptr())); // return a big-endian IP address (WTF? function should return LITTLE-ENDIAN value) return htonl(::inet_addr(cp.get_ptr())); // return a big-endian IP address (WTF? function should return LITTLE-ENDIAN value)
} }
@ -374,7 +374,7 @@ namespace sys_net
vm::cptr<char> inet_ntop(s32 af, vm::ptr<void> src, vm::ptr<char> dst, u32 size) vm::cptr<char> inet_ntop(s32 af, vm::ptr<void> src, vm::ptr<char> dst, u32 size)
{ {
libnet.warning("inet_ntop(af=%d, src=*0x%x, dst=*0x%x, size=%d)", af, src, dst, size); libnet.warning("inet_ntop(af=%d, src=%s, dst=*0x%x, size=%d)", af, src, dst, size);
const char* result = ::inet_ntop(af, src.get_ptr(), dst.get_ptr(), size); const char* result = ::inet_ntop(af, src.get_ptr(), dst.get_ptr(), size);
if (result == nullptr) if (result == nullptr)
@ -387,7 +387,7 @@ namespace sys_net
s32 inet_pton(s32 af, vm::cptr<char> src, vm::ptr<char> dst) s32 inet_pton(s32 af, vm::cptr<char> src, vm::ptr<char> dst)
{ {
libnet.warning("inet_pton(af=%d, src=*0x%x, dst=*0x%x)", af, src, dst); libnet.warning("inet_pton(af=%d, src=%s, dst=*0x%x)", af, src, dst);
return ::inet_pton(af, src.get_ptr(), dst.get_ptr()); return ::inet_pton(af, src.get_ptr(), dst.get_ptr());
} }

View File

@ -14,7 +14,7 @@ extern void ppu_free_tls(u32 addr);
s32 sys_ppu_thread_create(vm::ptr<u64> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname) s32 sys_ppu_thread_create(vm::ptr<u64> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname)
{ {
sysPrxForUser.warning("sys_ppu_thread_create(thread_id=*0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=*0x%x)", sysPrxForUser.warning("sys_ppu_thread_create(thread_id=*0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=%s)",
thread_id, entry, arg, prio, stacksize, flags, threadname); thread_id, entry, arg, prio, stacksize, flags, threadname);
// Allocate TLS // Allocate TLS

View File

@ -65,13 +65,12 @@ s32 sys_spu_image_close(vm::ptr<sys_spu_image_t> img)
s32 sys_raw_spu_load(s32 id, vm::cptr<char> path, vm::ptr<u32> entry) s32 sys_raw_spu_load(s32 id, vm::cptr<char> path, vm::ptr<u32> entry)
{ {
sysPrxForUser.warning("sys_raw_spu_load(id=%d, path=*0x%x, entry=*0x%x)", id, path, entry); sysPrxForUser.warning("sys_raw_spu_load(id=%d, path=%s, entry=*0x%x)", id, path, entry);
sysPrxForUser.warning("*** path = '%s'", path.get_ptr());
const fs::file f(vfs::get(path.get_ptr())); const fs::file f(vfs::get(path.get_ptr()));
if (!f) if (!f)
{ {
sysPrxForUser.error("sys_raw_spu_load() error: '%s' not found!", path.get_ptr()); sysPrxForUser.error("sys_raw_spu_load() error: %s not found!", path);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -80,7 +79,7 @@ s32 sys_raw_spu_load(s32 id, vm::cptr<char> path, vm::ptr<u32> entry)
if (hdr.CheckMagic()) if (hdr.CheckMagic())
{ {
fmt::throw_exception("sys_raw_spu_load() error: '%s' is encrypted! Try to decrypt it manually and try again.", path.get_ptr()); fmt::throw_exception("sys_raw_spu_load() error: %s is encrypted! Try to decrypt it manually and try again.", path);
} }
f.seek(0); f.seek(0);

View File

@ -54,12 +54,11 @@ ppu_error_code sys_fs_test(u32 arg1, u32 arg2, vm::ptr<u32> arg3, u32 arg4, vm::
ppu_error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size) ppu_error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32 mode, vm::cptr<void> arg, u64 size)
{ {
sys_fs.warning("sys_fs_open(path=*0x%x, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size); sys_fs.warning("sys_fs_open(path=%s, flags=%#o, fd=*0x%x, mode=%#o, arg=*0x%x, size=0x%llx)", path, flags, fd, mode, arg, size);
sys_fs.warning("*** path = '%s'", path.get_ptr());
if (!path[0]) if (!path[0])
{ {
sys_fs.error("sys_fs_open('%s') failed: path is invalid", path.get_ptr()); sys_fs.error("sys_fs_open(%s) failed: path is invalid", path);
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -67,7 +66,7 @@ ppu_error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32
if (local_path.empty()) if (local_path.empty())
{ {
sys_fs.error("sys_fs_open('%s') failed: device not mounted", path.get_ptr()); sys_fs.error("sys_fs_open(%s) failed: device not mounted", path);
return CELL_ENOTMOUNTED; return CELL_ENOTMOUNTED;
} }
@ -75,7 +74,7 @@ ppu_error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32
if (fs::is_dir(local_path)) if (fs::is_dir(local_path))
{ {
sys_fs.error("sys_fs_open('%s') failed: path is a directory", path.get_ptr()); sys_fs.error("sys_fs_open(%s) failed: path is a directory", path);
return CELL_EISDIR; return CELL_EISDIR;
} }
@ -127,14 +126,14 @@ ppu_error_code sys_fs_open(vm::cptr<char> path, s32 flags, vm::ptr<u32> fd, s32
if (!test(open_mode)) if (!test(open_mode))
{ {
fmt::throw_exception("Invalid or unimplemented flags (%#o): '%s'" HERE, flags, path.get_ptr()); fmt::throw_exception("sys_fs_open(%s): Invalid or unimplemented flags: %#o" HERE, path, flags);
} }
fs::file file(local_path, open_mode); fs::file file(local_path, open_mode);
if (!file) if (!file)
{ {
sys_fs.error("sys_fs_open('%s'): failed to open file (flags=%#o, mode=%#o)", path.get_ptr(), flags, mode); sys_fs.error("sys_fs_open(%s): failed to open file (flags=%#o, mode=%#o)", path, flags, mode);
if (test(open_mode & fs::excl)) if (test(open_mode & fs::excl))
{ {
@ -220,14 +219,13 @@ ppu_error_code sys_fs_close(u32 fd)
ppu_error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd) ppu_error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd)
{ {
sys_fs.warning("sys_fs_opendir(path=*0x%x, fd=*0x%x)", path, fd); sys_fs.warning("sys_fs_opendir(path=%s, fd=*0x%x)", path, fd);
sys_fs.warning("*** path = '%s'", path.get_ptr());
const std::string& local_path = vfs::get(path.get_ptr()); const std::string& local_path = vfs::get(path.get_ptr());
if (local_path.empty()) if (local_path.empty())
{ {
sys_fs.error("sys_fs_opendir('%s') failed: device not mounted", path.get_ptr()); sys_fs.error("sys_fs_opendir(%s) failed: device not mounted", path);
return CELL_ENOTMOUNTED; return CELL_ENOTMOUNTED;
} }
@ -235,7 +233,7 @@ ppu_error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd)
if (fs::is_file(local_path)) if (fs::is_file(local_path))
{ {
sys_fs.error("sys_fs_opendir('%s') failed: path is a file", path.get_ptr()); sys_fs.error("sys_fs_opendir(%s) failed: path is a file", path);
return CELL_ENOTDIR; return CELL_ENOTDIR;
} }
@ -243,7 +241,7 @@ ppu_error_code sys_fs_opendir(vm::cptr<char> path, vm::ptr<u32> fd)
if (!dir) if (!dir)
{ {
sys_fs.error("sys_fs_opendir('%s'): failed to open directory", path.get_ptr()); sys_fs.error("sys_fs_opendir(%s): failed to open directory", path);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -306,14 +304,13 @@ ppu_error_code sys_fs_closedir(u32 fd)
ppu_error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb) ppu_error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
{ {
sys_fs.warning("sys_fs_stat(path=*0x%x, sb=*0x%x)", path, sb); sys_fs.warning("sys_fs_stat(path=%s, sb=*0x%x)", path, sb);
sys_fs.warning("*** path = '%s'", path.get_ptr());
const std::string& local_path = vfs::get(path.get_ptr()); const std::string& local_path = vfs::get(path.get_ptr());
if (local_path.empty()) if (local_path.empty())
{ {
sys_fs.warning("sys_fs_stat('%s') failed: not mounted", path.get_ptr()); sys_fs.warning("sys_fs_stat(%s) failed: not mounted", path);
return CELL_ENOTMOUNTED; return CELL_ENOTMOUNTED;
} }
@ -321,7 +318,7 @@ ppu_error_code sys_fs_stat(vm::cptr<char> path, vm::ptr<CellFsStat> sb)
if (!fs::stat(local_path, info)) if (!fs::stat(local_path, info))
{ {
sys_fs.error("sys_fs_stat('%s') failed: not found", path.get_ptr()); sys_fs.error("sys_fs_stat(%s) failed: not found", path);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -366,8 +363,7 @@ ppu_error_code sys_fs_fstat(u32 fd, vm::ptr<CellFsStat> sb)
ppu_error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode) ppu_error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode)
{ {
sys_fs.warning("sys_fs_mkdir(path=*0x%x, mode=%#o)", path, mode); sys_fs.warning("sys_fs_mkdir(path=%s, mode=%#o)", path, mode);
sys_fs.warning("*** path = '%s'", path.get_ptr());
const std::string& local_path = vfs::get(path.get_ptr()); const std::string& local_path = vfs::get(path.get_ptr());
@ -381,29 +377,26 @@ ppu_error_code sys_fs_mkdir(vm::cptr<char> path, s32 mode)
return CELL_EIO; // ??? return CELL_EIO; // ???
} }
sys_fs.notice("sys_fs_mkdir(): directory '%s' created", path.get_ptr()); sys_fs.notice("sys_fs_mkdir(): directory %s created", path);
return CELL_OK; return CELL_OK;
} }
ppu_error_code sys_fs_rename(vm::cptr<char> from, vm::cptr<char> to) ppu_error_code sys_fs_rename(vm::cptr<char> from, vm::cptr<char> to)
{ {
sys_fs.warning("sys_fs_rename(from=*0x%x, to=*0x%x)", from, to); sys_fs.warning("sys_fs_rename(from=%s, to=%s)", from, to);
sys_fs.warning("*** from = '%s'", from.get_ptr());
sys_fs.warning("*** to = '%s'", to.get_ptr());
if (!fs::rename(vfs::get(from.get_ptr()), vfs::get(to.get_ptr()))) if (!fs::rename(vfs::get(from.get_ptr()), vfs::get(to.get_ptr())))
{ {
return CELL_ENOENT; // ??? return CELL_ENOENT; // ???
} }
sys_fs.notice("sys_fs_rename(): '%s' renamed to '%s'", from.get_ptr(), to.get_ptr()); sys_fs.notice("sys_fs_rename(): %s renamed to %s", from, to);
return CELL_OK; return CELL_OK;
} }
ppu_error_code sys_fs_rmdir(vm::cptr<char> path) ppu_error_code sys_fs_rmdir(vm::cptr<char> path)
{ {
sys_fs.warning("sys_fs_rmdir(path=*0x%x)", path); sys_fs.warning("sys_fs_rmdir(path=%s)", path);
sys_fs.warning("*** path = '%s'", path.get_ptr());
if (!fs::remove_dir(vfs::get(path.get_ptr()))) if (!fs::remove_dir(vfs::get(path.get_ptr())))
{ {
@ -416,14 +409,13 @@ ppu_error_code sys_fs_rmdir(vm::cptr<char> path)
return CELL_EIO; // ??? return CELL_EIO; // ???
} }
sys_fs.notice("sys_fs_rmdir(): directory '%s' removed", path.get_ptr()); sys_fs.notice("sys_fs_rmdir(): directory %s removed", path);
return CELL_OK; return CELL_OK;
} }
ppu_error_code sys_fs_unlink(vm::cptr<char> path) ppu_error_code sys_fs_unlink(vm::cptr<char> path)
{ {
sys_fs.warning("sys_fs_unlink(path=*0x%x)", path); sys_fs.warning("sys_fs_unlink(path=%s)", path);
sys_fs.warning("*** path = '%s'", path.get_ptr());
if (!fs::remove_file(vfs::get(path.get_ptr()))) if (!fs::remove_file(vfs::get(path.get_ptr())))
{ {
@ -436,7 +428,7 @@ ppu_error_code sys_fs_unlink(vm::cptr<char> path)
return CELL_EIO; // ??? return CELL_EIO; // ???
} }
sys_fs.notice("sys_fs_unlink(): file '%s' deleted", path.get_ptr()); sys_fs.notice("sys_fs_unlink(): file %s deleted", path);
return CELL_OK; return CELL_OK;
} }
@ -540,8 +532,7 @@ ppu_error_code sys_fs_fget_block_size(u32 fd, vm::ptr<u64> sector_size, vm::ptr<
ppu_error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4) ppu_error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_size, vm::ptr<u64> block_size, vm::ptr<u64> arg4)
{ {
sys_fs.todo("sys_fs_get_block_size(path=*0x%x, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", path, sector_size, block_size, arg4); sys_fs.todo("sys_fs_get_block_size(path=%s, sector_size=*0x%x, block_size=*0x%x, arg4=*0x%x, arg5=*0x%x)", path, sector_size, block_size, arg4);
sys_fs.todo("*** path = '%s'", path.get_ptr());
*sector_size = 4096; // ? *sector_size = 4096; // ?
*block_size = 4096; // ? *block_size = 4096; // ?
@ -551,8 +542,7 @@ ppu_error_code sys_fs_get_block_size(vm::cptr<char> path, vm::ptr<u64> sector_si
ppu_error_code sys_fs_truncate(vm::cptr<char> path, u64 size) ppu_error_code sys_fs_truncate(vm::cptr<char> path, u64 size)
{ {
sys_fs.warning("sys_fs_truncate(path=*0x%x, size=0x%llx)", path, size); sys_fs.warning("sys_fs_truncate(path=%s, size=0x%llx)", path, size);
sys_fs.warning("*** path = '%s'", path.get_ptr());
if (!fs::truncate_file(vfs::get(path.get_ptr()), size)) if (!fs::truncate_file(vfs::get(path.get_ptr()), size))
{ {
@ -597,8 +587,7 @@ ppu_error_code sys_fs_ftruncate(u32 fd, u64 size)
ppu_error_code sys_fs_chmod(vm::cptr<char> path, s32 mode) ppu_error_code sys_fs_chmod(vm::cptr<char> path, s32 mode)
{ {
sys_fs.todo("sys_fs_chmod(path=*0x%x, mode=%#o) -> CELL_OK", path, mode); sys_fs.todo("sys_fs_chmod(path=%s, mode=%#o) -> CELL_OK", path, mode);
sys_fs.todo("*** path = '%s'", path.get_ptr());
return CELL_OK; return CELL_OK;
} }

View File

@ -212,7 +212,7 @@ s32 sys_ppu_thread_restart(u32 thread_id)
s32 _sys_ppu_thread_create(vm::ptr<u64> thread_id, vm::ptr<ppu_thread_param_t> param, u64 arg, u64 unk, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname) s32 _sys_ppu_thread_create(vm::ptr<u64> thread_id, vm::ptr<ppu_thread_param_t> param, u64 arg, u64 unk, s32 prio, u32 stacksize, u64 flags, vm::cptr<char> threadname)
{ {
sys_ppu_thread.warning("_sys_ppu_thread_create(thread_id=*0x%x, param=*0x%x, arg=0x%llx, unk=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=*0x%x)", sys_ppu_thread.warning("_sys_ppu_thread_create(thread_id=*0x%x, param=*0x%x, arg=0x%llx, unk=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname=%s)",
thread_id, param, arg, unk, prio, stacksize, flags, threadname); thread_id, param, arg, unk, prio, stacksize, flags, threadname);
LV2_LOCK; LV2_LOCK;
@ -272,7 +272,7 @@ s32 sys_ppu_thread_start(u32 thread_id)
s32 sys_ppu_thread_rename(u32 thread_id, vm::cptr<char> name) s32 sys_ppu_thread_rename(u32 thread_id, vm::cptr<char> name)
{ {
sys_ppu_thread.todo("sys_ppu_thread_rename(thread_id=0x%x, name=*0x%x)", thread_id, name); sys_ppu_thread.todo("sys_ppu_thread_rename(thread_id=0x%x, name=%s)", thread_id, name);
LV2_LOCK; LV2_LOCK;

View File

@ -35,7 +35,7 @@ s32 prx_load_module(std::string path, u64 flags, vm::ptr<sys_prx_load_module_opt
s32 sys_prx_load_module(vm::cptr<char> path, u64 flags, vm::ptr<sys_prx_load_module_option_t> pOpt) s32 sys_prx_load_module(vm::cptr<char> path, u64 flags, vm::ptr<sys_prx_load_module_option_t> pOpt)
{ {
sys_prx.warning("sys_prx_load_module(path=*0x%x, flags=0x%llx, pOpt=*0x%x)", path, flags, pOpt); sys_prx.warning("sys_prx_load_module(path=%s, flags=0x%llx, pOpt=*0x%x)", path, flags, pOpt);
return prx_load_module(path.get_ptr(), flags, pOpt); return prx_load_module(path.get_ptr(), flags, pOpt);
} }
@ -157,8 +157,7 @@ s32 sys_prx_get_module_id_by_address()
s32 sys_prx_get_module_id_by_name(vm::cptr<char> name, u64 flags, vm::ptr<sys_prx_get_module_id_by_name_option_t> pOpt) s32 sys_prx_get_module_id_by_name(vm::cptr<char> name, u64 flags, vm::ptr<sys_prx_get_module_id_by_name_option_t> pOpt)
{ {
const char *realName = name.get_ptr(); sys_prx.todo("sys_prx_get_module_id_by_name(name=%s, flags=%d, pOpt=*0x%x)", name, flags, pOpt);
sys_prx.todo("sys_prx_get_module_id_by_name(name=%s, flags=%d, pOpt=*0x%x)", realName, flags, pOpt);
//if (realName == "?") ... //if (realName == "?") ...

View File

@ -56,12 +56,12 @@ s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
s32 sys_spu_image_open(vm::ptr<sys_spu_image_t> img, vm::cptr<char> path) s32 sys_spu_image_open(vm::ptr<sys_spu_image_t> img, vm::cptr<char> path)
{ {
sys_spu.warning("sys_spu_image_open(img=*0x%x, path=*0x%x)", img, path); sys_spu.warning("sys_spu_image_open(img=*0x%x, path=%s)", img, path);
const fs::file f(vfs::get(path.get_ptr())); const fs::file f(vfs::get(path.get_ptr()));
if (!f) if (!f)
{ {
sys_spu.error("sys_spu_image_open() error: '%s' not found!", path.get_ptr()); sys_spu.error("sys_spu_image_open() error: %s not found!", path);
return CELL_ENOENT; return CELL_ENOENT;
} }
@ -70,7 +70,7 @@ s32 sys_spu_image_open(vm::ptr<sys_spu_image_t> img, vm::cptr<char> path)
if (hdr.CheckMagic()) if (hdr.CheckMagic())
{ {
fmt::throw_exception("sys_spu_image_open() error: '%s' is encrypted! Try to decrypt it manually and try again.", path.get_ptr()); fmt::throw_exception("sys_spu_image_open() error: %s is encrypted! Try to decrypt it manually and try again.", path);
} }
f.seek(0); f.seek(0);
@ -150,7 +150,7 @@ s32 sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_num, vm
return CELL_EBUSY; return CELL_EBUSY;
} }
*thread = spu_thread_initialize(group_id, spu_num, img, attr->name ? std::string(attr->name.get_ptr(), attr->name_len) : "", attr->option, arg->arg1, arg->arg2, arg->arg3, arg->arg4); *thread = spu_thread_initialize(group_id, spu_num, img, attr->name ? std::string(attr->name.get_ptr(), attr->name_len - 1) : "", attr->option, arg->arg1, arg->arg2, arg->arg3, arg->arg4);
return CELL_OK; return CELL_OK;
} }
@ -223,7 +223,7 @@ s32 sys_spu_thread_group_create(vm::ptr<u32> id, u32 num, s32 prio, vm::ptr<sys_
sys_spu.todo("Unsupported SPU Thread Group type (0x%x)", attr->type); sys_spu.todo("Unsupported SPU Thread Group type (0x%x)", attr->type);
} }
*id = idm::make<lv2_spu_group_t>(std::string{ attr->name.get_ptr(), attr->nsize - 1 }, num, prio, attr->type, attr->ct); *id = idm::make<lv2_spu_group_t>(std::string(attr->name.get_ptr(), attr->nsize - 1), num, prio, attr->type, attr->ct);
return CELL_OK; return CELL_OK;
} }

View File

@ -1,11 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "Memory.h" #include "Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "Utilities/Thread.h" #include "Utilities/Thread.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/Cell/SPUThread.h"
#include "Emu/PSP2/ARMv7Thread.h"
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
@ -822,3 +818,56 @@ namespace vm
throw access_violation(addr, cause); throw access_violation(addr, cause);
} }
} }
void fmt_class_string<vm::_ptr_base<const void>>::format(std::string& out, u64 arg)
{
fmt_class_string<u32>::format(out, arg);
}
void fmt_class_string<vm::_ptr_base<const char>>::format(std::string& out, u64 arg)
{
// Special case (may be allowed for some arguments)
if (arg == 0)
{
out += u8"«NULL»";
return;
}
// Filter certainly invalid addresses (TODO)
if (arg < 0x10000 || arg >= 0xf0000000)
{
out += u8"«INVALID_ADDRESS:";
fmt_class_string<u32>::format(out, arg);
out += u8"»";
return;
}
const auto start = out.size();
try
{
out += u8"";
for (vm::_ptr_base<const volatile char> ptr = vm::cast(arg);; ptr++)
{
if (const char ch = *ptr)
{
out += ch;
}
else
{
break;
}
}
out += u8"";
}
catch (const vm::access_violation&)
{
// Recover from invalid memory access
out.resize(start);
out += u8"«INVALID_ADDRESS:";
fmt_class_string<u32>::format(out, arg);
out += u8"»";
}
}

View File

@ -494,10 +494,34 @@ struct to_se<vm::_ptr_base<T, AT>, Se>
template<typename T, typename AT> template<typename T, typename AT>
struct fmt_unveil<vm::_ptr_base<T, AT>, void> struct fmt_unveil<vm::_ptr_base<T, AT>, void>
{ {
using type = typename fmt_unveil<AT>::type; using type = vm::_ptr_base<T>; // Use only T, ignoring AT
static inline auto get(const vm::_ptr_base<T, AT>& arg) static inline auto get(const vm::_ptr_base<T, AT>& arg)
{ {
return fmt_unveil<AT>::get(arg.addr()); return fmt_unveil<AT>::get(arg.addr());
} }
}; };
template<>
struct fmt_class_string<vm::_ptr_base<const void>, void>
{
static void format(std::string& out, u64 arg);
};
template<typename T>
struct fmt_class_string<vm::_ptr_base<T>, void> : fmt_class_string<vm::_ptr_base<const void>, void>
{
// Classify all pointers as const void*
};
template<>
struct fmt_class_string<vm::_ptr_base<const char>, void>
{
static void format(std::string& out, u64 arg);
};
template<>
struct fmt_class_string<vm::_ptr_base<char>, void> : fmt_class_string<vm::_ptr_base<const char>>
{
// Classify char* as const char*
};

View File

@ -90,7 +90,7 @@ s32 sceKernelGetMemBlockInfoByAddr(vm::ptr<void> vbase, vm::ptr<SceKernelMemBloc
arm_error_code sceKernelCreateThread(vm::cptr<char> pName, vm::ptr<SceKernelThreadEntry> entry, s32 initPriority, u32 stackSize, u32 attr, s32 cpuAffinityMask, vm::cptr<SceKernelThreadOptParam> pOptParam) arm_error_code sceKernelCreateThread(vm::cptr<char> pName, vm::ptr<SceKernelThreadEntry> entry, s32 initPriority, u32 stackSize, u32 attr, s32 cpuAffinityMask, vm::cptr<SceKernelThreadOptParam> pOptParam)
{ {
sceLibKernel.warning("sceKernelCreateThread(pName=*0x%x, entry=*0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam=*0x%x)", sceLibKernel.warning("sceKernelCreateThread(pName=%s, entry=*0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam=*0x%x)",
pName, entry, initPriority, stackSize, attr, cpuAffinityMask, pOptParam); pName, entry, initPriority, stackSize, attr, cpuAffinityMask, pOptParam);
const auto thread = idm::make_ptr<ARMv7Thread>(pName.get_ptr()); const auto thread = idm::make_ptr<ARMv7Thread>(pName.get_ptr());
@ -738,7 +738,7 @@ template<> DECLARE(psp2_event_flag::ipc::g_ipc) {};
arm_error_code sceKernelCreateEventFlag(vm::cptr<char> pName, u32 attr, u32 initPattern, vm::cptr<SceKernelEventFlagOptParam> pOptParam) arm_error_code sceKernelCreateEventFlag(vm::cptr<char> pName, u32 attr, u32 initPattern, vm::cptr<SceKernelEventFlagOptParam> pOptParam)
{ {
sceLibKernel.error("sceKernelCreateEventFlag(pName=*0x%x, attr=0x%x, initPattern=0x%x, pOptParam=*0x%x)", pName, attr, initPattern, pOptParam); sceLibKernel.error("sceKernelCreateEventFlag(pName=%s, attr=0x%x, initPattern=0x%x, pOptParam=*0x%x)", pName, attr, initPattern, pOptParam);
// Create EVF // Create EVF
auto evf = std::make_shared<psp2_event_flag>(pName.get_ptr(), attr, initPattern); auto evf = std::make_shared<psp2_event_flag>(pName.get_ptr(), attr, initPattern);
@ -778,7 +778,7 @@ arm_error_code sceKernelDeleteEventFlag(s32 evfId)
arm_error_code sceKernelOpenEventFlag(vm::cptr<char> pName) arm_error_code sceKernelOpenEventFlag(vm::cptr<char> pName)
{ {
sceLibKernel.error("sceKernelOpenEventFlag(pName=*0x%x)", pName); sceLibKernel.error("sceKernelOpenEventFlag(pName=%s)", pName);
const auto evf = psp2_event_flag::ipc::get(pName.get_ptr()); const auto evf = psp2_event_flag::ipc::get(pName.get_ptr());
@ -1019,7 +1019,7 @@ arm_error_code sceKernelGetEventFlagInfo(s32 evfId, vm::ptr<SceKernelEventFlagIn
arm_error_code sceKernelCreateSema(vm::cptr<char> pName, u32 attr, s32 initCount, s32 maxCount, vm::cptr<SceKernelSemaOptParam> pOptParam) arm_error_code sceKernelCreateSema(vm::cptr<char> pName, u32 attr, s32 initCount, s32 maxCount, vm::cptr<SceKernelSemaOptParam> pOptParam)
{ {
sceLibKernel.error("sceKernelCreateSema(pName=*0x%x, attr=0x%x, initCount=%d, maxCount=%d, pOptParam=*0x%x)", pName, attr, initCount, maxCount, pOptParam); sceLibKernel.error("sceKernelCreateSema(pName=%s, attr=0x%x, initCount=%d, maxCount=%d, pOptParam=*0x%x)", pName, attr, initCount, maxCount, pOptParam);
return NOT_AN_ERROR(idm::make<psp2_semaphore>(pName.get_ptr(), attr, initCount, maxCount)); return NOT_AN_ERROR(idm::make<psp2_semaphore>(pName.get_ptr(), attr, initCount, maxCount));
} }
@ -1095,7 +1095,7 @@ s32 sceKernelGetSemaInfo(s32 semaId, vm::ptr<SceKernelSemaInfo> pInfo)
arm_error_code sceKernelCreateMutex(vm::cptr<char> pName, u32 attr, s32 initCount, vm::cptr<SceKernelMutexOptParam> pOptParam) arm_error_code sceKernelCreateMutex(vm::cptr<char> pName, u32 attr, s32 initCount, vm::cptr<SceKernelMutexOptParam> pOptParam)
{ {
sceLibKernel.error("sceKernelCreateMutex(pName=*0x%x, attr=0x%x, initCount=%d, pOptParam=*0x%x)", pName, attr, initCount, pOptParam); sceLibKernel.error("sceKernelCreateMutex(pName=%s, attr=0x%x, initCount=%d, pOptParam=*0x%x)", pName, attr, initCount, pOptParam);
return NOT_AN_ERROR(idm::make<psp2_mutex>(pName.get_ptr(), attr, initCount)); return NOT_AN_ERROR(idm::make<psp2_mutex>(pName.get_ptr(), attr, initCount));
} }
@ -1202,7 +1202,7 @@ s32 sceKernelGetLwMutexInfoById(s32 lwMutexId, vm::ptr<SceKernelLwMutexInfo> pIn
arm_error_code sceKernelCreateCond(vm::cptr<char> pName, u32 attr, s32 mutexId, vm::cptr<SceKernelCondOptParam> pOptParam) arm_error_code sceKernelCreateCond(vm::cptr<char> pName, u32 attr, s32 mutexId, vm::cptr<SceKernelCondOptParam> pOptParam)
{ {
sceLibKernel.error("sceKernelCreateCond(pName=*0x%x, attr=0x%x, mutexId=0x%x, pOptParam=*0x%x)", pName, attr, mutexId, pOptParam); sceLibKernel.error("sceKernelCreateCond(pName=%s, attr=0x%x, mutexId=0x%x, pOptParam=*0x%x)", pName, attr, mutexId, pOptParam);
const auto mutex = idm::get<psp2_mutex>(mutexId); const auto mutex = idm::get<psp2_mutex>(mutexId);

View File

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