text stringlengths 0 1.99k |
|---|
The reason we cannot query players easily is because their "data ID" |
equivalent is not the internal ID used by the game. Wheras a course is |
associated with its data ID by every part of the game a maker ID's |
corresponding data ID is only used to generate that maker ID by Nintendo, |
summarily being ignored. The game actually uses PIDs, or Principal IDs, to |
refer to players, and these are randomized unsigned 64 bit integers on the |
switch. PID to maker ID is not reversible. While one can be used to query |
the other the direction we care about, maker ID to PID, can only be |
performed by GetUserOrCourse (method 131), and it only supports one maker ID |
at a time. Used in-game for a search bar it is not optimized for speed. The |
next best thing is just to collate all PIDs collected from other methods, |
assuming that one of the following applies to every player in the game: |
* Created a course |
* First cleared a course |
* Has an active WR on a course |
* Was one of the last 1000 players to play a course, |
whether they beat it or not |
* Has played a Ninji event course while it was active |
* Is within the top 1000 players on any in-game leaderboard (number of maker |
points, score in endless mode, etc) |
After finishing off with the Ninji data, which included the only queryable |
replays in the game, and calling the other methods I had implemented with |
each player I had collected in total, the scrape was done. It had taken 3 |
months and was performed on dorm gigabit internet at my university. The |
result I uploaded to HuggingFace with the hope that machine learning |
researchers can interpret the results and extrapolate some interesting |
findings. That, or it can bolster the development of LLMs or discrete |
diffusion models. |
--< 6. Opening A Public Server |
After the completion of the scrape it made sense to replace the feed |
entirely. By this I mean the classic final frontier in game modding related |
to protocol reimplementation: custom servers. That way no technical |
limitation, or action on the part of Nintendo, has an impact. |
Custom clients, the topic of this paper and my main work, are exceptional |
starts and the only way to have live data from the feed, as well as being |
more directly usable by an audience. Custom servers, however, are the best |
way to follow up a custom client. Assuming a modded official client or |
another custom client it's possible to hook into a new feed entirely. The |
company behind the feed may not have any interest in archival, or may not |
send out timely updates or may shut down the service with no recourse. With |
SMM2 having been around 5 years old by that time it was not, and still is |
not, an impossibility that Nintendo was considering shutting down the |
servers in a few years |
This final step was possible thanks to the help of a number of developers |
who had begun building tools around the API following the technical |
discoveries made: Kramer, Wizulus, jneen and Shadow. Kramer had begun |
developing a Golang server implementing the NEX protocol, using |
NintendoClients as a base. When he reached out to the rest of us we began |
contributing. |
NEX has a saving grace in regards to custom server development: the binary |
format of requests and responses are very similar. Same versioning scheme, |
same protobuf format and generally a 1-to-1 request to response protocol. |
In other words, NEX is a RPC protocol. RPC protocols are easier to |
reimplement because one only needs to search for packets known to be for |
requests and observe what comes immediately after, knowing that most of the |
response is influenced by only the request data. Well, certainly easier than |
the alternative but server -> client requests are still difficult. |
For example RegisterUser (method 47) seems to suggest a one-time call with |
important user info. We need to know a few things about a new user in order |
for other methods across the server to work (like GetUsers) so understanding |
the request payload is critical. Because this method was never exposed in |
the public API it had never been documented by me or others. Some of the |
things we need to know are: usernames, miis and regions. So how do we begin |
to dissect a request payload? |
Instead of tweaking the exact payload sent we tweak the black box producing |
the payload, ie the official client. If we change our username what changes? |
If we change our mii what changes? Not just what changes but how often. An |
hour long MITM session may be necessary to figure out when this method fires |
in the first place. We discovered that this is not strictly a method for |
registering users, as we discovered this is indeed the first identifying |
request made by the official client, but also a method for modifying users. |
Username changes trigger this method, so we can't create a user profile in |
our database without checking to see if we've seen this player before. |
But what in the payload we're sent is identifying? We're sent the username, |
current outfit, mii, region, country code and the device ID. So of all these |
fields device ID seems like the most promising ID. Indeed, on the official |
client this field is identifying to the hardware, but we encountered a |
problem when swapping out the official client with a custom client, namely a |
Nintendo Switch emulator. Ryujinx does not have a hardware ID, it's a |
portable emulator that could very well be running on a chromebook as much as |
a Window's PC! So their solution is sending `0xcafe` [34]. |
We can find our own solution to this. The way in which we mod the official |
client to redirect calls to our custom server is by hijacking a function |
call that calls `snprintf` to generate the initial websocket connection |
request http call. Instead of copying the http call used by the official |
client and inserting just our our own domain, as we previously did, we can |
add our own header with our own identifying information. A player's account |
is entirely independent of Nintendo. This means they can register on our |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.