mirror of
https://github.com/a2-4am/4cade.git
synced 2026-03-11 19:42:05 +00:00
Pack DHGR titles to save space (#677)
* Packer for DHGR files * Move unpacked DHGR files * Add packed DHGR files * Enable loading of packed DHGR titles
This commit is contained in:
1
Makefile
1
Makefile
@@ -408,6 +408,7 @@ compress: $(MD)
|
||||
$(PARALLEL) '[ -f "res/ACTION.DHGR/{/}" ] || (truncate -s 16384 "{}" && ${EXOMIZER} "{}"@0x0000 -o "res/ACTION.DHGR/{/}" && truncate -s -2 "res/ACTION.DHGR/{/}")' ::: res/ACTION.DHGR.UNCOMPRESSED/*
|
||||
$(PARALLEL) '[ -f "res/ARTWORK.SHR/{/}" ] || (truncate -s 32768 "{}" && ${EXOMIZER} "{}"@0x0000 -o "res/ARTWORK.SHR/{/}" && truncate -s -2 "res/ARTWORK.SHR/{/}")' ::: res/ARTWORK.SHR.UNCOMPRESSED/*
|
||||
$(PARALLEL) '[ -f "res/TITLE.HGR/{/}" ] || bin/packhgrfile.py "{}" "res/TITLE.HGR/{/}"' ::: res/TITLE.HGR.UNPACKED/*
|
||||
$(PARALLEL) '[ -f "res/TITLE.DHGR/{/}" ] || bin/packdhgrfile.py "{}" "res/TITLE.DHGR/{/}"' ::: res/TITLE.DHGR.UNPACKED/*
|
||||
|
||||
#
|
||||
# |attract| must be called separately because it is slow and
|
||||
|
||||
20
bin/packdhgrfile.py
Executable file
20
bin/packdhgrfile.py
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
infile = sys.argv[1]
|
||||
outfile = sys.argv[2]
|
||||
|
||||
with open(infile,"rb") as i:
|
||||
filedata = i.read()
|
||||
|
||||
outaux = bytearray(filedata[0:7680])
|
||||
outmain = bytearray(filedata[8192:15872])
|
||||
for h in range(60):
|
||||
oh = h*128+120
|
||||
ih = h*8+7680+(int(h/15)*8)
|
||||
outaux[oh:oh+8] = filedata[ih:ih+8]
|
||||
outmain[oh:oh+8] = filedata[ih+8192:ih+8192+8]
|
||||
|
||||
with open(outfile,"wb") as o:
|
||||
o.write(outaux)
|
||||
o.write(outmain)
|
||||
BIN
res/TITLE.DHGR.UNPACKED/AIRHEART
Normal file
BIN
res/TITLE.DHGR.UNPACKED/AIRHEART
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/ALIENS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/ALIENS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/ANGRYBIRDS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/ANGRYBIRDS
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/BAD.DUDES
Normal file
1
res/TITLE.DHGR.UNPACKED/BAD.DUDES
Normal file
File diff suppressed because one or more lines are too long
1
res/TITLE.DHGR.UNPACKED/BATMAN
Normal file
1
res/TITLE.DHGR.UNPACKED/BATMAN
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/BRUCE.LEE
Normal file
BIN
res/TITLE.DHGR.UNPACKED/BRUCE.LEE
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/CATACOMBS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/CATACOMBS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/COLUMNS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/COLUMNS
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/CROSSBOW
Normal file
1
res/TITLE.DHGR.UNPACKED/CROSSBOW
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/DANGEROUS.DAVE
Normal file
BIN
res/TITLE.DHGR.UNPACKED/DANGEROUS.DAVE
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/DD.GOES.NUTZ
Normal file
BIN
res/TITLE.DHGR.UNPACKED/DD.GOES.NUTZ
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/DD.RETURNS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/DD.RETURNS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/DEATH.SWORD
Normal file
BIN
res/TITLE.DHGR.UNPACKED/DEATH.SWORD
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/DG
Normal file
BIN
res/TITLE.DHGR.UNPACKED/DG
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/ETHER.QUEST
Normal file
BIN
res/TITLE.DHGR.UNPACKED/ETHER.QUEST
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/FLAPPLE.BIRD
Normal file
BIN
res/TITLE.DHGR.UNPACKED/FLAPPLE.BIRD
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/HEAVY.BARREL
Normal file
BIN
res/TITLE.DHGR.UNPACKED/HEAVY.BARREL
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/I2
Normal file
1
res/TITLE.DHGR.UNPACKED/I2
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/IE
Normal file
BIN
res/TITLE.DHGR.UNPACKED/IE
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/INDIANA.JONES
Normal file
BIN
res/TITLE.DHGR.UNPACKED/INDIANA.JONES
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/MS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/MS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/PIPE.DREAM
Normal file
BIN
res/TITLE.DHGR.UNPACKED/PIPE.DREAM
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/PLATOON
Normal file
1
res/TITLE.DHGR.UNPACKED/PLATOON
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/PP
Normal file
BIN
res/TITLE.DHGR.UNPACKED/PP
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/PUYO.PUYO
Normal file
BIN
res/TITLE.DHGR.UNPACKED/PUYO.PUYO
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/QIX
Normal file
BIN
res/TITLE.DHGR.UNPACKED/QIX
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/RADWARRIOR
Normal file
BIN
res/TITLE.DHGR.UNPACKED/RADWARRIOR
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/RAMPAGE
Normal file
1
res/TITLE.DHGR.UNPACKED/RAMPAGE
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/RENEGADE
Normal file
BIN
res/TITLE.DHGR.UNPACKED/RENEGADE
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/ROBOCOP
Normal file
BIN
res/TITLE.DHGR.UNPACKED/ROBOCOP
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/RR
Normal file
1
res/TITLE.DHGR.UNPACKED/RR
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/SO
Normal file
BIN
res/TITLE.DHGR.UNPACKED/SO
Normal file
Binary file not shown.
1
res/TITLE.DHGR.UNPACKED/SPIDERBOT
Normal file
1
res/TITLE.DHGR.UNPACKED/SPIDERBOT
Normal file
File diff suppressed because one or more lines are too long
BIN
res/TITLE.DHGR.UNPACKED/SS3
Normal file
BIN
res/TITLE.DHGR.UNPACKED/SS3
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/TC
Normal file
BIN
res/TITLE.DHGR.UNPACKED/TC
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/TETRIS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/TETRIS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/THE.LAST.NINJA
Normal file
BIN
res/TITLE.DHGR.UNPACKED/THE.LAST.NINJA
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/THEXDER
Normal file
BIN
res/TITLE.DHGR.UNPACKED/THEXDER
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/TS
Normal file
BIN
res/TITLE.DHGR.UNPACKED/TS
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/VICTORY.ROAD
Normal file
BIN
res/TITLE.DHGR.UNPACKED/VICTORY.ROAD
Normal file
Binary file not shown.
BIN
res/TITLE.DHGR.UNPACKED/WF
Normal file
BIN
res/TITLE.DHGR.UNPACKED/WF
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -104,7 +104,7 @@ LoadIndexedDHRFile
|
||||
jsr SwitchToBank2
|
||||
lda #0
|
||||
sta OKVS_CACHE
|
||||
lda #$20 ; load first $2000 bytes into auxiliary memory
|
||||
lda #$1E ; load first $1E00 bytes into auxiliary memory
|
||||
sta OKVS_CACHE + 5
|
||||
jsr GetOffscreenAddress
|
||||
sta @dhgr_addr_aux + 1
|
||||
@@ -114,16 +114,24 @@ LoadIndexedDHRFile
|
||||
!word $FD00 ; SMC high byte
|
||||
!word OKVS_CACHE
|
||||
jsr SwitchToBank2
|
||||
lda OKVS_CACHE + 2 ; offset += $2000 (note: stored in big-endian)
|
||||
lda OKVS_CACHE + 2 ; offset += $1E00 (note: stored in big-endian)
|
||||
clc
|
||||
adc #$20
|
||||
adc #$1E
|
||||
sta OKVS_CACHE + 2
|
||||
bcc +
|
||||
inc OKVS_CACHE + 1
|
||||
+ jsr LoadIndexedFile ; load next $2000 bytes into main memory
|
||||
+ jsr LoadIndexedFile ; load next $1E00 bytes into main memory
|
||||
@dhgr_addr_main
|
||||
!word $FD00 ; SMC high byte
|
||||
!word OKVS_CACHE
|
||||
|
||||
sta READAUXMEM ; unpack aux bank
|
||||
sta WRITEAUXMEM
|
||||
jsr UnpackHGRTitle
|
||||
sta READMAINMEM ; then main bank
|
||||
sta WRITEMAINMEM
|
||||
jsr UnpackHGRTitle
|
||||
|
||||
rts
|
||||
|
||||
.LoadHGRGameTitleOffscreen
|
||||
@@ -184,6 +192,12 @@ dest
|
||||
inc dest+2
|
||||
+ dec $E0
|
||||
bpl loop
|
||||
|
||||
lda dest+2 ; clear animation flag in last screen hole
|
||||
sbc #$01 ; in case the packed data contained a $4C
|
||||
sta clear+2
|
||||
clear sta $3FFD ; SMC high byte
|
||||
|
||||
OFFSCREENRTS
|
||||
rts
|
||||
|
||||
|
||||
Reference in New Issue
Block a user