mirror of
https://github.com/joel16/CMFileManager-PSP.git
synced 2024-11-23 03:39:42 +00:00
logs: Sanitize error codes
This commit is contained in:
parent
f0b9d624c5
commit
bb824a3071
@ -16,7 +16,7 @@ namespace Config {
|
||||
int len = snprintf(buf, 128, config_file, config_version, cfg.sort, cfg.dark_theme, cfg.dev_options);
|
||||
|
||||
if (R_FAILED(ret = FS::WriteFile("config.json", buf, len))) {
|
||||
Log::Error("Read config failed in Config_Save %08x\n", ret);
|
||||
Log::Error("Read config failed in Config_Save 0x%08x\n", ret);
|
||||
delete[] buf;
|
||||
return ret;
|
||||
}
|
||||
@ -51,7 +51,7 @@ namespace Config {
|
||||
char *buf = new char[size];
|
||||
|
||||
if (R_FAILED(ret = FS::ReadFile("config.json", buf, size))) {
|
||||
Log::Error("Read config failed in Config_Load %08x\n", ret);
|
||||
Log::Error("Read config failed in Config_Load 0x%08x\n", ret);
|
||||
delete[] buf;
|
||||
return ret;
|
||||
}
|
||||
|
@ -253,12 +253,12 @@ namespace FS {
|
||||
|
||||
#ifdef FS_DEBUG
|
||||
if (R_FAILED(ret = dir = sceIoDopen(path.c_str()))) {
|
||||
Log::Error("sceIoDopen(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("sceIoDopen(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
if (R_FAILED(ret = dir = pspIoOpenDir(path.c_str()))) {
|
||||
Log::Error("pspIoOpenDir(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("pspIoOpenDir(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
@ -455,12 +455,12 @@ namespace FS {
|
||||
|
||||
#ifdef FS_DEBUG
|
||||
if (R_FAILED(ret = dir = sceIoDopen(src_path.c_str()))) {
|
||||
Log::Error("sceIoDopen(%s) failed: %08x\n", src_path.c_str(), ret);
|
||||
Log::Error("sceIoDopen(%s) failed: 0x%08x\n", src_path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
if (R_FAILED(ret = dir = pspIoOpenDir(src_path.c_str()))) {
|
||||
Log::Error("pspIoOpenDir(%s) failed: %08x\n", src_path.c_str(), ret);
|
||||
Log::Error("pspIoOpenDir(%s) failed: 0x%08x\n", src_path.c_str(), ret);
|
||||
return dir;
|
||||
}
|
||||
#endif
|
||||
@ -602,7 +602,7 @@ namespace FS {
|
||||
#ifdef FS_DEBUG
|
||||
if (R_FAILED(ret = dir = sceIoDopen(path.c_str()))) {
|
||||
if (R_FAILED(ret = sceIoRemove(path.c_str()))) {
|
||||
Log::Error("sceIoRemove(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("sceIoRemove(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
scePowerUnlock(0);
|
||||
return ret;
|
||||
}
|
||||
@ -610,7 +610,7 @@ namespace FS {
|
||||
#else
|
||||
if (R_FAILED(ret = dir = pspIoOpenDir(path.c_str()))) {
|
||||
if (R_FAILED(ret = pspIoRemoveFile(path.c_str()))) {
|
||||
Log::Error("pspIoRemoveFile(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("pspIoRemoveFile(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
scePowerUnlock(0);
|
||||
return ret;
|
||||
}
|
||||
@ -645,7 +645,7 @@ namespace FS {
|
||||
if (FIO_S_ISDIR(entry.d_stat.st_mode)) {
|
||||
int result = FS::DeleteDirectoryRecursive(new_path);
|
||||
if (result <= 0) {
|
||||
Log::Error("FS::DeleteDirectoryRecursive(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("FS::DeleteDirectoryRecursive(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
#ifdef FS_DEBUG
|
||||
sceIoDclose(dir);
|
||||
#else
|
||||
@ -659,12 +659,12 @@ namespace FS {
|
||||
#ifdef FS_DEBUG
|
||||
int result = sceIoRemove(new_path.c_str());
|
||||
if (R_FAILED(result)) {
|
||||
Log::Error("sceIoRemove(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("sceIoRemove(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
sceIoDclose(dir);
|
||||
#else
|
||||
int result = pspIoRemoveFile(new_path.c_str());
|
||||
if (R_FAILED(result)) {
|
||||
Log::Error("pspIoRemoveFile(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("pspIoRemoveFile(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
pspIoCloseDir(dir);
|
||||
#endif
|
||||
scePowerUnlock(0);
|
||||
@ -683,12 +683,12 @@ namespace FS {
|
||||
|
||||
#ifdef FS_DEBUG
|
||||
if (R_FAILED(ret = sceIoRmdir(path.c_str()))) {
|
||||
Log::Error("sceIoRmdir(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("sceIoRmdir(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
if (R_FAILED(ret = pspIoRemoveDir(path.c_str()))) {
|
||||
Log::Error("pspIoRemoveDir(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("pspIoRemoveDir(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
@ -143,7 +143,7 @@ namespace CSO {
|
||||
SceUID file = 0;
|
||||
|
||||
if (R_FAILED(file = sceIoOpen(path.c_str(), PSP_O_RDONLY, 0))) {
|
||||
Log::Error("CSO::Read sceIoOpen(%s) failed: %08x\n", path.c_str(), file);
|
||||
Log::Error("CSO::Read sceIoOpen(%s) failed: 0x%08x\n", path.c_str(), file);
|
||||
return file;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ namespace ISO {
|
||||
SceUID file = 0;
|
||||
|
||||
if (R_FAILED(file = sceIoOpen(path.c_str(), PSP_O_RDONLY, 0))) {
|
||||
Log::Error("ISO::Read sceIoOpen(%s) failed: %08x\n", path.c_str(), file);
|
||||
Log::Error("ISO::Read sceIoOpen(%s) failed: 0x%08x\n", path.c_str(), file);
|
||||
return file;
|
||||
}
|
||||
|
||||
@ -402,14 +402,14 @@ namespace GameLauncher {
|
||||
|
||||
// Read the SFO header
|
||||
if (R_FAILED(ret = sceIoRead(file, sfo_data, sizeof(SFO)))) {
|
||||
Log::Error("GameLauncher::ReadSFOTitle sceIoRead sfo header failed: %08x\n", ret);
|
||||
Log::Error("GameLauncher::ReadSFOTitle sceIoRead sfo header failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Allocate memory to read the SFO block
|
||||
u8 *sfo_block = buffer + size;
|
||||
if (R_FAILED(ret = sceIoRead(file, sfo_block, size))) {
|
||||
Log::Error("GameLauncher::ReadSFOTitle sceIoRead sfo block failed: %08x\n", ret);
|
||||
Log::Error("GameLauncher::ReadSFOTitle sceIoRead sfo block failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ namespace GameLauncher {
|
||||
PBPHeader pbp_data = { { 0 } };
|
||||
|
||||
if (R_FAILED(ret = file = sceIoOpen(path.c_str(), PSP_O_RDONLY, 0777))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta sceIoOpen(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta sceIoOpen(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -475,7 +475,7 @@ namespace GameLauncher {
|
||||
if (meta->icon0_size) {
|
||||
meta->icon0_data = new u8[meta->icon0_size];
|
||||
if (R_FAILED(ret = sceIoRead(file, meta->icon0_data, meta->icon0_size))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta icon0 sceIoRead(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta icon0 sceIoRead(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -486,7 +486,7 @@ namespace GameLauncher {
|
||||
if (meta->icon1_size) {
|
||||
meta->icon1_data = new u8[meta->icon1_size];
|
||||
if (R_FAILED(ret = sceIoRead(file, meta->icon1_data, meta->icon1_size))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta icon1 sceIoRead(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta icon1 sceIoRead(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -497,7 +497,7 @@ namespace GameLauncher {
|
||||
if (meta->pic0_size) {
|
||||
meta->pic0_data = new u8[meta->pic0_size];
|
||||
if (R_FAILED(ret = sceIoRead(file, meta->pic0_data, meta->pic0_size))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta pic0 sceIoRead(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta pic0 sceIoRead(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -508,7 +508,7 @@ namespace GameLauncher {
|
||||
if (meta->pic1_size) {
|
||||
meta->pic1_data = new u8[meta->pic1_size];
|
||||
if (R_FAILED(ret = sceIoRead(file, meta->pic1_data, meta->pic1_size))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta pic1 sceIoRead(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta pic1 sceIoRead(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ namespace GameLauncher {
|
||||
if (meta->snd0_size) {
|
||||
meta->snd0_data = new u8[meta->snd0_size];
|
||||
if (R_FAILED(ret = sceIoRead(file, meta->snd0_data, meta->snd0_size))) {
|
||||
Log::Error("GameLauncher::GetEbootMeta snd0 sceIoRead(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("GameLauncher::GetEbootMeta snd0 sceIoRead(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -545,7 +545,7 @@ namespace GameLauncher {
|
||||
SceIoStat stat;
|
||||
|
||||
if (R_FAILED(ret = sceIoGetstat(path.c_str(), &stat))) {
|
||||
Log::Error("DisplayLauncher sceIoGetstat(%s) failed: %08x\n", path.c_str(), ret);
|
||||
Log::Error("DisplayLauncher sceIoGetstat(%s) failed: 0x%08x\n", path.c_str(), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace FTP {
|
||||
g2dFlip(G2D_VSYNC);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int InitNet(void) {
|
||||
|
@ -23,12 +23,12 @@ namespace Services {
|
||||
|
||||
int ret = 0;
|
||||
if (R_FAILED(ret = Config::Load())) {
|
||||
Log::Error("Config::Load failed: %08x\n", ret);
|
||||
Log::Error("Config::Load failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = intraFontInit())) {
|
||||
Log::Error("intraFontInit failed: %08x\n", ret);
|
||||
Log::Error("intraFontInit failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ namespace Textures {
|
||||
unsigned char *data = new unsigned char[size];
|
||||
|
||||
if (R_FAILED(ret = FS::ReadFile(path, data, size))) {
|
||||
Log::Error("LoadImage FS::ReadFile failed %08x\n", ret);
|
||||
Log::Error("LoadImage FS::ReadFile failed 0x%08x\n", ret);
|
||||
delete[] data;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -97,12 +97,12 @@ namespace Utils {
|
||||
SceUID modID = 0;
|
||||
|
||||
if (R_FAILED(ret = modID = kuKernelLoadModule(path, 0, nullptr))) {
|
||||
Log::Error("kuKernelLoadModule(%s) failed: %08x\n", path, ret);
|
||||
Log::Error("kuKernelLoadModule(%s) failed: 0x%08x\n", path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceKernelStartModule(modID, 0, nullptr, &status, nullptr))) {
|
||||
Log::Error("sceKernelStartModule(%s) failed: %08x\n", path, ret);
|
||||
Log::Error("sceKernelStartModule(%s) failed: 0x%08x\n", path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -125,17 +125,17 @@ namespace Utils {
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0))) {
|
||||
Log::Error("sceUsbStart(PSP_USBBUS_DRIVERNAME) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbStart(PSP_USBBUS_DRIVERNAME) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0))) {
|
||||
Log::Error("sceUsbStart(PSP_USBSTOR_DRIVERNAME) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbStart(PSP_USBSTOR_DRIVERNAME) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceUsbstorBootSetCapacity(0x800000))) {
|
||||
Log::Error("sceUsbstorBootSetCapacity(0x800000) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbstorBootSetCapacity(0x800000) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ namespace Utils {
|
||||
int ret = 0;
|
||||
|
||||
if (R_FAILED(ret = sceUsbActivate(0x1c8))) {
|
||||
Log::Error("sceUsbActivate(0x1c8) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbActivate(0x1c8) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -159,12 +159,12 @@ namespace Utils {
|
||||
int ret = 0;
|
||||
|
||||
if (R_FAILED(ret = sceUsbDeactivate(0x1c8))) {
|
||||
Log::Error("sceUsbActivate(0x1c8) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbActivate(0x1c8) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceIoDevctl("fatms0:", 0x0240D81E, nullptr, 0, nullptr, 0))) { // Avoid corrupted files
|
||||
Log::Error("sceIoDevctl(\"fatms0:\", 0x0240D81E, nullptr, 0, nullptr, 0) failed: %08x\n", ret);
|
||||
Log::Error("sceIoDevctl(\"fatms0:\", 0x0240D81E, nullptr, 0, nullptr, 0) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -182,17 +182,17 @@ namespace Utils {
|
||||
return ret;
|
||||
|
||||
if (R_FAILED(ret = sceUsbStop(PSP_USBSTOR_DRIVERNAME, 0, 0))) {
|
||||
Log::Error("sceUsbStop(PSP_USBSTOR_DRIVERNAME) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbStop(PSP_USBSTOR_DRIVERNAME) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = sceUsbStop(PSP_USBBUS_DRIVERNAME, 0, 0))) {
|
||||
Log::Error("sceUsbStop(PSP_USBBUS_DRIVERNAME) failed: %08x\n", ret);
|
||||
Log::Error("sceUsbStop(PSP_USBBUS_DRIVERNAME) failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = pspUsbDeviceFinishDevice())) {
|
||||
Log::Error("pspUsbDeviceFinishDevice() failed: %08x\n", ret);
|
||||
Log::Error("pspUsbDeviceFinishDevice() failed: 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ namespace Utils {
|
||||
param.key = "game";
|
||||
|
||||
if (R_FAILED(ret = sctrlKernelLoadExecVSHWithApitype(Utils::IsInternalStorage()? 0x152 : 0x141, path, ¶m))) {
|
||||
Log::Error("sctrlKernelLoadExecVSHWithApitype(%x, %s) failed: %08x\n", Utils::IsInternalStorage()? 0x152 : 0x141, path, ret);
|
||||
Log::Error("sctrlKernelLoadExecVSHWithApitype(%x, %s) failed: 0x%08x\n", Utils::IsInternalStorage()? 0x152 : 0x141, path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user