Compare commits

...

5 Commits

Author SHA1 Message Date
Devin AI
091fc14d21 memoryCard: GCSaveData ctor (NOVTABLE suppressed MemoryBase vptr), manager icon ptr-path + frame-shift/loop-bound decodes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 03:53:33 +00:00
Devin AI
da01e1c848 memoryCard: decode MI ctor layout — drop NOVTABLE from iplMemoryCard (vtable stays UND via inline dtor key-fn)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 03:35:49 +00:00
Devin AI
4d04028f08 memoryCard: apply DigitTable struct-copy decode to GCWindow::init
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 03:13:01 +00:00
Devin AI
2aab994761 memoryCard: decode show_capacity struct-copy + scNumber
- DigitTable struct-wrapped scNumber: struct assignment produces the
  exact wchar-pair CTR copy loop; digits read from local copy
- MemoryBase NOVTABLE guard: suppresses MemoryBase vtable in this TU
- puh_msc_blk: reverted probe (count-equal reg perm documented)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 03:08:52 +00:00
Devin AI
13541c02ae msc: link msc_drv + puh_msc + puh_msc_cmd as Matching
The 3 units were already whole-unit 100% at objdiff; flipping required
fixing .sbss emission order: MWCC emits tentative-definition sbss entries
in reverse declaration order (msc_drv g_attach/g_detach pair and
puh_msc st_uhs_* globals), so declare them reversed in source to match
orig's emitted order.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-01 02:29:11 +00:00
9 changed files with 46 additions and 42 deletions

View File

@@ -1856,10 +1856,10 @@ config.libs = [
Object(NonMatching, "fa/driver/nand_drv.c"),
Object(NonMatching, "fa/driver/sd_drv.c"),
Object(NonMatching, "fa/driver/pfd_cmn.c"),
Object(NonMatching, "fa/driver/msc_drv.c"),
Object(Matching, "fa/driver/msc_drv.c"),
Object(NonMatching, "fa/msc/puh_msc.c"),
Object(NonMatching, "fa/msc/puh_msc_cmd.c"),
Object(Matching, "fa/msc/puh_msc.c"),
Object(Matching, "fa/msc/puh_msc_cmd.c"),
Object(NonMatching, "fa/msc/puh_msc_blk.c"),
]
),

View File

@@ -35,7 +35,11 @@ namespace ipl {
MemoryBase* mpBase; // 0x0C
};
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
class __declspec(novtable) MemoryBase {
#else
class MemoryBase {
#endif
public:
class Anm {
public:

View File

@@ -1,7 +1,7 @@
#include <revolution/fa.h>
static FAInsertCallback g_attach_func;
static FAEjectCallback g_detach_func;
static FAInsertCallback g_attach_func;
extern s32 uhf_msc_is_media_insert(void);

View File

@@ -1,9 +1,9 @@
#include <private/fa/puh_msc.h>
static s32 st_uhs_msc_status;
static s32 st_uhs_msc_msgid;
static s32 st_uhs_msc_tskid;
s32 uhg_msc_memid_8169971C;
static s32 st_uhs_msc_tskid;
static s32 st_uhs_msc_msgid;
static s32 st_uhs_msc_status;
static s32 _uhf_msc_api_send_message(UHF_MSC_PARAMETERS* parameters, u32 command);
s32 usbh_msc_read10(UHF_MSC_DEVICE* device, u32 sector, u16 count, void* buffer, void* sense) {

View File

@@ -26,11 +26,10 @@ FAFuncTbl st_uhs_msc_blk_func = {
};
static inline UHF_MSC_DEVICE* uhf_msc_blk_find_device(FADisk* disk) {
UHF_MSC_DEVICE* entry = uhg_msc_blk_device_tbl;
UHF_MSC_DEVICE* device = NULL;
u32 index;
for (index = 0; index < 8; entry++, index++) {
if (entry->disk == disk) {
for (index = 0; index < 8; index++) {
if (uhg_msc_blk_device_tbl[index].disk == disk) {
device = &uhg_msc_blk_device_tbl[index];
break;
}
@@ -88,9 +87,8 @@ s32 uhf_msc_blk_mount(FADisk* disk) {
}
s32 uhf_msc_blk_pread(FADisk* disk, u8* buffer, u32 sector, u32 blocks, u32* completed) {
u16 transfer_blocks;
UHF_MSC_DEVICE* device;
s32 error;
UHF_MSC_DEVICE* device;
u32 block_size;
u8* transfer_buffer;
u32 transfer_limit;
@@ -129,7 +127,7 @@ s32 uhf_msc_blk_pread(FADisk* disk, u8* buffer, u32 sector, u32 blocks, u32* com
transfer_buffer = buffer;
}
do {
transfer_blocks = transfer_limit;
u16 transfer_blocks = transfer_limit;
if (blocks <= transfer_limit) {
transfer_blocks = blocks;
}

View File

@@ -1,4 +1,3 @@
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/memoryCard/iplGCSaveData.h"
#include "scene/memoryCard/iplMemoryCard.h"
@@ -6,7 +5,6 @@
#include "iplSound.h"
#include "iplSystem.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
namespace ipl {
namespace scene {

View File

@@ -50,6 +50,13 @@ static const TextboxToMessageID scTextboxToMessageID[3] = {
};
static const char* scButtonName[3] = {"B_Move_00", "B_Copy_00", "B_Del_00"};
struct DigitTable {
wchar_t w[10];
};
static const DigitTable scNumber = {{L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'}};
GCWindow::GCWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName)
: MemoryBase(), MemCardEventHandler(), mState(0), mLinearInterp(), mCardState(0), mCardIndex(0), mOperation(0), mActive(false),
mWaiting(false) {
@@ -102,15 +109,15 @@ void GCWindow::init(const math::VEC3& translate, MemoryCardManager* manager, u8
mpPaneManager->initPane(mpLayout->getNW4RLyt()->GetRootPane()->FindPaneByName(scButtonName[i], true));
}
int blocks = mpMemoryCardManager->getBlocks(cardState, cardIndex);
wchar_t digits[10] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'};
DigitTable digitTable = scNumber;
int blockCount = static_cast<u16>(blocks);
wchar_t decimal[5] = {0};
int skipCount = 0;
wchar_t blockText[5] = {0};
decimal[0] = digits[blockCount / 1000];
decimal[1] = digits[(blockCount / 100) % 10];
decimal[2] = digits[(blockCount / 10) % 10];
decimal[3] = digits[blockCount % 10];
decimal[0] = digitTable.w[blockCount / 1000];
decimal[1] = digitTable.w[(blockCount / 100) % 10];
decimal[2] = digitTable.w[(blockCount / 10) % 10];
decimal[3] = digitTable.w[blockCount % 10];
for (i = 0; i < 3; i++) {
if (decimal[i] != L'0') {
break;

View File

@@ -1,8 +1,5 @@
#define IPL_MEMORY_CARD_CPP
#define IPL_MEMORYCARD_BASE_OUT_OF_LINE
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/memoryCard/iplMemoryCard.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/memoryCard/iplGCWindow.h"
#include "scene/memoryCard/iplGCSaveData.h"
@@ -82,6 +79,12 @@ namespace ipl {
"B_ArwR", "B_ArwL", "B_SelectWii_00", "B_SelectSd_00",
};
struct DigitTable {
wchar_t w[10];
};
static const DigitTable scNumber = {{L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'}};
MemoryCard::MemoryCard(EGG::Heap* heap)
: Base(heap), MemoryBase(), mState(2), mPrevState(2), mSlot(0), mIconIndex(-15), mIconCount(0),
mShowArwR(0), mShowArwL(0), mpEvent(NULL), mpFocusSaveData(NULL) {
@@ -90,7 +93,6 @@ namespace ipl {
nw4r::ut::List_Init(&mBalloonList, 0);
}
MemoryBase::~MemoryBase() {}
void MemoryCard::prepare() {
System::getBS2Manager()->abort();
@@ -495,19 +497,14 @@ namespace ipl {
return;
}
u32 freeBlocks = mpManager->getFreeBlocks(slot);
wchar_t digits[5];
wchar_t digitTable[10] = {L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9'};
digits[0] = L'\0';
digits[1] = L'\0';
digits[2] = L'\0';
digits[3] = L'\0';
digits[4] = L'\0';
DigitTable digitTable = scNumber;
wchar_t digits[5] = {0};
wchar_t text[0x40] = L"";
int blocks = static_cast<u16>(freeBlocks);
digits[0] = digitTable[blocks / 1000];
digits[1] = digitTable[blocks / 100 % 10];
digits[2] = digitTable[blocks / 10 % 10];
digits[3] = digitTable[blocks % 10];
digits[0] = digitTable.w[blocks / 1000];
digits[1] = digitTable.w[blocks / 100 % 10];
digits[2] = digitTable.w[blocks / 10 % 10];
digits[3] = digitTable.w[blocks % 10];
int zeroOffset;
for (zeroOffset = 0; zeroOffset < 3; zeroOffset++) {

View File

@@ -253,12 +253,12 @@ void MemoryCardManager::update_icon_anm() {
for (int remaining = 0x7f; remaining > 0; remaining--, index++) {
u32 file = mFile[slot][index].fileNo;
if (file < 0x7f && dirs[slot][file].fileNo != 0) {
memorycard::IconState* icon = &icons[slot][file];
memorycard::IconState* icon = icons[slot] + file;
s32 frame = mFileCell[slot][file].iconAnmCounter + icon->anmDelta;
mFileCell[slot][file].iconAnmCounter = frame;
if ((s16)frame >= icon->anmMax) {
if ((s16)frame >= icons[slot][file].anmMax) {
if (icon->anmType == 4) {
mFileCell[slot][file].iconAnmCounter = icons[slot][file].anmMax - icon->unk_0x07 - 1;
mFileCell[slot][file].iconAnmCounter = icon->anmMax - icon->unk_0x07 - 1;
icon->anmDelta = -1;
} else {
mFileCell[slot][file].iconAnmCounter = 0;
@@ -342,18 +342,18 @@ void MemoryCardManager::update_change_cardstate(u8 slot) {
}
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
memorycard::IconState (*icons)[0x7f] = reinterpret_cast<memorycard::IconState(*)[0x7f]>(memorycard::getIconStateArray());
int total = 0;
int file = mFile[slot][index].fileNo;
s16 frame = 0;
do {
u32 shift = frame;
u32 shift = frame << 1;
frame++;
total += ((icons[slot][file].anmFrameBits >> ((shift & 0x1f) << 1)) & 3) * 4;
total += ((icons[slot][file].anmFrameBits >> shift) & 3) * 4;
if (mFileCell[slot][file].iconAnmCounter <= total) {
break;
}
} while (frame < 9);
} while (frame <= 8);
return _create_icon(slot, file, frame - 1);
}