Add TouchControl.s

This commit is contained in:
Aetias
2024-03-19 17:53:59 +01:00
parent f9f944ae47
commit 6f707bb31d
24 changed files with 95122 additions and 92622 deletions
+2 -2
View File
@@ -487,7 +487,7 @@
.extern data_027e0cbc
.extern data_027e0c54
.extern func_ov00_0207c0f0
.extern func_ov00_0207ac24
.extern _ZN12TouchControlC2Ev
.extern func_ov00_0207bcb4
.extern func_ov00_0207b288
.extern func_ov00_0207a2e8
@@ -514,7 +514,7 @@
.extern data_027e0dbc
.extern data_027e071c
.extern data_027e0618
.extern func_ov00_0207af38
.extern _ZN12TouchControl18func_ov00_0207af38Etb
.extern func_ov00_0207b9dc
.extern func_ov00_020d64ac
.extern func_ov00_0207be84
+1 -1
View File
@@ -1594,7 +1594,7 @@
.extern func_ov00_02078b40
.extern data_027e0d38
.extern data_027e0d44
.extern func_ov00_0207ac24
.extern _ZN12TouchControlC2Ev
.extern func_ov00_020b78a0
.extern func_0202e9f4
.extern _ZN9SysObjectnwEmPjj
+1 -1
View File
@@ -44,7 +44,7 @@
.extern func_020400c0
.extern func_02040100
.extern data_027e0ce0
.extern func_ov00_0207ac24
.extern _ZN12TouchControlC2Ev
.extern func_0200a23c
.extern func_0200dd94
.extern func_0200a318
+2 -2
View File
@@ -765,11 +765,11 @@
.extern func_0200f248
.extern func_0200a318
.extern func_0200a53c
.extern func_0200a9f4
.extern WaitForTouchUpdate
.extern func_0200aa0c
.extern func_0200f248
.extern func_0200a63c
.extern func_0200a9f4
.extern WaitForTouchUpdate
.extern func_0200aa0c
.extern func_0200a6d4
.extern func_0200a8d0
+11 -11
View File
@@ -14065,17 +14065,17 @@ func_0200a4d4: ; 0x0200a4d4
arm_func_end func_0200a4d4
_0200a51c: .word data_0205aa84
.global func_0200a520
arm_func_start func_0200a520
func_0200a520: ; 0x0200a520
.global GetTouchStateFlags
arm_func_start GetTouchStateFlags
GetTouchStateFlags: ; 0x0200a520
stmdb sp!, {r4, lr}
mov r4, r0
mov r0, #1
bl func_0200a9f4
bl WaitForTouchUpdate
mov r0, r4
bl func_0200a4d4
ldmia sp!, {r4, pc}
arm_func_end func_0200a520
arm_func_end GetTouchStateFlags
.global func_0200a53c
arm_func_start func_0200a53c
@@ -14427,9 +14427,9 @@ _0200a990:
_0200a9ec: .word data_0205aa84
_0200a9f0: .word data_0205aaa0
.global func_0200a9f4
arm_func_start func_0200a9f4
func_0200a9f4: ; 0x0200a9f4
.global WaitForTouchUpdate
arm_func_start WaitForTouchUpdate
WaitForTouchUpdate: ; 0x0200a9f4
ldr r1, _0200aa08 ; =data_0205aa84
_0200a9f8:
ldrh r2, [r1, #0x3a]
@@ -14437,7 +14437,7 @@ _0200a9f8:
bne _0200a9f8
bx lr
.align 2, 0
arm_func_end func_0200a9f4
arm_func_end WaitForTouchUpdate
_0200aa08: .word data_0205aa84
.global func_0200aa0c
@@ -59401,7 +59401,7 @@ _0202c75c:
ldr r1, [r4]
bl func_ov00_0207c0f0
ldr r0, _0202c924 ; =data_027e0d78
bl func_ov00_0207ac24
bl _ZN12TouchControlC2Ev
ldr r0, _0202c928 ; =data_027e0e2c
bl func_ov00_0207bcb4
ldr r0, _0202c92c ; =data_027e0db0
@@ -59653,7 +59653,7 @@ _0202ca34:
ldrh r1, [sl, #0xf2]
ldr r0, _0202ce84 ; =data_027e0d78
mov r2, r8
bl func_ov00_0207af38
bl _ZN12TouchControl18func_ov00_0207af38Etb
ldr r0, [sl, #0xf4]
tst r0, #7
bne _0202cac8
@@ -1,5 +1,5 @@
.include "macros/function.inc"
.include "ov00/ItemManager/include/ItemManager.inc"
.include "ov00/Item/include/ItemManager.inc"
.text
+296
View File
@@ -0,0 +1,296 @@
.include "macros/function.inc"
.include "ov00/Player/include/TouchControl.inc"
.text
.global _ZN12TouchControlC2Ev
thumb_func_start _ZN12TouchControlC2Ev
_ZN12TouchControlC2Ev: ; 0x0207ac24
mov r1, #1
strh r1, [r0]
ldr r1, _0207ac5c ; =0x0000ffff
mov r3, #0
strh r1, [r0, #2]
strh r1, [r0, #4]
mov r1, #0x14
strh r1, [r0, #6]
mov r1, #6
strh r1, [r0, #8]
ldrh r1, [r0, #6]
sub r2, r3, #1
strh r1, [r0, #0xa]
strb r3, [r0, #0xc]
str r2, [r0, #0x10]
str r2, [r0, #0x14]
strb r3, [r0, #0x18]
str r2, [r0, #0x1c]
str r2, [r0, #0x20]
mov r1, #0x80
str r1, [r0, #0x24]
mov r1, #0x60
str r1, [r0, #0x28]
str r2, [r0, #0x2c]
str r2, [r0, #0x30]
strh r3, [r0, #0x34]
bx lr
nop
thumb_func_end _ZN12TouchControlC2Ev
_0207ac5c: .word 0x0000ffff
.global _ZN12TouchControl13IncreaseSpeedEs
arm_func_start _ZN12TouchControl13IncreaseSpeedEs
_ZN12TouchControl13IncreaseSpeedEs: ; 0x0207ac60
mov r2, #0
strh r2, [r0, #0x34]
ldrh r2, [r0]
add r1, r2, r1
strh r1, [r0]
bx lr
arm_func_end _ZN12TouchControl13IncreaseSpeedEs
.global _ZN12TouchControl11UpdateFlagsEt
arm_func_start _ZN12TouchControl11UpdateFlagsEt
_ZN12TouchControl11UpdateFlagsEt: ; 0x0207ac78
mov r2, #0
strh r2, [r0, #0x34]
ldrb r2, [r0, #0x18]
cmp r2, #0
ldreqb r2, [r0, #0xc]
cmpeq r2, #1
ldreqh r2, [r0, #0x34]
orreq r2, r2, #1
streqh r2, [r0, #0x34]
ldrb r2, [r0, #0x18]
cmp r2, #1
ldreqb r2, [r0, #0xc]
cmpeq r2, #0
ldreqh r2, [r0, #0x34]
orreq r2, r2, #2
streqh r2, [r0, #0x34]
ldrh r2, [r0]
cmp r2, r1
strloh r1, [r0]
ldrh r2, [r0, #0x34]
tst r2, #1
beq _0207ace8
ldrh r2, [r0, #0x34]
orr r2, r2, #4
strh r2, [r0, #0x34]
ldrh r2, [r0, #6]
strh r2, [r0, #0xa]
b _0207ad20
_0207ace8:
ldrb r2, [r0, #0xc]
cmp r2, #0
beq _0207ad20
ldrh r3, [r0]
ldrh r2, [r0, #0xa]
sub r2, r2, r3
cmp r2, #0
strgth r2, [r0, #0xa]
bgt _0207ad20
ldrh r2, [r0, #0x34]
orr r2, r2, #4
strh r2, [r0, #0x34]
ldrh r2, [r0, #8]
strh r2, [r0, #0xa]
_0207ad20:
ldrh ip, [r0]
ldrh r3, [r0, #4]
ldr r2, _0207ad8c ; =0x0000ffff
add r3, r3, ip
cmp r3, r2
strlth r3, [r0, #4]
strgeh r2, [r0, #4]
ldrh r2, [r0, #0x34]
tst r2, #1
beq _0207ad68
ldrh r3, [r0, #4]
mov r2, #0
strh r3, [r0, #2]
strh r2, [r0, #4]
ldr r2, [r0, #0x10]
str r2, [r0, #0x2c]
ldr r2, [r0, #0x14]
str r2, [r0, #0x30]
_0207ad68:
strh r1, [r0]
ldrb r1, [r0, #0xc]
cmp r1, #0
bxeq lr
ldr r1, [r0, #0x10]
str r1, [r0, #0x24]
ldr r1, [r0, #0x14]
str r1, [r0, #0x28]
bx lr
.align 2, 0
arm_func_end _ZN12TouchControl11UpdateFlagsEt
_0207ad8c: .word 0x0000ffff
.global _ZN12TouchControl20UpdateWithStateFlagsEP15TouchStateFlagst
arm_func_start _ZN12TouchControl20UpdateWithStateFlagsEP15TouchStateFlagst
_ZN12TouchControl20UpdateWithStateFlagsEP15TouchStateFlagst: ; 0x0207ad90
ldrb r3, [r0, #0xc]
strb r3, [r0, #0x18]
ldr r3, [r0, #0x10]
str r3, [r0, #0x1c]
ldr r3, [r0, #0x14]
str r3, [r0, #0x20]
ldrh r3, [r1, #4]
cmp r3, #1
bne _0207ae48
ldrh r3, [r1, #6]
cmp r3, #0
bne _0207addc
mov r3, #1
strb r3, [r0, #0xc]
ldrh r3, [r1]
str r3, [r0, #0x10]
ldrh r1, [r1, #2]
str r1, [r0, #0x14]
b _0207ae5c
_0207addc:
tst r3, #1
ldrne r3, [r0, #0x1c]
ldreqh r3, [r1]
str r3, [r0, #0x10]
ldrh r3, [r1, #6]
tst r3, #2
ldrne r1, [r0, #0x20]
ldreqh r1, [r1, #2]
str r1, [r0, #0x14]
ldr r1, [r0, #0x10]
cmp r1, #0
blt _0207ae30
cmp r1, #0x100
bge _0207ae30
ldr r1, [r0, #0x14]
cmp r1, #0
blt _0207ae30
cmp r1, #0xc0
movlt r1, #1
strltb r1, [r0, #0xc]
blt _0207ae5c
_0207ae30:
mov r1, #0
strb r1, [r0, #0xc]
sub r1, r1, #1
str r1, [r0, #0x10]
str r1, [r0, #0x14]
b _0207ae5c
_0207ae48:
mov r1, #0
strb r1, [r0, #0xc]
sub r1, r1, #1
str r1, [r0, #0x10]
str r1, [r0, #0x14]
_0207ae5c:
ldr ip, _0207ae68 ; =_ZN12TouchControl11UpdateFlagsEt
mov r1, r2
bx ip
.align 2, 0
arm_func_end _ZN12TouchControl20UpdateWithStateFlagsEP15TouchStateFlagst
_0207ae68: .word _ZN12TouchControl11UpdateFlagsEt - 1
.global _ZN12TouchControl6UpdateEP10TouchStatet
arm_func_start _ZN12TouchControl6UpdateEP10TouchStatet
_ZN12TouchControl6UpdateEP10TouchStatet: ; 0x0207ae6c
ldrb r3, [r0, #0xc]
ldr ip, _0207aea8 ; =_ZN12TouchControl11UpdateFlagsEt
strb r3, [r0, #0x18]
ldr r3, [r0, #0x10]
str r3, [r0, #0x1c]
ldr r3, [r0, #0x14]
str r3, [r0, #0x20]
ldrb r3, [r1]
strb r3, [r0, #0xc]
ldr r3, [r1, #4]
str r3, [r0, #0x10]
ldr r3, [r1, #8]
mov r1, r2
str r3, [r0, #0x14]
bx ip
.align 2, 0
arm_func_end _ZN12TouchControl6UpdateEP10TouchStatet
_0207aea8: .word _ZN12TouchControl11UpdateFlagsEt - 1
.global _ZN12TouchControl18func_ov00_0207aeacEv
arm_func_start _ZN12TouchControl18func_ov00_0207aeacEv
_ZN12TouchControl18func_ov00_0207aeacEv: ; 0x0207aeac
ldr r0, _0207aecc ; =0x027fffa8
ldrh r0, [r0]
and r0, r0, #0x8000
mov r0, r0, asr #0xf
cmp r0, #1
moveq r0, #1
movne r0, #0
bx lr
.align 2, 0
arm_func_end _ZN12TouchControl18func_ov00_0207aeacEv
_0207aecc: .word 0x027fffa8
.global _ZN12TouchControl19UpdateConditionallyEP10TouchStatet
arm_func_start _ZN12TouchControl19UpdateConditionallyEP10TouchStatet
_ZN12TouchControl19UpdateConditionallyEP10TouchStatet: ; 0x0207aed0
stmdb sp!, {r3, r4, r5, r6, lr}
sub sp, sp, #0xc
mov r4, r0
mov r6, r1
mov r5, r2
bl _ZN12TouchControl18func_ov00_0207aeacEv
cmp r0, #0
beq _0207af08
mov r1, #0
sub r0, r1, #1
strb r1, [sp]
str r0, [sp, #4]
str r0, [sp, #8]
b _0207af20
_0207af08:
ldrb r0, [r6]
strb r0, [sp]
ldr r0, [r6, #4]
str r0, [sp, #4]
ldr r0, [r6, #8]
str r0, [sp, #8]
_0207af20:
add r1, sp, #0
mov r0, r4
mov r2, r5
bl _ZN12TouchControl6UpdateEP10TouchStatet
add sp, sp, #0xc
ldmia sp!, {r3, r4, r5, r6, pc}
arm_func_end _ZN12TouchControl19UpdateConditionallyEP10TouchStatet
.global _ZN12TouchControl18func_ov00_0207af38Etb
arm_func_start _ZN12TouchControl18func_ov00_0207af38Etb
_ZN12TouchControl18func_ov00_0207af38Etb: ; 0x0207af38
stmdb sp!, {r3, r4, r5, lr}
sub sp, sp, #8
mov r5, r0
mov r4, r1
cmp r2, #0
beq _0207af5c
bl _ZN12TouchControl13IncreaseSpeedEs
add sp, sp, #8
ldmia sp!, {r3, r4, r5, pc}
_0207af5c:
bl _ZN12TouchControl18func_ov00_0207aeacEv
cmp r0, #0
beq _0207af7c
add r1, sp, #0
mov r0, #0
mov r2, #8
bl func_020078c0
b _0207af84
_0207af7c:
add r0, sp, #0
bl GetTouchStateFlags
_0207af84:
add r1, sp, #0
mov r0, r5
mov r2, r4
bl _ZN12TouchControl20UpdateWithStateFlagsEP15TouchStateFlagst
add sp, sp, #8
ldmia sp!, {r3, r4, r5, pc}
arm_func_end _ZN12TouchControl18func_ov00_0207af38Etb
+3
View File
@@ -0,0 +1,3 @@
#pragma once
.extern func_020078c0
.extern GetTouchStateFlags
+2 -1
View File
@@ -358,7 +358,7 @@
.extern data_020683f4
.extern data_027e0184
.extern func_020078c0
.extern func_0200a520
.extern GetTouchStateFlags
.extern data_027e0618
.extern data_027e0618
.extern data_027e0618
@@ -3718,3 +3718,4 @@
.extern func_ov05_0210f708
.extern func_ov05_0210f708
.extern func_ov05_0210f708
.extern func_ov00_0207c170
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -727,7 +727,7 @@
.extern data_027e0fe4
.extern func_ov00_02081f4c
.extern _ZN9SysObjectdlEPv
.extern func_ov00_0207aed0
.extern _ZN12TouchControl19UpdateConditionallyEP10TouchStatet
.extern func_ov00_0208b180
.extern func_01ffe468
.extern func_01ffb7ec
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -11163,7 +11163,7 @@ func_ov00_020b7924: ; 0x020b7924
ldr r1, _020b7d38 ; =data_027e0d84
mov r2, #2
mov r4, r0
bl func_ov00_0207aed0
bl _ZN12TouchControl19UpdateConditionallyEP10TouchStatet
ldr r0, _020b7d3c ; =data_027e0f64
ldr r0, [r0]
bl func_ov00_0208b180
+1 -1
View File
@@ -21224,7 +21224,7 @@ _0210afd8: .word data_ov04_02110bb4
func_ov04_0210afdc: ; 0x0210afdc
push {r4, r5, r6, lr}
add r4, r0, #0
bl func_ov00_0207ac24
bl _ZN12TouchControlC2Ev
add r0, r4, #0
blx func_ov00_020b78a0
add r1, r4, #0
+1 -1
View File
@@ -349,7 +349,7 @@ func_ov08_02113080: ; 0x02113080
stmdb sp!, {r4, lr}
sub sp, sp, #8
mov r4, r0
blx func_ov00_0207ac24
blx _ZN12TouchControlC2Ev
blx func_0200a23c
bl func_0200dd94
cmp r0, #0
+2 -2
View File
@@ -51036,7 +51036,7 @@ _0212acea:
mov r3, #5
blx func_0200a53c
mov r0, #2
blx func_0200a9f4
blx WaitForTouchUpdate
mov r0, #2
blx func_0200aa0c
cmp r0, #0
@@ -51059,7 +51059,7 @@ func_ov11_0212ad20: ; 0x0212ad20
_0212ad26:
blx func_0200a63c
add r0, r5, #0
blx func_0200a9f4
blx WaitForTouchUpdate
add r0, r4, #0
blx func_0200aa0c
cmp r0, #0
+45
View File
@@ -0,0 +1,45 @@
#pragma once
#include "global.h"
#include "types.h"
#include "lib/touch.h"
typedef u16 TouchFlags;
enum TouchFlag_ {
TouchFlag_TouchedNow = 0x0001,
TouchFlag_UntouchedNow = 0x0002,
TouchFlag_Repeat = 0x0004,
};
class TouchControl {
public:
/* 00 */ u16 mSpeed;
/* 02 */ u16 mTimeBetweenTouches; // gets set to mTimeSinceTouch when touching the screen
/* 04 */ u16 mTimeSinceTouch; // increases by mSpeed every frame
/* 06 */ unk16 mRepeatStart;
/* 08 */ unk16 mRepeatLoop;
// mRepeatTimer starts at mRepeatStart, decreases by mSpeed while touching the screen.
// if equal to 0, mRepeatTimer gets set to mRepeatLoop and the Repeat flag is set
/* 0a */ unk16 mRepeatTimer;
/* 0c */ bool mTouch;
/* 10 */ s32 mTouchX;
/* 14 */ s32 mTouchY;
/* 18 */ bool mTouchPrev;
/* 1c */ s32 mTouchPrevX;
/* 20 */ s32 mTouchPrevY;
/* 24 */ s32 mTouchLastX;
/* 28 */ s32 mTouchLastY;
/* 2c */ s32 mTouchStartX;
/* 30 */ s32 mTouchStartY;
/* 34 */ TouchFlags mFlags;
/* 36 */
TouchControl();
void IncreaseSpeed(s16 increase);
void UpdateFlags(u16 speed);
void UpdateWithStateFlags(TouchStateFlags *state, u16 speed);
void Update(TouchState *state, u16 speed);
bool func_ov00_0207aeac();
void UpdateConditionally(TouchState *state, u16 speed);
void func_ov00_0207af38(u16 speed, bool param2);
};
+17
View File
@@ -0,0 +1,17 @@
#pragma once
struct TouchStateFlags {
u16 touchX;
u16 touchY;
u16 touch;
u16 flags;
};
struct TouchState {
bool touch;
s32 touchX;
s32 touchY;
};
void WaitForTouchUpdate(u16 param1);
bool GetTouchStateFlags(TouchStateFlags *pState);
+1 -1
View File
@@ -243,7 +243,7 @@ extern "C" bool _ZNK11ItemManager7HasItemEi();
extern "C" void _ZN11ItemManager12GetEquipItemEi();
ARM bool NONMATCH(ItemManager::func_ov00_020ad790)(unk32 param1) {
#ifndef NONMATCHING
#include "../asm/ov00/ItemManager/ItemManager_func_ov00_020ad790.inc"
#include "../asm/ov00/Item/ItemManager_func_ov00_020ad790.inc"
#else
unk32 unk1 = func_ov00_02078b40(data_027e0d38);
if (unk1 == 2) return func_ov15_02136670(data_027e10a4);
+14
View File
@@ -0,0 +1,14 @@
#include "Player/TouchControl.hpp"
#ifdef STUBS
TouchControl::TouchControl() {}
void TouchControl::IncreaseSpeed(s16 increase) {}
void TouchControl::UpdateFlags(u16 speed) {}
void TouchControl::UpdateWithStateFlags(TouchStateFlags *state, u16 speed) {}
void TouchControl::Update(TouchState *state, u16 speed) {}
bool TouchControl::func_ov00_0207aeac() {}
void TouchControl::UpdateConditionally(TouchState *state, u16 speed) {}
void TouchControl::func_ov00_0207af38(u16 speed, bool param2) {}
#endif
+4 -1
View File
@@ -24,10 +24,13 @@ DTCM_OBJECTS = [
ov00 = Overlay(name='ov00', after='ARM9', objects=[
'asm/ov00/ov00_020773c0.s',
'src/00_Core/Player/TouchControl.cpp',
'asm/ov00/Player/TouchControl.s',
'asm/ov00/ov00_0207af9c.s',
'src/00_Core/Item/Item.cpp',
'asm/ov00/Item/Item.s',
'src/00_Core/Item/ItemManager.cpp',
'asm/ov00/ItemManager/ItemManager.s',
'asm/ov00/Item/ItemManager.s',
'asm/ov00/ov00_020ae7a4.s',
'asm/ov00/ov00_init.s'
])