FlashGBX 4.3__tar.gz → 4.6__tar.gz

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.
Files changed (54) hide show
  1. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/DataTransfer.py +1 -1
  2. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/FlashGBX.py +4 -3
  3. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/FlashGBX_CLI.py +36 -20
  4. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/FlashGBX_GUI.py +359 -148
  5. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/Flashcart.py +3 -2
  6. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/GBMemory.py +4 -2
  7. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/LK_Device.py +327 -233
  8. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/Mapper.py +6 -27
  9. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/PocketCamera.py +1 -1
  10. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/PocketCameraWindow.py +32 -2
  11. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/RomFileAGB.py +5 -2
  12. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/RomFileDMG.py +8 -3
  13. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/UserInputDialog.py +1 -1
  14. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/Util.py +33 -11
  15. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/__main__.py +1 -1
  16. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/fw_GBFlash.py +20 -3
  17. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/fw_GBxCartRW_v1_3.py +1 -1
  18. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/fw_GBxCartRW_v1_4.py +1 -1
  19. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/fw_JoeyJr.py +10 -3
  20. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/hw_GBFlash.py +3 -3
  21. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/hw_GBxCartRW.py +16 -16
  22. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/hw_JoeyJr.py +3 -3
  23. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/pyside.py +1 -1
  24. flashgbx-4.6/FlashGBX/res/config.zip +0 -0
  25. flashgbx-4.6/FlashGBX/res/fw_GBFlash.zip +0 -0
  26. flashgbx-4.6/FlashGBX/res/fw_GBxCart_RW_v1_4.zip +0 -0
  27. flashgbx-4.6/FlashGBX/res/fw_GBxCart_RW_v1_4a.zip +0 -0
  28. flashgbx-4.6/FlashGBX/res/fw_JoeyJr.zip +0 -0
  29. {FlashGBX-4.3 → flashgbx-4.6/FlashGBX.egg-info}/PKG-INFO +100 -54
  30. FlashGBX-4.3/README.md → flashgbx-4.6/PKG-INFO +438 -363
  31. FlashGBX-4.3/FlashGBX.egg-info/PKG-INFO → flashgbx-4.6/README.md +398 -392
  32. {FlashGBX-4.3 → flashgbx-4.6}/setup.py +5 -5
  33. FlashGBX-4.3/FlashGBX/res/config.zip +0 -0
  34. FlashGBX-4.3/FlashGBX/res/fw_GBFlash.zip +0 -0
  35. FlashGBX-4.3/FlashGBX/res/fw_GBxCart_RW_v1_4.zip +0 -0
  36. FlashGBX-4.3/FlashGBX/res/fw_GBxCart_RW_v1_4a.zip +0 -0
  37. FlashGBX-4.3/FlashGBX/res/fw_JoeyJr.zip +0 -0
  38. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/__init__.py +0 -0
  39. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/Third Party Notices.md +0 -0
  40. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/fw_GBxCart_RW_Mini_v1_0.zip +0 -0
  41. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/fw_GBxCart_RW_XMAS_v1_0.zip +0 -0
  42. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/fw_GBxCart_RW_v1_1_v1_2.zip +0 -0
  43. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/fw_GBxCart_RW_v1_3.zip +0 -0
  44. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/icon.ico +0 -0
  45. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/icon.png +0 -0
  46. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX/res/pc_frame.png +0 -0
  47. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX.egg-info/SOURCES.txt +0 -0
  48. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX.egg-info/dependency_links.txt +0 -0
  49. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX.egg-info/entry_points.txt +0 -0
  50. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX.egg-info/requires.txt +0 -0
  51. {FlashGBX-4.3 → flashgbx-4.6}/FlashGBX.egg-info/top_level.txt +0 -0
  52. {FlashGBX-4.3 → flashgbx-4.6}/LICENSE +0 -0
  53. {FlashGBX-4.3 → flashgbx-4.6}/MANIFEST.in +0 -0
  54. {FlashGBX-4.3 → flashgbx-4.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # FlashGBX
3
- # Author: Lesserkuma (github.com/lesserkuma)
3
+ # Author: Lesserkuma (github.com/Lesserkuma)
4
4
 
5
5
  import traceback
6
6
  from serial import SerialException
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # FlashGBX
3
- # Author: Lesserkuma (github.com/lesserkuma)
3
+ # Author: Lesserkuma (github.com/Lesserkuma)
4
4
 
5
5
  import sys, os, glob, re, json, zlib, argparse, zipfile, traceback, platform, datetime, copy
6
6
  from . import Util
@@ -88,7 +88,7 @@ def main(portableMode=False):
88
88
  os.environ['QT_MAC_WANTS_LAYER'] = '1'
89
89
 
90
90
  print("{:s} {:s} by Lesserkuma".format(Util.APPNAME, Util.VERSION))
91
- print("https://github.com/lesserkuma/FlashGBX")
91
+ print("https://github.com/Lesserkuma/FlashGBX")
92
92
 
93
93
  if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
94
94
  app_path = os.path.dirname(sys.executable)
@@ -135,10 +135,11 @@ def main(portableMode=False):
135
135
  ap_cli2 = parser.add_argument_group('optional command line interface arguments')
136
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
- 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")
138
+ ap_cli2.add_argument("--dmg-savetype", choices=["auto", "4k", "16k", "64k", "256k", "512k", "1m", "mbc6", "mbc7_2k", "mbc7_4k", "tama5", "sram4m", "eeprom1m", "photo"], type=str.lower, default="auto", help="set type 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")
140
140
  ap_cli2.add_argument("--agb-savetype", choices=["auto", "eeprom4k", "eeprom64k", "sram256k", "flash512k", "flash1m", "dacs8m", "sram512k", "sram1m"], type=str.lower, default="auto", help="set type of Game Boy Advance cartridge save data")
141
141
  ap_cli2.add_argument("--store-rtc", action="store_true", default=False, help="store RTC register values if supported")
142
+ ap_cli2.add_argument("--keep-calibration", action="store_true", default=True, help="keep existing calibration data of the e-Reader when writing save data")
142
143
  ap_cli2.add_argument("--ignore-bad-header", action="store_true", help="don’t stop if invalid data found in cartridge header data")
143
144
  ap_cli2.add_argument("--flashcart-type", type=str, default="autodetect", help="name of flash cart; see txt files in config directory")
144
145
  ap_cli2.add_argument("--prefer-chip-erase", action="store_true", help="prefer full chip erase over sector erase when both available")
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # FlashGBX
3
- # Author: Lesserkuma (github.com/lesserkuma)
3
+ # Author: Lesserkuma (github.com/Lesserkuma)
4
4
 
5
5
  import datetime, shutil, platform, os, math, traceback, re, time, serial, zipfile
6
6
  try:
@@ -371,11 +371,21 @@ class FlashGBX_CLI():
371
371
 
372
372
  elif self.CONN.INFO["last_action"] == 2: # Backup RAM
373
373
  self.CONN.INFO["last_action"] = 0
374
- if not "debug" in self.ARGS and self.CONN.GetMode() == "DMG" and self.CONN.INFO["mapper_raw"] == 252 and self.CONN.INFO["transferred"] == 131072: # Pocket Camera / 128 KiB: # 128 KiB
374
+ if not "debug" in self.ARGS and self.CONN.GetMode() == "DMG" and self.CONN.INFO["mapper_raw"] == 252 and self.CONN.INFO["transferred"] == 0x20000 or (self.CONN.INFO["transferred"] == 0x100000 and self.CONN.INFO["dump_info"]["header"]["ram_size_raw"] == 0x204):
375
375
  answer = input("Would you like to extract Game Boy Camera pictures to “{:s}” now? [Y/n]: ".format(Util.formatPathOS(os.path.abspath(os.path.splitext(self.CONN.INFO["last_path"])[0]), end_sep=True) + "IMG_PC**.{:s}".format(self.ARGS["argparsed"].gbcamera_outfile_format))).strip().lower()
376
376
  if answer != "n":
377
+ if self.CONN.INFO["transferred"] == 0x100000:
378
+ answer = int(input("A Photo! save file was detected. Please select the roll of pictures that you would like to load.\n- 1: Current Save Data\n- 2-8: Flash Directory Slots\nLoad Roll [1-8]: "))
379
+ if answer == 0:
380
+ return
381
+ with open(self.CONN.INFO["last_path"], "rb") as f:
382
+ f.seek(0x20000 * (answer - 1))
383
+ file = bytearray(f.read(0x20000))
384
+ else:
385
+ file = self.CONN.INFO["last_path"]
386
+
377
387
  pc = PocketCamera()
378
- if pc.LoadFile(self.CONN.INFO["last_path"]) != False:
388
+ if pc.LoadFile(file) != False:
379
389
  palettes = [ "grayscale", "dmg", "sgb", "cgb1", "cgb2", "cgb3" ]
380
390
  pc.SetPalette(palettes.index(self.ARGS["argparsed"].gbcamera_palette))
381
391
  file = os.path.splitext(self.CONN.INFO["last_path"])[0] + "/IMG_PC00.png"
@@ -475,6 +485,9 @@ class FlashGBX_CLI():
475
485
  bad_read = False
476
486
  s = ""
477
487
  if self.CONN.GetMode() == "DMG":
488
+ if data["db"]:
489
+ s += "Game Name: {:s}\n".format(os.path.splitext(Util.GenerateFileName(mode=self.CONN.GetMode(), header=self.CONN.INFO, settings=None))[0])
490
+
478
491
  s += "Game Title: {:s}\n".format(data["game_title"])
479
492
  if len(data['game_code']) > 0:
480
493
  s += "Game Code: {:s}\n".format(data['game_code'])
@@ -544,6 +557,9 @@ class FlashGBX_CLI():
544
557
  self.ARGS["argparsed"].flashcart_type = cart_types[0][i]
545
558
 
546
559
  elif self.CONN.GetMode() == "AGB":
560
+ if data["db"]:
561
+ s += "Game Name: {:s}\n".format(os.path.splitext(Util.GenerateFileName(mode=self.CONN.GetMode(), header=self.CONN.INFO, settings=None))[0])
562
+
547
563
  s += "Game Title: {:s}\n".format(data["game_title"])
548
564
  s += "Game Code: {:s}\n".format(data["game_code"])
549
565
  s += "Revision: {:d}\n".format(data["version"])
@@ -571,12 +587,10 @@ class FlashGBX_CLI():
571
587
  bad_read = True
572
588
 
573
589
  s += "ROM Checksum: "
574
- #Util.AGB_Global_CRC32 = 0
575
590
  db_agb_entry = data["db"]
576
591
  if db_agb_entry != None:
577
592
  if data["rom_size_calc"] < 0x400000:
578
593
  s += "In database (0x{:06X})\n".format(db_agb_entry['rc'])
579
- #Util.AGB_Global_CRC32 = db_agb_entry['rc']
580
594
  s += "ROM Size: {:d} MiB\n".format(int(db_agb_entry['rs']/1024/1024))
581
595
  data['rom_size'] = db_agb_entry['rs']
582
596
  elif data["rom_size"] != 0:
@@ -606,10 +620,6 @@ class FlashGBX_CLI():
606
620
 
607
621
  if data['logo_correct'] and isinstance(db_agb_entry, dict) and "rs" in db_agb_entry and db_agb_entry['rs'] == 0x4000000 and not self.CONN.IsSupported3dMemory():
608
622
  print("{:s}\nWARNING: This cartridge uses a Memory Bank Controller that may not be completely supported yet. A future version of the {:s} device firmware may add support for it.{:s}".format(ANSI.YELLOW, self.CONN.GetFullName(), ANSI.RESET))
609
-
610
- # if "has_rtc" in data and data["has_rtc"] is not True and "no_rtc_reason" in data:
611
- # if data["no_rtc_reason"] == 1:
612
- # print("{:s}NOTE: It seems that this cartridge’s Real Time Clock battery may no longer be functional and needs to be replaced.{:s}".format(ANSI.YELLOW, ANSI.RESET))
613
623
 
614
624
  return (bad_read, s, data)
615
625
 
@@ -666,7 +676,10 @@ class FlashGBX_CLI():
666
676
  elif self.CONN.GetMode() == "AGB":
667
677
  temp = "{:s}".format(Util.AGB_Header_Save_Types[save_type])
668
678
  if save_type == 0:
669
- msg_save_type_s = "Save Type: None or unknown (no save data detected)\n"
679
+ if "Unknown" in save_chip:
680
+ msg_save_type_s = "Save Type: {:s}\n".format(save_chip)
681
+ else:
682
+ msg_save_type_s = "Save Type: None or unknown (no save data detected)\n"
670
683
  else:
671
684
  if sram_unstable and "SRAM" in temp:
672
685
  msg_save_type_s = "Save Type: {:s} {:s}(not battery-backed){:s}\n".format(temp, ANSI.RED, ANSI.RESET)
@@ -903,7 +916,6 @@ class FlashGBX_CLI():
903
916
  elif os.path.getsize(path) < 0x400:
904
917
  print("{:s}ROM files smaller than 1 KiB are not supported.{:s}".format(ANSI.RED, ANSI.RESET))
905
918
  return
906
- #with open(path, "rb") as file: buffer = bytearray(file.read())
907
919
 
908
920
  with open(path, "rb") as file:
909
921
  ext = os.path.splitext(path)[1]
@@ -1032,6 +1044,7 @@ class FlashGBX_CLI():
1032
1044
  def BackupRestoreRAM(self, args, header):
1033
1045
  add_date_time = args.save_filename_add_datetime is True
1034
1046
  rtc = args.store_rtc is True
1047
+ cart_type = 0
1035
1048
 
1036
1049
  path_datetime = ""
1037
1050
  if add_date_time:
@@ -1064,7 +1077,7 @@ class FlashGBX_CLI():
1064
1077
  else:
1065
1078
  mbc = 0x19
1066
1079
 
1067
- if args.dmg_savesize == "auto":
1080
+ if args.dmg_savetype == "auto":
1068
1081
  try:
1069
1082
  if header['mapper_raw'] == 0x06: # MBC2
1070
1083
  save_type = 1
@@ -1074,19 +1087,22 @@ class FlashGBX_CLI():
1074
1087
  save_type = 0x102
1075
1088
  elif header['mapper_raw'] == 0xFD: # TAMA5
1076
1089
  save_type = 0x103
1077
- elif header['mapper_raw'] == 0x20: # TAMA5
1090
+ elif header['mapper_raw'] == 0x20: # MBC6
1078
1091
  save_type = 0x104
1079
1092
  else:
1080
1093
  save_type = header['ram_size_raw']
1081
1094
  except:
1082
- save_type = 0x20000
1095
+ save_type = 0
1083
1096
  else:
1084
- sizes = [ "auto", "4k", "16k", "64k", "256k", "512k", "1m", "eeprom2k", "eeprom4k", "tama5", "4m" ]
1085
- save_type = args.dmg_savesize
1097
+ sizes = [ "auto", "4k", "16k", "64k", "256k", "512k", "1m", "mbc6", "mbc7_2k", "mbc7_4k", "tama5", "sram4m", "eeprom1m", "photo" ]
1098
+ save_type = Util.DMG_Header_RAM_Sizes_Map[sizes.index(args.dmg_savetype)]
1086
1099
 
1087
1100
  if save_type == 0:
1088
- print("{:s}Unable to auto-detect the save size. Please use the “--dmg-savesize” command line switch to manually select it.{:s}".format(ANSI.RED, ANSI.RESET))
1101
+ print("{:s}Unable to auto-detect the save size. Please use the “--dmg-savetype” command line switch to manually select it.{:s}".format(ANSI.RED, ANSI.RESET))
1089
1102
  return
1103
+
1104
+ if save_type == 0x204:
1105
+ cart_type = self.DetectCartridge()
1090
1106
 
1091
1107
  elif self.CONN.GetMode() == "AGB":
1092
1108
  if args.agb_savetype == "auto":
@@ -1153,7 +1169,7 @@ class FlashGBX_CLI():
1153
1169
  if "ereader_calibration" in self.CONN.INFO:
1154
1170
  with open(path, "rb") as f: buffer = bytearray(f.read())
1155
1171
  if buffer[0xD000:0xF000] != self.CONN.INFO["ereader_calibration"]:
1156
- if not args.overwrite:
1172
+ if args.keep_calibration:
1157
1173
  if args.action == "erase-save": args.action = "restore-save"
1158
1174
  print("Note: Keeping existing e-Reader calibration data.")
1159
1175
  buffer[0xD000:0xF000] = self.CONN.INFO["ereader_calibration"]
@@ -1185,13 +1201,13 @@ class FlashGBX_CLI():
1185
1201
  self.CONN.TransferData(args={ 'mode':2, 'path':path, 'mbc':mbc, 'save_type':save_type, 'rtc':rtc }, signal=self.PROGRESS.SetProgress)
1186
1202
  elif args.action == "restore-save":
1187
1203
  verify_write = args.no_verify_write is False
1188
- targs = { 'mode':3, 'path':path, 'mbc':mbc, 'save_type':save_type, 'erase':False, 'rtc':rtc, 'verify_write':verify_write }
1204
+ targs = { 'mode':3, 'path':path, 'mbc':mbc, 'save_type':save_type, 'erase':False, 'rtc':rtc, 'verify_write':verify_write, 'cart_type':cart_type }
1189
1205
  if buffer is not None:
1190
1206
  targs["buffer"] = buffer
1191
1207
  targs["path"] = None
1192
1208
  self.CONN.TransferData(args=targs, signal=self.PROGRESS.SetProgress)
1193
1209
  elif args.action == "erase-save":
1194
- self.CONN.TransferData(args={ 'mode':3, 'path':path, 'mbc':mbc, 'save_type':save_type, 'erase':True, 'rtc':rtc }, signal=self.PROGRESS.SetProgress)
1210
+ self.CONN.TransferData(args={ 'mode':3, 'path':path, 'mbc':mbc, 'save_type':save_type, 'erase':True, 'rtc':rtc, 'cart_type':cart_type }, signal=self.PROGRESS.SetProgress)
1195
1211
  elif args.action == "debug-test-save": # debug
1196
1212
  self.ARGS["debug"] = True
1197
1213