diff --git a/payload/import/mkw/net/itemHandler.hpp b/payload/import/mkw/net/itemHandler.hpp index 9a8b4ab..b56e67c 100644 --- a/payload/import/mkw/net/itemHandler.hpp +++ b/payload/import/mkw/net/itemHandler.hpp @@ -1,8 +1,6 @@ #pragma once #include "import/mkw/item.hpp" -#include "import/mkw/system/raceManager.hpp" -#include "net.hpp" namespace mkw::Net { @@ -100,7 +98,7 @@ class ItemHandler } } - /* 0x00 */ u8 receivedTime; + /* 0x00 */ u8 _00; /* 0x01 */ u8 heldItem; /* 0x02 */ u8 trailedItem; /* 0x03 */ HeldPhase heldPhase; @@ -110,40 +108,13 @@ class ItemHandler static_assert(sizeof(Packet) == 0x08); - Packet& sendPacket(u32 localPlayerIndex) - { - return m_sendPacket[localPlayerIndex]; - } - - void setReceivedTime(u32 receivedTime, u32 playerIndex) - { - m_receivedTime[playerIndex] = receivedTime; - } - - void broadcastDecidedItem(u32 playerId, mkw::Item::ItemBox item) - { - u32 localPlayerIndex = - RacePacketHandler::Instance()->playerIdToLocalPlayerIndex(playerId); - u32 timer = mkw::System::RaceManager::Instance()->timer(); - u8 myAid = NetController::Instance()->myAid(); - - Packet& packet = sendPacket(localPlayerIndex); - packet.receivedTime = (myAid << 1) + localPlayerIndex; - packet.heldItem = static_cast(item); - packet.heldPhase = Packet::HeldPhase::Decided; - setReceivedTime(timer & 0xFFFFFFF8, playerId); - } - static ItemHandler* Instance() { return s_instance; } private: - /* 0x000 */ Packet m_sendPacket[2]; - /* 0x010 */ u8 _010[0x0A0 - 0x010]; - /* 0x0A0 */ u32 m_receivedTime[12]; - /* 0x0D0 */ u8 _0D0[0x184 - 0x0D0]; + /* 0x000 */ u8 _000[0x184 - 0x000]; static ItemHandler* s_instance AT(RMCXD_PORT(0x809C20F8, 0x809BD950, 0x809C1158, 0x809B0738)); diff --git a/payload/import/mkw/net/net.hpp b/payload/import/mkw/net/net.hpp index 3cf3bf2..41dbb1f 100644 --- a/payload/import/mkw/net/net.hpp +++ b/payload/import/mkw/net/net.hpp @@ -10,32 +10,6 @@ namespace mkw::Net #if RMC -class RacePacketHandler -{ -public: - u32 playerIdToLocalPlayerIndex(u32 playerId) - { - LONGCALL u32 playerIdToLocalPlayerIndex( - RacePacketHandler * racePacketHandler, u32 playerId - ) AT(RMCXD_PORT(0x80654918, 0x80650490, 0x80653F84, 0x80642C30)); - - return playerIdToLocalPlayerIndex(this, playerId); - } - - static RacePacketHandler* Instance() - { - return s_instance; - } - -private: - /* 0x000 */ u8 _000[0x1C8 - 0x000]; - - static RacePacketHandler* s_instance - AT(RMCXD_PORT(0x809C1F50, 0x809BD790, 0x809C0FB0, 0x809B0590)); -}; - -static_assert(sizeof(RacePacketHandler) == 0x1C8); - struct __attribute__((packed)) RacePacket { enum EType { Header, diff --git a/payload/import/mkw/system/raceManager.hpp b/payload/import/mkw/system/raceManager.hpp deleted file mode 100644 index 86bdfc8..0000000 --- a/payload/import/mkw/system/raceManager.hpp +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include - -namespace mkw::System -{ - -#if RMC - -class RaceManager -{ -public: - u32 timer() const - { - return m_timer; - } - - static RaceManager* Instance() - { - return s_instance; - } - -private: - /* 0x00 */ u8 _00[0x20 - 0x00]; - /* 0x20 */ u32 m_timer; - /* 0x24 */ u8 _24[0x4C - 0x24]; - - static RaceManager* s_instance - AT(RMCXD_PORT(0x809BD730, 0x809B8F70, 0x809BC790, 0x809ABD70)); -}; - -static_assert(sizeof(RaceManager) == 0x4C); - -#endif - -} // namespace mkw::System diff --git a/payload/wwfcFeature.cpp b/payload/wwfcFeature.cpp index 3a3e809..439972b 100644 --- a/payload/wwfcFeature.cpp +++ b/payload/wwfcFeature.cpp @@ -1,4 +1,3 @@ -#include "import/mkw/net/itemHandler.hpp" #include "import/mkw/net/selectHandler.hpp" #include "import/mkw/net/userHandler.hpp" #include "import/mkw/ui/page/friendRoomPage.hpp" @@ -255,21 +254,6 @@ WWFC_DEFINE_PATCH = { ), }; -// Fix a bug that leads to the rejection of one's item request without -// justification -WWFC_DEFINE_PATCH = { - Patch::BranchWithCTR( // - WWFC_PATCH_LEVEL_BUGFIX | WWFC_PATCH_LEVEL_PARITY, // - RMCXD_PORT(0x8065C6C0, 0x8065D348, 0x8065BD2C, 0x8064A9D8), // - // clang-format off - [](mkw::Net::ItemHandler* itemHandler, u32 playerId, - mkw::Item::ItemBox item) -> void { - itemHandler->broadcastDecidedItem(playerId, item); - } - // clang-format on - ), -}; - // Reset the timer that is used to detect if clients are stalling the room WWFC_DEFINE_PATCH = { Patch::CallWithCTR( //