You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-09-08 08:13:02 -07:00
Merge pull request #124 from yenatch/master
hram labels + png make target
This commit is contained in:
10
Makefile
10
Makefile
@@ -44,15 +44,15 @@ pokecrystal.gbc: pokecrystal.o
|
|||||||
lzs: ${VERTGFX} ${HORIZGFX}
|
lzs: ${VERTGFX} ${HORIZGFX}
|
||||||
|
|
||||||
pngs:
|
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
|
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:
|
tiles.png:
|
||||||
cd extras; python gfx.py png-to-2bpp $@
|
cd extras && python gfx.py png-to-2bpp $@
|
||||||
.png: ${VERTGFX}
|
.png: ${VERTGFX}
|
||||||
cd extras; python gfx.py png-to-lz --vert $@
|
cd extras && python gfx.py png-to-lz --vert $@
|
||||||
.png: ${HORIZGFX}
|
.png: ${HORIZGFX}
|
||||||
cd extras; python gfx.py png-to-lz $@
|
cd extras && python gfx.py png-to-lz $@
|
||||||
|
|
||||||
|
@@ -1436,8 +1436,8 @@ def mass_to_colored_png(debug=False):
|
|||||||
for name in files:
|
for name in files:
|
||||||
if debug: print os.path.splitext(name), os.path.join(root, name)
|
if debug: print os.path.splitext(name), os.path.join(root, name)
|
||||||
if os.path.splitext(name)[1] == '.2bpp':
|
if os.path.splitext(name)[1] == '.2bpp':
|
||||||
if name[:5]+'.pal' in files:
|
if os.path.splitext(name)[0]+'.pal' in files:
|
||||||
to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
|
to_png(os.path.join(root, name), None, os.path.join(root, os.path.splitext(name)[0]+'.pal'))
|
||||||
else:
|
else:
|
||||||
to_png(os.path.join(root, name))
|
to_png(os.path.join(root, name))
|
||||||
|
|
||||||
@@ -1459,26 +1459,26 @@ def mass_to_colored_png(debug=False):
|
|||||||
|
|
||||||
def mass_decompress(debug=False):
|
def mass_decompress(debug=False):
|
||||||
for root, dirs, files in os.walk('../gfx/'):
|
for root, dirs, files in os.walk('../gfx/'):
|
||||||
for file in files:
|
for name in files:
|
||||||
if 'lz' in file:
|
if 'lz' in name:
|
||||||
if '/pics' in root:
|
if '/pics' in root:
|
||||||
if 'front' in file:
|
if 'front' in name:
|
||||||
id = root.split('pics/')[1][:3]
|
id = root.split('pics/')[1][:3]
|
||||||
if id != 'egg':
|
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:
|
else:
|
||||||
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
|
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
|
||||||
to_file(root+'/'+'front.2bpp', de.pic)
|
to_file(os.path.join(root, 'front.2bpp'), de.pic)
|
||||||
to_file(root+'/'+'tiles.2bpp', de.animtiles)
|
to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles)
|
||||||
elif 'back' in file:
|
elif 'back' in name:
|
||||||
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
|
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
|
||||||
to_file(root+'/'+'back.2bpp', de.output)
|
to_file(os.path.join(root, 'back.2bpp'), de.output)
|
||||||
elif '/trainers' in root or '/fx' in root:
|
elif '/trainers' in root or '/fx' in root:
|
||||||
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
|
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
|
||||||
to_file(root+'/'+file[:-3]+'.2bpp', de.output)
|
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
|
||||||
else:
|
else:
|
||||||
with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read())
|
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read())
|
||||||
to_file(root+file[:-3]+'.2bpp', de.output)
|
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
|
||||||
|
|
||||||
def append_terminator_to_lzs(directory):
|
def append_terminator_to_lzs(directory):
|
||||||
# fix lzs that were extracted with a missing terminator
|
# fix lzs that were extracted with a missing terminator
|
||||||
|
50
hram.asm
Normal file
50
hram.asm
Normal 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
|
||||||
|
|
54
joypad.asm
54
joypad.asm
@@ -9,9 +9,9 @@ JoypadInt: ; 92e
|
|||||||
ClearJoypadPublic: ; 92f
|
ClearJoypadPublic: ; 92f
|
||||||
xor a
|
xor a
|
||||||
; Pressed this frame (delta)
|
; Pressed this frame (delta)
|
||||||
ld [$ffa7], a
|
ld [hJoyPressed], a
|
||||||
; Currently pressed
|
; Currently pressed
|
||||||
ld [$ffa8], a
|
ld [hJoyDown], a
|
||||||
ret
|
ret
|
||||||
; 935
|
; 935
|
||||||
|
|
||||||
@@ -22,10 +22,10 @@ Joypad: ; 935
|
|||||||
|
|
||||||
; Updates:
|
; Updates:
|
||||||
|
|
||||||
; $ffa2: released this frame (delta)
|
; hJoypadReleased: released this frame (delta)
|
||||||
; $ffa3: pressed this frame (delta)
|
; hJoypadPressed: pressed this frame (delta)
|
||||||
; $ffa4: currently pressed
|
; hJoypadDown: currently pressed
|
||||||
; $ffa5: pressed so far
|
; hJoypadSum: pressed so far
|
||||||
|
|
||||||
; Any of these three bits can be used to disable input.
|
; Any of these three bits can be used to disable input.
|
||||||
ld a, [$cfbe]
|
ld a, [$cfbe]
|
||||||
@@ -76,27 +76,27 @@ Joypad: ; 935
|
|||||||
ld [rJOYP], a
|
ld [rJOYP], a
|
||||||
|
|
||||||
; To get the delta we xor the last frame's input with the new one.
|
; 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
|
ld e, a
|
||||||
xor b
|
xor b
|
||||||
ld d, a
|
ld d, a
|
||||||
; Released this frame:
|
; Released this frame:
|
||||||
and e
|
and e
|
||||||
ld [$ffa2], a
|
ld [hJoypadReleased], a
|
||||||
; Pressed this frame:
|
; Pressed this frame:
|
||||||
ld a, d
|
ld a, d
|
||||||
and b
|
and b
|
||||||
ld [$ffa3], a
|
ld [hJoypadPressed], a
|
||||||
|
|
||||||
; Add any new presses to the list of collective presses:
|
; Add any new presses to the list of collective presses:
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [$ffa5]
|
ld a, [hJoypadSum]
|
||||||
or c
|
or c
|
||||||
ld [$ffa5], a
|
ld [hJoypadSum], a
|
||||||
|
|
||||||
; Currently pressed:
|
; Currently pressed:
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa4], a
|
ld [hJoypadDown], a
|
||||||
|
|
||||||
; Now that we have the input, we can do stuff with it.
|
; Now that we have the input, we can do stuff with it.
|
||||||
|
|
||||||
@@ -110,11 +110,11 @@ Joypad: ; 935
|
|||||||
|
|
||||||
|
|
||||||
GetJoypadPublic: ; 984
|
GetJoypadPublic: ; 984
|
||||||
; Update mirror joypad input from $ffa4 (real input)
|
; Update mirror joypad input from hJoypadDown (real input)
|
||||||
|
|
||||||
; $ffa6: released this frame (delta)
|
; hJoyReleased: released this frame (delta)
|
||||||
; $ffa7: pressed this frame (delta)
|
; hJoyPressed: pressed this frame (delta)
|
||||||
; $ffa8: currently pressed
|
; hJoyDown: currently pressed
|
||||||
|
|
||||||
; bit 0 A
|
; bit 0 A
|
||||||
; 1 B
|
; 1 B
|
||||||
@@ -137,28 +137,28 @@ GetJoypadPublic: ; 984
|
|||||||
jr z, .auto
|
jr z, .auto
|
||||||
|
|
||||||
; To get deltas, take this and last frame's input.
|
; To get deltas, take this and last frame's input.
|
||||||
ld a, [$ffa4] ; real input
|
ld a, [hJoypadDown] ; real input
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [$ffa8] ; last frame mirror
|
ld a, [hJoyDown] ; last frame mirror
|
||||||
ld e, a
|
ld e, a
|
||||||
|
|
||||||
; Released this frame:
|
; Released this frame:
|
||||||
xor b
|
xor b
|
||||||
ld d, a
|
ld d, a
|
||||||
and e
|
and e
|
||||||
ld [$ffa6], a
|
ld [hJoyReleased], a
|
||||||
|
|
||||||
; Pressed this frame:
|
; Pressed this frame:
|
||||||
ld a, d
|
ld a, d
|
||||||
and b
|
and b
|
||||||
ld [$ffa7], a
|
ld [hJoyPressed], a
|
||||||
|
|
||||||
; It looks like the collective presses got commented out here.
|
; It looks like the collective presses got commented out here.
|
||||||
ld c, a
|
ld c, a
|
||||||
|
|
||||||
; Currently pressed:
|
; Currently pressed:
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa8], a ; frame input
|
ld [hJoyDown], a ; frame input
|
||||||
|
|
||||||
.quit
|
.quit
|
||||||
pop bc
|
pop bc
|
||||||
@@ -174,7 +174,7 @@ GetJoypadPublic: ; 984
|
|||||||
; A value of $ff will immediately end the stream.
|
; A value of $ff will immediately end the stream.
|
||||||
|
|
||||||
; Read from the input stream.
|
; Read from the input stream.
|
||||||
ld a, [$ff9d]
|
ld a, [hROMBank]
|
||||||
push af
|
push af
|
||||||
ld a, [AutoInputBank]
|
ld a, [AutoInputBank]
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
@@ -232,8 +232,8 @@ GetJoypadPublic: ; 984
|
|||||||
pop af
|
pop af
|
||||||
rst Bankswitch
|
rst Bankswitch
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [$ffa7], a ; pressed
|
ld [hJoyPressed], a ; pressed
|
||||||
ld [$ffa8], a ; input
|
ld [hJoyDown], a ; input
|
||||||
jr .quit
|
jr .quit
|
||||||
; 9ee
|
; 9ee
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ StartAutoInput: ; 9ee
|
|||||||
ld [AutoInputLength], a
|
ld [AutoInputLength], a
|
||||||
; Reset input mirrors.
|
; Reset input mirrors.
|
||||||
xor a
|
xor a
|
||||||
ld [$ffa7], a ; pressed this frame
|
ld [hJoyPressed], a ; pressed this frame
|
||||||
ld [$ffa6], a ; released this frame
|
ld [hJoyReleased], a ; released this frame
|
||||||
ld [$ffa8], a ; currently pressed
|
ld [hJoyDown], a ; currently pressed
|
||||||
|
|
||||||
ld a, AUTO_INPUT
|
ld a, AUTO_INPUT
|
||||||
ld [InputType], a
|
ld [InputType], a
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
INCLUDE "wram.asm"
|
INCLUDE "wram.asm"
|
||||||
INCLUDE "constants.asm"
|
INCLUDE "constants.asm"
|
||||||
INCLUDE "gbhw.asm"
|
INCLUDE "gbhw.asm"
|
||||||
|
INCLUDE "hram.asm"
|
||||||
INCLUDE "main.tx"
|
INCLUDE "main.tx"
|
||||||
|
@@ -128,7 +128,7 @@ VBlank0: ; 2b1
|
|||||||
jr nz, .vblankoccurred
|
jr nz, .vblankoccurred
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -230,7 +230,7 @@ VBlank1: ; 337
|
|||||||
call UpdateBGMap
|
call UpdateBGMap
|
||||||
call LoadTiles
|
call LoadTiles
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -339,7 +339,7 @@ VBlank3: ; 396
|
|||||||
call LoadTiles
|
call LoadTiles
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4 ; Sprites / $100
|
; ld a, $c4 ; Sprites / $100
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
@@ -411,7 +411,7 @@ VBlank4: ; 3df
|
|||||||
call SafeLoadTiles
|
call SafeLoadTiles
|
||||||
|
|
||||||
; update oam by dma transfer
|
; update oam by dma transfer
|
||||||
call $ff80
|
call hPushOAM
|
||||||
; 403f:
|
; 403f:
|
||||||
; ld a, $c4
|
; ld a, $c4
|
||||||
; ld [rDMA], a
|
; ld [rDMA], a
|
||||||
|
Reference in New Issue
Block a user