Skip to main content
gamedev.net
🔒 Locked

What does this code do?

Started by MrLloyd1981 Sep 8, 2011 at 9:41 PM 1 replies 1.8k views
Original Post
MrLloyd1981
MrLloyd1981
I picked this up from an old programming test found on the web. I understand what it does, as in I can explain in words what happens, but why and where would you use something like this?


What does this code block do?

{
u_int *source, *end;
u_int addr_printf, addr_scePrintf;
int counter = 0;

addr_printf = ((u_int) printf & 0xFFFFFF) / 4;
addr_scePrintf = ((u_int) scePrintf & 0xFFFFFF) / 4;

source = (u_int *) sceGsSyncPath;
end = source + 195;

while (source < end)
{
if ((*source & 0xFF000000) == 0x0C000000)
{
// Function call...
if ((*source & 0xFFFFFF) == addr_printf)
{
*source = 0x0C000000 | addr_scePrintf;
counter++;
}
}

source++;
}
}
jlouts
jlouts
looks like a rather hackish way to change code to use a different scePrintf rather than printf. Don't see why you would use it unless you were going to modify some compiled library or something that you don't have the source code to.
ApochPiQ
ApochPiQ
Well, let's hear your explanation of what's going on. From that it should be easy to determine what you're missing :-)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.