mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 22:50:06 -04:00
Pad stuff
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "d/col/bg/d_bg_s_lin_chk.h"
|
||||
#include "d/col/c/c_cc_d.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/d_rumble.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "f/f_base.h"
|
||||
@@ -91,7 +92,7 @@ void dAcBoomerang_c::atHitCallback(cCcD_Obj *i_objInfA, dAcObjBase_c *i_actorB,
|
||||
|
||||
field_0x8D8.normalize();
|
||||
|
||||
setField_0x8CC(FLAG_BOOMERANG_CANCEL);
|
||||
setField_0x8CC(FLAG_CANCEL);
|
||||
mStateMgr.changeState(StateID_MoveCancelWait);
|
||||
} else {
|
||||
// Play the animation to move the pincers
|
||||
@@ -290,16 +291,16 @@ const dAcBoomerang_c::ChrAnimation_t dAcBoomerang_c::sChrAnims[dAcBoomerang_c::R
|
||||
|
||||
bool dAcBoomerang_c::tryGrabObject(dAcObjBase_c *pObj) {
|
||||
dAcPy_c *player = dAcPy_c::GetLink2();
|
||||
if (checkField_0x8CC(0x1000) && GetLinkage().checkFlag(0x80)) {}
|
||||
if (checkField_0x8CC(FLAG_CONTROLLABLE) && GetLinkage().checkFlag(0x80)) {}
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
void dAcBoomerang_c::bonk() {
|
||||
if (checkField_0x8CC(FLAG_BOOMERANG_RUMBLE_ACTIVE)) {
|
||||
if (checkField_0x8CC(FLAG_RUMBLE_ACTIVE)) {
|
||||
return;
|
||||
}
|
||||
setField_0x8CC(FLAG_BOOMERANG_RUMBLE_ACTIVE);
|
||||
setField_0x8CC(FLAG_RUMBLE_ACTIVE);
|
||||
dRumble_c::start(dRumble_c::sRumblePreset1, 1);
|
||||
}
|
||||
|
||||
@@ -360,10 +361,7 @@ void dAcBoomerang_c::initializeState_Wait() {
|
||||
mSph0.ClrAtHit();
|
||||
mSph1.ClrTgHit();
|
||||
mSph1.ClrAtHit();
|
||||
unsetField_0x8CC(
|
||||
FLAG_BOOMERANG_0x10000 | FLAG_BOOMERANG_WING_EFFECT_ACTIVE | FLAG_BOOMERANG_0x2000 |
|
||||
FLAG_BOOMERANG_STOP_TIMER_ACTIVE | FLAG_BOOMERANG_0x10 | FLAG_BOOMERANG_RELEASE_ITEM | FLAG_BOOMERANG_CANCEL
|
||||
);
|
||||
unsetField_0x8CC(FLAG_COMMON_INIT);
|
||||
|
||||
placeOnArm();
|
||||
field_0x8D0 = 0.f;
|
||||
@@ -373,7 +371,7 @@ void dAcBoomerang_c::initializeState_Wait() {
|
||||
void dAcBoomerang_c::executeState_Wait() {
|
||||
forwardSpeed = 0.f;
|
||||
placeOnArm();
|
||||
if (checkField_0x8CC(FLAG_BOOMERANG_REQUEST_MOVE)) {
|
||||
if (checkField_0x8CC(FLAG_REQUEST_MOVE)) {
|
||||
mStateMgr.changeState(StateID_Move);
|
||||
}
|
||||
}
|
||||
@@ -385,10 +383,7 @@ void dAcBoomerang_c::initializeState_ReturnWait() {
|
||||
mSph0.ClrAtHit();
|
||||
mSph1.ClrTgHit();
|
||||
mSph1.ClrAtHit();
|
||||
unsetField_0x8CC(
|
||||
FLAG_BOOMERANG_0x10000 | FLAG_BOOMERANG_WING_EFFECT_ACTIVE | FLAG_BOOMERANG_0x2000 |
|
||||
FLAG_BOOMERANG_STOP_TIMER_ACTIVE | FLAG_BOOMERANG_0x10 | FLAG_BOOMERANG_RELEASE_ITEM | FLAG_BOOMERANG_CANCEL
|
||||
);
|
||||
unsetField_0x8CC(FLAG_COMMON_INIT);
|
||||
placeOnArm();
|
||||
}
|
||||
void dAcBoomerang_c::executeState_ReturnWait() {
|
||||
@@ -411,7 +406,28 @@ void dAcBoomerang_c::initializeState_Move() {
|
||||
setFlyChrAnimation(RB_FLY);
|
||||
field_0x8B1 = 45; // 1.5 seconds if that means anything
|
||||
field_0x8C8 = 0;
|
||||
forwardSpeed = dAcPy_c::GetLink2()->getBeetleSmallRadius();
|
||||
|
||||
dAcPy_c *player = dAcPy_c::GetLink2();
|
||||
forwardSpeed = player->getBeetleNormalSpeed();
|
||||
|
||||
mSph0.ClrAtHit();
|
||||
mSph1.ClrTgHit();
|
||||
mSph1.ClrAtHit();
|
||||
|
||||
mRemainingFlightTime = player->getBeetleFlightTime();
|
||||
mFlashTimer = player->getBeetleWarningTimeLeft();
|
||||
unsetField_0x8CC(FLAG_REQUEST_MOVE | FLAG_WING_EFFECT_ACTIVE | FLAG_0x10000);
|
||||
setField_0x8CC(FLAG_CONTROLLABLE | FLAG_0x80000);
|
||||
|
||||
angle.x = 2000 - player->vt_0x198();
|
||||
|
||||
rotation.x.set(-angle.x);
|
||||
rotation.y.set(angle.y);
|
||||
rotation.z.set(0);
|
||||
field_0x8B2 = 0;
|
||||
|
||||
mOldPosition = position;
|
||||
mOldPosition.y += 60.f;
|
||||
}
|
||||
void dAcBoomerang_c::executeState_Move() {}
|
||||
void dAcBoomerang_c::finalizeState_Move() {}
|
||||
@@ -426,10 +442,7 @@ void dAcBoomerang_c::initializeState_EventReturnWait() {
|
||||
mSph1.ClrTgHit();
|
||||
mSph1.ClrAtHit();
|
||||
|
||||
unsetField_0x8CC(
|
||||
FLAG_BOOMERANG_0x10000 | FLAG_BOOMERANG_WING_EFFECT_ACTIVE | FLAG_BOOMERANG_0x2000 |
|
||||
FLAG_BOOMERANG_STOP_TIMER_ACTIVE | FLAG_BOOMERANG_0x10 | FLAG_BOOMERANG_RELEASE_ITEM | FLAG_BOOMERANG_CANCEL
|
||||
);
|
||||
unsetField_0x8CC(FLAG_COMMON_INIT);
|
||||
}
|
||||
void dAcBoomerang_c::executeState_EventReturnWait() {}
|
||||
void dAcBoomerang_c::finalizeState_EventReturnWait() {}
|
||||
@@ -439,7 +452,7 @@ void dAcBoomerang_c::executeTimeWarning() {
|
||||
mColor flashClr(0, 0, 0, 0xFF);
|
||||
|
||||
if (mRemainingFlightTime <= timeLimit) {
|
||||
setField_0x8CC(FLAG_BOOMERANG_STOP_TIMER_ACTIVE);
|
||||
setField_0x8CC(FLAG_STOP_TIMER_ACTIVE);
|
||||
|
||||
if (mFlashTimer != 0) {
|
||||
mFlashTimer--;
|
||||
@@ -471,22 +484,22 @@ void dAcBoomerang_c::registerInEvent() {
|
||||
int dAcBoomerang_c::actorExecute() {
|
||||
dAcPy_c *player = dAcPy_c::GetLink2();
|
||||
|
||||
if (checkField_0x8CC(FLAG_BOOMERANG_REQUEST_0x400)) {
|
||||
unsetField_0x8CC(FLAG_BOOMERANG_REQUEST_0x400);
|
||||
if (checkField_0x8CC(FLAG_REQUEST_0x400)) {
|
||||
unsetField_0x8CC(FLAG_REQUEST_0x400);
|
||||
}
|
||||
|
||||
if (dAcPy_c::GetLink2()->checkModelUpdateFlag(0x10000 | 0x80)) {
|
||||
deleteRequest();
|
||||
unsetField_0x8CC(FLAG_BOOMERANG_REQUEST_0x400);
|
||||
unsetField_0x8CC(FLAG_REQUEST_0x400);
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
if (EventManager::isInEvent() && mEventRelated.getSomeEventRelatedNumber() != -1) {
|
||||
setField_0x8CC(FLAG_BOOMERANG_0x40);
|
||||
setField_0x8CC(FLAG_0x40);
|
||||
mEventRelated.advanceNext();
|
||||
}
|
||||
|
||||
unsetField_0x8CC(FLAG_BOOMERANG_0x40000 | FLAG_BOOMERANG_RUMBLE_ACTIVE);
|
||||
unsetField_0x8CC(FLAG_0x40000 | FLAG_RUMBLE_ACTIVE);
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
mAnmChr[i].play();
|
||||
@@ -503,7 +516,7 @@ int dAcBoomerang_c::actorExecute() {
|
||||
mMdl.getNodeWorldMtxMultVecZero(0, poscopy2);
|
||||
poscopy3 = poscopy2;
|
||||
|
||||
if (checkField_0x8CC(FLAG_BOOMERANG_WING_EFFECT_ACTIVE)) {
|
||||
if (checkField_0x8CC(FLAG_WING_EFFECT_ACTIVE)) {
|
||||
mEff0.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_6_, mWorldMtx, nullptr, nullptr);
|
||||
mEff1.setTransform(mWorldMtx);
|
||||
|
||||
@@ -523,14 +536,14 @@ int dAcBoomerang_c::actorExecute() {
|
||||
mEff2.remove(true);
|
||||
}
|
||||
|
||||
if (checkField_0x8CC(FLAG_BOOMERANG_0x20) && !checkField_0x8CC(FLAG_BOOMERANG_CANCEL)) {
|
||||
if (checkField_0x8CC(FLAG_0x20) && !checkField_0x8CC(FLAG_CANCEL)) {
|
||||
if (mStateMgr.isState(StateID_Move) || mStateMgr.isState(StateID_MoveCancelWait)) {
|
||||
mEff3.createContinuousEffect(PARTICLE_RESOURCE_ID_MAPPING_7_, mWorldMtx, nullptr, nullptr);
|
||||
playSoundEffect1(SE_BE_HIT_LEAVES_LV);
|
||||
}
|
||||
}
|
||||
|
||||
unsetField_0x8CC(FLAG_BOOMERANG_0x20 | FLAG_BOOMERANG_0x40 | FLAG_BOOMERANG_0x80 | FLAG_BOOMERANG_DROP_ITEM);
|
||||
unsetField_0x8CC(FLAG_0x20 | FLAG_0x40 | FLAG_0x80 | FLAG_DROP_ITEM);
|
||||
retrieve();
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "d/col/bg/d_bg_s_lin_chk.h"
|
||||
#include "d/col/cc/d_cc_s.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -11,9 +13,7 @@
|
||||
#include "nw4r/lyt/lyt_bounding.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "nw4r/ut/ut_RuntimeTypeInfo.h"
|
||||
#include "rvl/MTX/mtx.h"
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
dCsMgr_c::dCsMgr_c() {
|
||||
// NONMATCHING - TList ctor issues
|
||||
@@ -117,19 +117,24 @@ bool dCursorHitCheck_c::checkOverrideCallback(bool b) {
|
||||
|
||||
bool dCursorHitCheckCC_c::checkHit(s32 x, s32 y) {
|
||||
// NONMATCHING - TODO
|
||||
mVec3_c pos(x, y, 10000.0f);
|
||||
pos.x = (pos.x - get_8057515C()) / get_80575148() * -2.0f - 1.0f;
|
||||
pos.y = (pos.y - get_8057519C()) / get_80575190() * 2.0f - 1.0f;
|
||||
|
||||
mVec3_c pos(
|
||||
(x - dGfx_c::getWidth4x3LeftF()) / dGfx_c::getWidth4x3F() * 2.f - 1.f,
|
||||
(y - dGfx_c::getCurrentScreenTopF()) / dGfx_c::getCurrentScreenHeightF() * -2.f - 1.f, 10000.f
|
||||
);
|
||||
|
||||
mVec3_c v;
|
||||
d3d::fn_80016B60(v, pos);
|
||||
|
||||
nw4r::g3d::Camera cam = dStageMgr_c::GetInstance()->getCamera(0);
|
||||
|
||||
mMtx_c mtx;
|
||||
cam.GetCameraMtx(mtx);
|
||||
PSMTXInverse(mtx, mtx);
|
||||
mVec3_c a;
|
||||
a.x = mtx.m[0][3];
|
||||
a.y = mtx.m[1][3];
|
||||
a.z = mtx.m[2][3];
|
||||
|
||||
cam.GetCameraMtx(mtx);
|
||||
mtx.inverse();
|
||||
mtx.getTranslation(a);
|
||||
|
||||
dBgS_LinChk ck;
|
||||
ck.Set(&a, &v, nullptr);
|
||||
dBgS::GetInstance()->LineCross(&ck);
|
||||
@@ -254,6 +259,5 @@ void dCursorHitCheckLyt_c::gatherBoundings(dCsCheckLyt_BoundingData **pEnd, nw4r
|
||||
}
|
||||
|
||||
mVec2_c &dCursorInterface_c::getCursorPos() {
|
||||
// NONMATCHING - Controller stuff
|
||||
return *(mVec2_c *)nullptr;
|
||||
return dPad::ex_c::getInstance()->field_0x8;
|
||||
}
|
||||
|
||||
+18
-14
@@ -1,15 +1,14 @@
|
||||
#include "d/d_dvd_drive_error.h"
|
||||
|
||||
#include "d/d_dvd_unk.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "egg/gfx/eggDrawGX.h"
|
||||
#include "egg/gfx/eggScreen.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/reload_color_fader.h"
|
||||
|
||||
|
||||
/** 805750d0 */
|
||||
dDvdDriveError_c *dDvdDriveError_c::sInstance;
|
||||
|
||||
@@ -28,7 +27,8 @@ bool dDvdDriveError_c::isError() const {
|
||||
|
||||
static const wchar_t sErrEnGeneral[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc.";
|
||||
static const wchar_t sErrEnDiskId[] = L"Please insert The Legend of Zelda:\nSkyward Sword Game Disc.";
|
||||
static const wchar_t sErrEnDiskError[] = L"The disc could not be read.\nRefer to the Wii Operations\nManual for details.";
|
||||
static const wchar_t sErrEnDiskError[] =
|
||||
L"The disc could not be read.\nRefer to the Wii Operations\nManual for details.";
|
||||
|
||||
static const wchar_t *sErrorsEn[] = {
|
||||
sErrEnGeneral,
|
||||
@@ -38,7 +38,8 @@ static const wchar_t *sErrorsEn[] = {
|
||||
|
||||
static const wchar_t sErrEsGeneral[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword.";
|
||||
static const wchar_t sErrEsDiskId[] = L"Por favor, inserta el disco\nde The Legend of Zelda:\nSkyward Sword.";
|
||||
static const wchar_t sErrEsDiskError[] = L"No se puede leer el disco.\nConsulta el manual de operaciones\nde la consola Wii para obtener m\xe1"
|
||||
static const wchar_t sErrEsDiskError[] =
|
||||
L"No se puede leer el disco.\nConsulta el manual de operaciones\nde la consola Wii para obtener m\xe1"
|
||||
"s\ninformaci\xf3"
|
||||
"n.";
|
||||
|
||||
@@ -48,11 +49,14 @@ static const wchar_t *sErrorsEs[] = {
|
||||
sErrEsDiskError,
|
||||
};
|
||||
|
||||
static const wchar_t sErrFrGeneral[] = L"Veuillez ins\xe9"
|
||||
static const wchar_t sErrFrGeneral[] =
|
||||
L"Veuillez ins\xe9"
|
||||
"rer le disque\nThe Legend of Zelda:\nSkyward Sword.";
|
||||
static const wchar_t sErrFrDiskId[] = L"Veuillez ins\xe9"
|
||||
static const wchar_t sErrFrDiskId[] =
|
||||
L"Veuillez ins\xe9"
|
||||
"rer le disque\nThe Legend of Zelda:\nSkyward Sword.";
|
||||
static const wchar_t sErrFrDiskError[] = L"Impossible de lire le disque.\nVeuillez vous r\xe9"
|
||||
static const wchar_t sErrFrDiskError[] =
|
||||
L"Impossible de lire le disque.\nVeuillez vous r\xe9"
|
||||
"f\xe9"
|
||||
"rer au mode\nd'emploi de la Wii pour plus\nde d\xe9"
|
||||
"tails.";
|
||||
@@ -71,11 +75,11 @@ void dDvdDriveError_c::draw() {
|
||||
screen.SetCanvasMode(EGG::Screen::CANVASMODE_0);
|
||||
screen.SetProjectionType(EGG::Frustum::PROJ_ORTHO);
|
||||
screen.SetNearFar(0.0f, 500.0f);
|
||||
screen.SetScale(mVec3_c(get_80575190() / get_80575144(), 1.0f, 1.0f));
|
||||
screen.SetScale(mVec3_c(dGfx_c::getWidth4x3F() / dGfx_c::getCurrentScreenWidthF(), 1.0f, 1.0f));
|
||||
screen.SetProjectionGX();
|
||||
f32 x = get_80575144() * 0.5f;
|
||||
f32 x = dGfx_c::getCurrentScreenWidthF() * 0.5f;
|
||||
f32 mx = -x;
|
||||
f32 y = get_80575148() * 0.5f;
|
||||
f32 y = dGfx_c::getCurrentScreenHeightF() * 0.5f;
|
||||
f32 my = -y;
|
||||
|
||||
EGG::DrawGX::BeginDrawScreen(screen.GetCanvasMode() == EGG::Screen::CANVASMODE_1, false, false);
|
||||
@@ -89,8 +93,8 @@ void dDvdDriveError_c::draw() {
|
||||
EGG::DrawGX::DrawDL(EGG::DrawGX::DL_17, mtx, EGG::DrawGX::BLACK);
|
||||
|
||||
nw4r::math::MTX44 mtx2;
|
||||
f32 a = get_8057511C();
|
||||
f32 b = get_80575118();
|
||||
f32 a = dGfx_c::getCurrentScreenHeight();
|
||||
f32 b = dGfx_c::getCurrentScreenWidth();
|
||||
C_MTXOrtho(mtx2, 0.0f, a, 0.0f, b, 0.0f, 1.0f);
|
||||
GXSetProjection(mtx2, GX_ORTHOGRAPHIC);
|
||||
GXSetScissor(0, 0, b, a);
|
||||
@@ -126,8 +130,8 @@ void dDvdDriveError_c::draw() {
|
||||
|
||||
textWriter.SetupGX();
|
||||
textWriter.SetDrawFlag(0x110);
|
||||
textWriter.SetCursorX(get_8057514C());
|
||||
textWriter.SetCursorY(get_80575150());
|
||||
textWriter.SetCursorX(dGfx_c::getCurrentScreenWidthLimitF());
|
||||
textWriter.SetCursorY(dGfx_c::getCurrentScreenHeightLimitF());
|
||||
|
||||
textWriter.Print(str, wcslen(str));
|
||||
}
|
||||
|
||||
+390
@@ -0,0 +1,390 @@
|
||||
#include "d/d_pad.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "egg/core/eggController.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "m/m_pad.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "rvl/KPAD/KPAD.h"
|
||||
#include "rvl/WPAD/WPAD.h"
|
||||
|
||||
#include "rvl/WPAD.h"
|
||||
|
||||
namespace dPad {
|
||||
|
||||
ex_c ex_c::m_ex[4];
|
||||
ex_c *ex_c::m_current_ex = ex_c::m_ex;
|
||||
|
||||
WPADInfo ex_c::m_info[2][4];
|
||||
|
||||
bool ex_c::m_connected[4];
|
||||
|
||||
void control_mpls_callback(s32 idx, s32 code) {
|
||||
switch (code) {
|
||||
case WPAD_ERR_OK: {
|
||||
ex_c::on_0x54(idx);
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_NO_CONTROLLER: {
|
||||
ex_c::on_0x55(idx);
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_BUSY: {
|
||||
ex_c::on_0x56(idx);
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
ex_c::on_0x57(idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool checkDeviceType(u32 type) {
|
||||
switch (type) {
|
||||
case WPAD_DEV_MOTION_PLUS:
|
||||
case WPAD_DEV_MPLS_PT_FS:
|
||||
case WPAD_DEV_MPLS_PT_CLASSIC:
|
||||
case WPAD_DEV_MPLS_PT_UNKNOWN: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
void initMpls(s32 chan) {
|
||||
KPADResetMpls(chan);
|
||||
KPADDisableMplsZeroPlay(chan);
|
||||
KPADSetMplsZeroPlayParam(chan, 0.005f);
|
||||
KPADSetMplsZeroDriftMode(chan, 2);
|
||||
disableMplsDirRevise(chan);
|
||||
KPADSetMplsDirReviseParam(chan, 0.35f);
|
||||
KPADEnableMplsAccRevise(chan);
|
||||
KPADSetMplsAccReviseParam(chan, 0.03f, 0.4f);
|
||||
KPADEnableMplsDpdRevise(chan);
|
||||
KPADSetMplsDpdReviseParam(chan, 0.5f);
|
||||
}
|
||||
|
||||
extern "C" void fn_80194080();
|
||||
void create() {
|
||||
mPad::create();
|
||||
|
||||
KPADSetBtnRepeat(mPad::getCore(0)->getChannelID(), 0.5f, 0.1f);
|
||||
ex_c::resetInfo();
|
||||
|
||||
KPADSetMplsWorkarea(new (0x20) u8[KPADGetMplsWorkSize()]);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
ex_c::m_ex[i].mMotion.init();
|
||||
KPADSetReviseMode(i, 1);
|
||||
KPADSetControlMplsCallback(i, control_mpls_callback);
|
||||
ex_c::m_ex[i].resetState(i);
|
||||
}
|
||||
fn_80194080();
|
||||
}
|
||||
|
||||
void setMpls(bool enable, s32 chan) {
|
||||
if (enable) {
|
||||
if (ex_c::m_ex[chan].mMplsEnabled == false) {
|
||||
ex_c::m_ex[chan].mMplsEnabled = true;
|
||||
KPADEnableMpls(chan, 5);
|
||||
initMpls(chan);
|
||||
}
|
||||
} else {
|
||||
if (ex_c::m_ex[chan].mMplsEnabled) {
|
||||
ex_c::m_ex[chan].mMplsEnabled = false;
|
||||
KPADDisableMpls(chan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void centerPos(mVec2_c &in, mVec2_c &out) {
|
||||
out.x = dGfx_c::getWidth4x3F() * 0.5f * (1.f + in.x) + dGfx_c::getWidth4x3LeftF();
|
||||
out.y = dGfx_c::getCurrentScreenHeightF() * -0.5f * (1.f + in.y) + dGfx_c::getCurrentScreenTopF();
|
||||
}
|
||||
|
||||
void beginPad_BR() {
|
||||
mPad::beginPad();
|
||||
|
||||
if (mPad::getCore(0)->isConnected()) {
|
||||
WPADSetAcceptConnection(0);
|
||||
} else {
|
||||
WPADSetAcceptConnection(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (mPad::getCore(i)->isConnected()) {
|
||||
WPADDisconnect(i);
|
||||
}
|
||||
}
|
||||
|
||||
ex_c::m_ex[0].fn_800572A0();
|
||||
if (mPad::getCore(0)->isConnected()) {
|
||||
ex_c::m_ex[0].getUnifiedWpadStatus(0);
|
||||
ex_c::m_ex[0].fn_80059300(0);
|
||||
ex_c::m_ex[0].fn_80056AF0(0);
|
||||
ex_c::m_ex[0].fn_80056B90(0);
|
||||
ex_c::m_ex[0].fn_80056CE0(0);
|
||||
ex_c::m_ex[0].fn_80056DF0(0);
|
||||
}
|
||||
|
||||
ex_c::m_current_ex = &ex_c::m_ex[mPad::getCurrentCoreID()];
|
||||
}
|
||||
|
||||
void endPad_BR() {
|
||||
mPad::endPad();
|
||||
}
|
||||
|
||||
void connectCallback(const EGG::CoreControllerConnectArg &rArg) {
|
||||
switch (rArg.result) {
|
||||
case WPAD_ERR_OK: {
|
||||
dSndPlayerMgr_c::GetInstance()->setup(rArg.chan);
|
||||
ex_c::m_ex[rArg.chan].mSpeakerSetup = true;
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_NO_CONTROLLER: {
|
||||
dSndPlayerMgr_c::GetInstance()->shutdown(rArg.chan);
|
||||
ex_c::m_ex[rArg.chan].mSpeakerShutdown = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setConnectCallback() {
|
||||
EGG::CoreControllerMgr::setConnectCallback(connectCallback);
|
||||
}
|
||||
|
||||
void enableMplsDirRevise(s32 chan) {
|
||||
KPADEnableMplsDirRevise(chan);
|
||||
}
|
||||
|
||||
void disableMplsDirRevise(s32 chan) {
|
||||
KPADDisableMplsDirRevise(chan);
|
||||
}
|
||||
|
||||
void ex_c::fn_80056AF0(s32 chan) {
|
||||
if (mSpeakerSetup) {
|
||||
mSpeakerSetup = false;
|
||||
field_0x38 = 90;
|
||||
field_0x44 = true;
|
||||
|
||||
m_ex[chan].field_0x46 = true;
|
||||
m_ex[chan].field_0x3C = 120;
|
||||
} else {
|
||||
field_0x44 = false;
|
||||
}
|
||||
if (mSpeakerShutdown) {
|
||||
mSpeakerShutdown = false;
|
||||
field_0x45 = true;
|
||||
m_ex[chan].mWPADDeviceTypeStable = WPAD_DEV_UNKNOWN;
|
||||
} else {
|
||||
field_0x45 = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ex_c::fn_80056B90(s32 chan) {
|
||||
u32 prevType = mWPADDeviceType;
|
||||
WPADResult prevResult = mWPADProbeResult;
|
||||
|
||||
mWPADProbeResult = WPADProbe(chan, &mWPADDeviceType);
|
||||
|
||||
if (prevResult == mWPADProbeResult) {
|
||||
mWPADProbeStableTimer++;
|
||||
if (mWPADProbeStableTimer >= 5) {
|
||||
mWPADProbeStableTimer = 5;
|
||||
}
|
||||
} else {
|
||||
mWPADProbeStableTimer = 0;
|
||||
}
|
||||
if (mWPADProbeStableTimer >= 5) {
|
||||
mWPADProbeResultStable = mWPADProbeResult;
|
||||
}
|
||||
if (field_0x38 > 0) {
|
||||
field_0x38--;
|
||||
if (field_0x38 < 0) {
|
||||
field_0x38 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (prevType != mWPADDeviceType) {
|
||||
mWPADDeviceTypeStableTimer = 0;
|
||||
} else {
|
||||
mWPADDeviceTypeStableTimer++;
|
||||
if (mWPADDeviceTypeStableTimer > 20) {
|
||||
mWPADDeviceTypeStableTimer = 20;
|
||||
}
|
||||
}
|
||||
|
||||
if (mWPADDeviceType != mWPADDeviceTypeStable && mWPADDeviceTypeStableTimer >= 20) {
|
||||
mWPADDeviceTypeStable = mWPADDeviceType;
|
||||
}
|
||||
|
||||
if (!checkDeviceType(mWPADDeviceTypeStable)) {
|
||||
mIncorrectDeviceType = true;
|
||||
field_0x6C = 0;
|
||||
}
|
||||
if (checkDeviceType(mWPADDeviceTypeStable) && field_0x6C < 8) {
|
||||
field_0x6C++;
|
||||
}
|
||||
}
|
||||
|
||||
void ex_c::fn_80056CE0(s32 chan) {
|
||||
if (field_0x46 == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (field_0x3C == 1) {
|
||||
if (WPADCanSendStreamData(chan) && WPADGetRadioSensitivity(chan) > 50) {
|
||||
WPADResult res = getInfo(chan);
|
||||
if (res == WPAD_ERR_OK || res == WPAD_ERR_NO_CONTROLLER) {
|
||||
field_0x46 = false;
|
||||
} else {
|
||||
field_0x3C = 120;
|
||||
}
|
||||
} else {
|
||||
field_0x3C = 120;
|
||||
}
|
||||
}
|
||||
field_0x3C--;
|
||||
if (field_0x3C < 0) {
|
||||
field_0x3C = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// . . .
|
||||
|
||||
bool ex_c::isLowBattery() {
|
||||
return getBatteryLevel() == 1;
|
||||
}
|
||||
bool ex_c::isOutOfBattery() {
|
||||
return getBatteryLevel() == 0;
|
||||
}
|
||||
|
||||
void ex_c::resetInfo() {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
clearInfo(i);
|
||||
}
|
||||
}
|
||||
void ex_c::clearInfo(s32 chan) {
|
||||
m_connected[chan] = false;
|
||||
m_info[0][chan].dpd = FALSE;
|
||||
m_info[0][chan].speaker = FALSE;
|
||||
m_info[0][chan].attach = FALSE;
|
||||
m_info[0][chan].lowBat = FALSE;
|
||||
m_info[0][chan].nearempty = FALSE;
|
||||
m_info[0][chan].battery = 0;
|
||||
m_info[0][chan].led = 0;
|
||||
m_info[0][chan].protocol = 0;
|
||||
m_info[0][chan].firmware = 0;
|
||||
}
|
||||
extern "C" void async_info_callback(WPADChannel chan, WPADResult result) {
|
||||
switch (result) {
|
||||
case WPAD_ERR_OK: {
|
||||
ex_c::setInfo(chan, &ex_c::m_info[0][chan]);
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_NO_CONTROLLER: {
|
||||
ex_c::clearInfo(chan);
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_BUSY: {
|
||||
ex_c::m_ex[chan].field_0x46 = true;
|
||||
ex_c::m_ex[chan].field_0x3C = 120;
|
||||
break;
|
||||
}
|
||||
case WPAD_ERR_TRANSFER: {
|
||||
ex_c::m_ex[chan].field_0x46 = true;
|
||||
ex_c::m_ex[chan].field_0x3C = 120;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
s32 ex_c::getInfo(s32 chan) {
|
||||
WPADResult res = WPADGetInfoAsync(chan, &ex_c::m_info[0][chan], async_info_callback);
|
||||
if (res == WPAD_ERR_NO_CONTROLLER) {
|
||||
clearInfo(chan);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
s32 ex_c::getBatteryLevel() {
|
||||
return getBatteryLevel(mPad::g_currentCoreId);
|
||||
}
|
||||
s32 ex_c::getBatteryLevel(s32 chan) {
|
||||
if (m_connected[chan]) {
|
||||
return m_info[0][chan].battery;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ex_c::setInfo(s32 chan, const WPADInfo *pInfo) {
|
||||
m_info[0][chan].dpd = pInfo->dpd;
|
||||
m_info[0][chan].speaker = pInfo->speaker;
|
||||
m_info[0][chan].attach = pInfo->attach;
|
||||
m_info[0][chan].lowBat = pInfo->lowBat;
|
||||
m_info[0][chan].nearempty = pInfo->nearempty;
|
||||
m_info[0][chan].battery = pInfo->battery;
|
||||
m_info[0][chan].led = pInfo->led;
|
||||
m_info[0][chan].protocol = pInfo->protocol;
|
||||
m_info[0][chan].firmware = pInfo->firmware;
|
||||
m_connected[chan] = true;
|
||||
}
|
||||
// . . .
|
||||
|
||||
void ex_c::on_0x54(s32 idx) {
|
||||
m_ex[idx].field_0x54[0] = true;
|
||||
}
|
||||
void ex_c::on_0x55(s32 idx) {
|
||||
m_ex[idx].field_0x54[1] = true;
|
||||
}
|
||||
void ex_c::on_0x56(s32 idx) {
|
||||
m_ex[idx].field_0x54[2] = true;
|
||||
}
|
||||
void ex_c::on_0x57(s32 idx) {
|
||||
m_ex[idx].field_0x54[3] = true;
|
||||
}
|
||||
|
||||
void ex_c::fn_800592D0(s32 chan) {
|
||||
m_ex[chan].field_0x54[0] = 0;
|
||||
m_ex[chan].field_0x54[1] = 0;
|
||||
m_ex[chan].field_0x54[2] = 0;
|
||||
m_ex[chan].field_0x54[3] = 0;
|
||||
}
|
||||
|
||||
void ex_c::fn_80059300(s32 chan) {
|
||||
field_0x58[0] = field_0x54[0];
|
||||
field_0x58[1] = field_0x54[1];
|
||||
field_0x58[2] = field_0x54[2];
|
||||
field_0x58[3] = field_0x54[3];
|
||||
fn_800592D0(chan);
|
||||
}
|
||||
|
||||
void ex_c::getUnifiedWpadStatus(s32 chan) {
|
||||
KPADGetUnifiedWpadStatus(chan, &mStatus, 1);
|
||||
}
|
||||
|
||||
void ex_c::fn_800593D0() {
|
||||
field_0x22D1 = 0;
|
||||
if (mFSStickDistance < 0.8f) {
|
||||
field_0x22D4 = 0;
|
||||
return;
|
||||
}
|
||||
u32 prev22D4 = field_0x22D4;
|
||||
s32 ang = mFSStickAngle;
|
||||
ang = ((ang + 0x11000) / 0x2000) % 8;
|
||||
field_0x22D4 = 1 << ang;
|
||||
if (field_0x22D4 != 0 && field_0x22D4 != prev22D4) {
|
||||
field_0x22D1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void setNoSleep() {
|
||||
WPADSetAutoSleepTime(0);
|
||||
}
|
||||
|
||||
void setAutoSleepTime() {
|
||||
WPADSetAutoSleepTime(5);
|
||||
WPADSetControllerLastDataUpdateTime(0);
|
||||
}
|
||||
|
||||
} // namespace dPad
|
||||
@@ -0,0 +1,270 @@
|
||||
#include "common.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "egg/core/eggController.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_pad.h"
|
||||
#include "m/m_vec.h"
|
||||
|
||||
namespace dPad {
|
||||
|
||||
void fn_80059620() {
|
||||
return;
|
||||
}
|
||||
|
||||
void fn_80059630() {
|
||||
return;
|
||||
}
|
||||
|
||||
void fn_80059640() {
|
||||
return;
|
||||
}
|
||||
|
||||
void fn_80059650() {
|
||||
return;
|
||||
}
|
||||
|
||||
// GET DOWN TRIG
|
||||
|
||||
bool getDownTrig(u32 btns) {
|
||||
return mPad::g_currentCore->downTrigger(btns);
|
||||
}
|
||||
|
||||
bool getDownTrigA() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_A);
|
||||
}
|
||||
|
||||
bool getDownTrigB() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_B);
|
||||
}
|
||||
|
||||
bool getDownTrigC() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_C);
|
||||
}
|
||||
|
||||
bool getDownTrigZ() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_Z);
|
||||
}
|
||||
|
||||
bool getDownTrigUp() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_UP);
|
||||
}
|
||||
|
||||
bool getDownTrigDown() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_DOWN);
|
||||
}
|
||||
|
||||
bool getDownTrigLeft() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_LEFT);
|
||||
}
|
||||
|
||||
bool getDownTrigRight() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_RIGHT);
|
||||
}
|
||||
|
||||
bool getDownTrig1() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_1);
|
||||
}
|
||||
|
||||
bool getDownTrig2() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_2);
|
||||
}
|
||||
|
||||
bool getDownTrigMinus() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_MINUS);
|
||||
}
|
||||
|
||||
bool getDownTrigPlus() {
|
||||
return mPad::g_currentCore->downTrigger(mPad::BUTTON_PLUS);
|
||||
}
|
||||
|
||||
// GET DOWN
|
||||
|
||||
bool getDown(u32 btns) {
|
||||
return mPad::g_currentCore->down(btns);
|
||||
}
|
||||
bool getDownAll(u32 btns) {
|
||||
return mPad::g_currentCore->downAll(btns);
|
||||
}
|
||||
bool getDownA() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_A);
|
||||
}
|
||||
bool getDownB() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_B);
|
||||
}
|
||||
bool getDownC() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_C);
|
||||
}
|
||||
bool getDownZ() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_Z);
|
||||
}
|
||||
bool getDownUp() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_UP);
|
||||
}
|
||||
bool getDownDown() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_DOWN);
|
||||
}
|
||||
bool getDownLeft() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_LEFT);
|
||||
}
|
||||
bool getDownRight() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_RIGHT);
|
||||
}
|
||||
bool getDown1() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_1);
|
||||
}
|
||||
bool getDown2() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_2);
|
||||
}
|
||||
bool getDownMinus() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_MINUS);
|
||||
}
|
||||
bool getDownPlus() {
|
||||
return mPad::g_currentCore->down(mPad::BUTTON_PLUS);
|
||||
}
|
||||
|
||||
// GET UP TRIG
|
||||
|
||||
bool getUpTrig(u32 btns) {
|
||||
return mPad::g_currentCore->upTrigger(btns);
|
||||
}
|
||||
bool getUpTrigA() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_A);
|
||||
}
|
||||
bool getUpTrigB() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_B);
|
||||
}
|
||||
bool getUpTrigC() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_C);
|
||||
}
|
||||
bool getUpTrigZ() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_Z);
|
||||
}
|
||||
bool getUpTrigUp() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_UP);
|
||||
}
|
||||
bool getUpTrigDown() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_DOWN);
|
||||
}
|
||||
bool getUpTrigLeft() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_LEFT);
|
||||
}
|
||||
bool getUpTrigRight() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_RIGHT);
|
||||
}
|
||||
bool getUpTrig1() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_1);
|
||||
}
|
||||
bool getUpTrig2() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_2);
|
||||
}
|
||||
bool getUpTrigMinus() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_MINUS);
|
||||
}
|
||||
bool getUpTrigPlus() {
|
||||
return mPad::g_currentCore->upTrigger(mPad::BUTTON_PLUS);
|
||||
}
|
||||
|
||||
// GET UP
|
||||
|
||||
bool getUp(u32 btns) {
|
||||
return mPad::g_currentCore->up(btns);
|
||||
}
|
||||
bool getUpAll(u32 btns) {
|
||||
return mPad::g_currentCore->upAll(btns);
|
||||
}
|
||||
bool getUpA() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_A);
|
||||
}
|
||||
bool getUpB() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_B);
|
||||
}
|
||||
bool getUpC() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_C);
|
||||
}
|
||||
bool getUpZ() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_Z);
|
||||
}
|
||||
bool getUpUp() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_UP);
|
||||
}
|
||||
bool getUpDown() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_DOWN);
|
||||
}
|
||||
bool getUpLeft() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_LEFT);
|
||||
}
|
||||
bool getUpRight() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_RIGHT);
|
||||
}
|
||||
bool getUp1() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_1);
|
||||
}
|
||||
bool getUp2() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_2);
|
||||
}
|
||||
bool getUpMinus() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_MINUS);
|
||||
}
|
||||
bool getUpPlus() {
|
||||
return mPad::g_currentCore->up(mPad::BUTTON_PLUS);
|
||||
}
|
||||
|
||||
mVec2_c &getDpdPos() {
|
||||
return ex_c::m_current_ex->mDpdPos;
|
||||
}
|
||||
mVec2_c &getDpdStableMaybe() {
|
||||
return ex_c::m_current_ex->field_0x8;
|
||||
}
|
||||
mVec2_c &getFSStick() {
|
||||
return ex_c::m_current_ex->mFSStick;
|
||||
}
|
||||
f32 getFSStickX() {
|
||||
return ex_c::m_current_ex->mFSStick.x;
|
||||
}
|
||||
f32 getFSStickY() {
|
||||
return ex_c::m_current_ex->mFSStick.y;
|
||||
}
|
||||
f32 getFSStickDistance() {
|
||||
return ex_c::m_current_ex->mFSStickDistance;
|
||||
}
|
||||
mAng getFSStickAngle() {
|
||||
return ex_c::m_current_ex->mFSStickAngle;
|
||||
}
|
||||
mVec3_c getAcc() {
|
||||
const EGG::CoreStatus *status = mPad::g_currentCore->getCoreStatus();
|
||||
return mVec3_c(status->acc.x, status->acc.y, status->acc.z);
|
||||
}
|
||||
|
||||
u32 fn_80059B750() {
|
||||
return ex_c::getInstance()->mMotion.field_0x10C8 >> 0 & 1;
|
||||
}
|
||||
u32 fn_80059B760() {
|
||||
return ex_c::getInstance()->mMotion.field_0x10C8 >> 1 & 1;
|
||||
}
|
||||
u32 fn_80059B70() {
|
||||
return ex_c::getInstance()->mMotion.field_0x10C8 >> 2 & 1;
|
||||
}
|
||||
u32 fn_80059B80() {
|
||||
return ex_c::getInstance()->mMotion.field_0x10C8 >> 3 & 1;
|
||||
}
|
||||
u32 fn_80059B90() {
|
||||
return ex_c::getInstance()->mMotion.field_0x10C8 >> 5 & 1;
|
||||
}
|
||||
|
||||
mVec3_c getFSAcc() {
|
||||
if (mPad::g_padMg->getDevType(mPad::g_currentCoreId) == EGG::cDEV_FREESTYLE ||
|
||||
mPad::g_padMg->getDevType(mPad::g_currentCoreId) == EGG::cDEV_MPLS_PT_FS) {
|
||||
const EGG::CoreStatus *status = mPad::g_currentCore->getCoreStatus();
|
||||
return mVec3_c(status->ex_status.fs.acc.x, status->ex_status.fs.acc.y, status->ex_status.fs.acc.z);
|
||||
} else {
|
||||
return mVec3_c(mVec3_c::Zero.x, mVec3_c::Zero.y, mVec3_c::Zero.z);
|
||||
}
|
||||
}
|
||||
u32 fn_80059CC0() {
|
||||
return ex_c::getInstance()->mFSMotion.field_0x10C8 >> 4 & 1;
|
||||
}
|
||||
u32 fn_80059CD0() {
|
||||
return ex_c::getInstance()->mFSMotion.field_0x10C8 >> 5 & 1;
|
||||
}
|
||||
|
||||
} // namespace dPad
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "d/d_dvd_unk.h"
|
||||
#include "d/d_heap.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "f/f_base.h"
|
||||
@@ -66,7 +67,6 @@ dScTitle_c::~dScTitle_c() {
|
||||
}
|
||||
|
||||
extern "C" u32 TITLE_SCREEN_CHANGE;
|
||||
extern "C" void fn_80059450();
|
||||
extern "C" void fn_80058C90(s32);
|
||||
|
||||
static const char *const sFileSelect = "FileSelect";
|
||||
@@ -90,7 +90,7 @@ int dScTitle_c::create() {
|
||||
if (ret == SUCCEEDED) {
|
||||
dSys::setFrameRate(2);
|
||||
dSys::setClearColor(mColor(0x00000000));
|
||||
fn_80059450();
|
||||
dPad::setAutoSleepTime();
|
||||
fn_80058C90(0);
|
||||
SaveRelated::create();
|
||||
field_0x2AD = 0;
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#include "d/d_textwindow_unk.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/other_sound_stuff.h"
|
||||
|
||||
TextWindowUnk::TextWindowUnk(dTagProcessor_c *c) {
|
||||
@@ -89,7 +89,7 @@ void MsgWindowBlurRelated::drawTextBlur(dLytTextLight *thing, mVec2_c size, u8 a
|
||||
} else {
|
||||
mData[i].displayTimerMaybe = t;
|
||||
}
|
||||
mVec3_c v((size.x + mData[i].posX) / get_805751A4(), size.y + mData[i].posY, 0.0f);
|
||||
mVec3_c v((size.x + mData[i].posX) / dGfx_c::get16x9to4x3WidthScaleF(), size.y + mData[i].posY, 0.0f);
|
||||
thing->draw(mData[i].displayTimerMaybe, v, alpha, mData[i].field_0x08);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,43 +232,43 @@ bool dLytAreaCaptionParts_c::shouldImmediatelyDismiss() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dPad::checkButtonBPressed()) {
|
||||
if (dPad::getDownTrigB()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_C) && dPad::checkButtonCPressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_C) && dPad::getDownTrigC()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_PLUS) && dPad::checkButtonPlusPressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_PLUS) && dPad::getDownTrigPlus()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dPad::checkButtonMinusPressed()) {
|
||||
if (dPad::getDownTrigMinus()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_1) && dPad::checkButton1Pressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_1) && dPad::getDownTrig1()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_2) && dPad::checkButton2Pressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_2) && dPad::getDownTrig2()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dPad::checkButtonDpadUpPressed()) {
|
||||
if (dPad::getDownTrigUp()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_DOWN) && dPad::checkButtonDpadDownPressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_DOWN) && dPad::getDownTrigDown()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_LEFT) && dPad::checkButtonDpadLeftPressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_LEFT) && dPad::getDownTrigLeft()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_RIGHT) && dPad::checkButtonDpadRightPressed()) {
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_CROSS_RIGHT) && dPad::getDownTrigRight()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "d/lyt/d_lyt_battery.h"
|
||||
|
||||
#include "d/d_d2d.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "egg/core/eggController.h"
|
||||
#include "m/m_pad.h"
|
||||
#include "toBeSorted/arc_managers/layout_arc_manager.h"
|
||||
@@ -85,11 +86,8 @@ bool dLytBattery_c::dismissManually() {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" bool isLowBattery1();
|
||||
extern "C" bool isLowBattery2();
|
||||
|
||||
bool dLytBattery_c::hasEnoughBatteryCharge() {
|
||||
if (!mPad::g_currentCore->mFlag.offBit(0) && (isLowBattery2() || isLowBattery1())) {
|
||||
if (mPad::getCore()->isConnected() && (dPad::ex_c::isLowBattery() || dPad::ex_c::isOutOfBattery())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_font_manager.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
@@ -20,7 +21,6 @@
|
||||
#include "rvl/GX/GXPixel.h"
|
||||
#include "rvl/GX/GXTev.h"
|
||||
#include "rvl/GX/GXTypes.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -442,7 +442,7 @@ f32 dTextBox_c::GetLinesHeight() const {
|
||||
}
|
||||
|
||||
f32 dTextBox_c::GetUnkWidthRatio() const {
|
||||
return GetLineWidth(nullptr) / get_805751A4();
|
||||
return GetLineWidth(nullptr) / dGfx_c::get16x9to4x3WidthScaleF();
|
||||
}
|
||||
|
||||
f32 dTextBox_c::resizeTextToFit(f32 maxWidth) {
|
||||
|
||||
@@ -791,7 +791,7 @@ void dLytMeterItemSelect_c::finalizeState_SelectIn() {
|
||||
|
||||
void dLytMeterItemSelect_c::initializeState_Select() {}
|
||||
void dLytMeterItemSelect_c::executeState_Select() {
|
||||
if (dLytMeter_c::getCrossIconDown() == 0 && dPad::checkButtonDpadDownPressed()) {
|
||||
if (dLytMeter_c::getCrossIconDown() == 0 && dPad::getDownTrigDown()) {
|
||||
if (field_0x5794 != I_INVALID) {
|
||||
field_0x5780 = 0.0f;
|
||||
mStateMgr.changeState(StateID_SetIn);
|
||||
|
||||
@@ -186,14 +186,15 @@ bool dLytMeterZBtn_c::execute() {
|
||||
return true;
|
||||
}
|
||||
field_0x1C4 = true;
|
||||
if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || AttentionManager::GetInstance()->checkLink2()) &&
|
||||
if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") ||
|
||||
AttentionManager::GetInstance()->checkLink2()) &&
|
||||
LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z) == 0x67) {
|
||||
field_0x1C4 = false;
|
||||
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE);
|
||||
}
|
||||
field_0x1B4 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z);
|
||||
field_0x1B8 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_Z) &&
|
||||
dLytMeter_c::GetInstance()->checkAllFlags(0x800);
|
||||
field_0x1B8 =
|
||||
LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_Z) && dLytMeter_c::GetInstance()->checkAllFlags(0x800);
|
||||
mStateMgr.executeState();
|
||||
|
||||
for (int i = 0; i < Z_BTN_NUM_ANIMS; i++) {
|
||||
@@ -204,7 +205,7 @@ bool dLytMeterZBtn_c::execute() {
|
||||
|
||||
if (dLytControlGame_c::getInstance()->isStateNormal()) {
|
||||
if (StoryflagManager::sInstance->getCounterOrFlag(565)) {
|
||||
if (dPad::checkButtonZPressed()) {
|
||||
if (dPad::getDownTrigZ()) {
|
||||
field_0x1C5 = 0;
|
||||
StoryflagManager::sInstance->unsetFlag(565);
|
||||
} else {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "d/lyt/d_lyt_auto_caption.h"
|
||||
// clang-format on
|
||||
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_fader_base.h"
|
||||
@@ -36,7 +37,6 @@
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/fi_context.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/other_sound_stuff.h"
|
||||
|
||||
@@ -265,9 +265,14 @@ void dLytMsgWindow_c::initializeState_In() {
|
||||
param = 1;
|
||||
} else if (obj != nullptr && d3d::fn_80016A90(obj->poscopy2)) {
|
||||
d3d::fn_80016960(field_0x768, obj->poscopy2);
|
||||
// TODO - stack and FPR problems
|
||||
field_0x768 = mVec3_c(field_0x768.x, field_0x768.y, 0.0f);
|
||||
if (field_0x768.y < get_8057511C() / 3.0f + get_80575134()) {
|
||||
mVec3_c v = field_0x768;
|
||||
v.z = 0.f;
|
||||
field_0x768 = v;
|
||||
f32 h, b;
|
||||
h = dGfx_c::getCurrentScreenHeight();
|
||||
b = +dGfx_c::getCurrentScreenBottom();
|
||||
|
||||
if (v.y < b + (h / 3.f)) {
|
||||
param = 2;
|
||||
}
|
||||
}
|
||||
@@ -297,7 +302,7 @@ void dLytMsgWindow_c::executeState_OutputText() {
|
||||
|
||||
if (field_0x815 == 0 && field_0x816 == 0) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(false, true);
|
||||
if (field_0x811 == 0 && dPad::checkButtonAHeld() && field_0x815 == 0 && field_0x816 == 0) {
|
||||
if (field_0x811 == 0 && dPad::getDownA() && field_0x815 == 0 && field_0x816 == 0) {
|
||||
mpMsgWindowUnk->textAdvancingRelated(false, true);
|
||||
}
|
||||
}
|
||||
@@ -354,7 +359,7 @@ void dLytMsgWindow_c::executeState_WaitKeyChangePage0() {
|
||||
field_0x813 = 0;
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (dPad::checkButtonAPressed() || fn_8011A5D0()) {
|
||||
} else if (dPad::getDownTrigA() || fn_8011A5D0()) {
|
||||
fn_8035E880(BGM_MGR);
|
||||
allowChange = true;
|
||||
}
|
||||
@@ -414,7 +419,7 @@ void dLytMsgWindow_c::executeState_WaitKeyMsgEnd0() {
|
||||
field_0x813 = 0;
|
||||
allowChange = true;
|
||||
}
|
||||
} else if (dPad::checkButtonAPressed() || fn_8011A5D0()) {
|
||||
} else if (dPad::getDownTrigA() || fn_8011A5D0()) {
|
||||
fn_8035E880(BGM_MGR);
|
||||
allowChange = true;
|
||||
}
|
||||
@@ -553,8 +558,7 @@ void dLytMsgWindow_c::finalizeState_MapOpen() {}
|
||||
|
||||
void dLytMsgWindow_c::initializeState_WaitKeyMapClose() {}
|
||||
void dLytMsgWindow_c::executeState_WaitKeyMapClose() {
|
||||
if ((dPad::checkButtonBPressed() || dPad::checkButtonPlusPressed()) &&
|
||||
!dLytControlGame_c::getInstance()->isNotInStateMap()) {
|
||||
if ((dPad::getDownTrigB() || dPad::getDownTrigPlus()) && !dLytControlGame_c::getInstance()->isNotInStateMap()) {
|
||||
dLytControlGame_c::getInstance()->fn_802CCD40(true);
|
||||
mStateMgr.changeState(StateID_MapClose);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, On);
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Select);
|
||||
@@ -328,7 +327,7 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mBtnHelper.field_0x50 >= 0 && dPad::checkButtonAPressed()) {
|
||||
if (mBtnHelper.field_0x50 >= 0 && dPad::getDownTrigA()) {
|
||||
field_0x9D0 = 0;
|
||||
field_0x9B0 = mBtnHelper.field_0x50;
|
||||
mStateMgr.changeState(StateID_WaitDecide);
|
||||
@@ -339,7 +338,7 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
}
|
||||
fn_8035E880(BGM_MGR);
|
||||
} else if (dPad::checkButtonBPressed()) {
|
||||
} else if (dPad::getDownTrigB()) {
|
||||
f32 f = mBtnHelper.fn_8011D690(field_0x9BC);
|
||||
// TODO
|
||||
field_0x9CC = field_0x9BC;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_sword.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
@@ -11,7 +12,6 @@
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "s/s_State.hpp"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowSword_c, In);
|
||||
@@ -271,7 +271,8 @@ void dLytMsgWindowSword_c::draw() {
|
||||
mCharacterData[i].displayTimerMaybe += 1;
|
||||
}
|
||||
mVec3_c v(
|
||||
(mOffset.x + mCharacterData[i].posX) / get_805751A4(), mOffset.y + mCharacterData[i].posY, 0.0f
|
||||
(mOffset.x + mCharacterData[i].posX) / dGfx_c::get16x9to4x3WidthScaleF(),
|
||||
mOffset.y + mCharacterData[i].posY, 0.0f
|
||||
);
|
||||
|
||||
wchar_t str[2];
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
|
||||
#include "egg/core/eggDvdRipper.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
@@ -72,6 +73,14 @@ void dSndPlayerMgr_c::leaveHelp() {
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HELP_OUT);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::setup(s32 channel) {
|
||||
EGG::AudioRmtSpeakerMgr::setup(channel, nullptr);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::shutdown(s32 channel) {
|
||||
EGG::AudioRmtSpeakerMgr::shutdown(channel, nullptr);
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
|
||||
nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
|
||||
) {
|
||||
@@ -118,10 +127,8 @@ bool dSndPlayerMgr_c::canUseThisPlayer(u8 sourceType) const {
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_PLAYER:
|
||||
case SND_SOURCE_PLAYER_HEAD:
|
||||
case SND_SOURCE_58:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case SND_SOURCE_58: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
|
||||
|
||||
#include "nw4r/snd/snd_SoundSystem.h"
|
||||
|
||||
#include "rvl/OS.h" // IWYU pragma: export
|
||||
|
||||
namespace EGG {
|
||||
@@ -21,7 +22,7 @@ void AudioRmtSpeakerMgr::setupCallback(s32 arg1, s32 arg2) {
|
||||
}
|
||||
sAudioRmtSpeakerWpadVolume = WPADGetSpeakerVolume();
|
||||
} else {
|
||||
fn_804B6D80(arg1, sTasks[mTaskFinishCount].mpCallback);
|
||||
setup(arg1, sTasks[mTaskFinishCount].mpCallback);
|
||||
}
|
||||
sTasks[mTaskFinishCount].field_0x01 = true;
|
||||
}
|
||||
@@ -32,12 +33,12 @@ void AudioRmtSpeakerMgr::shutdownCallback(s32 arg1, s32 arg2) {
|
||||
(sTasks[mTaskFinishCount].mpCallback)(arg1, arg2);
|
||||
}
|
||||
} else {
|
||||
fn_804B6DE0(arg1, sTasks[mTaskFinishCount].mpCallback);
|
||||
shutdown(arg1, sTasks[mTaskFinishCount].mpCallback);
|
||||
}
|
||||
sTasks[mTaskFinishCount].field_0x01 = true;
|
||||
}
|
||||
|
||||
void AudioRmtSpeakerMgr::fn_804B6AF0(s32 i, WPADCallback *pCallback, bool enable) {
|
||||
void AudioRmtSpeakerMgr::add_task(s32 i, WPADCallback *pCallback, bool enable) {
|
||||
BOOL intr = OSDisableInterrupts();
|
||||
|
||||
u32 index = mTaskRequestCount;
|
||||
@@ -52,14 +53,14 @@ void AudioRmtSpeakerMgr::fn_804B6AF0(s32 i, WPADCallback *pCallback, bool enable
|
||||
OSRestoreInterrupts(intr);
|
||||
}
|
||||
|
||||
void AudioRmtSpeakerMgr::fn_804B6B80(s32 i, WPADCallback *pCallback) {
|
||||
void AudioRmtSpeakerMgr::doSetup(s32 i, WPADCallback *pCallback) {
|
||||
if (!nw4r::snd::SoundSystem::GetRemoteSpeaker(i).Setup(pCallback)) {
|
||||
fn_804B6AF0(i, pCallback, true);
|
||||
add_task(i, pCallback, true);
|
||||
sTasks[mTaskRequestCount].field_0x01 = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioRmtSpeakerMgr::fn_804B6C00(s32 i, WPADCallback *pCallback) {
|
||||
void AudioRmtSpeakerMgr::doShutdown(s32 i, WPADCallback *pCallback) {
|
||||
nw4r::snd::SoundSystem::GetRemoteSpeaker(i).Shutdown(pCallback);
|
||||
}
|
||||
|
||||
@@ -67,9 +68,9 @@ void AudioRmtSpeakerMgr::calc() {
|
||||
if (!sTask) {
|
||||
if (mTaskRequestCount != mTaskFinishCount) {
|
||||
if (sTasks[mTaskFinishCount].field_0x00) {
|
||||
fn_804B6B80(sTasks[mTaskFinishCount].mChannel, setupCallback);
|
||||
doSetup(sTasks[mTaskFinishCount].mChannel, setupCallback);
|
||||
} else {
|
||||
fn_804B6C00(sTasks[mTaskFinishCount].mChannel, shutdownCallback);
|
||||
doShutdown(sTasks[mTaskFinishCount].mChannel, shutdownCallback);
|
||||
}
|
||||
sTask = true;
|
||||
}
|
||||
@@ -86,7 +87,7 @@ void AudioRmtSpeakerMgr::setupCallbackDirect(s32 arg1, s32 arg2) {
|
||||
if (arg2 == 0) {
|
||||
sAudioRmtSpeakerWpadVolume = WPADGetSpeakerVolume();
|
||||
} else {
|
||||
fn_804B6B80(arg1, setupCallbackDirect);
|
||||
doSetup(arg1, setupCallbackDirect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,17 +98,17 @@ void AudioRmtSpeakerMgr::shutdownCallbackDirect(s32 arg1, s32 arg2) {
|
||||
if (arg2 == 0) {
|
||||
return;
|
||||
}
|
||||
fn_804B6C00(arg1, shutdownCallbackDirect);
|
||||
doShutdown(arg1, shutdownCallbackDirect);
|
||||
}
|
||||
|
||||
void AudioRmtSpeakerMgr::fn_804B6D80(s32 i, WPADCallback *pCallback) {
|
||||
void AudioRmtSpeakerMgr::setup(s32 i, WPADCallback *pCallback) {
|
||||
WPADDeviceType ty;
|
||||
if (!sAudioRmtSpeakerConnectCanncelSw && WPADProbe(i, &ty) != WPAD_ERR_NO_CONTROLLER) {
|
||||
fn_804B6AF0(i, pCallback, true);
|
||||
add_task(i, pCallback, true);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioRmtSpeakerMgr::fn_804B6DE0(s32 i, WPADCallback *pCallback) {
|
||||
void AudioRmtSpeakerMgr::shutdown(s32 i, WPADCallback *pCallback) {
|
||||
WPADDeviceType ty;
|
||||
if (!sAudioRmtSpeakerConnectCanncelSw) {
|
||||
if (WPADProbe(i, &ty) == WPAD_ERR_NO_CONTROLLER) {
|
||||
@@ -115,7 +116,7 @@ void AudioRmtSpeakerMgr::fn_804B6DE0(s32 i, WPADCallback *pCallback) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
fn_804B6AF0(i, pCallback, false);
|
||||
add_task(i, pCallback, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ void AudioRmtSpeakerMgr::connectAllByForce() {
|
||||
sAudioRmtSpeakerConnectCanncelSw = false;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (WPADProbe(i, &ty) != WPAD_ERR_NO_CONTROLLER) {
|
||||
fn_804B6B80(i, setupCallbackDirect);
|
||||
doSetup(i, setupCallbackDirect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,7 +135,7 @@ void AudioRmtSpeakerMgr::disconnectAllByForce() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
WPADProbe(i, &ty); // ignoring result here
|
||||
if (nw4r::snd::SoundSystem::GetRemoteSpeaker(i).IsAvailable()) {
|
||||
fn_804B6C00(i, shutdownCallbackDirect);
|
||||
doShutdown(i, shutdownCallbackDirect);
|
||||
}
|
||||
}
|
||||
sAudioRmtSpeakerConnectCanncelSw = true;
|
||||
|
||||
+106
-102
@@ -5,16 +5,20 @@
|
||||
#include "egg/core/eggExpHeap.h"
|
||||
#include "egg/core/eggSystem.h"
|
||||
#include "egg/math/eggMath.h"
|
||||
#include "rvl/VI.h" // IWYU pragma: export
|
||||
#include "egg/math/eggVector.h"
|
||||
#include "rvl/WPAD/WPAD.h"
|
||||
#include "string.h"
|
||||
|
||||
EGG::NullController null_controller;
|
||||
#include "rvl/VI.h" // IWYU pragma: export
|
||||
|
||||
namespace EGG {
|
||||
|
||||
NullController null_controller;
|
||||
|
||||
CoreControllerMgr *CoreControllerMgr::sInstance;
|
||||
CoreControllerMgr::T__Disposer *CoreControllerMgr::T__Disposer::sStaticDisposer;
|
||||
ControllerFactory CoreControllerMgr::sCoreControllerFactory;
|
||||
ConnectCallback CoreControllerMgr::sConnectCallback;
|
||||
CoreControllerFactory CoreControllerMgr::sCoreControllerFactory;
|
||||
CoreControllerConnectCallback CoreControllerMgr::sConnectCallback;
|
||||
// This controls whether EggController registers an allocator within the WPAD driver
|
||||
bool CoreControllerMgr::sUseBuiltinWpadAllocator;
|
||||
s32 CoreControllerMgr::sWPADWorkSize = 0x32000;
|
||||
@@ -23,7 +27,7 @@ void CoreStatus::init() {
|
||||
memset(this, 0, sizeof(CoreStatus));
|
||||
}
|
||||
|
||||
u32 CoreStatus::getFSStickButton() const {
|
||||
u32 CoreStatus::getFSStickButton() {
|
||||
f32 stick = getFSStickX();
|
||||
u32 result = 0;
|
||||
|
||||
@@ -51,47 +55,47 @@ u32 CoreStatus::getFSStickButton() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreController::CoreController() : mDpdPos(), mAccel(), mAccelFlags(), mFlag(0) {
|
||||
CoreController::CoreController() : mDpdPosPrev(), mStableAccel(), mFlag(0) {
|
||||
mRumbleMgr = nullptr;
|
||||
mButtonHeld = 0;
|
||||
mButtonTriggered = 0;
|
||||
mButtonReleased = 0;
|
||||
mFSStickHold = 0;
|
||||
mFSStickTrig = 0;
|
||||
mFSStickRelease = 0;
|
||||
sceneReset();
|
||||
mFlag.makeAllZero();
|
||||
}
|
||||
|
||||
void CoreController::sceneReset() {
|
||||
mAccel.set(0.0, 0.0, 0.0);
|
||||
mDpdPos.x = 0.0f;
|
||||
mDpdPos.y = 0.0f;
|
||||
mAccelPrev.set(0.0, 0.0, 0.0);
|
||||
mDpdPosPrev.x = 0.0f;
|
||||
mDpdPosPrev.y = 0.0f;
|
||||
mIdleTime = 0;
|
||||
mPostureMatrixPrev.makeIdentity();
|
||||
mPostureMatrix.makeIdentity();
|
||||
mMaxAccelFrameTime = 10;
|
||||
mMaxAccelDiff = 0.13;
|
||||
mPrevAccel.set(0.0, 0.0, 0.0);
|
||||
mAccelFlags.makeAllZero();
|
||||
mAccelFrameTime[2] = 0;
|
||||
mAccelFrameTime[1] = 0;
|
||||
mAccelFrameTime[0] = 0;
|
||||
mMotorPattern = 0;
|
||||
mMotorFrameDuration = 0;
|
||||
mEnableMotor = false;
|
||||
mMotorPatternLength = 0x20;
|
||||
mMotorPatternPos = 0x1f;
|
||||
mStableFrame = 10;
|
||||
mStableMag = 0.13;
|
||||
mStableAccel.set(0.0, 0.0, 0.0);
|
||||
mStableFlags = 0;
|
||||
mStableTimer[2] = 0;
|
||||
mStableTimer[1] = 0;
|
||||
mStableTimer[0] = 0;
|
||||
mSimpleRumblePattern = 0;
|
||||
mSimpleRumbleFrame = 0;
|
||||
mEnableSimpleRumble = false;
|
||||
mSimpleRumbleSize = 0x20;
|
||||
mSimpleRumbleIndex = 0x1f;
|
||||
stopRumbleMgr();
|
||||
}
|
||||
|
||||
Vector2f CoreController::getDpdRawPos() {
|
||||
return Vector2f(mCoreStatus[0].mDpdRawX, mCoreStatus[0].mDpdRawY);
|
||||
return Vector2f(mCoreStatus[0].pos.x, mCoreStatus[0].pos.y);
|
||||
}
|
||||
|
||||
f32 CoreController::getDpdDistance() {
|
||||
return mCoreStatus[0].mDpdDistance;
|
||||
return mCoreStatus[0].dist;
|
||||
}
|
||||
|
||||
s32 CoreController::getDpdValidFlag() {
|
||||
return mCoreStatus[0].getDpdValidFlag();
|
||||
return mCoreStatus[0].getDPDValidFlag();
|
||||
}
|
||||
|
||||
void CoreController::startMotor() {
|
||||
@@ -169,15 +173,15 @@ void CoreController::calc_posture_matrix(Matrix34f &posture, bool checkStable) {
|
||||
|
||||
void CoreController::beginFrame(PADStatus *padStatus) {
|
||||
s32 kpad_result;
|
||||
mReadStatusIdx = KPADReadEx(mChannelID, mCoreStatus, 0x10, &kpad_result);
|
||||
if (mReadStatusIdx == 0 && kpad_result == -1 /* Rvl usually uses negative nums for results */) {
|
||||
mReadStatusIdx = 1;
|
||||
mKPADReadLength = KPADReadEx(mChannelID, mCoreStatus, 0x10, &kpad_result);
|
||||
if (mKPADReadLength == 0 && kpad_result == WPAD_ERR_NO_CONTROLLER) {
|
||||
mKPADReadLength = 1;
|
||||
}
|
||||
|
||||
WPADDeviceType dev_type;
|
||||
switch (WPADProbe(mChannelID, &dev_type)) {
|
||||
case WPAD_ERR_OK: {
|
||||
if ((u32)dev_type == WPAD_DEV_NONE) {
|
||||
if ((u32)dev_type == WPAD_DEV_NOT_FOUND) {
|
||||
mFlag.resetBit(0);
|
||||
} else {
|
||||
mFlag.setBit(0);
|
||||
@@ -188,59 +192,59 @@ void CoreController::beginFrame(PADStatus *padStatus) {
|
||||
} break;
|
||||
}
|
||||
|
||||
if (mReadStatusIdx > 0) {
|
||||
if (mKPADReadLength > 0) {
|
||||
CoreStatus *pStatus = mCoreStatus;
|
||||
u32 prev_held = mButtonHeld;
|
||||
u32 prev_held = mFSStickHold;
|
||||
if (pStatus->isFreestyle()) {
|
||||
mButtonHeld = pStatus->getFSStickButton();
|
||||
mFSStickHold = pStatus->getFSStickButton();
|
||||
} else {
|
||||
mButtonHeld = 0;
|
||||
mFSStickHold = 0;
|
||||
}
|
||||
|
||||
mButtonTriggered = mButtonHeld & ~prev_held;
|
||||
mButtonReleased = prev_held & ~mButtonHeld;
|
||||
pStatus->mHold &= ~0xF0000;
|
||||
pStatus->mTrig &= ~0xF0000;
|
||||
pStatus->mRelease &= ~0xF0000;
|
||||
pStatus->mHold |= (mButtonHeld & 0xF0000);
|
||||
pStatus->mTrig |= (mButtonTriggered & 0xF0000);
|
||||
pStatus->mRelease |= (mButtonReleased & 0xF0000);
|
||||
mFSStickTrig = mFSStickHold & ~prev_held;
|
||||
mFSStickRelease = prev_held & ~mFSStickHold;
|
||||
pStatus->hold &= ~0xF0000;
|
||||
pStatus->trig &= ~0xF0000;
|
||||
pStatus->release &= ~0xF0000;
|
||||
pStatus->hold |= (mFSStickHold & 0xF0000);
|
||||
pStatus->trig |= (mFSStickTrig & 0xF0000);
|
||||
pStatus->release |= (mFSStickRelease & 0xF0000);
|
||||
}
|
||||
|
||||
mPostureMatrixPrev.copyFrom(mPostureMatrix);
|
||||
mAccelFlags.makeAllZero();
|
||||
mStableFlags = 0;
|
||||
Vector3f acc = mCoreStatus->getAccel();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (acc(i) - mAccel(i) < mMaxAccelDiff) {
|
||||
if (mMaxAccelFrameTime <= ++mAccelFrameTime[i]) {
|
||||
mAccelFrameTime[i] = mMaxAccelFrameTime;
|
||||
mAccelFlags.set(1 << i);
|
||||
mPrevAccel(i) = acc(i);
|
||||
if (acc(i) - mAccelPrev(i) < mStableMag) {
|
||||
if (mStableFrame <= ++mStableTimer[i]) {
|
||||
mStableTimer[i] = mStableFrame;
|
||||
mStableFlags |= (1 << i);
|
||||
mStableAccel(i) = acc(i);
|
||||
}
|
||||
} else {
|
||||
mAccelFlags.value &= ~(1 << i); // ?
|
||||
mAccelFrameTime[i] = 0;
|
||||
mStableFlags &= ~(1 << i);
|
||||
mStableTimer[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
calc_posture_matrix(mPostureMatrix, true);
|
||||
|
||||
if (mEnableMotor) {
|
||||
if (mMotorPattern & (1 << mMotorPatternPos)) {
|
||||
if (mEnableSimpleRumble) {
|
||||
if (mSimpleRumblePattern & (1 << mSimpleRumbleIndex)) {
|
||||
startMotor();
|
||||
} else {
|
||||
stopMotor();
|
||||
}
|
||||
if (mMotorPatternPos == 0) {
|
||||
mMotorPatternPos = mMotorPatternLength - 1;
|
||||
if (mSimpleRumbleIndex == 0) {
|
||||
mSimpleRumbleIndex = mSimpleRumbleSize - 1;
|
||||
} else {
|
||||
mMotorPatternPos = mMotorPatternPos - 1;
|
||||
mSimpleRumbleIndex = mSimpleRumbleIndex - 1;
|
||||
}
|
||||
|
||||
if (--mMotorFrameDuration == 0) {
|
||||
if (--mSimpleRumbleFrame == 0) {
|
||||
stopMotor();
|
||||
mEnableMotor = false;
|
||||
mEnableSimpleRumble = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,13 +258,13 @@ void CoreController::beginFrame(PADStatus *padStatus) {
|
||||
}
|
||||
|
||||
if (increment) {
|
||||
Vector3f diff = (mAccel - mCoreStatus->getAccel());
|
||||
Vector3f diff = (mAccelPrev - mCoreStatus->getAccel());
|
||||
if (diff.squaredLength() > 0.01f) {
|
||||
increment = false;
|
||||
}
|
||||
}
|
||||
if (increment) {
|
||||
Vector2f diff = (mDpdPos - getDpdRawPos());
|
||||
Vector2f diff = (mDpdPosPrev - getDpdRawPos());
|
||||
if (diff.squaredLength() > 0.05f) {
|
||||
increment = false;
|
||||
}
|
||||
@@ -278,8 +282,8 @@ void CoreController::beginFrame(PADStatus *padStatus) {
|
||||
}
|
||||
|
||||
void CoreController::endFrame() {
|
||||
mAccel = getAccel();
|
||||
mDpdPos = getDpdRawPos();
|
||||
mAccelPrev = *reinterpret_cast<Vector3f *>(&mCoreStatus[0].acc);
|
||||
mDpdPosPrev = getDpdRawPos();
|
||||
}
|
||||
|
||||
/* 0x80499AC0 */
|
||||
@@ -343,7 +347,7 @@ int free(void *ptr) {
|
||||
|
||||
/* 0x80499CD0 */
|
||||
void CoreControllerMgr::connectCallback(s32 a1, s32 a2) {
|
||||
int args[] = {a1, a2};
|
||||
CoreControllerConnectArg args = {a1, a2};
|
||||
if (sConnectCallback != nullptr) {
|
||||
(sConnectCallback)(args);
|
||||
}
|
||||
@@ -393,7 +397,7 @@ void CoreControllerMgr::beginFrame() {
|
||||
|
||||
/* 0x8049A1E0 */
|
||||
void CoreControllerMgr::endFrame() {
|
||||
for (int i = 0; i < mControllers.mSize; i++) {
|
||||
for (int i = 0; i < mControllers.getSize(); i++) {
|
||||
mControllers(i)->endFrame();
|
||||
|
||||
WPADDeviceType dev_type;
|
||||
@@ -403,7 +407,7 @@ void CoreControllerMgr::endFrame() {
|
||||
if (result == WPAD_ERR_OK) {
|
||||
res_dev_type = dev_type;
|
||||
} else if (result == WPAD_ERR_NO_CONTROLLER) {
|
||||
res_dev_type = WPAD_DEV_NONE;
|
||||
res_dev_type = WPAD_DEV_NOT_FOUND;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@@ -425,77 +429,77 @@ void CoreControllerMgr::endFrame() {
|
||||
|
||||
/* 0x8049A3B0 */
|
||||
void ControllerRumbleUnit::init() {
|
||||
mPattern = nullptr;
|
||||
mPatternPos = nullptr;
|
||||
mTimer = 0;
|
||||
mIntensity = 0.0f;
|
||||
mRampUp = 0.0f;
|
||||
mFlag.makeAllZero();
|
||||
mRumblePattern = nullptr;
|
||||
mRumblePatternPtr = nullptr;
|
||||
mRumbleFrame = 0;
|
||||
mRumbleValue = 0.0f;
|
||||
mRumblePower = 0.0f;
|
||||
mFlags.makeAllZero();
|
||||
}
|
||||
|
||||
/* 0x8049A3E0 */
|
||||
void ControllerRumbleUnit::startPattern(const char *pattern, int duration) {
|
||||
mPattern = pattern;
|
||||
mPatternPos = pattern;
|
||||
mRumblePattern = pattern;
|
||||
mRumblePatternPtr = pattern;
|
||||
|
||||
mFlag.value &= 0xef;
|
||||
mFlag.value &= 0xdf;
|
||||
mFlags.value &= 0xef;
|
||||
mFlags.value &= 0xdf;
|
||||
|
||||
if (duration < 0) {
|
||||
mFlag.set(0x10);
|
||||
mFlags.set(0x10);
|
||||
} else if (duration > 0) {
|
||||
mFlag.set(0x30);
|
||||
mFlags.set(0x30);
|
||||
}
|
||||
|
||||
mTimer = duration;
|
||||
mRumbleFrame = duration;
|
||||
|
||||
mFlag.setBit(0);
|
||||
mFlag.resetBit(1);
|
||||
mFlag.setBit(3);
|
||||
mFlags.setBit(0);
|
||||
mFlags.resetBit(1);
|
||||
mFlags.setBit(3);
|
||||
}
|
||||
|
||||
/* 0x8049A440 */
|
||||
f32 ControllerRumbleUnit::calc() {
|
||||
f32 result = 0.0f;
|
||||
if (mFlag.onBit(3)) {
|
||||
if (mFlag.onBit(0)) {
|
||||
char x = *++mPatternPos;
|
||||
if (mFlags.onBit(3)) {
|
||||
if (mFlags.onBit(0)) {
|
||||
char x = *++mRumblePatternPtr;
|
||||
if (x == '\0') {
|
||||
if (mFlag.onBit(4)) {
|
||||
mPatternPos = mPattern;
|
||||
if (mFlags.onBit(4)) {
|
||||
mRumblePatternPtr = mRumblePattern;
|
||||
} else {
|
||||
mFlag.resetBit(3);
|
||||
mFlags.resetBit(3);
|
||||
}
|
||||
} else if (x == '*') {
|
||||
result = 1.0f;
|
||||
}
|
||||
|
||||
if (mFlag.offBit(5)) {
|
||||
if (mFlags.offBit(5)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (--mTimer > 0) {
|
||||
if (--mRumbleFrame > 0) {
|
||||
return result;
|
||||
}
|
||||
mFlag.resetBit(3);
|
||||
mFlags.resetBit(3);
|
||||
return result;
|
||||
} else {
|
||||
f32 intensity = mIntensity + mRampUp;
|
||||
mIntensity = intensity;
|
||||
f32 intensity = mRumbleValue + mRumblePower;
|
||||
mRumbleValue = intensity;
|
||||
if (intensity >= 1.0f) {
|
||||
result = 1.0f;
|
||||
mIntensity = 0.0f;
|
||||
mRumbleValue = 0.0f;
|
||||
}
|
||||
|
||||
if (mFlag.onBit(2)) {
|
||||
if (mFlags.onBit(2)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (--mTimer > 0) {
|
||||
if (--mRumbleFrame > 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
mFlag.resetBit(3);
|
||||
mFlags.resetBit(3);
|
||||
return result;
|
||||
} else {
|
||||
return -1.0f;
|
||||
@@ -506,14 +510,14 @@ f32 ControllerRumbleUnit::calc() {
|
||||
ControllerRumbleMgr::ControllerRumbleMgr() {
|
||||
mController = nullptr;
|
||||
List_Init(&mActiveUnitList, offsetof(ControllerRumbleUnit, mNode));
|
||||
List_Init(&mInactiveUnitList, offsetof(ControllerRumbleUnit, mNode));
|
||||
List_Init(&mStoppedUnitList, offsetof(ControllerRumbleUnit, mNode));
|
||||
}
|
||||
|
||||
/* 0x8049A590 */
|
||||
void ControllerRumbleMgr::createUnit(u8 numUnits, CoreController *ctrl) {
|
||||
for (u8 created = 0; created < numUnits; created++) {
|
||||
ControllerRumbleUnit *unit = new ControllerRumbleUnit();
|
||||
List_Append(&mInactiveUnitList, unit);
|
||||
List_Append(&mStoppedUnitList, unit);
|
||||
}
|
||||
mController = ctrl;
|
||||
}
|
||||
@@ -524,7 +528,7 @@ void ControllerRumbleMgr::stop() {
|
||||
while (List_GetSize(&mActiveUnitList) != 0) {
|
||||
ControllerRumbleUnit *unit = static_cast<ControllerRumbleUnit *>(List_GetNext(&mActiveUnitList, nullptr));
|
||||
List_Remove(&mActiveUnitList, unit);
|
||||
List_Append(&mInactiveUnitList, unit);
|
||||
List_Append(&mStoppedUnitList, unit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,7 +544,7 @@ void ControllerRumbleMgr::calc() {
|
||||
void *nextObject = List_GetNext(&mActiveUnitList, object);
|
||||
if (x < 0.0f) {
|
||||
List_Remove(&mActiveUnitList, object);
|
||||
List_Append(&mInactiveUnitList, object);
|
||||
List_Append(&mStoppedUnitList, object);
|
||||
} else {
|
||||
acc += x;
|
||||
}
|
||||
@@ -565,9 +569,9 @@ void ControllerRumbleMgr::startPattern(const char *pattern, int duration, bool b
|
||||
|
||||
/* 0x8049A7F0 */
|
||||
ControllerRumbleUnit *ControllerRumbleMgr::getUnitFromList(bool bGrabActive) {
|
||||
void *first = List_GetFirst(&this->mInactiveUnitList);
|
||||
void *first = List_GetFirst(&this->mStoppedUnitList);
|
||||
if (first) {
|
||||
List_Remove(&mInactiveUnitList, first);
|
||||
List_Remove(&mStoppedUnitList, first);
|
||||
List_Append(&mActiveUnitList, first);
|
||||
} else if (bGrabActive && (first = List_GetFirst(&mActiveUnitList), first != nullptr)) {
|
||||
List_Remove(&mActiveUnitList, first);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "nw4r/db/db_directPrint.h"
|
||||
#include "nw4r/db/db_exception.h"
|
||||
#include "nw4r/db/db_mapFile.h"
|
||||
|
||||
#include "rvl/KPAD.h" // IWYU pragma: export
|
||||
#include "rvl/OS.h" // IWYU pragma: export
|
||||
|
||||
@@ -52,9 +53,9 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data)
|
||||
while (((u16 *)data)[u4] != 0) {
|
||||
KPADRead(0, &status, 1);
|
||||
ExceptionWaitTime(50);
|
||||
if (status.mTrig) {
|
||||
if (status.trig) {
|
||||
// Reset the sequence on wrong button press, advance on right button press
|
||||
u4 = status.mTrig & (((u16 *)data)[u4]) ? u4 + 1 : 0;
|
||||
u4 = status.trig & (((u16 *)data)[u4]) ? u4 + 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +80,7 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data)
|
||||
while (true) {
|
||||
KPADRead(0, &status, 1);
|
||||
ExceptionWaitTime(100);
|
||||
if (status.mTrig & (/* HOME */ 0x8000)) {
|
||||
if (status.trig & cCORE_BUTTON_HOME) {
|
||||
sUserCallbackMode = !sUserCallbackMode;
|
||||
}
|
||||
if (sUserCallbackMode && sUserCallbackFunc != nullptr) {
|
||||
@@ -91,22 +92,22 @@ bool Exception::ExceptionCallback_(nw4r::db::ConsoleHandle console, void *data)
|
||||
;
|
||||
prevY = newY;
|
||||
|
||||
if (status.mHold & (/* DPAD_DOWN */ 0x4)) {
|
||||
if (status.hold & cCORE_BUTTON_DOWN) {
|
||||
newY += 1;
|
||||
if (newY > end) {
|
||||
newY = end;
|
||||
}
|
||||
} else if (status.mHold & (/* DPAD_UP */ 0x8)) {
|
||||
} else if (status.hold & cCORE_BUTTON_UP) {
|
||||
newY -= 1;
|
||||
if (newY < start) {
|
||||
newY = start;
|
||||
}
|
||||
} else if (status.mHold & (/* DPAD_RIGHT */ 0x2)) {
|
||||
} else if (status.hold & cCORE_BUTTON_RIGHT) {
|
||||
newX -= 5;
|
||||
if (newX < -150) {
|
||||
newX = -150;
|
||||
}
|
||||
} else if (status.mHold & (/* DPAD_LEFT */ 0x1)) {
|
||||
} else if (status.hold & cCORE_BUTTON_LEFT) {
|
||||
newX += 5;
|
||||
if (newX > 10) {
|
||||
newX = 10;
|
||||
|
||||
+7
-8
@@ -1,10 +1,11 @@
|
||||
#include "m/m_pad.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "egg/core/eggController.h"
|
||||
#include "egg/math/eggVector.h"
|
||||
#include "rvl/WPAD.h" // IWYU pragma: export
|
||||
|
||||
#include "rvl/WPAD.h" // IWYU pragma: export
|
||||
|
||||
namespace mPad {
|
||||
|
||||
@@ -38,7 +39,7 @@ static void clearWPADInfo(int);
|
||||
static int getWPADInfoCB(int controller);
|
||||
|
||||
void create() {
|
||||
g_padMg = EGG::CoreControllerMgr::sInstance;
|
||||
g_padMg = EGG::CoreControllerMgr::instance();
|
||||
initWPADInfo();
|
||||
beginPad();
|
||||
endPad();
|
||||
@@ -62,10 +63,10 @@ void beginPad() {
|
||||
for (; i < 4; i++) {
|
||||
ctl = g_padMg->getNthController(i);
|
||||
*p_ctl = ctl;
|
||||
if (ctl->mFlag.onBit(0)) {
|
||||
if (ctl->isConnected()) {
|
||||
// These sort of look like value, first order derivative, and second order derivative
|
||||
// So perhaps value, velocity, acceleration?
|
||||
EGG::Vector2f pos = ctl->mCoreStatus[0].getUnk();
|
||||
EGG::Vector2f pos = ctl->getCoreStatus()->getAccelVertical();
|
||||
EGG::Vector2f v = pos - dat->v1;
|
||||
dat->v1 = pos;
|
||||
dat->v3 = v - dat->v2;
|
||||
@@ -81,7 +82,7 @@ void beginPad() {
|
||||
getWPADInfoCB(i);
|
||||
}
|
||||
} else if (*connected) {
|
||||
ctl->mCoreStatus->init();
|
||||
ctl->getCoreStatus()->init();
|
||||
ctl->sceneReset();
|
||||
dat->v1.x = 0.0f;
|
||||
dat->v1.y = 0.0f;
|
||||
@@ -134,10 +135,8 @@ static void initWPADInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void fn_80058DA0(s32, s32);
|
||||
|
||||
static int getWPADInfoCB(int controller) {
|
||||
int result = WPADGetInfoAsync(controller, &s_WPADInfoTmp[controller], fn_80058DA0);
|
||||
int result = WPADGetInfoAsync(controller, &s_WPADInfoTmp[controller], async_info_callback);
|
||||
if (result == -1) {
|
||||
clearWPADInfo(controller);
|
||||
}
|
||||
|
||||
@@ -140,11 +140,11 @@ bool AttentionManager::isInNormalGameState() const {
|
||||
}
|
||||
|
||||
bool AttentionManager::isZButtonPressed() const {
|
||||
return dPad::checkButtonZPressed();
|
||||
return dPad::getDownTrigZ();
|
||||
}
|
||||
|
||||
bool AttentionManager::isZButtonHeld() const {
|
||||
return dPad::checkButtonZHeld();
|
||||
return dPad::getDownZ();
|
||||
}
|
||||
|
||||
bool AttentionManager::checkUnknown() const {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// vtable order
|
||||
#include "JSystem/JParticle/JPAEmitter.h"
|
||||
#include "JSystem/JParticle/JPAParticle.h"
|
||||
#include "d/d_gfx.h"
|
||||
#include "rvl/GX/GXTypes.h"
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
// clang-format on
|
||||
@@ -40,12 +41,10 @@
|
||||
#include "toBeSorted/d_d3d.h"
|
||||
#include "toBeSorted/d_particle.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
|
||||
#include "rvl/GX.h"
|
||||
#include "rvl/MTX.h"
|
||||
|
||||
|
||||
void float_ordering_1(s32 a) {
|
||||
(f32) a;
|
||||
}
|
||||
@@ -465,15 +464,18 @@ void dEffect2D_c::draw() {
|
||||
f32 proj[GX_PROJECTION_SZ];
|
||||
GXGetProjectionv(proj);
|
||||
f32 base = proj[1];
|
||||
proj[1] = base / get_805751A4();
|
||||
proj[1] = base / dGfx_c::get16x9to4x3WidthScaleF();
|
||||
GXSetProjectionv(proj);
|
||||
f32 f = get_80575184() / 2;
|
||||
f32 f = dGfx_c::getWidth16x9() / 2.f;
|
||||
mMtx_c mtx1, mtx2;
|
||||
JPADrawInfo info;
|
||||
|
||||
C_MTXLightOrtho(mtx1, -get_80575150(), get_80575150(), -f, f, 0.5f, 0.5f, 0.5f, 0.5f);
|
||||
C_MTXLightOrtho(
|
||||
mtx1, -dGfx_c::getCurrentScreenHeightLimitF(), dGfx_c::getCurrentScreenHeightLimitF(), -f, f, 0.5f, 0.5f, 0.5f,
|
||||
0.5f
|
||||
);
|
||||
|
||||
MTXScale(mtx2, fn_80054AD0() ? get_805751A4() : 1.0f, 1.0f, 1.0f);
|
||||
MTXScale(mtx2, fn_80054AD0() ? dGfx_c::get16x9to4x3WidthScaleF() : 1.0f, 1.0f, 1.0f);
|
||||
MTXCopy(mtx2, info.mCamMtx);
|
||||
MTXCopy(mtx1, info.mPrjMtx);
|
||||
dJEffManager_c::draw(&info, mGroupId);
|
||||
@@ -1030,7 +1032,6 @@ bool dJEffManager_c::createMassObjEffect(
|
||||
void dEmitterBase_c::loadColors(
|
||||
JPABaseEmitter *emitter, const GXColor *color1, const GXColor *color2, s32 plltIdx1, s32 plltIdx2
|
||||
) {
|
||||
dLightEnv_c &mgr = dLightEnv_c::GetInstance();
|
||||
u8 r1 = 0xFF;
|
||||
u8 g1 = 0xFF;
|
||||
u8 b1 = 0xFF;
|
||||
@@ -1039,6 +1040,7 @@ void dEmitterBase_c::loadColors(
|
||||
u8 b2 = 0xFF;
|
||||
u8 r, g, b;
|
||||
|
||||
dLightEnv_c &mgr = dLightEnv_c::GetInstance();
|
||||
const mColor c1 = mgr.GetCurrentSpf().mParticleTransparentClr;
|
||||
const mColor c2 = mgr.GetCurrentSpf().mParticleSolidClr;
|
||||
|
||||
@@ -1073,22 +1075,22 @@ void dEmitterBase_c::loadColors(
|
||||
|
||||
if (plltIdx1 > 0) {
|
||||
if ((flags & 0x1000) != 0) {
|
||||
const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2);
|
||||
r1 = entry.field_0x00.r;
|
||||
g1 = entry.field_0x00.g;
|
||||
b1 = entry.field_0x00.b;
|
||||
const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x00;
|
||||
r1 = entry.r;
|
||||
g1 = entry.g;
|
||||
b1 = entry.b;
|
||||
} else if ((flags & 0x2000) != 0) {
|
||||
const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2);
|
||||
r1 = entry.field_0x08.r;
|
||||
g1 = entry.field_0x08.g;
|
||||
b1 = entry.field_0x08.b;
|
||||
const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x08;
|
||||
r1 = entry.r;
|
||||
g1 = entry.g;
|
||||
b1 = entry.b;
|
||||
}
|
||||
}
|
||||
|
||||
if (factor != 0) {
|
||||
r = mgr.getfield_0x2F14() * r1 * scaleR;
|
||||
g = mgr.getfield_0x2F18() * g1 * scaleG;
|
||||
b = mgr.getfield_0x2F1C() * b1 * scaleB;
|
||||
r = r1 * scaleR * mgr.getfield_0x2F14();
|
||||
g = g1 * scaleG * mgr.getfield_0x2F18();
|
||||
b = b1 * scaleB * mgr.getfield_0x2F1C();
|
||||
} else {
|
||||
r = r1 * scaleR;
|
||||
g = g1 * scaleG;
|
||||
@@ -1105,15 +1107,15 @@ void dEmitterBase_c::loadColors(
|
||||
|
||||
if (plltIdx1 > 0) {
|
||||
if ((flags & 0x1000) != 0) {
|
||||
const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2);
|
||||
r2 = entry.field_0x04.r;
|
||||
g2 = entry.field_0x04.g;
|
||||
b2 = entry.field_0x04.b;
|
||||
const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x04;
|
||||
r2 = entry.r;
|
||||
g2 = entry.g;
|
||||
b2 = entry.b;
|
||||
} else if ((flags & 0x2000) != 0) {
|
||||
const PaletteEAF_smol_entry &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2);
|
||||
r2 = entry.field_0x0C.r;
|
||||
g2 = entry.field_0x0C.g;
|
||||
b2 = entry.field_0x0C.b;
|
||||
const mColor &entry = mgr.getSmallEAF(plltIdx1 - 1, plltIdx2).field_0x0C;
|
||||
r2 = entry.r;
|
||||
g2 = entry.g;
|
||||
b2 = entry.b;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1232,14 +1234,11 @@ dEmitterBase_c *dJEffManager_c::spawnGroundEffect(
|
||||
mtx.makeRotationFromVecs(mVec3_c::Ey, v1, 1.0f);
|
||||
mAng rot(cM::rndF(65536.0f));
|
||||
mtx.YrotM(rot);
|
||||
mtx.m[0][3] = pos.x;
|
||||
mtx.m[1][3] = pos.y;
|
||||
mtx.m[2][3] = pos.z;
|
||||
mtx.setTranslation(pos);
|
||||
mMtx_c scaleMtx;
|
||||
MTXScale(scaleMtx, scale, scale, scale);
|
||||
MTXConcat(mtx, scaleMtx, mtx);
|
||||
u16 eff = sEffArray[idx][unk];
|
||||
return spawnEffect(eff, mtx, nullptr, nullptr, polyAttr0, polyAttr1);
|
||||
return spawnEffect(sEffArray[idx][unk], mtx, nullptr, nullptr, polyAttr0, polyAttr1);
|
||||
}
|
||||
|
||||
void dWaterEffect_c::init(dAcObjBase_c *base, f32 height, f32 scale, f32 f3) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/d_message.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/d_pouch.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
@@ -13,6 +14,7 @@
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/unk_save_time.h"
|
||||
|
||||
|
||||
// https://github.com/lepelog/skywardsword-tools/wiki/Navi-Table-(Fi-Advice)
|
||||
|
||||
// Portability hazard, only works for 32 bit architectures
|
||||
@@ -290,9 +292,6 @@ u8 FiContext::rateBattlePerformance(u8 id) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern "C" bool isLowBattery1();
|
||||
extern "C" bool isLowBattery2();
|
||||
|
||||
u16 FiContext::prepareFiHelpIndex() {
|
||||
u16 ret = 0xFFFF;
|
||||
setHelpIndex(-1);
|
||||
@@ -317,10 +316,10 @@ u16 FiContext::prepareFiHelpIndex() {
|
||||
setHelpIndex(0);
|
||||
}
|
||||
|
||||
if (isLowBattery2() || isLowBattery1()) {
|
||||
if (dPad::ex_c::getInstance()->isLowBattery() || dPad::ex_c::getInstance()->isOutOfBattery()) {
|
||||
if (!getField_0x48()) {
|
||||
ret = 6400;
|
||||
if (isLowBattery1()) {
|
||||
if (dPad::ex_c::getInstance()->isOutOfBattery()) {
|
||||
// "Master, the batteries in your Wii Remote will be depleted any moment."
|
||||
setHelpIndex(3);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user