mirror of
https://github.com/a2-4am/4cade.git
synced 2026-04-25 04:30:18 +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:
@@ -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
|
||||
|
||||
Executable
+20
@@ -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)
|
||||
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.
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.
+1
-1
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.
+1
-1
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.
+18
-4
@@ -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