Compare commits

..

1 Commits

Author SHA1 Message Date
coah
4700e05974 match(iplMemoryCardManager): update_file_array
Load mLastCmd through a volatile so MWCC keeps the this+0x10000
base in r3 and the command value in r4 for the range check.
2026-10-01 17:33:21 -05:00
20 changed files with 166 additions and 424 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.37% | 87.71% | 62.05% | 92.06% |
| 99.37% | 87.71% | 61.93% | 92.06% |
units 918/1027 complete, functions 12213/12563 matched.
units 917/1027 complete, functions 12213/12563 matched.
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->

View File

@@ -14110,7 +14110,7 @@ hairColorTable$1737 = .rodata:0x8161DDDC; // type:object size:0xB4 scope:local
eyeColorTable$1742 = .rodata:0x8161DE90; // type:object size:0x1E scope:local
scDefaultData = .rodata:0x8161DEB0; // type:object size:0x1BC scope:local
scDayMax$1845 = .rodata:0x8161E070; // type:object size:0xD scope:local
scJpegAanScale = .rodata:0x8161E080; // type:object size:0x100 scope:local data:4byte
lbl_8161E080 = .rodata:0x8161E080; // type:object size:0x100 scope:local data:4byte
TMCJPEGDEC_SampleH_N = .rodata:0x8161E180; // type:object size:0x18 data:byte
TMCJPEGDEC_SampleV_N = .rodata:0x8161E198; // type:object size:0x18 data:byte
TMCJPEGDEC_Zigzag_data = .rodata:0x8161E1B0; // type:object size:0x40 data:byte
@@ -19181,13 +19181,13 @@ base64_array = .data:0x816874A0; // type:object size:0x80 scope:local
@2185 = .data:0x816876A0; // type:object size:0x21 scope:local data:string
@654 = .data:0x816876C8; // type:object size:0x48 scope:local data:string
ShutdownFunctionInfo = .data:0x81687710; // type:object size:0x10 scope:local
scWpadVersionStr = .data:0x81687720; // type:object size:0x49 data:string
lbl_81687720 = .data:0x81687720; // type:object size:0x49 data:string
lbl_8168776C = .data:0x8168776C; // type:object size:0x1C data:string
lbl_81687788 = .data:0x81687788; // type:object size:0x1B data:string
lbl_816877A4 = .data:0x816877A4; // type:object size:0x2F data:string
lbl_816877D4 = .data:0x816877D4; // type:object size:0x27 data:string
ShutdownFunctionInfo = .data:0x81687800; // type:object size:0x10 scope:local
scWpadManageStrs = .data:0x81687810; // type:object size:0x58
lbl_81687810 = .data:0x81687810; // type:object size:0x58
lbl_81687868 = .data:0x81687868; // type:object size:0xC data:string
lbl_81687874 = .data:0x81687874; // type:object size:0x37 data:string
lbl_816878AC = .data:0x816878AC; // type:object size:0xB4
@@ -20050,8 +20050,8 @@ lbl_816932D0 = .data:0x816932D0; // type:object size:0x48 data:string
lbl_81693318 = .data:0x81693318; // type:object size:0xA data:string
lbl_81693324 = .data:0x81693324; // type:object size:0x15 data:string
@466 = .data:0x81693340; // type:object size:0xD scope:local data:string
scCntCacheStrs = .data:0x81693350; // type:object size:0xD0
scCntCacheTitleDataFmt = .data:0x81693420; // type:object size:0x16 data:string
lbl_81693350 = .data:0x81693350; // type:object size:0xD0
lbl_81693420 = .data:0x81693420; // type:object size:0x16 data:string
__vt__Q23EGG9Allocator = .data:0x81693438; // type:object size:0x14
__vt__Q23EGG9ArcPlayer = .data:0x81693450; // type:object size:0x54
__vt__Q23EGG20SimpleAudioMgrWithFx = .data:0x816934A8; // type:object size:0x78
@@ -23109,7 +23109,7 @@ lbl_816983EC = .sdata:0x816983EC; // type:object size:0x6 data:string
__KBDVersion = .sdata:0x816985C8; // type:object size:0x4 data:4byte
__KPRVersion = .sdata:0x816985D0; // type:object size:0x4 data:4byte
__CNTCACHEVersion = .sdata:0x816985D8; // type:object size:0x4 data:4byte
scCntCacheSpaceNl = .sdata:0x816985DC; // type:object size:0x3 data:string
lbl_816985DC = .sdata:0x816985DC; // type:object size:0x3 data:string
@428 = .sdata:0x816985E0; // type:object size:0x4 scope:local data:string
@429 = .sdata:0x816985E4; // type:object size:0x3 scope:local data:string
@442 = .sdata:0x816985E7; // type:object size:0x8 scope:local data:string

View File

@@ -869,7 +869,7 @@ config.libs = [
),
IPLSection("setting", [
Object(NonMatching, "scene/setting/iplSetting.cpp"),
Object(Matching, "scene/setting/iplSensitivity.cpp"),
Object(NonMatching, "scene/setting/iplSensitivity.cpp"),
Object(Matching, "scene/setting/iplNCDSetting.cpp"),
Object(Matching, "scene/setting/iplParental.cpp"),
Object(Matching, "scene/setting/iplAPScanThread.cpp"),
@@ -918,7 +918,7 @@ config.libs = [
Object(NonMatching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiAtokString.cpp", extra_cflags=["-O4,p"]), # for 4.3J
Object(NonMatching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
Object(Matching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiNw4rManager.cpp", extra_cflags=["-O4,p"]),
Object(NonMatching, "keyboard/tiManager.cpp", extra_cflags=["-O4,p"]),
Object(Matching, "keyboard/tiUtil.cpp", extra_cflags=["-O4,p"]),

View File

@@ -301,9 +301,9 @@ namespace nw4r {
}
if (error == OS_EXCEPTION_FLOATING_POINT_EXCEPTION) {
u32 fpcsr = sException.FPCSR_COPY;
fpcsr &= (((fpcsr & 0xf8) << 0x16) | 0x01f80700);
if ((fpcsr & 0x20000000) != 0) {
u32 uVar1 = sException.FPCSR_COPY;
uVar1 &= (((uVar1 & 0xf8) << 0x16) | 0x01f80700);
if ((uVar1 & 0x20000000) != 0) {
Exception_Printf_(" FPE: Invalid operation\n");
if ((sException.FPCSR_COPY & 0x1000000) != 0) {
Exception_Printf_(" SNaN\n");
@@ -333,16 +333,16 @@ namespace nw4r {
Exception_Printf_(" Invalid integer convert\n");
}
}
if ((fpcsr & 0x10000000) != 0) {
if ((uVar1 & 0x10000000) != 0) {
Exception_Printf_(" FPE: Overflow\n");
}
if ((fpcsr & 0x8000000) != 0) {
if ((uVar1 & 0x8000000) != 0) {
Exception_Printf_(" FPE: Underflow\n");
}
if ((fpcsr & 0x4000000) != 0) {
if ((uVar1 & 0x4000000) != 0) {
Exception_Printf_(" FPE: Zero division\n");
}
if ((fpcsr & 0x2000000) != 0) {
if ((uVar1 & 0x2000000) != 0) {
Exception_Printf_(" FPE: Inexact result\n");
}
}

View File

@@ -2,7 +2,7 @@
extern void* memset(void* dest, s32 val, u32 count);
extern const u32 scJpegAanScale[64] = {
extern const u32 lbl_8161E080[64] = {
0x00000100, 0x000000B9, 0x000000C4, 0x000000DA, 0x00000100, 0x00000146, 0x000001D9, 0x000003A0, 0x000000B9, 0x00000085, 0x0000008D,
0x0000009D, 0x000000B9, 0x000000EB, 0x00000155, 0x0000029D, 0x000000C4, 0x0000008D, 0x00000096, 0x000000A7, 0x000000C4, 0x000000F9,
0x0000016A, 0x000002C6, 0x000000DA, 0x0000009D, 0x000000A7, 0x000000B9, 0x000000DA, 0x00000115, 0x00000192, 0x00000315, 0x00000100,
@@ -1424,7 +1424,7 @@ static s32 TMCJPEGDEC_parse_dqt(TMCCJPEGDecWork* work) {
s32 r;
d = tblCopy;
*(CopyBlock64*)d = *(CopyBlock64*)scJpegAanScale;
*(CopyBlock64*)d = *(CopyBlock64*)lbl_8161E080;
scaleInfo = (QuantizationTables*)&work->scaleFlag;

View File

@@ -3,7 +3,7 @@
#include <revolution/types.h>
s32 uhf_ker_create_sem(u32 initCount, int flags);
s32 uhf_ker_create_sem(u32 param_1, int param_2);
s32 uhf_ker_delete_sem(int sem);
s32 uhf_ker_get_sem(int sem);

View File

@@ -62,8 +62,8 @@ typedef struct CXUncompContextHuffman {
CXHuffmanDecodeTableEntry decodeTableData[0x200]; // 0x20
} CXUncompContextHuffman;
void CXInitUncompContextRL(CXUncompContextRL* context, u8* data);
void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* data);
void CXInitUncompContextRL(CXUncompContextRL* context, u8* param_2);
void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* param_2);
void CXInitUncompContextHuffman(CXUncompContextHuffman* context, u8* param_2);
CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u32 size);

View File

@@ -33,8 +33,8 @@ typedef struct USBKBDCmdLEDAsync {
USBKBDErr USBKBDInitialize(USBKBDAttachCallback attachCb, USBKBDDetachCallback detachCb);
USBKBDErr USBKBDSetLED(u32 device, u8 ledBits, USBKBDCmdLED* cmd);
USBKBDErr USBKBDSetLEDAsync(u32 device, u8 ledBits, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg);
USBKBDErr USBKBDSetLED(u32, u8, USBKBDCmdLED* cmd);
USBKBDErr USBKBDSetLEDAsync(u32, u8, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg);
USBKBDErr USBKBDRegisterEventCallback(USBKBDEventCallback cb);

View File

@@ -22,7 +22,7 @@ void bte_hcisu_send(HC_BT_HDR *p_msg, UINT16 event)
GKI_freebuf(p_msg);
}
void bte_hcisu_task(int unused)
void bte_hcisu_task(int param_1)
{
if (p_hcisu_if)
{

View File

@@ -152,11 +152,11 @@ void BTA_CleanUp(tBTA_APP_INFO_CBACK *p_cb)
GKI_shutdown();
}
void bta_usb_close_evt(INT8 status)
void bta_usb_close_evt(INT8 param_1)
{
if (_bte_app_info)
{
if (status >= 0)
if (param_1 >= 0)
(*_bte_app_info)(0);
else
(*_bte_app_info)(1);

View File

@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
char scCntCacheStrs[0xd0] = {
char lbl_81693350[0xd0] = {
0x3c, 0x3c, 0x20, 0x52, 0x56, 0x4c, 0x5f, 0x53, 0x44, 0x4b, 0x20, 0x2d, 0x20, 0x43, 0x4e, 0x54,
0x43, 0x41, 0x43, 0x48, 0x45, 0x20, 0x09, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x62,
0x75, 0x69, 0x6c, 0x64, 0x3a, 0x20, 0x41, 0x70, 0x72, 0x20, 0x32, 0x30, 0x20, 0x32, 0x30, 0x31,
@@ -22,12 +22,12 @@ char scCntCacheStrs[0xd0] = {
0x74, 0x20, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x00,
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00
};
char scCntCacheTitleDataFmt[0x16] = {
char lbl_81693420[0x16] = {
0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x2f, 0x25, 0x30, 0x38, 0x78, 0x2f, 0x25, 0x30, 0x38, 0x78,
0x2f, 0x64, 0x61, 0x74, 0x61, 0x00,
};
const char* __CNTCACHEVersion = scCntCacheStrs;
char scCntCacheSpaceNl[3] = {0x20, 0x0a, 0x00};
const char* __CNTCACHEVersion = lbl_81693350;
char lbl_816985DC[3] = {0x20, 0x0a, 0x00};
extern void _savegpr_23();
extern void _restgpr_23();
@@ -72,9 +72,9 @@ asm void CNTCACHEClear() {
mr r11, r12
stw r0, 4(r12)
bl _savegpr_23
lis r30, scCntCacheStrs@ha
lis r30, lbl_81693350@ha
lis r3, _CNTCACHEMutex@ha
addi r30, r30, scCntCacheStrs@l
addi r30, r30, lbl_81693350@l
li r29, 0
addi r3, r3, _CNTCACHEMutex@l
bl OSLockMutex
@@ -146,7 +146,7 @@ L_184:
stb r31, 0(r4)
subf r23, r24, r4
mr r3, r24
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
bl strtok
cmpwi r3, 0
mr r29, r3
@@ -246,7 +246,7 @@ asm void _CNTCACHEDeleteTitle() {
stwu r1, -0x20(r1)
mflr r0
li r3, 0
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
stw r30, 0x18(r1)
@@ -284,7 +284,7 @@ L_350:
bl ES_DeleteTitleContent
L_364:
li r3, 0
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
bl strtok
L_370:
cmpwi r3, 0
@@ -305,10 +305,10 @@ asm int _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
subfic r11, r11, -0x2100
stwux r1, r1, r11
mflr r0
lis r5, scCntCacheTitleDataFmt@ha
lis r5, lbl_81693420@ha
stw r0, 4(r12)
li r0, 1
addi r5, r5, scCntCacheTitleDataFmt@l
addi r5, r5, lbl_81693420@l
stw r31, -4(r12)
stw r30, -8(r12)
mr r30, r3
@@ -403,7 +403,7 @@ asm void _CNTCACHEDeleteContent() {
stw r0, 4(r12)
bl _savegpr_26
li r3, 0
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
bl strtok
li r31, 0
li r4, 0
@@ -441,10 +441,10 @@ asm void _CNTCACHEDeleteContent() {
rlwinm. r0, r3, 0, 0x1b, 0x1b
beq L_6f0
li r3, 0
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
bl strtok
li r26, 1
lis r27, scCntCacheTitleDataFmt@ha
lis r27, lbl_81693420@ha
b L_6e8
L_5b0:
stw r31, errno(r0)
@@ -488,7 +488,7 @@ L_5e8:
li r0, -1
stw r26, 0x20(r1)
addi r3, r1, 0x40
addi r5, r27, scCntCacheTitleDataFmt@l
addi r5, r27, lbl_81693420@l
stw r26, 0x24(r1)
and r6, r30, r0
and r7, r29, r0
@@ -529,7 +529,7 @@ L_6d4:
bdnz L_5e8
L_6dc:
li r3, 0
la r4, scCntCacheSpaceNl
la r4, lbl_816985DC
bl strtok
L_6e8:
cmpwi r3, 0

View File

@@ -221,11 +221,11 @@ CXSecureResult CXSecureUncompressLZ(const void* src, u32 length, void* dst) {
return CX_SECURE_ERR_OK;
}
BOOL CXiVerifyHuffmanTable_(const void* table, u8 bitSize) {
const u8* a = table;
BOOL CXiVerifyHuffmanTable_(const void* param_1, u8 param_2) {
const u8* a = param_1;
const u8* b = a + 1;
u32 c = *a;
const u8* d = (u8*)table + ((c + 1) << 1);
const u8* d = (u8*)param_1 + ((c + 1) << 1);
u8 e[sizeof(u8) * 0x40];
u32 i;
@@ -233,7 +233,7 @@ BOOL CXiVerifyHuffmanTable_(const void* table, u8 bitSize) {
e[i] = 0;
}
if (bitSize == 4 && c >= 16) {
if (param_2 == 4 && c >= 16) {
return FALSE;
}

View File

@@ -4,8 +4,8 @@
static inline int CXiReadHeader(u8*, int*, const u8*, int, int);
static inline CXHuffmanDecodeTableEntry* GetNextNode(CXHuffmanDecodeTableEntry*, int);
void CXInitUncompContextRL(CXUncompContextRL* context, u8* data) {
context->unk_0x00 = data;
void CXInitUncompContextRL(CXUncompContextRL* context, u8* param_2) {
context->unk_0x00 = param_2;
context->unk_0x04 = 0;
context->unk_0x0e = 0;
context->unk_0x0C = 0;
@@ -13,8 +13,8 @@ void CXInitUncompContextRL(CXUncompContextRL* context, u8* data) {
context->size = 0;
}
void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* data) {
context->unk_0x00 = data;
void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* param_2) {
context->unk_0x00 = param_2;
context->unk_0x04 = 0;
context->unk_0x11 = 0;
context->unk_0x12 = 0;
@@ -125,7 +125,7 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
return CX_STREAMING_ERR_OK;
}
static int CXiReadHeader(u8* pHdrLen, int* pOutLen, const u8* pSrc, int srcSize, int maxOutLen) {
static int CXiReadHeader(u8* pHdrLen, int* pOutLen, const u8* pSrc, int srcSize, int param_5) {
int bytesParsed = 0;
while (*pHdrLen) {
@@ -150,8 +150,8 @@ static int CXiReadHeader(u8* pHdrLen, int* pOutLen, const u8* pSrc, int srcSize,
}
}
if (maxOutLen > 0 && maxOutLen < *pOutLen) {
*pOutLen = maxOutLen;
if (param_5 > 0 && param_5 < *pOutLen) {
*pOutLen = param_5;
}
return bytesParsed;

View File

@@ -291,7 +291,7 @@ s32 pfd_st_removal_callback(s32 status, void* data) {
return 0;
}
g_pfd_sddrv_info.media_inserted = 0;
if (g_pfd_sddrv_info.media_inserted == 0 && pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
if (pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
g_event = 1;
result = ISD_RegisterDeviceIntrHandler(g_pfd_sddrv_info.device, (SDDevIntrCallback)pfd_st_inter_callback, &g_event);
if (result != 0) {

View File

@@ -34,13 +34,13 @@ static void uhf_ker_sem_inline_1() {
}
}
s32 uhf_ker_create_sem(u32 initCount, int flags) {
s32 uhf_ker_create_sem(u32 param_1, int param_2) {
int i, k;
if (initCount != 0 && initCount != 1) {
if (param_1 != 0 && param_1 != 1) {
return -5;
}
if (flags != 0) {
if (param_2 != 0) {
return -5;
}
@@ -60,13 +60,13 @@ s32 uhf_ker_create_sem(u32 initCount, int flags) {
OSInitSemaphore(&st_uhf_ker_sem[i], 1);
sem = &st_uhf_ker_sem[i];
for (k = (int)(1 - initCount); k > 0; k--) {
for (k = (int)(1 - param_1); k > 0; k--) {
OSWaitSemaphore((OSSemaphore*)sem);
}
st_uhs_ker_sem_mng.entries[i].sem = sem;
st_uhs_ker_sem_mng.entries[i].unk_0x04 = initCount;
st_uhs_ker_sem_mng.entries[i].unk_0x08 = flags;
st_uhs_ker_sem_mng.entries[i].unk_0x04 = param_1;
st_uhs_ker_sem_mng.entries[i].unk_0x08 = param_2;
st_uhs_ker_sem_mng.unk_0x90++;
uhf_ker_sem_inline_1();

View File

@@ -96,13 +96,13 @@ USBKBDErr USBKBDInitialize(USBKBDAttachCallback attachCb, USBKBDDetachCallback d
return USB_KBD_ERR_OK;
}
USBKBDErr USBKBDSetLED(u32 device, u8 ledBits, USBKBDCmdLED* cmd) {
USBKBDErr USBKBDSetLED(u32 param_1, u8 param_2, USBKBDCmdLED* cmd) {
if (usbKbdFd < 0) {
return USB_KBD_ERR_NOT_INIT;
}
cmd->unk_0x04 = ledBits;
cmd->unk_0x00 = device;
cmd->unk_0x04 = param_2;
cmd->unk_0x00 = param_1;
return IOS_Write(usbKbdFd, cmd, sizeof(USBKBDCmdLED)) != IPC_RESULT_OK ? USB_KBD_ERR_FATAL : USB_KBD_ERR_OK;
}
@@ -114,12 +114,12 @@ static IOSError usbKbdSetLEDHandler(IOSError error, void* arg) {
return IPC_RESULT_OK;
}
USBKBDErr USBKBDSetLEDAsync(u32 device, u8 ledBits, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg) {
USBKBDErr USBKBDSetLEDAsync(u32 param_1, u8 param_2, USBKBDCmdLEDAsync* cmd, USBKBDCmdLEDCallback cb, void* cbArg) {
if (usbKbdFd < 0) {
return USB_KBD_ERR_NOT_INIT;
}
cmd->base.unk_0x00 = device;
cmd->base.unk_0x04 = ledBits;
cmd->base.unk_0x00 = param_1;
cmd->base.unk_0x04 = param_2;
cmd->cb = cb;
cmd->cbArg = cbArg;

View File

@@ -28,8 +28,8 @@
#define DPD_CONFIG2_SIZE 2
#define SPK_CONFIG_SIZE 7
char scWpadVersionStr[] = "<< RVL_SDK - WPAD \trelease build: Apr 20 2010 11:20:55 (0x4199_60831) >>";
const char* __WPADVersion = scWpadVersionStr;
char lbl_81687720[] = "<< RVL_SDK - WPAD \trelease build: Apr 20 2010 11:20:55 (0x4199_60831) >>";
const char* __WPADVersion = lbl_81687720;
WPADStorage _wpd;
WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS];
@@ -617,7 +617,7 @@ static void __reconnect(BOOL exec) {
WUDShutdown(exec);
}
#ifdef __MWERKS__
char scWpadManageStrs[0x58] = "Reconnect Start!!\n\0\0\0\0\0\0"
char lbl_81687810[0x58] = "Reconnect Start!!\n\0\0\0\0\0\0"
"Check the update of WiFi using channel\n\0"
"WiFi uses channel = %d\n";
extern void _savegpr_19();
@@ -629,8 +629,8 @@ static asm void WPADiManageHandler(OSAlarm* pAlarm, OSContext* pContext) {
stw r0, 0x164(r1)
addi r11, r1, 0x160
bl _savegpr_19
lis r28, scWpadVersionStr@ha
addi r28, r28, scWpadVersionStr@l
lis r28, lbl_81687720@ha
addi r28, r28, lbl_81687720@l
bl WUDGetStatus
cmpwi r3, 0x3
beq WPADiManageHandler_8AC8

View File

@@ -526,6 +526,23 @@ extern const u8 controlKeys[];
return false;
}
extern "C" const u8 scCountryMap_EU[] = {0x0f, 0x21, 0x20, 0x08, 0x09, 0x0e, 0x19, 0x00, 0x21, 0x21, 0x00, 0x00};
extern "C" const u8 scCountryMap_NonEU[] = {0x0f, 0x21, 0x20, 0x04, 0x09, 0x0e, 0x11, 0x00, 0x21, 0x21, 0x00, 0x00};
const u8 controlKeys[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x0a, 0x03,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x04, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x19, 0x1a, 0x1b, 0x13, 0x15, 0x17, 0x14, 0x16, 0x18, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0f, 0x0e,
0x00, 0x00, 0x00, 0x00,
0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x07, 0x0b,
0x06, 0x05, 0x07, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
bool HWKeyboard::updateTappingShift_(input::HKBManager& hkbManager) {
hkbManager.GetModifierState();
input::HKBManager::KeySet currentKeySet;
@@ -619,24 +636,6 @@ extern const u8 controlKeys[];
}
}
extern "C" const u8 scCountryMap_EU[] = {0x0f, 0x21, 0x20, 0x08, 0x09, 0x0e, 0x19, 0x00, 0x21, 0x21, 0x00, 0x00};
extern "C" const u8 scCountryMap_NonEU[] = {0x0f, 0x21, 0x20, 0x04, 0x09, 0x0e, 0x11, 0x00, 0x21, 0x21, 0x00, 0x00};
const u8 controlKeys[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x0a, 0x03,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x00, 0x04, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
0x2b, 0x2c, 0x19, 0x1a, 0x1b, 0x13, 0x15, 0x17, 0x14, 0x16, 0x18, 0x00,
0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0f, 0x0e,
0x00, 0x00, 0x00, 0x00,
0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x07, 0x0b,
0x06, 0x05, 0x07, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
extern "C" asm void setLanguage__Q49textinput8keyboard5hwkey10HWKeyboardFQ29textinput11DestinationQ29textinput8Language() {
nofralloc
cmpwi r4, 2

View File

@@ -281,7 +281,7 @@ void MemoryCardManager::update_file_array(u8 slot) {
memorycard::CardState* states = memorycard::getCardSlotState();
states[slot].changed = 0;
sort_file_array(slot);
long command = mLastCmd;
long command = *(volatile long*)&mLastCmd;
if ((u32)(command - 1) <= 3) {
if (mLastResult == -0x15) {
mLastResult = memorycard::getCardLastCMDFCmdResult();

View File

@@ -1,342 +1,85 @@
#include <revolution/types.h>
#include "system/iplSystem.h"
#include "system/iplNand.h"
#include "utility/iplGraphics.h"
#include <revolution/tpl.h>
extern "C" {
WPADStatus* KPADGetWPADRingBuffer(s32 channel);
WPADFSStatus* KPADGetWPADFSRingBuffer(s32 channel);
WPADCLStatus* KPADGetWPADCLRingBuffer(s32 channel);
}
namespace ipl {
namespace nand { class File; }
class SensitivityDrawing {
public:
static void draw(nand::File* texture);
};
}
extern "C" {
void _savegpr_27();
void _restgpr_27();
void GXGetScissor();
void GXSetScissor();
void GXInitTexObjWrapMode();
void TPLGetGXTexObjFromPalette();
void WPADGetLatestIndexInBuf();
void __cvt_fp2unsigned();
void KPADGetWPADRingBuffer();
void KPADGetWPADFSRingBuffer();
void KPADGetWPADCLRingBuffer();
void getRenderModeObj__Q23ipl6SystemFv();
void getProjectionRect__Q23ipl6SystemFPQ34nw4r2ut4Rect();
void setDefaultOrtho__Q33ipl7utility8GraphicsFUl();
void drawPolygon__Q33ipl7utility8GraphicsFRCQ34nw4r2ut4Rect8_GXColor();
void getYoungController__Q23ipl6SystemFv();
void drawTexture__Q33ipl7utility8GraphicsFRCQ34nw4r2ut4RectRC9_GXTexObj8_GXColorUcQ43ipl7utility8Graphics11Orientation();
}
#pragma section sconst_type ".sdata2"
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C40 = 0.5f;
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C44 = 768.0f;
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C48 = 0.0009765625f;
extern "C" __declspec(section ".sdata2") const u32 lbl_81694C4C = 0;
extern "C" __declspec(section ".sdata2") const f64 lbl_81694C50 = 4503601774854144.0;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C58 = 0x60;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C59 = 0x60;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5A = 0x60;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5B = 0xC0;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5C = 0xFF;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5D = 0xFF;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5E = 0xFF;
extern "C" __declspec(section ".sdata2") const u8 lbl_81694C5F = 0xFF;
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C60 = 0.0f;
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C64 = -45.0f;
extern "C" __declspec(section ".sdata2") const f32 lbl_81694C68 = 0.15f;
extern "C" __declspec(section ".sdata2") const u32 lbl_81694C6C = 0;
extern "C" __declspec(section ".sdata2") const f64 lbl_81694C70 = 4503599627370496.0;
namespace ipl {
asm void SensitivityDrawing::draw(nand::File* texture) {
nofralloc
stwu r1, -0x120(r1)
mflr r0
stw r0, 0x124(r1)
stfd f31, 0x110(r1)
psq_st f31, 0x118(r1), 0, 0
stfd f30, 0x100(r1)
psq_st f30, 0x108(r1), 0, 0
stfd f29, 0xf0(r1)
psq_st f29, 0xf8(r1), 0, 0
stfd f28, 0xe0(r1)
psq_st f28, 0xe8(r1), 0, 0
stfd f27, 0xd0(r1)
psq_st f27, 0xd8(r1), 0, 0
addi r11, r1, 0xd0
bl _savegpr_27
lis r0, 0x4330
mr r30, r3
stw r0, 0xa0(r1)
stw r0, 0xa8(r1)
bl getRenderModeObj__Q23ipl6SystemFv
li r0, 0x7
addi r5, r1, 0x60
subi r4, r3, 0x4
mtctr r0
L_813F9BD0:
lwz r3, 0x4(r4)
lwzu r0, 0x8(r4)
stw r3, 0x4(r5)
stwu r0, 0x8(r5)
bdnz L_813F9BD0
lwz r0, 0x4(r4)
addi r3, r1, 0x34
lfs f0, lbl_81694C60(r0)
stw r0, 0x4(r5)
stfs f0, 0x34(r1)
stfs f0, 0x38(r1)
stfs f0, 0x3c(r1)
stfs f0, 0x40(r1)
bl getProjectionRect__Q23ipl6SystemFPQ34nw4r2ut4Rect
lbz r9, lbl_81694C58(r0)
addi r3, r1, 0x1c
lbz r8, lbl_81694C59(r0)
addi r4, r1, 0x18
lbz r7, lbl_81694C5A(r0)
addi r5, r1, 0x14
lbz r0, lbl_81694C5B(r0)
addi r6, r1, 0x10
stb r9, 0x20(r1)
stb r8, 0x21(r1)
stb r7, 0x22(r1)
stb r0, 0x23(r1)
bl GXGetScissor
lhz r4, 0x68(r1)
li r3, 0x0
lhz r0, 0x6a(r1)
stw r4, 0xa4(r1)
lfs f2, 0x3c(r1)
lfs f1, 0x34(r1)
stw r0, 0xac(r1)
fsubs f4, f2, f1
lfs f3, 0x40(r1)
lfs f0, 0x38(r1)
lfd f2, lbl_81694C70(r0)
fsubs f5, f3, f0
lfd f1, 0xa0(r1)
lfd f0, 0xa8(r1)
fsubs f1, f1, f2
lfs f3, lbl_81694C40(r0)
fsubs f0, f0, f2
fmuls f31, f3, f4
fdivs f30, f1, f4
fdivs f29, f0, f5
fmuls f27, f3, f5
bl setDefaultOrtho__Q33ipl7utility8GraphicsFUl
lfs f2, 0x40(r1)
lfs f1, 0x38(r1)
lfs f0, lbl_81694C40(r0)
fsubs f3, f2, f1
lfs f2, 0x3c(r1)
lfs f1, 0x34(r1)
fmuls f0, f0, f3
fsubs f28, f2, f1
fmuls f1, f29, f0
bl __cvt_fp2unsigned
lfs f0, lbl_81694C40(r0)
mr r27, r3
fmuls f0, f0, f28
fmuls f1, f30, f0
bl __cvt_fp2unsigned
lfs f2, lbl_81694C40(r0)
mr r28, r3
lfs f1, 0x38(r1)
lfs f0, lbl_81694C64(r0)
fmuls f1, f2, f1
fadds f1, f1, f27
fadds f0, f0, f1
fmuls f1, f29, f0
bl __cvt_fp2unsigned
lfs f1, lbl_81694C40(r0)
mr r29, r3
lfs f0, 0x34(r1)
fmuls f0, f1, f0
fadds f0, f0, f31
fmuls f1, f30, f0
bl __cvt_fp2unsigned
mr r4, r29
mr r5, r28
mr r6, r27
bl GXSetScissor
lbz r7, 0x20(r1)
addi r3, r1, 0x34
lbz r6, 0x21(r1)
addi r4, r1, 0xc
lbz r5, 0x22(r1)
lbz r0, 0x23(r1)
stb r7, 0xc(r1)
stb r6, 0xd(r1)
stb r5, 0xe(r1)
stb r0, 0xf(r1)
bl drawPolygon__Q33ipl7utility8GraphicsFRCQ34nw4r2ut4Rect8_GXColor
bl getYoungController__Q23ipl6SystemFv
cmpwi r3, 0x0
mr r27, r3
beq L_813F9F74
lwz r12, 0x0(r3)
lwz r12, 0x64(r12)
mtctr r12
bctrl
cmpwi r3, 0x0
beq L_813F9F74
lwz r3, 0xa0(r30)
addi r4, r1, 0x44
li r5, 0x1
bl TPLGetGXTexObjFromPalette
addi r3, r1, 0x44
li r4, 0x2
li r5, 0x2
bl GXInitTexObjWrapMode
lfs f1, 0x40(r1)
mr r3, r27
lfs f0, 0x38(r1)
lwz r12, 0x0(r27)
fsubs f1, f1, f0
lfs f3, lbl_81694C40(r0)
lfs f0, lbl_81694C44(r0)
lfs f5, 0x3c(r1)
fmuls f1, f3, f1
lfs f4, 0x34(r1)
lfs f2, lbl_81694C48(r0)
fsubs f4, f5, f4
lwz r12, 0x10(r12)
fdivs f29, f1, f0
fmuls f0, f3, f4
fmuls f27, f0, f2
mtctr r12
bctrl
bl WPADGetLatestIndexInBuf
lwz r12, 0x0(r27)
mr r29, r3
mr r3, r27
lwz r12, 0xc(r12)
mtctr r12
bctrl
cmpwi r3, 0x1
beq L_813F9E48
bge L_813F9E10
cmpwi r3, 0x0
bge L_813F9E1C
b L_813F9E9C
L_813F9E10:
cmpwi r3, 0x3
bge L_813F9E9C
b L_813F9E74
L_813F9E1C:
lwz r12, 0x0(r27)
mr r3, r27
lwz r12, 0x10(r12)
mtctr r12
bctrl
bl KPADGetWPADRingBuffer
mulli r0, r29, 0x2a
add r3, r3, r0
addi r31, r3, 0x20
addi r30, r3, 0x8
b L_813F9E9C
L_813F9E48:
lwz r12, 0x0(r27)
mr r3, r27
lwz r12, 0x10(r12)
mtctr r12
bctrl
bl KPADGetWPADFSRingBuffer
mulli r0, r29, 0x32
add r3, r3, r0
addi r31, r3, 0x20
addi r30, r3, 0x8
b L_813F9E9C
L_813F9E74:
lwz r12, 0x0(r27)
mr r3, r27
lwz r12, 0x10(r12)
mtctr r12
bctrl
bl KPADGetWPADCLRingBuffer
mulli r0, r29, 0x36
add r3, r3, r0
addi r31, r3, 0x20
addi r30, r3, 0x8
L_813F9E9C:
lfd f28, lbl_81694C50(r0)
lfs f31, lbl_81694C68(r0)
lfs f30, lbl_81694C64(r0)
L_813F9EA8:
lhz r3, 0x4(r31)
cmpwi r3, 0x0
beq L_813F9F68
addi r0, r3, 0x19
lha r3, 0x2(r31)
xoris r0, r0, 0x8000
lha r4, 0x0(r31)
stw r0, 0xa4(r1)
subi r0, r3, 0x180
subi r3, r4, 0x200
lbz r5, lbl_81694C5C(r0)
lfd f0, 0xa0(r1)
xoris r8, r3, 0x8000
xoris r0, r0, 0x8000
stw r8, 0xac(r1)
fsubs f2, f0, f28
lbz r6, lbl_81694C5D(r0)
stw r0, 0xa4(r1)
addi r3, r1, 0x24
lfd f1, 0xa8(r1)
addi r4, r1, 0x44
lfd f0, 0xa0(r1)
fsubs f1, f1, f28
lbz r7, lbl_81694C5E(r0)
fmuls f4, f31, f2
fsubs f0, f0, f28
lbz r0, lbl_81694C5F(r0)
fmuls f5, f1, f27
stb r5, 0x8(r1)
addi r5, r1, 0x8
fmuls f0, f0, f29
fsubs f3, f5, f4
stb r6, 0x9(r1)
li r6, 0x2
fneg f0, f0
stb r7, 0xa(r1)
li r7, 0x0
stb r0, 0xb(r1)
fadds f1, f0, f4
fsubs f0, f0, f4
stfs f3, 0x24(r1)
fsubs f2, f1, f30
fadds f1, f5, f4
fsubs f0, f0, f30
stfs f2, 0x28(r1)
stfs f1, 0x2c(r1)
stfs f0, 0x30(r1)
bl drawTexture__Q33ipl7utility8GraphicsFRCQ34nw4r2ut4RectRC9_GXTexObj8_GXColorUcQ43ipl7utility8Graphics11Orientation
L_813F9F68:
subi r31, r31, 0x8
cmplw r31, r30
bge L_813F9EA8
L_813F9F74:
lwz r3, 0x1c(r1)
lwz r4, 0x18(r1)
lwz r5, 0x14(r1)
lwz r6, 0x10(r1)
bl GXSetScissor
psq_l f31, 0x118(r1), 0, 0
lfd f31, 0x110(r1)
psq_l f30, 0x108(r1), 0, 0
lfd f30, 0x100(r1)
psq_l f29, 0xf8(r1), 0, 0
lfd f29, 0xf0(r1)
psq_l f28, 0xe8(r1), 0, 0
lfd f28, 0xe0(r1)
psq_l f27, 0xd8(r1), 0, 0
addi r11, r1, 0xd0
lfd f27, 0xd0(r1)
bl _restgpr_27
lwz r0, 0x124(r1)
mtlr r0
addi r1, r1, 0x120
blr
void SensitivityDrawing::draw(nand::File* texture) {
GXRenderModeObj renderMode = *System::getRenderModeObj();
nw4r::ut::Rect projection;
System::getProjectionRect(&projection);
GXColor background = {96, 96, 96, 192};
u32 scissorX, scissorY, scissorWidth, scissorHeight;
GXGetScissor(&scissorX, &scissorY, &scissorWidth, &scissorHeight);
f32 projectionWidth = projection.GetWidth();
f32 projectionHeight = projection.GetHeight();
f32 halfWidth = 0.5f * projectionWidth;
f32 scaleX = renderMode.fbWidth / projectionWidth;
f32 scaleY = renderMode.efbHeight / projectionHeight;
f32 halfHeight = 0.5f * projectionHeight;
utility::Graphics::setDefaultOrtho(0);
projectionHeight = projection.GetHeight();
projectionWidth = projection.GetWidth();
GXSetScissor(scaleX * (0.5f * projection.left + halfWidth),
scaleY * (-45.0f + (0.5f * projection.top + halfHeight)),
scaleX * (0.5f * projectionWidth),
scaleY * (0.5f * projectionHeight));
utility::Graphics::drawPolygon(projection, background);
controller::Interface* controller = System::getYoungController();
if (controller != NULL && controller->getKPADStatus() != NULL) {
GXTexObj image;
TPLGetGXTexObjFromPalette((TPLPalette*)texture->getBuffer(), &image, 1);
GXInitTexObjWrapMode(&image, GX_MIRROR, GX_MIRROR);
f32 width = projection.GetWidth();
f32 height = projection.GetHeight();
f32 horizontalScale = (0.5f * width) / 1024.0f;
f32 verticalScale = (0.5f * height) / 768.0f;
int sample = WPADGetLatestIndexInBuf(controller->getChannel());
DPDObject* object;
DPDObject* first;
switch (controller->getType()) {
case 0: {
WPADStatus* status = KPADGetWPADRingBuffer(controller->getChannel()) + sample;
object = &status->obj[3];
first = &status->obj[0];
break;
}
case 1: {
WPADFSStatus* status = KPADGetWPADFSRingBuffer(controller->getChannel()) + sample;
object = &status->obj[3];
first = &status->obj[0];
break;
}
case 2: {
WPADCLStatus* status = KPADGetWPADCLRingBuffer(controller->getChannel()) + sample;
object = &status->obj[3];
first = &status->obj[0];
break;
}
}
do {
if (object->size != 0) {
f32 radius = 0.15f * (object->size + 25);
f32 x = (object->x - 512) * horizontalScale;
f32 y = (object->y - 384) * verticalScale;
GXColor foreground = {255, 255, 255, 255};
nw4r::ut::Rect rectangle(x - radius, -y + radius - -45.0f,
x + radius, -y - radius - -45.0f);
utility::Graphics::drawTexture(rectangle, image, foreground, 2, utility::Graphics::ORI_NONE);
}
} while (--object >= first);
}
GXSetScissor(scissorX, scissorY, scissorWidth, scissorHeight);
}
}