mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #19924 from hrydgard/more-log-cleanup
More log cleanup
This commit is contained in:
17 files changed
+166
-252
No files matched your search
+2
-3
@@ -774,8 +774,7 @@ static void CallSyscallWithoutFlags(const HLEFunction *info) {
|
||||
g_stackSize = 0;
|
||||
}
|
||||
|
||||
const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op)
|
||||
{
|
||||
const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op) {
|
||||
u32 callno = (op >> 6) & 0xFFFFF; //20 bits
|
||||
int funcnum = callno & 0xFFF;
|
||||
int modulenum = (callno & 0xFF000) >> 12;
|
||||
@@ -1000,7 +999,7 @@ void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line
|
||||
_dbg_assert_(hleFunc->argmask != nullptr);
|
||||
|
||||
// NOTE: For second stack level, we can't get arguments (unless we somehow get them from the host stack!)
|
||||
// Need to do something smart in hleCall.
|
||||
// Need to do something smart in hleCall. But it's better than printing function name and args from the wrong function.
|
||||
|
||||
if (stackSize == 1) {
|
||||
hleFormatLogArgs(formatted_args, sizeof(formatted_args), hleFunc->argmask);
|
||||
|
||||
+24
-43
@@ -430,12 +430,8 @@ void __CtrlShutdown()
|
||||
|
||||
static u32 sceCtrlSetSamplingCycle(u32 cycle)
|
||||
{
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlSetSamplingCycle(%u)", cycle);
|
||||
|
||||
if ((cycle > 0 && cycle < 5555) || cycle > 20000)
|
||||
{
|
||||
WARN_LOG(Log::sceCtrl, "SCE_KERNEL_ERROR_INVALID_VALUE=sceCtrlSetSamplingCycle(%u)", cycle);
|
||||
return SCE_KERNEL_ERROR_INVALID_VALUE;
|
||||
if ((cycle > 0 && cycle < 5555) || cycle > 20000) {
|
||||
return hleLogWarning(Log::sceCtrl, SCE_KERNEL_ERROR_INVALID_VALUE);
|
||||
}
|
||||
|
||||
u32 prev = ctrlCycle;
|
||||
@@ -446,68 +442,60 @@ static u32 sceCtrlSetSamplingCycle(u32 cycle)
|
||||
if (cycle > 0)
|
||||
CoreTiming::ScheduleEvent(usToCycles(ctrlCycle), ctrlTimer, 0);
|
||||
|
||||
return prev;
|
||||
return hleLogDebug(Log::sceCtrl, prev);
|
||||
}
|
||||
|
||||
static int sceCtrlGetSamplingCycle(u32 cyclePtr)
|
||||
{
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlGetSamplingCycle(%08x)", cyclePtr);
|
||||
if (Memory::IsValidAddress(cyclePtr))
|
||||
Memory::Write_U32(ctrlCycle, cyclePtr);
|
||||
return 0;
|
||||
Memory::WriteUnchecked_U32(ctrlCycle, cyclePtr);
|
||||
return hleLogDebug(Log::sceCtrl, 0);
|
||||
}
|
||||
|
||||
static u32 sceCtrlSetSamplingMode(u32 mode)
|
||||
{
|
||||
u32 retVal = 0;
|
||||
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlSetSamplingMode(%i)", mode);
|
||||
if (mode > 1)
|
||||
return SCE_KERNEL_ERROR_INVALID_MODE;
|
||||
return hleLogError(Log::sceCtrl, SCE_KERNEL_ERROR_INVALID_MODE);
|
||||
|
||||
retVal = analogEnabled == true ? CTRL_MODE_ANALOG : CTRL_MODE_DIGITAL;
|
||||
analogEnabled = mode == CTRL_MODE_ANALOG ? true : false;
|
||||
return retVal;
|
||||
return hleLogDebug(Log::sceCtrl, retVal);
|
||||
}
|
||||
|
||||
static int sceCtrlGetSamplingMode(u32 modePtr)
|
||||
{
|
||||
u32 retVal = analogEnabled == true ? CTRL_MODE_ANALOG : CTRL_MODE_DIGITAL;
|
||||
DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlGetSamplingMode(%08x)", retVal, modePtr);
|
||||
|
||||
if (Memory::IsValidAddress(modePtr))
|
||||
Memory::Write_U32(retVal, modePtr);
|
||||
Memory::WriteUnchecked_U32(retVal, modePtr);
|
||||
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceCtrl, 0);
|
||||
}
|
||||
|
||||
static int sceCtrlSetIdleCancelThreshold(int idleReset, int idleBack)
|
||||
{
|
||||
DEBUG_LOG(Log::sceCtrl, "FAKE sceCtrlSetIdleCancelThreshold(%d, %d)", idleReset, idleBack);
|
||||
|
||||
if (idleReset < -1 || idleBack < -1 || idleReset > 128 || idleBack > 128)
|
||||
return SCE_KERNEL_ERROR_INVALID_VALUE;
|
||||
return hleLogError(Log::sceCtrl, SCE_KERNEL_ERROR_INVALID_VALUE);
|
||||
|
||||
ctrlIdleReset = idleReset;
|
||||
ctrlIdleBack = idleBack;
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceCtrl, 0);
|
||||
}
|
||||
|
||||
static int sceCtrlGetIdleCancelThreshold(u32 idleResetPtr, u32 idleBackPtr)
|
||||
{
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlSetIdleCancelThreshold(%08x, %08x)", idleResetPtr, idleBackPtr);
|
||||
|
||||
if (idleResetPtr && !Memory::IsValidAddress(idleResetPtr))
|
||||
return SCE_KERNEL_ERROR_PRIV_REQUIRED;
|
||||
return hleLogError(Log::sceCtrl, SCE_KERNEL_ERROR_PRIV_REQUIRED);
|
||||
if (idleBackPtr && !Memory::IsValidAddress(idleBackPtr))
|
||||
return SCE_KERNEL_ERROR_PRIV_REQUIRED;
|
||||
return hleLogError(Log::sceCtrl, SCE_KERNEL_ERROR_PRIV_REQUIRED);
|
||||
|
||||
if (idleResetPtr)
|
||||
Memory::Write_U32(ctrlIdleReset, idleResetPtr);
|
||||
if (idleBackPtr)
|
||||
Memory::Write_U32(ctrlIdleBack, idleBackPtr);
|
||||
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceCtrl, 0);
|
||||
}
|
||||
|
||||
static int sceCtrlReadBufferPositive(u32 ctrlDataPtr, u32 nBufs)
|
||||
@@ -515,50 +503,43 @@ static int sceCtrlReadBufferPositive(u32 ctrlDataPtr, u32 nBufs)
|
||||
int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, false, false);
|
||||
hleEatCycles(330);
|
||||
if (done != 0) {
|
||||
DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlReadBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs);
|
||||
}
|
||||
else
|
||||
{
|
||||
return hleLogDebug(Log::sceCtrl, done);
|
||||
} else {
|
||||
waitingThreads.push_back(__KernelGetCurThread());
|
||||
__KernelWaitCurThread(WAITTYPE_CTRL, CTRL_WAIT_POSITIVE, ctrlDataPtr, 0, false, "ctrl buffer waited");
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlReadBufferPositive(%08x, %i) - waiting", ctrlDataPtr, nBufs);
|
||||
return hleLogDebug(Log::sceCtrl, done, "waiting");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
static int sceCtrlReadBufferNegative(u32 ctrlDataPtr, u32 nBufs)
|
||||
{
|
||||
int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, true, false);
|
||||
hleEatCycles(330);
|
||||
if (done != 0)
|
||||
{
|
||||
DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlReadBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs);
|
||||
if (done != 0) {
|
||||
return hleLogDebug(Log::sceCtrl, done);
|
||||
}
|
||||
else
|
||||
{
|
||||
waitingThreads.push_back(__KernelGetCurThread());
|
||||
__KernelWaitCurThread(WAITTYPE_CTRL, CTRL_WAIT_NEGATIVE, ctrlDataPtr, 0, false, "ctrl buffer waited");
|
||||
DEBUG_LOG(Log::sceCtrl, "sceCtrlReadBufferNegative(%08x, %i) - waiting", ctrlDataPtr, nBufs);
|
||||
return hleLogDebug(Log::sceCtrl, done, "waiting");
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
static int sceCtrlPeekBufferPositive(u32 ctrlDataPtr, u32 nBufs)
|
||||
{
|
||||
int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, false, true);
|
||||
// Some homebrew call this in a tight loop - so VERBOSE it is.
|
||||
VERBOSE_LOG(Log::sceCtrl, "%d=sceCtrlPeekBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs);
|
||||
hleEatCycles(330);
|
||||
return done;
|
||||
return hleLogVerbose(Log::sceCtrl, done);
|
||||
}
|
||||
|
||||
static int sceCtrlPeekBufferNegative(u32 ctrlDataPtr, u32 nBufs)
|
||||
{
|
||||
int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, true, true);
|
||||
// Some homebrew call this in a tight loop - so VERBOSE it is.
|
||||
VERBOSE_LOG(Log::sceCtrl, "%d=sceCtrlPeekBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs);
|
||||
hleEatCycles(330);
|
||||
return done;
|
||||
return hleLogVerbose(Log::sceCtrl, done);
|
||||
}
|
||||
|
||||
static void __CtrlWriteUserLatch(CtrlLatch *userLatch, int bufs) {
|
||||
@@ -619,11 +600,11 @@ void Register_sceCtrl_driver()
|
||||
}
|
||||
|
||||
u16 sceCtrlGetRightVibration() {
|
||||
return rightVibration;
|
||||
return hleNoLog(rightVibration);
|
||||
}
|
||||
|
||||
u16 sceCtrlGetLeftVibration() {
|
||||
return leftVibration;
|
||||
return hleNoLog(leftVibration);
|
||||
}
|
||||
|
||||
namespace SceCtrl {
|
||||
|
||||
+15
-26
@@ -38,8 +38,7 @@ static u32 buttonValue = PSP_SYSTEMPARAM_BUTTON_CIRCLE;
|
||||
static u32 umdPopup = PSP_UMD_POPUP_DISABLE;
|
||||
static u32 backlightOffTime;
|
||||
|
||||
void __ImposeInit()
|
||||
{
|
||||
void __ImposeInit() {
|
||||
language = g_Config.GetPSPLanguage();
|
||||
if (PSP_CoreParameter().compat.flags().EnglishOrJapaneseOnly) {
|
||||
if (language != PSP_SYSTEMPARAM_LANGUAGE_ENGLISH && language != PSP_SYSTEMPARAM_LANGUAGE_JAPANESE) {
|
||||
@@ -51,8 +50,7 @@ void __ImposeInit()
|
||||
backlightOffTime = 0;
|
||||
}
|
||||
|
||||
void __ImposeDoState(PointerWrap &p)
|
||||
{
|
||||
void __ImposeDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceImpose", 1);
|
||||
if (!s)
|
||||
return;
|
||||
@@ -65,12 +63,11 @@ void __ImposeDoState(PointerWrap &p)
|
||||
|
||||
static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr)
|
||||
{
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeGetBatteryIconStatus(%08x, %08x)", chargingPtr, iconStatusPtr);
|
||||
if (Memory::IsValidAddress(chargingPtr))
|
||||
Memory::Write_U32(PSP_IMPOSE_BATTICON_NONE, chargingPtr);
|
||||
Memory::WriteUnchecked_U32(PSP_IMPOSE_BATTICON_NONE, chargingPtr);
|
||||
if (Memory::IsValidAddress(iconStatusPtr))
|
||||
Memory::Write_U32(3, iconStatusPtr);
|
||||
return 0;
|
||||
Memory::WriteUnchecked_U32(3, iconStatusPtr);
|
||||
return hleLogDebug(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceImposeSetLanguageMode(u32 languageVal, u32 buttonVal) {
|
||||
@@ -82,41 +79,34 @@ static u32 sceImposeSetLanguageMode(u32 languageVal, u32 buttonVal) {
|
||||
return hleLogSuccessI(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr)
|
||||
{
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeGetLanguageMode(%08x, %08x)", languagePtr, btnPtr);
|
||||
static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr) {
|
||||
if (Memory::IsValidAddress(languagePtr))
|
||||
Memory::Write_U32(language, languagePtr);
|
||||
Memory::WriteUnchecked_U32(language, languagePtr);
|
||||
if (Memory::IsValidAddress(btnPtr))
|
||||
Memory::Write_U32(buttonValue, btnPtr);
|
||||
return 0;
|
||||
Memory::WriteUnchecked_U32(buttonValue, btnPtr);
|
||||
return hleLogDebug(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceImposeSetUMDPopup(int mode) {
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeSetUMDPopup(%i)", mode);
|
||||
umdPopup = mode;
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceImposeGetUMDPopup() {
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeGetUMDPopup()");
|
||||
return umdPopup;
|
||||
return hleLogDebug(Log::sceUtility, umdPopup);
|
||||
}
|
||||
|
||||
static u32 sceImposeSetBacklightOffTime(int time) {
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeSetBacklightOffTime(%i)", time);
|
||||
backlightOffTime = time;
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceImposeGetBacklightOffTime() {
|
||||
DEBUG_LOG(Log::sceUtility, "sceImposeGetBacklightOffTime()");
|
||||
return backlightOffTime;
|
||||
return hleLogDebug(Log::sceUtility, backlightOffTime);
|
||||
}
|
||||
|
||||
//OSD stuff? home button?
|
||||
const HLEFunction sceImpose[] =
|
||||
{
|
||||
const HLEFunction sceImpose[] = {
|
||||
{0X36AA6E91, &WrapU_UU<sceImposeSetLanguageMode>, "sceImposeSetLanguageMode", 'i', "ii"},
|
||||
{0X381BD9E7, nullptr, "sceImposeHomeButton", '?', "" },
|
||||
{0X0F341BE4, nullptr, "sceImposeGetHomePopup", '?', "" },
|
||||
@@ -134,7 +124,6 @@ const HLEFunction sceImpose[] =
|
||||
{0XFF1A2F07, nullptr, "sceImpose_FF1A2F07", '?', "" },
|
||||
};
|
||||
|
||||
void Register_sceImpose()
|
||||
{
|
||||
void Register_sceImpose() {
|
||||
RegisterModule("sceImpose", ARRAY_SIZE(sceImpose), sceImpose);
|
||||
}
|
||||
+32
-49
@@ -871,23 +871,19 @@ static u32 sceIoAssign(u32 alias_addr, u32 physical_addr, u32 filesystem_addr, i
|
||||
|
||||
static u32 sceIoUnassign(const char *alias)
|
||||
{
|
||||
WARN_LOG_REPORT(Log::sceIo, "sceIoUnassign(%s)", alias);
|
||||
return 0;
|
||||
return hleLogWarning(Log::sceIo, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
static u32 sceKernelStdin() {
|
||||
DEBUG_LOG(Log::sceIo, "%d=sceKernelStdin()", PSP_STDIN);
|
||||
return PSP_STDIN;
|
||||
return hleLogDebug(Log::sceIo, PSP_STDIN);
|
||||
}
|
||||
|
||||
static u32 sceKernelStdout() {
|
||||
DEBUG_LOG(Log::sceIo, "%d=sceKernelStdout()", PSP_STDOUT);
|
||||
return PSP_STDOUT;
|
||||
return hleLogDebug(Log::sceIo, PSP_STDOUT);
|
||||
}
|
||||
|
||||
static u32 sceKernelStderr() {
|
||||
DEBUG_LOG(Log::sceIo, "%d=sceKernelStderr()", PSP_STDERR);
|
||||
return PSP_STDERR;
|
||||
return hleLogDebug(Log::sceIo, PSP_STDERR);
|
||||
}
|
||||
|
||||
u64 __IoCompleteAsyncIO(FileNode *f) {
|
||||
@@ -1133,14 +1129,16 @@ static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) {
|
||||
static u32 sceIoRead(int id, u32 data_addr, int size) {
|
||||
u32 error;
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (id > 2 && f != NULL) {
|
||||
if (!f) {
|
||||
return hleLogError(Log::sceIo, error, "bad file descriptor");
|
||||
}
|
||||
|
||||
if (id > 2) {
|
||||
if (!__KernelIsDispatchEnabled()) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled");
|
||||
}
|
||||
if (__IsInInterrupt()) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): inside interrupt", id, data_addr, size);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,12 +1146,10 @@ static u32 sceIoRead(int id, u32 data_addr, int size) {
|
||||
int us;
|
||||
bool complete = __IoRead(result, id, data_addr, size, us);
|
||||
if (!complete) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): deferring result", id, data_addr, size);
|
||||
|
||||
__IoSchedSync(f, id, us);
|
||||
__KernelWaitCurThread(WAITTYPE_IO, id, 0, 0, false, "io read");
|
||||
f->waitingSyncThreads.push_back(__KernelGetCurThread());
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0, "deferring result");
|
||||
} else if (result >= 0) {
|
||||
return hleDelayResult(hleLogDebug(Log::ME, result), "io read", us);
|
||||
} else {
|
||||
@@ -1261,12 +1257,10 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) {
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (id > 2 && f != NULL) {
|
||||
if (!__KernelIsDispatchEnabled()) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled");
|
||||
}
|
||||
if (__IsInInterrupt()) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): inside interrupt", id, data_addr, size);
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1274,18 +1268,16 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) {
|
||||
int us;
|
||||
bool complete = __IoWrite(result, id, data_addr, size, us);
|
||||
if (!complete) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): deferring result", id, data_addr, size);
|
||||
|
||||
__IoSchedSync(f, id, us);
|
||||
__KernelWaitCurThread(WAITTYPE_IO, id, 0, 0, false, "io write");
|
||||
f->waitingSyncThreads.push_back(__KernelGetCurThread());
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0, "deferring result");
|
||||
} else if (result >= 0) {
|
||||
if (__KernelIsDispatchEnabled()) {
|
||||
// If we wrote to stdout, return an error (even though we did log it) rather than delaying.
|
||||
// On actual hardware, it would just return this... we just want the log output.
|
||||
if (__IsInInterrupt()) {
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT);
|
||||
}
|
||||
return hleDelayResult(hleLogDebug(Log::sceIo, result), "io write", us);
|
||||
} else {
|
||||
@@ -1430,11 +1422,10 @@ static s64 __IoLseek(SceUID id, s64 offset, int whence) {
|
||||
static s64 sceIoLseek(int id, s64 offset, int whence) {
|
||||
s64 result = __IoLseek(id, offset, whence);
|
||||
if (result >= 0 || result == -1) {
|
||||
DEBUG_LOG(Log::sceIo, "%lli = sceIoLseek(%d, %llx, %i)", result, id, offset, whence);
|
||||
// Educated guess at timing.
|
||||
hleEatCycles(1400);
|
||||
hleReSchedule("io seek");
|
||||
return result;
|
||||
return hleLogDebug(Log::sceIo, result);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, result, "bad file descriptor");
|
||||
}
|
||||
@@ -1443,11 +1434,10 @@ static s64 sceIoLseek(int id, s64 offset, int whence) {
|
||||
static u32 sceIoLseek32(int id, int offset, int whence) {
|
||||
s32 result = (s32) __IoLseek(id, offset, whence);
|
||||
if (result >= 0 || result == -1) {
|
||||
DEBUG_LOG(Log::sceIo, "%i = sceIoLseek32(%d, %x, %i)", result, id, offset, whence);
|
||||
// Educated guess at timing.
|
||||
hleEatCycles(1400);
|
||||
hleReSchedule("io seek");
|
||||
return result;
|
||||
return hleLogDebug(Log::sceIo, result);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, result, "bad file descriptor");
|
||||
}
|
||||
@@ -1748,8 +1738,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
case 0x01F100A6:
|
||||
case 0x01F100A8:
|
||||
case 0x01F100A9:
|
||||
ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen);
|
||||
return 0;
|
||||
return hleReportError(Log::sceIo, 0, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen);
|
||||
}
|
||||
|
||||
// This should really send it on to a FileSystem implementation instead.
|
||||
@@ -1794,7 +1783,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
}
|
||||
return hleNoLog(0);
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
}
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, ERROR_MEMSTICK_DEVCTL_BAD_PARAMS);
|
||||
@@ -1815,8 +1804,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
|
||||
if (slot != (size_t)-1) {
|
||||
memStickCallbacks.erase(memStickCallbacks.begin() + slot);
|
||||
DEBUG_LOG(Log::sceIo, "sceIoDevctl: Unregistered memstick callback %i", cbId);
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
return hleLogDebug(Log::sceIo, 0, "sceIoDevctl: Unregistered memstick callback %i", cbId);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
}
|
||||
@@ -1859,7 +1847,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
deviceSize.NotifyWrite("ms0:02425818");
|
||||
}
|
||||
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, ERROR_MEMSTICK_DEVCTL_BAD_PARAMS);
|
||||
}
|
||||
@@ -1940,20 +1928,18 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
MemoryStick_SetFatState((MemStickFatState)Memory::Read_U32(argAddr));
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
} else {
|
||||
ERROR_LOG(Log::sceIo, "Failed 0x02415823 fat");
|
||||
return -1;
|
||||
return hleLogError(Log::sceIo, -1, "Failed 0x02415823 fat");
|
||||
}
|
||||
break;
|
||||
case 0x02425823:
|
||||
// Check if FAT enabled
|
||||
// If the values added together are >= 0x80000000, or less than outPtr, invalid address.
|
||||
if (((int)outPtr + outLen) < (int)outPtr) {
|
||||
ERROR_LOG(Log::sceIo, "sceIoDevctl: fatms0: 0x02425823 command, bad address");
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "sceIoDevctl: fatms0: 0x02425823 command, bad address");
|
||||
} else if (!Memory::IsValidAddress(outPtr)) {
|
||||
// Technically, only checks for NULL, crashes for many bad addresses.
|
||||
ERROR_LOG(Log::sceIo, "sceIoDevctl: fatms0: 0x02425823 command, no output address");
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
ERROR_LOG(Log::sceIo, "sceIoDevctl: ");
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "fatms0: 0x02425823 command, no output address");
|
||||
} else {
|
||||
// Does not care about outLen, even if it's 0.
|
||||
// Note: writes 1 when inserted, 0 when not inserted.
|
||||
@@ -1964,7 +1950,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
case 0x02425824:
|
||||
// Check if write protected
|
||||
if (MemoryStick_State() != PSP_MEMORYSTICK_STATE_INSERTED) {
|
||||
return SCE_KERNEL_ERROR_ERRNO_DEVICE_NOT_FOUND;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_DEVICE_NOT_FOUND);
|
||||
}
|
||||
if (Memory::IsValidAddress(outPtr) && outLen == 4) {
|
||||
Memory::Write_U32(0, outPtr);
|
||||
@@ -2034,7 +2020,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
if (PSP_CoreParameter().collectDebugOutput)
|
||||
*PSP_CoreParameter().collectDebugOutput += data;
|
||||
}
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
case EMULATOR_DEVCTL__IS_EMULATOR:
|
||||
if (Memory::IsValidAddress(outPtr))
|
||||
Memory::Write_U32(1, outPtr);
|
||||
@@ -2403,15 +2389,13 @@ public:
|
||||
};
|
||||
|
||||
static u32 sceIoDopen(const char *path) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoDopen(\"%s\")", path);
|
||||
|
||||
double startTime = time_now_d();
|
||||
|
||||
bool listingExists = false;
|
||||
auto listing = pspFileSystem.GetDirListing(path, &listingExists);
|
||||
|
||||
if (!listingExists) {
|
||||
return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
DirListing *dir = new DirListing();
|
||||
@@ -2468,7 +2452,7 @@ static u32 sceIoDopen(const char *path) {
|
||||
}
|
||||
|
||||
// TODO: The result is delayed only from the memstick, it seems.
|
||||
return id;
|
||||
return hleLogDebug(Log::sceIo, id);
|
||||
}
|
||||
|
||||
// For some reason strncpy will fill up the entire output buffer. No reason to do that,
|
||||
@@ -2541,8 +2525,7 @@ static u32 sceIoDread(int id, u32 dirent_addr) {
|
||||
}
|
||||
|
||||
static u32 sceIoDclose(int id) {
|
||||
DEBUG_LOG(Log::sceIo, "sceIoDclose(%d)", id);
|
||||
return kernelObjects.Destroy<DirListing>(id);
|
||||
return hleLogDebug(Log::sceIo, kernelObjects.Destroy<DirListing>(id));
|
||||
}
|
||||
|
||||
int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) {
|
||||
@@ -2704,7 +2687,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out
|
||||
if (Memory::IsValidAddress(outdataPtr) && size <= outlen) {
|
||||
// sceIoRead does its own delaying (and deferring.)
|
||||
usec = 0;
|
||||
return sceIoRead(id, outdataPtr, size);
|
||||
return hleCall(IoFileMgrForUser, u32, sceIoRead, id, outdataPtr, size);
|
||||
} else {
|
||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ void sceKernelExitGame()
|
||||
Core_Stop();
|
||||
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, "sceKernelExitGame()", 0.0f, "kernelexit");
|
||||
hleNoLogVoid();
|
||||
}
|
||||
|
||||
void sceKernelExitGameWithStatus()
|
||||
@@ -341,6 +342,7 @@ void sceKernelExitGameWithStatus()
|
||||
Core_Stop();
|
||||
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, "sceKernelExitGameWithStatus()");
|
||||
hleNoLogVoid();
|
||||
}
|
||||
|
||||
u32 sceKernelDevkitVersion()
|
||||
@@ -418,7 +420,7 @@ int sceKernelDcacheWritebackAll()
|
||||
gpu->InvalidateCache(0, -1, GPU_INVALIDATE_ALL);
|
||||
hleEatCycles(3524);
|
||||
hleReSchedule("dcache writeback all");
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
int sceKernelDcacheWritebackRange(u32 addr, int size)
|
||||
@@ -427,13 +429,13 @@ int sceKernelDcacheWritebackRange(u32 addr, int size)
|
||||
NOTICE_LOG(Log::CPU,"sceKernelDcacheWritebackRange(%08x, %i)", addr, size);
|
||||
#endif
|
||||
if (size < 0)
|
||||
return SCE_KERNEL_ERROR_INVALID_SIZE;
|
||||
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_INVALID_SIZE);
|
||||
|
||||
if (size > 0 && addr != 0) {
|
||||
gpu->InvalidateCache(addr, size, GPU_INVALIDATE_HINT);
|
||||
}
|
||||
hleEatCycles(165);
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
int sceKernelDcacheWritebackInvalidateRange(u32 addr, int size)
|
||||
@@ -442,13 +444,13 @@ int sceKernelDcacheWritebackInvalidateRange(u32 addr, int size)
|
||||
NOTICE_LOG(Log::CPU,"sceKernelDcacheInvalidateRange(%08x, %i)", addr, size);
|
||||
#endif
|
||||
if (size < 0)
|
||||
return SCE_KERNEL_ERROR_INVALID_SIZE;
|
||||
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_INVALID_SIZE);
|
||||
|
||||
if (size > 0 && addr != 0) {
|
||||
gpu->InvalidateCache(addr, size, GPU_INVALIDATE_HINT);
|
||||
}
|
||||
hleEatCycles(165);
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
int sceKernelDcacheWritebackInvalidateAll()
|
||||
|
||||
@@ -242,7 +242,9 @@ enum : u32 {
|
||||
SCE_KERNEL_ERROR_MUTEX_LOCK_OVERFLOW = 0x800201c6,
|
||||
SCE_KERNEL_ERROR_MUTEX_UNLOCK_UNDERFLOW = 0x800201c7,
|
||||
SCE_KERNEL_ERROR_MUTEX_RECURSIVE_NOT_ALLOWED = 0x800201c8,
|
||||
|
||||
SCE_KERNEL_ERROR_MESSAGEBOX_DUPLICATE_MESSAGE = 0x800201c9,
|
||||
|
||||
SCE_KERNEL_ERROR_LWMUTEX_NOT_FOUND = 0x800201ca,
|
||||
SCE_KERNEL_ERROR_LWMUTEX_LOCKED = 0x800201cb,
|
||||
SCE_KERNEL_ERROR_LWMUTEX_UNLOCKED = 0x800201cc,
|
||||
@@ -583,3 +585,6 @@ void Register_ThreadManForKernel();
|
||||
void Register_LoadExecForUser();
|
||||
void Register_LoadExecForKernel();
|
||||
void Register_UtilsForKernel();
|
||||
|
||||
// returns nullptr if not found.
|
||||
const char *KernelErrorToString(u32 err);
|
||||
@@ -431,6 +431,7 @@ void __KernelReturnFromInterrupt()
|
||||
else
|
||||
__KernelSwitchToThread(threadBeforeInterrupt, "left interrupt");
|
||||
}
|
||||
hleNoLogVoid();
|
||||
}
|
||||
|
||||
void __RegisterIntrHandler(u32 intrNumber, IntrHandler* handler)
|
||||
|
||||
@@ -2030,7 +2030,7 @@ int __KernelGPUReplay() {
|
||||
}
|
||||
|
||||
// Return 0 for normal looping, 1 for break.
|
||||
return result == GPURecord::ReplayResult::Break ? 1 : 0;
|
||||
return hleNoLog(result == GPURecord::ReplayResult::Break ? 1 : 0);
|
||||
}
|
||||
|
||||
int sceKernelLoadExec(const char *filename, u32 paramPtr) {
|
||||
|
||||
@@ -198,8 +198,7 @@ int sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr)
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelCancelSema(%i, %i, %08x): invalid semaphore", id, newCount, numWaitThreadsPtr);
|
||||
return error;
|
||||
return hleLogError(Log::sceKernel, error, "invalid semaphore");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-17
@@ -86,7 +86,7 @@ u32 sceKernelGetSystemTimeLow()
|
||||
if (PSP_CoreParameter().compat.flags().KernelGetSystemTimeLowEatMoreCycles)
|
||||
hleEatCycles(70000);
|
||||
hleReSchedule("system time");
|
||||
return (u32)t;
|
||||
return hleNoLog((u32)t);
|
||||
}
|
||||
|
||||
u64 sceKernelGetSystemTimeWide()
|
||||
@@ -95,7 +95,7 @@ u64 sceKernelGetSystemTimeWide()
|
||||
VERBOSE_LOG(Log::sceKernel,"%i=sceKernelGetSystemTimeWide()",(u32)t);
|
||||
hleEatCycles(250);
|
||||
hleReSchedule("system time");
|
||||
return t;
|
||||
return hleNoLog(t);
|
||||
}
|
||||
|
||||
int sceKernelUSec2SysClock(u32 usec, u32 clockPtr)
|
||||
@@ -104,14 +104,14 @@ int sceKernelUSec2SysClock(u32 usec, u32 clockPtr)
|
||||
if (Memory::IsValidAddress(clockPtr))
|
||||
Memory::Write_U64((usec & 0xFFFFFFFFL), clockPtr);
|
||||
hleEatCycles(165);
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
u64 sceKernelUSec2SysClockWide(u32 usec)
|
||||
{
|
||||
VERBOSE_LOG(Log::sceKernel, "sceKernelUSec2SysClockWide(%i)", usec);
|
||||
hleEatCycles(150);
|
||||
return usec;
|
||||
return hleNoLog(usec);
|
||||
}
|
||||
|
||||
int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
|
||||
@@ -121,11 +121,11 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
|
||||
u32 highResult = (u32)(time / 1000000);
|
||||
u32 lowResult = (u32)(time % 1000000);
|
||||
if (Memory::IsValidAddress(highPtr))
|
||||
Memory::Write_U32(highResult, highPtr);
|
||||
Memory::WriteUnchecked_U32(highResult, highPtr);
|
||||
if (Memory::IsValidAddress(lowPtr))
|
||||
Memory::Write_U32(lowResult, lowPtr);
|
||||
Memory::WriteUnchecked_U32(lowResult, lowPtr);
|
||||
hleEatCycles(415);
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr)
|
||||
@@ -133,40 +133,38 @@ int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 high
|
||||
u64 sysClock = lowClock | ((u64)highClock << 32);
|
||||
DEBUG_LOG(Log::sceKernel, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", sysClock, lowPtr, highPtr);
|
||||
if (Memory::IsValidAddress(lowPtr)) {
|
||||
Memory::Write_U32((u32)(sysClock / 1000000), lowPtr);
|
||||
Memory::WriteUnchecked_U32((u32)(sysClock / 1000000), lowPtr);
|
||||
if (Memory::IsValidAddress(highPtr))
|
||||
Memory::Write_U32((u32)(sysClock % 1000000), highPtr);
|
||||
Memory::WriteUnchecked_U32((u32)(sysClock % 1000000), highPtr);
|
||||
} else
|
||||
if (Memory::IsValidAddress(highPtr))
|
||||
Memory::Write_U32((int) sysClock, highPtr);
|
||||
Memory::WriteUnchecked_U32((int) sysClock, highPtr);
|
||||
hleEatCycles(385);
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
u32 sceKernelLibcClock()
|
||||
{
|
||||
u32 retVal = (u32) CoreTiming::GetGlobalTimeUs();
|
||||
DEBUG_LOG(Log::sceKernel, "%i = sceKernelLibcClock", retVal);
|
||||
hleEatCycles(330);
|
||||
hleReSchedule("libc clock");
|
||||
return retVal;
|
||||
return hleLogDebug(Log::sceKernel, retVal);
|
||||
}
|
||||
|
||||
u32 sceKernelLibcTime(u32 outPtr)
|
||||
{
|
||||
u32 t = (u32) start_time + (u32) (CoreTiming::GetGlobalTimeUs() / 1000000ULL);
|
||||
|
||||
DEBUG_LOG(Log::sceKernel, "%i = sceKernelLibcTime(%08X)", t, outPtr);
|
||||
// The PSP sure takes its sweet time on this function.
|
||||
hleEatCycles(3385);
|
||||
|
||||
if (Memory::IsValidAddress(outPtr))
|
||||
Memory::Write_U32(t, outPtr);
|
||||
Memory::WriteUnchecked_U32(t, outPtr);
|
||||
else if (outPtr != 0)
|
||||
return 0;
|
||||
|
||||
hleReSchedule("libc time");
|
||||
return t;
|
||||
return hleLogDebug(Log::sceKernel, t);
|
||||
}
|
||||
|
||||
u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
|
||||
@@ -182,7 +180,7 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
|
||||
hleEatCycles(1885);
|
||||
|
||||
hleReSchedule("libc timeofday");
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
std::string KernelTimeNowFormatted() {
|
||||
|
||||
@@ -39,19 +39,6 @@
|
||||
// TODO: Determine how many handlers we can actually have
|
||||
const size_t MAX_APCTL_HANDLERS = 32;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
|
||||
typedef struct ProductStruct { // Similar to SceNetAdhocctlAdhocId ?
|
||||
s32_le unknown; // Unknown, set to 0 // Product Type ?
|
||||
char product[PRODUCT_CODE_LENGTH]; // Game ID (Example: ULUS10000)
|
||||
} PACK ProductStruct;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
typedef void(*sceNetApctlHandler)(int oldState, int newState, int event, int error, void* pArg);
|
||||
|
||||
#define APCTL_PROFILENAME_MAXLEN 64
|
||||
|
||||
@@ -30,6 +30,11 @@ typedef struct SceNetAdhocDiscoverParam {
|
||||
u32_le result; // inited to 0?
|
||||
} PACK SceNetAdhocDiscoverParam;
|
||||
|
||||
typedef struct ProductStruct { // Similar to SceNetAdhocctlAdhocId ?
|
||||
s32_le unknown; // Unknown, set to 0 // Product Type ?
|
||||
char product[PRODUCT_CODE_LENGTH]; // Game ID (Example: ULUS10000)
|
||||
} PACK ProductStruct;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
+23
-36
@@ -170,59 +170,49 @@ void __PowerDoState(PointerWrap &p) {
|
||||
}
|
||||
|
||||
static int scePowerGetBatteryLifePercent() {
|
||||
DEBUG_LOG(Log::HLE, "100=scePowerGetBatteryLifePercent");
|
||||
return 100;
|
||||
return hleLogDebug(Log::HLE, 100);
|
||||
}
|
||||
|
||||
static int scePowerGetBatteryLifeTime() {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryLifeTime()");
|
||||
// 0 means we're on AC power.
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
}
|
||||
|
||||
static int scePowerGetBatteryTemp() {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryTemp()");
|
||||
// 0 means celsius temperature of the battery
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
}
|
||||
|
||||
static int scePowerIsPowerOnline() {
|
||||
DEBUG_LOG(Log::HLE, "1=scePowerIsPowerOnline");
|
||||
return 1;
|
||||
return hleLogDebug(Log::HLE, 1);
|
||||
}
|
||||
|
||||
static int scePowerIsBatteryExist() {
|
||||
DEBUG_LOG(Log::HLE, "1=scePowerIsBatteryExist");
|
||||
return 1;
|
||||
return hleLogDebug(Log::HLE, 1);
|
||||
}
|
||||
|
||||
static int scePowerIsBatteryCharging() {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerIsBatteryCharging");
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
}
|
||||
|
||||
static int scePowerGetBatteryChargingStatus() {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryChargingStatus");
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
}
|
||||
|
||||
static int scePowerIsLowBattery() {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerIsLowBattery");
|
||||
return 0;
|
||||
return hleLogDebug(Log::HLE, 0);
|
||||
}
|
||||
|
||||
static int scePowerRegisterCallback(int slot, int cbId) {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerRegisterCallback(%i, %i)", slot, cbId);
|
||||
|
||||
if (slot < -1 || slot >= numberOfCBPowerSlotsPrivate) {
|
||||
return PSP_POWER_ERROR_INVALID_SLOT;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_INVALID_SLOT);
|
||||
}
|
||||
if (slot >= numberOfCBPowerSlots) {
|
||||
return SCE_KERNEL_ERROR_PRIV_REQUIRED;
|
||||
return hleLogError(Log::HLE, SCE_KERNEL_ERROR_PRIV_REQUIRED);
|
||||
}
|
||||
// TODO: If cbId is invalid return PSP_POWER_ERROR_INVALID_CB.
|
||||
if (cbId == 0) {
|
||||
return PSP_POWER_ERROR_INVALID_CB;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_INVALID_CB);
|
||||
}
|
||||
|
||||
int retval = -1;
|
||||
@@ -235,42 +225,40 @@ static int scePowerRegisterCallback(int slot, int cbId) {
|
||||
}
|
||||
}
|
||||
if (retval == -1) {
|
||||
return PSP_POWER_ERROR_SLOTS_FULL;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_SLOTS_FULL);
|
||||
}
|
||||
} else {
|
||||
if (powerCbSlots[slot] == 0) {
|
||||
powerCbSlots[slot] = cbId;
|
||||
retval = 0;
|
||||
} else {
|
||||
return PSP_POWER_ERROR_TAKEN_SLOT;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_TAKEN_SLOT);
|
||||
}
|
||||
}
|
||||
if (retval >= 0) {
|
||||
int arg = PSP_POWER_CB_AC_POWER | PSP_POWER_CB_BATTERY_EXIST | PSP_POWER_CB_BATTERY_FULL;
|
||||
__KernelNotifyCallback(cbId, arg);
|
||||
}
|
||||
return retval;
|
||||
return hleLogSuccessOrError(Log::HLE, retval);
|
||||
}
|
||||
|
||||
static int scePowerUnregisterCallback(int slotId) {
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerUnregisterCallback(%i)", slotId);
|
||||
|
||||
if (slotId < 0 || slotId >= numberOfCBPowerSlotsPrivate) {
|
||||
return PSP_POWER_ERROR_INVALID_SLOT;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_INVALID_SLOT);
|
||||
}
|
||||
if (slotId >= numberOfCBPowerSlots) {
|
||||
return SCE_KERNEL_ERROR_PRIV_REQUIRED;
|
||||
return hleLogError(Log::HLE, SCE_KERNEL_ERROR_PRIV_REQUIRED);
|
||||
}
|
||||
|
||||
if (powerCbSlots[slotId] != 0) {
|
||||
int cbId = powerCbSlots[slotId];
|
||||
DEBUG_LOG(Log::HLE, "0=scePowerUnregisterCallback(%i) (cbid = %i)", slotId, cbId);
|
||||
powerCbSlots[slotId] = 0;
|
||||
return hleLogDebug(Log::HLE, 0, "(cbid = %i)", cbId);
|
||||
} else {
|
||||
return PSP_POWER_ERROR_EMPTY_SLOT;
|
||||
return hleLogError(Log::HLE, PSP_POWER_ERROR_EMPTY_SLOT);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sceKernelPowerLock(int lockType) {
|
||||
@@ -293,6 +281,7 @@ static int sceKernelPowerTick(int flag) {
|
||||
return hleLogDebug(Log::HLE, 0, "UNIMPL");
|
||||
}
|
||||
|
||||
// not a syscall
|
||||
int KernelVolatileMemLock(int type, u32 paddr, u32 psize) {
|
||||
if (type != 0) {
|
||||
return SCE_KERNEL_ERROR_INVALID_MODE;
|
||||
@@ -305,14 +294,13 @@ int KernelVolatileMemLock(int type, u32 paddr, u32 psize) {
|
||||
// It's always available in the emu.
|
||||
// TODO: Should really reserve this properly!
|
||||
if (Memory::IsValidAddress(paddr)) {
|
||||
Memory::Write_U32(0x08400000, paddr);
|
||||
Memory::WriteUnchecked_U32(0x08400000, paddr);
|
||||
}
|
||||
if (Memory::IsValidAddress(psize)) {
|
||||
Memory::Write_U32(0x00400000, psize);
|
||||
Memory::WriteUnchecked_U32(0x00400000, psize);
|
||||
}
|
||||
volatileMemLocked = true;
|
||||
NotifyMemInfo(MemBlockFlags::ALLOC, 0x08400000, 0x400000, "Volatile memory (locked)");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -331,15 +319,14 @@ static int sceKernelVolatileMemTryLock(int type, u32 paddr, u32 psize) {
|
||||
|
||||
case SCE_KERNEL_ERROR_POWER_VMEM_IN_USE:
|
||||
// This is OK, let's not ERROR_LOG.
|
||||
DEBUG_LOG(Log::HLE, "sceKernelVolatileMemTryLock(%i, %08x, %08x) - already locked!", type, paddr, psize);
|
||||
break;
|
||||
return hleLogDebug(Log::HLE, error, "(%i, %08x, %08x) - already locked!", type, paddr, psize);
|
||||
|
||||
default:
|
||||
ERROR_LOG_REPORT(Log::HLE, "%08x=sceKernelVolatileMemTryLock(%i, %08x, %08x) - error", type, paddr, psize, error);
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
return hleLogSuccessOrError(Log::HLE, error);
|
||||
}
|
||||
|
||||
int KernelVolatileMemUnlock(int type) {
|
||||
|
||||
@@ -30,7 +30,7 @@ static int sceNpDrmEdataSetupKey(u32 edataFd) {
|
||||
// call PGD open
|
||||
// Note that usec accumulates.
|
||||
retval = __IoIoctl(edataFd, 0x04100001, 0, 0, 0, 0, usec);
|
||||
return hleDelayResult(hleLogError(Log::sceIo, retval), "io ctrl command", usec);
|
||||
return hleDelayResult(hleLogSuccessOrError(Log::sceIo, retval), "io ctrl command", usec);
|
||||
}
|
||||
|
||||
static int sceNpDrmEdataGetDataSize(u32 edataFd) {
|
||||
|
||||
+3
-4
@@ -271,8 +271,7 @@ static bool __RtcValidatePspTime(const ScePspDateTime &t)
|
||||
|
||||
static u32 sceRtcGetTickResolution()
|
||||
{
|
||||
DEBUG_LOG(Log::sceRtc, "sceRtcGetTickResolution()");
|
||||
return 1000000;
|
||||
return hleLogDebug(Log::sceRtc, 1000000);
|
||||
}
|
||||
|
||||
static u32 sceRtcGetCurrentTick(u32 tickPtr)
|
||||
@@ -284,7 +283,7 @@ static u32 sceRtcGetCurrentTick(u32 tickPtr)
|
||||
Memory::Write_U64(curTick, tickPtr);
|
||||
hleEatCycles(300);
|
||||
hleReSchedule("rtc current tick");
|
||||
return 0;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
static u64 sceRtcGetAccumulativeTime()
|
||||
@@ -292,7 +291,7 @@ static u64 sceRtcGetAccumulativeTime()
|
||||
DEBUG_LOG(Log::sceRtc, "sceRtcGetAccumulativeTime()");
|
||||
hleEatCycles(300);
|
||||
hleReSchedule("rtc accumulative time");
|
||||
return __RtcGetCurrentTick();
|
||||
return hleNoLog(__RtcGetCurrentTick());
|
||||
}
|
||||
|
||||
static u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz) {
|
||||
|
||||
+31
-51
@@ -258,29 +258,27 @@ static void __UmdEndCallback(SceUID threadID, SceUID prevCallbackId)
|
||||
}
|
||||
}
|
||||
|
||||
static int sceUmdCheckMedium()
|
||||
{
|
||||
static int sceUmdCheckMedium() {
|
||||
int retVal = 0;
|
||||
if (UMDInserted) {
|
||||
DEBUG_LOG(Log::sceIo, "1=sceUmdCheckMedium()");
|
||||
return 1; //non-zero: disc in drive
|
||||
retVal = 1; //non-zero: disc in drive
|
||||
}
|
||||
DEBUG_LOG(Log::sceIo, "0=sceUmdCheckMedium()");
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceKernel, retVal);
|
||||
}
|
||||
|
||||
static u32 sceUmdGetDiscInfo(u32 infoAddr)
|
||||
{
|
||||
static u32 sceUmdGetDiscInfo(u32 infoAddr) {
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdGetDiscInfo(%08x)", infoAddr);
|
||||
|
||||
if (Memory::IsValidAddress(infoAddr)) {
|
||||
auto info = PSPPointer<PspUmdInfo>::Create(infoAddr);
|
||||
if (info->size != 8)
|
||||
return PSP_ERROR_UMD_INVALID_PARAM;
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
|
||||
info->type = PSP_UMD_TYPE_GAME;
|
||||
return 0;
|
||||
} else
|
||||
return PSP_ERROR_UMD_INVALID_PARAM;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
}
|
||||
}
|
||||
|
||||
static int sceUmdActivate(u32 mode, const char *name) {
|
||||
@@ -299,17 +297,15 @@ static int sceUmdDeactivate(u32 mode, const char *name)
|
||||
{
|
||||
// Why 18? No idea.
|
||||
if (mode > 18)
|
||||
return PSP_ERROR_UMD_INVALID_PARAM;
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
|
||||
__KernelUmdDeactivate();
|
||||
|
||||
if (mode == 1) {
|
||||
DEBUG_LOG(Log::sceIo, "0=sceUmdDeactivate(%d, %s)", mode, name);
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
} else {
|
||||
ERROR_LOG(Log::sceIo, "UNTESTED 0=sceUmdDeactivate(%d, %s)", mode, name);
|
||||
return hleLogError(Log::sceIo, 0, "UNTESTED mode != 1");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceUmdRegisterUMDCallBack(u32 cbId)
|
||||
@@ -323,39 +319,33 @@ static u32 sceUmdRegisterUMDCallBack(u32 cbId)
|
||||
// There's only ever one.
|
||||
driveCBId = cbId;
|
||||
}
|
||||
DEBUG_LOG(Log::sceIo, "%d=sceUmdRegisterUMDCallback(id=%08x)", retVal, cbId);
|
||||
return retVal;
|
||||
return hleLogDebug(Log::sceIo, retVal);
|
||||
}
|
||||
|
||||
static int sceUmdUnRegisterUMDCallBack(int cbId)
|
||||
{
|
||||
int retVal;
|
||||
|
||||
if (cbId != driveCBId) {
|
||||
retVal = PSP_ERROR_UMD_INVALID_PARAM;
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
} else {
|
||||
int retVal;
|
||||
if (sceKernelGetCompiledSdkVersion() > 0x3000000) {
|
||||
retVal = 0;
|
||||
} else {
|
||||
retVal = cbId;
|
||||
}
|
||||
driveCBId = 0;
|
||||
return hleLogDebug(Log::sceIo, retVal);
|
||||
}
|
||||
DEBUG_LOG(Log::sceIo, "%08x=sceUmdUnRegisterUMDCallBack(id=%08x)", retVal, cbId);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static u32 sceUmdGetDriveStat()
|
||||
{
|
||||
static u32 sceUmdGetDriveStat() {
|
||||
if (!UMDInserted) {
|
||||
WARN_LOG(Log::sceIo, "sceUmdGetDriveStat: UMD is taking out for switch UMD");
|
||||
return PSP_UMD_NOT_PRESENT;
|
||||
return hleLogWarning(Log::sceIo, PSP_UMD_NOT_PRESENT, "sceUmdGetDriveStat: UMD is taking out for switch UMD");
|
||||
}
|
||||
//u32 retVal = PSP_UMD_INITED | PSP_UMD_READY | PSP_UMD_PRESENT;
|
||||
u32 retVal = __KernelUmdGetState();
|
||||
// This one can be very spammy.
|
||||
VERBOSE_LOG(Log::sceIo,"0x%02x=sceUmdGetDriveStat()", retVal);
|
||||
return retVal;
|
||||
return hleLogVerbose(Log::sceIo, retVal, "0x%02x=sceUmdGetDriveStat()", retVal);
|
||||
}
|
||||
|
||||
static void __UmdStatTimeout(u64 userdata, int cyclesLate)
|
||||
@@ -405,7 +395,7 @@ static int sceUmdWaitDriveStat(u32 stat) {
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStat(stat = %08x): waiting", stat);
|
||||
umdWaitingThreads.push_back(__KernelGetCurThread());
|
||||
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited");
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
}
|
||||
|
||||
return hleLogSuccessI(Log::sceIo, 0);
|
||||
@@ -424,11 +414,10 @@ static int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout) {
|
||||
|
||||
hleEatCycles(520);
|
||||
if ((stat & __KernelUmdGetState()) == 0) {
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): waiting", stat, timeout);
|
||||
__UmdWaitStat(timeout);
|
||||
umdWaitingThreads.push_back(__KernelGetCurThread());
|
||||
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, false, "umd stat waited with timer");
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0, "waiting");
|
||||
} else {
|
||||
hleReSchedule("umd stat checked");
|
||||
}
|
||||
@@ -450,7 +439,6 @@ static int sceUmdWaitDriveStatCB(u32 stat, u32 timeout) {
|
||||
hleEatCycles(520);
|
||||
hleCheckCurrentCallbacks();
|
||||
if ((stat & __KernelUmdGetState()) == 0) {
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): waiting", stat, timeout);
|
||||
if (timeout == 0) {
|
||||
timeout = 8000;
|
||||
}
|
||||
@@ -458,6 +446,7 @@ static int sceUmdWaitDriveStatCB(u32 stat, u32 timeout) {
|
||||
__UmdWaitStat(timeout);
|
||||
umdWaitingThreads.push_back(__KernelGetCurThread());
|
||||
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, true, "umd stat waited");
|
||||
return hleLogSuccessI(Log::sceIo, 0, "waiting");
|
||||
} else {
|
||||
hleReSchedule("umd stat waited");
|
||||
}
|
||||
@@ -465,10 +454,7 @@ static int sceUmdWaitDriveStatCB(u32 stat, u32 timeout) {
|
||||
return hleLogSuccessI(Log::sceIo, 0);
|
||||
}
|
||||
|
||||
static u32 sceUmdCancelWaitDriveStat()
|
||||
{
|
||||
DEBUG_LOG(Log::sceIo, "0=sceUmdCancelWaitDriveStat()");
|
||||
|
||||
static u32 sceUmdCancelWaitDriveStat() {
|
||||
for (size_t i = 0; i < umdWaitingThreads.size(); ++i) {
|
||||
const SceUID threadID = umdWaitingThreads[i];
|
||||
CoreTiming::UnscheduleEvent(umdStatTimeoutEvent, threadID);
|
||||
@@ -476,13 +462,11 @@ static u32 sceUmdCancelWaitDriveStat()
|
||||
}
|
||||
umdWaitingThreads.clear();
|
||||
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
}
|
||||
|
||||
static u32 sceUmdGetErrorStat()
|
||||
{
|
||||
DEBUG_LOG(Log::sceIo,"%i=sceUmdGetErrorStat()", umdErrorStat);
|
||||
return umdErrorStat;
|
||||
static u32 sceUmdGetErrorStat() {
|
||||
return hleLogError(Log::sceIo, umdErrorStat);
|
||||
}
|
||||
|
||||
void __UmdReplace(const Path &filepath) {
|
||||
@@ -510,26 +494,22 @@ bool getUMDReplacePermit() {
|
||||
return g_UMDReplacePermit;
|
||||
}
|
||||
|
||||
static u32 sceUmdReplaceProhibit()
|
||||
{
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdReplaceProhibit()");
|
||||
static u32 sceUmdReplaceProhibit() {
|
||||
if (g_UMDReplacePermit) {
|
||||
INFO_LOG(Log::sceIo, "sceUmdReplaceProhibit() - prohibited");
|
||||
g_UMDReplacePermit = false;
|
||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||
}
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
}
|
||||
|
||||
static u32 sceUmdReplacePermit()
|
||||
{
|
||||
DEBUG_LOG(Log::sceIo, "sceUmdReplacePermit()");
|
||||
static u32 sceUmdReplacePermit() {
|
||||
if (!g_UMDReplacePermit) {
|
||||
INFO_LOG(Log::sceIo, "sceUmdReplacePermit() - permitted");
|
||||
g_UMDReplacePermit = true;
|
||||
System_Notify(SystemNotification::SWITCH_UMD_UPDATED);
|
||||
}
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
}
|
||||
|
||||
const HLEFunction sceUmdUser[] =
|
||||
|
||||
@@ -612,7 +612,6 @@ static void DrawAdhoc(ImConfig &cfg) {
|
||||
ImGui::Text("WantTextInput: %s", BoolStr(io.WantTextInput));
|
||||
*/
|
||||
|
||||
ImGui::Text("sceNetAdhoc inited: %s", BoolStr(netAdhocInited));
|
||||
ImGui::Text("sceNetAdhoc inited: %s", BoolStr(netAdhocInited));
|
||||
ImGui::Text("sceNetAdhocctl inited: %s", BoolStr(netAdhocctlInited));
|
||||
ImGui::Text("sceNetAdhocctl state: %s", AdhocCtlStateToString(NetAdhocctl_GetState()));
|
||||
|
||||
Reference in new issue
Block a user