Decompile TouchControl (98%) (#24)

* decompile touchcontrol (98%)

* fix broken match
This commit is contained in:
Yanis
2026-01-19 18:54:06 +01:00
committed by GitHub
parent e9789bf360
commit 3e57b7c175
12 changed files with 266 additions and 48 deletions
+2 -2
View File
@@ -3,9 +3,9 @@
#include "Player/TouchControl.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_02049b18.hpp"
#include "Unknown/UnkStruct_02049b4c.hpp"
#include "nitro/button.h"
#include "nitro/math.h"
#include "nitro/touch.h"
#include "types.h"
class GameModeManagerBase;
@@ -160,7 +160,7 @@ public:
GameModeManagerBase(unk32 param1);
void func_02018550(void);
void func_02018554(void);
void func_02018634(unk32 param1);
void func_02018634(u16 speed);
void *func_020186f8(unk32 param1);
void func_02018704(void);
void func_02018714(unk32 param1, unk32 param2, unk32 param3, unk32 param4, unk32 param5);
+16 -9
View File
@@ -1,11 +1,12 @@
#pragma once
#include "Unknown/UnkStruct_02049b4c.hpp"
#include "nitro/math.h"
#include "nitro/touch.h"
#include "types.h"
typedef u16 TouchFlags;
enum TouchFlag_ {
TouchFlag_None = 0x0000,
TouchFlag_TouchedNow = 0x0001,
TouchFlag_UntouchedNow = 0x0002,
TouchFlag_Repeat = 0x0004,
@@ -18,20 +19,26 @@ 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;
/* 06 */ u16 mRepeatStart;
/* 08 */ u16 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 */ Vec2s mTouchPos;
/* 14 */ bool mTouchPrev;
/* 16 */ Vec2s mTouchPosPrev;
/* 0A */ u16 mRepeatTimer;
/* 0C */ TouchState mState;
/* 12 */ TouchState mPrevState;
/* 18 */ Vec2s mTouchPosLast;
/* 1C */ Vec2s mTouchPosStart;
/* 20 */ TouchFlags mFlags;
/* 22 */
TouchControl();
void func_02014478(UnkStruct_02049b4c *param1, unk32 param2);
void IncreaseSpeed(u16 increase);
void UpdateFlags(u16 speed);
void UpdateWithStateFlags(TouchStateFlags *state, u16 speed);
void Update(TouchState *state, u16 speed);
void func_02014414(u16 speedIncrease, bool shouldIncrease);
void func_02014478(TouchState *state, u16 speed);
static bool func_020143f0();
static void UpdateState(TouchState *state, TouchStateFlags *stateFlags);
};
-14
View File
@@ -1,14 +0,0 @@
#pragma once
#include "global.h"
#include "types.h"
class UnkStruct_02049b4c {
public:
/* 00 */ unk32 mUnk_00;
UnkStruct_02049b4c();
~UnkStruct_02049b4c();
};
extern UnkStruct_02049b4c data_02049b4c;
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include "global.h"
#include "nitro/math.h"
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TouchStateFlags {
/* 00 */ Vec2us touchPos;
/* 04 */ u16 touch;
/* 06 */ u16 flags;
} TouchStateFlags; // size = 0x08
typedef struct TouchState {
/* 00 */ bool touch;
/* 01 */ bool unk_01;
/* 02 */ Vec2s touchPos;
} TouchState; // size = 0x06
typedef struct TouchStateU {
/* 00 */ bool touch;
/* 01 */ bool unk_01;
/* 02 */ Vec2us touchPos;
} TouchStateU; // size = 0x06
void WaitForTouchUpdate(u16 param1);
bool TP_GetTouchStateFlags(TouchStateFlags *pState);
static inline void TP_CopyState(TouchState *from, TouchState *to) {
to->touch = from->touch;
to->unk_01 = from->unk_01;
to->touchPos = from->touchPos;
}
extern TouchState data_02049b4c;
#ifdef __cplusplus
}
#endif