From b7ae49c4d2d9d4cb78bdd70a54edd655a6ca8a17 Mon Sep 17 00:00:00 2001 From: Sepalani Date: Mon, 10 Jul 2017 23:14:26 +0100 Subject: [PATCH] NetKDTime: Log IOCtl --- Source/Core/Core/IOS/Network/KD/NetKDTime.cpp | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp b/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp index a9f0be3132..b74cf86ec4 100644 --- a/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp +++ b/Source/Core/Core/IOS/Network/KD/NetKDTime.cpp @@ -4,6 +4,7 @@ #include "Core/IOS/Network/KD/NetKDTime.h" +#include #include #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); - break; + { + 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); - break; + { + 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); - break; + { + 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; }