FlashGBX 4.1__py3-none-any.whl → 4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
FlashGBX/DataTransfer.py CHANGED
@@ -5,7 +5,6 @@
5
5
  import traceback
6
6
  from serial import SerialException
7
7
  from . import pyside as PySide2
8
- from . import Util
9
8
  from .Util import dprint
10
9
 
11
10
  class DataTransfer(PySide2.QtCore.QThread):
@@ -54,5 +53,5 @@ class DataTransfer(PySide2.QtCore.QThread):
54
53
  if error is not None:
55
54
  print(tb)
56
55
  dprint(tb)
57
- self.updateProgress.emit({"action":"ABORT", "info_type":"msgbox_critical", "fatal":True, "info_msg":"An unresolvable error has occured. See console output for more information. Reconnect the device, restart the software and try again.\n\n{:s}: {:s}".format(type(error).__name__, str(error)), "abortable":False})
56
+ self.updateProgress.emit({"action":"ABORT", "info_type":"msgbox_critical", "fatal":True, "info_msg":"An unresolvable error has occured. See the debug log file for more information. Reconnect the device, restart the software and try again.\n\n{:s}: {:s}".format(type(error).__name__, str(error)), "abortable":False})
58
57
  self.FINISHED = True
FlashGBX/FlashGBX.py CHANGED
@@ -133,7 +133,7 @@ def main(portableMode=False):
133
133
  ap_cli1.add_argument("path", nargs="?", default="auto", help="target or source file path (optional when reading, required when writing)")
134
134
 
135
135
  ap_cli2 = parser.add_argument_group('optional command line interface arguments')
136
- ap_cli2.add_argument("--dmg-romsize", choices=["auto", "32kb", "64kb", "128kb", "256kb", "512kb", "1mb", "2mb", "4mb", "8mb", "16mb", "32mb"], type=str.lower, default="auto", help="set size of Game Boy cartridge ROM data")
136
+ ap_cli2.add_argument("--dmg-romsize", choices=["auto", "32kb", "64kb", "128kb", "256kb", "512kb", "1mb", "2mb", "4mb", "8mb", "16mb", "32mb", "64mb", "128mb"], type=str.lower, default="auto", help="set size of Game Boy cartridge ROM data")
137
137
  ap_cli2.add_argument("--dmg-mbc", type=str.lower, default="auto", help="set memory bank controller type of Game Boy cartridge")
138
138
  ap_cli2.add_argument("--dmg-savesize", choices=["auto", "4k", "16k", "64k", "256k", "512k", "1m", "eeprom2k", "eeprom4k", "tama5", "4m"], type=str.lower, default="auto", help="set size of Game Boy cartridge save data")
139
139
  ap_cli2.add_argument("--agb-romsize", choices=["auto", "32kb", "64kb", "128kb", "256kb", "512kb", "1mb", "2mb", "4mb", "8mb", "16mb", "32mb", "64mb", "128mb", "256mb", "512mb"], type=str.lower, default="auto", help="set size of Game Boy Advance cartridge ROM data")
FlashGBX/FlashGBX_CLI.py CHANGED
@@ -624,7 +624,8 @@ class FlashGBX_CLI():
624
624
 
625
625
  header = self.CONN.ReadInfo()
626
626
  self.ReadCartridge(header)
627
- ret = self.CONN.DetectCartridge(limitVoltage=limitVoltage, checkSaveType=True)
627
+ self.CONN._DetectCartridge(args={"limitVoltage":limitVoltage, "checkSaveType":True})
628
+ ret = self.CONN.INFO["detect_cart"]
628
629
  (header, _, save_type, save_chip, sram_unstable, cart_types, cart_type_id, cfi_s, _, flash_id, detected_size) = ret
629
630
 
630
631
  # Save Type
@@ -638,6 +639,8 @@ class FlashGBX_CLI():
638
639
  supp_cart_types = self.CONN.GetSupportedCartridgesDMG()
639
640
  elif self.CONN.GetMode() == "AGB":
640
641
  supp_cart_types = self.CONN.GetSupportedCartridgesAGB()
642
+ else:
643
+ raise NotImplementedError
641
644
 
642
645
  if len(cart_types) > 0:
643
646
  cart_type = cart_type_id
@@ -654,6 +657,7 @@ class FlashGBX_CLI():
654
657
 
655
658
  # Save Type
656
659
  msg_save_type_s = ""
660
+ temp = ""
657
661
  if save_chip is not None:
658
662
  temp = "{:s} ({:s})".format(Util.AGB_Header_Save_Types[save_type], save_chip)
659
663
  else:
@@ -695,6 +699,7 @@ class FlashGBX_CLI():
695
699
  else:
696
700
  if (len(flash_id.split("\n")) > 2) and ((self.CONN.GetMode() == "DMG") or ("dacs_8m" in header and header["dacs_8m"] is not True)):
697
701
  msg_cart_type_s = "Cartridge Type: Unknown flash cartridge."
702
+ try_this = ""
698
703
  if ("[ 0/90]" in flash_id):
699
704
  try_this = "Generic Flash Cartridge (0/90)"
700
705
  elif ("[ AAA/AA]" in flash_id):
@@ -767,7 +772,7 @@ class FlashGBX_CLI():
767
772
  print("{:s}Couldn’t determine ROM size, will use 8 MiB. It can also be manually set with the “--dmg-romsize” command line switch.{:s}".format(ANSI.YELLOW, ANSI.RESET))
768
773
  rom_size = 8 * 1024 * 1024
769
774
  else:
770
- sizes = [ "auto", "32kb", "64kb", "128kb", "256kb", "512kb", "1mb", "2mb", "4mb", "8mb", "16mb", "32mb" ]
775
+ sizes = [ "auto", "32kb", "64kb", "128kb", "256kb", "512kb", "1mb", "2mb", "4mb", "8mb", "16mb", "32mb", "64mb", "128mb" ]
771
776
  rom_size = Util.DMG_Header_ROM_Sizes_Flasher_Map[sizes.index(args.dmg_romsize) - 1]
772
777
 
773
778
  elif self.CONN.GetMode() == "AGB":
@@ -820,6 +825,9 @@ class FlashGBX_CLI():
820
825
  carts = self.CONN.GetSupportedCartridgesDMG()[1]
821
826
  elif self.CONN.GetMode() == "AGB":
822
827
  carts = self.CONN.GetSupportedCartridgesAGB()[1]
828
+ else:
829
+ raise NotImplementedError
830
+
823
831
  cart_type = 0
824
832
  for i in range(0, len(carts)):
825
833
  if not "names" in carts[i]: continue
@@ -978,6 +986,9 @@ class FlashGBX_CLI():
978
986
  s_mbc = " using Mapper Type 0x{:X}".format(mbc)
979
987
  elif self.CONN.GetMode() == "AGB":
980
988
  hdr = RomFileAGB(buffer).GetHeader()
989
+ else:
990
+ raise NotImplementedError
991
+
981
992
  if not hdr["logo_correct"] and (self.CONN.GetMode() == "AGB" or (self.CONN.GetMode() == "DMG" and mbc not in (0x203, 0x205))):
982
993
  print("{:s}Warning: The ROM file you selected will not boot on actual hardware due to invalid boot logo data.{:s}".format(ANSI.YELLOW, ANSI.RESET))
983
994
  bootlogo = None
@@ -1249,14 +1260,6 @@ class FlashGBX_CLI():
1249
1260
  print("\n{:s}Done! The writable save data size is {:s} out of {:s} checked.{:s}".format(ANSI.GREEN, Util.formatFileSize(size=found_length), Util.formatFileSize(size=Util.DMG_Header_RAM_Sizes_Flasher_Map[Util.DMG_Header_RAM_Sizes_Map.index(save_type)]), ANSI.RESET))
1250
1261
  elif self.CONN.GetMode() == "AGB":
1251
1262
  print("\n{:s}Done! The writable save data size using save type “{:s}” is {:s}.{:s}".format(ANSI.GREEN, Util.AGB_Header_Save_Types[save_type], Util.formatFileSize(size=found_length), ANSI.RESET))
1252
-
1253
- try:
1254
- (_, _, cfi) = self.CONN.CheckFlashChip(limitVoltage=False)
1255
- if len(cfi["raw"]) > 0:
1256
- with open(Util.CONFIG_PATH + "/cfi.bin", "wb") as f: f.write(cfi["raw"])
1257
- print("CFI data was extracted to “cfi.bin”.")
1258
- except:
1259
- pass
1260
1263
 
1261
1264
  def UpdateFirmware_PrintText(self, text, enableUI=False, setProgress=None):
1262
1265
  if setProgress is not None:
@@ -1415,8 +1418,8 @@ class FlashGBX_CLI():
1415
1418
  with zf.open("fw.ini") as f: ini_file = f.read()
1416
1419
  ini_file = ini_file.decode(encoding="utf-8")
1417
1420
  self.INI = Util.IniSettings(ini=ini_file, main_section="Firmware")
1418
- fw_ver = self.INI.GetValue("fw_ver")
1419
- fw_buildts = self.INI.GetValue("fw_buildts")
1421
+ #fw_ver = self.INI.GetValue("fw_ver")
1422
+ #fw_buildts = self.INI.GetValue("fw_buildts")
1420
1423
 
1421
1424
  print("Select the firmware to install:\n1) Lesserkuma’s FlashGBX firmware\n2) BennVenn’s Drag’n’Drop firmware\n3) BennVenn’s JoeyGUI firmware\n")
1422
1425
  answer = input("Enter number 1-3: ").lower().strip()
@@ -1454,6 +1457,7 @@ class FlashGBX_CLI():
1454
1457
  FWUPD = FirmwareUpdater(port=port)
1455
1458
  file_name = Util.APP_PATH + "/res/fw_JoeyJr.zip"
1456
1459
  with zipfile.ZipFile(file_name) as archive:
1460
+ fw_data = None
1457
1461
  if fw_choice == 1:
1458
1462
  with archive.open("FIRMWARE_LK.JR") as f: fw_data = bytearray(f.read())
1459
1463
  elif fw_choice == 2: