This commit is contained in:
Lesserkuma 2022-08-01 14:31:03 +02:00
parent 79605b9b16
commit ced09c6457
7 changed files with 33 additions and 22 deletions

View File

@ -1,4 +1,7 @@
# Release notes
### v3.17 (released 2022-08-01)
- Improved MBC1 ROM banking based on the [Game Boy: Complete Technical Reference](https://github.com/Gekkio/gb-ctr) by gekkio (fixes games such as Super Chinese Fighter GB)
### v3.16/v3.16.1 (released 2022-07-26)
- Added support for 256M29EWH (no PCB text) *(thanks Diddy_Kong)*
- Added support for a new insideGadgets 4 MB flash cartridge *(thanks AlexiG)*

View File

@ -207,11 +207,12 @@ class DMG_MBC1(DMG_MBC):
def SelectBankROM(self, index):
dprint(self.GetName(), "|", index, hex(index >> 5), hex(index & 0x1F))
commands = [
[ 0x6000, 0 ],
[ 0x6000, 1 ],
[ 0x2000, index ],
[ 0x4000, index >> 5 ],
[ 0x2000, index & 0x1F ],
]
start_address = 0 if index == 0 else 0x4000
start_address = 0x4000 if index & 0x1F else 0
self.CartWrite(commands)
return (start_address, self.ROM_BANK_SIZE)
@ -544,18 +545,12 @@ class DMG_MBC1M(DMG_MBC1):
def SelectBankROM(self, index):
dprint(self.GetName(), "|", index)
if index < 10:
commands = [
[ 0x4000, index >> 4 ],
[ 0x2000, index & 0x1F ],
]
else:
commands = [
[ 0x4000, index >> 4 ],
[ 0x2000, 0x10 | (index & 0x1F) ],
]
start_address = 0 if index == 0 else 0x4000
commands = [
[ 0x6000, 1 ],
[ 0x2000, index ],
[ 0x4000, index >> 4 ],
]
start_address = 0x4000 if index & 0x0F else 0
self.CartWrite(commands)
return (start_address, self.ROM_BANK_SIZE)

View File

@ -7,7 +7,7 @@ from enum import Enum
# Common constants
APPNAME = "FlashGBX"
VERSION_PEP440 = "3.16.1"
VERSION_PEP440 = "3.17"
VERSION = "v{:s}".format(VERSION_PEP440)
DEBUG = False
@ -632,8 +632,10 @@ def GenerateFileName(mode, header, settings):
path_revision = str(header["version"])
path_extension = "bin"
path = "%TITLE%"
fe_sgb = "enabled"
if settings is not None:
path = settings.value(key="FileNameFormatDMG", default=path)
fe_sgb = settings.value(key="AutoFileExtensionSGB", default="enabled")
if header["cgb"] == 0xC0 or header["cgb"] == 0x80:
if len(header["game_title_raw"].rstrip("\x00")) == 15:
if path_title[-4:][0] in ("A", "B", "H", "K", "V") and path_title[-4:][3] in ("A", "B", "D", "E", "F", "I", "J", "K", "P", "S", "U", "X", "Y"):
@ -643,7 +645,7 @@ def GenerateFileName(mode, header, settings):
if settings is not None:
path = settings.value(key="FileNameFormatCGB", default=path)
path_extension = "gbc"
elif header["old_lic"] == 0x33 and header["sgb"] == 0x03:
elif header["old_lic"] == 0x33 and header["sgb"] == 0x03 and fe_sgb.lower() == "enabled":
path_extension = "sgb"
else:
path_extension = "gb"

View File

@ -190,7 +190,7 @@ class GbxDevice:
dev.close()
self.DEVICE = None
return False
elif (self.FW[1] == 100 and self.FW[0] < 26):
elif (self.FW[1] == 100 and self.FW[0] < 26 and self.FW[0] != 20):
self.FW_UPDATE_REQ = True
elif (self.FW[1] in (2, 4, 90) and self.FW[0] < self.DEVICE_MAX_FW) or (self.FW[0] < self.DEVICE_MIN_FW):
self.FW_UPDATE_REQ = True
@ -703,9 +703,12 @@ class GbxDevice:
if mbc in (0x01, 0x02, 0x03): # MBC1
dprint("└[MBC1] 0x6000=0x00, 0x4000=0x{:X}, 0x2000=0x{:X}".format(bank >> 5, bank & 0x1F))
self.cart_write(0x6000, 0)
#self.cart_write(0x6000, 0)
#self.cart_write(0x4000, bank >> 5)
#self.cart_write(0x2000, bank & 0x1F)
self.cart_write(0x6000, 1)
self.cart_write(0x2000, bank)
self.cart_write(0x4000, bank >> 5)
self.cart_write(0x2000, bank & 0x1F)
elif mbc in (0x101, 0x103): # MBC1M
self.cart_write(0x4000, bank >> 4)
if (bank < 10):
@ -1386,7 +1389,14 @@ class GbxDevice:
elif mbc == 0x104: # M161
startAddr = 0
endAddr = 0x8000
elif mbc in (0x01, 0x02, 0x03): # MBC1
if bank & 0x1F:
startAddr = 0x4000
endAddr = 0x8000
else:
startAddr = 0
endAddr = 0x4000
self.SetBankROM(bank, mbc)
for currAddr in range(startAddr, endAddr, buffer_len):

Binary file not shown.

View File

@ -303,6 +303,7 @@ The author would like to thank the following very kind people for their help and
- FerrantePescara (flash chip info)
- frarees (bug reports)
- Frost Clock (flash chip info)
- gekkio (bug reports, technical information)
- Godan (flash chip info)
- Grender (testing)
- HDR (testing)

View File

@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read(
setuptools.setup(
name="FlashGBX",
version="3.16.1",
version="3.17",
author="Lesserkuma",
description="Reads and writes Game Boy and Game Boy Advance cartridge data. Supported hardware: GBxCart RW v1.3 and v1.4 by insideGadgets.",
url="https://github.com/lesserkuma/FlashGBX",