Merge pull request #124 from yenatch/master

hram labels + png make target
This commit is contained in:
Bryan Bishop 2013-03-20 20:12:48 -07:00
commit 1abb020335
7 changed files with 237 additions and 186 deletions

View File

@ -44,15 +44,15 @@ pokecrystal.gbc: pokecrystal.o
lzs: ${VERTGFX} ${HORIZGFX}
pngs:
cd extras; python gfx.py mass-decompress; python gfx.py dump-pngs
cd extras && python gfx.py mass-decompress && python gfx.py dump-pngs
front.png: tiles.png
cd extras; python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp
cd extras && python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp
tiles.png:
cd extras; python gfx.py png-to-2bpp $@
cd extras && python gfx.py png-to-2bpp $@
.png: ${VERTGFX}
cd extras; python gfx.py png-to-lz --vert $@
cd extras && python gfx.py png-to-lz --vert $@
.png: ${HORIZGFX}
cd extras; python gfx.py png-to-lz $@
cd extras && python gfx.py png-to-lz $@

View File

@ -1436,8 +1436,8 @@ def mass_to_colored_png(debug=False):
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
if name[:5]+'.pal' in files:
to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
if os.path.splitext(name)[0]+'.pal' in files:
to_png(os.path.join(root, name), None, os.path.join(root, os.path.splitext(name)[0]+'.pal'))
else:
to_png(os.path.join(root, name))
@ -1459,26 +1459,26 @@ def mass_to_colored_png(debug=False):
def mass_decompress(debug=False):
for root, dirs, files in os.walk('../gfx/'):
for file in files:
if 'lz' in file:
for name in files:
if 'lz' in name:
if '/pics' in root:
if 'front' in file:
if 'front' in name:
id = root.split('pics/')[1][:3]
if id != 'egg':
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
else:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
to_file(root+'/'+'front.2bpp', de.pic)
to_file(root+'/'+'tiles.2bpp', de.animtiles)
elif 'back' in file:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(root+'/'+'back.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
to_file(os.path.join(root, 'front.2bpp'), de.pic)
to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles)
elif 'back' in name:
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(os.path.join(root, 'back.2bpp'), de.output)
elif '/trainers' in root or '/fx' in root:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(root+'/'+file[:-3]+'.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
else:
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read())
to_file(root+file[:-3]+'.2bpp', de.output)
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read())
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
def append_terminator_to_lzs(directory):
# fix lzs that were extracted with a missing terminator

50
hram.asm Normal file
View File

@ -0,0 +1,50 @@
hPushOAM EQU $ff80
hBuffer EQU $ff8b
hRTCDayHi EQU $ff8d
hRTCDayLo EQU $ff8e
hRTCHours EQU $ff8f
hRTCMinutes EQU $ff90
hRTCSeconds EQU $ff91
hHours EQU $ff94
hMinutes EQU $ff96
hSeconds EQU $ff98
hROMBank EQU $ff9d
hJoypadReleased EQU $ffa2
hJoypadPressed EQU $ffa3
hJoypadDown EQU $ffa4
hJoypadSum EQU $ffa5
hJoyReleased EQU $ffa6
hJoyPressed EQU $ffa7
hJoyDown EQU $ffa8
hPastLeadingZeroes EQU $ffb3
hLCDStatCustom EQU $ffc6
hBGMapMode EQU $ffd4
hBGMapThird EQU $ffd5
hBGMapAddress EQU $ffd6
hOAMUpdate EQU $ffd8
hSPBuffer EQU $ffd9
hBGMapUpdate EQU $ffdb
hTileAnimFrame EQU $ffdf
hRandomAdd EQU $ffe1
hRandomSub EQU $ffe2
hBattleTurn EQU $ffe4
hCGBPalUpdate EQU $ffe5
hCGB EQU $ffe6
hSGB EQU $ffe7
hDMATransfer EQU $ffe8

View File

@ -9,9 +9,9 @@ JoypadInt: ; 92e
ClearJoypadPublic: ; 92f
xor a
; Pressed this frame (delta)
ld [$ffa7], a
ld [hJoyPressed], a
; Currently pressed
ld [$ffa8], a
ld [hJoyDown], a
ret
; 935
@ -22,10 +22,10 @@ Joypad: ; 935
; Updates:
; $ffa2: released this frame (delta)
; $ffa3: pressed this frame (delta)
; $ffa4: currently pressed
; $ffa5: pressed so far
; hJoypadReleased: released this frame (delta)
; hJoypadPressed: pressed this frame (delta)
; hJoypadDown: currently pressed
; hJoypadSum: pressed so far
; Any of these three bits can be used to disable input.
ld a, [$cfbe]
@ -76,27 +76,27 @@ Joypad: ; 935
ld [rJOYP], a
; To get the delta we xor the last frame's input with the new one.
ld a, [$ffa4] ; last frame
ld a, [hJoypadDown] ; last frame
ld e, a
xor b
ld d, a
; Released this frame:
and e
ld [$ffa2], a
ld [hJoypadReleased], a
; Pressed this frame:
ld a, d
and b
ld [$ffa3], a
ld [hJoypadPressed], a
; Add any new presses to the list of collective presses:
ld c, a
ld a, [$ffa5]
ld a, [hJoypadSum]
or c
ld [$ffa5], a
ld [hJoypadSum], a
; Currently pressed:
ld a, b
ld [$ffa4], a
ld [hJoypadDown], a
; Now that we have the input, we can do stuff with it.
@ -110,11 +110,11 @@ Joypad: ; 935
GetJoypadPublic: ; 984
; Update mirror joypad input from $ffa4 (real input)
; Update mirror joypad input from hJoypadDown (real input)
; $ffa6: released this frame (delta)
; $ffa7: pressed this frame (delta)
; $ffa8: currently pressed
; hJoyReleased: released this frame (delta)
; hJoyPressed: pressed this frame (delta)
; hJoyDown: currently pressed
; bit 0 A
; 1 B
@ -137,28 +137,28 @@ GetJoypadPublic: ; 984
jr z, .auto
; To get deltas, take this and last frame's input.
ld a, [$ffa4] ; real input
ld a, [hJoypadDown] ; real input
ld b, a
ld a, [$ffa8] ; last frame mirror
ld a, [hJoyDown] ; last frame mirror
ld e, a
; Released this frame:
xor b
ld d, a
and e
ld [$ffa6], a
ld [hJoyReleased], a
; Pressed this frame:
ld a, d
and b
ld [$ffa7], a
ld [hJoyPressed], a
; It looks like the collective presses got commented out here.
ld c, a
; Currently pressed:
ld a, b
ld [$ffa8], a ; frame input
ld [hJoyDown], a ; frame input
.quit
pop bc
@ -174,7 +174,7 @@ GetJoypadPublic: ; 984
; A value of $ff will immediately end the stream.
; Read from the input stream.
ld a, [$ff9d]
ld a, [hROMBank]
push af
ld a, [AutoInputBank]
rst Bankswitch
@ -232,8 +232,8 @@ GetJoypadPublic: ; 984
pop af
rst Bankswitch
ld a, b
ld [$ffa7], a ; pressed
ld [$ffa8], a ; input
ld [hJoyPressed], a ; pressed
ld [hJoyDown], a ; input
jr .quit
; 9ee
@ -251,9 +251,9 @@ StartAutoInput: ; 9ee
ld [AutoInputLength], a
; Reset input mirrors.
xor a
ld [$ffa7], a ; pressed this frame
ld [$ffa6], a ; released this frame
ld [$ffa8], a ; currently pressed
ld [hJoyPressed], a ; pressed this frame
ld [hJoyReleased], a ; released this frame
ld [hJoyDown], a ; currently pressed
ld a, AUTO_INPUT
ld [InputType], a

268
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
INCLUDE "wram.asm"
INCLUDE "constants.asm"
INCLUDE "gbhw.asm"
INCLUDE "hram.asm"
INCLUDE "main.tx"

View File

@ -128,7 +128,7 @@ VBlank0: ; 2b1
jr nz, .vblankoccurred
; update oam by dma transfer
call $ff80
call hPushOAM
; 403f:
; ld a, $c4
; ld [rDMA], a
@ -230,7 +230,7 @@ VBlank1: ; 337
call UpdateBGMap
call LoadTiles
; update oam by dma transfer
call $ff80
call hPushOAM
; 403f:
; ld a, $c4
; ld [rDMA], a
@ -339,7 +339,7 @@ VBlank3: ; 396
call LoadTiles
; update oam by dma transfer
call $ff80
call hPushOAM
; 403f:
; ld a, $c4 ; Sprites / $100
; ld [rDMA], a
@ -411,7 +411,7 @@ VBlank4: ; 3df
call SafeLoadTiles
; update oam by dma transfer
call $ff80
call hPushOAM
; 403f:
; ld a, $c4
; ld [rDMA], a