From 29f24a600e204549a48dd97ae7deb23cde393972 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sat, 13 Feb 2016 20:27:07 +0800 Subject: [PATCH 1/3] Add sceNetIfhandle staff Used in Yu-Gi-Oh 5Ds Tag Force 4 --- Core/HLE/HLETables.cpp | 1 + Core/HLE/sceNet.cpp | 28 ++++++++++++++++++++++++++++ Core/HLE/sceNet.h | 2 ++ 3 files changed, 31 insertions(+) diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index 604905a310..023bc437a0 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -342,5 +342,6 @@ void RegisterAllModules() { Register_sceUsbCam(); Register_sceG729(); Register_sceNetUpnp(); + Register_sceNetIfhandle(); } diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index db6ba8d0ab..75c5bf7d2e 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -38,6 +38,8 @@ static bool netInited; static bool netInetInited; static bool netApctlInited; +u32 netDropRate = 0; +u32 netDropDuration = 0; static struct SceNetMallocStat netMallocStat; @@ -457,6 +459,22 @@ static int sceNetUpnpGetNatInfo() return 0; } +static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr) +{ + INFO_LOG(SCENET, "sceNetGetDropRate %08x,%08x", dropRateAddr, dropDurationAddr); + Memory::Write_U32(netDropRate, dropRateAddr); + Memory::Write_U32(netDropDuration, dropDurationAddr); + return 0; +} + +static int sceNetSetDropRate(u32 dropRate, u32 dropDuration) +{ + INFO_LOG(SCENET, "sceNetSetDropRate dropRate %d, dropDuration %d", dropRate, dropDuration); + netDropRate = dropRate; + netDropDuration = dropDuration; + return 0; +} + const HLEFunction sceNet[] = { {0X39AF39A6, &WrapU_UUUUU, "sceNetInit", 'x', "xxxxx"}, {0X281928A9, &WrapU_V, "sceNetTerm", 'x', "" }, @@ -548,6 +566,12 @@ const HLEFunction sceNetUpnp[] = { {0XE24220B5, &WrapI_II, "sceNetUpnpInit", 'i', "ii" }, }; +const HLEFunction sceNetIfhandle[] = { + { 0xC80181A2, &WrapI_UU, "sceNetGetDropRate", 'i', "ii" }, + { 0xFD8585E1, &WrapI_UU, "sceNetSetDropRate", 'i', "ii" }, + +}; + void Register_sceNet() { RegisterModule("sceNet", ARRAY_SIZE(sceNet), sceNet); RegisterModule("sceNetResolver", ARRAY_SIZE(sceNetResolver), sceNetResolver); @@ -562,3 +586,7 @@ void Register_sceWlanDrv() { void Register_sceNetUpnp() { RegisterModule("sceNetUpnp", ARRAY_SIZE(sceNetUpnp), sceNetUpnp); } + +void Register_sceNetIfhandle() { + RegisterModule("sceNetIfhandle", ARRAY_SIZE(sceNetIfhandle), sceNetIfhandle); +} diff --git a/Core/HLE/sceNet.h b/Core/HLE/sceNet.h index e95be7a6da..f5cec1206c 100644 --- a/Core/HLE/sceNet.h +++ b/Core/HLE/sceNet.h @@ -93,6 +93,8 @@ class PointerWrap; void Register_sceNet(); void Register_sceWlanDrv(); void Register_sceNetUpnp(); +void Register_sceNetIfhandle(); + void __NetInit(); void __NetShutdown(); From 5894e8f18f7744ad31d5036d480fc67c622c7f2e Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 21 Feb 2016 07:33:06 +0800 Subject: [PATCH 2/3] Add save status support --- Core/HLE/sceNet.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 75c5bf7d2e..ce1e211f6c 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -91,7 +91,7 @@ static void __UpdateApctlHandlers(int oldState, int newState, int flag, int erro // This feels like a dubious proposition, mostly... void __NetDoState(PointerWrap &p) { - auto s = p.Section("sceNet", 1); + auto s = p.Section("sceNet", 1, 2); if (!s) return; @@ -100,6 +100,13 @@ void __NetDoState(PointerWrap &p) { p.Do(netApctlInited); p.Do(apctlHandlers); p.Do(netMallocStat); + if (s < 2) { + netDropRate = 0; + netDropDuration = 0; + } else { + p.Do(netDropRate); + p.Do(netDropDuration); + } } static u32 sceNetTerm() { @@ -569,7 +576,6 @@ const HLEFunction sceNetUpnp[] = { const HLEFunction sceNetIfhandle[] = { { 0xC80181A2, &WrapI_UU, "sceNetGetDropRate", 'i', "ii" }, { 0xFD8585E1, &WrapI_UU, "sceNetSetDropRate", 'i', "ii" }, - }; void Register_sceNet() { From 1df833cc16025b333f7d1f096761a1e3bff55335 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 21 Feb 2016 13:18:03 +0800 Subject: [PATCH 3/3] Small fix and change log format --- Core/HLE/sceNet.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index ce1e211f6c..002eb03bef 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -468,18 +468,16 @@ static int sceNetUpnpGetNatInfo() static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr) { - INFO_LOG(SCENET, "sceNetGetDropRate %08x,%08x", dropRateAddr, dropDurationAddr); Memory::Write_U32(netDropRate, dropRateAddr); Memory::Write_U32(netDropDuration, dropDurationAddr); - return 0; + return hleLogSuccessInfoI(SCENET, 0); } static int sceNetSetDropRate(u32 dropRate, u32 dropDuration) { - INFO_LOG(SCENET, "sceNetSetDropRate dropRate %d, dropDuration %d", dropRate, dropDuration); netDropRate = dropRate; netDropDuration = dropDuration; - return 0; + return hleLogSuccessInfoI(SCENET, 0); } const HLEFunction sceNet[] = { @@ -574,8 +572,8 @@ const HLEFunction sceNetUpnp[] = { }; const HLEFunction sceNetIfhandle[] = { - { 0xC80181A2, &WrapI_UU, "sceNetGetDropRate", 'i', "ii" }, - { 0xFD8585E1, &WrapI_UU, "sceNetSetDropRate", 'i', "ii" }, + {0xC80181A2, &WrapI_UU, "sceNetGetDropRate", 'i', "pp" }, + {0xFD8585E1, &WrapI_UU, "sceNetSetDropRate", 'i', "ii" }, }; void Register_sceNet() {