Wrap sceKernelTime functions

This commit is contained in:
Marcin Mikołajczyk 2013-02-03 16:33:01 +01:00
parent 2bacf8071f
commit 4497252398
3 changed files with 25 additions and 26 deletions

View File

@ -602,9 +602,9 @@ const HLEFunction ThreadManForUser[] =
{0x94416130,WrapU_UUUU<sceKernelGetThreadmanIdList>,"sceKernelGetThreadmanIdList"},
{0x57CF62DD,WrapU_U<sceKernelGetThreadmanIdType>,"sceKernelGetThreadmanIdType"},
{0x82BC5777,sceKernelGetSystemTimeWide,"sceKernelGetSystemTimeWide"},
{0x82BC5777,WrapU64_V<sceKernelGetSystemTimeWide>,"sceKernelGetSystemTimeWide"},
{0xdb738f35,WrapI_U<sceKernelGetSystemTime>,"sceKernelGetSystemTime"},
{0x369ed59d,sceKernelGetSystemTimeLow,"sceKernelGetSystemTimeLow"},
{0x369ed59d,WrapU_V<sceKernelGetSystemTimeLow>,"sceKernelGetSystemTimeLow"},
{0x8218B4DD,&WrapU_U<sceKernelReferGlobalProfiler>,"sceKernelReferGlobalProfiler"},
{0x627E6F3A,&WrapU_U<sceKernelReferSystemStatus>,"sceKernelReferSystemStatus"},
@ -619,9 +619,9 @@ const HLEFunction ThreadManForUser[] =
{0xba6b92e2,WrapI_UUU<sceKernelSysClock2USec>,"sceKernelSysClock2USec"},
{0x110DEC9A,0,"sceKernelUSec2SysClock"},
{0xC8CD158C,WrapU_U<sceKernelUSec2SysClockWide>,"sceKernelUSec2SysClockWide"},
{0xE1619D7C,sceKernelSysClock2USecWide,"sceKernelSysClock2USecWide"},
{0xE1619D7C,WrapI_UUUU<sceKernelSysClock2USecWide>,"sceKernelSysClock2USecWide"},
{0x110dec9a,sceKernelUSec2SysClock,"sceKernelUSec2SysClock"},
{0x110dec9a,WrapI_UU<sceKernelUSec2SysClock>,"sceKernelUSec2SysClock"},
{0x278C0DF5,WrapI_IU<sceKernelWaitThreadEnd>,"sceKernelWaitThreadEnd"},
{0xd59ead2f,sceKernelWakeupThread,"sceKernelWakeupThread"}, //AI Go, audio?

View File

@ -66,29 +66,28 @@ int sceKernelGetSystemTime(u32 sysclockPtr)
return 0;
}
void sceKernelGetSystemTimeLow()
u32 sceKernelGetSystemTimeLow()
{
// This clock should tick at 1 Mhz.
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
// DEBUG_LOG(HLE,"%08x=sceKernelGetSystemTimeLow()",(u32)t);
RETURN((u32)t);
return (u32)t;
}
void sceKernelGetSystemTimeWide()
u64 sceKernelGetSystemTimeWide()
{
u64 t = CoreTiming::GetTicks() / CoreTiming::GetClockFrequencyMHz();
DEBUG_LOG(HLE,"%i=sceKernelGetSystemTimeWide()",(u32)t);
RETURN((u32)t);
currentMIPS->r[3] = t >> 32;
return t;
}
void sceKernelUSec2SysClock()
int sceKernelUSec2SysClock(u32 microsec, u32 clockPtr)
{
u32 microseconds = PARAM(0);
SceKernelSysClock *clock = (SceKernelSysClock*)Memory::GetPointer(PARAM(1));
u32 microseconds = microsec;
SceKernelSysClock *clock = (SceKernelSysClock*)Memory::GetPointer(clockPtr);
clock->lo = microseconds; //TODO: fix
DEBUG_LOG(HLE,"sceKernelUSec2SysClock(%i, %08x )",PARAM(0), PARAM(1));
RETURN(0);
DEBUG_LOG(HLE,"sceKernelUSec2SysClock(%i, %08x )",microsec,clockPtr);
return 0;
}
int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
@ -104,15 +103,15 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr)
return 0;
}
void sceKernelSysClock2USecWide()
int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr)
{
u64 clock = PARAM(0) | ((u64)PARAM(1) << 32);
DEBUG_LOG(HLE, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", clock, PARAM(2), PARAM(3));
if (Memory::IsValidAddress(PARAM(2)))
Memory::Write_U32((u32)(clock / 1000000), PARAM(2));
if (Memory::IsValidAddress(PARAM(3)))
Memory::Write_U32((u32)(clock % 1000000), PARAM(3));
RETURN(0);
u64 clock = lowClock | ((u64)highClock << 32);
DEBUG_LOG(HLE, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", clock, lowPtr, highPtr);
if (Memory::IsValidAddress(lowPtr))
Memory::Write_U32((u32)(clock / 1000000), lowPtr);
if (Memory::IsValidAddress(highPtr))
Memory::Write_U32((u32)(clock % 1000000), highPtr);
return 0;
}
u32 sceKernelUSec2SysClockWide(u32 usec)

View File

@ -19,12 +19,12 @@
u32 sceKernelLibcGettimeofday(u32 timeAddr);
u32 sceKernelLibcTime(u32 outPtr);
void sceKernelUSec2SysClock();
int sceKernelUSec2SysClock(u32 microsec, u32 clockPtr);
int sceKernelGetSystemTime(u32 sysclockPtr);
void sceKernelGetSystemTimeLow();
void sceKernelGetSystemTimeWide();
u32 sceKernelGetSystemTimeLow();
u64 sceKernelGetSystemTimeWide();
int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr);
void sceKernelSysClock2USecWide();
int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr);
u32 sceKernelUSec2SysClockWide(u32 usec);
u32 sceKernelLibcClock();