Skip to content

Commit

Permalink
Merge pull request #69 from MikeIsAStar/add-method-to-check-custom-re…
Browse files Browse the repository at this point in the history
…gion-usage

[MKW] Add a method to check custom region usage
  • Loading branch information
mkwcat authored Jun 24, 2024
2 parents c32e4f8 + 3bb4469 commit e10c127
Showing 1 changed file with 19 additions and 15 deletions.
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

0 comments on commit e10c127

Please sign in to comment.