mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-25 23:15:06 -04:00
767ba3bb14
* launch.json cwd * bodge to load gci for testing * stub card stat * gameplay bodges * viewport, ub fixes * add release with debug info cmake variant * be fixes, sound stub * viewport h * d_msg_flow BE * be fopAcM_createItemFromEnemyID * update launch configuration to use iso * more audio stubs * Attempt to set viewport and get messages for brightness check * skip opening scene again, fixed JMessage::TResourceContainer::TCResource::Do_destroy * add guards for viewport changes * moar endian swapping to get Link sitting in PROC_OPENING_SCENE and for dialogues * BE d_msg_class i_data * stub bgm start * fix div by 0 error (for now) * TEMP_BROKEN in d_menu_ring * REQUIRES_GX_LINES * properly stub renderingAmap::draw with REQUIRES_GX_LINES * better stubbing outside of stubs * fix event data getting swapped multiple times * evil draw vp fix * Stub log imgui This redirects all spammy logs to an imgui window that is cleared per frame. This fixes the serious performance dip of the logging, and makes the regular log readable. * Oops move those optimization changes I accidentally committed behind a flag DUSK_SELECTED_OPT * gx_line macro in map * fix audio stubbing * switch to CARD API aurora impl * remove kabufuda from link libs * refactor imgui stuff and add input viewer * merge stub log with refactor * accidentally committed a metaforce header shh * basic map loader * ImGuiConsole: Add missing <thread> include * you may now play as luigi (you may now load stages with bridges) * bloom fix * bloom leak fix * cloud shadow fix * add soft reset button to imgui menu * if it broke dont not fix it * i swear i committed this * BE swap indMtx in JPAResource::setPTev * wnark ct fix * frsqrte implementation from kinoko * Fix Clang compile error in JAISeq::prepare_getSeqData_ * Add endian conversions to dMsgFlow_c::getInitNodeIndex This fixes a freeze when Fado tries to stop you from leaving the starting area. * Add RAII GXTexObj wrapper; fix almost all leaks * Update aurora for indirect texturing * Update aurora for CARD fix * Fix Clang build * More d_msg_flow endian fixes Fixes softlock when trying to talk to Fado and possibly other NPCs. * no frame limiter * get pause menu working * proper frame limiting * particle pointer size fix * improve map loader a bit --------- Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net> Co-authored-by: TakaRikka <takarikka@outlook.com> Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com> Co-authored-by: Luke Street <luke@street.dev> Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com> Co-authored-by: tgsm <doodrabbit@hotmail.com> Co-authored-by: Max Roncace <me@caseif.net> Co-authored-by: Phillip Stephens <antidote.crk@gmail.com>
92 lines
4.9 KiB
C++
92 lines
4.9 KiB
C++
#ifndef M_DO_M_DO_CONTROLLER_PAD_H
|
|
#define M_DO_M_DO_CONTROLLER_PAD_H
|
|
|
|
#include "JSystem/JUtility/JUTGamePad.h"
|
|
#include "SSystem/SComponent/c_API_controller_pad.h"
|
|
|
|
// Controller Ports 1 - 4
|
|
enum { PAD_1, PAD_2, PAD_3, PAD_4 };
|
|
|
|
class mDoCPd_c {
|
|
public:
|
|
static void create();
|
|
static void read();
|
|
static void convert(interface_of_controller_pad*, JUTGamePad*);
|
|
static void LRlockCheck(interface_of_controller_pad*);
|
|
static void recalibrate();
|
|
|
|
static interface_of_controller_pad& getCpadInfo(u32 pad) { return m_cpadInfo[pad]; }
|
|
static JUTGamePad* getGamePad(u32 pad) { return m_gamePad[pad]; }
|
|
static u32 getTrig(u32 pad) { return getCpadInfo(pad).mPressedButtonFlags; }
|
|
static u32 getTrigLockL(u32 pad) { return getCpadInfo(pad).mTrigLockL; }
|
|
static u32 getTrigLockR(u32 pad) { return getCpadInfo(pad).mTrigLockR; }
|
|
static u32 getTrigUp(u32 pad) { return getTrig(pad) & PAD_BUTTON_UP; }
|
|
static u32 getTrigDown(u32 pad) { return getTrig(pad) & PAD_BUTTON_DOWN; }
|
|
static u32 getTrigLeft(u32 pad) { return getTrig(pad) & PAD_BUTTON_LEFT; }
|
|
static u32 getTrigRight(u32 pad) { return getTrig(pad) & PAD_BUTTON_RIGHT; }
|
|
static u32 getTrigL(u32 pad) { return getTrig(pad) & PAD_TRIGGER_L; }
|
|
static u32 getTrigR(u32 pad) { return getTrig(pad) & PAD_TRIGGER_R; }
|
|
static u32 getTrigA(u32 pad) { return getTrig(pad) & PAD_BUTTON_A; }
|
|
static u32 getTrigB(u32 pad) { return getTrig(pad) & PAD_BUTTON_B; }
|
|
static u32 getTrigZ(u32 pad) { return getTrig(pad) & PAD_TRIGGER_Z; }
|
|
static u32 getTrigY(u32 pad) { return getTrig(pad) & PAD_BUTTON_Y; }
|
|
static u32 getTrigX(u32 pad) { return getTrig(pad) & PAD_BUTTON_X; }
|
|
static u32 getTrigStart(u32 pad) { return getTrig(pad) & PAD_BUTTON_START; }
|
|
static u32 getHold(u32 pad) { return getCpadInfo(pad).mButtonFlags; }
|
|
static u32 getHoldLockL(u32 pad) { return getCpadInfo(pad).mHoldLockL; }
|
|
static u32 getHoldLockR(u32 pad) { return getCpadInfo(pad).mHoldLockR; }
|
|
static u32 getHoldUp(u32 pad) { return getHold(pad) & PAD_BUTTON_UP; }
|
|
static u32 getHoldDown(u32 pad) { return getHold(pad) & PAD_BUTTON_DOWN; }
|
|
static u32 getHoldLeft(u32 pad) { return getHold(pad) & PAD_BUTTON_LEFT; }
|
|
static u32 getHoldRight(u32 pad) { return getHold(pad) & PAD_BUTTON_RIGHT; }
|
|
static u32 getHoldL(u32 pad) { return getHold(pad) & PAD_TRIGGER_L; }
|
|
static u32 getHoldR(u32 pad) { return getHold(pad) & PAD_TRIGGER_R; }
|
|
static u32 getHoldA(u32 pad) { return getHold(pad) & PAD_BUTTON_A; }
|
|
static u32 getHoldB(u32 pad) { return getHold(pad) & PAD_BUTTON_B; }
|
|
static u32 getHoldZ(u32 pad) { return getHold(pad) & PAD_TRIGGER_Z; }
|
|
static u32 getHoldY(u32 pad) { return getHold(pad) & PAD_BUTTON_Y; }
|
|
static u32 getHoldX(u32 pad) { return getHold(pad) & PAD_BUTTON_X; }
|
|
static u32 getHoldStart(u32 pad) { return getHold(pad) & PAD_BUTTON_START; }
|
|
static f32 getStickX(u32 pad) { return getCpadInfo(pad).mMainStickPosX; }
|
|
static f32 getStickY(u32 pad) { return getCpadInfo(pad).mMainStickPosY; }
|
|
static f32 getStickX3D(u32 pad) { return getCpadInfo(pad).mMainStickPosX; }
|
|
static f32 getStickValue(u32 pad) { return getCpadInfo(pad).mMainStickValue; }
|
|
static s16 getStickAngle(u32 pad) { return getCpadInfo(pad).mMainStickAngle; }
|
|
static s16 getStickAngle3D(u32 pad) { return getCpadInfo(pad).mMainStickAngle; }
|
|
static f32 getSubStickX3D(u32 pad) { return getCpadInfo(pad).mCStickPosX; }
|
|
static f32 getSubStickX(u32 pad) { return getCpadInfo(pad).mCStickPosX; }
|
|
static f32 getSubStickY(u32 pad) { return getCpadInfo(pad).mCStickPosY; }
|
|
static f32 getSubStickValue(u32 pad) { return getCpadInfo(pad).mCStickValue; }
|
|
static s16 getSubStickAngle(u32 pad) { return getCpadInfo(pad).mCStickAngle; }
|
|
static f32 getAnalogR(u32 pad) { return getCpadInfo(pad).mTriggerRight; }
|
|
static f32 getAnalogL(u32 pad) { return getCpadInfo(pad).mTriggerLeft; }
|
|
static BOOL isConnect(u32 pad) { return JUTGamePad::getPortStatus((JUTGamePad::EPadPort)pad) == 0; }
|
|
static void startMotorWave(u32 pad, void* data, JUTGamePad::CRumble::ERumble rumble, u32 length) {
|
|
m_gamePad[pad]->startMotorWave(data, rumble, length);
|
|
}
|
|
static void stopMotor(u32 pad) { m_gamePad[pad]->stopMotor(); }
|
|
static void stopMotorWave(u32 pad) { m_gamePad[pad]->stopMotorWave(); }
|
|
static void stopMotorHard(u32 pad) { return m_gamePad[pad]->stopMotorHard(); }
|
|
static void stopMotorWaveHard(u32 pad) { return m_gamePad[pad]->stopMotorWaveHard(); }
|
|
|
|
static JUTGamePad* m_gamePad[4];
|
|
static interface_of_controller_pad m_cpadInfo[4];
|
|
static interface_of_controller_pad m_debugCpadInfo[4];
|
|
};
|
|
|
|
inline void mDoCPd_ANALOG_CONV(u8 analog, f32& param_1) {
|
|
param_1 = analog * (1.0f / 15.0f);
|
|
if (param_1 > 1.0f) {
|
|
param_1 = 1.0f;
|
|
}
|
|
}
|
|
|
|
inline void mDoCPd_TRIGGER_CONV(u8 analog, f32& param_1) {
|
|
param_1 = analog * (1.0f / 140.0f);
|
|
if (param_1 > 1.0f) {
|
|
param_1 = 1.0f;
|
|
}
|
|
}
|
|
|
|
#endif /* M_DO_M_DO_CONTROLLER_PAD_H */
|