NintendoClients icon indicating copy to clipboard operation
NintendoClients copied to clipboard

Server usage examples

Open BurAndBY opened this issue 1 year ago • 17 comments

I found this package very useful, however there are no examples on how to use things like nintendo.nex.matchmaking. MatchMakingServer. Are there any examples (other than the SMB35 repo) for those server classes?

BurAndBY avatar Jan 28 '24 08:01 BurAndBY

This repo has an example server found in the examples folder

https://github.com/kinnay/NintendoClients/blob/master/examples/custom/server.py

You would use the other protocol classes the same way. As for the actual logic behind them, that's an implementation detail and really up to you how you implement it. Also some NEX versions have slightly different requirements especially with matchmaking, so your implementation would also vary by game

We've had instances like this several times over at Pretendo, where one game may expect a matchmaking notification and another may not (as an example)

jonbarrow avatar Jan 28 '24 09:01 jonbarrow

@jonbarrow is right. No other examples unfortunately. If you have a specific question about the match making protocol, feel free to ask and we can try to help.

kinnay avatar Jan 28 '24 09:01 kinnay

This repo has an example server found in the examples folder

https://github.com/kinnay/NintendoClients/blob/master/examples/custom/server.py

You would use the other protocol classes the same way. As for the actual logic behind them, that's an implementation detail and really up to you how you implement it. Also some NEX versions have slightly different requirements especially with matchmaking, so your implementation would also vary by game

We've had instances like this several times over at Pretendo, where one game may expect a matchmaking notification and another may not (as an example)

This is very useful, thanks! I was looking at the matchmaking_mk8d code to try serve it, since it has the full server code and as far as I understand I need to run the servers mk8d uses

BurAndBY avatar Jan 28 '24 09:01 BurAndBY

@jonbarrow is right. No other examples unfortunately. If you have a specific question about the match making protocol, feel free to ask and we can try to help.

This example is good enough and it tells what parts are coded specifically for SMB35 and which ones are the base code needed

BurAndBY avatar Jan 28 '24 09:01 BurAndBY

This is very useful, thanks! I was looking at the matchmaking_mk8d code to try serve it, since it has the full server code and as far as I understand I need to run the servers mk8d uses

It has the skeleton of the protocol but you'll still need to implement all the actual functionality by hand. You'll also probably need to run your own account server, unless there's some other way to force the game to connect? I haven't looked much into the Switch's architecture myself yet, to be honest. I assume it gets the NEX servers location from the account server much like the WiiU/3DS do

jonbarrow avatar Jan 28 '24 09:01 jonbarrow

This is very useful, thanks! I was looking at the matchmaking_mk8d code to try serve it, since it has the full server code and as far as I understand I need to run the servers mk8d uses

It has the skeleton of the protocol but you'll still need to implement all the actual functionality by hand. You'll also probably need to run your own account server, unless there's some other way to force the game to connect? I haven't looked much into the Switch's architecture myself yet, to be honest. I assume it gets the NEX servers location from the account server much like the WiiU/3DS do

Oh, that makes a lot of sense, thanks!

BurAndBY avatar Jan 28 '24 09:01 BurAndBY

You'll also probably need to run your own account server, unless there's some other way to force the game to connect? I haven't looked much into the Switch's architecture myself yet, to be honest. I assume it gets the NEX servers location from the account server much like the WiiU/3DS do

No, the Switch finds the game servers by DNS lookup. The easiest way to connect with a custom server is to write an IPS patch that replaces the game server URL. This is what I did with SMB35 as well.

kinnay avatar Jan 28 '24 09:01 kinnay

No, the Switch finds the game servers by DNS lookup. The easiest way to connect with a custom server is to write an IPS patch that replaces the game server URL. This is what I did with SMB35 as well.

That's right, my bad. I remember that from your wiki now, ignore me

jonbarrow avatar Jan 28 '24 09:01 jonbarrow

You'll also probably need to run your own account server, unless there's some other way to force the game to connect? I haven't looked much into the Switch's architecture myself yet, to be honest. I assume it gets the NEX servers location from the account server much like the WiiU/3DS do

No, the Switch finds the game servers by DNS lookup. The easiest way to connect with a custom server is to write an IPS patch that replaces the game server URL. This is what I did with SMB35 as well.

And what about the dauth/nso check switch does on connection, how to bypass that? I presume a patch too?

BurAndBY avatar Jan 28 '24 10:01 BurAndBY

Yes. It depends on the game, but you probably want to look for the following functions:

  • nn::account::EnsureNetworkServiceAccountAvailable
  • nn::account::EnsureNetworkServiceAccountIdTokenCacheAsync
  • nn::account::GetNetworkServiceAccountId
  • nn::account::LoadNetworkServiceAccountIdTokenCache

kinnay avatar Jan 28 '24 11:01 kinnay

And does F-Zero 99 use libeagle too? It seems so, but it's not mentioned in the wiki.

BurAndBY avatar Jan 29 '24 10:01 BurAndBY

Yes it does, I just checked and updated the wiki. Its version string is 2.5.5, so the protocol is probably the same as in SMB 35 and Pac-Man 99.

kinnay avatar Jan 29 '24 11:01 kinnay

Yes it does, I just checked and updated the wiki. Its version string is 2.5.5, so the protocol is probably the same as in SMB 35 and Pac-Man 99.

Great to know, thanks!

BurAndBY avatar Jan 30 '24 07:01 BurAndBY

You'll also probably need to run your own account server, unless there's some other way to force the game to connect? I haven't looked much into the Switch's architecture myself yet, to be honest. I assume it gets the NEX servers location from the account server much like the WiiU/3DS do

No, the Switch finds the game servers by DNS lookup. The easiest way to connect with a custom server is to write an IPS patch that replaces the game server URL. This is what I did with SMB35 as well.

And what about the dauth/nso check switch does on connection, how to bypass that? I presume a patch too?

I have a question on this. Instead of the patch for the game server url, couldn't you disable certificate check and custom DNS to point into your game/authentication server?.

Same logic could go on dauth/nso checks?, I could run my own dauth/nso servers with certificate check and custom DNS, correct?

damartcode avatar Apr 30 '24 02:04 damartcode

Correct. Here's a repo that disables certificate checks: https://github.com/misson20000/exefs_patches.

kinnay avatar Apr 30 '24 05:04 kinnay

Kinnay, would you appreciate implementations for the dauth/nso servers in the repo?

damartcode avatar May 02 '24 02:05 damartcode

Not here, but I have a server implementation elsewhere: https://github.com/nintendo-playground/.

It currently implements dauth and aauth up to system version 14.1.2.

kinnay avatar May 02 '24 10:05 kinnay