Source code for Jirachi and Celebi tower fixes.

Celebis source code is actually significantly different and way better organized, so I uploaded this as well.
This commit is contained in:
notblisy 2024-12-28 19:43:07 -05:00 committed by GitHub
parent 7ff3c12bae
commit 90ede960ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
79 changed files with 1966 additions and 0 deletions

View File

@ -0,0 +1,174 @@
INCLUDE "../macros.asm"
SECTION "eonticket",ROM0[$100]
jp Start
db $00
TicketSprite: ; 104
INCBIN "celebis.bin"
TicketPalette: ; 1604
INCBIN "celebispal.bin"
Prologue:
INCBIN "prologue-{REGION_NAME}.bin"
DataPacket: ; 164a
INCBIN "eonticket-{REGION_NAME}.mev"
db 0,0,0 ; padding
INCLUDE "../common/mem_struct.asm"
SpriteData:
dw TicketSprite,TicketPalette
db $07,$07,$01,$01,$01,$01,$01 ; 64 x 64 size
Instructions1: ; 1921
db "Link e-Reader to Pokémon Emerald\n"
db "and use MYSTERY EVENTS by talking\n"
db "to the MYSTERY GIFT MAN\n"
db "Press the B Button to cancel.\0"
Instructions2: ; 199d
db "Press the A Button on the Game Boy\n"
db "Advance containing Pokémon Emerald\n"
db "to begin sending the UNLOCKED\n"
db "CELEBI EVENT.\0"
DeliveryInProcess: ; 1a0d
db "UNLOCKED EVENT delivery in Progress\0"
TicketDelivered: ; 1a2f
db "UNLOCKED CELEBI EVENT delivered!\n"
db "\n"
db "Press the A Button to resend.\n"
db "Press the B Button to cancel.\0"
; this function is subtly different than the one
; on the Battle e cards, for no apparent reason
TransferData:
LD_IND_HL SomeVar1
push de
ld hl, $bbbb
LD_IND_HL Space_1
EX_DE_HL
LD_IND_HL Space_2
API_0C7 Space_1
wait $01
pop hl
inc hl
ld b, $01
call WordShiftRight
LD_IND_HL SomeVar2
.asm_1aa1
LD_HL_IND SomeVar2
ld a, l
or h
ret z
ld hl, $8888
LD_IND_HL Space_1
ld e, $01
.asm_1aaf
ld a, e
cp $08
jr nc, .asm_1ad9
push de
LD_HL_IND SomeVar1
ld c, [hl]
inc hl
ld b, [hl]
inc hl
LD_IND_HL SomeVar1
ld l, e
ld h, $00
add hl, hl
ld de, Space_1
add hl, de
ld [hl], c
inc hl
ld [hl], b
pop de
LD_HL_IND SomeVar2
dec hl
LD_IND_HL SomeVar2
ld a, l
or h
jr z, .asm_1ad9
inc e
jr .asm_1aaf
.asm_1ad9
API_0C7 Space_1
wait $01
jr .asm_1aa1
Start: ; 1ae2
API_121
CreateCustomSprite SpriteHandlePtr, $80, SpriteData
SetSpritePos SpriteHandlePtr, 120, 64
SpriteHide SpriteHandlePtr
CreateRegion RegionHandlePtr, 30, 6, 0, 14, 0, 4
ld h, a
ld l, $00
SetTextSize
API_09B RegionHandlePtr, $0102
SetTextColor RegionHandlePtr, 2, 0
SetRegionColor RegionHandlePtr, 0
SetBackgroundPalette 16, $0040, TicketPalette
FadeIn 16
wait 16
API $0C6
DrawText RegionHandlePtr, Instructions1, 8, 4
API $08D
INCLUDE "../common/wait_for_link.asm"
SpriteShow SpriteHandlePtr
DrawText RegionHandlePtr, Instructions2, 8, 4
API $08D
ld a, b
nop
UNKNOWN_VALUE EQU $0078
INCLUDE "../common/wait_for_ready.asm"
DrawText RegionHandlePtr, DeliveryInProcess, 8, 4
DATA_TRANSFER_LENGTH EQU 6144
INCLUDE "../common/transfer_data.asm"
ld hl, $5fff
LD_IND_HL Space_1
API_0C7 Space_1
wait $80
SpriteHide SpriteHandlePtr
DrawText RegionHandlePtr, TicketDelivered, 8, 4
API $08D
ld c, a
nop
INCLUDE "../common/wrap_up.asm"
INCLUDE "../common/word_shift_right.asm"
SomeVar1: ; 1CA2
db $FF,0 ; mark EOF
RegionHandlePtr: db 0 ; 1CA4
SpriteHandlePtr: db 0,0 ; 1CA5
SomeVar2: db 0,0 ; 1CA7

Binary file not shown.

View File

@ -0,0 +1,40 @@
all: 00-C000-EN.raw verify
verify:
md5sum --check eonticket.md5
eonticket-%.tx: eonticket.asm
python ../scripts/regionalize.py $< $@ $* $*
eonticket-%.o: eonticket-%.tx
./rgbasm -o $@ $<
eonticket-%.gbc: eonticket-%.o
./rgblink -o $@ $<
eonticket-%.bin: eonticket-%.gbc
python ../scripts/stripgbc.py $< $@
eonticket-%.mev: eonticket-%.bin
python ../scripts/checksum.py $< $@
prologue-%.tx: prologue.asm
python ../scripts/regionalize.py $< $@ $* $*
prologue-%.o: prologue-%.tx
./rgbasm -o $@ $<
prologue-%.gbc: prologue-%.o
./rgblink -o $@ $<
prologue-%.bin: prologue-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.tx: 00-C000.asm eonticket-%.mev prologue-%.bin
python ../scripts/ereadertext.py $< $@ $*
00-C000-%.o: 00-C000-%.tx
./rgbasm -o $@ $<
00-C000-%.gbc: 00-C000-%.o
./rgblink -o $@ $<
00-C000-%.z80: 00-C000-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.vpk: 00-C000-%.z80
./nevpk -c -i $< -o $@
00-C000-%.raw: 00-C000-%.vpk
./nedcmake -i $< -o $@ -type 1 -region 1
clean:
rm -f *.tx *.o *.gbc *.z80 *.bin *.mev *.vpk *.raw

View File

@ -0,0 +1 @@
_F9W˙ýk¸SO;č"$˙µîr'f€Y|Ö^ÍA

View File

@ -0,0 +1,3 @@
Start:
PUSH {LR}
PUSH {r0-r7}

Binary file not shown.

View File

@ -0,0 +1,152 @@
Start:
PUSH {LR}
PUSH {r0-r7}
ColoRNGAlgo:
ldr r2, gRNGValue
ldr r1, [r2]
ldr r0, TempCelebiLocation
ldr r3, ColoMult
ldr r4, ColoAdd
mul r1, r3 @Colo RNG for IV1
add r1, r4
lsl r2, r1, #1 @bitshift and stores result into r0
lsr r2, r2, #17
mul r1, r3 @Colo RNG for IV2
add r1, r4
lsl r5, r1, #1
lsr r5, r5, #17
lsl r5, r5, #15
ORR r2, r5
str r2, [r0, #72] @combine and store IVs into Pokemon
mul r1, r3 @Blank RNG for ability
add r1, r4
ldr r6, CelebiOTID
SHINYLOCKSTART:
mul r1, r3 @RNG for PID1
add r1, r4
lsr r2, r1, #16
mul r1, r3 @RNG for PID2
add r1, r4
lsr r5, r1, #16
EOR r6, r2
EOR r6, r5
cmp r6, #7
bls SHINYLOCKSTART @comment this out to remove shinylock
strh r2, [r0, #2] @Store PID in proper spot.
strh r5, [r0, #0]
MemoryCopyCelebi:
ldr r1, gEnemyParty
ldr r2, UnencryptedCopyLengthInfo
SWI 11
ldr r0, TempCelebiLocation
ldr r5, SubstructureTable
ldr r0, [r0]
mov r1, #24
mov r7, r0
swi #06
mov r0, r7
cmp r0, #0
bpl EndCorrectionMath
add r1, #16
cmp r1, #0
bpl EndCorrectionMath
add r1, #24
EndCorrectionMath:
add r5, r1
ldrb r6, [r5]
ldr r0, TempCelebiLocation
mov r7, #3 @loop counter setup
mov r4, #12
mov r5, #3
add r0, #32 @Substructure start location for TempCelebiLocation
SubstructureCopyLoop:
ldr r1, gEnemyParty @destination of substructures
add r1, #32 @adding 32 to make substructure enemy ram celebi gEnemyParty
ldr r2, SubstructureCopyLengthInfo
mov r3, r6
and r3, r5
mul r3, r4
add r1, r3
swi #11
lsr r6, #2
sub r7, #1
bpl SubstructureCopyLoop
lsl r0, r0, #0
FixCelebi:
mov r4, pc
add r4, #9
mov lr, r4
ldr r0, gEnemyParty
ldr r3, CalculateBoxMonChecksum
bx r3
ldr r1, gEnemyParty
strh r0, [r1, #28]
mov r4, pc
add r4, #9
mov lr, r4
mov r0, r1
ldr r3, EncryptBoxMon
bx r3
mov r4, pc
add r4, #9
mov lr, r4
ldr r0, gEnemyParty
ldr r3, CalculateMonStats
bx r3
ldr r0, gEnemyParty
ldr r1, TempCelebiLocation
ldr r2, UnencryptedCopyLengthInfo
add r2, #12
swi #11
pop {r0-r7, pc}
CaptureCelebi:
PUSH {LR}
PUSH {r0-r7}
ldr r0, TempCelebiLocation @Copy entire celebi over pre-battle
ldr r1, gPlayerParty
ldr r2, UnencryptedCopyLengthInfo
add r2, #12
mov r6, #100 @this section figures out party position
ldr r3, gSpecialVar_0x800B @party size stored in special var, times 100
ldrb r7, [r3] @add result to destination
mul r7, r6
add r1, r7
swi #11
ldr r0, gEnemyParty @this copies stuff to keep nickname
ldr r1, gPlayerParty
mov r2, #5
add r1, r7
add r0, #8
add r1, #8
swi #11
pop {r0-r7, pc}
.align
gRNGValue:
.long 0x03005d80
ColoMult:
.long 0x000343FD
ColoAdd:
.long 0x00269EC3
TempCelebiLocation:
.long 0x0203ABE0
SubstructureTable:
.long 0x0203AC30 @Change Later
gPlayerParty:
.long 0x020244ec
gEnemyParty:
.long 0x02024744
UnencryptedCopyLengthInfo:
.long 0x04000008
SubstructureCopyLengthInfo:
.long 0x04000003
CalculateBoxMonChecksum:
.long 0x08068c79
EncryptBoxMon:
.long 0x0806a229
CalculateMonStats:
.long 0x08068d0d
CelebiOTID:
.long 0x00007991
gSpecialVar_0x800B:
.long 0x020375ee @Player Party Size

Binary file not shown.

View File

@ -0,0 +1,213 @@
INCLUDE "../macros.asm"
INCLUDE "../constants/items.asm"
INCLUDE "../constants/scriptcommandscelebinotowerUnlocked.asm"
Mystery_Event
db CHECKSUM_CRC
dd 0 ; checksum placeholder
GBAPTR DataStart
GBAPTR DataEnd
DataStart:
db IN_GAME_SCRIPT
db 24,11 ; petalburg gym
db 2 ; norman
GBAPTR NormanScriptStart
GBAPTR NormanScriptEnd
db PRELOAD_SCRIPT
GBAPTR PreloadScriptStart
db END_OF_CHUNKS
PreloadScriptStart:
setvirtualaddress PreloadScriptStart
callasm $0201C045
virtualloadpointer GoSeeYourFather
setbyte 2
dw $0000
end
WriteFlashMemory
CelebiScriptStart:
setvirtualaddress CelebiScriptStart
db $00
dw $0000
virtualmsgbox Poor
waitmsg
db $6E, $17, $8
release
compare LASTRESULT, 0
virtualgotoif 1, Changemind
virtualgotoif 5, CelebiEvent
db $00
TEMPCELEBI
STRUCTURETABLECOMPRESSED
LOADSTOREPARTYAMOUNT
CelebiRNGAlgo2
CelebiEvent:
db $43
compare LASTRESULT, 5
virtualgotoif 2, NoRoom
copyvar $800B, $800D
setwildbattle $F4, $30, $00
callasm $0203AC5D ;Colo RNG
special $13F
sound $13
waitstate
playmoncry $FB, $0
virtualmsgbox Celebi
waitmsg
waitmoncry
waitkeypress
release
special $145
playsong $0166, $0
waitmoncry
waitstate
db $43
comparevar LASTRESULT, $800B
virtualgotoif 3, FlewAway
virtualgotoif 2, Catch
Catch:
callasm $0203AD19
killscript
NoRoom:
virtualmsgbox NoSpace
waitmsg
waitkeypress
release
end
Changemind:
virtualmsgbox Change
waitmsg
waitkeypress
release
end
NoRoomToGive:
virtualloadpointer PartyFull
setbyte 3
killscript
FlewAway:
db $97, $01
db $97, $00
virtualmsgbox Flew
waitmsg
waitkeypress
release
end
PartyFull:
Text_EN "You need space in your party\n"
Text_EN "to play this MYSTERY EVENT!@"
Poor:
Text_EN "A Pokemon is rustling around\n"
Text_EN "in this tree.\p"
Text_EN "Would you like to investigate?@"
Change:
Text_EN "Maybe another time.@"
Flew:
Text_EN "The CELEBI flew away!@"
NoSpace:
Text_EN "You need space in your party\n"
Text_EN "to capture CELEBI!@"
Celebi:
Text_EN "CELEBI: Biyoo!@"
GoSeeYourFather:
Text_EN "A bright flash was seen in\n"
Text_EN "PETALBURG WOODS!\p"
Text_EN "Ever since, a rare Pokemon has\n"
Text_EN "been seen healing thin trees.@"
NormanScriptStart:
writebytetoaddr $1E, $2024744
writebytetoaddr $20, $2024745
writebytetoaddr $01, $2024746
writebytetoaddr $49, $2024747
writebytetoaddr $01, $2024748
writebytetoaddr $4B, $2024749
writebytetoaddr $18, $202474A
writebytetoaddr $47, $202474B
writebytetoaddr $BC, $202474C
writebytetoaddr $AB, $202474D
writebytetoaddr $03, $202474E
writebytetoaddr $02, $202474F
writebytetoaddr $4D, $2024750
writebytetoaddr $31, $2024751
writebytetoaddr $15, $2024752
writebytetoaddr $08, $2024753
callasm $02024745 ;readflash
goto $0203abbc
NormanScriptEnd:
DataEnd:
EOF

View File

@ -0,0 +1 @@
901180e44767e19e5dc9d5df881fe123 00-C000-EN.z80

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
9.º5&¿BNW<4E>N‡-*!sB1d»qÏ)kÿc

View File

@ -0,0 +1,15 @@
INCLUDE "../macros.asm"
SECTION "prologue", ROM0[$100]
db "GameFreak inc."
db 0,0,0,0,0,0
dd 0
Text "e reader" ; no string terminator
db 0,0,0,0,$01,$55
db 0,0,0,0
db REGION
db 0
db "GameFreak inc."
db 0,0
EOF

Binary file not shown.

View File

@ -0,0 +1,11 @@
Start:
mov r0, #30
ldr r1, gSaveDataBuffer
ldr r3, ReadFlashSector
bx r3
.align
gSaveDataBuffer:
.long 0x0203abbc
ReadFlashSector:
.long 0x0815314d

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
9Wÿs¿s?c<>N»Aõ ÿwwM/É"ElÖ^ÍAÆ

View File

@ -0,0 +1,11 @@
Start:
mov r0, #30
ldr r1, WRAMLocation
ldr r2, TryWriteSector
bx r2
.align
WRAMLocation:
.long 0x0200005C
TryWriteSector:
.long 0x08152909

View File

@ -0,0 +1,174 @@
INCLUDE "../macros.asm"
SECTION "eonticket",ROM0[$100]
jp Start
db $00
TicketSprite: ; 104
INCBIN "Spr_3r_251.img.bin"
TicketPalette: ; 1604
INCBIN "Spr_3r_251.pal.bin"
Prologue:
INCBIN "prologue-{REGION_NAME}.bin"
DataPacket: ; 164a
INCBIN "eonticket-{REGION_NAME}.mev"
db 0,0,0 ; padding
INCLUDE "../common/mem_struct.asm"
SpriteData:
dw TicketSprite,TicketPalette
db $07,$07,$01,$01,$01,$01,$01 ; 64 x 64 size
Instructions1: ; 1921
db "Link e-Reader to Pokémon Emerald\n"
db "and use MYSTERY EVENTS by talking\n"
db "to the MYSTERY GIFT MAN\n"
db "Press the B Button to cancel.\0"
Instructions2: ; 199d
db "Press the A Button on the Game Boy\n"
db "Advance containing Pokémon Emerald\n"
db "to begin sending the UNLOCKED\n"
db "CELEBI EVENT.\0"
DeliveryInProcess: ; 1a0d
db "UNLOCKED EVENT delivery in Progress\0"
TicketDelivered: ; 1a2f
db "UNLOCKED CELEBI EVENT delivered!\n"
db "\n"
db "Press the A Button to resend.\n"
db "Press the B Button to cancel.\0"
; this function is subtly different than the one
; on the Battle e cards, for no apparent reason
TransferData:
LD_IND_HL SomeVar1
push de
ld hl, $bbbb
LD_IND_HL Space_1
EX_DE_HL
LD_IND_HL Space_2
API_0C7 Space_1
wait $01
pop hl
inc hl
ld b, $01
call WordShiftRight
LD_IND_HL SomeVar2
.asm_1aa1
LD_HL_IND SomeVar2
ld a, l
or h
ret z
ld hl, $8888
LD_IND_HL Space_1
ld e, $01
.asm_1aaf
ld a, e
cp $08
jr nc, .asm_1ad9
push de
LD_HL_IND SomeVar1
ld c, [hl]
inc hl
ld b, [hl]
inc hl
LD_IND_HL SomeVar1
ld l, e
ld h, $00
add hl, hl
ld de, Space_1
add hl, de
ld [hl], c
inc hl
ld [hl], b
pop de
LD_HL_IND SomeVar2
dec hl
LD_IND_HL SomeVar2
ld a, l
or h
jr z, .asm_1ad9
inc e
jr .asm_1aaf
.asm_1ad9
API_0C7 Space_1
wait $01
jr .asm_1aa1
Start: ; 1ae2
API_121
CreateCustomSprite SpriteHandlePtr, $80, SpriteData
SetSpritePos SpriteHandlePtr, 120, 64
SpriteHide SpriteHandlePtr
CreateRegion RegionHandlePtr, 30, 6, 0, 14, 0, 4
ld h, a
ld l, $00
SetTextSize
API_09B RegionHandlePtr, $0102
SetTextColor RegionHandlePtr, 2, 0
SetRegionColor RegionHandlePtr, 0
SetBackgroundPalette 16, $0040, TicketPalette
FadeIn 16
wait 16
API $0C6
DrawText RegionHandlePtr, Instructions1, 8, 4
API $08D
INCLUDE "../common/wait_for_link.asm"
SpriteShow SpriteHandlePtr
DrawText RegionHandlePtr, Instructions2, 8, 4
API $08D
ld a, b
nop
UNKNOWN_VALUE EQU $0078
INCLUDE "../common/wait_for_ready.asm"
DrawText RegionHandlePtr, DeliveryInProcess, 8, 4
DATA_TRANSFER_LENGTH EQU 6144
INCLUDE "../common/transfer_data.asm"
ld hl, $5fff
LD_IND_HL Space_1
API_0C7 Space_1
wait $80
SpriteHide SpriteHandlePtr
DrawText RegionHandlePtr, TicketDelivered, 8, 4
API $08D
ld c, a
nop
INCLUDE "../common/wrap_up.asm"
INCLUDE "../common/word_shift_right.asm"
SomeVar1: ; 1CA2
db $FF,0 ; mark EOF
RegionHandlePtr: db 0 ; 1CA4
SpriteHandlePtr: db 0,0 ; 1CA5
SomeVar2: db 0,0 ; 1CA7

Binary file not shown.

View File

@ -0,0 +1,40 @@
all: 00-C000-EN.raw verify
verify:
md5sum --check eonticket.md5
eonticket-%.tx: eonticket.asm
python ../scripts/regionalize.py $< $@ $* $*
eonticket-%.o: eonticket-%.tx
./rgbasm -o $@ $<
eonticket-%.gbc: eonticket-%.o
./rgblink -o $@ $<
eonticket-%.bin: eonticket-%.gbc
python ../scripts/stripgbc.py $< $@
eonticket-%.mev: eonticket-%.bin
python ../scripts/checksum.py $< $@
prologue-%.tx: prologue.asm
python ../scripts/regionalize.py $< $@ $* $*
prologue-%.o: prologue-%.tx
./rgbasm -o $@ $<
prologue-%.gbc: prologue-%.o
./rgblink -o $@ $<
prologue-%.bin: prologue-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.tx: 00-C000.asm eonticket-%.mev prologue-%.bin
python ../scripts/ereadertext.py $< $@ $*
00-C000-%.o: 00-C000-%.tx
./rgbasm -o $@ $<
00-C000-%.gbc: 00-C000-%.o
./rgblink -o $@ $<
00-C000-%.z80: 00-C000-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.vpk: 00-C000-%.z80
./nevpk -c -i $< -o $@
00-C000-%.raw: 00-C000-%.vpk
./nedcmake -i $< -o $@ -type 1 -region 1
clean:
rm -f *.tx *.o *.gbc *.z80 *.bin *.mev *.vpk *.raw

Binary file not shown.

View File

@ -0,0 +1 @@
_F9W˙ýk¸SO;č"$˙µîr'f€Y|Ö^ÍA

Binary file not shown.

View File

@ -0,0 +1,3 @@
Start:
PUSH {LR}
PUSH {r0-r7}

Binary file not shown.

View File

@ -0,0 +1,152 @@
Start:
PUSH {LR}
PUSH {r0-r7}
ColoRNGAlgo:
ldr r2, gRNGValue
ldr r1, [r2]
ldr r0, TempCelebiLocation
ldr r3, ColoMult
ldr r4, ColoAdd
mul r1, r3 @Colo RNG for IV1
add r1, r4
lsl r2, r1, #1 @bitshift and stores result into r0
lsr r2, r2, #17
mul r1, r3 @Colo RNG for IV2
add r1, r4
lsl r5, r1, #1
lsr r5, r5, #17
lsl r5, r5, #15
ORR r2, r5
str r2, [r0, #72] @combine and store IVs into Pokemon
mul r1, r3 @Blank RNG for ability
add r1, r4
ldr r6, CelebiOTID
SHINYLOCKSTART:
mul r1, r3 @RNG for PID1
add r1, r4
lsr r2, r1, #16
mul r1, r3 @RNG for PID2
add r1, r4
lsr r5, r1, #16
EOR r6, r2
EOR r6, r5
cmp r6, #7
bls SHINYLOCKSTART @comment this out to remove shinylock
strh r2, [r0, #2] @Store PID in proper spot.
strh r5, [r0, #0]
MemoryCopyCelebi:
ldr r1, gEnemyParty
ldr r2, UnencryptedCopyLengthInfo
SWI 11
ldr r0, TempCelebiLocation
ldr r5, SubstructureTable
ldr r0, [r0]
mov r1, #24
mov r7, r0
swi #06
mov r0, r7
cmp r0, #0
bpl EndCorrectionMath
add r1, #16
cmp r1, #0
bpl EndCorrectionMath
add r1, #24
EndCorrectionMath:
add r5, r1
ldrb r6, [r5]
ldr r0, TempCelebiLocation
mov r7, #3 @loop counter setup
mov r4, #12
mov r5, #3
add r0, #32 @Substructure start location for TempCelebiLocation
SubstructureCopyLoop:
ldr r1, gEnemyParty @destination of substructures
add r1, #32 @adding 32 to make substructure enemy ram celebi gEnemyParty
ldr r2, SubstructureCopyLengthInfo
mov r3, r6
and r3, r5
mul r3, r4
add r1, r3
swi #11
lsr r6, #2
sub r7, #1
bpl SubstructureCopyLoop
lsl r0, r0, #0
FixCelebi:
mov r4, pc
add r4, #9
mov lr, r4
ldr r0, gEnemyParty
ldr r3, CalculateBoxMonChecksum
bx r3
ldr r1, gEnemyParty
strh r0, [r1, #28]
mov r4, pc
add r4, #9
mov lr, r4
mov r0, r1
ldr r3, EncryptBoxMon
bx r3
mov r4, pc
add r4, #9
mov lr, r4
ldr r0, gEnemyParty
ldr r3, CalculateMonStats
bx r3
ldr r0, gEnemyParty
ldr r1, TempCelebiLocation
ldr r2, UnencryptedCopyLengthInfo
add r2, #12
swi #11
pop {r0-r7, pc}
CaptureCelebi:
PUSH {LR}
PUSH {r0-r7}
ldr r0, TempCelebiLocation @Copy entire celebi over pre-battle
ldr r1, gPlayerParty
ldr r2, UnencryptedCopyLengthInfo
add r2, #12
mov r6, #100 @this section figures out party position
ldr r3, gSpecialVar_0x800B @party size stored in special var, times 100
ldrb r7, [r3] @add result to destination
mul r7, r6
add r1, r7
swi #11
ldr r0, gEnemyParty @this copies stuff to keep nickname
ldr r1, gPlayerParty
mov r2, #5
add r1, r7
add r0, #8
add r1, #8
swi #11
pop {r0-r7, pc}
.align
gRNGValue:
.long 0x03005d80
ColoMult:
.long 0x000343FD
ColoAdd:
.long 0x00269EC3
TempCelebiLocation:
.long 0x0203ABE0
SubstructureTable:
.long 0x0203AC30 @Change Later
gPlayerParty:
.long 0x020244ec
gEnemyParty:
.long 0x02024744
UnencryptedCopyLengthInfo:
.long 0x04000008
SubstructureCopyLengthInfo:
.long 0x04000003
CalculateBoxMonChecksum:
.long 0x08068c79
EncryptBoxMon:
.long 0x0806a229
CalculateMonStats:
.long 0x08068d0d
CelebiOTID:
.long 0x00007991
gSpecialVar_0x800B:
.long 0x020375ee @Player Party Size

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,213 @@
INCLUDE "../macros.asm"
INCLUDE "../constants/items.asm"
INCLUDE "../constants/scriptcommandscelebinotower.asm"
Mystery_Event
db CHECKSUM_CRC
dd 0 ; checksum placeholder
GBAPTR DataStart
GBAPTR DataEnd
DataStart:
db IN_GAME_SCRIPT
db 24,11 ; petalburg gym
db 2 ; norman
GBAPTR NormanScriptStart
GBAPTR NormanScriptEnd
db PRELOAD_SCRIPT
GBAPTR PreloadScriptStart
db END_OF_CHUNKS
PreloadScriptStart:
setvirtualaddress PreloadScriptStart
callasm $0201C045
virtualloadpointer GoSeeYourFather
setbyte 2
dw $0000
end
WriteFlashMemory
CelebiScriptStart:
setvirtualaddress CelebiScriptStart
db $00
dw $0000
virtualmsgbox Poor
waitmsg
db $6E, $17, $8
release
compare LASTRESULT, 0
virtualgotoif 1, Changemind
virtualgotoif 5, CelebiEvent
db $00
TEMPCELEBI
STRUCTURETABLECOMPRESSED
LOADSTOREPARTYAMOUNT
CelebiRNGAlgo2
CelebiEvent:
db $43
compare LASTRESULT, 5
virtualgotoif 2, NoRoom
copyvar $800B, $800D
setwildbattle $F4, $30, $00
callasm $0203AC5D ;Colo RNG
special $13F
sound $13
waitstate
playmoncry $FB, $0
virtualmsgbox Celebi
waitmsg
waitmoncry
waitkeypress
release
special $145
playsong $0166, $0
waitmoncry
waitstate
db $43
comparevar LASTRESULT, $800B
virtualgotoif 3, FlewAway
virtualgotoif 2, Catch
Catch:
callasm $0203AD19
killscript
NoRoom:
virtualmsgbox NoSpace
waitmsg
waitkeypress
release
end
Changemind:
virtualmsgbox Change
waitmsg
waitkeypress
release
end
NoRoomToGive:
virtualloadpointer PartyFull
setbyte 3
killscript
FlewAway:
db $97, $01
db $97, $00
virtualmsgbox Flew
waitmsg
waitkeypress
release
end
PartyFull:
Text_EN "You need space in your party\n"
Text_EN "to play this MYSTERY EVENT!@"
Poor:
Text_EN "A Pokemon is rustling around\n"
Text_EN "in this tree.\p"
Text_EN "Would you like to investigate?@"
Change:
Text_EN "Maybe another time.@"
Flew:
Text_EN "The CELEBI flew away!@"
NoSpace:
Text_EN "You need space in your party\n"
Text_EN "to capture CELEBI!@"
Celebi:
Text_EN "CELEBI: Biyoo!@"
GoSeeYourFather:
Text_EN "A bright flash was seen in\n"
Text_EN "PETALBURG WOODS!\p"
Text_EN "Ever since, a rare Pokemon has\n"
Text_EN "been seen healing thin trees.@"
NormanScriptStart:
writebytetoaddr $1E, $2024744
writebytetoaddr $20, $2024745
writebytetoaddr $01, $2024746
writebytetoaddr $49, $2024747
writebytetoaddr $01, $2024748
writebytetoaddr $4B, $2024749
writebytetoaddr $18, $202474A
writebytetoaddr $47, $202474B
writebytetoaddr $BC, $202474C
writebytetoaddr $AB, $202474D
writebytetoaddr $03, $202474E
writebytetoaddr $02, $202474F
writebytetoaddr $4D, $2024750
writebytetoaddr $31, $2024751
writebytetoaddr $15, $2024752
writebytetoaddr $08, $2024753
callasm $02024745 ;readflash
goto $0203abbc
NormanScriptEnd:
DataEnd:
EOF

View File

@ -0,0 +1 @@
901180e44767e19e5dc9d5df881fe123 00-C000-EN.z80

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
9.º5&¿BNW<4E>N‡-*!sB1d»qÏ)kÿc

View File

@ -0,0 +1,15 @@
INCLUDE "../macros.asm"
SECTION "prologue", ROM0[$100]
db "GameFreak inc."
db 0,0,0,0,0,0
dd 0
Text "e reader" ; no string terminator
db 0,0,0,0,$01,$55
db 0,0,0,0
db REGION
db 0
db "GameFreak inc."
db 0,0
EOF

Binary file not shown.

View File

@ -0,0 +1,11 @@
Start:
mov r0, #30
ldr r1, gSaveDataBuffer
ldr r3, ReadFlashSector
bx r3
.align
gSaveDataBuffer:
.long 0x0203abbc
ReadFlashSector:
.long 0x0815314d

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
9Wÿs¿s?c<>N»Aõ ÿwwM/É"ElÖ^ÍAÆ

Binary file not shown.

View File

@ -0,0 +1,11 @@
Start:
mov r0, #30
ldr r1, WRAMLocation
ldr r2, TryWriteSector
bx r2
.align
WRAMLocation:
.long 0x0200005C
TryWriteSector:
.long 0x08152909

View File

@ -0,0 +1,171 @@
INCLUDE "../macros.asm"
SECTION "eonticket",ROM0[$100]
jp Start
db $00
TicketPalette: ; 1604
INCBIN "jirachi.pal.bin"
Prologue:
INCBIN "prologue-{REGION_NAME}.bin"
DataPacket: ; 164a
INCBIN "eonticket-{REGION_NAME}.mev"
db 0,0,0 ; padding
INCLUDE "../common/mem_struct.asm"
SpriteData:
dw TicketPalette
db $00,$00,$01,$01,$01,$01,$01 ;
Instructions1: ; 1921
db "Link e-Reader to Pokémon Emerald\n"
db "and activate Mystery Event.\n"
db "Press the B Button to cancel.\0"
Instructions2: ; 199d
db "Press the A Button on the Game Boy\n"
db "Advance containing Pokémon Emerald\n"
db "to begin sending the JIRACHI EVENT.\0"
DeliveryInProcess: ; 1a0d
db "JIRACHI EVENT delivery in Progress...\0"
TicketDelivered: ; 1a2f
db "JIRACHI EVENT delivered!\n"
db "\n"
db "Press the A Button to resend.\n"
db "Press the B Button to cancel.\0"
; this function is subtly different than the one
; on the Battle e cards, for no apparent reason
TransferData:
LD_IND_HL SomeVar1
push de
ld hl, $bbbb
LD_IND_HL Space_1
EX_DE_HL
LD_IND_HL Space_2
API_0C7 Space_1
wait $01
pop hl
inc hl
ld b, $01
call WordShiftRight
LD_IND_HL SomeVar2
.asm_1aa1
LD_HL_IND SomeVar2
ld a, l
or h
ret z
ld hl, $8888
LD_IND_HL Space_1
ld e, $01
.asm_1aaf
ld a, e
cp $08
jr nc, .asm_1ad9
push de
LD_HL_IND SomeVar1
ld c, [hl]
inc hl
ld b, [hl]
inc hl
LD_IND_HL SomeVar1
ld l, e
ld h, $00
add hl, hl
ld de, Space_1
add hl, de
ld [hl], c
inc hl
ld [hl], b
pop de
LD_HL_IND SomeVar2
dec hl
LD_IND_HL SomeVar2
ld a, l
or h
jr z, .asm_1ad9
inc e
jr .asm_1aaf
.asm_1ad9
API_0C7 Space_1
wait $01
jr .asm_1aa1
Start: ; 1ae2
API_121
CreateCustomSprite SpriteHandlePtr, $80, SpriteData
SetSpritePos SpriteHandlePtr, 120, 64
SpriteHide SpriteHandlePtr
CreateRegion RegionHandlePtr, 30, 6, 0, 14, 0, 4
ld h, a
ld l, $00
SetTextSize
API_09B RegionHandlePtr, $0102
SetTextColor RegionHandlePtr, 2, 0
SetRegionColor RegionHandlePtr, 0
SetBackgroundPalette 16, $0040, TicketPalette
FadeIn 16
wait 16
API $0C6
DrawText RegionHandlePtr, Instructions1, 8, 4
API $08D
INCLUDE "../common/wait_for_link.asm"
SpriteShow SpriteHandlePtr
DrawText RegionHandlePtr, Instructions2, 8, 4
API $08D
ld a, b
nop
UNKNOWN_VALUE EQU $0078
INCLUDE "../common/wait_for_ready.asm"
DrawText RegionHandlePtr, DeliveryInProcess, 8, 4
DATA_TRANSFER_LENGTH EQU 6144
INCLUDE "../common/transfer_data.asm"
ld hl, $5fff
LD_IND_HL Space_1
API_0C7 Space_1
wait $80
SpriteHide SpriteHandlePtr
DrawText RegionHandlePtr, TicketDelivered, 8, 4
API $08D
ld c, a
nop
INCLUDE "../common/wrap_up.asm"
INCLUDE "../common/word_shift_right.asm"
SomeVar1: ; 1CA2
db $FF,0 ; mark EOF
RegionHandlePtr: db 0 ; 1CA4
SpriteHandlePtr: db 0,0 ; 1CA5
SomeVar2: db 0,0 ; 1CA7

View File

@ -0,0 +1,40 @@
all: 00-C000-EN.raw verify
verify:
md5sum --check eonticket.md5
eonticket-%.tx: eonticket.asm
python ../scripts/regionalize.py $< $@ $* $*
eonticket-%.o: eonticket-%.tx
./rgbasm -o $@ $<
eonticket-%.gbc: eonticket-%.o
./rgblink -o $@ $<
eonticket-%.bin: eonticket-%.gbc
python ../scripts/stripgbc.py $< $@
eonticket-%.mev: eonticket-%.bin
python ../scripts/checksum.py $< $@
prologue-%.tx: prologue.asm
python ../scripts/regionalize.py $< $@ $* $*
prologue-%.o: prologue-%.tx
./rgbasm -o $@ $<
prologue-%.gbc: prologue-%.o
./rgblink -o $@ $<
prologue-%.bin: prologue-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.tx: 00-C000.asm eonticket-%.mev prologue-%.bin
python ../scripts/ereadertext.py $< $@ $*
00-C000-%.o: 00-C000-%.tx
./rgbasm -o $@ $<
00-C000-%.gbc: 00-C000-%.o
./rgblink -o $@ $<
00-C000-%.z80: 00-C000-%.gbc
python ../scripts/stripgbc.py $< $@
00-C000-%.vpk: 00-C000-%.z80
./nevpk -c -i $< -o $@
00-C000-%.raw: 00-C000-%.vpk
./nedcmake -i $< -o $@ -type 1 -region 1
clean:
rm -f *.tx *.o *.gbc *.z80 *.bin *.mev *.vpk *.raw

View File

@ -0,0 +1,263 @@
INCLUDE "../macros.asm"
INCLUDE "../constants/items.asm"
INCLUDE "../constants/scriptcommandsjirachibattleemeraldnotower.asm"
Mystery_Event
db CHECKSUM_CRC
dd 0 ; checksum placeholder
GBAPTR DataStart
GBAPTR DataEnd
DataStart:
db IN_GAME_SCRIPT
db 0,6 ; mossdeep
db 8 ; girl near rock
GBAPTR NormanScriptStart
GBAPTR NormanScriptEnd
db PRELOAD_SCRIPT
GBAPTR PreloadScriptStart
db END_OF_CHUNKS
PreloadScriptStart:
setvirtualaddress PreloadScriptStart
callasm $0201C045
virtualloadpointer GoSeeYourFather
setbyte 2
dw $0000
end
WriteFlashMemory
JirachiScriptStart:
setvirtualaddress JirachiScriptStart
db $5A
virtualmsgbox Wish
waitmsg
db $6E, $17, $8
release
compare LASTRESULT, 0
virtualgotoif 5, checkspot
Changemind:
virtualmsgbox Change
waitmsg
waitkeypress
release
end
db $00
db $00
db $00
db $00
CHANNELRNG
STORAGETABLE
TEMPJIRACHI2
STRUCTURETABLEG
MEMCOPYJIRACHI
RETURN
FIXJIRACHIANDCOPY
CAPTUREJIRACHI
FINALSTORAGE
MOVEPLAYERDOWNRIGHT
MOVEPLAYERRIGHTFACEUP
MOVEPLAYERQUESTION
db $00
TEMPJIRACHI
MOVEPLAYERLEFTFACEUP
checkspot:
virtualmsgbox Youdo
waitmsg
waitkeypress
release
db $43
compare LASTRESULT, 5
virtualgotoif 2, NoRoom
copyvar $800B, $800D
getplayerpos $8000, $8001
compare $8000, $37
virtualgotoif 5, Movement1
Movement0:
applymovement $FF, $0203ADE0
waitmovement $FF
Movement1:
applymovement $FF, $0203ADE3
battle:
waitmovement $FF
pause $10
special $13D
sound $83
pause $10
pause $10
applymovement $FF, $0203ade8
waitmovement $FF
sound $15
setwildbattle $F4, $30, $00
virtualmsgbox Pokemon
waitmsg
waitkeypress
release
playmoncry $199, $0
virtualmsgbox Jirachi
waitmsg
waitkeypress
release
callasm $0203ABE5 ;Channel RNG
callasm $0203AD69 ;FIXJIRACHIANDCOPY
waitmoncry
special $145
playsong $01CE, $0
waitstate
db $43
comparevar LASTRESULT, $800B
virtualgotoif 3, FlewAway
Catch:
callasm $0203AD9D
killscript
NoRoom:
virtualmsgbox NoSpace
waitmsg
waitkeypress
release
end
FlewAway:
db $97, $01
db $97, $00
virtualmsgbox Flew
waitmsg
waitkeypress
release
applymovement $FF, $0203AE3C
waitmovement $FF
end
Wish:
Text_EN "Do you have a wish?@"
Youdo:
Text_EN "You do? Then leave a wish tag\n"
Text_EN "on the WHITE ROCK!@"
Change:
Text_EN "Really? I thought everyone had\n"
Text_EN "a wish...@"
Flew:
Text_EN "The JIRACHI flew away!@"
NoSpace:
Text_EN "You cant make wish\n"
Text_EN "with a full party!@"
Pokemon:
Text_EN "Huh? A POKéMON?@"
Jirachi:
Text_EN "Wiish!@"
GoSeeYourFather:
Text_EN "The WHITE ROCK in MOSSDEEP has\n"
Text_EN "been glowing...@"
NormanScriptStart:
setvirtualaddress NormanScriptStart
writebytetoaddr $1E, $2024744
writebytetoaddr $20, $2024745
writebytetoaddr $01, $2024746
writebytetoaddr $49, $2024747
writebytetoaddr $01, $2024748
writebytetoaddr $4B, $2024749
writebytetoaddr $18, $202474A
writebytetoaddr $47, $202474B
writebytetoaddr $BC, $202474C
writebytetoaddr $AB, $202474D
writebytetoaddr $03, $202474E
writebytetoaddr $02, $202474F
writebytetoaddr $4D, $2024750
writebytetoaddr $31, $2024751
writebytetoaddr $15, $2024752
writebytetoaddr $08, $2024753
callasm $02024745 ;readflash
goto $0203abbc
NormanScriptEnd:
DataEnd:
EOF

View File

@ -0,0 +1 @@
901180e44767e19e5dc9d5df881fe123 00-C000-EN.z80

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,225 @@
INCLUDE "../macros.asm"
INCLUDE "../constants/items.asm"
INCLUDE "../constants/scriptcommandsjirachibattle.asm"
Mystery_Event
db CHECKSUM_CRC
dd 0 ; checksum placeholder
GBAPTR DataStart
GBAPTR DataEnd
DataStart:
db IN_GAME_SCRIPT
db 0,6 ; mossdeep
db 8 ; girl near rock
GBAPTR NormanScriptStart
GBAPTR NormanScriptEnd
db PRELOAD_SCRIPT
GBAPTR PreloadScriptStart
db END_OF_CHUNKS
GoSeeYourFather:
Text_EN "The WHITE ROCK in MOSSDEEP has\n"
Text_EN "been glowing...@"
NormanScriptStart:
setvirtualaddress NormanScriptStart
db $5A
virtualmsgbox Wish
waitmsg
db $6E, $17, $8
release
compare LASTRESULT, 0
virtualgotoif 5, checkspot
Changemind:
virtualmsgbox Change
waitmsg
waitkeypress
release
end
CHANNELRNG
STORAGETABLE
TEMPJIRACHI
STRUCTURETABLEG
MEMCOPYJIRACHI
RETURN
FIXJIRACHIANDCOPY
CAPTUREJIRACHI
FINALSTORAGE
MOVEPLAYERDOWNRIGHT
MOVEPLAYERRIGHTFACEUP
MOVEPLAYERQUESTION
checkspot:
virtualmsgbox Youdo
waitmsg
waitkeypress
release
db $43
compare LASTRESULT, 5
virtualgotoif 2, NoRoom
copyvar $800B, $800D
getplayerpos $8000, $8001
compare $8000, $37
virtualgotoif 5, Movement2
Movement0:
applymovement $FF, $02029034
waitmovement $FF
Movement1:
applymovement $FF, $02029037
battle:
waitmovement $FF
pause $10
special $13B
sound $83
pause $10
pause $10
applymovement $FF, $0202903C
waitmovement $FF
sound $15
virtualmsgbox Pokemon
waitmsg
waitkeypress
release
playmoncry $199, $0
virtualmsgbox Jirachi
waitmsg
waitkeypress
release
callasm $02028DF1
callasm $02028FBD
waitmoncry
special $139
playsong $01CE, $0
waitstate
db $43
comparevar LASTRESULT, $800B
virtualgotoif 3, FlewAway
Catch:
callasm $02028FF1
killscript
NoRoom:
virtualmsgbox NoSpace
waitmsg
waitkeypress
release
end
FlewAway:
db $97, $01
db $97, $00
virtualmsgbox Flew
waitmsg
waitkeypress
release
end
Wish:
Text_EN "Do you have a wish?@"
Youdo:
Text_EN "You do? Then leave a wish tag\n"
Text_EN "on the WHITE ROCK!@"
Change:
Text_EN "Really? I thought everyone had\n"
Text_EN "a wish...@"
Flew:
Text_EN "The JIRACHI flew away!@"
NoSpace:
Text_EN "You cant make a wish with a\n"
Text_EN "full party!@"
Pokemon:
Text_EN "Huh? A Pokémon?@"
Jirachi:
Text_EN "Wiiish!@"
NormanScriptEnd:
PreloadScriptStart:
setvirtualaddress PreloadScriptStart
virtualloadpointer GoSeeYourFather
setbyte 2
end
DataEnd:
EOF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,15 @@
INCLUDE "../macros.asm"
SECTION "prologue", ROM0[$100]
db "GameFreak inc."
db 0,0,0,0,0,0
dd 0
Text "e reader" ; no string terminator
db 0,0,0,0,$01,$55
db 0,0,0,0
db REGION
db 0
db "GameFreak inc."
db 0,0
EOF

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,5 @@
RGB 18, 0, 0
RGB 0, 0, 0
RGB 31, 31, 31
RGB 15, 31, 31
RGB 6, 15, 29