Initial Commit
This commit is contained in:
20
README.md
Normal file
20
README.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
## Drastic to MelonDS
|
||||||
|
|
||||||
|
This script will convert the dsv save from drastic emulator to a melonDS save file
|
||||||
|
|
||||||
|
How this works ?
|
||||||
|
|
||||||
|
MelonDS determines save type using exact byte count in the save file
|
||||||
|
Which needs to be a power of 2 as mentioned [here](http://melonds.kuribo64.net/faq.php).
|
||||||
|
This script calculates the closest power of 2 to the save file and removes the padding
|
||||||
|
|
||||||
|
This can be easily done manually by removing the padding using a hex editor.
|
||||||
|
Or using dd like this
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dd if=Pokemon.dsv of=Pokemon.sav bs=1 count=524288
|
||||||
|
```
|
||||||
|
|
||||||
|
This will make a 4KiB EEPROM save from drastic to melonDS save.
|
||||||
|
|
||||||
|
I will add argparse later.
|
||||||
21
dr2mds.py
Executable file
21
dr2mds.py
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
from math import log
|
||||||
|
import os
|
||||||
|
|
||||||
|
DRASTIC_SAVE="Pokemon Black.dsv"
|
||||||
|
MELONDS_SAVE="Pokemon Black.sav"
|
||||||
|
|
||||||
|
def st_size(path):
|
||||||
|
return os.stat(path).st_size
|
||||||
|
|
||||||
|
def closest2pow(n):
|
||||||
|
return 2**int(log(n) / log(2))
|
||||||
|
|
||||||
|
def drastic2melonds(infile,outfile):
|
||||||
|
with open(infile,"rb") as inf, open(outfile,"wb") as ouf:
|
||||||
|
|
||||||
|
ouf.write(inf.read(closest2pow(st_size(infile))))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
drastic2melonds(DRASTIC_SAVE,MELONDS_SAVE)
|
||||||
Reference in New Issue
Block a user