Actually use the table's arg and ret masks.

This commit is contained in:
Unknown W. Brackets 2015-03-22 17:11:52 -07:00
parent fcf0518223
commit 52a37c1330
4 changed files with 35 additions and 31 deletions

View File

@ -620,7 +620,7 @@ size_t hleFormatLogArgs(char *message, size_t sz, const char *argmask) {
return used;
}
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *argmask, const char *reason, ...) {
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, ...) {
if (level > MAX_LOGLEVEL || !GenericLogEnabled(level, t)) {
return res;
}
@ -637,7 +637,11 @@ u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const ch
}
char formatted_args[4096];
hleFormatLogArgs(formatted_args, sizeof(formatted_args), argmask);
hleFormatLogArgs(formatted_args, sizeof(formatted_args), latestSyscall->argmask);
// This acts as an override (for error returns which are usually hex.)
if (retmask == '\0')
retmask = latestSyscall->retmask;
const char *fmt;
// TODO: Floats and other types... move to another func (for return type?) Hmm.
@ -669,6 +673,6 @@ u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const ch
return res;
}
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *argmask) {
return hleDoLog(t, level, res, file, line, reportTag, retmask, argmask, nullptr);
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask) {
return hleDoLog(t, level, res, file, line, reportTag, retmask, nullptr);
}

View File

@ -146,20 +146,20 @@ const HLEFunction *GetSyscallInfo(MIPSOpcode op);
// For jit, takes arg: const HLEFunction *
void *GetQuickSyscallFunc(MIPSOpcode op);
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *argmask, const char *reason, ...);
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *argmask);
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, ...);
u32 hleDoLog(LogTypes::LOG_TYPE t, LogTypes::LOG_LEVELS level, u32 res, const char *file, int line, const char *reportTag, char retmask);
// Only one side of the ?: is evaluated (per c++ standard), so this should be safe.
#define hleLogHelper(t, level, res, retmask, ...) (LogTypes::level > MAX_LOGLEVEL ? res : hleDoLog(LogTypes::t, LogTypes::level, res, __FILE__, __LINE__, nullptr, retmask, __VA_ARGS__))
#define hleLogError(t, res, ...) hleLogHelper(t, LERROR, res, 'x', __VA_ARGS__)
#define hleLogWarning(t, res, ...) hleLogHelper(t, LWARNING, res, 'x', __VA_ARGS__)
#define hleLogDebug(t, res, ...) hleLogHelper(t, LDEBUG, res, 'x', __VA_ARGS__)
#define hleLogSuccessX(t, res, ...) hleLogHelper(t, LDEBUG, res, 'x', __VA_ARGS__)
#define hleLogSuccessI(t, res, ...) hleLogHelper(t, LDEBUG, res, 'i', __VA_ARGS__)
#define hleLogSuccessVerboseX(t, res, ...) hleLogHelper(t, LVERBOSE, res, 'x', __VA_ARGS__)
#define hleLogSuccessVerboseI(t, res, ...) hleLogHelper(t, LVERBOSE, res, 'i', __VA_ARGS__)
#define hleLogHelper(t, level, res, retmask, ...) (LogTypes::level > MAX_LOGLEVEL ? res : hleDoLog(LogTypes::t, LogTypes::level, res, __FILE__, __LINE__, nullptr, retmask, ##__VA_ARGS__))
#define hleLogError(t, res, ...) hleLogHelper(t, LERROR, res, 'x', ##__VA_ARGS__)
#define hleLogWarning(t, res, ...) hleLogHelper(t, LWARNING, res, 'x', ##__VA_ARGS__)
#define hleLogDebug(t, res, ...) hleLogHelper(t, LDEBUG, res, 'x', ##__VA_ARGS__)
#define hleLogSuccessX(t, res, ...) hleLogHelper(t, LDEBUG, res, 'x', ##__VA_ARGS__)
#define hleLogSuccessI(t, res, ...) hleLogHelper(t, LDEBUG, res, 'i', ##__VA_ARGS__)
#define hleLogSuccessVerboseX(t, res, ...) hleLogHelper(t, LVERBOSE, res, 'x', ##__VA_ARGS__)
#define hleLogSuccessVerboseI(t, res, ...) hleLogHelper(t, LVERBOSE, res, 'i', ##__VA_ARGS__)
#define hleReportError(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LERROR, res, __FILE__, __LINE__, "", 'x', __VA_ARGS__)
#define hleReportWarning(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LWARNING, res, __FILE__, __LINE__, "", 'x', __VA_ARGS__)
#define hleReportDebug(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LDEBUG, res, __FILE__, __LINE__, "", 'x', __VA_ARGS__)
#define hleReportVerbose(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LVERBOSE, res, __FILE__, __LINE__, "", 'x', __VA_ARGS__)
#define hleReportError(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LERROR, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__)
#define hleReportWarning(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LWARNING, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__)
#define hleReportDebug(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LDEBUG, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__)
#define hleReportVerbose(t, res, ...) hleDoLog(LogTypes::t, LogTypes::LVERBOSE, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__)

View File

@ -823,7 +823,7 @@ const HLEFunction ThreadManForUser[] =
{0XC11BA8C4, &WrapI_II<sceKernelNotifyCallback>, "sceKernelNotifyCallback", 'i', "ii" },
{0XBA4051D6, &WrapI_I<sceKernelCancelCallback>, "sceKernelCancelCallback", 'i', "i" },
{0X2A3D44FF, &WrapI_I<sceKernelGetCallbackCount>, "sceKernelGetCallbackCount", 'i', "i" },
{0X730ED8BC, &WrapI_IU<sceKernelReferCallbackStatus>, "sceKernelReferCallbackStatus", 'i', "ix" },
{0X730ED8BC, &WrapI_IU<sceKernelReferCallbackStatus>, "sceKernelReferCallbackStatus", 'i', "ip" },
{0X8125221D, &WrapI_CUU<sceKernelCreateMbx>, "sceKernelCreateMbx", 'i', "sxx" },
{0X86255ADA, &WrapI_I<sceKernelDeleteMbx>, "sceKernelDeleteMbx", 'i', "i" },

View File

@ -3020,9 +3020,9 @@ int sceKernelDeleteCallback(SceUID cbId)
if (cb->nc.notifyCount != 0)
readyCallbacksCount--;
return hleLogSuccessI(SCEKERNEL, kernelObjects.Destroy<Callback>(cbId), "d");
return hleLogSuccessI(SCEKERNEL, kernelObjects.Destroy<Callback>(cbId));
} else {
return hleLogError(SCEKERNEL, error, "i", "bad cbId");
return hleLogError(SCEKERNEL, error, "bad cbId");
}
}
@ -3033,9 +3033,9 @@ int sceKernelNotifyCallback(SceUID cbId, int notifyArg)
Callback *cb = kernelObjects.Get<Callback>(cbId, error);
if (cb) {
__KernelNotifyCallback(cbId, notifyArg);
return hleLogSuccessI(SCEKERNEL, 0, "ii");
return hleLogSuccessI(SCEKERNEL, 0);
} else {
return hleLogError(SCEKERNEL, error, "ii", "bad cbId");
return hleLogError(SCEKERNEL, error, "bad cbId");
}
}
@ -3046,9 +3046,9 @@ int sceKernelCancelCallback(SceUID cbId)
if (cb) {
// This just resets the notify count.
cb->nc.notifyArg = 0;
return hleLogSuccessI(SCEKERNEL, 0, "i");
return hleLogSuccessI(SCEKERNEL, 0);
} else {
return hleLogError(SCEKERNEL, error, "i", "bad cbId");
return hleLogError(SCEKERNEL, error, "bad cbId");
}
}
@ -3057,9 +3057,9 @@ int sceKernelGetCallbackCount(SceUID cbId)
u32 error;
Callback *cb = kernelObjects.Get<Callback>(cbId, error);
if (cb) {
return hleLogSuccessVerboseI(SCEKERNEL, cb->nc.notifyCount, "i");
return hleLogSuccessVerboseI(SCEKERNEL, cb->nc.notifyCount);
} else {
return hleLogError(SCEKERNEL, error, "i", "bad cbId");
return hleLogError(SCEKERNEL, error, "bad cbId");
}
}
@ -3070,12 +3070,12 @@ int sceKernelReferCallbackStatus(SceUID cbId, u32 statusAddr)
if (c) {
if (Memory::IsValidAddress(statusAddr) && Memory::Read_U32(statusAddr) != 0) {
Memory::WriteStruct(statusAddr, &c->nc);
return hleLogSuccessI(SCEKERNEL, 0, "ip");
return hleLogSuccessI(SCEKERNEL, 0);
} else {
return hleLogDebug(SCEKERNEL, 0, "ip", "struct size was 0");
return hleLogDebug(SCEKERNEL, 0, "struct size was 0");
}
} else {
return hleLogError(SCEKERNEL, error, "ip", "bad cbId");
return hleLogError(SCEKERNEL, error, "bad cbId");
}
}
@ -3105,7 +3105,7 @@ u32 sceKernelExtendThreadStack(u32 size, u32 entryAddr, u32 entryParameter)
currentMIPS->r[MIPS_REG_SP] = thread->currentStack.end - 0x10;
hleSkipDeadbeef();
return hleLogSuccessI(SCEKERNEL, 0, "xxx");
return hleLogSuccessI(SCEKERNEL, 0);
}
void __KernelReturnFromExtendStack()