mirror of
https://github.com/zeldaret/ss
synced 2026-07-10 22:41:46 -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user