mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 12:40:21 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dd889b35b | |||
| 032f894f7f | |||
| 9922e235c6 | |||
| 667267d9bb | |||
| 6588901e9a | |||
| 142d1358dd |
@@ -193,6 +193,26 @@ get_controls
|
||||
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
|
||||
|
||||
GAMEDIR="$SHDIR/gen1recomp"
|
||||
# Anbernic stock keeps the launcher and the game folder side by side, so the
|
||||
# SHDIR-relative path above is correct there and is tried first.
|
||||
#
|
||||
# Other firmwares (muOS, and PortMaster's layout on several devices) keep
|
||||
# launcher scripts and port data in SEPARATE trees -- scripts under roms/ports,
|
||||
# data under ports -- so the sibling folder holds no game.
|
||||
#
|
||||
# Probe for the BINARY, not the directory: on a split layout this script has
|
||||
# usually already created "$SHDIR/gen1recomp/conf" and log.txt on an earlier
|
||||
# failed run (see mkdir/tee below), so an existence test matches a decoy of our
|
||||
# own making. Stock is unaffected -- its sibling holds the real binary and wins
|
||||
# on the first test.
|
||||
if [ ! -f "$GAMEDIR/bin/love.aarch64" ]; then
|
||||
for candidate in "/$directory/ports/gen1recomp" \
|
||||
"/mnt/sdcard/ports/gen1recomp" \
|
||||
"/mnt/mmc/ports/gen1recomp" \
|
||||
"/roms/ports/gen1recomp"; do
|
||||
if [ -f "$candidate/bin/love.aarch64" ]; then GAMEDIR="$candidate"; break; fi
|
||||
done
|
||||
fi
|
||||
CONFDIR="$GAMEDIR/conf"
|
||||
mkdir -p "$CONFDIR"
|
||||
|
||||
|
||||
+14
-1
@@ -1279,14 +1279,27 @@ function SaveData.ensurePlaythroughId(save, injectedFs)
|
||||
local isFresh = save == freshPlaythrough
|
||||
if isFresh then freshPlaythrough = nil end
|
||||
local byVersion = opts.playthroughIds and opts.playthroughIds[version]
|
||||
id = not isFresh and byVersion and byVersion[scope] or nil
|
||||
local existing = byVersion and byVersion[scope]
|
||||
id = not isFresh and existing or nil
|
||||
if type(id) ~= "string" or id == "" then
|
||||
id = SaveData.newPlaythroughId()
|
||||
-- A fresh skeleton still gets its own id (two unsaved New Games sharing a
|
||||
-- slot must stay distinct), and it is still persisted when the slot has no
|
||||
-- binding yet -- that is the contract a tool relies on to resolve
|
||||
-- `selected` at the title after a restart, before any normal SAVE.
|
||||
--
|
||||
-- What it must NOT do is OVERWRITE a binding that already exists. newGame()
|
||||
-- marks a skeleton on the boot frame, before any save is loaded, and mods
|
||||
-- initialise inside that window -- so a mod touching storage at init
|
||||
-- replaced the real save's id with a throwaway, stranding that save's mod
|
||||
-- storage and repeating on every launch.
|
||||
if not (isFresh and type(existing) == "string" and existing ~= "") then
|
||||
opts.playthroughIds = opts.playthroughIds or {}
|
||||
opts.playthroughIds[version] = opts.playthroughIds[version] or {}
|
||||
opts.playthroughIds[version][scope] = id
|
||||
SaveData.saveOptions(opts, injectedFs)
|
||||
end
|
||||
end
|
||||
save.meta.playthroughId = id
|
||||
return id
|
||||
end
|
||||
|
||||
+15
-4
@@ -988,14 +988,25 @@ def cmd_add_release_workflow(args, repo):
|
||||
# ---------------------------------------------------------------- lint
|
||||
|
||||
def ahash(image):
|
||||
"""Ink-mask hash over the 8x8 downscale: background (the lightest GB
|
||||
shade) vs ink. Swapping the three ink shades -- the classic recolor --
|
||||
leaves the mask intact, which is exactly what MK302 wants to catch."""
|
||||
"""Ink-mask hash over the 8x8 downscale: background vs ink, split at
|
||||
THIS image's own average brightness rather than a fixed shade. Swapping
|
||||
the three ink shades -- the classic recolor -- leaves the mask intact,
|
||||
which is exactly what MK302 wants to catch.
|
||||
|
||||
A fixed cutoff (e.g. "<=200 is ink") only makes sense for sprites with a
|
||||
light background to split against; a mostly-opaque 16x16 icon has almost
|
||||
no pixel above that cutoff, so every such icon collapsed onto the same
|
||||
"all ink" hash and was flagged as a near-duplicate of anything else that
|
||||
also collapsed -- which was most of them, boulder.png included.
|
||||
Thresholding against the image's own mean keeps the split meaningful
|
||||
(and roughly balanced) no matter how light or dark the source is."""
|
||||
from PIL import Image
|
||||
small = image.convert("L").resize((8, 8), Image.LANCZOS)
|
||||
raw = (small.get_flattened_data() if hasattr(small, "get_flattened_data")
|
||||
else small.getdata())
|
||||
return sum((1 << i) for i, p in enumerate(raw) if p <= 200)
|
||||
raw = list(raw)
|
||||
average = sum(raw) / len(raw)
|
||||
return sum((1 << i) for i, p in enumerate(raw) if p <= average)
|
||||
|
||||
|
||||
def hamming(a, b):
|
||||
|
||||
Reference in New Issue
Block a user