This commit is contained in:
Lesserkuma 2023-11-01 17:19:55 +01:00
parent cbe17ef7c5
commit a3c4a44893
2 changed files with 14 additions and 3 deletions

View File

@ -15,7 +15,8 @@ The following section must be edited in order to specify the cartridge type to u
```json
"cartridge": {
"type": 2,
"battery_present": false
"battery_present": false,
"min_rom_size": 4194304
},
```
Set `type` to `1` or `2`:
@ -24,6 +25,8 @@ Set `type` to `1` or `2`:
Set `battery_present` to `true` or `false`. This will enable enhanced save data handling which will only be functional with a working battery.
Set `min_rom_size` to whatever your cartridge supports as the smallest possible ROM size. Many newer cartridges only support ROMs no smaller than 4 MiB (`4194304`) while some older cartridges can go as low as 512 KiB (`524288`).
In the `games` section, you can edit the game-related stuff:
```json
"games": [

View File

@ -5,7 +5,7 @@
import sys, os, glob, json, math, re, struct, hashlib, argparse, datetime
# Configuration
app_version = "0.6"
app_version = "0.7"
default_file = "LK_MULTIMENU_<CODE>.gba"
################################
@ -83,6 +83,7 @@ if not os.path.exists(args.config):
games = []
cartridge_type = 1
battery_present = False
min_rom_size = 0x400000
for file in files:
d = {
"enabled": True,
@ -102,6 +103,7 @@ if not os.path.exists(args.config):
"cartridge": {
"type": cartridge_type + 1,
"battery_present": battery_present,
"min_rom_size": min_rom_size,
},
"games": games,
}
@ -124,6 +126,10 @@ else:
games = j["games"]
cartridge_type = j["cartridge"]["type"] - 1
battery_present = j["cartridge"]["battery_present"]
if "min_rom_size" in j["cartridge"]:
min_rom_size = j["cartridge"]["min_rom_size"]
else:
min_rom_size = 0x400000
# Prepare compilation
flash_size = cartridge_types[cartridge_type]["flash_size"]
@ -176,7 +182,9 @@ for game in games:
with open(f"roms/{game['file']}", "rb") as f:
buffer = f.read()
if b"Batteryless mod by Lesserkuma" in buffer:
size = 0x400000
size = max(0x400000, min_rom_size)
else:
size = max(size, min_rom_size)
game["index"] = index
game["size"] = size
if "title_font" in game: