NetKDTime: Log IOCtl

This commit is contained in:
Sepalani 2017-07-10 23:14:26 +01:00
parent 07ab81e1bd
commit b7ae49c4d2
1 changed files with 27 additions and 10 deletions

View File

@ -4,6 +4,7 @@
#include "Core/IOS/Network/KD/NetKDTime.h"
#include <cinttypes>
#include <string>
#include "Common/CommonTypes.h"
@ -27,34 +28,50 @@ IPCCommandResult NetKDTime::IOCtl(const IOCtlRequest& request)
s32 result = 0;
u32 common_result = 0;
// TODO Writes stuff to /shared2/nwc24/misc.bin
// u32 update_misc = 0;
u32 update_misc = 0;
switch (request.request)
{
case IOCTL_NW24_GET_UNIVERSAL_TIME:
Memory::Write_U64(GetAdjustedUTC(), request.buffer_out + 4);
{
const u64 adjusted_utc = GetAdjustedUTC();
Memory::Write_U64(adjusted_utc, request.buffer_out + 4);
INFO_LOG(IOS_WC24, "IOCTL_NW24_GET_UNIVERSAL_TIME = %d, time = %" PRIu64, result, adjusted_utc);
}
break;
case IOCTL_NW24_SET_UNIVERSAL_TIME:
SetAdjustedUTC(Memory::Read_U64(request.buffer_in));
// update_misc = Memory::Read_U32(request.buffer_in + 8);
{
const u64 adjusted_utc = Memory::Read_U64(request.buffer_in);
SetAdjustedUTC(adjusted_utc);
update_misc = Memory::Read_U32(request.buffer_in + 8);
INFO_LOG(IOS_WC24, "IOCTL_NW24_SET_UNIVERSAL_TIME (%" PRIu64 ", %u) = %d", adjusted_utc,
update_misc, result);
}
break;
case IOCTL_NW24_SET_RTC_COUNTER:
rtc = Memory::Read_U32(request.buffer_in);
// update_misc = Memory::Read_U32(request.buffer_in + 4);
update_misc = Memory::Read_U32(request.buffer_in + 4);
INFO_LOG(IOS_WC24, "IOCTL_NW24_SET_RTC_COUNTER (%" PRIu64 ", %u) = %d", rtc, update_misc,
result);
break;
case IOCTL_NW24_GET_TIME_DIFF:
Memory::Write_U64(GetAdjustedUTC() - rtc, request.buffer_out + 4);
{
const u64 time_diff = GetAdjustedUTC() - rtc;
Memory::Write_U64(time_diff, request.buffer_out + 4);
INFO_LOG(IOS_WC24, "IOCTL_NW24_GET_TIME_DIFF = %d, time_diff = %" PRIu64, result, time_diff);
}
break;
case IOCTL_NW24_UNIMPLEMENTED:
result = -9;
INFO_LOG(IOS_WC24, "IOCTL_NW24_UNIMPLEMENTED = %d", result);
break;
default:
ERROR_LOG(IOS_NET, "%s - unknown IOCtl: %x", GetDeviceName().c_str(), request.request);
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_WC24);
break;
}