Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MKW] Add a method to check custom region usage #69

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions payload/import/mkw/net/net.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ class NetController
return m_joinType == JoinType::RoomHost;
}

bool usingCustomRegion() const
{
using namespace mkw::HostSystem;

// Allow clients to modify their region without having to change
// their matching area.
extern SystemManager::MatchingArea customMatchingArea AT(0x80005EFC);
if (customMatchingArea < SystemManager::MatchingArea::Japan ||
customMatchingArea > SystemManager::MatchingArea::China) {
return true;
}

SystemManager::MatchingArea matchingArea =
SystemManager::Instance()->matchingArea();
return matchingArea < SystemManager::MatchingArea::Japan ||
matchingArea > SystemManager::MatchingArea::China;
}

bool inVanillaMatch() const
{
switch (m_joinType) {
Expand All @@ -135,21 +153,7 @@ class NetController
case JoinType::ContinentalBattle:
case JoinType::FriendContinentalVersusRace:
case JoinType::FriendContinentalBattle: {
using namespace mkw::HostSystem;

// Allow clients to modify their region without having to change
// their matching area.
extern SystemManager::MatchingArea customMatchingArea AT(0x80005EFC
);
if (customMatchingArea < SystemManager::MatchingArea::Japan ||
customMatchingArea > SystemManager::MatchingArea::China) {
return false;
}

SystemManager::MatchingArea matchingArea =
SystemManager::Instance()->matchingArea();
return matchingArea >= SystemManager::MatchingArea::Japan &&
matchingArea <= SystemManager::MatchingArea::China;
return !usingCustomRegion();
}
case JoinType::RoomHost:
case JoinType::RoomGuest: {
Expand Down