Hacking Destructobot's Batch R4/M3 Simply Save Converter

Destructobot

Crave the Hammer
Member
Joined
Oct 15, 2006
Messages
5,002
Reaction score
9
Trophies
1
Age
48
Location
Portland, OR
Website
Visit site
XP
321
Country
United States
All the official R4/M3 Simply save converter does to 256k raw saves (used by the G6 and the slot 2 Supercards, as well as some others) is it pads them out to 512k. I recently figured out how to do drag & drop stuff with batch files, so I wrote a batch script that will pad multiple files at once, without bugging you for filenames for each one.

I don't feel like typing up more of a description, so I'll just post the readme:
QUOTE said:
Batch Save Converter for R4 & M3 Simply
by Destructobot.


This script will convert raw 256k saves (G6, Supercard, etc.) to raw 512k saves
for use with the R4 or M3 Simply. It can convert multiple files at once, and
it works via simple drag & drop. All output files are automatically given the
.sav extension.


This script only creates new files. It will not move, rename, modify, overwrite
or delete any input file.


I have only tested this script on Windows XP and Windows 98. This script
will not work on Windows 9x. It will probably not work on Windows ME, but I
haven't tested that. It may work on Windows 2000, but I haven't tested that,
either.




INSTRUCTIONS

1. Extract "R4 Batch Save Converter.bat" and "R4_save.dat" to a folder.

2. Drag and drop the saves you want to convert onto "R4 Batch Save Converter.bat".


Output files are placed in a folder named _R4_ that is created along side the input files.

Get it here:
http://www.zshare.net/download/r4-batch-sa...verter-zip.html
 
It would be interesting if someone could try what I posted earlier (I still don't have a R4DS), but if you do, backup your saves in another directory first:
Assuming the .sav/.0-files are 256 kB, this python script should search for them in the current directory and change their size to 512 kB, and also rename the .nds.sav/.0-files to .sav (sorry for my ugly code, I can barely code at all):

Code:
import os, re

pattern = re.compile('.*\.sav|.*\.0', re.IGNORECASE)
for file in os.listdir('.'):
   if pattern.match(file):
       open(file,'a').write('\xff'*262144)
       os.rename(file,re.sub('.0|.nds.sav','.sav',file))

(I changed the tabs to 4 spaces, otherwise the code-tags acted strange)

If you don't have python installed, try this (windows binary, run r4ds.exe), and put the .sav/.0-files in the "sav"-directory. I'm guessing someone else have a better solution (maybe they already posted about it), but whatever. Let me know if it works, I don't have a R4DS.
 
I've never used python, but I don't see anything in that bit of code that checks the input filesize before adding 256k to the files. If there happens to be other types of saves in the folder (GBA saves for example) it will produce odd sized (possibly unusable) files.

That, combined with the fact that it modifies the original file rather than creating a new one, seems... bad.
 
What you say is true. The program doesn't protect itself against stupid users.
smile.gif
 

Site & Scene News

Popular threads in this forum