Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/RSBE01_02/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ sora/st/module.cpp:
sora/ut/ut_list.cpp:
.text start:0x800448F8 end:0x80044AD0

sora/ip/ip_human.cpp:
.text start:0x80048118 end:0x80048548
.data start:0x8042B810 end:0x8042B858
.sdata start:0x8059C7E0 end:0x8059C800
.sdata2 start:0x805A17F8 end:0x805A1818

sora/ef/ef_screen_handle.cpp:
.text start:0x8005E5C8 end:0x8005E5E8

Expand Down
58 changes: 29 additions & 29 deletions config/RSBE01_02/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2611,13 +2611,13 @@ fn_8002BAB0 = .text:0x8002BAB0; // type:function size:0x6C
fn_8002BB1C = .text:0x8002BB1C; // type:function size:0x88
fn_8002BBA4 = .text:0x8002BBA4; // type:function size:0x188
fn_8002BD2C = .text:0x8002BD2C; // type:function size:0x1C8
fn_8002BEF4 = .text:0x8002BEF4; // type:function size:0xC8
fn_8002BFBC = .text:0x8002BFBC; // type:function size:0xA4
lbSetRumble__8gfRumbleFlllll = .text:0x8002BEF4; // type:function size:0xC8
lbStopRumble__8gfRumbleFl = .text:0x8002BFBC; // type:function size:0xA4
fn_8002C060 = .text:0x8002C060; // type:function size:0xBC
fn_8002C11C = .text:0x8002C11C; // type:function size:0x94
HSD_PadRumbleRemove__8gfRumbleFl = .text:0x8002C11C; // type:function size:0x94
fn_8002C1B0 = .text:0x8002C1B0; // type:function size:0xAC
fn_8002C25C = .text:0x8002C25C; // type:function size:0x128
fn_8002C384 = .text:0x8002C384; // type:function size:0xA4
HSD_PadRumbleRemoveId__8gfRumbleFlll = .text:0x8002C25C; // type:function size:0x128
HSD_PadRumbleRemoveMask__8gfRumbleFlUl = .text:0x8002C384; // type:function size:0xA4
fn_8002C428 = .text:0x8002C428; // type:function size:0x74
fn_8002C49C = .text:0x8002C49C; // type:function size:0x74
fn_8002C510 = .text:0x8002C510; // type:function size:0x104
Expand Down Expand Up @@ -3040,24 +3040,24 @@ fn_80047FCC = .text:0x80047FCC; // type:function size:0x90
fn_8004805C = .text:0x8004805C; // type:function size:0x80
fn_800480DC = .text:0x800480DC; // type:function size:0x30
fn_8004810C = .text:0x8004810C; // type:function size:0xC
fn_80048118 = .text:0x80048118; // type:function size:0x44
fn_8004815C = .text:0x8004815C; // type:function size:0x40
fn_8004819C = .text:0x8004819C; // type:function size:0xB4
fn_80048250 = .text:0x80048250; // type:function size:0x104
fn_80048354 = .text:0x80048354; // type:function size:0x24
fn_80048378 = .text:0x80048378; // type:function size:0x18
fn_80048390 = .text:0x80048390; // type:function size:0x5C
fn_800483EC = .text:0x800483EC; // type:function size:0x4C
fn_80048438 = .text:0x80048438; // type:function size:0x30
fn_80048468 = .text:0x80048468; // type:function size:0x30
fn_80048498 = .text:0x80048498; // type:function size:0x3C
fn_800484D4 = .text:0x800484D4; // type:function size:0x34
fn_80048508 = .text:0x80048508; // type:function size:0x8
fn_80048510 = .text:0x80048510; // type:function size:0x10
fn_80048520 = .text:0x80048520; // type:function size:0x8
fn_80048528 = .text:0x80048528; // type:function size:0x10
fn_80048538 = .text:0x80048538; // type:function size:0x10
fn_80048548 = .text:0x80048548; // type:function size:0x5C
__ct__7IpHumanFUl = .text:0x80048118; // type:function size:0x44
__dt__7IpHumanFv = .text:0x8004815C; // type:function size:0x40
clampStick__FR5Vec2f = .text:0x8004819C; // type:function size:0xB4
update__7IpHumanFv = .text:0x80048250; // type:function size:0x104
isWinPoseIndicate__7IpHumanCFv = .text:0x80048354; // type:function size:0x24
getWinPose__7IpHumanCFv = .text:0x80048378; // type:function size:0x18
setEnableRumble__7IpHumanFb = .text:0x80048390; // type:function size:0x5C
setRumble__7IpHumanFUlUllUc = .text:0x800483EC; // type:function size:0x4C
stopRumble__7IpHumanFv = .text:0x80048438; // type:function size:0x30
removeRumble__7IpHumanFv = .text:0x80048468; // type:function size:0x30
removeRumbleId__7IpHumanFll = .text:0x80048498; // type:function size:0x3C
removeRumbleMask__7IpHumanFUl = .text:0x800484D4; // type:function size:0x34
getContNo__7IpHumanCFv = .text:0x80048508; // type:function size:0x8
getTrigger__7IpHumanCFv = .text:0x80048510; // type:function size:0x10
getButton__7IpHumanCFv = .text:0x80048520; // type:function size:0x8
getStickSub__7IpHumanCFv = .text:0x80048528; // type:function size:0x10
getStickMain__7IpHumanCFv = .text:0x80048538; // type:function size:0x10
getInstance__11ipPadConfigFv = .text:0x80048548; // type:function size:0x5C
fn_800485A4 = .text:0x800485A4; // type:function size:0x3D8
fn_8004897C = .text:0x8004897C; // type:function size:0x27C
fn_80048BF8 = .text:0x80048BF8; // type:function size:0x374
Expand All @@ -3067,17 +3067,17 @@ fn_800499D8 = .text:0x800499D8; // type:function size:0x3E4
fn_80049DBC = .text:0x80049DBC; // type:function size:0x50C
fn_8004A2C8 = .text:0x8004A2C8; // type:function size:0x1A0
fn_8004A468 = .text:0x8004A468; // type:function size:0x108
fn_8004A570 = .text:0x8004A570; // type:function size:0x58
getPlayerNo__11ipPadConfigFl = .text:0x8004A570; // type:function size:0x58
fn_8004A5C8 = .text:0x8004A5C8; // type:function size:0x10
fn_8004A5D8 = .text:0x8004A5D8; // type:function size:0x98
fn_8004A670 = .text:0x8004A670; // type:function size:0xD8
fn_8004A748 = .text:0x8004A748; // type:function size:0x8
fn_8004A750 = .text:0x8004A750; // type:function size:0x48
getInstance__8ipSwitchFv = .text:0x8004A750; // type:function size:0x48
fn_8004A798 = .text:0x8004A798; // type:function size:0x17C
fn_8004A914 = .text:0x8004A914; // type:function size:0x68
fn_8004A97C = .text:0x8004A97C; // type:function size:0x70
fn_8004A9EC = .text:0x8004A9EC; // type:function size:0x23C
fn_8004AC28 = .text:0x8004AC28; // type:function size:0x28
getPadStatus__8ipSwitchFlR11ipPadStatus = .text:0x8004AC28; // type:function size:0x28
fn_8004AC50 = .text:0x8004AC50; // type:function size:0x54
fn_8004ACA4 = .text:0x8004ACA4; // type:function size:0x38
fn_8004ACDC = .text:0x8004ACDC; // type:function size:0x48
Expand Down Expand Up @@ -17866,7 +17866,7 @@ lbl_8042B7C8 = .data:0x8042B7C8; // type:object size:0x14
lbl_8042B7DC = .data:0x8042B7DC; // type:object size:0x14
lbl_8042B7F0 = .data:0x8042B7F0; // type:object size:0xC
lbl_8042B7FC = .data:0x8042B7FC; // type:object size:0x14
lbl_8042B810 = .data:0x8042B810; // type:object size:0x38
__vt__7IpHuman = .data:0x8042B810; // type:object size:0x38
lbl_8042B848 = .data:0x8042B848; // type:object size:0x10
lbl_8042B858 = .data:0x8042B858; // type:object size:0x24
lbl_8042B87C = .data:0x8042B87C; // type:object size:0xC
Expand Down Expand Up @@ -28534,9 +28534,9 @@ lbl_8059C7C8 = .sdata:0x8059C7C8; // type:object size:0x8
lbl_8059C7D0 = .sdata:0x8059C7D0; // type:object size:0x8
lbl_8059C7D8 = .sdata:0x8059C7D8; // type:object size:0x8
lbl_8059C7E0 = .sdata:0x8059C7E0; // type:object size:0x8 data:string
lbl_8059C7E8 = .sdata:0x8059C7E8; // type:object size:0x8
__RTTI__7IpHuman = .sdata:0x8059C7E8; // type:object size:0x8
lbl_8059C7F0 = .sdata:0x8059C7F0; // type:object size:0x8
lbl_8059C7F8 = .sdata:0x8059C7F8; // type:object size:0x8
__RTTI__5Input = .sdata:0x8059C7F8; // type:object size:0x8
lbl_8059C800 = .sdata:0x8059C800; // type:object size:0x8 data:4byte
lbl_8059C808 = .sdata:0x8059C808; // type:object size:0x4 data:4byte
lbl_8059C80C = .sdata:0x8059C80C; // type:object size:0x4 data:4byte
Expand Down
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def MatchingFor(*versions):
Object(Matching, "sora/mt/mt_prng.cpp", extra_cflags=["-RTTI off"]),
Object(Matching, "sora/st/module.cpp"),
Object(Matching, "sora/ut/ut_list.cpp"),
Object(Matching, "sora/ip/ip_human.cpp"),
Object(Matching, "sora/ef/ef_screen_handle.cpp"),
Object(Matching, "sora/snd/snd_init_thread.cpp"),
Object(Matching, "sora/mv/mv_THPAudioDecode.cpp"),
Expand Down
136 changes: 136 additions & 0 deletions src/sora/ip/ip_human.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#include <gf/gf_pad_system.h>
#include <ip/input.h>
#include <ip/ip_padconfig.h>
#include <ip/ip_human.h>
#include <ip/ip_switch.h>
#include <mt/mt_vector.h>
#include <types.h>

IpHuman::IpHuman(u32 contNo) {
m_contNo = contNo;
m_rumbleEnabled = true;
m_stickMain.m_y = 0.0f;
m_stickMain.m_x = 0.0f;
m_stickSub.m_y = 0.0f;
m_stickSub.m_x = 0.0f;
m_button.m_mask = 0;
m_trigger.m_r = 0.0f;
m_trigger.m_l = 0.0f;
}

IpHuman::~IpHuman() { }

static void clampStick(Vec2f& stk) {
stk.m_x *= 0.0125f;
stk.m_y *= 0.0125f;
if (stk.m_x > 1.0f) {
stk.m_x = 1.0f;
} else if (stk.m_x < -1.0f) {
stk.m_x = -1.0f;
}

if (stk.m_y > 1.0f) {
stk.m_y = 1.0f;
} else if (stk.m_y < -1.0f) {
stk.m_y = -1.0f;
}

if (float(__fabs(stk.m_x)) <= 0.28f) {
stk.m_x = 0.0f;
}
if (float(__fabs(stk.m_y)) <= 0.28f) {
stk.m_y = 0.0f;
}
}

void IpHuman::update() {
ipPadStatus padStatus;
bool isPlayer = false;
s32 playerNo = m_contNo;
if (playerNo >= 0) {
playerNo = ipPadConfig::getInstance()->getPlayerNo(playerNo);
if (playerNo >= 0) {
isPlayer = true;
ipSwitch::getInstance()->getPadStatus(playerNo, padStatus);
}
}

if (isPlayer) {
Vec2f stickVal;
stickVal.m_y = padStatus.m_stickY;
stickVal.m_x = padStatus.m_stickX;
clampStick(stickVal);
m_stickMain = stickVal;
m_button.m_mask = padStatus.m_button;
} else {
m_button.m_mask = 0;
m_stickMain = Vec2f(0.0f, 0.0f);
}
}

bool IpHuman::isWinPoseIndicate() const {
return getWinPose() != 0;
}

u32 IpHuman::getWinPose() const {
return ((m_button.m_mask >> 6) & 1) | (-((m_button.m_mask >> 7) & 1) & 2);
}

void IpHuman::setEnableRumble(bool enable) {
if (m_rumbleEnabled == true && enable == false) {
stopRumble();
}
m_rumbleEnabled = enable;
}

#define CHECK_RUMBLE() (m_rumbleEnabled == true && m_contNo >= 0 && m_contNo < 8)

void IpHuman::setRumble(u32 p1, u32 p2, s32 p3, u8 p4) {
if (CHECK_RUMBLE()) {
g_gfPadSystem->m_gfRumble->lbSetRumble(m_contNo, p1, p2, p3, p4);
}
}

void IpHuman::stopRumble() {
if (CHECK_RUMBLE()) {
g_gfPadSystem->m_gfRumble->lbStopRumble(m_contNo);
}
}

void IpHuman::removeRumble() {
if (CHECK_RUMBLE()) {
g_gfPadSystem->m_gfRumble->HSD_PadRumbleRemove(m_contNo);
}
}

void IpHuman::removeRumbleId(s32 p1, s32 p2) {
if (CHECK_RUMBLE()) {
g_gfPadSystem->m_gfRumble->HSD_PadRumbleRemoveId(m_contNo, p1, p2);
}
}

void IpHuman::removeRumbleMask(u32 p1) {
if (CHECK_RUMBLE()) {
g_gfPadSystem->m_gfRumble->HSD_PadRumbleRemoveMask(m_contNo, p1);
}
}

s32 IpHuman::getContNo() const {
return m_contNo;
}

ipPadTrigger IpHuman::getTrigger() const {
return m_trigger;
}

ipPadButton IpHuman::getButton() const {
return m_button;
}

Vec2f IpHuman::getStickSub() const {
return m_stickSub;
}

Vec2f IpHuman::getStickMain() const {
return m_stickMain;
}