Compare commits

...

13 Commits

Author SHA1 Message Date
coah
a2d71c76ca fix: shrink Calendar .data padding now that EventHandler has a vtable
With gui::EventHandler no longer novtable, its 0x18-byte vtable fills most
of the gap after __vt__Q33ipl5scene8Calendar; keep one 4-byte pad.
2026-09-28 04:23:42 +00:00
coah
8518d7a486 fix: unlink eggAudioExpMgr
MWCC emits the @52 calc thunk ahead of the @52 dtor thunk, but the
original has them the other way round, which swaps two vtable entries.
Link the original object until the order is matched.
2026-09-28 04:21:25 +00:00
coah
72c348e168 fix: force-active unreferenced iplDate and WDScan data
MWLD dead-strips scene::padding (the 0x10 bytes after Date::mscMaxDate)
and the unreferenced WDScan .sdata2 bytes lbl_81695063/lbl_81695067,
which shifted .bss and .sdata2.
2026-09-28 04:20:49 +00:00
coah
1438868554 fix: share tiGUIManager's named 0.0f constant
drawLine_ and PaneComponent::contain now load lbl_81694EE8, as in the
original, instead of emitting their own 0.0f ahead of it in .sdata2.
2026-09-28 04:20:44 +00:00
coah
fb33c24ee1 fix: restore fork-point iplCSMtx string pooling
Moving "MTX34" into a static const array put it in .sdata2 and left the
pooled .sdata copy to be dead-stripped, shifting both sections.
2026-09-28 04:20:44 +00:00
coah
6408f7b737 fix: define WaveFile dtors in AudioWavePlayer after the ctor
The original emits WavePacket's weak dtor first, then the WaveFileAiff and
WaveFileWav dtors. Declaring the dtors after getBit keeps the vtables in
AudioWaveUtility.
2026-09-28 04:11:57 +00:00
coah
fc9418731b fix: define EGG audio Arg and SoundHeapMgr ctors out of line
Emits IAudioMgr::Arg::Arg first and SoundHeapMgr's weak dtor ahead of its
ctor, matching the original eggAudioMgr function order.
2026-09-28 04:10:06 +00:00
coah
0374339700 fix: define textinput PaneComponent dtor after PaneManager dtor
Matches the original object's function order, which also pulls the weak
GUIComponent dtor into place.
2026-09-28 04:07:16 +00:00
coah
bf2d6fe2ef fix: construct scene::Date::mscMaxDate with utility::Date
The MaxDate wrapper emitted a weak MaxDate ctor that the original does
not have, shifting .text by 0x10 after iplDate. Go back to a plain
utility::Date followed by the 0x10-byte padding array.
2026-09-28 04:03:35 +00:00
coah
a2f2d98ba1 fix: emit TVRC loop handlers after TVRCSendStartAsync
The original object places both alarm handlers at the end of .text.
2026-09-28 04:00:46 +00:00
coah
5a3afa664e fix: restore u16 addrType in cdb::Manager::createNewRecord
The original symbol takes u16 (mangled UsUs); the enum parameter made
createNewRecord 4 bytes longer. Match the caller in iplNwc24Manager with a
u16 local assigned through if/else.
2026-09-28 03:59:48 +00:00
coah
43ce074617 fix: limit ChannelTitle novtable header changes to IPL_CHANNEL_TITLE_NOVTABLE
PR #182 made gui::EventHandler novtable and rewrote HermiteIntp for every
unit, which dropped __vt__Q23gui12EventHandler from linked scene units and
moved EventHandler::onEvent. Restore the pre-#182 definitions unless the
macro is defined.
2026-09-28 03:59:48 +00:00
coah
09316e5096 fix: restore MSL extab flags and force-active stripped symbols 2026-09-28 03:52:02 +00:00
19 changed files with 295 additions and 218 deletions

View File

@@ -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

View File

@@ -36,3 +36,7 @@ SECTIONS {
__ArenaLo = (_db_stack_addr + 0x1F) & ~0x1F;
__ArenaHi = $ARENAHI;
}
FORCEACTIVE {
$FORCEACTIVE
}

View File

@@ -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"),

View File

@@ -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;

View File

@@ -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,

View File

@@ -44,6 +44,7 @@ namespace ipl {
T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); }
};
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
template <typename T>
class __declspec(novtable) HermiteIntp : public utility::FrameController {
public:
@@ -130,6 +131,58 @@ namespace ipl {
};
#pragma dont_instantiate HermiteIntp<float>
#else
template <typename T>
class HermiteIntp : public Interporation<T> {
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

View File

@@ -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

View File

@@ -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);

View File

@@ -15,7 +15,7 @@ namespace EGG {
class SoundHeapMgr {
public:
SoundHeapMgr() NO_INLINE {}
SoundHeapMgr();
~SoundHeapMgr() { destroySoundHeap(); }

View File

@@ -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:

View File

@@ -7,6 +7,15 @@
#include <revolution/ax.h>
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() {
}

View File

@@ -80,6 +80,10 @@ SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_P
mThreadRunning = false;
}
WaveFileAiff::~WaveFileAiff() {}
WaveFileWav::~WaveFileWav() {}
SimpleWavePlayer::~SimpleWavePlayer() {
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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

View File

@@ -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) {

View File

@@ -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

View File

@@ -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;

View File

@@ -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);