add AttemptCounter
This commit is contained in:
parent
783002008b
commit
9e13a87a75
4 changed files with 175 additions and 0 deletions
37
NTSC-J 1.0/AttemptCounter.customized.txt
Normal file
37
NTSC-J 1.0/AttemptCounter.customized.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
Configuration:
|
||||
* xxxx: x coordinate of the text
|
||||
* yyyy: y coordinate of the text
|
||||
* ssss: font size of the text
|
||||
* rrggbbaa: color of the text
|
||||
You can use the preview function of "Customized display" in https://gct.zint.ch/
|
||||
by setting the format to
|
||||
0
|
||||
1
|
||||
or something else
|
||||
|
||||
$ AttemptCounter (2022/11/02) [sup39]
|
||||
0410C3C8 496EDB45
|
||||
040EDB34 4970C411
|
||||
04206898 495F36CC
|
||||
077F9F0C 000000A8
|
||||
7C7E1B78 3D808180
|
||||
A40C9F08 A17E007C
|
||||
7C005800 B16C0000
|
||||
3960003C B16C0002
|
||||
39600001 4082000C
|
||||
816CFFFC 396B0001
|
||||
916CFFFC 4E800020
|
||||
3D808180 856C9F00
|
||||
396B0001 916C0000
|
||||
3960003C B16C000A
|
||||
39000000 4E800020
|
||||
4A83B2C5 3D808180
|
||||
A46C9F0A 3463FFFF
|
||||
4180003C B06C0000
|
||||
3860xxxx 3880yyyy
|
||||
38A0ssss 3CC0rrgg
|
||||
60C6bbaa 7CC73378
|
||||
4800000D 25640A25
|
||||
64000000 7D0802A6
|
||||
812CFFF6 814CFFFA
|
||||
4BFF628D 4AA0C8EC
|
26
NTSC-J 1.0/AttemptCounter.txt
Normal file
26
NTSC-J 1.0/AttemptCounter.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
$ AttemptCounter (2022/11/02) [sup39]
|
||||
0410C3C8 496EDB45
|
||||
040EDB34 4970C411
|
||||
04206898 495F36CC
|
||||
077F9F0C 000000A8
|
||||
7C7E1B78 3D808180
|
||||
A40C9F08 A17E007C
|
||||
7C005800 B16C0000
|
||||
3960003C B16C0002
|
||||
39600001 4082000C
|
||||
816CFFFC 396B0001
|
||||
916CFFFC 4E800020
|
||||
3D808180 856C9F00
|
||||
396B0001 916C0000
|
||||
3960003C B16C000A
|
||||
39000000 4E800020
|
||||
4A83B2C5 3D808180
|
||||
A46C9F0A 3463FFFF
|
||||
4180003C B06C0000
|
||||
38600090 3880007C
|
||||
38A0001C 3CC0FFFF
|
||||
60C6FFFF 7CC73378
|
||||
4800000D 25640A25
|
||||
64000000 7D0802A6
|
||||
812CFFF6 814CFFFA
|
||||
4BFF628D 4AA0C8EC
|
14
src/AttemptCounter.ld
Normal file
14
src/AttemptCounter.ld
Normal file
|
@ -0,0 +1,14 @@
|
|||
$$ = 0x817f9f0c;
|
||||
|
||||
$bl$.onStart = 0x8010c3c8;
|
||||
$bl$.onShineGet = 0x800edb34;
|
||||
$b$.onRender = 0x80206898;
|
||||
drawText = 0x817f0238;
|
||||
|
||||
/**
|
||||
* u32 success count
|
||||
* u32 total count
|
||||
* u16 last area
|
||||
* u16 freeze count
|
||||
*/
|
||||
$data = 0x817f9f00;
|
98
src/AttemptCounter.s
Normal file
98
src/AttemptCounter.s
Normal file
|
@ -0,0 +1,98 @@
|
|||
.set x, 144
|
||||
.set y, 124
|
||||
.set fontSize, 28
|
||||
.set color, 0xffffffff
|
||||
.set freezeDuration, 60
|
||||
|
||||
.set off$succnt, 0
|
||||
.set off$tolcnt, 4
|
||||
.set off$area0, 8
|
||||
.set off$freeze, 10
|
||||
|
||||
.macro liDX reg val
|
||||
.if -0x8000 <= \val && \val < 0x8000 || 0xffff8000 <= \val
|
||||
li \reg, \val@l
|
||||
.else
|
||||
lis \reg, \val@h
|
||||
.if \val&0xffff != 0
|
||||
ori \reg, \reg, \val@l
|
||||
.endif
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.onStart:
|
||||
.set r$$, 12
|
||||
.set off$$, off$area0
|
||||
.set a$$, $data+off$$
|
||||
## orig
|
||||
mr r30, r3
|
||||
## check last area
|
||||
### r0 = last area
|
||||
### r11 = current area
|
||||
lis r$$, a$$@ha
|
||||
lhzu r0, a$$@l(r$$)
|
||||
lhz r11, 0x7c(r30)
|
||||
cmpw r0, r11
|
||||
### store current area
|
||||
sth r11, off$area0-off$$@l(r$$)
|
||||
## set freeze
|
||||
li r11, freezeDuration
|
||||
sth r11, off$freeze-off$$(r$$)
|
||||
## total count (r11)
|
||||
### if curArea != area0, totalCount = 1
|
||||
li r11, 1
|
||||
bne .onStart.done
|
||||
### else total Count += 1
|
||||
lwz r11, off$tolcnt-off$$(r$$)
|
||||
addi r11, r11, 1
|
||||
.onStart.done:
|
||||
stw r11, off$tolcnt-off$$(r$$)
|
||||
blr
|
||||
|
||||
.onShineGet:
|
||||
.set r$$, 12
|
||||
.set off$$, off$succnt
|
||||
.set a$$, $data+off$$
|
||||
## success count += 1
|
||||
lis r$$, a$$@ha
|
||||
lwzu r11, a$$@l(r$$)
|
||||
addi r11, r11, 1
|
||||
stw r11, 0(r$$)
|
||||
## set freeze
|
||||
li r11, freezeDuration
|
||||
sth r11, off$freeze-off$$(r$$)
|
||||
## orig
|
||||
li r8, 0
|
||||
blr
|
||||
|
||||
.onRender:
|
||||
## orig (setup2D)
|
||||
bl setup2D
|
||||
## check freeze count
|
||||
.set r$$, 12
|
||||
.set off$$, off$freeze
|
||||
.set a$$, $data+off$$
|
||||
### r$$ = &freezeCount
|
||||
### r3 = freezeCount
|
||||
lis r$$, a$$@ha
|
||||
lhzu r3, a$$@l(r$$)
|
||||
addic. r3, r3, -1
|
||||
## if freezeCount < 0, return
|
||||
blt .onRender.done
|
||||
## update freezeCount
|
||||
sth r3, off$freeze-off$$(r$$)
|
||||
.onRender.drawText:
|
||||
li r3, x
|
||||
li r4, y
|
||||
li r5, fontSize
|
||||
#liDX r6, color # colorTop
|
||||
lis r6, color@h
|
||||
ori r6, r6, color@l
|
||||
mr r7, r6 # colorBot
|
||||
bl .onRender.fmt; .string "%d\n%d"; .align 2; .onRender.fmt: mflr r8
|
||||
lwz r9, off$succnt-off$$(r$$)
|
||||
lwz r10, off$tolcnt-off$$(r$$)
|
||||
bl drawText
|
||||
.onRender.done:
|
||||
## orig
|
||||
b 4+$b$.onRender
|
Loading…
Reference in a new issue