? SmileBASIC Program Archiver ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Creep into the Halloween / Horror Programming Contest (Deadline Extended)

SmileBASIC Program Archiver

Submitted
Updated
Author
amihart
Public Key
C34N4DRX
Min. Compat.
All
Size
16.76 KB
Rating
9 votes
Description Transfer a SmileBASIC program from your 3DS to your PC through the internet to archive it on your PC. Since the transfer is essentially done through the internet, no special devices are needed! No auxiliary cables or splitters or webcams or anything. This is for archiving programs with 3DS->PC transfers. It does not support PC->3DS transfers. Instructions Move the program you wish to archive into the same folder as this Archiver program. Launch the program "Archiver" and select the to program to archive from the list of files (or send the example "SENDME" file). You will be given a screen filled with what looks like TV static. Take a screenshot of this by pressing the home button, clicking the "Miiverse" icon, and clicking "Save to Album". Return to the program, and press A. If another image shows, then take another screenshot. Keep repeating this until the program ends. The longer your program is, the more amount of screenshots you will need to take. Each screenshot can carry up to 12,000 bytes! How big is 12,000 bytes? The entire Archiver program is less than 3000 bytes! Navigate to your screenshot album on your PC on Miiverse. That can be found at : https://miiverse.nintendo.net/users/YOURNNID/album Download all the screenshots. Save them as "image1.jpg", "image2.jpg", etc, and make sure they are in the right order. Install this program on your PC. It is compatible with Windows, Mac, and Linux. Launch this program, click the button, and select all of your images. Make sure they are in order. If they are not in order, click the top of the "Name" column to sort files by name. Click "open" and it will deconvert the images back into a text document and you will have your program on your PC! And that's all there is to it. Sounds complicated but once you get the hang of it it's really easy. The tl;dr version of the steps are: The 3DS app will turn your program into a series of images which you take screenshots through Miiverse, download the screenshots on your PC, and then open them with the PC version of the program linked above.
Categories
Keywords
  • archive
32 Comment(s) 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS I made a faster image decoder. Tested in Firefox, Chrome, and Safari (Should work in IE too) https://12me21.github.io/archiver/ https://jsfiddle.net/7st1pLyd/1/ EDIT: It also works in the new 3DS browser, though I'm not sure why you'd want to. amihart amihart This will be helpful for mobile users. Good job. Simeon Simeon Scholar Received for knowing a great deal about programming topics Achievements Amazing Page Hidden Achievements Drawing I like to draw! Hobbies So clever! Mr_Mo Mr_Mo Reading I like to read books! Hobbies Video Games I like to play video games! Hobbies Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Nice! 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS This is really cool! I tried to make a better version that stored data 4x more efficiently, but it just barely couldn't survive JPEG compression. Your program is very inefficient (the conversion function could be reduced to around 5-7 lines), but it works. amihart amihart It's not super efficient because I just modified the source code of a previous program to make this so I wouldn't have to rewrite it from scratch, and it ran so fast I didn't see a point in making it more efficient. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies What about using black & white, as well as red and blue in the 1x1 pixel form? would the jpeg compression cause information loss with the 4 colors? You could double the amount of information to 24 kilobytes per image. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS JPEG throws out a lot of color data, especially blue, so it probably wouldn't work. Komodo Komodo Pokemon Is Awesome! I love Pokemon! Express Yourself Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength can this work on a android tablet instead of a pc?this is realy a cool idea by the way. amihart amihart If you navigate to the JSFiddle page using Firefox Nightly you can get it to work on Android. Guzzler Guzzler First Week Joined in the very first week of SmileBASIC Source Website Drawing I like to draw! Hobbies Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Interesting. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength OSP Contest 1 Contest Participant I participated in the first SmileBASIC Source OSP Contest! Characters are 2 bytes by the way, so a single image would hold 6000 characters. amihart amihart I just saved a text file with the contents "BOB" and it saved as 4 bytes (fourth byte being the newline character). Unicode characters take up more bytes, but 99% of the characters you will use in a program aren't unicode. glennxserge glennxserge There may be some circumstances though, where you would need to keep the extended characters. Like if you were using any of the window border characters to create a dialog box or ui component. However, instead of sacrificing half your storage to accommodate the odd 2 byte requirement, you could just use a specific bit combination to mark where in the image you need to read 2 bytes and cast them to a unicode character. Like a gray pixel or something. I didn't test to see how gray-scale images effect compression on miiverse, but maybe something like that would work. EDIT: In fact if gray-scale remains uneffected by compression, you could extend your storage values greatly. You could use percentage gray to represent series of bits. 50%(127) = 1 bit on, 100%(255) = 128 bits, and you could interpolate inbetween. 49% (126) = 1 bit off, 0% = 127 bits off. Something like that could help squeeze a bit more into your images. amihart amihart If gray-scale is truly unaffected by compression then I could fit 96 kilobytes into a single image instead of 12, since there are 254 shades of gray. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength OSP Contest 1 Contest Participant I participated in the first SmileBASIC Source OSP Contest! Internally SB characters are all 2 bytes each. But when you save a file, it's converted to a UTF-8 encoding. This would be why your text file only occupies 4 bytes. glennxserge glennxserge Okay, so a couple of things I noticed testing this with a full grayscale image. There is zero compression loss when you can represent the image as a single channel. I'm guessing the algorithm must be happy enough ditching the other two channels that it leaves the image unmolested. As soon as I added one pixel with color it bled into the other pixels. The second thing to note, is that the graphics once blitted to the screen (at 8 bits per channel), get stored as 5 bit per channel. When you capture the image, it's getting this 15 bit representation. So you'll need to factor that into your value calculations. ColeslawProductions ColeslawProductions Oh yeah. JPEG (the format the screenshots are saved in), does this thing called chroma subsampling, but first, the mage is converted into Y'CbCr. Y' being the grayscale brightness of each pixel, and Cb and Cr being the values that turn it into a color, if set. JPEG downscales the size of the Cb and Cr channels by a quarter, making each Cb and Cr "subpixel" influencing 4 actual pixels), while leaving the grayscale in actual 1:1 size. Now it surprises me if the grayscales are perfect 0-255. I was sure the fact they are turned into DCT chunks, the values must be tend to be off by at least one or two, however, the limitations of SB's colors itself, it doesn't even change anything, at least to the point where it can't be rounded back. By the way, it seems we're lucky with quantization. Quantization is when DCT data is erased for space savings. With it, even the grayscale pixels will bleed, however, it seems to be off or very sparse in the screenshots. Okay I may be a little too confident in explaining this, tbh. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength OSP Contest 1 Contest Participant I participated in the first SmileBASIC Source OSP Contest! Very old bump. I glanced at a grayscale noise image off Miiverse and it seems unaffected. Even if the colors are thrown slightly off balance, SB colors are still only 5 bits per channel. The results might not affect anything. So anyway, 5 bits per pixel at 400x240 is 60000 bytes. That's 30000 SB characters, more if you encode them in a different scheme. amihart amihart Due to input by glennxserge, I have updated the program so that now it can hold 12 kilobytes for a single image! Download the program using the new public key. You also need to get the new version of the PC end. It should be listed as v0.5. I just updated it so it may not be up yet. Unclesporky Unclesporky You may have missed the forest for the trees a bit, here. :) You could probably just use black and white for 0 and 1. I can see why a webcam-based program would need to read data based on changing colors, you wouldn't want to rely on precise timing like "3 beats of pure white for 1 1 1, 2 beats of black for 0 0," but if you're looking at 2x2 chunks of a static image you should be able to use set colors for 0 and 1, rather than doing it based on changes. If you used white and black it would end up looking an awful lot like a QR code, actually. But you could do even better: every 2x2 block could stand for two bits, and you could store double the data! Black = 00, red = 01, green = 10, blue = 11. amihart amihart Yes, that's something I've considered implementing but haven't gotten around to it yet. Simply using black and white wouldn't make it better, because even though I'm using three colors, each color still represents 1 bit each. So using black and white for 1 bit each would have the exact same efficiency. Using different colors every time is actually better because you'll never end up with a situation where, let's say a green is surrounded by 9 reds. This could cause it to turn red when compressed. I have been considering trying to use multiple colors to store more bits per block, I just haven't gotten around to it yet. I will probably update this in the future. This RGB method was just the easiest and I already had the code going. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength OSP Contest 1 Contest Participant I participated in the first SmileBASIC Source OSP Contest! How are you taking into account JPEG compression on Miiverse? I would think that messes up the output. amihart amihart It's because of the way I'm encoding it. The compression loses data and ends up blending the colors together, but the data is encoded using 2x2 boxes that are either red, blue, or green, each representing 1 bit. All I need to do is average the four pixels that make up the box and see what color is most prevalent. The compression simply doesn't drop enough information to make the information non-recoverable. You can fit 24,000 2x2 boxes on the screen at a single time, so you get 3000 bytes of data from a single image. Here's a close-up of one of the compressed screenshots: As you can see, the colors are blended together but not enough to make what the original colors were supposed to be unrecognizable. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength OSP Contest 1 Contest Participant I participated in the first SmileBASIC Source OSP Contest! Hmm, how do the colored squares represent the data exactly? I'm not sure I follow. glennxserge glennxserge This is a clever idea, I wish there was a way to counteract the compression though, so you could use single pixels, that would quadruple the amount of data an image could contain. Does the compression really mitigate the dominate color that much with single pixel colors? amihart amihart @slackerSnail It basically uses three colors, R, G, and B, to transfer data, with a list of agreed upon rules (the protocol). If the previous color was R, then R can either change to G or B. If the previous color is G, then the color can either change to R or B. So no matter what color you have just used, you have 2 options to switch to. I then have an agreed upon list of rules that describes which jump represents a 0 and which represents a 1. The purpose of this protocol is that I never reuse the same color twice in a row. It always changes per bit, which in many cases, makes encoded information significantly easier and more efficient to decode. Each box represents 1 bit. How it represents 1 bit is based on the color of the previous box and the color of the current box based on the protocol. I made this reusing the code I made for my previous program. So how this works is pretty similar, so you can see the explanation for that here. @gleenxserge I tried using single pixels but I had trouble recovering the original data after compression. Here's a zoom-up of a 1x1 encoding after compression: The first three boxes are supposed to be Green->Blue->Red. But due to the compression, there is 0 blue in that second box (RGB = 0,56,0). In fact, green is the most prevalent color of the first 5 boxes. glennxserge glennxserge Yikes, that is lossy (>_<). Have you tried 2x1 areas, would at least double the amount of data. I gave this a shot using different colors ( Yellow, Black, Blue), they tend to compress better, but you'll need to compare hue versus value to determine which pixel. If it's black, the value threshold is quite low even when surrounding pixels get filtered into it. If it's yellow or blue you can tell from the hue R+G or B. Might be worth exploring, but seriously this is a neat application, and very useful for posting online code examples. Get tired of typing out examples to test and than transcribing them to explain to others online. EDIT: Better yet, just use white and black pixels (white for bit on, black for off), they don't suffer any compression loss! (Above image is from miiverse screen cap) amihart amihart Really? For 1x1 black/white pixels there's absolutely no compression loss? I'll have to try that, thanks for pointing it out! glennxserge glennxserge Sure thing, I was quite surprised myself! At 399x239, that's almost 12,000 bytes! amihart amihart Yep! You are right, just transferred some data over using this and it worked fine. I will update the key and the software with this version soon. Minxrod Minxrod Summer 2016 Contest Participant I participated in the SmileBASIC Source Summer 2016 Contest! Programming Contest Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Pokemon Is Awesome! I love Pokemon! Express Yourself The screenshots are pretty too! :D Nice program :D