Something i began to do after doing the homebrew for the BS-X.
I wanted to talk about it here, as it is SNES-related.
Official Website : http://luigiblood.0fees.net/bsx/
What is BS-X Project ?
BS-X Project is about to revive one of the officials SNES Add-ons, the Broadcast Satellaview. (Emulation Only)
What's done for now ?
So far, we've done the first homebrew for Satellaview, and discovered how the SRAM checksum worked, also made BS-X downloading something.
Documentations :
Super Famicom Wiki : http://wiki.superfamicom.org/snes/show/Satellaview+(Meta)
BS-X Registers Document (by d4s) : http://dforce3000.de/pub/d4s_satellaview_modem_regs.txt
TODO:
- Make BS-X Download something (Done.)
- Understand how must be the BS-X Downloaded Data.
(My website have some typos so i fixed them here.)
I'll give you the source code of BS-X SRAM Checksum Fixer (Python Code) :
I wanted to talk about it here, as it is SNES-related.
Official Website : http://luigiblood.0fees.net/bsx/
What is BS-X Project ?
BS-X Project is about to revive one of the officials SNES Add-ons, the Broadcast Satellaview. (Emulation Only)
What's done for now ?
So far, we've done the first homebrew for Satellaview, and discovered how the SRAM checksum worked, also made BS-X downloading something.
Documentations :
Super Famicom Wiki : http://wiki.superfamicom.org/snes/show/Satellaview+(Meta)
BS-X Registers Document (by d4s) : http://dforce3000.de/pub/d4s_satellaview_modem_regs.txt
TODO:
- Make BS-X Download something (Done.)
- Understand how must be the BS-X Downloaded Data.
(My website have some typos so i fixed them here.)
I'll give you the source code of BS-X SRAM Checksum Fixer (Python Code) :
Code:
from struct import *
import sys
print "BS-X SRAM Checksum Fixer v0.2"
print "By LuigiBlood/Seru-kun"
#12287
if sys.argv[1] == "-f" and sys.argv[2] <> "" :
FILE = sys.argv[2]
elif sys.argv[1] <> "-f" and sys.argv[1] <> "" :
FILE = sys.argv[1]
if FILE <> "" and sys.argv[1] == FILE :
SRAM = open(FILE,"r+b")
CHK = 0
CHK2 = 0
OFFSET = int("2fff", 16)
SRAM.seek(4)
OLD=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Checksum : " + hex(OLD)
SRAM.seek(2)
OLDR=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Reversed Checksum : " + hex(OLDR)
elif FILE <> "" and sys.argv[1] == "-f" and sys.argv[2] == FILE :
SRAM = open(FILE,"r+b")
CHK = 0
CHK2 = 0
A = 0
OFFSET = int("fff", 16)
SRAM.seek(4)
OLD=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Checksum : " + hex(OLD)
SRAM.seek(2)
OLDR=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Reversed Checksum : " + hex(OLDR)
SRAM.seek(2)
SRAM.write(chr(255))
SRAM.write(chr(255))
SRAM.write(chr(0))
SRAM.write(chr(0))
print "Checksum Removed, calculating..."
while OFFSET >= 0:
SRAM.seek(OFFSET)
A = ord(SRAM.read(1))
A += CHK
CHK = A
SRAM.seek(OFFSET + int("1000", 16))
A = ord(SRAM.read(1))
A += CHK
CHK = A
SRAM.seek(OFFSET + int("2000", 16))
A = ord(SRAM.read(1))
A += CHK
CHK = A
OFFSET -= 1
SRAM.seek(2)
CHK2 = CHK & int("ffff", 16)
print "NEW Checksum : " + hex(CHK2)
RCHK = CHK2 ^ int("ffff", 16)
print "NEW Reversed Checksum : " + hex(RCHK)
print "Replacing Checksums..."
SRAM.write(pack("H", RCHK))
SRAM.write(pack("H", CHK2))
print "Done !"
import sys
print "BS-X SRAM Checksum Fixer v0.2"
print "By LuigiBlood/Seru-kun"
#12287
if sys.argv[1] == "-f" and sys.argv[2] <> "" :
FILE = sys.argv[2]
elif sys.argv[1] <> "-f" and sys.argv[1] <> "" :
FILE = sys.argv[1]
if FILE <> "" and sys.argv[1] == FILE :
SRAM = open(FILE,"r+b")
CHK = 0
CHK2 = 0
OFFSET = int("2fff", 16)
SRAM.seek(4)
OLD=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Checksum : " + hex(OLD)
SRAM.seek(2)
OLDR=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Reversed Checksum : " + hex(OLDR)
elif FILE <> "" and sys.argv[1] == "-f" and sys.argv[2] == FILE :
SRAM = open(FILE,"r+b")
CHK = 0
CHK2 = 0
A = 0
OFFSET = int("fff", 16)
SRAM.seek(4)
OLD=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Checksum : " + hex(OLD)
SRAM.seek(2)
OLDR=ord(SRAM.read(1))+ord(SRAM.read(1))*256
print "Reversed Checksum : " + hex(OLDR)
SRAM.seek(2)
SRAM.write(chr(255))
SRAM.write(chr(255))
SRAM.write(chr(0))
SRAM.write(chr(0))
print "Checksum Removed, calculating..."
while OFFSET >= 0:
SRAM.seek(OFFSET)
A = ord(SRAM.read(1))
A += CHK
CHK = A
SRAM.seek(OFFSET + int("1000", 16))
A = ord(SRAM.read(1))
A += CHK
CHK = A
SRAM.seek(OFFSET + int("2000", 16))
A = ord(SRAM.read(1))
A += CHK
CHK = A
OFFSET -= 1
SRAM.seek(2)
CHK2 = CHK & int("ffff", 16)
print "NEW Checksum : " + hex(CHK2)
RCHK = CHK2 ^ int("ffff", 16)
print "NEW Reversed Checksum : " + hex(RCHK)
print "Replacing Checksums..."
SRAM.write(pack("H", RCHK))
SRAM.write(pack("H", CHK2))
print "Done !"