mirror of
https://github.com/lesserkuma/FlashGBX.git
synced 2026-09-14 20:05:28 -05:00
0.9β
This commit is contained in:
BIN
.github/FlashGBX_Ubuntu.png
vendored
BIN
.github/FlashGBX_Ubuntu.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 66 KiB |
BIN
.github/FlashGBX_Windows.png
vendored
BIN
.github/FlashGBX_Windows.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
BIN
.github/FlashGBX_macOS.png
vendored
BIN
.github/FlashGBX_macOS.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 67 KiB |
@@ -1,42 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# UTF-8
|
||||
import sys
|
||||
import sys, traceback
|
||||
from PySide2.QtCore import QThread, Signal
|
||||
|
||||
class DataTransfer(QThread):
|
||||
CONFIG = None
|
||||
RUNNING = False
|
||||
FINISHED = False
|
||||
|
||||
updateProgress = Signal(object, int, int, float, float, float)
|
||||
updateProgress = Signal(object)
|
||||
|
||||
def __init__(self, config=None):
|
||||
QThread.__init__(self)
|
||||
if config is not None:
|
||||
self.CONFIG = config
|
||||
self.FINISHED = False
|
||||
|
||||
def setConfig(self, config):
|
||||
self.CONFIG = config
|
||||
|
||||
self.FINISHED = False
|
||||
|
||||
def isRunning(self):
|
||||
return self.RUNNING
|
||||
return not self.FINISHED
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
if self.CONFIG == None:
|
||||
pass
|
||||
elif self.CONFIG['mode'] == 1:
|
||||
self.RUNNING = True
|
||||
self.CONFIG['port']._TransferData(1, self.updateProgress, [ self.CONFIG['path'], self.CONFIG['mbc'], self.CONFIG['rom_banks'], self.CONFIG['agb_rom_size'] ])
|
||||
self.RUNNING = False
|
||||
elif self.CONFIG['mode'] == 2:
|
||||
self.RUNNING = True
|
||||
self.CONFIG['port']._TransferData(2, self.updateProgress, [ self.CONFIG['path'], self.CONFIG['mbc'], self.CONFIG['save_type'] ])
|
||||
self.RUNNING = False
|
||||
elif self.CONFIG['mode'] == 3:
|
||||
self.RUNNING = True
|
||||
self.CONFIG['port']._TransferData(3, self.updateProgress, [ self.CONFIG['path'], self.CONFIG['mbc'], self.CONFIG['save_type'], self.CONFIG['erase'] ])
|
||||
self.RUNNING = False
|
||||
elif self.CONFIG['mode'] == 4:
|
||||
self.RUNNING = True
|
||||
self.CONFIG['port']._TransferData(4, self.updateProgress, [ self.CONFIG['path'], self.CONFIG['cart_type'], self.CONFIG['trim_rom'], self.CONFIG['override_voltage'] ])
|
||||
self.RUNNING = False
|
||||
|
||||
|
||||
else:
|
||||
self.FINISHED = False
|
||||
self.CONFIG['port']._TransferData(self.CONFIG, self.updateProgress)
|
||||
self.FINISHED = True
|
||||
|
||||
except Exception as e:
|
||||
self.updateProgress.emit({"action":"ABORT", "info_type":"msgbox_critical", "info_msg":"An error has occured!\nPlease try to reconnect the hardware and restart the application.\n\n" + str(e), "abortable":False}, 0, 0, 0, 0, 0)
|
||||
self.RUNNING = False
|
||||
traceback.print_exc()
|
||||
self.updateProgress.emit({"action":"ABORT", "info_type":"msgbox_critical", "info_msg":"An error has occured!\nPlease try to reconnect the hardware and restart the application.\n\n{:s}: {:s}".format(type(e).__name__, str(e)), "abortable":False})
|
||||
self.FINISHED = True
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# UTF-8
|
||||
import sys, threading, os, glob, importlib, time, re, json, platform, subprocess, zlib, argparse, math, struct
|
||||
import sys, threading, os, glob, time, re, json, platform, subprocess, zlib, argparse, math, struct, statistics
|
||||
from PySide2 import QtCore, QtWidgets, QtGui
|
||||
from zipfile import *
|
||||
from datetime import datetime
|
||||
from .RomFileDMG import *
|
||||
from .RomFileAGB import *
|
||||
from . import hw_GBxCartRW
|
||||
hw_devices = [hw_GBxCartRW]
|
||||
|
||||
APPNAME = "FlashGBX"
|
||||
VERSION = "0.8β"
|
||||
VERSION = "0.9β"
|
||||
|
||||
class FlashGBX(QtWidgets.QWidget):
|
||||
global APPNAME, VERSION
|
||||
|
||||
AGB_Header_ROM_Sizes = [ "4 MB", "8 MB", "16 MB", "32 MB" ]
|
||||
AGB_Header_ROM_Sizes_Map = [ 0x400000, 0x800000, 0x1000000, 0x2000000 ]
|
||||
AGB_Header_Save_Types = [ "None", "4K EEPROM (512 Bytes)", "64K EEPROM (8 KB)", "256K SRAM (32 KB)", "512K SRAM (64 KB)", "512K FLASH (64 KB)", "1M FLASH (128 KB)" ]
|
||||
AGB_Header_Save_Types = [ "None", "4K EEPROM (512 Bytes)", "64K EEPROM (8 KB)", "256K SRAM (32 KB)", "512K SRAM (64 KB)", "1M SRAM (128 KB)", "512K FLASH (64 KB)", "1M FLASH (128 KB)" ]
|
||||
AGB_Global_CRC32 = 0
|
||||
|
||||
DMG_Header_Features = { 0x00:'ROM ONLY', 0x01:'MBC1', 0x02:'MBC1+RAM', 0x03:'MBC1+RAM+BATTERY', 0x05:'MBC2', 0x06:'MBC2+BATTERY', 0x08:'ROM+RAM', 0x09:'ROM+RAM+BATTERY', 0x0B:'MMM01', 0x0C:'MMM01+RAM', 0x0D:'MMM01+RAM+BATTERY', 0x0F:'MBC3+TIMER+BATTERY', 0x10:'MBC3+TIMER+RAM+BATTERY', 0x11:'MBC3', 0x12:'MBC3+RAM', 0x13:'MBC3+RAM+BATTERY', 0x15:'MBC4', 0x16:'MBC4+RAM', 0x17:'MBC4+RAM+BATTERY', 0x19:'MBC5', 0x1A:'MBC5+RAM', 0x1B:'MBC5+RAM+BATTERY', 0x1C:'MBC5+RUMBLE', 0x1D:'MBC5+RUMBLE+RAM', 0x1E:'MBC5+RUMBLE+RAM+BATTERY', 0x20:'MBC6', 0x22:'MBC7+RAM+BATTERY', 0x55:'Game Genie', 0x56:'Game Genie v3.0', 0xFC:'POCKET CAMERA', 0xFD:'BANDAI TAMA5', 0xFE:'HuC3', 0xFF:'HuC1+RAM+BATTERY' }
|
||||
@@ -34,12 +36,30 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
DEVICES = {}
|
||||
FLASHCARTS = { "DMG":{}, "AGB":{} }
|
||||
CONFIG_PATH = ""
|
||||
TEMPFILE = ""
|
||||
TBPROG = None # Windows 7+ Taskbar Progress Bar
|
||||
PROGRESS = {}
|
||||
#DEBUG = []
|
||||
|
||||
def ReadConfig(self, reset=False):
|
||||
self.SETTINGS = QtCore.QSettings(self.CONFIG_PATH + "/settings.ini", QtCore.QSettings.IniFormat)
|
||||
config_version = self.SETTINGS.value("ConfigVersion")
|
||||
if not os.path.exists(self.CONFIG_PATH): os.makedirs(self.CONFIG_PATH)
|
||||
fc_files = glob.glob("{0:s}/fc_*.txt".format(self.CONFIG_PATH))
|
||||
if config_version is not None and len(fc_files) == 0:
|
||||
print("FAIL: No flash cartridge type configuration files found in {:s}. Resetting configuration...\n".format(self.CONFIG_PATH))
|
||||
self.SETTINGS.clear()
|
||||
os.rename(self.CONFIG_PATH + "/settings.ini", self.CONFIG_PATH + "/settings.ini_" + datetime.now().strftime("%Y%m%d%H%M%S") + ".bak")
|
||||
config_version = False # extracts the config.zip again
|
||||
elif reset:
|
||||
self.SETTINGS.clear()
|
||||
print("All configuration has been reset.\n")
|
||||
|
||||
self.SETTINGS.setValue("ConfigVersion", VERSION)
|
||||
return (config_version, fc_files)
|
||||
|
||||
def __init__(self, args):
|
||||
app_path = args['app_path']
|
||||
config_path = args['config_path']
|
||||
self.CONFIG_PATH = args['config_path']
|
||||
|
||||
QtWidgets.QWidget.__init__(self)
|
||||
self.setStyleSheet("QMessageBox { messagebox-text-interaction-flags: 5; }")
|
||||
@@ -48,37 +68,24 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.setWindowFlags(self.windowFlags() | QtGui.Qt.MSWindowsFixedSizeDialogHint);
|
||||
|
||||
# Settings and Config
|
||||
self.SETTINGS = QtCore.QSettings(config_path + "/config.ini", QtCore.QSettings.IniFormat)
|
||||
config_version = self.SETTINGS.value("ConfigVersion")
|
||||
if not os.path.exists(config_path): os.makedirs(config_path)
|
||||
fc_files = glob.glob("{0:s}/fc_*.txt".format(config_path))
|
||||
if config_version is not None and len(fc_files) == 0:
|
||||
print("FAIL: No flash cartridge type configuration files found. Resetting configuration...\n")
|
||||
self.SETTINGS.clear()
|
||||
elif args['argparsed'].reset:
|
||||
self.SETTINGS.clear()
|
||||
print("All configuration has been reset.\n")
|
||||
|
||||
(config_version, fc_files) = self.ReadConfig(reset=args['argparsed'].reset)
|
||||
if config_version != VERSION:
|
||||
rf_list = ""
|
||||
if os.path.exists(app_path + "/res/config.zip"):
|
||||
with ZipFile(app_path + "/res/config.zip") as zip:
|
||||
for zfile in zip.namelist():
|
||||
if os.path.exists(config_path + "/" + zfile):
|
||||
if os.path.exists(self.CONFIG_PATH + "/" + zfile):
|
||||
zfile_crc = zip.getinfo(zfile).CRC
|
||||
with open(config_path + "/" + zfile, "rb") as ofile: buffer = ofile.read()
|
||||
with open(self.CONFIG_PATH + "/" + zfile, "rb") as ofile: buffer = ofile.read()
|
||||
ofile_crc = zlib.crc32(buffer) & 0xffffffff
|
||||
if zfile_crc == ofile_crc: continue
|
||||
os.rename(config_path + "/" + zfile, config_path + "/" + zfile + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + ".bak")
|
||||
os.rename(self.CONFIG_PATH + "/" + zfile, self.CONFIG_PATH + "/" + zfile + "_" + datetime.now().strftime("%Y%m%d%H%M%S") + ".bak")
|
||||
rf_list += zfile + "\n"
|
||||
zip.extract(zfile, config_path + "/")
|
||||
zip.extract(zfile, self.CONFIG_PATH + "/")
|
||||
if rf_list != "": QtWidgets.QMessageBox.information(self, APPNAME, "The application was recently updated and some config files have been updated as well. You will find backup copies of them in your configuration directory.\n\nUpdated files:\n" + rf_list[:-1], QtWidgets.QMessageBox.Ok)
|
||||
fc_files = glob.glob("{0:s}/fc_*.txt".format(config_path))
|
||||
fc_files = glob.glob("{0:s}/fc_*.txt".format(self.CONFIG_PATH))
|
||||
else:
|
||||
print("ERROR: {:s} not found. This is required to read the flash cartridge type configuration\n".format(app_path + "/res/config.zip"))
|
||||
|
||||
self.SETTINGS.setValue("ConfigVersion", VERSION)
|
||||
self.CONFIG_PATH = config_path
|
||||
print("ERROR: {:s} not found. This is required to read the flash cartridge type configuration.\n".format(app_path + "/res/config.zip"))
|
||||
|
||||
# Read flash cart types
|
||||
for file in fc_files:
|
||||
@@ -88,7 +95,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
try:
|
||||
specs = json.loads(specs_int)
|
||||
except:
|
||||
print("WARNING: Flash chip config file “{:s}” is broken and needs to be fixed before it can be used.".format(os.path.basename(file)))
|
||||
print("WARNING: Flash chip config file “{:s}” could not be parsed and needs to be fixed before it can be used.".format(os.path.basename(file)))
|
||||
continue
|
||||
for name in specs["names"]:
|
||||
if not specs["type"] in self.FLASHCARTS: continue # only DMG and AGB are supported right now
|
||||
@@ -144,14 +151,11 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
rowActionsGeneral3 = QtWidgets.QHBoxLayout()
|
||||
self.btnFlashROM = QtWidgets.QPushButton("&Flash ROM")
|
||||
self.btnFlashROM.setStyleSheet("min-height: 17px;")
|
||||
self.mnuFlashROM = QtWidgets.QMenu()
|
||||
self.mnuFlashROM.addAction("&Complete ROM file", self.FlashROM)
|
||||
self.mnuFlashROM.addAction("&Trimmed ROM file", lambda: self.FlashROM(trim_rom=True))
|
||||
self.btnFlashROM.setMenu(self.mnuFlashROM)
|
||||
self.connect(self.btnFlashROM, QtCore.SIGNAL("clicked()"), self.FlashROM)
|
||||
rowActionsGeneral3.addWidget(self.btnFlashROM)
|
||||
self.btnRestoreRAM = QtWidgets.QPushButton("Writ&e Save Data")
|
||||
self.mnuRestoreRAM = QtWidgets.QMenu()
|
||||
self.mnuRestoreRAM.addAction("&Restore save data file", self.WriteRAM)
|
||||
self.mnuRestoreRAM.addAction("&Restore from save data file", self.WriteRAM)
|
||||
self.mnuRestoreRAM.addAction("&Erase cartridge save data", lambda: self.WriteRAM(erase=True))
|
||||
self.btnRestoreRAM.setMenu(self.mnuRestoreRAM)
|
||||
self.btnRestoreRAM.setStyleSheet("min-height: 17px;")
|
||||
@@ -178,7 +182,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
rowStatus1a.addWidget(self.lblStatus1aResult)
|
||||
grpStatusLayout.addLayout(rowStatus1a)
|
||||
rowStatus2a = QtWidgets.QHBoxLayout()
|
||||
self.lblStatus2a = QtWidgets.QLabel("Speed:")
|
||||
self.lblStatus2a = QtWidgets.QLabel("Transfer rate:")
|
||||
rowStatus2a.addWidget(self.lblStatus2a)
|
||||
self.lblStatus2aResult = QtWidgets.QLabel("–")
|
||||
rowStatus2a.addWidget(self.lblStatus2aResult)
|
||||
@@ -200,10 +204,11 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.prgStatus = QtWidgets.QProgressBar()
|
||||
self.SetProgressBars(min=0, max=1, value=0)
|
||||
rowStatus2.addWidget(self.prgStatus)
|
||||
btnText = "&Abort"
|
||||
btnText = "Stop"
|
||||
self.btnCancel = QtWidgets.QPushButton(btnText)
|
||||
self.btnCancel.setEnabled(False)
|
||||
btnWidth = self.btnCancel.fontMetrics().boundingRect(btnText).width() + 14
|
||||
btnWidth = self.btnCancel.fontMetrics().boundingRect(btnText).width() + 15
|
||||
if platform.system() == "Darwin": btnWidth += 12
|
||||
self.btnCancel.setMaximumWidth(btnWidth)
|
||||
self.connect(self.btnCancel, QtCore.SIGNAL("clicked()"), self.AbortOperation)
|
||||
rowStatus2.addWidget(self.btnCancel)
|
||||
@@ -225,11 +230,25 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.layout_devices.addWidget(self.cmbDevice)
|
||||
self.layout_devices.addStretch()
|
||||
|
||||
btnText = "C&onfig"
|
||||
btnText = "C&onfig"
|
||||
self.btnConfig = QtWidgets.QPushButton(btnText)
|
||||
btnWidth = self.btnConfig.fontMetrics().boundingRect(btnText).width() + 14
|
||||
btnWidth = self.btnConfig.fontMetrics().boundingRect(btnText).width() + 24
|
||||
if platform.system() == "Darwin": btnWidth += 12
|
||||
self.btnConfig.setMaximumWidth(btnWidth)
|
||||
self.connect(self.btnConfig, QtCore.SIGNAL("clicked()"), self.OpenConfigDir)
|
||||
self.mnuConfig = QtWidgets.QMenu()
|
||||
self.mnuConfig.addAction("&Append date && time to filename of save data backups", lambda: self.SETTINGS.setValue("SaveFileNameAddDateTime", str(self.mnuConfig.actions()[0].isChecked()).lower().replace("true", "enabled").replace("false", "disabled")))
|
||||
self.mnuConfig.addAction("Prefer §or erase over full chip erase when available", lambda: self.SETTINGS.setValue("PreferSectorErase", str(self.mnuConfig.actions()[1].isChecked()).lower().replace("true", "enabled").replace("false", "disabled")))
|
||||
self.mnuConfig.addAction("Enable &fast read mode (experimental)", lambda: self.SETTINGS.setValue("FastReadMode", str(self.mnuConfig.actions()[2].isChecked()).lower().replace("true", "enabled").replace("false", "disabled"))) # GBxCart RW
|
||||
self.mnuConfig.addSeparator()
|
||||
self.mnuConfig.addAction("Show &configuration directory", self.OpenConfigDir)
|
||||
self.mnuConfig.actions()[0].setCheckable(True)
|
||||
self.mnuConfig.actions()[0].setChecked(self.SETTINGS.value("SaveFileNameAddDateTime") == "enabled")
|
||||
self.mnuConfig.actions()[1].setCheckable(True)
|
||||
self.mnuConfig.actions()[1].setChecked(self.SETTINGS.value("PreferSectorErase") == "enabled")
|
||||
self.mnuConfig.actions()[2].setCheckable(True) # GBxCart RW
|
||||
self.mnuConfig.actions()[2].setChecked(self.SETTINGS.value("FastReadMode") == "enabled") # GBxCart RW
|
||||
self.btnConfig.setMenu(self.mnuConfig)
|
||||
|
||||
self.btnScan = QtWidgets.QPushButton("&Device Scan")
|
||||
self.connect(self.btnScan, QtCore.SIGNAL("clicked()"), self.FindDevices)
|
||||
self.btnConnect = QtWidgets.QPushButton("&Connect")
|
||||
@@ -482,6 +501,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
print("Disconnected from {:s}\n".format(devname))
|
||||
except:
|
||||
pass
|
||||
|
||||
self.CONN = None
|
||||
self.btnScan.show()
|
||||
self.optAGB.setEnabled(False)
|
||||
@@ -564,6 +584,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
print("Connected to " + dev.GetFullName())
|
||||
self.grpDMGCartridgeInfo.setEnabled(True)
|
||||
self.grpAGBCartridgeInfo.setEnabled(True)
|
||||
self.grpActions.setEnabled(True)
|
||||
self.btnCancel.setEnabled(False)
|
||||
self.SetProgressBars(min=0, max=1, value=0)
|
||||
|
||||
@@ -633,6 +654,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.CONN.CANCEL = True
|
||||
|
||||
def FinishOperation(self):
|
||||
if self.lblStatus2aResult.text() == "Pending...": self.lblStatus2aResult.setText("–")
|
||||
self.lblStatus4aResult.setText("")
|
||||
self.grpDMGCartridgeInfo.setEnabled(True)
|
||||
self.grpAGBCartridgeInfo.setEnabled(True)
|
||||
@@ -655,13 +677,14 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.cmbAGBCartridgeTypeResult.setCurrentIndex(t5)
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Information, windowTitle=APPNAME, text="ROM flashing complete!", standardButtons=QtWidgets.QMessageBox.Ok)
|
||||
msgbox.exec()
|
||||
#self.CONN.FlashROM(fncSetProgress=self.DEBUG[0], path=self.DEBUG[1], cart_type=self.DEBUG[2], override_voltage=self.DEBUG[3])
|
||||
|
||||
elif self.CONN.INFO["last_action"] == 1: # Backup ROM
|
||||
self.CONN.INFO["last_action"] = 0
|
||||
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
if self.CONN.INFO["rom_checksum"] == self.CONN.INFO["rom_checksum_calc"]:
|
||||
self.lblHeaderROMChecksumResult.setText("OK (0x{:04X})".format(self.CONN.INFO["rom_checksum"]))
|
||||
self.lblHeaderROMChecksumResult.setText("Valid (0x{:04X})".format(self.CONN.INFO["rom_checksum"]))
|
||||
self.lblHeaderROMChecksumResult.setStyleSheet("QLabel { color: green; }");
|
||||
self.lblStatus4a.setText("Done!")
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Information, windowTitle=APPNAME, text="The ROM was dumped successfully!", standardButtons=QtWidgets.QMessageBox.Ok)
|
||||
@@ -670,14 +693,15 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblHeaderROMChecksumResult.setText("Invalid (0x{:04X}≠0x{:04X})".format(self.CONN.INFO["rom_checksum_calc"], self.CONN.INFO["rom_checksum"]))
|
||||
self.lblHeaderROMChecksumResult.setStyleSheet("QLabel { color: red; }");
|
||||
self.lblStatus4a.setText("Done.")
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "The ROM dump is complete, but the checksum is not correct. This may indicate a bad dump, however this is normal for some bootleg cartridges, prototypes, patched games and trimmed ROM files.\nWhen dumping from a flash cartridge, manually selecting MBC5 before dumping may also help.", QtWidgets.QMessageBox.Ok)
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "The ROM was dumped, but the checksum is not correct. This may indicate a bad dump, however this can be normal for some reproduction cartridges, prototypes and patched games.\nWhen dumping from a flash cartridge, manually selecting MBC5 before dumping may also help.", QtWidgets.QMessageBox.Ok)
|
||||
elif self.CONN.GetMode() == "AGB":
|
||||
if self.AGB_Global_CRC32 == self.CONN.INFO["rom_checksum_calc"]:
|
||||
self.lblAGBHeaderROMChecksumResult.setText("OK (0x{:06X})".format(self.AGB_Global_CRC32))
|
||||
self.lblAGBHeaderROMChecksumResult.setText("Valid (0x{:06X})".format(self.AGB_Global_CRC32))
|
||||
self.lblAGBHeaderROMChecksumResult.setStyleSheet("QLabel { color: green; }");
|
||||
self.lblStatus4a.setText("Done!")
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Information, windowTitle=APPNAME, text="The ROM was dumped successfully!", standardButtons=QtWidgets.QMessageBox.Ok)
|
||||
msgbox.exec()
|
||||
|
||||
elif self.AGB_Global_CRC32 == 0:
|
||||
self.lblAGBHeaderROMChecksumResult.setText("0x{:06X}".format(self.CONN.INFO["rom_checksum_calc"]))
|
||||
self.lblAGBHeaderROMChecksumResult.setStyleSheet(self.lblHeaderCGBResult.styleSheet())
|
||||
@@ -687,16 +711,16 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblAGBHeaderROMChecksumResult.setText("Invalid (0x{:06X}≠0x{:06X})".format(self.CONN.INFO["rom_checksum_calc"], self.AGB_Global_CRC32))
|
||||
self.lblAGBHeaderROMChecksumResult.setStyleSheet("QLabel { color: red; }");
|
||||
self.lblStatus4a.setText("Done.")
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "The ROM dump is complete, but the checksum doesn’t match the known database entry. This may indicate a bad dump, however this is normal for some bootleg cartridges, prototypes, patched games and trimmed ROM files.", QtWidgets.QMessageBox.Ok)
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "The ROM was dumped, but the checksum doesn’t match the known database entry. This may indicate a bad dump, however this can be normal for some reproduction cartridges, prototypes and patched games.", QtWidgets.QMessageBox.Ok)
|
||||
|
||||
elif self.CONN.INFO["last_action"] == 2: # Backup RAM
|
||||
self.lblStatus4a.setText("Done!")
|
||||
self.CONN.INFO["last_action"] = 0
|
||||
|
||||
|
||||
elif self.CONN.INFO["last_action"] == 3: # Restore RAM
|
||||
self.lblStatus4a.setText("Done!")
|
||||
self.CONN.INFO["last_action"] = 0
|
||||
|
||||
|
||||
else:
|
||||
self.lblStatus4a.setText("Ready.")
|
||||
self.CONN.INFO["last_action"] = 0
|
||||
@@ -707,6 +731,10 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
cart_type = 0
|
||||
cart_text = ""
|
||||
|
||||
if self.CONN.CheckROMStable() is False:
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, "Unstable ROM reading detected. Please make sure you selected the correct mode and that the cartridge contacts are clean.", QtWidgets.QMessageBox.Ok)
|
||||
return 0
|
||||
|
||||
if self.CONN.GetMode() in self.FLASHCARTS and len(self.FLASHCARTS[self.CONN.GetMode()]) == 0:
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, "No flash cartridge type configuration files found. Try to restart the application with the “--reset” switch to reset the configuration.", QtWidgets.QMessageBox.Ok)
|
||||
return 0
|
||||
@@ -722,7 +750,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
else:
|
||||
detected = self.CONN.AutoDetectFlash(limitVoltage)
|
||||
if len(detected) == 0:
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Question, windowTitle=APPNAME, text="No pre-configured flash cartridge type was detected. You can still try and manually select one from the list -- look for similar PCB text and/or flash chip markings. However, chances are this cartridge is currently not supported for flashing with " + APPNAME + ".\n\nWould you like " + APPNAME + " to run a Flash ID check? This may help adding support for your flash cartridge in the future.", standardButtons=QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Question, windowTitle=APPNAME, text="No pre-configured flash cartridge type was detected. You can still try and manually select one from the list -- look for similar PCB text and/or flash chip markings. However, chances are this cartridge is currently not supported for flashing with " + APPNAME + ".\n\nWould you like " + APPNAME + " to run a flash chip query? This may help adding support for your flash cartridge in the future.", standardButtons=QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
msgbox.setCheckBox(cb)
|
||||
answer = msgbox.exec()
|
||||
@@ -732,30 +760,44 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
limitVoltage = False
|
||||
|
||||
if answer == QtWidgets.QMessageBox.Yes:
|
||||
check = self.CONN.CheckFlashID(limitVoltage)
|
||||
if check == "":
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "There was no Flash ID response from the cartridge. There probably is no flash chip or it requires unique unlocking and handling.", QtWidgets.QMessageBox.Ok)
|
||||
(flashid, cfi, cfi_raw) = self.CONN.CheckFlashChip(limitVoltage)
|
||||
if cfi == "":
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "There was no Common Flash Interface (CFI) response from the cartridge. If a flash chip exists on the cartridge PCB, it may be too old or require unique unlocking and handling.", QtWidgets.QMessageBox.Ok)
|
||||
else:
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "Here is what the Flash ID check returned: <pre>" + check + "</pre> This information along with a good quality picture of the PCB with readable chip markings may help adding support for your flash cartridge. You should be able to copy & paste the text above.", QtWidgets.QMessageBox.Ok)
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "Flash chip query result: <pre>" + flashid + "</pre><pre>" + str(cfi) + "</pre> This information along with a good quality picture of the PCB with readable chip markings may help adding support for your flash cartridge.", QtWidgets.QMessageBox.Ok)
|
||||
with open(self.CONFIG_PATH + "/cfi.bin", "wb") as f: f.write(cfi_raw)
|
||||
return 0
|
||||
else:
|
||||
cart_type = detected[0]
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
cart_types = self.CONN.GetSupportedCartridgesDMG()
|
||||
for i in range(0, len(detected)):
|
||||
cart_text += cart_types[0][detected[i]] + "\n"
|
||||
cart_text += "- " + cart_types[0][detected[i]] + "\n"
|
||||
elif self.CONN.GetMode() == "AGB":
|
||||
cart_types = self.CONN.GetSupportedCartridgesAGB()
|
||||
for i in range(0, len(detected)):
|
||||
cart_text += cart_types[0][detected[i]] + "\n"
|
||||
cart_text += "- " + cart_types[0][detected[i]] + "\n"
|
||||
|
||||
if len(detected) == 1:
|
||||
msg_text = "The following flash cartridge type was detected:\n" + cart_text + "\nIt seems to have a storage capacity of up to {:d} MB.\nOther features (such as save type) have to be manually selected.".format(int(cart_types[1][detected[0]]['flash_size'] / 1024 / 1024))
|
||||
msg_text = "The following flash cartridge type was detected:\n" + cart_text + "\nThe supported ROM size is up to {:d} MB.".format(int(cart_types[1][detected[0]]['flash_size'] / 1024 / 1024))
|
||||
else:
|
||||
msg_text = "The following flash cartridge type variants were detected:\n" + cart_text + "\nAll from this list should behave identical. The flash chip seems to have a storage capacity of up to {:d} MB.\nOther features (such as save type) have to be manually selected.".format(int(cart_types[1][detected[0]]['flash_size'] / 1024 / 1024))
|
||||
msg_text = "The following flash cartridge type variants were detected:\n" + cart_text + "\nAll from this list should work the same. The first name/alias will now be auto-selected.\n\nThe supported ROM size is up to {:d} MB.".format(int(cart_types[1][detected[0]]['flash_size'] / 1024 / 1024))
|
||||
|
||||
if QtWidgets.QMessageBox.Cancel == QtWidgets.QMessageBox.information(self, APPNAME, msg_text, QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel):
|
||||
return 0
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Question, windowTitle=APPNAME, text=msg_text)
|
||||
button_ok = msgbox.addButton("&OK", QtWidgets.QMessageBox.ActionRole)
|
||||
button_cancel = msgbox.addButton("&Cancel", QtWidgets.QMessageBox.RejectRole)
|
||||
button_cfi = msgbox.addButton(" Run flash chip &query ", QtWidgets.QMessageBox.ActionRole)
|
||||
msgbox.setDefaultButton(button_ok)
|
||||
msgbox.setEscapeButton(button_cancel)
|
||||
answer = msgbox.exec()
|
||||
if msgbox.clickedButton() == button_cfi:
|
||||
(flashid, cfi, cfi_raw) = self.CONN.CheckFlashChip(limitVoltage=limitVoltage, cart_type=cart_types[1][cart_type])
|
||||
if cfi == "":
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "There was no Common Flash Interface (CFI) response from the cartridge. If a flash chip exists on the cartridge PCB, it may be too old or require unique unlocking and handling.", QtWidgets.QMessageBox.Ok)
|
||||
else:
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, "Flash chip query result: <pre>" + flashid + "</pre><pre>" + str(cfi) + "</pre>", QtWidgets.QMessageBox.Ok)
|
||||
with open(self.CONFIG_PATH + "/cfi.bin", "wb") as f: f.write(cfi_raw)
|
||||
elif msgbox.clickedButton() == button_cancel: return 0
|
||||
|
||||
return cart_type
|
||||
|
||||
@@ -766,19 +808,35 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
cart_type = self.CartridgeTypeAutoDetect()
|
||||
if (cart_type == 1): cart_type = 0
|
||||
self.cmbDMGCartridgeTypeResult.setCurrentIndex(cart_type)
|
||||
elif cart_types[1][index] == "RETAIL": # special keyword
|
||||
pass
|
||||
else:
|
||||
for i in range(0, len(self.DMG_Header_ROM_Sizes_Flasher_Map)):
|
||||
if cart_types[1][index]["flash_size"] == (self.DMG_Header_ROM_Sizes_Flasher_Map[i] * 0x4000):
|
||||
self.cmbHeaderROMSizeResult.setCurrentIndex(i)
|
||||
|
||||
elif self.CONN.GetMode() == "AGB":
|
||||
cart_types = self.CONN.GetSupportedCartridgesAGB()
|
||||
if cart_types[1][index] == "AUTODETECT": # special keyword
|
||||
cart_type = self.CartridgeTypeAutoDetect()
|
||||
if (cart_type == 1): cart_type = 0
|
||||
self.cmbAGBCartridgeTypeResult.setCurrentIndex(cart_type)
|
||||
else:
|
||||
return
|
||||
elif cart_types[1][index] == "RETAIL": # special keyword
|
||||
pass
|
||||
else:
|
||||
self.cmbAGBHeaderROMSizeResult.setCurrentIndex(self.AGB_Header_ROM_Sizes_Map.index(cart_types[1][index]["flash_size"]))
|
||||
|
||||
def BackupROM(self):
|
||||
if not self.CheckDeviceAlive(): return
|
||||
mbc = self.DMG_Header_Features_MBC[self.cmbHeaderFeaturesResult.currentIndex()]
|
||||
rom_banks = self.DMG_Header_ROM_Sizes_Flasher_Map[self.cmbHeaderROMSizeResult.currentIndex()]
|
||||
|
||||
fast_read_mode = self.SETTINGS.value("FastReadMode")
|
||||
if fast_read_mode and fast_read_mode.lower() == "enabled":
|
||||
fast_read_mode = True
|
||||
else:
|
||||
fast_read_mode = False
|
||||
|
||||
rom_size = 0
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
if mbc == 1 and ("MOMOCOL" in self.lblHeaderTitleResult.text() or "BOMCOL" in self.lblHeaderTitleResult.text()):
|
||||
@@ -815,11 +873,18 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblHeaderROMChecksumResult.setStyleSheet(self.lblHeaderCGBResult.styleSheet())
|
||||
self.lblAGBHeaderROMChecksumResult.setStyleSheet(self.lblHeaderCGBResult.styleSheet())
|
||||
|
||||
self.CONN.BackupROM(self.setProgress, path, mbc, rom_banks, rom_size)
|
||||
#self.DEBUG = [ self.SetProgress, path, mbc, rom_banks, rom_size, fast_read_mode ]
|
||||
self.CONN.BackupROM(fncSetProgress=self.SetProgress, path=path, mbc=mbc, rom_banks=rom_banks, agb_rom_size=rom_size, fast_read_mode=fast_read_mode)
|
||||
|
||||
def FlashROM(self, dpath="", trim_rom=False):
|
||||
def FlashROM(self, dpath=""):
|
||||
if not self.CheckDeviceAlive(): return
|
||||
path = ""
|
||||
if dpath != "":
|
||||
text = "The following ROM file will now be written to the flash cartridge:\n" + dpath
|
||||
answer = QtWidgets.QMessageBox.question(self, APPNAME, text, QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
if answer == QtWidgets.QMessageBox.Cancel: return
|
||||
path = dpath
|
||||
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
setting_name = "LastDirRomDMG"
|
||||
last_dir = self.SETTINGS.value(setting_name)
|
||||
@@ -844,11 +909,6 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.cmbAGBCartridgeTypeResult.setCurrentIndex(cart_type)
|
||||
if cart_type == 0: return
|
||||
|
||||
if dpath != "":
|
||||
answer = QtWidgets.QMessageBox.question(self, APPNAME, "The following ROM file will now be written to the flash cartridge:\n" + dpath, QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
if answer == QtWidgets.QMessageBox.Cancel: return
|
||||
path = dpath
|
||||
|
||||
while path == "":
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(self, "Flash ROM", last_dir, "Game Boy ROM File (*.gb *.gbc *.sgb *.bin);;All Files (*.*)")[0]
|
||||
@@ -878,7 +938,38 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
override_voltage = 5
|
||||
elif msgbox.clickedButton() == button_cancel: return
|
||||
|
||||
self.CONN.FlashROM(self.setProgress, path=path, cart_type=cart_type, trim_rom=trim_rom, override_voltage=override_voltage)
|
||||
reverse_sectors = False
|
||||
if 'sector_reversal' in carts[cart_type]:
|
||||
msgbox = QtWidgets.QMessageBox(parent=self, icon=QtWidgets.QMessageBox.Question, windowTitle=APPNAME, text="The selected flash cartridge type is reported to sometimes have reversed sectors. If the cartridge is not working after flashing, try reversed sectors.")
|
||||
button_normal = msgbox.addButton("Normal", QtWidgets.QMessageBox.ActionRole)
|
||||
button_reversed = msgbox.addButton("Reversed", QtWidgets.QMessageBox.ActionRole)
|
||||
button_cancel = msgbox.addButton("&Cancel", QtWidgets.QMessageBox.RejectRole)
|
||||
msgbox.setDefaultButton(button_normal)
|
||||
msgbox.setEscapeButton(button_cancel)
|
||||
answer = msgbox.exec()
|
||||
if msgbox.clickedButton() == button_reversed:
|
||||
reverse_sectors = True
|
||||
elif msgbox.clickedButton() == button_cancel: return
|
||||
|
||||
prefer_sector_erase = False
|
||||
if 'chip_erase' in carts[cart_type]['commands'] and 'sector_erase' in carts[cart_type]['commands']:
|
||||
prefer_sector_erase = self.SETTINGS.value("PreferSectorErase")
|
||||
if prefer_sector_erase and prefer_sector_erase.lower() == "enabled":
|
||||
prefer_sector_erase = True
|
||||
|
||||
if self.CONN.GetMode() == "DMG":
|
||||
hdr = RomFileDMG(path).GetHeader()
|
||||
elif self.CONN.GetMode() == "AGB":
|
||||
hdr = RomFileAGB(path).GetHeader()
|
||||
if not hdr["logo_correct"]:
|
||||
answer = QtWidgets.QMessageBox.warning(self, APPNAME, "Warning: The ROM file you selected may not boot on actual hardware due to invalid logo data.", QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
if answer == QtWidgets.QMessageBox.Cancel: return
|
||||
if not hdr["header_checksum_correct"]:
|
||||
answer = QtWidgets.QMessageBox.warning(self, APPNAME, "Warning: The ROM file you selected may not boot on actual hardware due to an invalid header checksum (expected 0x{:02X} instead of 0x{:02X}).".format(hdr["header_checksum_calc"], hdr["header_checksum"]), QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
if answer == QtWidgets.QMessageBox.Cancel: return
|
||||
|
||||
#self.DEBUG = [ self.SetProgress, path, cart_type, override_voltage ]
|
||||
self.CONN.FlashROM(fncSetProgress=self.SetProgress, path=path, cart_type=cart_type, override_voltage=override_voltage, prefer_sector_erase=prefer_sector_erase, reverse_sectors=reverse_sectors)
|
||||
buffer = None
|
||||
|
||||
def BackupRAM(self):
|
||||
@@ -904,18 +995,23 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
features = 0
|
||||
save_type = self.cmbAGBSaveTypeResult.currentIndex()
|
||||
if save_type == 0:
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, "The save type was not selected or auto-detection failed.", QtWidgets.QMessageBox.Ok)
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "The save type was not selected or auto-detection failed.", QtWidgets.QMessageBox.Ok)
|
||||
return
|
||||
else:
|
||||
return
|
||||
|
||||
path = re.sub(r"[<>:\"/\\|\?\*]", "_", path) + ".sav"
|
||||
|
||||
add_date_time = self.SETTINGS.value("SaveFileNameAddDateTime")
|
||||
if add_date_time and add_date_time.lower() == "enabled":
|
||||
path = re.sub(r"[<>:\"/\\|\?\*]", "_", path) + "_" + datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + ".sav"
|
||||
else:
|
||||
path = re.sub(r"[<>:\"/\\|\?\*]", "_", path) + ".sav"
|
||||
|
||||
path = QtWidgets.QFileDialog.getSaveFileName(self, "Backup Save Data", last_dir + "/" + path, "Save Data File (*.sav);;All Files (*.*)")[0]
|
||||
|
||||
if (path == ""): return
|
||||
|
||||
self.SETTINGS.setValue(setting_name, os.path.dirname(path))
|
||||
self.CONN.BackupRAM(self.setProgress, path, features, save_type)
|
||||
self.CONN.BackupRAM(fncSetProgress=self.SetProgress, path=path, mbc=features, save_type=save_type)
|
||||
|
||||
def WriteRAM(self, dpath="", erase=False):
|
||||
if not self.CheckDeviceAlive(): return
|
||||
@@ -943,7 +1039,8 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
return
|
||||
|
||||
if dpath != "":
|
||||
answer = QtWidgets.QMessageBox.question(self, APPNAME, "The following save data file will now be written to the cartridge:\n" + dpath, QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
text = "The following save data file will now be written to the cartridge:\n" + dpath
|
||||
answer = QtWidgets.QMessageBox.question(self, APPNAME, text, QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel)
|
||||
if answer == QtWidgets.QMessageBox.Cancel: return
|
||||
path = dpath
|
||||
self.SETTINGS.setValue(setting_name, os.path.dirname(path))
|
||||
@@ -954,10 +1051,9 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
path = path + ".sav"
|
||||
path = QtWidgets.QFileDialog.getOpenFileName(self, "Restore Save Data", last_dir + "/" + path, "Save Data File (*.sav);;All Files (*.*)")[0]
|
||||
if not path == "": self.SETTINGS.setValue(setting_name, os.path.dirname(path))
|
||||
if (path == ""): return
|
||||
|
||||
if (path == ""): return
|
||||
|
||||
self.CONN.RestoreRAM(self.setProgress, path, features, save_type, erase)
|
||||
self.CONN.RestoreRAM(fncSetProgress=self.SetProgress, path=path, mbc=features, save_type=save_type, erase=erase)
|
||||
|
||||
def CheckDeviceAlive(self, setMode=False):
|
||||
if self.CONN is not None:
|
||||
@@ -1075,7 +1171,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblHeaderLogoValidResult.setText("Invalid")
|
||||
self.lblHeaderLogoValidResult.setStyleSheet("QLabel { color: red; }");
|
||||
if data['header_checksum_correct']:
|
||||
self.lblHeaderChecksumResult.setText("OK (0x{:02X})".format(data['header_checksum']))
|
||||
self.lblHeaderChecksumResult.setText("Valid (0x{:02X})".format(data['header_checksum']))
|
||||
self.lblHeaderChecksumResult.setStyleSheet(self.lblHeaderCGBResult.styleSheet())
|
||||
else:
|
||||
self.lblHeaderChecksumResult.setText("Invalid (0x{:02X})".format(data['header_checksum']))
|
||||
@@ -1123,7 +1219,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblAGBHeader96hResult.setStyleSheet("QLabel { color: red; }");
|
||||
|
||||
if data['header_checksum_correct']:
|
||||
self.lblAGBHeaderChecksumResult.setText("OK (0x{:02X})".format(data['header_checksum']))
|
||||
self.lblAGBHeaderChecksumResult.setText("Valid (0x{:02X})".format(data['header_checksum']))
|
||||
self.lblAGBHeaderChecksumResult.setStyleSheet(self.lblAGBHeaderCodeResult.styleSheet())
|
||||
else:
|
||||
self.lblAGBHeaderChecksumResult.setText("Invalid (0x{:02X})".format(data['header_checksum']))
|
||||
@@ -1172,6 +1268,8 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblStatus3aResult.setText("–")
|
||||
self.lblStatus4a.setText("Ready.")
|
||||
self.FinishOperation()
|
||||
if self.CONN.CheckROMStable() is False:
|
||||
QtWidgets.QMessageBox.warning(self, APPNAME, "Unstable ROM reading detected. Please reconnect the device, make sure you selected the correct mode and that the cartridge contacts are clean.", QtWidgets.QMessageBox.Ok)
|
||||
|
||||
def formatFileSize(self, size):
|
||||
size = size / 1024
|
||||
@@ -1202,44 +1300,150 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
s = s + "seconds"
|
||||
return s
|
||||
|
||||
def setProgress(self, error, cur, max, speed=0, elapsed=0, left=0):
|
||||
if error != None and type(error) != type({}):
|
||||
def SetProgress(self, args):
|
||||
now = time.time()
|
||||
if args["action"] == "INITIALIZE":
|
||||
self.PROGRESS["method"] = args["method"]
|
||||
self.PROGRESS["size"] = args["size"]
|
||||
if "pos" in args:
|
||||
self.PROGRESS["pos"] = args["pos"]
|
||||
else:
|
||||
self.PROGRESS["pos"] = 0
|
||||
if "time_start" in args:
|
||||
self.PROGRESS["time_start"] = args["time_start"]
|
||||
else:
|
||||
self.PROGRESS["time_start"] = now
|
||||
self.PROGRESS["time_last_emit"] = now
|
||||
self.PROGRESS["time_last_update_speed"] = now
|
||||
self.PROGRESS["time_left"] = 0
|
||||
self.PROGRESS["speed"] = 0
|
||||
self.PROGRESS["speeds"] = []
|
||||
self.PROGRESS["bytes_last_update_speed"] = 0
|
||||
self.UpdateProgress(self.PROGRESS)
|
||||
|
||||
if args["action"] == "ABORT":
|
||||
self.UpdateProgress(args)
|
||||
self.PROGRESS = {}
|
||||
|
||||
elif args["action"] in ("ERASE", "SECTOR_ERASE"):
|
||||
if "time_start" in self.PROGRESS:
|
||||
args["time_elapsed"] = now - self.PROGRESS["time_start"]
|
||||
else:
|
||||
args["time_elapsed"] = now - args["time_start"]
|
||||
args["pos"] = 1
|
||||
args["size"] = 0
|
||||
self.UpdateProgress(args)
|
||||
|
||||
elif self.PROGRESS == {}:
|
||||
return
|
||||
|
||||
elif args["action"] == "UPDATE_POS":
|
||||
self.PROGRESS["pos"] = args["pos"]
|
||||
|
||||
#elif args["action"] in ("UPDATE_SPEED"): # so that speed displayed won't drop right after sector erase
|
||||
# self.PROGRESS["speed_updated"] = True
|
||||
# self.PROGRESS["time_last_update_speed"] = now
|
||||
# self.PROGRESS["bytes_last_update_speed"] = self.PROGRESS["pos"]
|
||||
|
||||
elif args["action"] in ("READ", "WRITE"):
|
||||
if "method" not in self.PROGRESS: return
|
||||
elif args["action"] == "READ" and self.PROGRESS["method"] in ("SAVE_WRITE", "ROM_WRITE"): return
|
||||
elif args["action"] == "WRITE" and self.PROGRESS["method"] in ("SAVE_READ", "ROM_READ"): return
|
||||
|
||||
self.PROGRESS["pos"] += args["bytes_added"]
|
||||
if (now - self.PROGRESS["time_last_emit"]) > 0.05:
|
||||
self.PROGRESS["time_elapsed"] = now - self.PROGRESS["time_start"]
|
||||
if (now - self.PROGRESS["time_last_update_speed"]) > 0.25:
|
||||
time_delta = now - self.PROGRESS["time_last_update_speed"]
|
||||
pos_delta = self.PROGRESS["pos"] - self.PROGRESS["bytes_last_update_speed"]
|
||||
if time_delta > 0:
|
||||
speed = (pos_delta / time_delta) / 1024
|
||||
self.PROGRESS["speeds"].append(speed)
|
||||
if len(self.PROGRESS["speeds"]) > 32: self.PROGRESS["speeds"].pop(0)
|
||||
self.PROGRESS["speed"] = statistics.median(self.PROGRESS["speeds"]) #(pos_delta / time_delta) / 1024
|
||||
self.PROGRESS["time_last_update_speed"] = now
|
||||
self.PROGRESS["bytes_last_update_speed"] = self.PROGRESS["pos"]
|
||||
|
||||
if "skipping" in args and args["skipping"] is True:
|
||||
self.PROGRESS["speed"] = 0
|
||||
self.PROGRESS["skipping"] = True
|
||||
else:
|
||||
self.PROGRESS["skipping"] = False
|
||||
|
||||
if self.PROGRESS["speed"] > 0:
|
||||
self.PROGRESS["time_left"] = (self.PROGRESS["size"] - self.PROGRESS["pos"]) / 1024 / self.PROGRESS["speed"]
|
||||
|
||||
self.UpdateProgress(self.PROGRESS)
|
||||
self.PROGRESS["time_last_emit"] = now
|
||||
|
||||
elif args["action"] == "FINISHED":
|
||||
self.PROGRESS["pos"] = self.PROGRESS["size"]
|
||||
self.PROGRESS["bytes_last_update_speed"] = self.PROGRESS["size"]
|
||||
self.PROGRESS["time_elapsed"] = now - self.PROGRESS["time_start"]
|
||||
self.PROGRESS["time_last_emit"] = now
|
||||
self.PROGRESS["time_last_update_speed"] = now
|
||||
self.PROGRESS["time_left"] = 0
|
||||
self.PROGRESS["speed"] = (self.PROGRESS["size"] / self.PROGRESS["time_elapsed"]) / 1024
|
||||
self.PROGRESS["bytes_last_emit"] = self.PROGRESS["size"]
|
||||
|
||||
if self.PROGRESS["speed"] > self.PROGRESS["size"] / 1024:
|
||||
self.PROGRESS["speed"] = self.PROGRESS["size"] / 1024
|
||||
|
||||
self.UpdateProgress(self.PROGRESS)
|
||||
self.PROGRESS = {}
|
||||
|
||||
def UpdateProgress(self, args):
|
||||
if args is None: return
|
||||
|
||||
if "error" in args:
|
||||
self.lblStatus4a.setText("Failed!")
|
||||
self.grpDMGCartridgeInfo.setEnabled(True)
|
||||
self.grpAGBCartridgeInfo.setEnabled(True)
|
||||
self.grpActions.setEnabled(True)
|
||||
self.btnCancel.setEnabled(False)
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, str(error), QtWidgets.QMessageBox.Ok)
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, str(args["error"]), QtWidgets.QMessageBox.Ok)
|
||||
return
|
||||
|
||||
|
||||
self.grpDMGCartridgeInfo.setEnabled(False)
|
||||
self.grpAGBCartridgeInfo.setEnabled(False)
|
||||
self.grpActions.setEnabled(False)
|
||||
|
||||
if (type(error) == type({})):
|
||||
if error["action"] == "ERASE":
|
||||
pos = 0
|
||||
size = 0
|
||||
speed = 0
|
||||
elapsed = 0
|
||||
left = 0
|
||||
if "pos" in args: pos = args["pos"]
|
||||
if "size" in args: size = args["size"]
|
||||
if "speed" in args: speed = args["speed"]
|
||||
if "time_elapsed" in args: elapsed = args["time_elapsed"]
|
||||
if "time_left" in args: left = args["time_left"]
|
||||
|
||||
if "action" in args:
|
||||
if args["action"] == "ERASE":
|
||||
self.lblStatus1aResult.setText("Pending...")
|
||||
self.lblStatus2aResult.setText("Pending...")
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
self.lblStatus4a.setText("Erasing flash...")
|
||||
self.lblStatus4aResult.setText("")
|
||||
self.btnCancel.setEnabled(error["abortable"])
|
||||
self.SetProgressBars(min=0, max=max, value=cur)
|
||||
elif error["action"] == "SECTOR_ERASE":
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
self.btnCancel.setEnabled(args["abortable"])
|
||||
self.SetProgressBars(min=0, max=size, value=pos)
|
||||
elif args["action"] == "SECTOR_ERASE":
|
||||
if elapsed >= 1:
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
self.lblStatus4a.setText("Erasing sector...")
|
||||
self.lblStatus4aResult.setText("")
|
||||
self.btnCancel.setEnabled(error["abortable"])
|
||||
self.SetProgressBars(min=0, max=max, value=cur, setPause=True)
|
||||
elif error["action"] == "VERIFY":
|
||||
self.lblStatus1aResult.setText("")
|
||||
self.lblStatus2aResult.setText("")
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
self.lblStatus4a.setText("Verifying...")
|
||||
self.btnCancel.setEnabled(args["abortable"])
|
||||
self.SetProgressBars(min=0, max=size, value=pos, setPause=True)
|
||||
elif args["action"] == "ABORTING":
|
||||
self.lblStatus1aResult.setText("–")
|
||||
self.lblStatus2aResult.setText("–")
|
||||
self.lblStatus3aResult.setText("–")
|
||||
self.lblStatus4a.setText("Stopping... Please wait.")
|
||||
self.lblStatus4aResult.setText("")
|
||||
self.btnCancel.setEnabled(error["abortable"])
|
||||
self.SetProgressBars(min=0, max=max, value=cur)
|
||||
elif error["action"] == "ABORT":
|
||||
self.btnCancel.setEnabled(args["abortable"])
|
||||
self.SetProgressBars(min=0, max=size, value=pos)
|
||||
elif args["action"] == "ABORT":
|
||||
wd = 10
|
||||
while self.CONN.WORKER.isRunning():
|
||||
time.sleep(0.1)
|
||||
@@ -1253,36 +1457,42 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
self.lblStatus1aResult.setText("–")
|
||||
self.lblStatus2aResult.setText("–")
|
||||
self.lblStatus3aResult.setText("–")
|
||||
self.lblStatus4a.setText("Aborted.")
|
||||
self.lblStatus4a.setText("Stopped.")
|
||||
self.lblStatus4aResult.setText("")
|
||||
self.btnCancel.setEnabled(False)
|
||||
self.SetProgressBars(min=0, max=1, value=0)
|
||||
self.btnCancel.setEnabled(False)
|
||||
|
||||
if "info_type" in error.keys() and "info_msg" in error.keys():
|
||||
if error["info_type"] == "msgbox_critical":
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, error["info_msg"], QtWidgets.QMessageBox.Ok)
|
||||
elif error["info_type"] == "msgbox_information":
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, error["info_msg"], QtWidgets.QMessageBox.Ok)
|
||||
elif error["info_type"] == "label":
|
||||
self.lblStatus4a.setText(error["info_msg"])
|
||||
if "info_type" in args.keys() and "info_msg" in args.keys():
|
||||
if args["info_type"] == "msgbox_critical":
|
||||
QtWidgets.QMessageBox.critical(self, APPNAME, args["info_msg"], QtWidgets.QMessageBox.Ok)
|
||||
elif args["info_type"] == "msgbox_information":
|
||||
QtWidgets.QMessageBox.information(self, APPNAME, args["info_msg"], QtWidgets.QMessageBox.Ok)
|
||||
elif args["info_type"] == "label":
|
||||
self.lblStatus4a.setText(args["info_msg"])
|
||||
|
||||
return
|
||||
|
||||
else:
|
||||
self.SetProgressBars(min=0, max=max, value=cur)
|
||||
self.SetProgressBars(min=0, max=size, value=pos)
|
||||
self.btnCancel.setEnabled(True)
|
||||
self.lblStatus1aResult.setText(self.formatFileSize(cur))
|
||||
if speed == 0:
|
||||
self.lblStatus2aResult.setText("–")
|
||||
self.lblStatus4aResult.setText("–")
|
||||
pass
|
||||
else:
|
||||
self.lblStatus1aResult.setText(self.formatFileSize(pos))
|
||||
if speed > 0:
|
||||
self.lblStatus2aResult.setText("{:.2f} KB/s".format(speed))
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
self.lblStatus4a.setText("Time left:")
|
||||
if speed > 0 and left > 0:
|
||||
else:
|
||||
self.lblStatus2aResult.setText("Pending...")
|
||||
if left > 0:
|
||||
self.lblStatus4aResult.setText(self.formatProgressTime(left))
|
||||
elif max == cur:
|
||||
else:
|
||||
self.lblStatus4aResult.setText("Pending...")
|
||||
if elapsed > 0:
|
||||
self.lblStatus3aResult.setText(self.formatProgressTime(elapsed))
|
||||
|
||||
if speed == 0 and "skipping" in args and args["skipping"] is True:
|
||||
self.lblStatus4aResult.setText("Pending...")
|
||||
self.lblStatus4a.setText("Time left:")
|
||||
|
||||
if size == pos:
|
||||
wd = 10
|
||||
while self.CONN.WORKER.isRunning():
|
||||
time.sleep(0.1)
|
||||
@@ -1291,7 +1501,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
pass
|
||||
self.FinishOperation()
|
||||
|
||||
def SetProgressBars(self, min=0, max=100, value=0, setPause=None, setStop=None):
|
||||
def SetProgressBars(self, min=0, max=100, value=0, setPause=None):
|
||||
self.prgStatus.setMinimum(min)
|
||||
self.prgStatus.setMaximum(max)
|
||||
self.prgStatus.setValue(value)
|
||||
@@ -1374,7 +1584,7 @@ class FlashGBX(QtWidgets.QWidget):
|
||||
|
||||
# Taskbar Progress on Windows only
|
||||
try:
|
||||
from PySide2.QtWinExtras import QWinTaskbarProgress, QWinTaskbarButton, QtWin
|
||||
from PySide2.QtWinExtras import QWinTaskbarButton, QtWin
|
||||
myappid = 'lesserkuma.flashgbx'
|
||||
QtWin.setCurrentProcessExplicitAppUserModelID(myappid)
|
||||
taskbar_button = QWinTaskbarButton()
|
||||
|
||||
107
FlashGBX/Util.py
Normal file
107
FlashGBX/Util.py
Normal file
@@ -0,0 +1,107 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# UTF-8
|
||||
import math, time, datetime, copy
|
||||
|
||||
# Utility functions
|
||||
def bitswap(n, s):
|
||||
p, q = s
|
||||
if (((n & (1 << p)) >> p) ^ ((n & (1 << q)) >> q)) == 1:
|
||||
n ^= (1 << p)
|
||||
n ^= (1 << q)
|
||||
return n
|
||||
|
||||
def ParseCFI(buffer):
|
||||
buffer = copy.copy(buffer)
|
||||
info = {}
|
||||
magic = "{:s}{:s}{:s}".format(chr(buffer[0x20]), chr(buffer[0x22]), chr(buffer[0x24]))
|
||||
if magic != "QRY": # nothing swapped
|
||||
return False
|
||||
|
||||
try:
|
||||
info["flash_id"] = buffer[0:8]
|
||||
info["magic"] = "{:s}{:s}{:s}".format(chr(buffer[0x20]), chr(buffer[0x22]), chr(buffer[0x24]))
|
||||
|
||||
if buffer[0x36] == 0xFF and buffer[0x48] == 0xFF:
|
||||
print("FAIL: No information about the voltage range found in CFI data.")
|
||||
try:
|
||||
with open("./cfi_debug.bin", "wb") as f: f.write(buffer)
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
info["vdd_min"] = (buffer[0x36] >> 4) + ((buffer[0x36] & 0x0F) / 10)
|
||||
info["vdd_max"] = (buffer[0x38] >> 4) + ((buffer[0x38] & 0x0F) / 10)
|
||||
|
||||
if buffer[0x3E] > 0 and buffer[0x3E] < 0xFF:
|
||||
info["single_write"] = True
|
||||
info["single_write_time_avg"] = int(math.pow(2, buffer[0x3E]))
|
||||
info["single_write_time_max"] = int(math.pow(2, buffer[0x46]) * info["single_write_time_avg"])
|
||||
else:
|
||||
info["single_write"] = False
|
||||
|
||||
if buffer[0x40] > 0 and buffer[0x40] < 0xFF:
|
||||
info["buffer_write"] = True
|
||||
info["buffer_write_time_avg"] = int(math.pow(2, buffer[0x40]))
|
||||
info["buffer_write_time_max"] = int(math.pow(2, buffer[0x48]) * info["buffer_write_time_avg"])
|
||||
else:
|
||||
info["buffer_write"] = False
|
||||
|
||||
if buffer[0x42] > 0 and buffer[0x42] < 0xFF:
|
||||
info["sector_erase"] = True
|
||||
info["sector_erase_time_avg"] = int(math.pow(2, buffer[0x42]))
|
||||
info["sector_erase_time_max"] = int(math.pow(2, buffer[0x4A]) * info["sector_erase_time_avg"])
|
||||
else:
|
||||
info["sector_erase"] = False
|
||||
|
||||
if buffer[0x44] > 0 and buffer[0x44] < 0xFF:
|
||||
info["chip_erase"] = True
|
||||
info["chip_erase_time_avg"] = int(math.pow(2, buffer[0x44]))
|
||||
info["chip_erase_time_max"] = int(math.pow(2, buffer[0x4C]) * info["chip_erase_time_avg"])
|
||||
else:
|
||||
info["chip_erase"] = False
|
||||
|
||||
info["tb_boot_sector"] = False
|
||||
if "{:s}{:s}{:s}".format(chr(buffer[0x80]), chr(buffer[0x82]), chr(buffer[0x84])) == "PRI":
|
||||
if buffer[0x9E] != 0 and buffer[0x9E] != 0xFF:
|
||||
temp = { 0x02: 'Bottom Boot Device', 0x03: 'Top Boot Device' }
|
||||
try:
|
||||
info["tb_boot_sector"] = "{:s} (0x{:02X})".format(temp[buffer[0x9E]], buffer[0x9E])
|
||||
except:
|
||||
info["tb_boot_sector"] = "0x{:02X}".format(buffer[0x9E])
|
||||
elif "{:s}{:s}{:s}".format(chr(buffer[0x214]), chr(buffer[0x216]), chr(buffer[0x218])) == "PRI":
|
||||
pass # todo
|
||||
|
||||
info["device_size"] = int(math.pow(2, buffer[0x4E]))
|
||||
info["buffer_size"] = buffer[0x56] << 8 | buffer[0x54]
|
||||
if info["buffer_size"] > 1:
|
||||
info["buffer_write"] = True
|
||||
info["buffer_size"] = int(math.pow(2, info["buffer_size"]))
|
||||
else:
|
||||
del(info["buffer_size"])
|
||||
info["buffer_write"] = False
|
||||
info["erase_sector_regions"] = buffer[0x58]
|
||||
info["erase_sector_blocks"] = []
|
||||
total_blocks = 0
|
||||
pos = 0
|
||||
for i in range(0, min(4, info["erase_sector_regions"])):
|
||||
b = (buffer[0x5C+(i*8)] << 8 | buffer[0x5A+(i*8)]) + 1
|
||||
t = (buffer[0x60+(i*8)] << 8 | buffer[0x5E+(i*8)]) * 256
|
||||
total_blocks += b
|
||||
size = b * t
|
||||
pos += size
|
||||
info["erase_sector_blocks"].append([ t, b, size ])
|
||||
|
||||
except:
|
||||
print("ERROR: Trying to parse CFI data resulted in an error.")
|
||||
try:
|
||||
with open("./cfi_debug.bin", "wb") as f: f.write(buffer)
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
return info
|
||||
|
||||
def dprint(*args, **kwargs):
|
||||
# uncomment for some debug prints
|
||||
#print(" ".join(map(str, args)), **kwargs)
|
||||
pass
|
||||
File diff suppressed because it is too large
Load Diff
53
FlashGBX/config/fc_AGB_29LV128DT.txt
Normal file
53
FlashGBX/config/fc_AGB_29LV128DT.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"type":"AGB",
|
||||
"names":[
|
||||
"AGB-E08-09 with 29LV128DTMC-90Q"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0xC1, 0x00, 0x7D, 0x22 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x1000000,
|
||||
"sector_size":[
|
||||
[0x10000, 255],
|
||||
[0x02000, 8]
|
||||
],
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xF0 ]
|
||||
],
|
||||
"read_identifier":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x90 ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFFFF, 0xFFFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0xA0 ],
|
||||
[ "PA", "PD" ]
|
||||
],
|
||||
"single_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
{
|
||||
"type":"AGB",
|
||||
"names":[
|
||||
"4455_4400_4000_4350_36L0R_V3 with M36L0R705"
|
||||
"4455_4400_4000_4350_36L0R_V3 with M36L0R7050T",
|
||||
"4050_4400_4000_4350_36L0R_V5 with M36L0R7050T"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x20, 0x00, 0xC4, 0x88 ],
|
||||
[ 0x20, 0x00, 0xC4, 0x88 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
86
FlashGBX/config/fc_AGB_M36L0R8060B.txt
Normal file
86
FlashGBX/config/fc_AGB_M36L0R8060B.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"type":"AGB",
|
||||
"names":[
|
||||
"36L0R8-39VF512 with M36L0R8060B",
|
||||
"36L0R8-39VF512 with M36L0R8060B"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x20, 0x00, 0x0D, 0x88 ],
|
||||
[ 0x8A, 0x00, 0x10, 0x88 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x2000000,
|
||||
"sector_size":[
|
||||
[0x08000, 4],
|
||||
[0x20000, 255]
|
||||
],
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xFF ],
|
||||
[ 0x100000, 0xFF ],
|
||||
[ 0x200000, 0xFF ],
|
||||
[ 0x300000, 0xFF ],
|
||||
[ 0x400000, 0xFF ],
|
||||
[ 0x500000, 0xFF ],
|
||||
[ 0x600000, 0xFF ],
|
||||
[ 0x700000, 0xFF ],
|
||||
[ 0x800000, 0xFF ],
|
||||
[ 0x900000, 0xFF ],
|
||||
[ 0xA00000, 0xFF ],
|
||||
[ 0xB00000, 0xFF ],
|
||||
[ 0xC00000, 0xFF ],
|
||||
[ 0xD00000, 0xFF ],
|
||||
[ 0xE00000, 0xFF ],
|
||||
[ 0xF00000, 0xFF ],
|
||||
[ 0x1000000, 0xFF ],
|
||||
[ 0x1100000, 0xFF ],
|
||||
[ 0x1200000, 0xFF ],
|
||||
[ 0x1300000, 0xFF ],
|
||||
[ 0x1400000, 0xFF ],
|
||||
[ 0x1500000, 0xFF ],
|
||||
[ 0x1600000, 0xFF ],
|
||||
[ 0x1700000, 0xFF ],
|
||||
[ 0x1800000, 0xFF ],
|
||||
[ 0x1900000, 0xFF ],
|
||||
[ 0x1A00000, 0xFF ],
|
||||
[ 0x1B00000, 0xFF ],
|
||||
[ 0x1C00000, 0xFF ],
|
||||
[ 0x1D00000, 0xFF ],
|
||||
[ 0x1E00000, 0xFF ],
|
||||
[ 0x1F00000, 0xFF ]
|
||||
],
|
||||
"read_identifier":[
|
||||
[ 0, 0x90 ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ "SA", 0x60 ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0x20 ],
|
||||
[ "SA", 0xD0 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ]
|
||||
],
|
||||
"buffer_write":[
|
||||
[ "SA", 0x60 ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0xE8 ],
|
||||
[ "SA", "BS" ],
|
||||
[ "PA", "PD" ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0xFF ]
|
||||
],
|
||||
"buffer_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ],
|
||||
[ null, null, null ]
|
||||
]
|
||||
}
|
||||
}
|
||||
86
FlashGBX/config/fc_AGB_M36L0R8060T.txt
Normal file
86
FlashGBX/config/fc_AGB_M36L0R8060T.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"type":"AGB",
|
||||
"names":[
|
||||
"4050_4400_4000_4350_36L0R_V5 with M36L0R8060T",
|
||||
"36L0R8-39VF512 with M36L0R8060T"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x20, 0x00, 0x0E, 0x88 ],
|
||||
[ 0x20, 0x00, 0x0E, 0x88 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x2000000,
|
||||
"sector_size":[
|
||||
[0x20000, 255],
|
||||
[0x08000, 4]
|
||||
],
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xFF ],
|
||||
[ 0x100000, 0xFF ],
|
||||
[ 0x200000, 0xFF ],
|
||||
[ 0x300000, 0xFF ],
|
||||
[ 0x400000, 0xFF ],
|
||||
[ 0x500000, 0xFF ],
|
||||
[ 0x600000, 0xFF ],
|
||||
[ 0x700000, 0xFF ],
|
||||
[ 0x800000, 0xFF ],
|
||||
[ 0x900000, 0xFF ],
|
||||
[ 0xA00000, 0xFF ],
|
||||
[ 0xB00000, 0xFF ],
|
||||
[ 0xC00000, 0xFF ],
|
||||
[ 0xD00000, 0xFF ],
|
||||
[ 0xE00000, 0xFF ],
|
||||
[ 0xF00000, 0xFF ],
|
||||
[ 0x1000000, 0xFF ],
|
||||
[ 0x1100000, 0xFF ],
|
||||
[ 0x1200000, 0xFF ],
|
||||
[ 0x1300000, 0xFF ],
|
||||
[ 0x1400000, 0xFF ],
|
||||
[ 0x1500000, 0xFF ],
|
||||
[ 0x1600000, 0xFF ],
|
||||
[ 0x1700000, 0xFF ],
|
||||
[ 0x1800000, 0xFF ],
|
||||
[ 0x1900000, 0xFF ],
|
||||
[ 0x1A00000, 0xFF ],
|
||||
[ 0x1B00000, 0xFF ],
|
||||
[ 0x1C00000, 0xFF ],
|
||||
[ 0x1D00000, 0xFF ],
|
||||
[ 0x1E00000, 0xFF ],
|
||||
[ 0x1F00000, 0xFF ]
|
||||
],
|
||||
"read_identifier":[
|
||||
[ 0, 0x90 ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ "SA", 0x60 ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0x20 ],
|
||||
[ "SA", 0xD0 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ]
|
||||
],
|
||||
"buffer_write":[
|
||||
[ "SA", 0x60 ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0xE8 ],
|
||||
[ "SA", "BS" ],
|
||||
[ "PA", "PD" ],
|
||||
[ "SA", 0xD0 ],
|
||||
[ "SA", 0xFF ]
|
||||
],
|
||||
"buffer_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0x80, 0xFFFF ],
|
||||
[ null, null, null ]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
"voltage":3.3,
|
||||
"flash_size":0x1000000,
|
||||
"sector_size":0x10000,
|
||||
"chip_erase_timeout":75,
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xF0 ]
|
||||
@@ -19,22 +18,6 @@
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x90 ]
|
||||
],
|
||||
"chip_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x10 ]
|
||||
],
|
||||
"chip_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFFFF, 0xFFFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
@@ -51,10 +34,26 @@
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFFFF, 0xFFFF ]
|
||||
],
|
||||
"buffer_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x26 ],
|
||||
[ "SA", "BS" ],
|
||||
[ "PA", "PD" ],
|
||||
[ "SA", 0x2A ]
|
||||
],
|
||||
"buffer_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", "PD", 0xFFFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0x555, 0xA9 ],
|
||||
[ 0x2AA, 0x56 ],
|
||||
[ 0x555, 0xA0 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0xA0 ],
|
||||
[ "PA", "PD" ]
|
||||
],
|
||||
"single_write_wait_for":[
|
||||
|
||||
@@ -2,11 +2,19 @@
|
||||
"type":"AGB",
|
||||
"names":[
|
||||
"AGB-E05-01 with MSP55LV128M",
|
||||
"BX2006_0106_NEW with S29GL128N10TFI01"
|
||||
"AGB-E05-01 with GL128S",
|
||||
"BX2006_0106_NEW with S29GL128N10TFI01",
|
||||
"BX2006_TSOP_64BALL with GL128S",
|
||||
"BX2006_TSOPBGA_0106 with M29W640GB6AZA6",
|
||||
"AGB-E05-02 with M29W128GH"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x02, 0x00, 0x7D, 0x22 ],
|
||||
[ 0x02, 0x00, 0x7D, 0x22 ]
|
||||
[ 0x02, 0x00, 0x7D, 0x22 ],
|
||||
[ 0x02, 0x00, 0x7D, 0x22 ],
|
||||
[ 0x02, 0x00, 0x7D, 0x22 ],
|
||||
[ 0x20, 0x00, 0x7D, 0x22 ],
|
||||
[ 0x20, 0x00, 0x7D, 0x22 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x1000000,
|
||||
@@ -21,22 +29,6 @@
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x90 ]
|
||||
],
|
||||
"chip_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x10 ]
|
||||
],
|
||||
"chip_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFFFF, 0xFFFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
@@ -53,10 +45,26 @@
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFFFF, 0xFFFF ]
|
||||
],
|
||||
"buffer_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x26 ],
|
||||
[ "SA", "BS" ],
|
||||
[ "PA", "PD" ],
|
||||
[ "SA", 0x2A ]
|
||||
],
|
||||
"buffer_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", "PD", 0xFFFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0x555, 0xA9 ],
|
||||
[ 0x2AA, 0x56 ],
|
||||
[ 0x555, 0xA0 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0xA0 ],
|
||||
[ "PA", "PD" ]
|
||||
],
|
||||
"single_write_wait_for":[
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
"wait_read_status_register":true,
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xFF ]
|
||||
[ 0, 0xFF ],
|
||||
[ 0x400000, 0xFF ],
|
||||
[ 0x800000, 0xFF ],
|
||||
[ 0xC00000, 0xFF ]
|
||||
],
|
||||
"read_status_register":[
|
||||
[ 0, 0x70 ]
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_48BALL_64M_V3 with 29DL161TD-90",
|
||||
"SD007_48BALL_64M_V5 with 29DL163BD-90",
|
||||
"SD007_48BALL_64M_V6 with 29DL163BD-90"
|
||||
"SD007_48BALL_64M_V3 with 29DL161TD-90"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x04, 0x04, 0x35, 0x35 ],
|
||||
[ 0x04, 0x04, 0x2B, 0x2B ],
|
||||
[ 0x04, 0x04, 0x2B, 0x2B ]
|
||||
[ 0x04, 0x04, 0x35, 0x35 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x200000,
|
||||
"start_addr":0,
|
||||
"first_bank":1,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x10000, 31],
|
||||
[0x2000, 8]
|
||||
],
|
||||
"chip_erase_timeout":120,
|
||||
"commands":{
|
||||
"reset":[
|
||||
@@ -41,6 +41,22 @@
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
|
||||
75
FlashGBX/config/fc_DMG_29DL163BD-90.txt
Normal file
75
FlashGBX/config/fc_DMG_29DL163BD-90.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_48BALL_64M_V5 with 29DL163BD-90",
|
||||
"SD007_48BALL_64M_V6 with 29DL163BD-90"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x04, 0x04, 0x2B, 0x2B ],
|
||||
[ 0x04, 0x04, 0x2B, 0x2B ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x200000,
|
||||
"start_addr":0,
|
||||
"first_bank":1,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x2000, 8],
|
||||
[0x10000, 31]
|
||||
],
|
||||
"chip_erase_timeout":120,
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0, 0xF0 ]
|
||||
],
|
||||
"read_identifier":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x90 ]
|
||||
],
|
||||
"chip_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x10 ]
|
||||
],
|
||||
"chip_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0xA0 ],
|
||||
[ "PA", "PD" ]
|
||||
],
|
||||
"single_write_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ]
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,11 @@
|
||||
"start_addr":0,
|
||||
"first_bank":1,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x2000, 8],
|
||||
[0x10000, 31]
|
||||
],
|
||||
"sector_reversal":true,
|
||||
"chip_erase_timeout":50,
|
||||
"commands":{
|
||||
"reset":[
|
||||
@@ -37,6 +42,22 @@
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_48BALL_64M_V5 with 36VF3204"
|
||||
"SD007_48BALL_64M_V5 with 36VF3204",
|
||||
"SD007_48BALL_64M_V6 with 36VF3204",
|
||||
"SD007_TSOP_48BALL with 36VF3204",
|
||||
"SD007_48BALL_64M_V5 with 36VF3203"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0xBF, 0x00, 0x53, 0x73 ]
|
||||
[ 0xBF, 0x00, 0x53, 0x73 ],
|
||||
[ 0xBF, 0x00, 0x53, 0x73 ],
|
||||
[ 0xBF, 0x00, 0x53, 0x73 ],
|
||||
[ 0xBF, 0x00, 0x54, 0x73 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"voltage_variants":true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"AM29F016/AM29F016B (DIY cart) @ AUDIO"
|
||||
"DIY cart with AM29F016/AM29F016B @ AUDIO"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x01, 0xAD, 0x00, 0x00 ]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"AM29F016/AM29F016B (DIY cart) @ WR"
|
||||
"DIY cart with AM29F016/AM29F016B @ WR"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x01, 0xAD, 0x00, 0x00 ]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"AM29F032/AM29F032B (DIY cart) @ AUDIO"
|
||||
"DIY cart with AM29F032/AM29F032B @ AUDIO"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x04, 0xD4, 0x00, 0x00 ]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"AM29F032/AM29F032B (DIY cart) @ WR"
|
||||
"DIY cart with AM29F032/AM29F032B @ WR"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x04, 0xD4, 0x00, 0x00 ]
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_BV5_V3 with AM29LV160MB"
|
||||
"SD007_BV5_V3 with AM29LV160MB",
|
||||
"SD007_TSOP_48BALL with L160DB12VI",
|
||||
"SD007_TSOP_48BALL with AM29LV160DT"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x02, 0x02, 0x4A, 0x4A ]
|
||||
[ 0x02, 0x02, 0x4A, 0x4A ],
|
||||
[ 0x02, 0x02, 0x4A, 0x4A ],
|
||||
[ 0x02, 0x02, 0xC4, 0xC4 ]
|
||||
],
|
||||
"voltage":5,
|
||||
"flash_size":0x200000,
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_48BALL_64M with GL032M11BAIR4",
|
||||
"S29GL032 (no PCB text)"
|
||||
"SD007_48BALL_64M_V2 with GL032M11BAIR4",
|
||||
"S29GL032N90T and ALTERA CPLD (no PCB text)"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0x02, 0x02, 0x7D, 0x7D ],
|
||||
[ 0x02, 0x02, 0x7D, 0x7D ],
|
||||
[ 0x02, 0x02, 0x7D, 0x7D ]
|
||||
],
|
||||
@@ -13,23 +15,27 @@
|
||||
"start_addr":0x4000,
|
||||
"first_bank":0,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x2000, 8],
|
||||
[0x10000, 63]
|
||||
],
|
||||
"chip_erase_timeout":60,
|
||||
"commands":{
|
||||
"reset":[
|
||||
[ 0x7000, 0xF0 ]
|
||||
[ 0x4000, 0xF0 ]
|
||||
],
|
||||
"read_identifier":[
|
||||
[ 0x7AAA, 0xA9 ],
|
||||
[ 0x7555, 0x56 ],
|
||||
[ 0x7AAA, 0x90 ]
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ 0x4AAA, 0x90 ]
|
||||
],
|
||||
"chip_erase":[
|
||||
[ 0x7AAA, 0xA9 ],
|
||||
[ 0x7555, 0x56 ],
|
||||
[ 0x7AAA, 0x80 ],
|
||||
[ 0x7AAA, 0xA9 ],
|
||||
[ 0x7555, 0x56 ],
|
||||
[ 0x7AAA, 0x10 ]
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ 0x4AAA, 0x80 ],
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ 0x4AAA, 0x10 ]
|
||||
],
|
||||
"chip_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
@@ -39,10 +45,26 @@
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ 0x4AAA, 0x80 ],
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0x7AAA, 0xA9 ],
|
||||
[ 0x7555, 0x56 ],
|
||||
[ 0x7AAA, 0xA0 ],
|
||||
[ 0x4AAA, 0xA9 ],
|
||||
[ 0x4555, 0x56 ],
|
||||
[ 0x4AAA, 0xA0 ],
|
||||
[ "PA", "PD" ]
|
||||
],
|
||||
"single_write_wait_for":[
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"SD007_BV5_V2 with HY29LV160TT"
|
||||
"SD007_BV5_V2 with HY29LV160TT",
|
||||
"SD007_BV5_V3 with HY29LV160BT",
|
||||
"SD007_BV5_V3 with 29LV160BE-90PFTN",
|
||||
"SD007_TSOP_48BALL with M29W160ET70ZA6"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0xAE, 0xAE, 0xC4, 0xC4 ]
|
||||
[ 0xAE, 0xAE, 0xC4, 0xC4 ],
|
||||
[ 0xAE, 0xAE, 0x4A, 0x4A ],
|
||||
[ 0x04, 0x04, 0x4A, 0x4A ],
|
||||
[ 0x20, 0x20, 0xC4, 0xC4 ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x200000,
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
"start_addr":0,
|
||||
"first_bank":1,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x4000, 1],
|
||||
[0x2000, 2],
|
||||
[0x8000, 1],
|
||||
[0x10000, 31]
|
||||
],
|
||||
"chip_erase_timeout":30,
|
||||
"commands":{
|
||||
"reset":[
|
||||
@@ -37,6 +43,22 @@
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xAA ],
|
||||
[ 0x555, 0x55 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xAA ],
|
||||
[ 0x555, 0x55 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xAA ],
|
||||
[ 0x555, 0x55 ],
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
"start_addr":0,
|
||||
"first_bank":1,
|
||||
"write_pin":"WR",
|
||||
"sector_size":[
|
||||
[0x02000, 8],
|
||||
[0x10000, 127]
|
||||
],
|
||||
"chip_erase_timeout":70,
|
||||
"commands":{
|
||||
"reset":[
|
||||
@@ -37,6 +41,22 @@
|
||||
[ null, null, null ],
|
||||
[ 0, 0xFF, 0xFF ]
|
||||
],
|
||||
"sector_erase":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ 0xAAA, 0x80 ],
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
[ "SA", 0x30 ]
|
||||
],
|
||||
"sector_erase_wait_for":[
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ null, null, null ],
|
||||
[ "SA", 0xFF, 0xFF ]
|
||||
],
|
||||
"single_write":[
|
||||
[ 0xAAA, 0xA9 ],
|
||||
[ 0x555, 0x56 ],
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"type":"DMG",
|
||||
"names":[
|
||||
"GB-M968 with MX29LV320ABTC"
|
||||
"GB-M968 with MX29LV320ABTC",
|
||||
"SD007_BV5_DRV with M29W320DT"
|
||||
],
|
||||
"flash_ids":[
|
||||
[ 0xC2, 0xC2, 0xA8, 0xA8 ]
|
||||
[ 0xC2, 0xC2, 0xA8, 0xA8 ],
|
||||
[ 0x20, 0x20, 0xCA, 0xCA ]
|
||||
],
|
||||
"voltage":3.3,
|
||||
"flash_size":0x400000,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
101
README.md
101
README.md
@@ -15,12 +15,12 @@ by Lesserkuma
|
||||
- Backup, restore and erase save data from Game Boy and Game Boy Advance game cartridges
|
||||
- Backup ROM data from Game Boy and Game Boy Advance game cartridges
|
||||
- Write new ROMs to a wide variety of Game Boy and Game Boy Advance flash cartridges
|
||||
- Many flash cartridges can be auto-detected
|
||||
- A Flash ID check can be performed for unsupported flash cartridges
|
||||
- Many reproduction cartridges and flash cartridges can be auto-detected
|
||||
- A flash chip query can be performed for unsupported flash cartridges
|
||||
|
||||
### Confirmed working reader/writer hardware
|
||||
|
||||
- [insideGadgets GBxCart RW v1.3 and v1.3 Pro](https://www.gbxcart.com/) with firmware versions from R17 up to R19 (other hardware revisions and firmware versions may also work, but are untested)
|
||||
- [insideGadgets GBxCart RW v1.3 and v1.3 Pro](https://www.gbxcart.com/) with firmware versions from R19 up to R23 (other hardware revisions and firmware versions may also work, but are untested)
|
||||
|
||||
### Currently supported flash cartridges
|
||||
|
||||
@@ -38,44 +38,63 @@ by Lesserkuma
|
||||
|
||||
- Game Boy Advance
|
||||
|
||||
- Flash2Advance 256M (non-ultra variant)
|
||||
- Flash2Advance 256M (non-ultra variant, with 2× 28F128J3A150)
|
||||
- Nintendo AGB Cartridge 128M Flash S, E201850
|
||||
- Nintendo AGB Cartridge 256M Flash S, E201868
|
||||
|
||||
### Currently supported bootleg cartridges
|
||||
### Currently supported and tested reproduction cartridges
|
||||
|
||||
- Game Boy
|
||||
|
||||
- ES29LV160_DRV with 29DL32TF-70
|
||||
- GB-M968 with M29W160EB *(thanks RevZ)*
|
||||
- GB-M968 with MX29LV320ABTC
|
||||
- S29GL032 (no PCB text)
|
||||
- ALTERA CPLD and S29GL032N90T (no PCB text)
|
||||
- SD007_48BALL_64M with GL032M11BAIR4 *(thanks RevZ)*
|
||||
- SD007_48BALL_64M with M29W640
|
||||
- SD007_48BALL_64M_V2 with GL032M11BAIR4
|
||||
- SD007_48BALL_64M_V3 with 29DL161TD-90
|
||||
- SD007_48BALL_64M_V5 with 36VF3203
|
||||
- SD007_48BALL_64M_V5 with 36VF3204
|
||||
- SD007_48BALL_64M_V6 with 36VF3204
|
||||
- SD007_48BALL_64M_V6 with 29DL163BD-90 *(thanks LovelyA72)*
|
||||
- SD007_BV5_DRV with M29W320DT *(thanks Frost Clock)*
|
||||
- SD007_BV5_V3 with 29LV160BE-90PFTN *(thanks LucentW)*
|
||||
- SD007_BV5_V3 with HY29LV160BT-70 *(thanks LucentW)*
|
||||
- SD007_BV5_V2 with HY29LV160TT *(thanks RevZ)*
|
||||
- SD007_BV5_V2 with MX29LV320BTC *(thanks RevZ)*
|
||||
- SD007_BV5_V3 with AM29LV160MB *(thanks RevZ)*
|
||||
- SD007_TSOP_48BALL with 36VF3204
|
||||
- SD007_TSOP_48BALL with AM29LV160DT *(thanks marv17)*
|
||||
- SD007_TSOP_48BALL with L160DB12VI *(thanks marv17)*
|
||||
|
||||
- Game Boy Advance
|
||||
|
||||
- 28F256L03B-DRV with 256L30B
|
||||
- 4455_4400_4000_4350_36L0R_V3 with M36L0R705
|
||||
- 36L0R8-39VF512 with M36L0R8060B *(thanks LucentW)*
|
||||
- 36L0R8-39VF512 with M36L0R8060T *(thanks AndehX)*
|
||||
- 4050_4400_4000_4350_36L0R_V5 with M36L0R7050T
|
||||
- 4050_4400_4000_4350_36L0R_V5 with M36L0T8060T
|
||||
- 4050_4400_4000_4350_36L0R_V5 with M36L0R8060T
|
||||
- 4455_4400_4000_4350_36L0R_V3 with M36L0R7050T
|
||||
- AGB-E05-01 with GL128S
|
||||
- AGB-E05-01 with MSP55LV128M
|
||||
- AGB-E05-02 with M29W128GH *(thanks marv17)*
|
||||
- AGB-E08-09 with 29LV128DTMC-90Q *(thanks LucentW)*
|
||||
- AGB-SD-E05 with MSP55LV128 *(thanks RevZ)*
|
||||
- BX2006_0106_NEW with S29GL128N10TFI01 *(thanks litlemoran)*
|
||||
- BX2006_TSOP_64BALL with GL128S
|
||||
- BX2006_TSOPBGA_0106 with M29W640GB6AZA6
|
||||
|
||||
Many different bootleg cartridges share their flash chip command set, so even if yours is not on this list, it may still work fine or even be detected as another one. Support for more cartridges can also be added by creating external config files that include the necessary flash chip commands.
|
||||
Many different reproduction cartridges share their flash chip command set, so even if yours is not on this list, it may still work fine or even be auto-detected as another one. Support for more cartridges can also be added by creating external config files that include the necessary flash chip commands.
|
||||
|
||||
## Installing and running
|
||||
|
||||
The application should work on pretty much every operating system that supports Qt-GUI applications built using [Python 3](https://www.python.org/downloads/) with [PySide2](https://pypi.org/project/PySide2/) and [pyserial](https://pypi.org/project/pyserial/) packages.
|
||||
|
||||
If you have Python and pip installed, you can use `pip install FlashGBX` to download and install the application.
|
||||
If you have Python and pip installed, you can use `pip install FlashGBX` to download and install the application. Then use `python -m FlashGBX` to run it.
|
||||
|
||||
To run it in portable mode, you can also download the source code archive and call `python run.py` after installing the prerequisites yourself.
|
||||
To run FlashGBX in portable mode, you can also download the source code archive and call `python run.py` after installing the prerequisites yourself.
|
||||
|
||||
### Windows binaries
|
||||
|
||||
@@ -88,12 +107,16 @@ These executables have been created using *PyInstaller* and *Inno Setup*.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
* If something doesn’t work as expected during data transfer, first try to clean the game cartridge contacts, wiggle the cartridge a bit and reconnect the USB device.
|
||||
* If something doesn’t work as expected, first try to clean the game cartridge contacts (best with IPA 99%+ on a Q-tip) and reconnect the device.
|
||||
|
||||
* On Linux systems, you may run into a *Permission Error* problem when trying to connect to USB devices without *sudo* privileges. To grant yourself the necessary permissions temporarily, you can run `sudo chmod 0666 /dev/ttyUSB0` (replace with actual device path) before running the app. For a permanent solution, add yourself to the usergroup that has access to serial devices by default (e.g. *dialout* on Debian-based distros; `sudo adduser $USER dialout`) and then reboot the system.
|
||||
|
||||
* On some Linux systems, you may need the *XCB Xinerama package* if you see an error regarding failed Qt platform plugin initialization. You can install it with `sudo apt install libxcb-xinerama0` etc.
|
||||
|
||||
* For save data backup/restore on Game Boy Advance reproduction cartridges, depending on how it was built, you may have to manually select the save type for it to work properly.
|
||||
|
||||
* The save data backup/restore feature may not work on certain reproduction cartridges with batteryless-patched ROMs. As those cartridges use the same flash chip for both ROM and save data storage, a full ROM backup will usually include the save data. Also, when flashing a new unpatched ROM to a cartridge like this, the game may not be able to save progress without soldering in a battery.
|
||||
|
||||
## DISCLAIMER
|
||||
|
||||
This software is provided as-is and the developer is not responsible for any damage that is caused by the use of it. Use at your own risk!
|
||||
@@ -103,16 +126,20 @@ This software is provided as-is and the developer is not responsible for any dam
|
||||
The author would like to thank the following very kind people for their help and contributions (in alphabetical order):
|
||||
|
||||
- AlexiG (GBxCart RW hardware, bug reports, flash chip info)
|
||||
- AndehX (app icon)
|
||||
- AndehX (app icon, flash chip info)
|
||||
- easthighNerd (feature suggestions)
|
||||
- Frost Clock (flash chip info)
|
||||
- JFox (help with properly packaging the app for pip)
|
||||
- julgr (macOS help, testing)
|
||||
- litlemoran (flash chip info)
|
||||
- LovelyA72 (flash chip info)
|
||||
- LucentW (flash chip info, testing)
|
||||
- marv17 (flash chip info, testing)
|
||||
- RevZ (Linux help, testing, bug reports, flash chip info)
|
||||
|
||||
## Changes
|
||||
|
||||
### v0.7β (2020-09-25)
|
||||
### v0.7β (released 2020-09-25)
|
||||
|
||||
- First started tracking changes
|
||||
- Added a way to launch the flash cartridge type auto-detection process from the type list
|
||||
@@ -121,24 +148,24 @@ The author would like to thank the following very kind people for their help and
|
||||
- Fixed config file for 4455_4400_4000_4350_36L0R_V3 with M36L0R705 (sector size map was incomplete)
|
||||
- Renamed some labels of flash cartridge types
|
||||
- Made config files UTF-8 compatible
|
||||
- File open and save dialogs will now remember the last used directory for ROM files and save data files respectively (stored in config.ini in AppData/Roaming), clearable with the `--reset` switch or by editing/deleting config.ini
|
||||
- File open and save dialogs will now remember the last used directory for ROM files and save data files respectively (stored in settings.ini in AppData/Roaming), clearable with the `--reset` switch or by editing/deleting settings.ini
|
||||
- Added CRC32 checksum comparison for Game Boy Advance games by using a database based on header SHA1 hashes
|
||||
- Fixed a bug with save data restore and improved save data backup speed
|
||||
- Fixed a few status message errors
|
||||
- Added a warning when changing platforms
|
||||
- Made some messages suppressible (stored in config.ini)
|
||||
- Made some messages suppressible (stored in settings.ini)
|
||||
- Added detection of ungraceful device disconnects when starting a new task, with optional automatic reconnect
|
||||
- First public beta release
|
||||
|
||||
### v0.8β (2020-10-03)
|
||||
### v0.8β (released 2020-10-03)
|
||||
|
||||
- Added support for the DIY cart with AM29F016/AM29F016B with AUDIO as WE *(thanks AndehX)*
|
||||
- Renamed `VIN` to `AUDIO` in config files and the command line switch `--resetconfig` to `--reset`
|
||||
- Added experimental support for GBxCart RW revisions other than v1.3 and fixed a crash when connecting to unknown revisions of the GBxCart RW
|
||||
- The app is now available as a package and can be installed directly through *pip* *(thanks JFox)*
|
||||
- Changed the way configuration files are stored (for details call with `--help` command line switch)
|
||||
- Added the option to write an automatically trimmed ROM file which can reduce flashing time, especially in Game Boy Advance mode (note that not all ROMs can be trimmed)
|
||||
- When dumping a flash cartridge that has been flashed with a trimmed ROM, the ROM will be fixed so checksums will still match up (can be disabled for debugging by adding `_notrimfix` to the file name)
|
||||
- ~~Added the option to write an automatically trimmed ROM file which can reduce flashing time, especially in Game Boy Advance mode (note that not all ROMs can be trimmed)~~
|
||||
- ~~When dumping a flash cartridge that has been flashed with a trimmed ROM, the ROM will be fixed so checksums will still match up (can be disabled for debugging by adding `_notrimfix` to the file name)~~
|
||||
- Added a button that opens a file browser to the currently used config directory for easy access
|
||||
- Added the option to erase/wipe the save data on a cartridge
|
||||
- Rearranged some buttons on the main window so that the newly added button popup menus don’t block anything
|
||||
@@ -146,9 +173,45 @@ The author would like to thank the following very kind people for their help and
|
||||
- Rewrote some of the save data handling for Game Boy Advance cartridges to speed transfers up a bit
|
||||
- Fixed a couple of instability issues that used to caused timeouts on macOS *(thanks julgr)*
|
||||
- Confirmed support for SD007_48BALL_64M_V5 with 29DL163BD-90 *(thanks julgr)*
|
||||
- Added an option for flashing at 5V for a few flash cartridge types that sometimes require this; if you think your cartridge is affected, you can add `"voltage_variants":true,` to the config file
|
||||
- Added an option for flashing at 5V for a few flash cartridge types that sometimes require this; if you think your cartridge is affected, you can add `"voltage_variants":true,` to the config file for it
|
||||
- Fixed support for Windows 7 when using pre-compiled exe file packages
|
||||
- Reduced size and decompression time of the pre-compiled exe file packages by excluding unnecessary DLL files
|
||||
- Fixed a timing issue that could sometimes cause a loss of save data when hot-swapping Game Boy cartridges
|
||||
- Added some warnings that help with troubleshooting, for example that manually setting the feature box to a MBC5 option may be necessary for a clean dump when dumping ROMs from flash cartridges
|
||||
- Added taskbar progress visualization on Windows systems
|
||||
|
||||
### v0.9β (released 2020-12-17)
|
||||
|
||||
- Confirmed support for BX2006_TSOP_64BALL with GL128S
|
||||
- Confirmed support for SD007_48BALL_64M_V2 with GL032M11BAIR4
|
||||
- Added support for 4050_4400_4000_4350_36L0R_V5 with M36L0R8060T/M36L0T8060T
|
||||
- Rewrote parts of the GBxCart RW interface code
|
||||
- Removed the option to trim ROM files and will now instead just skip writing empty chunks of data
|
||||
- Fixed config files for MSP55LV128 and MSP55LV128M flash chips
|
||||
- Confirmed support for SD007_48BALL_64M_V6 with 36VF3204
|
||||
- Confirmed support for SD007_TSOP_48BALL with 36VF3204
|
||||
- Added the option to add date and time to suggested filenames for save data backups *(thanks easthighNerd)*
|
||||
- Added a check and warning for unstable ROM readings
|
||||
- Added Common Flash Interface query for both unknown and known flash cartridge types
|
||||
- Added support for 36L0R8-39VF512 with M36L0R8060B *(thanks LucentW)*
|
||||
- Added support for another version of 36L0R8-39VF512 with M36L0R8060B/M36L0R8060T *(thanks AndehX)*
|
||||
- Added support for AGB-E05-02 with M29W128GH *(thanks marv17)*
|
||||
- Added backup and restore of 1M SRAM save data in GBA mode
|
||||
- Confirmed support for BX2006_TSOPBGA_0106 with M29W640GB6AZA6 *(thanks LucentW)*
|
||||
- Confirmed support for AGB-E05-01 with GL128S
|
||||
- Improved writing speed for MSP55LV128M, S29GL128 and similar flash chips (requires GBxCart RW firmware R23 or higher)
|
||||
- Before flashing a ROM it will now be checked if its logo data and header checksum are valid and a warning will be shown if not
|
||||
- Added support for SD007_BV5_V3 with 29LV160BE-90PFTN *(thanks LucentW)*
|
||||
- Added support for SD007_BV5_V3 with HY29LV160BT *(thanks LucentW)*
|
||||
- Added support for SD007_48BALL_64M_V5 with 36VF3203 *(thanks LucentW)*
|
||||
- Added support for SD007_TSOP_48BALL with M29W160ET70ZA6 *(thanks LucentW)*
|
||||
- Added support for AGB-E08-09 with 29LV128DTMC-90Q *(thanks LucentW)*
|
||||
- Confirmed support for SD007_TSOP_48BALL with L160DB12VI *(thanks marv17)*
|
||||
- Added support for SD007_TSOP_48BALL with AM29LV160DT *(thanks marv17)*
|
||||
- Added support for SD007_BV5_DRV with M29W320DT *(thanks Frost Clock)*
|
||||
- Added experimental *fast read mode* support for GBxCart RW v1.3 with firmware R19+ (about 20% faster)
|
||||
- Bumped the required minimum firmware version of GBxCart RW v1.3 to R19
|
||||
- Confirmed support for 4050_4400_4000_4350_36L0R_V5 with M36L0R7050T
|
||||
- Added the option to enable the preference of sector erase over chip erase when flashing a ROM (this can improve flashing speed for ROMs smaller than the flash chip capacity)
|
||||
- Some flash chips may have reversed sectors despite shared flash ID; if you think your cartridge is affected, you can add `"sector_reversal":true,` to its config file for a prompt upon flashing
|
||||
- Renamed config.ini to settings.ini to avoid confusion with the term “config file”
|
||||
|
||||
2
run.py
2
run.py
@@ -1,4 +1,4 @@
|
||||
# Note: This file runs FlashGBX in portable mode and is also used to build the portable Windows archive.
|
||||
# Note: This file runs FlashGBX in portable mode.
|
||||
|
||||
from FlashGBX import FlashGBX
|
||||
FlashGBX.main(portableMode=True)
|
||||
|
||||
2
setup.py
2
setup.py
@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read(
|
||||
|
||||
setuptools.setup(
|
||||
name="FlashGBX",
|
||||
version="0.8b0",
|
||||
version="0.9b0",
|
||||
author="Lesserkuma",
|
||||
description="A GUI application that can read and write Game Boy and Game Boy Advance cartridge data. Currently supports the GBxCart RW hardware device by insideGadgets.",
|
||||
url="https://github.com/lesserkuma/FlashGBX",
|
||||
|
||||
Reference in New Issue
Block a user