LoginLogin

PetitModem

Root / Talk About Programs / [.]

TechokamiCreated:
So, here's something important and useful. The primary means of sharing projects in SmileBASIC is to use the cloud server SmileBoom is running. While this is very easy to use and quite useful, there are three major "GOTCHA" kind of problems: 1) SmileBoom is actively policing the server and things uploaded to it. They have been very quick with deleting - without warning - any fangame or game clone projects. So awesome projects like Mega Man 2 PTC ( http://petitcomputer.wikia.com/wiki/MegaMan_2_PTC ) are going to be killed if distributed on the cloud. 2) You can't back up your work from your 3DS or the cloud to your PC in a readable format. The files on your SD Card are heavily encrypted, and can't be used on any other 3DS system. 3) If SmileBoom unplugs the server, you're hosed. (Anyone remember SwapNote?) Thankfully, a Japanese user created a clever solution, using old microcomputer tech! Back in the early 80s, before floppy disks were affordable for home users of microcomputers (like the Commodore PET, VIC-20, and ZX Spectrum), you generally used cassette tapes to store and load data. A modem device in the microcomputer would modulate the data into audio sound to be recorded onto the tape to store, and demodulated from audio back into data to load. It wasn't very fast, but it worked and was affordable, until floppy disks came down in price. So... one of the features of SmileBASIC is that you can use the microphone... which led to the creation of PetitModem! http://rei.to/petitmodem_en.html One program on your Windows PC, one program loaded in SmileBASIC. You can use it to freely transfer files between the 3DS and PC! At a, ahem, blisteringly "fast" 1200 baud. (That's 92 bytes/second with error correction on, 112 bytes/second without) To get the most out of this, I suggest getting a splitter like this: http://www.amazon.com/Extrasensory-Devices-ESDHW011-Headphone-Microphone/dp/B006T65CXE Combine this with some cheap audio cables, and you can connect directly into your computer. Just remember to plug the headset lead into the microphone jack, and the microphone lead into the speaker jack. This avoids issues with background noise and allows for using faster speeds. I've noticed that some Japanese SmileBASIC sites provide code via a browser-based audio player, using the same technology. Maybe something similar can be considered for this site?

Wow, that is wild. That is not the workaround I was expecting to this limitation.

Can it send files from the computer to SmileBASIC?

PetitEditor is good for programming on PC and sending to Smilebasic. As for implementing it here... we thought about it some a while ago. It's possible, yes, but it depends whether people will want to bother uploading their files over modem/saving to SD and adding when it's so easy to just list the download key for most things. It wouldn't happen for some time, anyway. Also, it's REALLY slow, and your "blistering fast" comment is actually kind of misleading. I don't remember the exact statistics, but one of those sites said a 9000 or something line program can take 4 HOURS to send. And then there are graphical assets too. In other words, it wouldn't be a very good choice for, oh, I don't know, Megaman 2 PTC. It's certainly possible, but it might not be worthwhile and it definitely won't be soon.

What is the best method for people to send files to and from their computer to SmileBASIC?

Can't we rewrite the modem, to use a faster protocol? For example, what (A)DSL uses, can't that work? It's MUCH faster than what you've described and also works via audio. Fax, too. Point is there's a lot of ways to send data via audio, and I'm having trouble believing that 96 bytes/second is the fastest speed possible.

Yeah, Petit Modem is really slow. I've been messing.G around with it, but I haven't taken the time to see if I can fully import a program or graphic. I want to find out how P/SEND works, but I can't seem to get it right. I have a male/male cable, but that doesn't seem to do anything. If anyone figures it out, please let me know!

Also, it's REALLY slow, and your "blistering fast" comment is actually kind of misleading.
Actually it was supposed to be sarcasm, but I didn't sarcasm correctly >_> I'll edit the post.
Can't we rewrite the modem, to use a faster protocol? For example, what (A)DSL uses, can't that work? It's MUCH faster than what you've described and also works via audio. Fax, too. Point is there's a lot of ways to send data via audio, and I'm having trouble believing that 96 bytes/second is the fastest speed possible.
I have a funny feeling the limitation is due to how fast SmileBASIC and the 3DS can process the data with a modem that's entirely in software, and the afforded mic quality on the 3DS.
I have a male/male cable, but that doesn't seem to do anything.
3DS uses a composite headset connection. This combines microphone and speakers into one connection. You can't use just a single male/male cable, you need a composite splitter (I linked to a cheap one on Amazon in the OP that works well) and two male/male cables, crossing them over so that the 3DS microphone goes into the speaker jack in your computer, and the 3DS speaker goes into the microphone jack in your computer. This is because both the 3DS and PC are actively talking to each other to transfer data.
What is the best method for people to send files to and from their computer to SmileBASIC?
As of right now, just this, and similar implementations. :/ SmileBASIC removed a lot of the older data transmission methods. No QR Code support, SENDFILE and RECVFILE are gone. The only authorized way to send a file from one 3DS to another is to upload it to SmileBoom's server, get it authorized for public viewing, and download it on the other system. Sending files between the 3DS and PC, SmileBoom does not want. There are three potential ideas (that I've come up with) for alternatives to data transfer: 1) File Transfer program using the local multiplayer functions provided with SmileBASIC - Yes, you can write a program that talks to other 3DSes for multiplayer games. So why not use it to just shove bytes to the other console as fast as we can? The only problem is that both users need the transfer app to begin with, which isn't that much of a problem right now with the cloud server being around, but if SmileBoom shuts it down it might get messy. Perhaps a simple type-and-run bootstrap program that connects to the sender and pulls down a more feature-complete client? We can dynamically change the code as needed, as that's one of the features of SmileBASIC. 2) Local wireless intercept - Similar to above, but the other user is actually a PC pretending to be a 3DS. I know there has been a lot of work in spoofing wireless stuff on Nintendo's handheld platforms, but it might not be practical due to needing special hardware. An alternate take would be to use a custom DNS server to point SmileBASIC to some other computer than SmileBoom's server, and thus get files that way. 3) Get crypto keys for SD Card files - Once you have that, you can just encrypt/decrypt the files on the SD Card, and bypass everything. However, this might be messy, because the extdata is stored very differently than how it is presented in SmileBASIC, and the key will be different for each user. Can we poke this info with a homebrew tool?

Mmm that's what I thought. Sorry. It can be made faster with an ideal setup and reducing the amount of error correction, but without a good quality cable capable of doing this you do need high error correction. Another limiting factor is the capabilities of the microphone data collection. So erm, there are a few possible ways to increase the efficiency. I'm not knowledgeable enough to discuss them in depth, but maybe we could make it feasible.

But doesn't P/SEND only require one cable? It only seems to send data to the 3DS, and that's it. The two devices don't need to talk to each other in any way. I've ordered a cable, but I guess I'll order the splitter as well if that doesn't work out.

Which homebrew tool? the save data manager tool?

Which homebrew tool? the save data manager tool?
Well, I figured a homebrew solution would be available to extract the SD Card encryption keys from a user's 3DS, but I guess not. Files aren't stored in the SmileBASIC save file, only some settings. The files are in the extdata directory.

I don't know if this works, but there is a thing I found https://www.reddit.com/r/3DS/comments/gh5d2/3ds_savefile_encryption_has_been_cracked_the_game/ Could work for this.

The key itself is different for every extdata file, since it depends on the file location in the directory structure, so unfortunately there's no one 'key'... It is possible to decrypt saved extdata files off the SD card without even knowing any key, but until someone figures out how the 20-byte hash is calculated, it's only one-way from 3DS to PC.

3) Get crypto keys for SD Card files - Once you have that, you can just encrypt/decrypt the files on the SD Card, and bypass everything. However, this might be messy, because the extdata is stored very differently than how it is presented in SmileBASIC, and the key will be different for each user. Can we poke this info with a homebrew tool?
Yeah, the programs are stored in the game's extended save data instead of raw files in the SD card, I have no idea why. You can't really decrypt the whole SD card content without a fully exploitable 3DS (fw 9.2 or lower). You can manage some extdata with homebrews but it seems SmileBASIC's files are out of reach.

I was thinking about trying to make a QR code generator, but that's not a faster way from getting from the PC to the 3DS.

Ah, actually it's possible to dump and inject files with this tool, even on the latest fw (10.1) https://gbatemp.net/threads/3ds-extdata-dump-and-restore-tool-extra-data-editing.378492/

That's just home menu savedata though. Should be possible to change it to reg titles though. (edit: it's for game extdata too, nice find. now we need to refine it for smilebasic)

Yeah, the programs are stored in the game's extended save data instead of raw files in the SD card, I have no idea why.
The extdata at least has no size limit, unlike save data which has one set by Nintendo per app.
That's just home menu savedata though. Should be possible to change it to reg titles though.
That screenshot shows SOLID GUNNER from SmileBASIC...

In case anyone is interested (it took me ages to gather all this info, I hope to save some others the trouble): There are two standards for audio ports that combine stereo output with mono input. One is called OMTP, the other is called CTIA. The splitter mentioned by Techokami in the original post is OMTP (according to "Gnemik" who wrote about it on the Amazon website). If you buy a CTIA splitter, it likely will not work, unless you also get a CTIA/OMTP converter. If you're interested in the details: The 3.5mm connector for stereo headphones is called TRS - there is a conducting Tip, a band of insulation, a conducting Ring, a band of insulation, and a conducting Sleeve: Tip, Ring, Sleeve makes TRS. The tip is the signal for the left ear, the ring is the signal for the right ear, and the sleeve is ground; this is denoted LRG. The 3.5mm connector for headsets (that is, stereo headphones with a mono microphone) is called TRRS, because there is a second conducting ring between the tip and the sleeve. Using the letter M for microphone, one standard (OMTP) orders the signals LRMG, and the other standard (CTIA) orders the signals LRGM. So: For the 3DS, use the OMTP, or LRMG, standard (assuming Techokami and Gnemik are both right). EDIT: I purchased that splitter, and it is CTIA (LRGM). Either Gnemic got it wrong, or I misinterpreted his message (it was indirect). I have used a multimeter to verify that the ring near the sleeve, and not the sleeve itself, is electrically connected to the negative terminal of the battery connection.