diff --git a/configure.py b/configure.py index 4a1710ac..40d20482 100644 --- a/configure.py +++ b/configure.py @@ -624,7 +624,7 @@ config.libs = [ Object(Matching, "system/rvl_dec.c"), Object(Matching, "system/RIPL_BoardRecord.c"), Object(Matching, "system/iplSystem.cpp"), - Object(Matching, "system/iplController.cpp"), + Object(NonMatching, "system/iplController.cpp"), Object(Matching, "system/iplChannelManager.cpp"), Object(Matching, "system/iplChannelScriptManager.cpp"), Object(Matching, "system/iplNand.cpp"), @@ -653,7 +653,7 @@ config.libs = [ Object(Matching, "system/iplWarningHandler.cpp"), Object(Matching, "system/iplSocketSetting.cpp"), Object(Matching, "system/iplPostmanManager.cpp"), - Object(Matching, "system/iplSaveDataManager.cpp"), + Object(NonMatching, "system/iplSaveDataManager.cpp"), Object(Matching, "system/iplChannelRsoThread.cpp"), Object(Matching, "system/RsoSystem.cpp"), Object(Matching, "system/iplCdbBackup.cpp"), @@ -737,8 +737,8 @@ config.libs = [ ] ), IPLSection("board", [ - Object(Matching, "scene/board/iplBoard.cpp"), - Object(Matching, "scene/board/iplBoardObject.cpp"), + Object(Equivalent, "scene/board/iplBoard.cpp"), + Object(Equivalent, "scene/board/iplBoardObject.cpp"), Object(Matching, "scene/board/iplBoardSD.cpp"), Object(Matching, "scene/board/iplUrlProcessor.cpp"), Object(Equivalent, "scene/board/iplFocusObject.cpp"), @@ -765,13 +765,13 @@ config.libs = [ ] ), IPLSection("channelSelect", [ - Object(Matching, "scene/channelSelect/iplChannelSelect.cpp"), + Object(Equivalent, "scene/channelSelect/iplChannelSelect.cpp"), Object(Matching, "scene/channelSelect/iplClock.cpp"), Object(Equivalent, "scene/channelSelect/iplChannelObj.cpp"), ] ), IPLSection("channelTitle", [ - Object(Matching, "scene/channelTitle/iplChannelTitle.cpp"), + Object(Equivalent, "scene/channelTitle/iplChannelTitle.cpp"), ] ), IPLSection("faceSelect", [ @@ -1907,7 +1907,7 @@ config.libs = [ [ Object(Matching, "core/eggAllocator.cpp"), Object(Matching, "core/eggAudioArcPlayerMgr.cpp"), - Object(Matching, "core/eggAudioExpMgr.cpp"), + Object(Equivalent, "core/eggAudioExpMgr.cpp"), Object(Matching, "core/eggAudioFxMgr.cpp"), Object(Matching, "core/eggAudioMgr.cpp"), Object(Matching, "core/eggAudioHeapMgr.cpp"), diff --git a/include/math/iplMathTypes.h b/include/math/iplMathTypes.h index 8a80737a..f1425545 100644 --- a/include/math/iplMathTypes.h +++ b/include/math/iplMathTypes.h @@ -55,14 +55,10 @@ namespace ipl { x = r.x; y = r.y; } -#ifdef IPL_MATH_VEC2_CTOR_OUT_OF_LINE - VEC2(f32 fx, f32 fy); -#else VEC2(f32 fx, f32 fy) { x = fx; y = fy; } -#endif void operator=(const VEC2& r); diff --git a/include/scene/board/iplBoard.h b/include/scene/board/iplBoard.h index 537cc103..eb9657d7 100644 --- a/include/scene/board/iplBoard.h +++ b/include/scene/board/iplBoard.h @@ -234,7 +234,6 @@ namespace ipl { class ObjList { public: ObjList(); - ~ObjList() {} BoardObject* getNext(BoardObject* obj = NULL) const { return (BoardObject*)nw4r::ut::List_GetNext((nw4r::ut::List*)&mUsedObjs, obj); } diff --git a/include/scene/button/iplButton.h b/include/scene/button/iplButton.h index db5aa154..7777e532 100644 --- a/include/scene/button/iplButton.h +++ b/include/scene/button/iplButton.h @@ -400,35 +400,20 @@ namespace ipl { class ButtonEventHandlerBase : public ::gui::EventHandler { public: -#ifdef IPL_CHANNEL_TITLE_NOVTABLE - virtual void onEvent(u32 compId, u32 event, void* data) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} -#else virtual void onEvent(u32 compId, u32 event, void* data); virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); -#endif }; class OptOutButtonEventHandlerBase : public ButtonEventHandlerBase { public: -#ifdef IPL_CHANNEL_TITLE_NOVTABLE - virtual void onEvent(u32 compId, u32 event, void* data) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} -#else virtual void onEvent(u32 compId, u32 event, void* data); virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); -#endif }; class SDMenuEventHandlerBase : public ButtonEventHandlerBase { public: -#ifdef IPL_CHANNEL_TITLE_NOVTABLE - virtual void onEvent(u32 compId, u32 event, void* data) {} - virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con) {} -#else virtual void onEvent(u32 compId, u32 event, void* data); virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con); -#endif }; } // namespace scene } // namespace ipl diff --git a/libs/EGG/include/egg/core/eggAudioArcPlayerMgr.h b/libs/EGG/include/egg/core/eggAudioArcPlayerMgr.h index c50266b3..140d777d 100644 --- a/libs/EGG/include/egg/core/eggAudioArcPlayerMgr.h +++ b/libs/EGG/include/egg/core/eggAudioArcPlayerMgr.h @@ -38,19 +38,6 @@ namespace EGG { virtual void calc(); // 0x30 -#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS - virtual bool startSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x34 - virtual bool startSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x38 - virtual bool startSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x3C - - virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x44 - virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x44 - virtual bool prepareSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x48 - - virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, u32 id); // 0x50 - virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, unsigned int id); // 0x50 - virtual bool holdSound(nw4r::snd::SoundHandle* pHandle, const char* pName); // 0x58 -#else virtual bool startSound(nw4r::snd::SoundHandle* pHandle, u32 id) { return mSoundArchivePlayer.StartSound(pHandle, id); } // 0x34 virtual bool startSound(nw4r::snd::SoundHandle* pHandle, unsigned int id) { return mSoundArchivePlayer.StartSound(pHandle, id); } // 0x38 virtual bool startSound(nw4r::snd::SoundHandle* pHandle, const char* pName) NO_INLINE { @@ -75,7 +62,6 @@ namespace EGG { u32 id = changeNameToId(pName); return mSoundArchivePlayer.HoldSound(pHandle, id); } // 0x58 -#endif u32 changeNameToId(const char* pName) { return mpArchive->ConvertLabelStringToSoundId(pName); } const char* changeIdToName(u32 id) { return mpArchive->GetSoundLabelString(id); } diff --git a/libs/EGG/include/egg/core/eggAudioHeapMgr.h b/libs/EGG/include/egg/core/eggAudioHeapMgr.h index b706aad5..1602326d 100644 --- a/libs/EGG/include/egg/core/eggAudioHeapMgr.h +++ b/libs/EGG/include/egg/core/eggAudioHeapMgr.h @@ -19,10 +19,6 @@ namespace EGG { ~SoundHeapMgr() { destroySoundHeap(); } -#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS - virtual bool loadState(s32 id); // 0x08 - virtual s32 getCurrentLevel(); // 0x0C -#else virtual bool loadState(s32 id) { s32 level = mHeap.GetCurrentLevel(); @@ -35,7 +31,6 @@ namespace EGG { } // 0x08 virtual s32 getCurrentLevel() { return mHeap.GetCurrentLevel(); } // 0x0C -#endif s32 saveState() { return mHeap.SaveState(); } diff --git a/libs/EGG/src/core/eggAudioExpMgr.cpp b/libs/EGG/src/core/eggAudioExpMgr.cpp index bad95987..0be9ecbc 100644 --- a/libs/EGG/src/core/eggAudioExpMgr.cpp +++ b/libs/EGG/src/core/eggAudioExpMgr.cpp @@ -1,42 +1,30 @@ -#define EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS #include -#undef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS namespace EGG { - -// Declaring this unused subclass makes the @52@ adjustor thunks emit in the -// original order (@52@__dt__ before @52@calc). All of its emissions strip. -class Sample : public SimpleAudioMgrWithFx { -public: - Sample() : SimpleAudioMgrWithFx() {} - virtual ~Sample() {} -}; - -SimpleAudioMgrWithFx::SimpleAudioMgrWithFx() { -} - -SimpleAudioMgrWithFx::~SimpleAudioMgrWithFx() { -} - -SimpleAudioMgrWithFx::ArgWithFx::ArgWithFx() : fxArg() { - // auto generates constructors - SimpleAudioMgrArg unused0; - AudioFxMgr::AudioFxMgrArg unused1; -} - -void SimpleAudioMgrWithFx::initialize(IAudioMgr::Arg* arg) { - SimpleAudioMgr::initialize(arg); - - if (arg != NULL) { - arg = (IAudioMgr::Arg*)&((ArgWithFx*)arg)->fxArg; + SimpleAudioMgrWithFx::SimpleAudioMgrWithFx() { } - initializeFx(&mHeap, (AudioFxMgrArg*)arg); + SimpleAudioMgrWithFx::~SimpleAudioMgrWithFx() { + } - setFxReverbHi(nw4r::snd::AUX_A, AudioFxMgr::getDefaultFxReverbHi()); - setFxChorus(nw4r::snd::AUX_B, AudioFxMgr::getDefaultFxChorus()); + SimpleAudioMgrWithFx::ArgWithFx::ArgWithFx() : fxArg() { + // auto generates constructors + SimpleAudioMgrArg unused0; + AudioFxMgr::AudioFxMgrArg unused1; + } - mHeap.SaveState(); -} + void SimpleAudioMgrWithFx::initialize(IAudioMgr::Arg* arg) { + SimpleAudioMgr::initialize(arg); + if (arg != NULL) { + arg = (IAudioMgr::Arg*)&((ArgWithFx*)arg)->fxArg; + } + + initializeFx(&mHeap, (AudioFxMgrArg*)arg); + + setFxReverbHi(nw4r::snd::AUX_A, AudioFxMgr::getDefaultFxReverbHi()); + setFxChorus(nw4r::snd::AUX_B, AudioFxMgr::getDefaultFxChorus()); + + mHeap.SaveState(); + } } // namespace EGG diff --git a/libs/NW4R/include/nw4r/ut/Lock.h b/libs/NW4R/include/nw4r/ut/Lock.h index 3f49847a..eee9652a 100644 --- a/libs/NW4R/include/nw4r/ut/Lock.h +++ b/libs/NW4R/include/nw4r/ut/Lock.h @@ -19,13 +19,8 @@ namespace nw4r { template class AutoLock : private NonCopyable { public: -#ifdef EGG_AUDIO_EXPMGR_NO_INLINE_VIRTUALS - explicit AutoLock(T& rLockObj); - ~AutoLock(); -#else explicit AutoLock(T& rLockObj) : mLockObj(rLockObj) { Lock(rLockObj); } ~AutoLock() { Unlock(mLockObj); } -#endif private: T& mLockObj; // 0x00 diff --git a/src/scene/board/iplBoard.cpp b/src/scene/board/iplBoard.cpp index 9f033b6f..612b4f6c 100644 --- a/src/scene/board/iplBoard.cpp +++ b/src/scene/board/iplBoard.cpp @@ -419,11 +419,11 @@ namespace ipl { CDBRecordKey recordKey; utility::Date recordDate; - u32 recordGC = 0; - - int recordHour; - int recordMin; int recordDay; + int recordMin; + int recordHour; + + u32 recordGC = 0; cdb::Manager* cdbManager = System::getCdbManager(); @@ -460,7 +460,7 @@ namespace ipl { // Find any free space to put the object on screen - volatile BOOL old = OSDisableInterrupts(); + BOOL old = OSDisableInterrupts(); BOOL exist = is_exist_diff_date(); BoardObject* obj = mObjList.getNextFree(); OSRestoreInterrupts(old); @@ -468,7 +468,7 @@ namespace ipl { if (obj == NULL && exist) { while (obj == NULL) { OSSleepMilliseconds((OSTime)1); - volatile BOOL old2 = OSDisableInterrupts(); + BOOL old2 = OSDisableInterrupts(); obj = mObjList.getNextFree(); OSRestoreInterrupts(old2); } @@ -513,7 +513,7 @@ namespace ipl { result = TRUE; if (((RBRHeader*)rbrData)->magic == RBR_MAGIC && cdbManager->isValidHeader((RBRHeader*)rbrData)) { - volatile BOOL old3 = OSDisableInterrupts(); + BOOL old3 = OSDisableInterrupts(); if (recordDate == mCurrentDate) { if (mbReading == true && mSearchRecord_Prev.created) { diff --git a/src/scene/board/iplBoardObject.cpp b/src/scene/board/iplBoardObject.cpp index 5e0287b1..830f4b9f 100644 --- a/src/scene/board/iplBoardObject.cpp +++ b/src/scene/board/iplBoardObject.cpp @@ -1,68 +1,7 @@ -#define IPL_CHANNEL_TITLE_NOVTABLE - -#define SCENE_HEADER_FOR_UI_H -#define IPL_NIGAOE_H -#define IPL_CAPTURE_H - -#include "layout/GUIManager.h" -#include "system/RIPL_BoardRecord.h" -#include "utility/iplCalendar.h" -#include "iplMath.h" -#include -#include -#include -#include -#include - -namespace ipl { - namespace layout { - class Object; - } - namespace controller { - class Interface; - } - namespace nand { - class LayoutFile; - } - namespace nigaoe { - class Object; - } - namespace utility { - class Capture; - } - namespace gui { - class PaneManager; - } -} // namespace ipl -namespace EGG { - class Heap; - class Allocator; -} // namespace EGG - -// Reproduce the anonymous-type ordinal the original TU reached before -// iplBoardObject.h's anonymous classes: its include chain defined more -// types than our reconstructed headers, so without this the compiler -// numbers them differently (@class$ symbols). These member functions are -// parsed and counted but never emitted. -struct AnonOrdinalPad { - void f0() {} void f1() {} void f2() {} void f3() {} void f4() {} void f5() {} void f6() {} void f7() {} void f8() {} void f9() {} void f10() {} void f11() {} void f12() {} void f13() {} void f14() {} void f15() {} void f16() {} void f17() {} void f18() {} void f19() {} void f20() {} void f21() {} void f22() {} void f23() {} void f24() {} void f25() {} void f26() {} void f27() {} void f28() {} void f29() {} void f30() {} void f31() {} void f32() {} void f33() {} void f34() {} void f35() {} void f36() {} void f37() {} void f38() {} void f39() {} void f40() {} void f41() {} void f42() {} void f43() {} void f44() {} void f45() {} void f46() {} void f47() {} void f48() {} void f49() {} void f50() {} void f51() {} void f52() {} void f53() {} void f54() {} void f55() {} void f56() {} void f57() {} void f58() {} void f59() {} void f60() {} void f61() {} void f62() {} void f63() {} void f64() {} void f65() {} void f66() {} void f67() {} void f68() {} void f69() {} void f70() {} void f71() {} void f72() {} void f73() {} void f74() {} void f75() {} void f76() {} void f77() {} void f78() {} void f79() {} void f80() {} void f81() {} void f82() {} void f83() {} void f84() {} void f85() {} void f86() {} void f87() {} void f88() {} void f89() {} void f90() {} void f91() {} void f92() {} void f93() {} void f94() {} void f95() {} void f96() {} void f97() {} void f98() {} void f99() {} void f100() {} void f101() {} void f102() {} void f103() {} void f104() {} void f105() {} void f106() {} void f107() {} void f108() {} void f109() {} void f110() {} void f111() {} void f112() {} void f113() {} void f114() {} void f115() {} void f116() {} void f117() {} void f118() {} void f119() {} void f120() {} void f121() {} void f122() {} void f123() {} void f124() {} void f125() {} void f126() {} void f127() {} void f128() {} void f129() {} void f130() {} void f131() {} void f132() {} void f133() {} void f134() {} void f135() {} void f136() {} void f137() {} void f138() {} void f139() {} void f140() {} void f141() {} void f142() {} void f143() {} void f144() {} void f145() {} void f146() {} void f147() {} void f148() {} void f149() {} void f150() {} void f151() {} void f152() {} void f153() {} void f154() {} void f155() {} void f156() {} void f157() {} void f158() {} void f159() {} void f160() {} void f161() {} void f162() {} void f163() {} void f164() {} void f165() {} void f166() {} void f167() {} void f168() {} void f169() {} void f170() {} void f171() {} void f172() {} void f173() {} void f174() {} void f175() {} void f176() {} void f177() {} void f178() {} void f179() {} void f180() {} void f181() {} void f182() {} void f183() {} void f184() {} void f185() {} void f186() {} void f187() {} void f188() {} void f189() {} void f190() {} void f191() {} void f192() {} void f193() {} void f194() {} void f195() {} void f196() {} void f197() {} void f198() {} void f199() {} void f200() {} void f201() {} void f202() {} void f203() {} void f204() {} void f205() {} void f206() {} void f207() {} void f208() {} void f209() {} void f210() {} void f211() {} void f212() {} void f213() {} void f214() {} void f215() {} void f216() {} void f217() {} void f218() {} void f219() {} void f220() {} void f221() {} void f222() {} void f223() {} void f224() {} void f225() {} void f226() {} void f227() {} void f228() {} void f229() {} void f230() {} void f231() {} void f232() {} void f233() {} void f234() {} void f235() {} void f236() {} void f237() {} void f238() {} void f239() {} void f240() {} void f241() {} void f242() {} void f243() {} void f244() {} void f245() {} void f246() {} void f247() {} void f248() {} void f249() {} void f250() {} void f251() {} void f252() {} void f253() {} void f254() {} void f255() {} void f256() {} void f257() {} void f258() {} void f259() {} void f260() {} void f261() {} void f262() {} void f263() {} void f264() {} void f265() {} void f266() {} void f267() {} void f268() {} void f269() {} void f270() {} void f271() {} void f272() {} void f273() {} void f274() {} void f275() {} void f276() {} void f277() {} void f278() {} void f279() {} void f280() {} void f281() {} void f282() {} void f283() {} void f284() {} void f285() {} void f286() {} void f287() {} void f288() {} void f289() {} void f290() {} void f291() {} void f292() {} void f293() {} void f294() {} void f295() {} void f296() {} void f297() {} void f298() {} void f299() {} void f300() {} void f301() {} void f302() {} void f303() {} void f304() {} void f305() {} void f306() {} void f307() {} void f308() {} void f309() {} void f310() {} void f311() {} void f312() {} void f313() {} void f314() {} void f315() {} void f316() {} void f317() {} void f318() {} void f319() {} void f320() {} void f321() {} void f322() {} void f323() {} void f324() {} void f325() {} void f326() {} void f327() {} void f328() {} void f329() {} void f330() {} void f331() {} void f332() {} void f333() {} void f334() {} void f335() {} void f336() {} void f337() {} void f338() {} void f339() {} void f340() {} void f341() {} void f342() {} void f343() {} void f344() {} void f345() {} void f346() {} void f347() {} void f348() {} void f349() {} void f350() {} void f351() {} void f352() {} void f353() {} void f354() {} void f355() {} void f356() {} void f357() {} void f358() {} void f359() {} void f360() {} void f361() {} void f362() {} void f363() {} void f364() {} void f365() {} void f366() {} void f367() {} void f368() {} void f369() {} void f370() {} void f371() {} void f372() {} void f373() {} void f374() {} void f375() {} void f376() {} void f377() {} void f378() {} void f379() {} void f380() {} void f381() {} void f382() {} void f383() {} void f384() {} void f385() {} void f386() {} void f387() {} void f388() {} void f389() {} void f390() {} void f391() {} void f392() {} void f393() {} void f394() {} void f395() {} void f396() {} void f397() {} void f398() {} void f399() {} void f400() {} void f401() {} void f402() {} void f403() {} void f404() {} void f405() {} void f406() {} void f407() {} void f408() {} void f409() {} void f410() {} void f411() {} void f412() {} void f413() {} void f414() {} void f415() {} void f416() {} void f417() {} void f418() {} void f419() {} void f420() {} void f421() {} void f422() {} void f423() {} void f424() {} void f425() {} void f426() {} void f427() {} void f428() {} void f429() {} void f430() {} void f431() {} void f432() {} void f433() {} void f434() {} void f435() {} void f436() {} void f437() {} void f438() {} void f439() {} void f440() {} void f441() {} void f442() {} void f443() {} void f444() {} void f445() {} void f446() {} void f447() {} void f448() {} void f449() {} void f450() {} void f451() {} void f452() {} void f453() {} void f454() {} void f455() {} void f456() {} void f457() {} void f458() {} void f459() {} void f460() {} void f461() {} void f462() {} void f463() {} void f464() {} void f465() {} void f466() {} void f467() {} void f468() {} void f469() {} void f470() {} -}; -struct { int pad; } sAnonOrdinalPad1; -struct { int pad; } sAnonOrdinalPad2; -struct { int pad; } sAnonOrdinalPad3; - -#include "scene/board/iplBoardObject.h" - -#undef SCENE_HEADER_FOR_UI_H -#undef IPL_NIGAOE_H -#undef IPL_CAPTURE_H - #include "iplSceneUI.h" -#include "system/iplNigaoe.h" -#include "utility/iplCapture.h" - #include "scene/board/iplBoard.h" +#include "scene/board/iplBoardObject.h" #include "scene/button/iplButton.h" @@ -76,8 +15,6 @@ struct { int pad; } sAnonOrdinalPad3; #include "utility/iplRBRUtility.h" #include "utility/iplTPLValidity.h" -#undef IPL_CHANNEL_TITLE_NOVTABLE - extern "C" void __ct__Q33ipl4math4VEC2Fff(ipl::math::VEC2*, f32, f32); // I don't want to keep typing this out lol @@ -541,8 +478,8 @@ namespace ipl { } void BoardObject::stt_stand() { - f32 dVar2 = nw4r::math::CosDeg(mStandData.unk_0x0C * 30.0f + 30.0f); - f32 dVar3 = nw4r::math::SinDeg(mStandData.unk_0x0C * 30.0f + 30.0f); + f32 dVar2 = nw4r::math::CosFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f))); + f32 dVar3 = nw4r::math::SinFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f))); math::VEC2 standPos; __ct__Q33ipl4math4VEC2Fff(&standPos, dVar3 * 160.0f, dVar2 * 160.0f); @@ -950,47 +887,6 @@ namespace ipl { void GenerateWEAK() { nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast(((nw4r::lyt::Pane*)NULL)->FindPaneByName(NULL)); - - static const f32 pad_data0 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data1 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data2 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data3 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data4 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data5 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data6 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data7 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data8 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data9 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data10 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data11 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data12 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data13 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data14 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data15 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data16 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data17 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data18 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data19 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data20 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data21 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data22 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data23 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data24 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data25 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data26 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data27 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data28 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data29 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data30 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data31 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data32 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data33 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data34 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data35 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data36 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_data37 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad_rodata __attribute__((section(".rodata"), aligned(1), used)) = 0.0f; - static const f32 pad_sdata2 __attribute__((section(".sdata2"), aligned(1), used)) = 0.0f; } } // namespace scene } // namespace ipl diff --git a/src/scene/channelSelect/iplChannelSelect.cpp b/src/scene/channelSelect/iplChannelSelect.cpp index a68d78e7..e4c83858 100644 --- a/src/scene/channelSelect/iplChannelSelect.cpp +++ b/src/scene/channelSelect/iplChannelSelect.cpp @@ -1,49 +1,3 @@ -#include "layout/GUIManager.h" -#include "math/iplInterporation.h" - -namespace ipl { - namespace math { - template <> - class HermiteIntp : public utility::FrameController { - public: - HermiteIntp() {} - virtual ~HermiteIntp() {} - - void init(const f32& start, const f32& end, f32 maxFrame, f32 param_5, f32 param_6, - int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) { - mStart = start; - mEnd = end; - utility::FrameController::init(playback, maxFrame, 0.0f, speed); - unkVal0 = param_5; - unkVal1 = param_6; - } - - f32 get() const { - f32 var_f27 = mFrame; - f32 var_f28 = 1.0f / mMaxFrame; - f32 r = - (mStart * - (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - - (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) - - (mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - - (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))))); - r += (unkVal0 * (var_f27 + ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) - - (var_f28 * (2.0f * var_f27 * var_f27))))) + - (unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) - - (var_f28 * (var_f27 * var_f27)))); - return r; - } - - protected: - f32 mStart; - f32 mEnd; - f32 unkVal0; - f32 unkVal1; - }; - } // namespace math -} // namespace ipl - -#define IPL_CHANNEL_TITLE_NOVTABLE #include #include "iplSceneUI.h" @@ -60,11 +14,6 @@ namespace ipl { #include -#pragma dont_instantiate ipl::math::HermiteIntp - -#undef IPL_CHANNEL_TITLE_NOVTABLE - - // #pragma sym on namespace ipl { @@ -95,13 +44,16 @@ namespace ipl { } template <> - void HermiteIntp::init(const VEC3& start, const VEC3& end, f32 maxFrame, f32 param_5, f32 param_6, - int playback, f32 speed) { - mStart = start; - mEnd = end; - utility::FrameController::init(playback, maxFrame, 0.0f, speed); - unkVal0 = param_5; - unkVal1 = param_6; + f32 HermiteIntp::get() const { + f32 var_f27 = mFrame; + f32 var_f28 = 1.0f / mMaxFrame; + f32 r = (mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - + (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) - + (mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - + (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))))); + r += (unkVal0 * (var_f27 + ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) - (var_f28 * (2.0f * var_f27 * var_f27))))) + + (unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) - (var_f28 * (var_f27 * var_f27)))); + return r; } } // namespace math } // namespace ipl @@ -110,6 +62,7 @@ namespace ipl { namespace scene { extern "C" char smArg__Q23ipl6System; extern "C" char sSystem__Q23ipl3snd; + extern "C" const double lbl_81694998; extern "C" void* m_handle__Q23ipl11TVRCManager; extern "C" void calcChanZoomParam__Q33ipl5scene13ChannelSelectFv(); extern "C" void setChanZoomOrtho__Q33ipl5scene13ChannelSelectFv(); @@ -142,9 +95,7 @@ namespace ipl { extern "C" void initPane__Q33ipl3gui11PaneManagerFPQ34nw4r3lyt4Pane(); extern "C" void* jumptable_8164DD14[]; extern "C" void* jumptable_8164DE80[]; - extern "C" void getCurrentChannel__Q33ipl7channel7ManagerFPiPi(int*, int*); - extern "C" int msCurPage__Q33ipl7channel7Manager; - extern "C" int msCurIndex__Q33ipl7channel7Manager; + extern "C" void getCurrentChannel__Q33ipl7channel7ManagerFPiPi(); extern "C" void calcNormalRestart__Q33ipl5scene13ChannelSelectFv(); extern "C" void _savegpr_28(); extern "C" void _restgpr_28(); @@ -185,6 +136,7 @@ namespace ipl { extern "C" char lbl_8164DFE1[]; extern "C" char lbl_8164DE64[]; extern "C" char lbl_8164DE6D[]; + extern "C" char lbl_8164DE9C[]; extern "C" char lbl_8164DFCB[]; extern "C" char lbl_8164DFF1[]; extern "C" char lbl_8164E000[]; @@ -250,6 +202,20 @@ namespace ipl { #pragma pop + #pragma push + #pragma section sconst_type ".sdata2" + extern "C" const f32 lbl_81694948; + extern "C" const u32 lbl_8169494C = 1; + extern "C" const f32 lbl_81694968; + extern "C" const f32 lbl_8169496C; + extern "C" const f32 lbl_81694970; + extern "C" const char lbl_81694950 = 0; + extern "C" const char lbl_81694951 = 0; + extern "C" const char lbl_81694952 = 0; + extern "C" const char lbl_81694953 = 255; + extern "C" const double lbl_81694998 = 4503601774854144.0; + #pragma pop + static Board* getBoard() { return (Board*)System::getSceneManager()->getScene(SCENE_BOARD); } @@ -1099,15 +1065,6 @@ calcNormal_ChannelSelect_L20: blr } - extern "C" asm void getCurrentChannel__Q33ipl7channel7ManagerFPiPi(int*, int*) { - nofralloc - lwz r0, -0x59a4(r13) - stw r0, 0(r3) - lwz r0, -0x59a0(r13) - stw r0, 0(r4) - blr - } - void ChannelSelect::initCalcFadeout() { } @@ -1131,14 +1088,6 @@ calcNormal_ChannelSelect_L20: return result; } - #pragma push - #pragma section sconst_type ".sdata2" - extern "C" const char lbl_81694950 = 0; - extern "C" const char lbl_81694951 = 0; - extern "C" const char lbl_81694952 = 0; - extern "C" const char lbl_81694953 = 255; - #pragma pop - extern "C" asm void draw__Q33ipl5scene13ChannelSelectFv() { nofralloc stwu r1, -0x40(r1) @@ -1781,7 +1730,7 @@ draw_ChannelSelect_L6: if (isPageCreatedAllDone(mCurrentPage)) { if (unkBool()) { int page, index; - getCurrentChannel__Q33ipl7channel7ManagerFPiPi(&page, &index); + channel::Manager::getCurrentChannel(&page, &index); reserveSceneChangeDerived(page, index); mState = STATE_CHANNEL_TITLE; } @@ -1791,7 +1740,7 @@ draw_ChannelSelect_L6: void ChannelSelect::calcNormalFadeOutZoom() { // unused int page, index; - getCurrentChannel__Q33ipl7channel7ManagerFPiPi(&page, &index); + channel::Manager::getCurrentChannel(&page, &index); calcChanZoomParam(); setChanZoomOrtho(); @@ -2619,28 +2568,33 @@ calcNormalRestart_ChannelSelect_L7: nw4r::ut::Rect projRect; System::getProjectionRect(&projRect); GXRenderModeObj* rMode = System::getRenderModeObj(); - f32 var_f31; - f32 var_f30; f32 var_f29; + f32 var_f30; + f32 var_f31; f32 var_f1; u16 var_r0; u16 var_r3; if (mState == STATE_NORMAL_FADE_ZOOM || mState == STATE_NORMAL_DONE_FADE_ZOOM || mState == STATE_NORMAL_RESTART) { nw4r::math::MTX44 mtx; - f32 right = unk_0xD8.x + projRect.right / unk_0xE4.x; - f32 left = unk_0xD8.x + projRect.left / unk_0xE4.x; - f32 bottom = unk_0xD8.y - projRect.bottom / unk_0xE4.y; - f32 top = unk_0xD8.y - projRect.top / unk_0xE4.y; + f32 rightScale = projRect.right / unk_0xE4.x; + f32 leftScale = projRect.left / unk_0xE4.x; + f32 topScale = projRect.top / unk_0xE4.y; + f32 bottomScale = projRect.bottom / unk_0xE4.y; + f32 bottom = unk_0xD8.y - bottomScale; + f32 right = unk_0xD8.x + rightScale; + f32 left = unk_0xD8.x + leftScale; + f32 top = unk_0xD8.y - topScale; MTXOrtho(mtx, top, bottom, left, right, -100.0f, 100.0f); nw4r::math::VEC4 vec4_in(vec.x, vec.y, 0.0f, 1.0f); nw4r::math::VEC4 vec4; nw4r::math::VEC4Transform(&vec4, &mtx, &vec4_in); var_r0 = rMode->fbWidth; var_r3 = rMode->efbHeight; - f32 width = projRect.GetWidth(); - var_f31 = ((1.0f + vec4.x) * var_r0 / 2) - ((mChanThumbOff_X * unk_0xE4.x) * (var_r0 / width)); + var_f29 = projRect.GetWidth(); var_f30 = (var_r3 - ((1.0f + vec4.y) * var_r3 / 2)) - (mChanThumbOff_Y * unk_0xE4.y); - var_f29 = 2.0f * (mChanThumbOff_X * unk_0xE4.x) * (var_r0 / width); + f32 temp_f7_2 = var_r0 / var_f29; + var_f31 = ((1.0f + vec4.x) * var_r0 / 2) - ((mChanThumbOff_X * unk_0xE4.x) * (temp_f7_2)); + var_f29 = 2.0f * (mChanThumbOff_X * unk_0xE4.x) * (var_r0 / var_f29); var_f1 = 2.0f * (mChanThumbOff_Y * unk_0xE4.y); } else { var_r0 = rMode->fbWidth; @@ -2864,8 +2818,8 @@ calcNormalRestart_ChannelSelect_L7: if (mCurrentPage > 0 && unk_0x2B0 >= 15 && isPageCreatedAllDone(mCurrentPage)) { if (unkBool()) { button->animation(Button::IDANIM_ARROW_LEFT_SELECT); - mpLayout->setMinFrame(0.0f); - mpLayout->setMaxFrame(20.0f); + mpLayout->setMinFrame(lbl_81694948); + mpLayout->setMaxFrame(lbl_81694968); mpLayout->setAnmType(ANIM_TYPE_FORWARD); mpLayout->start(); @@ -2882,7 +2836,7 @@ calcNormalRestart_ChannelSelect_L7: for (int i = 0; i < MAX_CHANNEL_INDEX; i++) { mpGui->initPane(getChannelBasePane(i)); } - snd::getSystem()->startSE("WSD_SELECT"); + snd::getSystem()->startSE(lbl_8164DE9C); return; } } @@ -2890,8 +2844,8 @@ calcNormalRestart_ChannelSelect_L7: if (mCurrentPage < mMaxPages - 1 && unk_0x2AC >= 15 && isPageCreatedAllDone(mCurrentPage)) { if (unkBool()) { button->animation(Button::IDANIM_ARROW_RIGHT_SELECT); - mpLayout->setMinFrame(40.0f); - mpLayout->setMaxFrame(60.0f); + mpLayout->setMinFrame(lbl_8169496C); + mpLayout->setMaxFrame(lbl_81694970); mpLayout->setAnmType(ANIM_TYPE_FORWARD); mpLayout->start(); @@ -2908,7 +2862,7 @@ calcNormalRestart_ChannelSelect_L7: for (int i = 0; i < MAX_CHANNEL_INDEX; i++) { mpGui->initPane(getChannelBasePane(i)); } - snd::getSystem()->startSE("WSD_SELECT"); + snd::getSystem()->startSE(lbl_8164DE9C); return; } } @@ -2991,14 +2945,60 @@ calcNormalRestart_ChannelSelect_L7: } } - void ChannelSelect::calcNormalMoveChanOut() { - if (!mpMoveLytMask->getAnim(1)->isPlaying() && - !mpMoveLytObject->getAnim(1)->isPlaying() && - !mpMoveLytDrop->getAnim(1)->isPlaying()) { - unk_0x2C8->setCurrentFrame(System::getRndm()->get_u16() % 2000); - restartChannelModules(); - mState = STATE_NORMAL; - } + extern "C" asm void calcNormalMoveChanOut__Q33ipl5scene13ChannelSelectFv() { + nofralloc + stwu r1, -0x20(r1) + mflr r0 + li r4, 0x1 + stw r0, 0x24(r1) + stw r31, 0x1c(r1) + mr r31, r3 + lwz r5, 0xac(r3) + addi r3, r5, 0x28c + bl List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs + lwz r0, 0x14(r3) + cmpwi r0, 0x1 + beq calcNormalMoveChanOut_ChannelSelect_L1 + lwz r3, 0xb0(r31) + li r4, 0x1 + addi r3, r3, 0x28c + bl List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs + lwz r0, 0x14(r3) + cmpwi r0, 0x1 + beq calcNormalMoveChanOut_ChannelSelect_L1 + lwz r3, 0xb4(r31) + li r4, 0x1 + addi r3, r3, 0x28c + bl List_GetNth__Q24nw4r2utFPCQ34nw4r2ut4ListUs + lwz r0, 0x14(r3) + cmpwi r0, 0x1 + beq calcNormalMoveChanOut_ChannelSelect_L1 + bl getRndm__Q23ipl6SystemFv + bl get_u16__Q33ipl4math6RandomFv + clrlwi r7, r3, 16 + li r6, 0x7d0 + divw r5, r7, r6 + lis r0, 0x4330 + stw r0, 0x8(r1) + mr r3, r31 + lfd f1, lbl_81694998 + lwz r4, 0x2c8(r31) + mullw r0, r5, r6 + subf r0, r0, r7 + xoris r0, r0, 0x8000 + stw r0, 0xc(r1) + lfd f0, 0x8(r1) + fsubs f0, f0, f1 + stfs f0, 0xc(r4) + bl restartChannelModules__Q33ipl5scene13ChannelSelectFv + li r0, 0x1 + stw r0, 0xc0(r31) +calcNormalMoveChanOut_ChannelSelect_L1: + lwz r0, 0x24(r1) + lwz r31, 0x1c(r1) + mtlr r0 + addi r1, r1, 0x20 + blr } void ChannelSelect::calcNormalDragScrl() { @@ -3116,7 +3116,7 @@ calcNormalRestart_ChannelSelect_L7: if (con->isValidDpd()) { mDragPos = con->getDpdPos(); } else { - mDragPos = nw4r::math::VEC2(0.0f, 0.0f); + mDragPos = nw4r::math::VEC2(lbl_81694948, lbl_81694948); } mConChan = con->getChannel(); @@ -3379,19 +3379,6 @@ calcNormalRestart_ChannelSelect_L7: math::VEC2 ForceCTORWeak() { return math::VEC2(NULL, NULL); } - - // Stripped out function generated weak emits for dead data (dedup'd vtables). - void ForceVTableWeaks() { - utility::Tree::reverse_iterator deadTreeIter(NULL); - scene::Base::reverse_iterator deadSceneIter(NULL); - OptOutButtonEventHandlerBase deadOptOutEvent; - (void)deadTreeIter; - (void)deadSceneIter; - (void)deadOptOutEvent; - } - - static u32 deadSBss; - DECOMP_FORCE_ACTIVE(iplChannelSelect_cpp, deadSBss); #endif // NON_MATCHING } // namespace scene } // namespace ipl diff --git a/src/scene/channelTitle/iplChannelTitle.cpp b/src/scene/channelTitle/iplChannelTitle.cpp index 24791cf1..de0c0dd5 100644 --- a/src/scene/channelTitle/iplChannelTitle.cpp +++ b/src/scene/channelTitle/iplChannelTitle.cpp @@ -2900,60 +2900,6 @@ namespace ipl { } void ChannelTitle::startResetting() { - // clang-format off - static const f32 pad0 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad1 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad2 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad3 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad4 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad5 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad6 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad7 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad8 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad9 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad10 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad11 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad12 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad13 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad14 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad15 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad16 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad17 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad18 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad19 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad20 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad21 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad22 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad23 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad24 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad25 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad26 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad27 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad28 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad29 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad30 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad31 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad32 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad33 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad34 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad35 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad36 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad37 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad38 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad39 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad40 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad41 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad42 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad43 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad44 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad45 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const u8 pad53 __attribute__((section(".sdata"), aligned(1), used)) = 0; - static const u8 pad54 __attribute__((section(".sdata"), aligned(1), used)) = 0; - static const u8 pad55 __attribute__((section(".sdata"), aligned(1), used)) = 0; - static const u8 pad56 __attribute__((section(".sdata"), aligned(1), used)) = 0; - static const u8 pad57 __attribute__((section(".sdata"), aligned(1), used)) = 0; - static const u8 pad58 __attribute__((section(".sdata"), aligned(1), used)) = 0; - // clang-format on snd::getSystem()->resetAllSound(); } } // namespace scene diff --git a/src/system/iplController.cpp b/src/system/iplController.cpp index 223072f3..a1a9d3e9 100644 --- a/src/system/iplController.cpp +++ b/src/system/iplController.cpp @@ -1,7 +1,5 @@ #include -#define IPL_MATH_VEC2_CTOR_OUT_OF_LINE #include -#undef IPL_MATH_VEC2_CTOR_OUT_OF_LINE #define IPL_SOUND_RECT_OUT_OF_LINE #include #undef IPL_SOUND_RECT_OUT_OF_LINE @@ -34,7 +32,6 @@ extern "C" void pinch__Q33ipl10controller9InterfaceCFv(); extern "C" void pinchTrg__Q33ipl10controller9InterfaceCFv(); extern "C" void pinchOffTrg__Q33ipl10controller9InterfaceCFv(); extern "C" void decide__Q33ipl10controller6MasterCFv(); -extern "C" void call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b(); extern "C" void repeat__Q33ipl10controller6MasterCFUl(); extern "C" void rumble__Q33ipl10controller9InterfaceFi(); extern "C" void cancelRumbling__Q33ipl10controller9InterfaceFv(); @@ -329,17 +326,25 @@ extern "C" ControllerDataFunction const __vt__Q33ipl10controller4Core[35] = { read__Q33ipl10controller10RevolutionFv, }; #pragma pop -extern const f32 lbl_81694450; -extern const f32 lbl_81694454; -extern const f32 lbl_81694458; -extern const f32 lbl_8169445C; -extern const f32 lbl_81694460; -extern const f32 lbl_81694478; -extern const f32 lbl_8169447C; -extern const f32 lbl_81694480; -extern const f32 lbl_81694484; -extern const f32 lbl_81694488; -extern const f32 lbl_8169448C; +extern const f32 lbl_81694440 = 1000.0f; +extern const f32 lbl_81694444 = 0.058333333f; +extern const f64 lbl_81694448 = 4503599627370496.0; +extern const f32 lbl_81694450 = 1.0f / 0.0f; +extern const f32 lbl_81694454 = 0.0f; +extern const f32 lbl_81694458 = 1.10132003f; +extern const f32 lbl_8169445C = 1.15f; +extern const f32 lbl_81694460 = 100.0f; +extern const f32 lbl_81694464 = 0.01f; +extern const f32 lbl_81694468 = 0.0036f; +extern const f32 lbl_8169446C = 0.05f; +extern const f32 lbl_81694470 = 1.0f; +extern const f32 lbl_81694474 = -0.2679492f; +extern const f32 lbl_81694478 = 0.5f; +extern const f32 lbl_8169447C = 0.1f; +extern const f32 lbl_81694480 = 0.2f; +extern const f32 lbl_81694484 = -0.2f; +extern const f32 lbl_81694488 = 0.05f; +extern const f32 lbl_8169448C = 1.0f; extern "C" void* mpBuf__Q33ipl10controller7Manager = 0; extern "C" void* mpParentHeap__Q33ipl10controller7Manager = 0; extern "C" void* mpHeap__Q33ipl10controller7Manager = 0; @@ -372,264 +377,6 @@ extern "C" void __nw__FUlPQ23EGG4Heapi(); extern "C" void read__Q33ipl10controller7ManagerFv(); extern "C" void __dl__FPv(); -namespace ipl { - namespace math { - template <> - float abs_clamp<>(const float& x, const float& y); - } -} - -namespace ipl { - namespace controller { - EGG::Allocator* Manager::mpAllocator; - - void Base::read() { - if (isValidBtn()) { - if (downTrg(BTN_INTERACT)) { - mButton = 1; - } - if (pinch()) { - mButton = 0; - } - if (mButton != 0) { - if (down(BTN_INTERACT)) { - unk_0x08++; - } else { - unk_0x08 = 0; - mButton = 0; - } - } else { - unk_0x08 = 0; - } - } else { - mButton = 0; - unk_0x08 = 0; - } - - switch (mRumbleType) { - case 0: - case 1: { - u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime); - f32 f1 = (f32)time / 1000.0f; - if (f1 < 0.058333333f) { - WPADControlMotor(mChan, 1); - } else if (f1 < lbl_8160D2C0[mRumbleType]) { - WPADControlMotor(mChan, 0); - } else if (getKPADStatus() == NULL || getKPADStatus()->wpad_err == 0) { - mLastRumbleTime = 0; - mRumbleType = -1; - WPADControlMotor(mChan, 0); - } - if (downTrg(BTN_INTERACT) != 0 || decide() != 0) { - WPADControlMotor(mChan, 0); - mRumbleType = 2; - } - break; - } - case 2: { - u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime); - f32 f1 = (f32)time / 1000.0f; - if (f1 < lbl_8160D2C0[1]) { - WPADControlMotor(mChan, 0); - } else if (getKPADStatus() == NULL || getKPADStatus()->wpad_err == 0) { - mLastRumbleTime = 0; - mRumbleType = -1; - WPADControlMotor(mChan, 0); - } - break; - } - } - } - bool Interface::isValidBtn() const { - return false; - } - bool Interface::downTrg(u32 mButton) const { - return 0; - } - int Interface::pinch() const { - return 0; - } -extern "C" asm void down__Q33ipl10controller9InterfaceCFUl() { - nofralloc - li r3, 0 - blr -} - KPADStatus* Interface::getKPADStatus() const { - return NULL; - } - int Base::decide() const { - return unk_0x08 == 5; - } - int Base::rumble(int type) { - int ret = FALSE; - if (WPADIsMotorEnabled() && mRumbleType == -1) { - mLastRumbleTime = OSGetTick(); - ret = TRUE; - mRumbleType = type; - } - - return ret; - } - void Base::cancelRumbling() { - if (mRumbleType != -1) { - WPADControlMotor(mChan, 0); - } - mLastRumbleTime = 0; - mRumbleType = -1; - } - extern "C" const f32 lbl_81694450 = 1.0f / 0.0f; - extern "C" const f32 lbl_81694454 = 0.0f; - extern "C" const f32 lbl_81694458 = 1.10132003f; - extern "C" const f32 lbl_8169445C = 1.15f; - extern "C" const f32 lbl_81694460 = 100.0f; - extern "C" asm void read__Q33ipl10controller10RevolutionFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - lwz r12, 0(r3) - lwz r12, 0x70(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - bne revolution_read_dpd_done - lfs f1, lbl_81694450 - lwz r3, 0x20(r31) - lfs f0, lbl_81694454 - stfs f1, 0x24(r3) - lwz r3, 0x20(r31) - stfs f1, 0x20(r3) - lwz r3, 0x20(r31) - stfs f0, 0x30(r3) - lwz r3, 0x20(r31) - stfs f0, 0x2c(r3) - lwz r3, 0x20(r31) - stfs f0, 0x28(r3) - revolution_read_dpd_done: - lbz r0, 0x1d(r31) - mr r3, r31 - stb r0, 0x1e(r31) - lwz r12, 0(r31) - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq revolution_read_btn_invalid - lbz r0, 0x1e(r31) - cmpwi r0, 0 - bne revolution_read_btn_was_down - lwz r12, 0(r31) - mr r3, r31 - li r4, 0x800 - lwz r12, 0x14(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq revolution_read_btn_end - lwz r12, 0(r31) - mr r3, r31 - li r4, 0x400 - lwz r12, 0x14(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq revolution_read_btn_end - li r0, 1 - stb r0, 0x1d(r31) - b revolution_read_btn_end - revolution_read_btn_was_down: - lwz r12, 0(r31) - mr r3, r31 - li r4, 0x800 - lwz r12, 0x14(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq revolution_read_clear_btn - lwz r12, 0(r31) - mr r3, r31 - li r4, 0x400 - lwz r12, 0x14(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - bne revolution_read_btn_end - revolution_read_clear_btn: - li r0, 0 - stb r0, 0x1d(r31) - b revolution_read_btn_end - revolution_read_btn_invalid: - li r0, 0 - stb r0, 0x1d(r31) - revolution_read_btn_end: - mr r3, r31 - bl read__Q33ipl10controller4BaseFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - } - bool Revolution::isValidDpd() const { - if (unk_0x1C != 0) { - return false; - } - - return (unk_0x20->wpad_err == 0 || unk_0x20->wpad_err == -7) && unk_0x20->dpd_valid_fg != 0; - } - bool Revolution::isValidBtn() const { - u8 val = unk_0x20->wpad_err; - - return (u8)(val + 7) <= 7 && ((1 << (val + 7)) & 0xA1) != 0; - } - bool Revolution::down(u32 mButton) const { - bool ret = false; - if (isValidBtn()) { - if (unk_0x20->hold & (mButton & 0xFFFF)) { - ret = true; - } - } - - return ret; - } - math::VEC2 Revolution::getDpdProjectionPos() const { - math::VEC2 ret; - Vec2 dest; - Vec2 src = {unk_0x20->pos.x, unk_0x20->pos.y}; - nw4r::ut::Rect nw4r_rect; // constructor shouldn't be inlined - Rect kpad_rect; - - System::getProjectionRect(&nw4r_rect); - - kpad_rect.left = nw4r_rect.left; - kpad_rect.top = nw4r_rect.top; - kpad_rect.right = nw4r_rect.right; - kpad_rect.bottom = nw4r_rect.bottom; - - KPADGetProjectionPos(&dest, &src, &kpad_rect, *(const f32*)&lbl_81694458); - if (SCGetAspectRatio() == 1) { - dest.x *= *(const f32*)&lbl_8169445C; - dest.y *= *(const f32*)&lbl_8169445C; - } - - // regswap - if (nw4r_rect.left - *(const f32*)&lbl_81694460 > dest.x) { - dest.x = nw4r_rect.left - *(const f32*)&lbl_81694460; - } else if (*(const f32*)&lbl_81694460 + nw4r_rect.right < dest.x) { - dest.x = *(const f32*)&lbl_81694460 + nw4r_rect.right; - } else if (nw4r_rect.top - *(const f32*)&lbl_81694460 > dest.y) { - dest.y = nw4r_rect.top - *(const f32*)&lbl_81694460; - } else if (*(const f32*)&lbl_81694460 + nw4r_rect.bottom < dest.y) { - dest.y = *(const f32*)&lbl_81694460 + nw4r_rect.bottom; - } - // // - - ret.set(dest.x, dest.y); // shouldn't be inlined - - return ret; - } extern "C" asm void __ct__Q34nw4r2ut4RectFv() { nofralloc lfs f0, lbl_81694454 @@ -639,288 +386,367 @@ extern "C" asm void __ct__Q34nw4r2ut4RectFv() { stfs f0, 0xc(r3) blr } -extern "C" asm void set__Q33ipl4math4VEC2Fff() { + +extern "C" asm void __dt__Q33ipl10controller7ClassicFv() { nofralloc - stfs f1, 0(r3) - stfs f2, 4(r3) + stwu r1, -0x10(r1) + mflr r0 + cmpwi r3, 0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r4 + stw r30, 0x8(r1) + mr r30, r3 + beq classic_dtor_done + li r4, 0 + bl __dt__Q33ipl10controller10RevolutionFv + cmpwi r31, 0 + ble classic_dtor_done + mr r3, r30 + bl __dl__FPv +classic_dtor_done: + mr r3, r30 + lwz r31, 0xc(r1) + lwz r30, 0x8(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 blr } - Classic::Classic(int arg0, KPADStatus& arg1) : Revolution(arg0, arg1) { - unk_0x24.x = 0.01f; - unk_0x24.y = 0.01f; - unk_0x2C = 0; - } - Base::~Base() { - } - Revolution::~Revolution() { - } - } - namespace math { - VEC2::VEC2(f32 fx, f32 fy) { - x = fx; - y = fy; - } - } - namespace controller { - void Classic::read() { - if (!Revolution::isValidDpd()) { - math::VEC2 lstick(unk_0x20->ex_status.cl.lstick.x, unk_0x20->ex_status.cl.lstick.y); - if (lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f) { - unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * 0.05f, 1.8f); - unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * 0.05f, 1.2f); - } +extern "C" asm void __dt__Q33ipl10controller4CoreFv() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + cmpwi r3, 0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r4 + stw r30, 0x8(r1) + mr r30, r3 + beq core_dtor_done + li r4, 0 + bl __dt__Q33ipl10controller10RevolutionFv + cmpwi r31, 0 + ble core_dtor_done + mr r3, r30 + bl __dl__FPv +core_dtor_done: + mr r3, r30 + lwz r31, 0xc(r1) + lwz r30, 0x8(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr +} - math::VEC2 rstick = math::VEC2(unk_0x20->ex_status.cl.rstick.x, unk_0x20->ex_status.cl.rstick.y); - if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f || - rstick.x * rstick.x + rstick.y * rstick.y > 0.0036f) { - unk_0x2C = 180; - } +extern "C" asm void __dt__Q33ipl10controller9FreeStyleFv() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + cmpwi r3, 0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r4 + stw r30, 0x8(r1) + mr r30, r3 + beq freestyle_dtor_done + li r4, 0 + bl __dt__Q33ipl10controller10RevolutionFv + cmpwi r31, 0 + ble freestyle_dtor_done + mr r3, r30 + bl __dl__FPv +freestyle_dtor_done: + mr r3, r30 + lwz r31, 0xc(r1) + lwz r30, 0x8(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr +} - if (--unk_0x2C < 0) { - unk_0x2C = 0; - } - } else { - unk_0x24.y = 0.01f; - unk_0x24.x = 0.01f; - unk_0x2C = 0; - } +extern "C" asm void getMainStickX__Q33ipl10controller9InterfaceCFv() { + nofralloc + li r3, 0 + blr +} - Revolution::read(); - } - int Classic::getClassicHoldFlag() const { - return unk_0x20->ex_status.cl.hold; - } - } - namespace math { - template <> - float abs_clamp<>(const float& x, const float& y) { - if (x > y) { - return y; - } else if (x < -y) { - return -y; - } else { - return x; - } - } - } - namespace controller { - math::VEC2 Classic::getHorizon() const { - math::VEC2 ret; - if (Revolution::isValidDpd()) { - ret.set(unk_0x20->horizon.x, unk_0x20->horizon.y); - } else { - ret.x = 1.0f; - ret.y = -0.2679492f; - } - return ret; - } - math::VEC2 Classic::getDpdPos() const { - math::VEC2 ret; - if (Revolution::isValidDpd()) { - ret.set(unk_0x20->pos.x, unk_0x20->pos.y); - } else if (unk_0x2C != 0) { - ret = unk_0x24; - } else { - ret.x = *(const f32*)&lbl_81694450; - ret.y = *(const f32*)&lbl_81694450; - } - return ret; - } - } - namespace math { - void VEC2::operator=(const VEC2& r) { - x = r.x; - y = r.y; - } - } - namespace controller { - extern "C" asm void getDpdProjectionPos__Q33ipl10controller7ClassicCFv() { - nofralloc - stwu r1, -0x50(r1) - mflr r0 - stw r0, 0x54(r1) - stw r31, 0x4c(r1) - mr r31, r3 - bl isValidDpd__Q33ipl10controller10RevolutionCFv - cmpwi r3, 0 - beq classic_projection_check_stick - lwz r4, 0x20(r31) - addi r3, r1, 0x18 - lfs f1, 0x20(r4) - lfs f2, 0x24(r4) - bl set__Q33ipl4math4VEC2Fff - b classic_projection_have_src - classic_projection_check_stick: - lwz r0, 0x2c(r31) - cmpwi r0, 0 - beq classic_projection_invalid - addi r3, r1, 0x18 - addi r4, r31, 0x24 - bl __as__Q33ipl4math4VEC2FRCQ33ipl4math4VEC2 - b classic_projection_have_src - classic_projection_invalid: - lfs f0, lbl_81694450 - stfs f0, 0x18(r1) - stfs f0, 0x1c(r1) - classic_projection_have_src: - lfs f1, 0x18(r1) - addi r3, r1, 0x30 - lfs f0, 0x1c(r1) - stfs f1, 0x8(r1) - stfs f0, 0xc(r1) - bl __ct__Q34nw4r2ut4RectFv - addi r3, r1, 0x30 - bl getProjectionRect__Q23ipl6SystemFPQ34nw4r2ut4Rect - lfs f1, 0x30(r1) - addi r3, r1, 0x10 - lfs f3, 0x34(r1) - addi r4, r1, 0x8 - lfs f2, 0x38(r1) - addi r5, r1, 0x20 - lfs f0, 0x3c(r1) - stfs f1, 0x20(r1) - lfs f1, lbl_81694458 - stfs f3, 0x24(r1) - stfs f2, 0x28(r1) - stfs f0, 0x2c(r1) - bl KPADGetProjectionPos - bl SCGetAspectRatio - clrlwi r0, r3, 24 - cmplwi r0, 1 - bne classic_projection_no_aspect - lfs f1, 0x10(r1) - lfs f2, lbl_8169445C - lfs f0, 0x14(r1) - fmuls f1, f1, f2 - fmuls f0, f0, f2 - stfs f1, 0x10(r1) - stfs f0, 0x14(r1) - classic_projection_no_aspect: - lfs f0, 0x30(r1) - lfs f2, lbl_81694460 - lfs f1, 0x10(r1) - fsubs f0, f0, f2 - fcmpo cr0, f0, f1 - ble classic_projection_right - stfs f0, 0x10(r1) - b classic_projection_done - classic_projection_right: - lfs f0, 0x38(r1) - fadds f0, f2, f0 - fcmpo cr0, f0, f1 - bge classic_projection_top - stfs f0, 0x10(r1) - b classic_projection_done - classic_projection_top: - lfs f0, 0x34(r1) - lfs f1, 0x14(r1) - fsubs f0, f0, f2 - fcmpo cr0, f0, f1 - ble classic_projection_bottom - stfs f0, 0x14(r1) - b classic_projection_done - classic_projection_bottom: - lfs f0, 0x3c(r1) - fadds f0, f2, f0 - fcmpo cr0, f0, f1 - bge classic_projection_done - stfs f0, 0x14(r1) - classic_projection_done: - lfs f1, 0x10(r1) - addi r3, r1, 0x18 - lfs f2, 0x14(r1) - bl set__Q33ipl4math4VEC2Fff - lwz r31, 0x4c(r1) - lwz r0, 0x54(r1) - lwz r3, 0x18(r1) - lwz r4, 0x1c(r1) - mtlr r0 - addi r1, r1, 0x50 - blr - } -extern "C" asm void down__Q33ipl10controller6MasterCFUl() { +extern "C" asm void getMainStickY__Q33ipl10controller9InterfaceCFv() { + nofralloc + li r3, 0 + blr +} + +extern "C" asm void getSubStickX__Q33ipl10controller9InterfaceCFv() { + nofralloc + li r3, 0 + blr +} + +extern "C" asm void getSubStickY__Q33ipl10controller9InterfaceCFv() { + nofralloc + li r3, 0 + blr +} + +extern "C" asm void getDpdPos__Q33ipl10controller10RevolutionCFv() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + lwz r4, 0x20(r3) + stw r0, 0x14(r1) + addi r3, r1, 8 + lfs f1, 0x20(r4) + lfs f2, 0x24(r4) + bl __ct__Q33ipl4math4VEC2Fff + lwz r0, 0x14(r1) + mr r4, r3 + lwz r3, 0(r3) + lwz r4, 4(r4) + mtlr r0 + addi r1, r1, 0x10 + blr +} + +extern "C" asm void getHorizon__Q33ipl10controller10RevolutionCFv() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + lwz r4, 0x20(r3) + stw r0, 0x14(r1) + addi r3, r1, 8 + lfs f1, 0x34(r4) + lfs f2, 0x38(r4) + bl __ct__Q33ipl4math4VEC2Fff + lwz r0, 0x14(r1) + mr r4, r3 + lwz r3, 0(r3) + lwz r4, 4(r4) + mtlr r0 + addi r1, r1, 0x10 + blr +} + +extern "C" asm void repeat__Q33ipl10controller10RevolutionCFUl() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + li r31, 0 + stw r30, 8(r1) + mr r30, r3 + lwz r12, 0(r3) + lwz r12, 0x14(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Revolution_repeat_L1 + lwz r3, 0x20(r30) + lwz r0, 0(r3) + rlwinm. r0, r0, 0, 0, 0 + beq iplController_Revolution_repeat_L1 + li r31, 1 +iplController_Revolution_repeat_L1: + mr r3, r31 + lwz r31, 0xc(r1) + lwz r30, 8(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr +} + +extern "C" asm void down__Q33ipl10controller7ClassicCFUl() { nofralloc stwu r1, -0x20(r1) mflr r0 - lis r8, lbl_816346A8@ha stw r0, 0x24(r1) - addi r5, r1, 8 - lwzu r7, lbl_816346A8@l(r8) - lwz r6, 4(r8) - lwz r0, 8(r8) - stw r7, 8(r1) - stw r6, 0xc(r1) - stw r0, 0x10(r1) - bl call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b + addi r11, r1, 0x20 + bl _savegpr_29 + lwz r12, 0(r3) + mr r29, r3 + mr r30, r4 + li r31, 0 + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Classic_down_L1 + lwz r3, 0x20(r29) + li r4, 1 + lwz r0, 0(r3) + and r0, r0, r30 + clrlwi. r0, r0, 16 + bne iplController_Classic_down_L2 + lwz r3, 0x60(r3) + srwi r0, r30, 16 + and. r0, r3, r0 + bne iplController_Classic_down_L2 + li r4, 0 +iplController_Classic_down_L2: + cmpwi r4, 0 + beq iplController_Classic_down_L1 + li r31, 1 +iplController_Classic_down_L1: + addi r11, r1, 0x20 + mr r3, r31 + bl _restgpr_29 lwz r0, 0x24(r1) mtlr r0 addi r1, r1, 0x20 blr } -extern "C" asm void downTrg__Q33ipl10controller6MasterCFUl() { + +extern "C" asm void downTrg__Q33ipl10controller7ClassicCFUl() { nofralloc stwu r1, -0x20(r1) mflr r0 - lis r8, lbl_816346B4@ha stw r0, 0x24(r1) - addi r5, r1, 8 - lwzu r7, lbl_816346B4@l(r8) - lwz r6, 4(r8) - lwz r0, 8(r8) - stw r7, 8(r1) - stw r6, 0xc(r1) - stw r0, 0x10(r1) - bl call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b + addi r11, r1, 0x20 + bl _savegpr_29 + lwz r12, 0(r3) + mr r29, r3 + mr r30, r4 + li r31, 0 + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Classic_downTrg_L1 + lwz r5, 0x20(r29) + clrlwi r0, r30, 16 + li r4, 1 + lwz r3, 4(r5) + and. r0, r3, r0 + bne iplController_Classic_downTrg_L2 + lwz r3, 0x64(r5) + srwi r0, r30, 16 + and. r0, r3, r0 + bne iplController_Classic_downTrg_L2 + li r4, 0 +iplController_Classic_downTrg_L2: + cmpwi r4, 0 + beq iplController_Classic_downTrg_L1 + li r31, 1 +iplController_Classic_downTrg_L1: + addi r11, r1, 0x20 + mr r3, r31 + bl _restgpr_29 lwz r0, 0x24(r1) mtlr r0 addi r1, r1, 0x20 blr } -extern "C" asm void upTrg__Q33ipl10controller6MasterCFUl() { + +extern "C" asm void upTrg__Q33ipl10controller7ClassicCFUl() { nofralloc stwu r1, -0x20(r1) mflr r0 - lis r8, lbl_816346C0@ha stw r0, 0x24(r1) - addi r5, r1, 8 - lwzu r7, lbl_816346C0@l(r8) - lwz r6, 4(r8) - lwz r0, 8(r8) - stw r7, 8(r1) - stw r6, 0xc(r1) - stw r0, 0x10(r1) - bl call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b + addi r11, r1, 0x20 + bl _savegpr_29 + lwz r12, 0(r3) + mr r29, r3 + mr r30, r4 + li r31, 0 + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Classic_upTrg_L1 + lwz r5, 0x20(r29) + clrlwi r0, r30, 16 + li r4, 1 + lwz r3, 8(r5) + and. r0, r3, r0 + bne iplController_Classic_upTrg_L2 + lwz r3, 0x68(r5) + srwi r0, r30, 16 + and. r0, r3, r0 + bne iplController_Classic_upTrg_L2 + li r4, 0 +iplController_Classic_upTrg_L2: + cmpwi r4, 0 + beq iplController_Classic_upTrg_L1 + li r31, 1 +iplController_Classic_upTrg_L1: + addi r11, r1, 0x20 + mr r3, r31 + bl _restgpr_29 lwz r0, 0x24(r1) mtlr r0 addi r1, r1, 0x20 blr } - bool Interface::upTrg(u32 mButton) const { - return 0; - } -extern "C" asm void repeat__Q33ipl10controller6MasterCFUl() { + +extern "C" asm void downTrg__Q33ipl10controller10RevolutionCFUl() { nofralloc stwu r1, -0x20(r1) mflr r0 - lis r8, lbl_816346CC@ha stw r0, 0x24(r1) - addi r5, r1, 8 - lwzu r7, lbl_816346CC@l(r8) - lwz r6, 4(r8) - lwz r0, 8(r8) - stw r7, 8(r1) - stw r6, 0xc(r1) - stw r0, 0x10(r1) - bl call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b + addi r11, r1, 0x20 + bl _savegpr_29 + lwz r12, 0(r3) + mr r29, r3 + mr r30, r4 + li r31, 0 + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Revolution_downTrg_L1 + lwz r3, 0x20(r29) + clrlwi r0, r30, 16 + lwz r3, 4(r3) + and. r0, r3, r0 + beq iplController_Revolution_downTrg_L1 + li r31, 1 +iplController_Revolution_downTrg_L1: + addi r11, r1, 0x20 + mr r3, r31 + bl _restgpr_29 lwz r0, 0x24(r1) mtlr r0 addi r1, r1, 0x20 blr } - bool Interface::repeat(u32 mButton) const { - return 0; - } + +extern "C" asm void upTrg__Q33ipl10controller10RevolutionCFUl() { + nofralloc + stwu r1, -0x20(r1) + mflr r0 + stw r0, 0x24(r1) + addi r11, r1, 0x20 + bl _savegpr_29 + lwz r12, 0(r3) + mr r29, r3 + mr r30, r4 + li r31, 0 + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq iplController_Revolution_upTrg_L1 + lwz r3, 0x20(r29) + clrlwi r0, r30, 16 + lwz r3, 8(r3) + and. r0, r3, r0 + beq iplController_Revolution_upTrg_L1 + li r31, 1 +iplController_Revolution_upTrg_L1: + addi r11, r1, 0x20 + mr r3, r31 + bl _restgpr_29 + lwz r0, 0x24(r1) + mtlr r0 + addi r1, r1, 0x20 + blr +} + extern "C" asm void decide__Q33ipl10controller6MasterCFv() { nofralloc stwu r1, -0x20(r1) @@ -961,6 +787,7 @@ iplController_Master_decide_L2: addi r1, r1, 0x20 blr } + extern "C" asm void setForceInvalid__Q33ipl10controller6MasterFb() { nofralloc stwu r1, -0x20(r1) @@ -994,6 +821,45 @@ iplController_Master_setForceInvalid_L2: addi r1, r1, 0x20 blr } + +extern "C" asm void __ct__Q33ipl10controller10RevolutionFiiR10KPADStatus() { + nofralloc + stwu r1, -0x20(r1) + mflr r0 + stw r0, 0x24(r1) + addi r11, r1, 0x20 + bl _savegpr_29 + lis r7, __vt__Q33ipl10controller4Base@ha + li r31, 0 + addi r7, r7, __vt__Q33ipl10controller4Base@l + li r0, -1 + stw r7, 0(r3) + mr r29, r3 + mr r30, r6 + stb r31, 4(r3) + stw r31, 8(r3) + stw r31, 0xc(r3) + stw r0, 0x10(r3) + stw r4, 0x14(r3) + stw r5, 0x18(r3) + stb r31, 0x1c(r3) + mr r3, r4 + bl KPADEnableDPD + lis r3, __vt__Q33ipl10controller10Revolution@ha + stb r31, 0x1d(r29) + addi r3, r3, __vt__Q33ipl10controller10Revolution@l + addi r11, r1, 0x20 + stw r3, 0(r29) + mr r3, r29 + stb r31, 0x1e(r29) + stw r30, 0x20(r29) + bl _restgpr_29 + lwz r0, 0x24(r1) + mtlr r0 + addi r1, r1, 0x20 + blr +} + extern "C" asm void call__Q33ipl10controller6MasterCFUlMQ33ipl10controller9InterfaceFPCvPCvUl_b() { nofralloc stwu r1, -0x30(r1) @@ -1036,450 +902,235 @@ iplController_Master_call_L2: addi r1, r1, 0x30 blr } - void Interface::read() { + +namespace ipl { + namespace math { + void VEC2::operator=(const VEC2& r) { + x = r.x; + y = r.y; } -extern "C" asm void getSubStickY__Q33ipl10controller9InterfaceCFv() { - nofralloc - li r3, 0 - blr -} -extern "C" asm void getSubStickX__Q33ipl10controller9InterfaceCFv() { - nofralloc - li r3, 0 - blr -} -extern "C" asm void getMainStickY__Q33ipl10controller9InterfaceCFv() { - nofralloc - li r3, 0 - blr -} -extern "C" asm void getMainStickX__Q33ipl10controller9InterfaceCFv() { - nofralloc - li r3, 0 - blr -} - bool Interface::isValidDpd() const { - return false; - } - PADStatus* Interface::getPADStatus() const { - return NULL; - } -extern "C" asm void getDpdDistance__Q33ipl10controller9InterfaceCFv() { - nofralloc - lfs f1, lbl_81694454 - blr -} -extern "C" asm void getHorizon__Q33ipl10controller9InterfaceCFv() { - nofralloc - stwu r1, -0x10(r1) - lfs f0, lbl_81694454 - stfs f0, 8(r1) - stfs f0, 0xc(r1) - lwz r3, 8(r1) - lwz r4, 0xc(r1) - addi r1, r1, 0x10 - blr -} -extern "C" asm void getDpdProjectionPos__Q33ipl10controller9InterfaceCFv() { - nofralloc - stwu r1, -0x10(r1) - lfs f0, lbl_81694454 - stfs f0, 8(r1) - stfs f0, 0xc(r1) - lwz r3, 8(r1) - lwz r4, 0xc(r1) - addi r1, r1, 0x10 - blr -} -extern "C" asm void getDpdPos__Q33ipl10controller9InterfaceCFv() { - nofralloc - stwu r1, -0x10(r1) - lfs f0, lbl_81694454 - stfs f0, 8(r1) - stfs f0, 0xc(r1) - lwz r3, 8(r1) - lwz r4, 0xc(r1) - addi r1, r1, 0x10 - blr -} - int Interface::getClassicReleaseFlag() const { - return 0; - } - int Interface::getClassicTrigFlag() const { - return 0; - } - int Interface::getClassicHoldFlag() const { - return 0; - } - int Interface::getReleaseFlag() const { - return 0; - } - int Interface::getTrigFlag() const { - return 0; - } - int Interface::getHoldFlag() const { - return 0; - } - void Interface::cancelRumbling() { - } - BOOL Interface::rumble(int type) { - return FALSE; - } - int Interface::pinchOffTrg() const { - return 0; - } - int Interface::pinchTrg() const { - return 0; - } - int Interface::getChannel() const { - return -1; - } - int Interface::getType() const { - return -1; - } - bool Base::setForceInvalid(bool flag) { - unk_0x1C = flag; + } + + namespace controller { + void Base::read() { + if (isValidBtn()) { + if (downTrg(BTN_INTERACT)) { + mButton = 1; + } + if (pinch()) { + mButton = 0; + } + if (mButton != 0) { + if (down(BTN_INTERACT)) { + unk_0x08++; + } else { + unk_0x08 = 0; + mButton = 0; + } + } else { + unk_0x08 = 0; + } + } else { + mButton = 0; + unk_0x08 = 0; + } + + switch (mRumbleType) { + case 0: + case 1: { + u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime); + f32 f1 = (f32)time / lbl_81694440; + if (f1 < lbl_81694444) { + WPADControlMotor(mChan, 1); + } else if (f1 < lbl_8160D2C0[mRumbleType]) { + WPADControlMotor(mChan, 0); + } else if (getKPADStatus() == NULL || getKPADStatus()->wpad_err == 0) { + mLastRumbleTime = 0; + mRumbleType = -1; + WPADControlMotor(mChan, 0); + } + if (downTrg(BTN_INTERACT) != 0 || decide() != 0) { + WPADControlMotor(mChan, 0); + mRumbleType = 2; + } + break; + } + case 2: { + u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime); + f32 f1 = (f32)time / lbl_81694440; + if (f1 < lbl_8160D2C0[1]) { + WPADControlMotor(mChan, 0); + } else if (getKPADStatus() == NULL || getKPADStatus()->wpad_err == 0) { + mLastRumbleTime = 0; + mRumbleType = -1; + WPADControlMotor(mChan, 0); + } + break; + } + } } + int Base::getType() const { return mType; } + int Base::getChannel() const { return mChan; } - KPADStatus* Revolution::getKPADStatus() const { - return unk_0x20; - } - f32 Revolution::getDpdDistance() const { - return unk_0x20->dist; - } - int Revolution::getReleaseFlag() const { - return unk_0x20->release; - } - int Revolution::getTrigFlag() const { - return unk_0x20->trig; - } - int Revolution::getHoldFlag() const { - return unk_0x20->hold; - } - int Revolution::pinchOffTrg() const { - int ret = 0; - if (isValidBtn() && unk_0x1D == 0 && unk_0x1E != 0) { - ret = 1; - } - return ret; - } - int Revolution::pinch() const { - int ret = 0; - if (isValidBtn() && unk_0x1D != 0) { - ret = 1; - } - return ret; - } - int Revolution::pinchTrg() const { - int ret = 0; - if (isValidBtn() && unk_0x1D != 0 && unk_0x1E == 0) { - ret = 1; - } - return ret; - } -extern "C" asm void repeat__Q33ipl10controller10RevolutionCFUl() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - li r31, 0 - stw r30, 8(r1) - mr r30, r3 - lwz r12, 0(r3) - lwz r12, 0x14(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Revolution_repeat_L1 - lwz r3, 0x20(r30) - lwz r0, 0(r3) - rlwinm. r0, r0, 0, 0, 0 - beq iplController_Revolution_repeat_L1 - li r31, 1 -iplController_Revolution_repeat_L1: - mr r3, r31 - lwz r31, 0xc(r1) - lwz r30, 8(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - BOOL Classic::isValidDpdClassic() const { - return unk_0x2C != 0; - } - bool Classic::isValidDpd() const { - if (unk_0x1C != 0) { - return false; - } - return (Revolution::isValidDpd() != 0) || (unk_0x2C != 0); + bool Base::setForceInvalid(bool flag) { + unk_0x1C = flag; } - int Classic::getClassicReleaseFlag() const { - return unk_0x20->ex_status.cl.release; + + bool Interface::isValidBtn() const { + return false; } - int Classic::getClassicTrigFlag() const { - return unk_0x20->ex_status.cl.trig; + + bool Interface::downTrg(u32 mButton) const { + return 0; } -extern "C" asm void upTrg__Q33ipl10controller7ClassicCFUl() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lwz r12, 0(r3) - mr r29, r3 - mr r30, r4 - li r31, 0 - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Classic_upTrg_L1 - lwz r5, 0x20(r29) - clrlwi r0, r30, 16 - li r4, 1 - lwz r3, 8(r5) - and. r0, r3, r0 - bne iplController_Classic_upTrg_L2 - lwz r3, 0x68(r5) - srwi r0, r30, 16 - and. r0, r3, r0 - bne iplController_Classic_upTrg_L2 - li r4, 0 -iplController_Classic_upTrg_L2: - cmpwi r4, 0 - beq iplController_Classic_upTrg_L1 - li r31, 1 -iplController_Classic_upTrg_L1: - addi r11, r1, 0x20 - mr r3, r31 - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} -extern "C" asm void downTrg__Q33ipl10controller7ClassicCFUl() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lwz r12, 0(r3) - mr r29, r3 - mr r30, r4 - li r31, 0 - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Classic_downTrg_L1 - lwz r5, 0x20(r29) - clrlwi r0, r30, 16 - li r4, 1 - lwz r3, 4(r5) - and. r0, r3, r0 - bne iplController_Classic_downTrg_L2 - lwz r3, 0x64(r5) - srwi r0, r30, 16 - and. r0, r3, r0 - bne iplController_Classic_downTrg_L2 - li r4, 0 -iplController_Classic_downTrg_L2: - cmpwi r4, 0 - beq iplController_Classic_downTrg_L1 - li r31, 1 -iplController_Classic_downTrg_L1: - addi r11, r1, 0x20 - mr r3, r31 - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} -extern "C" asm void down__Q33ipl10controller7ClassicCFUl() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lwz r12, 0(r3) - mr r29, r3 - mr r30, r4 - li r31, 0 - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Classic_down_L1 - lwz r3, 0x20(r29) - li r4, 1 - lwz r0, 0(r3) - and r0, r0, r30 - clrlwi. r0, r0, 16 - bne iplController_Classic_down_L2 - lwz r3, 0x60(r3) - srwi r0, r30, 16 - and. r0, r3, r0 - bne iplController_Classic_down_L2 - li r4, 0 -iplController_Classic_down_L2: - cmpwi r4, 0 - beq iplController_Classic_down_L1 - li r31, 1 -iplController_Classic_down_L1: - addi r11, r1, 0x20 - mr r3, r31 - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} -extern "C" asm void getHorizon__Q33ipl10controller10RevolutionCFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - lwz r4, 0x20(r3) - stw r0, 0x14(r1) - addi r3, r1, 8 - lfs f1, 0x34(r4) - lfs f2, 0x38(r4) - bl __ct__Q33ipl4math4VEC2Fff - lwz r0, 0x14(r1) - mr r4, r3 - lwz r3, 0(r3) - lwz r4, 4(r4) - mtlr r0 - addi r1, r1, 0x10 - blr -} -extern "C" asm void getDpdPos__Q33ipl10controller10RevolutionCFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - lwz r4, 0x20(r3) - stw r0, 0x14(r1) - addi r3, r1, 8 - lfs f1, 0x20(r4) - lfs f2, 0x24(r4) - bl __ct__Q33ipl4math4VEC2Fff - lwz r0, 0x14(r1) - mr r4, r3 - lwz r3, 0(r3) - lwz r4, 4(r4) - mtlr r0 - addi r1, r1, 0x10 - blr -} -extern "C" asm void upTrg__Q33ipl10controller10RevolutionCFUl() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lwz r12, 0(r3) - mr r29, r3 - mr r30, r4 - li r31, 0 - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Revolution_upTrg_L1 - lwz r3, 0x20(r29) - clrlwi r0, r30, 16 - lwz r3, 8(r3) - and. r0, r3, r0 - beq iplController_Revolution_upTrg_L1 - li r31, 1 -iplController_Revolution_upTrg_L1: - addi r11, r1, 0x20 - mr r3, r31 - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} -extern "C" asm void downTrg__Q33ipl10controller10RevolutionCFUl() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lwz r12, 0(r3) - mr r29, r3 - mr r30, r4 - li r31, 0 - lwz r12, 0x6c(r12) - mtctr r12 - bctrl - cmpwi r3, 0 - beq iplController_Revolution_downTrg_L1 - lwz r3, 0x20(r29) - clrlwi r0, r30, 16 - lwz r3, 4(r3) - and. r0, r3, r0 - beq iplController_Revolution_downTrg_L1 - li r31, 1 -iplController_Revolution_downTrg_L1: - addi r11, r1, 0x20 - mr r3, r31 - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} -extern "C" asm void __dt__Q33ipl10controller7ClassicFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - cmpwi r3, 0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 0x8(r1) - mr r30, r3 - beq classic_dtor_done - li r4, 0 - bl __dt__Q33ipl10controller10RevolutionFv - cmpwi r31, 0 - ble classic_dtor_done - mr r3, r30 - bl __dl__FPv -classic_dtor_done: - mr r3, r30 - lwz r31, 0xc(r1) - lwz r30, 0x8(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - Master::~Master() { + + bool Interface::upTrg(u32 mButton) const { + return 0; } + + int Interface::pinch() const { + return 0; + } + + int Interface::pinchTrg() const { + return 0; + } + + int Interface::pinchOffTrg() const { + return 0; + } + + bool Interface::down(u32 mButton) const { + return 0; + } + + bool Interface::repeat(u32 mButton) const { + return 0; + } + + bool Interface::isValidDpd() const { + return false; + } + + math::VEC2 Interface::getDpdPos() const { + math::VEC2 ret; + f32 zero = *((volatile const f32*)&lbl_81694454); + ret.x = zero; + ret.y = zero; + return ret; + } + + math::VEC2 Interface::getDpdProjectionPos() const { + math::VEC2 ret; + f32 zero = *((volatile const f32*)&lbl_81694454); + ret.x = zero; + ret.y = zero; + return ret; + } + + math::VEC2 Interface::getHorizon() const { + math::VEC2 ret; + f32 zero = *((volatile const f32*)&lbl_81694454); + ret.x = zero; + ret.y = zero; + return ret; + } + + int Interface::getClassicHoldFlag() const { + return 0; + } + + int Interface::getClassicTrigFlag() const { + return 0; + } + + int Interface::getClassicReleaseFlag() const { + return 0; + } + + KPADStatus* Interface::getKPADStatus() const { + return NULL; + } + + PADStatus* Interface::getPADStatus() const { + return NULL; + } + + f32 Interface::getDpdDistance() const { + return *((volatile const f32*)&lbl_81694454); + } + + int Interface::getHoldFlag() const { + return 0; + } + + int Interface::getReleaseFlag() const { + return 0; + } + + int Interface::getTrigFlag() const { + return 0; + } + + void Interface::cancelRumbling() { + } + + int Interface::getChannel() const { + return -1; + } + + int Interface::getType() const { + return -1; + } + + bool Master::down(u32 button) const { + return call(button, (bool (Interface::*)(u32) const)&Interface::down); + } + + bool Master::downTrg(u32 button) const { + return call(button, (bool (Interface::*)(u32) const)&Interface::downTrg); + } + + bool Master::upTrg(u32 button) const { + return call(button, (bool (Interface::*)(u32) const)&Interface::upTrg); + } + + bool Master::repeat(u32 button) const { + return call(button, (bool (Interface::*)(u32) const)&Interface::repeat); + } + + BOOL Interface::rumble(int type) { + return FALSE; + } + + void Interface::read() { + } + + EGG::Allocator* Manager::mpAllocator; + void* Manager::alloc(u32 size) { return mpAllocator->alloc(size); } + + Interface* Manager::getMasterController() { + return (Interface*)((u8*)this + 0xd0); + } + + Interface* Manager::getController(int chan) { + return ((Interface**)this)[chan]; + } + int Manager::free(void* ptr) { mpAllocator->free(ptr); return TRUE; } + extern "C" asm void __ct__Q33ipl10controller7ManagerFPQ23EGG4Heap() { nofralloc stwu r1, -0x20(r1) @@ -1590,6 +1241,7 @@ classic_dtor_done: addi r1, r1, 0x20 blr } + extern "C" asm void read__Q33ipl10controller7ManagerFv() { nofralloc stwu r1, -0x50(r1) @@ -1805,49 +1457,7 @@ classic_dtor_done: addi r1, r1, 0x50 blr } -extern "C" asm void __ct__Q33ipl10controller10RevolutionFiiR10KPADStatus() { - nofralloc - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - addi r11, r1, 0x20 - bl _savegpr_29 - lis r7, __vt__Q33ipl10controller4Base@ha - li r31, 0 - addi r7, r7, __vt__Q33ipl10controller4Base@l - li r0, -1 - stw r7, 0(r3) - mr r29, r3 - mr r30, r6 - stb r31, 4(r3) - stw r31, 8(r3) - stw r31, 0xc(r3) - stw r0, 0x10(r3) - stw r4, 0x14(r3) - stw r5, 0x18(r3) - stb r31, 0x1c(r3) - mr r3, r4 - bl KPADEnableDPD - lis r3, __vt__Q33ipl10controller10Revolution@ha - stb r31, 0x1d(r29) - addi r3, r3, __vt__Q33ipl10controller10Revolution@l - addi r11, r1, 0x20 - stw r3, 0(r29) - mr r3, r29 - stb r31, 0x1e(r29) - stw r30, 0x20(r29) - bl _restgpr_29 - lwz r0, 0x24(r1) - mtlr r0 - addi r1, r1, 0x20 - blr -} - Interface* Manager::getMasterController() { - return (Interface*)((u8*)this + 0xd0); - } - Interface* Manager::getController(int chan) { - return ((Interface**)this)[chan]; - } + Interface* Manager::getYoungController() { Interface* ret = NULL; for (int i = 0; i < 4; i++) { @@ -1859,64 +1469,421 @@ extern "C" asm void __ct__Q33ipl10controller10RevolutionFiiR10KPADStatus() { } return ret; } -extern "C" asm void __dt__Q33ipl10controller4CoreFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - cmpwi r3, 0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 0x8(r1) - mr r30, r3 - beq core_dtor_done - li r4, 0 - bl __dt__Q33ipl10controller10RevolutionFv - cmpwi r31, 0 - ble core_dtor_done - mr r3, r30 - bl __dl__FPv -core_dtor_done: - mr r3, r30 - lwz r31, 0xc(r1) - lwz r30, 0x8(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} -extern "C" asm void __dt__Q33ipl10controller9FreeStyleFv() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - cmpwi r3, 0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 0x8(r1) - mr r30, r3 - beq freestyle_dtor_done - li r4, 0 - bl __dt__Q33ipl10controller10RevolutionFv - cmpwi r31, 0 - ble freestyle_dtor_done - mr r3, r30 - bl __dl__FPv -freestyle_dtor_done: - mr r3, r30 - lwz r31, 0xc(r1) - lwz r30, 0x8(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - } -} -extern const f32 lbl_81694478 = 0.5f; -extern const f32 lbl_8169447C = 0.1f; -extern const f32 lbl_81694480 = 0.2f; -extern const f32 lbl_81694484 = -0.2f; -extern const f32 lbl_81694488 = 0.05f; -extern const f32 lbl_8169448C = 1.0f; + int Base::decide() const { + return unk_0x08 == 5; + } + + int Base::rumble(int type) { + int ret = FALSE; + if (WPADIsMotorEnabled() && mRumbleType == -1) { + mLastRumbleTime = OSGetTick(); + ret = TRUE; + mRumbleType = type; + } + + return ret; + } + + void Base::cancelRumbling() { + if (mRumbleType != -1) { + WPADControlMotor(mChan, 0); + } + mLastRumbleTime = 0; + mRumbleType = -1; + } + + extern "C" asm void read__Q33ipl10controller10RevolutionFv() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r3 + lwz r12, 0(r3) + lwz r12, 0x70(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + bne revolution_read_dpd_done + lfs f1, lbl_81694450 + lwz r3, 0x20(r31) + lfs f0, lbl_81694454 + stfs f1, 0x24(r3) + lwz r3, 0x20(r31) + stfs f1, 0x20(r3) + lwz r3, 0x20(r31) + stfs f0, 0x30(r3) + lwz r3, 0x20(r31) + stfs f0, 0x2c(r3) + lwz r3, 0x20(r31) + stfs f0, 0x28(r3) + revolution_read_dpd_done: + lbz r0, 0x1d(r31) + mr r3, r31 + stb r0, 0x1e(r31) + lwz r12, 0(r31) + lwz r12, 0x6c(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq revolution_read_btn_invalid + lbz r0, 0x1e(r31) + cmpwi r0, 0 + bne revolution_read_btn_was_down + lwz r12, 0(r31) + mr r3, r31 + li r4, 0x800 + lwz r12, 0x14(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq revolution_read_btn_end + lwz r12, 0(r31) + mr r3, r31 + li r4, 0x400 + lwz r12, 0x14(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq revolution_read_btn_end + li r0, 1 + stb r0, 0x1d(r31) + b revolution_read_btn_end + revolution_read_btn_was_down: + lwz r12, 0(r31) + mr r3, r31 + li r4, 0x800 + lwz r12, 0x14(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + beq revolution_read_clear_btn + lwz r12, 0(r31) + mr r3, r31 + li r4, 0x400 + lwz r12, 0x14(r12) + mtctr r12 + bctrl + cmpwi r3, 0 + bne revolution_read_btn_end + revolution_read_clear_btn: + li r0, 0 + stb r0, 0x1d(r31) + b revolution_read_btn_end + revolution_read_btn_invalid: + li r0, 0 + stb r0, 0x1d(r31) + revolution_read_btn_end: + mr r3, r31 + bl read__Q33ipl10controller4BaseFv + lwz r0, 0x14(r1) + lwz r31, 0xc(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + } + + bool Revolution::isValidDpd() const { + if (unk_0x1C != 0) { + return false; + } + + return (unk_0x20->wpad_err == 0 || unk_0x20->wpad_err == -7) && unk_0x20->dpd_valid_fg != 0; + } + + bool Revolution::isValidBtn() const { + u8 val = unk_0x20->wpad_err; + + return (u8)(val + 7) <= 7 && ((1 << (val + 7)) & 0xA1) != 0; + } + + bool Revolution::down(u32 mButton) const { + bool ret = false; + if (isValidBtn()) { + if (unk_0x20->hold & (mButton & 0xFFFF)) { + ret = true; + } + } + + return ret; + } + + int Revolution::pinch() const { + int ret = 0; + if (isValidBtn() && unk_0x1D != 0) { + ret = 1; + } + return ret; + } + + int Revolution::pinchTrg() const { + int ret = 0; + if (isValidBtn() && unk_0x1D != 0 && unk_0x1E == 0) { + ret = 1; + } + return ret; + } + + int Revolution::pinchOffTrg() const { + int ret = 0; + if (isValidBtn() && unk_0x1D == 0 && unk_0x1E != 0) { + ret = 1; + } + return ret; + } + + f32 Revolution::getDpdDistance() const { + return unk_0x20->dist; + } + + KPADStatus* Revolution::getKPADStatus() const { + return unk_0x20; + } + + int Revolution::getReleaseFlag() const { + return unk_0x20->release; + } + + int Revolution::getTrigFlag() const { + return unk_0x20->trig; + } + + int Revolution::getHoldFlag() const { + return unk_0x20->hold; + } + + // non-matching + math::VEC2 Revolution::getDpdProjectionPos() const { + math::VEC2 ret; + Vec2 dest; + Vec2 src = {unk_0x20->pos.x, unk_0x20->pos.y}; + nw4r::ut::Rect nw4r_rect; // constructor shouldn't be inlined + Rect kpad_rect; + + System::getProjectionRect(&nw4r_rect); + + kpad_rect.left = nw4r_rect.left; + kpad_rect.top = nw4r_rect.top; + kpad_rect.right = nw4r_rect.right; + kpad_rect.bottom = nw4r_rect.bottom; + + KPADGetProjectionPos(&dest, &src, &kpad_rect, lbl_81694458); + if (SCGetAspectRatio() == 1) { + dest.x *= lbl_8169445C; + dest.y *= lbl_8169445C; + } + + // regswap + if (nw4r_rect.left - lbl_81694460 > dest.x) { + dest.x = nw4r_rect.left - lbl_81694460; + } else if (nw4r_rect.right + lbl_81694460 < dest.x) { + dest.x = nw4r_rect.right + lbl_81694460; + } else if (nw4r_rect.top - lbl_81694460 > dest.y) { + dest.y = nw4r_rect.top - lbl_81694460; + } else if (nw4r_rect.bottom + lbl_81694460 < dest.y) { + dest.y = nw4r_rect.bottom + lbl_81694460; + } + // // + + ret.set(dest.x, dest.y); // shouldn't be inlined + + return ret; + } + + Classic::Classic(int arg0, KPADStatus& arg1) : Revolution(arg0, arg1) { + unk_0x24.x = lbl_81694464; + unk_0x24.y = lbl_81694464; + unk_0x2C = 0; + } + + Base::~Base() { + } + + Master::~Master() { + } + + Revolution::~Revolution() { + } + + void Classic::read() { + if (!Revolution::isValidDpd()) { + math::VEC2 lstick(unk_0x20->ex_status.cl.lstick.x, unk_0x20->ex_status.cl.lstick.y); + + if (lstick.x * lstick.x + lstick.y * lstick.y > lbl_81694468) { + unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * lbl_8169446C, 1.8f); + unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * lbl_8169446C, 1.2f); + } + + math::VEC2 rstick = math::VEC2(unk_0x20->ex_status.cl.rstick.x, unk_0x20->ex_status.cl.rstick.y); + if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > lbl_81694468 || + rstick.x * rstick.x + rstick.y * rstick.y > lbl_81694468) { + unk_0x2C = 180; + } + + if (--unk_0x2C < 0) { + unk_0x2C = 0; + } + } else { + unk_0x24.y = lbl_81694464; + unk_0x24.x = lbl_81694464; + unk_0x2C = 0; + } + + Revolution::read(); + } + + bool Classic::isValidDpd() const { + if (unk_0x1C != 0) { + return false; + } + + return (Revolution::isValidDpd() != 0) || (unk_0x2C != 0); + } + + BOOL Classic::isValidDpdClassic() const { + return unk_0x2C != 0; + } + + int Classic::getClassicHoldFlag() const { + return unk_0x20->ex_status.cl.hold; + } + + int Classic::getClassicTrigFlag() const { + return unk_0x20->ex_status.cl.trig; + } + + int Classic::getClassicReleaseFlag() const { + return unk_0x20->ex_status.cl.release; + } + + math::VEC2 Classic::getHorizon() const { + math::VEC2 ret; + if (Revolution::isValidDpd()) { + ret.set(unk_0x20->horizon.x, unk_0x20->horizon.y); + } else { + ret.x = 1.0f; + ret.y = lbl_81694474; + } + return ret; + } + + math::VEC2 Classic::getDpdPos() const { + math::VEC2 ret; + if (Revolution::isValidDpd()) { + ret.set(unk_0x20->pos.x, unk_0x20->pos.y); + } else if (unk_0x2C != 0) { + ret = unk_0x24; + } else { + ret.x = lbl_81694450; + ret.y = lbl_81694450; + } + return ret; + } + + extern "C" asm void getDpdProjectionPos__Q33ipl10controller7ClassicCFv() { + nofralloc + stwu r1, -0x50(r1) + mflr r0 + stw r0, 0x54(r1) + stw r31, 0x4c(r1) + mr r31, r3 + bl isValidDpd__Q33ipl10controller10RevolutionCFv + cmpwi r3, 0 + beq classic_projection_check_stick + lwz r4, 0x20(r31) + addi r3, r1, 0x18 + lfs f1, 0x20(r4) + lfs f2, 0x24(r4) + bl set__Q33ipl4math4VEC2Fff + b classic_projection_have_src + classic_projection_check_stick: + lwz r0, 0x2c(r31) + cmpwi r0, 0 + beq classic_projection_invalid + addi r3, r1, 0x18 + addi r4, r31, 0x24 + bl __as__Q33ipl4math4VEC2FRCQ33ipl4math4VEC2 + b classic_projection_have_src + classic_projection_invalid: + lfs f0, lbl_81694450 + stfs f0, 0x18(r1) + stfs f0, 0x1c(r1) + classic_projection_have_src: + lfs f1, 0x18(r1) + addi r3, r1, 0x30 + lfs f0, 0x1c(r1) + stfs f1, 0x8(r1) + stfs f0, 0xc(r1) + bl __ct__Q34nw4r2ut4RectFv + addi r3, r1, 0x30 + bl getProjectionRect__Q23ipl6SystemFPQ34nw4r2ut4Rect + lfs f1, 0x30(r1) + addi r3, r1, 0x10 + lfs f3, 0x34(r1) + addi r4, r1, 0x8 + lfs f2, 0x38(r1) + addi r5, r1, 0x20 + lfs f0, 0x3c(r1) + stfs f1, 0x20(r1) + lfs f1, lbl_81694458 + stfs f3, 0x24(r1) + stfs f2, 0x28(r1) + stfs f0, 0x2c(r1) + bl KPADGetProjectionPos + bl SCGetAspectRatio + clrlwi r0, r3, 24 + cmplwi r0, 1 + bne classic_projection_no_aspect + lfs f1, 0x10(r1) + lfs f2, lbl_8169445C + lfs f0, 0x14(r1) + fmuls f1, f1, f2 + fmuls f0, f0, f2 + stfs f1, 0x10(r1) + stfs f0, 0x14(r1) + classic_projection_no_aspect: + lfs f0, 0x30(r1) + lfs f2, lbl_81694460 + lfs f1, 0x10(r1) + fsubs f0, f0, f2 + fcmpo cr0, f0, f1 + ble classic_projection_right + stfs f0, 0x10(r1) + b classic_projection_done + classic_projection_right: + lfs f0, 0x38(r1) + fadds f0, f2, f0 + fcmpo cr0, f0, f1 + bge classic_projection_top + stfs f0, 0x10(r1) + b classic_projection_done + classic_projection_top: + lfs f0, 0x34(r1) + lfs f1, 0x14(r1) + fsubs f0, f0, f2 + fcmpo cr0, f0, f1 + ble classic_projection_bottom + stfs f0, 0x14(r1) + b classic_projection_done + classic_projection_bottom: + lfs f0, 0x3c(r1) + fadds f0, f2, f0 + fcmpo cr0, f0, f1 + bge classic_projection_done + stfs f0, 0x14(r1) + classic_projection_done: + lfs f1, 0x10(r1) + addi r3, r1, 0x18 + lfs f2, 0x14(r1) + bl set__Q33ipl4math4VEC2Fff + lwz r31, 0x4c(r1) + lwz r0, 0x54(r1) + lwz r3, 0x18(r1) + lwz r4, 0x1c(r1) + mtlr r0 + addi r1, r1, 0x50 + blr + } + } // namespace controller +} // namespace ipl diff --git a/src/system/iplSaveDataManager.cpp b/src/system/iplSaveDataManager.cpp index 33475cec..53cba973 100644 --- a/src/system/iplSaveDataManager.cpp +++ b/src/system/iplSaveDataManager.cpp @@ -795,6 +795,172 @@ namespace ipl { blr } + asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) { + nofralloc + stwu r1, -0x40(r1) + mflr r0 + stw r0, 0x44(r1) + addi r11, r1, 0x40 + bl _savegpr_20 + mr r27, r3 + mr r28, r4 + li r3, 0 + li r30, 0 + li r26, 0 + li r25, 0 + li r20, 3 + li r21, 0 + li r22, 0xe + li r23, -1 + doUpdateChanInfos_L1: + add r31, r27, r26 + li r29, 0 + li r24, 0 + doUpdateChanInfos_L2: + add r4, r31, r24 + lbz r0, 0x30(r4) + cmplwi r0, 1 + beq doUpdateChanInfos_L5 + add r0, r29, r25 + lwz r9, 0x38(r4) + slwi r0, r0, 3 + lwz r5, 0x3c(r4) + add r8, r28, r0 + lwzx r6, r28, r0 + lwz r7, 4(r8) + xor r0, r9, r6 + xor r5, r5, r7 + or. r0, r5, r0 + beq doUpdateChanInfos_L5 + or. r0, r7, r6 + bne doUpdateChanInfos_L4 + addi r3, r4, 0x30 + li r4, 0 + li r5, 0x10 + bl memset + b doUpdateChanInfos_L6 + doUpdateChanInfos_L4: + stb r20, 0x30(r4) + stb r21, 0x31(r4) + stb r21, 0x32(r4) + stb r21, 0x33(r4) + stw r22, 0x34(r4) + lwz r0, 0(r8) + and r0, r0, r23 + stw r0, 0x38(r4) + lwz r0, 4(r8) + and r0, r0, r23 + stw r0, 0x3c(r4) + doUpdateChanInfos_L6: + li r3, 1 + doUpdateChanInfos_L5: + addi r29, r29, 1 + addi r24, r24, 0x10 + cmpwi r29, 0xc + blt doUpdateChanInfos_L2 + addi r30, r30, 1 + addi r25, r25, 0xc + cmpwi r30, 4 + addi r26, r26, 0xc0 + blt doUpdateChanInfos_L1 + addi r11, r1, 0x40 + bl _restgpr_20 + lwz r0, 0x44(r1) + mtlr r0 + addi r1, r1, 0x40 + blr + } + + asm void Manager::iplSavedata_813596B8(register ESTitleId titleId) { + nofralloc + lis r7, 0x4841 + lis r4, 1 + addi r0, r7, 0x5445 + addi r8, r4, 1 + xor r4, r6, r0 + xor r0, r5, r8 + or. r0, r4, r0 + beqlr + addi r4, r7, 0x4445 + xor r0, r5, r8 + xor r4, r6, r4 + or. r0, r4, r0 + bne iplSavedata_813596B8_L1 + blr + iplSavedata_813596B8_L1: + addis r0, r5, -1 + cmplwi r0, 1 + beq iplSavedata_813596B8_L2 + cmplwi r0, 3 + beq iplSavedata_813596B8_L2 + cmplwi r0, 4 + beq iplSavedata_813596B8_L2 + cmplwi r0, 6 + bnelr + iplSavedata_813596B8_L2: + li r0, 0x30 + li r9, 0 + li r4, 0 + mtctr r0 + iplSavedata_813596B8_L3: + add r7, r3, r4 + lwz r0, 0x340(r7) + lwz r7, 0x344(r7) + xor r0, r5, r0 + xor r7, r6, r7 + or. r0, r7, r0 + beq iplSavedata_813596B8_L4 + addi r9, r9, 1 + addi r4, r4, 8 + bdnz iplSavedata_813596B8_L3 + iplSavedata_813596B8_L4: + cmpwi r9, 0x30 + bne iplSavedata_813596B8_L5 + li r9, 0x2f + iplSavedata_813596B8_L5: + slwi r4, r9, 3 + mtctr r9 + cmpwi r9, 0 + ble iplSavedata_813596B8_L6 + iplSavedata_813596B8_L7: + addi r0, r9, -1 + add r7, r3, r4 + slwi r0, r0, 3 + addi r9, r9, -1 + add r8, r3, r0 + addi r4, r4, -8 + lwz r0, 0x340(r8) + lwz r8, 0x344(r8) + stw r8, 0x344(r7) + stw r0, 0x340(r7) + bdnz iplSavedata_813596B8_L7 + iplSavedata_813596B8_L6: + stw r6, 0x344(r3) + stw r5, 0x340(r3) + blr + } + + extern "C" asm BOOL iplSavedata_813597A0(register void* manager, register ESTitleId titleId) { + nofralloc + li r0, 0x30 + li r4, 0 + mtctr r0 + iplSavedata_813597A0_L1: + add r7, r3, r4 + lwz r0, 0x340(r7) + lwz r7, 0x344(r7) + xor r0, r5, r0 + xor r7, r6, r7 + or. r0, r7, r0 + bne iplSavedata_813597A0_L2 + li r3, 1 + blr + iplSavedata_813597A0_L2: + addi r4, r4, 8 + bdnz iplSavedata_813597A0_L1 + li r3, 0 + blr + } asm void Manager::makeTmpList(register ESTitleId* titleIdsOut, register u32 availableCount, register ESTitleId* titleIdsIn, register u32 titleCount) { nofralloc @@ -950,82 +1116,6 @@ namespace ipl { addi r1, r1, 0x20 blr } - - asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) { - nofralloc - stwu r1, -0x40(r1) - mflr r0 - stw r0, 0x44(r1) - addi r11, r1, 0x40 - bl _savegpr_20 - mr r27, r3 - mr r28, r4 - li r3, 0 - li r30, 0 - li r26, 0 - li r25, 0 - li r20, 3 - li r21, 0 - li r22, 0xe - li r23, -1 - doUpdateChanInfos_L1: - add r31, r27, r26 - li r29, 0 - li r24, 0 - doUpdateChanInfos_L2: - add r4, r31, r24 - lbz r0, 0x30(r4) - cmplwi r0, 1 - beq doUpdateChanInfos_L5 - add r0, r29, r25 - lwz r9, 0x38(r4) - slwi r0, r0, 3 - lwz r5, 0x3c(r4) - add r8, r28, r0 - lwzx r6, r28, r0 - lwz r7, 4(r8) - xor r0, r9, r6 - xor r5, r5, r7 - or. r0, r5, r0 - beq doUpdateChanInfos_L5 - or. r0, r7, r6 - bne doUpdateChanInfos_L4 - addi r3, r4, 0x30 - li r4, 0 - li r5, 0x10 - bl memset - b doUpdateChanInfos_L6 - doUpdateChanInfos_L4: - stb r20, 0x30(r4) - stb r21, 0x31(r4) - stb r21, 0x32(r4) - stb r21, 0x33(r4) - stw r22, 0x34(r4) - lwz r0, 0(r8) - and r0, r0, r23 - stw r0, 0x38(r4) - lwz r0, 4(r8) - and r0, r0, r23 - stw r0, 0x3c(r4) - doUpdateChanInfos_L6: - li r3, 1 - doUpdateChanInfos_L5: - addi r29, r29, 1 - addi r24, r24, 0x10 - cmpwi r29, 0xc - blt doUpdateChanInfos_L2 - addi r30, r30, 1 - addi r25, r25, 0xc - cmpwi r30, 4 - addi r26, r26, 0xc0 - blt doUpdateChanInfos_L1 - addi r11, r1, 0x40 - bl _restgpr_20 - lwz r0, 0x44(r1) - mtlr r0 - addi r1, r1, 0x40 - blr - } #endif BOOL Manager::checkValidApp(ESTitleId titleId) { @@ -1199,97 +1289,6 @@ namespace ipl { mData.prevSDPage = 0; } - asm void Manager::iplSavedata_813596B8(register ESTitleId titleId) { - nofralloc - lis r7, 0x4841 - lis r4, 1 - addi r0, r7, 0x5445 - addi r8, r4, 1 - xor r4, r6, r0 - xor r0, r5, r8 - or. r0, r4, r0 - beqlr - addi r4, r7, 0x4445 - xor r0, r5, r8 - xor r4, r6, r4 - or. r0, r4, r0 - bne iplSavedata_813596B8_L1 - blr - iplSavedata_813596B8_L1: - addis r0, r5, -1 - cmplwi r0, 1 - beq iplSavedata_813596B8_L2 - cmplwi r0, 3 - beq iplSavedata_813596B8_L2 - cmplwi r0, 4 - beq iplSavedata_813596B8_L2 - cmplwi r0, 6 - bnelr - iplSavedata_813596B8_L2: - li r0, 0x30 - li r9, 0 - li r4, 0 - mtctr r0 - iplSavedata_813596B8_L3: - add r7, r3, r4 - lwz r0, 0x340(r7) - lwz r7, 0x344(r7) - xor r0, r5, r0 - xor r7, r6, r7 - or. r0, r7, r0 - beq iplSavedata_813596B8_L4 - addi r9, r9, 1 - addi r4, r4, 8 - bdnz iplSavedata_813596B8_L3 - iplSavedata_813596B8_L4: - cmpwi r9, 0x30 - bne iplSavedata_813596B8_L5 - li r9, 0x2f - iplSavedata_813596B8_L5: - slwi r4, r9, 3 - mtctr r9 - cmpwi r9, 0 - ble iplSavedata_813596B8_L6 - iplSavedata_813596B8_L7: - addi r0, r9, -1 - add r7, r3, r4 - slwi r0, r0, 3 - addi r9, r9, -1 - add r8, r3, r0 - addi r4, r4, -8 - lwz r0, 0x340(r8) - lwz r8, 0x344(r8) - stw r8, 0x344(r7) - stw r0, 0x340(r7) - bdnz iplSavedata_813596B8_L7 - iplSavedata_813596B8_L6: - stw r6, 0x344(r3) - stw r5, 0x340(r3) - blr - } - - extern "C" asm BOOL iplSavedata_813597A0(register void* manager, register ESTitleId titleId) { - nofralloc - li r0, 0x30 - li r4, 0 - mtctr r0 - iplSavedata_813597A0_L1: - add r7, r3, r4 - lwz r0, 0x340(r7) - lwz r7, 0x344(r7) - xor r0, r5, r0 - xor r7, r6, r7 - or. r0, r7, r0 - bne iplSavedata_813597A0_L2 - li r3, 1 - blr - iplSavedata_813597A0_L2: - addi r4, r4, 8 - bdnz iplSavedata_813597A0_L1 - li r3, 0 - blr - } - BOOL Manager::nand_error_handling(int code) { BOOL result = FALSE;