From a54cfa48e067ed0a0a67fa138c2952dc217c3288 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 13 May 2014 15:36:37 +0200 Subject: [PATCH 1/2] Implement "SVCLOC" action. This appears to be sent by the DS to find a download server for DLC files. --- nintendo_nas_server.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nintendo_nas_server.py b/nintendo_nas_server.py index b8f48b9..bee14bf 100644 --- a/nintendo_nas_server.py +++ b/nintendo_nas_server.py @@ -70,6 +70,15 @@ class NintendoNasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): logger.log(logging.DEBUG, ret) self.wfile.write(self.dict_to_str(ret)) + + elif action == "SVCLOC": + ret["returncd"] = "007" + ret["statusdata"] = "Y" + ret["svchost"] = "dls1.nintendowifi.net" + + logger.log(logging.DEBUG, "SVCLOC response to %s", self.client_address) + logger.log(logging.DEBUG, ret) + self.wfile.write(self.dict_to_str(ret)) elif self.path == "/pr": length = int(self.headers['content-length']) From 43076f35af97941b80bff187120e950e7106fa8b Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 13 May 2014 15:53:38 +0200 Subject: [PATCH 2/2] Request to list filecount should not include the file list. --- nintendo_nas_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nintendo_nas_server.py b/nintendo_nas_server.py index bee14bf..6a3c0ed 100644 --- a/nintendo_nas_server.py +++ b/nintendo_nas_server.py @@ -110,6 +110,10 @@ class NintendoNasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): if os.path.exists(dlcpath): count = len(os.listdir(dlcpath)) + + # the above counts the file list as a file too, subtract that again if it exists + if os.path.isfile(dlcpath + "/_list.txt"): + count -= 1 ret = "%d" % count