forums.PPSSPP.org
Fix for sceKernelPrintf() function - Printable Version

+- forums.PPSSPP.org (https://forums.ppsspp.org)
+-- Forum: PPSSPP - Playstation Portable Simulator Suitable for Playing Portably (/forumdisplay.php?fid=1)
+--- Forum: Development (/forumdisplay.php?fid=3)
+--- Thread: Fix for sceKernelPrintf() function (/showthread.php?tid=3125)



Fix for sceKernelPrintf() function - Denizen - 05-01-2013 02:35 AM

Before:

Code:
void sceKernelPrintf()
{
    const char *formatString = Memory::GetCharPointer(PARAM(0));

    ERROR_LOG(HLE,"UNIMPL sceKernelPrintf(%08x, %08x, %08x, %08x)", PARAM(0),PARAM(1),PARAM(2),PARAM(3));
    ERROR_LOG(HLE,"%s", formatString);
    RETURN(0);
}

After:
Code:
void sceKernelPrintf()
{
    const char *formatString = Memory::GetCharPointer(PARAM(0));
    DEBUG_LOG(HLE,"IMPL sceKernelPrintf(%08x, %08x, %08x, %08x)", PARAM(0),PARAM(1),PARAM(2),PARAM(3));

    if(!Memory::IsValidAddress(PARAM(2)) {
        DEBUG_LOG(HLE,formatString, &Memory::GetStruct(PARAM(1)));
    } else {
        if(!Memory::IsValidAddress(PARAM(3)) {
            DEBUG_LOG(HLE,formatString, &Memory::GetStruct(PARAM(1)), &Memory::GetStruct(PARAM(2)));
        } else {
            DEBUG_LOG(HLE,formatString, &Memory::GetStruct(PARAM(1)), &Memory::GetStruct(PARAM(2)),
                &Memory::GetStruct(PARAM(3)));
        }
    }
    RETURN(0);
}