diff --git a/config/43U/config.yml b/config/43U/config.yml index 4a2c10af..8b30cbc8 100644 --- a/config/43U/config.yml +++ b/config/43U/config.yml @@ -10,6 +10,17 @@ splits: 'config/43U/splits.txt' ldscript_template: 'config/ldscript_ipl2.lcf' +force_active: + - labs + - itoa + - strpbrk + - strspn + - strcspn + - atol + - padding__Q23ipl5scene + - lbl_81695063 + - lbl_81695067 + quick_analysis: true fill_gaps: false diff --git a/config/ldscript_ipl2.lcf b/config/ldscript_ipl2.lcf index 7e39b783..27bf1dcc 100644 --- a/config/ldscript_ipl2.lcf +++ b/config/ldscript_ipl2.lcf @@ -36,3 +36,7 @@ SECTIONS { __ArenaLo = (_db_stack_addr + 0x1F) & ~0x1F; __ArenaHi = $ARENAHI; } + +FORCEACTIVE { + $FORCEACTIVE +} diff --git a/configure.py b/configure.py index 19414553..3e2b8b81 100644 --- a/configure.py +++ b/configure.py @@ -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"), @@ -1946,13 +1946,13 @@ config.libs = [ Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c"), Object(Matching, "MSL_Common/ctype.c"), Object(NonMatching, "MSL_Common/locale.c"), - Object(Matching, "MSL_Common/arith.c"), - Object(Matching, "MSL_Common/bsearch.c"), - Object(Matching, "MSL_Common/buffer_io.c"), + Object(Matching, "MSL_Common/arith.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/bsearch.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/buffer_io.c", extra_cflags=["-Cpp_exceptions on"]), Object(Matching, "MSL_Common/direct_io.c", extra_cflags=["-Cpp_exceptions on"]), Object(NonMatching, "MSL_Common/file_io.c"), - Object(Matching, "MSL_Common/FILE_POS.c"), - Object(Matching, "MSL_Common/mbstring.c"), + Object(Matching, "MSL_Common/FILE_POS.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/mbstring.c", extra_cflags=["-Cpp_exceptions on"]), Object(Matching, "MSL_Common/mem.c"), Object(Matching, "MSL_Common/mem_funcs.c"), Object(Matching, "MSL_Common/math_api.c"), diff --git a/include/bannerSound/AudioWaveUtility.h b/include/bannerSound/AudioWaveUtility.h index e492efc8..e3d731be 100644 --- a/include/bannerSound/AudioWaveUtility.h +++ b/include/bannerSound/AudioWaveUtility.h @@ -30,9 +30,9 @@ private: class WaveFileAiff : public WaveFile { public: WaveFileAiff(); - virtual ~WaveFileAiff() {} virtual u32 getBit() const override; + virtual ~WaveFileAiff(); virtual int getChannels() const override { return mNumChans; } virtual f64 getSamplingRate() const override { return mSamplingRate; } virtual s32 getFrames() const override; @@ -67,9 +67,9 @@ private: class WaveFileWav : public WaveFile { public: WaveFileWav(); - virtual ~WaveFileWav() {} virtual u32 getBit() const override; + virtual ~WaveFileWav(); virtual int getChannels() const override { return mNumChans; } virtual f64 getSamplingRate() const override { return mSamplingRate; } virtual s32 getFrames() const override; diff --git a/include/layout/GUIManager.h b/include/layout/GUIManager.h index 8d163534..2569806c 100644 --- a/include/layout/GUIManager.h +++ b/include/layout/GUIManager.h @@ -37,7 +37,11 @@ namespace gui { #endif }; +#ifdef IPL_CHANNEL_TITLE_NOVTABLE class __declspec(novtable) EventHandler { +#else + class EventHandler { +#endif public: enum { ON_TRIG = 0, diff --git a/include/math/iplInterporation.h b/include/math/iplInterporation.h index 1943578a..2e3d7471 100644 --- a/include/math/iplInterporation.h +++ b/include/math/iplInterporation.h @@ -44,6 +44,7 @@ namespace ipl { T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); } }; +#ifdef IPL_CHANNEL_TITLE_NOVTABLE template class __declspec(novtable) HermiteIntp : public utility::FrameController { public: @@ -130,6 +131,58 @@ namespace ipl { }; #pragma dont_instantiate HermiteIntp +#else + template + class HermiteIntp : public Interporation { + public: + HermiteIntp() {} + + void init(const T& start, const T& 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; + } + + T get() const { + f32 var_f27 = mFrame; + f32 var_f28 = 1.0f / mMaxFrame; + f32 t1t2 = + (var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))); + + T r = (mStart * (1.0f + t1t2)) - (mEnd * t1t2); + + f32 temp_f4 = var_f27 * var_f27; + f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4)); + f32 temp_f3 = + (unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4))); + + r = r + temp_f3; + + return r; + + /*f32 var_f27 = mMaxFrame; + f32 var_f28 = 1.0f / mMaxFrame; + T sp28 = 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)))); + T sp1C = 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))))); + T r = sp1C - sp28; + + f32 temp_f4 = var_f27 * var_f27; + f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4)); + f32 temp_f3 = + (unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4))); + r = r + temp_f3; + return r;*/ + } + + protected: + f32 unkVal0; + f32 unkVal1; + }; +#endif } // namespace math } // namespace ipl diff --git a/include/scene/calendar/iplDate.h b/include/scene/calendar/iplDate.h index c694479c..2adaeaa3 100644 --- a/include/scene/calendar/iplDate.h +++ b/include/scene/calendar/iplDate.h @@ -7,12 +7,6 @@ namespace ipl { namespace scene { - class MaxDate : public utility::Date { - public: - u8 padding[0x10]; - MaxDate(int year, int month, int day) : utility::Date(year, month, day) {} - }; - class Date : ::gui::EventHandler { public: typedef struct AnmFrame { @@ -88,7 +82,7 @@ namespace ipl { static const char* mscAnimPanes[ANIM_PANE_MAX]; static utility::Date mscMinDate; - static MaxDate mscMaxDate; + static utility::Date mscMaxDate; nw4r::ut::Link mNode1; // 0x40 nw4r::ut::Link mNode2; // 0x48 diff --git a/include/system/iplCdbManager.h b/include/system/iplCdbManager.h index 66e62ba5..4120d09a 100644 --- a/include/system/iplCdbManager.h +++ b/include/system/iplCdbManager.h @@ -25,7 +25,7 @@ namespace ipl { void closeDatabase(); BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode, - const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, u16 noReplyFlag, + const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, RBRAttachmentType* attachType); diff --git a/libs/EGG/include/egg/core/eggAudioHeapMgr.h b/libs/EGG/include/egg/core/eggAudioHeapMgr.h index a8a37541..1602326d 100644 --- a/libs/EGG/include/egg/core/eggAudioHeapMgr.h +++ b/libs/EGG/include/egg/core/eggAudioHeapMgr.h @@ -15,7 +15,7 @@ namespace EGG { class SoundHeapMgr { public: - SoundHeapMgr() NO_INLINE {} + SoundHeapMgr(); ~SoundHeapMgr() { destroySoundHeap(); } diff --git a/libs/EGG/include/egg/core/eggAudioMgr.h b/libs/EGG/include/egg/core/eggAudioMgr.h index 43909119..62bc570b 100644 --- a/libs/EGG/include/egg/core/eggAudioMgr.h +++ b/libs/EGG/include/egg/core/eggAudioMgr.h @@ -17,14 +17,7 @@ namespace EGG { s32 soundThreadPrio; // 0x08 s32 dvdThreadPrio; // 0x0C - Arg() NO_INLINE { - pHeap = NULL; - - soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY; - dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY; - - unk_0x04 = 0; - } + Arg(); }; public: diff --git a/libs/EGG/src/core/eggAudioMgr.cpp b/libs/EGG/src/core/eggAudioMgr.cpp index 6b84bd1f..9fb54bce 100644 --- a/libs/EGG/src/core/eggAudioMgr.cpp +++ b/libs/EGG/src/core/eggAudioMgr.cpp @@ -7,6 +7,15 @@ #include namespace EGG { + IAudioMgr::Arg::Arg() { + pHeap = NULL; + + soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY; + dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY; + + unk_0x04 = 0; + } + SimpleAudioMgr::SimpleAudioMgrArg::SimpleAudioMgrArg() { soundHeapSize = DEFAULT_SOUND_HEAP_SIZE; } @@ -14,6 +23,8 @@ namespace EGG { SimpleAudioMgr::SimpleAudioMgr() : ArcPlayer(&getSoundHeap()) { } + SoundHeapMgr::SoundHeapMgr() {} + SimpleAudioMgr::~SimpleAudioMgr() { } diff --git a/src/bannerSound/AudioWavePlayer.cpp b/src/bannerSound/AudioWavePlayer.cpp index c80b9b5a..9407bd56 100644 --- a/src/bannerSound/AudioWavePlayer.cpp +++ b/src/bannerSound/AudioWavePlayer.cpp @@ -80,6 +80,10 @@ SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_P mThreadRunning = false; } +WaveFileAiff::~WaveFileAiff() {} + +WaveFileWav::~WaveFileWav() {} + SimpleWavePlayer::~SimpleWavePlayer() { } diff --git a/src/channelScript/systemmenu/iplCSMtx.cpp b/src/channelScript/systemmenu/iplCSMtx.cpp index e4d288a4..de34bc58 100644 --- a/src/channelScript/systemmenu/iplCSMtx.cpp +++ b/src/channelScript/systemmenu/iplCSMtx.cpp @@ -8,8 +8,6 @@ namespace ipl { // used but pooled first DECOMP_FORCE_ACTIVE(iplCSMtx_cpp, "MTX34"); - static const char mtx34_name[] = "MTX34"; - #define PROPERTY_COUNT 13 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; @@ -153,7 +151,7 @@ namespace ipl { BOOL init(CHANSVm* vm) { BOOL result = FALSE; // Create class - CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, mtx34_name, ctor, NULL); + CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, "MTX34", ctor, NULL); if (cls != NULL) { // Add properties result = CHANSVmAddNativePropertyAccessorsList(vm, cls, cPropertyList, PROPERTY_COUNT) == CHANS_VM_OK; diff --git a/src/keyboard/tiGUIManager.cpp b/src/keyboard/tiGUIManager.cpp index 4d1c0f0b..326e11b0 100644 --- a/src/keyboard/tiGUIManager.cpp +++ b/src/keyboard/tiGUIManager.cpp @@ -8,6 +8,7 @@ namespace textinput { namespace gui { extern "C" void drawLine___Q29textinput3guiFfffffUcR8_GXColor(); + extern "C" const f32 lbl_81694EE8; void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) { GXClearVtxDesc(); @@ -30,7 +31,7 @@ namespace textinput { GXSetBlendMode(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_NOOP); Mtx mtx; - MTXTrans(mtx, 0.0f, 0.0f, 0.0f); + MTXTrans(mtx, lbl_81694EE8, lbl_81694EE8, lbl_81694EE8); GXLoadPosMtxImm(mtx, 0); GXSetLineWidth(width, GX_TO_ZERO); @@ -46,16 +47,6 @@ namespace textinput { GXEnd(); } - #pragma push - #pragma section sconst_type ".sdata2" - extern "C" const f32 lbl_81694EE8 = 0.0f; - extern "C" const u8 lbl_81694EEC = 0xFF; - extern "C" const u8 lbl_81694EED = 0x00; - extern "C" const u8 lbl_81694EEE = 0x00; - extern "C" const u8 lbl_81694EEF = 0xFF; - extern "C" const f32 lbl_81694EF0 = 0.5f; - #pragma pop - u32 GUIComponent::updatePointerImpl(const GUIPointer& pointer) { int point = pointer.getCtrlNo(); u32 event = EVENT_NONE; @@ -250,6 +241,8 @@ namespace textinput { } } + PaneComponent::~PaneComponent() {} + void PaneManager::createLayoutScene(const nw4r::lyt::Layout& layout) { mIDCounter = 0; walkInChildren(layout.GetRootPane()->GetChildList()); @@ -315,8 +308,6 @@ namespace textinput { return NULL; } - PaneComponent::~PaneComponent() {} - void PaneManager::setAllBoundingBoxComponentTriggerTarget(bool bEnable) { const volatile u16& numObjects = mPaneComponents.numObjects; for (u32 i = 0; i < numObjects; i++) { @@ -343,7 +334,7 @@ namespace textinput { MTXInverse(mpPane->GetGlobalMtx(), globalMtx); nw4r::math::VEC3 pos; - MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, 0), pos); + MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, lbl_81694EE8), pos); nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo); @@ -355,6 +346,16 @@ namespace textinput { } } + #pragma push + #pragma section sconst_type ".sdata2" + extern "C" const f32 lbl_81694EE8 = 0.0f; + extern "C" const u8 lbl_81694EEC = 0xFF; + extern "C" const u8 lbl_81694EED = 0x00; + extern "C" const u8 lbl_81694EEE = 0x00; + extern "C" const u8 lbl_81694EEF = 0xFF; + extern "C" const f32 lbl_81694EF0 = 0.5f; + #pragma pop + extern "C" asm void draw__Q39textinput3gui13PaneComponentFv() { nofralloc stwu r1, -0x40(r1) diff --git a/src/scene/calendar/iplCalendar.cpp b/src/scene/calendar/iplCalendar.cpp index 27b48278..ae8e1363 100644 --- a/src/scene/calendar/iplCalendar.cpp +++ b/src/scene/calendar/iplCalendar.cpp @@ -880,12 +880,6 @@ namespace ipl { BOOL Calendar::is_lower_limit() { 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; return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month; } } // namespace scene diff --git a/src/scene/calendar/iplDate.cpp b/src/scene/calendar/iplDate.cpp index d23c2107..974aa4ec 100644 --- a/src/scene/calendar/iplDate.cpp +++ b/src/scene/calendar/iplDate.cpp @@ -60,9 +60,11 @@ namespace ipl { // clang-format on utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY); - MaxDate Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); + utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); - DECOMP_FORCE_ACTIVE(iplDate_cpp, &Date::mscMaxDate); + u8 padding[0x10]; + + DECOMP_FORCE_ACTIVE(iplDate_cpp, padding); Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName) : ::gui::EventHandler(), mbAppearMsg(0), unk_0x10(0), unk_0x14(0), mpLayout(NULL), mpCurrentPaneAnim(0), unk_0x3C(0) { diff --git a/src/system/TVRC.cpp b/src/system/TVRC.cpp index ebbe9b4c..8b963c23 100644 --- a/src/system/TVRC.cpp +++ b/src/system/TVRC.cpp @@ -119,175 +119,11 @@ namespace LibTVRC { void __FTVRCLoop0Handler(OSAlarm *alarm, OSContext *ctx); - void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx) { - if (_ctCombo != 0 && _isActive != 0) { - if (_func1state == -1) { - _unitStartTime = OSGetTime(); - _func1state = 0; - } - - if (_isLastOnOff != 0) { - _unitLastTime = OSGetTime(); - - if (_func1state == 0) { - WPADSetSensorBarPower(TRUE); - _func1state = 1; - OSSetAlarm(&_alarm, _tickWait[1], __FTVRCLoop1Handler); - return; - } - - BOOL active = (int)(_unitLastTime - _unitStartTime) < (int)(*(u32*)&_tickT * _ctCombo); - WPADSetSensorBarPower(FALSE); - _func1state = 0; - if (active) { - OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop1Handler); - } else { - OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop0Handler); - } - } else { - WPADSetSensorBarPower(FALSE); - OSSetAlarm(&_alarm, *(u32*)&_tickT * _ctCombo, __FTVRCLoop0Handler); - } - } - } + void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx); } // namespace LibTVRC using namespace LibTVRC; -extern "C" asm void __FTVRCLoop0Handler__7LibTVRCFP7OSAlarmP9OSContext() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 0x8(r1) - mr r30, r3 - lwz r0, _isActive__7LibTVRC - cmpwi r0, 0 - bne TVRCLoop0_active - li r0, 2 - stw r0, _func0state__7LibTVRC -TVRCLoop0_active: - lwz r0, _func0state__7LibTVRC - cmpwi r0, 1 - bne TVRCLoop0_check_state - li r0, 0 - stw r0, _func0state__7LibTVRC - b TVRCLoop0_prepare -TVRCLoop0_check_state: - cmpwi r0, 0 - bne TVRCLoop0_check_stop - lwz r4, _loop0count__7LibTVRC - li r0, 0 - lwz r3, _isOnOff__7LibTVRC - addi r4, r4, 1 - stw r0, _func0state__7LibTVRC - stw r4, _loop0count__7LibTVRC - stw r3, _isLastOnOff__7LibTVRC - b TVRCLoop0_prepare -TVRCLoop0_check_stop: - cmpwi r0, 2 - bne TVRCLoop0_prepare - lwz r0, _isReserveDeactive__7LibTVRC - cmpwi r0, 0 - bne TVRCLoop0_stop - bl OSGetTime - lis r5, 0x8000 - lwz r6, _totalStartTime__7LibTVRC+4 - lwz r5, 0xf8(r5) - li r0, 0x3e8 - subfc r4, r6, r4 - lwz r7, _totalStartTime__7LibTVRC - srwi r6, r5, 2 - li r5, 0 - divwu r6, r6, r0 - subfe r3, r7, r3 - bl __div2i - lwz r7, _limitMilli__7LibTVRC - li r6, 0 - xoris r5, r3, 0x8000 - xoris r0, r6, 0x8000 - subfc r3, r4, r7 - subfe r5, r5, r0 - subfe r5, r0, r0 - neg. r5, r5 - beq TVRCLoop0_continue -TVRCLoop0_stop: - li r3, 1 - bl WPADSetSensorBarPower - li r0, 0 - stw r0, _isActive__7LibTVRC - b TVRCLoop0_exit -TVRCLoop0_continue: - lwz r4, _isUseRepeatCode__7LibTVRC - lwz r3, _repeatBitLength__7LibTVRC - lwz r0, _repeatBitArray__7LibTVRC - stw r4, _isRepeatActive__7LibTVRC - stw r3, _bitLength__7LibTVRC - stw r0, _bitArray__7LibTVRC - stw r6, _isOnOff__7LibTVRC - stw r6, _isLastOnOff__7LibTVRC - stw r6, _func0state__7LibTVRC - stw r6, _loop0count__7LibTVRC -TVRCLoop0_prepare: - li r3, 0 - lwz r7, _bitArray__7LibTVRC - stw r3, _ctCombo__7LibTVRC - lwz r8, _bitLength__7LibTVRC - lwz r4, _loop0count__7LibTVRC - lwz r0, _isLastOnOff__7LibTVRC - b TVRCLoop0_check_bits -TVRCLoop0_bit_loop: - srawi r5, r4, 3 - addi r3, r3, 1 - addze r6, r5 - srawi r5, r4, 3 - lbzx r6, r7, r6 - addze r5, r5 - slwi r5, r5, 3 - stw r3, _ctCombo__7LibTVRC - subf r5, r5, r4 - subfic r5, r5, 7 - sraw r5, r6, r5 - clrlwi r5, r5, 31 - cmpw r0, r5 - stw r5, _isOnOff__7LibTVRC - beq TVRCLoop0_bit_match - li r3, -1 - li r0, 0 - stw r3, _func1state__7LibTVRC - mr r3, r30 - mr r4, r31 - stw r0, _func0state__7LibTVRC - bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext - b TVRCLoop0_exit -TVRCLoop0_bit_match: - addi r4, r4, 1 - stw r5, _isLastOnOff__7LibTVRC - mr r0, r5 - stw r4, _loop0count__7LibTVRC -TVRCLoop0_check_bits: - cmpw r4, r8 - blt TVRCLoop0_bit_loop - addi r3, r3, 1 - li r5, -1 - li r0, 2 - stw r3, _ctCombo__7LibTVRC - mr r3, r30 - mr r4, r31 - stw r5, _func1state__7LibTVRC - stw r0, _func0state__7LibTVRC - bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext -TVRCLoop0_exit: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 0x8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - BOOL TVRCInit(void* pRsrc) { if (_isInitialized) { _lastError = 0; @@ -596,3 +432,171 @@ TVRCSendStartAsync_exit: addi r1, r1, 0x40 blr } + +extern "C" asm void __FTVRCLoop0Handler__7LibTVRCFP7OSAlarmP9OSContext() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r4 + stw r30, 0x8(r1) + mr r30, r3 + lwz r0, _isActive__7LibTVRC + cmpwi r0, 0 + bne TVRCLoop0_active + li r0, 2 + stw r0, _func0state__7LibTVRC +TVRCLoop0_active: + lwz r0, _func0state__7LibTVRC + cmpwi r0, 1 + bne TVRCLoop0_check_state + li r0, 0 + stw r0, _func0state__7LibTVRC + b TVRCLoop0_prepare +TVRCLoop0_check_state: + cmpwi r0, 0 + bne TVRCLoop0_check_stop + lwz r4, _loop0count__7LibTVRC + li r0, 0 + lwz r3, _isOnOff__7LibTVRC + addi r4, r4, 1 + stw r0, _func0state__7LibTVRC + stw r4, _loop0count__7LibTVRC + stw r3, _isLastOnOff__7LibTVRC + b TVRCLoop0_prepare +TVRCLoop0_check_stop: + cmpwi r0, 2 + bne TVRCLoop0_prepare + lwz r0, _isReserveDeactive__7LibTVRC + cmpwi r0, 0 + bne TVRCLoop0_stop + bl OSGetTime + lis r5, 0x8000 + lwz r6, _totalStartTime__7LibTVRC+4 + lwz r5, 0xf8(r5) + li r0, 0x3e8 + subfc r4, r6, r4 + lwz r7, _totalStartTime__7LibTVRC + srwi r6, r5, 2 + li r5, 0 + divwu r6, r6, r0 + subfe r3, r7, r3 + bl __div2i + lwz r7, _limitMilli__7LibTVRC + li r6, 0 + xoris r5, r3, 0x8000 + xoris r0, r6, 0x8000 + subfc r3, r4, r7 + subfe r5, r5, r0 + subfe r5, r0, r0 + neg. r5, r5 + beq TVRCLoop0_continue +TVRCLoop0_stop: + li r3, 1 + bl WPADSetSensorBarPower + li r0, 0 + stw r0, _isActive__7LibTVRC + b TVRCLoop0_exit +TVRCLoop0_continue: + lwz r4, _isUseRepeatCode__7LibTVRC + lwz r3, _repeatBitLength__7LibTVRC + lwz r0, _repeatBitArray__7LibTVRC + stw r4, _isRepeatActive__7LibTVRC + stw r3, _bitLength__7LibTVRC + stw r0, _bitArray__7LibTVRC + stw r6, _isOnOff__7LibTVRC + stw r6, _isLastOnOff__7LibTVRC + stw r6, _func0state__7LibTVRC + stw r6, _loop0count__7LibTVRC +TVRCLoop0_prepare: + li r3, 0 + lwz r7, _bitArray__7LibTVRC + stw r3, _ctCombo__7LibTVRC + lwz r8, _bitLength__7LibTVRC + lwz r4, _loop0count__7LibTVRC + lwz r0, _isLastOnOff__7LibTVRC + b TVRCLoop0_check_bits +TVRCLoop0_bit_loop: + srawi r5, r4, 3 + addi r3, r3, 1 + addze r6, r5 + srawi r5, r4, 3 + lbzx r6, r7, r6 + addze r5, r5 + slwi r5, r5, 3 + stw r3, _ctCombo__7LibTVRC + subf r5, r5, r4 + subfic r5, r5, 7 + sraw r5, r6, r5 + clrlwi r5, r5, 31 + cmpw r0, r5 + stw r5, _isOnOff__7LibTVRC + beq TVRCLoop0_bit_match + li r3, -1 + li r0, 0 + stw r3, _func1state__7LibTVRC + mr r3, r30 + mr r4, r31 + stw r0, _func0state__7LibTVRC + bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext + b TVRCLoop0_exit +TVRCLoop0_bit_match: + addi r4, r4, 1 + stw r5, _isLastOnOff__7LibTVRC + mr r0, r5 + stw r4, _loop0count__7LibTVRC +TVRCLoop0_check_bits: + cmpw r4, r8 + blt TVRCLoop0_bit_loop + addi r3, r3, 1 + li r5, -1 + li r0, 2 + stw r3, _ctCombo__7LibTVRC + mr r3, r30 + mr r4, r31 + stw r5, _func1state__7LibTVRC + stw r0, _func0state__7LibTVRC + bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext +TVRCLoop0_exit: + lwz r0, 0x14(r1) + lwz r31, 0xc(r1) + lwz r30, 0x8(r1) + mtlr r0 + addi r1, r1, 0x10 + blr +} + +namespace LibTVRC { + void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx) { + if (_ctCombo != 0 && _isActive != 0) { + if (_func1state == -1) { + _unitStartTime = OSGetTime(); + _func1state = 0; + } + + if (_isLastOnOff != 0) { + _unitLastTime = OSGetTime(); + + if (_func1state == 0) { + WPADSetSensorBarPower(TRUE); + _func1state = 1; + OSSetAlarm(&_alarm, _tickWait[1], __FTVRCLoop1Handler); + return; + } + + BOOL active = (int)(_unitLastTime - _unitStartTime) < (int)(*(u32*)&_tickT * _ctCombo); + WPADSetSensorBarPower(FALSE); + _func1state = 0; + if (active) { + OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop1Handler); + } else { + OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop0Handler); + } + } else { + WPADSetSensorBarPower(FALSE); + OSSetAlarm(&_alarm, *(u32*)&_tickT * _ctCombo, __FTVRCLoop0Handler); + } + } + } +} // namespace LibTVRC diff --git a/src/system/iplCdbManager.cpp b/src/system/iplCdbManager.cpp index b72bd1bd..d34468c4 100644 --- a/src/system/iplCdbManager.cpp +++ b/src/system/iplCdbManager.cpp @@ -38,7 +38,7 @@ namespace ipl { } BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, - u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, + u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { BOOL result = FALSE; diff --git a/src/system/iplNwc24Manager.cpp b/src/system/iplNwc24Manager.cpp index 4a9b0058..81f315be 100644 --- a/src/system/iplNwc24Manager.cpp +++ b/src/system/iplNwc24Manager.cpp @@ -569,7 +569,7 @@ namespace ipl { NWC24FriendAddr msgFriendAddr; memset(&msgFriendAddr, 0, sizeof(msgFriendAddr)); - NWC24FriendType msgFriendType; + u16 msgFriendType; // Get friend data if (msgType == NWC24_MSGTYPE_PUBLIC) { @@ -586,7 +586,11 @@ namespace ipl { } else { u32 index = 0; getMsgFromId(&msgObj, &msgFriendAddr.wiiId); - msgFriendType = msgFriendAddr.wiiId == myUserId ? NWC24_FRIENDTYPE_NONE : NWC24_FRIENDTYPE_WII; + if (msgFriendAddr.wiiId == myUserId) { + msgFriendType = NWC24_FRIENDTYPE_NONE; + } else { + msgFriendType = NWC24_FRIENDTYPE_WII; + } if (searchFriendInfo(msgFriendAddr.wiiId, &index)) { NWC24FriendInfo friendInfo ALIGN32; readFriendInfo(&friendInfo, index);