Homebrew Save Nintendo WiFi - A project to save online servers for DS (and Wii) games

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
That should be fine.

No, nobody has sent in stuff for Pokemon yet. I would imagine there are a lot of communities working on them since Pokemon is so big but I would accept packets for those games. But Pokemon games have a lot of different online functions and all of them will have to be recorded.
 

Asfand

Member
Newcomer
Joined
Aug 5, 2012
Messages
18
Trophies
0
XP
32
Country
United States
Ok, I was thinking of sending in packets for all the Yugioh games, but I don't know if I'll be able to get recordings for those, will it be necessary?
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
I don't know. Unless I get a dump from the game I don't know whether it just uses the stock GameSpy servers or something custom.
 

pleonex

Well-Known Member
Member
Joined
Jan 16, 2009
Messages
204
Trophies
1
Location
Spain & Switzerland
Website
github.com
XP
523
Country
Switzerland
Here is a version of DeSmuME that export every packet sent or received. The packets will be stored in a PCAP file (the same format that use Wireshark). It will create a PCAP file per Wi-Fi connection. With this version of the emulator Wireshark it is not needed to get the dumps, so it's easier and faster to get them.

The base version is rev3947, a very old version but the only one that I could compile with Wi-Fi working. It works fine at least with Ninokuni. The zip contains the modified source. The build has been compiled with Wi-Fi and GDB stub enabled.

I am working now in the NOSLL autopatcher.

PD: This revision has a bug and can't load the .dfc config, so the Wi-Fi connection must be set each time the emulator is opened. If anyone could compile a newer revision I could apply the modification to it.

PD2: It includes also the code to dump data once it's known the address of the RC4 function. In the binary it's disabled.
 

Attachments

  • DeSmuME PCAP.zip
    963.1 KB · Views: 569

superfranci99

Active Member
Newcomer
Joined
Dec 26, 2012
Messages
29
Trophies
0
Age
34
XP
179
Country
Italy
Here is a version of DeSmuME that export every packet sent or received. The packets will be stored in a PCAP file (the same format that use Wireshark). It will create a PCAP file per Wi-Fi connection. With this version of the emulator Wireshark it is not needed to get the dumps, so it's easier and faster to get them.

The base version is rev3947, a very old version but the only one that I could compile with Wi-Fi working. It works fine at least with Ninokuni. The zip contains the modified source. The build has been compiled with Wi-Fi and GDB stub enabled.

I am working now in the NOSLL autopatcher.

PD: This revision has a bug and can't load the .dfc config, so the Wi-Fi connection must be set each time the emulator is opened. If anyone could compile a newer revision I could apply the modification to it.

PD2: It includes also the code to dump data once it's known the address of the RC4 function. In the binary it's disabled.


Good job Pleonex
hope it helps to save ds games from the disaster
 

pleonex

Well-Known Member
Member
Joined
Jan 16, 2009
Messages
204
Trophies
1
Location
Spain & Switzerland
Website
github.com
XP
523
Country
Switzerland
Thanks superfranci.

I have finished the programs. Here they are with a little tutorial:

What you need
* A computer with Windows (it works with VirtualBox too).
* Wired (Ethernet) Internet connection (in VirtualBox it isn't needed).
* SSL Autopatcher v1.4: http://www.mediafire.com/download/s5ucc79m6xzrtis/SslPatcher_v1.4.zip
* Desmume PCAP v1.2: http://www.mediafire.com/download/x5odqqph39oaurs/DeSmuME_PCAP_v1.2.zip
* NDS BIOS and Firmware for DeSmuME. It's on Internet.

Steps:
1.- Select a game. Here there is a list of affected games from Nintendo: http://www.nintendo.com/consumer/gameslist/en/games-wifi.jsp
2.- Drag & drop the game over SslPatcher.exe. The program will patch it (if needed) to use only HTTP instead of HTTPS. In that case, it will create a new ROM file in the same folder as the original ROM and appending to the file name "[NOSSL]".
3.- Copy BIOS and Firmware files inside Firmware folder of DeSmuME.
4.- Open DeSmuME PCAP.
4.A.- Go to Config->Wifi Settings. Select Infrastructure and in the menu select your Ethernet network card.
4.B.- Go to Config->Emulation Settings. Check "Use external BIOS images" and select the BIOS files. Check "Use external firmware image" and select the Firmware file.
5.- Play :D

Once the setup is done, you just need to patch a game and play it.

If you can not have an Ethernet connection there are two alternatives as far as I know:
1.- By using two computer and an Ethernet cable, connect them with the cable and in the computer you have the 3G / Wi-Fi connection, configure the network adapter to share the connection with the Ethernet adapter. By doing that the second computer will have Internet using Ethernet and DeSmuME will work there. I can give instruction for both Windows and Linux if anyone need them.

2.- The easier way would be installing Windows inside Virtualbox. In this case just follow the steps, there isn't any extra config.

NOTE 1: You do not need to configure the Wireless connection inside the game. That should be taken from firmware.dfc file (included). The configuration uses the SSL tunnel of Toad King. If you need / want to configure manually just put as DNS server the following address: 199.195.254.155

NOTE 2: Each time you connect to the WFC, DeSmuME will create one (or more than one) ".pcap" file. In that file all the packets sent or received are stored. You can open it with Wireshark. This is the file to share.

NOTE 3: Pay attention if you move DeSmuME of folder, you will need to make all the setup again since the paths in the desmume.ini file are absolute and will point to the old location. This can cause a 20104 error.
 

windwakr

Well-Known Member
Member
Joined
Sep 13, 2009
Messages
502
Trophies
1
Website
windwakr.github.io
XP
1,792
Country
United States
The SSL patcher crashes with:
Code:
Unhandled Exception: System.IO.EndOfStreamException: Attempted to read past the
end of the stream.
  at Libgame.IO.DataStream.ReadByte()
  at SslPatcher.MainClass.Replace(DataStream stream, Int32 pos)
  at SslPatcher.MainClass.SearchAndModify(GameFile file)
  at SslPatcher.MainClass.Main(String[] args)

When I try to use it on Picross 3D.

It also makes Picross DS unplayable. I can patch it with your program, but it crashes with "undefined opcode" in DeSmuME.
 

windwakr

Well-Known Member
Member
Joined
Sep 13, 2009
Messages
502
Trophies
1
Website
windwakr.github.io
XP
1,792
Country
United States
Ok, captured some packets from Picross 3D. Connected to WFC for the first time, viewed and downloaded some puzzles, then disconnected.
http://filetrip.net/dl?pCGpM4Efws
Includes the packet capture, the final save file, and a video showing the game as I was capturing the packets.

Could be useful in the future if someone wants to implement a download server or something.


EDIT: Re-encoded the video as h.264. 1/7th the size, nearly the same quality.
 

GamerzHell9137

Well-Known Member
Member
Joined
Nov 1, 2011
Messages
4,038
Trophies
2
Age
28
XP
3,720
Country
Bosnia and Herzegovina
Thanks for reporting. I have fixed it and tested with that game.
Here is the new version: http://www.mediafire.com/download/ktdedyh4f7668xs/SslPatcher_v1.1.zip


Crashes with Rune Factory 3 US version

51e3f4ff68.jpg
 

pleonex

Well-Known Member
Member
Joined
Jan 16, 2009
Messages
204
Trophies
1
Location
Spain & Switzerland
Website
github.com
XP
523
Country
Switzerland
Crashes with Rune Factory 3 US version

51e3f4ff68.jpg

It's not a problem of compatibility because I have just tested with that game and it works fine.
The error says: Access to the path 'C:\Users\Gamez\Desktop\New folder (2)\Rune Factory 3.nds' is denied I think it's because your ROM file is "read only" and in my last quick fix I am opening the files as "Read & Write".

This new version should fix it: http://www.mediafire.com/download/oea24eqa422p7g6/SslPatcher_v1.2.zip
Thanks :D
 

GamerzHell9137

Well-Known Member
Member
Joined
Nov 1, 2011
Messages
4,038
Trophies
2
Age
28
XP
3,720
Country
Bosnia and Herzegovina
It's not a problem of compatibility because I have just tested with that game and it works fine.
The error says: Access to the path 'C:\Users\Gamez\Desktop\New folder (2)\Rune Factory 3.nds' is denied I think it's because your ROM file is "read only" and in my last quick fix I am opening the files as "Read & Write".

This new version should fix it: http://www.mediafire.com/download/oea24eqa422p7g6/SslPatcher_v1.2.zip
Thanks :D


Will check that tomorrow but i have tested Tetris DS meanwhile.

European version, the NOSSL version bring up a white screen on DeSmuMe while booting the game.
The non patched works fine, i can login to WFC and have played 2 times with a guy in 2P mode.
The only weird thing is when you lose the game still goes on and after a while it goes into the " You Lose " screen. *
1st time i got delayed* and then disconnected with him and second time was fine but only the delay* was there.

Here's the pcap file, tomorrow i'll make a video if its needed.
 

Attachments

  • ATRP [30-02-53-39].rar
    85.8 KB · Views: 233

GHANMI

Well-Known Member
Member
Joined
Jun 10, 2012
Messages
969
Trophies
0
XP
914
Country
I'd really love to help but I only have a 3g connection.
Is it possible at all to use that Wifi build?
 

Toad King

Well-Known Member
OP
Member
Joined
Aug 19, 2009
Messages
374
Trophies
0
XP
546
Country
United States
Will check that tomorrow but i have tested Tetris DS meanwhile.

European version, the NOSSL version bring up a white screen on DeSmuMe while booting the game.
The non patched works fine, i can login to WFC and have played 2 times with a guy in 2P mode.
The only weird thing is when you lose the game still goes on and after a while it goes into the " You Lose " screen. *
1st time i got delayed* and then disconnected with him and second time was fine but only the delay* was there.

Here's the pcap file, tomorrow i'll make a video if its needed.

I've found that some games don't work well if you extract them and try to repackage them, but if you get an edited version of the arm9 binary/overlay and manually hex edit it back into the original ROM that will work. With some ROM parsing (or even brute force searching) this can be implemented into that tool for every case except the one where a new compressed overlay is not the same size as the old one.
 

pleonex

Well-Known Member
Member
Joined
Jan 16, 2009
Messages
204
Trophies
1
Location
Spain & Switzerland
Website
github.com
XP
523
Country
Switzerland
I'd really love to help but I only have a 3g connection.
Is it possible at all to use that Wifi build?
If you don't have an Ethernet connection there are two alternatives as far as I know:
1.- If you have two computer and an Ethernet cable, connect them with the cable and in the computer you have the 3G connection, configure the network adapter to share the connection with the Ethernet adapter. By doing that the second computer will have Internet using Ethernet and DeSmuME will work there. I can give instruction for both Windows and Linux if you need them.

2.- The easier way would be installing Windows inside Virtualbox, in that case you can use any way of Internet connection since VirtualBox emulate an Ethernet connection inside the virtual machine. The problem is that running DeSmuME inside it could be slowly, but it works!

I've found that some games don't work well if you extract them and try to repackage them, but if you get an edited version of the arm9 binary/overlay and manually hex edit it back into the original ROM that will work. With some ROM parsing (or even brute force searching) this can be implemented into that tool for every case except the one where a new compressed overlay is not the same size as the old one.
I think the problem it is not with overlay files. If they are compressed, you can decompress them with the "blz.exe" program by CUE. Then edit them, and compress again. If after the new compression their file size change, you need to modify a value that indicate the size of the Overlay inside the file "y9.bin" (the overlay table). This is done automatically by the tool.

The problem is the ARM9.bin file. If it's compressed, there is a 32-bit value somewhere that indicates the size of the file compressed. If after the new compression the file size change, this value must be updated. The problem is that the value is not in a fixed position and there isn't any standard way to find it. In fact, the way I search it in my tool it's a little bit complex: I search for the bytes of some ARM instructions of the decompression code, then I search for a MOV instruction that assign the value to a register... Let's say that I analyze code and that can not work always. Anyway, I will try to fix it, but as far as I know CrystalTile2 does the work of finding and updating that value very well (I don't know how...), it could be used.

EDITED:
I have found the problem. I was using an old version of the program "blz.exe". Here is the pack with the last version that fix the problem with Tetris DS game: http://www.mediafire.com/download/jclbhw1pscfk16b/SslPatcher_v1.3.zip

My algorithm to find that value in the ARM9 seems to work always :D
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
There are some games that fail to work with a ndstool unpack and repack, New Super Mario Brothers being one of the more notable here.

Treeki (the original NSMB-editor author) explained it in a forum post I read someone in that there are two opens in the DS SDK (a very fast one and a slightly slower one that uses the lookup table). Treeki's nitro explorer (which he did release the source code to and I stuck it up on filetrip ( http://filetrip.net/nds-downloads/utilities/download-nitroexplorer-2b-source-f32331.html ) handles this and manually injecting will sort it as well.

On compression though if you want you can always edit the header section/ovt file that says it is compressed or not. http://gbatemp.net/threads/recompressing-an-overlay-file.329576/#post-4386857
I do like to return things to as close to the original as I can get but you can dodge it here.
 

Master X

Well-Known Member
Member
Joined
Mar 21, 2010
Messages
165
Trophies
1
XP
616
Country
United States
What would be best kind of logs? Logs from games run through emuators, or physical cartridges?

I'll go through my collection in the morning, but top of my head I've got 5 or 6 (Not counting pokemon, but I've got the majority of those games. But I'm assuming other groups are working on saving wifi for that series) that you don't have logs for yet.

Edit - AActually, found a list that I made a few months ago. Here's what I've got

Bleach The Blade of Fate
Castlevania Portrait of Ruin
Custom Robo Arena
Dragon Quest Monsters Joker
Lumonious Arc
Fossil Fighters Champions
Mario VS Donkey Kong Miniland Mayhem
Rune Factory
Star Fox Command
Sukioden Tierkreis
Tron Evolution
Yugioh WC 2008
Yugioh GX Spirit Caller

I'll see about getting logs in the morning - Any prefrence for which ones I do first though?
 

orochi115

Well-Known Member
Member
Joined
Jun 8, 2013
Messages
157
Trophies
0
Age
44
XP
222
Country
Switzerland
Sorry for the lack of updates on my end lately. I've been really busy with other stuff so I've kinda lost motivation to work on this for now. Having said that, I've been working with someone for the past few weeks trying to get a server set up but it's taking longer than I expected because of some problems that are hard to pinpoint at the moment. I'm not really able to work on improving the server much at this point until we get more people playing on it, so it's stuck at a standstill right now. All of the code is on Github for anyone who wants to poke around and make their own changes. Please feel free to send pull requests if you change something that you think benefits the server as a whole. I know that the documentation is pretty lacking, so send me a PM if you need help understanding how something works and I'll try to help.

Thank you very much for your amazing work!

Do you have any public server for us easy to test?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: https://www.keepretro.com/products/miyoo-a30