Compare commits

..

4 Commits

Author SHA1 Message Date
coah
96d9867915 continue odh matching 2026-09-28 20:39:41 +00:00
coah
e648cfd25b name odh codec variables 2026-09-28 20:39:41 +00:00
coah
d387e2b42c continue odh matching 2026-09-28 20:39:41 +00:00
coah
e65e9d06cd wip: salvage uncommitted luna worktree state 2026-09-28 20:39:41 +00:00
52 changed files with 3204 additions and 22860 deletions

View File

@@ -37,16 +37,11 @@ src/system/iplSystem.cpp:
.sdata start:0x81696060 end:0x81696080
src/system/iplController.cpp:
.text start:0x81335CCC end:0x81337318
.text start:0x81335CCC end:0x81337978
.rodata start:0x8160D2C0 end:0x8160D2D0
.data start:0x816346A8 end:0x81634910
.sdata2 start:0x81694440 end:0x81694478
.data start:0x816346A8 end:0x81634A28
.sdata2 start:0x81694440 end:0x81694490
.sdata start:0x81696080 end:0x81696088
src/system/iplControllerManager.cpp:
.text start:0x81337318 end:0x81337978
.data start:0x81634910 end:0x81634A28
.sdata2 start:0x81694478 end:0x81694490
.sbss start:0x81698680 end:0x81698690
src/system/iplChannelManager.cpp:

View File

@@ -4558,44 +4558,44 @@ __ct__Q33ipl5scene15SDChannelSelectFPQ23EGG4Heap = .text:0x813DAB08; // type:fun
__dt__Q33ipl5scene15SDChannelSelectFv = .text:0x813DAE7C; // type:function size:0x5C
prepare__Q33ipl5scene15SDChannelSelectFv = .text:0x813DAED8; // type:function size:0xA8
create__Q33ipl5scene15SDChannelSelectFv = .text:0x813DAF80; // type:function size:0x248
enqueueStartNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB1C8; // type:function size:0x44
enqueueFinishNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB20C; // type:function size:0x48
enqueueNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB254; // type:function size:0xB4
enqueueLoadNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB308; // type:function size:0x5C
enqueuePageNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB364; // type:function size:0x5C
enqueueResultNotice__Q33ipl5scene15SDChannelSelectFUl = .text:0x813DB3C0; // type:function size:0x5C
enqueueChannelNotice__Q33ipl5scene15SDChannelSelectFUlUlUlUl = .text:0x813DB41C; // type:function size:0x5C
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB478; // type:function size:0x5C
enqueueStateNotice__Q33ipl5scene15SDChannelSelectFUlUlUlUl = .text:0x813DB4D4; // type:function size:0x5C
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DB530; // type:function size:0x5C
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB58C; // type:function size:0x60
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB5EC; // type:function size:0x60
clearCommandQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB64C; // type:function size:0x40
clearNoticeQueue__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB68C; // type:function size:0x40
processWorkerCommands__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB6CC; // type:function size:0x518
handleWorkerStartup__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBBE4; // type:function size:0xB0
handleNandTitleCount__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBC94; // type:function size:0xB8
handleNandTitleUsageComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBD4C; // type:function size:0x48
handleNandTitleUsage__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBD94; // type:function size:0xD8
compareTitleUsage__Q33ipl5scene15SDChannelSelectFPCvPCv = .text:0x813DBE6C; // type:function size:0x28
handleSDTitleList__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBE94; // type:function size:0x124
compareTitleInfo__Q33ipl5scene15SDChannelSelectFPCvPCv = .text:0x813DBFB8; // type:function size:0x28
handleSDTitleListResult__Q33ipl5scene15SDChannelSelectFv = .text:0x813DBFE0; // type:function size:0x2AC
handleSDMountComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC28C; // type:function size:0x64
handleSDChannelUpdateComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC2F0; // type:function size:0x1B0
handleSDCardReady__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC4A0; // type:function size:0x5C
handleCardCommand__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC4FC; // type:function size:0x78
handleCopyComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC574; // type:function size:0x80
handleSDLocationUpdateComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC5F4; // type:function size:0x48
handleSDLocationReadComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC63C; // type:function size:0x48
handleMoveComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC684; // type:function size:0x90
handleBackupFitComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC714; // type:function size:0x48
handleNandSDCleanupComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC75C; // type:function size:0x48
handleSDDeleteComplete__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC7A4; // type:function size:0x48
updateChannelNotices__Q33ipl5scene15SDChannelSelectFii = .text:0x813DC7EC; // type:function size:0x14C
processWorkerState__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC938; // type:function size:0x18C
updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // type:function size:0x42C
setDialogMessage__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DCEF0; // type:function size:0x24
iplSDChannelSelect_813DB1C8 = .text:0x813DB1C8; // type:function size:0x44
iplSDChannelSelect_813DB20C = .text:0x813DB20C; // type:function size:0x48
iplSDChannelSelect_813DB254 = .text:0x813DB254; // type:function size:0xB4
iplSDChannelSelect_813DB308 = .text:0x813DB308; // type:function size:0x5C
iplSDChannelSelect_813DB364 = .text:0x813DB364; // type:function size:0x5C
iplSDChannelSelect_813DB3C0 = .text:0x813DB3C0; // type:function size:0x5C
iplSDChannelSelect_813DB41C = .text:0x813DB41C; // type:function size:0x5C
iplSDChannelSelect_813DB478 = .text:0x813DB478; // type:function size:0x5C
iplSDChannelSelect_813DB4D4 = .text:0x813DB4D4; // type:function size:0x5C
iplSDChannelSelect_813DB530 = .text:0x813DB530; // type:function size:0x5C
iplSDChannelSelect_813DB58C = .text:0x813DB58C; // type:function size:0x60
iplSDChannelSelect_813DB5EC = .text:0x813DB5EC; // type:function size:0x60
iplSDChannelSelect_813DB64C = .text:0x813DB64C; // type:function size:0x40
iplSDChannelSelect_813DB68C = .text:0x813DB68C; // type:function size:0x40
iplSDChannelSelect_813DB6CC = .text:0x813DB6CC; // type:function size:0x518
iplSDChannelSelect_813DBBE4 = .text:0x813DBBE4; // type:function size:0xB0
iplSDChannelSelect_813DBC94 = .text:0x813DBC94; // type:function size:0xB8
iplSDChannelSelect_813DBD4C = .text:0x813DBD4C; // type:function size:0x48
iplSDChannelSelect_813DBD94 = .text:0x813DBD94; // type:function size:0xD8
iplSDChannelSelect_813DBE6C = .text:0x813DBE6C; // type:function size:0x28
iplSDChannelSelect_813DBE94 = .text:0x813DBE94; // type:function size:0x124
iplSDChannelSelect_813DBFB8 = .text:0x813DBFB8; // type:function size:0x28
iplSDChannelSelect_813DBFE0 = .text:0x813DBFE0; // type:function size:0x2AC
iplSDChannelSelect_813DC28C = .text:0x813DC28C; // type:function size:0x64
iplSDChannelSelect_813DC2F0 = .text:0x813DC2F0; // type:function size:0x1B0
iplSDChannelSelect_813DC4A0 = .text:0x813DC4A0; // type:function size:0x5C
iplSDChannelSelect_813DC4FC = .text:0x813DC4FC; // type:function size:0x78
iplSDChannelSelect_813DC574 = .text:0x813DC574; // type:function size:0x80
iplSDChannelSelect_813DC5F4 = .text:0x813DC5F4; // type:function size:0x48
iplSDChannelSelect_813DC63C = .text:0x813DC63C; // type:function size:0x48
iplSDChannelSelect_813DC684 = .text:0x813DC684; // type:function size:0x90
iplSDChannelSelect_813DC714 = .text:0x813DC714; // type:function size:0x48
iplSDChannelSelect_813DC75C = .text:0x813DC75C; // type:function size:0x48
iplSDChannelSelect_813DC7A4 = .text:0x813DC7A4; // type:function size:0x48
iplSDChannelSelect_813DC7EC = .text:0x813DC7EC; // type:function size:0x14C
iplSDChannelSelect_813DC938 = .text:0x813DC938; // type:function size:0x18C
iplSDChannelSelect_813DCAC4 = .text:0x813DCAC4; // type:function size:0x42C
iplSDChannelSelect_813DCEF0 = .text:0x813DCEF0; // type:function size:0x24
iplSDChannelSelect_813DCF14 = .text:0x813DCF14; // type:function size:0xCC
iplSDChannelSelect_813DCFE0 = .text:0x813DCFE0; // type:function size:0xCC
iplSDChannelSelect_813DD0AC = .text:0x813DD0AC; // type:function size:0x194
@@ -4619,31 +4619,31 @@ initCalcFadeout__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE24C; // type:fun
calcFadeout__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE2EC; // type:function size:0x50
draw__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE33C; // type:function size:0x38C
destroy__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE6C8; // type:function size:0x334
createBaseLayout__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE9FC; // type:function size:0x440
updateChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DEE3C; // type:function size:0x5C
updateChannelObject__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene12SDChannelObj = .text:0x813DEE98; // type:function size:0x78
calcChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DEF10; // type:function size:0x58
iplSDChannelSelect_813DE9FC = .text:0x813DE9FC; // type:function size:0x440
iplSDChannelSelect_813DEE3C = .text:0x813DEE3C; // type:function size:0x5C
iplSDChannelSelect_813DEE98 = .text:0x813DEE98; // type:function size:0x78
iplSDChannelSelect_813DEF10 = .text:0x813DEF10; // type:function size:0x58
iplSDChannelSelect_813DEF68 = .text:0x813DEF68; // type:function size:0x27C
iplSDChannelSelect_813DF1E4 = .text:0x813DF1E4; // type:function size:0x14
drawChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF1F8; // type:function size:0xB0
iplSDChannelSelect_813DF1F8 = .text:0x813DF1F8; // type:function size:0xB0
iplSDChannelSelect_813DF2A8 = .text:0x813DF2A8; // type:function size:0x138
iplSDChannelSelect_813DF3E0 = .text:0x813DF3E0; // type:function size:0x1C
iplSDChannelSelect_813DF3FC = .text:0x813DF3FC; // type:function size:0x110
iplSDChannelSelect_813DF50C = .text:0x813DF50C; // type:function size:0x4C
iplSDChannelSelect_813DF558 = .text:0x813DF558; // type:function size:0x178
iplSDChannelSelect_813DF6D0 = .text:0x813DF6D0; // type:function size:0x164
createChannelList__Q33ipl5scene15SDChannelSelectFib = .text:0x813DF834; // type:function size:0x110
createChannelObject__Q33ipl5scene15SDChannelSelectFii = .text:0x813DF944; // type:function size:0x84
destroyUnusedChannelObjects__Q33ipl5scene15SDChannelSelectFiPQ33ipl5scene12SDChannelObj = .text:0x813DF9C8; // type:function size:0xF8
refreshChannelList__Q33ipl5scene15SDChannelSelectFv = .text:0x813DFAC0; // type:function size:0xFC
refreshAfterSDTitleList__Q33ipl5scene15SDChannelSelectFv = .text:0x813DFBBC; // type:function size:0xE4
destroyChannelObject__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene12SDChannelObj = .text:0x813DFCA0; // type:function size:0x50
iplSDChannelSelect_813DF834 = .text:0x813DF834; // type:function size:0x110
iplSDChannelSelect_813DF944 = .text:0x813DF944; // type:function size:0x84
iplSDChannelSelect_813DF9C8 = .text:0x813DF9C8; // type:function size:0xF8
iplSDChannelSelect_813DFAC0 = .text:0x813DFAC0; // type:function size:0xFC
iplSDChannelSelect_813DFBBC = .text:0x813DFBBC; // type:function size:0xE4
iplSDChannelSelect_813DFCA0 = .text:0x813DFCA0; // type:function size:0x50
iplSDChannelSelect_813DFCF0 = .text:0x813DFCF0; // type:function size:0x74
iplSDChannelSelect_813DFD64 = .text:0x813DFD64; // type:function size:0x154
findChannelObject__Q33ipl5scene15SDChannelSelectCFii = .text:0x813DFEB8; // type:function size:0x74
iplSDChannelSelect_813DFEB8 = .text:0x813DFEB8; // type:function size:0x74
iplSDChannelSelect_813DFF2C = .text:0x813DFF2C; // type:function size:0x1C0
hasChannelObject__Q33ipl5scene15SDChannelSelectCFii = .text:0x813E00EC; // type:function size:0x140
isChannelInCalc__Q33ipl5scene15SDChannelSelectCFiii = .text:0x813E022C; // type:function size:0x68
iplSDChannelSelect_813E00EC = .text:0x813E00EC; // type:function size:0x140
iplSDChannelSelect_813E022C = .text:0x813E022C; // type:function size:0x68
iplSDChannelSelect_813E0294 = .text:0x813E0294; // type:function size:0x104
iplSDChannelSelect_813E0398 = .text:0x813E0398; // type:function size:0x18
iplSDChannelSelect_813E03B0 = .text:0x813E03B0; // type:function size:0xA0
@@ -4651,13 +4651,13 @@ iplSDChannelSelect_813E0450 = .text:0x813E0450; // type:function size:0xEC
iplSDChannelSelect_813E053C = .text:0x813E053C; // type:function size:0x84
iplSDChannelSelect_813E05C0 = .text:0x813E05C0; // type:function size:0x64
iplSDChannelSelect_813E0624 = .text:0x813E0624; // type:function size:0xB4
getChannelBasePane__Q33ipl5scene15SDChannelSelectCFiii = .text:0x813E06D8; // type:function size:0xAC
getCenterChannelPane__Q33ipl5scene15SDChannelSelectCFi = .text:0x813E0784; // type:function size:0x30
getChannelPane__Q33ipl5scene15SDChannelSelectCFi = .text:0x813E07B4; // type:function size:0x30
getChannelPanePosition__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene15SDChannelSelecti = .text:0x813E07E4; // type:function size:0x64
iplSDChannelSelect_813E06D8 = .text:0x813E06D8; // type:function size:0xAC
iplSDChannelSelect_813E0784 = .text:0x813E0784; // type:function size:0x30
iplSDChannelSelect_813E07B4 = .text:0x813E07B4; // type:function size:0x30
iplSDChannelSelect_813E07E4 = .text:0x813E07E4; // type:function size:0x64
iplSDChannelSelect_813E0848 = .text:0x813E0848; // type:function size:0x3A4
iplSDChannelSelect_813E0BEC = .text:0x813E0BEC; // type:function size:0x294
calcPageAnimations__Q33ipl5scene15SDChannelSelectFv = .text:0x813E0E80; // type:function size:0x60
iplSDChannelSelect_813E0E80 = .text:0x813E0E80; // type:function size:0x60
iplSDChannelSelect_813E0EE0 = .text:0x813E0EE0; // type:function size:0x26C
iplSDChannelSelect_813E114C = .text:0x813E114C; // type:function size:0x78
iplSDChannelSelect_813E11C4 = .text:0x813E11C4; // type:function size:0x3A4
@@ -4678,10 +4678,10 @@ iplSDChannelSelect_813E2750 = .text:0x813E2750; // type:function size:0x164
iplSDChannelSelect_813E28B4 = .text:0x813E28B4; // type:function size:0x2A0
iplSDChannelSelect_813E2B54 = .text:0x813E2B54; // type:function size:0x240
startResetting__Q33ipl5scene15SDChannelSelectFv = .text:0x813E2D94; // type:function size:0x44
pop__Q33ipl5scene26SDChannelSelectNoticeQueueFv = .text:0x813E2DD8; // type:function size:0x4C
push__Q33ipl5scene27SDChannelSelectCommandQueueFRCQ33ipl5scene22SDChannelSelectCommand = .text:0x813E2E24; // type:function size:0x80
pop__Q33ipl5scene27SDChannelSelectCommandQueueFv = .text:0x813E2EA4; // type:function size:0x4C
copyFrom__Q33ipl5scene22SDChannelSelectCommandFRCQ33ipl5scene22SDChannelSelectCommand = .text:0x813E2EF0; // type:function size:0x34
iplSDChannelSelect_813E2DD8 = .text:0x813E2DD8; // type:function size:0x4C
iplSDChannelSelect_813E2E24 = .text:0x813E2E24; // type:function size:0x80
iplSDChannelSelect_813E2EA4 = .text:0x813E2EA4; // type:function size:0x4C
iplSDChannelSelect_813E2EF0 = .text:0x813E2EF0; // type:function size:0x34
@20@__dt__Q33ipl5scene15SDChannelSelectFv = .text:0x813E2F24; // type:function size:0x8
__ct__Q33ipl5scene12SDChannelObjFPQ23EGG4Heapii = .text:0x813E2F2C; // type:function size:0x130
__dt__Q33ipl5scene12SDChannelObjFv = .text:0x813E305C; // type:function size:0xA8
@@ -4837,56 +4837,56 @@ onEvent__Q33ipl5scene22SDMenuEventHandlerBaseFUlUlPv = .text:0x813EB51C; // type
onEventDerived__Q33ipl5scene22SDMenuEventHandlerBaseFUlUlPCQ33ipl10controller9Interface = .text:0x813EB5E8; // type:function size:0x4
__ct__Q33ipl5scene8SDMemoryFv = .text:0x813EB5EC; // type:function size:0x48
__dt__Q33ipl5scene8SDMemoryFv = .text:0x813EB634; // type:function size:0x5C
create__Q33ipl5scene8SDMemoryFPQ23EGG4HeapPQ33ipl4nand10LayoutFilePQ33ipl5scene17NandSDCardManager = .text:0x813EB690; // type:function size:0x10A0
setTitleLists__Q33ipl5scene8SDMemoryFRCQ43ipl5scene8SDMemory10TitleRangeRCQ43ipl5scene8SDMemory10TitleRange = .text:0x813EC730; // type:function size:0xD4
setScrollLimit__Q33ipl5scene8SDMemoryFv = .text:0x813EC804; // type:function size:0x144
init__Q33ipl7utility8ScrollerFv = .text:0x813EC948; // type:function size:0x20
resetScrollArrows__Q33ipl5scene8SDMemoryFv = .text:0x813EC968; // type:function size:0x84
updateScrollArrows__Q33ipl5scene8SDMemoryFUlUlUlUl = .text:0x813EC9EC; // type:function size:0x9C
showDownArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECA88; // type:function size:0x74
showUpArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECAFC; // type:function size:0x74
hideDownArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECB70; // type:function size:0x78
hideUpArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECBE8; // type:function size:0x78
updateSideArrows__Q33ipl5scene8SDMemoryFv = .text:0x813ECC60; // type:function size:0x160
showLeftArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECDC0; // type:function size:0x60
showRightArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECE20; // type:function size:0x60
hideLeftArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECE80; // type:function size:0x64
hideRightArrow__Q33ipl5scene8SDMemoryFv = .text:0x813ECEE4; // type:function size:0x64
resetDialogPaneAnimations__Q33ipl5scene8SDMemoryFv = .text:0x813ECF48; // type:function size:0x13C
calc__Q33ipl5scene8SDMemoryFv = .text:0x813ED084; // type:function size:0x268
updateState__Q33ipl5scene8SDMemoryFv = .text:0x813ED2EC; // type:function size:0x4CC
onDialogState0__Q33ipl5scene8SDMemoryFv = .text:0x813ED7B8; // type:function size:0xA4
onDialogState2__Q33ipl5scene8SDMemoryFv = .text:0x813ED85C; // type:function size:0xC4
onDialogState3__Q33ipl5scene8SDMemoryFv = .text:0x813ED920; // type:function size:0x124
onDialogState4__Q33ipl5scene8SDMemoryFv = .text:0x813EDA44; // type:function size:0x110
onDialogState6__Q33ipl5scene8SDMemoryFv = .text:0x813EDB54; // type:function size:0x78
onDialogState7__Q33ipl5scene8SDMemoryFv = .text:0x813EDBCC; // type:function size:0xC0
onDialogState8__Q33ipl5scene8SDMemoryFv = .text:0x813EDC8C; // type:function size:0x278
onDialogState9__Q33ipl5scene8SDMemoryFv = .text:0x813EDF04; // type:function size:0xA4
onDialogState10__Q33ipl5scene8SDMemoryFv = .text:0x813EDFA8; // type:function size:0x130
onDialogState11__Q33ipl5scene8SDMemoryFv = .text:0x813EE0D8; // type:function size:0xE0
onDialogState12__Q33ipl5scene8SDMemoryFv = .text:0x813EE1B8; // type:function size:0x1A0
iplSDMemory_813EB690 = .text:0x813EB690; // type:function size:0x10A0
iplSDMemory_813EC730 = .text:0x813EC730; // type:function size:0xD4
iplSDMemory_813EC804 = .text:0x813EC804; // type:function size:0x144
iplSDMemory_813EC948 = .text:0x813EC948; // type:function size:0x20
iplSDMemory_813EC968 = .text:0x813EC968; // type:function size:0x84
iplSDMemory_813EC9EC = .text:0x813EC9EC; // type:function size:0x9C
iplSDMemory_813ECA88 = .text:0x813ECA88; // type:function size:0x74
iplSDMemory_813ECAFC = .text:0x813ECAFC; // type:function size:0x74
iplSDMemory_813ECB70 = .text:0x813ECB70; // type:function size:0x78
iplSDMemory_813ECBE8 = .text:0x813ECBE8; // type:function size:0x78
iplSDMemory_813ECC60 = .text:0x813ECC60; // type:function size:0x160
iplSDMemory_813ECDC0 = .text:0x813ECDC0; // type:function size:0x60
iplSDMemory_813ECE20 = .text:0x813ECE20; // type:function size:0x60
iplSDMemory_813ECE80 = .text:0x813ECE80; // type:function size:0x64
iplSDMemory_813ECEE4 = .text:0x813ECEE4; // type:function size:0x64
iplSDMemory_813ECF48 = .text:0x813ECF48; // type:function size:0x13C
iplSDMemory_813ED084 = .text:0x813ED084; // type:function size:0x268
iplSDMemory_813ED2EC = .text:0x813ED2EC; // type:function size:0x4CC
iplSDMemory_813ED7B8 = .text:0x813ED7B8; // type:function size:0xA4
iplSDMemory_813ED85C = .text:0x813ED85C; // type:function size:0xC4
iplSDMemory_813ED920 = .text:0x813ED920; // type:function size:0x124
iplSDMemory_813EDA44 = .text:0x813EDA44; // type:function size:0x110
iplSDMemory_813EDB54 = .text:0x813EDB54; // type:function size:0x78
iplSDMemory_813EDBCC = .text:0x813EDBCC; // type:function size:0xC0
iplSDMemory_813EDC8C = .text:0x813EDC8C; // type:function size:0x278
iplSDMemory_813EDF04 = .text:0x813EDF04; // type:function size:0xA4
iplSDMemory_813EDFA8 = .text:0x813EDFA8; // type:function size:0x130
iplSDMemory_813EE0D8 = .text:0x813EE0D8; // type:function size:0xE0
iplSDMemory_813EE1B8 = .text:0x813EE1B8; // type:function size:0x1A0
iplSDMemory_813EE358 = .text:0x813EE358; // type:function size:0x44
onDialogState13__Q33ipl5scene8SDMemoryFv = .text:0x813EE39C; // type:function size:0xEC
onDialogState14__Q33ipl5scene8SDMemoryFv = .text:0x813EE488; // type:function size:0x1C4
onDialogState15__Q33ipl5scene8SDMemoryFv = .text:0x813EE64C; // type:function size:0x12C
onDialogState16__Q33ipl5scene8SDMemoryFv = .text:0x813EE778; // type:function size:0xA0
onDialogState17__Q33ipl5scene8SDMemoryFv = .text:0x813EE818; // type:function size:0x128
onDialogState18__Q33ipl5scene8SDMemoryFv = .text:0x813EE940; // type:function size:0xE8
onDialogState19__Q33ipl5scene8SDMemoryFv = .text:0x813EEA28; // type:function size:0x84
onDialogState20__Q33ipl5scene8SDMemoryFv = .text:0x813EEAAC; // type:function size:0xE8
onDialogState21__Q33ipl5scene8SDMemoryFv = .text:0x813EEB94; // type:function size:0x148
onDialogState22__Q33ipl5scene8SDMemoryFv = .text:0x813EECDC; // type:function size:0x11C
onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function size:0x78
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
iplSDMemory_813EE39C = .text:0x813EE39C; // type:function size:0xEC
iplSDMemory_813EE488 = .text:0x813EE488; // type:function size:0x1C4
iplSDMemory_813EE64C = .text:0x813EE64C; // type:function size:0x12C
iplSDMemory_813EE778 = .text:0x813EE778; // type:function size:0xA0
iplSDMemory_813EE818 = .text:0x813EE818; // type:function size:0x128
iplSDMemory_813EE940 = .text:0x813EE940; // type:function size:0xE8
iplSDMemory_813EEA28 = .text:0x813EEA28; // type:function size:0x84
iplSDMemory_813EEAAC = .text:0x813EEAAC; // type:function size:0xE8
iplSDMemory_813EEB94 = .text:0x813EEB94; // type:function size:0x148
iplSDMemory_813EECDC = .text:0x813EECDC; // type:function size:0x11C
iplSDMemory_813EEDF8 = .text:0x813EEDF8; // type:function size:0x78
iplSDMemory_813EEE70 = .text:0x813EEE70; // type:function size:0xC0
iplSDMemory_813EEF30 = .text:0x813EEF30; // type:function size:0x88
iplSDMemory_813EEFB8 = .text:0x813EEFB8; // type:function size:0x70C
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
iplSDMemory_813EF6C4 = .text:0x813EF6C4; // type:function size:0x14
iplSDMemory_813EF6D8 = .text:0x813EF6D8; // type:function size:0x48
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
iplSDMemory_813EF728 = .text:0x813EF728; // type:function size:0x8
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
getControlPaneIndex__Q33ipl5scene8SDMemoryFPCc = .text:0x813EF748; // type:function size:0x74
iplSDMemory_813EF748 = .text:0x813EF748; // type:function size:0x74
iplSDMemory_813EF7BC = .text:0x813EF7BC; // type:function size:0x128
iplSDMemory_813EF8E4 = .text:0x813EF8E4; // type:function size:0xF0
iplSDMemory_813EF9D4 = .text:0x813EF9D4; // type:function size:0x120
@@ -13835,8 +13835,8 @@ scAnmTable__10homebutton = .rodata:0x8160F378; // type:object size:0x60 scope:lo
scGroupAnmTable__10homebutton = .rodata:0x8160F3D8; // type:object size:0x250 scope:local data:4byte
__DVDErrorMessage = .rodata:0x8160F628; // type:object size:0x28
lbl_8160F650 = .rodata:0x8160F650; // type:object size:0x16 data:2byte
specials$18760 = .rodata:0x8160F668; // type:object size:0xB data:byte
@19145 = .rodata:0x8160F673; // type:object size:0xC data:byte
lbl_8160F668 = .rodata:0x8160F668; // type:object size:0xB data:byte
lbl_8160F673 = .rodata:0x8160F673; // type:object size:0xC data:byte
lbl_8160F67F = .rodata:0x8160F67F; // type:object size:0xD data:byte
lbl_8160F690 = .rodata:0x8160F690; // type:object size:0x18 data:2byte
scAnmFrame__Q23ipl5scene = .rodata:0x8160F6A8; // type:object size:0x20 scope:local
@@ -15435,46 +15435,26 @@ __vt__Q33ipl5scene7Address = .data:0x81647B70; // type:object size:0x120
@11177 = .data:0x81647D9A; // type:object size:0xF scope:local data:string
__vt__Q33ipl5scene18AddressAddSelEvent = .data:0x81647DAC; // type:object size:0x18
__vt__Q33ipl5scene13AddressAddSel = .data:0x81647DC4; // type:object size:0x88
@16959 = .data:0x81647EE0; // type:object size:0xD data:string
@16960 = .data:0x81647EED; // type:object size:0xD data:string
@16961 = .data:0x81647EFA; // type:object size:0xD data:string
@16962 = .data:0x81647F07; // type:object size:0xE data:string
@16963 = .data:0x81647F15; // type:object size:0xC data:string
sButtonPaneNames = .data:0x81647F24; // type:object size:0x14
@16964 = .data:0x81647F38; // type:object size:0xE data:string
@23886 = .data:0x81647F46; // type:object size:0xC data:string
@24207 = .data:0x81647F52; // type:object size:0x12 data:string
@24208 = .data:0x81647F64; // type:object size:0x1C data:string
@24209 = .data:0x81647F80; // type:object size:0xF data:string
@24210 = .data:0x81647F8F; // type:object size:0x19 data:string
@24211 = .data:0x81647FA8; // type:object size:0xB data:string
@24212 = .data:0x81647FB3; // type:object size:0xB data:string
@24213 = .data:0x81647FBE; // type:object size:0xB data:string
@24214 = .data:0x81647FC9; // type:object size:0xC data:string
@24215 = .data:0x81647FD5; // type:object size:0xE data:string
@24216 = .data:0x81647FE3; // type:object size:0x1A data:string
@24217 = .data:0x81647FFD; // type:object size:0x1A data:string
@24218 = .data:0x81648017; // type:object size:0x1D data:string
@24219 = .data:0x81648034; // type:object size:0x1E data:string
@24220 = .data:0x81648052; // type:object size:0xC data:string
@24221 = .data:0x8164805E; // type:object size:0x22 data:string
@24222 = .data:0x81648080; // type:object size:0x9 data:string
@24223 = .data:0x81648089; // type:object size:0x23 data:string
@24224 = .data:0x816480AC; // type:object size:0x1C data:string
@24225 = .data:0x816480C8; // type:object size:0xD data:string
@24226 = .data:0x816480D5; // type:object size:0xD data:string
@24227 = .data:0x816480E2; // type:object size:0xD data:string
@24228 = .data:0x816480EF; // type:object size:0xE data:string
@24229 = .data:0x816480FD; // type:object size:0xE data:string
@24231 = .data:0x8164810B; // type:object size:0x1F5
@25188 = .data:0x81648300; // type:object size:0xC0 scope:local
@25187 = .data:0x816483C0; // type:object size:0xC0 scope:local
@25711 = .data:0x8164848D; // type:object size:0x16 data:string
@25835 = .data:0x816484A3; // type:object size:0xF data:string
@25838 = .data:0x816484B4; // type:object size:0x44 scope:local
@26007 = .data:0x81648508; // type:object size:0x58 scope:local
@26006 = .data:0x81648560; // type:object size:0x8C scope:local
@26030 = .data:0x816485EC; // type:object size:0xC data:wstring
lbl_81647EE0 = .data:0x81647EE0; // type:object size:0xD data:string
lbl_81647EED = .data:0x81647EED; // type:object size:0xD data:string
lbl_81647EFA = .data:0x81647EFA; // type:object size:0xD data:string
lbl_81647F07 = .data:0x81647F07; // type:object size:0xE data:string
lbl_81647F15 = .data:0x81647F15; // type:object size:0xC data:string
lbl_81647F24 = .data:0x81647F24; // type:object size:0x14
lbl_81647F38 = .data:0x81647F38; // type:object size:0xE data:string
lbl_81647F46 = .data:0x81647F46; // type:object size:0x83
lbl_81647FC9 = .data:0x81647FC9; // type:object size:0xC data:string
lbl_81647FD5 = .data:0x81647FD5; // type:object size:0x128
lbl_816480FD = .data:0x816480FD; // type:object size:0xE data:string
lbl_8164810B = .data:0x8164810B; // type:object size:0x1F5
jumptable_81648300 = .data:0x81648300; // type:object size:0xC0 scope:local
jumptable_816483C0 = .data:0x816483C0; // type:object size:0xC0 scope:local
lbl_8164848D = .data:0x8164848D; // type:object size:0x16 data:string
lbl_816484A3 = .data:0x816484A3; // type:object size:0xF data:string
jumptable_816484B4 = .data:0x816484B4; // type:object size:0x44 scope:local
jumptable_81648508 = .data:0x81648508; // type:object size:0x58 scope:local
jumptable_81648560 = .data:0x81648560; // type:object size:0x8C scope:local
lbl_816485EC = .data:0x816485EC; // type:object size:0xC data:wstring
__vt__Q33ipl5scene17AddressInputEvent = .data:0x816485F8; // type:object size:0x18
__vt__Q33ipl5scene16AddressEditEvent = .data:0x81648610; // type:object size:0x18
__vt__Q33ipl5scene11AddressEdit = .data:0x81648628; // type:object size:0x120
@@ -21711,7 +21691,7 @@ lbl_816965C4 = .sdata:0x816965C4; // type:object size:0x6 data:string
lbl_816965CA = .sdata:0x816965CA; // type:object size:0x4
smButtonName__Q33ipl5scene13AddressAddSel = .sdata:0x816965D0; // type:object size:0x8
@10971 = .sdata:0x816965D8; // type:object size:0x4 scope:local data:string
sInputPaneName = .sdata:0x816965E0; // type:object size:0x4 data:4byte
lbl_816965E0 = .sdata:0x816965E0; // type:object size:0x4 data:4byte
lbl_816965E4 = .sdata:0x816965E4; // type:object size:0x4 data:string
lbl_816965E8 = .sdata:0x816965E8; // type:object size:0x2
lbl_816965EA = .sdata:0x816965EA; // type:object size:0x6 data:string

View File

@@ -624,8 +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(Matching, "system/iplControllerManager.cpp"),
Object(NonMatching, "system/iplController.cpp"),
Object(Matching, "system/iplChannelManager.cpp"),
Object(Matching, "system/iplChannelScriptManager.cpp"),
Object(Matching, "system/iplNand.cpp"),
@@ -654,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"),
@@ -739,7 +738,7 @@ config.libs = [
),
IPLSection("board", [
Object(Equivalent, "scene/board/iplBoard.cpp"),
Object(Matching, "scene/board/iplBoardObject.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"),
@@ -1041,7 +1040,7 @@ config.libs = [
]
),
RevoEXLib("net", [
Object(Matching, "net/nettime.c"),
Object(NonMatching, "net/nettime.c"),
Object(Matching, "net/crc.c"),
Object(NonMatching, "net/md5.c"),
Object(NonMatching, "net/sha1.c"),
@@ -1083,7 +1082,7 @@ config.libs = [
Object(NonMatching, "nwc24/NWC24MsgRead.c"),
Object(NonMatching, "nwc24/NWC24MsgSubject.c"),
Object(Matching, "nwc24/NWC24Schedule.c"),
Object(Matching, "nwc24/NWC24DateParser.c"),
Object(NonMatching, "nwc24/NWC24DateParser.c"),
Object(Matching, "nwc24/NWC24FriendList.c"),
Object(Matching, "nwc24/NWC24SecretFList.c"),
Object(Matching, "nwc24/NWC24UserId.c"),
@@ -1707,7 +1706,7 @@ config.libs = [
Object(NonMatching, "fa/pf_volume.c"),
Object(NonMatching, "fa/pf_volume_apiadd.c"),
Object(NonMatching, "fa/pf_cp932.c"),
Object(Matching, "fa/pf_api_util.c"),
Object(NonMatching, "fa/pf_api_util.c"),
Object(NonMatching, "fa/pf_attach.c"),
Object(NonMatching, "fa/pf_buffering.c"),
Object(NonMatching, "fa/pf_cdelete.c"),
@@ -1774,7 +1773,7 @@ config.libs = [
Object(NonMatching, "fa/pf_unmount.c"),
Object(NonMatching, "fa/pf_unregctx.c"),
Object(NonMatching, "fa/pf_xdivide.c"),
Object(Matching, "fa/pf_w_api_util.c"),
Object(NonMatching, "fa/pf_w_api_util.c"),
Object(NonMatching, "fa/pf_w_cdelete.c"),
Object(NonMatching, "fa/pf_w_chdir.c"),
Object(NonMatching, "fa/pf_w_chdmod.c"),

View File

@@ -67,9 +67,6 @@ namespace textinput {
virtual void setAspectRatio(bool b4x3);
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
#ifdef IPL_ADDRESS_EDIT_CPP
void enableKSXFilter(bool compatibleFilter);
#endif
virtual void setDefaultPredictionJP(int num, const char** predicts);
virtual void setFixedPredictionJP(int num, const char** predicts);

View File

@@ -180,11 +180,7 @@ namespace ipl {
/*** TODO: These always generate a weak. Try and make them not do that. ***/
const nw4r::ut::Rect getTextDrawRect(const nw4r::lyt::TextBox* textBox) const { return textBox->GetTextDrawRect(mDrawInfo); }
#ifdef IPL_SDMEMORY_GET_TEXT_DRAW_RECT_OUT_OF_LINE
const nw4r::ut::Rect getTextDrawRect(const char* paneName) const;
#else
const nw4r::ut::Rect getTextDrawRect(const char* paneName) const { return getTextDrawRect(nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mLayout.GetRootPane()->FindPaneByName(paneName))); }
#endif
const nw4r::ut::Rect getPaneRect(nw4r::lyt::Pane* pane) const { return pane->GetPaneRect(mDrawInfo); }
const nw4r::ut::Rect getPaneRect(const char* paneName) const { return getPaneRect(mLayout.GetRootPane()->FindPaneByName(paneName)); }

View File

@@ -12,9 +12,6 @@ namespace ipl {
template <typename T>
class Interporation : public utility::FrameController {
public:
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
virtual ~Interporation();
#endif
void init(int playback, f32 maxFrame, f32 minFrame, const T& start, const T& end, f32 speed = 1.0f) {
mStart = start;
mEnd = end;
@@ -37,9 +34,6 @@ namespace ipl {
template <typename T>
class LinearIntp : public Interporation<T> {
public:
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
virtual ~LinearIntp();
#endif
T get() const {
T r = mEnd * getCurrentFrame();
T b = mStart * (mMaxFrame - mFrame);

View File

@@ -35,10 +35,6 @@ namespace ipl {
return x;
}
}
#ifdef IPL_CONTROLLER_OUT_OF_LINE_ABS_CLAMP
template <>
f32 abs_clamp<f32>(const f32& x, const f32& y);
#endif
typedef struct MTX33 : public nw4r::math::MTX33 {
} MTX33;
@@ -59,27 +55,19 @@ namespace ipl {
x = r.x;
y = r.y;
}
#ifdef IPL_CONTROLLER_OUT_OF_LINE_VEC2
VEC2(f32 fx, f32 fy);
#else
VEC2(f32 fx, f32 fy) {
x = fx;
y = fy;
}
#endif
void operator=(const VEC2& r);
VEC2 operator*(f32 val) const { return VEC2(x * val, y * val); }
#ifdef IPL_CONTROLLER_OUT_OF_LINE_VEC2
void set(f32 fx, f32 fy);
#else
void set(f32 fx, f32 fy) {
x = fx;
y = fy;
}
#endif
void clear() {
y = 0;
@@ -103,15 +91,11 @@ namespace ipl {
y = r.y;
z = 0.0f;
}
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP)
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {
x = fx;
y = fy;
z = fz;
}
#endif
VEC3& operator+=(const VEC3& rhs) {
VEC3Add(this, this, &rhs);

View File

@@ -258,9 +258,6 @@ namespace ipl {
static const math::VEC2 smcPageOffset;
friend class AddressEvent;
#ifdef IPL_ADDRESS_EDIT_CPP
friend class AddressEdit;
#endif
};
class AddressEvent : public ::gui::EventHandler {

View File

@@ -2,128 +2,22 @@
#define IPL_SCENE_ADDRESS_EDIT_H
#include "iplSceneHeader.h"
#include "scene/button/iplButton.h"
#include <RFL_Types.h>
#include <revolution/nwc24.h>
namespace ipl {
namespace nigaoe {
class Object;
}
namespace scene {
class AddressEditEvent;
class AddressInputEvent;
class FriendListCache;
FADER_SCENE_CLASS(AddressEdit), public ButtonEventHandlerBase {
FADER_SCENE_CLASS(AddressEdit) {
public:
AddressEdit(EGG::Heap * heap, int friendCode);
virtual ~AddressEdit();
virtual void prepare();
virtual void create();
virtual void draw();
virtual void initCalcNormal();
virtual void initCalcFadeout();
virtual void calcCommonAfter();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
virtual void onEventDerived(u32 compId, u32 event, const controller::Interface* con);
void stt_msg_code_add();
void stt_msg_code_edit();
void stt_msg_parental();
void stt_msg_nwc24_error();
void reset_gui();
void start_point_event(const char* paneName, controller::Interface* controller);
void start_left_event(const char* paneName);
void start_trig_event(const char* paneName);
void start_ipt_point_event(const char* paneName, int channel);
void start_ipt_left_event(const char* paneName, int channel);
void start_ipt_trig_event(const char* paneName, int channel);
int get_button_no(const char*);
void add_friendinfo();
void delete_friendinfo();
void set_textbox(nw4r::lyt::Pane*, const wchar_t*);
void setDefaultTitleText(const wchar_t*, bool);
static void wiiid_utf16(u64, wchar_t*);
static void nigaoe_create_callback_add(ipl::nigaoe::Object*, void*);
static void nigaoe_create_callback_edit(ipl::nigaoe::Object*, void*);
void set_err_msg(wchar_t*, u32, NWC24Err);
void get_friendinfo();
static u64 utf16_wiiid(const wchar_t*);
void stt_add_code_fadein();
void stt_add_code_fadeout();
void stt_add_code_input();
void stt_add_code_normal();
void stt_add_confirm_fadein();
void stt_add_confirm_fadeout();
void stt_add_confirm_normal();
void stt_add_mii_fadein();
void stt_add_mii_fadeout();
void stt_add_mii_input();
void stt_add_mii_normal();
void stt_add_name_fadein();
void stt_add_name_fadeout();
void stt_add_name_input();
void stt_add_name_normal();
void stt_ipt_input();
void stt_ipt_normal();
void stt_ipt_wait_fadein();
void stt_ipt_wait_fadeout();
void stt_msg_add_rlt();
void stt_msg_code_invalid();
void stt_msg_del_rlt();
void stt_msg_dup_email();
void stt_msg_dup_wii_no();
void stt_msg_my_wii_no();
void stt_msg_net();
void stt_msg_no_established();
void stt_msg_no_mii();
void stt_msg_no_mii_add();
void stt_msg_wc();
void stt_select_mii();
void stt_wait_btn_fadein();
void stt_wait_btn_fadeout();
void stt_wait_del_msg_fadein();
void stt_wait_del_msg_fadeout();
void stt_wait_del_msg_fadeout_to_rlt();
void stt_wait_delete();
void stt_wait_decide_anm_add();
void stt_wait_parental();
void stt_wait_parental_dst();
void stt_wait_parental_dst_wc();
void stt_wait_parental_wc();
void stt_normal();
void stt_wait_decide_anm();
void update_friendinfo();
void requestSceneChange(int sceneId, void* args) { reserveSceneChange(sceneId, args); }
u32 getPreviousScene() const { return getPrevSceneID(); }
EGG::Heap* getHeap() { return getSceneHeap(); }
::gui::Manager* getGuiManager() { return mpManager; }
class String {
public:
void clear();
const wchar_t* getDispCodeLong() const;
void setName(const wchar_t* value);
void setEMail(const wchar_t* value);
void setWiiNo(const wchar_t* value);
BOOL isDupCode() const;
BOOL isMyCode() const;
wchar_t mValue[0x102];
wchar_t mName[0x0c];
wchar_t mDisplayText[0x102];
bool mbValidMail;
bool mbNameNotEmpty;
bool mbHasWiiNo;
AddressEdit* mpCallbackOwner;
};
enum {
@@ -131,27 +25,8 @@ namespace ipl {
SCENE_ADD_EMAIL,
};
int mState;
layout::Object* mpCodeLayout;
AddressEditEvent* mpEditEvent;
gui::PaneManager* mpEditGui;
layout::Object* mpNameLayout;
AddressInputEvent* mpInputEvent;
gui::PaneManager* mpInputGui;
layout::Object* mpBackgroundLayout;
int mMode;
int mSelectedButton;
int mSubState;
s32 mPointCount[5];
u32 mSelectedFriend;
TextBalloon* mpBalloon;
nand::LayoutFile* mpBalloonFile;
String mString;
bool mbParentalOK;
nigaoe::Object* mpNigaoe;
RFLCreateID mCreateID;
int mNigaoeState;
FriendListCache* mpFriendCache;
private:
u8 unk_0x58[0x498];
};
} // namespace scene
} // namespace ipl

View File

@@ -19,13 +19,6 @@
namespace ipl {
namespace scene {
extern wchar_t scTextDateJpnFormat[];
extern wchar_t scTextDateKorFormat[];
extern wchar_t scTextDateGerFormat[];
extern wchar_t scTextDatePalengFormat[];
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
extern const u32 scWeekMsgId[];
#endif
class focus_object;
SCENE_CLASS(Board), public ButtonEventHandlerBase {
public:
@@ -88,57 +81,13 @@ namespace ipl {
void set_text_date();
void set_text_date(const utility::Date& date, const char* paneName);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* sep2 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateJpnFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* sep2 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateKorFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#else
void get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen);
void get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateGerFormat, date.day, date.month, weekStart, week, weekEnd);
}
#else
void get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen);
void get_text_usafre(const utility::Date& date, wchar_t* text, u32 textLen);
#ifdef IPL_BOARD_DATE_HELPERS_INLINE
void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
swprintf(text, textLen, scTextDatePalengFormat, week, date.day, date.month);
}
#else
void get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen);
#endif
void show_ricon();
void hide_ricon();
@@ -277,17 +226,8 @@ namespace ipl {
STATE_DONE,
};
#ifdef IPL_BOARD_INLINE_GETTERS
static Button* get_button() {
return static_cast<Button*>(System::getScene(SCENE_BUTTON));
}
static Arrow* get_arrow() {
return static_cast<Arrow*>(System::getScene(SCENE_ARROW));
}
#else
static Button* get_button();
static Arrow* get_arrow();
#endif
static const int OBJECTS_ON_SCREEN = 10;

View File

@@ -1,116 +0,0 @@
#ifndef IPL_SCENE_SD_MEMORY_H
#define IPL_SCENE_SD_MEMORY_H
#include <revolution.h>
#include "layout/iplLayout.h"
#include "layout/iplGuiManager.h"
#include "scene/board/iplFocusObject.h"
#include "scene/channelEdit/iplNandSDCardManager.h"
namespace ipl {
namespace scene {
class SDMemory {
public:
struct TitleRange {
s32 mByteSize;
u32 mCount;
};
SDMemory();
~SDMemory();
void create(EGG::Heap* heap, nand::LayoutFile* layoutFile, NandSDCardManager* manager);
void setTitleLists(const TitleRange& nandTitles, const TitleRange& sdTitles);
bool calc();
void setScrollLimit();
void updateSideArrows();
void resetScrollArrows();
void updateScrollArrows(u32 previousDownEnd, u32 previousUpEnd, u32 downEnd, u32 upEnd);
void showDownArrow();
void showUpArrow();
void hideDownArrow();
void hideUpArrow();
void showLeftArrow();
void showRightArrow();
void hideLeftArrow();
void hideRightArrow();
private:
s32 updateState();
void onDialogState0();
void onDialogState2();
bool onDialogState3();
void onDialogState4();
void onDialogState6();
void onDialogState7();
void onDialogState8();
void onDialogState9();
void onDialogState10();
void onDialogState11();
void onDialogState12();
void onDialogState13();
void onDialogState14();
void onDialogState15();
void onDialogState16();
void onDialogState17();
void onDialogState18();
void onDialogState19();
bool onDialogState20();
void onDialogState21();
bool onDialogState22();
void onDialogState23();
bool onDialogState24();
void resetDialogPaneAnimations();
s32 getControlPaneIndex(const char* paneName);
layout::Object* mpMainLayout;
layout::Object* mpTitleLayout;
layout::Object* mpDialogLayout;
layout::Object* mpProgressLayout;
gui::PaneManager* mpPaneManagers[3];
s32 mDialogState;
s32 mProcessState;
s32 mDisplayMode;
s32 mMessageId;
u32 mErrorCode;
u32 mPanelStates[3];
u32 mTitlePanelStates[5];
u32 mPanelAnimationStates[4];
NandSDCardManager* mpNandSDCardManager;
TitleRange mNandTitleRange;
TitleRange mSDTitleRange;
u32 mTitleCount;
u32 mCurrentTitle;
u32 mTitleFlags;
ESTitleId mTitleIds[96];
wchar_t mTitleNames[96][21];
u32 mTitleNameCount;
u32 mNandTitleNameCount;
ESTitleId mNandTitleIds[96];
u32 mNandTitleCount;
u32 mSDTitleCount;
ESTitleId mSDTitleIds[96];
wchar_t mCurrentTitleName[0x840];
u8 mTransferFlags[4];
u32 mTransferStatus;
u64 mTransferStartTime;
s32 mTransferFrame;
struct TitleListState {
ESTitleId* mpTitles;
u32 mCount;
ESTitleId* mpSecondaryTitles;
u32 mSecondaryCount;
ESTitleId* mpNames;
u32 mNameCount;
} mTitleListState;
scroller mScroller;
s32 mButtonState;
u8 mControllerFlags[4];
u32 mFinalState[3];
u8 mFinalFlags[4];
};
} // namespace scene
} // namespace ipl
#endif

View File

@@ -1,297 +1,18 @@
#ifndef IPL_SCENE_SD_CHANNEL_SELECT_H
#define IPL_SCENE_SD_CHANNEL_SELECT_H
#include "iplSceneUIHeader.h"
#include "math/iplInterporation.h"
#include "scene/sdButton/iplSDButton.h"
#include "system/iplChannelRsoThread.h"
#include "system/iplNandSDWorker.h"
#include "iplSceneHeader.h"
namespace ipl {
namespace scene {
class SDChannelObj {
public:
SDChannelObj(EGG::Heap* heap, int page, int index);
~SDChannelObj();
EGG::Heap* getHeap() const { return mpHeap; }
int getPage() const { return mPage; }
int getIndex() const { return mIndex; }
private:
friend class SDChannelSelect;
nw4r::ut::Link mListLink;
EGG::ExpHeap* mpDialogHeap;
EGG::ExpHeap* mpChannelHeap;
EGG::Heap* mpHeap;
u32 mState;
int mPage;
int mIndex;
nand::LayoutFile* mpLayoutFile;
nw4r::lyt::Pane* mpPane;
layout::Animator* mpPaneAnimator;
layout::Object* mpBaseLayout;
layout::Animator* mpBaseAnimator;
layout::Object* mpPageLayout;
layout::Animator* mpPageAnimators[3];
int mPageAnimation;
int mPageAnimationFrame;
layout::Object* mpDialogLayout;
layout::Animator* mpDialogAnimator;
int mDialogState;
int mDialogFrame;
int mDialogTimer;
int mAnimationState;
nw4r::lyt::Group* mpNewMessageGroup;
int mNewMessageCount;
u8 mbNewMessageGroupActive;
int mNewMessageState;
int mNewMessageFrame;
f32 mOffsetX;
f32 mOffsetY;
f32 mAspectRatioScale;
int mStateFlags;
void* mpThumbnailData;
NandSDWorker::SDAppMetaEntry mAppMeta;
};
extern "C" void iplSDChannelObj_813E3104(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E311C(SDChannelObj* channel, EGG::ExpHeap* firstHeap,
EGG::ExpHeap* secondHeap);
extern "C" void iplSDChannelObj_813E322C(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E3178(SDChannelObj* channel, nw4r::lyt::Pane* pane);
extern "C" void iplSDChannelObj_813E3180(SDChannelObj* channel, nand::LayoutFile* layoutFile);
extern "C" void iplSDChannelObj_813E3304(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E330C(SDChannelObj* channel);
extern "C" void* iplSDChannelObj_813E3128(SDChannelObj* channel);
extern "C" bool iplSDChannelObj_813E3330(SDChannelObj* channel);
union SDChannelSelectCommandArguments {
u32 values[3];
NandSDWorker::AppBlocksInfo* appBlocks[3];
NandSDWorker::TitleIdList* titleLists[3];
void* pointers[3];
};
struct SDChannelSelectCommand {
u32 type;
u64 titleId;
SDChannelSelectCommandArguments arguments;
void copyFrom(const SDChannelSelectCommand& other);
};
struct SDChannelSelectCommandQueue {
SDChannelSelectCommand commands[4];
int capacity;
int count;
int readIndex;
int writeIndex;
SDChannelSelectCommandQueue(u32 capacity, u32 count, u32 readIndex, u32 writeIndex)
: capacity(capacity), count(count), readIndex(readIndex), writeIndex(writeIndex) {
}
bool push(const SDChannelSelectCommand& command);
bool pop();
};
struct SDChannelSelectTitleInfo {
ESTitleId32 titleId;
bool used;
};
struct SDChannelSelectNoticeQueue {
SDChannelSelectCommand notices[42];
int capacity;
int count;
int readIndex;
int writeIndex;
SDChannelSelectNoticeQueue(u32 capacity, u32 count, u32 readIndex, u32 writeIndex)
: capacity(capacity), count(count), readIndex(readIndex), writeIndex(writeIndex) {
}
bool pop();
};
FADER_SCENE_CLASS(SDChannelSelect) {
public:
enum {
PAGE_COUNT = 5,
};
SDChannelSelect(EGG::Heap* heap);
virtual ~SDChannelSelect();
virtual BOOL isResetProcessDone();
virtual void startResetting();
virtual void prepare();
virtual void create();
virtual void draw();
virtual void destroy();
virtual void initCalcFadeout();
virtual void calcCommon();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
static const char* mscChannelPaneNames[PAGE_COUNT][MAX_CHANNEL_INDEX];
static const char* mscBasePaneNames[PAGE_COUNT];
static const char* mscPicturePaneNames[PAGE_COUNT];
static const char* mscEdgePaneNames[PAGE_COUNT];
static const char* mscClockPaneNames[3];
static const char* mscMaskPaneName;
SDChannelSelect(EGG::Heap * heap);
private:
void enqueueStartNotice();
bool enqueueFinishNotice();
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
bool enqueueLoadNotice();
bool enqueuePageNotice();
bool enqueueResultNotice(u32 result);
bool enqueueChannelNotice(u32 controller, u32 page, u32 index, u32 value);
bool enqueueMoveNotice(u32 controller, u32 page, u32 index);
bool enqueueStateNotice(u32 controller, u32 page, u32 index, u32 state);
bool enqueueErrorNotice(u32 page, u32 index);
bool enqueueCommandNotice(u32 page, u32 index, u32 command);
bool enqueueDeleteNotice(u32 controller, u32 page, u32 index);
void clearCommandQueue();
void clearNoticeQueue();
void calcChannelObjects();
void updateChannelObjects();
void updateChannelObject(SDChannelObj* channel);
void drawChannelObjects();
bool isChannelInCalc(int page, int index, int currentPage) const;
nw4r::lyt::Pane* getChannelBasePane(int page, int index, int currentPage) const;
nw4r::lyt::Pane* getCenterChannelPane(int index) const;
nw4r::lyt::Pane* getChannelPane(int index) const;
static math::VEC3 getChannelPanePosition(SDChannelSelect* scene, int index);
void calcPageAnimations();
void updateArrowVisibility();
void processWorkerState();
void updateDialogAnimation();
void processWorkerCommands();
void handleWorkerStartup();
void handleNandTitleCount();
void handleNandTitleUsage();
void handleNandTitleUsageComplete();
void handleSDTitleList();
void handleSDTitleListResult();
void refreshAfterSDTitleList();
void handleSDChannelUpdateComplete();
void updateChannelNotices(int pageOffset, int index);
void handleSDMountComplete();
void handleCopyComplete();
void handleDeleteComplete();
void handleMoveComplete();
void handleStorageCheckComplete();
void handleCardCommand();
void handleSDCardReady();
void handleSDLocationUpdateComplete();
void handleSDLocationReadComplete();
void handleBackupFitComplete();
void handleNandSDCleanupComplete();
void handleSDDeleteComplete();
bool setDialogMessage(u32 state, u32 message);
static int compareTitleUsage(const void* lhs, const void* rhs);
static int compareTitleInfo(const void* lhs, const void* rhs);
void createChannelList(int page, bool force);
void destroyChannelObject(SDChannelObj* channel);
void destroyUnusedChannelObjects(int currentPage, SDChannelObj* keepChannel);
void refreshChannelList();
bool hasChannelObject(int page, int index) const;
SDChannelObj* findChannelObject(int page, int index) const;
void createChannelObject(int page, int index);
void createBaseLayout();
void updateNoCardLayouts();
void createChannelThumbnails();
nw4r::ut::List mChannelObjects;
nand::LayoutFile* mpLayoutFile;
layout::Object* mpLayout;
math::HermiteIntp<math::VEC3>* mpPageAnimations[4];
gui::PaneManager* mpPaneManager;
layout::Object* mpNoCardLayout;
layout::Object* mpPageLayouts[3];
layout::Object* mpDialogLayout;
SDButtonEventHandlerBase* mpButtonEventHandler;
int mState;
int mCurrentPage;
int mPageCount;
int mCurrentChannelIndex;
f32 mThumbOffsetX;
f32 mThumbOffsetY;
nw4r::math::VEC3 mPosition;
math::VEC2 mScale;
f32 mAspectRatioScale;
bool mbLeftArrowVisible;
bool mbRightArrowVisible;
u8 mArrowState;
u8 mNoCardState;
EGG::UnitHeap* mpLayoutHeap;
EGG::ExpHeap* mpDialogHeap;
EGG::ExpHeap* mpChannelHeap;
EGG::ExpHeap* mpThumbnailHeap;
nw4r::math::VEC2 mPointerPosition;
int mControllerChannel;
int mSourcePage;
int mSourceIndex;
int mDestinationPage;
int mDestinationIndex;
int mPendingPage;
int mPendingIndex;
int mMoveState;
bool mbButtonEnabled;
bool mbDialogActive;
u16 mInputFlags;
SDChannelObj* mpCurrentChannel;
layout::Object* mpStateLayout;
layout::Object* mpHelpLayout;
EGG::ExpHeap* mpRsoHeap;
channel::RsoThread* mpRsoThread;
u32 mCommandQueueState;
SDChannelSelectCommandQueue mCommandQueue;
SDChannelSelectNoticeQueue mNoticeQueue;
int mCurrentSDState;
int mPreviousSDState;
int mWorkerState;
int mWorkerCommand;
EGG::Heap* mpWorkerHeap;
EGG::Heap* mpThumbnailWorkHeap;
NandSDWorker* mpSDWorker;
ESTitleId32* mpSDTitleIds;
SDChannelSelectTitleInfo* mpSDTitleInfo;
NandSDWorker::TitleUsage* mpNandTitleInfo;
u32 mFirstTitleCount;
u32 mSecondTitleCount;
SDChannelObj* mpCurrentLoadedChannel;
u32 mSDTitleCount;
u32 mNandTitleCount;
u32* mpChannelTitleIds;
u32 mPendingOperation;
int mLastOperation;
layout::Object* mpErrorLayout;
layout::Object* mpPointerLayout;
layout::Object* mpHelpButtonLayout;
int mOperationResult;
u8 mbShowNoCardMessage;
u8 mbOperationActive;
u8 mbSDCardBroken;
u32 mOperationState;
u32 mDialogState;
nand::File* mpSaveDataFile;
u32 mAnimationState;
u32 mAnimationTarget;
OSTime mOperationStartTime;
nand::File* mpCorruptIconFile;
u8 mbHazardTitleFound;
u8 mbChannelLimitReached;
u8 mbInitialLoadComplete;
u8 mbNeedsRefresh;
u8 unk_0x58[0x728];
};
}
}
} // namespace scene
} // namespace ipl
#endif
#endif // IPL_SCENE_SD_CHANNEL_SELECT_H

View File

@@ -62,204 +62,6 @@ namespace ipl {
};
// clang-format on
#ifdef IPL_CONTROLLER_NATIVE_HIERARCHY
#ifdef IPL_CONTROLLER_OUT_OF_LINE_INTERFACE
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#else
#ifdef IPL_CONTROLLER_INLINE_INTERFACE
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature implementation
#else
#define IPL_CONTROLLER_DEFAULT_VIRTUAL(signature, implementation) virtual signature;
#endif
#endif
class Interface {
public:
virtual ~Interface() = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getType() const, { return -1; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getChannel() const, { return -1; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool down(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool downTrg(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool upTrg(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinch() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchTrg() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int pinchOffTrg() const, { return 0; })
virtual int decide() const = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool repeat(u32 button) const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(BOOL rumble(int type = 0), { return FALSE; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void cancelRumbling(), { })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getHoldFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getTrigFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getReleaseFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicHoldFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicTrigFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getClassicReleaseFlag() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getDpdPos() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getDpdProjectionPos() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(math::VEC2 getHorizon() const, { return math::VEC2(0.0f, 0.0f); })
IPL_CONTROLLER_DEFAULT_VIRTUAL(f32 getDpdDistance() const, { return 0.0f; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(KPADStatus* getKPADStatus() const, { return NULL; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(PADStatus* getPADStatus() const, { return NULL; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool isValidBtn() const, { return false; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(bool isValidDpd() const, { return false; })
virtual void setForceInvalid(bool flag) = 0;
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getMainStickX() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getMainStickY() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getSubStickX() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(int getSubStickY() const, { return 0; })
IPL_CONTROLLER_DEFAULT_VIRTUAL(void read(), { })
};
#undef IPL_CONTROLLER_DEFAULT_VIRTUAL
#ifdef IPL_CONTROLLER_INLINE_INTERFACE
inline Interface::~Interface() {}
#endif
class Base : public Interface {
public:
Base(int chan, KPADStatus& status) {
mButton = 0;
unk_0x08 = 0;
mLastRumbleTime = 0;
mRumbleType = -1;
mChan = chan;
mType = 2;
unk_0x1C = 0;
KPADEnableDPD(chan);
unk_0x1D = 0;
unk_0x1E = 0;
unk_0x20 = &status;
}
Base(int chan, int type, KPADStatus& status) {
mButton = 0;
unk_0x08 = 0;
mLastRumbleTime = 0;
mRumbleType = -1;
mChan = chan;
mType = type;
unk_0x1C = 0;
KPADEnableDPD(chan);
}
virtual ~Base();
virtual int getType() const override;
virtual int getChannel() const override;
virtual int decide() const override;
virtual BOOL rumble(int timer = 0) override;
virtual void cancelRumbling() override;
virtual void setForceInvalid(bool flag) override;
virtual void read() override;
protected:
u8 mButton;
u32 unk_0x08;
OSTick mLastRumbleTime;
s32 mRumbleType;
u32 mChan;
u32 mType;
u8 unk_0x1C;
u8 unk_0x1D;
u8 unk_0x1E;
KPADStatus* unk_0x20;
};
class Revolution : public Base {
public:
Revolution(int chan, KPADStatus& status) : Base(chan, status) {}
Revolution(int chan, int type, KPADStatus& status);
virtual ~Revolution();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual int pinch() const override;
virtual int pinchTrg() const override;
virtual int pinchOffTrg() const override;
virtual bool repeat(u32 button) const override;
virtual f32 getDpdDistance() const override;
virtual KPADStatus* getKPADStatus() const override;
virtual int getReleaseFlag() const override;
virtual int getTrigFlag() const override;
virtual int getHoldFlag() const override;
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual bool isValidBtn() const override;
virtual bool isValidDpd() const override;
virtual void read() override;
};
class Classic : public Revolution {
public:
Classic(int chan, KPADStatus& status);
virtual ~Classic();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual int getClassicHoldFlag() const override;
virtual int getClassicTrigFlag() const override;
virtual int getClassicReleaseFlag() const override;
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual bool isValidDpd() const override;
virtual void read() override;
virtual BOOL isValidDpdClassic() const;
private:
math::VEC2 unk_0x24;
int unk_0x2C;
};
class Master : public Interface {
public:
Master(Interface** controllers) : mpControllers(controllers) {}
virtual ~Master();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
virtual bool upTrg(u32 button) const override;
virtual bool repeat(u32 button) const override;
virtual int decide() const override;
virtual void setForceInvalid(bool flag) override;
private:
bool call(u32 button, bool (Interface::*func)(u32) const) const;
Interface** mpControllers;
};
class Core : public Revolution {
public:
Core(int chan, int type, KPADStatus& status) : Revolution(chan, type, status) {}
virtual ~Core();
};
class FreeStyle : public Revolution {
public:
FreeStyle(int chan, int type, KPADStatus& status) : Revolution(chan, type, status) {}
virtual ~FreeStyle();
};
class Manager {
public:
Manager(EGG::Heap* heap);
void read();
Interface* getController(int chan);
Interface* getMasterController();
Interface* getYoungController();
static void* alloc(u32 size);
static int free(void* ptr);
private:
static void* mpBuf;
static EGG::Heap* mpParentHeap;
static EGG::ExpHeap* mpHeap;
static EGG::Allocator* mpAllocator;
Interface* mControllers[4];
u32 mControllerStorage[4][12];
Master mMaster;
KPADStatus mKPADStatus[4];
s32 mInvalidCount[4];
};
#else
class Base {
public:
Base(int chan, KPADStatus& arg1) {
@@ -316,11 +118,11 @@ namespace ipl {
virtual bool setForceInvalid(bool flag); // 0x74
virtual int getMainStickX() const; // 0x78
virtual int getMainStickY() const; // 0x7C
virtual f32 getMainStickX() const; // 0x78
virtual f32 getMainStickY() const; // 0x7C
virtual int getSubStickX() const; // 0x80
virtual int getSubStickY() const; // 0x84
virtual f32 getSubStickX() const; // 0x80
virtual f32 getSubStickY() const; // 0x84
virtual void read(); // 0x88
@@ -367,10 +169,10 @@ namespace ipl {
virtual math::VEC2 getDpdPos() const override;
virtual math::VEC2 getDpdProjectionPos() const override;
virtual math::VEC2 getHorizon() const override;
virtual int getMainStickX() const override;
virtual int getMainStickY() const override;
virtual int getSubStickX() const override;
virtual int getSubStickY() const override;
virtual f32 getMainStickX() const override;
virtual f32 getMainStickY() const override;
virtual f32 getSubStickX() const override;
virtual f32 getSubStickY() const override;
virtual BOOL rumble(int type = 0) override;
virtual void read() override;
};
@@ -426,7 +228,6 @@ namespace ipl {
class Classic : public Revolution {
public:
Classic(int arg0, KPADStatus& arg1);
virtual ~Classic();
virtual bool down(u32 button) const override;
virtual bool downTrg(u32 button) const override;
@@ -467,7 +268,6 @@ namespace ipl {
static EGG::Allocator* mpAllocator;
u8 dummy[0x2F8];
};
#endif
} // namespace controller
} // namespace ipl

View File

@@ -118,11 +118,6 @@ namespace ipl {
int getLastResult() { return mLastResult; }
/** @return If the dialog is moving onto the next state. */
bool doingNextState() { return mbNextState; }
#ifdef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
int getStateForSDMemory() const { return mState; }
int getResultForSDMemory() const { return mResult; }
void setTitleForSDMemory(const wchar_t* text) { set_title(text); }
#endif
/*=================*/
/* DIALOG BUTTON 0 */

View File

@@ -54,9 +54,6 @@ namespace ipl {
const wchar_t* wcString; // 0x04
u32 stringLimit; // 0x08
u32 rowLimit; // 0x0C
#ifdef IPL_ADDRESS_EDIT_CPP
KeyboardSetting(KeyboardType keyboardType, const wchar_t* value, u32 limit, u32 rows);
#endif
} KeyboardSetting;
typedef struct State {

View File

@@ -19,8 +19,6 @@ namespace ipl {
class Manager;
}
namespace savedata {
extern "C" BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
class Manager {
public:
Manager(EGG::Heap* heap);
@@ -50,12 +48,6 @@ namespace ipl {
int getPrevPage() { return mLastPrevPage; }
#ifdef IPL_SD_CHANNEL_SELECT_ACCESS
int getLastSDPrevPage() { return mLastSDPrevPage; }
void setLastSDPrevPage(int page) { mLastSDPrevPage = page; }
BOOL didntGotoSDMenu() const { return mData.didntGotoSDMenu; }
#endif
bool hasPhotoMP3Dummy() { return mbPhotoMP3; }
bool hasPhoto2Title() { return mbPhoto2; }
bool hasPhoto2DummyCheck() { return mbPhoto2Check; }
@@ -159,7 +151,6 @@ namespace ipl {
u8 unused_0x504[28];
friend class channel::Manager;
friend BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId);
};
} // namespace savedata
} // namespace ipl

View File

@@ -20,12 +20,7 @@ namespace ipl {
Date() : year(MIN_YEAR), month(MIN_MONTH), day(MIN_DAY) {}
Date(int myYear, int myMonth, int myDay) : year(myYear), month(myMonth), day(myDay) {}
#ifdef IPL_BOARD_DATE_CTOR_OUT_OF_LINE
Date(const OSCalendarTime& cal);
#else
Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon + 1), day(cal.mday) {}
#endif
#line 24 "include/utility/iplCalendar.h"
Date(const Date& date) : year(date.year), month(date.month), day(date.day) {}
static Date getMaxDate() {
@@ -132,9 +127,6 @@ namespace ipl {
return days[month - 1];
}
#ifdef IPL_BOARD_WEEK_FUNCTION_OUT_OF_LINE
static int getWeek(const Date& date) NO_INLINE;
#else
static int getWeek(const Date& date) NO_INLINE {
int month, year, day;
month = date.month;
@@ -146,8 +138,6 @@ namespace ipl {
}
return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7;
}
#endif
#line 147 "include/utility/iplCalendar.h"
static int getWeek(int year, int month, int day) NO_INLINE {
if (month <= 2) {

View File

@@ -49,9 +49,6 @@ namespace ipl {
public:
Scroller();
#ifdef IPL_SDMEMORY_SCROLLER_INIT_OUT_OF_LINE
void init();
#else
void init() {
mState = 0;
mScroll = 0.0f;
@@ -59,7 +56,6 @@ namespace ipl {
mUpLimit = 0.0f;
mDownLimit = 0.0f;
}
#endif
void calc();
f32 get() const;

View File

@@ -88,11 +88,7 @@ namespace nw4r {
PaneList& GetChildList() { return mChildList; }
const math::VEC3& GetTranslate() { return mTranslate; }
#ifdef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
void SetTranslate(const math::VEC3& translate);
#else
void SetTranslate(const math::VEC3& translate) { mTranslate = translate; }
#endif
void SetTranslate(const math::VEC2& translate) { SetTranslate(math::VEC3(translate.x, translate.y, 0.0f)); }
const math::VEC3& GetRotate() const { return mRotate; }

View File

@@ -16,9 +16,7 @@ namespace nw4r {
#endif
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
#ifndef IPL_CONTROLLER_TRIVIAL_RECT_DTOR
~Rect() {}
#endif
void SetWidth(f32 width) { right = left + width; }
void SetHeight(f32 height) { bottom = top + height; }

View File

@@ -37,9 +37,6 @@ namespace nw4r {
} // namespace detail
template <typename TDerived, typename TBase>
#ifdef IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST
TDerived DynamicCast(TBase* pPtr);
#else
inline TDerived DynamicCast(TBase* pPtr) {
const detail::RuntimeTypeInfo* pDerivedTypeInfo = detail::GetTypeInfoFromPtr_(static_cast<TDerived>(NULL));
if (pPtr->GetRuntimeTypeInfo()->IsDerivedFrom(pDerivedTypeInfo)) {
@@ -47,7 +44,6 @@ namespace nw4r {
}
return NULL;
}
#endif
} // namespace ut
} // namespace nw4r

View File

@@ -1,127 +0,0 @@
#include <revolution/fa/types.h>
#include <revolution/types.h>
static s32 pf_error_to_api_error[] = {FA_ERR_SUCCESS, FA_ERR_EINVAL, FA_ERR_EINVAL, FA_ERR_ENOENT, FA_ERR_EBUSY, FA_ERR_ENOTEMPTY, FA_ERR_ENOSPC,
FA_ERR_ENOEXEC, FA_ERR_EEXIST, FA_ERR_ENOEXEC, FA_ERR_EINVAL, FA_ERR_EWRTPROTECT, FA_ERR_ENOSYS, FA_ERR_ENOEXEC,
FA_ERR_ENOEXEC, FA_ERR_ENOEXEC, FA_ERR_EACCES, FA_ERR_EIO, FA_ERR_ENOEXEC, FA_ERR_EACCES, FA_ERR_ENOENT,
FA_ERR_ENFILE, FA_ERR_EMFILE, FA_ERR_EISDIR, FA_ERR_EACCES, FA_ERR_EPERM, FA_ERR_ENOEXEC, FA_ERR_ENOEXEC,
FA_ERR_ENOEXEC, FA_ERR_ENOEXEC, FA_ERR_ENOMEM, FA_ERR_EINVAL, FA_ERR_EINVAL, FA_ERR_ENOEXEC, FA_ERR_ENOENT,
FA_ERR_ENOEXEC, FA_ERR_ENOEXEC, FA_ERR_EFBIG, FA_ERR_EBADF, FA_ERR_ENOLCK};
s32 PFAPI_ParseOpenModeString(const char* mode_str) {
s32 open_mode = 0;
u32 i = 0;
if (mode_str == NULL) {
open_mode = 10;
return open_mode;
}
switch (mode_str[i++]) {
case 'r': {
open_mode = 2;
break;
}
case 'w': {
open_mode = 1;
break;
}
case 'a': {
open_mode = 4;
break;
}
default: {
return 0;
}
}
if (mode_str[i] == 'b') {
i++;
}
switch (mode_str[i++]) {
case 0: {
return open_mode;
}
case 't':
default: {
return 0;
}
case '+': {
switch (mode_str[i]) {
case 0: {
return open_mode | 8;
}
default: {
return 0;
}
}
}
}
return 0;
}
s32 PFAPI_convertError(s32 err) {
if (err == 0) {
return 0;
}
if (err == -1) {
return -1;
}
if (err > 0 && err < 0xA0) {
return pf_error_to_api_error[err];
}
if (err == 0x1000) {
err = FA_ERR_EIO;
}
return err;
}
s32 PFAPI_convertDriverError(s32 err) {
if (err == 0) {
return 0;
}
if (err <= 0) {
return err;
}
if ((u32)err < 0xA0) {
err = 1;
}
return err;
}
s32 PFAPI_convertReturnValue(s32 err) {
if (err == 0) {
return 0;
}
return -1;
}
s32 PFAPI_convertReturnValue4feof(s32 err) {
if (err == 1) {
return 1;
}
if (err == 0) {
return 0;
}
return -1;
}
void* PFAPI_convertReturnValue2NULL(s32 err, void* p_stream) {
void* ret;
if (err) {
ret = NULL;
} else {
ret = p_stream;
}
return ret;
}
s32 PFAPI_convertReturnValue4unmount(s32 err) {
if (err == 0) {
return 0;
}
if (err == 1) {
return 1;
}
return -1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,53 +0,0 @@
#include <revolution/types.h>
s32 PFWAPI_ParseOpenModeString(const unsigned short* mode_str) {
s32 open_mode = 0;
u32 i = 0;
if (mode_str == NULL) {
open_mode = 10;
return open_mode;
}
switch (mode_str[i++]) {
case 'r': {
open_mode = 2;
break;
}
case 'w': {
open_mode = 1;
break;
}
case 'a': {
open_mode = 4;
break;
}
default: {
return 0;
}
}
if (mode_str[i] == 'b') {
i++;
}
switch (mode_str[i++]) {
case 0: {
return open_mode;
}
case 't':
default: {
return 0;
}
case '+': {
switch (mode_str[i]) {
case 0: {
return open_mode | 8;
}
default: {
return 0;
}
}
}
}
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -90,7 +90,6 @@ NWC24Err NWC24FDeleteVF(const char* path);
NWC24Err NWC24MountVF(const char* drive, const char* fileName);
NWC24Err NWC24UnmountVF(const char* drive);
NWC24Err NWC24CheckSizeVF(const char* drive, u32* pSize);
NWC24Err NWC24CreateVF(const char* path, u32 fileSize);
NWC24Err NWC24FStreamInit(NWC24FileStream* stream, NWC24File* file, u32 baseOffset, u32 areaSize, char* buffer, u32 size);
u32 NWC24FStreamGetSize(NWC24FileStream* stream);

View File

@@ -4,125 +4,12 @@
#include <revolution/types.h>
#include <revolution/nwc24/NWC24Err.h>
#include <revolution/nwc24/NWC24Types.h>
#include <revolution/nwc24/NWC24MsgBoard.h>
#include <private/nwc24/NWC24File.h>
#include <private/nwc24/NWC24Private.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NWC24_MSG_RECIPIENT_MAX_ 8
#define NWC24_MSG_ATTACHMENT_MAX_ 2
typedef union NWC24iAddr {
u64 id;
NWC24Data data;
} NWC24iAddr;
typedef enum NWC24MsgBoxId {
NWC24_MSGBOX_SEND = 0,
NWC24_MSGBOX_RECV = 1,
NWC24_MSGBOX_MAX
} NWC24MsgBoxId;
typedef struct NWC24iMBCHeader {
u32 magic; // at 0x0
u32 version; // at 0x4
u32 numMsgs; // at 0x8
u32 capacity; // at 0xC
u32 totalMsgSize; // at 0x10
u32 fileSize; // at 0x14
u32 nextMsgId; // at 0x18
u32 freeChain; // at 0x1C
u32 oldestMsgId; // at 0x20
u32 freeSpace; // at 0x24
u8 reserved[0x30]; // at 0x28
char uidl[0x28]; // at 0x58
} NWC24iMBCHeader;
typedef struct NWC24iMsgObj {
u32 id; // at 0x0
u32 flags; // at 0x4
u32 length; // at 0x8
u32 appId; // at 0xC
u32 unk10; // at 0x10
u32 tag; // at 0x14
u32 command; // at 0x18
u32 unk1C; // at 0x1C
NWC24iAddr from; // at 0x20
s32 createTime; // at 0x28
u32 unk2C; // at 0x2C
NWC24Data fromField; // at 0x30
NWC24Data toField; // at 0x38
NWC24Data subject; // at 0x40
NWC24Data text; // at 0x48
NWC24Data contentType; // at 0x50
NWC24Data txEncoding; // at 0x58
NWC24Charset charset; // at 0x60
NWC24Encoding encoding; // at 0x64
NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x68
u32 attachedSize[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x78
NWC24MIMEType attachedType[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x80
union {
NWC24iAddr to[NWC24_MSG_RECIPIENT_MAX_];
NWC24Data toAddrs[NWC24_MSG_RECIPIENT_MAX_];
}; // at 0x88
u8 numTo; // at 0xC8
u8 numAttached; // at 0xC9
u16 groupId; // at 0xCA
u32 msgBoard; // at 0xCC
NWC24Data user; // at 0xD0
NWC24Data face; // at 0xD8
NWC24Data alt; // at 0xE0
NWC24Data dwcId; // at 0xE8
u32 iconNew; // at 0xF0
u8 unkF4[0x100 - 0xF4]; // at 0xF4
} NWC24iMsgObj;
typedef struct NWC24iMBCEntry {
u32 id; // at 0x0
u32 flags; // at 0x4
u32 length; // at 0x8
u32 appId; // at 0xC
u32 unk10; // at 0x10
u32 tag; // at 0x14
u32 command; // at 0x18
u32 unk1C; // at 0x1C
NWC24iAddr from; // at 0x20
s32 createTime; // at 0x28
u32 unk2C; // at 0x2C
u8 numTo; // at 0x30
u8 numAttached; // at 0x31
u16 groupId; // at 0x32
u32 fromField; // at 0x34
u32 toField; // at 0x38
u32 subject; // at 0x3C
u32 contentType; // at 0x40
u32 txEncoding; // at 0x44
NWC24Data text; // at 0x48
NWC24Data attached[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x50
u32 attachedSize[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x60
NWC24MIMEType attachedType[NWC24_MSG_ATTACHMENT_MAX_]; // at 0x68
NWC24Data dwcId; // at 0x70
u32 iconNew; // at 0x78
u32 unk7C; // at 0x7C
} NWC24iMBCEntry;
NWC24Err NWC24iOpenMBox();
NWC24Err NWC24iInitMBox();
NWC24Err NWC24iMBoxOpenNewMsg(NWC24MsgBoxId id, NWC24File* file, u32* msgId);
NWC24Err NWC24iMBoxOpenStoredMsg(NWC24MsgBoxId id, u32 msgId, NWC24File* file);
NWC24Err NWC24iMBoxCloseMsg(NWC24File* file);
NWC24Err NWC24iMBoxCancelMsg(NWC24File* file, NWC24MsgBoxId id, u32 msgId);
NWC24Err NWC24iMBoxAddMsgObj(NWC24MsgBoxId id, const NWC24iMsgObj* msg);
NWC24Err NWC24iMBoxFlushHeader(NWC24MsgBoxId id);
NWC24Err NWC24iMBoxCheck(NWC24MsgBoxId id, u32 size);
NWC24Err NWC24iMBoxSetLastUIDL(NWC24MsgBoxId id, const char* uidl);
BOOL NWC24iIsMsgObjReadable(const NWC24iMBCEntry* entry);
#ifdef __cplusplus
}

View File

@@ -21,7 +21,7 @@ typedef struct NWC24MsgObjPrivate {
u32 type; // 0x04
u32 length; // 0x08
u32 appId; // 0x0C
u32 unk_0x10; // 0x10
u8 unk_0x10[0x4];
u32 tag; // 0x14
u32 ledPattern; // 0x18
NWC24UserId fromId; // 0x20

View File

@@ -10,11 +10,8 @@ extern "C" {
#endif
typedef struct NWC24Data {
union {
const void* ptr; // 0x00
u32 offset;
};
u32 size; // 0x04
const void* ptr; // 0x00
u32 size; // 0x04
} NWC24Data;
typedef struct NWC24Work NWC24Work;

View File

@@ -15,7 +15,6 @@ extern "C" {
int STD_strnlen(const char* str, u32 len);
int Util_xtoi(char ch);
int Mail_isdigit(int ch);
void* Mail_memcpy(void* dest, const void* src, u32 len);
void* Mail_memset(void* dest, int fill, u32 count);

View File

@@ -24,9 +24,6 @@ typedef struct NWC24Date {
void NWC24Date_Init(NWC24Date* date);
NWC24Err NWC24iDateToMinutes(s32* pMinutes, const NWC24Date* pDate);
NWC24Err NWC24iMinutesToDate(NWC24Date* pDate, s32 minutes);
void NWC24iConvIdToStr(NWC24UserId addr, char* out);
NWC24Err NWC24iCheckStringLength(const char* str, int minLen, int maxLen);

View File

@@ -53,7 +53,7 @@ typedef enum NWC24EncodingRegion {
/* NWC24 Message Object */
typedef struct NWC24MsgObj {
volatile u32 data[64]; // 0x00
u32 data[64]; // 0x00
} NWC24MsgObj;
#define NWC24_FACE_DATA_SIZE 0x4A /* sizeof(RFLCharData) */

View File

@@ -1,33 +0,0 @@
#include <revolution/net.h>
#include <private/nwc24.h>
#include <private/os.h>
#include <revolution/NWC24.h>
#include <revolution/OS.h>
NWC24Err NWC24iEpochSecondsToDate(NWC24Date* date, OSTime time);
NWC24Err NWC24iDateToOSCalendarTime(OSCalendarTime* cal, const NWC24Date* date);
BOOL NETGetUniversalCalendar(OSCalendarTime* pTime) {
static s64 whenCached = 0;
NWC24Date date;
s64 universalTime;
if (whenCached == 0 ||
whenCached + OSSecondsToTicks(60) < __OSGetSystemTime()) {
NWC24iSynchronizeRtcCounter(FALSE);
whenCached = __OSGetSystemTime();
}
if (NWC24iGetUniversalTime(&universalTime) >= 0 &&
NWC24iEpochSecondsToDate(&date, universalTime) >= 0 &&
NWC24iDateToOSCalendarTime(pTime, &date) >= 0) {
return TRUE;
}
OSTicksToCalendarTime(OSGetTime(), pTime);
return FALSE;
}

View File

@@ -1,262 +0,0 @@
#include <private/nwc24.h>
#include <revolution/nwc24.h>
// The number of seconds between 01/01/1900 and 01/01/1970
#define EPOCH_BASE 2208988800LL
#define NWC24i_YEAR_MIN 1900
#define NWC24i_YEAR_DAY_MIN 1
#define NWC24i_YEAR_DAY_MAX 365
#define NWC24i_MONTH_MIN 1
#define NWC24i_MONTH_MAX 12
#define NWC24i_DAY_MIN 1
#define NWC24i_WEEK_DAY_MAX 7
#define NWC24i_HOUR_MAX 24
#define NWC24i_MIN_MAX 60
#define NWC24i_SEC_MAX 60
// Length of each month
static const u8 DAYS_OF_MONTH[NWC24i_MONTH_MAX] = {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31};
// End of each month
static const u16 DAYS_OF_YEAR[NWC24i_MONTH_MAX] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
// Forward declarations
static BOOL IsLeapYear(u16 year);
static s32 ConvertDateToDays(u16 year, u8 month, u8 day);
static void ConvertDaysToDate(u16* pYear, u8* pMonth, u8* pDay, s32 days);
static s32 ConvertTimeToMinutes(u8 hour, u8 min);
static s32 ConvertDaysToMinutes(s32 days);
static void ConvertMinutesToDays(s32* pDays, u8* pHour, u8* pMin, s32 minutes);
static s32 GetDayOfWeek(s32 days);
NWC24Err NWC24iDateToMinutes(s32* pMinutes, const NWC24Date* pDate) {
s32 days;
s32 minutes;
days = ConvertDateToDays(pDate->year, pDate->month, pDate->day);
if (days == -1) {
return NWC24_ERR_FAILED;
}
minutes = ConvertTimeToMinutes(pDate->hour, pDate->min);
if (minutes == -1 || pDate->sec > NWC24i_SEC_MAX) {
return NWC24_ERR_FAILED;
}
*pMinutes = ConvertDaysToMinutes(days) + minutes;
return NWC24_OK;
}
NWC24Err NWC24iMinutesToDate(NWC24Date* pDate, s32 minutes) {
s32 days;
ConvertMinutesToDays(&days, &pDate->hour, &pDate->min, minutes);
ConvertDaysToDate(&pDate->year, &pDate->month, &pDate->day, days);
return NWC24_OK;
}
NWC24Err NWC24iEpochSecondsToDate(NWC24Date* pDate, s64 timestamp) {
s32 minutes;
s32 days;
if (timestamp + EPOCH_BASE < 0) {
timestamp = -EPOCH_BASE;
}
pDate->sec = (timestamp + EPOCH_BASE) % NWC24i_MIN_MAX;
minutes = (timestamp + EPOCH_BASE) / NWC24i_MIN_MAX;
ConvertMinutesToDays(&days, &pDate->hour, &pDate->min, minutes);
ConvertDaysToDate(&pDate->year, &pDate->month, &pDate->day, days);
return NWC24_OK;
}
NWC24Err NWC24iMinutesToOSCalendarTime(OSCalendarTime* pOSTime, s32 minutes) {
s32 days;
NWC24Date date;
ConvertMinutesToDays(&days, &date.hour, &date.min, minutes);
ConvertDaysToDate(&date.year, &date.month, &date.day, days);
pOSTime->year = date.year;
pOSTime->mon = date.month - 1;
pOSTime->mday = date.day;
pOSTime->hour = date.hour;
pOSTime->min = date.min;
pOSTime->sec = 0;
pOSTime->msec = 0;
pOSTime->usec = 0;
pOSTime->yday = (DAYS_OF_YEAR[date.month - 1] + date.day) - NWC24i_YEAR_DAY_MIN;
// Leap year adds an extra day (February 29th)
if (IsLeapYear(date.year) && date.month > 2) {
pOSTime->yday++;
}
pOSTime->wday = GetDayOfWeek(days);
return NWC24_OK;
}
NWC24Err NWC24iDateToOSCalendarTime(OSCalendarTime* pOSTime,
const NWC24Date* pDate) {
pOSTime->year = pDate->year;
pOSTime->mon = pDate->month - 1;
pOSTime->mday = pDate->day;
pOSTime->hour = pDate->hour;
pOSTime->min = pDate->min;
pOSTime->sec = pDate->sec;
pOSTime->msec = 0;
pOSTime->usec = 0;
pOSTime->yday =
(DAYS_OF_YEAR[pOSTime->mon] + pDate->day) - NWC24i_YEAR_DAY_MIN;
// Leap year adds an extra day (February 29th)
if (IsLeapYear(pDate->year) && pDate->month > 2) {
pOSTime->yday++;
}
pOSTime->wday =
GetDayOfWeek(ConvertDateToDays(pDate->year, pDate->month, pDate->day));
return NWC24_OK;
}
NWC24Err NWC24iIsValidDate(u16 year, u8 month, u8 day) {
s32 days = ConvertDateToDays(year, month, day);
NWC24Err result = NWC24_OK;
if (days == -1) {
result = NWC24_ERR_INVALID_VALUE;
}
return result;
}
static BOOL IsLeapYear(u16 year) {
return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
static s32 ConvertDateToDays(u16 year, u8 month, u8 day) {
s32 dayOfYear;
s32 yearsSince1900;
s32 days;
s32 leapDays;
s32 gregorianCorrection;
if (year < NWC24i_YEAR_MIN || month < NWC24i_MONTH_MIN ||
month > NWC24i_MONTH_MAX) {
return -1;
}
// Leap year adds an extra day (February 29th)
if (month == 2 && IsLeapYear(year)) {
if (day < NWC24i_DAY_MIN || day > 29) {
return -1;
}
} else if (day < NWC24i_DAY_MIN ||
DAYS_OF_MONTH[month - NWC24i_MONTH_MIN] < day) {
return -1;
}
dayOfYear = day - 1;
dayOfYear += DAYS_OF_YEAR[month - 1];
// Leap year adds an extra day (February 29th)
if (month >= 3 && IsLeapYear(year)) {
dayOfYear++;
}
yearsSince1900 = year - NWC24i_YEAR_MIN;
leapDays = (yearsSince1900 - 1) / 4 - (yearsSince1900 - 1) / 100;
// Relative to YEAR_MIN=1900
gregorianCorrection = (yearsSince1900 + 299) / 400;
days = yearsSince1900 * NWC24i_YEAR_DAY_MAX + dayOfYear;
days += leapDays + gregorianCorrection;
return days;
}
static void ConvertDaysToDate(u16* pYear, u8* pMonth, u8* pDay, s32 days) {
s32 backup;
*pYear = NWC24i_YEAR_MIN;
*pMonth = NWC24i_MONTH_MIN;
*pDay = NWC24i_DAY_MIN;
if (days < 0) {
return;
}
while (TRUE) {
backup = days;
days -=
IsLeapYear(*pYear) ? NWC24i_YEAR_DAY_MAX + 1 : NWC24i_YEAR_DAY_MAX;
if (days < 0) {
days = backup;
break;
}
(*pYear)++;
}
while (TRUE) {
backup = days;
// Leap year adds an extra day (February 29th)
if (*pMonth == 2 && IsLeapYear(*pYear)) {
days -= 29;
} else {
days -= DAYS_OF_MONTH[*pMonth - NWC24i_DAY_MIN];
}
if (days < 0) {
days = backup;
break;
}
(*pMonth)++;
}
*pDay += days;
}
static s32 ConvertTimeToMinutes(u8 hour, u8 min) {
// Hour/minute are zero indexed
if (hour > NWC24i_HOUR_MAX - 1 || min > NWC24i_MIN_MAX - 1) {
return -1;
}
return hour * NWC24i_MIN_MAX + min;
}
static s32 ConvertDaysToMinutes(s32 days) {
return days * NWC24i_HOUR_MAX * NWC24i_MIN_MAX;
}
static void ConvertMinutesToDays(s32* pDays, u8* pHour, u8* pMin, s32 minutes) {
if (minutes < 0) {
minutes = 0;
}
*pDays = minutes / (NWC24i_MIN_MAX * NWC24i_HOUR_MAX);
minutes %= (NWC24i_MIN_MAX * NWC24i_HOUR_MAX);
*pHour = minutes / NWC24i_MIN_MAX;
*pMin = minutes % NWC24i_MIN_MAX;
}
static s32 GetDayOfWeek(s32 days) {
return (days + NWC24i_DAY_MIN) % NWC24i_WEEK_DAY_MAX;
}

File diff suppressed because it is too large Load Diff

View File

@@ -295,6 +295,7 @@ extern void _savegpr_27();
extern void _restgpr_27();
extern void NCDiGetEnabledConfigList();
extern NWC24Err AnalyzeScdErrors(s32* errorCode, u32 usage);
extern void NWC24iMBoxCheck();
extern void SCCheckStatus();
extern void SCGetWCFlags();
extern void SCGetEULA();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,878 +0,0 @@
#include <private/nwc24.h>
#include <revolution/nwc24.h>
#include <string.h>
#define NWC24i_STRING_WORK_SIZE 1024
enum {
MSG_OBJ_FOR_RECIPIENT = (1 << 0),
MSG_OBJ_FOR_PUBLIC = (1 << 1),
MSG_OBJ_FOR_APP = (1 << 2),
MSG_OBJ_FOR_MENU = (1 << 3),
MSG_OBJ_TO_SEND = (1 << 4),
MSG_OBJ_TO_RECV = (1 << 5),
MSG_OBJ_INITIALIZED = (1 << 8),
MSG_OBJ_DELIVERING = (1 << 9),
MSG_OBJ_FLAG_12 = (1 << 12),
};
static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text,
u32 textLen, char* name, u32 nameLen,
NWC24Encoding* encoding);
static NWC24Err ReadBase64Data(NWC24File* file, const NWC24Data* data,
u8* out, u32 outSize, u32* outLen);
static NWC24Err ReadQPText(const NWC24MsgObj* msg, NWC24File* file, char* text,
u32 textSize);
NWC24Err NWC24ReadMsgField(const NWC24MsgObj* msg, char* fieldName,
u8* fieldBuf, u32 fieldBufLen) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
NWC24Err result;
NWC24Err closeResult;
NWC24MsgBoxId id;
u32 flags;
char* pField;
u32 fieldOffset;
u32 fieldLength;
NWC24FileStream stream;
NWC24File file;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED;
}
if (!(msg->data[1] & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
flags = pMsg->type;
if (flags & MSG_OBJ_TO_SEND) {
id = NWC24_MSGBOX_SEND;
} else if (flags & MSG_OBJ_TO_RECV) {
id = NWC24_MSGBOX_RECV;
} else {
result = NWC24_ERR_INVALID_VALUE;
goto select_done;
}
result = NWC24_OK;
select_done:
if (result != NWC24_OK) {
return result;
}
result = NWC24iMBoxOpenStoredMsg(id, pMsg->msgId, &file);
if (result != NWC24_OK) {
return result;
}
result = NWC24FStreamInit(&stream, &file, 0, pMsg->length,
NWC24WorkP->mainWork, NWC24i_STRING_WORK_SIZE);
if (result == NWC24_OK) {
result = NWC24iSearchHeaderF(&stream, fieldName, pMsg->unk_0x10,
&fieldOffset, &fieldLength);
if (result == NWC24_OK) {
if (fieldLength > fieldBufLen) {
result = NWC24_ERR_OVERFLOW;
} else {
result = NWC24FStreamSeek(&stream, fieldOffset);
if (result == NWC24_OK) {
result = NWC24FStreamGetPtr(&stream, &pField, fieldLength);
if (result == NWC24_OK) {
Mail_strncpy((char*)fieldBuf, pField, fieldLength);
fieldBuf[fieldLength - 2] = 0;
}
}
}
}
}
closeResult = NWC24iMBoxCloseMsg(&file);
if (result == NWC24_OK) {
result = closeResult;
}
return result;
}
NWC24Err NWC24ReadMsgFaceData(const NWC24MsgObj* msg, u8* faceData) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
char* pWork;
NWC24Err result;
u32 decodeSize;
u32 length;
if ((pMsg->type & MSG_OBJ_FOR_PUBLIC) && !(pMsg->type & MSG_OBJ_FLAG_12)) {
return NWC24_ERR_NOT_FOUND;
}
pWork = NWC24WorkP->stringWork;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wiiface", (u8*)pWork,
NWC24i_STRING_WORK_SIZE);
if (result != NWC24_OK) {
return result;
}
length = STD_strnlen(pWork, NWC24i_STRING_WORK_SIZE);
result = NWC24Base64Decode((u8*)pWork, length, faceData, NWC24_FACE_DATA_SIZE,
&decodeSize);
if (result != NWC24_OK) {
return result;
}
if (decodeSize != NWC24_FACE_DATA_SIZE) {
return NWC24_ERR_FORMAT;
}
return NWC24_OK;
}
NWC24Err NWC24ReadMsgAltName(const NWC24MsgObj* msg, u16* altName,
u32 altNameLen) {
char* pWork = NWC24WorkP->stringWork;
NWC24Err result;
u32 decodeSize;
u32 length;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wii-altname:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE);
if (result != NWC24_OK) {
return result;
}
length = STD_strnlen(pWork, NWC24i_STRING_WORK_SIZE);
result = NWC24Base64Decode((u8*)pWork, length, (u8*)altName, altNameLen * 2,
&decodeSize);
return result != NWC24_OK ? result : NWC24_OK;
}
NWC24Err NWC24ReadMsgMBNoReply(const NWC24MsgObj* msg, BOOL* mbNoReplyFlag) {
char* pWork;
NWC24Err result;
*mbNoReplyFlag = FALSE;
pWork = NWC24WorkP->stringWork;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wii-mb-noreply:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE);
if (result == NWC24_OK) {
*mbNoReplyFlag = TRUE;
} else if (result == NWC24_ERR_NOT_FOUND) {
result = NWC24_OK;
}
return result;
}
NWC24Err NWC24ReadMsgMBRegDate(const NWC24MsgObj* msg, u16* year, u8* month,
u8* day) {
NWC24Err result;
char* pWork = NWC24WorkP->stringWork;
s32 digit;
u32 i;
u32 digits;
u32 value;
char* p;
i = 0;
digits = 0;
value = 0;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wii-mb-regdate:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE - 1);
if (result != NWC24_OK) {
return result;
}
p = pWork;
while (*p == '\t' || *p == ' ') {
p++;
i++;
}
while (i < NWC24i_STRING_WORK_SIZE) {
digit = Util_xtoi(*p);
if (digit < 0) {
break;
}
value = (value << 4) | digit;
p++;
i++;
digits++;
}
if (digits != 4) {
result = NWC24_ERR_FORMAT;
}
*year = ((value >> 9) & 0x7F) + 2000;
*month = (value >> 5) & 0xF;
*day = value & 0x1F;
return result;
}
NWC24Err NWC24ReadMsgMBDelay(const NWC24MsgObj* msg, u8* mbDelay) {
NWC24Err result;
char* pWork = NWC24WorkP->stringWork;
s32 digit;
u32 i;
u32 digits;
u32 value;
char* p;
i = 0;
digits = 0;
value = 0;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wii-mb-delay:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE - 1);
if (result != NWC24_OK) {
return result;
}
p = pWork;
while (*p == '\t' || *p == ' ') {
p++;
i++;
}
while (i < NWC24i_STRING_WORK_SIZE) {
digit = Util_xtoi(*p);
if (digit < 0) {
break;
}
value = (value << 4) | digit;
p++;
i++;
digits++;
}
if (digits != 2) {
result = NWC24_ERR_FORMAT;
}
*mbDelay = value;
return result;
}
NWC24Err NWC24ReadMsgMBUpdateSW(const NWC24MsgObj* msg, u32* mbUpdateSW) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
NWC24Err result;
u32 value;
char* pWork;
value = 0;
if (!(pMsg->type & MSG_OBJ_FLAG_12)) {
*mbUpdateSW = 0;
return NWC24_ERR_NOT_FOUND;
}
pWork = NWC24WorkP->stringWork;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
result = NWC24ReadMsgField(msg, "x-wii-mb-updatesw:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE - 1);
if (result != NWC24_OK) {
return result;
}
while (*pWork == '\t' || *pWork == ' ') {
pWork++;
}
if (Mail_isdigit(*pWork)) {
value = *pWork - '0';
}
*mbUpdateSW = value;
return result;
}
NWC24Err NWC24ReadMsgMBOptOutFlag(const NWC24MsgObj* msg, BOOL* mbOptOutFlag,
u32* appId) {
NWC24Err result;
char* pWork = NWC24WorkP->stringWork;
s32 digit;
u32 i;
u32 digits;
u32 value;
char* p;
i = 0;
digits = 0;
value = 0;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
*mbOptOutFlag = FALSE;
*appId = 0;
result = NWC24ReadMsgField(msg, "x-wii-mb-optout:", (u8*)pWork,
NWC24i_STRING_WORK_SIZE - 1);
if (result == NWC24_ERR_NOT_FOUND) {
return NWC24_OK;
}
if (result != NWC24_OK) {
return result;
}
p = pWork;
while (*p == '\t' || *p == ' ') {
p++;
i++;
}
if (*p == '1') {
*mbOptOutFlag = TRUE;
}
p += 2;
if (p[-1] != '-') {
return NWC24_OK;
}
i += 2;
while (i < NWC24i_STRING_WORK_SIZE) {
digit = Util_xtoi(*p);
if (digit < 0) {
break;
}
value = (value << 4) | digit;
p++;
i++;
digits++;
}
if (digits != 8) {
result = NWC24_ERR_FORMAT;
}
*appId = value;
return result;
}
NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* addr,
u32 addrLen) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
char* pWork;
NWC24Err result;
NWC24Err closeResult;
NWC24MsgBoxId id;
u32 flags;
NWC24FileStream stream;
NWC24File file;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED;
}
if (!(msg->data[1] & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
pWork = NWC24WorkP->stringWork;
Mail_memset(pWork, 0, NWC24i_STRING_WORK_SIZE);
if (!(msg->data[1] & MSG_OBJ_FOR_PUBLIC)) {
return NWC24_ERR_NOT_SUPPORTED;
}
flags = pMsg->type;
if (flags & MSG_OBJ_TO_SEND) {
id = NWC24_MSGBOX_SEND;
} else if (flags & MSG_OBJ_TO_RECV) {
id = NWC24_MSGBOX_RECV;
} else {
result = NWC24_ERR_INVALID_VALUE;
goto select_done;
}
result = NWC24_OK;
select_done:
if (result != NWC24_OK) {
return result;
}
if (pMsg->unk_0x30.size == 0) {
return NWC24_ERR_NULL;
}
result = NWC24iMBoxOpenStoredMsg(id, pMsg->msgId, &file);
if (result != NWC24_OK) {
return result;
}
result = NWC24FStreamInit(&stream, &file, 0, pMsg->length, pWork,
NWC24i_STRING_WORK_SIZE);
if (result == NWC24_OK) {
result = NWC24FStreamSeek(&stream, pMsg->unk_0x30.offset);
if (result == NWC24_OK) {
result = NWC24iExtractAddrSpec(&stream, pMsg->unk_0x30.size, 0,
addr, addrLen);
}
}
closeResult = NWC24iMBoxCloseMsg(&file);
if (result != NWC24_OK) {
return result;
}
return closeResult;
}
NWC24Err NWC24ReadMsgSubject(const NWC24MsgObj* msg, char* subject,
u32 subjectLen) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
NWC24Err result;
NWC24Err closeResult;
NWC24MsgBoxId id;
u32 flags;
u32 length;
NWC24File file;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED;
}
if (!(msg->data[1] & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
flags = pMsg->type;
if (flags & MSG_OBJ_TO_SEND) {
id = NWC24_MSGBOX_SEND;
} else if (flags & MSG_OBJ_TO_RECV) {
id = NWC24_MSGBOX_RECV;
} else {
result = NWC24_ERR_INVALID_VALUE;
goto select_done;
}
result = NWC24_OK;
select_done:
if (result != NWC24_OK) {
return result;
}
length = pMsg->subject.size;
if (length == 0) {
return NWC24_ERR_NULL;
}
result = NWC24iMBoxOpenStoredMsg(id, pMsg->msgId, &file);
if (result != NWC24_OK) {
return result;
}
if (length > subjectLen - 1) {
length = subjectLen - 1;
}
NWC24FSeek(&file, pMsg->subject.offset, NWC24_SEEK_BEG);
result = NWC24FRead(subject, length, &file);
if (result == NWC24_OK) {
subject[length] = '\0';
if (pMsg->subject.size > subjectLen - 1) {
result = NWC24_ERR_OVERFLOW;
}
}
closeResult = NWC24iMBoxCloseMsg(&file);
if (result == NWC24_OK) {
result = closeResult;
}
return result;
}
NWC24Err NWC24ReadMsgText(const NWC24MsgObj* msg, char* text, u32 textLen,
NWC24Charset* charset, NWC24Encoding* encoding) {
NWC24Err result;
char* charsetStr = (char*)NWC24WorkP + 0x20;
result = ReadMsgTextInternal(msg, text, textLen, charsetStr, 0x40,
encoding);
if (result == NWC24_OK) {
result = NWC24ParseCharsetStr(charset, charsetStr);
}
return result;
}
NWC24Err NWC24ReadMsgTextEx(const NWC24MsgObj* msg, char* text, u32 textLen,
const char* name, u32 nameLen,
NWC24Charset* charset, NWC24Encoding* encoding) {
NWC24Err result;
NWC24Encoding enc;
char* pName;
char c;
u32 i;
result = ReadMsgTextInternal(msg, text, textLen, (char*)name, nameLen,
&enc);
if (result == NWC24_OK) {
pName = (char*)name;
for (i = 0; i < nameLen; i++) {
c = *pName;
switch (c) {
case ' ':
case '\r':
case '\t':
case '\n':
case ';':
case '"':
*pName = '\0';
break;
}
if (*pName == '\0') {
break;
}
pName++;
}
}
return result;
}
static NWC24Err ReadMsgTextInternal(const NWC24MsgObj* msg, char* text,
u32 textLen, char* name, u32 nameLen,
NWC24Encoding* encoding) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
NWC24Err retCode;
NWC24Err result;
NWC24Err closeResult;
NWC24MsgBoxId id;
u32 length;
u32 decodeSize;
u32 flags;
char* pWork;
NWC24File file;
retCode = NWC24_OK;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED;
}
if (!(msg->data[1] & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
pWork = NWC24WorkP->stringWork;
if (pMsg->type & MSG_OBJ_TO_SEND) {
id = NWC24_MSGBOX_SEND;
} else if (pMsg->type & MSG_OBJ_TO_RECV) {
id = NWC24_MSGBOX_RECV;
} else {
result = NWC24_ERR_INVALID_VALUE;
goto select_done;
}
result = NWC24_OK;
*encoding = NWC24_ENC_7BIT;
select_done:
if (result != NWC24_OK) {
return result;
}
if (pMsg->textSize != 0) {
length = pMsg->textSize;
} else {
length = pMsg->text.size;
}
if (length == 0) {
return NWC24_ERR_NULL;
}
if (length > textLen - 1) {
length = textLen - 1;
retCode = NWC24_ERR_OVERFLOW;
}
result = NWC24iMBoxOpenStoredMsg(id, pMsg->msgId, &file);
if (result != NWC24_OK) {
return result;
}
Mail_memset(name, 0, nameLen);
if (pMsg->unk_0x50.size >= nameLen) {
result = NWC24_ERR_FORMAT;
} else {
if (pMsg->unk_0x50.size != 0) {
NWC24FSeek(&file, pMsg->unk_0x50.offset, NWC24_SEEK_BEG);
result = NWC24FRead(name, pMsg->unk_0x50.size, &file);
}
if (result == NWC24_OK && pMsg->unk_0x58.size != 0 &&
pMsg->unk_0x58.size < 0x20) {
Mail_memset(pWork, 0, 0x20);
NWC24FSeek(&file, pMsg->unk_0x58.offset, NWC24_SEEK_BEG);
result = NWC24FRead(pWork, pMsg->unk_0x58.size, &file);
if (result == NWC24_OK) {
result = NWC24ParseEncodingStr(encoding, pWork);
}
}
if (result == NWC24_OK) {
NWC24FSeek(&file, pMsg->text.offset, NWC24_SEEK_BEG);
switch (*encoding) {
case NWC24_ENC_7BIT:
case NWC24_ENC_8BIT:
result = NWC24FRead(text, length, &file);
text[length] = '\0';
break;
case NWC24_ENC_BASE64:
decodeSize = 0;
result = ReadBase64Data(&file, &pMsg->text, (u8*)text, length,
&decodeSize);
if (result == NWC24_OK && decodeSize != pMsg->textSize) {
result = NWC24_ERR_FORMAT;
}
text[length] = '\0';
break;
case NWC24_ENC_QUOTED_PRINTABLE:
result = ReadQPText(msg, &file, text, length);
break;
default:
result = NWC24_ERR_NOT_SUPPORTED;
text[0] = '\0';
break;
}
}
}
closeResult = NWC24iMBoxCloseMsg(&file);
if (result != NWC24_OK) {
closeResult = result;
}
if (closeResult != NWC24_OK) {
retCode = closeResult;
}
return retCode;
}
NWC24Err NWC24ReadMsgAttached(const NWC24MsgObj* msg, u32 attachIndex,
u8* attachData, u32 attachSize) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
NWC24Err result;
NWC24Err closeResult;
NWC24MsgBoxId id;
u32 flags;
u32 decodeSize;
NWC24File file;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED;
}
if (!(msg->data[1] & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
if (attachIndex >= pMsg->numAttached) {
return NWC24_ERR_NOT_FOUND;
}
flags = pMsg->type;
if (flags & MSG_OBJ_TO_SEND) {
id = NWC24_MSGBOX_SEND;
} else if (flags & MSG_OBJ_TO_RECV) {
id = NWC24_MSGBOX_RECV;
} else {
result = NWC24_ERR_INVALID_VALUE;
goto select_done;
}
result = NWC24_OK;
select_done:
if (result != NWC24_OK) {
return result;
}
if (pMsg->attached[attachIndex].size == 0 ||
pMsg->attachedSize[attachIndex] == 0) {
return NWC24_ERR_NULL;
}
result = NWC24iMBoxOpenStoredMsg(id, pMsg->msgId, &file);
if (result != NWC24_OK) {
return result;
}
decodeSize = 0;
result = ReadBase64Data(&file, &pMsg->attached[attachIndex], attachData,
attachSize, &decodeSize);
if (result == NWC24_OK && decodeSize != pMsg->attachedSize[attachIndex]) {
result = NWC24_ERR_FORMAT;
}
closeResult = NWC24iMBoxCloseMsg(&file);
if (result == NWC24_OK) {
result = closeResult;
}
return result;
}
static NWC24Err ReadBase64Data(NWC24File* file, const NWC24Data* data,
u8* out, u32 outSize, u32* outLen) {
char* pWork;
NWC24Err result;
s32 remaining;
u32 offset;
u32 written;
u32 chunk;
u32 decodeLen;
u32 decodeSize;
BOOL done;
int i;
pWork = NWC24WorkP->mainWork;
remaining = data->size;
offset = data->offset;
written = 0;
result = NWC24_OK;
done = FALSE;
while (remaining > 0 && !done) {
chunk = remaining > NWC24i_STRING_WORK_SIZE
? NWC24i_STRING_WORK_SIZE
: remaining;
NWC24FSeek(file, offset, NWC24_SEEK_BEG);
result = NWC24FRead(pWork, chunk, file);
if (result != NWC24_OK) {
break;
}
decodeLen = 0;
for (i = 0; i < chunk; i++) {
if (pWork[i] == '\r') {
decodeLen = i;
}
if (pWork[i] == '=') {
decodeLen = i + 1;
done = TRUE;
result = NWC24_OK;
break;
}
}
if (decodeLen == 0) {
break;
}
result = NWC24Base64Decode((u8*)pWork, decodeLen, out, outSize - written,
&decodeSize);
if (result != NWC24_OK) {
break;
}
offset += decodeLen;
remaining -= decodeLen;
written += decodeSize;
out += decodeSize;
}
if (result == NWC24_OK) {
*outLen = written;
}
return result;
}
static NWC24Err ReadQPText(const NWC24MsgObj* msg, NWC24File* file, char* text,
u32 textSize) {
const NWC24MsgObjPrivate* pMsg = (const NWC24MsgObjPrivate*)msg;
char* pWork;
NWC24Err result;
s32 remaining;
u32 offset;
u32 written;
s32 chunk;
u32 decLen;
u32 encLen;
pWork = NWC24WorkP->mainWork;
remaining = pMsg->text.size;
offset = pMsg->text.offset;
written = 0;
result = NWC24_OK;
while (remaining > 0) {
chunk = remaining > NWC24i_STRING_WORK_SIZE
? NWC24i_STRING_WORK_SIZE
: remaining;
NWC24FSeek(file, offset, NWC24_SEEK_BEG);
result = NWC24FRead(pWork, chunk, file);
if (result != NWC24_OK) {
break;
}
encLen = chunk;
if (chunk == NWC24i_STRING_WORK_SIZE) {
if (pWork[chunk - 1] == '=') {
encLen = chunk - 1;
} else if (pWork[chunk - 2] == '=') {
encLen = chunk - 2;
}
}
result = NWC24DecodeQuotedPrintable(text, textSize - written, &decLen,
(u8*)pWork, encLen, &encLen);
if (result != NWC24_OK && result != NWC24_ERR_OVERFLOW) {
break;
}
written += decLen;
text += decLen;
if (result == NWC24_ERR_OVERFLOW) {
break;
}
offset += encLen;
remaining -= encLen;
}
*text = '\0';
if (result == NWC24_OK && written > pMsg->textSize) {
result = NWC24_ERR_FORMAT;
}
return result;
}

View File

@@ -1,983 +0,0 @@
#include <private/nwc24.h>
#include <revolution/nwc24.h>
#include <revolution/enc.h>
#include <string.h>
enum {
MSG_OBJ_INITIALIZED = (1 << 8),
MSG_OBJ_DELIVERING = (1 << 9),
};
#define NWC24i_CHARSET_WORK_SIZE 0x40
#define NWC24i_WORD_LINE_SIZE 0x3f
#define NWC24i_WORD_LINE_SIZE_QP 0x47
static NWC24Err NWC24iGetDefaultCharset(char* charset, u32 size,
NWC24EncodingRegion region);
static NWC24Err NWC24iConvertToInternalEncoding(u16* dst, u32* dstSize,
const u8* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt);
static NWC24Err NWC24iConvertFromInternalEncoding(u8* dst, u32* dstSize,
const u16* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt);
static NWC24Err NWC24iDetectEncodingToSend(char* charset, u32 charsetSize,
const u16* src1, u32 src1Len,
const u16* src2, u32 src2Len,
NWC24EncodingRegion region);
static NWC24Err NWC24iDetectBreakPoint(u32* pos, NWC24Charset charset,
const u8* str, u32 size, u32 limit);
static NWC24Err NWC24iSetMsgSubjectPlain(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize, u32 charset,
char* charsetName);
static NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize, u32 charset,
char* charsetName);
static NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize, u32 charset,
char* charsetName);
static const char* sEncNamesJpn[3] = {
"us-ascii", "iso-2022-jp", "utf-8",
};
static const char* sEncNamesWest[8] = {
"us-ascii", "iso-8859-1", "windows-1252", "iso-8859-2",
"iso-8859-7", "iso-8859-10", "iso-8859-3", "utf-8",
};
static const char* sEncNamesKor[3] = {
"us-ascii", "euc-kr", "utf-8",
};
static const char* sEncNamesChn[2] = {
"us-ascii", "gb2312",
};
NWC24Err NWC24ReadMsgSubjectPublic(const NWC24MsgObj* msg, u16* subject,
u32* subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize) {
NWC24Err result;
NWC24Err readResult;
BOOL overflow;
u32 saved;
u32 half;
u32 quota;
u8* buf;
u32 size;
u32 written;
u32 i;
u16* p;
u16 c;
if (subjectLen == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
saved = *subjectLen;
*subjectLen = 0;
overflow = FALSE;
if (work == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
half = workSize / 2;
buf = work + half;
quota = workSize - half;
result = NWC24GetMsgSubjectSize(msg, &size);
if (result != NWC24_OK) {
return result;
}
if (size > half) {
size = half;
overflow = TRUE;
}
result = NWC24ReadMsgSubject(msg, (char*)work, size);
if (result != NWC24_OK) {
if (result != NWC24_ERR_OVERFLOW) {
return result;
}
overflow = TRUE;
}
result = NWC24DecodeMIMEHeaderFieldBody((u8*)NWC24WorkP, NWC24i_CHARSET_WORK_SIZE,
buf, quota, &written, work, size);
if (result != NWC24_OK) {
if (result != NWC24_ERR_OVERFLOW) {
return result;
}
overflow = TRUE;
}
*subjectLen = saved;
result = NWC24iConvertToInternalEncoding(subject, subjectLen, buf,
(s32*)&written,
(char*)NWC24WorkP,
NWC24i_CHARSET_WORK_SIZE, encRegion,
unk);
if (result != NWC24_OK && result != NWC24_ERR_OVERFLOW) {
return result;
}
for (i = 0, p = subject; i < *subjectLen && (c = *p) != 0; i++, p++) {
if (c == '\r' || c == '\n') {
*p = ' ';
}
}
if (result != NWC24_OK) {
return result;
}
if (overflow) {
return NWC24_ERR_OVERFLOW;
}
return NWC24_OK;
}
NWC24Err NWC24ReadMsgTextPublic(const NWC24MsgObj* msg, u16* text, u32* textLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize) {
NWC24Err result;
u32 size;
u32 saved;
BOOL overflow;
char* charsetBuf;
if (textLen == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
saved = *textLen;
*textLen = 0;
overflow = FALSE;
if (work == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
result = NWC24GetMsgTextSize(msg, &size);
if (result != NWC24_OK) {
return result;
}
if (size > workSize) {
size = workSize;
overflow = TRUE;
}
result = NWC24ReadMsgTextEx(msg, (char*)work, size,
charsetBuf = (char*)NWC24WorkP + 0x20,
NWC24i_CHARSET_WORK_SIZE, (NWC24Charset*)work,
(NWC24Encoding*)workSize);
if (result != NWC24_OK) {
if (result != NWC24_ERR_OVERFLOW) {
return result;
}
overflow = TRUE;
}
*textLen = saved;
result = NWC24iConvertToInternalEncoding(text, textLen, work,
(s32*)&size, charsetBuf,
NWC24i_CHARSET_WORK_SIZE, encRegion,
unk);
if (result != NWC24_OK) {
return result;
}
if (overflow) {
result = NWC24_ERR_OVERFLOW;
}
return result;
}
NWC24Err NWC24SetMsgSubjectPublic(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen, NWC24EncodingRegion encRegion,
u16 unk, u8* work, u32 workSize) {
NWC24Err result;
volatile u32 charset;
NWC24Encoding encoding;
char* charsetName;
u32 type;
type = msg->data[1];
if (!(type & MSG_OBJ_INITIALIZED) || (type & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
if (subject == NULL || subject[0] == 0) {
return NWC24_ERR_NULL;
}
if (subject[subjectLen] != 0) {
return NWC24_ERR_STRING_END;
}
if (work == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
charsetName = (char*)NWC24WorkP;
result = NWC24iDetectEncodingToSend(charsetName,
NWC24i_CHARSET_WORK_SIZE, subject,
subjectLen, NULL, 0, encRegion);
if (result != NWC24_OK) {
return result;
}
result = NWC24ParseCharsetStr((NWC24Charset*)&charset, charsetName);
if (result != NWC24_OK) {
charset = 0;
}
if (charset == 0) {
return NWC24iSetMsgSubjectPlain(msg, subject, subjectLen, encRegion,
unk, work, workSize, charset,
charsetName);
}
switch (encRegion) {
case NWC24_ENCODING_REGION_JPN:
encoding = 2;
break;
case NWC24_ENCODING_REGION_USA:
case NWC24_ENCODING_REGION_EUR:
encoding = 3;
break;
case NWC24_ENCODING_REGION_KOR:
case NWC24_ENCODING_REGION_CHN:
encoding = 2;
break;
default:
encoding = 2;
break;
}
if (encoding == NWC24_ENC_QUOTED_PRINTABLE) {
return NWC24iSetMsgSubjectQP(msg, subject, subjectLen, encRegion, unk,
work, workSize, charset,
charsetName);
}
return NWC24iSetMsgSubjectBase64(msg, subject, subjectLen, encRegion, unk,
work, workSize, charset,
charsetName);
}
NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen, const u16* text,
u32 textLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize) {
char* charsetName;
NWC24Err result;
u32 quota;
s32 convSize;
volatile u32 charset;
BOOL is7Bit;
NWC24Encoding encoding;
u32 subjQuota;
u8* subjWork;
u32 type;
type = msg->data[1];
if (!(type & MSG_OBJ_INITIALIZED) || (type & MSG_OBJ_DELIVERING)) {
return NWC24_ERR_PROTECTED;
}
if (subject == NULL || subject[0] == 0) {
return NWC24_ERR_NULL;
}
if (text == NULL || textLen == 0) {
NWC24Data_Init(&((NWC24MsgObjPrivate*)msg)->text);
return NWC24SetMsgSubjectPublic(msg, subject, subjectLen, encRegion,
unk, work, workSize);
}
if (text[textLen] != 0 || subject[subjectLen] != 0) {
return NWC24_ERR_STRING_END;
}
if (work == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
charsetName = (char*)NWC24WorkP;
result = NWC24iDetectEncodingToSend(charsetName, NWC24i_CHARSET_WORK_SIZE,
subject, subjectLen, text, textLen,
encRegion);
if (result != NWC24_OK) {
return result;
}
result = NWC24ParseCharsetStr((NWC24Charset*)&charset, charsetName);
if (result != NWC24_OK) {
charset = 0;
}
convSize = textLen;
quota = (workSize * textLen) / (textLen + subjectLen * 4);
subjQuota = workSize - quota;
subjWork = work + quota;
result = NWC24iConvertFromInternalEncoding(work, &quota, text, &convSize,
charsetName,
NWC24i_CHARSET_WORK_SIZE,
encRegion, unk);
if (result != NWC24_OK) {
return result;
}
result = ENCIs7BitEncoding(&is7Bit, charsetName);
if (is7Bit && result == 0) {
encoding = NWC24_ENC_7BIT;
} else {
switch (encRegion) {
case NWC24_ENCODING_REGION_JPN:
encoding = NWC24_ENC_BASE64;
break;
case NWC24_ENCODING_REGION_USA:
case NWC24_ENCODING_REGION_EUR:
encoding = NWC24_ENC_QUOTED_PRINTABLE;
break;
case NWC24_ENCODING_REGION_KOR:
case NWC24_ENCODING_REGION_CHN:
encoding = NWC24_ENC_BASE64;
break;
default:
encoding = NWC24_ENC_BASE64;
break;
}
}
result = NWC24SetMsgText(msg, (const char*)work, quota - 1, charset,
encoding);
if (result != NWC24_OK) {
return result;
}
if (charset == 0) {
return NWC24iSetMsgSubjectPlain(msg, subject, subjectLen, encRegion,
unk, subjWork, subjQuota, charset,
charsetName);
}
switch (encRegion) {
case NWC24_ENCODING_REGION_JPN:
encoding = NWC24_ENC_BASE64;
break;
case NWC24_ENCODING_REGION_USA:
case NWC24_ENCODING_REGION_EUR:
encoding = NWC24_ENC_QUOTED_PRINTABLE;
break;
case NWC24_ENCODING_REGION_KOR:
case NWC24_ENCODING_REGION_CHN:
encoding = NWC24_ENC_BASE64;
break;
default:
encoding = NWC24_ENC_BASE64;
break;
}
if (encoding == NWC24_ENC_QUOTED_PRINTABLE) {
return NWC24iSetMsgSubjectQP(msg, subject, subjectLen, encRegion, unk,
subjWork, subjQuota, charset,
charsetName);
}
return NWC24iSetMsgSubjectBase64(msg, subject, subjectLen, encRegion, unk,
subjWork, subjQuota, charset,
charsetName);
}
#pragma dont_inline on
static NWC24Err NWC24iGetDefaultCharset(char* charset, u32 size,
NWC24EncodingRegion region) {
NWC24Err result = NWC24_OK;
switch (region) {
case NWC24_ENCODING_REGION_JPN:
strncpy(charset, "iso-2022-jp", size - 1);
charset[size - 1] = 0;
break;
case NWC24_ENCODING_REGION_USA:
strncpy(charset, "iso-8859-1", size - 1);
charset[size - 1] = 0;
break;
case NWC24_ENCODING_REGION_EUR:
strncpy(charset, "iso-8859-1", size - 1);
charset[size - 1] = 0;
break;
case NWC24_ENCODING_REGION_KOR:
strncpy(charset, "euc-kr", size - 1);
charset[size - 1] = 0;
break;
case NWC24_ENCODING_REGION_CHN:
strncpy(charset, "gb2312", size - 1);
charset[size - 1] = 0;
break;
default:
strncpy(charset, "iso-8859-1", size - 1);
charset[size - 1] = 0;
result = NWC24_ERR_INVALID_VALUE;
break;
}
return result;
}
#pragma dont_inline reset
static NWC24Err NWC24iConvertToInternalEncoding(u16* dst, u32* dstSize,
const u8* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt);
static NWC24Err NWC24iConvertFromInternalEncoding(u8* dst, u32* dstSize,
const u16* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt);
static NWC24Err NWC24iDetectEncodingToSend(char* charset, u32 charsetSize,
const u16* src1, u32 src1Len,
const u16* src2, u32 src2Len,
NWC24EncodingRegion region);
static NWC24Err NWC24iDetectBreakPoint(u32* pos, NWC24Charset charset,
const u8* str, u32 size, u32 limit);
static NWC24Err NWC24iConvertToInternalEncoding(u16* dst, u32* dstSize,
const u8* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt) {
ENCContext ctx;
NWC24Err result;
s32 encErr;
u32 byteSize;
u32 cap;
cap = *dstSize * 2;
*dstSize = 0;
if (cap < 2) {
return NWC24_ERR_OVERFLOW;
}
if (*charset == '\0') {
result = NWC24iGetDefaultCharset(charset, charsetSize, region);
if (result != NWC24_OK) {
return result;
}
}
do {
encErr = ENCInitContext(&ctx);
if (encErr != 0) {
break;
}
encErr = ENCSetExternalEncoding(&ctx, charset);
if (encErr != 0) {
break;
}
encErr = ENCSetBreakType(&ctx, 3);
if (encErr != 0) {
break;
}
if (alt != 0) {
encErr = ENCSetAlternativeCharacter(&ctx, alt, alt);
if (encErr != 0) {
break;
}
}
byteSize = cap - 2;
encErr = ENCConvertToInternalEncoding(&ctx, dst, (s32*)&byteSize,
src, srcSize);
dst[(byteSize & ~1u) / 2] = 0;
*dstSize = byteSize / 2 + 1;
} while (0);
switch (encErr) {
case 0:
result = NWC24_OK;
break;
case -3:
result = NWC24_ERR_INVALID_VALUE;
break;
case -1:
result = NWC24_ERR_OVERFLOW;
break;
case -2:
case -4:
result = NWC24_ERR_INVALID_CHAR;
break;
case -5:
case -6:
case -7:
result = NWC24_ERR_NOT_SUPPORTED;
break;
default:
result = NWC24_ERR_FATAL;
break;
}
return result;
}
static NWC24Err NWC24iConvertFromInternalEncoding(u8* dst, u32* dstSize,
const u16* src, s32* srcSize,
char* charset, u32 charsetSize,
NWC24EncodingRegion region,
u16 alt) {
ENCContext ctx;
NWC24Err result;
s32 encErr;
u32 cap;
u32 dstCap;
u32 srcBytes;
cap = *dstSize;
*dstSize = 0;
if (cap < 1) {
return NWC24_ERR_OVERFLOW;
}
if (*charset == '\0') {
result = NWC24iGetDefaultCharset(charset, charsetSize, region);
if (result != NWC24_OK) {
return result;
}
}
do {
encErr = ENCInitContext(&ctx);
if (encErr != 0) {
break;
}
encErr = ENCSetExternalEncoding(&ctx, charset);
if (encErr != 0) {
break;
}
encErr = ENCSetBreakType(&ctx, 1);
if (encErr != 0) {
break;
}
if (alt != 0) {
encErr = ENCSetAlternativeCharacter(&ctx, alt, alt);
if (encErr != 0) {
break;
}
}
dstCap = cap - 1;
srcBytes = *srcSize * 2;
encErr = ENCConvertFromInternalEncoding(&ctx, dst, (s32*)&dstCap,
src, (s32*)&srcBytes);
dst[dstCap] = 0;
*srcSize = srcBytes / 2;
*dstSize = dstCap + 1;
} while (0);
switch (encErr) {
case 0:
result = NWC24_OK;
break;
case -3:
result = NWC24_ERR_INVALID_VALUE;
break;
case -1:
result = NWC24_ERR_OVERFLOW;
break;
case -2:
case -4:
result = NWC24_ERR_INVALID_CHAR;
break;
case -5:
case -6:
case -7:
result = NWC24_ERR_NOT_SUPPORTED;
break;
default:
result = NWC24_ERR_FATAL;
break;
}
return result;
}
static NWC24Err NWC24iDetectEncodingToSend(char* charset, u32 charsetSize,
const u16* src1, u32 src1Len,
const u16* src2, u32 src2Len,
NWC24EncodingRegion region) {
const char** names;
int numNames;
int found;
int i;
int prev;
s32 err;
u32 src1Bytes;
u32 src2Bytes;
found = 0;
i = 0;
prev = -1;
switch (region) {
case NWC24_ENCODING_REGION_JPN:
names = (const char**)sEncNamesJpn;
numNames = 3;
break;
case NWC24_ENCODING_REGION_USA:
case NWC24_ENCODING_REGION_EUR:
names = (const char**)sEncNamesWest;
numNames = 8;
break;
case NWC24_ENCODING_REGION_KOR:
names = (const char**)sEncNamesKor;
numNames = 3;
break;
case NWC24_ENCODING_REGION_CHN:
names = (const char**)sEncNamesChn;
numNames = 2;
break;
default:
names = (const char**)sEncNamesWest;
numNames = 8;
break;
}
src1Bytes = src1Len * 2;
src2Bytes = src2Len * 2;
while (found < numNames - 1) {
err = ENCCheckEncoding(&found, names + i, numNames - 1 - i,
(u16*)src1, src1Bytes);
if (err != 0) {
return NWC24_ERR_NOT_SUPPORTED;
}
if (found == -1) {
found = numNames - 1;
break;
}
i += found;
if (src2 == NULL || prev == i) {
found = i;
break;
}
err = ENCCheckEncoding(&found, names + i, numNames - 1 - i,
(u16*)src2, src2Bytes);
if (err != 0) {
return NWC24_ERR_NOT_SUPPORTED;
}
if (found == -1) {
found = numNames - 1;
break;
}
prev = i + found;
if (prev == i) {
found = prev;
break;
}
i = prev;
}
strncpy(charset, names[found], charsetSize - 1);
charset[charsetSize - 1] = 0;
return NWC24_OK;
}
static NWC24Err NWC24iDetectBreakPoint(u32* pos, NWC24Charset charset,
const u8* str, u32 size, u32 limit) {
const u8* p;
u32 flag;
u32 i = 0;
u32 last = 0;
u32 j;
if (pos == NULL || str == NULL) {
return NWC24_ERR_INVALID_VALUE;
}
if (charset == 0) {
flag = 1;
} else if (charset == 0x10008) {
flag = 0;
} else if ((charset & 0xffff0000u) == 0x80000 ||
charset == 0xf1252) {
flag = 1;
} else {
return NWC24_ERR_NOT_SUPPORTED;
}
if (size <= limit) {
*pos = size;
return NWC24_OK;
}
for (p = str; i < limit && *str != '\0'; i++, p++) {
if (*p == ' ') {
last = i;
}
}
if (last != 0) {
*pos = last;
return NWC24_OK;
}
if (flag != 0) {
*pos = limit;
return NWC24_OK;
}
for (j = 0, p = str; j < limit && *str != '\0'; j++, p++) {
if ((*p & 0xc0u) != 0x80u) {
last = j;
}
}
*pos = last;
return NWC24_OK;
}
static NWC24Err NWC24iSetMsgSubjectPlain(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize, u32 charset,
char* charsetName) {
u32 halfSize;
u32 srcLen;
u32 srcPos;
u32 cap;
u8* buf2;
u32 bufLen;
u8* p;
u32 i;
NWC24Err result;
u32 pos;
srcLen = subjectLen;
halfSize = workSize / 2;
pos = 0;
cap = workSize - halfSize;
buf2 = work + halfSize;
result = NWC24iConvertFromInternalEncoding(work, &halfSize, subject,
(s32*)&srcLen, charsetName,
NWC24i_CHARSET_WORK_SIZE,
encRegion, unk);
if (result != NWC24_OK) {
return result;
}
srcLen = halfSize - 1;
for (p = work, i = 0; i < halfSize; p++, i++) {
if (*p == '\n' || *p == '\r') {
*p = ' ';
}
}
NWC24iDetectBreakPoint(&pos, charset, work, srcLen,
NWC24i_WORD_LINE_SIZE);
if (pos == srcLen) {
return NWC24SetMsgSubject(msg, (const char*)work, srcLen);
}
halfSize = cap;
if (cap <= pos) {
return NWC24_ERR_OVERFLOW;
}
srcPos = pos;
bufLen = NWC24iStrLCpy((char*)buf2, (const char*)work, pos + 1);
while (srcPos < srcLen) {
if (halfSize - bufLen < 3) {
return NWC24_ERR_OVERFLOW;
}
buf2[bufLen++] = '\r';
buf2[bufLen++] = '\n';
if (work[srcPos] != ' ') {
buf2[bufLen++] = ' ';
}
NWC24iDetectBreakPoint(&pos, charset, work + srcPos,
srcLen - srcPos, 0x47);
if (halfSize - bufLen <= pos) {
return NWC24_ERR_OVERFLOW;
}
bufLen += NWC24iStrLCpy((char*)buf2 + bufLen,
(const char*)work + srcPos, pos + 1);
srcPos += pos;
}
buf2[bufLen] = 0;
return NWC24SetMsgSubject(msg, (const char*)buf2, bufLen);
}
static NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion, u16 unk,
u8* work, u32 workSize, u32 charset,
char* charsetName) {
u32 halfSize;
u32 srcLen;
u32 pos;
u32 cap;
u8* buf2;
u32 bufLen;
u32 srcPos;
u32 encLen;
u8* p;
u32 i;
NWC24Err result;
u32 limit;
srcLen = subjectLen;
halfSize = workSize / 2;
cap = workSize - halfSize;
buf2 = work + halfSize;
pos = 0;
result = NWC24iConvertFromInternalEncoding(work, &halfSize, subject,
(s32*)&srcLen, charsetName,
NWC24i_CHARSET_WORK_SIZE,
encRegion, unk);
if (result != NWC24_OK) {
return result;
}
srcLen = halfSize - 1;
for (p = work, i = 0; i < halfSize; p++, i++) {
if (*p == '\n' || *p == '\r') {
*p = ' ';
}
}
limit = (0x38 - strlen(charsetName)) / 3;
NWC24iDetectBreakPoint(&pos, charset, work, srcLen, limit);
result = NWC24EncodeWord(buf2, cap, &encLen, charsetName,
NWC24i_CHARSET_WORK_SIZE, 'Q', work, pos);
if (result != NWC24_OK) {
return result;
}
srcPos = pos;
if (srcPos == srcLen) {
return NWC24SetMsgSubject(msg, (const char*)buf2, encLen - 1);
}
limit = (0x40 - strlen(charsetName)) / 3;
halfSize = cap;
bufLen = encLen - 1;
while (srcPos < srcLen) {
if (halfSize - bufLen < 3) {
return NWC24_ERR_OVERFLOW;
}
buf2[bufLen++] = '\r';
buf2[bufLen++] = '\n';
buf2[bufLen++] = ' ';
NWC24iDetectBreakPoint(&pos, charset, work + srcPos,
srcLen - srcPos, limit);
result = NWC24EncodeWord(buf2 + bufLen, halfSize - bufLen, &encLen,
charsetName, NWC24i_CHARSET_WORK_SIZE, 'Q',
work + srcPos, pos);
if (result != NWC24_OK) {
return result;
}
bufLen += encLen - 1;
srcPos += pos;
}
return NWC24SetMsgSubject(msg, (const char*)buf2, bufLen);
}
static NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject,
u32 subjectLen,
NWC24EncodingRegion encRegion,
u16 unk, u8* work, u32 workSize,
u32 charset, char* charsetName) {
u32 encLen;
u32 srcLen;
u32 convert;
u32 halfSize;
u32 cap;
u8* buf2;
u32 bufLen;
u32 srcPos;
u32 chunk;
NWC24Err result;
halfSize = workSize / 2;
buf2 = work + halfSize;
cap = workSize - halfSize;
chunk = (0x36 - strlen(charsetName)) * 3 / 4;
if (chunk > halfSize) {
return NWC24_ERR_OVERFLOW;
}
srcLen = subjectLen;
convert = chunk + 1;
result = NWC24iConvertFromInternalEncoding(work, &convert, subject,
(s32*)&srcLen, charsetName,
NWC24i_CHARSET_WORK_SIZE,
encRegion, unk);
if (result != NWC24_OK && result != NWC24_ERR_OVERFLOW) {
return result;
}
result = NWC24EncodeWord(buf2, cap, &encLen, charsetName,
NWC24i_CHARSET_WORK_SIZE, 'B', work, convert - 1);
if (result != NWC24_OK) {
return result;
}
srcPos = srcLen;
if (srcPos == subjectLen) {
return NWC24SetMsgSubject(msg, (const char*)buf2, encLen - 1);
}
chunk = (0x3e - strlen(charsetName)) * 3 / 4 + 1;
bufLen = encLen - 1;
while (srcPos < subjectLen) {
if (cap - bufLen < 3) {
return NWC24_ERR_OVERFLOW;
}
srcLen = subjectLen - srcPos;
convert = chunk;
buf2[bufLen++] = '\r';
buf2[bufLen++] = '\n';
buf2[bufLen++] = ' ';
result = NWC24iConvertFromInternalEncoding(work, &convert,
subject + srcPos,
(s32*)&srcLen, charsetName,
NWC24i_CHARSET_WORK_SIZE,
encRegion, unk);
if (result != NWC24_OK && result != NWC24_ERR_OVERFLOW) {
return result;
}
result = NWC24EncodeWord(buf2 + bufLen, cap - bufLen, &encLen,
charsetName, NWC24i_CHARSET_WORK_SIZE, 'B',
work, convert - 1);
if (result != NWC24_OK) {
return result;
}
bufLen += encLen - 1;
srcPos += srcLen;
}
return NWC24SetMsgSubject(msg, (const char*)buf2, bufLen);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,5 @@
#define IPL_BOARD_DATE_CTOR_OUT_OF_LINE
#define IPL_BOARD_WEEK_FUNCTION_OUT_OF_LINE
#include "iplSceneUI.h"
#include "iplSystem.h"
#if defined(SYSMENU_REGION_USA)
#define IPL_BOARD_DATE_HELPERS_INLINE
#endif
#define IPL_BOARD_INLINE_GETTERS
#include "scene/board/iplBoard.h"
#include "scene/board/iplBoardObject.h"
@@ -23,6 +13,8 @@
#include "scene/setting/iplSetting.h"
#include "iplSystem.h"
#include "utility/iplRBRUtility.h"
#define RECORD_DATE_TO_CDB(x) (CDBMakeCDBDate((x).year, (x).month, (x).day, (x).hour, (x).min, (x).sec))
@@ -79,11 +71,6 @@ namespace ipl {
init_search_condition();
}
}
namespace utility {
Date::Date(const OSCalendarTime& cal) : year(cal.year), month(cal.mon + 1), day(cal.mday) {}
}
namespace scene {
void Board::prepare() {
System::checkNandOverFlowFlagAsync();
@@ -440,13 +427,7 @@ namespace ipl {
cdb::Manager* cdbManager = System::getCdbManager();
struct InterruptState {
BOOL first;
BOOL second;
BOOL third;
BOOL result;
} interrupts;
interrupts.result = TRUE;
BOOL result = TRUE;
char recordType[8] = "";
@@ -479,17 +460,17 @@ namespace ipl {
// Find any free space to put the object on screen
interrupts.first = OSDisableInterrupts();
BOOL old = OSDisableInterrupts();
BOOL exist = is_exist_diff_date();
BoardObject* obj = mObjList.getNextFree();
OSRestoreInterrupts(interrupts.first);
OSRestoreInterrupts(old);
if (obj == NULL && exist) {
while (obj == NULL) {
OSSleepMilliseconds((OSTime)1);
interrupts.second = OSDisableInterrupts();
BOOL old2 = OSDisableInterrupts();
obj = mObjList.getNextFree();
OSRestoreInterrupts(interrupts.second);
OSRestoreInterrupts(old2);
}
}
@@ -529,16 +510,16 @@ namespace ipl {
goto close;
}
interrupts.result = TRUE;
result = TRUE;
if (((RBRHeader*)rbrData)->magic == RBR_MAGIC && cdbManager->isValidHeader((RBRHeader*)rbrData)) {
interrupts.third = OSDisableInterrupts();
BOOL old3 = OSDisableInterrupts();
if (recordDate == mCurrentDate) {
if (mbReading == true && mSearchRecord_Prev.created) {
mbReading = false;
delete[] rbrData;
OSRestoreInterrupts(interrupts.third);
OSRestoreInterrupts(old3);
return FALSE;
}
@@ -556,11 +537,11 @@ namespace ipl {
memcpy(&mSearchRecord_Prev, &mSearchRecord_Next, sizeof(SearchRecord));
}
} else {
interrupts.result = FALSE;
result = FALSE;
delete[] rbrData;
}
OSRestoreInterrupts(interrupts.third);
OSRestoreInterrupts(old3);
} else {
delete[] rbrData;
}
@@ -584,13 +565,13 @@ namespace ipl {
show_ricon();
}
interrupts.result = FALSE;
result = FALSE;
goto out;
error:
interrupts.result = FALSE;
result = FALSE;
out:
return interrupts.result;
return result;
}
void Board::stt_wait_cdb_init() {
@@ -1409,11 +1390,10 @@ namespace ipl {
#undef TEXT_LENGTH
}
const u32 scWeekMsgId[] = {MESG_CALENDAR_SUNDAY, MESG_CALENDAR_MONDAY, MESG_CALENDAR_TUESDAY, MESG_CALENDAR_WEDNESDAY,
MESG_CALENDAR_THURSDAY, MESG_CALENDAR_FRIDAY, MESG_CALENDAR_SATURDAY};
wchar_t scTextDateJpnFormat[] = L"%d%ls%d%ls%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
static const u32 scWeekMsgId[] = {MESG_CALENDAR_SUNDAY, MESG_CALENDAR_MONDAY, MESG_CALENDAR_TUESDAY, MESG_CALENDAR_WEDNESDAY,
MESG_CALENDAR_THURSDAY, MESG_CALENDAR_FRIDAY, MESG_CALENDAR_SATURDAY};
void Board::get_text_jpn(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
@@ -1421,13 +1401,10 @@ namespace ipl {
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateJpnFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
swprintf(text, textLen, L"%d%ls%d%ls%ls%ls%ls", date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#endif
wchar_t scTextDateKorFormat[] = L"%d%ls %d%ls%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
void Board::get_text_kor(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* sep1 = msgMgr->getMessage(MESG_CALENDAR_MONDAY);
@@ -1435,25 +1412,9 @@ namespace ipl {
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateKorFormat, date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
swprintf(text, textLen, L"%d%ls %d%ls%ls%ls%ls", date.month, sep1, date.day, sep2, weekStart, week, weekEnd);
}
#endif
}
namespace utility {
int Calendar::getWeek(const Date& date) NO_INLINE {
int month, year, day;
month = date.month;
day = date.day;
year = date.year;
if (month <= 2) {
year--;
month += MAX_MONTH;
}
return (day + (((month * 13) + 8) / 5) + ((year / 400) + ((year + (year / 4)) - (year / 100)))) % 7;
}
}
namespace scene {
void Board::get_text_spa(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
@@ -1461,17 +1422,14 @@ namespace ipl {
swprintf(text, textLen, L"%ls %02d-%02d", week, date.day, date.month);
}
wchar_t scTextDateGerFormat[] = L"%02d.%02d.%ls%ls%ls";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
void Board::get_text_ger(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
const wchar_t* weekStart = msgMgr->getMessage(MESG_CALENDAR_WEEK_START);
const wchar_t* weekEnd = msgMgr->getMessage(MESG_CALENDAR_WEEK_END);
swprintf(text, textLen, scTextDateGerFormat, date.day, date.month, weekStart, week, weekEnd);
swprintf(text, textLen, L"%02d.%02d.%ls%ls%ls", date.day, date.month, weekStart, week, weekEnd);
}
#endif
void Board::get_text_usaeng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
@@ -1487,15 +1445,12 @@ namespace ipl {
swprintf(text, textLen, L"%ls %02d-%02d", week, date.month, date.day);
}
wchar_t scTextDatePalengFormat[] = L"%ls %02d/%02d";
#ifndef IPL_BOARD_DATE_HELPERS_INLINE
inline void Board::get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
void Board::get_text_paleng(const utility::Date& date, wchar_t* text, u32 textLen) {
message::Manager* msgMgr = System::getMessageManager();
const wchar_t* week = msgMgr->getMessage(scWeekMsgId[utility::Calendar::getWeek(date)]);
swprintf(text, textLen, scTextDatePalengFormat, week, date.day, date.month);
swprintf(text, textLen, L"%ls %02d/%02d", week, date.day, date.month);
}
#endif
void Board::show_ricon() {
u8 prev = mbRIconEnable;
@@ -2075,7 +2030,6 @@ namespace ipl {
}
}
#ifndef IPL_BOARD_INLINE_GETTERS
Button* Board::get_button() {
return static_cast<Button*>(System::getScene(SCENE_BUTTON));
}
@@ -2083,6 +2037,5 @@ namespace ipl {
Arrow* Board::get_arrow() {
return static_cast<Arrow*>(System::getScene(SCENE_ARROW));
}
#endif
} // namespace scene
} // namespace ipl

View File

@@ -1,6 +1,3 @@
#define IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST
#define IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
#include "iplSceneUI.h"
#include "scene/board/iplBoard.h"
@@ -46,10 +43,6 @@ extern "C" void __ct__Q33ipl4math4VEC2Fff(ipl::math::VEC2*, f32, f32);
#define PICTURE_THUMB_HEIGHT 48
namespace ipl {
namespace math {
template <> inline LinearIntp<VEC2>::~LinearIntp() {}
template <> inline Interporation<VEC2>::~Interporation() {}
}
namespace scene {
// clang-format off
const char* BoardObject::mAnimNames[BoardObject::TYPE_MAX][1+BoardObject::ANIM_MAX] = {
@@ -485,10 +478,8 @@ namespace ipl {
}
void BoardObject::stt_stand() {
f32 degrees = mStandData.unk_0x0C * 30.0f + 30.0f;
f32 dVar2 = nw4r::math::CosFIdx(degrees * 0.7111111f);
degrees = mStandData.unk_0x0C * 30.0f + 30.0f;
f32 dVar3 = nw4r::math::SinFIdx(degrees * 0.7111111f);
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);
@@ -888,5 +879,14 @@ namespace ipl {
return result;
}
#ifndef NON_MATCHING
void forceWeakFunc(nw4r::math::VEC2& vec) {
nw4r::math::VEC2 end(vec / 10.0f);
}
#endif
void GenerateWEAK() {
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(((nw4r::lyt::Pane*)NULL)->FindPaneByName(NULL));
}
} // namespace scene
} // namespace ipl

View File

@@ -1,857 +0,0 @@
#define IPL_SDMEMORY_SCROLLER_INIT_OUT_OF_LINE
#define IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#define IPL_SDMEMORY_GET_TEXT_DRAW_RECT_OUT_OF_LINE
#include "scene/sdChannelMemory/iplSDMemory.h"
#undef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#undef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
#undef IPL_SDMEMORY_SCROLLER_INIT_OUT_OF_LINE
#undef IPL_SDMEMORY_GET_TEXT_DRAW_RECT_OUT_OF_LINE
#include "system/iplSystem.h"
#include "sound/iplSound.h"
#include "utility/iplLayout.h"
#include <revolution/os/OSTime.h>
extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::NandSDCardManager* manager,
ipl::scene::SDMemory::TitleRange* nandTitles,
ipl::scene::SDMemory::TitleRange* sdTitles,
ESTitleId* titleIds, wchar_t* titleNames, u32* titleCount,
s32 state);
extern "C" bool iplSDChannelSelect_813DB5EC(ipl::scene::NandSDCardManager* manager,
const ESTitleId* titleEntry, ESTitleId titleId);
extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::NandSDCardManager* manager,
const ESTitleId* titleEntry, ESTitleId titleId, u32 flags);
namespace ipl {
namespace utility {
void Scroller::init() {
mState = 0;
mScroll = 0.0f;
unk_0x3C = 0.0f;
mUpLimit = 0.0f;
mDownLimit = 0.0f;
}
}
namespace scene {
static const char* const sControlPaneNames[] = {
"A", "B", "B_BtnA",
};
static const char* const sTitlePaneNames[] = {"A", "B", "B_BtnA", "C", "D"};
static const char* const sAdditionalTitlePaneNames[] = {"B_00", "C_00", "D_00", "B_BtnA"};
static const char* const sDialogPaneNames[] = {"B_ArwR", "B_ArwL", "B_CalExit", "B_CalExit_00"};
SDMemory::SDMemory() : mScroller() {}
SDMemory::~SDMemory() {}
void SDMemory::create(EGG::Heap* heap, nand::LayoutFile* layoutFile, NandSDCardManager* manager) {
mpNandSDCardManager = manager;
mpMainLayout = new (heap) layout::Object(heap, layoutFile, "arc", "mn_DialogWindow_ChChange_a.brlyt");
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_DialogIn.brlan", "G_InOut", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_DialogOut.brlan", "G_InOut", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_FocusBtn_on.brlan", "G_FocusBtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_FocusBtn_off.brlan", "G_FocusBtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_SelectBtn_Ac.brlan", "G_SelectBtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnA_Rollover.brlan", "G_BtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnA_Rollout.brlan", "G_BtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnA_On.brlan", "G_BtnA", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnB_Rollover.brlan", "G_BtnB", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnB_Rollout.brlan", "G_BtnB", false, true);
mpMainLayout->bindToGroup("mn_DialogWindow_ChChange_a_BtnB_On.brlan", "G_BtnB", false, true);
mpMainLayout->finishBinding();
mpMainLayout->getAnim(0)->initAnmFrame();
mpMainLayout->getAnim(2)->initAnmFrame();
mpMainLayout->getAnim(5)->initAnmFrame();
mpMainLayout->getAnim(8)->initAnmFrame();
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpMainLayout->FindPaneByName("T_Dialog_00"));
textBox->SetString(System::getMessage(0xB0));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpMainLayout->FindPaneByName("TextBox_05"));
textBox->SetString(System::getMessage(0xBB));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpMainLayout->FindPaneByName("TextBox_06"));
textBox->SetString(System::getMessage(0xBC));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpMainLayout->FindPaneByName("T_BtnA"));
textBox->SetString(System::getMessage(0x25));
mpTitleLayout = new (heap) layout::Object(heap, layoutFile, "arc", "mn_DialogWindow_ChChange_b.brlyt");
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_DialogIn.brlan", "G_InOut", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_DialogOut.brlan", "G_InOut", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_FocusBtn_on.brlan", "G_FocusBtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_FocusBtn_off.brlan", "G_FocusBtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_SelectBtn_Ac.brlan", "G_SelectBtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnA_Rollover.brlan", "G_BtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnA_Rollout.brlan", "G_BtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnA_On.brlan", "G_BtnA", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnB_Rollover.brlan", "G_BtnB", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnB_Rollout.brlan", "G_BtnB", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnB_On.brlan", "G_BtnB", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnC_Rollover.brlan", "G_BtnC", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnC_Rollout.brlan", "G_BtnC", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnC_On.brlan", "G_BtnC", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnD_Rollover.brlan", "G_BtnD", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnD_Rollout.brlan", "G_BtnD", false, true);
mpTitleLayout->bindToGroup("mn_DialogWindow_ChChange_b_BtnD_On.brlan", "G_BtnD", false, true);
mpTitleLayout->finishBinding();
mpTitleLayout->getAnim(0)->initAnmFrame();
mpTitleLayout->getAnim(2)->initAnmFrame();
mpTitleLayout->getAnim(5)->initAnmFrame();
mpTitleLayout->getAnim(8)->initAnmFrame();
mpTitleLayout->getAnim(11)->initAnmFrame();
mpTitleLayout->getAnim(14)->initAnmFrame();
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("T_Dialog"));
textBox->SetString(System::getMessage(0xB6));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_00"));
textBox->SetString(System::getMessage(0xB7));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_01"));
textBox->SetString(System::getMessage(0xB8));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_02"));
textBox->SetString(System::getMessage(0xB9));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_03"));
textBox->SetString(System::getMessage(0xBA));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("T_Dialog_00"));
textBox->SetString(System::getMessage(0xB6));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_05"));
textBox->SetString(System::getMessage(0xB8));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_06"));
textBox->SetString(System::getMessage(0xB9));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpTitleLayout->FindPaneByName("TextBox_07"));
textBox->SetString(System::getMessage(0xBA));
mpDialogLayout = new (heap) layout::Object(heap, layoutFile, "arc", "mn_DialogWindow_ChChange_c.brlyt");
static_cast<nw4r::lyt::TextBox*>(mpDialogLayout->FindPaneByName("T_Letter"))->AllocStringBuffer(0x840);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Dialog_FadeIn.brlan", "G_Fede", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Dialog_FadeOut.brlan", "G_Fede", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Back_RollOver.brlan", "G_Back_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Back_Rollout.brlan", "G_Back_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Back_On.brlan", "G_Back_Ac", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Move_RollOver.brlan", "G_Move_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Move_Rollout.brlan", "G_Move_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Move_On.brlan", "G_Move_Ac", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_FocusOn.brlan", "G_ArwL_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_FocusOff.brlan", "G_ArwL_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Select.brlan", "G_ArwL_Ac", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_FocusOn.brlan", "G_ArwR_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_FocusOff.brlan", "G_ArwR_Focus", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Select.brlan", "G_ArwR_Ac", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Appear.brlan", "G_ArwL_End", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Lost.brlan", "G_ArwL_End", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Appear.brlan", "G_ArwR_End", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Lost.brlan", "G_ArwR_End", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_Loop.brlan", "G_ArwRoop", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_HDActionStart.brlan", "G_ArwL_HDAc", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_HDActionEnd.brlan", "G_ArwL_HDAc", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_HDActionStart.brlan", "G_ArwR_HDAc", false, true);
mpDialogLayout->bindToGroup("mn_DialogWindow_ChChange_c_HDActionEnd.brlan", "G_ArwR_HDAc", false, true);
mpDialogLayout->finishBinding();
mpDialogLayout->getAnim(0)->initAnmFrame();
mpDialogLayout->getAnim(2)->initAnmFrame();
mpDialogLayout->getAnim(5)->initAnmFrame();
mpDialogLayout->getAnim(11)->initAnmFrame();
mpDialogLayout->getAnim(8)->initAnmFrame();
mpDialogLayout->getAnim(18)->initAnmFrame();
mpDialogLayout->getAnim(18)->initFrame();
mpDialogLayout->getAnim(18)->restart();
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpDialogLayout->FindPaneByName("T_CalExit"));
textBox->SetString(System::getMessage(0xA5));
textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpDialogLayout->FindPaneByName("T_CalExit_00"));
textBox->SetString(System::getMessage(0xC4));
mpProgressLayout = new (heap) layout::Object(heap, layoutFile, "arc", "mn_DialogWindow_Background.brlyt");
mpProgressLayout->bindToGroup("mn_DialogWindow_Background_DialogIn.brlan", "G_InOut", false, true);
mpProgressLayout->bindToGroup("mn_DialogWindow_Background_DialogOut.brlan", "G_InOut", false, true);
mpProgressLayout->finishBinding();
mpProgressLayout->getAnim(0)->initAnmFrame();
}
void SDMemory::setTitleLists(const TitleRange& nandTitles, const TitleRange& sdTitles) {
mNandTitleRange = nandTitles;
mSDTitleRange = sdTitles;
mTransferFlags[0] = 1;
mDialogState = 0;
mpMainLayout->getAnim(0)->initAnmFrame();
mpMainLayout->getAnim(0)->play();
mpProgressLayout->getAnim(0)->initAnmFrame();
mpProgressLayout->getAnim(0)->play();
snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW");
mTransferFlags[1] = 1;
mErrorCode = 0;
}
void SDMemory::setScrollLimit() {
nw4r::lyt::Pane* headerPane = mpDialogLayout->FindPaneByName("N_Header");
nw4r::lyt::Pane* buttonPane = mpDialogLayout->FindPaneByName("T_BtnA");
nw4r::lyt::Pane* footerPane = mpDialogLayout->FindPaneByName("N_Footer");
nw4r::ut::Rect projection;
System::getProjectionRect(&projection);
f32 itemCount = static_cast<f32>(mButtonState);
f32 buttonHeight = buttonPane->GetSize().height;
f32 headerHeight = headerPane->GetSize().height;
f32 footerHeight = footerPane->GetSize().height;
f32 contentHeight = headerHeight + footerHeight;
f32 itemHeight = itemCount * buttonHeight;
f32 contentHeightWithItems = itemHeight + contentHeight;
f32 downLimit = contentHeightWithItems - projection.GetHeight() + 1.0f;
if (downLimit < 0.0f) {
downLimit = 0.0f;
}
mScroller.init();
mScroller.setDownLimit(downLimit);
}
void SDMemory::updateSideArrows() {
controller::Interface* masterController = System::getMasterController();
if (mScroller.getBInst().isActive() ? false : true) {
if (masterController->down(controller::BTN_UP)) {
showLeftArrow();
}
if (!masterController->down(controller::BTN_UP)) {
hideLeftArrow();
}
if (masterController->down(controller::BTN_DOWN)) {
showRightArrow();
}
if (!masterController->down(controller::BTN_DOWN)) {
hideRightArrow();
}
} else {
if (mScroller.getBInst().isUp()) {
showLeftArrow();
}
if (!mScroller.getBInst().isUp()) {
hideLeftArrow();
}
if (mScroller.getBInst().isDown()) {
showRightArrow();
}
if (!mScroller.getBInst().isDown()) {
hideRightArrow();
}
}
}
void SDMemory::resetScrollArrows() {
mControllerFlags[0] = 0;
mControllerFlags[1] = 0;
mControllerFlags[2] = 0;
mControllerFlags[3] = 0;
mpDialogLayout->getAnim(16)->initAnmFrame();
mpDialogLayout->getAnim(14)->initAnmFrame();
if (!mScroller.isDownEnd()) {
showUpArrow();
}
}
void SDMemory::updateScrollArrows(u32 previousDownEnd, u32 previousUpEnd, u32 downEnd, u32 upEnd) {
if (previousDownEnd != 1 && downEnd == 1) {
hideDownArrow();
}
if (previousDownEnd == 1 && downEnd != 1) {
showDownArrow();
}
if (previousUpEnd != 1 && upEnd == 1) {
hideUpArrow();
}
if (previousUpEnd == 1 && upEnd != 1) {
showUpArrow();
}
}
void SDMemory::showDownArrow() {
if (mControllerFlags[0] == 0) {
layout::Animator* initAnimation = mpDialogLayout->getAnim(16);
initAnimation->initAnmFrame();
layout::Animator* playAnimation = mpDialogLayout->getAnim(16);
playAnimation->initFrame();
playAnimation->restart();
mControllerFlags[0] = 1;
}
}
void SDMemory::showUpArrow() {
if (mControllerFlags[1] == 0) {
layout::Animator* initAnimation = mpDialogLayout->getAnim(14);
initAnimation->initAnmFrame();
layout::Animator* playAnimation = mpDialogLayout->getAnim(14);
playAnimation->initFrame();
playAnimation->restart();
mControllerFlags[1] = 1;
}
}
void SDMemory::hideDownArrow() {
if (mControllerFlags[0] != 0) {
layout::Animator* initAnimation = mpDialogLayout->getAnim(17);
initAnimation->initAnmFrame();
layout::Animator* playAnimation = mpDialogLayout->getAnim(17);
playAnimation->initFrame();
playAnimation->restart();
mControllerFlags[0] = 0;
}
}
void SDMemory::hideUpArrow() {
if (mControllerFlags[1] != 0) {
layout::Animator* initAnimation = mpDialogLayout->getAnim(15);
initAnimation->initAnmFrame();
layout::Animator* playAnimation = mpDialogLayout->getAnim(15);
playAnimation->initFrame();
playAnimation->restart();
mControllerFlags[1] = 0;
}
}
void SDMemory::showLeftArrow() {
if (mControllerFlags[2] == 0) {
layout::Animator* animation = mpDialogLayout->getAnim(19);
animation->initFrame();
animation->restart();
mControllerFlags[2] = 1;
}
}
void SDMemory::showRightArrow() {
if (mControllerFlags[3] == 0) {
layout::Animator* animation = mpDialogLayout->getAnim(21);
animation->initFrame();
animation->restart();
mControllerFlags[3] = 1;
}
}
void SDMemory::hideLeftArrow() {
if (mControllerFlags[2] != 0) {
layout::Animator* animation = mpDialogLayout->getAnim(20);
animation->initFrame();
animation->restart();
mControllerFlags[2] = 0;
}
}
void SDMemory::hideRightArrow() {
if (mControllerFlags[3] != 0) {
layout::Animator* animation = mpDialogLayout->getAnim(22);
animation->initFrame();
animation->restart();
mControllerFlags[3] = 0;
}
}
void SDMemory::resetDialogPaneAnimations() {
for (int i = 0; i < 4; i++) {
if (mPanelAnimationStates[i] != 0) {
mPanelAnimationStates[i] = 0;
nw4r::lyt::Pane* pane = mpDialogLayout->FindPaneByName(sDialogPaneNames[i]);
mpPaneManagers[2]->initPane(pane);
layout::Animator* animation = NULL;
switch (i) {
case 2:
animation = mpDialogLayout->getAnim(3);
break;
case 3:
animation = mpDialogLayout->getAnim(6);
break;
case 0:
animation = mpDialogLayout->getAnim(12);
break;
case 1:
animation = mpDialogLayout->getAnim(9);
break;
}
if (animation != NULL) {
animation->initAnmFrame();
animation->initFrame();
animation->restart();
}
}
}
}
bool SDMemory::calc() {
bool result = false;
s32 stateResult = updateState();
if (stateResult == 0) {
if (mScroller.calc(mDialogState == 10) == TRUE) {
resetDialogPaneAnimations();
}
nw4r::math::VEC3 translation(0.0f, mScroller.get(), 0.0f);
mpDialogLayout->FindPaneByName("N_Memo")->SetTranslate(translation);
switch (mDialogState) {
case 0:
onDialogState0();
break;
case 1:
mpPaneManagers[0]->update();
mpPaneManagers[0]->calc();
break;
case 2:
onDialogState2();
break;
case 3:
result = onDialogState3();
break;
case 4:
onDialogState4();
break;
case 5:
mpPaneManagers[1]->update();
mpPaneManagers[1]->calc();
break;
case 6:
onDialogState6();
break;
case 7:
onDialogState7();
break;
case 8:
onDialogState8();
break;
case 9:
onDialogState9();
break;
case 10:
onDialogState10();
break;
case 11:
onDialogState11();
break;
case 12:
onDialogState12();
break;
case 13:
onDialogState13();
break;
case 14:
onDialogState14();
break;
case 15:
onDialogState15();
break;
case 16:
onDialogState16();
break;
case 17:
onDialogState17();
break;
case 18:
onDialogState18();
break;
case 19:
onDialogState19();
break;
case 20:
result = onDialogState20();
break;
case 21:
onDialogState21();
break;
case 22:
result = onDialogState22();
break;
case 23:
onDialogState23();
break;
case 24:
result = onDialogState24();
break;
case 25:
result = true;
break;
}
}
mpMainLayout->calc();
mpTitleLayout->calc();
mpDialogLayout->calc();
mpProgressLayout->calc();
return stateResult == 2 ? true : result;
}
void SDMemory::onDialogState0() {
if (!mpMainLayout->isPlaying(-1)) {
for (int i = 0; i < 3; i++) {
mPanelStates[i] = 0;
nw4r::lyt::Pane* pane = mpMainLayout->FindPaneByName(sControlPaneNames[i]);
mpPaneManagers[0]->initPane(pane);
}
mDialogState = 1;
}
}
void SDMemory::onDialogState2() {
if (!mpMainLayout->isPlaying(-1)) {
mpMainLayout->getAnim(1)->initAnmFrame();
mpMainLayout->getAnim(1)->play();
if (mProcessState == 2) {
mpProgressLayout->getAnim(1)->initAnmFrame();
mpProgressLayout->getAnim(1)->play();
mTransferFlags[1] = 0;
}
mDialogState = 3;
}
}
bool SDMemory::onDialogState3() {
if (!mpMainLayout->isPlaying(-1)) {
switch (mProcessState) {
case 0:
if (iplSDChannelSelect_813DDB74(mpNandSDCardManager, &mNandTitleRange, &mSDTitleRange,
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2)) {
mDialogState = 4;
mpTitleLayout->getAnim(0)->initAnmFrame();
mpTitleLayout->getAnim(0)->play();
snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW");
} else {
mDialogState = 21;
mMessageId = 0xB4;
}
break;
case 1:
mDialogState = 21;
mMessageId = 0xB3;
break;
case 2:
mDialogState = 25;
mErrorCode = 3;
return true;
}
}
return false;
}
void SDMemory::onDialogState4() {
if (!mpTitleLayout->isPlaying(-1)) {
if (mDisplayMode == 4) {
for (int i = 0; i < 5; i++) {
mTitlePanelStates[i] = 0;
mpPaneManagers[1]->initPane(mpTitleLayout->GetRootPane()->FindPaneByName(sTitlePaneNames[i], true));
}
} else {
for (int i = 1; i < 5; i++) {
mTitlePanelStates[i] = 0;
mpPaneManagers[1]->initPane(mpTitleLayout->GetRootPane()->FindPaneByName(sAdditionalTitlePaneNames[i - 1], true));
}
}
mDialogState = 5;
}
}
void SDMemory::onDialogState6() {
if (!mpTitleLayout->isPlaying(-1)) {
mDialogState = 7;
mpTitleLayout->getAnim(1)->initAnmFrame();
mpTitleLayout->getAnim(1)->play();
}
}
void SDMemory::onDialogState8() {
if (System::getDialog()->getStateForSDMemory() == 2) {
if (mTransferStartTime == 0) {
mTransferStartTime = OSGetTime();
}
if (!mpNandSDCardManager->getWorker()->is_working() &&
OSGetTime() - mTransferStartTime > OS_TIMER_CLOCK) {
System::getDialog()->terminate();
}
}
if (System::getDialog()->getLastResult() != -1) {
if (mpNandSDCardManager->getWorker()->get_async_result() == 0) {
mNandTitleCount = mTitleListState.mSecondaryCount;
mTitleNameCount = mTitleListState.mNameCount;
} else {
mNandTitleCount = 0;
mTitleNameCount = 0;
}
mDialogState = 9;
layout::Animator* animation = mpMainLayout->getAnim(0);
animation->initFrame();
animation->restart();
nw4r::lyt::Pane* headerPane = mpMainLayout->FindPaneByName("T_Header");
static_cast<nw4r::lyt::TextBox*>(headerPane)->SetString(System::getMessage(0xBE), 0);
mButtonState = 0;
nw4r::lyt::Pane* titlePane = mpMainLayout->FindPaneByName("N_Body");
nw4r::lyt::Pane* bodyPane = mpMainLayout->FindPaneByName("T_Letter");
bodyPane->SetAlpha(0xFF);
for (u32 i = 0; i < mTitleCount; i++) {
utility::layout::set_string(bodyPane, mTitleNames[i]);
nw4r::ut::Rect textRect = mpMainLayout->getTextDrawRect("T_Letter");
f32 lineCount = -(textRect.bottom - textRect.top) / titlePane->GetSize().height;
mButtonState += static_cast<s32>(ceil(lineCount));
}
setScrollLimit();
resetScrollArrows();
}
}
void SDMemory::onDialogState7() {
if (!mpTitleLayout->isPlaying(-1)) {
switch (mProcessState) {
case 4:
mDialogState = 0;
mpMainLayout->getAnim(0)->play();
snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING");
break;
default:
mTransferStartTime = 0;
mTransferFrame = 0;
System::getDialog()->callBtn0NoShade(0xCC, 0, true);
mDialogState = 8;
break;
}
}
}
void SDMemory::onDialogState9() {
if (!mpDialogLayout->isPlaying(0)) {
for (int i = 0; i < 4; i++) {
mPanelAnimationStates[i] = 0;
nw4r::lyt::Pane* pane = mpDialogLayout->FindPaneByName(sDialogPaneNames[i]);
mpPaneManagers[2]->initPane(pane);
}
mDialogState = 10;
}
}
void SDMemory::onDialogState10() {
controller::Interface* masterController = System::getMasterController();
if (mScroller.isActive()) {
updateSideArrows();
if (mScroller.getBInst().isActive() ? false : true) {
if (masterController->down(controller::BTN_UP)) {
mScroller.scrollUpByCon();
} else if (masterController->down(controller::BTN_DOWN)) {
mScroller.scrollDownByCon();
}
}
}
bool previousDownEnd = !!mControllerFlags[0];
bool previousUpEnd = !!mControllerFlags[1];
updateScrollArrows(previousDownEnd, previousUpEnd, mScroller.isUpEnd(), mScroller.isDownEnd());
if (mScroller.getBInst().isActive() ? false : true) {
mpPaneManagers[2]->update();
}
mpPaneManagers[2]->calc();
}
void SDMemory::onDialogState11() {
if (!mpDialogLayout->isPlaying(4) && !mpDialogLayout->isPlaying(7)) {
if (mProcessState < 4 && mProcessState >= 2) {
mDialogState = 12;
mpDialogLayout->getAnim(1)->initAnmFrame();
mpDialogLayout->getAnim(1)->play();
if (mControllerFlags[0] != 0) {
hideDownArrow();
}
if (mControllerFlags[1] != 0) {
hideUpArrow();
}
} else {
mDialogState = 10;
}
}
}
void SDMemory::onDialogState16() {
if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) {
const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle];
if (iplSDChannelSelect_813DB4D4(mpNandSDCardManager, titleEntry, *titleEntry, 0)) {
mDialogState = 16;
} else {
System::getDialog()->terminate();
mDialogState = 20;
mErrorCode = 1;
mMessageId = 0xAE;
}
}
}
void SDMemory::onDialogState18() {
if (System::getDialog()->getStateForSDMemory() == 2) {
mCurrentTitleName[0] = L'\0';
const wchar_t* message = System::getMessage(0xB1);
const wchar_t* titleName = mTitleNames[mCurrentTitle];
swprintf(mCurrentTitleName, 0x107f, L"%ls\n%ls", titleName, message);
System::getDialog()->setTitleForSDMemory(mCurrentTitleName);
const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle];
const ESTitleId titleId = *titleEntry;
if (iplSDChannelSelect_813DB5EC(mpNandSDCardManager, titleEntry, titleId)) {
mDialogState = 18;
} else {
System::getDialog()->terminate();
mDialogState = 20;
mErrorCode = 1;
mMessageId = 0xAE;
}
}
}
void SDMemory::onDialogState19() {
if (!mpNandSDCardManager->getWorker()->is_working()) {
if (mpNandSDCardManager->getWorker()->get_async_result() == 0) {
mDialogState = 13;
} else {
System::getDialog()->terminate();
mDialogState = 20;
mErrorCode = 1;
mMessageId = 0xAE;
}
}
}
bool SDMemory::onDialogState20() {
DialogWindow* dialog = System::getDialog();
if (dialog->getStateForSDMemory() == 4 && mTransferFlags[1] && mErrorCode == 0) {
mTransferFlags[1] = 0;
mpProgressLayout->getAnim(1)->initAnmFrame();
mpProgressLayout->getAnim(1)->play();
}
if (System::getDialog()->getLastResult() != -1) {
if (mErrorCode == 0) {
mTransferFlags[0] = 1;
mDialogState = 25;
return true;
}
mDialogState = 23;
}
return false;
}
void SDMemory::onDialogState21() {
const wchar_t* message = System::getMessage(mMessageId);
const wchar_t* blockCountMarker = wcsstr(message, L"***\n");
wchar_t* format = new (System::getMem2App(), -32) wchar_t[0x400];
wchar_t* dialogMessage = new (System::getMem2App(), -32) wchar_t[0x400];
if (blockCountMarker != NULL && message != NULL) {
format[0] = L'\0';
wcsncat(format, message, static_cast<u32>(blockCountMarker - message) >> 1);
wcscat(format, L"%d");
wcscat(format, blockCountMarker + 4);
s32 blocks = mNandTitleRange.mByteSize / 0x20000;
if (mNandTitleRange.mByteSize % 0x20000 != 0) {
blocks++;
}
swprintf(dialogMessage, 0x3ff, format, blocks);
}
System::getDialog()->callBtn2NoShade(dialogMessage, 0xC8, 0xA5, false);
mDialogState = 22;
delete[] format;
delete[] dialogMessage;
}
bool SDMemory::onDialogState22() {
DialogWindow* dialog = System::getDialog();
if (dialog->getStateForSDMemory() == 3 && dialog->getResultForSDMemory() == 1) {
mpProgressLayout->getAnim(1)->initAnmFrame();
mpProgressLayout->getAnim(1)->play();
mTransferFlags[1] = 0;
}
if (System::getDialog()->getLastResult() != -1) {
if (System::getDialog()->getLastResult() == 1) {
mErrorCode = 4;
mDialogState = 25;
return true;
}
mpMainLayout->getAnim(0)->initAnmFrame();
mpMainLayout->getAnim(0)->play();
snd::getSystem()->startSE("WIPL_SE_CANCEL");
mDialogState = 0;
}
return false;
}
void SDMemory::onDialogState23() {
switch (mMessageId) {
case 0xBF:
case 0xB5:
System::getDialog()->callBtn1NoShade(mMessageId, 0xA5);
break;
default:
System::getDialog()->callBtn1NoShade(mMessageId, 0x2E);
break;
}
mDialogState = 24;
}
bool SDMemory::onDialogState24() {
if (System::getDialog()->getStateForSDMemory() == 3) {
mpProgressLayout->getAnim(1)->initAnmFrame();
mpProgressLayout->getAnim(1)->play();
mTransferFlags[1] = 0;
}
if (System::getDialog()->getLastResult() != -1) {
mTransferFlags[0] = 1;
System::getHomeButtonMenu()->enable();
mDialogState = 25;
return true;
}
return false;
}
s32 SDMemory::getControlPaneIndex(const char* paneName) {
s32 paneIndex = -1;
for (s32 i = 0; i < 3; i++) {
if (strcmp(paneName, sControlPaneNames[i]) == 0) {
paneIndex = i;
break;
}
}
return paneIndex;
}
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth) {
flags[0] = first;
flags[1] = second;
flags[2] = third;
flags[3] = fourth;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,184 +0,0 @@
#include <decomp/ide.h>
#include <math/iplMathTypes.h>
#define IPL_SOUND_RECT_OUT_OF_LINE
#include <nw4r/ut/Rect.h>
#undef IPL_SOUND_RECT_OUT_OF_LINE
#include <revolution/kpad.h>
#include <revolution/mtx/GeoTypes.h>
#include <revolution/os.h>
#include <revolution/os/OSTime.h>
#include <revolution/sc.h>
#include <revolution/wpad.h>
#define IPL_CONTROLLER_NATIVE_HIERARCHY
#include "system/iplController.h"
#undef IPL_CONTROLLER_NATIVE_HIERARCHY
#include "system/iplSystem.h"
extern "C" void _savegpr_16();
extern "C" void _restgpr_16();
extern "C" void _savegpr_29();
extern "C" void _restgpr_29();
extern "C" void _savegpr_27();
extern "C" void _restgpr_27();
extern "C" void _savegpr_28();
extern "C" void _restgpr_28();
namespace ipl {
namespace controller {
void* Manager::mpBuf;
EGG::Heap* Manager::mpParentHeap;
EGG::ExpHeap* Manager::mpHeap;
EGG::Allocator* Manager::mpAllocator;
void* Manager::alloc(u32 size) {
return mpAllocator->alloc(size);
}
int Manager::free(void* ptr) {
mpAllocator->free(ptr);
return TRUE;
}
Manager::Manager(EGG::Heap* heap) : mMaster(mControllers) {
memset(mKPADStatus, 0, sizeof(mKPADStatus));
memset(mControllers, 0, sizeof(mControllers));
u32 workSize = WPADGetWorkMemorySize() + 0x400;
if (mpBuf != NULL && mpParentHeap != NULL) {
mpParentHeap->free(mpBuf);
}
mpParentHeap = heap;
mpBuf = heap->alloc(workSize, 0x20);
if (mpHeap != NULL) {
mpHeap->destroy();
}
mpHeap = EGG::ExpHeap::create(mpBuf, workSize, 2);
if (mpAllocator != NULL) {
delete mpAllocator;
}
mpAllocator = new (heap, 4) EGG::Allocator(mpHeap, 4);
WPADRegisterAllocator(alloc, free);
KPADInit();
u32 sensitivity = SCGetBtDpdSensibility();
for (int i = 0; i < 4; i++) {
WPADSetDpdSensitivity(sensitivity);
KPADSetBtnRepeat(i, 0.5f, 0.1f);
}
read();
}
void Manager::read() {
for (int chan = 0; chan < 4; chan++) {
if (SCGetWpadSensorBarPosition() == 1) {
KPADSetSensorHeight(chan, 0.2f);
} else {
KPADSetSensorHeight(chan, -0.2f);
}
u32 deviceType;
s32 probe = WPADProbe(chan, &deviceType);
if (probe == -1) {
goto probe_invalid;
}
if (probe < -1) {
if (probe >= -3) {
goto probe_valid;
}
goto probe_invalid;
} else if (probe >= 1) {
goto probe_invalid;
}
probe_valid:
{
s32 read = KPADRead(chan, &mKPADStatus[chan], 1);
if (read > 0 && mKPADStatus[chan].wpad_err != -4 && deviceType != 0xfd) {
mInvalidCount[chan] = 0;
if (mKPADStatus[chan].wpad_err == -7 || deviceType == 0 || deviceType == 0xfb ||
deviceType == 0xfc || deviceType == 0xff) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 0) {
mControllers[chan] = new (mControllerStorage[chan]) Core(chan, 0, mKPADStatus[chan]);
}
} else if (deviceType == 1) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 1) {
mControllers[chan] = new (mControllerStorage[chan]) FreeStyle(chan, 1, mKPADStatus[chan]);
}
} else if (deviceType == 2) {
if (mControllers[chan] == NULL || mControllers[chan]->getType() != 2) {
mControllers[chan] = new (mControllerStorage[chan]) Classic(chan, mKPADStatus[chan]);
}
} else {
mControllers[chan] = NULL;
}
} else {
if (read != 0) {
goto store_null;
}
mInvalidCount[chan]++;
if (mInvalidCount[chan] > 0x3c) {
mInvalidCount[chan] = 0x3c;
if (mControllers[chan] != NULL) {
WPADControlMotor(chan, 0);
}
mControllers[chan] = NULL;
}
}
}
goto channel_done;
store_null:
mControllers[chan] = NULL;
goto channel_done;
probe_invalid:
KPADRead(chan, &mKPADStatus[chan], 1);
mControllers[chan] = NULL;
channel_done:
KPADSetPosParam(chan, 0.05f, 1.0f);
}
for (int chan = 0; chan < 4; chan++) {
if (mControllers[chan] != NULL) {
mControllers[chan]->read();
}
}
}
Revolution::Revolution(int chan, int type, KPADStatus& status) : Base(chan, type, status) {
unk_0x1D = 0;
unk_0x1E = 0;
unk_0x20 = &status;
}
Interface* Manager::getMasterController() {
return &mMaster;
}
Interface* Manager::getController(int chan) {
return ((Interface**)this)[chan];
}
Interface* Manager::getYoungController() {
Interface* ret = NULL;
for (int i = 0; i < 4; i++) {
Interface* controller = ((Interface**)this)[i];
if (controller != NULL) {
ret = controller;
break;
}
}
return ret;
}
Core::~Core() {}
FreeStyle::~FreeStyle() {}
}
}

View File

@@ -751,13 +751,215 @@ namespace ipl {
blr
}
void Manager::integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
ESTitleId temporaryTitleIds[0x36] = {0};
int availableCount = getAvailableNumInList(titleIdsOut, 0x30);
if (availableCount != 0) {
makeTmpList(temporaryTitleIds, availableCount, titleIdsIn, titleCount);
moveTitleTmpToPrior(titleIdsOut, temporaryTitleIds);
}
asm void Manager::integrateTitleIDList(register ESTitleId* titleIdsOut, register ESTitleId* titleIdsIn, register u32 titleCount) {
nofralloc
stwu r1, -0x1d0(r1)
mflr r0
stw r0, 0x1d4(r1)
addi r11, r1, 0x1d0
bl _savegpr_28
li r0, 0x36
mr r28, r3
mr r29, r4
mr r30, r5
mr r31, r6
addi r4, r1, 4
li r3, 0
mtctr r0
integrateTitleIDList_L1:
stw r3, 4(r4)
stwu r3, 8(r4)
bdnz integrateTitleIDList_L1
mr r3, r28
mr r4, r29
li r5, 0x30
bl getAvailableNumInList__Q33ipl8savedata7ManagerFPCUxUl
cmpwi r3, 0
mr r5, r3
beq integrateTitleIDList_L2
mr r3, r28
mr r6, r30
mr r7, r31
addi r4, r1, 8
bl makeTmpList__Q33ipl8savedata7ManagerFPUxUlPUxUl
mr r3, r28
mr r4, r29
addi r5, r1, 8
bl moveTitleTmpToPrior__Q33ipl8savedata7ManagerFPUxPCUx
integrateTitleIDList_L2:
addi r11, r1, 0x1d0
bl _restgpr_28
lwz r0, 0x1d4(r1)
mtlr r0
addi r1, r1, 0x1d0
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) {
@@ -871,91 +1073,47 @@ namespace ipl {
blr
}
void Manager::moveTitleTmpToPrior(ESTitleId* titleIdsOut, const ESTitleId* titleIdsIn) {
for (int titleIndex = 0; titleIndex < 0x36; titleIndex++) {
if (titleIdsIn[titleIndex] != TITLE_NULL) {
int availableIndex = getAvailableInList(titleIdsOut, 0x30);
if (availableIndex == -1) {
return;
}
titleIdsOut[availableIndex] = titleIdsIn[titleIndex];
}
}
}
asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) {
asm void Manager::moveTitleTmpToPrior(register ESTitleId* titleIdsOut, register const ESTitleId* titleIdsIn) {
nofralloc
stwu r1, -0x40(r1)
stwu r1, -0x20(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
stw r0, 0x24(r1)
addi r11, r1, 0x20
bl _savegpr_26
mr r26, r3
mr r27, r4
mr r28, r5
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:
li r31, 0
moveTitleTmpToPrior_L1:
add r30, r28, r31
lwzx r0, r28, r31
lwz r3, 4(r30)
or. r0, r3, r0
beq moveTitleTmpToPrior_L2
mr r3, r26
mr r4, r27
li r5, 0x30
bl getAvailableInList__Q33ipl8savedata7ManagerFPCUxUl
cmpwi r3, -1
beq moveTitleTmpToPrior_L3
slwi r0, r3, 3
lwz r4, 4(r30)
add r3, r27, r0
lwz r0, 0(r30)
stw r4, 4(r3)
stw r0, 0(r3)
moveTitleTmpToPrior_L2:
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)
addi r31, r31, 8
cmpwi r29, 0x36
blt moveTitleTmpToPrior_L1
moveTitleTmpToPrior_L3:
addi r11, r1, 0x20
bl _restgpr_26
lwz r0, 0x24(r1)
mtlr r0
addi r1, r1, 0x40
addi r1, r1, 0x20
blr
}
#endif
@@ -1131,87 +1289,6 @@ namespace ipl {
mData.prevSDPage = 0;
}
#ifdef __MWERKS__
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" BOOL iplSavedata_813597A0(void* manager, ESTitleId titleId) {
Manager* savedataManager = static_cast<Manager*>(manager);
for (int index = 0; index < MAX_CHANNEL_TOTAL; index++) {
if (savedataManager->mData.titleCache[0][index] == titleId) {
return TRUE;
}
}
return FALSE;
}
#endif
BOOL Manager::nand_error_handling(int code) {
BOOL result = FALSE;

View File

@@ -1,11 +1,10 @@
#!/usr/bin/env python3
"""Compact function diff with context: python ctxdiff.py <unit> <symbol> [--full]"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, "/home/cole/projects/tests")
from odiff import dis, sym
import os
import itertools

View File

@@ -1,62 +0,0 @@
#!/usr/bin/env python3
"""odiff: symbol lookup + normalized disassembly for object files.
Recreated for this environment (original lived on the author's machine).
"""
import re
from capstone import CS_ARCH_PPC, CS_MODE_32, CS_MODE_BIG_ENDIAN, Cs
from elftools.elf.elffile import ELFFile
_cache = {}
def _load(path):
if path in _cache:
return _cache[path]
with open(path, "rb") as f:
e = ELFFile(f)
st = e.get_section_by_name(".symtab")
names = [s.name for s in st.iter_symbols()]
syms = {s.name: (s["st_value"], s["st_size"]) for s in st.iter_symbols()}
data = {}
for sec in e.iter_sections():
data[sec.name] = (sec["sh_offset"], sec.data())
relocs = {}
for sec in e.iter_sections():
if sec.name.startswith(".rela"):
target = sec.name[5:]
for r in sec.iter_relocations():
relocs[(target, r["r_offset"])] = names[r["r_info_sym"]]
_cache[path] = (data, syms, relocs)
return _cache[path]
def sym(path, name):
_, syms, _ = _load(path)
return syms[name]
def dis(path, off, size, section=".text"):
data, syms, relocs = _load(path)
sec_data = data[section][1]
md = Cs(CS_ARCH_PPC, CS_MODE_32 + CS_MODE_BIG_ENDIAN)
out = []
for i in md.disasm(sec_data[off:off + size], off):
text = i.mnemonic + " " + i.op_str
m = re.search(r"0x[0-9a-fA-F]+", i.op_str)
if (section, i.address) in relocs:
# External reference: show the symbol, drop the raw addend
text = i.mnemonic + " " + re.sub(r"0x[0-9a-fA-F]+",
"<" + relocs[(section, i.address)] + ">",
i.op_str)
elif m and i.mnemonic.startswith("b"):
val = int(m.group(0), 16)
if off <= val < off + size:
# Intra-function branch: normalize to function-relative
text = i.mnemonic + " " + (i.op_str[:m.start()] +
"+" + hex(val - off) +
i.op_str[m.end():])
out.append((i.address - off, text))
return out