Compare commits
77 Commits
agent/w092
...
agent/fix/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c19151d83e | ||
|
|
c3dd1c08c0 | ||
|
|
d5b07803ff | ||
|
|
2b4de43971 | ||
|
|
ab9cdd32e1 | ||
|
|
d83fa089e2 | ||
|
|
aed62d8530 | ||
|
|
85d653b0db | ||
|
|
bf4d1c8130 | ||
|
|
8a0c882d14 | ||
|
|
361763ad3e | ||
|
|
3c8503a947 | ||
|
|
5cc6dd1a4e | ||
|
|
f1db6b656e | ||
|
|
c8c8a71e22 | ||
|
|
f7f36d59f8 | ||
|
|
f1d824acd9 | ||
|
|
f393788bb9 | ||
|
|
da26714711 | ||
|
|
5d4b208246 | ||
|
|
0cffbfe4bf | ||
|
|
12e857a9e2 | ||
|
|
a8ac234de8 | ||
|
|
60febe20c3 | ||
|
|
b275eb2d99 | ||
|
|
e47a8e949d | ||
|
|
fa7f4c26e8 | ||
|
|
239334ba8d | ||
|
|
179cd4e3c3 | ||
|
|
09fc62528e | ||
|
|
dbbdc3dd98 | ||
|
|
4789b7c32f | ||
|
|
ad5b9deae3 | ||
|
|
5046adc6da | ||
|
|
87214ff944 | ||
|
|
54ca052b41 | ||
|
|
2ce8487681 | ||
|
|
47fe453260 | ||
|
|
2d4cfa7094 | ||
|
|
e27d9e090a | ||
|
|
983a6a2448 | ||
|
|
c1e1157d8b | ||
|
|
005d3734f0 | ||
|
|
55891734ae | ||
|
|
20cf9f9f25 | ||
|
|
2a7cc791b1 | ||
|
|
b2c43f5a66 | ||
|
|
d9b8013644 | ||
|
|
40b87edd73 | ||
|
|
3d7e767cf7 | ||
|
|
10146c1b5f | ||
|
|
82783c6edb | ||
|
|
72e9c8d658 | ||
|
|
0062d65a27 | ||
|
|
f67d537e0b | ||
|
|
2d169c59cf | ||
|
|
bbd98e1e4a | ||
|
|
838b6cb941 | ||
|
|
9936f0a9ed | ||
|
|
a0659667d9 | ||
|
|
e6837211c1 | ||
|
|
ebf00fbce2 | ||
|
|
a2bc1d564a | ||
|
|
da1c3b7ff8 | ||
|
|
710174c707 | ||
|
|
b66bd1ed67 | ||
|
|
ca6529e656 | ||
|
|
44dea2d510 | ||
|
|
f034087510 | ||
|
|
fa8632368e | ||
|
|
dc7725eb2d | ||
|
|
0b67e647ba | ||
|
|
b1e911808f | ||
|
|
c723136fb4 | ||
|
|
a65cd4cb73 | ||
|
|
2ca94fe4d3 | ||
|
|
d558bb14ca |
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
require_complete:
|
||||
description: Fail unless 43U code, data, functions, units, and links are all 100%
|
||||
description: Fail unless 43U binary matches completely and source inventory is complete
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
@@ -79,6 +79,7 @@ jobs:
|
||||
python tools/check_decomp_complete.py \
|
||||
build/${{ matrix.version }}/report.json \
|
||||
--dol build/${{ matrix.version }}/main.dol
|
||||
python tools/check_asm_inventory.py
|
||||
|
||||
# Upload map files
|
||||
- name: Upload map
|
||||
|
||||
@@ -94,10 +94,11 @@ The final completion assertion is machine-checkable:
|
||||
```
|
||||
python3 tools/check_decomp_complete.py build/43U/report.json \
|
||||
--dol build/43U/main.dol
|
||||
python3 tools/check_asm_inventory.py
|
||||
```
|
||||
|
||||
It must pass before claiming full completion. GitHub Actions runs the same
|
||||
assertion when manually dispatched with `require_complete=true`.
|
||||
Both checks must pass before claiming full completion. GitHub Actions runs the same
|
||||
assertions when manually dispatched with `require_complete=true`.
|
||||
Normal push and pull-request builds publish progress without failing on the
|
||||
current incomplete state. Use the manual `require_complete=true` dispatch for
|
||||
the terminal all-100% gate.
|
||||
|
||||
@@ -42,7 +42,7 @@ AppLoaderHdr = .bss:0x810ABF40; // type:object size:0x20 align:32 data:4byte
|
||||
bi2 = .bss:0x810ABF60; // type:object size:0x2000 align:32 data:4byte
|
||||
UpdateDiskID = .bss:0x810ADF60; // type:object size:0x20 align:32 data:4byte
|
||||
TicketViewsBuf = .bss:0x810ADF80; // type:object size:0x3600 scope:local align:32
|
||||
Flags0 = .bss:0x810B1580; // type:object size:0x800 scope:local
|
||||
Flags0$1129 = .bss:0x810B1580; // type:object size:0x800 scope:local
|
||||
Flags1 = .bss:0x810B1D80; // type:object size:0x800 scope:local
|
||||
Thread = .bss:0x810B2580; // type:object size:0x318 scope:local
|
||||
UpdateHeader0 = .bss:0x810B38A0; // type:object size:0x20 scope:local
|
||||
@@ -2524,7 +2524,7 @@ __ct__Q33ipl3snd10tagSSeInfoFv = .text:0x8136C63C; // type:function size:0x30
|
||||
__ct__Q34nw4r3snd11SoundHandleFv = .text:0x8136C66C; // type:function size:0xC
|
||||
__dt__Q34nw4r3snd11SoundHandleFv = .text:0x8136C678; // type:function size:0x54
|
||||
__dt__Q33ipl3snd10tagSSeInfoFv = .text:0x8136C6CC; // type:function size:0x58
|
||||
__dt__Q33ipl3snd6UnkClsFv = .text:0x8136C724; // type:function size:0x1C scope:local
|
||||
__arraydtor$15982 = .text:0x8136C724; // type:function size:0x1C scope:local
|
||||
__ct__Q33ipl3snd11tagSBgmInfoFv = .text:0x8136C740; // type:function size:0x30 scope:local
|
||||
__dt__Q33ipl3snd11tagSBgmInfoFv = .text:0x8136C770; // type:function size:0x58
|
||||
__ct__Q33ipl3snd6SystemFv = .text:0x8136C7C8; // type:function size:0x4C
|
||||
@@ -3223,7 +3223,7 @@ __dt__Q33ipl5scene5BoardFv = .text:0x81393CA4; // type:function size:0x68
|
||||
__ct__Q33ipl5scene11BoardObjectFv = .text:0x81393D1C; // type:function size:0x140
|
||||
__dt__Q33ipl4math28LinearIntp<Q33ipl4math4VEC2>Fv = .text:0x81393E5C; // type:function size:0x40
|
||||
__dt__Q33ipl4math31Interporation<Q33ipl4math4VEC2>Fv = .text:0x81393E9C; // type:function size:0x40
|
||||
init__Q43ipl5scene11BoardObject29@class$8157iplBoardObject_cppFv = .text:0x81393EDC; // type:function size:0x18
|
||||
init__Q43ipl5scene11BoardObject9StandDataFv = .text:0x81393EDC; // type:function size:0x18
|
||||
make_icon_cb___Q23ipl5sceneFPQ33ipl6nigaoe6ObjectPv = .text:0x81393EF4; // type:function size:0x80
|
||||
create__Q33ipl5scene11BoardObjectFPQ33ipl4nand10LayoutFilePUcUlRC6_CDBIdRC13_CDBRecordKeyRCQ33ipl7utility4Date = .text:0x81393F74; // type:function size:0x84
|
||||
init__Q33ipl5scene11BoardObjectFv = .text:0x81393FF8; // type:function size:0xA4
|
||||
@@ -4584,11 +4584,11 @@ enqueueLoadNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB308; // type:f
|
||||
enqueuePageNotice__Q33ipl5scene15SDChannelSelectFv = .text:0x813DB364; // type:function size:0x5C
|
||||
enqueueResultNotice__Q33ipl5scene15SDChannelSelectFUl = .text:0x813DB3C0; // type:function size:0x5C
|
||||
enqueueChannelNotice__Q33ipl5scene15SDChannelSelectFUxUl = .text:0x813DB41C; // type:function size:0x5C
|
||||
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUlUlUl = .text:0x813DB478; // type:function size:0x5C
|
||||
enqueueMoveNotice__Q33ipl5scene15SDChannelSelectFUx = .text:0x813DB478; // type:function size:0x5C
|
||||
enqueueStateNotice__Q33ipl5scene15SDChannelSelectFUxUl = .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
|
||||
enqueueErrorNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB530; // type:function size:0x5C
|
||||
enqueueCommandNotice__Q33ipl5scene15SDChannelSelectFPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdListPQ33ipl12NandSDWorker11TitleIdList = .text:0x813DB58C; // type:function size:0x60
|
||||
enqueueDeleteNotice__Q33ipl5scene15SDChannelSelectFUx = .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
|
||||
@@ -4617,11 +4617,11 @@ updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // ty
|
||||
setDialogMessage__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DCEF0; // type:function size:0x24
|
||||
isCurrentTitleUsageEnough__Q33ipl5scene15SDChannelSelectCFPCl = .text:0x813DCF14; // type:function size:0xCC
|
||||
getCurrentTitleUsage__Q33ipl5scene15SDChannelSelectCFPlPl = .text:0x813DCFE0; // type:function size:0xCC
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPA21_wPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
findAdjacentChannel__Q33ipl5scene15SDChannelSelectCFiPiPi = .text:0x813DDBB4; // type:function size:0xB4
|
||||
setCurrentPageAndRefresh__Q33ipl5scene15SDChannelSelectFiiPQ33ipl5scene12SDChannelObj = .text:0x813DDC68; // type:function size:0x18
|
||||
handleFourPageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDC80; // type:function size:0x58
|
||||
@@ -4762,7 +4762,7 @@ iplSDChannelTitle_updateParentalResult = .text:0x813E69B4; // type:function size
|
||||
iplSDChannelTitle_updateDialogResult = .text:0x813E6B88; // type:function size:0x144
|
||||
iplSDChannelTitle_startCopyProgress = .text:0x813E6CCC; // type:function size:0x158
|
||||
iplSDChannelTitle_updateCopyPrepare = .text:0x813E6E24; // type:function size:0x17C
|
||||
iplSDChannelTitle_copyTitleRange = .text:0x813E6FA0; // type:function size:0x14
|
||||
__as__Q43ipl5scene8SDMemory10TitleRangeFRCQ43ipl5scene8SDMemory10TitleRange = .text:0x813E6FA0; // type:function size:0x14 scope:weak
|
||||
iplSDChannelTitle_updateMemoryCalc = .text:0x813E6FB4; // type:function size:0xC0
|
||||
iplSDChannelTitle_updateCopyStart = .text:0x813E7074; // type:function size:0x130
|
||||
iplSDChannelTitle_updateAfterClearTmp = .text:0x813E71A4; // type:function size:0xA8
|
||||
@@ -4900,8 +4900,8 @@ onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function si
|
||||
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
|
||||
draw__Q33ipl5scene8SDMemoryFv = .text:0x813EEF30; // type:function size:0x88
|
||||
drawTransferTitles__Q33ipl5scene8SDMemoryFv = .text:0x813EEFB8; // type:function size:0x70C
|
||||
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
|
||||
setTitleRowColors__Q23ipl5sceneFPQ34nw4r3lyt7TextBoxRCQ34nw4r2ut5ColorRCQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
|
||||
__ct__Q34nw4r2ut5ColorFiiii = .text:0x813EF6C4; // type:function size:0x14
|
||||
SetTextColor__Q34nw4r3lyt7TextBoxFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
|
||||
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
|
||||
GetEndIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF728; // type:function size:0x8
|
||||
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
|
||||
@@ -17727,7 +17727,7 @@ __vt__Q39textinput4util9Animation = .data:0x8165D258; // type:object size:0x24
|
||||
@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl = .data:0x8165D28C; // type:object size:0x41 data:string
|
||||
scT_prdc_Text_00 = .data:0x8165D2D0; // type:object size:0xF data:string
|
||||
scP_prdc_scrl_Left = .data:0x8165D2E0; // type:object size:0x11 data:string
|
||||
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x680
|
||||
csPaneToAnimation__Q29textinput12candidatebox = .data:0x8165D2F8; // type:object size:0x680 scope:local
|
||||
@9934 = .data:0x8165D978; // type:object size:0x9 scope:local data:string
|
||||
@9935 = .data:0x8165D984; // type:object size:0x9 scope:local data:string
|
||||
@9936 = .data:0x8165D990; // type:object size:0xB scope:local data:string
|
||||
@@ -20933,31 +20933,28 @@ lbl_81694D18 = .sdata2:0x81694D18; // type:object size:0x4 data:4byte
|
||||
lbl_81694D1C = .sdata2:0x81694D1C; // type:object size:0x4 data:4byte
|
||||
lbl_81694D20 = .sdata2:0x81694D20; // type:object size:0x1 data:byte
|
||||
lbl_81694D24 = .sdata2:0x81694D24; // type:object size:0x1 data:byte
|
||||
scInputFormZeroF = .sdata2:0x81694D28; // type:object size:0x4 align:4 data:float
|
||||
scInputForm640F = .sdata2:0x81694D2C; // type:object size:0x4 align:4 data:float
|
||||
scInputFormF32ConvertMagic = .sdata2:0x81694D30; // type:object size:0x8 align:8 data:double
|
||||
scInputFormOneF = .sdata2:0x81694D38; // type:object size:0x4 align:4 data:float
|
||||
scInputFormHalfF = .sdata2:0x81694D3C; // type:object size:0x4 align:4 data:float
|
||||
scInputFormDegToFIdxF = .sdata2:0x81694D40; // type:object size:0x4 align:4 data:float
|
||||
scInputForm150F = .sdata2:0x81694D44; // type:object size:0x4 align:4 data:float
|
||||
scInputForm30F = .sdata2:0x81694D48; // type:object size:0x4 align:4 data:float
|
||||
scInputForm50F = .sdata2:0x81694D4C; // type:object size:0x4 align:4 data:float
|
||||
scInputForm10F = .sdata2:0x81694D50; // type:object size:0x4 align:4 data:float
|
||||
scInputForm52F = .sdata2:0x81694D54; // type:object size:0x4 align:4 data:float
|
||||
scInputFormTwoF = .sdata2:0x81694D58; // type:object size:0x4 align:4 data:float
|
||||
scInputForm140F = .sdata2:0x81694D5C; // type:object size:0x4 align:4 data:float
|
||||
scInputForm90F = .sdata2:0x81694D60; // type:object size:0x4 align:4 data:float
|
||||
scInputForm253F = .sdata2:0x81694D64; // type:object size:0x4 align:4 data:float
|
||||
scInputForm20F = .sdata2:0x81694D68; // type:object size:0x4 align:4 data:float
|
||||
scInputFormColorRU8 = .sdata2:0x81694D6C; // type:object size:0x1 data:byte
|
||||
scInputFormColorGU8 = .sdata2:0x81694D6D; // type:object size:0x1 data:byte
|
||||
scInputFormColorBU8 = .sdata2:0x81694D6E; // type:object size:0x1 data:byte
|
||||
scInputFormColorAU8 = .sdata2:0x81694D6F; // type:object size:0x1 data:byte
|
||||
scInputForm255F = .sdata2:0x81694D70; // type:object size:0x4 align:4 data:float
|
||||
scInputForm127F = .sdata2:0x81694D74; // type:object size:0x4 align:4 data:float
|
||||
scInputForm14592F = .sdata2:0x81694D78; // type:object size:0x4 align:4 data:float
|
||||
scInputFormF64ConvertMagic = .sdata2:0x81694D80; // type:object size:0x8 align:8 data:double
|
||||
scInputForm15F = .sdata2:0x81694D88; // type:object size:0x4 align:4 data:float
|
||||
@13326 = .sdata2:0x81694D28; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13327 = .sdata2:0x81694D2C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13360 = .sdata2:0x81694D30; // type:object size:0x8 scope:local align:8 data:double
|
||||
@13767 = .sdata2:0x81694D38; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13772 = .sdata2:0x81694D3C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13804 = .sdata2:0x81694D40; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13805 = .sdata2:0x81694D44; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13806 = .sdata2:0x81694D48; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13807 = .sdata2:0x81694D4C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13808 = .sdata2:0x81694D50; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13809 = .sdata2:0x81694D54; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13810 = .sdata2:0x81694D58; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13811 = .sdata2:0x81694D5C; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13812 = .sdata2:0x81694D60; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13813 = .sdata2:0x81694D64; // type:object size:0x4 scope:local align:4 data:float
|
||||
@13814 = .sdata2:0x81694D68; // type:object size:0x4 scope:local align:4 data:float
|
||||
@8131 = .sdata2:0x81694D6C; // type:object size:0x4 scope:local data:byte
|
||||
@14016 = .sdata2:0x81694D70; // type:object size:0x4 scope:local align:4 data:float
|
||||
@14017 = .sdata2:0x81694D74; // type:object size:0x4 scope:local align:4 data:float
|
||||
@14018 = .sdata2:0x81694D78; // type:object size:0x4 scope:local align:4 data:float
|
||||
@14021 = .sdata2:0x81694D80; // type:object size:0x8 scope:local align:8 data:double
|
||||
@14117 = .sdata2:0x81694D88; // type:object size:0x4 scope:local align:4 data:float
|
||||
lbl_81694D90 = .sdata2:0x81694D90; // type:object size:0x4 align:4 data:float
|
||||
lbl_81694D94 = .sdata2:0x81694D94; // type:object size:0x4 align:4 data:float
|
||||
lbl_81694D98 = .sdata2:0x81694D98; // type:object size:0x4 align:4 data:float
|
||||
@@ -23681,8 +23678,8 @@ RegionValid = .sbss:0x81698A48; // type:object size:0x4 data:4byte
|
||||
NandPending = .sbss:0x81698A4C; // type:object size:0x4 scope:local data:4byte
|
||||
CancelNand = .sbss:0x81698A50; // type:object size:0x4 scope:local data:4byte
|
||||
LowReadResult = .sbss:0x81698A54; // type:object size:0x4 scope:local data:4byte
|
||||
CacheCommandComplete = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
|
||||
AudioBufferUnconfigured = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
|
||||
CacheCommandComplete$1963 = .sbss:0x81698A58; // type:object size:0x4 scope:local data:4byte
|
||||
AudioBufferUnconfigured$2065 = .sbss:0x81698A5C; // type:object size:0x4 scope:local data:4byte
|
||||
ResetTime = .sbss:0x81698A60; // type:object size:0x8 scope:local data:4byte
|
||||
SpinupDeadline = .sbss:0x81698A68; // type:object size:0x8 scope:local data:4byte
|
||||
CoverPollTime = .sbss:0x81698A70; // type:object size:0x8 data:4byte
|
||||
@@ -23690,15 +23687,13 @@ DriveWasReset = .sbss:0x81698A78; // type:object size:0x4 data:4byte
|
||||
TitleTicketView = .sbss:0x81698A7C; // type:object size:0x4 scope:local data:4byte
|
||||
CurrentTmd = .sbss:0x81698A80; // type:object size:0x4 scope:local data:4byte
|
||||
TitleCode = .sbss:0x81698A84; // type:object size:0x4 data:4byte
|
||||
RequiredIosHigh = .sbss:0x81698A88; // type:object size:0x4 data:4byte
|
||||
RequiredIosLow = .sbss:0x81698A8C; // type:object size:0x4 data:4byte
|
||||
RequiredIos = .sbss:0x81698A88; // type:object size:0x8 data:4byte
|
||||
GamePartition = .sbss:0x81698A90; // type:object size:0x4 data:4byte
|
||||
UpdatePartition = .sbss:0x81698A94; // type:object size:0x4 data:4byte
|
||||
PartitionCursor = .sbss:0x81698A98; // type:object size:0x4 data:4byte
|
||||
DataToc = .sbss:0x81698A9C; // type:object size:0x4 data:4byte
|
||||
GameToc = .sbss:0x81698AA0; // type:object size:0x8 data:4byte
|
||||
CoverOpenTimeHigh = .sbss:0x81698AA8; // type:object size:0x4 data:4byte
|
||||
CoverOpenTimeLow = .sbss:0x81698AAC; // type:object size:0x4 data:4byte
|
||||
CoverOpenTime = .sbss:0x81698AA8; // type:object size:0x8 data:4byte
|
||||
NandTransferred = .sbss:0x81698AB0; // type:object size:0x4 data:4byte
|
||||
NandLength = .sbss:0x81698AB4; // type:object size:0x4 data:4byte
|
||||
NandBuffer = .sbss:0x81698AB8; // type:object size:0x4 data:4byte
|
||||
|
||||
42
configure.py
42
configure.py
@@ -658,7 +658,7 @@ config.libs = [
|
||||
Object(Matching, "system/iplChannelRsoThread.cpp"),
|
||||
Object(Matching, "system/RsoSystem.cpp"),
|
||||
Object(Matching, "system/iplCdbBackup.cpp"),
|
||||
Object(NonMatching, "system/odh.cpp"),
|
||||
Object(Matching, "system/odh.cpp"),
|
||||
Object(Matching, "system/iplSDVFWorker.cpp"),
|
||||
Object(Matching, "system/iplNandWrapper.cpp"),
|
||||
Object(Matching, "system/main.cpp"),
|
||||
@@ -700,7 +700,7 @@ config.libs = [
|
||||
Object(Matching, "iplwww/www_print.cpp"),
|
||||
Object(Matching, "iplwww/www_window.cpp"),
|
||||
Object(Matching, "iplwww/www_trasition.cpp"),
|
||||
Object(Equivalent, "iplwww/www_wiisetting.cpp"),
|
||||
Object(Matching, "iplwww/www_wiisetting.cpp"),
|
||||
Object(Matching, "iplwww/www_arcreader.cpp"),
|
||||
]
|
||||
),
|
||||
@@ -718,8 +718,8 @@ config.libs = [
|
||||
Object(Matching, "BS2/BS2Entry.c"),
|
||||
Object(Matching, "BS2/BS2.c"),
|
||||
Object(Matching, "BS2/BS2Init.c"),
|
||||
Object(NonMatching, "BS2/BS2Mach.c"),
|
||||
Object(NonMatching, "BS2/BS2Update.c"),
|
||||
Object(Matching, "BS2/BS2Mach.c"),
|
||||
Object(Matching, "BS2/BS2Update.c"),
|
||||
Object(Matching, "BS2/BS2ParentalControl.c"),
|
||||
Object(Matching, "BS2/BS2BringUp.c"),
|
||||
Object(Matching, "BS2/BS2Reset.c"),
|
||||
@@ -729,7 +729,7 @@ config.libs = [
|
||||
IPLSection("address", [
|
||||
Object(Matching, "scene/address/iplAddress.cpp"),
|
||||
Object(Matching, "scene/address/iplAddressAddSel.cpp"),
|
||||
Object(NonMatching, "scene/address/iplAddressEdit.cpp"),
|
||||
Object(Matching, "scene/address/iplAddressEdit.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("backMenu", [
|
||||
@@ -814,7 +814,7 @@ config.libs = [
|
||||
IPLSection("memoryCard", [
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCard.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCardBase.cpp"),
|
||||
Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplMemoryCardManager.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplGCSaveData.cpp"),
|
||||
Object(Matching, "scene/memoryCard/iplGCWindow.cpp"),
|
||||
]
|
||||
@@ -824,7 +824,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("cardSequence", [
|
||||
Object(NonMatching, "scene/cardSequence/iplCardSequence.cpp"),
|
||||
Object(Matching, "scene/cardSequence/iplCardSequence.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("nakamuraTest", [
|
||||
@@ -864,7 +864,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("sdChannelMemory", [
|
||||
Object(NonMatching, "scene/sdChannelMemory/iplSDMemory.cpp"),
|
||||
Object(Matching, "scene/sdChannelMemory/iplSDMemory.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("setting", [
|
||||
@@ -876,11 +876,11 @@ config.libs = [
|
||||
Object(Matching, "scene/setting/iplUSBAP.cpp"),
|
||||
Object(Matching, "scene/setting/iplUSBAPThread.cpp"),
|
||||
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSSLink.c"),
|
||||
Object(Matching, "scene/setting/AOSSLink.c"),
|
||||
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
|
||||
Object(Matching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline on,noauto"]),
|
||||
Object(Matching, "scene/setting/AOSSData.c"),
|
||||
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
|
||||
Object(Matching, "scene/setting/ATERM.c", mw_version="GC/3.0a5", extra_cflags=["-O4,p", "-inline on"]),
|
||||
]
|
||||
),
|
||||
IPLSection("settingSelect", [
|
||||
@@ -911,12 +911,12 @@ config.libs = [
|
||||
IPLSection("keyboard", [
|
||||
Object(Matching, "keyboard/tiPcKeyboard.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiCellPhone.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiPredictLang.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiAtokString.cpp", extra_cflags=["-O4,p"]), # for 4.3J
|
||||
Object(Matching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
|
||||
Object(Matching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -942,7 +942,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("channelScript", [
|
||||
Object(NonMatching, "channelScript/CHANSVm.c"),
|
||||
Object(Matching, "channelScript/CHANSVm.c"),
|
||||
Object(Matching, "channelScript/systemmenu/VmSystem.c"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSSystem.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSLayout.cpp"),
|
||||
@@ -1049,7 +1049,7 @@ config.libs = [
|
||||
Object(Matching, "net/hmac.c"),
|
||||
Object(Matching, "net/neterrorcode.c"),
|
||||
Object(Matching, "net/NETVersion.c"),
|
||||
Object(NonMatching, "net/aes.c"),
|
||||
Object(Matching, "net/aes.c"),
|
||||
Object(Matching, "net/wireless_macaddr.c"),
|
||||
]
|
||||
),
|
||||
@@ -1202,7 +1202,7 @@ config.libs = [
|
||||
Object(Matching, "buffer/mkhdec3.c"),
|
||||
Object(Matching, "buffer/buffer_system.c"),
|
||||
Object(Matching, "buffer/getcode.c"),
|
||||
Object(NonMatching, "buffer/idct_block_var.c"),
|
||||
Object(Matching, "buffer/idct_block_var.c"),
|
||||
|
||||
Object(Matching, "api/decapi.c"),
|
||||
|
||||
@@ -1217,7 +1217,7 @@ config.libs = [
|
||||
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoY8U8V8.c"),
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoRGB565.c"),
|
||||
Object(NonMatching, "texturecvtr/Texture_MCUtoRGBA8.c"),
|
||||
Object(Matching, "texturecvtr/Texture_MCUtoRGBA8.c"),
|
||||
|
||||
Object(Matching, "b65/iqdec_b65_frv32.c"),
|
||||
]
|
||||
@@ -1691,7 +1691,7 @@ config.libs = [
|
||||
Object(Matching, "fa/pdm_api.c"),
|
||||
Object(Matching, "fa/pdm_bpb.c"),
|
||||
Object(Matching, "fa/pdm_disk.c"),
|
||||
Object(NonMatching, "fa/pdm_partition.c"),
|
||||
Object(Matching, "fa/pdm_partition.c"),
|
||||
Object(Matching, "fa/pf_cache.c"),
|
||||
Object(Matching, "fa/pf_cluster.c"),
|
||||
Object(Matching, "fa/pf_dir.c"),
|
||||
@@ -1869,7 +1869,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("nup", [
|
||||
Object(NonMatching, "nup/nup.cpp"),
|
||||
Object(Matching, "nup/nup.cpp"),
|
||||
Object(Matching, "nup/nup_nhttp.cpp"),
|
||||
Object(Matching, "nup/nup_mem.cpp"),
|
||||
]
|
||||
@@ -1886,7 +1886,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("kbd", [
|
||||
Object(NonMatching, "kbd/kbd_lib.c"),
|
||||
Object(Matching, "kbd/kbd_lib.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_jp.c"),
|
||||
Object(Matching, "kbd/kbd_lib_map_us.c"),
|
||||
Object(NonMatching, "kbd/kbd_lib_map_eu.c"),
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, CHANSVmObjHdr*);
|
||||
typedef CHANSVmObjHdr* (*VmConvertFunc)(CHANSVm*, CHANSVmObjType, const CHANSVmObjHdr*);
|
||||
|
||||
typedef struct VmConvertEntry {
|
||||
VmConvertFunc convFunc[6]; // 0x00
|
||||
|
||||
@@ -12,6 +12,7 @@ extern void __sync();
|
||||
extern unsigned int __cntlzw(unsigned int value);
|
||||
extern void __memclr(void* buffer, int len);
|
||||
extern unsigned int __rlwimi(unsigned int a, unsigned int b, unsigned int c, unsigned int d, unsigned int e);
|
||||
extern unsigned int __rlwinm(unsigned int value, unsigned int shift, unsigned int maskBegin, unsigned int maskEnd);
|
||||
extern void* __alloca(unsigned int blockSize);
|
||||
extern int __abs(int n);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace textinput {
|
||||
|
||||
class Base : public CommandSender {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
Base(Manager* manager) : mpCandidates(NULL), mpAllocator(NULL), mbOn(false), mbInvalid(true), meLanguage(USA), mpManager(manager) {}
|
||||
#endif
|
||||
virtual ~Base();
|
||||
@@ -114,7 +114,7 @@ namespace textinput {
|
||||
|
||||
class EventHandler : public nw4rmanager::TiEventHandler {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
EventHandler(LayoutByNW4R* layout) : mpLayoutByNW4R(layout) {}
|
||||
#endif
|
||||
virtual void onTiEvent(gui::PaneComponent* paneComponent, u32 event, Input* input) override; // 0x18
|
||||
@@ -302,7 +302,7 @@ namespace textinput {
|
||||
// TODO
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
|
||||
public:
|
||||
#ifdef TIMANAGER_IMPLEMENTATION
|
||||
#if defined(TIMANAGER_IMPLEMENTATION) || defined(TI_CANDIDATEBOX_SAMPLE_CLASS)
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: Base(manager), nw4rmanager::Layout(accessor, layoutName, observer), mEventHandler(this), mpTiString(NULL),
|
||||
mTextArea(0, this, this), mLeftScroll(1, this, this), mRightScroll(2, this, this), mOnOffButton(3, this, this),
|
||||
@@ -371,6 +371,15 @@ namespace textinput {
|
||||
bool mbActive;
|
||||
};
|
||||
|
||||
#ifdef TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* accessor, EventObserver* observer, const char* layoutName)
|
||||
: LayoutByNW4R(manager, accessor, observer, layoutName) {}
|
||||
virtual ~Sample() {}
|
||||
};
|
||||
#endif
|
||||
|
||||
class CandidateTextAnmPane : public nw4rmanager::AnmPane {
|
||||
public:
|
||||
CandidateTextAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
|
||||
|
||||
@@ -178,8 +178,14 @@ namespace textinput {
|
||||
void inputCharZi_(wchar_t character, u32 modifiers);
|
||||
void inputCharDefault_(wchar_t character, u32 modifiers);
|
||||
void inputInputting_(wchar_t character);
|
||||
inline bool hasZiPredictions() const;
|
||||
inline bool usesZiPrediction() const;
|
||||
bool hasZiPredictions() const;
|
||||
bool usesZiPrediction() const;
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
void checkUnfixConverting_();
|
||||
void setAtokMode_(bool fixMode, bool kanaMode);
|
||||
void trimString_(u32 length);
|
||||
void startConverting_();
|
||||
#endif
|
||||
inline void resetPredictionContext();
|
||||
inline void resetInputRelation();
|
||||
#endif
|
||||
@@ -356,6 +362,7 @@ namespace textinput {
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
friend class EventHandler;
|
||||
inline const nw4r::lyt::Pane* getLanguageTextPane() const;
|
||||
inline nw4r::lyt::TextBox* getTextBox() const;
|
||||
#endif
|
||||
public:
|
||||
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace textinput {
|
||||
#ifdef TIHWKEYBOARD_IMPLEMENTATION
|
||||
EventObserver* getEventObserverForHardware() const { return mpEventObserver; }
|
||||
#endif
|
||||
#ifdef TISIGNWINDOW_IMPLEMENTATION
|
||||
#if defined(TISIGNWINDOW_IMPLEMENTATION) || defined(IPL_ADDRESS_EDIT_CPP)
|
||||
virtual InputForm* getInputForm();
|
||||
#else
|
||||
virtual InputForm* getInputForm() { return mpInputForm; }
|
||||
|
||||
@@ -85,10 +85,30 @@ namespace textinput {
|
||||
#endif
|
||||
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION) || defined(TIZISTRING_IMPLEMENTATION)
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION)
|
||||
virtual ~Decolated() {}
|
||||
#else
|
||||
virtual ~Decolated();
|
||||
#endif
|
||||
enum TranslateMode { TM_Direct, TM_Kana, TM_Roman, TM_Hangul };
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TISTRING_IMPLEMENTATION)
|
||||
virtual void clear() {
|
||||
StringBase::clear();
|
||||
mCursorStart = 0;
|
||||
mCursorEnd = 0;
|
||||
mbSustain = false;
|
||||
initKanaConverter();
|
||||
}
|
||||
virtual void set(const wchar_t* string) {
|
||||
StringBase::set(string);
|
||||
u32 length = getLength();
|
||||
mCursorStart = length;
|
||||
mCursorEnd = length;
|
||||
}
|
||||
#else
|
||||
virtual void clear();
|
||||
virtual void set(const wchar_t* string);
|
||||
#endif
|
||||
virtual void setLength(u16 length);
|
||||
void setTranslateMode(TranslateMode mode);
|
||||
TranslateMode getTranslateMode() const { return static_cast<TranslateMode>(mTranslateMode); }
|
||||
@@ -194,6 +214,9 @@ namespace textinput {
|
||||
public:
|
||||
WithAtok(u16 maxLength) : Decolated(maxLength) {}
|
||||
virtual ~WithAtok();
|
||||
virtual bool isFix();
|
||||
virtual void setFix(bool fix);
|
||||
virtual void initConverting();
|
||||
virtual void pushBack(wchar_t ch);
|
||||
virtual void popBack();
|
||||
virtual void inputChar(wchar_t ch);
|
||||
@@ -209,9 +232,6 @@ namespace textinput {
|
||||
u32 selectedStart;
|
||||
u32 selectedEnd;
|
||||
};
|
||||
virtual bool isFix();
|
||||
virtual void setFix(bool fix);
|
||||
virtual void initConverting();
|
||||
virtual bool isConverting();
|
||||
virtual wchar_t* getConfirmedWCString() const;
|
||||
virtual int getCurrentNumPredicted();
|
||||
|
||||
@@ -47,8 +47,13 @@ namespace textinput {
|
||||
public :
|
||||
virtual ~Base() {}
|
||||
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
virtual void create(MEMAllocator* allocator) {}
|
||||
virtual void init() {}
|
||||
#else
|
||||
virtual void create(MEMAllocator* allocator);
|
||||
virtual void init();
|
||||
#endif
|
||||
};
|
||||
|
||||
class CommandSender;
|
||||
@@ -59,8 +64,12 @@ namespace textinput {
|
||||
#endif
|
||||
#if defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
CommandReceiver() { clearSender(); }
|
||||
#ifdef TIINPUTFORM_IMPLEMENTATION
|
||||
virtual ~CommandReceiver() {}
|
||||
#else
|
||||
virtual ~CommandReceiver();
|
||||
#endif
|
||||
#endif
|
||||
#if defined(MYTIINPUTFORM_IMPLEMENTATION) || defined(MYTILETTERFORM_IMPLEMENTATION) || defined(TIINPUTFORM_IMPLEMENTATION) || defined(TIMANAGER_IMPLEMENTATION)
|
||||
struct Scroll {
|
||||
bool absY;
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace ipl {
|
||||
void add_friendinfo();
|
||||
void delete_friendinfo();
|
||||
void set_textbox(nw4r::lyt::Pane*, const wchar_t*);
|
||||
void set_textbox(nw4r::lyt::Pane* pane, u32 msgId);
|
||||
void setDefaultTitleText(const wchar_t*, bool);
|
||||
static void wiiid_utf16(u64, wchar_t*);
|
||||
static void nigaoe_create_callback_add(ipl::nigaoe::Object*, void*);
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace ipl {
|
||||
RBRRecordType mRecordType; // 0xDC
|
||||
u32 mOptOutFlag; // 0xE0
|
||||
|
||||
class {
|
||||
class StandData {
|
||||
public:
|
||||
void init() {
|
||||
mAngleIdx = -1;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
extern "C" BOOL push_button_queue(void*, const void*);
|
||||
class ButtonEventHandlerBase;
|
||||
class OptOutButtonEventHandlerBase;
|
||||
class SDMenuEventHandlerBase;
|
||||
@@ -315,7 +314,6 @@ namespace ipl {
|
||||
}
|
||||
|
||||
protected:
|
||||
friend BOOL push_button_queue(void*, const void*);
|
||||
typedef struct Command {
|
||||
enum {
|
||||
TYPE_ANIM = 0,
|
||||
|
||||
@@ -166,11 +166,11 @@ namespace ipl {
|
||||
void update_file_array(u8 slot);
|
||||
void update_change_cardstate(u8 slot);
|
||||
|
||||
GXTexObj* create_icon(u8 slot, s16 index);
|
||||
GXTexObj* create_icon(u8 slot, s16 index, long start);
|
||||
GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
|
||||
const GXTexObj* create_icon(u8 slot, s16 index);
|
||||
const GXTexObj* create_icon(u8 slot, s16 index, long start);
|
||||
const GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
|
||||
const wchar_t* getComment(u8 slot, s16 index, int which);
|
||||
GXTexObj* create_banner(u8 slot, s16 index);
|
||||
const GXTexObj* create_banner(u8 slot, s16 index);
|
||||
#ifdef IPL_GC_WINDOW_CPP
|
||||
u32 getBlocks(u8 slot, s16 index);
|
||||
#else
|
||||
@@ -187,7 +187,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
private:
|
||||
GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
|
||||
const GXTexObj* initBannerTexture(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObj(&mFileCell[slot][file].banner, data, CARD_BANNER_WIDTH, CARD_BANNER_HEIGHT,
|
||||
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
return &mFileCell[slot][file].banner;
|
||||
@@ -203,6 +203,22 @@ namespace ipl {
|
||||
return &mFileCell[slot][file].bannerTlut;
|
||||
}
|
||||
|
||||
const GXTexObj* initIconTexture(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObj(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
|
||||
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
return &mFileCell[slot][file].icon;
|
||||
}
|
||||
|
||||
void initIconTextureCI(u8 slot, s32 file, void* data) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].icon, data, CARD_ICON_WIDTH, CARD_ICON_HEIGHT,
|
||||
GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
}
|
||||
|
||||
GXTlutObj* initIconPalette(u8 slot, s32 file, void* data) {
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, data, GX_TL_RGB5A3, 0x100);
|
||||
return &mFileCell[slot][file].iconTlut;
|
||||
}
|
||||
|
||||
u32 reserved; // 0x00004
|
||||
MCFile mFile[2][CARD_MAX_FILE]; // 0x00008
|
||||
MCFileCell mFileCell[2][CARD_MAX_FILE]; // 0x00FE8
|
||||
|
||||
@@ -142,14 +142,9 @@ namespace ipl {
|
||||
u32 mTransferStatus;
|
||||
u64 mTransferStartTime;
|
||||
s32 mTransferFrame;
|
||||
struct TitleListState {
|
||||
ESTitleId* mpTitles;
|
||||
u32 mCount;
|
||||
ESTitleId* mpSecondaryTitles;
|
||||
u32 mSecondaryCount;
|
||||
ESTitleId* mpNames;
|
||||
u32 mNameCount;
|
||||
} mTitleListState;
|
||||
NandSDWorker::TitleIdList mTitleList;
|
||||
NandSDWorker::TitleIdList mNandTitleList;
|
||||
NandSDWorker::TitleIdList mSDTitleList;
|
||||
scroller mScroller;
|
||||
s32 mButtonState;
|
||||
u8 mControllerFlags[4];
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace ipl {
|
||||
BOOL onEventDerived(const char* paneName, u32 event,
|
||||
controller::Interface* controller);
|
||||
bool collectTitlesByUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
|
||||
static const char* mscChannelPaneNames[PAGE_COUNT][MAX_CHANNEL_INDEX];
|
||||
@@ -197,6 +197,8 @@ namespace ipl {
|
||||
friend class SDChannelSelectEventHandler;
|
||||
friend class SDChannelSelectButtonEventHandler;
|
||||
#endif
|
||||
friend class SDMemory;
|
||||
|
||||
void enqueueStartNotice();
|
||||
bool enqueueFinishNotice();
|
||||
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
|
||||
@@ -204,11 +206,14 @@ namespace ipl {
|
||||
bool enqueuePageNotice();
|
||||
bool enqueueResultNotice(u32 result);
|
||||
bool enqueueChannelNotice(u64 titleId, u32 value);
|
||||
bool enqueueMoveNotice(u32 controller, u32 page, u32 index);
|
||||
bool enqueueMoveNotice(ESTitleId titleId);
|
||||
bool enqueueStateNotice(u64 titleId, u32 state);
|
||||
bool enqueueErrorNotice(u32 page, u32 index);
|
||||
bool enqueueCommandNotice(u32 page, u32 index, u32 command);
|
||||
bool enqueueDeleteNotice(u32 controller, u32 page, u32 index);
|
||||
bool enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
|
||||
NandSDWorker::TitleIdList* replacingTitles);
|
||||
bool enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
|
||||
NandSDWorker::TitleIdList* foundTitles,
|
||||
NandSDWorker::TitleIdList* badTitles);
|
||||
bool enqueueDeleteNotice(ESTitleId titleId);
|
||||
void clearCommandQueue();
|
||||
void clearNoticeQueue();
|
||||
void calcChannelObjects();
|
||||
@@ -233,16 +238,16 @@ namespace ipl {
|
||||
bool isCurrentTitleUsageEnough(const s32* usage) const;
|
||||
void getCurrentTitleUsage(s32* bytes, s32* blocks) const;
|
||||
bool collectTitlesByChannelOrder(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesFromNandUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesBySpecialChannels(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount);
|
||||
bool collectTitlesForMode(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21],
|
||||
u32* titleCount, int searchMode);
|
||||
bool findAdjacentChannel(int direction, int* page, int* index) const;
|
||||
void setStateAndPlaySelectSound(int state) NO_INLINE;
|
||||
|
||||
@@ -18,6 +18,15 @@ namespace ipl {
|
||||
f32 margin16x9 = 120.0f, f32 margin4x3 = 30.0f);
|
||||
~TextBalloon();
|
||||
|
||||
static f32 getDefaultMargin16x9() {
|
||||
f32 margin = 120.0f;
|
||||
return margin;
|
||||
}
|
||||
static f32 getDefaultMargin4x3() {
|
||||
f32 margin = 30.0f;
|
||||
return margin;
|
||||
}
|
||||
|
||||
void calc();
|
||||
void draw();
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ipl {
|
||||
Manager(EGG::Heap* heap);
|
||||
|
||||
/** @return The message data in use. */
|
||||
const wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
|
||||
wchar_t* getMessage(u32 id) const { return mpMessage->getMessage(id); }
|
||||
void setResource(u8* msgData) const { mpMessage->setResource(msgData); }
|
||||
|
||||
private:
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
/** @return The Message ID as a Wide-string. */
|
||||
static const wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
|
||||
static wchar_t* getMessage(u32 id) { return smArg.mpMessageMgr->getMessage(id); }
|
||||
static message::Manager* getMessageManager() { return smArg.mpMessageMgr; }
|
||||
|
||||
static void* getFont();
|
||||
|
||||
@@ -10,31 +10,9 @@ namespace ipl {
|
||||
public:
|
||||
inline Queue<T, c>() : count(c), current(0), popped(0), pushed(0) {}
|
||||
|
||||
BOOL push(const T& item) {
|
||||
if (count == current) {
|
||||
return FALSE;
|
||||
}
|
||||
items[pushed] = item;
|
||||
if (++pushed >= count) {
|
||||
pushed = 0;
|
||||
}
|
||||
current++;
|
||||
return TRUE;
|
||||
}
|
||||
BOOL push(const T& item);
|
||||
|
||||
BOOL pop() {
|
||||
BOOL result = TRUE;
|
||||
if (current == 0) {
|
||||
result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
if (++popped >= count) {
|
||||
popped = 0;
|
||||
}
|
||||
current--;
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
BOOL pop();
|
||||
|
||||
int get_current_index() { return current; }
|
||||
T& get_current_item() { return items[get_current_index()]; }
|
||||
@@ -55,6 +33,34 @@ namespace ipl {
|
||||
int current; // (sizeof(items) * count) + 0x04
|
||||
int popped, pushed; // (sizeof(items) * count) + 0x08
|
||||
};
|
||||
|
||||
template <typename T, int c>
|
||||
BOOL Queue<T, c>::push(const T& item) {
|
||||
if (count == current) {
|
||||
return FALSE;
|
||||
}
|
||||
items[pushed] = item;
|
||||
if (++pushed >= count) {
|
||||
pushed = 0;
|
||||
}
|
||||
current++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
template <typename T, int c>
|
||||
BOOL Queue<T, c>::pop() {
|
||||
BOOL result = TRUE;
|
||||
if (current == 0) {
|
||||
result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
if (++popped >= count) {
|
||||
popped = 0;
|
||||
}
|
||||
current--;
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
} // namespace utility
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -22,7 +22,11 @@ int strcmp(const char* s1, const char* s2);
|
||||
char* strpbrk(const char* s1, const char* s2);
|
||||
size_t strspn(const char* s1, const char* s2);
|
||||
char* strtok(char* str, const char* delimiters);
|
||||
#ifdef __cplusplus
|
||||
const char* strstr(const char* str, const char* pat);
|
||||
#else
|
||||
char* strstr(const char* str, const char* pat);
|
||||
#endif
|
||||
|
||||
char* strncpy(char* dst, const char* src, size_t length);
|
||||
char* strncat(char* dst, const char* src, size_t length);
|
||||
@@ -39,4 +43,12 @@ int strcmpi(const char* s1, const char* s2);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C++" {
|
||||
inline char* strstr(char* str, const char* pat) {
|
||||
return const_cast<char*>(strstr(static_cast<const char*>(str), pat));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MSL_STRING_H
|
||||
|
||||
@@ -27,7 +27,11 @@ wchar_t* wcscat(wchar_t* dest, const wchar_t* src);
|
||||
wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num);
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num);
|
||||
wchar_t* wcschr(wchar_t* ws, wchar_t wc);
|
||||
#ifndef __cplusplus
|
||||
wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
#else
|
||||
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
||||
#endif
|
||||
|
||||
int swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...);
|
||||
int vswprintf(wchar_t* ws, size_t len, const wchar_t* format, va_list arg);
|
||||
@@ -36,6 +40,12 @@ int wcsnicmp(const char* dst, const char* src, size_t num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
extern "C++" {
|
||||
inline wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2) {
|
||||
return const_cast<wchar_t*>(wcsstr(static_cast<const wchar_t*>(s1), s2));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MSL_WCHAR_H
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace nw4r {
|
||||
const math::MTX34& GetMtx() const { return mMtx; }
|
||||
void SetMtx(const math::MTX34& mtx) { mMtx = mtx; }
|
||||
|
||||
u8 GetAlpha() { return mAlpha; }
|
||||
u8 GetAlpha() const { return mAlpha; }
|
||||
void SetAlpha(u8 alpha) { mAlpha = alpha; }
|
||||
|
||||
const char* GetName() const { return mName; }
|
||||
|
||||
@@ -55,16 +55,14 @@ namespace nw4r {
|
||||
NW4R_ASSERT(type < TEXTCOLOR_MAX);
|
||||
return mTextColors[type];
|
||||
}
|
||||
#ifdef IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
void SetTextColors(const ut::Color& first, const ut::Color& second) {
|
||||
mTextColors[0] = first;
|
||||
mTextColors[1] = second;
|
||||
}
|
||||
#endif
|
||||
void SetTextColor(u32 type, ut::Color value) {
|
||||
NW4R_ASSERT(type < TEXTCOLOR_MAX);
|
||||
mTextColors[type] = value;
|
||||
}
|
||||
void SetTextColor(ut::Color top, ut::Color bottom) {
|
||||
mTextColors[0] = top;
|
||||
mTextColors[1] = bottom;
|
||||
}
|
||||
|
||||
void SetTextPositionH(u8 pos) { detail::SetHorizontalPosition(&mTextPosition, pos); }
|
||||
void SetTextPositionV(u8 pos) { detail::SetVerticalPosition(&mTextPosition, pos); }
|
||||
|
||||
@@ -36,8 +36,9 @@ namespace nw4r {
|
||||
return instance;
|
||||
}
|
||||
|
||||
// MWCC needs IRO 0 to recompute voice addresses inside the initialization loop.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0 // uh
|
||||
#pragma ppc_iro_level 0
|
||||
void AxManager::Init() {
|
||||
if (mInitialized) {
|
||||
return;
|
||||
|
||||
@@ -84,157 +84,139 @@ s32 TMCJPEGDEC_get_byte(u8* dst, TMCCJPEGDecWork* work) {
|
||||
}
|
||||
|
||||
s32 TMCJPEGDEC_get_wbyte(u16* dst, TMCCJPEGDecWork* work) {
|
||||
u8 byte_val;
|
||||
u32 byte_shifted;
|
||||
s32 r;
|
||||
u8 byte;
|
||||
u32 highByte;
|
||||
s32 result;
|
||||
|
||||
u8* cur;
|
||||
u8* end;
|
||||
u8* next;
|
||||
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r < 0) {
|
||||
goto br;
|
||||
// MWCC needs the empty else branches to preserve refill branch direction.
|
||||
do {
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
// This else-branch is load-bearing...
|
||||
// Forces bge instead of blt.
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto br;
|
||||
}
|
||||
|
||||
{
|
||||
u8* bufferCursor = work->pBufCur;
|
||||
end = work->pBufEnd;
|
||||
cur = bufferCursor;
|
||||
next = bufferCursor + 1;
|
||||
}
|
||||
|
||||
work->pBufCur = next;
|
||||
byte = *cur;
|
||||
if (next >= end) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
result = 0;
|
||||
} while (0);
|
||||
highByte = (u32)byte << 8;
|
||||
if (result < 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
{
|
||||
u8* tmp = work->pBufCur;
|
||||
do {
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cur = work->pBufCur;
|
||||
end = work->pBufEnd;
|
||||
cur = tmp;
|
||||
next = tmp + 1;
|
||||
}
|
||||
|
||||
work->pBufCur = next;
|
||||
byte_val = *cur;
|
||||
if (next < end) {
|
||||
goto o1;
|
||||
}
|
||||
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
goto o1;
|
||||
next = cur + 1;
|
||||
work->pBufCur = next;
|
||||
byte = *cur;
|
||||
if (next >= end) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto br;
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto br;
|
||||
}
|
||||
|
||||
o1:
|
||||
r = 0;
|
||||
|
||||
br:
|
||||
byte_shifted = (u32)byte_val << 8;
|
||||
if (r >= 0) {
|
||||
goto p2;
|
||||
}
|
||||
return r;
|
||||
|
||||
p2:
|
||||
if (work->pBufCur < work->pBufEnd) {
|
||||
goto r2;
|
||||
}
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r < 0)
|
||||
goto ez;
|
||||
else {
|
||||
// ...
|
||||
}
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto ez;
|
||||
}
|
||||
|
||||
r2:
|
||||
cur = work->pBufCur;
|
||||
end = work->pBufEnd;
|
||||
next = cur + 1;
|
||||
work->pBufCur = next;
|
||||
byte_val = *cur;
|
||||
if (next < end) {
|
||||
goto o2;
|
||||
}
|
||||
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r < 0)
|
||||
goto ez;
|
||||
else {
|
||||
// ...
|
||||
}
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto ez;
|
||||
}
|
||||
|
||||
o2:
|
||||
r = 0;
|
||||
ez:
|
||||
*dst = byte_shifted + byte_val;
|
||||
return r < 0 ? r : 0;
|
||||
result = 0;
|
||||
} while (0);
|
||||
*dst = highByte + byte;
|
||||
return result < 0 ? result : 0;
|
||||
}
|
||||
|
||||
s32 TMCJPEGDEC_get_sbyte(u8* dst, u32 count, TMCCJPEGDecWork* work) {
|
||||
int r = 0;
|
||||
int result = 0;
|
||||
u32 i;
|
||||
u8 byte;
|
||||
u8* cur;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r < 0) {
|
||||
goto copy_byte;
|
||||
// MWCC needs the empty else branches to preserve refill branch direction.
|
||||
do {
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
// This else-branch is load-bearing...
|
||||
// Forces bge instead of blt.
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto copy_byte;
|
||||
}
|
||||
}
|
||||
|
||||
cur = work->pBufCur;
|
||||
work->pBufCur += 1;
|
||||
byte = *cur;
|
||||
cur = work->pBufCur;
|
||||
work->pBufCur += 1;
|
||||
byte = *cur;
|
||||
|
||||
if (work->pBufCur < work->pBufEnd) {
|
||||
goto r0;
|
||||
}
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
goto r0;
|
||||
if (work->pBufCur >= work->pBufEnd) {
|
||||
if (work->remaining != 0) {
|
||||
result = refillJpegBuffer(work);
|
||||
if (result < 0) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
result = TMCC_ERROR_UNDERFLOW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto copy_byte;
|
||||
} else {
|
||||
r = TMCC_ERROR_UNDERFLOW;
|
||||
goto copy_byte;
|
||||
}
|
||||
|
||||
r0:
|
||||
r = 0;
|
||||
|
||||
copy_byte:
|
||||
result = 0;
|
||||
} while (0);
|
||||
*dst = byte;
|
||||
dst++;
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (result < 0)
|
||||
return result;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -243,51 +225,41 @@ s32 TMCJPEGDEC_move_ptr(s32 offset, TMCCJPEGDecWork* work) {
|
||||
s32 avail;
|
||||
s32 r;
|
||||
|
||||
if (offset < 0) {
|
||||
goto ng;
|
||||
if (offset >= 0) {
|
||||
while (work->pBufEnd - work->pBufCur <= offset) {
|
||||
avail = work->pBufEnd - work->pBufCur;
|
||||
offset -= avail;
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
continue;
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
}
|
||||
}
|
||||
work->pBufCur += offset;
|
||||
if (work->pBufEnd > work->pBufCur) {
|
||||
goto done;
|
||||
}
|
||||
if (work->remaining != 0) {
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
goto done;
|
||||
}
|
||||
return r;
|
||||
} else {
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
}
|
||||
} else {
|
||||
offset = -offset;
|
||||
if (work->pBufCur - work->pBufStart < offset) {
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
}
|
||||
work->pBufCur -= offset;
|
||||
}
|
||||
goto lc;
|
||||
|
||||
lp:
|
||||
offset -= avail;
|
||||
if (work->remaining == 0) {
|
||||
goto er1;
|
||||
}
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
goto lc;
|
||||
}
|
||||
return r;
|
||||
er1:
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
|
||||
lc:
|
||||
avail = work->pBufEnd - work->pBufCur;
|
||||
if (avail <= offset) {
|
||||
goto lp;
|
||||
}
|
||||
work->pBufCur += offset;
|
||||
if (work->pBufEnd > work->pBufCur) {
|
||||
goto ret0;
|
||||
}
|
||||
if (work->remaining == 0) {
|
||||
goto er2;
|
||||
}
|
||||
r = refillJpegBuffer(work);
|
||||
if (r >= 0) {
|
||||
goto ret0;
|
||||
}
|
||||
return r;
|
||||
er2:
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
|
||||
ng:
|
||||
offset = -offset;
|
||||
if (work->pBufCur - work->pBufStart < offset) {
|
||||
return TMCC_ERROR_UNDERFLOW;
|
||||
}
|
||||
work->pBufCur -= offset;
|
||||
ret0:
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,47 +286,45 @@ s32 TMCJPEGDEC_load_buff(TMCCJPEGDecWork* work) {
|
||||
work->bitBuf = bitBuf;
|
||||
work->bitCount = bitCount;
|
||||
work->pBufCur = cur;
|
||||
goto ret;
|
||||
} else {
|
||||
do {
|
||||
if (work->pBufEnd <= work->pBufCur) {
|
||||
if (work->remaining == 0) {
|
||||
break;
|
||||
}
|
||||
r = refillJpegBufferAfterFF(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
u32 bb = work->bitBuf;
|
||||
u8* c = work->pBufCur;
|
||||
u8* next;
|
||||
u8 byte = *c;
|
||||
|
||||
next = c + 1;
|
||||
work->pBufCur = next;
|
||||
work->bitBuf = (bb << 8) + byte;
|
||||
work->bitCount += 8;
|
||||
if (byte == 0xFF) {
|
||||
work->pBufCur = next + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (work->pBufEnd <= work->pBufCur) {
|
||||
if (work->remaining == 0) {
|
||||
break;
|
||||
}
|
||||
r = refillJpegBufferAfterFF(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
} while (work->bitCount <= 24);
|
||||
}
|
||||
|
||||
do {
|
||||
if (work->pBufEnd <= work->pBufCur) {
|
||||
if (work->remaining == 0) {
|
||||
break;
|
||||
}
|
||||
r = refillJpegBufferAfterFF(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
u32 bb = work->bitBuf;
|
||||
u8* c = work->pBufCur;
|
||||
u8* next;
|
||||
u8 byte = *c;
|
||||
|
||||
next = c + 1;
|
||||
work->pBufCur = next;
|
||||
work->bitBuf = (bb << 8) + byte;
|
||||
work->bitCount += 8;
|
||||
if (byte == 0xFF) {
|
||||
work->pBufCur = next + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (work->pBufEnd <= work->pBufCur) {
|
||||
if (work->remaining == 0) {
|
||||
break;
|
||||
}
|
||||
r = refillJpegBufferAfterFF(work);
|
||||
if (r < 0) {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
} while (work->bitCount <= 24);
|
||||
|
||||
ret:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,444 +31,507 @@ static s32 scalingClampU8(s32 value) {
|
||||
return value < 0 ? 0 : 255;
|
||||
}
|
||||
|
||||
static s32 clampLumaDc(s32 coefficient) {
|
||||
return clampU8((coefficient >> 11) + 0x80);
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
s32 workspace[64];
|
||||
s32* workspaceCursor;
|
||||
s32 evenBaseSum;
|
||||
s32 evenRotation;
|
||||
s32 pitch2;
|
||||
s32* dst;
|
||||
s32 rowOddOutput1;
|
||||
int columnAcBits;
|
||||
s32 column;
|
||||
s32 evenOutput3;
|
||||
s32 coefficient2;
|
||||
s32 coefficient1;
|
||||
s32 coefficient4;
|
||||
s32 coefficient5;
|
||||
s32 coefficient6;
|
||||
s32 coefficient7;
|
||||
s32 oddOutput0;
|
||||
s32 m;
|
||||
s32 evenBaseDifference;
|
||||
s32 processedCoefficients;
|
||||
s32 z;
|
||||
s32 evenOutput1;
|
||||
s32 oddOutput3;
|
||||
s32 oddLowRotation;
|
||||
s32 oddHighRotation;
|
||||
s32 evenRotationSum;
|
||||
s32 r;
|
||||
s32 oddOutput1;
|
||||
s32 oddSumRotation;
|
||||
s32 oddSumDifference;
|
||||
s32 oddDifferenceSum;
|
||||
s32 columnsRemaining;
|
||||
s32 oddOutput2;
|
||||
s32 evenOutput0;
|
||||
s32 evenOutput2;
|
||||
s32 coefficient3;
|
||||
s32 rowEvenOutput0;
|
||||
s32 columnC6;
|
||||
s32 columnC4;
|
||||
s32 columnOddSumRotation;
|
||||
s32 rowDc;
|
||||
s32 rowEvenOutput1;
|
||||
s32 columnC1;
|
||||
s32 columnEvenBaseDifference;
|
||||
s32 columnEvenOutput0;
|
||||
s32 columnC2;
|
||||
s32 columnScaledEvenRotation;
|
||||
s32 columnEvenOutput1;
|
||||
s32 columnC5;
|
||||
s32 rowC4;
|
||||
s32 rowOddSumRotation;
|
||||
s32 columnEvenOutput3;
|
||||
s32 columnOddLowSum;
|
||||
s32 columnOddLowDifference;
|
||||
s32 columnOddHighSum;
|
||||
s32 columnC7;
|
||||
s32 columnC3;
|
||||
s32 columnEvenBaseSum;
|
||||
s32 rowEvenBaseDifference;
|
||||
s32 rowEvenOutput2;
|
||||
s32 rowOddOutput0;
|
||||
s32 rowC1;
|
||||
s32 columnOddHighDifference;
|
||||
s32 columnDc;
|
||||
s32 columnOddDifferenceRotation;
|
||||
s32 columnOddOutput1;
|
||||
s32 rowScaledEvenRotation;
|
||||
s32 columnEvenOutput2;
|
||||
s32 columnOddMix;
|
||||
int rowAcBits;
|
||||
s32 columnEvenRotationSum;
|
||||
s32 rowEvenBaseSum;
|
||||
s32 rowC2;
|
||||
s32 rowEvenRotationSum;
|
||||
s32 rowEvenOutput3;
|
||||
s32 rowOddLowDifference;
|
||||
s32 columnOddOutput0;
|
||||
u8* columnOutput;
|
||||
s32 pitch4;
|
||||
s32* src;
|
||||
s32 rowC3;
|
||||
s32 rowOddHighDifference;
|
||||
s32 rowOddHighSum;
|
||||
s32 rowOddOutput3;
|
||||
s32 pitch7;
|
||||
s32 pitch6;
|
||||
s32 rowC6;
|
||||
s32 columnOddOutput2;
|
||||
u8 columnSample;
|
||||
s32 processed;
|
||||
s32 rowOddLowSum;
|
||||
s32 rowOddDifferenceRotation;
|
||||
s32 columnOddOutput3;
|
||||
s32 rowC5;
|
||||
s32 rowOddMix;
|
||||
s32 rowSampleDc;
|
||||
s32 rowOddOutput2;
|
||||
s32 rowC7;
|
||||
s32 rowCount;
|
||||
s32 pitch5;
|
||||
s32 pitch3;
|
||||
s32 workspace[64];
|
||||
s32 rowEvenSum;
|
||||
s32 rowOddLowRotation;
|
||||
s32 rowEvenRotation;
|
||||
s32 rowOddDifferenceSum;
|
||||
s32 rowOddHighRotation;
|
||||
s32 rowOddSumDifference;
|
||||
s32 columnOddDifferenceSum;
|
||||
s32 columnOddHighRotation;
|
||||
s32 columnOddLowRotation;
|
||||
s32 columnEvenRotation;
|
||||
s32 columnOddSumDifference;
|
||||
int columnEvenSum;
|
||||
|
||||
r = (zigzag >> 4) * 8;
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
{
|
||||
for (; processedCoefficients < r; processedCoefficients += 8) {
|
||||
u32 acBits;
|
||||
coefficient4 = block[4];
|
||||
coefficient6 = block[6];
|
||||
coefficient2 = block[2];
|
||||
coefficient1 = block[1];
|
||||
coefficient7 = block[7];
|
||||
coefficient5 = block[5];
|
||||
coefficient3 = block[3];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample = block[0];
|
||||
workspaceCursor[7] = sample;
|
||||
workspaceCursor[6] = sample;
|
||||
workspaceCursor[5] = sample;
|
||||
workspaceCursor[4] = sample;
|
||||
workspaceCursor[3] = sample;
|
||||
workspaceCursor[2] = sample;
|
||||
workspaceCursor[1] = sample;
|
||||
workspaceCursor[0] = sample;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
evenRotation = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
evenRotationSum = coefficient6 + coefficient2;
|
||||
evenRotation = evenRotation * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
evenRotationSum = evenRotation + evenRotationSum;
|
||||
evenOutput1 = evenBaseDifference + evenRotation;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + evenRotationSum;
|
||||
evenOutput3 = evenBaseSum - evenRotationSum;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - evenRotation;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
oddOutput0 = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
workspaceCursor[0] = evenOutput0 + oddOutput0;
|
||||
oddLowRotation = oddLowDifference * 0x8B;
|
||||
workspaceCursor[7] = evenOutput0 - oddOutput0;
|
||||
oddLowRotation >>= 8;
|
||||
workspaceCursor[1] = evenOutput1 + oddOutput1;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
workspaceCursor[6] = evenOutput1 - oddOutput1;
|
||||
workspaceCursor[2] = evenOutput2 + oddOutput2;
|
||||
workspaceCursor[5] = evenOutput2 - oddOutput2;
|
||||
workspaceCursor[3] = evenOutput3 + oddOutput3;
|
||||
workspaceCursor[4] = evenOutput3 - oddOutput3;
|
||||
}
|
||||
block += 8;
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
}
|
||||
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
r = pitch * 8 - pitch;
|
||||
z = pitch * 4;
|
||||
m = pitch * 2;
|
||||
workspaceCursor = workspace + 7;
|
||||
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
|
||||
u32 acBits;
|
||||
u8* output;
|
||||
|
||||
coefficient4 = workspaceCursor[0x20];
|
||||
coefficient6 = workspaceCursor[0x30];
|
||||
coefficient2 = workspaceCursor[0x10];
|
||||
coefficient1 = workspaceCursor[8];
|
||||
coefficient7 = workspaceCursor[0x38];
|
||||
coefficient5 = workspaceCursor[0x28];
|
||||
coefficient3 = workspaceCursor[0x18];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
output = conv_row_ptr + column;
|
||||
if (acBits == 0) {
|
||||
u8 sample = clampU8((*workspaceCursor >> 11) + 0x80);
|
||||
output[r] = sample;
|
||||
output[pitch * 6] = sample;
|
||||
output[z + pitch] = sample;
|
||||
output[z] = sample;
|
||||
output[z - pitch] = sample;
|
||||
output[m] = sample;
|
||||
output[pitch] = sample;
|
||||
output[0] = sample;
|
||||
rowCount = (zigzag >> 4) * 8;
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowC4 = block[4];
|
||||
rowC6 = block[6];
|
||||
rowC2 = block[2];
|
||||
rowC1 = block[1];
|
||||
rowC7 = block[7];
|
||||
rowC5 = block[5];
|
||||
rowC3 = block[3];
|
||||
rowAcBits = rowC4 | rowC6;
|
||||
rowAcBits = rowC2 | rowAcBits;
|
||||
rowAcBits = rowC1 | rowAcBits;
|
||||
rowAcBits = rowC7 | rowAcBits;
|
||||
rowAcBits = rowC5 | rowAcBits;
|
||||
rowAcBits = rowC3 | rowAcBits;
|
||||
if (rowAcBits == 0) {
|
||||
rowSampleDc = block[0];
|
||||
dst[7] = rowSampleDc;
|
||||
dst[6] = rowSampleDc;
|
||||
dst[5] = rowSampleDc;
|
||||
dst[4] = rowSampleDc;
|
||||
dst[3] = rowSampleDc;
|
||||
dst[2] = rowSampleDc;
|
||||
dst[1] = rowSampleDc;
|
||||
dst[0] = rowSampleDc;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddHighSum;
|
||||
s32 dcValue;
|
||||
|
||||
evenRotation = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
coefficient5 = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
coefficient1 = coefficient1 - coefficient7;
|
||||
evenRotationSum = coefficient6 + coefficient2;
|
||||
coefficient2 = evenRotation * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = coefficient5 + coefficient1;
|
||||
dcValue = *workspaceCursor + 0x40000;
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
evenRotationSum = coefficient2 + evenRotationSum;
|
||||
evenOutput1 = evenBaseDifference + coefficient2;
|
||||
oddDifferenceSum = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + evenRotationSum;
|
||||
evenOutput3 = evenBaseSum - evenRotationSum;
|
||||
oddHighRotation = coefficient1 * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - coefficient2;
|
||||
oddHighRotation = oddHighRotation - oddDifferenceSum;
|
||||
oddLowSum += oddHighRotation;
|
||||
oddOutput0 = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + oddHighRotation;
|
||||
oddLowRotation = coefficient5 * 0x8B >> 8;
|
||||
oddOutput3 = oddDifferenceSum + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
output[0] = scalingClampU8(evenOutput0 + oddOutput0);
|
||||
output[r] = scalingClampU8(evenOutput0 - oddOutput0);
|
||||
output[pitch] = scalingClampU8(evenOutput1 + oddOutput1);
|
||||
output[pitch * 6] = scalingClampU8(evenOutput1 - oddOutput1);
|
||||
output[m] = scalingClampU8(evenOutput2 + oddOutput2);
|
||||
output[z + pitch] = scalingClampU8(evenOutput2 - oddOutput2);
|
||||
output[z - pitch] = scalingClampU8(evenOutput3 + oddOutput3);
|
||||
output[z] = scalingClampU8(evenOutput3 - oddOutput3);
|
||||
rowDc = block[0];
|
||||
rowEvenRotation = rowC2 - rowC6;
|
||||
rowEvenSum = rowC2 + rowC6;
|
||||
rowEvenBaseSum = rowDc + rowC4;
|
||||
rowEvenBaseDifference = rowDc - rowC4;
|
||||
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
|
||||
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
|
||||
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
|
||||
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
|
||||
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
|
||||
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
|
||||
rowOddHighSum = rowC1 + rowC7;
|
||||
rowOddHighDifference = rowC1 - rowC7;
|
||||
rowOddLowSum = rowC5 + rowC3;
|
||||
rowOddLowDifference = rowC5 - rowC3;
|
||||
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
|
||||
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
|
||||
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
|
||||
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
|
||||
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
|
||||
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
|
||||
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
|
||||
rowOddLowSum += rowOddMix;
|
||||
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
|
||||
rowOddOutput1 = rowOddSumRotation + rowOddMix;
|
||||
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
|
||||
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
|
||||
dst[0] = rowEvenOutput0 + rowOddOutput0;
|
||||
dst[7] = rowEvenOutput0 - rowOddOutput0;
|
||||
dst[1] = rowEvenOutput1 + rowOddOutput1;
|
||||
dst[6] = rowEvenOutput1 - rowOddOutput1;
|
||||
dst[2] = rowEvenOutput2 + rowOddOutput2;
|
||||
dst[5] = rowEvenOutput2 - rowOddOutput2;
|
||||
dst[3] = rowEvenOutput3 + rowOddOutput3;
|
||||
dst[4] = rowEvenOutput3 - rowOddOutput3;
|
||||
}
|
||||
workspaceCursor--;
|
||||
block += 8;
|
||||
dst += 8;
|
||||
}
|
||||
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
|
||||
src = workspace + 7;
|
||||
pitch4 = pitch * 4;
|
||||
pitch5 = pitch4 + pitch;
|
||||
pitch3 = pitch4 - pitch;
|
||||
pitch2 = pitch * 2;
|
||||
pitch6 = pitch * 6;
|
||||
pitch7 = pitch * 8 - pitch;
|
||||
for (column = 7; column >= 0; column--) {
|
||||
columnC4 = src[32];
|
||||
columnC6 = src[48];
|
||||
columnC2 = src[16];
|
||||
columnC1 = src[8];
|
||||
columnC7 = src[56];
|
||||
columnC5 = src[40];
|
||||
columnC3 = src[24];
|
||||
columnAcBits = columnC4 | columnC6;
|
||||
columnAcBits = columnC2 | columnAcBits;
|
||||
columnAcBits = columnC1 | columnAcBits;
|
||||
columnAcBits = columnC7 | columnAcBits;
|
||||
columnAcBits = columnC5 | columnAcBits;
|
||||
columnAcBits = columnC3 | columnAcBits;
|
||||
columnOutput = conv_row_ptr + column;
|
||||
if (columnAcBits == 0) {
|
||||
columnSample = clampLumaDc(*src);
|
||||
columnOutput[pitch7] = columnSample;
|
||||
columnOutput[pitch6] = columnSample;
|
||||
columnOutput[pitch5] = columnSample;
|
||||
columnOutput[pitch4] = columnSample;
|
||||
columnOutput[pitch3] = columnSample;
|
||||
columnOutput[pitch2] = columnSample;
|
||||
columnOutput[pitch] = columnSample;
|
||||
columnOutput[0] = columnSample;
|
||||
} else {
|
||||
columnEvenSum = columnC6 + columnC2;
|
||||
columnEvenRotation = columnC2 - columnC6;
|
||||
columnOddLowSum = columnC5 + columnC3;
|
||||
columnOddHighDifference = columnC1 - columnC7;
|
||||
columnOddLowDifference = columnC5 - columnC3;
|
||||
columnOddHighSum = columnC1 + columnC7;
|
||||
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
|
||||
columnDc = *src + 0x40000;
|
||||
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
|
||||
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
|
||||
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
|
||||
columnEvenBaseSum = columnDc + columnC4;
|
||||
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
|
||||
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
|
||||
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
|
||||
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
|
||||
columnOddLowSum += columnOddMix;
|
||||
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
|
||||
columnEvenBaseDifference = columnDc - columnC4;
|
||||
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
|
||||
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
|
||||
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
|
||||
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
|
||||
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
|
||||
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
|
||||
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
|
||||
columnOddOutput1 = columnOddSumRotation + columnOddMix;
|
||||
columnOutput[0] = scalingClampU8(columnEvenOutput0 + columnOddOutput0);
|
||||
columnOutput[pitch7] = scalingClampU8(columnEvenOutput0 - columnOddOutput0);
|
||||
columnOutput[pitch] = scalingClampU8(columnEvenOutput1 + columnOddOutput1);
|
||||
columnOutput[pitch6] = scalingClampU8(columnEvenOutput1 - columnOddOutput1);
|
||||
columnOutput[pitch2] = scalingClampU8(columnEvenOutput2 + columnOddOutput2);
|
||||
columnOutput[pitch5] = scalingClampU8(columnEvenOutput2 - columnOddOutput2);
|
||||
columnOutput[pitch3] = scalingClampU8(columnEvenOutput3 + columnOddOutput3);
|
||||
columnOutput[pitch4] = scalingClampU8(columnEvenOutput3 - columnOddOutput3);
|
||||
}
|
||||
src--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static s32 clampChromaDc(s32 value) {
|
||||
return clampS8(value >> 11);
|
||||
}
|
||||
|
||||
void TMCJPEGDEC_IdctBlock_Col(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigzag) {
|
||||
s32 workspace[64];
|
||||
s32* workspaceCursor;
|
||||
s32 evenBaseDifference;
|
||||
s32 columnsRemaining;
|
||||
s32 evenBaseSum;
|
||||
s32 coefficient1;
|
||||
s32 coefficient2;
|
||||
s32 coefficient3;
|
||||
s32 coefficient4;
|
||||
s32 coefficient5;
|
||||
s32 coefficient6;
|
||||
s32 coefficient7;
|
||||
s32 v;
|
||||
s32 rowCoefficientCount;
|
||||
s32 processedCoefficients;
|
||||
s32 rowCount;
|
||||
s32 columnOddSumRotation;
|
||||
s32 rowOddOutput1;
|
||||
s32 columnC1;
|
||||
int rowAcBits;
|
||||
s32 columnEvenBaseDifference;
|
||||
s32 columnC7;
|
||||
s32 rowDc;
|
||||
s32 rowOddSumRotation;
|
||||
s32 rowEvenBaseSum;
|
||||
s32 columnOddDifferenceRotation;
|
||||
s32 columnEvenRotationSum;
|
||||
s32* dst;
|
||||
s32 columnOddOutput2;
|
||||
s32 sparseDc;
|
||||
s32 rowOddDifferenceRotation;
|
||||
s32 columnOddOutput1;
|
||||
s32 rowOddOutput2;
|
||||
s32 columnDc;
|
||||
s32 columnEvenBaseSum;
|
||||
s32* src;
|
||||
s32 rowOuter;
|
||||
s32 processed;
|
||||
s32 columnC6;
|
||||
s32 rowOdd;
|
||||
s32 column;
|
||||
s32 m;
|
||||
s32 n;
|
||||
s32 oddOutput1;
|
||||
s32 oddSumRotation;
|
||||
s32 oddOutput2;
|
||||
s32 evenOutput2;
|
||||
s32 u;
|
||||
s32 evenOutput0;
|
||||
s32 oddOutput3;
|
||||
s32 rotation45;
|
||||
s32 z;
|
||||
s32 oddSumDifference;
|
||||
s32 oddDifferenceSum;
|
||||
s32 oddHighRotation;
|
||||
s32 oddLowRotation;
|
||||
s32 evenOutput3;
|
||||
s32 columnOddOutput3;
|
||||
s32 rowSampleDc;
|
||||
s32 rowOddOutput0;
|
||||
s32 rowC3;
|
||||
s32 columnScaledEvenRotation;
|
||||
s32 rowRotation;
|
||||
s32 rowEvenOutput2;
|
||||
s32 rowC2;
|
||||
s32 rowEvenBaseDifference;
|
||||
s32 columnC5;
|
||||
s32 rowEvenRotationSum;
|
||||
s32 columnOddOutput0;
|
||||
s32 rowC1;
|
||||
int columnAcBits;
|
||||
s32 columnC4;
|
||||
s32 columnOddMix;
|
||||
s32 columnOddLowSum;
|
||||
s32 rowEvenOutput1;
|
||||
s32 rowLowRotation;
|
||||
s32 columnC3;
|
||||
s32 rowOddHighDifference;
|
||||
s32 rowC5;
|
||||
s32 columnEvenOutput0;
|
||||
s32 rowEvenOutput0;
|
||||
s32 rowOddMix;
|
||||
s32 rowEvenOutput3;
|
||||
s32 rowC4;
|
||||
s32 rowInner;
|
||||
s32 rowC6;
|
||||
s32 columnEvenOutput1;
|
||||
s32 rowScaledEvenRotation;
|
||||
s32 rowOddLowDifference;
|
||||
s32 rowC7;
|
||||
s32 rowOddOutput3;
|
||||
s32 columnEvenOutput3;
|
||||
s32 rowMid;
|
||||
s32 columnOddHighDifference;
|
||||
s32 columnEvenOutput2;
|
||||
s32 columnC2;
|
||||
s32 columnOddLowDifference;
|
||||
s32 columnOddHighSum;
|
||||
s32 rowOddHighSum;
|
||||
s32 rowOddLowSum;
|
||||
u8* columnOutput;
|
||||
s32 columnOddLowRotation;
|
||||
s32 rowEvenSum;
|
||||
s32 flatDc;
|
||||
s32 columnEvenRotation;
|
||||
s32 rowOddDifferenceSum;
|
||||
s32 rowOddSumDifference;
|
||||
s32 columnSample;
|
||||
s32 columnOddDifferenceSum;
|
||||
int columnEvenSum;
|
||||
s32 rowOddHighRotation;
|
||||
s32 workspace[64];
|
||||
s32 rowOddLowRotation;
|
||||
s32 rowSample;
|
||||
s32 rowEvenRotation;
|
||||
s32 columnOddHighRotation;
|
||||
s32 columnOddSumDifference;
|
||||
s32 rowMix;
|
||||
|
||||
if (zigzag == 0x11) {
|
||||
s32 sample;
|
||||
sample = clampS8(block[0] >> 11);
|
||||
memset(conv_row_ptr, (s8)sample, 0x40);
|
||||
flatDc = block[0];
|
||||
rowSample = clampS8(flatDc >> 11);
|
||||
memset(conv_row_ptr, (s8)rowSample, 64);
|
||||
return;
|
||||
}
|
||||
|
||||
rowCoefficientCount = (zigzag >> 4) * 8;
|
||||
if ((zigzag & 0xF) > 2) {
|
||||
goto fullRowTransform;
|
||||
}
|
||||
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
|
||||
s32 dcValue;
|
||||
s32 oddCoefficient;
|
||||
|
||||
oddCoefficient = block[1];
|
||||
dcValue = block[0];
|
||||
rotation45 = oddCoefficient * 0xB5 >> 8;
|
||||
v = oddCoefficient * 0x62 >> 8;
|
||||
u = v + rotation45;
|
||||
z = (oddCoefficient * 0x14E >> 8) - v;
|
||||
m = oddCoefficient + z;
|
||||
n = rotation45 + z;
|
||||
workspaceCursor[0] = dcValue + m;
|
||||
workspaceCursor[7] = dcValue - m;
|
||||
workspaceCursor[1] = dcValue + n;
|
||||
workspaceCursor[6] = dcValue - n;
|
||||
workspaceCursor[2] = dcValue + u;
|
||||
workspaceCursor[5] = dcValue - u;
|
||||
workspaceCursor[3] = dcValue + v;
|
||||
workspaceCursor[4] = dcValue - v;
|
||||
workspaceCursor += 8;
|
||||
block += 8;
|
||||
}
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
goto columnTransform;
|
||||
|
||||
fullRowTransform:
|
||||
workspaceCursor = workspace;
|
||||
processedCoefficients = 0;
|
||||
for (; processedCoefficients < rowCoefficientCount; processedCoefficients += 8) {
|
||||
u32 acBits;
|
||||
coefficient4 = block[4];
|
||||
coefficient6 = block[6];
|
||||
coefficient2 = block[2];
|
||||
coefficient1 = block[1];
|
||||
coefficient7 = block[7];
|
||||
coefficient5 = block[5];
|
||||
coefficient3 = block[3];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample;
|
||||
sample = block[0];
|
||||
workspaceCursor[7] = sample;
|
||||
workspaceCursor[6] = sample;
|
||||
workspaceCursor[5] = sample;
|
||||
workspaceCursor[4] = sample;
|
||||
workspaceCursor[3] = sample;
|
||||
workspaceCursor[2] = sample;
|
||||
workspaceCursor[1] = sample;
|
||||
workspaceCursor[0] = sample;
|
||||
rowCount = (zigzag >> 4) * 8;
|
||||
if ((zigzag & 0xF) <= 2) {
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowOdd = block[1];
|
||||
rowRotation = rowOdd * 0xB5 >> 8;
|
||||
rowLowRotation = rowOdd * 0x62 >> 8;
|
||||
sparseDc = block[0];
|
||||
rowMix = (rowOdd * 0x14E >> 8) - rowLowRotation;
|
||||
rowOuter = rowOdd + rowMix;
|
||||
dst[0] = sparseDc + rowOuter;
|
||||
rowInner = rowRotation + rowMix;
|
||||
dst[7] = sparseDc - rowOuter;
|
||||
dst[1] = sparseDc + rowInner;
|
||||
rowMid = rowLowRotation + rowRotation;
|
||||
dst[6] = sparseDc - rowInner;
|
||||
dst[2] = sparseDc + rowMid;
|
||||
dst[5] = sparseDc - rowMid;
|
||||
dst[3] = sparseDc + rowLowRotation;
|
||||
dst[4] = sparseDc - rowLowRotation;
|
||||
dst += 8;
|
||||
block += 8;
|
||||
}
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
} else {
|
||||
dst = workspace;
|
||||
for (processed = 0; processed < rowCount; processed += 8) {
|
||||
rowC4 = block[4];
|
||||
rowC6 = block[6];
|
||||
rowC2 = block[2];
|
||||
rowC1 = block[1];
|
||||
rowC7 = block[7];
|
||||
rowC5 = block[5];
|
||||
rowC3 = block[3];
|
||||
rowAcBits = rowC4 | rowC6;
|
||||
rowAcBits = rowC2 | rowAcBits;
|
||||
rowAcBits = rowC1 | rowAcBits;
|
||||
rowAcBits = rowC7 | rowAcBits;
|
||||
rowAcBits = rowC5 | rowAcBits;
|
||||
rowAcBits = rowC3 | rowAcBits;
|
||||
if (rowAcBits == 0) {
|
||||
rowSampleDc = block[0];
|
||||
dst[7] = rowSampleDc;
|
||||
dst[6] = rowSampleDc;
|
||||
dst[5] = rowSampleDc;
|
||||
dst[4] = rowSampleDc;
|
||||
dst[3] = rowSampleDc;
|
||||
dst[2] = rowSampleDc;
|
||||
dst[1] = rowSampleDc;
|
||||
dst[0] = rowSampleDc;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
rotation45 = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
u = coefficient6 + coefficient2;
|
||||
rotation45 = rotation45 * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = block[0];
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
u = rotation45 + u;
|
||||
v = evenBaseDifference + rotation45;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + u;
|
||||
evenOutput3 = evenBaseSum - u;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - rotation45;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
workspaceCursor[0] = evenOutput0 + n;
|
||||
oddLowRotation = oddLowDifference * 0x8B;
|
||||
workspaceCursor[7] = evenOutput0 - n;
|
||||
oddLowRotation >>= 8;
|
||||
workspaceCursor[1] = v + oddOutput1;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
workspaceCursor[6] = v - oddOutput1;
|
||||
workspaceCursor[2] = evenOutput2 + oddOutput2;
|
||||
workspaceCursor[5] = evenOutput2 - oddOutput2;
|
||||
workspaceCursor[3] = evenOutput3 + oddOutput3;
|
||||
workspaceCursor[4] = evenOutput3 - oddOutput3;
|
||||
rowDc = block[0];
|
||||
rowEvenRotation = rowC2 - rowC6;
|
||||
rowEvenSum = rowC2 + rowC6;
|
||||
rowEvenBaseSum = rowDc + rowC4;
|
||||
rowEvenBaseDifference = rowDc - rowC4;
|
||||
rowScaledEvenRotation = rowEvenRotation * 0xB5 >> 8;
|
||||
rowEvenRotationSum = rowScaledEvenRotation + rowEvenSum;
|
||||
rowEvenOutput0 = rowEvenBaseSum + rowEvenRotationSum;
|
||||
rowEvenOutput1 = rowEvenBaseDifference + rowScaledEvenRotation;
|
||||
rowEvenOutput2 = rowEvenBaseDifference - rowScaledEvenRotation;
|
||||
rowEvenOutput3 = rowEvenBaseSum - rowEvenRotationSum;
|
||||
rowOddHighSum = rowC1 + rowC7;
|
||||
rowOddHighDifference = rowC1 - rowC7;
|
||||
rowOddLowSum = rowC5 + rowC3;
|
||||
rowOddLowDifference = rowC5 - rowC3;
|
||||
rowOddSumDifference = rowOddHighSum - rowOddLowSum;
|
||||
rowOddDifferenceSum = rowOddLowDifference + rowOddHighDifference;
|
||||
rowOddSumRotation = rowOddSumDifference * 0xB5 >> 8;
|
||||
rowOddDifferenceRotation = rowOddDifferenceSum * 0x62 >> 8;
|
||||
rowOddHighRotation = rowOddHighDifference * 0x14E >> 8;
|
||||
rowOddLowRotation = rowOddLowDifference * 0x8B >> 8;
|
||||
rowOddMix = rowOddHighRotation - rowOddDifferenceRotation;
|
||||
rowOddLowSum += rowOddMix;
|
||||
rowOddOutput0 = rowOddHighSum + rowOddLowSum;
|
||||
rowOddOutput1 = rowOddSumRotation + rowOddMix;
|
||||
rowOddOutput3 = rowOddDifferenceRotation + rowOddLowRotation;
|
||||
rowOddOutput2 = rowOddOutput3 + rowOddSumRotation;
|
||||
dst[0] = rowEvenOutput0 + rowOddOutput0;
|
||||
dst[7] = rowEvenOutput0 - rowOddOutput0;
|
||||
dst[1] = rowEvenOutput1 + rowOddOutput1;
|
||||
dst[6] = rowEvenOutput1 - rowOddOutput1;
|
||||
dst[2] = rowEvenOutput2 + rowOddOutput2;
|
||||
dst[5] = rowEvenOutput2 - rowOddOutput2;
|
||||
dst[3] = rowEvenOutput3 + rowOddOutput3;
|
||||
dst[4] = rowEvenOutput3 - rowOddOutput3;
|
||||
}
|
||||
block += 8;
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
workspaceCursor = workspace + processedCoefficients;
|
||||
for (; processedCoefficients <= 0x38; processedCoefficients += 8) {
|
||||
memset(workspaceCursor, 0, 0x20);
|
||||
workspaceCursor += 8;
|
||||
}
|
||||
|
||||
columnTransform:
|
||||
|
||||
workspaceCursor = workspace + 7;
|
||||
for (columnsRemaining = 8, column = 7; columnsRemaining > 0; columnsRemaining--, column--) {
|
||||
u32 acBits;
|
||||
u8* output;
|
||||
coefficient4 = workspaceCursor[0x20];
|
||||
output = conv_row_ptr + column;
|
||||
coefficient6 = workspaceCursor[0x30];
|
||||
coefficient2 = workspaceCursor[0x10];
|
||||
coefficient1 = workspaceCursor[8];
|
||||
coefficient7 = workspaceCursor[0x38];
|
||||
coefficient5 = workspaceCursor[0x28];
|
||||
coefficient3 = workspaceCursor[0x18];
|
||||
|
||||
acBits = (u32)coefficient4;
|
||||
acBits |= (u32)coefficient6;
|
||||
acBits |= (u32)coefficient2;
|
||||
acBits |= (u32)coefficient1;
|
||||
acBits |= (u32)coefficient7;
|
||||
acBits |= (u32)coefficient5;
|
||||
acBits |= (u32)coefficient3;
|
||||
if (acBits == 0) {
|
||||
s32 sample;
|
||||
sample = clampS8(*workspaceCursor >> 11);
|
||||
output[56] = (u8)sample;
|
||||
output[48] = (u8)sample;
|
||||
output[40] = (u8)sample;
|
||||
output[32] = (u8)sample;
|
||||
output[24] = (u8)sample;
|
||||
output[16] = (u8)sample;
|
||||
output[8] = (u8)sample;
|
||||
output[0] = (u8)sample;
|
||||
} else {
|
||||
s32 oddLowSum;
|
||||
s32 oddLowDifference;
|
||||
s32 oddHighSum;
|
||||
s32 oddHighDifference;
|
||||
s32 dcValue;
|
||||
|
||||
rotation45 = coefficient2 - coefficient6;
|
||||
oddLowSum = coefficient5 + coefficient3;
|
||||
oddLowDifference = coefficient5 - coefficient3;
|
||||
oddHighSum = coefficient1 + coefficient7;
|
||||
oddHighDifference = coefficient1 - coefficient7;
|
||||
u = coefficient6 + coefficient2;
|
||||
rotation45 = rotation45 * 0xB5 >> 8;
|
||||
oddSumDifference = oddHighSum - oddLowSum;
|
||||
oddDifferenceSum = oddLowDifference + oddHighDifference;
|
||||
dcValue = *workspaceCursor;
|
||||
evenBaseDifference = dcValue - coefficient4;
|
||||
oddSumRotation = oddSumDifference * 0xB5 >> 8;
|
||||
evenBaseSum = dcValue + coefficient4;
|
||||
u = rotation45 + u;
|
||||
v = evenBaseDifference + rotation45;
|
||||
z = oddDifferenceSum * 0x62 >> 8;
|
||||
evenOutput0 = evenBaseSum + u;
|
||||
evenOutput3 = evenBaseSum - u;
|
||||
oddHighRotation = oddHighDifference * 0x14E >> 8;
|
||||
evenOutput2 = evenBaseDifference - rotation45;
|
||||
m = oddHighRotation - z;
|
||||
oddLowSum += m;
|
||||
n = oddHighSum + oddLowSum;
|
||||
oddOutput1 = oddSumRotation + m;
|
||||
oddLowRotation = oddLowDifference * 0x8B >> 8;
|
||||
oddOutput3 = z + oddLowRotation;
|
||||
oddOutput2 = oddOutput3 + oddSumRotation;
|
||||
output[0] = (u8)clampS8((evenOutput0 + n) >> 11);
|
||||
output[56] = (u8)clampS8((evenOutput0 - n) >> 11);
|
||||
output[8] = (u8)clampS8((v + oddOutput1) >> 11);
|
||||
output[48] = (u8)clampS8((v - oddOutput1) >> 11);
|
||||
output[16] = (u8)clampS8((evenOutput2 + oddOutput2) >> 11);
|
||||
output[40] = (u8)clampS8((evenOutput2 - oddOutput2) >> 11);
|
||||
output[24] = (u8)clampS8((evenOutput3 + oddOutput3) >> 11);
|
||||
output[32] = (u8)clampS8((evenOutput3 - oddOutput3) >> 11);
|
||||
dst += 8;
|
||||
}
|
||||
workspaceCursor--;
|
||||
dst = workspace + processed;
|
||||
for (; processed <= 56; processed += 8) {
|
||||
memset(dst, 0, 32);
|
||||
dst += 8;
|
||||
}
|
||||
}
|
||||
|
||||
src = workspace + 7;
|
||||
for (column = 7; column >= 0; column--) {
|
||||
columnC4 = src[32];
|
||||
columnOutput = conv_row_ptr + column;
|
||||
columnC6 = src[48];
|
||||
columnC2 = src[16];
|
||||
columnC1 = src[8];
|
||||
columnC7 = src[56];
|
||||
columnC5 = src[40];
|
||||
columnC3 = src[24];
|
||||
columnAcBits = columnC4 | columnC6;
|
||||
columnAcBits = columnC2 | columnAcBits;
|
||||
columnAcBits = columnC1 | columnAcBits;
|
||||
columnAcBits = columnC7 | columnAcBits;
|
||||
columnAcBits = columnC5 | columnAcBits;
|
||||
columnAcBits = columnC3 | columnAcBits;
|
||||
if (columnAcBits == 0) {
|
||||
columnSample = clampChromaDc(*src);
|
||||
columnOutput[56] = (u8)columnSample;
|
||||
columnOutput[48] = (u8)columnSample;
|
||||
columnOutput[40] = (u8)columnSample;
|
||||
columnOutput[32] = (u8)columnSample;
|
||||
columnOutput[24] = (u8)columnSample;
|
||||
columnOutput[16] = (u8)columnSample;
|
||||
columnOutput[8] = (u8)columnSample;
|
||||
columnOutput[0] = (u8)columnSample;
|
||||
} else {
|
||||
columnOddHighSum = columnC1 + columnC7;
|
||||
columnEvenRotation = columnC2 - columnC6;
|
||||
columnOddLowSum = columnC5 + columnC3;
|
||||
columnOddSumDifference = columnOddHighSum - columnOddLowSum;
|
||||
columnEvenSum = columnC6 + columnC2;
|
||||
columnOddLowDifference = columnC5 - columnC3;
|
||||
columnScaledEvenRotation = columnEvenRotation * 0xB5 >> 8;
|
||||
columnOddHighDifference = columnC1 - columnC7;
|
||||
columnDc = *src;
|
||||
columnEvenRotationSum = columnScaledEvenRotation + columnEvenSum;
|
||||
columnOddSumRotation = columnOddSumDifference * 0xB5 >> 8;
|
||||
columnOddDifferenceSum = columnOddLowDifference + columnOddHighDifference;
|
||||
columnOddDifferenceRotation = columnOddDifferenceSum * 0x62 >> 8;
|
||||
columnEvenBaseDifference = columnDc - columnC4;
|
||||
columnEvenBaseSum = columnDc + columnC4;
|
||||
columnOddHighRotation = columnOddHighDifference * 0x14E >> 8;
|
||||
columnOddMix = columnOddHighRotation - columnOddDifferenceRotation;
|
||||
columnEvenOutput3 = columnEvenBaseSum - columnEvenRotationSum;
|
||||
columnEvenOutput1 = columnEvenBaseDifference + columnScaledEvenRotation;
|
||||
columnEvenOutput2 = columnEvenBaseDifference - columnScaledEvenRotation;
|
||||
columnEvenOutput0 = columnEvenBaseSum + columnEvenRotationSum;
|
||||
columnOddLowRotation = columnOddLowDifference * 0x8B >> 8;
|
||||
columnOddOutput3 = columnOddDifferenceRotation + columnOddLowRotation;
|
||||
columnOddLowSum += columnOddMix;
|
||||
columnOddOutput1 = columnOddSumRotation + columnOddMix;
|
||||
columnOddOutput0 = columnOddHighSum + columnOddLowSum;
|
||||
columnOddOutput2 = columnOddOutput3 + columnOddSumRotation;
|
||||
columnOutput[0] = (u8)clampS8((columnEvenOutput0 + columnOddOutput0) >> 11);
|
||||
columnOutput[56] = (u8)clampS8((columnEvenOutput0 - columnOddOutput0) >> 11);
|
||||
columnOutput[8] = (u8)clampS8((columnEvenOutput1 + columnOddOutput1) >> 11);
|
||||
columnOutput[48] = (u8)clampS8((columnEvenOutput1 - columnOddOutput1) >> 11);
|
||||
columnOutput[16] = (u8)clampS8((columnEvenOutput2 + columnOddOutput2) >> 11);
|
||||
columnOutput[40] = (u8)clampS8((columnEvenOutput2 - columnOddOutput2) >> 11);
|
||||
columnOutput[24] = (u8)clampS8((columnEvenOutput3 + columnOddOutput3) >> 11);
|
||||
columnOutput[32] = (u8)clampS8((columnEvenOutput3 - columnOddOutput3) >> 11);
|
||||
}
|
||||
src--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ static void TMCJPEGDEC_converterYUV444toRGB565edge(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEGDEC_converterYUV400toRGB565(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEGDEC_converterYUV400toRGB565edge(TMCCJPEGDecWork*, s32, s32);
|
||||
|
||||
/* MWCC needs level 1 to preserve the shared conversion-buffer base. */
|
||||
#pragma push
|
||||
#pragma optimization_level 1
|
||||
s32 TMCJPEGDEC_set_converterRGB565(TMCCJPEGDecWork* work) {
|
||||
|
||||
@@ -14,6 +14,7 @@ static void TMCJPEGDEC_converterYUV444toRGBA8edge(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEGDEC_converterYUV400toRGBA8(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEGDEC_converterYUV400toRGBA8edge(TMCCJPEGDecWork*, s32, s32);
|
||||
|
||||
/* MWCC needs level 1 to preserve the shared conversion-buffer base. */
|
||||
#pragma push
|
||||
#pragma optimization_level 1
|
||||
s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
|
||||
@@ -188,122 +189,116 @@ s32 TMCJPEGDEC_set_converterRGBA8(TMCCJPEGDecWork* work) {
|
||||
|
||||
#pragma pop
|
||||
|
||||
/* MWCC needs the full-width alpha addition before the halfword stores. */
|
||||
static void TMCJPEGDEC_converterYUV411toRGBA8(TMCCJPEGDecWork* work, s32 x, s32 y) {
|
||||
u16* output;
|
||||
s32 tileRow;
|
||||
s32 secondGreen;
|
||||
s32 thirdGreen;
|
||||
s32 fourthBlue;
|
||||
s32 columnInTile;
|
||||
s32 secondColumnInTile;
|
||||
s32 thirdColumnInTile;
|
||||
s32 fourthColumnInTile;
|
||||
s32 red;
|
||||
s32 secondBlue;
|
||||
s32 thirdBlue;
|
||||
s32 fourthGreen;
|
||||
s32 green;
|
||||
s32 secondRed;
|
||||
s32 thirdRed;
|
||||
s32 fourthRed;
|
||||
u8* texture;
|
||||
u8* luminance;
|
||||
u8* cb;
|
||||
u8* cr;
|
||||
TMCCJPEGDecState* state;
|
||||
u8* texture;
|
||||
s32 height;
|
||||
s32 column;
|
||||
s32 xEnd;
|
||||
s32 green;
|
||||
s32 yEnd;
|
||||
s32 tileWidth;
|
||||
s32 blueOffset;
|
||||
s32 greenOffset;
|
||||
s32 tileRow;
|
||||
s32 lumaSkip;
|
||||
s8 crValue;
|
||||
s32 chromaSkip;
|
||||
s32 width;
|
||||
s32 cbValue;
|
||||
u8 value;
|
||||
s32 row;
|
||||
u16* output;
|
||||
s32 redOffset;
|
||||
s32 greenOffset;
|
||||
s32 blueOffset;
|
||||
s32 blue;
|
||||
s32 value;
|
||||
TMCCJPEGDecState* state;
|
||||
s32 width;
|
||||
s32 height;
|
||||
s8 crValue;
|
||||
s32 cbValue;
|
||||
|
||||
luminance = work->convBuf + 4;
|
||||
cb = work->convBuf + 260;
|
||||
cr = work->convBuf + 324;
|
||||
cb = &work->convBuf[260];
|
||||
cr = &work->convBuf[324];
|
||||
state = work->pState;
|
||||
tileWidth = (state->convWidth >> 2) << 1;
|
||||
texture = state->pTexBuffer;
|
||||
|
||||
width = 32 / state->scaleFactor;
|
||||
height = 8 / state->scaleFactor;
|
||||
{
|
||||
yEnd = y + height;
|
||||
xEnd = x + width;
|
||||
lumaSkip = 32 - width;
|
||||
chromaSkip = lumaSkip >> 2;
|
||||
for (row = y; row < yEnd; row++) {
|
||||
output = (u16*)(texture + ((row & 3) << 3));
|
||||
tileRow = (row >> 2) * tileWidth;
|
||||
|
||||
for (column = x; column < xEnd; column += 4) {
|
||||
|
||||
{
|
||||
cbValue = (s8)*cb++;
|
||||
crValue = (s8)*cr++;
|
||||
redOffset = (crValue * 359) >> 8;
|
||||
greenOffset = -(crValue * 183 + cbValue * 88) >> 8;
|
||||
blueOffset = (cbValue * 454) >> 8;
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column & 3) + (((((column) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column & 3) + (((((column) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 1 & 3) + (((((column + 1) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 2 & 3) + (((((column + 2) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
{
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
red = (u8)red + 0x10000 - 0x100;
|
||||
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = red;
|
||||
output[(column + 3 & 3) + (((((column + 3) >> 2) << 1) + tileRow + 1) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
}
|
||||
|
||||
xEnd = x + width;
|
||||
yEnd = y + height;
|
||||
for (; y < yEnd; y++) {
|
||||
for (column = x; column < xEnd; column += 4) {
|
||||
cbValue = (s8)*cb++;
|
||||
crValue = (s8)*cr++;
|
||||
redOffset = (crValue * 359) >> 8;
|
||||
greenOffset = -(cbValue * 88 + crValue * 183) >> 8;
|
||||
blueOffset = (cbValue * 454) >> 8;
|
||||
value = *luminance++;
|
||||
green = value + greenOffset;
|
||||
red = value + redOffset;
|
||||
blue = value + blueOffset;
|
||||
if ((red | green | blue) >> 8) {
|
||||
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
|
||||
green = green > 255 ? 255 : green < 0 ? 0 : green;
|
||||
red = red > 255 ? 255 : red < 0 ? 0 : red;
|
||||
}
|
||||
luminance += lumaSkip;
|
||||
cb += chromaSkip;
|
||||
cr += chromaSkip;
|
||||
columnInTile = column & 3;
|
||||
/* MWCC needs these assignments in the first store to preserve row-address scheduling. */
|
||||
(output = (u16*)(texture + ((y & 3) << 3)))[
|
||||
columnInTile + ((((column >> 2) << 1) +
|
||||
(tileRow = (y >> 2) * tileWidth)) << 4)] = (u8)red + 0x10000 - 0x100;
|
||||
output[columnInTile + ((((column >> 2) << 1) + (tileRow + 1)) << 4)] = ((green & 255) << 8) + (blue & 255);
|
||||
value = *luminance++;
|
||||
secondGreen = value + greenOffset;
|
||||
secondRed = value + redOffset;
|
||||
secondBlue = value + blueOffset;
|
||||
if ((secondRed | secondGreen | secondBlue) >> 8) {
|
||||
secondBlue = secondBlue > 255 ? 255 : secondBlue < 0 ? 0 : secondBlue;
|
||||
secondGreen = secondGreen > 255 ? 255 : secondGreen < 0 ? 0 : secondGreen;
|
||||
secondRed = secondRed > 255 ? 255 : secondRed < 0 ? 0 : secondRed;
|
||||
}
|
||||
secondColumnInTile = (column + 1) & 3;
|
||||
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + tileRow) << 4)] = (u8)secondRed + 0x10000 - 0x100;
|
||||
output[secondColumnInTile + (((((column + 1) >> 2) << 1) + (tileRow + 1)) << 4)] = ((secondGreen & 255) << 8) + (secondBlue & 255);
|
||||
value = *luminance++;
|
||||
thirdGreen = value + greenOffset;
|
||||
thirdRed = value + redOffset;
|
||||
thirdBlue = value + blueOffset;
|
||||
if ((thirdRed | thirdGreen | thirdBlue) >> 8) {
|
||||
thirdBlue = thirdBlue > 255 ? 255 : thirdBlue < 0 ? 0 : thirdBlue;
|
||||
thirdGreen = thirdGreen > 255 ? 255 : thirdGreen < 0 ? 0 : thirdGreen;
|
||||
thirdRed = thirdRed > 255 ? 255 : thirdRed < 0 ? 0 : thirdRed;
|
||||
}
|
||||
thirdColumnInTile = (column + 2) & 3;
|
||||
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + tileRow) << 4)] = (u8)thirdRed + 0x10000 - 0x100;
|
||||
output[thirdColumnInTile + (((((column + 2) >> 2) << 1) + (tileRow + 1)) << 4)] = ((thirdGreen & 255) << 8) + (thirdBlue & 255);
|
||||
value = *luminance++;
|
||||
fourthGreen = value + greenOffset;
|
||||
fourthRed = value + redOffset;
|
||||
fourthBlue = value + blueOffset;
|
||||
if ((fourthRed | fourthGreen | fourthBlue) >> 8) {
|
||||
fourthBlue = fourthBlue > 255 ? 255 : fourthBlue < 0 ? 0 : fourthBlue;
|
||||
fourthGreen = fourthGreen > 255 ? 255 : fourthGreen < 0 ? 0 : fourthGreen;
|
||||
fourthRed = fourthRed > 255 ? 255 : fourthRed < 0 ? 0 : fourthRed;
|
||||
}
|
||||
fourthColumnInTile = (column + 3) & 3;
|
||||
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + tileRow) << 4)] = (u8)fourthRed + 0x10000 - 0x100;
|
||||
output[fourthColumnInTile + (((((column + 3) >> 2) << 1) + (tileRow + 1)) << 4)] = ((fourthGreen & 255) << 8) + (fourthBlue & 255);
|
||||
}
|
||||
luminance += (32 - width);
|
||||
cb += ((32 - width) >> 2);
|
||||
cr += ((32 - width) >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ static void TMCJPEG_814F32E4(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F34A4(TMCCJPEGDecWork*, s32, s32);
|
||||
static void TMCJPEG_814F372C(TMCCJPEGDecWork*, s32, s32);
|
||||
|
||||
/* MWCC needs level 1 to preserve the shared conversion-buffer base. */
|
||||
#pragma push
|
||||
#pragma optimization_level 1
|
||||
s32 TMCJPEGDEC_set_converterY8U8V8(TMCCJPEGDecWork* work) {
|
||||
|
||||
@@ -113,18 +113,16 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
|
||||
ziU16 matchCode;
|
||||
ziU8* data;
|
||||
ziU8 value;
|
||||
struct {
|
||||
ziU8 remaining;
|
||||
ziU8 dataIndex;
|
||||
ziU16 targetCode;
|
||||
} state;
|
||||
ziU16 targetCode;
|
||||
ziU8 dataIndex;
|
||||
ziU8 remaining;
|
||||
|
||||
if (match->componentIndex != 0) {
|
||||
state.targetCode = match->componentIndex;
|
||||
targetCode = match->componentIndex;
|
||||
matchCode = ((ziU16)(nodeAddress[4] & 3) << 8) | nodeAddress[5];
|
||||
value = 0;
|
||||
while (value++ < 6) {
|
||||
if (state.targetCode == matchCode) {
|
||||
if (targetCode == matchCode) {
|
||||
break;
|
||||
}
|
||||
matchCode = ((ziU16)(*(dictionaryAddress + matchCode * 8 + 6) & 3) << 8) | *(dictionaryAddress + matchCode * 8 + 7);
|
||||
@@ -132,7 +130,7 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state.targetCode != matchCode) {
|
||||
if (targetCode != matchCode) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -206,9 +204,9 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
|
||||
}
|
||||
}
|
||||
|
||||
state.dataIndex = 4;
|
||||
state.remaining = ((match->length + 1) >> 1) - 4;
|
||||
if ((value + 1) < state.remaining) {
|
||||
dataIndex = 4;
|
||||
remaining = ((match->length + 1) >> 1) - 4;
|
||||
if ((value + 1) < remaining) {
|
||||
return 0;
|
||||
}
|
||||
if ((match->length & 1) != 0) {
|
||||
@@ -221,12 +219,12 @@ ziU32 Zi8SecMatchChar(ziU8* nodeAddress, ziU8* dictionaryAddress, ziMatchParam*
|
||||
}
|
||||
}
|
||||
if (match->count == 0) {
|
||||
while (state.remaining != 0) {
|
||||
if ((data[0] & match->recordMasks[state.dataIndex]) != match->recordValues[state.dataIndex]) {
|
||||
while (remaining != 0) {
|
||||
if ((data[0] & match->recordMasks[dataIndex]) != match->recordValues[dataIndex]) {
|
||||
return 0;
|
||||
}
|
||||
state.dataIndex++;
|
||||
state.remaining--;
|
||||
dataIndex++;
|
||||
remaining--;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
@@ -290,17 +288,15 @@ extern ziU16 Zi8MatchAltSound(ziPtr soundTable, ziU16 soundCode, ziPtr pCodeTabl
|
||||
ziU16 Zi8GetPCode(ziU8* table, ziU8* node);
|
||||
|
||||
ziBool Zi8MatchPhonetic(ziU8* pCodeTable, ziU8* dictionary, ziPtr soundTable, ziU16 soundCode, ziU32 tableAddress, ziU8* node, ziU16* masks, ziU16* values, ziU16* count, ziU8** resultNode, ziU8** stringOffset, ziU8 partialMode, ziU8 strictMode, ziU8 numParts, ziU16 partMask, ziU16 partValue, ziU8 flag, ziU8 altMode, ziU16 initialCode, ziU16* resultCode, ziU8 lastMode ZI_NEED_WORK) {
|
||||
struct {
|
||||
ziBool hasString;
|
||||
ziU8 partIndex;
|
||||
ziU8 partCount;
|
||||
ziU8 nextCode;
|
||||
ziU8 matchedParts;
|
||||
ziU16 dictionaryIndex;
|
||||
ziU16 soundIndex;
|
||||
ziU16 remaining;
|
||||
ziU16 code;
|
||||
} traversal;
|
||||
ziU16 code;
|
||||
ziU16 remaining;
|
||||
ziU16 soundIndex;
|
||||
ziU16 dictionaryIndex;
|
||||
ziU8 matchedParts;
|
||||
ziU8 nextCode;
|
||||
ziU8 partCount;
|
||||
ziU8 partIndex;
|
||||
ziBool hasString;
|
||||
ziU8* sound;
|
||||
typedef struct {
|
||||
ziU8 header;
|
||||
@@ -308,42 +304,42 @@ ziBool Zi8MatchPhonetic(ziU8* pCodeTable, ziU8* dictionary, ziPtr soundTable, zi
|
||||
} DictionaryNode;
|
||||
|
||||
if (*stringOffset != 0) {
|
||||
traversal.hasString = 1;
|
||||
hasString = 1;
|
||||
} else {
|
||||
traversal.hasString = 0;
|
||||
hasString = 0;
|
||||
}
|
||||
if (*count != 0) {
|
||||
traversal.remaining = *count;
|
||||
remaining = *count;
|
||||
} else {
|
||||
traversal.remaining = 1;
|
||||
remaining = 1;
|
||||
}
|
||||
traversal.matchedParts = 0;
|
||||
matchedParts = 0;
|
||||
if ((lastMode != 0) && (numParts > 1)) {
|
||||
altMode = 1;
|
||||
}
|
||||
while (traversal.remaining-- != 0) {
|
||||
while (remaining-- != 0) {
|
||||
if ((node[0] & flag) != 0) goto decode_node;
|
||||
next_node:
|
||||
node += 0xC;
|
||||
continue;
|
||||
decode_node:
|
||||
traversal.code = Zi8GetPCode(pCodeTable, node);
|
||||
if ((*values != (traversal.code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
|
||||
code = Zi8GetPCode(pCodeTable, node);
|
||||
if ((*values != (code & *masks)) && (altMode == 0) && ((node[0] & 0x80) != 0)) {
|
||||
if (*count != 0) {
|
||||
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
|
||||
soundIndex = (initialCode - remaining) - 1;
|
||||
} else {
|
||||
traversal.soundIndex = initialCode;
|
||||
soundIndex = initialCode;
|
||||
}
|
||||
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.soundIndex, *masks, *values, flag, ZI_WORK);
|
||||
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, soundIndex, *masks, *values, flag, ZI_WORK);
|
||||
}
|
||||
goto check_code;
|
||||
match_code:
|
||||
if (partValue == (traversal.code & partMask)) goto next_node;
|
||||
traversal.matchedParts = 1;
|
||||
if (partValue == (code & partMask)) goto next_node;
|
||||
matchedParts = 1;
|
||||
if (*count != 0) {
|
||||
traversal.soundIndex = (initialCode - traversal.remaining) - 1;
|
||||
soundIndex = (initialCode - remaining) - 1;
|
||||
} else {
|
||||
traversal.soundIndex = initialCode;
|
||||
soundIndex = initialCode;
|
||||
}
|
||||
sound = (ziU8*)(tableAddress + ((node[9] & 0xF) * 0x10000 + (node[0xB] + node[0xA] * 0x100)));
|
||||
if (ZI_WORK->cangjieEnabled != 0) {
|
||||
@@ -368,46 +364,46 @@ match_code:
|
||||
} else if (numParts > 1) {
|
||||
goto next_node;
|
||||
}
|
||||
if (((ziU8)traversal.matchedParts == numParts) || (numParts == 0)) {
|
||||
if (((ziU8)matchedParts == numParts) || (numParts == 0)) {
|
||||
*resultNode = node;
|
||||
*resultCode = ((ziU16)node[6] << 8) + node[7];
|
||||
*count = traversal.remaining;
|
||||
*count = remaining;
|
||||
return 1;
|
||||
}
|
||||
next_group:
|
||||
{
|
||||
traversal.nextCode = *sound++;
|
||||
traversal.partCount = traversal.nextCode & 0xF;
|
||||
if ((traversal.nextCode & flag) == 0) {
|
||||
for (; traversal.partCount != 0; traversal.partCount--) {
|
||||
nextCode = *sound++;
|
||||
partCount = nextCode & 0xF;
|
||||
if ((nextCode & flag) == 0) {
|
||||
for (; partCount != 0; partCount--) {
|
||||
for (sound++; (*sound & 0x80) == 0; sound += 2) {
|
||||
}
|
||||
sound++;
|
||||
}
|
||||
}
|
||||
for (; traversal.partCount != 0; traversal.partCount--) {
|
||||
traversal.partIndex = 1;
|
||||
if (traversal.hasString && (sound > *stringOffset)) {
|
||||
traversal.hasString = 0;
|
||||
for (; partCount != 0; partCount--) {
|
||||
partIndex = 1;
|
||||
if (hasString && (sound > *stringOffset)) {
|
||||
hasString = 0;
|
||||
}
|
||||
if (!traversal.hasString) {
|
||||
if (!hasString) {
|
||||
*stringOffset = sound;
|
||||
}
|
||||
do {
|
||||
traversal.dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
|
||||
dictionaryIndex = sound[0] | ((ziU16)sound[1] << 8);
|
||||
sound += 2;
|
||||
if (traversal.hasString) {
|
||||
if (hasString) {
|
||||
goto phonetic_skip;
|
||||
}
|
||||
traversal.code = Zi8GetPCode(pCodeTable, dictionary + (traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
|
||||
if (((traversal.code & masks[traversal.partIndex]) != values[traversal.partIndex]) && (altMode == 0) && (dictionary[(traversal.dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
|
||||
traversal.code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, traversal.dictionaryIndex & 0x7FFF, masks[traversal.partIndex], values[traversal.partIndex], flag, ZI_WORK);
|
||||
code = Zi8GetPCode(pCodeTable, dictionary + (dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode));
|
||||
if (((code & masks[partIndex]) != values[partIndex]) && (altMode == 0) && (dictionary[(dictionaryIndex & 0x7FFF) * sizeof(DictionaryNode)] & 0x80) != 0) {
|
||||
code = Zi8MatchAltSound(soundTable, soundCode, pCodeTable, dictionaryIndex & 0x7FFF, masks[partIndex], values[partIndex], flag, ZI_WORK);
|
||||
}
|
||||
if ((traversal.code & masks[traversal.partIndex]) == values[traversal.partIndex]) {
|
||||
if ((code & masks[partIndex]) == values[partIndex]) {
|
||||
goto phonetic_matched;
|
||||
}
|
||||
phonetic_skip:
|
||||
if ((traversal.dictionaryIndex & 0x8000) == 0) {
|
||||
if ((dictionaryIndex & 0x8000) == 0) {
|
||||
sound++;
|
||||
while ((*sound & 0x80) == 0) {
|
||||
sound += 2;
|
||||
@@ -416,23 +412,23 @@ phonetic_skip:
|
||||
}
|
||||
break;
|
||||
phonetic_matched:
|
||||
if (++traversal.partIndex == numParts) {
|
||||
if (++partIndex == numParts) {
|
||||
if (partialMode != 0) {
|
||||
if (strictMode == 0 && (traversal.dictionaryIndex & 0x8000) != 0) goto phonetic_skip;
|
||||
if (strictMode != 0 && (traversal.dictionaryIndex & 0x8000) == 0) goto phonetic_skip;
|
||||
if (strictMode == 0 && (dictionaryIndex & 0x8000) != 0) goto phonetic_skip;
|
||||
if (strictMode != 0 && (dictionaryIndex & 0x8000) == 0) goto phonetic_skip;
|
||||
}
|
||||
*resultNode = node;
|
||||
*resultCode = ((ziU16)node[6] << 8) + node[7];
|
||||
*count = traversal.remaining;
|
||||
*count = remaining;
|
||||
return 1;
|
||||
}
|
||||
} while ((traversal.dictionaryIndex & 0x8000) == 0);
|
||||
} while ((dictionaryIndex & 0x8000) == 0);
|
||||
}
|
||||
}
|
||||
if ((traversal.nextCode & 0x80) != 0) goto next_node;
|
||||
if ((nextCode & 0x80) != 0) goto next_node;
|
||||
goto next_group;
|
||||
check_code:
|
||||
if (*values == (traversal.code & *masks)) goto match_code;
|
||||
if (*values == (code & *masks)) goto match_code;
|
||||
goto next_node;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -57,6 +57,7 @@ ziU8 ZADP_Zi8SetPDremoveOpt(ziU8 option, struct __zi8_work_data_s* __zi8_work_da
|
||||
return previous;
|
||||
}
|
||||
ziU8 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar* output, ziU16 capacity, ziWChar* spelling, ziU16 spellingCapacity, ziU8 complete, ziU8 continuation ZI_NEED_WORK) {
|
||||
// MWCC needs this aggregate to retain the unread workspace store at SP+0x24.
|
||||
struct {
|
||||
int fallback;
|
||||
ziPtr workspace;
|
||||
|
||||
@@ -27,31 +27,29 @@ ziU8 Zi8MatchKoreanSequence(ziU16* resultIndex, ziU16* input, ziU8 type, ziU16 c
|
||||
|
||||
ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
|
||||
struct __zi8_work_data_s* workData) {
|
||||
struct {
|
||||
ziU8 characterIndex;
|
||||
ziU8 matched;
|
||||
ziU8 elementIndex;
|
||||
ziU16 index;
|
||||
ziU16 currentCandidate;
|
||||
ziU16 inputIndex;
|
||||
ziU16 nextIndex;
|
||||
ziU16 tableCount31;
|
||||
ziU16 tableCount6;
|
||||
ziU16 tableCount3;
|
||||
ziU16 tableCount0;
|
||||
ziU8* table31;
|
||||
ziU8* table2;
|
||||
ziU8* table1;
|
||||
} state;
|
||||
ziU8* table1;
|
||||
ziU8* table2;
|
||||
ziU8* table31;
|
||||
ziU16 tableCount0;
|
||||
ziU16 tableCount3;
|
||||
ziU16 tableCount6;
|
||||
ziU16 tableCount31;
|
||||
ziU16 nextIndex;
|
||||
ziU16 inputIndex;
|
||||
ziU16 currentCandidate;
|
||||
ziU16 index;
|
||||
ziU8 elementIndex;
|
||||
ziU8 matched;
|
||||
ziU8 characterIndex;
|
||||
ziU16 buffer[100];
|
||||
ziU8 result;
|
||||
ziU16 currentCharacter;
|
||||
ziU8* selectedTable;
|
||||
|
||||
state.nextIndex = 0;
|
||||
nextIndex = 0;
|
||||
result = 0;
|
||||
state.characterIndex = 0xFF;
|
||||
state.currentCandidate = params->firstCandidate;
|
||||
characterIndex = 0xFF;
|
||||
currentCandidate = params->firstCandidate;
|
||||
params->letters = params->completion = params->count = 0;
|
||||
if ((argument != 0) && (*argument != 0)) {
|
||||
Zi8LogError(0x7D0, workData);
|
||||
@@ -63,31 +61,31 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
|
||||
}
|
||||
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 4, workData);
|
||||
state.table1 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 1, workData);
|
||||
state.table2 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 2, workData);
|
||||
state.table31 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x31, workData);
|
||||
state.tableCount0 = Zi8GetTableCount(ZI8_LANG_KO, 0, workData);
|
||||
state.tableCount3 = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
|
||||
state.tableCount6 = Zi8GetTableCount(ZI8_LANG_KO, 6, workData);
|
||||
state.tableCount31 = Zi8GetTableCount(ZI8_LANG_KO, 0x31, workData);
|
||||
table1 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 1, workData);
|
||||
table2 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 2, workData);
|
||||
table31 = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x31, workData);
|
||||
tableCount0 = Zi8GetTableCount(ZI8_LANG_KO, 0, workData);
|
||||
tableCount3 = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
|
||||
tableCount6 = Zi8GetTableCount(ZI8_LANG_KO, 6, workData);
|
||||
tableCount31 = Zi8GetTableCount(ZI8_LANG_KO, 0x31, workData);
|
||||
|
||||
for (state.elementIndex = 0; state.elementIndex < params->elementCount;
|
||||
state.elementIndex++) {
|
||||
currentCharacter = params->elements[state.elementIndex];
|
||||
for (elementIndex = 0; elementIndex < params->elementCount;
|
||||
elementIndex++) {
|
||||
currentCharacter = params->elements[elementIndex];
|
||||
|
||||
if ((currentCharacter >= 0x61) && (currentCharacter <= 0x7A)) {
|
||||
buffer[state.elementIndex] = state.table1[(currentCharacter - 0x61) * 2];
|
||||
buffer[elementIndex] = table1[(currentCharacter - 0x61) * 2];
|
||||
} else if ((currentCharacter >= 0x41) && (currentCharacter <= 0x5A)) {
|
||||
buffer[state.elementIndex] = (state.table1 + (currentCharacter - 0x41) * 2)[1];
|
||||
buffer[elementIndex] = (table1 + (currentCharacter - 0x41) * 2)[1];
|
||||
} else {
|
||||
state.matched = 0;
|
||||
for (; state.table2[state.matched * 3] != 0; state.matched++) {
|
||||
if (currentCharacter == state.table2[state.matched * 3]) break;
|
||||
matched = 0;
|
||||
for (; table2[matched * 3] != 0; matched++) {
|
||||
if (currentCharacter == table2[matched * 3]) break;
|
||||
}
|
||||
if (state.table2[state.matched * 3] != 0) {
|
||||
buffer[state.elementIndex] =
|
||||
((ziU16)(state.table2 + state.matched * 3)[1] << 8) |
|
||||
(state.table2 + state.matched * 3)[2];
|
||||
if (table2[matched * 3] != 0) {
|
||||
buffer[elementIndex] =
|
||||
((ziU16)(table2 + matched * 3)[1] << 8) |
|
||||
(table2 + matched * 3)[2];
|
||||
} else {
|
||||
Zi8LogError(0x161, workData);
|
||||
return 0;
|
||||
@@ -96,16 +94,16 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
|
||||
}
|
||||
|
||||
result = 0;
|
||||
for (currentCharacter = 0; currentCharacter < state.elementIndex; currentCharacter++) {
|
||||
if (Zi8LookupKoreanChar(buffer[currentCharacter], &state.characterIndex,
|
||||
&state.inputIndex, workData) != 0) {
|
||||
state.matched = Zi8MatchKoreanSequence(&state.nextIndex,
|
||||
for (currentCharacter = 0; currentCharacter < elementIndex; currentCharacter++) {
|
||||
if (Zi8LookupKoreanChar(buffer[currentCharacter], &characterIndex,
|
||||
&inputIndex, workData) != 0) {
|
||||
matched = Zi8MatchKoreanSequence(&nextIndex,
|
||||
buffer + currentCharacter + 1,
|
||||
state.characterIndex,
|
||||
(state.elementIndex - currentCharacter) - 1,
|
||||
characterIndex,
|
||||
(elementIndex - currentCharacter) - 1,
|
||||
workData);
|
||||
if (workData->koAltTables == 1) {
|
||||
switch (state.characterIndex) {
|
||||
switch (characterIndex) {
|
||||
case 1:
|
||||
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1E, workData);
|
||||
break;
|
||||
@@ -168,59 +166,59 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
state.matched = 0;
|
||||
matched = 0;
|
||||
}
|
||||
if (state.matched != 0) {
|
||||
if (state.tableCount6 == 0) {
|
||||
state.nextIndex += state.inputIndex * state.tableCount3;
|
||||
if (matched != 0) {
|
||||
if (tableCount6 == 0) {
|
||||
nextIndex += inputIndex * tableCount3;
|
||||
}
|
||||
if (state.currentCandidate != 0) {
|
||||
state.currentCandidate--;
|
||||
if (currentCandidate != 0) {
|
||||
currentCandidate--;
|
||||
} else {
|
||||
params->candidates[result] =
|
||||
((ziU16)selectedTable[state.nextIndex * 2] << 8) | (selectedTable + state.nextIndex * 2)[1];
|
||||
if ((state.tableCount6 != 0) && (workData->koAltTables == 0)) {
|
||||
params->candidates[result] += state.inputIndex * state.tableCount3;
|
||||
((ziU16)selectedTable[nextIndex * 2] << 8) | (selectedTable + nextIndex * 2)[1];
|
||||
if ((tableCount6 != 0) && (workData->koAltTables == 0)) {
|
||||
params->candidates[result] += inputIndex * tableCount3;
|
||||
}
|
||||
result++;
|
||||
}
|
||||
if (currentCharacter == 0) {
|
||||
params->completion = state.matched + 1;
|
||||
params->completion = matched + 1;
|
||||
}
|
||||
currentCharacter += state.matched;
|
||||
currentCharacter += matched;
|
||||
} else {
|
||||
if (state.currentCandidate != 0) {
|
||||
state.index = 0;
|
||||
for (; state.index < state.tableCount31; state.index++) {
|
||||
if (state.table31[state.index * 3] == buffer[currentCharacter] &&
|
||||
(state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1]) break;
|
||||
if (currentCandidate != 0) {
|
||||
index = 0;
|
||||
for (; index < tableCount31; index++) {
|
||||
if (table31[index * 3] == buffer[currentCharacter] &&
|
||||
(table31 + index * 3)[1] == buffer[currentCharacter + 1]) break;
|
||||
}
|
||||
if (state.index == state.tableCount31) {
|
||||
state.currentCandidate--;
|
||||
if (index == tableCount31) {
|
||||
currentCandidate--;
|
||||
}
|
||||
if (currentCharacter == 0) {
|
||||
params->completion = 1;
|
||||
}
|
||||
} else {
|
||||
for (state.index = 0; state.index < state.tableCount31; state.index++) {
|
||||
if ((state.table31[(state.index * 3)] == buffer[currentCharacter]) &&
|
||||
((state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1])) {
|
||||
for (index = 0; index < tableCount31; index++) {
|
||||
if ((table31[(index * 3)] == buffer[currentCharacter]) &&
|
||||
((table31 + index * 3)[1] == buffer[currentCharacter + 1])) {
|
||||
if (currentCharacter == 0) {
|
||||
params->completion = 1;
|
||||
}
|
||||
params->candidates[result] =
|
||||
state.tableCount0 + (state.table31 + state.index * 3)[2];
|
||||
tableCount0 + (table31 + index * 3)[2];
|
||||
result++;
|
||||
currentCharacter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state.index == state.tableCount31) {
|
||||
if (index == tableCount31) {
|
||||
if ((params->candidates[result] = buffer[currentCharacter]) < 0xFF) {
|
||||
if (currentCharacter == 0) {
|
||||
params->completion = 1;
|
||||
}
|
||||
params->candidates[result] += state.tableCount0;
|
||||
params->candidates[result] += tableCount0;
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ struct DVDCommandBlock {
|
||||
DVDCommandBlock* prev; // 0x04
|
||||
|
||||
u32 command; // 0x08
|
||||
volatile s32 state;
|
||||
// MWCC needs plain state stores; asynchronous readers use volatile views.
|
||||
s32 state; // 0x0C
|
||||
|
||||
u32 offset; // 0x10
|
||||
u32 length; // 0x14
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef GXTlutRegion* (*GXTlutRegionCallback)(u32 idx);
|
||||
|
||||
u32 GXGetTexBufferSize(u16 width, u16 height, u32 format, u8 mipmap, u8 max_lod);
|
||||
|
||||
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
u8 mipmap);
|
||||
void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, u8 mipmap,
|
||||
u32 tlut_name);
|
||||
|
||||
@@ -121,6 +121,7 @@ void defaultOptionalCommandChecker(DVDCommandBlock* block, DVDLowCallback callba
|
||||
|
||||
extern DVDErrorInfo __ErrorInfo;
|
||||
|
||||
// MWCC must reload the interrupt-shared flags and counters below.
|
||||
static vu32 CommandInfoCounter = 0;
|
||||
|
||||
static vBOOL PauseFlag = FALSE;
|
||||
@@ -1889,12 +1890,13 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
BOOL enabled;
|
||||
s32 retVal;
|
||||
DVDCommandBlock* next;
|
||||
const volatile DVDCommandBlock* statusBlock = block;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
if (block->state == DVD_STATE_COVER_CLOSED) {
|
||||
if (statusBlock->state == DVD_STATE_COVER_CLOSED) {
|
||||
retVal = DVD_STATE_BUSY;
|
||||
} else if (block->state == DVD_STATE_COVER_OPENED) {
|
||||
} else if (statusBlock->state == DVD_STATE_COVER_OPENED) {
|
||||
retVal = DVD_STATE_NO_DISK;
|
||||
} else if (executing == &__DVDStopMotorCommandBlock) {
|
||||
next = __DVDGetNextWaitingQueue();
|
||||
@@ -1902,17 +1904,17 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
if (block == next) {
|
||||
retVal = DVD_STATE_BUSY;
|
||||
} else {
|
||||
retVal = block->state;
|
||||
retVal = statusBlock->state;
|
||||
}
|
||||
} else {
|
||||
if (block == &__DVDStopMotorCommandBlock) {
|
||||
retVal = DVD_STATE_IDLE;
|
||||
} else {
|
||||
retVal = block->state;
|
||||
retVal = statusBlock->state;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
retVal = block->state;
|
||||
retVal = statusBlock->state;
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
@@ -136,6 +136,7 @@ typedef union PFD_SDDRV_U16_BYTES {
|
||||
u8 bytes[2];
|
||||
} PFD_SDDRV_U16_BYTES;
|
||||
|
||||
/* MWCC needs buffer-relative word stores to preserve boot-sector address calculations. */
|
||||
#define pfd_sddrv_store_le16(buffer, field, offset, value) \
|
||||
do { \
|
||||
if (((u32)(field) & 1) != 0) { \
|
||||
@@ -292,8 +293,6 @@ s32 pfd_st_removal_callback(s32 status, void* data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
s32 pfd_sddrv_init(FADisk* disk) {
|
||||
s32 sd_result;
|
||||
SDDev* device;
|
||||
@@ -311,7 +310,7 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
} else {
|
||||
if ((g_pfd_sddrv_info.flags & 4) == 0) {
|
||||
g_pfd_sddrv_info.bytes_per_sector = 0x200;
|
||||
pf_memset(&g_pfd_sddev, 0, 0x28);
|
||||
pf_memset(&g_pfd_sddev, 0, sizeof(g_pfd_sddev.device));
|
||||
sd_result = ISD_InitCard();
|
||||
if (sd_result != 0) {
|
||||
OSReport("ERR:Failed to init SD Card Driver in pfd_sddrv_init()\n");
|
||||
@@ -319,7 +318,7 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
}
|
||||
g_pfd_sddrv_info.flags |= 4;
|
||||
}
|
||||
pf_memset(&g_pfd_sddev, 0, 0x28);
|
||||
pf_memset(&g_pfd_sddev, 0, sizeof(g_pfd_sddev.device));
|
||||
device = &g_pfd_sddev.device;
|
||||
sd_result = ISD_MountCard(0, &device);
|
||||
if (sd_result != 0) {
|
||||
@@ -359,7 +358,6 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
s32 pfd_sddrv_mount(FADisk* disk) {
|
||||
s32 result;
|
||||
@@ -885,7 +883,7 @@ s32 pfd_sddrv_store_bpb_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector_buffe
|
||||
if (format_data == 0) {
|
||||
return -30;
|
||||
}
|
||||
pf_memset(&settings, 0, 0x10);
|
||||
pf_memset(&settings, 0, sizeof(settings));
|
||||
requested_sectors = format_data->total_sectors;
|
||||
size_entry = sddrv_size_depend_tbl;
|
||||
for (entry_index = 0; entry_index < 14; size_entry++, entry_index++) {
|
||||
@@ -967,7 +965,7 @@ s32 pfd_sddrv_store_mbr_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector_buffe
|
||||
if (format_data == 0) {
|
||||
return -30;
|
||||
}
|
||||
pf_memset(&settings, 0, 0x10);
|
||||
pf_memset(&settings, 0, sizeof(settings));
|
||||
requested_sectors = format_data->total_sectors;
|
||||
size_entry = sddrv_size_depend_tbl;
|
||||
for (entry_index = 0; entry_index < 14; size_entry++, entry_index++) {
|
||||
@@ -1028,7 +1026,7 @@ s32 pfd_sddrv_build_mbr_bpb(u32 total_sectors) {
|
||||
s32 result;
|
||||
u32 partition_start_sector;
|
||||
|
||||
pf_memset(&format_data, 0, 0x20);
|
||||
pf_memset(&format_data, 0, sizeof(format_data));
|
||||
format_data.total_sectors = total_sectors;
|
||||
result = pfd_sddrv_calc_mbr_bpb(&format_data);
|
||||
if (result != 0) {
|
||||
@@ -1093,7 +1091,7 @@ s32 pfd_sddrv_calc_fat32_mbr_bpb(PFD_SDDRV_FORMAT_DATA* format_data) {
|
||||
if (format_data == 0) {
|
||||
return -30;
|
||||
}
|
||||
pf_memset(&settings, 0, 0x10);
|
||||
pf_memset(&settings, 0, sizeof(settings));
|
||||
requested_sectors = format_data->total_sectors;
|
||||
total_sectors = format_data->total_sectors;
|
||||
size_entry = sddrv_size_depend_tbl;
|
||||
@@ -1191,7 +1189,7 @@ s32 pfd_sddrv_store_fat32_mbr_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector
|
||||
if (format_data == 0 || sector_buffer == 0) {
|
||||
return -30;
|
||||
}
|
||||
pf_memset(&settings, 0, 0x10);
|
||||
pf_memset(&settings, 0, sizeof(settings));
|
||||
requested_sectors = format_data->total_sectors;
|
||||
size_entry = sddrv_size_depend_tbl;
|
||||
for (entry_index = 0; entry_index < 14; size_entry++, entry_index++) {
|
||||
@@ -1306,7 +1304,7 @@ s32 pfd_sddrv_store_fat32_bpb_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector
|
||||
if (format_data == 0 || sector_buffer == 0) {
|
||||
return -30;
|
||||
}
|
||||
pf_memset(&settings, 0, 0x10);
|
||||
pf_memset(&settings, 0, sizeof(settings));
|
||||
requested_sectors = format_data->total_sectors;
|
||||
size_entry = sddrv_size_depend_tbl;
|
||||
for (entry_index = 0; entry_index < 14; size_entry++, entry_index++) {
|
||||
@@ -1375,12 +1373,13 @@ static inline s32 pfd_sddrv_write_sector(u32 sector) {
|
||||
return ISD_WriteBlock(g_pfd_sddrv_info.device, sector, g_pfd_sddrv_buf, 1);
|
||||
}
|
||||
|
||||
/* MWCC needs IRO 0 to retain the reserved-sector error path. */
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
PFD_SDDRV_FORMAT_DATA format_data;
|
||||
s32 result;
|
||||
pf_memset(&format_data, 0, 0x20);
|
||||
pf_memset(&format_data, 0, sizeof(format_data));
|
||||
format_data.total_sectors = total_sectors;
|
||||
result = pfd_sddrv_calc_fat32_mbr_bpb(&format_data);
|
||||
if (result != 0) {
|
||||
|
||||
@@ -8,12 +8,8 @@ static inline pf_u16 read_boot_u16(pf_u8* buf, pf_u32 offset) {
|
||||
return PF_SWAP_16(*(pf_u16*)&buf[(offset + 1) & ~1]);
|
||||
}
|
||||
|
||||
static inline pf_u32 read_partition_u32(const pf_u8* buf, pf_u32 offset) {
|
||||
return (((pf_u32)buf[offset + 2] << 16) + buf[offset]) +
|
||||
(((pf_u32)buf[offset + 3] << 24) + ((pf_u32)buf[offset + 1] << 8));
|
||||
}
|
||||
|
||||
pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
|
||||
// MWCC needs volatile byte loads to preserve the MBR decoding order.
|
||||
pf_s32 pdm_part_is_master_boot_sector(volatile pf_u8* buf, pf_u32 total, pf_bool* p_is_mbr) {
|
||||
pf_u32* p_start;
|
||||
pf_u32* p_count;
|
||||
pf_s16 index;
|
||||
@@ -25,8 +21,8 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
|
||||
p_count = count;
|
||||
for (index = 0; index < 4; index++) {
|
||||
*p_start = 0;
|
||||
*p_start = read_partition_u32(buf, 454);
|
||||
*p_count = read_partition_u32(buf, 458);
|
||||
*p_start = MBR_WORD(buf, 454);
|
||||
*p_count = MBR_WORD(buf, 458);
|
||||
if (*p_start != 0 && *p_count != 0) {
|
||||
if (index == 0) { *p_is_mbr = 1; }
|
||||
} else {
|
||||
@@ -36,15 +32,11 @@ pf_s32 pdm_part_is_master_boot_sector(pf_u8* buf, pf_u32 total, pf_bool* p_is_mb
|
||||
p_count++;
|
||||
buf += 16;
|
||||
}
|
||||
p_start = start;
|
||||
p_count = count;
|
||||
for (index = 0; index < 4; index++) {
|
||||
if (*p_start + *p_count > total) {
|
||||
if (start[index] + count[index] > total) {
|
||||
if (index == 0) { *p_is_mbr = 0; }
|
||||
return 2;
|
||||
}
|
||||
p_start++;
|
||||
p_count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -173,72 +173,77 @@ pf_s32 PFFAT12_WriteFATEntryWithBuf(PF_VOLUME* p_vol, pf_s16 cluster, pf_u16 val
|
||||
#undef FLUSH_FAT_BUFFER
|
||||
}
|
||||
|
||||
pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol , pf_u16 cluster , pf_u32* p_value ,
|
||||
PF_CACHE_PAGE* p_page ) {
|
||||
struct {
|
||||
pf_u32 sector;
|
||||
pf_u32 current_fat;
|
||||
pf_s32 err;
|
||||
pf_u32 offset;
|
||||
} state;
|
||||
static inline pf_s32 ReadFAT12WordWithBuf(PF_VOLUME* p_vol, pf_u32 offset, pf_u32* p_value, PF_CACHE_PAGE* p_page) {
|
||||
pf_u32 current_fat;
|
||||
pf_u32 sector;
|
||||
pf_s32 err;
|
||||
pf_s32 result;
|
||||
|
||||
#define LOAD_FAT_SECTOR(next_sector) \
|
||||
if (p_page->sector != state.sector + (next_sector)) { \
|
||||
if (p_page->sector != sector + (next_sector)) { \
|
||||
if (p_page->option == 1) { \
|
||||
for (state.err = 0; (pf_u16)state.err < p_vol->bpb.num_active_FATs; state.err++) { \
|
||||
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)state.err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector); \
|
||||
for (err = 0; (pf_u16)err < p_vol->bpb.num_active_FATs; err++) { \
|
||||
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector); \
|
||||
} \
|
||||
} \
|
||||
state.err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, state.sector + (next_sector), 0, p_vol->bpb.bytes_per_sector); \
|
||||
if (state.err != 0) { continue; } \
|
||||
p_page->sector = state.sector + (next_sector); \
|
||||
err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, sector + (next_sector), 0, p_vol->bpb.bytes_per_sector); \
|
||||
if (err != 0) { continue; } \
|
||||
p_page->sector = sector + (next_sector); \
|
||||
}
|
||||
|
||||
state.offset = (pf_u16)(cluster + (cluster >> 1));
|
||||
state.sector = p_vol->bpb.active_FAT_sector + (state.offset >> p_vol->bpb.log2_bytes_per_sector) & 0xFFFF;
|
||||
sector = p_vol->bpb.active_FAT_sector + (offset >> p_vol->bpb.log2_bytes_per_sector) & 0xFFFF;
|
||||
if ((p_vol->bpb.ext_flags & 0x80) != 0) {
|
||||
state.current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04);
|
||||
current_fat = p_vol->bpb.ext_flags & (0x01 | 0x02 | 0x04);
|
||||
} else {
|
||||
state.current_fat = 1;
|
||||
current_fat = 1;
|
||||
}
|
||||
state.err = 0;
|
||||
err = 0;
|
||||
while (PF_TRUE) {
|
||||
if (state.err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
if (err == 0x1000 && p_vol->p_callback != PF_NULL) {
|
||||
result = ((PF_VOLUME_CB)p_vol->p_callback)(p_vol->last_driver_error);
|
||||
if (result == 0) {
|
||||
state.err = 0;
|
||||
err = 0;
|
||||
continue;
|
||||
}
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && state.current_fat < p_vol->bpb.num_active_FATs) {
|
||||
state.current_fat++;
|
||||
state.sector += p_vol->bpb.sectors_per_FAT;
|
||||
state.err = 0;
|
||||
if (result == 1 && p_vol->bpb.num_active_FATs >= 2 && current_fat < p_vol->bpb.num_active_FATs) {
|
||||
current_fat++;
|
||||
sector += p_vol->bpb.sectors_per_FAT;
|
||||
err = 0;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
LOAD_FAT_SECTOR(0);
|
||||
state.offset &= p_vol->bpb.bytes_per_sector - 1;
|
||||
if (state.offset == (p_vol->bpb.bytes_per_sector - 1)) {
|
||||
*p_value = p_page->p_buf[state.offset];
|
||||
offset &= p_vol->bpb.bytes_per_sector - 1;
|
||||
if (offset == (p_vol->bpb.bytes_per_sector - 1)) {
|
||||
*p_value = p_page->p_buf[offset];
|
||||
if (p_page->option == 1) {
|
||||
for (state.err = 0; (pf_u16)state.err < p_vol->bpb.num_active_FATs; state.err++) {
|
||||
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)state.err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector);
|
||||
for (err = 0; (pf_u16)err < p_vol->bpb.num_active_FATs; err++) {
|
||||
VFiPFSEC_WriteFAT(p_vol, p_page->p_buf, p_page->sector + (pf_u16)err * p_vol->bpb.sectors_per_FAT, 0, p_vol->bpb.bytes_per_sector);
|
||||
}
|
||||
}
|
||||
state.err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, state.sector + 1, 0, p_vol->bpb.bytes_per_sector);
|
||||
if (state.err != 0) { continue; }
|
||||
p_page->sector = state.sector + 1;
|
||||
err = VFiPFSEC_ReadFAT(p_vol, p_page->p_buf, sector + 1, 0, p_vol->bpb.bytes_per_sector);
|
||||
if (err != 0) { continue; }
|
||||
p_page->sector = sector + 1;
|
||||
*p_value += (pf_u16)(*p_page->p_buf) << 8;
|
||||
} else {
|
||||
*p_value = ((pf_u16)p_page->p_buf[state.offset + 1] << 8) + p_page->p_buf[state.offset];
|
||||
*p_value = ((pf_u16)p_page->p_buf[offset + 1] << 8) + p_page->p_buf[offset];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (state.err != 0) {
|
||||
return err;
|
||||
|
||||
#undef LOAD_FAT_SECTOR
|
||||
}
|
||||
|
||||
pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol, pf_u16 cluster, pf_u32* p_value,
|
||||
PF_CACHE_PAGE* p_page) {
|
||||
pf_s32 err;
|
||||
|
||||
err = ReadFAT12WordWithBuf(p_vol, (pf_u16)(cluster + (cluster >> 1)), p_value, p_page);
|
||||
if (err != 0) {
|
||||
*p_value = -1;
|
||||
return state.err;
|
||||
return err;
|
||||
}
|
||||
if ((cluster & 0x01) != 0) {
|
||||
*p_value = *p_value >> 4;
|
||||
@@ -246,6 +251,4 @@ pf_s32 PFFAT12_ReadFATEntryWithBuf(PF_VOLUME* p_vol , pf_u16 cluster , pf_u32* p
|
||||
*p_value &= 0xFFF;
|
||||
}
|
||||
return 0;
|
||||
|
||||
#undef LOAD_FAT_SECTOR
|
||||
}
|
||||
|
||||
@@ -1873,10 +1873,7 @@ pf_s32 PFFILE_fappend(PFFILE_FILE* file, pf_u32 size, pf_u32* size_appended) {
|
||||
pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
|
||||
PF_VOLUME* volume = file == PF_NULL ? PF_NULL : file->p_sfd->dir_entry.p_vol;
|
||||
PFFILE_CURSOR saved_cursor;
|
||||
struct {
|
||||
PF_FAT_HINT hint;
|
||||
pf_u32 last_access_chain_index;
|
||||
} saved_hint;
|
||||
PFFILE_FAT_HINT saved_hint;
|
||||
pf_u16 access_time;
|
||||
pf_s32 error;
|
||||
|
||||
@@ -1894,8 +1891,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
|
||||
}
|
||||
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = file;
|
||||
saved_cursor = file->cursor;
|
||||
saved_hint.hint = file->hint;
|
||||
saved_hint.last_access_chain_index = file->last_access_data.last_access.chain_index;
|
||||
saved_hint = *(PFFILE_FAT_HINT*)&file->hint;
|
||||
if ((file->open_mode & 8) == 0 && (file->open_mode & 2) != 0) {
|
||||
error = 0x0A;
|
||||
} else if ((file->p_sfd->lock.mode & 3) != 0 &&
|
||||
@@ -1907,8 +1903,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
|
||||
error &= (-error | error) >> 31;
|
||||
}
|
||||
file->cursor = saved_cursor;
|
||||
file->hint = saved_hint.hint;
|
||||
file->last_access_data.last_access.chain_index = saved_hint.last_access_chain_index;
|
||||
*(PFFILE_FAT_HINT*)&file->hint = saved_hint;
|
||||
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = PF_NULL;
|
||||
if (error != 0) {
|
||||
pf_vol_set.last_error = error;
|
||||
@@ -1923,10 +1918,7 @@ pf_s32 PFFILE_fadjust(PFFILE_FILE* file) {
|
||||
pf_s32 PFFILE_finfo(PFFILE_FILE* file, PF_INFO* info) {
|
||||
PF_VOLUME* volume = file == PF_NULL ? PF_NULL : file->p_sfd->dir_entry.p_vol;
|
||||
PFFILE_CURSOR saved_cursor;
|
||||
struct {
|
||||
PF_FAT_HINT hint;
|
||||
pf_u32 last_access_chain_index;
|
||||
} saved_hint;
|
||||
PFFILE_FAT_HINT saved_hint;
|
||||
pf_s32 error;
|
||||
|
||||
error = PFVOL_CheckForRead(volume);
|
||||
@@ -1943,12 +1935,10 @@ pf_s32 PFFILE_finfo(PFFILE_FILE* file, PF_INFO* info) {
|
||||
}
|
||||
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = file;
|
||||
saved_cursor = file->cursor;
|
||||
saved_hint.hint = file->hint;
|
||||
saved_hint.last_access_chain_index = file->last_access_data.last_access.chain_index;
|
||||
saved_hint = *(PFFILE_FAT_HINT*)&file->hint;
|
||||
error = PFFILE_p_finfo(file, info);
|
||||
file->cursor = saved_cursor;
|
||||
file->hint = saved_hint.hint;
|
||||
file->last_access_data.last_access.chain_index = saved_hint.last_access_chain_index;
|
||||
*(PFFILE_FAT_HINT*)&file->hint = saved_hint;
|
||||
((PFFILE_VOLUME_DIRS*)volume)->cache_signature = PF_NULL;
|
||||
if (error != 0) {
|
||||
pf_vol_set.last_error = error;
|
||||
|
||||
@@ -418,15 +418,13 @@ pf_s32 PFPATH_cmpNameUni(const pf_u16* name, PF_STR* pattern) {
|
||||
}
|
||||
|
||||
pf_s32 PFPATH_cmpName(const pf_s8* short_name, PF_STR* pattern, pf_u32 short_search) {
|
||||
struct {
|
||||
pf_u32 matched_end;
|
||||
pf_s8 name[0x10];
|
||||
} work;
|
||||
pf_s8* name = work.name;
|
||||
pf_s8 name_buffer[13];
|
||||
pf_u32 matched_end;
|
||||
pf_s8* name = name_buffer;
|
||||
pf_s8* name_end;
|
||||
const pf_s8* pattern_text;
|
||||
|
||||
work.matched_end = 0;
|
||||
matched_end = 0;
|
||||
pattern_text = PFSTR_GetStrPos(pattern, 3);
|
||||
pf_strcpy(name, short_name);
|
||||
if ((pf_vol_set.setting & 2) == 2 && PFSTR_GetCodeMode(pattern) == 2 && pf_strcmp(name, (const pf_s8*)".") != 0 &&
|
||||
@@ -450,7 +448,7 @@ pf_s32 PFPATH_cmpName(const pf_s8* short_name, PF_STR* pattern, pf_u32 short_sea
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return PFPATH_cmpNameImpl(work.name, pattern_text, &work.matched_end);
|
||||
return PFPATH_cmpNameImpl(name_buffer, pattern_text, &matched_end);
|
||||
}
|
||||
|
||||
pf_s32 PFPATH_cmpTailSFN(const pf_s8* sfn_name, const pf_s8* pattern) {
|
||||
|
||||
@@ -76,6 +76,7 @@ typedef struct FS_Callback {
|
||||
#define FS_HEAP_SIZE ((FS_HEAP_BLOCK + 1) * OSRoundUp32B(sizeof(FS_Callback)))
|
||||
|
||||
#define FS_ALLOC(p) iosAllocAligned(hId, sizeof(*p), DEFAULT_ALIGN)
|
||||
/* MWCC needs nested null guards to retain both cleanup branches. */
|
||||
#define FS_FREE(p) \
|
||||
if (p != NULL) { \
|
||||
iosFree(hId, p); \
|
||||
@@ -139,7 +140,7 @@ ISFSError ISFS_OpenLibEx() {
|
||||
}
|
||||
|
||||
ISFSError ISFS_CloseLib() {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
|
||||
if (__fsFd < 0) {
|
||||
ret = ISFS_ERROR_INVALID;
|
||||
@@ -265,7 +266,7 @@ IOSError _isfsFuncCb(IOSError result, void* isfsCallbackArg) {
|
||||
}
|
||||
|
||||
ISFSError ISFS_GetStats(ISFSStats* stats) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg = NULL;
|
||||
|
||||
if (__fsFd < 0 || stats == NULL) {
|
||||
@@ -296,8 +297,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MWCC needs path-length assignments in validation to share each error branch. */
|
||||
ISFSError ISFS_CreateDir(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
@@ -335,7 +337,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
@@ -359,7 +361,7 @@ ISFSError ISFS_CreateDirAsync(const char* dirName, u32 dirAttr, u32 ownerAcc, u3
|
||||
isfsCallbackArg->func = ISFS_CB_STATE_NONE;
|
||||
|
||||
pathAttrArgs = (ISFSPathAttrArgs*)isfsCallbackArg->ioBuf;
|
||||
memcpy(pathAttrArgs->path, (void*)dirName, len + 1);
|
||||
memcpy(pathAttrArgs->path, dirName, len + 1);
|
||||
pathAttrArgs->attr = dirAttr;
|
||||
pathAttrArgs->ownerAccess = ownerAcc;
|
||||
pathAttrArgs->groupAccess = groupAcc;
|
||||
@@ -372,7 +374,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_ReadDir(const char* dirName, char* nameList, u32* num) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len, numInputs, numOutputs, *numPtr;
|
||||
|
||||
IOSIoVector* vec = NULL;
|
||||
@@ -435,7 +437,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_ReadDirAsync(const char* dirName, char* nameList, u32* num, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len, numInputs, numOutputs, *numPtr;
|
||||
|
||||
FS_Callback* isfsCallbackArg = NULL;
|
||||
@@ -494,7 +496,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
|
||||
u32 len;
|
||||
@@ -522,7 +524,7 @@ ISFSError ISFS_SetAttr(const char* fileName, u32 ownerId, u16 groupId, u32 attr,
|
||||
pathAttrArgs->groupAccess = (u8)groupAcc;
|
||||
pathAttrArgs->othersAccess = (u8)othersAcc;
|
||||
|
||||
ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_SET_ATTR, (u8*)pathAttrArgs, sizeof(*pathAttrArgs), NULL, 0);
|
||||
ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_SET_ATTR, pathAttrArgs, sizeof(*pathAttrArgs), NULL, 0);
|
||||
|
||||
out:
|
||||
if (isfsCallbackArg != NULL) {
|
||||
@@ -534,7 +536,7 @@ out:
|
||||
|
||||
ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32 attr, u32 ownerAcc, u32 groupAcc, u32 othersAcc,
|
||||
ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
|
||||
u32 len;
|
||||
@@ -566,13 +568,13 @@ ISFSError ISFS_SetAttrAsync(const char* fileName, u32 ownerId, u16 groupId, u32
|
||||
pathAttrArgs->groupAccess = (u8)groupAcc;
|
||||
pathAttrArgs->othersAccess = (u8)othersAcc;
|
||||
|
||||
ret = IOS_IoctlAsync(__fsFd, ISFS_IOCTL_SET_ATTR, (u8*)pathAttrArgs, sizeof(ISFSPathAttrArgs), NULL, 0, _isfsFuncCb, isfsCallbackArg);
|
||||
ret = IOS_IoctlAsync(__fsFd, ISFS_IOCTL_SET_ATTR, pathAttrArgs, sizeof(ISFSPathAttrArgs), NULL, 0, _isfsFuncCb, isfsCallbackArg);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
|
||||
u8* ptr;
|
||||
@@ -592,7 +594,7 @@ ISFSError ISFS_GetAttr(const char* fileName, u32* ownerId, u16* groupId, u32* at
|
||||
goto out;
|
||||
}
|
||||
|
||||
ptr = (u8*)isfsCallbackArg->ioBuf;
|
||||
ptr = isfsCallbackArg->ioBuf;
|
||||
memcpy(ptr, fileName, len + 1);
|
||||
pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(ptr + FS_MAX_PATH);
|
||||
ret = IOS_Ioctl(__fsFd, ISFS_IOCTL_GET_ATTR, ptr, FS_MAX_PATH, pathAttrArgs, sizeof(*pathAttrArgs));
|
||||
@@ -618,7 +620,7 @@ out:
|
||||
|
||||
ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u32* attr, u32* ownerAcc, u32* groupAcc, u32* othersAcc,
|
||||
ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
u8* ptr;
|
||||
@@ -646,7 +648,7 @@ ISFSError ISFS_GetAttrAsync(const char* fileName, u32* ownerId, u16* groupId, u3
|
||||
isfsCallbackArg->callbackArg = callbackArg;
|
||||
isfsCallbackArg->func = ISFS_CB_STATE_GET_ATTR;
|
||||
|
||||
ptr = (u8*)isfsCallbackArg->ioBuf;
|
||||
ptr = isfsCallbackArg->ioBuf;
|
||||
memcpy(ptr, fileName, len + 1);
|
||||
pathAttrArgs = (ISFSPathAttrArgs*)OSRoundUp32B(ptr + FS_MAX_PATH);
|
||||
|
||||
@@ -656,7 +658,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_Delete(const char* fileName) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
FS_Callback* isfsCallbackArg = NULL;
|
||||
|
||||
@@ -683,7 +685,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_DeleteAsync(const char* fileName, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
@@ -709,7 +711,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_Rename(const char* oldName, const char* newName) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathsArgs* pathsArgs;
|
||||
|
||||
u32 oldLen, newLen;
|
||||
@@ -742,7 +744,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_RenameAsync(const char* oldName, const char* newName, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathsArgs* pathsArgs;
|
||||
|
||||
u32 oldLen, newLen;
|
||||
@@ -775,7 +777,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_GetUsage(const char* dirName, u32* blocks, u32* iNodes) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
|
||||
u32 len, *blkPtr, *inodePtr;
|
||||
|
||||
@@ -828,7 +830,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_CreateFile(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
|
||||
u32 len;
|
||||
@@ -866,7 +868,7 @@ out:
|
||||
|
||||
ISFSError ISFS_CreateFileAsync(const char* fileName, u32 fileAttr, u32 ownerAcc, u32 groupAcc, u32 othersAcc, ISFSCallback callback,
|
||||
void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
ISFSPathAttrArgs* pathAttrArgs;
|
||||
|
||||
u32 len;
|
||||
@@ -901,7 +903,7 @@ out:
|
||||
}
|
||||
|
||||
IOSFd ISFS_Open(const char* fileName, u32 access) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
FS_Callback* isfsCallbackArg = NULL;
|
||||
|
||||
@@ -928,7 +930,7 @@ out:
|
||||
}
|
||||
|
||||
IOSFd ISFS_OpenAsync(const char* fileName, u32 access, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
u32 len;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
@@ -954,7 +956,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_GetFileStats(IOSFd fd, ISFSFileStats* stats) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg = NULL;
|
||||
|
||||
if (stats == NULL || ((u32)stats & 31)) {
|
||||
@@ -985,7 +987,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_GetFileStatsAsync(IOSFd fd, ISFSFileStats* stats, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
if (stats == NULL || ((u32)stats & 31)) {
|
||||
@@ -1034,14 +1036,14 @@ out:
|
||||
|
||||
ISFSError ISFS_Read(s32 fd, u8* buffer, u32 bufferLen) {
|
||||
if (buffer == NULL || (u32)buffer & 31) {
|
||||
return -101;
|
||||
return ISFS_ERROR_INVALID;
|
||||
}
|
||||
|
||||
return IOS_Read(fd, buffer, bufferLen);
|
||||
}
|
||||
|
||||
ISFSError ISFS_ReadAsync(IOSFd fd, u8* buffer, u32 size, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
if (buffer == NULL || ((u32)buffer & 31)) {
|
||||
@@ -1065,7 +1067,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_Write(IOSFd fd, const char* buffer, u32 size) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
|
||||
if ((buffer == NULL) || ((u32)buffer & 31)) {
|
||||
ret = ISFS_ERROR_INVALID;
|
||||
@@ -1078,7 +1080,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_WriteAsync(IOSFd fd, const char* buffer, u32 size, ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
if (buffer == NULL || ((u32)buffer & 31)) {
|
||||
@@ -1126,7 +1128,7 @@ out:
|
||||
}
|
||||
|
||||
ISFSError ISFS_ShutdownAsync(ISFSCallback callback, void* callbackArg) {
|
||||
ISFSError ret = ISFS_ERROR_OK;
|
||||
ISFSError ret;
|
||||
FS_Callback* isfsCallbackArg;
|
||||
|
||||
isfsCallbackArg = FS_ALLOC(isfsCallbackArg);
|
||||
|
||||
@@ -124,7 +124,7 @@ void __GetImageTileCount(GXTexFmt fmt, u16 wd, u16 ht, u32* rowTiles, u32* colTi
|
||||
*cmpTiles = (fmt == GX_TF_RGBA8 || fmt == GX_TF_Z24X8) ? 2 : 1;
|
||||
}
|
||||
|
||||
void GXInitTexObj(const GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
void GXInitTexObj(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXTexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t,
|
||||
GXBool mipmap) {
|
||||
u32 imageBase;
|
||||
u32 maxLOD;
|
||||
|
||||
@@ -35,9 +35,8 @@ size_t strnlen(const char* s, size_t maxlen) {
|
||||
}
|
||||
|
||||
static inline IOSError ipcFree(IOSRpcRequest* rpc) {
|
||||
IOSError ret = IPC_RESULT_OK;
|
||||
iosFree(hid, rpc);
|
||||
return ret;
|
||||
return IPC_RESULT_OK;
|
||||
}
|
||||
|
||||
static inline void __ipcSendRequest() {
|
||||
|
||||
@@ -171,7 +171,6 @@ static void kbd_led_handler(BOOL success, void* callbackArg);
|
||||
|
||||
static void kbdAttachHandler(void* device) {
|
||||
u32 channel;
|
||||
channel = 0;
|
||||
|
||||
for (channel = 0; channel < 4; channel++) {
|
||||
if (kbdData[(u8)channel].device == NULL) {
|
||||
@@ -196,7 +195,6 @@ static void kbdAttachHandler(void* device) {
|
||||
|
||||
static void kbdDetachHandler(void* device) {
|
||||
u32 channel;
|
||||
channel = 0;
|
||||
|
||||
for (channel = 0; channel < 4; channel++) {
|
||||
if (device == kbdData[(u8)channel].device) {
|
||||
@@ -221,7 +219,6 @@ static void kbdDetachHandler(void* device) {
|
||||
|
||||
static void kbdEventHandler(void* device, char* report) {
|
||||
u32 channel;
|
||||
channel = 0;
|
||||
|
||||
for (channel = 0; channel < 4; channel++) {
|
||||
if (device == kbdData[(u8)channel].device) {
|
||||
@@ -396,13 +393,14 @@ static void kbdProcKey(u32 key, u32 pressed, u32 channel) {
|
||||
kbdSendKey(&event);
|
||||
}
|
||||
|
||||
/* MWCC needs propagation disabled to preserve the inlined modifier-state registers. */
|
||||
#pragma push
|
||||
#pragma opt_propagation off
|
||||
static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
|
||||
KBDChannel* data;
|
||||
u32 modState;
|
||||
s32 delta;
|
||||
u8 flags;
|
||||
|
||||
u32 finalState;
|
||||
s8 value;
|
||||
data = &kbdData[channel];
|
||||
delta = (pressed & 1) != 0 ? 1 : -1;
|
||||
@@ -521,9 +519,9 @@ static void kbdProcMod(u32 key, u32 pressed, u32 channel) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
finalState = modState | 0x1000;
|
||||
KBDSetModState(channel, finalState);
|
||||
KBDSetModState(channel, modState | 0x1000);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
static void kbdSendKey(KBDKeyEventData* event) {
|
||||
KBDChannel* data;
|
||||
@@ -554,26 +552,25 @@ static void kbdSendKey(KBDKeyEventData* event) {
|
||||
}
|
||||
}
|
||||
|
||||
/* MWCC needs IRO 0 to reload the callback and retain the success branch. */
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
static void kbd_led_handler(BOOL success, void* callbackArg) {
|
||||
const KBDLEDCallbackData* callback;
|
||||
s32 index;
|
||||
u32 err;
|
||||
index = (s32)callbackArg;
|
||||
callback = &kbdLCBuf[index];
|
||||
u32 index;
|
||||
USBKBDErr err;
|
||||
index = (u32)callbackArg;
|
||||
kbdCmdBuf[index].device = 0;
|
||||
if (callback->callbackAddress == (USBKBDCmdLEDCallback)(u32)kbdCmdBuf[(u32)callbackArg].device) {
|
||||
if (kbdLCBuf[index].callbackAddress == NULL) {
|
||||
return;
|
||||
}
|
||||
switch (success) {
|
||||
default:
|
||||
err = 7;
|
||||
break;
|
||||
case TRUE:
|
||||
if (success == TRUE) {
|
||||
err = 0;
|
||||
break;
|
||||
} else {
|
||||
err = 7;
|
||||
}
|
||||
kbdLCBuf[(u32)callbackArg].callbackAddress(err, kbdLCBuf[(u32)callbackArg].callbackArg);
|
||||
kbdLCBuf[index].callbackAddress(err, kbdLCBuf[index].callbackArg);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
USBKBDErr KBDSetLedsAsync(u32 channel, u32 leds, USBKBDCmdLEDCallback callback, void* callbackArg) {
|
||||
u8 ledBits;
|
||||
@@ -823,6 +820,9 @@ USBKBDErr KBDSetLockProcessing(u32 channel, u32 value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MWCC needs IRO 1 to preserve the modifier-state load and store registers. */
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
USBKBDErr KBDSetModState(u32 channel, u32 value) {
|
||||
if (!kbdInitialized) {
|
||||
return 2;
|
||||
@@ -834,17 +834,18 @@ USBKBDErr KBDSetModState(u32 channel, u32 value) {
|
||||
kbdData[channel].modState = value & ~0x1000;
|
||||
} else {
|
||||
BOOL interrupts;
|
||||
KBDModifierState oldState;
|
||||
u32 oldState;
|
||||
KBDModifierState newState;
|
||||
interrupts = OSDisableInterrupts();
|
||||
newState.value = value & 0xfc0;
|
||||
oldState.value = kbdData[channel].modState;
|
||||
newState.bits.physical = oldState.bits.physical;
|
||||
oldState = kbdData[channel].modState;
|
||||
newState.bits.physical = oldState;
|
||||
kbdData[channel].modState = newState.value;
|
||||
OSRestoreInterrupts(interrupts);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
u16 KBDTranslateHidCode(u32 keyCode, u32 modifiers, s32 country) {
|
||||
s32 mask;
|
||||
|
||||
@@ -198,17 +198,16 @@ static void* get_ring_buffer_by_kpad1_style(s32 chan, void* buffer, s32 style) {
|
||||
switch (style) {
|
||||
case WPAD_DEV_CORE:
|
||||
size = 0x2A;
|
||||
goto process;
|
||||
break;
|
||||
case WPAD_DEV_FREESTYLE:
|
||||
size = 0x32;
|
||||
goto process;
|
||||
break;
|
||||
case WPAD_DEV_CLASSIC:
|
||||
size = 0x36;
|
||||
goto process;
|
||||
break;
|
||||
default:
|
||||
return buffer;
|
||||
}
|
||||
process:
|
||||
enabled = OSDisableInterrupts();
|
||||
index = kpad->ringIndex - 1;
|
||||
latest = WPADGetLatestIndexInBuf(chan);
|
||||
@@ -622,6 +621,7 @@ static void read_kpad_acc(KPADInside* kpad, KPADSample* status) {
|
||||
kpad->status.acc_speed = (f32)sqrt(previous.z * previous.z + (previous.x * previous.x + previous.y * previous.y));
|
||||
calc_acc_horizon(kpad);
|
||||
calc_acc_vertical(kpad);
|
||||
// MWCC needs separate format exits to preserve both comparisons.
|
||||
if (status->error == WPAD_ERR_OK && status->device == WPAD_DEV_FREESTYLE) {
|
||||
if (status->dataFormat == WPAD_FMT_FS_BTN_ACC) {
|
||||
goto read_extension_acceleration;
|
||||
@@ -664,7 +664,7 @@ static s8 select_2obj_first(KPADInside* kpad) {
|
||||
object = kpad->dpdState.objects;
|
||||
do {
|
||||
if ((s8)object->metadata.bytes.flags != 0) {
|
||||
goto nextObject;
|
||||
continue;
|
||||
}
|
||||
other = object + 1;
|
||||
do {
|
||||
@@ -676,7 +676,7 @@ static s8 select_2obj_first(KPADInside* kpad) {
|
||||
f32 dot;
|
||||
f32 score;
|
||||
if ((s8)other->metadata.bytes.flags != 0) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
dx = other->x - object->x;
|
||||
dy = other->y - object->y;
|
||||
@@ -687,7 +687,7 @@ static s8 select_2obj_first(KPADInside* kpad) {
|
||||
direction.y = kpad->horizonTangent.y * dx - kpad->horizonTangent.x * dy;
|
||||
dist = kpad->dpdDistanceScale * scale;
|
||||
if (dist <= kpad->minDpdDistance || dist >= kp_err_dist_max) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
dot = kpad->horizonAxis.x * direction.x + kpad->horizonAxis.y * direction.y;
|
||||
score = dot;
|
||||
@@ -703,12 +703,8 @@ static s8 select_2obj_first(KPADInside* kpad) {
|
||||
first = object;
|
||||
second = other;
|
||||
}
|
||||
nextOther:
|
||||
++other;
|
||||
} while (other <= kpad->dpdState.objects + 3);
|
||||
nextObject:
|
||||
++object;
|
||||
} while (object < kpad->dpdState.objects + 3);
|
||||
} while (++other <= kpad->dpdState.objects + 3);
|
||||
} while (++object < kpad->dpdState.objects + 3);
|
||||
if (best == kp_err_first_inpr) {
|
||||
return 0;
|
||||
}
|
||||
@@ -726,7 +722,7 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
object = kpad->dpdState.objects;
|
||||
do {
|
||||
if ((s8)object->metadata.bytes.flags != 0) {
|
||||
goto nextObject;
|
||||
continue;
|
||||
}
|
||||
other = object + 1;
|
||||
do {
|
||||
@@ -738,7 +734,7 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
f32 dot;
|
||||
BOOL reverse;
|
||||
if ((s8)other->metadata.bytes.flags != 0) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
dx = other->x - object->x;
|
||||
dy = other->y - object->y;
|
||||
@@ -747,7 +743,7 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
direction.y = dy * scale;
|
||||
scale *= kpad->dpdDistanceScale;
|
||||
if (scale <= kpad->minDpdDistance || scale >= kp_err_dist_max) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
scale -= kpad->dpdReferenceDistance;
|
||||
if (scale < 0.0f) {
|
||||
@@ -756,7 +752,7 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
scale *= kpad->invDistSpeed;
|
||||
}
|
||||
if (scale >= 1.0f) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
dot = kpad->dpdObjectDirection.x * direction.x + kpad->dpdObjectDirection.y * direction.y;
|
||||
if (dot < 0.0f) {
|
||||
@@ -766,7 +762,7 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
reverse = FALSE;
|
||||
}
|
||||
if (dot <= kp_err_next_inpr) {
|
||||
goto nextOther;
|
||||
continue;
|
||||
}
|
||||
scale += ((1.0f - dot) / (1.0f - kp_err_next_inpr));
|
||||
if (scale < best) {
|
||||
@@ -779,12 +775,8 @@ static s8 select_2obj_continue(KPADInside* kpad) {
|
||||
second = other;
|
||||
}
|
||||
}
|
||||
nextOther:
|
||||
++other;
|
||||
} while (other <= kpad->dpdState.objects + 3);
|
||||
nextObject:
|
||||
++object;
|
||||
} while (object < kpad->dpdState.objects + 3);
|
||||
} while (++other <= kpad->dpdState.objects + 3);
|
||||
} while (++object < kpad->dpdState.objects + 3);
|
||||
if (2.0f == best) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1092,50 +1084,51 @@ static void read_kpad_dpd(KPADInside* kpad, KPADSample* status) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(kpad->status.acc_vertical.x <= kp_err_up_inpr)) {
|
||||
if (kpad->status.dpd_valid_fg == 2 || kpad->status.dpd_valid_fg == -2) {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
do {
|
||||
if (!(kpad->status.acc_vertical.x <= kp_err_up_inpr)) {
|
||||
if (kpad->status.dpd_valid_fg == 2 || kpad->status.dpd_valid_fg == -2) {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kpad->dpdCount >= 1) {
|
||||
selected = select_1obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
if (kpad->dpdCount >= 1) {
|
||||
selected = select_1obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (kpad->status.dpd_valid_fg == 1 || kpad->status.dpd_valid_fg == -1) {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
} else if (kpad->status.dpd_valid_fg == 1 || kpad->status.dpd_valid_fg == -1) {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kpad->dpdCount >= 1) {
|
||||
selected = select_1obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
if (kpad->dpdCount >= 1) {
|
||||
selected = select_1obj_continue(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
} else {
|
||||
if (kpad->dpdCount >= 2) {
|
||||
selected = select_2obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kpad->dpdCount == 1) {
|
||||
selected = select_1obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
goto updateSelection;
|
||||
if (kpad->dpdCount == 1) {
|
||||
selected = select_1obj_first(kpad);
|
||||
if (selected != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selected = 0;
|
||||
updateSelection:
|
||||
selected = 0;
|
||||
} while (0);
|
||||
if (selected != 0) {
|
||||
f32 dy;
|
||||
f32 dx;
|
||||
|
||||
@@ -169,13 +169,15 @@ static inline char* __nupFindTag(char* response, const char* startTag, const cha
|
||||
char** value, size_t* length) {
|
||||
char* start;
|
||||
char* end;
|
||||
/* MWCC needs the tag searches in this short-circuit expression. */
|
||||
if (response == 0 || (start = strstr(response, startTag)) == 0 ||
|
||||
(end = strstr(start, endTag)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
*value = start + strlen(startTag);
|
||||
*length = end - *value;
|
||||
return end + strlen(endTag);
|
||||
end += strlen(endTag);
|
||||
return end;
|
||||
}
|
||||
|
||||
static s32 __nupParseServerInfo(NUPContextInfo* context, char* response, char* messageId,
|
||||
@@ -265,6 +267,7 @@ static s32 __nupParseServerInfo(NUPContextInfo* context, char* response, char* m
|
||||
titleCount = 0;
|
||||
cursor = response;
|
||||
{
|
||||
/* MWCC needs both tag searches in the loop condition to preserve instruction order. */
|
||||
while ((cursor = __nupFindTag(cursor, "<TitleId>", "</TitleId>", &start, &valueLength)) != 0 &&
|
||||
(cursor = __nupFindTag(cursor, "<Version>", "</Version>", &start, &valueLength)) != 0) {
|
||||
titleCount++;
|
||||
@@ -284,6 +287,7 @@ static s32 __nupParseServerInfo(NUPContextInfo* context, char* response, char* m
|
||||
size_t titleLength;
|
||||
size_t versionLength;
|
||||
char* parsedEnd;
|
||||
/* MWCC needs both tag searches in the loop condition to preserve instruction order. */
|
||||
while ((cursor = __nupFindTag(cursor, "<TitleId>", "</TitleId>", &titleStart, &titleLength)) != 0 &&
|
||||
(cursor = __nupFindTag(cursor, "<Version>", "</Version>", &versionStart, &versionLength)) != 0) {
|
||||
unsigned long long titleId = strtoull(titleStart, &parsedEnd, 16);
|
||||
@@ -423,6 +427,7 @@ static s32 __nupGetTicketViews(ESTitleId titleId, ESTicketView** ticketViews, u3
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MWCC must keep this helper out of line to match its callers. */
|
||||
#pragma dont_inline on
|
||||
static u32 __nupSetAuditState(u8 state) {
|
||||
const char* auditPath = "NUPAUDIT";
|
||||
@@ -617,6 +622,7 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MWCC must keep this helper out of line to match its callers. */
|
||||
#pragma dont_inline on
|
||||
static s32 __nupGetTmdView(ESTitleId titleId, ESTmdView** tmdView) {
|
||||
u32 tmdViewSize;
|
||||
@@ -645,10 +651,9 @@ static inline BOOL __nupHasContent(const Title* title, ESContentId contentId) {
|
||||
if (title->contentCount == 0 || title->contentIds == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
ESContentId* installedContent;
|
||||
u32 index;
|
||||
for (index = 0; index < title->contentCount; index++) {
|
||||
if (contentId == *(installedContent = &title->contentIds[index])) {
|
||||
if (contentId == title->contentIds[index]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -660,10 +665,9 @@ static inline BOOL __nupHasInstalledContent(const ESTitleVersion* title, ESConte
|
||||
if (contentCount == 0 || title->contentIds == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
ESContentId* installedContent;
|
||||
u32 index;
|
||||
for (index = 0; index < contentCount; index++) {
|
||||
if (contentId == *(installedContent = &title->contentIds[index])) {
|
||||
if (contentId == title->contentIds[index]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -840,7 +844,7 @@ static s32 __nupGetTmd(NUPTitleInfo* title, char* contentPrefixUrl) {
|
||||
result = -5000;
|
||||
} else {
|
||||
result = ES_DiGetTmdView((ESTitleMeta*)title->tmd, title->tmdSize,
|
||||
(ESTmdView*)title->tmdView, &title->tmdViewSize);
|
||||
title->tmdView, &title->tmdViewSize);
|
||||
if (result != 0) {
|
||||
nup::__nupFree(title->tmdView);
|
||||
title->tmdView = 0;
|
||||
@@ -906,10 +910,10 @@ static s32 __nupGetContentFull(NUPContextInfo* context, NUPTitleInfo* title, cha
|
||||
char* url = 0;
|
||||
u8* response = 0;
|
||||
unsigned long responseSize = 0;
|
||||
tmdView = (ESTmdView*)title->tmdView;
|
||||
tmdView = title->tmdView;
|
||||
|
||||
for (contentIndex = 0; contentIndex < tmdView->head.numContents; contentIndex++) {
|
||||
if (contentId == ((ESTmdView*)title->tmdView)->contents[contentIndex].cid) {
|
||||
if (contentId == title->tmdView->contents[contentIndex].cid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -953,11 +957,11 @@ static s32 __nupGetContentIncr(NUPContextInfo* context, NUPTitleInfo* title, cha
|
||||
if (url == 0) {
|
||||
result = -5000;
|
||||
} else {
|
||||
for (contentIndex = 0; contentIndex < ((ESTmdView*)title->tmdView)->head.numContents; contentIndex++) {
|
||||
ESContentId contentId = ((ESTmdView*)title->tmdView)->contents[contentIndex].cid;
|
||||
for (contentIndex = 0; contentIndex < title->tmdView->head.numContents; contentIndex++) {
|
||||
ESContentId contentId = title->tmdView->contents[contentIndex].cid;
|
||||
if (!__nupHasContent(title, contentId)) {
|
||||
snprintf(url, urlSize, "%s/%016llx/%08x", contentPrefixUrl, title->titleId, contentId);
|
||||
unsigned long contentSize = (u32)((((ESTmdView*)title->tmdView)->contents[contentIndex].size + 0xf) & 0xfffffffffffffff0ULL);
|
||||
unsigned long contentSize = (u32)((title->tmdView->contents[contentIndex].size + 0xf) & 0xfffffffffffffff0ULL);
|
||||
ESFd fd = ES_ImportContentBegin(title->titleId, contentId);
|
||||
result = fd;
|
||||
if (result < 0) {
|
||||
@@ -1020,6 +1024,7 @@ static void __nupCleanup(NUPContextInfo* context) {
|
||||
if (context->titles != 0) {
|
||||
for (u32 i = 0; i < context->titleCount; i++) {
|
||||
NUPTitleInfo* title = &context->titles[i];
|
||||
/* MWCC emits a separate null check before title cleanup. */
|
||||
if (title != 0) {
|
||||
__nupCleanupTitleInfo(title);
|
||||
}
|
||||
@@ -1071,7 +1076,7 @@ static s32 __nupUpdateTitle(NUPContextInfo* context, NUPTitleInfo* title, char*
|
||||
if (result != 0) {
|
||||
goto done;
|
||||
}
|
||||
ESTmdView* tmdView = (ESTmdView*)title->tmdView;
|
||||
ESTmdView* tmdView = title->tmdView;
|
||||
if (tmdView->head.numContents != 1) {
|
||||
result = -0x1389;
|
||||
goto done;
|
||||
@@ -1134,8 +1139,11 @@ static inline s32 __nupGetBoot2Version(u16* version) {
|
||||
s32 result = ES_GetBoot2Version(&bootVersion);
|
||||
if (result == 0) {
|
||||
u16 checkedVersion = bootVersion;
|
||||
if (checkedVersion != bootVersion) { result = -0x1389; }
|
||||
if (checkedVersion == bootVersion) { *version = checkedVersion; }
|
||||
if (checkedVersion != bootVersion) {
|
||||
result = -0x1389;
|
||||
} else {
|
||||
*version = checkedVersion;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1322,7 +1330,7 @@ extern "C" void* __nupOp(void* argument) {
|
||||
}
|
||||
}
|
||||
if (menuTitle != 0 && menuTitle->updateRequired != 0) {
|
||||
ESTitleId requiredSystemTitle = ((ESTmdView*)menuTitle->tmdView)->head.sysVersion;
|
||||
ESTitleId requiredSystemTitle = menuTitle->tmdView->head.sysVersion;
|
||||
for (i = 0; i < context->titleCount; i++) {
|
||||
if (context->titles[i].titleId == requiredSystemTitle) {
|
||||
systemTitle = &context->titles[i];
|
||||
@@ -1389,7 +1397,8 @@ void* NUP_Init(MEMAllocator* allocator) {
|
||||
NUPContextInfo* context = (NUPContextInfo*)instance;
|
||||
OSInitMutex(&context->mutex);
|
||||
OSLockMutex(&context->mutex);
|
||||
context->progress.message = (context->progress.result = 1, __nupStatusMessage[1]);
|
||||
context->progress.result = 1;
|
||||
context->progress.message = __nupStatusMessage[1];
|
||||
OSUnlockMutex(&context->mutex);
|
||||
}
|
||||
}
|
||||
@@ -1443,6 +1452,7 @@ int NUP_Start(void* instance, const char* serverAddress, const char* countryCode
|
||||
if (result < 0) {
|
||||
OSLockMutex(&context->mutex);
|
||||
context->progress.result = result;
|
||||
/* MWCC retains these status alternatives under the negative-result guard. */
|
||||
if (result < 0) {
|
||||
context->progress.message = __nupStatusMessage[5];
|
||||
} else {
|
||||
|
||||
@@ -73,6 +73,7 @@ static u8* __nupNhttpBufFull(u8** buffer, unsigned long* length, unsigned long r
|
||||
if (state->error != 0) goto done;
|
||||
}
|
||||
next = *buffer;
|
||||
/* MWCC needs the switch's extra branch around buffer allocation. */
|
||||
switch ((u32)next) {
|
||||
case 0: {
|
||||
requested = NhttpBufferSize(requested);
|
||||
@@ -142,6 +143,7 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
char* field = headerCopy;
|
||||
char* colon;
|
||||
char* end;
|
||||
/* MWCC needs the header searches in this loop condition to preserve instruction order. */
|
||||
while (*field != 0 && (colon = strchr(field, ':')) != NULL && (end = strstr(colon, "\r\n")) != NULL) {
|
||||
*colon = 0;
|
||||
*end = 0;
|
||||
@@ -194,7 +196,6 @@ static int __nupNhttpOp(char* url, NHTTPReqMethod method, char* headers, u8* bod
|
||||
goto cleanup;
|
||||
}
|
||||
if (status != 200 && status != 202) result = -5000 - status;
|
||||
goto cleanup;
|
||||
cleanup:
|
||||
if (state.response != NULL || result == -5009) NHTTPDestroyResponse(state.response);
|
||||
if (headerCopy != NULL) nup::__nupFree(headerCopy);
|
||||
@@ -233,6 +234,7 @@ static long __nupHttpStringFlush(u8* data, unsigned long length, unsigned long r
|
||||
return AppendHttpString(length, data, requested, (HttpString*)context);
|
||||
}
|
||||
}
|
||||
/* MWCC must keep this helper out of line to match its callers. */
|
||||
static int __nupNhttpOpString(u8** output, unsigned long* outputLength, char* url, NHTTPReqMethod method, char* headers, u8* body, unsigned long bodyLength, unsigned long limit, ProgressCallback progress, void* context) NO_INLINE;
|
||||
static int __nupNhttpOpString(u8** output, unsigned long* outputLength, char* url, NHTTPReqMethod method, char* headers, u8* body, unsigned long bodyLength, unsigned long limit, ProgressCallback progress, void* context) {
|
||||
HttpString text;
|
||||
|
||||
@@ -264,18 +264,17 @@ static void CloseCallbackFromReload(s32 result, NANDCommandBlock* block) {
|
||||
static void FinishFromReload() {
|
||||
SCStatus status;
|
||||
|
||||
_openFile:
|
||||
Control.openFileType++;
|
||||
|
||||
if (Control.openFileType < SC_CONF_FILE_MAX) {
|
||||
for (;;) {
|
||||
Control.openFileType++;
|
||||
if (Control.openFileType >= SC_CONF_FILE_MAX) {
|
||||
break;
|
||||
}
|
||||
Control.isFileOpen = FALSE;
|
||||
|
||||
if (NANDPrivateOpenAsync(Control.filePaths[Control.openFileType], &Control.fileInfo, NAND_ACCESS_READ, OpenCallbackFromReload,
|
||||
&Control.commandBlock) == NAND_RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
goto _openFile;
|
||||
}
|
||||
|
||||
switch (Control.asyncResult) {
|
||||
@@ -293,7 +292,7 @@ _openFile:
|
||||
}
|
||||
}
|
||||
|
||||
*(u8*)((u8*)OSPhysicalToCached(SC_CONFIG_FILE_PHYS_ADDRESS) + SC_CONFIG_FILE_LENGTH - 1) = '\0';
|
||||
((u8*)OSPhysicalToCached(SC_CONFIG_FILE_PHYS_ADDRESS))[SC_CONFIG_FILE_LENGTH - 1] = '\0';
|
||||
|
||||
if (Control.asyncCallback != NULL) {
|
||||
Control.asyncCallback(Control.asyncResult);
|
||||
@@ -442,6 +441,7 @@ static SCStatus ParseConfBuf(u8* conf, u32 size) {
|
||||
|
||||
// Build lookup table
|
||||
|
||||
// MWCC needs the name load in this loop condition to preserve scheduling.
|
||||
for (tblEnd = &tblIter[ItemIDMaxPlus1]; tblIter < tblEnd && (itName = tblIter->name) != (void*)NULL; tblIter++) {
|
||||
u32 itNameLen = strlen(itName);
|
||||
|
||||
@@ -726,6 +726,7 @@ static BOOL CreateItemByID(SCItemID id, u8 primType, const void* src, u32 len) {
|
||||
|
||||
itemSize += len;
|
||||
|
||||
// MWCC needs the name load in this loop condition to preserve both branches.
|
||||
for (; (itemName = it->name) != (void*)NULL; it++) {
|
||||
if (it->id == id) {
|
||||
break;
|
||||
@@ -1011,6 +1012,7 @@ void SCFlushAsync(SCFlushCallback callback) {
|
||||
static void MyNandCallback(s32 result, NANDCommandBlock* block) {
|
||||
SCControl* ctrl = &Control;
|
||||
|
||||
// MWCC needs shared switch paths to preserve branch layout.
|
||||
switch (ctrl->nandCbState) {
|
||||
case NAND_CB_STATE_GET_STATUS: {
|
||||
if (result == NAND_RESULT_OK && ctrl->fileType == NAND_TYPE_FILE) {
|
||||
@@ -1020,15 +1022,15 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) {
|
||||
goto _error;
|
||||
}
|
||||
} else {
|
||||
goto _case_1_lbl;
|
||||
goto deleteFile;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case NAND_CB_STATE_DELETE: {
|
||||
if (result == NAND_RESULT_OK && ctrl->fileAttr.permission == NAND_PERM_ALL_RW) {
|
||||
goto _case_5_lbl;
|
||||
goto openFile;
|
||||
}
|
||||
_case_1_lbl:
|
||||
deleteFile:
|
||||
ctrl->nandCbState = NAND_CB_STATE_GET_TYPE;
|
||||
|
||||
if (NANDPrivateDeleteAsync(ConfFileName, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) {
|
||||
@@ -1045,19 +1047,17 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) {
|
||||
return;
|
||||
}
|
||||
case NAND_CB_STATE_CREATE_DIR: {
|
||||
if (result == NAND_RESULT_OK && ctrl->fileType == NAND_TYPE_DIR) {
|
||||
goto _case_4_lbl;
|
||||
}
|
||||
if (result != NAND_RESULT_OK || ctrl->fileType != NAND_TYPE_DIR) {
|
||||
ctrl->nandCbState = NAND_CB_STATE_CREATE_FILE;
|
||||
|
||||
ctrl->nandCbState = NAND_CB_STATE_CREATE_FILE;
|
||||
|
||||
if (NANDPrivateCreateDirAsync(ConfDirName, NAND_PERM_ALL_RW, 0, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) {
|
||||
goto _error;
|
||||
if (NANDPrivateCreateDirAsync(ConfDirName, NAND_PERM_ALL_RW, 0, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) {
|
||||
goto _error;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
// FALLTHROUGH
|
||||
}
|
||||
case NAND_CB_STATE_CREATE_FILE: {
|
||||
_case_4_lbl:
|
||||
ctrl->nandCbState = NAND_CB_STATE_OPEN_FILE;
|
||||
if (NANDPrivateCreateAsync(ConfFileName, NAND_PERM_ALL_RW, 0, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) {
|
||||
goto _error;
|
||||
@@ -1065,7 +1065,7 @@ static void MyNandCallback(s32 result, NANDCommandBlock* block) {
|
||||
return;
|
||||
}
|
||||
case NAND_CB_STATE_OPEN_FILE: {
|
||||
_case_5_lbl:
|
||||
openFile:
|
||||
ctrl->nandCbState = NAND_CB_STATE_WRITE_FILE;
|
||||
if (NANDPrivateOpenAsync(ConfFileName, &ctrl->fileInfo, NAND_ACCESS_WRITE, MyNandCallback, &ctrl->commandBlock) != NAND_RESULT_OK) {
|
||||
goto _error;
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#pragma sym on
|
||||
|
||||
#define SD_SLOT_0_PATH "/dev/sdio/slot0"
|
||||
#define SD_SLOT_1_PATH "/dev/sdio/slot1"
|
||||
#define SD_SLOT_W_PATH "/dev/sdio/slotw"
|
||||
@@ -591,27 +589,32 @@ ISD_Error ISD_InitCard() {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((__sdCmdBuffer = iosAlloc(__sdHeapId[0], 0x20)) == 0) {
|
||||
__sdCmdBuffer = iosAlloc(__sdHeapId[0], 0x20);
|
||||
if (__sdCmdBuffer == 0) {
|
||||
ret = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((__sdResp = iosAlloc(__sdHeapId[0], 0x20)) == 0) {
|
||||
__sdResp = iosAlloc(__sdHeapId[0], 0x20);
|
||||
if (__sdResp == 0) {
|
||||
ret = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((__sdResp2 = iosAlloc(__sdHeapId[0], 0x20)) == 0) {
|
||||
__sdResp2 = iosAlloc(__sdHeapId[0], 0x20);
|
||||
if (__sdResp2 == 0) {
|
||||
ret = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((__sdReg = iosAlloc(__sdHeapId[0], 0x20)) == 0) {
|
||||
__sdReg = iosAlloc(__sdHeapId[0], 0x20);
|
||||
if (__sdReg == 0) {
|
||||
ret = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((__sdVect = iosAlloc(__sdHeapId[0], 0x60)) == 0) {
|
||||
__sdVect = iosAlloc(__sdHeapId[0], 0x60);
|
||||
if (__sdVect == 0) {
|
||||
ret = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,8 @@ IOSError IUSB_GetDeviceList(const char* path, USBDeviceInfo* deviceList, u8 maxD
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto out;
|
||||
}
|
||||
if ((fd = __openDevice(path)) < 0) {
|
||||
fd = __openDevice(path);
|
||||
if (fd < 0) {
|
||||
rv = fd;
|
||||
goto out;
|
||||
}
|
||||
@@ -658,7 +659,8 @@ static void _GetStrCb(IOSError ret, void* ctxt) {
|
||||
buf = (char*)req->msg.buffer;
|
||||
buflen = req->msg.length;
|
||||
USB_LOG("GetStrCb: buf = 0x%x buflen = %u\n", buf, buflen);
|
||||
if ((len = unicode2ascii(buf, buflen)) < 0)
|
||||
len = unicode2ascii(buf, buflen);
|
||||
if (len < 0)
|
||||
USB_ERR("Failed to convert buffer from unicode 2 ascii\n");
|
||||
else
|
||||
buf[len] = '\0';
|
||||
@@ -684,7 +686,8 @@ IOSError IUSB_GetAsciiStr(IOSFd fd, u8 ep, u16 index, u16 langId, char* buf, u16
|
||||
USB_ERR("Failed __CtrlMsg: %d", rv);
|
||||
goto out;
|
||||
}
|
||||
if ((len = unicode2ascii(buf, buflen)) < 0)
|
||||
len = unicode2ascii(buf, buflen);
|
||||
if (len < 0)
|
||||
USB_ERR("Failed to convert unicode 2 ascii\n");
|
||||
else
|
||||
buf[len] = '\0';
|
||||
@@ -912,7 +915,8 @@ IOSError IUSB_DeviceInsertionNotifyAsync(const char* path, u16 vid, u16 pid, USB
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if ((fd = IOS_Open(path, 0)) < 0) {
|
||||
fd = IOS_Open(path, 0);
|
||||
if (fd < 0) {
|
||||
rv = fd;
|
||||
USB_ERR("Open(%s) failed\n", path);
|
||||
goto done;
|
||||
@@ -975,7 +979,8 @@ IOSError IUSB_DeviceClassInsertionNotifyAsync(const char* path, u8 devClass, USB
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if ((fd = IOS_Open(path, 0)) < 0) {
|
||||
fd = IOS_Open(path, 0);
|
||||
if (fd < 0) {
|
||||
rv = fd;
|
||||
OSReport("Open(%s) failed\n", path);
|
||||
goto done;
|
||||
|
||||
@@ -34,11 +34,11 @@ typedef struct WADBroadOnHeader {
|
||||
u32 headerSize;
|
||||
u32 contentOffset;
|
||||
u32 certSize;
|
||||
u32 crlSize;
|
||||
u32 ticketSize;
|
||||
u32 titleMetaSize;
|
||||
u32 metaSize;
|
||||
u32 contentSize;
|
||||
u32 fileListSize;
|
||||
u32 crlSize;
|
||||
} WADBroadOnHeader;
|
||||
|
||||
typedef struct WADUnpackInfo {
|
||||
@@ -46,22 +46,22 @@ typedef struct WADUnpackInfo {
|
||||
s32 headerInfo;
|
||||
u16 cidxMode;
|
||||
u8 reserved_0x0a[2];
|
||||
u32 size_0x0c;
|
||||
u32 offset_0x10;
|
||||
void* buffer_0x14;
|
||||
u32 size_0x18;
|
||||
u32 size_0x1c;
|
||||
u32 offset_0x20;
|
||||
void* buffer_0x24;
|
||||
u32 size_0x28;
|
||||
u32 size_0x2c;
|
||||
u32 offset_0x30;
|
||||
void* buffer_0x34;
|
||||
u32 size_0x38;
|
||||
u32 sectionSize;
|
||||
u32 sectionOffset;
|
||||
ESTitleMeta* titleMeta;
|
||||
u32 certificateSize;
|
||||
u32 certificateOffset;
|
||||
void* certificates;
|
||||
u32 certificatesAllocated;
|
||||
u32 crlSize;
|
||||
u32 crlOffset;
|
||||
void* crls;
|
||||
u32 crlsAllocated;
|
||||
u32 ticketSize;
|
||||
u32 ticketOffset;
|
||||
void* ticket;
|
||||
u32 ticketAllocated;
|
||||
u32 titleMetaSize;
|
||||
u32 titleMetaOffset;
|
||||
ESTitleMeta* titleMeta;
|
||||
u32 titleMetaAllocated;
|
||||
u32 contentSize;
|
||||
u32 contentOffset;
|
||||
u32 metaSize;
|
||||
@@ -69,7 +69,7 @@ typedef struct WADUnpackInfo {
|
||||
u32 fileListSize;
|
||||
u32 fileOffset;
|
||||
u32 fileCount;
|
||||
void* contentIndex;
|
||||
ESContentMask* contentIndex;
|
||||
void* fileNames;
|
||||
} WADUnpackInfo;
|
||||
|
||||
@@ -83,8 +83,10 @@ typedef struct WADFileHeader {
|
||||
u8 reserved_0x60[0x20];
|
||||
} WADFileHeader;
|
||||
|
||||
typedef struct WADBootImportParts {
|
||||
s32 headerInfo[2];
|
||||
typedef struct WADImportParts {
|
||||
s32 type;
|
||||
u16 cidxMode;
|
||||
u16 version;
|
||||
u32 certificateSize;
|
||||
void* certificates;
|
||||
u32 crlSize;
|
||||
@@ -93,7 +95,7 @@ typedef struct WADBootImportParts {
|
||||
void* ticket;
|
||||
u32 titleMetaSize;
|
||||
void* titleMeta;
|
||||
} WADBootImportParts;
|
||||
} WADImportParts;
|
||||
|
||||
typedef struct WADBackupFileHeader {
|
||||
u32 magic;
|
||||
@@ -399,6 +401,7 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
|
||||
s32 result;
|
||||
BOOL streamOpened;
|
||||
u32 index;
|
||||
/* MWCC needs these buffer lifetimes to preserve the original cleanup branches. */
|
||||
void* secondBuffer;
|
||||
void* firstBuffer;
|
||||
WADFileEntry* allocatedFiles;
|
||||
@@ -437,7 +440,7 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
|
||||
titleMeta = workspace.unpackInfo.titleMeta;
|
||||
if (titleMeta != 0) {
|
||||
if (skipTitleMeta == 0) {
|
||||
blocks->unkBlocks += (workspace.unpackInfo.sectionSize + 0x3FFF) >> 14;
|
||||
blocks->unkBlocks += (workspace.unpackInfo.titleMetaSize + 0x3FFF) >> 14;
|
||||
blocks->unkInodes = 1;
|
||||
}
|
||||
if (workspace.unpackInfo.cidxMode >= 1) {
|
||||
@@ -689,24 +692,24 @@ s32 WADImportEx(char* path, MEMAllocator* allocator, WADLocation location, u32 o
|
||||
goto cleanup;
|
||||
}
|
||||
result = 0;
|
||||
result = ES_ImportBoot(unpackInfo.buffer_0x34,
|
||||
unpackInfo.buffer_0x14,
|
||||
unpackInfo.size_0x0c,
|
||||
result = ES_ImportBoot(unpackInfo.ticket,
|
||||
unpackInfo.certificates,
|
||||
unpackInfo.certificateSize,
|
||||
unpackInfo.titleMeta,
|
||||
unpackInfo.sectionSize,
|
||||
unpackInfo.buffer_0x14,
|
||||
unpackInfo.size_0x0c,
|
||||
unpackInfo.buffer_0x24,
|
||||
unpackInfo.size_0x1c, readBuffer,
|
||||
unpackInfo.titleMetaSize,
|
||||
unpackInfo.certificates,
|
||||
unpackInfo.certificateSize,
|
||||
unpackInfo.crls,
|
||||
unpackInfo.crlSize, readBuffer,
|
||||
size);
|
||||
goto cleanup;
|
||||
}
|
||||
if (unpackInfo.buffer_0x34 != 0) {
|
||||
result = ES_ImportTicket(unpackInfo.buffer_0x34,
|
||||
unpackInfo.buffer_0x14,
|
||||
unpackInfo.size_0x0c,
|
||||
unpackInfo.buffer_0x24,
|
||||
unpackInfo.size_0x1c, unpackInfo.headerInfo);
|
||||
if (unpackInfo.ticket != 0) {
|
||||
result = ES_ImportTicket(unpackInfo.ticket,
|
||||
unpackInfo.certificates,
|
||||
unpackInfo.certificateSize,
|
||||
unpackInfo.crls,
|
||||
unpackInfo.crlSize, unpackInfo.headerInfo);
|
||||
if (result != 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -726,7 +729,7 @@ s32 WADImportEx(char* path, MEMAllocator* allocator, WADLocation location, u32 o
|
||||
contentCount = titleMeta->head.numContents;
|
||||
}
|
||||
result = ES_ListTmdContentsOnCard(titleMeta,
|
||||
unpackInfo.sectionSize, 0,
|
||||
unpackInfo.titleMetaSize, 0,
|
||||
&installedContentCount);
|
||||
if ((result == 0) && (installedContentCount != 0)) {
|
||||
installedContentIds = _WADMemAlloc(allocator, installedContentCount * sizeof(ESContentId));
|
||||
@@ -735,21 +738,22 @@ s32 WADImportEx(char* path, MEMAllocator* allocator, WADLocation location, u32 o
|
||||
goto cleanup;
|
||||
}
|
||||
result = ES_ListTmdContentsOnCard(titleMeta,
|
||||
unpackInfo.sectionSize,
|
||||
unpackInfo.titleMetaSize,
|
||||
installedContentIds, &installedContentCount);
|
||||
if ((result == 0) &&
|
||||
((result = ES_GetTmd(titleMeta->head.titleId, 0,
|
||||
&installedTmdSize)) == 0)) {
|
||||
alignedSize = (installedTmdSize + 0x1F) & ~0x1F;
|
||||
installedTitleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (installedTitleMeta == 0) {
|
||||
result = -3003;
|
||||
goto cleanup;
|
||||
}
|
||||
result = ES_GetTmd(titleMeta->head.titleId,
|
||||
installedTitleMeta, &installedTmdSize);
|
||||
if (result == 0) {
|
||||
result = ES_GetTmd(titleMeta->head.titleId, 0, &installedTmdSize);
|
||||
if (result == 0) {
|
||||
importExistingTitle = FALSE;
|
||||
alignedSize = (installedTmdSize + 0x1F) & ~0x1F;
|
||||
installedTitleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (installedTitleMeta == 0) {
|
||||
result = -3003;
|
||||
goto cleanup;
|
||||
}
|
||||
result = ES_GetTmd(titleMeta->head.titleId,
|
||||
installedTitleMeta, &installedTmdSize);
|
||||
if (result == 0) {
|
||||
importExistingTitle = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -787,11 +791,11 @@ s32 WADImportEx(char* path, MEMAllocator* allocator, WADLocation location, u32 o
|
||||
}
|
||||
}
|
||||
result = ES_ImportTitleInit(titleMeta,
|
||||
unpackInfo.sectionSize,
|
||||
unpackInfo.buffer_0x14,
|
||||
unpackInfo.size_0x0c,
|
||||
unpackInfo.buffer_0x24,
|
||||
unpackInfo.size_0x1c,
|
||||
unpackInfo.titleMetaSize,
|
||||
unpackInfo.certificates,
|
||||
unpackInfo.certificateSize,
|
||||
unpackInfo.crls,
|
||||
unpackInfo.crlSize,
|
||||
unpackInfo.headerInfo, 1);
|
||||
if (result != 0) {
|
||||
goto cleanup;
|
||||
@@ -1644,7 +1648,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
streamResult = WADWriteStream(&stream, fileHeaderBuffer, size);
|
||||
if ((u32)streamResult != size) {
|
||||
result = -3006;
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
result = 0;
|
||||
importedSize += sizeof(WADBackupHeaderBlock);
|
||||
@@ -1655,7 +1659,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
result = NANDPrivateOpen(fileHeaderBuffer->name, &savedFile, NAND_ACCESS_READ);
|
||||
fileOpened = TRUE;
|
||||
if (result != 0) {
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
byteCount = (fileHeaderBuffer->fileSize + 0x1F) & ~0x1F;
|
||||
while (byteCount != 0) {
|
||||
@@ -1667,13 +1671,13 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
length = NANDRead(&savedFile, encryptionBuffer, size);
|
||||
if (((length + 0x1F) & ~0x1F) != size) {
|
||||
result = -3005;
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
result = 0;
|
||||
result = ES_Encrypt(6, fileHeaderBuffer->iv, encryptionBuffer, size,
|
||||
outputBuffer);
|
||||
if (result != 0) {
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
result = SHA1Input(hashContext, outputBuffer, size);
|
||||
if (result != 0) {
|
||||
@@ -1682,7 +1686,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
streamResult = WADWriteStream(&stream, outputBuffer, size);
|
||||
if ((u32)streamResult != size) {
|
||||
result = -3006;
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
result = 0;
|
||||
importedSize += size;
|
||||
@@ -1694,7 +1698,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
result = NANDClose(&savedFile);
|
||||
fileOpened = FALSE;
|
||||
if (result != 0) {
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
{
|
||||
u32 roundedSize = (fileHeaderBuffer->fileSize + 0x1F) & ~0x1F;
|
||||
@@ -1711,7 +1715,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
size);
|
||||
if ((u32)streamResult != size) {
|
||||
result = -3006;
|
||||
goto file_done;
|
||||
goto cleanupFile;
|
||||
}
|
||||
result = 0;
|
||||
importedSize += size;
|
||||
@@ -1723,7 +1727,7 @@ s32 WADBackupEx(u64 titleId, u32 flags, MEMAllocator* allocator, char* path, u32
|
||||
} else if (fileHeaderBuffer->flags[2] == NAND_TYPE_FILE) {
|
||||
byteCount = 0;
|
||||
}
|
||||
file_done:
|
||||
cleanupFile:
|
||||
if (fileOpened) {
|
||||
NANDClose(&savedFile);
|
||||
}
|
||||
@@ -1863,7 +1867,7 @@ static s32 _WADCheckContents(ESTmdView* titleMeta, ESContentMask* contentMask) {
|
||||
if (installedIndex == installedContentCount) {
|
||||
if ((titleMeta->contents[contentIndex].type & 0x4000) == 0) {
|
||||
result = -3002;
|
||||
goto done;
|
||||
break;
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
@@ -1871,10 +1875,10 @@ static s32 _WADCheckContents(ESTmdView* titleMeta, ESContentMask* contentMask) {
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MWCC keeps allocator calls out of line in the original callers. */
|
||||
#pragma dont_inline on
|
||||
static void* _WADMemAlloc(MEMAllocator* allocator, u32 size) {
|
||||
s32 allocationKind;
|
||||
@@ -1992,7 +1996,6 @@ s32 WADOpenStream(WADLocation location, const char* path, WADStream* stream, u32
|
||||
|
||||
case WAD_LOCATION_DVD:
|
||||
{
|
||||
s32 result;
|
||||
if (write != 0) {
|
||||
return -3004;
|
||||
}
|
||||
@@ -2298,7 +2301,6 @@ static s32 WAD_815C2F44(WADHeader* header, s32* headerInfo) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
static s32 _WADUnpack(void* header, WADStream* stream, WADUnpackInfo* info, MEMAllocator* allocator,
|
||||
u32 offset, u32 flags, u32 mode) {
|
||||
s32 result;
|
||||
@@ -2325,7 +2327,6 @@ static s32 _WADUnpack(void* header, WADStream* stream, WADUnpackInfo* info, MEMA
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
static s32 _WADUnpackIRD(WADHeader* header, WADStream* stream, WADUnpackInfo* info,
|
||||
MEMAllocator* allocator, u32 offset, u32 mode) {
|
||||
@@ -2356,17 +2357,17 @@ static s32 _WADUnpackIRD(WADHeader* header, WADStream* stream, WADUnpackInfo* in
|
||||
|
||||
sectionSize = header->certSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x0c = sectionSize;
|
||||
info->offset_0x10 = sectionOffset;
|
||||
info->certificateSize = sectionSize;
|
||||
info->certificateOffset = sectionOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x14 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x14 == 0) {
|
||||
info->certificates = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->certificates == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x18 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x14, alignedSize,
|
||||
offset + info->offset_0x10);
|
||||
info->certificatesAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->certificates, alignedSize,
|
||||
offset + info->certificateOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2375,17 +2376,17 @@ static s32 _WADUnpackIRD(WADHeader* header, WADStream* stream, WADUnpackInfo* in
|
||||
}
|
||||
sectionSize = header->crlSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x1c = sectionSize;
|
||||
info->offset_0x20 = sectionOffset;
|
||||
info->crlSize = sectionSize;
|
||||
info->crlOffset = sectionOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x24 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x24 == 0) {
|
||||
info->crls = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->crls == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x28 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x24, alignedSize,
|
||||
offset + info->offset_0x20);
|
||||
info->crlsAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->crls, alignedSize,
|
||||
offset + info->crlOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2394,17 +2395,17 @@ static s32 _WADUnpackIRD(WADHeader* header, WADStream* stream, WADUnpackInfo* in
|
||||
}
|
||||
sectionSize = header->ticketSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x2c = sectionSize;
|
||||
info->offset_0x30 = sectionOffset;
|
||||
info->ticketSize = sectionSize;
|
||||
info->ticketOffset = sectionOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x34 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x34 == 0) {
|
||||
info->ticket = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->ticket == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x38 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x34, alignedSize,
|
||||
offset + info->offset_0x30);
|
||||
info->ticketAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->ticket, alignedSize,
|
||||
offset + info->ticketOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2413,16 +2414,16 @@ static s32 _WADUnpackIRD(WADHeader* header, WADStream* stream, WADUnpackInfo* in
|
||||
}
|
||||
sectionSize = header->tmdSize;
|
||||
if (sectionSize != 0) {
|
||||
info->sectionSize = sectionSize;
|
||||
info->sectionOffset = sectionOffset;
|
||||
info->titleMetaSize = sectionSize;
|
||||
info->titleMetaOffset = sectionOffset;
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->titleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->titleMeta == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->titleMetaSize = 1;
|
||||
info->titleMetaAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, (void**)&info->titleMeta, alignedSize,
|
||||
offset + info->sectionOffset);
|
||||
offset + info->titleMetaOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2447,24 +2448,24 @@ static s32 _WADUnpackBroadOn(WADBroadOnHeader* header, WADStream* stream, WADUnp
|
||||
s32 alignedSize;
|
||||
s32 bytesRead;
|
||||
|
||||
if ((header->crlSize == 0) && (header->ticketSize == 0)) {
|
||||
if ((header->ticketSize == 0) && (header->titleMetaSize == 0)) {
|
||||
return -3001;
|
||||
}
|
||||
|
||||
currentOffset = header->headerSize;
|
||||
sectionSize = header->certSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x0c = sectionSize;
|
||||
info->offset_0x10 = currentOffset;
|
||||
info->certificateSize = sectionSize;
|
||||
info->certificateOffset = currentOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x14 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x14 == 0) {
|
||||
info->certificates = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->certificates == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x18 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x14, alignedSize,
|
||||
offset + info->offset_0x10);
|
||||
info->certificatesAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->certificates, alignedSize,
|
||||
offset + info->certificateOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2472,64 +2473,64 @@ static s32 _WADUnpackBroadOn(WADBroadOnHeader* header, WADStream* stream, WADUnp
|
||||
currentOffset += header->certSize;
|
||||
}
|
||||
|
||||
sectionSize = header->crlSize;
|
||||
sectionSize = header->ticketSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x2c = sectionSize;
|
||||
info->offset_0x30 = currentOffset;
|
||||
info->ticketSize = sectionSize;
|
||||
info->ticketOffset = currentOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x34 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x34 == 0) {
|
||||
info->ticket = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->ticket == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x38 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x34, alignedSize,
|
||||
offset + info->offset_0x30);
|
||||
info->ticketAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->ticket, alignedSize,
|
||||
offset + info->ticketOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
}
|
||||
currentOffset += header->crlSize;
|
||||
}
|
||||
|
||||
sectionSize = header->ticketSize;
|
||||
if (sectionSize != 0) {
|
||||
info->sectionSize = sectionSize;
|
||||
info->sectionOffset = currentOffset;
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->titleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->titleMeta == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->titleMetaSize = 1;
|
||||
bytesRead = WADReadStream(stream, (void**)&info->titleMeta, alignedSize,
|
||||
offset + info->sectionOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
currentOffset += header->ticketSize;
|
||||
}
|
||||
|
||||
sectionSize = header->titleMetaSize;
|
||||
if (sectionSize != 0) {
|
||||
info->metaSize = sectionSize;
|
||||
info->metaOffset = currentOffset;
|
||||
info->titleMetaSize = sectionSize;
|
||||
info->titleMetaOffset = currentOffset;
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->titleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->titleMeta == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->titleMetaAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, (void**)&info->titleMeta, alignedSize,
|
||||
offset + info->titleMetaOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
currentOffset += header->titleMetaSize;
|
||||
}
|
||||
|
||||
sectionSize = header->fileListSize;
|
||||
sectionSize = header->metaSize;
|
||||
if (sectionSize != 0) {
|
||||
info->size_0x1c = sectionSize;
|
||||
info->offset_0x20 = currentOffset;
|
||||
info->metaSize = sectionSize;
|
||||
info->metaOffset = currentOffset;
|
||||
currentOffset += header->metaSize;
|
||||
}
|
||||
|
||||
sectionSize = header->crlSize;
|
||||
if (sectionSize != 0) {
|
||||
info->crlSize = sectionSize;
|
||||
info->crlOffset = currentOffset;
|
||||
if (mode == 0) {
|
||||
alignedSize = WAD_ALIGN32(sectionSize);
|
||||
info->buffer_0x24 = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->buffer_0x24 == 0) {
|
||||
info->crls = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->crls == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->size_0x28 = 1;
|
||||
bytesRead = WADReadStream(stream, &info->buffer_0x24, alignedSize,
|
||||
offset + info->offset_0x20);
|
||||
info->crlsAllocated = 1;
|
||||
bytesRead = WADReadStream(stream, &info->crls, alignedSize,
|
||||
offset + info->crlOffset);
|
||||
if (bytesRead != alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2578,16 +2579,16 @@ static s32 _WADUnpackBackup(WADHeader* header, WADStream* stream, WADUnpackInfo*
|
||||
|
||||
if (titleMetaSize != 0) {
|
||||
if ((flags & 4) == 0) {
|
||||
info->sectionSize = titleMetaSize;
|
||||
info->sectionOffset = sectionOffset;
|
||||
info->titleMetaSize = titleMetaSize;
|
||||
info->titleMetaOffset = sectionOffset;
|
||||
alignedSize = WAD_ALIGN32(titleMetaSize);
|
||||
info->titleMeta = _WADMemAlloc(allocator, alignedSize);
|
||||
if (info->titleMeta == 0) {
|
||||
return -3003;
|
||||
}
|
||||
info->titleMetaSize = 1;
|
||||
info->titleMetaAllocated = 1;
|
||||
result = WADReadStream(stream, (void**)&info->titleMeta, alignedSize,
|
||||
offset + info->sectionOffset);
|
||||
offset + info->titleMetaOffset);
|
||||
if (result != (s32)alignedSize) {
|
||||
return -3005;
|
||||
}
|
||||
@@ -2622,6 +2623,7 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MWCC needs these content and backup helpers out of line to preserve caller code. */
|
||||
#pragma dont_inline on
|
||||
s32 _WADGetCidxCount(const ESContentMask* contentMask) {
|
||||
u32 bitIndex;
|
||||
@@ -2731,6 +2733,7 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
result = -3003;
|
||||
goto cleanup;
|
||||
}
|
||||
/* MWCC needs the repeated check to preserve the original error path. */
|
||||
if (nameList == 0) {
|
||||
result = -3003;
|
||||
goto cleanup;
|
||||
@@ -2765,24 +2768,24 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
}
|
||||
result = NANDPrivateGetType(fullFilePath, &fileType);
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
if ((flags & 0x10) == 0) {
|
||||
if (absolutePaths && strcmp(directoryPath, ".") == 0) {
|
||||
snprintf(noCopyPath, sizeof(noCopyPath), "%s/%s", currentDirectory, "nocopy");
|
||||
snprintf(bannerPath, sizeof(bannerPath), "%s/%s", currentDirectory, "banner.bin");
|
||||
if (strcmp(fullFilePath, noCopyPath) == 0 && fileType == NAND_TYPE_DIR) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
if (strcmp(fullFilePath, bannerPath) == 0 && fileType == NAND_TYPE_FILE) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
} else {
|
||||
if (strcmp(fullFilePath, "nocopy") == 0 && fileType == NAND_TYPE_DIR) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
if (strcmp(fullFilePath, "banner.bin") == 0 && fileType == NAND_TYPE_FILE) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2790,20 +2793,20 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
result = NANDPrivateOpen(fullFilePath, &fileInfo, NAND_ACCESS_READ);
|
||||
closeFile = TRUE;
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
result = NANDGetLength(&fileInfo, &fileSize);
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
result = NANDClose(&fileInfo);
|
||||
closeFile = FALSE;
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
} else if (fileType == NAND_TYPE_DIR) {
|
||||
if ((flags & 8) == 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
fileSize = 0;
|
||||
if (files != 0) {
|
||||
@@ -2812,7 +2815,7 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
}
|
||||
result = NANDPrivateGetStatus(fullFilePath, &status);
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
if (files != 0) {
|
||||
file->magic = 0x3ADF17E;
|
||||
@@ -2842,7 +2845,7 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
}
|
||||
result = _WADBackupGetFiles(fullFilePath, flags, allocator, &childFileCount, children);
|
||||
if (result != 0) {
|
||||
goto nextName;
|
||||
goto cleanupName;
|
||||
}
|
||||
if (childFileCount != 0) {
|
||||
if (files != 0) {
|
||||
@@ -2851,7 +2854,7 @@ static s32 _WADBackupGetFiles(const char* directoryPath, u32 flags, MEMAllocator
|
||||
totalFiles += childFileCount;
|
||||
}
|
||||
}
|
||||
nextName:
|
||||
cleanupName:
|
||||
nameIndex++;
|
||||
name += strlen(name) + 1;
|
||||
if (closeFile) {
|
||||
@@ -2921,19 +2924,19 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
|
||||
|
||||
|
||||
static void _WADFreeMemory(WADUnpackInfo* info, MEMAllocator* allocator) {
|
||||
if ((info->size_0x18 != 0) && (info->buffer_0x14 != 0)) {
|
||||
_WADMemFree(allocator, info->buffer_0x14);
|
||||
info->buffer_0x14 = 0;
|
||||
if ((info->certificatesAllocated != 0) && (info->certificates != 0)) {
|
||||
_WADMemFree(allocator, info->certificates);
|
||||
info->certificates = 0;
|
||||
}
|
||||
if ((info->size_0x28 != 0) && (info->buffer_0x24 != 0)) {
|
||||
_WADMemFree(allocator, info->buffer_0x24);
|
||||
info->buffer_0x24 = 0;
|
||||
if ((info->crlsAllocated != 0) && (info->crls != 0)) {
|
||||
_WADMemFree(allocator, info->crls);
|
||||
info->crls = 0;
|
||||
}
|
||||
if ((info->size_0x38 != 0) && (info->buffer_0x34 != 0)) {
|
||||
_WADMemFree(allocator, info->buffer_0x34);
|
||||
info->buffer_0x34 = 0;
|
||||
if ((info->ticketAllocated != 0) && (info->ticket != 0)) {
|
||||
_WADMemFree(allocator, info->ticket);
|
||||
info->ticket = 0;
|
||||
}
|
||||
if ((info->titleMetaSize != 0) && (info->titleMeta != 0)) {
|
||||
if ((info->titleMetaAllocated != 0) && (info->titleMeta != 0)) {
|
||||
_WADMemFree(allocator, info->titleMeta);
|
||||
info->titleMeta = 0;
|
||||
}
|
||||
@@ -3165,6 +3168,7 @@ cleanup:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MWCC keeps transfer initialization out of line in the original callers. */
|
||||
#pragma dont_inline on
|
||||
void WAD_815C4A2C(WADImportTransfer* transfer, void* firstBuffer, void* secondBuffer,
|
||||
u32 chunkSize) {
|
||||
@@ -3183,6 +3187,7 @@ void WAD_815C4A2C(WADImportTransfer* transfer, void* firstBuffer, void* secondBu
|
||||
}
|
||||
#pragma dont_inline reset
|
||||
|
||||
/* MWCC needs separate termination checks to preserve the savedata validation loops. */
|
||||
#pragma dont_inline on
|
||||
static u32 _WADIsTerminated(const char* text, u32 maxLength) {
|
||||
u32 index;
|
||||
@@ -3226,22 +3231,12 @@ s32 WADCheckSavedataZD(const WADSaveDataFile* saveData) {
|
||||
record = saveData->primary;
|
||||
index = 0;
|
||||
do {
|
||||
if (!_WADIsTerminated(record->fileName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->bannerName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->saveName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->titleName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->description, 0x11)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->subtitle, 0x11)) {
|
||||
if (!_WADIsTerminated(record->fileName, 8) ||
|
||||
!_WADIsTerminated(record->bannerName, 8) ||
|
||||
!_WADIsTerminated(record->saveName, 8) ||
|
||||
!_WADIsTerminated(record->titleName, 8) ||
|
||||
!_WADIsTerminated(record->description, 0x11) ||
|
||||
!_WADIsTerminated(record->subtitle, 0x11)) {
|
||||
goto done;
|
||||
}
|
||||
index++;
|
||||
@@ -3249,22 +3244,12 @@ s32 WADCheckSavedataZD(const WADSaveDataFile* saveData) {
|
||||
} while (index < 3);
|
||||
record = saveData->secondary;
|
||||
for (index = 0; index < 3; index++, record++) {
|
||||
if (!_WADIsTerminated(record->fileName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->bannerName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->saveName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->titleName, 8)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->description, 0x11)) {
|
||||
goto done;
|
||||
}
|
||||
if (!_WADIsTerminated(record->subtitle, 0x11)) {
|
||||
if (!_WADIsTerminated(record->fileName, 8) ||
|
||||
!_WADIsTerminated(record->bannerName, 8) ||
|
||||
!_WADIsTerminated(record->saveName, 8) ||
|
||||
!_WADIsTerminated(record->titleName, 8) ||
|
||||
!_WADIsTerminated(record->description, 0x11) ||
|
||||
!_WADIsTerminated(record->subtitle, 0x11)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -3397,7 +3382,7 @@ static s32 _WADCleanTmpDir(MEMAllocator* allocator) {
|
||||
|
||||
s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
|
||||
DVDFileInfo fileInfo;
|
||||
WADBootImportParts parts;
|
||||
WADImportParts parts;
|
||||
WADHeader* header;
|
||||
u8* readBuffer;
|
||||
BOOL fileOpened = FALSE;
|
||||
@@ -3433,14 +3418,14 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
|
||||
|
||||
memset(&parts, 0, sizeof(parts));
|
||||
header = (WADHeader*)readBuffer;
|
||||
result = WAD_815C2F44(header, parts.headerInfo);
|
||||
result = WAD_815C2F44(header, &parts.type);
|
||||
if (result != 2) {
|
||||
OSReport("%s:%d Format should be iRD format: %s\n", __func__, 0x17D2,
|
||||
path);
|
||||
result = -3000;
|
||||
goto cleanup;
|
||||
}
|
||||
if (parts.headerInfo[0] == 3) {
|
||||
if (parts.type == 3) {
|
||||
sectionOffset = (header->hdrSize + 0x3F) & ~0x3F;
|
||||
if (header->certSize != 0) {
|
||||
parts.certificateSize = header->certSize;
|
||||
@@ -3496,19 +3481,7 @@ cleanup:
|
||||
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
|
||||
WADHeader header ALIGN32;
|
||||
DVDFileInfo fileInfo;
|
||||
struct {
|
||||
s32 type;
|
||||
u16 cidxMode;
|
||||
u16 version;
|
||||
u32 certificateSize;
|
||||
void* certificates;
|
||||
u32 crlSize;
|
||||
void* crls;
|
||||
u32 ticketSize;
|
||||
void* ticket;
|
||||
u32 titleMetaSize;
|
||||
void* titleMeta;
|
||||
} parts;
|
||||
WADImportParts parts;
|
||||
BOOL fileOpened = FALSE;
|
||||
s32 result;
|
||||
u8* contentBuffer;
|
||||
@@ -3531,6 +3504,7 @@ s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
|
||||
return -3004;
|
||||
}
|
||||
fileOpened = TRUE;
|
||||
/* MWCC needs this repeated check to preserve the DVD import error path. */
|
||||
if (buffer == NULL) {
|
||||
result = -3003;
|
||||
goto cleanup;
|
||||
|
||||
@@ -168,72 +168,86 @@ static const u32 AESiDecryptTable[] = {
|
||||
0xa8017139, 0xcb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0
|
||||
};
|
||||
|
||||
#define ROTATE(x,n) (((x) << (n)) | ((x) >> (32 - (n))))
|
||||
#define ENCRYPT(state0,state1,state2,state3) (((ROTATE(AESiEncryptTable[((state1)>>16)&255],16) ^ ROTATE(AESiEncryptTable[(state0)>>24],24)) ^ AESiEncryptTable[(state3)&255]) ^ ROTATE(AESiEncryptTable[((state2)>>8)&255],8))
|
||||
#define DECRYPT(state0,state1,state2,state3) (((ROTATE(AESiDecryptTable[((state1)>>16)&255],16) ^ AESiDecryptTable[(state3)&255]) ^ ROTATE(AESiDecryptTable[(state0)>>24],24)) ^ ROTATE(AESiDecryptTable[((state2)>>8)&255],8))
|
||||
#define SUBSTITUTE(table,state0,state1,state2,state3) ((((u32)table[(state0)>>24]<<24) | table[(state3)&255]) | (((u32)table[((state1)>>16)&255]<<16) | ((u32)table[((state2)>>8)&255]<<8)))
|
||||
|
||||
#define DECRYPT_FINAL(table,state0,state1,state2,state3,key) ((table[(state3)&255] ^ ((u32)table[((state2)>>8)&255]<<8)) ^ (((u32)table[((state1)>>16)&255]<<16) ^ ((key) ^ ((u32)table[(state0)>>24]<<24))))
|
||||
#define ROTATE(x, n) __rlwinm((x), (n), 0, 31)
|
||||
#define ROUND_WORD(table, a, b, c, d) (ROTATE(table[(a) >> 24], 24) ^ ROTATE(table[((b) >> 16) & 255], 16) ^ ROTATE(table[((c) >> 8) & 255], 8) ^ table[(d) & 255])
|
||||
#define SUBSTITUTE_WORD(table, a, b, c, d) (((u32)table[(a) >> 24] << 24) | ((u32)table[((b) >> 16) & 255] << 16) | ((u32)table[((c) >> 8) & 255] << 8) | table[(d) & 255])
|
||||
#define DOUBLE_BYTES(x) ((((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b))
|
||||
|
||||
void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
|
||||
const u32* key = context->keys;
|
||||
u32 rounds = context->rounds;
|
||||
const u32* key = context->keys + 4;
|
||||
u32 state0=input[0]^context->keys[0], state1=input[1]^context->keys[1], state2=input[2]^context->keys[2], state3=input[3]^context->keys[3];
|
||||
u32 state0 = input[0];
|
||||
u32 state1 = input[1];
|
||||
u32 state2 = input[2];
|
||||
u32 state3 = input[3];
|
||||
state0 ^= key[0];
|
||||
state1 ^= key[1];
|
||||
state2 ^= key[2];
|
||||
state3 ^= key[3];
|
||||
key += 4;
|
||||
while (--rounds != 0) {
|
||||
u32 nextState0=ENCRYPT(state0,state1,state2,state3);
|
||||
u32 nextState1=ENCRYPT(state1,state2,state3,state0);
|
||||
u32 nextState2=ENCRYPT(state2,state3,state0,state1);
|
||||
u32 nextState3=ENCRYPT(state3,state0,state1,state2);
|
||||
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
|
||||
u32 next0 = ROUND_WORD(AESiEncryptTable, state0, state1, state2, state3);
|
||||
u32 next1 = ROUND_WORD(AESiEncryptTable, state1, state2, state3, state0);
|
||||
u32 next2 = ROUND_WORD(AESiEncryptTable, state2, state3, state0, state1);
|
||||
u32 next3 = ROUND_WORD(AESiEncryptTable, state3, state0, state1, state2);
|
||||
state0 = next0 ^ key[0];
|
||||
state1 = next1 ^ key[1];
|
||||
state2 = next2 ^ key[2];
|
||||
state3 = next3 ^ key[3];
|
||||
key += 4;
|
||||
}
|
||||
output[0] = SUBSTITUTE(AESiSubShiftTable,state0,state1,state2,state3)^key[0];
|
||||
output[1] = SUBSTITUTE(AESiSubShiftTable,state1,state2,state3,state0)^key[1];
|
||||
output[2] = SUBSTITUTE(AESiSubShiftTable,state2,state3,state0,state1)^key[2];
|
||||
output[3] = SUBSTITUTE(AESiSubShiftTable,state3,state0,state1,state2)^key[3];
|
||||
output[0] = SUBSTITUTE_WORD(AESiSubShiftTable, state0, state1, state2, state3) ^ key[0];
|
||||
output[1] = SUBSTITUTE_WORD(AESiSubShiftTable, state1, state2, state3, state0) ^ key[1];
|
||||
output[2] = SUBSTITUTE_WORD(AESiSubShiftTable, state2, state3, state0, state1) ^ key[2];
|
||||
output[3] = SUBSTITUTE_WORD(AESiSubShiftTable, state3, state0, state1, state2) ^ key[3];
|
||||
}
|
||||
|
||||
#define DOUBLE_BYTES(x) ((((x)&0x7f7f7f7f)<<1) ^ ((((x)&0x80808080)>>7)*0x1b))
|
||||
static inline void AESiInvMixColumn(u32* word) {
|
||||
u32 value = *word;
|
||||
u32 timesTwo = DOUBLE_BYTES(value);
|
||||
u32 timesFour = DOUBLE_BYTES(timesTwo);
|
||||
u32 mixed = DOUBLE_BYTES(timesFour) ^ value;
|
||||
mixed ^= timesFour ^ ROTATE(mixed, 8);
|
||||
mixed ^= timesTwo ^ ROTATE(mixed, 8);
|
||||
mixed ^= value ^ ROTATE(mixed, 8);
|
||||
*word = mixed;
|
||||
}
|
||||
|
||||
void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
|
||||
u32 rounds=context->rounds;
|
||||
u32* key=context->keys;
|
||||
u32 state1;
|
||||
u32 state0;
|
||||
u32 state2;
|
||||
u32 state3;
|
||||
key += rounds*4;
|
||||
u32* key = context->keys;
|
||||
u32 rounds = context->rounds;
|
||||
u32 state0, state1, state2, state3;
|
||||
key += rounds * 4;
|
||||
if (context->needsTransform) {
|
||||
u32 round;
|
||||
for (round=1; round<context->rounds; ++round) {
|
||||
for (round = 1; round < context->rounds; round++) {
|
||||
u32 word;
|
||||
for (word=0; word<4; ++word) {
|
||||
u32 value=context->keys[round*4 + word];
|
||||
u32 timesTwo=DOUBLE_BYTES(value);
|
||||
u32 timesFour=DOUBLE_BYTES(timesTwo);
|
||||
u32 timesNine=DOUBLE_BYTES(timesFour)^value;
|
||||
u32 mixed=(ROTATE(timesNine,8) ^ (timesNine ^ timesFour));
|
||||
mixed=(ROTATE(mixed,8) ^ (mixed ^ timesTwo));
|
||||
mixed=(ROTATE(mixed,8) ^ (mixed ^ value));
|
||||
context->keys[round*4 + word]=mixed;
|
||||
for (word = 0; word < 4; word++) {
|
||||
AESiInvMixColumn(&context->keys[round * 4 + word]);
|
||||
}
|
||||
}
|
||||
context->needsTransform=0;
|
||||
context->needsTransform = 0;
|
||||
}
|
||||
state0=input[0]^key[0]; state1=input[1]^key[1]; state2=input[2]^key[2]; state3=input[3]^key[3];
|
||||
key-=4;
|
||||
state0 = input[0] ^ key[0];
|
||||
state1 = input[1] ^ key[1];
|
||||
state2 = input[2] ^ key[2];
|
||||
state3 = input[3] ^ key[3];
|
||||
key -= 4;
|
||||
while (--rounds != 0) {
|
||||
u32 nextState0=DECRYPT(state0,state3,state2,state1);
|
||||
u32 nextState1=DECRYPT(state1,state0,state3,state2);
|
||||
u32 nextState2=DECRYPT(state2,state1,state0,state3);
|
||||
u32 nextState3=DECRYPT(state3,state2,state1,state0);
|
||||
state0=nextState0^key[0]; state1=nextState1^key[1]; state2=nextState2^key[2]; state3=nextState3^key[3];
|
||||
key-=4;
|
||||
u32 next0 = ROUND_WORD(AESiDecryptTable, state0, state3, state2, state1);
|
||||
u32 next1 = ROUND_WORD(AESiDecryptTable, state1, state0, state3, state2);
|
||||
u32 next2 = ROUND_WORD(AESiDecryptTable, state2, state1, state0, state3);
|
||||
u32 next3 = ROUND_WORD(AESiDecryptTable, state3, state2, state1, state0);
|
||||
state0 = next0 ^ key[0];
|
||||
state1 = next1 ^ key[1];
|
||||
state2 = next2 ^ key[2];
|
||||
state3 = next3 ^ key[3];
|
||||
key -= 4;
|
||||
}
|
||||
output[0]=DECRYPT_FINAL(AESiInvSubShiftTable,state0,state3,state2,state1,key[0]);
|
||||
output[1]=DECRYPT_FINAL(AESiInvSubShiftTable,state1,state0,state3,state2,key[1]);
|
||||
output[2]=DECRYPT_FINAL(AESiInvSubShiftTable,state2,state1,state0,state3,key[2]);
|
||||
output[3]=DECRYPT_FINAL(AESiInvSubShiftTable,state3,state2,state1,state0,key[3]);
|
||||
output[0] = key[0] ^ ((u32)AESiInvSubShiftTable[state0 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state3 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state2 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state1 & 255];
|
||||
output[1] = key[1] ^ ((u32)AESiInvSubShiftTable[state1 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state0 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state3 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state2 & 255];
|
||||
output[2] = key[2] ^ ((u32)AESiInvSubShiftTable[state2 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state1 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state0 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state3 & 255];
|
||||
output[3] = key[3] ^ ((u32)AESiInvSubShiftTable[state3 >> 24] << 24) ^ ((u32)AESiInvSubShiftTable[(state2 >> 16) & 255] << 16) ^ ((u32)AESiInvSubShiftTable[(state1 >> 8) & 255] << 8) ^ AESiInvSubShiftTable[state0 & 255];
|
||||
}
|
||||
|
||||
BOOL NETAESCreateEx(AESContext* context, const void* key, u32 keyLength, const void* iv, const AESBlockMode* mode) {
|
||||
|
||||
@@ -199,6 +199,7 @@ NWC24Err NWC24SetMsgSubjectPublic(NWC24MsgObj* msg, const u16* subject, u32 subj
|
||||
|
||||
nwcWork = NWC24WorkP;
|
||||
result = NWC24iDetectEncodingToSend(nwcWork->stringWork, 0x40, subject, subjectSize, NULL, 0, region);
|
||||
/* MWCC needs the success-only switches to retain their extra branches. */
|
||||
switch (result) {
|
||||
case NWC24_OK:
|
||||
break;
|
||||
@@ -206,29 +207,29 @@ NWC24Err NWC24SetMsgSubjectPublic(NWC24MsgObj* msg, const u16* subject, u32 subj
|
||||
goto done;
|
||||
}
|
||||
if (NWC24ParseCharsetStr(&charset, nwcWork->stringWork) != NWC24_OK) {
|
||||
charset = 0;
|
||||
charset = NWC24_US_ASCII;
|
||||
}
|
||||
if (charset == 0) {
|
||||
if (charset == NWC24_US_ASCII) {
|
||||
result = NWC24iSetMsgSubjectPlain(msg, subject, subjectSize, region, alternative, work, workSize, charset, nwcWork->stringWork);
|
||||
goto done;
|
||||
}
|
||||
switch (region) {
|
||||
case 0:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_JPN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
result = 3;
|
||||
case NWC24_ENCODING_REGION_USA:
|
||||
case NWC24_ENCODING_REGION_EUR:
|
||||
result = NWC24_ENC_QUOTED_PRINTABLE;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_KOR:
|
||||
case NWC24_ENCODING_REGION_CHN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
default:
|
||||
result = 2;
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
}
|
||||
if (result == 3) {
|
||||
if (result == NWC24_ENC_QUOTED_PRINTABLE) {
|
||||
result = NWC24iSetMsgSubjectQP(msg, subject, subjectSize, region, alternative, work, workSize, charset, nwcWork->stringWork);
|
||||
} else {
|
||||
result = NWC24iSetMsgSubjectBase64(msg, subject, subjectSize, region, alternative, work, workSize, charset, nwcWork->stringWork);
|
||||
@@ -275,6 +276,7 @@ NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u
|
||||
|
||||
nwcWork = NWC24WorkP;
|
||||
result = NWC24iDetectEncodingToSend(nwcWork->stringWork, 0x40, subject, subjectSize, text, textSize, region);
|
||||
/* MWCC needs the success-only switches to retain their extra branches. */
|
||||
switch (result) {
|
||||
case NWC24_OK:
|
||||
break;
|
||||
@@ -282,7 +284,7 @@ NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u
|
||||
goto done;
|
||||
}
|
||||
if (NWC24ParseCharsetStr(&charset, nwcWork->stringWork) != NWC24_OK) {
|
||||
charset = 0;
|
||||
charset = NWC24_US_ASCII;
|
||||
}
|
||||
textCapacity = (workSize * textSize) / (textSize + subjectSize * 4);
|
||||
textWorkSize = textCapacity;
|
||||
@@ -300,23 +302,23 @@ NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u
|
||||
result = ENCIs7BitEncoding(&is7Bit, nwcWork->stringWork);
|
||||
if (!is7Bit || (result != ENC_OK)) {
|
||||
switch (region) {
|
||||
case 0:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_JPN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
result = 3;
|
||||
case NWC24_ENCODING_REGION_USA:
|
||||
case NWC24_ENCODING_REGION_EUR:
|
||||
result = NWC24_ENC_QUOTED_PRINTABLE;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_KOR:
|
||||
case NWC24_ENCODING_REGION_CHN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
default:
|
||||
result = 2;
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
result = 0;
|
||||
result = NWC24_ENC_7BIT;
|
||||
}
|
||||
result = NWC24SetMsgText(msg, (char*)work, textWorkSize - 1, charset, result);
|
||||
switch (result) {
|
||||
@@ -325,27 +327,27 @@ NWC24Err NWC24SetMsgSubjectAndTextPublic(NWC24MsgObj* msg, const u16* subject, u
|
||||
default:
|
||||
goto done;
|
||||
}
|
||||
if (charset == 0) {
|
||||
if (charset == NWC24_US_ASCII) {
|
||||
result = NWC24iSetMsgSubjectPlain(msg, subject, subjectSize, region, alternative, subjectWork, subjectWorkSize, charset, nwcWork->stringWork);
|
||||
goto done;
|
||||
}
|
||||
switch (region) {
|
||||
case 0:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_JPN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
result = 3;
|
||||
case NWC24_ENCODING_REGION_USA:
|
||||
case NWC24_ENCODING_REGION_EUR:
|
||||
result = NWC24_ENC_QUOTED_PRINTABLE;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
result = 2;
|
||||
case NWC24_ENCODING_REGION_KOR:
|
||||
case NWC24_ENCODING_REGION_CHN:
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
default:
|
||||
result = 2;
|
||||
result = NWC24_ENC_BASE64;
|
||||
break;
|
||||
}
|
||||
if (result == 3) {
|
||||
if (result == NWC24_ENC_QUOTED_PRINTABLE) {
|
||||
result = NWC24iSetMsgSubjectQP(msg, subject, subjectSize, region, alternative, subjectWork, subjectWorkSize, charset, nwcWork->stringWork);
|
||||
} else {
|
||||
result =
|
||||
@@ -360,33 +362,32 @@ NWC24Err NWC24iGetDefaultCharset(char* charset, u32 charsetSize, NWC24EncodingRe
|
||||
NWC24Err result = NWC24_OK;
|
||||
|
||||
switch (region) {
|
||||
case 0:
|
||||
case NWC24_ENCODING_REGION_JPN:
|
||||
strncpy(charset, DefaultCharsetJp, charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
goto done;
|
||||
case 1:
|
||||
break;
|
||||
case NWC24_ENCODING_REGION_USA:
|
||||
strncpy(charset, "iso-8859-1", charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
goto done;
|
||||
case 2:
|
||||
break;
|
||||
case NWC24_ENCODING_REGION_EUR:
|
||||
strncpy(charset, "iso-8859-1", charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
goto done;
|
||||
case 3:
|
||||
break;
|
||||
case NWC24_ENCODING_REGION_KOR:
|
||||
strncpy(charset, DefaultCharsetKr, charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
goto done;
|
||||
case 4:
|
||||
break;
|
||||
case NWC24_ENCODING_REGION_CHN:
|
||||
strncpy(charset, "gb2312", charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
strncpy(charset, "iso-8859-1", charsetSize - 1);
|
||||
charset[charsetSize - 1] = 0;
|
||||
result = NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -403,6 +404,7 @@ NWC24Err NWC24iConvertToInternalEncoding(u16* dst, u32* dstSize, const u8* src,
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
goto done;
|
||||
}
|
||||
/* MWCC needs the success switch and short-circuit setup for this instruction order. */
|
||||
if (charset[0] == '\0') {
|
||||
result = NWC24iGetDefaultCharset(charset, charsetSize, region);
|
||||
switch (result) {
|
||||
@@ -421,52 +423,29 @@ NWC24Err NWC24iConvertToInternalEncoding(u16* dst, u32* dstSize, const u8* src,
|
||||
dst[convertedBytes >> 1] = 0;
|
||||
*dstSize = (convertedBytes >> 1) + 1;
|
||||
}
|
||||
if (result == ENC_ERR_NO_MAP_RULE) {
|
||||
goto invalidCharacter;
|
||||
switch (result) {
|
||||
case ENC_OK:
|
||||
result = NWC24_OK;
|
||||
break;
|
||||
case ENC_ERR_INVALID_PARAM:
|
||||
result = NWC24_ERR_INVALID_VALUE;
|
||||
break;
|
||||
case ENC_ERR_NO_BUF_LEFT:
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
break;
|
||||
case ENC_ERR_NO_MAP_RULE:
|
||||
case ENC_ERR_INVALID_FORMAT:
|
||||
result = NWC24_ERR_INVALID_CHAR;
|
||||
break;
|
||||
case ENC_ERR_UNKNOWN_ENCODING:
|
||||
case ENC_ERR_UNSUPPORTED:
|
||||
case ENC_ERR_NOT_LOADED:
|
||||
result = NWC24_ERR_NOT_SUPPORTED;
|
||||
break;
|
||||
default:
|
||||
result = NWC24_ERR_FATAL;
|
||||
break;
|
||||
}
|
||||
if (result < ENC_ERR_NO_MAP_RULE) {
|
||||
if (result == ENC_ERR_INVALID_FORMAT) {
|
||||
goto invalidCharacter;
|
||||
}
|
||||
if (result >= ENC_ERR_INVALID_FORMAT) {
|
||||
goto invalidValue;
|
||||
}
|
||||
if (result >= ENC_ERR_NOT_LOADED) {
|
||||
goto notSupported;
|
||||
}
|
||||
} else {
|
||||
if (result == ENC_OK) {
|
||||
goto success;
|
||||
}
|
||||
if (result >= ENC_OK) {
|
||||
goto fatal;
|
||||
}
|
||||
goto overflow;
|
||||
}
|
||||
goto fatal;
|
||||
|
||||
success:
|
||||
result = ENC_OK;
|
||||
goto done;
|
||||
|
||||
invalidValue:
|
||||
result = NWC24_ERR_INVALID_VALUE;
|
||||
goto done;
|
||||
|
||||
overflow:
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
goto done;
|
||||
|
||||
invalidCharacter:
|
||||
result = NWC24_ERR_INVALID_CHAR;
|
||||
goto done;
|
||||
|
||||
notSupported:
|
||||
result = NWC24_ERR_NOT_SUPPORTED;
|
||||
goto done;
|
||||
|
||||
fatal:
|
||||
result = NWC24_ERR_FATAL;
|
||||
|
||||
done:
|
||||
return result;
|
||||
@@ -486,6 +465,7 @@ NWC24Err NWC24iConvertFromInternalEncoding(u8* dst, u32* dstSize, const u16* src
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
goto done;
|
||||
}
|
||||
/* MWCC needs the success switch and short-circuit setup for this instruction order. */
|
||||
if (charset[0] == '\0') {
|
||||
result = NWC24iGetDefaultCharset(charset, charsetSize, region);
|
||||
switch (result) {
|
||||
@@ -506,51 +486,29 @@ NWC24Err NWC24iConvertFromInternalEncoding(u8* dst, u32* dstSize, const u16* src
|
||||
*srcSize = inputBytes >> 1;
|
||||
*dstSize = outputBytes + 1;
|
||||
}
|
||||
if (result == ENC_ERR_NO_MAP_RULE) {
|
||||
goto invalidCharacter;
|
||||
switch (result) {
|
||||
case ENC_OK:
|
||||
result = NWC24_OK;
|
||||
break;
|
||||
case ENC_ERR_INVALID_PARAM:
|
||||
result = NWC24_ERR_INVALID_VALUE;
|
||||
break;
|
||||
case ENC_ERR_NO_BUF_LEFT:
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
break;
|
||||
case ENC_ERR_NO_MAP_RULE:
|
||||
case ENC_ERR_INVALID_FORMAT:
|
||||
result = NWC24_ERR_INVALID_CHAR;
|
||||
break;
|
||||
case ENC_ERR_UNKNOWN_ENCODING:
|
||||
case ENC_ERR_UNSUPPORTED:
|
||||
case ENC_ERR_NOT_LOADED:
|
||||
result = NWC24_ERR_NOT_SUPPORTED;
|
||||
break;
|
||||
default:
|
||||
result = NWC24_ERR_FATAL;
|
||||
break;
|
||||
}
|
||||
if (result < ENC_ERR_NO_MAP_RULE) {
|
||||
if (result == ENC_ERR_INVALID_FORMAT) {
|
||||
goto invalidCharacter;
|
||||
}
|
||||
if (result >= ENC_ERR_INVALID_FORMAT) {
|
||||
goto invalidValue;
|
||||
}
|
||||
if (result >= ENC_ERR_NOT_LOADED) {
|
||||
goto notSupported;
|
||||
}
|
||||
goto fatal;
|
||||
}
|
||||
if (result == ENC_OK) {
|
||||
goto success;
|
||||
}
|
||||
if (result >= ENC_OK) {
|
||||
goto fatal;
|
||||
}
|
||||
goto overflow;
|
||||
|
||||
success:
|
||||
result = ENC_OK;
|
||||
goto done;
|
||||
|
||||
invalidValue:
|
||||
result = NWC24_ERR_INVALID_VALUE;
|
||||
goto done;
|
||||
|
||||
overflow:
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
goto done;
|
||||
|
||||
invalidCharacter:
|
||||
result = NWC24_ERR_INVALID_CHAR;
|
||||
goto done;
|
||||
|
||||
notSupported:
|
||||
result = NWC24_ERR_NOT_SUPPORTED;
|
||||
goto done;
|
||||
|
||||
fatal:
|
||||
result = NWC24_ERR_FATAL;
|
||||
|
||||
done:
|
||||
return result;
|
||||
@@ -572,20 +530,20 @@ NWC24Err NWC24iDetectEncodingToSend(char* charset, u32 charsetSize, const u16* s
|
||||
startIndex = 0;
|
||||
lastIndex = -1;
|
||||
switch (region) {
|
||||
case 0:
|
||||
case NWC24_ENCODING_REGION_JPN:
|
||||
names = JapaneseCharsets;
|
||||
numNames = 3;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case NWC24_ENCODING_REGION_USA:
|
||||
case NWC24_ENCODING_REGION_EUR:
|
||||
names = WesternCharsets;
|
||||
numNames = 8;
|
||||
break;
|
||||
case 3:
|
||||
case NWC24_ENCODING_REGION_KOR:
|
||||
names = KoreanCharsets;
|
||||
numNames = 3;
|
||||
break;
|
||||
case 4:
|
||||
case NWC24_ENCODING_REGION_CHN:
|
||||
names = ChineseCharsets;
|
||||
numNames = 2;
|
||||
break;
|
||||
@@ -642,7 +600,7 @@ NWC24Err NWC24iDetectBreakPoint(u32* breakPoint, NWC24Charset charset, const u8*
|
||||
if ((breakPoint == NULL) || (text == NULL)) {
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
if (charset == 0) {
|
||||
if (charset == NWC24_US_ASCII) {
|
||||
byteEncoding = TRUE;
|
||||
} else if (charset == NWC24_UTF_8) {
|
||||
byteEncoding = FALSE;
|
||||
@@ -797,7 +755,7 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
|
||||
charsetLength = (0x40 - strlen(charsetName)) / 3;
|
||||
total = outputLength - 1;
|
||||
workHalf = secondSize;
|
||||
for (; sourceOffset < subjectLength;) {
|
||||
while (sourceOffset < subjectLength) {
|
||||
if (workHalf - total < 3) {
|
||||
result = NWC24_ERR_OVERFLOW;
|
||||
goto done;
|
||||
@@ -808,6 +766,7 @@ NWC24Err NWC24iSetMsgSubjectQP(NWC24MsgObj* msg, const u16* subject, u32 subject
|
||||
NWC24iDetectBreakPoint(&lineLength, charset, work + sourceOffset, subjectLength - sourceOffset, charsetLength);
|
||||
result = NWC24EncodeWord(second + total, workHalf - total, &outputLength, charsetName, 0x40, 'Q', work + sourceOffset,
|
||||
lineLength);
|
||||
/* MWCC needs this success-only switch's extra branch. */
|
||||
switch (result) {
|
||||
case NWC24_OK:
|
||||
break;
|
||||
@@ -829,6 +788,7 @@ done:
|
||||
|
||||
NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 subjectSize, NWC24EncodingRegion region, u16 alternative, u8* work,
|
||||
u32 workSize, NWC24Charset charset, char* charsetName) {
|
||||
/* MWCC needs a const input alias to preserve the conversion-call registers. */
|
||||
const u8* encodedInput = work;
|
||||
u8* second;
|
||||
u32 secondSize;
|
||||
@@ -852,6 +812,7 @@ NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 sub
|
||||
subjectLength = subjectSize;
|
||||
result = NWC24iConvertFromInternalEncoding(work, &workHalf, subject, &subjectLength, charsetName, 0x40, region, alternative);
|
||||
if (result != NWC24_OK) {
|
||||
/* MWCC needs the success-only switches to retain their extra branches. */
|
||||
switch (result) {
|
||||
case NWC24_ERR_OVERFLOW: break;
|
||||
default: goto done;
|
||||
@@ -867,7 +828,7 @@ NWC24Err NWC24iSetMsgSubjectBase64(NWC24MsgObj* msg, const u16* subject, u32 sub
|
||||
charsetLength = strlen(charsetName);
|
||||
lineLength = (((0x3E - charsetLength) * 3) >> 2) + 1;
|
||||
total = outputLength - 1;
|
||||
for (; sourceOffset < subjectSize;) {
|
||||
while (sourceOffset < subjectSize) {
|
||||
subjectLength = subjectSize - sourceOffset;
|
||||
workHalf = lineLength;
|
||||
if (secondSize - total < 3) {
|
||||
|
||||
@@ -16,6 +16,7 @@ const u8 scWpaOui0 = 0;
|
||||
const u8 scWpaOui1 = 0x50;
|
||||
const u8 scWpaOui2 = 0xF2;
|
||||
const u8 scWpaOuiPad = 0;
|
||||
/* MWCC places the WPA search bytes in .sdata. */
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
const u8 scWpaFindOui0 = 0;
|
||||
@@ -28,6 +29,7 @@ const u8 scWpaFindOuiPad3 = 0;
|
||||
const u8 scWpaFindOuiPad4 = 0;
|
||||
#pragma pop
|
||||
|
||||
/* MWCC must load the OUI bytes from memory instead of folding their values. */
|
||||
#define scRsnOui0 (*((volatile const u8*)&scRsnOui0))
|
||||
#define scRsnOui1 (*((volatile const u8*)&scRsnOui1))
|
||||
#define scRsnOui2 (*((volatile const u8*)&scRsnOui2))
|
||||
@@ -96,68 +98,58 @@ static inline s32 GetResultNCD(s32 result) {
|
||||
|
||||
s32 WDCheckEnableChannel(u16* enableChannel) {
|
||||
s32 id;
|
||||
s32 result;
|
||||
s32 infoResult;
|
||||
|
||||
if (enableChannel != NULL) {
|
||||
*enableChannel = 0;
|
||||
}
|
||||
|
||||
id = NCDLockWirelessDriver();
|
||||
if (id <= 0) {
|
||||
goto ncd_err;
|
||||
} else {
|
||||
s32 result = WD_Startup(3);
|
||||
s32 result2;
|
||||
if (id > 0) {
|
||||
result = WD_Startup(3);
|
||||
if (result == WD_INTERNAL_ERR_OK) {
|
||||
WD_Info info;
|
||||
result2 = WD_GetInfo(&info);
|
||||
if (result2 == WD_INTERNAL_ERR_OK && enableChannel != NULL) {
|
||||
infoResult = WD_GetInfo(&info);
|
||||
if (infoResult == WD_INTERNAL_ERR_OK && enableChannel != NULL) {
|
||||
*enableChannel = info.enableChannel;
|
||||
}
|
||||
WAIT_FOR_OPERATION(WD_Cleanup());
|
||||
}
|
||||
|
||||
WAIT_FOR_OPERATION(NCDUnlockWirelessDriver(id));
|
||||
goto wd_err;
|
||||
|
||||
ncd_err:
|
||||
} else {
|
||||
return GetResultNCD(id);
|
||||
|
||||
wd_err:
|
||||
if (result == WD_ERR_OK) {
|
||||
return GetResultWD(result2);
|
||||
} else {
|
||||
return GetResultWD(result);
|
||||
}
|
||||
}
|
||||
if (result == WD_ERR_OK) {
|
||||
return GetResultWD(infoResult);
|
||||
} else {
|
||||
return GetResultWD(result);
|
||||
}
|
||||
}
|
||||
|
||||
s32 WDScanOnce(u8* scanBuffer, u32 scanBufferLen, WDScanParam* param) {
|
||||
s32 id;
|
||||
s32 result;
|
||||
s32 scanResult;
|
||||
|
||||
id = NCDLockWirelessDriver();
|
||||
if (id <= 0) {
|
||||
goto ncd_err;
|
||||
} else {
|
||||
s32 result = WD_Startup(3);
|
||||
s32 result2;
|
||||
if (id > 0) {
|
||||
result = WD_Startup(3);
|
||||
if (result == WD_INTERNAL_ERR_OK) {
|
||||
memset(scanBuffer, 0, scanBufferLen);
|
||||
result2 = WD_Scan(param, scanBuffer, scanBufferLen);
|
||||
scanResult = WD_Scan(param, scanBuffer, scanBufferLen);
|
||||
WAIT_FOR_OPERATION(WD_Cleanup());
|
||||
}
|
||||
|
||||
WAIT_FOR_OPERATION(NCDUnlockWirelessDriver(id));
|
||||
goto wd_err;
|
||||
|
||||
ncd_err:
|
||||
} else {
|
||||
return GetResultNCD(id);
|
||||
|
||||
wd_err:
|
||||
if (result == WD_ERR_OK) {
|
||||
return GetResultWD(result2);
|
||||
} else {
|
||||
return GetResultWD(result);
|
||||
}
|
||||
}
|
||||
if (result == WD_ERR_OK) {
|
||||
return GetResultWD(scanResult);
|
||||
} else {
|
||||
return GetResultWD(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,93 +167,55 @@ s32 WDGetPrivacyMode(WDBssDesc* bssDesc) {
|
||||
data[2] = scRsnOui2;
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement) + 2);
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) == 0) {
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_second;
|
||||
switch (readIE[5]) {
|
||||
case 1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
case 2:
|
||||
return WD_PRIVACY_MODE_7;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
return WD_PRIVACY_MODE_5;
|
||||
case 5:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_rsn_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_rsn_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_rsn_mode7;
|
||||
}
|
||||
goto privacy_second;
|
||||
privacy_rsn_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_rsn_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_second;
|
||||
}
|
||||
goto privacy_rsn_mode5;
|
||||
}
|
||||
}
|
||||
goto privacy_second;
|
||||
|
||||
privacy_rsn_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_rsn_mode7:
|
||||
return WD_PRIVACY_MODE_7;
|
||||
privacy_rsn_mode5:
|
||||
return WD_PRIVACY_MODE_5;
|
||||
privacy_rsn_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_second: {
|
||||
{
|
||||
u8 data[WD_VENDOR_LENGTH];
|
||||
u8 findData[WD_VENDOR_LENGTH];
|
||||
|
||||
findData[0] = scWpaFindOui0;
|
||||
findData[1] = scWpaFindOui1;
|
||||
findData[2] = scWpaFindOui2;
|
||||
if (!WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
data[0] = scWpaOui0;
|
||||
data[1] = scWpaOui1;
|
||||
data[2] = scWpaOui2;
|
||||
if (WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
data[0] = scWpaOui0;
|
||||
data[1] = scWpaOui1;
|
||||
data[2] = scWpaOui2;
|
||||
|
||||
{
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement));
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) != 0) {
|
||||
goto privacy_fallback;
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) == 0) {
|
||||
switch (readIE[5]) {
|
||||
case 1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
case 2:
|
||||
return WD_PRIVACY_MODE_4;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
return WD_PRIVACY_MODE_6;
|
||||
case 5:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_wpa_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_wpa_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_wpa_mode4;
|
||||
}
|
||||
goto privacy_fallback;
|
||||
privacy_wpa_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_wpa_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
goto privacy_wpa_mode6;
|
||||
}
|
||||
}
|
||||
|
||||
privacy_wpa_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_wpa_mode4:
|
||||
return WD_PRIVACY_MODE_4;
|
||||
privacy_wpa_mode6:
|
||||
return WD_PRIVACY_MODE_6;
|
||||
privacy_wpa_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_fallback:
|
||||
if (bssDesc != NULL && (bssDesc->capabilities & 0x10) == 0x10) {
|
||||
result = WD_PRIVACY_MODE_8;
|
||||
} else {
|
||||
|
||||
@@ -48,60 +48,57 @@ u8 PartitionInfoBuf[OSRoundUp32B(sizeof(DVDPartitionInfo) * 256)] ALIGN32;
|
||||
DVDCommandBlock Block;
|
||||
|
||||
static BS2State State = BS2_STT_BEGIN;
|
||||
// MWCC must preserve the reads and writes of interrupt-shared flags below.
|
||||
static vu32 DvdReadPending = 0;
|
||||
static u32 BannerAllocation = 0;
|
||||
static u32 BannerBuffer = 0;
|
||||
static u32 BannerAvailable = 0;
|
||||
static u32 Allocator = 0;
|
||||
volatile BOOL StartingGame = FALSE;
|
||||
static u32 RestartRequested = 0;
|
||||
static u32 PartitionOpen = 0;
|
||||
static vu32 RestartRequested = 0;
|
||||
static vu32 PartitionOpen = 0;
|
||||
static u32 CacheSeekComplete = 0;
|
||||
static u32 LoadingTitle = 0;
|
||||
BOOL FatalErrorFlag = FALSE;
|
||||
static vu32 LoadingTitle = 0;
|
||||
volatile BOOL FatalErrorFlag = FALSE;
|
||||
BOOL RetryErrorFlag = FALSE;
|
||||
BOOL UpdateErrorFlag = FALSE;
|
||||
BOOL AbortFlag = FALSE;
|
||||
volatile BOOL AbortFlag = FALSE;
|
||||
volatile int CacheFailed = 0;
|
||||
volatile int RegionValid = 0;
|
||||
static volatile int NandPending = 0;
|
||||
static vu32 CancelNand = 0;
|
||||
static vu32 LowReadResult = 0;
|
||||
static u32 CacheCommandComplete = 0;
|
||||
static u32 AudioBufferUnconfigured = 0;
|
||||
static u64 ResetTime = 0;
|
||||
static u64 SpinupDeadline = 0;
|
||||
u64 CoverPollTime = 0;
|
||||
u32 DriveWasReset = 0;
|
||||
static u32 TitleTicketView = 0;
|
||||
static u32 CurrentTmd = 0;
|
||||
u32 TitleCode = 0;
|
||||
u32 RequiredIosHigh = 0;
|
||||
u32 RequiredIosLow = 0;
|
||||
u32 GamePartition = 0;
|
||||
u32 UpdatePartition = 0;
|
||||
u32 PartitionCursor = 0;
|
||||
u32 DataToc = 0;
|
||||
u64 GameToc = 0;
|
||||
u32 CoverOpenTimeHigh = 0;
|
||||
u32 CoverOpenTimeLow = 0;
|
||||
vu32 NandTransferred = 0;
|
||||
vu32 NandLength = 0;
|
||||
u8 *NandBuffer = NULL;
|
||||
NANDFileInfo *NandFile = NULL;
|
||||
vu32 NandOperation = 0;
|
||||
volatile NANDCallback NandCompletion = NULL;
|
||||
u32 LoaderOffset = 0;
|
||||
vu32 LoaderLength = 0;
|
||||
u32 LoaderAddress = 0;
|
||||
vu32 CacheLength = 0;
|
||||
static vu32 BannerLength = 0;
|
||||
static vu32 DvdTransferLength = 0;
|
||||
static vu32 DvdTransferred = 0;
|
||||
static u32 *DvdProgress = 0;
|
||||
static u32 LoaderClose = 0;
|
||||
static u32 LoaderMain = 0;
|
||||
static u32 LoaderInit = 0;
|
||||
static u32 LoaderInit;
|
||||
static u32 LoaderMain;
|
||||
static u32 LoaderClose;
|
||||
static u32 *DvdProgress;
|
||||
static vu32 DvdTransferred;
|
||||
static vu32 DvdTransferLength;
|
||||
static vu32 BannerLength;
|
||||
vu32 CacheLength;
|
||||
u32 LoaderAddress;
|
||||
vu32 LoaderLength;
|
||||
u32 LoaderOffset;
|
||||
volatile NANDCallback NandCompletion;
|
||||
vu32 NandOperation;
|
||||
NANDFileInfo *NandFile;
|
||||
u8 *NandBuffer;
|
||||
vu32 NandLength;
|
||||
vu32 NandTransferred;
|
||||
OSTime CoverOpenTime;
|
||||
u64 GameToc;
|
||||
u32 DataToc;
|
||||
u32 PartitionCursor;
|
||||
u32 UpdatePartition;
|
||||
u32 GamePartition;
|
||||
u64 RequiredIos;
|
||||
u32 TitleCode;
|
||||
static u32 CurrentTmd;
|
||||
static u32 TitleTicketView;
|
||||
u32 DriveWasReset;
|
||||
u64 CoverPollTime;
|
||||
static u64 SpinupDeadline;
|
||||
static u64 ResetTime;
|
||||
|
||||
|
||||
void BS2Report(const char *msg, ...) {
|
||||
@@ -311,36 +308,33 @@ BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pTitleIds) {
|
||||
goto getLockedTitles;
|
||||
}
|
||||
|
||||
*count = 0;
|
||||
PartitionCursor = (u32)PartitionInfoBuf;
|
||||
for (i = 0; i < **(u32 **)&GameToc; i++) {
|
||||
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
|
||||
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
|
||||
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
|
||||
BS2Report(" count++\n");
|
||||
(*count)++;
|
||||
if (!pTitleIds) {
|
||||
*count = 0;
|
||||
PartitionCursor = (u32)PartitionInfoBuf;
|
||||
for (i = 0; i < **(u32 **)&GameToc; i++) {
|
||||
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
|
||||
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
|
||||
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
|
||||
BS2Report(" count++\n");
|
||||
(*count)++;
|
||||
}
|
||||
PartitionCursor += 8;
|
||||
}
|
||||
PartitionCursor += 8;
|
||||
}
|
||||
|
||||
PartitionCursor = (u32)PartitionInfoBuf + 0x20;
|
||||
for (i = 0; i < **(u32 **)&DataToc; i++) {
|
||||
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
|
||||
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
|
||||
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
|
||||
BS2Report(" count++\n");
|
||||
(*count)++;
|
||||
PartitionCursor = (u32)PartitionInfoBuf + 0x20;
|
||||
for (i = 0; i < **(u32 **)&DataToc; i++) {
|
||||
BS2Report("gamePartition ... 0x%08X\n", (u32)((DVDPartitionInfo *)PartitionCursor)->partition);
|
||||
BS2Report("type ... 0x%08X\n", ((DVDPartitionInfo *)PartitionCursor)->partitionType);
|
||||
if (((DVDPartitionInfo *)PartitionCursor)->partitionType & 0xFF000000) {
|
||||
BS2Report(" count++\n");
|
||||
(*count)++;
|
||||
}
|
||||
PartitionCursor += 8;
|
||||
}
|
||||
PartitionCursor += 8;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
getLockedTitles:
|
||||
titleCount = *count;
|
||||
if (titleCount != 0) {
|
||||
PartitionCursor = (u32)PartitionInfoBuf;
|
||||
@@ -607,6 +601,10 @@ static void BS2Reboot(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline s32 BS2ReadDVDState(const volatile DVDCommandBlock *block) {
|
||||
return block->state;
|
||||
}
|
||||
|
||||
void BS2StartGame() {
|
||||
u32 runResult;
|
||||
u8 *base;
|
||||
@@ -623,7 +621,7 @@ void BS2StartGame() {
|
||||
u32 (*entry)(void);
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
while (BS2ReadDVDState(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
BS2Report("BS2StartGame(1)\n");
|
||||
@@ -667,8 +665,8 @@ void BS2StartGame() {
|
||||
__OSWriteStateFlags(&stateFlags);
|
||||
__OSClearRTCFlags();
|
||||
|
||||
titleType = RequiredIosHigh;
|
||||
titleCode = RequiredIosLow;
|
||||
titleType = (u32)(RequiredIos >> 32);
|
||||
titleCode = (u32)RequiredIos;
|
||||
ticketCount = 1;
|
||||
ticketViews = TicketViews;
|
||||
if ((titleCode | titleType) == 0) {
|
||||
@@ -726,6 +724,7 @@ void BS2StartGame() {
|
||||
}
|
||||
|
||||
status = LowReadResult;
|
||||
// MWCC needs the shared fatal and completion exits below.
|
||||
if (status != 2) {
|
||||
if ((status >= 2) || (status < 1)) {
|
||||
goto disk_fatal;
|
||||
@@ -806,16 +805,25 @@ partition_fatal:
|
||||
partition_done:
|
||||
BS2Report("DVDLowOpenPartition done\n");
|
||||
if (*(u8 *)0x8000315D != 0x80) {
|
||||
u32 diBits;
|
||||
u32 diValue;
|
||||
typedef union {
|
||||
u32 value;
|
||||
struct {
|
||||
u32 reserved : 29;
|
||||
u32 bit2 : 1;
|
||||
u32 bit1 : 1;
|
||||
u32 bit0 : 1;
|
||||
} bits;
|
||||
} DIControl;
|
||||
DIControl diBits;
|
||||
DIControl diValue;
|
||||
u32 *diAddr;
|
||||
|
||||
diAddr = (u32 *)0xCC003024;
|
||||
diBits = 2;
|
||||
diBits |= 4;
|
||||
diValue = *diAddr;
|
||||
diValue |= 1;
|
||||
*diAddr = diValue | diBits;
|
||||
diValue.value = *diAddr;
|
||||
diValue.bits.bit0 = 1;
|
||||
diBits.value = 2;
|
||||
diBits.bits.bit2 = 1;
|
||||
*diAddr = diValue.value | diBits.value;
|
||||
enableLegacyDI();
|
||||
}
|
||||
oldInterrupts = OSDisableInterrupts();
|
||||
@@ -845,7 +853,7 @@ void BS2StartGCGame() {
|
||||
OSTime time;
|
||||
|
||||
StartingGame = TRUE;
|
||||
while (CoverBlock.state != DVD_STATE_IDLE) {
|
||||
while (BS2ReadDVDState(&CoverBlock) != DVD_STATE_IDLE) {
|
||||
}
|
||||
|
||||
soundMode = SCGetSoundMode();
|
||||
@@ -973,9 +981,7 @@ static BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
|
||||
case 4:
|
||||
case 5:
|
||||
if (State == 7 || State == 9 || State == 10) {
|
||||
u64 systemTime = __OSGetSystemTime();
|
||||
CoverOpenTimeLow = (u32)systemTime;
|
||||
CoverOpenTimeHigh = (u32)(systemTime >> 32);
|
||||
CoverOpenTime = __OSGetSystemTime();
|
||||
State = BS2_STT_66;
|
||||
} else {
|
||||
State = BS2_STT_NO_DISK;
|
||||
@@ -1090,6 +1096,8 @@ static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32
|
||||
}
|
||||
|
||||
static BOOL CheckBS2CommandStatus() {
|
||||
static u32 CacheCommandComplete = 0;
|
||||
|
||||
if (CheckDVDCommandStatus(&Block) == 0) {
|
||||
BS2Report("DVD command is issuing\n");
|
||||
return 0;
|
||||
@@ -1172,8 +1180,8 @@ static BOOL CheckBS2CommandStatus() {
|
||||
if (BS2BootCaching != 0) {
|
||||
BS2Report("Write partition ifno\n");
|
||||
NandPending = 1;
|
||||
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
|
||||
CacheCommandComplete = 1;
|
||||
CacheLength += OSRoundUp32B(((DVDGameTOC *)DataToc)->partitionCount * sizeof(DVDPartitionInfo)) + 32;
|
||||
if ((unsigned int)CacheLength > 0xb00000) {
|
||||
BS2NANDCallback(-1, NULL);
|
||||
return 1;
|
||||
@@ -1315,25 +1323,24 @@ static void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
|
||||
}
|
||||
|
||||
BS2State BS2Tick() {
|
||||
static u32 AudioBufferUnconfigured;
|
||||
u32 interruptsEnabled = OSDisableInterrupts();
|
||||
u32 loaderAddress;
|
||||
u32 loaderLength;
|
||||
u32 loaderOffset;
|
||||
u32 titleCode;
|
||||
s32 titlePrefix;
|
||||
u8 titleCharacters[4];
|
||||
struct {
|
||||
u32 offset;
|
||||
u32 length;
|
||||
u32 address;
|
||||
} loaderRead;
|
||||
DVDFileInfo bannerFile;
|
||||
u32 bannerAddress;
|
||||
u32 discRegion;
|
||||
s32 status;
|
||||
u64 currentTime;
|
||||
BOOL regionMatches;
|
||||
char productRegion;
|
||||
u32 iosHigh;
|
||||
char *ticketByte;
|
||||
u32 entryCount;
|
||||
u32 readInterruptsEnabled;
|
||||
DVDGameTOC *dataToc;
|
||||
u32 readAddress;
|
||||
const char *discTitle;
|
||||
const DVDDiskID *bootDisc;
|
||||
@@ -1343,17 +1350,16 @@ BS2State BS2Tick() {
|
||||
BS2Report("Drive Reset : %d\n", BS2DriveReset);
|
||||
BS2Report("Wait Spinup : %d\n", BS2WaitSpinup);
|
||||
BS2Report("Boot From Cache : %d\n", BS2BootFromCache);
|
||||
DvdProgress = (u32 *)&(*(u32 *)0x800030d4);
|
||||
DvdProgress = (u32 *)0x800030d4;
|
||||
PartitionParams.numTmdBytes = 0;
|
||||
PartitionParams.numCertBytes = 0;
|
||||
PartitionParams.dataWordOffset = 0;
|
||||
(*(u32 *)0x800030d4) = 0;
|
||||
*DvdProgress = 0;
|
||||
DvdTransferred = 0;
|
||||
DvdTransferLength = 0;
|
||||
status = BS2NoDisk;
|
||||
AudioBufferUnconfigured = 1;
|
||||
CoverBlock.state = 0;
|
||||
if (status != 0)
|
||||
if (BS2NoDisk != 0)
|
||||
State = BS2_STT_NO_DISK;
|
||||
else if (BS2DriveReset != 0)
|
||||
State = BS2_STT_2;
|
||||
@@ -1432,13 +1438,14 @@ BS2State BS2Tick() {
|
||||
case 5:
|
||||
status = CheckBS2CommandStatus();
|
||||
if (status != 0) {
|
||||
if ((((const OSBootInfo *)0x80000000)->consoleType & 0xf0000000) == 0) {
|
||||
OSBootInfo *bootInfo = (OSBootInfo *)OSPhysicalToCached(OS_ADDR_BOOT_INFO);
|
||||
|
||||
if ((bootInfo->consoleType & 0xf0000000) == 0) {
|
||||
__OSDeviceCode = 0x8002;
|
||||
State = BS2_STT_8;
|
||||
} else {
|
||||
__OSDeviceCode = DriveInfo.deviceCode | 0x8000;
|
||||
State = BS2_STT_8;
|
||||
}
|
||||
State = BS2_STT_8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@@ -1470,6 +1477,7 @@ BS2State BS2Tick() {
|
||||
if (bootDisc->rvlMagic == 0x5d1c9ea3) {
|
||||
discTitle = (const char *)0x80000000;
|
||||
status = strncmp(discTitle, "RAAE", 4);
|
||||
// MWCC needs both 410 comparisons to preserve the instruction stream.
|
||||
if (status == 0 || strncmp(discTitle, "408", 3) == 0 ||
|
||||
strncmp(discTitle, "410", 3) == 0 ||
|
||||
strncmp(discTitle, "410", 3) == 0)
|
||||
@@ -1524,6 +1532,7 @@ BS2State BS2Tick() {
|
||||
break;
|
||||
discRegion = bi2.countryCode;
|
||||
productRegion = SCGetProductGameRegion();
|
||||
// MWCC needs the shared false-result paths in these region switches.
|
||||
switch (productRegion) {
|
||||
case 0:
|
||||
if (discRegion != 0)
|
||||
@@ -1565,8 +1574,9 @@ invalidGcRegion:
|
||||
BS2Report("length ... 0x%08X\n", 0x20);
|
||||
BS2Report("numGamePartitions ... 0x%08X\n", (*(DVDGameTOC **)&GameToc)->partitionCount);
|
||||
BS2Report("partitionInfos ... 0x%08X\n", (u32)(*(DVDGameTOC **)&GameToc)->partitionInfo);
|
||||
DataToc = (u32)((DVDGameTOC *)GameTOCBuf + 1);
|
||||
BS2Report("numGamePartitions ... 0x%08X\n", ((DVDGameTOC *)GameTOCBuf)[1].partitionCount);
|
||||
dataToc = (DVDGameTOC *)GameTOCBuf + 1;
|
||||
DataToc = (u32)dataToc;
|
||||
BS2Report("numGamePartitions ... 0x%08X\n", dataToc->partitionCount);
|
||||
BS2Report("partitionInfos ... 0x%08X\n", ((DVDGameTOC *)DataToc)->partitionInfo);
|
||||
State = BS2_STT_17;
|
||||
case 0x11:
|
||||
@@ -1723,21 +1733,23 @@ invalidRvlRegion:
|
||||
((void (*)(void *))((*(void **)&LoaderInit)))((void *)BS2Report);
|
||||
BS2Report("\nApploader Initialized\n");
|
||||
State = BS2_STT_29;
|
||||
case 0x1d:
|
||||
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderRead.address, &loaderRead.length, &loaderRead.offset);
|
||||
case 0x1d: {
|
||||
u32 readInterruptsEnabled;
|
||||
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderAddress, &loaderLength, &loaderOffset);
|
||||
if (status != 0) {
|
||||
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderRead.address, loaderRead.length, loaderRead.offset);
|
||||
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderAddress, loaderLength, loaderOffset);
|
||||
readInterruptsEnabled = OSDisableInterrupts();
|
||||
DVDReadAbsAsyncForBS(&Block, (void *)loaderRead.address, loaderRead.length, loaderRead.offset >> __DVDLayoutFormat, BS2DVDCallback);
|
||||
DVDReadAbsAsyncForBS(&Block, (void *)loaderAddress, loaderLength, loaderOffset >> __DVDLayoutFormat, BS2DVDCallback);
|
||||
if (*(s32 *)DvdProgress != 0) {
|
||||
DvdReadPending = 1;
|
||||
DvdTransferLength = loaderRead.length;
|
||||
DvdTransferLength = loaderLength;
|
||||
}
|
||||
OSRestoreInterrupts(readInterruptsEnabled);
|
||||
State = BS2_STT_30;
|
||||
} else
|
||||
State = BS2_STT_31;
|
||||
break;
|
||||
}
|
||||
case 0x1e:
|
||||
status = CheckDVDCommandStatus(&Block);
|
||||
if (status != 0)
|
||||
@@ -1871,9 +1883,7 @@ invalidRvlRegion:
|
||||
(u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion);
|
||||
BS2Report("Title ID ... 0x%08X%08X\n", (u32)(((ESTitleMeta *)CurrentTmd)->head.titleId >> 32),
|
||||
(u32)((ESTitleMeta *)CurrentTmd)->head.titleId);
|
||||
iosHigh = (u32)(((ESTitleMeta *)CurrentTmd)->head.sysVersion >> 32);
|
||||
RequiredIosLow = (u32)((ESTitleMeta *)CurrentTmd)->head.sysVersion;
|
||||
RequiredIosHigh = iosHigh;
|
||||
RequiredIos = ((ESTitleMeta *)CurrentTmd)->head.sysVersion;
|
||||
titleCode = (u32)((ESTitleMeta *)CurrentTmd)->head.titleId;
|
||||
TitleCode = titleCode;
|
||||
if (((ESTitleMeta *)CurrentTmd)->head.sysVersion == 0x0000000100000010ULL) {
|
||||
@@ -2011,25 +2021,27 @@ invalidRvlRegion:
|
||||
((void (*)(void *))((*(void **)&LoaderInit)))((void *)OSReport);
|
||||
BS2Report("\nApploader Initialized\n");
|
||||
State = BS2_STT_43;
|
||||
case 0x2b:
|
||||
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderRead.address, &loaderRead.length, &loaderRead.offset);
|
||||
case 0x2b: {
|
||||
u32 readInterruptsEnabled;
|
||||
status = ((int (*)(u32 *, u32 *, u32 *))((*(void **)&LoaderMain)))(&loaderAddress, &loaderLength, &loaderOffset);
|
||||
if (status != 0) {
|
||||
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderRead.address, loaderRead.length, loaderRead.offset);
|
||||
BS2Report("Addr [0x%x] length [0x%x] offset [0x%x]\n", loaderAddress, loaderLength, loaderOffset);
|
||||
readInterruptsEnabled = OSDisableInterrupts();
|
||||
BS2ReadDiskID((void *)loaderRead.address, loaderRead.length, loaderRead.offset >> __DVDLayoutFormat);
|
||||
readAddress = loaderRead.address;
|
||||
LoaderLength = loaderRead.length;
|
||||
BS2ReadDiskID((void *)loaderAddress, loaderLength, loaderOffset >> __DVDLayoutFormat);
|
||||
readAddress = loaderAddress;
|
||||
LoaderLength = loaderLength;
|
||||
LoaderAddress = readAddress;
|
||||
LoaderOffset = loaderRead.offset;
|
||||
LoaderOffset = loaderOffset;
|
||||
if ((*(s32 *)DvdProgress != 0) && (BS2BootFromCache == 0)) {
|
||||
DvdReadPending = 1;
|
||||
DvdTransferLength = loaderRead.length;
|
||||
DvdTransferLength = loaderLength;
|
||||
}
|
||||
OSRestoreInterrupts(readInterruptsEnabled);
|
||||
State = BS2_STT_44;
|
||||
} else
|
||||
State = BS2_STT_45;
|
||||
break;
|
||||
}
|
||||
case 0x2c:
|
||||
status = CheckBS2CommandStatus();
|
||||
if (status != 0)
|
||||
@@ -2052,13 +2064,15 @@ invalidRvlRegion:
|
||||
BannerAllocation = status;
|
||||
if (status == 0)
|
||||
OSPanic("BS2Mach.c", 0x12c8, "BS2 ERROR >>> Cannnot alloc 0x%08x from MEMAllocator", bannerFile.length);
|
||||
bannerAddress = BannerAllocation + 32 - BannerAllocation % 32;
|
||||
BannerLength = bannerFile.length;
|
||||
BannerBuffer = BannerAllocation + 32 - BannerAllocation % 32;
|
||||
BannerBuffer = bannerAddress;
|
||||
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
|
||||
} else {
|
||||
if ((BannerBuffer != 0) && (BannerLength != 0)) {
|
||||
if (BannerLength < ((bannerFile.length + 0x1fU) & 0xffffffe0))
|
||||
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)");
|
||||
OSPanic("BS2Mach.c", 0x12d3, "BS2 ERROR >>> Banner buffer is not enough to load banner file (0x%08x)",
|
||||
bannerFile.length);
|
||||
BS2Report("BannerBufferAddr : %08X\n", BannerBuffer);
|
||||
} else
|
||||
OSPanic("BS2Mach.c", 0x12da, "BS2 ERROR >>> MEMAllocator and banner buffer is not set");
|
||||
@@ -2162,7 +2176,7 @@ invalidRvlRegion:
|
||||
BS2BootFromCache = 0;
|
||||
BS2BootCaching = 1;
|
||||
LoadingTitle = 0;
|
||||
switch (Block.state) {
|
||||
switch (BS2ReadDVDState(&Block)) {
|
||||
case 4:
|
||||
case 5:
|
||||
CheckDVDCommandStatus(&Block);
|
||||
@@ -2307,7 +2321,7 @@ invalidRvlRegion:
|
||||
break;
|
||||
case 0x42:
|
||||
currentTime = __OSGetSystemTime();
|
||||
if ((OSTime)(currentTime - (((u64)CoverOpenTimeHigh << 32) | CoverOpenTimeLow)) < OSMillisecondsToTicks((OSTime)350))
|
||||
if ((OSTime)(currentTime - CoverOpenTime) < OSMillisecondsToTicks((OSTime)350))
|
||||
break;
|
||||
currentTime = __OSGetSystemTime();
|
||||
CoverPollTime = currentTime;
|
||||
|
||||
@@ -9,14 +9,13 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT] = {0};
|
||||
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT] = {0};
|
||||
static OSThread Thread = {0};
|
||||
static u8 ThreadStack[4096] = {0};
|
||||
static BS2UpdateHeader UpdateHeader0 ALIGN32 = {0};
|
||||
static BS2UpdateHeader UpdateHeader1 ALIGN32 = {0};
|
||||
static u32 Flags1[BS2_UPDATE_ENTRY_COUNT];
|
||||
static OSThread Thread;
|
||||
static u8 ThreadStack[4096];
|
||||
static BS2UpdateHeader UpdateHeader0 ALIGN32;
|
||||
static BS2UpdateHeader UpdateHeader1 ALIGN32;
|
||||
|
||||
#define UPDATE_DISC_ENTRIES ((BS2UpdateEntry*)0x80480000)
|
||||
BS2UpdateEntry DiscEntries[BS2_UPDATE_ENTRY_COUNT] ADDRESS(0x80480000);
|
||||
|
||||
s32 WADCheckImport(u64 titleId, u16 titleVersion);
|
||||
s32 WADImportDVDForBS(const char* path, void* buffer, u32 length);
|
||||
@@ -32,8 +31,8 @@ static u32 RebootRequired = 0;
|
||||
static BOOL ContainsSeatTitles = 0;
|
||||
static u32 UpdateImportState = 0;
|
||||
static u32 UpdateImportResult = 0;
|
||||
u32 StartUpdate = 0;
|
||||
u32 CancelUpdate = 0;
|
||||
volatile u32 StartUpdate = 0;
|
||||
volatile u32 CancelUpdate = 0;
|
||||
static u32 UpdateProgress = 0;
|
||||
static volatile s32 rc = 0;
|
||||
static u64 VersionIOS = 0;
|
||||
@@ -50,71 +49,45 @@ char* getSuffix(const char* path) {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
void BS2UpdateInit(void* allocator) {
|
||||
BS2Report("initialize BS2Update\n");
|
||||
ConsoleType = OSGetConsoleType();
|
||||
VersionES = __OSGetHollywoodRev();
|
||||
VersionMEM2 = OSGetPhysicalMem2Size();
|
||||
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
|
||||
BS2Report("Console Type : %08X\n", ConsoleType);
|
||||
BS2Report("Hollywood Rev : %08X\n", VersionES);
|
||||
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
|
||||
MemAllocator = allocator;
|
||||
State = 0;
|
||||
CurrentEntry = NULL;
|
||||
pEntries = NULL;
|
||||
EntriesCount = 0;
|
||||
memset(UPDATE_DISC_ENTRIES, 0, 0x40000);
|
||||
memset(EntriesToImport, 0, 0x40000);
|
||||
memset(Flags1, 0, sizeof(Flags1));
|
||||
BS2Report("Create update thread\n");
|
||||
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
|
||||
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
|
||||
OSResumeThread(&Thread);
|
||||
}
|
||||
|
||||
// MWCC needs the shared product-region result paths to preserve branch layout.
|
||||
static inline u32 BS2SelectUpdateEntries(void) {
|
||||
|
||||
static u32 Flags0[BS2_UPDATE_ENTRY_COUNT];
|
||||
BOOL missingFile;
|
||||
u32 index;
|
||||
u32 selectedCount;
|
||||
u32 requiredBytes;
|
||||
u32 requiredInodes;
|
||||
u32 channelCount;
|
||||
u32 index;
|
||||
BS2UpdateEntry* seatEntries;
|
||||
BS2UpdateEntry* selectedSeats;
|
||||
u32 selectedSeatCount;
|
||||
BOOL regionValid;
|
||||
u32 titleRegion;
|
||||
struct {
|
||||
u32 freeChannels;
|
||||
u32 freeBlocks;
|
||||
u32 freeInodes;
|
||||
u32 ticketCount;
|
||||
char productArea[8];
|
||||
u64 titleId;
|
||||
char updatePath[32];
|
||||
char seatPath[32];
|
||||
DVDFileInfo file;
|
||||
} scratch;
|
||||
u32 freeChannels;
|
||||
u32 freeBlocks;
|
||||
u32 freeInodes;
|
||||
u32 ticketCount;
|
||||
char productArea[8];
|
||||
u64 titleId;
|
||||
char updatePath[32];
|
||||
char seatPath[32];
|
||||
DVDFileInfo file;
|
||||
|
||||
missingFile = FALSE;
|
||||
selectedCount = 0;
|
||||
requiredBytes = 0;
|
||||
requiredInodes = 0;
|
||||
channelCount = 0;
|
||||
scratch.freeChannels = 0;
|
||||
scratch.freeBlocks = 0;
|
||||
scratch.freeInodes = 0;
|
||||
freeChannels = 0;
|
||||
freeBlocks = 0;
|
||||
freeInodes = 0;
|
||||
selectedSeatCount = 0;
|
||||
State = 0;
|
||||
ContainsSeatTitles = FALSE;
|
||||
if (ES_GetTitleId(&scratch.titleId) != ES_ERR_OK) {
|
||||
if (ES_GetTitleId(&titleId) != ES_ERR_OK) {
|
||||
regionValid = FALSE;
|
||||
} else {
|
||||
titleRegion = (u8)scratch.titleId;
|
||||
titleRegion = (u8)titleId;
|
||||
switch (SCGetProductArea()) {
|
||||
case SC_PRODUCT_AREA_JPN:
|
||||
case SC_PRODUCT_AREA_TWN:
|
||||
@@ -159,23 +132,23 @@ product_region_checked:
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
if (!SCGetProductAreaString(scratch.productArea, sizeof(scratch.productArea))) {
|
||||
if (!SCGetProductAreaString(productArea, sizeof(productArea))) {
|
||||
BS2Report("Error: failed to get product information.");
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
strcpy(scratch.updatePath, "__update.inf");
|
||||
strcat(scratch.updatePath, ".");
|
||||
strcat(scratch.updatePath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
|
||||
strcpy(updatePath, "__update.inf");
|
||||
strcat(updatePath, ".");
|
||||
strcat(updatePath, productArea);
|
||||
if (DVDConvertPathToEntrynum(updatePath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 6:
|
||||
case 11:
|
||||
strcpy(scratch.updatePath, "__update.inf");
|
||||
if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) {
|
||||
case SC_PRODUCT_AREA_JPN:
|
||||
case SC_PRODUCT_AREA_USA:
|
||||
case SC_PRODUCT_AREA_EUR:
|
||||
case SC_PRODUCT_AREA_KOR:
|
||||
case SC_PRODUCT_AREA_CHN:
|
||||
strcpy(updatePath, "__update.inf");
|
||||
if (DVDConvertPathToEntrynum(updatePath) < 0) {
|
||||
BS2Report("Error: update information file is not found.");
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
@@ -187,13 +160,13 @@ product_region_checked:
|
||||
goto selection_complete;
|
||||
}
|
||||
}
|
||||
BS2Report("%s is found.\n", scratch.updatePath);
|
||||
if (!DVDOpen(scratch.updatePath, &scratch.file)) {
|
||||
BS2Report("%s is found.\n", updatePath);
|
||||
if (!DVDOpen(updatePath, &file)) {
|
||||
BS2Report("Error: failed to open update information file.");
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) {
|
||||
if (DVDReadPrio(&file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information header.");
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
@@ -214,25 +187,24 @@ product_region_checked:
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, UPDATE_DISC_ENTRIES, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
if (DVDReadPrio(&file, DiscEntries, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information.");
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
{
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (index = 0; index < UpdateHeader0.wadCount; index++) {
|
||||
if ((discEntries[index].attr & 1) == 0) {
|
||||
if ((DiscEntries[index].attr & 1) == 0) {
|
||||
continue;
|
||||
}
|
||||
switch (OSGetPhysicalMem2Size()) {
|
||||
case 0x4000000:
|
||||
if ((discEntries[index].depend & 1) == 0) {
|
||||
if ((DiscEntries[index].depend & 1) == 0) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 0x8000000:
|
||||
if ((discEntries[index].depend & 2) == 0) {
|
||||
if ((DiscEntries[index].depend & 2) == 0) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -242,37 +214,37 @@ product_region_checked:
|
||||
selectedCount = 0;
|
||||
goto selection_complete;
|
||||
}
|
||||
if (DVDOpen(discEntries[index].path, &scratch.file) < 0) {
|
||||
BS2Report("%s is not found\n", discEntries[index].path);
|
||||
if (DVDOpen(DiscEntries[index].path, &file) < 0) {
|
||||
BS2Report("%s is not found\n", DiscEntries[index].path);
|
||||
missingFile = TRUE;
|
||||
continue;
|
||||
}
|
||||
discEntries[index].size = scratch.file.length;
|
||||
if (discEntries[index].type == 0) {
|
||||
DiscEntries[index].size = file.length;
|
||||
if (DiscEntries[index].type == 0) {
|
||||
selectedCount++;
|
||||
} else if (WADCheckImport(discEntries[index].titleId, discEntries[index].titleVersion) == 0) {
|
||||
BS2Report("%s is already installed\n", discEntries[index].path);
|
||||
} else if (WADCheckImport(DiscEntries[index].titleId, DiscEntries[index].titleVersion) == 0) {
|
||||
BS2Report("%s is already installed\n", DiscEntries[index].path);
|
||||
Flags1[index] = 0;
|
||||
} else {
|
||||
BS2Report("%s\n", discEntries[index].path);
|
||||
memcpy(&EntriesToImport[selectedCount], &discEntries[index], sizeof(BS2UpdateEntry));
|
||||
BS2Report("%s\n", DiscEntries[index].path);
|
||||
memcpy(&EntriesToImport[selectedCount], &DiscEntries[index], sizeof(BS2UpdateEntry));
|
||||
selectedCount++;
|
||||
Flags1[index] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
strcpy(scratch.seatPath, "__seatholder.inf");
|
||||
strcat(scratch.seatPath, ".");
|
||||
strcat(scratch.seatPath, scratch.productArea);
|
||||
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
|
||||
strcpy(seatPath, "__seatholder.inf");
|
||||
strcat(seatPath, ".");
|
||||
strcat(seatPath, productArea);
|
||||
if (DVDConvertPathToEntrynum(seatPath) < 0) {
|
||||
switch (SCGetProductArea()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 6:
|
||||
case 11:
|
||||
strcpy(scratch.seatPath, "__seatholder.inf");
|
||||
if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) {
|
||||
case SC_PRODUCT_AREA_JPN:
|
||||
case SC_PRODUCT_AREA_USA:
|
||||
case SC_PRODUCT_AREA_EUR:
|
||||
case SC_PRODUCT_AREA_KOR:
|
||||
case SC_PRODUCT_AREA_CHN:
|
||||
strcpy(seatPath, "__seatholder.inf");
|
||||
if (DVDConvertPathToEntrynum(seatPath) < 0) {
|
||||
BS2Report("Error: update seatholder information file is not found.");
|
||||
goto seats_done;
|
||||
}
|
||||
@@ -282,12 +254,12 @@ product_region_checked:
|
||||
goto seats_done;
|
||||
}
|
||||
}
|
||||
BS2Report("%s is found.\n", scratch.seatPath);
|
||||
if (!DVDOpen(scratch.seatPath, &scratch.file)) {
|
||||
BS2Report("%s is found.\n", seatPath);
|
||||
if (!DVDOpen(seatPath, &file)) {
|
||||
BS2Report("Error: failed to open update information file.");
|
||||
goto seats_done;
|
||||
}
|
||||
if (DVDReadPrio(&scratch.file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) {
|
||||
if (DVDReadPrio(&file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information header.");
|
||||
goto seats_done;
|
||||
}
|
||||
@@ -300,11 +272,9 @@ product_region_checked:
|
||||
BS2Report("Error: found too many extra entries.");
|
||||
goto seats_done;
|
||||
}
|
||||
seatEntries = UPDATE_DISC_ENTRIES;
|
||||
seatEntries += UpdateHeader0.wadCount;
|
||||
selectedSeats = EntriesToImport;
|
||||
selectedSeats += selectedCount;
|
||||
if (DVDReadPrio(&scratch.file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
seatEntries = DiscEntries + UpdateHeader0.wadCount;
|
||||
selectedSeats = EntriesToImport + selectedCount;
|
||||
if (DVDReadPrio(&file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) {
|
||||
BS2Report("Error: failed to read update information.");
|
||||
goto seats_done;
|
||||
}
|
||||
@@ -337,7 +307,7 @@ product_region_checked:
|
||||
State = 5;
|
||||
goto seats_done;
|
||||
}
|
||||
if (DVDOpen(seatEntries[index].path, &scratch.file) < 0) {
|
||||
if (DVDOpen(seatEntries[index].path, &file) < 0) {
|
||||
BS2Report("%s is not found\n", seatEntries[index].path);
|
||||
missingFile = TRUE;
|
||||
continue;
|
||||
@@ -345,11 +315,11 @@ product_region_checked:
|
||||
if (seatEntries[index].type != 7) {
|
||||
continue;
|
||||
}
|
||||
if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &scratch.ticketCount) != ES_ERR_OK) {
|
||||
if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &ticketCount) != ES_ERR_OK) {
|
||||
BS2Report("Faild to get eTicket views.\n");
|
||||
continue;
|
||||
}
|
||||
if (scratch.ticketCount != 0) {
|
||||
if (ticketCount != 0) {
|
||||
continue;
|
||||
}
|
||||
if (SCGetWwwRestriction() && ((u32)(seatEntries[index].titleId & 0xFFFFFFFFULL) & 0xFFFFFF00) == 0x48414400) {
|
||||
@@ -372,23 +342,23 @@ product_region_checked:
|
||||
requiredInodes += seatEntries[index].inodes;
|
||||
}
|
||||
if (channelCount != 0) {
|
||||
if (!SCGetFreeChannelAppCount(&scratch.freeChannels)) {
|
||||
if (!SCGetFreeChannelAppCount(&freeChannels)) {
|
||||
BS2Report("Error: cannot get channel count.");
|
||||
goto seats_done;
|
||||
}
|
||||
if (NANDSecretGetUserAvailableArea(&scratch.freeBlocks, &scratch.freeInodes) != NAND_RESULT_OK) {
|
||||
if (NANDSecretGetUserAvailableArea(&freeBlocks, &freeInodes) != NAND_RESULT_OK) {
|
||||
BS2Report("Error: cannot get free user blocks.");
|
||||
goto seats_done;
|
||||
}
|
||||
if ((scratch.freeBlocks << 14) < 0x1004000 || requiredBytes > (scratch.freeBlocks << 14) - 0x1004000) {
|
||||
if ((freeBlocks << 14) < 0x1004000 || requiredBytes > (freeBlocks << 14) - 0x1004000) {
|
||||
BS2Report("Sufficient user blocks doesn't exist.");
|
||||
goto seats_done;
|
||||
}
|
||||
if (scratch.freeInodes < requiredInodes + 36) {
|
||||
if (freeInodes < requiredInodes + 36) {
|
||||
BS2Report("Sufficient user inodes doesn't exist.");
|
||||
goto seats_done;
|
||||
}
|
||||
if (channelCount > scratch.freeChannels) {
|
||||
if (channelCount > freeChannels) {
|
||||
BS2Report("No enough blank channel.");
|
||||
goto seats_done;
|
||||
}
|
||||
@@ -410,14 +380,13 @@ seats_done:
|
||||
pEntries = EntriesToImport;
|
||||
pFlags = Flags1;
|
||||
{
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (index = 0; index < UpdateHeader0.wadCount; index++) {
|
||||
if (Flags1[index] == 1) {
|
||||
BS2Report("File: %s\n", discEntries[index].path);
|
||||
BS2Report("Name: %s\n", discEntries[index].dataName);
|
||||
BS2Report("Info: %s\n", discEntries[index].dataMeta);
|
||||
BS2Report("Attr: %s\n", (discEntries[index].attr & 1) ? "Critical" : "Non critical");
|
||||
BS2Report(" %s\n", (discEntries[index].attr & 2) ? "Reboot" : "Not reboot");
|
||||
BS2Report("File: %s\n", DiscEntries[index].path);
|
||||
BS2Report("Name: %s\n", DiscEntries[index].dataName);
|
||||
BS2Report("Info: %s\n", DiscEntries[index].dataMeta);
|
||||
BS2Report("Attr: %s\n", (DiscEntries[index].attr & 1) ? "Critical" : "Non critical");
|
||||
BS2Report(" %s\n", (DiscEntries[index].attr & 2) ? "Reboot" : "Not reboot");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,6 +394,31 @@ selection_complete:
|
||||
return selectedCount;
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
void BS2UpdateInit(void* allocator) {
|
||||
BS2Report("initialize BS2Update\n");
|
||||
ConsoleType = OSGetConsoleType();
|
||||
VersionES = __OSGetHollywoodRev();
|
||||
VersionMEM2 = OSGetPhysicalMem2Size();
|
||||
__OSGetIOSRev((OSIOSRev*)&VersionIOS);
|
||||
BS2Report("Console Type : %08X\n", ConsoleType);
|
||||
BS2Report("Hollywood Rev : %08X\n", VersionES);
|
||||
BS2Report("MEM2 Size : %08X\n", VersionMEM2);
|
||||
MemAllocator = allocator;
|
||||
State = 0;
|
||||
CurrentEntry = NULL;
|
||||
pEntries = NULL;
|
||||
EntriesCount = 0;
|
||||
memset(DiscEntries, 0, 0x40000);
|
||||
memset(EntriesToImport, 0, 0x40000);
|
||||
memset(Flags1, 0, sizeof(Flags1));
|
||||
BS2Report("Create update thread\n");
|
||||
OSCreateThread(&Thread, UpdateThread, NULL, ThreadStack + sizeof(ThreadStack),
|
||||
sizeof(ThreadStack), 31, OS_THREAD_ATTR_DETACH);
|
||||
OSResumeThread(&Thread);
|
||||
}
|
||||
|
||||
static void* UpdateThread(void* argument) {
|
||||
u32 index;
|
||||
s32 importResult;
|
||||
@@ -442,25 +436,24 @@ static void* UpdateThread(void* argument) {
|
||||
State = 1;
|
||||
UpdateProgress = 0;
|
||||
{
|
||||
BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES;
|
||||
for (;;) {
|
||||
if (StartUpdate != 0) {
|
||||
if (UpdateProgress < UpdateHeader0.wadCount) {
|
||||
BS2Report("Progress : %d\n", UpdateProgress);
|
||||
if (Flags1[UpdateProgress] == 1) {
|
||||
const char* path = discEntries[UpdateProgress].path;
|
||||
const char* path = DiscEntries[UpdateProgress].path;
|
||||
BS2Report("Import : %s\n", path);
|
||||
State = 2;
|
||||
CurrentEntry = &discEntries[UpdateProgress];
|
||||
if (discEntries[UpdateProgress].type == 0) {
|
||||
CurrentEntry = &DiscEntries[UpdateProgress];
|
||||
if (DiscEntries[UpdateProgress].type == 0) {
|
||||
UpdateProgress++;
|
||||
continue;
|
||||
}
|
||||
if (((const BS2UpdateEntry *)discEntries)[UpdateProgress].type == 1) {
|
||||
if (((const BS2UpdateEntry *)DiscEntries)[UpdateProgress].type == 1) {
|
||||
BS2Report("BS2WADImportDVD : ");
|
||||
index = UpdateProgress;
|
||||
if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) {
|
||||
importResult = WADImportDVDForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
|
||||
if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) {
|
||||
importResult = WADImportDVDForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
|
||||
} else {
|
||||
importResult = 0;
|
||||
}
|
||||
@@ -468,20 +461,20 @@ static void* UpdateThread(void* argument) {
|
||||
BS2Report("rc = %d\n", rc);
|
||||
if (rc != 0) {
|
||||
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
|
||||
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5);
|
||||
rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5);
|
||||
State = 5;
|
||||
UpdateProgress = UpdateHeader0.wadCount + 1;
|
||||
break;
|
||||
}
|
||||
if ((discEntries[UpdateProgress].attr & 2) != 0) {
|
||||
if ((DiscEntries[UpdateProgress].attr & 2) != 0) {
|
||||
RebootRequired = 1;
|
||||
}
|
||||
UpdateProgress++;
|
||||
} else {
|
||||
BS2Report("BS2WADImportDVDEx : ");
|
||||
index = UpdateProgress;
|
||||
if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) {
|
||||
importResult = WADImportDVDExForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
|
||||
if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) {
|
||||
importResult = WADImportDVDExForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000);
|
||||
} else {
|
||||
importResult = 0;
|
||||
}
|
||||
@@ -489,18 +482,18 @@ static void* UpdateThread(void* argument) {
|
||||
BS2Report("rc = %d\n", rc);
|
||||
if (rc != 0) {
|
||||
NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d",
|
||||
rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F);
|
||||
rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F);
|
||||
State = 5;
|
||||
UpdateProgress = UpdateHeader0.wadCount + 1;
|
||||
break;
|
||||
}
|
||||
if ((discEntries[UpdateProgress].attr & 2) != 0) {
|
||||
if ((DiscEntries[UpdateProgress].attr & 2) != 0) {
|
||||
RebootRequired = 1;
|
||||
}
|
||||
UpdateProgress++;
|
||||
}
|
||||
} else {
|
||||
const char* path = discEntries[UpdateProgress].path;
|
||||
const char* path = DiscEntries[UpdateProgress].path;
|
||||
BS2Report("Not import : %s\n", path);
|
||||
UpdateProgress++;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <revolution/sc.h>
|
||||
|
||||
VoiceInfo Voices[AX_VOICE_MAX];
|
||||
u8 sZeroMem[0x100];
|
||||
u8 sZeroMem[0x100] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
void* zeroBuffer;
|
||||
bool AxAdpcmSimplePlayer::sSysInit;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
int gDpdWaitFrm = 0;
|
||||
|
||||
#include "iplwww/www_wiisetting.h"
|
||||
|
||||
#include <string.h>
|
||||
@@ -9,16 +11,18 @@
|
||||
|
||||
#include "iplwww/www_browser.h"
|
||||
|
||||
int gDpdWaitFrm = 0;
|
||||
BOOL gEnableDpd = TRUE;
|
||||
|
||||
namespace www {
|
||||
namespace wiisetting {
|
||||
static const char emptyString[] = "";
|
||||
char MSG_TICK_TIMER_TAG[12] = "[TickTimer]";
|
||||
char MSG_WARNING_TAG[10] = "[Warning]";
|
||||
char MSG_EVENT_TAG[10] = "[[Event]]";
|
||||
const char* Message[] = {NULL, NULL, NULL, NULL, emptyString, NULL};
|
||||
struct ReportInfo {
|
||||
char tickTimerTag[12];
|
||||
char warningTag[10];
|
||||
char eventTag[10];
|
||||
const char* MessageArr[6];
|
||||
};
|
||||
|
||||
ReportInfo reportInfo = {"[TickTimer]", "[Warning]", "[[Event]]", {NULL, NULL, NULL, NULL, NULL, NULL}};
|
||||
|
||||
const u8 kbLangUsaLUT[][0x30] = {
|
||||
{
|
||||
@@ -150,8 +154,8 @@ namespace www {
|
||||
extern const char* strProps[FORM_ID_MAX];
|
||||
int getStringPropertyIdx(const char* targetStr) {
|
||||
const char* names[ARRAY_LENGTH(strProps)];
|
||||
const char** destinationName = names - 1;
|
||||
const char* const* sourceName = strProps - 1;
|
||||
const char** destinationName = names - 1;
|
||||
for (int i = 0; i < (ARRAY_LENGTH(names) >> 1); i++) {
|
||||
*(++destinationName) = *(++sourceName);
|
||||
*(++destinationName) = *(++sourceName);
|
||||
@@ -169,9 +173,19 @@ namespace www {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int getSettingProperty(const char* str, WWWJSPluginValue* val);
|
||||
|
||||
static inline void selectEuropeanKeyboardLanguage(u32& kbLang) {
|
||||
int i;
|
||||
for (i = 0; i < 0x3b; i++) {
|
||||
if (sWiiData.data[WB_ID_COUNTRY] == kbLangEurLUT[ipl::System::getLanguage() - 1][i] + 0x40) {
|
||||
kbLang = (u8)(i + 0x40);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Getter_(WWWJSPluginObj* obj, const char* str, WWWJSPluginValue* val) {
|
||||
int retVal;
|
||||
int strPropIdx;
|
||||
if (strcmp(str, "CallOSReport") == 0) {
|
||||
int data;
|
||||
if (opera_callbacks->globalGet(obj, 0, 0, wiiOSReport, wiiOSReport, "", 0, (WWWJSPluginValueData*)&data) < 0) {
|
||||
@@ -191,6 +205,15 @@ namespace www {
|
||||
return 7;
|
||||
}
|
||||
}
|
||||
return getSettingProperty(str, val);
|
||||
}
|
||||
|
||||
static inline int getSettingProperty(const char* str, WWWJSPluginValue* val) {
|
||||
int privacyIndex;
|
||||
int retVal;
|
||||
SetStringBuf* strBuf;
|
||||
int maskLength;
|
||||
int strPropIdx;
|
||||
if (!(writeBackID == WB_ID_PROGRESSIVE || writeBackID == WB_ID_PAL || writeBackID == WB_ID_COUNTRY || writeBackID == WB_ID_LIGHT ||
|
||||
writeBackID == WB_ID_LANGUAGE || writeBackID == WB_ID_RATE)) {
|
||||
writeBackID = WB_ID_RESET;
|
||||
@@ -281,14 +304,13 @@ namespace www {
|
||||
memset(pString->asterisks, 0, sizeof(pString->asterisks));
|
||||
OSReport("mode %d %d\n", saveData, (u16)ipl::ncd::NCDSetting::getPrivacyMode());
|
||||
if (saveData == (u16)ipl::ncd::NCDSetting::getPrivacyMode()) {
|
||||
int i;
|
||||
OSReport("len ::: %d\n", ipl::ncd::NCDSetting::getPrivacyLen());
|
||||
for (i = 0; i < ipl::ncd::NCDSetting::getPrivacyLen(); i++) {
|
||||
pString->asterisks[i] = '*';
|
||||
for (privacyIndex = 0; privacyIndex < ipl::ncd::NCDSetting::getPrivacyLen(); privacyIndex++) {
|
||||
pString->asterisks[privacyIndex] = '*';
|
||||
}
|
||||
if (0x20 < i) {
|
||||
if (0x20 < privacyIndex) {
|
||||
pString->asterisks[0x20] = '\n';
|
||||
pString->asterisks[i] = '*';
|
||||
pString->asterisks[privacyIndex] = '*';
|
||||
}
|
||||
} else {
|
||||
memset(pString->securityKey, 0, sizeof(pString->securityKey));
|
||||
@@ -298,13 +320,11 @@ namespace www {
|
||||
}
|
||||
case FORM_ID_DUMMY_SECURITY_KEY: {
|
||||
memset(pString->asterisks, 0, sizeof(pString->asterisks));
|
||||
SetStringBuf* strBuf;
|
||||
int i;
|
||||
for (i = 0; i < strlen((strBuf = pString)->securityKey); strBuf->asterisks[i++] = '*') {
|
||||
for (maskLength = 0; maskLength < strlen((strBuf = pString)->securityKey); strBuf->asterisks[maskLength++] = '*') {
|
||||
}
|
||||
if (i > 0x20) {
|
||||
if (maskLength > 0x20) {
|
||||
pString->asterisks[0x20] = '\n';
|
||||
pString->asterisks[i] = '*';
|
||||
pString->asterisks[maskLength] = '*';
|
||||
}
|
||||
val->data.jsStr = pString->asterisks;
|
||||
break;
|
||||
@@ -522,12 +542,7 @@ namespace www {
|
||||
}
|
||||
}
|
||||
} else if ((u32)ipl::System::getRegion() == SC_PRODUCT_AREA_EUR) {
|
||||
for (int i = 0; i < 0x3b; i++) {
|
||||
if (sWiiData.data[WB_ID_COUNTRY] == kbLangEurLUT[ipl::System::getLanguage() - 1][i] + 0x40) {
|
||||
kbLang = (u8)(i + 0x40);
|
||||
break;
|
||||
}
|
||||
}
|
||||
selectEuropeanKeyboardLanguage(kbLang);
|
||||
}
|
||||
val->data.jsDouble = (u8)kbLang;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#define TI_CANDIDATEBOX_IMPLEMENTATION
|
||||
#define TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
#include "keyboard/tiCandidateBox.h"
|
||||
#undef TI_CANDIDATEBOX_SAMPLE_CLASS
|
||||
|
||||
#include "keyboard/tiManager.h"
|
||||
|
||||
@@ -60,11 +62,7 @@ namespace textinput {
|
||||
{ANM_InvalidOff, "fs_VK_predictInput_a_invalidMode_OFF.brlan"},
|
||||
};
|
||||
|
||||
struct CandidatePaneData {
|
||||
PaneToAnimation panes[26];
|
||||
};
|
||||
|
||||
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
|
||||
static const PaneToAnimation csPaneToAnimation[] = {
|
||||
{KT_CandidateText, "N_predictInput", 1, NULL, {&csAninationFile[0]}},
|
||||
{KT_ScrollButton,
|
||||
"P_prdc_scrl_Left",
|
||||
@@ -195,7 +193,7 @@ namespace textinput {
|
||||
6,
|
||||
NULL,
|
||||
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
|
||||
}};
|
||||
};
|
||||
|
||||
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
|
||||
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
|
||||
@@ -376,48 +374,44 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
|
||||
const char* forceAddName;
|
||||
u16 i;
|
||||
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
|
||||
const PaneToAnimation& p = scCandidatePaneData.panes[i];
|
||||
for (u16 i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
|
||||
const PaneToAnimation& paneAnimations = csPaneToAnimation[i];
|
||||
CandidateTextAnmPane* pane = NULL;
|
||||
switch (p.type) {
|
||||
switch (paneAnimations.type) {
|
||||
case KT_ScrollButton: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
|
||||
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(p.paneName), NULL);
|
||||
pane = new (pBtnBuf) CandidateScrollAnmPane(getPane(paneAnimations.paneName), NULL);
|
||||
break;
|
||||
}
|
||||
case KT_CandidateText: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateTextAnmPane));
|
||||
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(p.paneName), NULL);
|
||||
pane = new (pBtnBuf) CandidateTextAnmPane(getPane(paneAnimations.paneName), NULL);
|
||||
break;
|
||||
}
|
||||
case KT_OnOffButton: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(OnOffAnmPane));
|
||||
pane = new (pBtnBuf) OnOffAnmPane(getPane(p.paneName), &mOnOffButton);
|
||||
pane = new (pBtnBuf) OnOffAnmPane(getPane(paneAnimations.paneName), &mOnOffButton);
|
||||
break;
|
||||
}
|
||||
|
||||
case KT_Window: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(PredictWindow));
|
||||
pane = new (pBtnBuf) PredictWindow(getPane(p.paneName), &mTextWindow);
|
||||
pane = new (pBtnBuf) PredictWindow(getPane(paneAnimations.paneName), &mTextWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
|
||||
forceAddName = p.forceAddName;
|
||||
for (u16 j = 0; j < p.count; j++) {
|
||||
const AnimationFile* const& animation = p.pAnims[j];
|
||||
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
|
||||
for (u16 j = 0; j < paneAnimations.count; j++) {
|
||||
void* pResource = mpMultiArcResourceAccessor->GetResource(0, paneAnimations.pAnims[j]->fileName);
|
||||
AnimTransformPane* transform =
|
||||
static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(pResource, mpMultiArcResourceAccessor));
|
||||
|
||||
if (forceAddName == NULL) {
|
||||
pane->addAnimation(allocator, animation->id, transform, false, true);
|
||||
if (paneAnimations.forceAddName == NULL) {
|
||||
pane->addAnimation(allocator, paneAnimations.pAnims[j]->id, transform, false, true);
|
||||
} else {
|
||||
pane->forceAddAnimation(allocator, animation->id, transform, forceAddName, false, true);
|
||||
pane->forceAddAnimation(allocator, paneAnimations.pAnims[j]->id, transform, paneAnimations.forceAddName, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -676,8 +670,8 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::cancelStateFocusIn() {
|
||||
const PaneToAnimation* pane = scCandidatePaneData.panes;
|
||||
for (int i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
|
||||
const PaneToAnimation* pane = csPaneToAnimation;
|
||||
for (int i = 0; i < ARRAY_LENGTH(csPaneToAnimation); i++) {
|
||||
CandidateTextAnmPane* p = static_cast<CandidateTextAnmPane*>(searchAnmPane(pane->paneName));
|
||||
if (p != NULL) {
|
||||
switch (p->getKeyType()) {
|
||||
@@ -1764,3 +1758,48 @@ namespace textinput {
|
||||
|
||||
} // namespace candidatebox
|
||||
} // namespace textinput
|
||||
|
||||
inline void textinput::util::Animation::startAnm(AnimObserver* observer, f32 start, f32 end, f32 duration, void* data) {
|
||||
mfStartPoint = start;
|
||||
mfEndPoint = end;
|
||||
mfAnimationTime = duration;
|
||||
mfCurrentFrame = 0.0f;
|
||||
mbInAnimation = true;
|
||||
mpAnimObserver = observer;
|
||||
mpData = data;
|
||||
mbSE = false;
|
||||
if (observer) observer->onAnmEvent(AnimObserver::AE_0, data);
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::calc() {
|
||||
if (mbInAnimation) {
|
||||
if (mfCurrentFrame < mfAnimationTime) {
|
||||
mfCurrentFrame = 1.0f + mfCurrentFrame;
|
||||
} else {
|
||||
if (mbInAnimation && mpAnimObserver) {
|
||||
mpAnimObserver->onAnmEvent(AnimObserver::AE_1, mpData);
|
||||
}
|
||||
mbInAnimation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline f32 textinput::util::Animation::getValue() {
|
||||
return hermiteInterporation(mfCurrentFrame, 0.0f, mfStartPoint, 0.0f, mfAnimationTime, mfEndPoint, 0.0f);
|
||||
}
|
||||
|
||||
inline bool textinput::util::Animation::isActive() {
|
||||
return mbInAnimation;
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::setSEFlag(bool flag) {
|
||||
mbSE = flag;
|
||||
}
|
||||
|
||||
inline bool textinput::util::Animation::isSEFlag() {
|
||||
return mbSE;
|
||||
}
|
||||
|
||||
inline void textinput::util::Animation::stop() {
|
||||
mbInAnimation = false;
|
||||
}
|
||||
|
||||
@@ -115,99 +115,48 @@ extern const u8 controlKeys[];
|
||||
|
||||
u32 modifierFlag = modifierState & 0x8;
|
||||
|
||||
while (currentKeySet.IsValid()) {
|
||||
for (; currentKeySet.IsValid(); currentKeySet = currentKeySet.GetNext()) {
|
||||
int key = currentKeySet.GetKey();
|
||||
u32 command;
|
||||
|
||||
if (key == 0x4c) {
|
||||
goto sendCommand2;
|
||||
}
|
||||
|
||||
if (key < 0x4c) {
|
||||
if (key != 0x2b) {
|
||||
if (key < 0x2b) {
|
||||
if (key >= 0x2a) {
|
||||
goto sendCommand1;
|
||||
}
|
||||
} else {
|
||||
if (key >= 0x2d) {
|
||||
goto nextRepeatedKey;
|
||||
}
|
||||
goto checkSpecialCommand;
|
||||
}
|
||||
// MWCC needs the navigation cases to share this command tail.
|
||||
switch (key) {
|
||||
case 0x4c:
|
||||
sendCommand(2, NULL);
|
||||
continue;
|
||||
case 0x2a:
|
||||
sendCommand(1, NULL);
|
||||
continue;
|
||||
case 0x4f:
|
||||
command = 0x20;
|
||||
goto sendNavigationCommand;
|
||||
case 0x50:
|
||||
command = 0x1f;
|
||||
goto sendNavigationCommand;
|
||||
case 0x51:
|
||||
command = 0x1e;
|
||||
goto sendNavigationCommand;
|
||||
case 0x52:
|
||||
command = 0x1d;
|
||||
sendNavigationCommand:
|
||||
{
|
||||
u32 commandData[2];
|
||||
commandData[0] = command;
|
||||
commandData[1] = modifierState;
|
||||
sendCommand(0x26, commandData);
|
||||
}
|
||||
goto nextRepeatedKey;
|
||||
}
|
||||
|
||||
if (key == 0x51) {
|
||||
goto setNavigationCommand1e;
|
||||
}
|
||||
|
||||
if (key < 0x51) {
|
||||
if (key == 0x4f) {
|
||||
goto setNavigationCommand20;
|
||||
} else if (key >= 0x4f) {
|
||||
goto setNavigationCommand1f;
|
||||
continue;
|
||||
case 0x2c:
|
||||
if ((mgr()->getToolBar()->isQwerty() ||
|
||||
!mgr()->getCellPhoneKeyboard()->isNumeric()) && modifierFlag == 0) {
|
||||
NavigationCommand commandData = {8, modifierState};
|
||||
sendCommand(0x26, &commandData);
|
||||
}
|
||||
} else {
|
||||
if (key >= 0x53) {
|
||||
goto nextRepeatedKey;
|
||||
}
|
||||
goto setNavigationCommand1d;
|
||||
continue;
|
||||
case 0x2b:
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
goto nextRepeatedKey;
|
||||
|
||||
sendCommand2:
|
||||
sendCommand(2, NULL);
|
||||
goto nextRepeatedKey;
|
||||
|
||||
sendCommand1:
|
||||
sendCommand(1, NULL);
|
||||
goto nextRepeatedKey;
|
||||
|
||||
setNavigationCommand20:
|
||||
command = 0x20;
|
||||
goto sendNavigationCommand;
|
||||
|
||||
setNavigationCommand1f:
|
||||
command = 0x1f;
|
||||
goto sendNavigationCommand;
|
||||
|
||||
setNavigationCommand1e:
|
||||
command = 0x1e;
|
||||
goto sendNavigationCommand;
|
||||
|
||||
setNavigationCommand1d:
|
||||
command = 0x1d;
|
||||
|
||||
sendNavigationCommand:
|
||||
{
|
||||
u32 commandData[2];
|
||||
commandData[0] = command;
|
||||
commandData[1] = modifierState;
|
||||
sendCommand(0x26, commandData);
|
||||
}
|
||||
goto nextRepeatedKey;
|
||||
|
||||
checkSpecialCommand:
|
||||
if (mgr()->getToolBar()->isQwerty() ||
|
||||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
|
||||
if (modifierFlag == 0) {
|
||||
goto sendSpecialCommand;
|
||||
}
|
||||
}
|
||||
goto nextRepeatedKey;
|
||||
|
||||
sendSpecialCommand:
|
||||
{
|
||||
NavigationCommand commandData = {8, modifierState};
|
||||
sendCommand(0x26, &commandData);
|
||||
}
|
||||
|
||||
nextRepeatedKey:
|
||||
|
||||
currentKeySet = currentKeySet.GetNext();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -250,29 +199,28 @@ extern const u8 controlKeys[];
|
||||
bool sendCharacter = true;
|
||||
if (!mgr()->getToolBar()->isQwerty() &&
|
||||
mgr()->getCellPhoneKeyboard()->isNumeric()) {
|
||||
if (static_cast<wchar_t>(character) == '/') {
|
||||
goto suppressCharacter;
|
||||
}
|
||||
if (static_cast<wchar_t>(character) < '/') {
|
||||
if (static_cast<wchar_t>(character) >= '.') {
|
||||
goto checkNumericDot;
|
||||
switch (static_cast<wchar_t>(character)) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
break;
|
||||
case '.':
|
||||
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot()) {
|
||||
break;
|
||||
}
|
||||
goto suppressCharacter;
|
||||
case '/':
|
||||
default:
|
||||
sendCharacter = false;
|
||||
break;
|
||||
}
|
||||
if (static_cast<wchar_t>(character) >= ':') {
|
||||
goto suppressCharacter;
|
||||
}
|
||||
goto sendCharacterCheck;
|
||||
checkNumericDot:
|
||||
if (mgr()->getCellPhoneKeyboard()->isNumericWithDot()) {
|
||||
goto sendCharacterCheck;
|
||||
}
|
||||
suppressCharacter:
|
||||
sendCharacter = false;
|
||||
}
|
||||
|
||||
goto sendCharacterCheck;
|
||||
sendCharacterCheck:
|
||||
if (sendCharacter) {
|
||||
modifierState = 0;
|
||||
if ((hkbManager.GetModifierState() & 0x2) != 0) {
|
||||
@@ -287,7 +235,7 @@ extern const u8 controlKeys[];
|
||||
}
|
||||
|
||||
character = convertWCCode(character);
|
||||
KeyInputData keyInputData = {0, 0, 0, 1, 0, 0, 0};
|
||||
KeyInputData keyInputData = {0, 0, 0, 1, 0, 0, 0};
|
||||
keyInputData.character = character;
|
||||
keyInputData.modifier = modifierState;
|
||||
sendCommand(0, &keyInputData);
|
||||
@@ -325,24 +273,21 @@ extern const u8 controlKeys[];
|
||||
hkbManager.SetModifierState(capsLock ? 0x100 : 0, 0x100);
|
||||
}
|
||||
|
||||
if (mgr()->getToolBar()->isQwerty() ||
|
||||
!mgr()->getCellPhoneKeyboard()->isNumeric()) {
|
||||
goto sendKeyCheck;
|
||||
if (!mgr()->getToolBar()->isQwerty() &&
|
||||
mgr()->getCellPhoneKeyboard()->isNumeric()) {
|
||||
switch (translatedKey) {
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x1d:
|
||||
case 0x1e:
|
||||
case 0x1f:
|
||||
case 0x20:
|
||||
break;
|
||||
default:
|
||||
sendKey = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (translatedKey) {
|
||||
case 0x15:
|
||||
case 0x16:
|
||||
case 0x1d:
|
||||
case 0x1e:
|
||||
case 0x1f:
|
||||
case 0x20:
|
||||
break;
|
||||
default:
|
||||
sendKey = false;
|
||||
break;
|
||||
}
|
||||
sendKeyCheck:
|
||||
if (sendKey) {
|
||||
u32 commandData[2] = {translatedKey, modifierState};
|
||||
sendCommand(0x26, commandData);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@ void KPRSetMode(KPRQueue*, u32);
|
||||
|
||||
namespace textinput {
|
||||
namespace tistring {
|
||||
Decolated::~Decolated() {}
|
||||
void StringBase::create(MEMAllocator* allocator) {
|
||||
mpAllocator = allocator;
|
||||
mpszString = static_cast<wchar_t*>(MEMAllocFromAllocator(allocator, muMaxLength << 1));
|
||||
@@ -142,24 +141,13 @@ wchar_t StringBase::getLastWChar() {
|
||||
}
|
||||
|
||||
namespace {
|
||||
class CharacterOutput {
|
||||
public:
|
||||
CharacterOutput(wchar_t* output) : mpOutput(output), mCount(0) {
|
||||
mpOutput[0] = 0;
|
||||
}
|
||||
// This build has no Hangul composer; syllable state stays empty and keys are committed as typed.
|
||||
// MWCC needs these aggregate tests and dead stores for Hangul scheduling and count narrowing.
|
||||
struct HangulSyllable {
|
||||
u32 length;
|
||||
|
||||
void append(wchar_t ch) {
|
||||
mpOutput[mCount++] = ch;
|
||||
}
|
||||
|
||||
u16 finish() {
|
||||
mpOutput[mCount] = 0;
|
||||
return mCount;
|
||||
}
|
||||
|
||||
private:
|
||||
wchar_t* mpOutput;
|
||||
u32 mCount;
|
||||
bool isEmpty() const { return length == 0; }
|
||||
void clear() { length = 0; }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -172,10 +160,7 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
input[1] = 0;
|
||||
input[0] = 0;
|
||||
u16 count;
|
||||
if (static_cast<u32>(mTranslateMode) - 1 > 1) {
|
||||
goto nonKana;
|
||||
}
|
||||
{
|
||||
if (mTranslateMode == TM_Kana || mTranslateMode == TM_Roman) {
|
||||
mKanaStream.mOutput[4] = 0;
|
||||
mKanaStream.mOutput[3] = 0;
|
||||
mKanaStream.mOutput[2] = 0;
|
||||
@@ -191,20 +176,30 @@ void Decolated::inputChar(wchar_t ch) {
|
||||
input[static_cast<u8>(inputIndex)] = KPRGetChar(&mKanaStream.mQueue);
|
||||
}
|
||||
KPRLookAhead(&mKanaStream.mQueue, mKanaStream.mOutput, 5);
|
||||
goto inputReady;
|
||||
}
|
||||
nonKana:
|
||||
if (mTranslateMode == 3) {
|
||||
CharacterOutput output(input);
|
||||
output.append(ch);
|
||||
count = output.finish();
|
||||
} else if (mTranslateMode == TM_Hangul) {
|
||||
u32 outputLength = 0;
|
||||
HangulSyllable composing = {0};
|
||||
input[outputLength] = 0;
|
||||
if (!composing.isEmpty()) {
|
||||
outputLength += composing.length;
|
||||
}
|
||||
if (ch == L'\n') {
|
||||
composing.clear();
|
||||
}
|
||||
input[outputLength++] = ch;
|
||||
HangulSyllable next = {0};
|
||||
if (next.isEmpty()) {
|
||||
next.length = 1;
|
||||
}
|
||||
input[outputLength] = 0;
|
||||
composing.length = static_cast<u16>(outputLength);
|
||||
count = outputLength;
|
||||
mKanaStream.mOutput[0] = 0;
|
||||
} else {
|
||||
count = 1;
|
||||
input[0] = ch;
|
||||
input[1] = 0;
|
||||
}
|
||||
inputReady:
|
||||
setCandidate(0);
|
||||
u32 start;
|
||||
u32 end;
|
||||
|
||||
@@ -72,16 +72,14 @@ void WithZi::ChangeDictionaryLanguage(u8 language) {
|
||||
}
|
||||
if (entryIndex != -1) {
|
||||
dictionaryEntry = reinterpret_cast<u32*>(dictionaryTable[entryIndex].table);
|
||||
if (dictionaryEntry == NULL) goto noDictionary;
|
||||
attached = EZTXAttachOEMDict(
|
||||
(u8*)SearchOEMDictionary, *dictionaryEntry & 0xffff,
|
||||
dictionaryEntry, mpDictionaryWork);
|
||||
mOemDictionaryId = attached & 0xff;
|
||||
goto dictionaryReady;
|
||||
noDictionary:
|
||||
mOemDictionaryId = 0;
|
||||
dictionaryReady:
|
||||
;
|
||||
if (dictionaryEntry != NULL) {
|
||||
attached = EZTXAttachOEMDict(
|
||||
(u8*)SearchOEMDictionary, *dictionaryEntry & 0xffff,
|
||||
dictionaryEntry, mpDictionaryWork);
|
||||
mOemDictionaryId = attached & 0xff;
|
||||
} else {
|
||||
mOemDictionaryId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,6 +269,7 @@ void WithZi::partialConfirmForKR() {
|
||||
const wchar_t* letters;
|
||||
wchar_t value = util::toWLower(CandidatesBuffer[mInputLength - 1]);
|
||||
letters = kKoreanFinalLetters;
|
||||
// MWCC needs the match flag assigned at the loop exits.
|
||||
for (index = 0; index < 12; ++index) {
|
||||
if (value == *letters) {
|
||||
match = true;
|
||||
@@ -280,17 +279,14 @@ void WithZi::partialConfirmForKR() {
|
||||
}
|
||||
match = false;
|
||||
finalLetterChecked:
|
||||
if (!match) goto keepLastLetter;
|
||||
value = util::toWLower(CandidatesBuffer[mInputLength - 2]);
|
||||
if (!IsKoreanLeadingLetter(value)) goto keepLastLetter;
|
||||
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 2];
|
||||
CandidatesBuffer[1] = CandidatesBuffer[mInputLength - 1];
|
||||
mInputLength = 2;
|
||||
goto confirmLetters;
|
||||
keepLastLetter:
|
||||
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 1];
|
||||
mInputLength = 1;
|
||||
confirmLetters:
|
||||
if (match && IsKoreanLeadingLetter(util::toWLower(CandidatesBuffer[mInputLength - 2]))) {
|
||||
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 2];
|
||||
CandidatesBuffer[1] = CandidatesBuffer[mInputLength - 1];
|
||||
mInputLength = 2;
|
||||
} else {
|
||||
CandidatesBuffer[0] = CandidatesBuffer[mInputLength - 1];
|
||||
mInputLength = 1;
|
||||
}
|
||||
CandidatesBuffer[mInputLength] = 0;
|
||||
update();
|
||||
}
|
||||
@@ -393,12 +389,14 @@ void WithZi::update() {
|
||||
if (static_cast<s32>(count) > 0x28) {
|
||||
count = 0x28;
|
||||
}
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0 &&
|
||||
(mbContextChanged = 0, mSearch.count == 0)) {
|
||||
copyLength = mCurrentWordLength;
|
||||
CopyWordSuffix(LatestWord, copyLength);
|
||||
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
|
||||
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0) {
|
||||
mbContextChanged = 0;
|
||||
if (mSearch.count == 0) {
|
||||
copyLength = mCurrentWordLength;
|
||||
CopyWordSuffix(LatestWord, copyLength);
|
||||
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
|
||||
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
|
||||
}
|
||||
}
|
||||
if (count == 0) {
|
||||
if (getPredictLanguage() != ZI8_LANG_ZH) {
|
||||
@@ -415,6 +413,7 @@ void WithZi::update() {
|
||||
if (elementCount != 0 || mSearch.wordCharCount != 0) {
|
||||
source = reinterpret_cast<u16*>(mSearch.candidates);
|
||||
destination = CandidatedWord;
|
||||
// MWCC needs failed copies to join at the destination advance.
|
||||
for (index = 0; index < static_cast<s32>(count); index++) {
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH) {
|
||||
candidateLength = 0;
|
||||
@@ -466,22 +465,17 @@ nextCandidate:
|
||||
}
|
||||
}
|
||||
|
||||
u32 WithZi::complementsCandidates_(s32) {
|
||||
bool useSentinel;
|
||||
static inline bool HasNumericElement(const u16* scan) {
|
||||
u16 value;
|
||||
u16* scan = ElementBuffer;
|
||||
goto scanCheck;
|
||||
scanBody:
|
||||
if (0xeff1 <= value && value <= 0xeff9) {
|
||||
useSentinel = true;
|
||||
goto scanDone;
|
||||
while ((value = *scan) != 0) {
|
||||
if (0xeff1 <= value && value <= 0xeff9) return true;
|
||||
++scan;
|
||||
}
|
||||
++scan;
|
||||
scanCheck:
|
||||
value = *scan;
|
||||
if (value != 0) goto scanBody;
|
||||
useSentinel = false;
|
||||
scanDone:
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 WithZi::complementsCandidates_(s32) {
|
||||
bool useSentinel = HasNumericElement(ElementBuffer);
|
||||
if (useSentinel) {
|
||||
CandidatedWord[mInputLength - 1] = 0xfffe;
|
||||
CandidatedWord[mInputLength] = 0;
|
||||
@@ -497,31 +491,26 @@ scanDone:
|
||||
character = source;
|
||||
while (*source != 0) {
|
||||
s32 mode = mLetterMode;
|
||||
if (mode == 2) goto modeTwo;
|
||||
if (mode >= 2) goto modeThree;
|
||||
if (mode == 0) goto modeZero;
|
||||
if (mode >= 0) goto modeOne;
|
||||
goto modeDone;
|
||||
modeThree:
|
||||
if (mode >= 4) goto modeDone;
|
||||
goto modeCopy;
|
||||
modeOne:
|
||||
*destination = util::toWLower(*character);
|
||||
goto modeDone;
|
||||
modeTwo:
|
||||
*destination = util::toWUpper(*character);
|
||||
goto modeDone;
|
||||
modeZero:
|
||||
if (length == 0) {
|
||||
*destination = util::toWUpper(*character);
|
||||
}
|
||||
else {
|
||||
switch (mode) {
|
||||
case LM_1:
|
||||
*destination = util::toWLower(*character);
|
||||
break;
|
||||
case LM_2:
|
||||
*destination = util::toWUpper(*character);
|
||||
break;
|
||||
case LM_0:
|
||||
if (length == 0) {
|
||||
*destination = util::toWUpper(*character);
|
||||
} else {
|
||||
*destination = util::toWLower(*character);
|
||||
}
|
||||
break;
|
||||
case LM_3:
|
||||
*destination = *character;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
goto modeDone;
|
||||
modeCopy:
|
||||
*destination = *character;
|
||||
modeDone:
|
||||
++source;
|
||||
++character;
|
||||
++destination;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,7 @@ namespace ipl {
|
||||
|
||||
void delete_task_(void* work);
|
||||
|
||||
#define FOREACH_OBJ_IN_LIST(object) while (object = mObjList.getNext(object), object != NULL)
|
||||
#define FOREACH_OBJ_IN_LIST(object) while ((object = mObjList.getNext(object)) != NULL)
|
||||
|
||||
enum {
|
||||
FOCUS_ANIM_IN = 0,
|
||||
@@ -429,6 +429,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL Board::appendRecord(CDBRecord* record) {
|
||||
// MWCC needs this aggregate to keep interrupt states in their original stack slots.
|
||||
struct RecordReadState {
|
||||
BOOL recordInterrupts;
|
||||
u32 dataSize;
|
||||
@@ -572,7 +573,6 @@ namespace ipl {
|
||||
close:
|
||||
cdbManager->close(record);
|
||||
|
||||
hide_icon:
|
||||
if (mSearchDirection == CDB_SEARCH_DIRECTION_LEFT) {
|
||||
hide_licon();
|
||||
} else {
|
||||
@@ -693,6 +693,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO disabled to preserve the original scene-check scheduling.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void Board::stt_wait_child_dst() {
|
||||
@@ -1656,24 +1657,18 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO disabled for the original list cursor registers.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void Board::return_to_freelist_if_diff_date() {
|
||||
BoardObject* object = mObjList.getNext(NULL);
|
||||
goto start_loop;
|
||||
while (TRUE) {
|
||||
BoardObject* tmp = mObjList.getNext(object);
|
||||
|
||||
while (object != NULL) {
|
||||
BoardObject* next = mObjList.getNext(object);
|
||||
if (object->mBoardDate != mCurrentDate) {
|
||||
object->destroy();
|
||||
mObjList.remove(object);
|
||||
}
|
||||
|
||||
object = tmp;
|
||||
start_loop:
|
||||
if (object == NULL) {
|
||||
break;
|
||||
}
|
||||
object = next;
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
@@ -2053,6 +2048,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO disabled to preserve the list cursor and result registers.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
BoardObject* Board::get_log_obj() {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
extern char scPaneName_B_Stop[7];
|
||||
extern char scPaneName_T_Stop[];
|
||||
extern "C" BOOL push_button_queue(void*, const void*);
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
@@ -828,7 +827,7 @@ namespace ipl {
|
||||
Command command;
|
||||
command.type = Command::TYPE_ANIM;
|
||||
command.animId = animId;
|
||||
push_button_queue(&mReservedCmd, &command);
|
||||
mReservedCmd.push(command);
|
||||
}
|
||||
|
||||
void Button::reserveText(int paneId, u32 msgId) {
|
||||
@@ -836,7 +835,7 @@ namespace ipl {
|
||||
command.type = Command::TYPE_TEXT;
|
||||
command.paneId = paneId;
|
||||
command.msgId = msgId;
|
||||
push_button_queue(&mReservedCmd, &command);
|
||||
mReservedCmd.push(command);
|
||||
}
|
||||
|
||||
/* ============== */
|
||||
@@ -968,22 +967,6 @@ namespace ipl {
|
||||
|
||||
void OptOutButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {
|
||||
}
|
||||
|
||||
extern "C" BOOL push_button_queue(void* storage, const void* item) {
|
||||
typedef utility::Queue<Button::Command, 8> CommandQueue;
|
||||
CommandQueue* queue = static_cast<CommandQueue*>(storage);
|
||||
const Button::Command* command = static_cast<const Button::Command*>(item);
|
||||
if (queue->count == queue->current) {
|
||||
return FALSE;
|
||||
}
|
||||
queue->items[queue->pushed] = *command;
|
||||
if (++queue->pushed >= queue->count) {
|
||||
queue->pushed = 0;
|
||||
}
|
||||
queue->current++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ extern "C" void pollCardSlot(u8 slot) {
|
||||
sThread->slots[slot].state = 3;
|
||||
sThread->slots[slot].changed = 0;
|
||||
}
|
||||
goto done;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (result == 0) {
|
||||
@@ -144,7 +144,6 @@ extern "C" void pollCardSlot(u8 slot) {
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -398,200 +397,204 @@ extern "C" void clearAllCardFileEntries(s32 slot);
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir);
|
||||
extern "C" void runCardMoveOrCopy(u8 slot, s16 fileNo, s32 command);
|
||||
|
||||
static inline void sendValidityResponse(u32 command, u32 valid) {
|
||||
union {
|
||||
u32 value;
|
||||
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
|
||||
} reply;
|
||||
reply.value = command;
|
||||
reply.fields.valid = valid;
|
||||
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
|
||||
static inline u8 getCardCommandSlot(u32 message) {
|
||||
u8 slot = message >> 16;
|
||||
slot &= 1;
|
||||
return slot;
|
||||
}
|
||||
|
||||
extern "C" void* cardThreadMain(void*) {
|
||||
struct CardThreadLocals {
|
||||
u8 compareName[6];
|
||||
u32 message;
|
||||
CARDDir freeDir;
|
||||
CARDDir mountDir;
|
||||
CARDDir listingDir;
|
||||
char fileName[33];
|
||||
} local;
|
||||
BOOL brokenFile;
|
||||
BOOL exitThread = FALSE;
|
||||
u32 validState = TRUE;
|
||||
u32 command;
|
||||
s16 fileNo;
|
||||
u8 slot;
|
||||
static inline s32 countCardTitleBlocks(s32 slot, CARDDir* dir) {
|
||||
s32 fileNo;
|
||||
s32 result;
|
||||
s32 blocks;
|
||||
blocks = 0;
|
||||
for (fileNo = 0; fileNo < CARD_MAX_FILE; ++fileNo) {
|
||||
result = __CARDGetStatusEx(slot, fileNo, dir);
|
||||
if (result < CARD_RESULT_READY && result != CARD_RESULT_NOFILE) {
|
||||
blocks = -1;
|
||||
break;
|
||||
}
|
||||
if (result == CARD_RESULT_READY &&
|
||||
memcmp(dir->gameName, (void*)0x80000000, 4) == 0 &&
|
||||
memcmp(dir->company, (void*)0x80000004, 2) == 0) {
|
||||
blocks += dir->length;
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
static inline void listCardFiles(u8 slot, CARDDir& dir, char* fileName) {
|
||||
u32 fileNo;
|
||||
for (fileNo = 0; fileNo < CARD_MAX_FILE; ++fileNo) {
|
||||
if (__CARDGetStatusEx(slot, (u16)fileNo, &dir) == CARD_RESULT_READY) {
|
||||
memcpy(fileName, dir.fileName, CARD_FILENAME_MAX);
|
||||
fileName[CARD_FILENAME_MAX] = 0;
|
||||
OSReport("%d - %s: %d blocks\n", (u16)fileNo, fileName, dir.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void deleteCardFile(u8 slot, s16 fileNo) {
|
||||
s32 result = CARDFastDelete(slot, fileNo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
reportCardThreadError(slot, 4, result);
|
||||
} else {
|
||||
clearCardFileEntry(slot, fileNo);
|
||||
refreshCardSlotInfo(slot);
|
||||
sendCardSlotState(slot, 4, (u8)fileNo);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void formatCardSlot(u8 slot) {
|
||||
s32 result = CARDFormat(slot);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
reportCardThreadError(slot, 1, result);
|
||||
} else {
|
||||
sThread->mounted[slot] = 1;
|
||||
refreshCardSlotInfo(slot);
|
||||
sendCardSlotState(slot, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void mountCardSlot(u8 slot, CARDDir& mountDir, CARDDir& listingDir, char* fileName) {
|
||||
s32 result;
|
||||
s32 file;
|
||||
u32 listingFile;
|
||||
BOOL brokenFile;
|
||||
|
||||
result = CARDMount(slot, sThread->mountBuffers[slot], 0);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = handleCardMountResult(slot, result);
|
||||
if (result != CARD_RESULT_READY) {
|
||||
goto scanFiles;
|
||||
}
|
||||
return;
|
||||
}
|
||||
result = CARDCheck(slot);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
|
||||
scanFiles:
|
||||
clearAllCardFileEntries(slot);
|
||||
for (file = 0; file < CARD_MAX_FILE; ++file) {
|
||||
result = __CARDGetStatusEx(slot, (s16)file, &mountDir);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = handleCardMountResult(slot, result);
|
||||
if (result != CARD_RESULT_READY) {
|
||||
continue;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
u8 company[2];
|
||||
u8 gameName[4];
|
||||
company[0] = 0;
|
||||
company[1] = 0;
|
||||
gameName[0] = 0;
|
||||
gameName[1] = 0;
|
||||
gameName[2] = 0;
|
||||
gameName[3] = 0;
|
||||
if (strncmp((const char*)mountDir.fileName, "Broken File", 0xB) == 0 &&
|
||||
memcmp(mountDir.gameName, gameName, 4) == 0 &&
|
||||
memcmp(mountDir.company, company, 2) == 0) {
|
||||
brokenFile = TRUE;
|
||||
} else {
|
||||
brokenFile = FALSE;
|
||||
}
|
||||
if (brokenFile) {
|
||||
result = CARDFastDelete(slot, (s16)file);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
} else {
|
||||
result = loadCardFileIcons(slot, (s16)file, &mountDir);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshCardSlotInfo(slot);
|
||||
sThread->mounted[slot] = 1;
|
||||
sendCardSlotState(slot, 0, 0);
|
||||
OSReport("Slot %c\n", sCardSlotName[slot]);
|
||||
listCardFiles(slot, listingDir, fileName);
|
||||
return;
|
||||
|
||||
mountError:
|
||||
OSReport("MountError\n");
|
||||
reportCardThreadError(slot, 0, result);
|
||||
}
|
||||
|
||||
// MWCC must keep validState in a register for the response bit insert.
|
||||
#pragma push
|
||||
#pragma opt_propagation off
|
||||
extern "C" void* cardThreadMain(void*) {
|
||||
char fileName[33];
|
||||
CARDDir listingDir;
|
||||
CARDDir mountDir;
|
||||
CARDDir freeDir;
|
||||
u32 message;
|
||||
s32 outerSlot;
|
||||
s32 freeFile;
|
||||
s32 freeBlocks;
|
||||
u32 command;
|
||||
u8 validState = TRUE;
|
||||
BOOL exitThread = FALSE;
|
||||
|
||||
sThread->mounted[0] = 0;
|
||||
sThread->mounted[1] = 0;
|
||||
goto loopCheck;
|
||||
loopStart:
|
||||
OSReceiveMessage(&sThread->requests, (OSMessage*)&local.message, OS_MESSAGE_BLOCK);
|
||||
OSReport("CARD THREAD: Message received %d\n", (s8)(u8)local.message);
|
||||
while (!exitThread) {
|
||||
OSReceiveMessage(&sThread->requests, (OSMessage*)&message, OS_MESSAGE_BLOCK);
|
||||
OSReport("CARD THREAD: Message received %d\n", (s8)(u8)message);
|
||||
if (validState != TRUE) {
|
||||
goto loopCheck;
|
||||
continue;
|
||||
}
|
||||
command = local.message & 0xFF;
|
||||
command = message & 0xFF;
|
||||
|
||||
switch ((s8)command) {
|
||||
case 10:
|
||||
validState = TRUE;
|
||||
OSReport("card thread valid state changed:%d\n", 1);
|
||||
sendValidityResponse(command, validState);
|
||||
OSSendMessage(&sThread->responses, (OSMessage)((validState << 8) | (u8)command), OS_MESSAGE_BLOCK);
|
||||
break;
|
||||
case 11:
|
||||
exitThread = TRUE;
|
||||
break;
|
||||
case 0: {
|
||||
slot = (local.message >> 16) & 1;
|
||||
command = (local.message >> 14) & 4;
|
||||
result = CARDMount(slot, sThread->mountBuffers[command / 4], 0);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = handleCardMountResult(slot, result);
|
||||
if (result != CARD_RESULT_READY) {
|
||||
goto mountContinue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
result = CARDCheck(slot);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
|
||||
mountContinue:
|
||||
clearAllCardFileEntries(slot);
|
||||
for (file = 0; file < CARD_MAX_FILE; ++file) {
|
||||
result = __CARDGetStatusEx(slot, (s16)file, &local.mountDir);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = handleCardMountResult(slot, result);
|
||||
if (result != CARD_RESULT_READY) {
|
||||
continue;
|
||||
}
|
||||
goto loopCheck;
|
||||
} else {
|
||||
local.compareName[0] = 0;
|
||||
local.compareName[1] = 0;
|
||||
local.compareName[2] = 0;
|
||||
local.compareName[3] = 0;
|
||||
local.compareName[4] = 0;
|
||||
local.compareName[5] = 0;
|
||||
if (strncmp((const char*)local.mountDir.fileName, "Broken File", 0xB) == 0 &&
|
||||
memcmp(local.mountDir.gameName, local.compareName + 2, 4) == 0 &&
|
||||
memcmp(local.mountDir.company, local.compareName, 2) == 0) {
|
||||
brokenFile = TRUE;
|
||||
} else {
|
||||
brokenFile = FALSE;
|
||||
}
|
||||
if (brokenFile) {
|
||||
result = CARDFastDelete(slot, (s16)file);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
} else {
|
||||
result = loadCardFileIcons(slot, (s16)file, &local.mountDir);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto mountError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshCardSlotInfo(slot);
|
||||
sThread->mounted[command / 4] = 1;
|
||||
sendCardSlotState(slot, 0, 0);
|
||||
OSReport("Slot %c\n", sCardSlotName[slot]);
|
||||
for (listingFile = 0; listingFile < CARD_MAX_FILE; ++listingFile) {
|
||||
if (__CARDGetStatusEx(slot, (u16)listingFile, &local.listingDir) == CARD_RESULT_READY) {
|
||||
memcpy(local.fileName, local.listingDir.fileName, CARD_FILENAME_MAX);
|
||||
local.fileName[CARD_FILENAME_MAX] = 0;
|
||||
OSReport("%d - %s: %d blocks\n", (u16)listingFile, local.fileName,
|
||||
local.listingDir.length);
|
||||
}
|
||||
}
|
||||
case 0:
|
||||
mountCardSlot(getCardCommandSlot(message), mountDir, listingDir, fileName);
|
||||
break;
|
||||
|
||||
mountError:
|
||||
OSReport("MountError\n");
|
||||
reportCardThreadError(slot, 0, result);
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
reportCardThreadError((local.message >> 16) & 1, 9, CARD_RESULT_NOCARD);
|
||||
reportCardThreadError(getCardCommandSlot(message), 9, CARD_RESULT_NOCARD);
|
||||
break;
|
||||
case 1: {
|
||||
slot = (local.message >> 16) & 1;
|
||||
result = CARDFormat(slot);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
reportCardThreadError(slot, 1, result);
|
||||
} else {
|
||||
sThread->mounted[slot] = 1;
|
||||
refreshCardSlotInfo(slot);
|
||||
sendCardSlotState(slot, 1, 0);
|
||||
}
|
||||
case 1:
|
||||
formatCardSlot(getCardCommandSlot(message));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
runCardMoveOrCopy((local.message >> 16) & 1,
|
||||
(s16)(u8)(local.message >> 24), (s8)command);
|
||||
runCardMoveOrCopy(getCardCommandSlot(message), (s16)(u8)(message >> 24), (s8)command);
|
||||
break;
|
||||
case 3:
|
||||
runCardMoveOrCopy((local.message >> 16) & 1,
|
||||
(s16)(u8)(local.message >> 24), (s8)command);
|
||||
runCardMoveOrCopy(getCardCommandSlot(message), (s16)(u8)(message >> 24), (s8)command);
|
||||
break;
|
||||
case 4: {
|
||||
slot = (local.message >> 16) & 1;
|
||||
fileNo = (s16)(local.message >> 24);
|
||||
result = CARDFastDelete(slot, fileNo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
reportCardThreadError(slot, 4, result);
|
||||
} else {
|
||||
clearCardFileEntry(slot, fileNo);
|
||||
refreshCardSlotInfo(slot);
|
||||
sendCardSlotState(slot, 4, (u8)fileNo);
|
||||
}
|
||||
case 4:
|
||||
deleteCardFile(getCardCommandSlot(message), (s16)(message >> 24));
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
outerSlot = 0;
|
||||
|
||||
do {
|
||||
if (sThread->mounted[outerSlot] != 0) {
|
||||
freeBlocks = 0;
|
||||
for (freeFile = 0; freeFile < CARD_MAX_FILE; ++freeFile) {
|
||||
result = __CARDGetStatusEx(outerSlot, freeFile, &local.freeDir);
|
||||
if (result < CARD_RESULT_READY && result != CARD_RESULT_NOFILE) {
|
||||
freeBlocks = -1;
|
||||
break;
|
||||
}
|
||||
if (result == CARD_RESULT_READY &&
|
||||
memcmp(local.freeDir.gameName, (void*)0x80000000, 4) == 0 &&
|
||||
memcmp(local.freeDir.company, (void*)0x80000004, 2) == 0) {
|
||||
freeBlocks += local.freeDir.length;
|
||||
}
|
||||
}
|
||||
freeBlocks = countCardTitleBlocks(outerSlot, &freeDir);
|
||||
sThread->slots[outerSlot].unk_0x12 = freeBlocks;
|
||||
}
|
||||
++outerSlot;
|
||||
|
||||
} while (outerSlot < 2);
|
||||
sendCardSlotState(0, 0xC, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
loopCheck:
|
||||
if (!exitThread) {
|
||||
goto loopStart;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
extern "C" s32 checkCardFileDuplicate(s32 slot, s16 fileNo);
|
||||
|
||||
@@ -651,11 +654,13 @@ reportError:
|
||||
}
|
||||
|
||||
extern "C" s32 reportCardThreadError(s32 slot, s32 state, s32 result) {
|
||||
if (result != CARD_RESULT_EXIST && result != -27 && result != CARD_RESULT_NOENT && result != CARD_RESULT_INSSPACE &&
|
||||
(clearAllCardFileEntries(slot), result != CARD_RESULT_BROKEN) && result != CARD_RESULT_ENCODING) {
|
||||
OSReport("DEBUG: UnmountCard %d \n", slot);
|
||||
CARDUnmount(slot);
|
||||
sThread->mounted[slot & 0xFF] = 0;
|
||||
if (result != CARD_RESULT_EXIST && result != -27 && result != CARD_RESULT_NOENT && result != CARD_RESULT_INSSPACE) {
|
||||
clearAllCardFileEntries(slot);
|
||||
if (result != CARD_RESULT_BROKEN && result != CARD_RESULT_ENCODING) {
|
||||
OSReport("DEBUG: UnmountCard %d \n", slot);
|
||||
CARDUnmount(slot);
|
||||
sThread->mounted[slot & 0xFF] = 0;
|
||||
}
|
||||
}
|
||||
OSReport("DEBUG: CardThread error %d %d\n", state, result);
|
||||
markAllCardFilesDirty();
|
||||
@@ -691,25 +696,82 @@ extern "C" void clearAllCardFileEntries(s32 slot) {
|
||||
} while (file < CARD_MAX_FILE);
|
||||
}
|
||||
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
struct CardSequenceFileData {
|
||||
s32 commentSectorSize;
|
||||
s32 sectorSize;
|
||||
CARDFileInfo fileInfo;
|
||||
} local;
|
||||
s32 iconAddressOffset;
|
||||
u32 iconAddressBase;
|
||||
s32 result;
|
||||
result = CARDFastOpen(slot, fileNo, &local.fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
static inline s32 readCardImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo,
|
||||
u32 address, s32 offset, s32 imageSize, u32 transferSize) {
|
||||
s32 sectorSize;
|
||||
if (CARDGetSectorSize(slot, (u32*)§orSize) < CARD_RESULT_READY) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 fileSize = (u32)dir->length * sectorSize;
|
||||
if (address > fileSize) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
if (address + transferSize > fileSize) {
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (imageSize > 0) {
|
||||
s32 result = CARDRead(fileInfo, sThread->imageReadBuffer, transferSize, address);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
memcpy(sThread->images[slot][fileNo], sThread->imageReadBuffer + offset, imageSize);
|
||||
DCStoreRange(sThread->images[slot][fileNo], transferSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline s32 readCardComment(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
|
||||
u32 address;
|
||||
s32 result;
|
||||
u32 base;
|
||||
s32 readSize;
|
||||
u32 end;
|
||||
u32 fileSize;
|
||||
s32 offset;
|
||||
s32 sectorSize;
|
||||
address = dir->commentAddr;
|
||||
base = address & 0xFFFFFE00;
|
||||
offset = address - base;
|
||||
readSize = ((address + 0x23F) & 0xFFFFFE00) - base;
|
||||
result = CARDGetSectorSize(slot, (u32*)§orSize);
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
if ((s32)base < 0 || base > (fileSize = (u32)dir->length * sectorSize)) {
|
||||
result = 0;
|
||||
} else {
|
||||
end = base + readSize;
|
||||
if ((s32)end < 0 || end > fileSize) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = CARDRead(fileInfo, sThread->commentBuffer, readSize, base);
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
memcpy(sThread->comments[slot][fileNo], sThread->commentBuffer + offset,
|
||||
CARD_COMMENT_SIZE);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline s32 loadCardIconImages(s32 slot, s32 fileNo, CARDDir* dir, CARDFileInfo* fileInfo) {
|
||||
s32 imageSize;
|
||||
s32 bannerImageSize = 0;
|
||||
u8 format = dir->bannerFormat & CARD_STAT_BANNER_MASK;
|
||||
u32 iconAddress = dir->iconAddr;
|
||||
iconAddressBase = iconAddress & 0xFFFFFE00;
|
||||
iconAddressOffset = iconAddress - iconAddressBase;
|
||||
u32 transferSize;
|
||||
s32 iconAddressOffset = iconAddress - (iconAddress & 0xFFFFFE00);
|
||||
|
||||
switch (format) {
|
||||
case CARD_STAT_BANNER_C8: {
|
||||
@@ -746,72 +808,71 @@ extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 shift = 0;
|
||||
s32 iconImageSize = 0;
|
||||
s32 iconCount = 0;
|
||||
s32 iconImageSize;
|
||||
s32 iconFrameSize;
|
||||
s32 icon;
|
||||
BOOL hasTlut;
|
||||
s32 iconCount;
|
||||
s32 shift;
|
||||
|
||||
shift = 0;
|
||||
hasTlut = FALSE;
|
||||
iconImageSize = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x02 = 0;
|
||||
sThread->icons[slot][fileNo].anmMax = 0;
|
||||
sThread->icons[slot][fileNo].anmFrameBits = dir->iconSpeed;
|
||||
sThread->icons[slot][fileNo].unk_0x06 =
|
||||
(dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
|
||||
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
|
||||
sThread->icons[slot][fileNo].unk_0x06 = (dir->iconSpeed & CARD_STAT_SPEED_MASK) << 2;
|
||||
icon = 0;
|
||||
iconCount = 0;
|
||||
while (icon < CARD_ICON_MAX) {
|
||||
s32 iconSpeed = (dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK;
|
||||
if (iconSpeed != 0) {
|
||||
sThread->icons[slot][fileNo].anmMax =
|
||||
sThread->icons[slot][fileNo].anmMax + (iconSpeed << 2);
|
||||
sThread->icons[slot][fileNo].anmMax += iconSpeed << 2;
|
||||
} else {
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(u8)(((dir->iconSpeed >> ((iconCount - 1) * 2)) << 2) & 0xC);
|
||||
goto iconSpeedDone;
|
||||
goto animationDone;
|
||||
}
|
||||
iconCount = iconCount + 1;
|
||||
shift = shift + 2;
|
||||
++icon;
|
||||
}
|
||||
sThread->icons[slot][fileNo].unk_0x07 =
|
||||
(dir->iconSpeed >> 0xC) & 0xC;
|
||||
|
||||
iconSpeedDone:
|
||||
sThread->icons[slot][fileNo].unk_0x07 = (dir->iconSpeed >> 0xC) & 0xC;
|
||||
animationDone:
|
||||
if ((dir->iconSpeed & CARD_STAT_SPEED_MASK) == 0 || (dir->iconFormat & CARD_STAT_ICON_MASK) == 0) {
|
||||
iconImageSize = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
iconImageSize = 0;
|
||||
} else {
|
||||
BOOL hasTlut = FALSE;
|
||||
iconCount = 0;
|
||||
shift = 0;
|
||||
for (icon = 0; icon < CARD_ICON_MAX; ++icon) {
|
||||
if (((dir->iconSpeed >> shift) & CARD_STAT_SPEED_MASK) != 0) {
|
||||
s32 iconFormat = (dir->iconFormat >> shift) & CARD_STAT_ICON_MASK;
|
||||
s32 paletteSize;
|
||||
for (iconCount = 0; iconCount < CARD_ICON_MAX; ++iconCount) {
|
||||
if (((dir->iconSpeed >> (iconCount * 2)) & CARD_STAT_SPEED_MASK) != 0) {
|
||||
s32 iconFormat = (dir->iconFormat >> (iconCount * 2)) & CARD_STAT_ICON_MASK;
|
||||
switch (iconFormat) {
|
||||
case CARD_STAT_ICON_C8:
|
||||
paletteSize = 0x400;
|
||||
iconFrameSize = 0x400;
|
||||
hasTlut = TRUE;
|
||||
sThread->icons[slot][fileNo].iconFmt[iconCount] = GX_TF_C8;
|
||||
break;
|
||||
case CARD_STAT_ICON_RGB5A3:
|
||||
paletteSize = 0x800;
|
||||
iconFrameSize = 0x800;
|
||||
sThread->icons[slot][fileNo].iconFmt[iconCount] = GX_TF_RGB5A3;
|
||||
break;
|
||||
case CARD_STAT_ICON_NONE: {
|
||||
paletteSize = 0;
|
||||
u8* iconPalette =
|
||||
&sThread->icons[slot][fileNo].iconFmt[iconCount];
|
||||
*iconPalette = iconPalette[-1];
|
||||
iconFrameSize = 0;
|
||||
u8* previous = &sThread->icons[slot][fileNo].iconFmt[iconCount - 1];
|
||||
sThread->icons[slot][fileNo].iconFmt[iconCount] = *previous;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
paletteSize = 0;
|
||||
break;
|
||||
}
|
||||
if (iconCount < 7) {
|
||||
sThread->icons[slot][fileNo].iconOffset[iconCount + 1] =
|
||||
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
if (iconCount < CARD_ICON_MAX - 1) {
|
||||
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
|
||||
iconFrameSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
} else {
|
||||
sThread->icons[slot][fileNo].iconTlutOffset =
|
||||
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
iconFrameSize + sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
}
|
||||
iconImageSize += paletteSize;
|
||||
iconImageSize += iconFrameSize;
|
||||
sThread->icons[slot][fileNo].unk_0x02 =
|
||||
sThread->icons[slot][fileNo].unk_0x02 + 1;
|
||||
} else {
|
||||
@@ -819,8 +880,6 @@ iconSpeedDone:
|
||||
sThread->icons[slot][fileNo].iconOffset[iconCount];
|
||||
break;
|
||||
}
|
||||
++iconCount;
|
||||
shift += 2;
|
||||
}
|
||||
if (hasTlut) {
|
||||
iconImageSize += 0x200;
|
||||
@@ -830,85 +889,30 @@ iconSpeedDone:
|
||||
sThread->icons[slot][fileNo].anmDelta = 1;
|
||||
}
|
||||
|
||||
s32 totalImageSize = iconImageSize + bannerImageSize;
|
||||
u32 transferSize = (totalImageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
|
||||
result = CARDGetSectorSize(slot, (u32*)&local.sectorSize);
|
||||
imageSize = bannerImageSize + iconImageSize;
|
||||
transferSize = (imageSize + iconAddressOffset + 0x1FF) & 0xFFFFFE00;
|
||||
return readCardImages(slot, fileNo, dir, fileInfo, iconAddress & 0xFFFFFE00, iconAddressOffset,
|
||||
imageSize, transferSize);
|
||||
}
|
||||
|
||||
extern "C" s32 loadCardFileIcons(s32 slot, s32 fileNo, CARDDir* dir) {
|
||||
CARDFileInfo fileInfo;
|
||||
s32 result = CARDFastOpen(slot, fileNo, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else {
|
||||
u32 fileSize = (u32)dir->length * local.sectorSize;
|
||||
if (iconAddressBase > fileSize) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else if (iconAddressBase + transferSize > fileSize) {
|
||||
result = 0;
|
||||
sThread->icons[slot][fileNo].bannerEnable = 0;
|
||||
sThread->icons[slot][fileNo].unk_0x01 = 0;
|
||||
} else if (totalImageSize > 0) {
|
||||
result = CARDRead(&local.fileInfo, sThread->imageReadBuffer,
|
||||
transferSize, iconAddressBase);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto closeFile;
|
||||
}
|
||||
memcpy(sThread->images[slot][fileNo],
|
||||
sThread->imageReadBuffer + iconAddressOffset,
|
||||
totalImageSize);
|
||||
DCStoreRange(sThread->images[slot][fileNo], transferSize);
|
||||
result = 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
result = loadCardIconImages(slot, fileNo, dir, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto closeFile;
|
||||
return result;
|
||||
}
|
||||
|
||||
iconAddress = dir->commentAddr;
|
||||
iconAddressBase = iconAddress & 0xFFFFFE00;
|
||||
s32 commentDataOffset = iconAddress - iconAddressBase;
|
||||
s32 imageSize = ((iconAddress + 0x23F) & 0xFFFFFE00) - iconAddressBase;
|
||||
result = CARDGetSectorSize(slot, (u32*)&local.commentSectorSize);
|
||||
result = readCardComment(slot, fileNo, dir, &fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto clearComment;
|
||||
}
|
||||
{
|
||||
u32 fileSize;
|
||||
if ((s32)iconAddressBase < 0 ||
|
||||
iconAddressBase > (fileSize = (u32)dir->length * local.commentSectorSize)) {
|
||||
result = 0;
|
||||
} else {
|
||||
u32 endOffset = iconAddressBase + imageSize;
|
||||
if ((s32)endOffset < 0 || endOffset > fileSize) {
|
||||
result = 0;
|
||||
goto clearComment;
|
||||
}
|
||||
result = CARDRead(&local.fileInfo, sThread->commentBuffer, imageSize,
|
||||
iconAddressBase);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
goto clearComment;
|
||||
}
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
memcpy(sThread->comments[slot][fileNo],
|
||||
sThread->commentBuffer + commentDataOffset, CARD_COMMENT_SIZE);
|
||||
result = 0;
|
||||
goto commentDone;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
clearComment:
|
||||
memset(sThread->comments[slot][fileNo], 0, CARD_COMMENT_SIZE);
|
||||
|
||||
commentDone:
|
||||
if (result >= CARD_RESULT_READY) {
|
||||
goto closeFileSuccess;
|
||||
}
|
||||
closeFile:
|
||||
return result;
|
||||
|
||||
closeFileSuccess:
|
||||
result = CARDClose(&local.fileInfo);
|
||||
result = CARDClose(&fileInfo);
|
||||
if (result < CARD_RESULT_READY) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
#include "titledb.h"
|
||||
|
||||
// actually needed to match.
|
||||
#pragma sym on
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
#define COMMAND_FN(FUNCTION_HEADER, TAG, APP_BOX, SAVE_BOX, WII_TITLE_ID, SD_TITLE_ID) \
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#undef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
|
||||
// :)
|
||||
#define PREV_LOADED_INDEX (1 - mLoadedIndex)
|
||||
|
||||
namespace ipl {
|
||||
@@ -646,6 +645,7 @@ namespace ipl {
|
||||
|
||||
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped()) {
|
||||
if (System::getNwc24Manager() && !System::getNwc24Manager()->isReceivingIdle()) {
|
||||
// MWCC needs the shared exit label to preserve these branches.
|
||||
goto scn_continue;
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ namespace ipl {
|
||||
memcpy(titleName[1], System::getChannelManager()->getTitleName(mChanPage, mChanIndex, 1), sizeof(titleName[1]));
|
||||
|
||||
char code[] = {((char*)&mCurGameCode)[0], ((char*)&mCurGameCode)[1]};
|
||||
__OSCreatePlayRecord(titleName[0], &((char*)&titleId)[sizeof(ESTitleId32)] /* :( */, code);
|
||||
__OSCreatePlayRecord(titleName[0], &((char*)&titleId)[sizeof(ESTitleId32)], code);
|
||||
OSReport("Create play recode\n"); // @BUG: recode instead of record
|
||||
|
||||
BS2SetStateFlags();
|
||||
@@ -801,7 +801,7 @@ namespace ipl {
|
||||
memcpy(titleName[1], System::getChannelManager()->getTitleName(mChanPage, mChanIndex, 1), sizeof(titleName[1]));
|
||||
|
||||
char code[] = {((char*)&mCurGameCode)[0], ((char*)&mCurGameCode)[1]};
|
||||
__OSCreatePlayRecord(titleName[0], &((char*)&titleId)[sizeof(ESTitleId32)] /* :( */, code);
|
||||
__OSCreatePlayRecord(titleName[0], &((char*)&titleId)[sizeof(ESTitleId32)], code);
|
||||
OSReport("Create play recode\n"); // @BUG: recode instead of record
|
||||
|
||||
System::getBS2Manager()->startRVLGame();
|
||||
@@ -1213,6 +1213,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 0 to preserve the BS2 argument-base registers.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void ChannelTitle::calcNormalParentalDialog() {
|
||||
@@ -1313,7 +1314,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// uhh
|
||||
// MWCC needs IRO level 0 to preserve ticket-check branches and register saves.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void ChannelTitle::calcNormalWaitTmd() {
|
||||
@@ -1455,6 +1456,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 1 to preserve progress-bar register allocation.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void ChannelTitle::calcNormalUpdating() {
|
||||
@@ -1926,6 +1928,7 @@ namespace ipl {
|
||||
bool noDisk = BS2State == bs2::IPL_STATE_NO_DISK;
|
||||
|
||||
nw4r::lyt::Group* group = mpDiskBnrLayout->FindGroupByName(scDiskGroups[DISK_ANIM_GRP_COMMENT]);
|
||||
// MWCC needs group references to preserve pane-loop register allocation.
|
||||
nw4r::lyt::Group*& groupAlias = group;
|
||||
for (nw4r::lyt::PaneLinkList::Iterator it = groupAlias->GetPaneList().GetBeginIter(); it != groupAlias->GetPaneList().GetEndIter();
|
||||
it++) {
|
||||
@@ -2152,8 +2155,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL ChannelTitle::checkNetSetting(int page, int index) {
|
||||
// i hate this
|
||||
|
||||
// MWCC needs the shared return label to preserve this branch sequence.
|
||||
BOOL flag = System::getChannelManager()->getSceneID(page, index) == SCENE_DISK_CHANNEL;
|
||||
if (flag) {
|
||||
goto yes;
|
||||
@@ -2552,9 +2554,8 @@ namespace ipl {
|
||||
if (mLimitType == LIMIT_TYPE_TIME) {
|
||||
*hour = mTimeLimitRemain / (60 * 60);
|
||||
|
||||
// FAKEMATCH: should be modular division. not whatever this is
|
||||
// MWCC needs subtraction through the stored hour value to preserve this sequence.
|
||||
*minute = (mTimeLimitRemain - ((60 * 60) * *hour)) / 60;
|
||||
//*minute = (u32)(mTimeLimitRemain % (60 * 60)) / 60U;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
@@ -2675,8 +2676,6 @@ namespace ipl {
|
||||
chanTtl->mbTmdReady = true;
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void ChannelTitle::getTicketLimitTask(void* work) {
|
||||
ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work);
|
||||
|
||||
@@ -2694,7 +2693,6 @@ namespace ipl {
|
||||
}
|
||||
chanTtl->mbTicketLimitReady = true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
void ChannelTitle::deleteTmpTitleContentTask(void* work) {
|
||||
ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work);
|
||||
|
||||
@@ -63,8 +63,6 @@ namespace ipl {
|
||||
void KitayamaTest::calcCommon() {
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 2
|
||||
FaderSceneCommand KitayamaTest::calcNormal() {
|
||||
FaderSceneCommand command = FADER_SCN_CONTINUE;
|
||||
controller::Interface* controller = System::getMasterController();
|
||||
@@ -82,16 +80,13 @@ namespace ipl {
|
||||
s32 result;
|
||||
NANDFileInfo bannerInfo;
|
||||
NANDFileInfo testInfo;
|
||||
WIISaveBannerFile* buffer;
|
||||
|
||||
ES_SetUid(0x0001000030303030);
|
||||
ISFS_CloseLib();
|
||||
ISFS_OpenLib();
|
||||
|
||||
// Delete old test file
|
||||
nand::wrapper::Delete("/title/00010000/30303030/data/banner.bin");
|
||||
|
||||
// Create new test file
|
||||
result = nand::wrapper::Create("/title/00010000/30303030/data/banner.bin", NAND_PERM_ALL_RW, 0);
|
||||
if (result == NAND_RESULT_OK) {
|
||||
result = nand::wrapper::Open("/title/00010000/30303030/data/banner.bin", &bannerInfo, NAND_ACCESS_WRITE);
|
||||
@@ -100,8 +95,7 @@ namespace ipl {
|
||||
OSHalt("Terminated.\n", 173);
|
||||
}
|
||||
|
||||
// Write some data to test file
|
||||
buffer = (WIISaveBannerFile*)mpHeap->alloc(sizeof(WIISaveBannerFile), 32);
|
||||
WIISaveBannerFile* buffer = (WIISaveBannerFile*)mpHeap->alloc(sizeof(WIISaveBannerFile), 32);
|
||||
memset(buffer, 0x55, sizeof(WIISaveBannerFile));
|
||||
buffer->signature = 'WIBN';
|
||||
buffer->flags = 0;
|
||||
@@ -134,7 +128,7 @@ namespace ipl {
|
||||
OSHalt("Terminated.\n", 213);
|
||||
}
|
||||
|
||||
buffer = (WIISaveBannerFile*)mpHeap->alloc(sizeof(WIISaveBannerFile), 32);
|
||||
WIISaveBannerFile* buffer = (WIISaveBannerFile*)mpHeap->alloc(sizeof(WIISaveBannerFile), 32);
|
||||
memset(buffer, 0x55, sizeof(WIISaveBannerFile));
|
||||
buffer->signature = 'WIBN';
|
||||
buffer->flags = 0;
|
||||
@@ -270,7 +264,6 @@ namespace ipl {
|
||||
|
||||
return command;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
FaderSceneCommand KitayamaTest::calcFadeout() {
|
||||
if (mOption == KITAYAMA_OPT_INIT_NAND) {
|
||||
|
||||
@@ -87,11 +87,9 @@ namespace ipl {
|
||||
mNwc24ErrCountdown2 = 0;
|
||||
|
||||
// Text balloon for Mii face
|
||||
f32 f0 = 30.0f;
|
||||
f32 f1 = 120.0f;
|
||||
mpNigaoeBalloon =
|
||||
new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt",
|
||||
math::VEC3(0.0f, (f1 = 120.0f, 0.0f), (f0 = 30.0f, 0.0f)), f1, f0);
|
||||
new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f),
|
||||
TextBalloon::getDefaultMargin16x9(), TextBalloon::getDefaultMargin4x3());
|
||||
|
||||
// Scroller
|
||||
mpScroller = new utility::YoungBScroller();
|
||||
@@ -196,7 +194,8 @@ namespace ipl {
|
||||
mpCaptionString->clear();
|
||||
mpCaptionString->set(System::getMessage(MESG_LETTERWRITER_LETTER_HEADER));
|
||||
|
||||
wchar_t* namePlaceholder = wcsstr(mpCaptionString->getWCString(), L"xxxxxxxxxx");
|
||||
wchar_t* caption = mpCaptionString->getWCString();
|
||||
wchar_t* namePlaceholder = wcsstr(caption, L"xxxxxxxxxx");
|
||||
|
||||
mpCaptionString->replace((namePlaceholder - mpCaptionString->getWCString()), RFL_NAME_LENGTH, headerCaption);
|
||||
return mpCaptionString->getWCString();
|
||||
|
||||
@@ -341,7 +341,7 @@ void MemoryCardManager::update_change_cardstate(u8 slot) {
|
||||
}
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
memorycard::IconState (*icons)[CARD_MAX_FILE] = reinterpret_cast<memorycard::IconState(*)[CARD_MAX_FILE]>(memorycard::getIconStateArray());
|
||||
int total = 0;
|
||||
s16 frame = 0;
|
||||
@@ -355,26 +355,24 @@ GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index) {
|
||||
return _create_icon(slot, file, frame - 1);
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
|
||||
const GXTexObj* MemoryCardManager::create_icon(u8 slot, s16 index, long start) {
|
||||
memorycard::getIconStateArray();
|
||||
u32 file = mFile[slot][index].fileNo;
|
||||
return _create_icon(slot, file, 0);
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
const GXTexObj* MemoryCardManager::_create_icon(u8 slot, s16 file, long start) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
if (dirs[slot][file].fileNo == 0) {
|
||||
return NULL;
|
||||
}
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
memorycard::IconState* icon = &icons[slot][file];
|
||||
if ((int)icon->iconFmt[start] == GX_TF_RGB5A3) {
|
||||
GXInitTexObj(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else if ((int)icon->iconFmt[start] == GX_TF_C8) {
|
||||
GXInitTexObjCI(&mFileCell[slot][file].icon, reinterpret_cast<u8*>(icon) + icon->iconOffset[start], CARD_ICON_WIDTH, CARD_ICON_HEIGHT, GX_TF_C8, GX_CLAMP, GX_CLAMP, GX_FALSE, GX_TLUT0);
|
||||
GXInitTlutObj(&mFileCell[slot][file].iconTlut, reinterpret_cast<u8*>(icon) + icons[slot][file].iconTlutOffset, GX_TL_RGB5A3, 0x100);
|
||||
GXLoadTlut(&mFileCell[slot][file].iconTlut, GX_TLUT0);
|
||||
if ((int)icons[slot][file].iconFmt[start] == GX_TF_RGB5A3) {
|
||||
GXLoadTexObj(initIconTexture(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]), GX_TEXMAP0);
|
||||
} else if ((int)icons[slot][file].iconFmt[start] == GX_TF_C8) {
|
||||
initIconTextureCI(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconOffset[start]);
|
||||
GXTlutObj* tlut = initIconPalette(slot, file, reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].iconTlutOffset);
|
||||
GXLoadTlut(tlut, GX_TLUT0);
|
||||
GXLoadTexObj(&mFileCell[slot][file].icon, GX_TEXMAP0);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -424,7 +422,7 @@ const wchar_t* MemoryCardManager::getComment(u8 slot, s16 index, int which) {
|
||||
return mFileCell[slot][file].comment[which];
|
||||
}
|
||||
|
||||
GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
const GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
CardDirectory* dirs = reinterpret_cast<CardDirectory*>(memorycard::getCardDirState());
|
||||
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
|
||||
u32 file = mFile[slot][index].fileNo;
|
||||
@@ -432,7 +430,7 @@ GXTexObj* MemoryCardManager::create_banner(u8 slot, s16 index) {
|
||||
return NULL;
|
||||
}
|
||||
if ((int)icons[slot][file].bannerType == GX_TF_RGB5A3) {
|
||||
GXTexObj* banner = initBannerTexture(slot, file,
|
||||
const GXTexObj* banner = initBannerTexture(slot, file,
|
||||
reinterpret_cast<u8*>(&icons[slot][file]) + icons[slot][file].bannerOffset);
|
||||
GXLoadTexObj(banner, GX_TEXMAP0);
|
||||
} else if ((int)icons[slot][file].bannerType == GX_TF_C8) {
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace ipl {
|
||||
mpLayout->calc();
|
||||
mpGui->calc();
|
||||
anmPane = NULL;
|
||||
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
|
||||
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
|
||||
anmPane->calc();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ipl {
|
||||
mpGui->calc();
|
||||
|
||||
anmPane = NULL;
|
||||
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
|
||||
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
|
||||
anmPane->calc();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace ipl {
|
||||
mpLayout->calc();
|
||||
mpGui->calc();
|
||||
anmPane = NULL;
|
||||
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL)
|
||||
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL)
|
||||
anmPane->calc();
|
||||
|
||||
switch (mState) {
|
||||
@@ -203,7 +203,7 @@ namespace ipl {
|
||||
change_button_text(MESG_CMN_BACK_ALT_3);
|
||||
|
||||
AnmPane* anmPane = NULL;
|
||||
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL)
|
||||
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL)
|
||||
clear_anmpane(anmPane->getName());
|
||||
|
||||
do_animation(ANIM_MASK_IN, ANIM_TYPE_FORWARD, true);
|
||||
@@ -235,7 +235,7 @@ namespace ipl {
|
||||
change_button_text(MESG_CMN_BACK_ALT_3);
|
||||
|
||||
AnmPane* anmPane = NULL;
|
||||
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL)
|
||||
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL)
|
||||
clear_anmpane(anmPane->getName());
|
||||
|
||||
mState = STATE_SELECT_FADEIN;
|
||||
|
||||
@@ -6,19 +6,22 @@ namespace ipl {
|
||||
namespace scene {
|
||||
void SDArrow::draw() {
|
||||
SDButton* button;
|
||||
if (System::onDefaultDrawLayer() && (button = static_cast<SDButton*>(System::getScene(SCENE_SD_BUTTON)), button != NULL)) {
|
||||
layout::Object::setDefaultCamera();
|
||||
if (System::onDefaultDrawLayer()) {
|
||||
button = static_cast<SDButton*>(System::getScene(SCENE_SD_BUTTON));
|
||||
if (button != NULL) {
|
||||
layout::Object::setDefaultCamera();
|
||||
|
||||
for (int i = 0; i < SDButton::ARROW_BTN_MAX; i++) {
|
||||
layout::Object* arrowLayout = button->get_layout();
|
||||
nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(SDButton::mscArrowName[i]);
|
||||
for (int i = 0; i < SDButton::ARROW_BTN_MAX; i++) {
|
||||
layout::Object* arrowLayout = button->get_layout();
|
||||
nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(SDButton::mscArrowName[i]);
|
||||
|
||||
pane->SetVisible(true);
|
||||
arrowLayout->draw(pane);
|
||||
pane->SetVisible(false);
|
||||
pane->SetVisible(true);
|
||||
arrowLayout->draw(pane);
|
||||
pane->SetVisible(false);
|
||||
}
|
||||
|
||||
button->drawBalloon();
|
||||
}
|
||||
|
||||
button->drawBalloon();
|
||||
}
|
||||
}
|
||||
} // namespace scene
|
||||
|
||||
@@ -7,13 +7,11 @@
|
||||
#define IPL_SDMEMORY_SD_CHANNEL_SELECT_LAYOUT
|
||||
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
|
||||
#define IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
#define IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
#define IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
|
||||
#include "system/iplDialogWindow.h"
|
||||
#undef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
#include "scene/sdChannelMemory/iplSDMemory.h"
|
||||
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
|
||||
#undef IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
#undef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
|
||||
#undef IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
|
||||
#undef IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
|
||||
@@ -28,34 +26,12 @@
|
||||
#include "utility/iplLayout.h"
|
||||
#include <revolution/os/OSTime.h>
|
||||
|
||||
extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::SDChannelSelect* channelSelect,
|
||||
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::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId, u32 flags);
|
||||
extern "C" bool iplSDChannelSelect_813DB530(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId** titleNames, ESTitleId** secondaryTitles);
|
||||
extern "C" bool iplSDChannelSelect_813DB478(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId** titles, ESTitleId** secondaryTitles,
|
||||
ESTitleId** names);
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
typedef ::gui::Component GuiComponent;
|
||||
typedef ::gui::PaneComponent GuiPaneComponent;
|
||||
typedef controller::Interface ControllerInterface;
|
||||
|
||||
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth);
|
||||
|
||||
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
|
||||
const nw4r::ut::Color& second) NO_INLINE;
|
||||
|
||||
static const char* sControlPaneNames[] = {
|
||||
"A", "B", "B_BtnA",
|
||||
};
|
||||
@@ -79,6 +55,7 @@ namespace ipl {
|
||||
return count;
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 1 to preserve the layout-string base register.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void SDMemory::create(EGG::Heap* heap, nand::LayoutFile* layoutFile, SDChannelSelect* channelSelect) {
|
||||
@@ -732,8 +709,8 @@ namespace ipl {
|
||||
if (!mpMainLayout->isPlaying(-1)) {
|
||||
switch (mProcessState) {
|
||||
case 0:
|
||||
if (iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2)) {
|
||||
if (mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 2)) {
|
||||
mDialogState = 4;
|
||||
mpTitleLayout->getAnim(0)->initAnmFrame();
|
||||
mpTitleLayout->getAnim(0)->play();
|
||||
@@ -816,8 +793,8 @@ namespace ipl {
|
||||
|
||||
if (System::getDialog()->getLastResult() != -1) {
|
||||
if (mpSDChannelSelect->getWorker()->get_async_result() == NandSDWorker::RESULT_OK) {
|
||||
mNandTitleCount = mTitleListState.mSecondaryCount;
|
||||
mTitleNameCount = mTitleListState.mNameCount;
|
||||
mNandTitleCount = mNandTitleList.count;
|
||||
mTitleNameCount = mSDTitleList.count;
|
||||
} else {
|
||||
mNandTitleCount = 0;
|
||||
mTitleNameCount = 0;
|
||||
@@ -931,8 +908,7 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iplSDChannelSelect_813DB530(mpSDChannelSelect, &mTitleListState.mpNames,
|
||||
&mTitleListState.mpSecondaryTitles)) {
|
||||
if (mpSDChannelSelect->enqueueErrorNotice(&mSDTitleList, &mNandTitleList)) {
|
||||
mDialogState = 19;
|
||||
mCurrentTitleName[0] = L'\0';
|
||||
mCurrentTitle = 0;
|
||||
@@ -1005,7 +981,7 @@ namespace ipl {
|
||||
if (iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) ||
|
||||
iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) {
|
||||
ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) {
|
||||
if (mpSDChannelSelect->enqueueMoveNotice(titleId)) {
|
||||
mDialogState = 14;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1055,7 +1031,7 @@ namespace ipl {
|
||||
|
||||
void SDMemory::onDialogState16() {
|
||||
if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) {
|
||||
if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, mTitleIds[mCurrentTitle], 0)) {
|
||||
if (mpSDChannelSelect->enqueueStateNotice(mTitleIds[mCurrentTitle], 0)) {
|
||||
mDialogState = 16;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1110,7 +1086,7 @@ namespace ipl {
|
||||
System::getDialog()->setTitleForSDMemory(mCurrentTitleName);
|
||||
|
||||
const ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleId)) {
|
||||
if (mpSDChannelSelect->enqueueDeleteNotice(titleId)) {
|
||||
mDialogState = 18;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1165,7 +1141,9 @@ namespace ipl {
|
||||
|
||||
if (blockCountMarker != NULL && message != NULL) {
|
||||
format[0] = L'\0';
|
||||
// MWCC retains this zero-length memset call in the original dialog setup.
|
||||
memset(format + 1, 1, 0);
|
||||
// MWCC needs unsigned address subtraction to preserve the logical shift.
|
||||
wcsncat(format, message,
|
||||
(reinterpret_cast<u32>(blockCountMarker) - reinterpret_cast<u32>(message)) >> 1);
|
||||
wcscat(format, L"%d");
|
||||
@@ -1270,19 +1248,39 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void SDMemory::drawTransferTitles() {
|
||||
f32 rowY;
|
||||
f32 rowTop;
|
||||
f32 backgroundOffset;
|
||||
f32 titleOffset;
|
||||
f32 rowHeight;
|
||||
f32 messageOffset;
|
||||
f32 bodyHeight;
|
||||
f32 bodyY;
|
||||
u8 alpha;
|
||||
nw4r::lyt::Pane* bodyPane;
|
||||
nw4r::lyt::Pane* titleSizePane;
|
||||
nw4r::lyt::TextBox* titleText;
|
||||
nw4r::lyt::Pane* footerPane;
|
||||
u32 nandTitleIndex;
|
||||
u32 titleIndex;
|
||||
wchar_t* messageForCount;
|
||||
s32 lineCount;
|
||||
wchar_t* messageLine;
|
||||
nw4r::lyt::TextBox* messageText;
|
||||
s32 lineIndex;
|
||||
wchar_t* lineEnd;
|
||||
u32 lineLength;
|
||||
const nw4r::math::VEC3& translation = mpDialogLayout->FindPaneByName("N_Memo")->GetTranslate();
|
||||
nw4r::math::VEC3 memoPosition;
|
||||
memoPosition.x = translation.x;
|
||||
memoPosition.y = translation.y;
|
||||
memoPosition.z = translation.z;
|
||||
f32 bodyY = memoPosition.y;
|
||||
memoPosition = translation;
|
||||
bodyY = memoPosition.y;
|
||||
mpDialogLayout->FindPaneByName("header_header");
|
||||
nw4r::lyt::Pane* bodyPane = mpDialogLayout->FindPaneByName("header_body");
|
||||
bodyPane = mpDialogLayout->FindPaneByName("header_body");
|
||||
if (bodyY < 500.0f) {
|
||||
mpDialogLayout->draw("header_header");
|
||||
}
|
||||
|
||||
u8 alpha = mpDialogLayout->FindPaneByName("N_Memo")->GetAlpha();
|
||||
alpha = mpDialogLayout->FindPaneByName("N_Memo")->GetAlpha();
|
||||
nw4r::ut::LinkList<nw4r::lyt::Pane, offsetof(nw4r::lyt::detail::PaneBase, mLink)>::Iterator child =
|
||||
bodyPane->GetChildList().GetBeginIter();
|
||||
while (child != bodyPane->GetChildList().GetEndIter()) {
|
||||
@@ -1290,29 +1288,26 @@ namespace ipl {
|
||||
++child;
|
||||
}
|
||||
|
||||
f32 messageOffset = 0.0f;
|
||||
f32 bodyHeight = bodyPane->GetSize().height;
|
||||
messageOffset = 0.0f;
|
||||
bodyHeight = bodyPane->GetSize().height;
|
||||
if (mNandTitleCount != 0) {
|
||||
const wchar_t* messageForCount = System::getMessage(0xCB);
|
||||
s32 lineCount = 0;
|
||||
const wchar_t* newline = wcsstr(messageForCount, L"\n");
|
||||
messageForCount = System::getMessage(0xCB);
|
||||
lineCount = 0;
|
||||
wchar_t* newline = wcsstr(messageForCount, L"\n");
|
||||
while (newline != NULL) {
|
||||
++lineCount;
|
||||
newline = wcsstr(newline + 1, L"\n");
|
||||
}
|
||||
|
||||
const wchar_t* messageLine = System::getMessage(0xCB);
|
||||
nw4r::lyt::TextBox* messageText = static_cast<nw4r::lyt::TextBox*>(
|
||||
messageLine = System::getMessage(0xCB);
|
||||
messageText = static_cast<nw4r::lyt::TextBox*>(
|
||||
mpDialogLayout->FindPaneByName("T_Header_body"));
|
||||
s32 totalLines = lineCount + 1;
|
||||
s32 lineIndex = 0;
|
||||
if (lineIndex < totalLines) {
|
||||
do {
|
||||
const wchar_t* lineEnd = wcsstr(messageLine, L"\n");
|
||||
for (lineIndex = 0; lineIndex < lineCount + 1; ++lineIndex) {
|
||||
lineEnd = wcsstr(messageLine, L"\n");
|
||||
if (lineEnd == NULL) {
|
||||
utility::layout::set_string(messageText, messageLine);
|
||||
} else {
|
||||
u32 lineLength = static_cast<u32>(lineEnd - messageLine);
|
||||
lineLength = static_cast<u32>(lineEnd - messageLine);
|
||||
wcsncpy(mCurrentTitleName, messageLine, lineLength);
|
||||
mCurrentTitleName[lineLength] = L'\0';
|
||||
utility::layout::set_string(messageText, mCurrentTitleName);
|
||||
@@ -1327,52 +1322,42 @@ namespace ipl {
|
||||
}
|
||||
|
||||
messageOffset -= bodyHeight;
|
||||
++lineIndex;
|
||||
} while (lineIndex < totalLines);
|
||||
}
|
||||
}
|
||||
|
||||
messageOffset += bodyHeight;
|
||||
f32 backgroundOffset = 40.0f + messageOffset;
|
||||
f32 titleOffset = 79.5f + messageOffset;
|
||||
backgroundOffset = 40.0f + messageOffset;
|
||||
titleOffset = 79.5f + messageOffset;
|
||||
|
||||
nw4r::lyt::Pane* titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
|
||||
f32 rowHeight = titleSizePane->GetSize().height;
|
||||
nw4r::lyt::PaneList::Iterator titleChild = titleSizePane->GetChildList().GetBeginIter();
|
||||
while (titleChild != titleSizePane->GetChildList().GetEndIter()) {
|
||||
titleChild->SetAlpha(alpha);
|
||||
++titleChild;
|
||||
titleSizePane = mpDialogLayout->FindPaneByName("N_Body");
|
||||
rowHeight = titleSizePane->GetSize().height;
|
||||
nw4r::lyt::PaneList::Iterator bodyChild = titleSizePane->GetChildList().GetBeginIter();
|
||||
while (bodyChild != titleSizePane->GetChildList().GetEndIter()) {
|
||||
bodyChild->SetAlpha(alpha);
|
||||
++bodyChild;
|
||||
}
|
||||
|
||||
nw4r::lyt::TextBox* titleText = static_cast<nw4r::lyt::TextBox*>(
|
||||
titleText = static_cast<nw4r::lyt::TextBox*>(
|
||||
mpDialogLayout->FindPaneByName("T_Letter"));
|
||||
titleText->SetAlpha(alpha);
|
||||
|
||||
u32 nandTitleIndex = 0;
|
||||
for (u32 titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
|
||||
nandTitleIndex = 0;
|
||||
for (titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
|
||||
utility::layout::set_string(titleText, mTitleNames[titleIndex]);
|
||||
if (nandTitleIndex < mNandTitleCount && mTitleIds[titleIndex] == mNandTitleIds[nandTitleIndex]) {
|
||||
GXColor gxActive;
|
||||
writeFourFlagBytes(&gxActive.r, 0x34, 0xBE, 0xED, 0xFF);
|
||||
++nandTitleIndex;
|
||||
nw4r::ut::Color active0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxActive);
|
||||
setTitleRowColors(titleText,
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)),
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)));
|
||||
nw4r::ut::Color color(0x34, 0xBE, 0xED, 0xFF);
|
||||
titleText->SetTextColor(color, color);
|
||||
} else {
|
||||
GXColor gxInactive;
|
||||
writeFourFlagBytes(&gxInactive.r, 0x64, 0x64, 0x64, 0xFF);
|
||||
nw4r::ut::Color inactive0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxInactive);
|
||||
setTitleRowColors(titleText,
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)),
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)));
|
||||
nw4r::ut::Color color(0x64, 0x64, 0x64, 0xFF);
|
||||
titleText->SetTextColor(color, color);
|
||||
}
|
||||
|
||||
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
|
||||
f32 rowTop = textRect.bottom - textRect.top;
|
||||
rowTop = textRect.bottom - textRect.top;
|
||||
s32 visibleRows = static_cast<s32>(static_cast<f32>(ceil(-rowTop / titleSizePane->GetSize().height)));
|
||||
for (s32 row = 0; row < visibleRows; ++row) {
|
||||
f32 rowY = bodyY + backgroundOffset;
|
||||
rowY = bodyY + backgroundOffset;
|
||||
if (-500.0f < rowY && rowY < 500.0f) {
|
||||
nw4r::math::VEC2 translation(0.0f, backgroundOffset);
|
||||
titleSizePane->SetTranslate(translation);
|
||||
@@ -1387,11 +1372,11 @@ namespace ipl {
|
||||
titleText->CalculateMtx(*mpDialogLayout->getDrawInfo());
|
||||
mpDialogLayout->draw(titleText);
|
||||
}
|
||||
titleOffset -= rowHeight * static_cast<f32>(visibleRows);
|
||||
titleOffset -= visibleRows * rowHeight;
|
||||
}
|
||||
|
||||
backgroundOffset += rowHeight;
|
||||
nw4r::lyt::Pane* footerPane = mpDialogLayout->FindPaneByName("N_Footer");
|
||||
footerPane = mpDialogLayout->FindPaneByName("N_Footer");
|
||||
nw4r::lyt::PaneList::Iterator footerChild = footerPane->GetChildList().GetBeginIter();
|
||||
while (footerChild != footerPane->GetChildList().GetEndIter()) {
|
||||
footerChild->SetAlpha(alpha);
|
||||
@@ -1410,18 +1395,6 @@ namespace ipl {
|
||||
mpDialogLayout->draw("N_Move");
|
||||
}
|
||||
|
||||
void writeFourFlagBytes(u8* flags, u8 first, u8 second, u8 third, u8 fourth) {
|
||||
flags[0] = first;
|
||||
flags[1] = second;
|
||||
flags[2] = third;
|
||||
flags[3] = fourth;
|
||||
}
|
||||
|
||||
void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first,
|
||||
const nw4r::ut::Color& second) NO_INLINE {
|
||||
textBox->SetTextColors(first, second);
|
||||
}
|
||||
|
||||
s32 SDMemory::getControlPaneIndex(const char* paneName) {
|
||||
s32 paneIndex = -1;
|
||||
for (s32 i = 0; i < 3; i++) {
|
||||
@@ -1645,23 +1618,23 @@ namespace ipl {
|
||||
switch (paneIndex) {
|
||||
case 0:
|
||||
animator = mpTitleLayout->getAnim(7);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 0);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 0);
|
||||
break;
|
||||
case 1:
|
||||
animator = mpTitleLayout->getAnim(10);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 1);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 1);
|
||||
break;
|
||||
case 2:
|
||||
animator = mpTitleLayout->getAnim(13);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 2);
|
||||
break;
|
||||
case 3:
|
||||
animator = mpTitleLayout->getAnim(16);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 3);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, mTitleNames, &mTitleCount, 3);
|
||||
break;
|
||||
case 4:
|
||||
animator = mpTitleLayout->getAnim(4);
|
||||
@@ -1681,16 +1654,13 @@ namespace ipl {
|
||||
memset(mSDTitleIds, 0, sizeof(mSDTitleIds));
|
||||
mNandTitleCount = 0;
|
||||
mTitleNameCount = 0;
|
||||
mTitleListState.mpTitles = mTitleIds;
|
||||
mTitleListState.mCount = mTitleCount;
|
||||
mTitleListState.mpSecondaryTitles = mNandTitleIds;
|
||||
mTitleListState.mSecondaryCount = 0;
|
||||
mTitleListState.mpNames = mSDTitleIds;
|
||||
mTitleListState.mNameCount = 0;
|
||||
iplSDChannelSelect_813DB58C(mpSDChannelSelect,
|
||||
&mTitleListState.mpTitles,
|
||||
&mTitleListState.mpSecondaryTitles,
|
||||
&mTitleListState.mpNames);
|
||||
mTitleList.titleIds = mTitleIds;
|
||||
mTitleList.count = mTitleCount;
|
||||
mNandTitleList.titleIds = mNandTitleIds;
|
||||
mNandTitleList.count = 0;
|
||||
mSDTitleList.titleIds = mSDTitleIds;
|
||||
mSDTitleList.count = 0;
|
||||
mpSDChannelSelect->enqueueCommandNotice(&mTitleList, &mNandTitleList, &mSDTitleList);
|
||||
}
|
||||
|
||||
if (paneIndex == 4) {
|
||||
|
||||
@@ -206,12 +206,12 @@ namespace ipl {
|
||||
getSceneHeap(), "corrupt_icon.ash", 0, 0, 0);
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
iplSDChannelObj_activateIfIdle(channel);
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 0 to preserve the BS2 wait-loop instructions.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void SDChannelSelect::create() {
|
||||
@@ -352,7 +352,7 @@ namespace ipl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueMoveNotice(u32 controller, u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueMoveNotice(ESTitleId titleId) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ namespace ipl {
|
||||
command.type = 6;
|
||||
command.arguments.values[0] = 0;
|
||||
command.arguments.values[1] = 0;
|
||||
command.titleId = ((u64)page << 32) | index;
|
||||
command.titleId = titleId;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
@@ -380,36 +380,39 @@ namespace ipl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueErrorNotice(u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueErrorNotice(NandSDWorker::TitleIdList* newTitles,
|
||||
NandSDWorker::TitleIdList* replacingTitles) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SDChannelSelectCommand command;
|
||||
command.type = 11;
|
||||
command.arguments.values[0] = page;
|
||||
command.arguments.values[1] = index;
|
||||
command.arguments.titleLists[0] = newTitles;
|
||||
command.arguments.titleLists[1] = replacingTitles;
|
||||
command.titleId = 0;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueCommandNotice(u32 page, u32 index, u32 commandType) {
|
||||
bool SDChannelSelect::enqueueCommandNotice(NandSDWorker::TitleIdList* titles,
|
||||
NandSDWorker::TitleIdList* foundTitles,
|
||||
NandSDWorker::TitleIdList* badTitles) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SDChannelSelectCommand command;
|
||||
command.arguments.values[0] = page;
|
||||
command.arguments.titleLists[0] = titles;
|
||||
command.type = 12;
|
||||
command.arguments.values[1] = index;
|
||||
command.arguments.values[2] = commandType;
|
||||
command.arguments.titleLists[1] = foundTitles;
|
||||
command.arguments.titleLists[2] = badTitles;
|
||||
command.titleId = 0;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SDChannelSelect::enqueueDeleteNotice(u32 controller, u32 page, u32 index) {
|
||||
bool SDChannelSelect::enqueueDeleteNotice(ESTitleId titleId) {
|
||||
if (mCurrentSDState != 6) {
|
||||
return false;
|
||||
}
|
||||
@@ -419,7 +422,7 @@ namespace ipl {
|
||||
command.arguments.values[0] = 0;
|
||||
command.arguments.values[1] = 0;
|
||||
command.arguments.values[2] = 0;
|
||||
command.titleId = ((u64)page << 32) | index;
|
||||
command.titleId = titleId;
|
||||
mCommandQueue.push(command);
|
||||
return true;
|
||||
}
|
||||
@@ -450,68 +453,69 @@ namespace ipl {
|
||||
break;
|
||||
}
|
||||
|
||||
if (mState < 8) {
|
||||
if (mState == 1) {
|
||||
} else if (mState >= 1) {
|
||||
goto process_worker;
|
||||
} else if (mState >= 0) {
|
||||
goto process_worker;
|
||||
}
|
||||
} else {
|
||||
if (mState >= 15) {
|
||||
} else if (mState >= 12) {
|
||||
goto process_worker;
|
||||
}
|
||||
}
|
||||
switch (mCurrentSDState) {
|
||||
case 1:
|
||||
switch (mState) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4: {
|
||||
if (mDialogState != 0) {
|
||||
return;
|
||||
}
|
||||
mSourcePage = -1;
|
||||
mSourceIndex = -1;
|
||||
mbShowNoCardMessage = true;
|
||||
refreshChannelList();
|
||||
memset(mpChannelTitleIds, 0, mPageCount * 0x30);
|
||||
memset(mpSDTitleInfo, 0, 0x4b00);
|
||||
mSDTitleCount = 0;
|
||||
mbOperationActive = false;
|
||||
mbHazardTitleFound = false;
|
||||
mbChannelLimitReached = false;
|
||||
mbSDCardBroken = false;
|
||||
mbNeedsRefresh = false;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
break;
|
||||
default:
|
||||
switch (mCurrentSDState) {
|
||||
case 1:
|
||||
setDialogMessage(2, 0xa9);
|
||||
mWorkerCommand = 6;
|
||||
break;
|
||||
case 2:
|
||||
if (!mbInitialLoadComplete) {
|
||||
setDialogMessage(8, 0xaa);
|
||||
}
|
||||
mbInitialLoadComplete = true;
|
||||
enqueueStartNotice();
|
||||
enqueueFinishNotice();
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
setDialogMessage(2, 0xab);
|
||||
mWorkerCommand = 15;
|
||||
case 4: {
|
||||
if (mDialogState != 0) {
|
||||
return;
|
||||
}
|
||||
mSourcePage = -1;
|
||||
mSourceIndex = -1;
|
||||
mbShowNoCardMessage = true;
|
||||
refreshChannelList();
|
||||
memset(mpChannelTitleIds, 0, mPageCount * 0x30);
|
||||
memset(mpSDTitleInfo, 0, 0x4b00);
|
||||
mSDTitleCount = 0;
|
||||
mbOperationActive = false;
|
||||
mbHazardTitleFound = false;
|
||||
mbChannelLimitReached = false;
|
||||
mbSDCardBroken = false;
|
||||
mbNeedsRefresh = false;
|
||||
|
||||
switch (mCurrentSDState) {
|
||||
case 1:
|
||||
setDialogMessage(2, 0xa9);
|
||||
mWorkerCommand = 6;
|
||||
break;
|
||||
case 2:
|
||||
if (!mbInitialLoadComplete) {
|
||||
setDialogMessage(8, 0xaa);
|
||||
}
|
||||
mbInitialLoadComplete = true;
|
||||
enqueueStartNotice();
|
||||
enqueueFinishNotice();
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
setDialogMessage(2, 0xab);
|
||||
mWorkerCommand = 15;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
process_worker:
|
||||
if (mpSDWorker->is_working() || mWorkerState != 4) {
|
||||
return;
|
||||
}
|
||||
@@ -1326,7 +1330,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesByUsage(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1343,7 +1347,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1361,7 +1365,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesFromNandUsage(
|
||||
s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount) {
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1384,7 +1388,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[index].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1400,7 +1404,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesByChannelOrder(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
static const int channelOrder[MAX_CHANNEL_INDEX] = {
|
||||
11, 7, 3, 10, 6, 2, 9, 5, 1, 8, 4, 0,
|
||||
};
|
||||
@@ -1427,7 +1431,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(page, channelOrder[order], 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1445,7 +1449,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesBySpecialChannels(
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
wchar_t (*titleNames)[21], u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
@@ -1502,7 +1506,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1528,7 +1532,7 @@ namespace ipl {
|
||||
titleIds[*titleCount] = mpNandTitleInfo[usageIndex].curTitleId;
|
||||
wchar_t* titleName = System::getChannelManager()->getTitleName(
|
||||
page, channelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1544,7 +1548,7 @@ namespace ipl {
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(
|
||||
hadePage, hadeChannelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1559,7 +1563,7 @@ namespace ipl {
|
||||
wchar_t* titleName =
|
||||
System::getChannelManager()->getTitleName(
|
||||
hatePage, hateChannelIndex, 0);
|
||||
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
|
||||
memcpy(titleNames[*titleCount], titleName, sizeof(*titleNames));
|
||||
++*titleCount;
|
||||
|
||||
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) {
|
||||
@@ -1575,7 +1579,7 @@ namespace ipl {
|
||||
|
||||
bool SDChannelSelect::collectTitlesForMode(
|
||||
s32* requiredBytes, s32* requiredBlocks,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount, int searchMode) {
|
||||
ESTitleId* titleIds, wchar_t (*titleNames)[21], u32* titleCount, int searchMode) {
|
||||
switch (searchMode) {
|
||||
case 0:
|
||||
return collectTitlesBySpecialChannels(
|
||||
@@ -1643,6 +1647,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 0 to load the flush heap before its receiver.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void SDChannelSelect::flushSaveDataAndMountSD() {
|
||||
@@ -1827,9 +1832,8 @@ namespace ipl {
|
||||
|
||||
if (state == 1 && mState != 1 && mState != 15) {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int channelPage = channel->getPage();
|
||||
int channelIndex = channel->getIndex();
|
||||
if (channelPage == mCurrentPage) {
|
||||
@@ -1932,8 +1936,7 @@ namespace ipl {
|
||||
SDChannelObj* channel = NULL;
|
||||
System::getSaveData()->setLastSDPrevPage(mCurrentPage);
|
||||
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
nw4r::ut::List_Remove(&mChannelObjects, channel);
|
||||
destroyChannelObject(channel);
|
||||
channel = NULL;
|
||||
@@ -2051,8 +2054,7 @@ namespace ipl {
|
||||
|
||||
void SDChannelSelect::updateChannelObjects() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
updateChannelObject(channel);
|
||||
}
|
||||
}
|
||||
@@ -2068,16 +2070,14 @@ namespace ipl {
|
||||
|
||||
void SDChannelSelect::calcChannelObjects() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
iplSDChannelObj_calc(channel);
|
||||
}
|
||||
}
|
||||
|
||||
void SDChannelSelect::drawChannelTransitionObjects() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int page = channel->mPage;
|
||||
int index = channel->mIndex;
|
||||
if (!hasChannelObject(page, index) || !isChannelReady(channel)) {
|
||||
@@ -2142,6 +2142,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs this pragma to preserve calls from the drawing loops.
|
||||
#pragma dont_inline on
|
||||
BOOL SDChannelSelect::isChannelReady(const SDChannelObj* channel) {
|
||||
return channel->mState == 3;
|
||||
@@ -2150,16 +2151,14 @@ namespace ipl {
|
||||
|
||||
void SDChannelSelect::drawChannelObjects() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
if (hasChannelObject(channel->getPage(), channel->getIndex())) {
|
||||
iplSDChannelObj_drawPage(channel);
|
||||
}
|
||||
}
|
||||
|
||||
channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
if (hasChannelObject(channel->getPage(), channel->getIndex())) {
|
||||
iplSDChannelObj_drawDialog(channel);
|
||||
}
|
||||
@@ -2291,9 +2290,8 @@ namespace ipl {
|
||||
updateChannelObjectOrder(page);
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int titleIndex = channel->getPage() * MAX_CHANNEL_INDEX + channel->getIndex();
|
||||
if (!iplSDChannelObj_hasAppMeta(channel) && mpChannelTitleIds[titleIndex] != 0 &&
|
||||
mbNeedsRefresh) {
|
||||
@@ -2352,9 +2350,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int page = channel->getPage();
|
||||
int index = channel->getIndex();
|
||||
if (keepChannel != NULL && page == keepPage && index == keepIndex) {
|
||||
@@ -2387,9 +2384,8 @@ namespace ipl {
|
||||
|
||||
void SDChannelSelect::refreshChannelList() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
if (iplSDChannelObj_hasAppMeta(channel)) {
|
||||
SDChannelObj* previous = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetPrev(&mChannelObjects, channel));
|
||||
@@ -2413,9 +2409,8 @@ namespace ipl {
|
||||
|
||||
void SDChannelSelect::refreshAfterSDTitleList() {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int channelIndex = channel->mPage * 12 + channel->mIndex;
|
||||
if (!iplSDChannelObj_hasAppMeta(channel) &&
|
||||
mpChannelTitleIds[channelIndex] != 0) {
|
||||
@@ -2489,9 +2484,8 @@ namespace ipl {
|
||||
|
||||
SDChannelObj* SDChannelSelect::findChannelObject(int page, int index) const {
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int channelPage = channel->getPage();
|
||||
int channelIndex = channel->getIndex();
|
||||
if (channelPage == page && channelIndex == index) {
|
||||
@@ -2973,9 +2967,8 @@ namespace ipl {
|
||||
mPendingPage = -1;
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
iplSDChannelObj_resetPageAnim(channel, 1);
|
||||
}
|
||||
|
||||
@@ -2995,9 +2988,8 @@ namespace ipl {
|
||||
mPendingPage = 0;
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(
|
||||
nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
iplSDChannelObj_resetPageAnim(channel, 1);
|
||||
}
|
||||
|
||||
@@ -3286,8 +3278,7 @@ namespace ipl {
|
||||
button->disableBtn();
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
int channelPage = channel->getPage();
|
||||
int channelIndex = channel->getIndex();
|
||||
bool selected = channelPage == page && channelIndex == index;
|
||||
@@ -3325,8 +3316,7 @@ namespace ipl {
|
||||
mbDialogActive = false;
|
||||
|
||||
SDChannelObj* channel = NULL;
|
||||
while (channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel)),
|
||||
channel != NULL) {
|
||||
while ((channel = static_cast<SDChannelObj*>(nw4r::ut::List_GetNext(&mChannelObjects, channel))) != NULL) {
|
||||
iplSDChannelObj_resetPageAnim(channel, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,10 +54,8 @@ extern "C" BOOL iplSDChannelTitle_isNetworkAllowed(SDChannelTitle*, ESTmdView*,
|
||||
extern "C" BOOL iplSDChannelTitle_isParentalEnabled();
|
||||
extern "C" void iplSDChannelTitle_beginLaunch(SDChannelTitle* scene, SDChannelObj* channel);
|
||||
extern "C" void iplSDChannelTitle_prepareSceneExit(SDChannelTitle* scene, int nextScene);
|
||||
extern "C" void iplSDChannelTitle_rebootSystem(SDChannelTitle*);
|
||||
extern "C" bool iplSDChannelTitle_isLaunchDelayDone(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_setStartButtonPressed(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_drawDimOverlay(SDChannelTitle*, const nw4r::ut::Rect& bounds, GXColor color);
|
||||
extern "C" void iplSDChannelTitle_setPaneMessage(SDChannelTitle*, nw4r::lyt::Pane* pane, u32 message, bool allocate);
|
||||
extern "C" nand::LayoutFile* iplSDChannelTitle_loadBannerMetaFiles(SDChannelTitle*, ESTitleId title, nand::File** sound);
|
||||
extern "C" void iplSDChannelTitle_fetchTmdViewTask(void* argument);
|
||||
@@ -83,7 +81,6 @@ extern "C" void iplSDChannelTitle_setPageAndIndex(SDChannelTitle* scene, int pag
|
||||
extern "C" void iplSDChannelTitle_cleanupAndLeave(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_confirmLeaveToSettings(SDChannelTitle* scene, bool settings);
|
||||
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene);
|
||||
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(SDMemory::TitleRange*, const SDMemory::TitleRange*);
|
||||
|
||||
static inline void setMemoryTitleLists(SDMemory* memory, SDMemory::TitleRange sdRange,
|
||||
SDMemory::TitleRange nandRange) {
|
||||
@@ -140,9 +137,6 @@ public:
|
||||
|
||||
extern "C" void iplSDChannelObj_applyLanguageGroups(layout::Object* layout);
|
||||
extern "C" const wchar_t* iplSDChannelObj_getLocalizedName(SDChannelObj* channel, int nameIndex);
|
||||
extern "C" bool iplSDChannelTitle_startZoomFade(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_rebuildBannerLayout(SDChannelTitle* scene);
|
||||
extern "C" void iplSDChannelTitle_setPaneMessage(SDChannelTitle* scene, nw4r::lyt::Pane* pane, u32 message, bool allocate);
|
||||
|
||||
SDChannelTitle::SDChannelTitle(EGG::Heap* heap, SDChannelSelect* channelSelect)
|
||||
: FaderSceneBase(heap), mState(0), mNextScene(0), mParentalResult(0),
|
||||
@@ -764,9 +758,10 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
|
||||
if (static_cast<u32>(scene->mTitleRange.mByteSize) < 0x3800000) {
|
||||
nandRange.mByteSize = 0x3800000;
|
||||
nandRange.mCount = scene->mTitleRange.mCount;
|
||||
iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange);
|
||||
sdRange = scene->mTitleRange;
|
||||
} else {
|
||||
iplSDChannelTitle_copyTitleRange(&nandRange, iplSDChannelTitle_copyTitleRange(&sdRange, &scene->mTitleRange));
|
||||
// MWCC needs the chained copy to preserve title-range copy order.
|
||||
nandRange = sdRange = scene->mTitleRange;
|
||||
}
|
||||
SDMemory* memory = &scene->mMemory;
|
||||
setMemoryTitleLists(memory, sdRange, nandRange);
|
||||
@@ -788,14 +783,6 @@ extern "C" void iplSDChannelTitle_updateCopyPrepare(SDChannelTitle* scene) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" SDMemory::TitleRange* iplSDChannelTitle_copyTitleRange(
|
||||
SDMemory::TitleRange* target, const SDMemory::TitleRange* source) {
|
||||
s32 bytes = source->mByteSize;
|
||||
target->mCount = source->mCount;
|
||||
target->mByteSize = bytes;
|
||||
return target;
|
||||
}
|
||||
|
||||
extern "C" void iplSDChannelTitle_updateMemoryCalc(SDChannelTitle* scene) {
|
||||
if (!scene->mMemory.calc()) {
|
||||
return;
|
||||
@@ -1351,6 +1338,7 @@ extern "C" void iplSDChannelTitle_prepareSceneExit(SDChannelTitle* scene, int ne
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO level 0 to preserve the save-manager address register.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -127,15 +127,23 @@ int AOSSi_EndLocal(void) {
|
||||
}
|
||||
|
||||
int AOSSi_WLANGetBSSList(void** output) {
|
||||
int index;
|
||||
int driver;
|
||||
void* buffer;
|
||||
u8* scanBuffer;
|
||||
WDBssDesc* descriptor;
|
||||
int count;
|
||||
struct AOSSAccessPointList* list;
|
||||
int rate;
|
||||
int rateCount;
|
||||
int scanResult;
|
||||
int result = -1;
|
||||
int startupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
int cleanupRetries = 0;
|
||||
int unlockRetries = 0;
|
||||
WDScanParam scan ATTRIBUTE_ALIGN(32);
|
||||
WD_Info info ATTRIBUTE_ALIGN(32);
|
||||
int unlockRetries = 0;
|
||||
int driver;
|
||||
u8* buffer;
|
||||
int cleanupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
u8 macAddress[6];
|
||||
if (!allocateMemory || !releaseMemory) {
|
||||
return -1;
|
||||
@@ -144,14 +152,15 @@ int AOSSi_WLANGetBSSList(void** output) {
|
||||
if (driver <= 0) {
|
||||
return -1;
|
||||
}
|
||||
startup:
|
||||
if (WD_Startup(3) != 0) {
|
||||
while (1) {
|
||||
if (WD_Startup(3) == 0) {
|
||||
break;
|
||||
}
|
||||
if (startupRetries > 10) {
|
||||
goto unlock;
|
||||
}
|
||||
++startupRetries;
|
||||
AOSSi_SleepMs(10);
|
||||
goto startup;
|
||||
}
|
||||
if (WD_GetInfo(&info) == 0) {
|
||||
memcpy(macAddress, info.MAC, 6);
|
||||
@@ -159,6 +168,7 @@ startup:
|
||||
buffer = AOSSi_Alloc(0x3200);
|
||||
if (buffer) {
|
||||
memset(buffer, 0, 0x3200);
|
||||
scanBuffer = (u8*)buffer;
|
||||
scan.channelBit = info.enableChannel;
|
||||
scan.maxChannelTime = 40;
|
||||
memset(scan.bssid, 255, 6);
|
||||
@@ -167,15 +177,11 @@ startup:
|
||||
memset(scan.ssid, 0, 32);
|
||||
memset(scan.ssidMask, 255, 32);
|
||||
while (1) {
|
||||
int scanResult = WD_Scan(&scan, buffer, 0x3200);
|
||||
int count;
|
||||
struct AOSSAccessPointList* list;
|
||||
WDBssDesc* descriptor;
|
||||
int index;
|
||||
scanResult = WD_Scan(&scan, scanBuffer, 0x3200);
|
||||
if (scanResult != 0 && scanResult != WD_INTERNAL_ERR_4) {
|
||||
break;
|
||||
}
|
||||
count = *(u16*)buffer;
|
||||
count = *(u16*)scanBuffer;
|
||||
if (count != 0) {
|
||||
list = AOSSi_Alloc(sizeof(*list) + (count - 1) * sizeof(struct AOSSAccessPoint));
|
||||
if (!list) {
|
||||
@@ -183,10 +189,8 @@ startup:
|
||||
break;
|
||||
}
|
||||
list->count = count;
|
||||
descriptor = (WDBssDesc*)&buffer[2];
|
||||
descriptor = (WDBssDesc*)&scanBuffer[2];
|
||||
for (index = 0; index < count; ++index) {
|
||||
int rate;
|
||||
int rateCount;
|
||||
list->accessPoints[index].ssidLength = descriptor->ssidLength;
|
||||
memcpy(list->accessPoints[index].ssid, descriptor->ssid, 32);
|
||||
list->accessPoints[index].channel = descriptor->channel;
|
||||
@@ -235,7 +239,6 @@ startup:
|
||||
}
|
||||
AOSSi_Free(buffer);
|
||||
}
|
||||
cleanup:
|
||||
while (WD_Cleanup() != 0) {
|
||||
if (cleanupRetries > 10) {
|
||||
result = -1;
|
||||
@@ -287,20 +290,23 @@ int AOSSi_WLANConnect(struct AOSSConnection* connection, struct AOSSConnectionSt
|
||||
interfaceConfig->netif.wireless.config.manual.ssidLength = (u8)connection->ssidLength;
|
||||
memcpy(interfaceConfig->netif.wireless.config.manual.ssid, connection->ssid, connection->ssidLength);
|
||||
result = 0;
|
||||
ipConfig = &AOSSi_NcdIpConfig;
|
||||
memset(ipConfig, 0, sizeof(*ipConfig));
|
||||
ipConfig->adjust.maxTransferUnit = 1300;
|
||||
ipConfig->adjust.tcpRetransTimeout = 100;
|
||||
ipConfig->adjust.dhcpRetransCount = 4;
|
||||
ipConfig->useDhcp = 0;
|
||||
ipConfig->useProxy = 0;
|
||||
memcpy(ipConfig->ip.addr, ipAddress, 4);
|
||||
memcpy(ipConfig->ip.netmask, ipNetmask, 4);
|
||||
memcpy(ipConfig->ip.gateway, ipGateway, 4);
|
||||
memcpy(ipConfig->ip.dns1, primaryDns, 4);
|
||||
memcpy(ipConfig->ip.dns2, secondaryDns, 4);
|
||||
if (NCDSetIpConfig(ipConfig) != 0) {
|
||||
result = -1;
|
||||
// MWCC needs this guard to schedule the IP-config memset arguments.
|
||||
if (result == 0) {
|
||||
ipConfig = &AOSSi_NcdIpConfig;
|
||||
memset(ipConfig, 0, sizeof(*ipConfig));
|
||||
ipConfig->adjust.maxTransferUnit = 1300;
|
||||
ipConfig->adjust.tcpRetransTimeout = 100;
|
||||
ipConfig->adjust.dhcpRetransCount = 4;
|
||||
ipConfig->useDhcp = 0;
|
||||
ipConfig->useProxy = 0;
|
||||
memcpy(ipConfig->ip.addr, ipAddress, 4);
|
||||
memcpy(ipConfig->ip.netmask, ipNetmask, 4);
|
||||
memcpy(ipConfig->ip.gateway, ipGateway, 4);
|
||||
memcpy(ipConfig->ip.dns1, primaryDns, 4);
|
||||
memcpy(ipConfig->ip.dns2, secondaryDns, 4);
|
||||
if (NCDSetIpConfig(ipConfig) != 0) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
if (result == 0 && NCDSetIfConfig(&AOSSi_NcdIfConfig) != 0) {
|
||||
result = -1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -247,49 +247,32 @@ namespace ipl {
|
||||
char fontName[32];
|
||||
char htmlPath[64];
|
||||
char productArea = SCGetProductArea();
|
||||
if (productArea == 6) {
|
||||
goto koreanFont;
|
||||
switch (productArea) {
|
||||
case SC_PRODUCT_AREA_JPN:
|
||||
case SC_PRODUCT_AREA_USA:
|
||||
case SC_PRODUCT_AREA_EUR:
|
||||
case SC_PRODUCT_AREA_AUS:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
break;
|
||||
case SC_PRODUCT_AREA_KOR:
|
||||
snprintf(fontName, sizeof(fontName), "Wii-kr_Round Gothic B.ttf");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
break;
|
||||
case SC_PRODUCT_AREA_CHN:
|
||||
snprintf(fontName, sizeof(fontName), "Wii-cn_HeiTiW5.ttf");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
break;
|
||||
case SC_PRODUCT_AREA_TWN:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "TW2");
|
||||
break;
|
||||
default:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
break;
|
||||
}
|
||||
if (productArea < 6) {
|
||||
if (productArea == 4) {
|
||||
goto defaultFont;
|
||||
}
|
||||
if (productArea >= 4) {
|
||||
goto europeFont;
|
||||
}
|
||||
if (productArea >= 0) {
|
||||
goto standardFont;
|
||||
}
|
||||
} else if (productArea == 11) {
|
||||
goto chineseFont;
|
||||
}
|
||||
goto defaultFont;
|
||||
|
||||
standardFont:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
goto loadFiles;
|
||||
|
||||
koreanFont:
|
||||
snprintf(fontName, sizeof(fontName), "Wii-kr_Round Gothic B.ttf");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
goto loadFiles;
|
||||
|
||||
chineseFont:
|
||||
snprintf(fontName, sizeof(fontName), "Wii-cn_HeiTiW5.ttf");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
goto loadFiles;
|
||||
|
||||
europeFont:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "TW2");
|
||||
goto loadFiles;
|
||||
|
||||
defaultFont:
|
||||
snprintf(fontName, sizeof(fontName), "WiiNTLG-Regular.ttc");
|
||||
snprintf(htmlPath, sizeof(htmlPath), "/html/%s/iplsetting.ash", "US2");
|
||||
|
||||
loadFiles:
|
||||
mpSettingHTMLFile = System::getNandManager()->readAsync(
|
||||
System::createMem1AppHeap(), htmlPath, 0, 0, false);
|
||||
mpWWWArchiveFile = System::getNandManager()->readAsync(
|
||||
@@ -673,7 +656,7 @@ namespace ipl {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto screenModeDispatch;
|
||||
break;
|
||||
}
|
||||
} else if (mScreenModeChangeState == 1 && mDialogState == 8) {
|
||||
System::getFader()->fadeOut();
|
||||
@@ -683,7 +666,6 @@ namespace ipl {
|
||||
return true;
|
||||
}
|
||||
|
||||
screenModeDispatch:
|
||||
switch (mScreenModeChangeState) {
|
||||
case 1:
|
||||
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN) {
|
||||
@@ -1514,44 +1496,45 @@ namespace ipl {
|
||||
}
|
||||
|
||||
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
|
||||
GXRenderModeObj* pRmode = System::getRenderModeObj();
|
||||
GXRenderModeObj* sourceMode = System::getRenderModeObj();
|
||||
GXRenderModeObj renderMode;
|
||||
volatile GXRenderModeObj* srcMode = pRmode;
|
||||
volatile GXRenderModeObj* dstMode = &renderMode;
|
||||
int n = 12;
|
||||
u8* src;
|
||||
u8* dst = &renderMode.aa;
|
||||
src = &pRmode->aa;
|
||||
dstMode->viTVmode = srcMode->viTVmode;
|
||||
dstMode->fbWidth = srcMode->fbWidth;
|
||||
dstMode->efbHeight = srcMode->efbHeight;
|
||||
dstMode->xfbHeight = srcMode->xfbHeight;
|
||||
dstMode->viXOrigin = srcMode->viXOrigin;
|
||||
dstMode->viYOrigin = srcMode->viYOrigin;
|
||||
dstMode->viWidth = srcMode->viWidth;
|
||||
dstMode->viHeight = srcMode->viHeight;
|
||||
dstMode->xFBmode = srcMode->xFBmode;
|
||||
dstMode->field_rendering = srcMode->field_rendering;
|
||||
dstMode->aa = srcMode->aa;
|
||||
for (; n != 0; n--) {
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[2];
|
||||
src += 2;
|
||||
dst += 2;
|
||||
// Volatile accesses preserve MWCC's field-copy order and stores.
|
||||
volatile GXRenderModeObj* sourceFields = sourceMode;
|
||||
volatile GXRenderModeObj* copiedFields = &renderMode;
|
||||
int samplePairsRemaining = 12;
|
||||
u8* sourceSamples;
|
||||
u8* destinationSamples = &renderMode.aa;
|
||||
sourceSamples = &sourceMode->aa;
|
||||
copiedFields->viTVmode = sourceFields->viTVmode;
|
||||
copiedFields->fbWidth = sourceFields->fbWidth;
|
||||
copiedFields->efbHeight = sourceFields->efbHeight;
|
||||
copiedFields->xfbHeight = sourceFields->xfbHeight;
|
||||
copiedFields->viXOrigin = sourceFields->viXOrigin;
|
||||
copiedFields->viYOrigin = sourceFields->viYOrigin;
|
||||
copiedFields->viWidth = sourceFields->viWidth;
|
||||
copiedFields->viHeight = sourceFields->viHeight;
|
||||
copiedFields->xFBmode = sourceFields->xFBmode;
|
||||
copiedFields->field_rendering = sourceFields->field_rendering;
|
||||
copiedFields->aa = sourceFields->aa;
|
||||
for (; samplePairsRemaining != 0; samplePairsRemaining--) {
|
||||
destinationSamples[1] = sourceSamples[1];
|
||||
destinationSamples[2] = sourceSamples[2];
|
||||
sourceSamples += 2;
|
||||
destinationSamples += 2;
|
||||
}
|
||||
dstMode->vfilter[0] = srcMode->vfilter[0];
|
||||
dstMode->vfilter[1] = srcMode->vfilter[1];
|
||||
dstMode->vfilter[2] = srcMode->vfilter[2];
|
||||
dstMode->vfilter[3] = srcMode->vfilter[3];
|
||||
dstMode->vfilter[4] = srcMode->vfilter[4];
|
||||
dstMode->vfilter[5] = srcMode->vfilter[5];
|
||||
dstMode->vfilter[6] = srcMode->vfilter[6];
|
||||
copiedFields->vfilter[0] = sourceFields->vfilter[0];
|
||||
copiedFields->vfilter[1] = sourceFields->vfilter[1];
|
||||
copiedFields->vfilter[2] = sourceFields->vfilter[2];
|
||||
copiedFields->vfilter[3] = sourceFields->vfilter[3];
|
||||
copiedFields->vfilter[4] = sourceFields->vfilter[4];
|
||||
copiedFields->vfilter[5] = sourceFields->vfilter[5];
|
||||
copiedFields->vfilter[6] = sourceFields->vfilter[6];
|
||||
u32 left;
|
||||
u32 top;
|
||||
u32 width;
|
||||
u32 height;
|
||||
GXGetScissor(&left, &top, &width, &height);
|
||||
GXSetScissor(0, dstMode->efbHeight / 2 - 0xA4, dstMode->fbWidth, 0x132);
|
||||
GXSetScissor(0, copiedFields->efbHeight / 2 - 0xA4, copiedFields->fbWidth, 0x132);
|
||||
mpMainLayout->draw();
|
||||
GXSetScissor(left, top, width, height);
|
||||
}
|
||||
@@ -2705,6 +2688,7 @@ namespace ipl {
|
||||
mUiStatus[2] = 0;
|
||||
}
|
||||
|
||||
// MWCC needs IRO 1 to load animation indices before layout addresses.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void Setting::scanAP() {
|
||||
|
||||
@@ -91,10 +91,8 @@ namespace ipl {
|
||||
mNwc24ErrCountdown = 0;
|
||||
|
||||
// Text balloon for Mii face
|
||||
f32 f0 = 30.0f;
|
||||
f32 f1 = 120.0f;
|
||||
mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt",
|
||||
math::VEC3(0.0f, (f1 = 120.0f, 0.0f), (f0 = 30.0f, 0.0f)), f1, f0);
|
||||
mpNigaoeBalloon = new TextBalloon(getSceneHeap(), mpBalloonFile, "arc", "my_IplTopBalloon_a.brlyt", math::VEC3(0.0f, 0.0f, 0.0f),
|
||||
TextBalloon::getDefaultMargin16x9(), TextBalloon::getDefaultMargin4x3());
|
||||
|
||||
// Scroller
|
||||
mpScroller = new utility::YoungBScroller();
|
||||
|
||||
@@ -727,7 +727,7 @@ namespace ipl {
|
||||
channel->state = CHAN_STATE_LOADED;
|
||||
}
|
||||
|
||||
// uhh
|
||||
// MWCC needs IRO disabled to preserve repeated channel-entry address calculations.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void Manager::loadMetaHeaderAsync(int page, int index) {
|
||||
@@ -838,21 +838,21 @@ namespace ipl {
|
||||
void Manager::makeLoadOrderList(int* list) const {
|
||||
int prevPage = System::getSaveData()->getPrevPage();
|
||||
*list = prevPage;
|
||||
int var1 = prevPage + 1;
|
||||
int nextPage = prevPage + 1;
|
||||
|
||||
int i = 1;
|
||||
do {
|
||||
int var2 = var1 - prevPage;
|
||||
if (var2 >= 0) {
|
||||
if (var1 < 4) {
|
||||
list[i++] = var1;
|
||||
int pageDistance = nextPage - prevPage;
|
||||
if (pageDistance >= 0) {
|
||||
if (nextPage < MAX_CHANNEL_PAGE) {
|
||||
list[i++] = nextPage;
|
||||
}
|
||||
var1 = prevPage - var2;
|
||||
nextPage = prevPage - pageDistance;
|
||||
} else {
|
||||
if (var1 >= 0) {
|
||||
list[i++] = var1;
|
||||
if (nextPage >= 0) {
|
||||
list[i++] = nextPage;
|
||||
}
|
||||
var1 = (prevPage - var2) + 1;
|
||||
nextPage = (prevPage - pageDistance) + 1;
|
||||
}
|
||||
} while (i != MAX_CHANNEL_PAGE);
|
||||
}
|
||||
|
||||
@@ -15,16 +15,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern "C" void _savegpr_14();
|
||||
extern "C" void _restgpr_14();
|
||||
extern "C" void _savegpr_26();
|
||||
extern "C" void _restgpr_26();
|
||||
extern "C" void _savegpr_16();
|
||||
extern "C" void _restgpr_16();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _restgpr_28();
|
||||
extern "C" void _savegpr_20();
|
||||
extern "C" void _restgpr_20();
|
||||
extern "C" void _savegpr_22();
|
||||
extern "C" void _restgpr_22();
|
||||
|
||||
@@ -231,22 +221,23 @@ namespace ipl {
|
||||
}
|
||||
|
||||
int Manager::getNumValidChannel() const {
|
||||
const ChannelSlot* q;
|
||||
int dens = MAX_CHANNEL_INDEX;
|
||||
const ChannelPage* p;
|
||||
int slot;
|
||||
// MWCC needs this page view to preserve the original channel-base calculation.
|
||||
const ChannelSlot* channelSlot;
|
||||
int channelsPerPage = MAX_CHANNEL_INDEX;
|
||||
const ChannelPage* channelPage;
|
||||
int index;
|
||||
int count = 0;
|
||||
int page;
|
||||
u8 flag;
|
||||
s32 val;
|
||||
u8 primaryType;
|
||||
s32 sceneID;
|
||||
for (page = 0; page < MAX_CHANNEL_PAGE; page++) {
|
||||
p = (const ChannelPage*)((const u8*)this + page * 0xc0);
|
||||
for (slot = 0; slot < dens; slot++) {
|
||||
q = &p->slots[slot];
|
||||
flag = q->valid;
|
||||
if (flag != 0) {
|
||||
val = q->titleId;
|
||||
if (val != 0) {
|
||||
channelPage = (const ChannelPage*)((const u8*)this + page * sizeof(mData.chanInfo[page]));
|
||||
for (index = 0; index < channelsPerPage; index++) {
|
||||
channelSlot = &channelPage->slots[index];
|
||||
primaryType = channelSlot->valid;
|
||||
if (primaryType != 0) {
|
||||
sceneID = channelSlot->titleId;
|
||||
if (sceneID != 0) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -327,13 +318,15 @@ namespace ipl {
|
||||
|
||||
u8* data = (u8*)manager;
|
||||
u32* loopFileLen = &fileLen;
|
||||
// MWCC needs volatile MD5 reads to preserve the original byte-load schedule.
|
||||
volatile NETMD5Sum& md5Ref = md5;
|
||||
u32 i = 0;
|
||||
while (i < NET_MD5_DIGEST_SIZE) {
|
||||
u8 md5Byte = md5Ref[i];
|
||||
u32 offset = i;
|
||||
offset += *loopFileLen;
|
||||
u32 fileByte = *(u8*)(offset + (u32)data + NET_MD5_DIGEST_SIZE);
|
||||
u8* fileByteAddress = (u8*)(offset + (u32)data + NET_MD5_DIGEST_SIZE);
|
||||
u32 fileByte = *fileByteAddress;
|
||||
if (md5Byte != fileByte) {
|
||||
// Invalid MD5 sum, create new
|
||||
bCreateNew = TRUE;
|
||||
@@ -588,14 +581,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
#ifdef __MWERKS__
|
||||
extern "C" int isEqualChannel__Q33ipl8savedata7ManagerFUxUx();
|
||||
extern "C" int checkValidApp__Q33ipl8savedata7ManagerFUx();
|
||||
extern "C" int getAvailableInList__Q33ipl8savedata7ManagerFPCUxUl();
|
||||
extern "C" int getAvailableNumInList__Q33ipl8savedata7ManagerFPCUxUl();
|
||||
extern "C" int isDefaultChannel__Q33ipl8savedata7ManagerFUlUl();
|
||||
extern "C" void makeTmpList__Q33ipl8savedata7ManagerFPUxUlPUxUl();
|
||||
extern "C" void moveTitleTmpToPrior__Q33ipl8savedata7ManagerFPUxPCUx();
|
||||
|
||||
// MWCC needs IRO disabled to recompute title-list addresses at each use.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void Manager::makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
|
||||
@@ -696,6 +683,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
// MWCC needs IRO disabled to retain separate indexed channel address calculations.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
BOOL Manager::doUpdateChanInfos(ESTitleId* titleIds) {
|
||||
@@ -704,9 +692,9 @@ namespace ipl {
|
||||
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
|
||||
if (mData.chanInfo[page][index].primaryType != channel::PRIMARY_TYPE_DISK) {
|
||||
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
|
||||
int n = index + page * MAX_CHANNEL_INDEX;
|
||||
if (titleId != titleIds[n]) {
|
||||
if (titleIds[n] == TITLE_NULL) {
|
||||
int titleIndex = index + page * MAX_CHANNEL_INDEX;
|
||||
if (titleId != titleIds[titleIndex]) {
|
||||
if (titleIds[titleIndex] == TITLE_NULL) {
|
||||
memset(&mData.chanInfo[page][index], 0, sizeof(channel::SInfo));
|
||||
} else {
|
||||
mData.chanInfo[page][index].primaryType = channel::PRIMARY_TYPE_CHANNEL;
|
||||
@@ -714,8 +702,8 @@ namespace ipl {
|
||||
mData.chanInfo[page][index].reserved[0] = 0;
|
||||
mData.chanInfo[page][index].reserved[1] = 0;
|
||||
mData.chanInfo[page][index].sceneID = SCENE_NORMAL_CHANNEL;
|
||||
mData.chanInfo[page][index].titleType = ES_TITLE_TYPE(titleIds[n]);
|
||||
mData.chanInfo[page][index].titleCode = ES_TITLE_CODE(titleIds[n]);
|
||||
mData.chanInfo[page][index].titleType = ES_TITLE_TYPE(titleIds[titleIndex]);
|
||||
mData.chanInfo[page][index].titleCode = ES_TITLE_CODE(titleIds[titleIndex]);
|
||||
}
|
||||
changed = TRUE;
|
||||
}
|
||||
@@ -771,16 +759,17 @@ namespace ipl {
|
||||
}
|
||||
|
||||
int Manager::getAvailableInList(const ESTitleId* titleIds, u32 titleCount) {
|
||||
int dens = MAX_CHANNEL_INDEX;
|
||||
u32 i;
|
||||
for (i = 0; i < titleCount; i++) {
|
||||
if (titleIds[i] == 0) {
|
||||
int page = (int)i / dens;
|
||||
int slot = (int)i % dens;
|
||||
u8* p = (u8*)this + page * 0xc0;
|
||||
p += slot * 16;
|
||||
if (*(p + 0x30) != 1) {
|
||||
return (int)i;
|
||||
int channelsPerPage = MAX_CHANNEL_INDEX;
|
||||
u32 titleIndex;
|
||||
for (titleIndex = 0; titleIndex < titleCount; titleIndex++) {
|
||||
if (titleIds[titleIndex] == TITLE_NULL) {
|
||||
int page = (int)titleIndex / channelsPerPage;
|
||||
int index = (int)titleIndex % channelsPerPage;
|
||||
// MWCC needs this address order to preserve the original channel-slot loads.
|
||||
u8* channelPage = (u8*)this + page * sizeof(mData.chanInfo[page]);
|
||||
channelPage += index * sizeof(channel::SInfo);
|
||||
if (*(channelPage + 0x30) != channel::PRIMARY_TYPE_DISK) {
|
||||
return (int)titleIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,11 +527,9 @@ namespace ipl {
|
||||
|
||||
// Default values for initial setup
|
||||
if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) {
|
||||
struct BlankNameStorage {
|
||||
SCOwnerNickname blankName;
|
||||
} blankNameStorage;
|
||||
memset(&blankNameStorage.blankName, 0, sizeof(blankNameStorage.blankName));
|
||||
SCSetOwnerNickName(&blankNameStorage.blankName);
|
||||
SCOwnerNickname blankName;
|
||||
memset(&blankName, 0, sizeof(blankName));
|
||||
SCSetOwnerNickName(&blankName);
|
||||
|
||||
SCSetAspectRatio(SC_ASPECT_RATIO_4x3);
|
||||
|
||||
|
||||
@@ -892,68 +892,62 @@ s32 CArGBAOdh::cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* sourceData, int for
|
||||
void CArGBAOdh::LineConv11(u8* source, u8* lumaOutput, u8* cbOutput, u8* crOutput, u16 width, u16 height,
|
||||
const long* conversionTable, int format) {
|
||||
u32 planeSize = (u32)width * (u32)height;
|
||||
const s32* table = conversionTable;
|
||||
u32 pixelIndex = 0;
|
||||
|
||||
for (int i = 0; i < width; i++) {
|
||||
s32 red;
|
||||
s32 green;
|
||||
s32 blue;
|
||||
s32 red;
|
||||
s32 green;
|
||||
s32 blue;
|
||||
s32 cbValue;
|
||||
s32 crValue;
|
||||
|
||||
if (format == ODH_FORMAT_RGB565) {
|
||||
u8* pixelSource = source + (pixelIndex & 0x1FFFFFFC) * 8 + (pixelIndex & 3) * 2;
|
||||
u16 pixel = pixelSource[1];
|
||||
pixel |= (u16)pixelSource[0] << 8;
|
||||
red = (pixel >> 11) & 0x1F;
|
||||
green = (pixel >> 6) & 0x1F;
|
||||
blue = pixel & 0x1F;
|
||||
} else if (format == ODH_FORMAT_RGBA8) {
|
||||
int blueOrPixelOffset = (pixelIndex & 0xFFFFFFFC) * 0x10 + (pixelIndex & 3) * 2;
|
||||
u8* pixel = source + blueOrPixelOffset;
|
||||
red = pixel[1] >> 3;
|
||||
green = pixel[0x20] >> 3;
|
||||
blue = pixel[0x21] >> 3;
|
||||
} else {
|
||||
int sourceOffset = (pixelIndex & 7) + (pixelIndex & 0x3FFFFFF8) * 4;
|
||||
float y = (float)source[sourceOffset] - colorConvert16;
|
||||
float cb = (float)source[planeSize + sourceOffset] - colorConvert128;
|
||||
float cr = (float)source[planeSize * 2 + sourceOffset] - colorConvert128;
|
||||
red = (int)(colorConvertY * y + colorConvertR * cr);
|
||||
green = (int)(colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr);
|
||||
blue = (int)(colorConvertY * y + colorConvertB * cb);
|
||||
|
||||
if (red < 0) {
|
||||
red = 0;
|
||||
}
|
||||
if (0xFF < red) {
|
||||
red = 0xFF;
|
||||
}
|
||||
if (green < 0) {
|
||||
green = 0;
|
||||
}
|
||||
if (0xFF < green) {
|
||||
green = 0xFF;
|
||||
}
|
||||
if (blue < 0) {
|
||||
blue = 0;
|
||||
}
|
||||
if (0xFF < blue) {
|
||||
blue = 0xFF;
|
||||
}
|
||||
|
||||
red >>= 3;
|
||||
green >>= 3;
|
||||
blue >>= 3;
|
||||
if (format == ODH_FORMAT_RGB565) {
|
||||
int offset = (i & ~3) * 8 + (i & 3) * 2;
|
||||
u16 pixel = source[offset];
|
||||
pixel <<= 8;
|
||||
pixel |= source[offset + 1];
|
||||
red = (pixel >> 11) & 0x1F;
|
||||
green = (pixel >> 6) & 0x1F;
|
||||
blue = pixel & 0x1F;
|
||||
} else if (format == ODH_FORMAT_RGBA8) {
|
||||
int offset = (i & ~3) * 16 + (i & 3) * 2;
|
||||
red = source[offset + 1] >> 3;
|
||||
green = source[offset + 0x20] >> 3;
|
||||
blue = source[offset + 0x21] >> 3;
|
||||
} else {
|
||||
int offset = (i & 7) + (i & ~7) * 4;
|
||||
float y = source[offset] - colorConvert16;
|
||||
float cb = source[planeSize + offset] - colorConvert128;
|
||||
float cr = source[planeSize * 2 + offset] - colorConvert128;
|
||||
red = colorConvertY * y + colorConvertR * cr;
|
||||
green = colorConvertY * y - colorConvertG1 * cb - colorConvertG2 * cr;
|
||||
blue = colorConvertY * y + colorConvertB * cb;
|
||||
if (red < 0) {
|
||||
red = 0;
|
||||
}
|
||||
if (red > 0xFF) {
|
||||
red = 0xFF;
|
||||
}
|
||||
if (green < 0) {
|
||||
green = 0;
|
||||
}
|
||||
if (green > 0xFF) {
|
||||
green = 0xFF;
|
||||
}
|
||||
if (blue < 0) {
|
||||
blue = 0;
|
||||
}
|
||||
if (blue > 0xFF) {
|
||||
blue = 0xFF;
|
||||
}
|
||||
red >>= 3;
|
||||
green >>= 3;
|
||||
blue >>= 3;
|
||||
}
|
||||
|
||||
int cbValue = (table[red + 0x60] + table[green + 0x80] + table[blue + 0xA0]) >> 16;
|
||||
int crValue = (table[red + 0xC0] + table[green + 0xE0] + table[blue + 0x100]) >> 16;
|
||||
int luma = (table[red + 0] + table[green + 0x20] + table[blue + 0x40]) >> 16;
|
||||
|
||||
*lumaOutput++ = (u8)luma;
|
||||
*cbOutput++ = (u8)cbValue;
|
||||
*crOutput++ = (u8)crValue;
|
||||
pixelIndex++;
|
||||
cbValue = (conversionTable[red + 0x60] + conversionTable[green + 0x80] + conversionTable[blue + 0xA0]) >> 16;
|
||||
crValue = (conversionTable[red + 0xC0] + conversionTable[green + 0xE0] + conversionTable[blue + 0x100]) >> 16;
|
||||
*lumaOutput++ = (conversionTable[red] + conversionTable[green + 0x20] + conversionTable[blue + 0x40]) >> 16;
|
||||
*cbOutput++ = cbValue;
|
||||
*crOutput++ = crValue;
|
||||
}
|
||||
}
|
||||
void CArGBAOdh::fdct_fast(u32* coefficients, u8* samples, u32 stride, u32* quantizationTable) {
|
||||
@@ -2007,208 +2001,206 @@ void CArGBAOdh::LineDeconv22(u8* dest, u8* y, u8* cb, u8* cr, u16 width, u16 hei
|
||||
}
|
||||
|
||||
s32 CArGBAOdh::huffmanDecoder(u32* coefficientOutput, SArCDJ_HuffmanRequest* request, u16** huffmanTables, int component, u32 sourceLimit) {
|
||||
u32 bitBuffer;
|
||||
u32 tableCount;
|
||||
s32 decodeResult;
|
||||
int bitIndex;
|
||||
s32 maximumBitLength;
|
||||
int maxHuffmanBits;
|
||||
u16 tableEntry;
|
||||
s32 valueCategory;
|
||||
u32 tableIndex;
|
||||
u32 magnitudeMask;
|
||||
int bytesConsumed;
|
||||
u8* sourceCursor;
|
||||
u32 decodedSymbol;
|
||||
u32 bitCountAndMask;
|
||||
u32 bitOffset;
|
||||
int coefficient;
|
||||
s32 category;
|
||||
int bytesConsumed;
|
||||
u32 bitBuffer;
|
||||
int length;
|
||||
u32 tableIndex;
|
||||
int maxLength;
|
||||
u32 value;
|
||||
u32 mask;
|
||||
u32 leafIndex;
|
||||
u32 run;
|
||||
u32 i;
|
||||
|
||||
bytesConsumed = request->bytesConsumed;
|
||||
sourceCursor = request->bitstream;
|
||||
u32 bitOffset = *request->bitCount;
|
||||
bitOffset = *request->bitCount;
|
||||
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
} else {
|
||||
maximumBitLength = 0xB;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitOffset;
|
||||
if (component == 0) {
|
||||
maximumBitLength = 9;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
maxHuffmanBits = (int)maximumBitLength;
|
||||
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
|
||||
tableEntry = huffmanTables[0][tableIndex];
|
||||
decodedSymbol = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + decodedSymbol];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + decodedSymbol;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
u32 leafIndex = tableIndex + decodedSymbol + 1;
|
||||
valueCategory = huffmanTables[0][leafIndex];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + decodedSymbol + 1;
|
||||
}
|
||||
}
|
||||
if (bitIndex > maxHuffmanBits) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= maxLength; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[0][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[0][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (valueCategory > 0) {
|
||||
bitCountAndMask = (1 << (valueCategory)) - 1;
|
||||
bitBuffer = bitCountAndMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
|
||||
bitBuffer = bitBuffer + 1 | ~bitCountAndMask;
|
||||
}
|
||||
} else {
|
||||
bitBuffer = 0;
|
||||
if (node & 0x4000) {
|
||||
leafIndex = tableIndex + branch + 1;
|
||||
category = huffmanTables[0][leafIndex];
|
||||
break;
|
||||
}
|
||||
u32** predictors = request->predictors;
|
||||
u32* predictor = predictors[component >> 1];
|
||||
bitCountAndMask = bitOffset + bitIndex + valueCategory;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
decodedSymbol = 1;
|
||||
bitIndex = (int)bitBuffer + *predictor;
|
||||
*coefficientOutput = bitIndex;
|
||||
*predictors[component >> 1] = bitIndex;
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
do {
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitCountAndMask;
|
||||
maximumBitLength = 6;
|
||||
for (; maximumBitLength != 0; maximumBitLength--) {
|
||||
tableEntry = huffmanTables[1][tableIndex];
|
||||
tableCount = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[1][tableIndex + tableCount];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
valueCategory = huffmanTables[1][tableIndex + tableCount + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount + 1;
|
||||
}
|
||||
bitIndex++;
|
||||
}
|
||||
if (bitIndex > 6) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
if (valueCategory == 7) {
|
||||
bitCountAndMask += bitIndex;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (valueCategory > 0) {
|
||||
tableIndex = (u32)(1 << (valueCategory)) - 1 &
|
||||
(bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((tableIndex & (u32)(1 << (valueCategory - 1))) == 0) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
} else {
|
||||
tableIndex = 0;
|
||||
}
|
||||
for (u32 zeroIndex = 0; zeroIndex < tableIndex; zeroIndex++) {
|
||||
coefficientOutput[decodedSymbol] = 0;
|
||||
decodedSymbol++;
|
||||
}
|
||||
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
maximumBitLength = 0xB;
|
||||
bitBuffer = ((u32)*sourceCursor << 0x18) | ((u32)sourceCursor[1] << 0x10) | ((u32)sourceCursor[2] << 8) | sourceCursor[3];
|
||||
bitBuffer <<= bitCountAndMask;
|
||||
if (component == 0) {
|
||||
maximumBitLength = 9;
|
||||
}
|
||||
bitIndex = 1;
|
||||
tableIndex = 0;
|
||||
maxHuffmanBits = (int)maximumBitLength;
|
||||
for (; bitIndex <= maxHuffmanBits; bitIndex++) {
|
||||
tableEntry = huffmanTables[0][tableIndex];
|
||||
tableCount = (u32)tableEntry & 0x3FFF;
|
||||
if (((bitBuffer >> (0x20U - bitIndex)) & 1) == 0) {
|
||||
if ((tableEntry & 0x8000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + tableCount];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount;
|
||||
} else {
|
||||
if ((tableEntry & 0x4000) != 0) {
|
||||
valueCategory = huffmanTables[0][tableIndex + tableCount + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex = tableIndex + tableCount + 1;
|
||||
}
|
||||
}
|
||||
if (bitIndex > maxHuffmanBits) {
|
||||
decodeResult = ODH_ERROR_INVALID_BITSTREAM;
|
||||
goto finishDecode;
|
||||
}
|
||||
if (valueCategory > 0) {
|
||||
magnitudeMask = (1 << (valueCategory)) - 1;
|
||||
bitBuffer = magnitudeMask & (bitBuffer >> ((0x20 - bitIndex) - valueCategory));
|
||||
if ((bitBuffer & (1 << (valueCategory - 1))) == 0) {
|
||||
bitBuffer = bitBuffer + 1 | ~magnitudeMask;
|
||||
}
|
||||
} else {
|
||||
bitBuffer = 0;
|
||||
}
|
||||
bitCountAndMask = bitCountAndMask + bitIndex + valueCategory;
|
||||
coefficientOutput[decodedSymbol] = bitBuffer;
|
||||
tableIndex = (bitCountAndMask >> 3);
|
||||
decodedSymbol = decodedSymbol + 1;
|
||||
while (bitCountAndMask >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitCountAndMask -= 8;
|
||||
}
|
||||
} while ((int)decodedSymbol < 0x40);
|
||||
for (; (int)decodedSymbol < 0x40; decodedSymbol++) {
|
||||
coefficientOutput[decodedSymbol] = 0;
|
||||
}
|
||||
request->bytesConsumed = bytesConsumed;
|
||||
decodeResult = 0;
|
||||
request->bitstream = sourceCursor;
|
||||
*request->bitCount = bitCountAndMask;
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
finishDecode:
|
||||
return decodeResult;
|
||||
}
|
||||
|
||||
if (length > maxLength) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
mask = (1 << category) - 1;
|
||||
value = mask & (bitBuffer >> (32 - length - category));
|
||||
if ((value & (1 << (category - 1))) == 0) {
|
||||
value = (value + 1) | ~mask;
|
||||
}
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
bitOffset += length + category;
|
||||
coefficient = 1;
|
||||
coefficientOutput[0] = value + *request->predictors[component >> 1];
|
||||
*request->predictors[component >> 1] = coefficientOutput[0];
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
|
||||
do {
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= 6; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[1][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[1][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (node & 0x4000) {
|
||||
category = huffmanTables[1][tableIndex + branch + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (length > 6) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category == 7) {
|
||||
bitOffset += length;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
run = ((1 << category) - 1) & (bitBuffer >> (32 - length - category));
|
||||
if ((run & (1 << (category - 1))) == 0) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
} else {
|
||||
run = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < run; i++) {
|
||||
coefficientOutput[coefficient] = 0;
|
||||
coefficient++;
|
||||
}
|
||||
|
||||
bitOffset += length + category;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
|
||||
if ((u32)(bytesConsumed + 4) > sourceLimit) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
bitBuffer = ((u32)sourceCursor[0] << 24 | (u32)sourceCursor[1] << 16 | (u32)sourceCursor[2] << 8 | sourceCursor[3]) << bitOffset;
|
||||
maxLength = component == 0 ? 9 : 11;
|
||||
|
||||
length = 1;
|
||||
tableIndex = 0;
|
||||
for (; length <= maxLength; length++) {
|
||||
u32 branch;
|
||||
u16 node;
|
||||
|
||||
node = huffmanTables[0][tableIndex];
|
||||
branch = node & 0x3FFF;
|
||||
if (((bitBuffer >> (32 - length)) & 1) == 0) {
|
||||
if (node & 0x8000) {
|
||||
category = huffmanTables[0][tableIndex + branch];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch;
|
||||
} else {
|
||||
if (node & 0x4000) {
|
||||
category = huffmanTables[0][tableIndex + branch + 1];
|
||||
break;
|
||||
}
|
||||
tableIndex += branch + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (length > maxLength) {
|
||||
return ODH_ERROR_INVALID_BITSTREAM;
|
||||
}
|
||||
|
||||
if (category > 0) {
|
||||
mask = (1 << category) - 1;
|
||||
value = mask & (bitBuffer >> (32 - length - category));
|
||||
if ((value & (1 << (category - 1))) == 0) {
|
||||
value = (value + 1) | ~mask;
|
||||
}
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
coefficientOutput[coefficient++] = value;
|
||||
bitOffset += length + category;
|
||||
while (bitOffset >= 8) {
|
||||
sourceCursor++;
|
||||
bytesConsumed++;
|
||||
bitOffset -= 8;
|
||||
}
|
||||
} while (coefficient < 64);
|
||||
|
||||
for (; coefficient < 64; coefficient++) {
|
||||
coefficientOutput[coefficient] = 0;
|
||||
}
|
||||
|
||||
request->bytesConsumed = bytesConsumed;
|
||||
request->bitstream = sourceCursor;
|
||||
*request->bitCount = bitOffset;
|
||||
return 0;
|
||||
}
|
||||
void CArGBAOdh::idct_fast(const u8* rangeLimitTable, u32* coefficients, u32* quantizationTable, u8* destination, u32 stride) {
|
||||
int evenPart0, evenPart1, evenPart2, evenPart3, oddPart3, oddPart2, oddPart1, oddPart0;
|
||||
int butterflyTerm0, butterflyTerm1, butterflyTerm2, evenInnerSum;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// MWCC needs this local interpolation layout for the original Scroller methods.
|
||||
#define IPL_MATH_INTERPORATION_H
|
||||
|
||||
#include <nw4r/math.h>
|
||||
@@ -244,7 +245,7 @@ namespace ipl {
|
||||
return result;
|
||||
}
|
||||
|
||||
// uhh
|
||||
// MWCC needs IRO disabled to keep the direction test as branches.
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void BScroller::set_arw_param() {
|
||||
@@ -267,7 +268,7 @@ namespace ipl {
|
||||
#pragma pop
|
||||
|
||||
bool BScroller::isActive() const {
|
||||
return (u32)(mState + 1) > 0;
|
||||
return mState != -1;
|
||||
}
|
||||
|
||||
bool BScroller::isUp() const {
|
||||
@@ -286,6 +287,7 @@ namespace ipl {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// MWCC needs inlining disabled for this constructor's original call sequence.
|
||||
#pragma dont_inline on
|
||||
Scroller::Scroller() {
|
||||
mState = 0;
|
||||
@@ -476,18 +478,16 @@ namespace ipl {
|
||||
u32 result = 0;
|
||||
int len = 0;
|
||||
|
||||
const wchar_t* p = src;
|
||||
while (*p != 0) {
|
||||
const wchar_t* digit = src;
|
||||
while (*digit != 0) {
|
||||
len++;
|
||||
p++;
|
||||
digit++;
|
||||
}
|
||||
|
||||
int off = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
double exp = pow(10.0, len - i - 1);
|
||||
wchar_t in = src[i];
|
||||
result += (in - L'0') * exp;
|
||||
off += 2;
|
||||
}
|
||||
*dest = result;
|
||||
}
|
||||
@@ -500,10 +500,10 @@ namespace ipl {
|
||||
char* bytes = (char*)dest;
|
||||
for (int i = 0; i < count; i++) {
|
||||
int off = i * 2;
|
||||
char t0 = bytes[off];
|
||||
char t1 = bytes[off + 1];
|
||||
bytes[off] = t1;
|
||||
bytes[off + 1] = t0;
|
||||
char firstByte = bytes[off];
|
||||
char secondByte = bytes[off + 1];
|
||||
bytes[off] = secondByte;
|
||||
bytes[off + 1] = firstByte;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,6 +526,7 @@ namespace ipl {
|
||||
while (info != NULL) {
|
||||
if (info == textBoxType) {
|
||||
found = true;
|
||||
// MWCC needs this exit shape to preserve the type-check instruction order.
|
||||
goto check;
|
||||
}
|
||||
info = info->mParentTypeInfo;
|
||||
@@ -557,10 +558,12 @@ namespace ipl {
|
||||
|
||||
math::VEC2 result;
|
||||
math::VEC2 pos;
|
||||
math::VEC2* posPtr = &pos;
|
||||
posPtr = __ct__Q33ipl4math4VEC2Fff(posPtr, basePos.x * (rect4x3.GetWidth() / rect16x9.GetWidth()), -basePos.y);
|
||||
((u32*)&result)[1] = ((u32*)posPtr)[1];
|
||||
((u32*)&result)[0] = ((u32*)posPtr)[0];
|
||||
math::VEC2* posPtr = __ct__Q33ipl4math4VEC2Fff(&pos, basePos.x * (rect4x3.GetWidth() / rect16x9.GetWidth()), -basePos.y);
|
||||
// MWCC needs the original integer-copy order when returning this vector.
|
||||
u32* resultWords = (u32*)&result;
|
||||
const u32* positionWords = (const u32*)posPtr;
|
||||
resultWords[1] = positionWords[1];
|
||||
resultWords[0] = positionWords[0];
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -575,7 +578,7 @@ namespace ipl {
|
||||
if (pal == NULL) {
|
||||
return;
|
||||
}
|
||||
if (pal->versionNumber != 0x0020AF30) {
|
||||
if (pal->versionNumber != TPL_MAGIC) {
|
||||
return;
|
||||
}
|
||||
if ((u32)pal->descriptorArray < 0x80000000) {
|
||||
@@ -652,9 +655,9 @@ namespace ipl {
|
||||
mpTexHeader->format != GX_TF_IA4 && mpTexHeader->format != GX_TF_IA8 && mpTexHeader->format != GX_TF_RGB565 &&
|
||||
mpTexHeader->format != GX_TF_RGB5A3 && mpTexHeader->format != GX_TF_CMPR && mpTexHeader->format != GX_TF_RGBA8) {
|
||||
r = FALSE;
|
||||
} else if (mpClutHeader != NULL && mpTexHeader->format != 8 && mpTexHeader->format != 9) {
|
||||
} else if (mpClutHeader != NULL && mpTexHeader->format != GX_TF_C4 && mpTexHeader->format != GX_TF_C8) {
|
||||
r = FALSE;
|
||||
} else if (mpClutHeader != NULL && mpClutHeader->format != 0 && mpClutHeader->format != 1 && mpClutHeader->format != 2) {
|
||||
} else if (mpClutHeader != NULL && mpClutHeader->format != GX_TL_IA8 && mpClutHeader->format != GX_TL_RGB565 && mpClutHeader->format != GX_TL_RGB5A3) {
|
||||
r = FALSE;
|
||||
} else if (mpClutHeader != NULL && mpClutHeader->numEntries > 0x4000) {
|
||||
r = FALSE;
|
||||
@@ -691,7 +694,7 @@ namespace ipl {
|
||||
r = FALSE;
|
||||
} else if (mpTexHeader->width > 0x200) {
|
||||
r = FALSE;
|
||||
} else if (mpClutHeader == NULL && mpTexHeader->format == 6) {
|
||||
} else if (mpClutHeader == NULL && mpTexHeader->format == GX_TF_RGBA8) {
|
||||
r = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -731,6 +734,7 @@ namespace ipl {
|
||||
} // namespace utility
|
||||
|
||||
#ifndef NON_MATCHING
|
||||
// MWCC needs this weak factory to preserve the original object text layout.
|
||||
__declspec(weak) math::VEC2 ForceCTORWeak() {
|
||||
return math::VEC2(NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,15 @@ EXPECTED_TOTAL_DATA = 1832684
|
||||
EXPECTED_TOTAL_FUNCTIONS = 12563
|
||||
INTEGER_PATTERN = re.compile(r"-?(0|[1-9][0-9]*)\Z")
|
||||
CODE_SECTIONS = frozenset({".text", ".init"})
|
||||
DATA_SECTIONS = frozenset({
|
||||
".bss", "extab", "extabindex", ".ctors", ".ctors$10", ".dtors",
|
||||
".rodata", ".data", ".sdata2", ".sbss2", ".sdata", ".sbss",
|
||||
})
|
||||
# objdiff accumulates the aggregate fuzzy_match_percent in 32-bit floats over every code byte,
|
||||
# so a fully matched report can read 99.9998 instead of 100.0. Aggregates are accepted within
|
||||
# this tolerance only when every code byte is counted as matched; units, sections and functions
|
||||
# are always checked exactly.
|
||||
AGGREGATE_FUZZY_TOLERANCE = 0.001
|
||||
AGGREGATE_FIELDS = (
|
||||
"total_units",
|
||||
"total_code",
|
||||
@@ -85,7 +94,25 @@ def percent(measures, field, label, failures):
|
||||
failures.append(f"{label}: {value}")
|
||||
|
||||
|
||||
def check_complete_measures(measures, label, failures):
|
||||
def aggregate_fuzzy(measures, label, failures):
|
||||
value = required(measures, "fuzzy_match_percent", f"{label} fuzzy_match_percent", failures)
|
||||
if value is None or exact(value):
|
||||
return
|
||||
try:
|
||||
fully_matched = integer(measures.get("matched_code")) == integer(measures.get("total_code"))
|
||||
except ValueError:
|
||||
fully_matched = False
|
||||
if (
|
||||
not fully_matched
|
||||
or not isinstance(value, (int, float))
|
||||
or isinstance(value, bool)
|
||||
or not math.isfinite(float(value))
|
||||
or not 100.0 - AGGREGATE_FUZZY_TOLERANCE <= float(value) <= 100.0
|
||||
):
|
||||
failures.append(f"{label} fuzzy_match_percent: {value}")
|
||||
|
||||
|
||||
def check_complete_measures(measures, label, failures, aggregate=False):
|
||||
for matched, total, name in (
|
||||
("matched_code", "total_code", "code match"),
|
||||
("complete_code", "total_code", "code link"),
|
||||
@@ -101,9 +128,49 @@ def check_complete_measures(measures, label, failures):
|
||||
"matched_data_percent",
|
||||
"complete_data_percent",
|
||||
"matched_functions_percent",
|
||||
"fuzzy_match_percent",
|
||||
):
|
||||
percent(measures, field, f"{label} {field}", failures)
|
||||
if aggregate:
|
||||
aggregate_fuzzy(measures, label, failures)
|
||||
else:
|
||||
percent(measures, "fuzzy_match_percent", f"{label} fuzzy_match_percent", failures)
|
||||
|
||||
|
||||
def check_sections(sections, measures, name, failures):
|
||||
if not isinstance(sections, list):
|
||||
failures.append(f"{name}: missing sections")
|
||||
return
|
||||
sizes = {"code": 0, "data": 0}
|
||||
names = set()
|
||||
for section in sections:
|
||||
if not isinstance(section, dict):
|
||||
failures.append(f"{name}: invalid section entry")
|
||||
continue
|
||||
section_name = section.get("name")
|
||||
label = f"{name} section {section_name}"
|
||||
if not isinstance(section_name, str) or section_name not in CODE_SECTIONS | DATA_SECTIONS:
|
||||
failures.append(f"{label}: unknown section name")
|
||||
continue
|
||||
if section_name in names:
|
||||
failures.append(f"{label}: duplicate section")
|
||||
names.add(section_name)
|
||||
# Protobuf JSON omits a zero-valued size. objdiff counts data sections in
|
||||
# full, but code measures exclude ignored/deduplicated function symbols.
|
||||
size = count({"size": section.get("size", 0)}, "size", label, failures)
|
||||
if size is not None:
|
||||
sizes["code" if section_name in CODE_SECTIONS else "data"] += size
|
||||
if "fuzzy_match_percent" in section:
|
||||
percent(section, "fuzzy_match_percent", label, failures)
|
||||
elif section_name in CODE_SECTIONS:
|
||||
failures.append(f"{label}: missing fuzzy_match_percent")
|
||||
for kind in ("code", "data"):
|
||||
total = count({f"total_{kind}": measures.get(f"total_{kind}", 0)},
|
||||
f"total_{kind}", name, failures)
|
||||
if total is not None and (
|
||||
sizes[kind] < total if kind == "code" else sizes[kind] != total
|
||||
):
|
||||
relation = "<" if kind == "code" else "!="
|
||||
failures.append(f"{name} section {kind} coverage: {sizes[kind]} {relation} {total}")
|
||||
|
||||
|
||||
def key_for(value):
|
||||
@@ -131,7 +198,7 @@ def check_report(report):
|
||||
value = count(measures, field, "overall", failures)
|
||||
if value is not None and value != expected:
|
||||
failures.append(f"overall {field}: {value} != {expected}")
|
||||
check_complete_measures(measures, "overall", failures)
|
||||
check_complete_measures(measures, "overall", failures, aggregate=True)
|
||||
|
||||
units = report.get("units")
|
||||
if not isinstance(units, list) or len(units) != EXPECTED_TOTAL_UNITS:
|
||||
@@ -189,19 +256,7 @@ def check_report(report):
|
||||
equal(unit_measures, "matched_functions", "total_functions", f"{name} function match", failures)
|
||||
percent(unit_measures, "matched_functions_percent", f"{name} function percent", failures)
|
||||
|
||||
sections = unit.get("sections")
|
||||
if not isinstance(sections, list):
|
||||
failures.append(f"{name}: missing sections")
|
||||
else:
|
||||
for section in sections:
|
||||
if not isinstance(section, dict):
|
||||
failures.append(f"{name}: invalid section entry")
|
||||
continue
|
||||
section_name = section.get("name", "<unnamed>")
|
||||
if "fuzzy_match_percent" in section:
|
||||
percent(section, "fuzzy_match_percent", f"{name} section {section_name}", failures)
|
||||
elif isinstance(section_name, str) and section_name in CODE_SECTIONS:
|
||||
failures.append(f"{name} section {section_name}: missing fuzzy_match_percent")
|
||||
check_sections(unit.get("sections"), unit_measures, name, failures)
|
||||
|
||||
functions = unit.get("functions", [])
|
||||
if total_functions is not None and total_functions > 0:
|
||||
@@ -244,7 +299,7 @@ def check_report(report):
|
||||
if not isinstance(category_measures, dict):
|
||||
failures.append(f"{name}: missing measures")
|
||||
continue
|
||||
check_complete_measures(category_measures, name, failures)
|
||||
check_complete_measures(category_measures, name, failures, aggregate=True)
|
||||
for field in AGGREGATE_FIELDS:
|
||||
if field in category_measures:
|
||||
value = count(category_measures, field, name, failures)
|
||||
|
||||
58
tools/decomp-assist/CHANSVm-converter-const-20261009.md
Normal file
58
tools/decomp-assist/CHANSVm-converter-const-20261009.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# CHANSVm converter input types
|
||||
|
||||
Base: `20cf9f9f25b13b8cd6910e07cc5eb71558845d4e`, target 43U only.
|
||||
|
||||
## Change and source review
|
||||
|
||||
`CHANSVmConvertToFloatFromStr` took a pointer-to-const source header while
|
||||
`VmConvertFunc` specified a mutable source header. The conversion table cast
|
||||
hid that incompatible function-pointer type at the indirect call.
|
||||
|
||||
Give all 11 converters and the callback typedef the same pointer-to-const
|
||||
source-header type, and remove the callback cast. All converters either read
|
||||
source values, ignore the source, or pass it through the read-only array-join
|
||||
path. They write only newly allocated result objects. Propagate the input type
|
||||
through `VmArrayJoinCommon`, `VmArrayJoinEstimateStrSize`, `VmArrayJoinSub`, and
|
||||
`VmArraySeekTop`, including the forward declaration. These helpers only read
|
||||
the source header; the join routines write the destination string and local
|
||||
state. `VmArraySeekTop` still returns a mutable chunk pointer because header
|
||||
constness is shallow and other callers can mutate array elements. No cast is
|
||||
needed at the array-join boundary.
|
||||
|
||||
The public `CHANSVmConvertObjectType` input remains mutable: its same-type fast
|
||||
path returns the original mutable object. Passing it to a const-source
|
||||
converter is valid. No executable expressions, flags, data or layout changed.
|
||||
|
||||
## Fresh leaf verification
|
||||
|
||||
Configured using the restored `wii-source-tools/build-43U.sh` tool paths and
|
||||
flags, with commands run in the isolated leaf instead of that script's fixed
|
||||
main directory. Baseline object was freshly compiled before editing.
|
||||
|
||||
- Entire CHANSVm object is byte-identical to that baseline, SHA256
|
||||
`11fa48261cd93668d133d5ef73efbf3c9109181730b21409153b78316189e063`.
|
||||
All 233 sibling function spans, allocated sections and relocations unchanged.
|
||||
- All 15 emitted converter/dispatch/join functions: exact-name objdiff 100.0,
|
||||
raw target function bytes and normalized relocation targets identical
|
||||
(86 code relocations). VmArraySeekTop is inlined.
|
||||
- All target data sections match including alignment padding: `.rodata` 1432,
|
||||
`.data` 4672, `.sdata2` 184, `.sdata` 600, `.sbss` 16 bytes;
|
||||
all 614 data relocations match by resolved section/function target.
|
||||
- Pool: 125/125 strings identical. Dispatch ctxdiff: 47/47 instructions, 0 diffs.
|
||||
FloatFromStr: 83/83 instructions, one textual symbol-alias difference
|
||||
(`VmNaN` versus `lbl_81694F08`); raw bytes and resolved relocation target are
|
||||
identical. This is not represented as a literal ctxdiff-zero result.
|
||||
- Fresh full 43U build, report and `build/43U/ok` pass. DOL SHA1:
|
||||
`26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
- All 1028 unit measures/functions/sections and overall report measures are
|
||||
unchanged against the saved base report. All 22 workflow guards pass with
|
||||
no skips. `git diff --check` passes.
|
||||
|
||||
This is a binary-neutral type correction, not a new matching/linking gain.
|
||||
CHANSVm remains 229/233 exact, 45284/53564 exact code bytes, 6904/6904 matching
|
||||
data bytes, and unlinked. The completion assertion still fails on the existing
|
||||
project-wide incomplete code/link totals; no full-completion claim is made.
|
||||
|
||||
Local evidence: `../vm-converter-const-evidence/` contains baseline/candidate
|
||||
build logs, original baseline object/report, verification script/results,
|
||||
full-build/report/ok logs, pool and ctxdiff results, guards and completion logs.
|
||||
118
tools/decomp-assist/cleanup-c1.attempts.md
Normal file
118
tools/decomp-assist/cleanup-c1.attempts.md
Normal file
@@ -0,0 +1,118 @@
|
||||
# cleanup-c1 source cleanup
|
||||
|
||||
Baseline: f1db6b656e386063a8bc263fb75a299f36ae4803, equal to origin/main.
|
||||
Assigned units: CHANSVm, AOSS, iplCardSequence. Existing rx67c.attempts.md is unrelated and left untouched.
|
||||
Initial full ninja build passed. All 1028 units and 12563 functions matched and linked at 100%.
|
||||
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d. Completion checker: DECOMPLETE_OK.
|
||||
|
||||
Acceptance: preserve every allocated object section, relocation, unit match/link measure, and the DOL hash.
|
||||
Restore any trial that changes bytes. Finish with the three-unit gate and a fresh completion check.
|
||||
|
||||
## Trials
|
||||
- src/channelScript/CHANSVm: remove function-scoped #pragma opt_lifetimes off. RESTORED; .rela.text; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/scene/setting/AOSS: remove function-scoped #pragma optimization_level 3. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: remove function-scoped #pragma opt_propagation off. RESTORED; .rela.data; .rela.text; .text: 9852 -> 9848 bytes, 5438 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma with immutable index bound. RESTORED; .rela.text; .sdata2: 184 -> 192 bytes, 8 differing bytes; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with response-table declaration before cursor. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: remove propagation pragma with byte-sized command. RESTORED; .rela.data; .rela.text; .text: 9852 -> 9848 bytes, 5441 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with cursor initialization before response table. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma using response parameter as the option cursor. RESTORED; .rela.text; .text: 16192 -> 16192 bytes, 34 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: remove propagation pragma with command-scoped response local. RESTORED; .rela.data; .rela.text; .text: 9852 -> 9848 bytes, 5438 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma with array accumulator declared after stack top. RESTORED; .rela.text; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/scene/setting/AOSS: replace checksum carrier with expected and actual checksum scalars. RESTORED; .rela.text; .text: 16192 -> 16192 bytes, 16 differing bytes.
|
||||
- src/scene/setting/AOSS: remove unused poll-time carrier and dead field stores. RESTORED; .rela.data; .rela.text; .text: 16192 -> 16184 bytes, 9327 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: replace pollCardSlot exit goto with return. RESTORED; .rela.text.
|
||||
- src/scene/cardSequence/iplCardSequence: replace probeCard dispatch gotos with a structured command test. RESTORED; .rela.text; .text: 9852 -> 9852 bytes, 14 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: move clearAllCardFileEntries out of comma expression into its conditional block. RESTORED; .rela.text.
|
||||
- src/scene/cardSequence/iplCardSequence: split chained icon-counter assignment into ordered initializations. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: replace source-line and object-header size literals with sizeof. RESTORED; .text: 53564 -> 53564 bytes, 2 differing bytes.
|
||||
- src/scene/setting/AOSS: replace socket cleanup goto with a structured status result. RESTORED; .rela.data; .rela.text; .text: 16192 -> 16184 bytes, 12282 differing bytes.
|
||||
|
||||
Relocation comparison now resolves defined symbols to section plus address and undefined symbols to external name. Compiler-generated local names and symbol-size metadata do not affect linked bytes. Recheck the two text-identical control-flow trials with this normalization.
|
||||
|
||||
- src/scene/cardSequence/iplCardSequence: replace pollCardSlot exit goto with return, checking resolved relocations. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: remove comma expression from reportCardThreadError, checking resolved relocations. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: replace line-table entry size with sizeof(SrcLineEntry). KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/setting/AOSS: replace checksum carrier with reversed scalar declaration order. RESTORED; .text: 16192 -> 16192 bytes, 16 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after AOSSKeySchedule schedule;. RESTORED; .text: 16192 -> 16192 bytes, 16 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after u32 firstValue;. RESTORED; .text: 16192 -> 16192 bytes, 22 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after u8* state;. RESTORED; .text: 16192 -> 16192 bytes, 22 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after u32 controlFlags;. RESTORED; .text: 16192 -> 16192 bytes, 34 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after u32 dataLength;. RESTORED; .text: 16192 -> 16192 bytes, 56 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier after int result;. RESTORED; .text: 16192 -> 16192 bytes, 56 differing bytes.
|
||||
- src/scene/setting/AOSS: flatten checksum carrier into a block around decryption and CRC validation. RESTORED; .text: 16192 -> 16192 bytes, 56 differing bytes.
|
||||
- src/channelScript/CHANSVm: replace object free sizes with the aligned object-header size used for allocation. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: use CARD_ICON_MAX for the final icon boundary. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with accumulatorGetPropertyName. RESTORED; .text: 53564 -> 53564 bytes, 58 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with pAccLoadStringConst. RESTORED; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with pAccLogNot. RESTORED; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with pAccLoadIndirect. RESTORED; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with accumulatorGetPropertyName, pAccLoadStringConst. RESTORED; .text: 53564 -> 53564 bytes, 58 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma while sharing accumulator pointer with pAccLogNot, pAccLoadStringConst, pAccLoadIndirect, pAccStoreIndirect, accumulatorGetPropertyName, accumulatorSetIndex, accumulatorDeleteIndirect. RESTORED; .text: 53564 -> 53564 bytes, 58 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma with case-local u32 propertyIndex;, u32 foundEntry;. RESTORED; .text: 53564 -> 53564 bytes, 72 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma with case-local u32 arraySize;. RESTORED; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/channelScript/CHANSVm: remove lifetime pragma with case-local u32 propertyIndex;, u32 foundEntry;, CHANSVmErr propertyResult;. RESTORED; .text: 53564 -> 53564 bytes, 209 differing bytes.
|
||||
- src/scene/setting/AOSS: replace six printable-key/SSID scan gotos with loop breaks. RESTORED; .text: 16192 -> 16192 bytes, 256 differing bytes.
|
||||
- src/channelScript/CHANSVm: move binary operand deletion results out of condition assignments. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/setting/AOSS: replace request-record buffer initialization size with sizeof. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: replace mount-result label dispatch with nested conditions. RESTORED; compile failed.
|
||||
- src/scene/cardSequence/iplCardSequence: replace mount-result gotos with nested conditions, selecting the definition rather than its prototype. RESTORED; .rela.text; .text: 9852 -> 9848 bytes, 4394 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after u32 flags = 0;. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after AOSSConfigRecord* configRecord;. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after AOSSStoredConfig* wep40Config;. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after AOSSStoredConfig* wep104Config;. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after AOSSStoredConfig* tkipConfig;. RESTORED; .text: 16192 -> 16192 bytes, 12 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after AOSSStoredConfig* aesConfig;. RESTORED; .text: 16192 -> 16192 bytes, 14 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after u8* networkSettings;. RESTORED; .text: 16192 -> 16192 bytes, 23 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after u32 length;. RESTORED; .text: 16192 -> 16192 bytes, 23 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after int result;. RESTORED; .text: 16192 -> 16192 bytes, 23 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with option cursor declared after s32 optionRemaining;. RESTORED; .text: 16192 -> 16192 bytes, 15 differing bytes.
|
||||
- src/scene/setting/AOSS: remove optimizer pragma with direct response-type table access. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: replace command-message bitfield union with explicit field masks. RESTORED; .text: 9852 -> 9852 bytes, 6 differing bytes.
|
||||
- src/channelScript/CHANSVm: replace string conversion failure goto with return in CHANSVmConvertToStrFromInt. RESTORED; .text: 53564 -> 53564 bytes, 10 differing bytes.
|
||||
- src/channelScript/CHANSVm: replace string conversion failure goto with return in CHANSVmConvertToStrFromFloat. RESTORED; .text: 53564 -> 53564 bytes, 10 differing bytes.
|
||||
- src/scene/setting/AOSS: replace reply payload byte offset with its typed payload field. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/setting/AOSS: express reply option header length with offsetof instead of summing field sizes. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: replace reused class-size variable with named source-line count and table end. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: use a while loop for separately initialized icon counters. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: remove unreachable break after the symbol-opcode error return. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/setting/AOSS: expand compact protocol jump conditions into normal blocks. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: name per-frame icon bytes separately from the texture palette size. KEPT; all allocated sections and relocations identical.
|
||||
- src/channelScript/CHANSVm: retest pragma removal on the retained cleanups using resolved relocation destinations. RESTORED; .text: 53564 -> 53564 bytes, 41 differing bytes.
|
||||
- src/scene/setting/AOSS: retest pragma removal on the retained cleanups using resolved relocation destinations. RESTORED; .text: 16192 -> 16192 bytes, 8 differing bytes.
|
||||
- src/scene/cardSequence/iplCardSequence: retest pragma removal on the retained cleanups using resolved relocation destinations. RESTORED; .rela.data; .rela.text; .text: 9852 -> 9848 bytes, 5438 differing bytes.
|
||||
- src/channelScript/CHANSVm: document retained compiler requirements. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/setting/AOSS: document retained compiler requirements and keep two-space protocol indentation. KEPT; all allocated sections and relocations identical.
|
||||
- src/scene/cardSequence/iplCardSequence: document retained compiler requirements. KEPT; all allocated sections and relocations identical.
|
||||
|
||||
## Retained result
|
||||
|
||||
72 recorded compiler trials: 18 retained, 54 restored, including one failed compilation. Trials include cumulative improvements and final documentation checks.
|
||||
|
||||
CHANSVm: source-line table size uses sizeof(SrcLineEntry), with separate lineBlockCount and lineTableEnd. Object free sizes use the same VM_ALIGN(sizeof(CHANSVmObjHdr)) as allocation. Operand deletion assignments are normal statements. Removed three obsolete size TODOs and an unreachable break.
|
||||
|
||||
AOSS: request initialization uses sizeof(requestRecords). Option headers use offsetof(AOSSReplyOption, fields.payload), and the payload cursor uses the typed field. Expanded four compact protocol jump conditions.
|
||||
|
||||
iplCardSequence: replaced the polling exit goto with return; removed the error-path comma expression; split icon counter initialization into a normal while loop; named iconFrameSize for frame bytes; replaced the last-frame literal with CARD_ICON_MAX - 1.
|
||||
|
||||
All three function pragmas remain. CHANSVm default lifetime splitting changes 24 instructions; AOSS default optimization swaps the search cursor and table-base registers in eight instructions; cardThreadMain constant propagation folds the response into ori and removes the target register insert. Declaration, scope, pointer-sharing and response-local alternatives failed exact comparison. Each pragma now has one compiler-requirement comment.
|
||||
|
||||
AOSS checksum fields remain grouped: scalar replacements change the checksum/key-state register allocation, even at equal instruction count. Legacy select descriptor and timeout stores remain; deleting the unused timeout removes two target stores. Both requirements have one-line comments. Remaining shared card-state placeholder fields were not renamed because their header has consumers outside this assignment. Structured mount-result, validation and conversion rewrites changed code and were restored. No new workaround was introduced.
|
||||
|
||||
The first mount-result trial selected a forward declaration and failed compilation; the corrected definition-only trial compiled but removed one target instruction. Both were restored. The initial checksum-placement harness assertion happened before any source write and was corrected before running those trials.
|
||||
|
||||
## Final verification
|
||||
|
||||
Ran the requested gate once over all three units with --quick. Full 43U build passed. Pools identical: CHANSVm 125/125, AOSS 1/1, iplCardSequence 43/43.
|
||||
|
||||
Instruction-exact counts unchanged: CHANSVm 233/233; AOSS 21/21; iplCardSequence 30/30. Code/data: 53564/6904, 16192/2800, 9852/1496 bytes respectively, all matched and fully linked. Every owned section is 100%. No configure.py or header changes.
|
||||
|
||||
Fresh focused ctxdiff checks all have identical counts and diffs 0: CHANSVmAddExe, CHANSVmStep, AOSS_Init_old, AOSSApplyAuthOptions, AOSSDecryptMessage, pollCardSlot, reportCardThreadError, cardThreadMain, loadCardFileIcons.
|
||||
|
||||
Every allocated object section and resolved relocation is identical to the initial source-object snapshot. Global report measures are identical to the initial complete report. Report regeneration and completion checker passed: DECOMPLETE_OK. DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
|
||||
|
||||
GATE PASS: 0 regressions, 0 forbidden patterns, 0 readability warnings. Git diff --check passed. Gate transcript: /tmp/cleanup-c1-gate.log. Trial utility and initial snapshots: /tmp/cleanup-c1-*.
|
||||
|
||||
origin/main advanced two commits through another session during this work. This worker did not fetch, merge or rebase; the branch remains based on f1db6b65 for parent integration.
|
||||
|
||||
Source commits: cb31c2d7 CHANSVm; ee720b82 AOSS; 673e11b5 iplCardSequence. Each source file was committed separately after verification.
|
||||
150
tools/decomp-assist/cleanup-c2.attempts.md
Normal file
150
tools/decomp-assist/cleanup-c2.attempts.md
Normal file
@@ -0,0 +1,150 @@
|
||||
# cleanup-c2 attempts
|
||||
|
||||
Baseline: f1db6b656e386063a8bc263fb75a299f36ae4803. Full 43U build passed before edits. DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Fresh initial report passed DECOMPLETE_OK. All four assigned units are Matching.
|
||||
|
||||
Each retained trial must preserve every allocated object section and relocation. Any changed byte or build failure restores the source and rebuilds the initial exact object. Final acceptance also requires the full build, report, completion checker and four-unit gate with zero regressions.
|
||||
|
||||
## Trials
|
||||
|
||||
- src/system/iplChannelManager: remove iro pragma from Manager::loadMetaHeaderAsync: reverted; changed .rela.text, .text; functions: loadMetaHeaderAsync__Q33ipl7channel7ManagerFii.
|
||||
- src/system/iplSaveDataManager: remove iro pragma from Manager::makePriorTitleIDList: reverted; changed .rela.text, .text; functions: makePriorTitleIDList__Q33ipl8savedata7ManagerFPUxPUxUl.
|
||||
- src/system/iplSaveDataManager: remove iro pragma from Manager::doUpdateChanInfos: reverted; changed .rela.text, .text; functions: doUpdateChanInfos__Q33ipl8savedata7ManagerFPUx.
|
||||
- src/scene/board/iplBoard: remove iro pragma from Board::stt_wait_child_dst: reverted; changed .rela.text, .text; functions: stt_wait_child_dst__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove iro pragma from Board::return_to_freelist_if_diff_date: reverted; changed .text; functions: return_to_freelist_if_diff_date__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove iro pragma from Board::get_log_obj: reverted; changed .text; functions: get_log_obj__Q33ipl5scene5BoardFv.
|
||||
- src/utility/iplUtility: remove iro pragma from BScroller::set_arw_param: reverted; changed .rela.text, .text; functions: set_arw_param__Q33ipl7utility9BScrollerFv.
|
||||
- src/utility/iplUtility: remove Scroller constructor dont_inline pragma: reverted; changed .rela.text, .text; functions: __ct__Q33ipl7utility8ScrollerFv, __ct__Q33ipl4math14HermiteIntp<f>Fv.
|
||||
- src/scene/board/iplBoard: replace RecordReadState with independent metadata and interrupt locals: reverted; changed .rela.text, .text; functions: appendRecord__Q33ipl5scene5BoardFP10_CDBRecord.
|
||||
- src/scene/board/iplBoard: remove freelist pragma and use a structured while loop: reverted; changed .rela.text, .text; functions: return_to_freelist_if_diff_date__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove get_log_obj pragma and return the found object directly: reverted; changed .rela.text, .text; functions: get_log_obj__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: replace comma expression in object iteration with an assignment condition: reverted; changed .rela.text; functions: .
|
||||
- src/scene/board/iplBoard: use typed BoardObject pointer when destroying free objects: reverted; changed .rela.text, .text; functions: destroy__Q33ipl5scene5BoardFv.
|
||||
- src/system/iplChannelManager: rename load-order locals and use MAX_CHANNEL_PAGE: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: remove use-site volatile MD5 reference: reverted; changed .rela.text, .text; functions: initManagerTask__Q33ipl8savedata7ManagerFPv.
|
||||
- src/system/iplSaveDataManager: remove unused mangled helper declarations: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: read available channel slot through chanInfo instead of raw offsets: reverted; changed .rela.text, .text; functions: getAvailableInList__Q33ipl8savedata7ManagerFPCUxUl.
|
||||
- src/utility/iplUtility: replace set_string goto with a structured type-search loop: reverted; changed .rela.text, .text; functions: set_string__Q33ipl7utility6layoutFPQ34nw4r3lyt4PanePCw.
|
||||
- src/utility/iplUtility: remove unused decimal-conversion byte offset: reverted; changed .rela.text; functions: .
|
||||
- src/utility/iplUtility: use TPL_MAGIC instead of its literal value: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: replace cursor position word copies with vector assignment: reverted; changed .rela.text, .text; functions: get_cursor_pos__Q23ipl7utilityFRCQ33ipl4math4VEC2.
|
||||
- src/scene/board/iplBoard: replace comma expression in object iteration with an assignment condition after sorting relocations: reverted; changed .rela.text; functions: .
|
||||
- src/utility/iplUtility: remove unused decimal-conversion byte offset after sorting relocations: reverted; changed .rela.text; functions: .
|
||||
- src/scene/board/iplBoard: structure freelist iteration while retaining iro pragma: reverted; changed .rela.text; functions: .
|
||||
- src/scene/board/iplBoard: remove get_log_obj pragma with an explicit counted iteration: reverted; changed .rela.text, .text; functions: get_log_obj__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove stt_wait_child_dst pragma and shorten channel-title lookup lifetime: reverted; changed .rela.text, .text; functions: stt_wait_child_dst__Q33ipl5scene5BoardFv.
|
||||
- src/system/iplChannelManager: remove loadMetaHeaderAsync pragma with directly scoped channel-info assignment: reverted; changed .rela.text, .text; functions: loadMetaHeaderAsync__Q33ipl7channel7ManagerFii.
|
||||
- src/system/iplSaveDataManager: remove makePriorTitleIDList pragma and scope output index to channel: reverted; changed .rela.text, .text; functions: makePriorTitleIDList__Q33ipl8savedata7ManagerFPUxPUxUl.
|
||||
- src/system/iplSaveDataManager: remove doUpdateChanInfos pragma and name channel info reference: reverted; changed .rela.text, .text; functions: doUpdateChanInfos__Q33ipl8savedata7ManagerFPUx.
|
||||
- src/utility/iplUtility: remove set_arw_param pragma and scope arrow-length intermediates: reverted; changed .rela.text, .text; functions: set_arw_param__Q33ipl7utility9BScrollerFv.
|
||||
- src/utility/iplUtility: remove set_string goto with a break and initialized match flag: reverted; changed .rela.text, .text; functions: set_string__Q33ipl7utility6layoutFPQ34nw4r3lyt4PanePCw.
|
||||
- src/system/iplSaveDataManager: use channel fields for valid-channel count: reverted; changed .rela.text, .text; functions: getNumValidChannel__Q33ipl8savedata7ManagerCFv.
|
||||
- src/system/iplSaveDataManager: rename valid-channel count locals to their field meanings: retained; every allocated section and relocation is identical to the initial object.
|
||||
|
||||
Relocation comparison correction: initial trials compared anonymous local constant names literally. MWCC renumbers these names when source tokens change. Subsequent trials resolve local relocations to their section and offset, preserve external symbol identity, and still compare every allocated section byte. Earlier relocation-only rejections are retried below.
|
||||
|
||||
- src/scene/board/iplBoard: replace comma iteration with assignment condition using resolved local relocations: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: remove dead decimal-conversion byte offset using resolved local relocations: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/scene/board/iplBoard: replace freelist goto with structured iteration using resolved local relocations: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: replace cursor word casts with two field-sized memcpy calls: reverted; changed .rela.text, .text; functions: get_cursor_pos__Q23ipl7utilityFRCQ33ipl4math4VEC2.
|
||||
- src/utility/iplUtility: replace cursor word casts with a single vector-sized memcpy: reverted; changed .rela.text, .text; functions: get_cursor_pos__Q23ipl7utilityFRCQ33ipl4math4VEC2.
|
||||
- src/utility/iplUtility: use shared interpolation header instead of local class copies: reverted; changed .data, .rela.data, .rela.text, .text; functions: __dt__Q33ipl4math16Interporation<f>Fv, calc__Q33ipl7utility8ScrollerFv.
|
||||
- src/system/iplSaveDataManager: remove raw MD5 byte cast while preserving address order: reverted; changed .text; functions: initManagerTask__Q33ipl8savedata7ManagerFPv.
|
||||
- src/system/iplSaveDataManager: derive variable-length MD5 trailer from the saved data field: reverted; changed .rela.text, .text; functions: initManagerTask__Q33ipl8savedata7ManagerFPv.
|
||||
- src/system/iplSaveDataManager: remove redundant file-length pointer in MD5 validation: reverted; changed .text; functions: initManagerTask__Q33ipl8savedata7ManagerFPv.
|
||||
- src/utility/iplUtility: remove arrow pragma and branch directly at pointer setters: reverted; changed .rela.text, .text; functions: set_arw_param__Q33ipl7utility9BScrollerFv.
|
||||
- src/scene/board/iplBoard: remove log-object pragma with separate cursor and candidate lifetimes: reverted; changed .rela.text, .text; functions: get_log_obj__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove freelist pragma after replacing goto with structured iteration: reverted; changed .text; functions: return_to_freelist_if_diff_date__Q33ipl5scene5BoardFv.
|
||||
- src/utility/iplUtility: remove dead cursor-pointer reassignment: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: replace cursor word-copy casts with named integer views: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: replace MD5 raw address cast with a named byte address: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: rename available-list indices and literal channel dimensions: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: name flattened channel-info index: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: use GX texture and palette enums in TPL validation: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplChannelManager: remove integer address casts from channel metadata pointer additions: reverted; changed .text; functions: cbReadMetaHeader__Q33ipl7channel7ManagerFPv, cbReadTmpMetaHeader__Q33ipl7channel7ManagerFPv.
|
||||
- src/system/iplSaveDataManager: remove unused register-helper declarations: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/system/iplSaveDataManager: use channel-row size in valid-channel count address calculation: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: simplify BScroller active-state comparison: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/utility/iplUtility: remove ForceCTORWeak placeholder: reverted; changed .rela.text, .text; functions: ForceCTORWeak__3iplFv.
|
||||
- src/utility/iplUtility: rename byte-conversion loop locals: retained; every allocated section and relocation is identical to the initial object.
|
||||
- src/scene/board/iplBoard: remove freelist pragma with next-pointer declared before cursor: reverted; changed .text; functions: return_to_freelist_if_diff_date__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove log-object pragma with cursor declared before result: reverted; changed .text; functions: get_log_obj__Q33ipl5scene5BoardFv.
|
||||
- src/scene/board/iplBoard: remove unused appendRecord hide_icon label: retained; every allocated section and relocation is identical to the initial object.
|
||||
|
||||
## Retained changes and remaining compiler requirements
|
||||
|
||||
- iplChannelManager.cpp: named load-order page and distance locals; replaced the page-limit literal with MAX_CHANNEL_PAGE. The IRO pragma and callback address casts remain after compiled removal trials changed bytes. The pragma now has a one-line explanation.
|
||||
- iplSaveDataManager.cpp: removed seven unused mangled declarations and ten unused register-save declarations. Named channel-count, channel-search and flattened-title indices; used existing channel constants and row/slot sizes. Named the MD5 trailer byte address. Both IRO pragmas, the volatile MD5 reference, its file-length pointer and the original channel views remain because ordinary array/member variants changed bytes. Added one-line compiler explanations at retained workarounds.
|
||||
- iplBoard.cpp: replaced the freelist goto with a structured while loop, removed its entry label and the unused appendRecord hide_icon label, and replaced comma-expression iteration with an assignment condition. All three IRO pragmas and RecordReadState remain with one-line explanations. Flattening RecordReadState changed appendRecord. Removing the freelist pragma keeps 37 instructions but exchanges r30 and r31 in nine positions; declaring next before the cursor did not fix it.
|
||||
- iplUtility.cpp: removed the unused decimal-conversion offset and its dead update, removed the initial cursor-pointer assignment, simplified the active-state test, named integer-copy and byte-conversion locals, and replaced TPL/GX literals with existing constants. The IRO/inlining pragmas, local interpolation classes, out-of-line vector constructor, integer-copy order, runtime-type goto and weak factory remain because compiled alternatives changed code or data. Added one-line explanations.
|
||||
|
||||
Header-owned Scroller::unk_0x3C was left intact because the assigned scope excludes its declaration in include/utility/iplScroller.h. The pre-existing hasChannel assembly was left intact; earlier source attempts and their register/frame differences are recorded in tools/decomp-assist/da1.attempts.md.
|
||||
|
||||
60 completed source trials are recorded above. The alternate MD5 pointer spelling after the successful named-address trial was skipped because that source expression had already been replaced; no compiler result is claimed for it. After final comments, all four objects were rebuilt sequentially and every allocated section plus resolved relocation target still equals the initial exact object. git diff --check passed. Final gate and completion evidence follow below.
|
||||
|
||||
Source commit: 5e39d1defe8f5179694b331809bddfbca3069206 (src/system/iplChannelManager.cpp).
|
||||
|
||||
Source commit: c5228d90353280107f9abc9a36571715ef4ebcd7 (src/system/iplSaveDataManager.cpp).
|
||||
|
||||
Source commit: 589458dc75dc2c94670bbe301e1b3ece870b1daa (src/scene/board/iplBoard.cpp).
|
||||
|
||||
Source commit: e5486c1ce5b78fb60bae41e825dc6da3ba2a4bb9 (src/utility/iplUtility.cpp).
|
||||
|
||||
## Final verification
|
||||
|
||||
Ran gate.py once at the end over all four assigned units with --quick. The initial full build had already run before edits. Final gate output:
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/system/iplChannelManager] pool: IDENTICAL
|
||||
[src/system/iplChannelManager] objdiff: code 12552/12552 data 1080/1080 functions 74/74 fuzzy 100.0000 linked code 12552
|
||||
[src/system/iplChannelManager] instruction-exact functions: 74/74
|
||||
[src/system/iplChannelManager] section .data size 224 match 100.0
|
||||
[src/system/iplChannelManager] section .rodata size 816 match 100.0
|
||||
[src/system/iplChannelManager] section .sbss size 24 match 100.0
|
||||
[src/system/iplChannelManager] section .sdata size 16 match 100.0
|
||||
[src/system/iplChannelManager] section .text size 12552 match 100.0
|
||||
[src/system/iplChannelManager] baseline: code 12552/12552 data 1080 functions 74 fuzzy 100.0000
|
||||
[src/system/iplSaveDataManager] pool: IDENTICAL
|
||||
[src/system/iplSaveDataManager] objdiff: code 7172/7172 data 968/968 functions 35/35 fuzzy 100.0000 linked code 7172
|
||||
[src/system/iplSaveDataManager] instruction-exact functions: 35/35
|
||||
[src/system/iplSaveDataManager] section .data size 184 match 100.0
|
||||
[src/system/iplSaveDataManager] section .rodata size 768 match 100.0
|
||||
[src/system/iplSaveDataManager] section .sdata size 16 match 100.0
|
||||
[src/system/iplSaveDataManager] section .text size 7172 match 100.0
|
||||
[src/system/iplSaveDataManager] baseline: code 7172/7172 data 968 functions 35 fuzzy 100.0000
|
||||
[src/scene/board/iplBoard] pool: IDENTICAL
|
||||
[src/scene/board/iplBoard] objdiff: code 20276/20276 data 896/896 functions 94/94 fuzzy 100.0000 linked code 20276
|
||||
[src/scene/board/iplBoard] instruction-exact functions: 94/94
|
||||
[src/scene/board/iplBoard] section .data size 744 match 100.0
|
||||
[src/scene/board/iplBoard] section .rodata size 104 match 100.0
|
||||
[src/scene/board/iplBoard] section .sdata size 40 match 100.0
|
||||
[src/scene/board/iplBoard] section .sdata2 size 8 match 100.0
|
||||
[src/scene/board/iplBoard] section .text size 20276 match 100.0
|
||||
[src/scene/board/iplBoard] baseline: code 20276/20276 data 896 functions 94 fuzzy 100.0000
|
||||
[src/utility/iplUtility] pool: IDENTICAL
|
||||
[src/utility/iplUtility] objdiff: code 5932/5932 data 304/304 functions 45/45 fuzzy 100.0000 linked code 5932
|
||||
[src/utility/iplUtility] instruction-exact functions: 45/45
|
||||
[src/utility/iplUtility] section .data size 136 match 100.0
|
||||
[src/utility/iplUtility] section .sdata size 80 match 100.0
|
||||
[src/utility/iplUtility] section .sdata2 size 88 match 100.0
|
||||
[src/utility/iplUtility] section .text size 5932 match 100.0
|
||||
[src/utility/iplUtility] baseline: code 5932/5932 data 304 functions 45 fuzzy 100.0000
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 100.00000 -> 100.00000
|
||||
global fuzzy_match_percent: 99.99989 -> 99.99989
|
||||
global complete_code_percent: 100.00000 -> 100.00000
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
Regenerated build/43U/report.json with ninja; target was already current. The fresh completion checker returned DECOMPLETE_OK. DOL SHA1 is 26116613f624061ba99c8d1a299aaa6efa85670d. All four configure.py entries remain Matching.
|
||||
|
||||
- main/src/system/iplChannelManager: exact functions 74/74 before and after; code 12552/12552; data 1080/1080; code and data fully linked; every section 100.0.
|
||||
- main/src/system/iplSaveDataManager: exact functions 35/35 before and after; code 7172/7172; data 968/968; code and data fully linked; every section 100.0.
|
||||
- main/src/utility/iplUtility: exact functions 45/45 before and after; code 5932/5932; data 304/304; code and data fully linked; every section 100.0.
|
||||
- main/src/scene/board/iplBoard: exact functions 94/94 before and after; code 20276/20276; data 896/896; code and data fully linked; every section 100.0.
|
||||
|
||||
Final source review: scoped to the four assigned files; no new assembly, register keywords, volatile accesses or compiler pragmas. Retained workaround comments are one line each. Forbidden-pattern and readability counts are zero. git diff --check passed. Source files are committed separately; this log is the final independent documentation commit. No push, PR, merge, rebase or edits to another worktree.
|
||||
93
tools/decomp-assist/cleanup-c3.attempts.md
Normal file
93
tools/decomp-assist/cleanup-c3.attempts.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# cleanup-c3
|
||||
|
||||
Baseline `f1db6b656e386063a8bc263fb75a299f36ae4803`, branch `agent/w1009/cleanup-c3`.
|
||||
Initial full 43U build passed. The live report is 100% matched and linked for code and data.
|
||||
`DECOMPLETE_OK`; DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
|
||||
Each trial rebuilds the owned object and compares its sections with the initial object.
|
||||
Code, data, relocations and symbol records must remain identical. Compiler-generated local literal names and local-static numeric suffixes may change without changing the linked bytes.
|
||||
Trials changing compiled bytes are restored. Final acceptance requires the four-unit gate and completion checker.
|
||||
`drawTransferTitles` already uses `nw4r::ut::Color` directly, with no GXColor reinterpret casts or color copy chain.
|
||||
|
||||
## Trials
|
||||
- REVERT `iplSDChannelSelect` remove scoped IRO pragma from void SDChannelSelect::create(): changed sections: .rela.text, .strtab, .symtab, .text.
|
||||
- REVERT `iplSDChannelSelect` remove scoped IRO pragma from void SDChannelSelect::flushSaveDataAndMountSD(): changed sections: .text.
|
||||
- REVERT `iplSDMemory` remove scoped IRO pragma from void SDMemory::create(: changed sections: .strtab, .text; .text 21992 -> 21992 bytes, 191 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` remove scoped IRO pragma from void iplSDChannelTitle_flushSaveBeforeExit: changed sections: .text; .text 19480 -> 19480 bytes, 8 differing bytes.
|
||||
- REVERT `iplChannelTitle` remove scoped IRO pragma from void ChannelTitle::calcNormalParentalDialog(): changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 5 differing bytes.
|
||||
- REVERT `iplChannelTitle` remove scoped IRO pragma from void ChannelTitle::calcNormalWaitTmd(): changed sections: .rela.text, .strtab, .symtab, .text; .text 30156 -> 30136 bytes, 13771 differing bytes.
|
||||
- REVERT `iplChannelTitle` remove scoped IRO pragma from void ChannelTitle::calcNormalUpdating(): changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 12 differing bytes.
|
||||
- KEEP `iplChannelTitle` remove scoped IRO pragma from void ChannelTitle::getTicketLimitTask: all ELF sections identical.
|
||||
- REVERT `iplSDMemory` drawTransferTitles remove unused memo-position component copies: changed sections: .rela.text, .strtab, .symtab, .text; .text 21992 -> 21972 bytes, 5289 differing bytes.
|
||||
- REVERT `iplSDMemory` drawTransferTitles replace component copy chain with VEC3 copy: changed sections: .rela.text, .strtab, .symtab, .text; .text 21992 -> 21996 bytes, 5275 differing bytes.
|
||||
- REVERT `iplSDMemory` drawTransferTitles replace component copies with VEC3 assignment: changed sections: .strtab.
|
||||
- KEEP `iplSDMemory` drawTransferTitles VEC3 assignment, allowing harmless local-literal renumbering: code, data, relocations and symbol records identical; local literal names renumbered.
|
||||
- REVERT `iplSDMemory` onDialogState21 remove zero-length memset: changed sections: .comment, .rela.data, .rela.text, .strtab, .symtab, .text; .text 21992 -> 21976 bytes, 5873 differing bytes.
|
||||
- REVERT `iplSDMemory` onDialogState21 use typed pointer difference for marker length: changed sections: .rela.text, .strtab, .symtab, .text; .text 21992 -> 21996 bytes, 6116 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` remove comma operators in drag traversal conditions: changed sections: .strtab.
|
||||
- REVERT `iplChannelTitle` remove redundant group reference aliases: changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 12 differing bytes.
|
||||
- REVERT `iplChannelTitle` checkNetSetting replace goto and bool copy with early returns: changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 13 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` updateMemoryCalc split chained title-range assignment: changed sections: .rela.text, .symtab, .text; .text 19480 -> 19484 bytes, 8220 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` drag traversal remove comma operators, allowing compiler-local names: changed sections: .strtab.
|
||||
- REVERT `iplSDChannelSelect` flushSaveDataAndMountSD remove pragma with named save-data receiver: changed sections: .strtab, .text; .text 35264 -> 35264 bytes, 4 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` flushSaveDataAndMountSD remove pragma with named flush heap: changed sections: .strtab, .text; .text 35264 -> 35264 bytes, 4 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` flushSaveBeforeExit remove pragma with named page reference: compile failed.
|
||||
- REVERT `iplSDChannelTitle` flushSaveBeforeExit remove pragma with named page value: changed sections: .strtab, .text; .text 19480 -> 19480 bytes, 8 differing bytes.
|
||||
- REVERT `iplChannelTitle` calcNormalUpdating remove pragma with named update size: changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 13 differing bytes.
|
||||
- REVERT `iplChannelTitle` calcNormalUpdating remove pragma with named update offset: changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 12 differing bytes.
|
||||
- KEEP `iplSDChannelSelect` drag and prepare traversal remove comma operators; normalize local static suffixes: code, data, relocations and symbol records identical; local literal names renumbered.
|
||||
- REVERT `iplSDChannelTitle` flushSaveBeforeExit remove pragma with correctly typed page reference: changed sections: .strtab, .text; .text 19480 -> 19480 bytes, 8 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` remove six duplicate helper forward declarations: compile failed.
|
||||
- REVERT `iplSDChannelTitle` updateMemoryCalc split range copies in destination order: changed sections: .rela.text, .symtab, .text; .text 19480 -> 19484 bytes, 8202 differing bytes.
|
||||
- REVERT `iplChannelTitle` checkNetSetting remove goto with existing boolean temporaries: changed sections: .rela.text, .strtab, .symtab, .text; .text 30156 -> 30164 bytes, 6831 differing bytes.
|
||||
- REVERT `iplChannelTitle` calcFadeout replace exit goto with early return: changed sections: .rela.text, .strtab, .symtab, .text; .text 30156 -> 30164 bytes, 19807 differing bytes.
|
||||
- REVERT `iplChannelTitle` isTimeLimitedChannel express remaining minutes with modulo: changed sections: .rela.text, .symtab, .text; .text 30156 -> 30160 bytes, 3840 differing bytes.
|
||||
- KEEP `iplSDChannelTitle` remove duplicate helper declarations with declaration-only matching: code, data, relocations and symbol records identical; local literal names renumbered.
|
||||
- REVERT `iplSDMemory` create remove pragma and declare title-cache locals at use: changed sections: .strtab, .text; .text 21992 -> 21992 bytes, 191 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` create remove pragma with upfront heap/timing declarations: changed sections: .rela.text, .strtab, .symtab, .text; .text 35264 -> 35260 bytes, 27101 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` prepare use for-loop list traversal without assignment condition: changed sections: .rela.text, .strtab, .symtab, .text; .text 35264 -> 35276 bytes, 27194 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` updateChannelObjects use for-loop list traversal without assignment condition: changed sections: .rela.text, .strtab, .symtab, .text; .text 35264 -> 35276 bytes, 13953 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` calcChannelObjects use for-loop list traversal without assignment condition: changed sections: .rela.text, .strtab, .symtab, .text; .text 35264 -> 35276 bytes, 13788 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` finishDrag use for-loop list traversal without assignment condition: changed sections: .rela.text, .strtab, .symtab, .text; .text 35264 -> 35276 bytes, 2198 differing bytes.
|
||||
- REVERT `iplChannelTitle` calcNormalParentalDialog remove pragma with upfront dialog declaration: changed sections: .strtab, .text; .text 30156 -> 30156 bytes, 5 differing bytes.
|
||||
- REVERT `iplChannelTitle` calcNormalWaitTmd remove pragma with direct ticket-flag initialization: changed sections: .rela.text, .strtab, .symtab, .text; .text 30156 -> 30136 bytes, 13771 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` updateMemoryCalc copy title range separately into both destinations: changed sections: .strtab, .text; .text 19480 -> 19480 bytes, 7 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` remove scoped dont_inline pragma: changed sections: .comment, .rela.text, .strtab, .symtab, .text; .text 35264 -> 35256 bytes, 13654 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` processWorkerCommands replace goto dispatch with structured state guard: changed sections: .rela.data, .rela.text, .strtab, .symtab, .text; .text 35264 -> 35256 bytes, 25748 differing bytes.
|
||||
- KEEP `iplChannelTitle` remove discarded jokes and commented-out modulo alternative: all ELF sections identical.
|
||||
- REVERT `iplSDChannelSelect` isChannelReady replace scoped pragma with existing NO_INLINE attribute: changed sections: .comment, .rela.text, .strtab, .symtab, .text; .text 35264 -> 35256 bytes, 13654 differing bytes.
|
||||
- REVERT `iplSDChannelSelect` flushSaveDataAndMountSD remove pragma with named heap and save receiver: changed sections: .strtab, .text; .text 35264 -> 35264 bytes, 4 differing bytes.
|
||||
- REVERT `iplSDChannelTitle` flushSaveBeforeExit remove pragma with named heap and save receiver: changed sections: .strtab, .text; .text 19480 -> 19480 bytes, 8 differing bytes.
|
||||
|
||||
## Retained cleanup
|
||||
|
||||
- `iplSDChannelSelect.cpp`: removed comma operators from all nine channel traversals. Kept the ordinary assignment conditions because for-loop versions added three instructions. Kept both IRO-0 scopes, the drawing-loop no-inline pragma and worker-state dispatch, with concise compiler explanations.
|
||||
- `iplSDMemory.cpp`: replaced three component copies with `memoPosition = translation`. Colors were already direct `nw4r::ut::Color` values. Kept IRO-1, the zero-length memset call and unsigned marker-address subtraction, with concise compiler explanations.
|
||||
- `iplSDChannelTitle.cpp`: removed five duplicate forward declarations. Kept IRO-0 and the chained title-range copy, with concise compiler explanations.
|
||||
- `iplChannelTitle.cpp`: removed the IRO-1 scope from `getTicketLimitTask`, discarded jokes and the commented-out modulo alternative. Kept the other three IRO scopes, group references, shared goto exits and stored-quotient subtraction, with concise compiler explanations.
|
||||
|
||||
The first duplicate-declaration regex crossed into a definition and failed compilation; the source was restored and the corrected declaration-only trial passed. The first page-reference trial used `s32&` for an `int&` accessor; the corrected type compiled and still changed bytes.
|
||||
|
||||
Final focused object rebuild passed. All four objects have identical code, data, relocations and symbol records versus the initial objects. Only local literal labels and local-static numeric suffixes were renumbered in the first three units; `iplChannelTitle.o` is entirely identical.
|
||||
|
||||
Instruction evidence for retained pragmas: SDChannelSelect create loses one BS2-loop instruction without IRO-0; its flush swaps receiver/heap loads. SDMemory create changes its string-base register without IRO-1. SDChannelTitle flush changes the save-manager address register without IRO-0. ChannelTitle parental changes BS2 argument-base registers, TMD waiting loses five instructions, and update progress changes registers without their scopes.
|
||||
|
||||
## Final acceptance
|
||||
|
||||
`gate.py src/scene/sdChannelSelect/iplSDChannelSelect src/scene/sdChannelMemory/iplSDMemory src/scene/sdChannelTitle/iplSDChannelTitle src/scene/channelTitle/iplChannelTitle --quick` passed.
|
||||
|
||||
| Unit | Exact functions before -> after | Matched code | Matched data | Pools |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| SDChannelSelect | 129/129 -> 129/129 | 33828/33828 | 2960/2960 | identical |
|
||||
| SDMemory | 66/66 -> 66/66 | 20872/20872 | 3344/3344 | identical |
|
||||
| SDChannelTitle | 69/69 -> 69/69 | 18624/18624 | 1976/1976 | identical |
|
||||
| ChannelTitle | 95/95 -> 95/95 | 28788/28788 | 3144/3144 | identical |
|
||||
|
||||
Every owned objdiff section remains 100%. The gate independently found every owned function instruction-exact, 0 regressions, 0 forbidden patterns and 0 readability warnings. A separate comparison against the initial live report also found 0 regressions across all units and exact functions.
|
||||
|
||||
Full build passed; refreshed `build/43U/report.json` passed `DECOMPLETE_OK`.
|
||||
DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
Final gate transcript: `/tmp/cleanup-c3-final-gate.log`.
|
||||
|
||||
Source commits: SDChannelSelect `dde666c3`; SDMemory `9c7cd77f`; SDChannelTitle `f5bfa17b`; ChannelTitle `8b101cc3`.
|
||||
GATE PASS
|
||||
158
tools/decomp-assist/cleanup-c4.attempts.md
Normal file
158
tools/decomp-assist/cleanup-c4.attempts.md
Normal file
@@ -0,0 +1,158 @@
|
||||
# cleanup-c4 attempts
|
||||
|
||||
Worktree `/mnt/drive2/projects/wii-ipl-workers/data-d4`, branch `agent/w1009/cleanup-c4`.
|
||||
Baseline `f1db6b656e386063a8bc263fb75a299f36ae4803`. Existing untracked files retained.
|
||||
|
||||
Acceptance: readable changes only in the four assigned files; every allocated object section and relocation stays identical; all four units remain Matching; final full build, objdiff report, DECOMPLETE_OK, and gate.py pass with zero regressions and DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. Commit each source file separately and this log.
|
||||
|
||||
Baseline full build passed, report regenerated, DECOMPLETE_OK; code/data/link 100%, 12563/12563 functions; DOL SHA1 verified.
|
||||
|
||||
## Trials
|
||||
|
||||
- setting-remove-all-pragmas: REJECT, changed .rela.text, .text.
|
||||
- kitayama-remove-all-pragmas: REJECT, changed .rela.text, .text.
|
||||
- address-remove-all-pragmas: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- ax-remove-all-pragmas: REJECT, changed .rela.text, .text.
|
||||
- setting-remove-all-pragmas instruction evidence: `scanAP__Q33ipl5scene7SettingFv` 14 differing instructions, 272/272 instruction counts.
|
||||
- kitayama-remove-all-pragmas instruction evidence: `calcNormal__Q33ipl5scene12KitayamaTestFv` 3 differing instructions, 464/464 instruction counts.
|
||||
- address-remove-all-pragmas instruction evidence: `create__Q33ipl5scene11AddressEditFv` 329 differing instructions, 818/820 instruction counts.
|
||||
- address-remove-all-pragmas instruction evidence: `get_friendinfo__Q33ipl5scene11AddressEditFv` 68 differing instructions, 82/84 instruction counts.
|
||||
- address-remove-all-pragmas instruction evidence: `update_friendinfo__Q33ipl5scene11AddressEditFv` 2 differing instructions, 38/38 instruction counts.
|
||||
- ax-remove-all-pragmas instruction evidence: `Init__Q44nw4r3snd6detail9AxManagerFv` 52 differing instructions, 62/63 instruction counts.
|
||||
- kitayama-controller-first: REJECT, changed .rela.text, .text.
|
||||
- kitayama-controller-declare-first: REJECT, changed .rela.text, .text.
|
||||
- kitayama-buffer-first: REJECT, changed .rela.text, .text.
|
||||
- kitayama-result-last: REJECT, changed .rela.text, .text.
|
||||
- kitayama-controller-reference: REJECT, changed .rela.text, .text.
|
||||
- kitayama-buffer-scopes: REJECT, changed .rela.text.
|
||||
- setting-scan-index-locals: REJECT, compilation failed.
|
||||
- setting-scan-direct-predicate: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- setting-scan-state-local: REJECT, changed .rela.text, .text.
|
||||
- ax-init-voice-pointer: REJECT, changed .rela.text, .text.
|
||||
- ax-init-voice-local: REJECT, changed .rela.text, .text.
|
||||
- ax-init-loop-scope: REJECT, changed .rela.text, .text.
|
||||
- Relocation comparison now resolves local compiler labels by section/value, preserving global symbol names. Kitayama buffer scopes changed only local literal symbol names, with identical .text and .data. Retested below.
|
||||
- kitayama-buffer-scopes-normalized-relocs: KEEP, all allocated sections and relocations identical.
|
||||
- setting-scan-scoped-indices: REJECT, changed .text.
|
||||
- setting-scan-animation-local: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-create-no-pragma: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-get-friendinfo-no-pragma: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-update-friendinfo-no-pragma: REJECT, changed .text.
|
||||
- address-create-text-scopes: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-create-pane-last: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-get-pane-local: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-get-display-scope: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-update-destination-local: REJECT, changed .text.
|
||||
- address-update-source-first: REJECT, changed .text.
|
||||
- setting-screen-mode-remove-goto: KEEP, all allocated sections and relocations identical.
|
||||
- address-create-remove-dead-label: KEEP, all allocated sections and relocations identical.
|
||||
- address-title-structured-if: KEEP, all allocated sections and relocations identical.
|
||||
- address-stt_ipt_input-switch: REJECT, compilation failed.
|
||||
- address-stt_add_name_input-switch: REJECT, compilation failed.
|
||||
- address-remove-member-parentheses: KEEP, all allocated sections and relocations identical.
|
||||
- setting-copy-plain-source: REJECT, changed .text.
|
||||
- setting-copy-plain-destination: REJECT, changed .text.
|
||||
- setting-render-mode-copy: REJECT, changed .rela.data, .rela.text, .text.
|
||||
- address-stt_ipt_input-structured-switch: KEEP, all allocated sections and relocations identical.
|
||||
- address-stt_add_name_input-structured-switch: KEEP, all allocated sections and relocations identical.
|
||||
- setting-prepare-font-switch: KEEP, all allocated sections and relocations identical.
|
||||
- address-point-event-structured-switch: KEEP, all allocated sections and relocations identical.
|
||||
- address-trigger-event-structured-switch: KEEP, all allocated sections and relocations identical.
|
||||
- address-add-name-fadeout-structured-switch: KEEP, all allocated sections and relocations identical.
|
||||
- address-polish-titles-and-layout-calls: KEEP, all allocated sections and relocations identical.
|
||||
- setting-name-render-copy-locals: KEEP, all allocated sections and relocations identical.
|
||||
- kitayama-remove-obvious-comments: KEEP, all allocated sections and relocations identical.
|
||||
- ax-document-required-iro: KEEP, all allocated sections and relocations identical.
|
||||
- setting-document-required-workarounds: KEEP, all allocated sections and relocations identical.
|
||||
- address-document-required-iro: KEEP, all allocated sections and relocations identical.
|
||||
- address-remove-unneeded-fadeout-scope: KEEP, all allocated sections and relocations identical.
|
||||
- address-name-trigger-animators: KEEP, all allocated sections and relocations identical.
|
||||
- setting-indent-compiler-note: KEEP, all allocated sections and relocations identical.
|
||||
- ax-indent-compiler-note: KEEP, all allocated sections and relocations identical.
|
||||
- Final setting: allocated sections and resolved relocations identical to baseline; 112/112 functions exact; every objdiff section 100%; POOL IDENTICAL up to 108 (mine=108 base=108).
|
||||
- Final kitayama: allocated sections and resolved relocations identical to baseline; 12/12 functions exact; every objdiff section 100%; POOL IDENTICAL up to 17 (mine=17 base=17).
|
||||
- Final address: allocated sections and resolved relocations identical to baseline; 94/94 functions exact; every objdiff section 100%; POOL IDENTICAL up to 57 (mine=57 base=57).
|
||||
- Final ax: allocated sections and resolved relocations identical to baseline; 25/25 functions exact; every objdiff section 100%; POOL IDENTICAL up to 0 (mine=0 base=0).
|
||||
- Final live report compared with the saved f1db6b65 baseline: 0 regressions across all 1028 units.
|
||||
- Final ctxdiff `prepare__Q33ipl5scene7SettingFv`: src 0x2cc base 0x2cc insns 179/179.
|
||||
- Final ctxdiff `updateScreenMode__Q33ipl5scene7SettingFv`: src 0x224 base 0x224 insns 137/137.
|
||||
- Final ctxdiff `draw__Q33ipl5scene7SettingFv`: src 0x9e0 base 0x9e0 insns 632/632.
|
||||
- Final ctxdiff `scanAP__Q33ipl5scene7SettingFv`: src 0x440 base 0x440 insns 272/272.
|
||||
- Final ctxdiff `calcNormal__Q33ipl5scene12KitayamaTestFv`: src 0x740 base 0x740 insns 464/464.
|
||||
- Final ctxdiff `create__Q33ipl5scene11AddressEditFv`: src 0xcd0 base 0xcd0 insns 820/820.
|
||||
- Final ctxdiff `get_friendinfo__Q33ipl5scene11AddressEditFv`: src 0x150 base 0x150 insns 84/84.
|
||||
- Final ctxdiff `update_friendinfo__Q33ipl5scene11AddressEditFv`: src 0x98 base 0x98 insns 38/38.
|
||||
- Final ctxdiff `stt_ipt_input__Q33ipl5scene11AddressEditFv`: src 0x20c base 0x20c insns 131/131.
|
||||
- Final ctxdiff `stt_add_name_input__Q33ipl5scene11AddressEditFv`: src 0x20c base 0x20c insns 131/131.
|
||||
- Final ctxdiff `stt_add_name_fadeout__Q33ipl5scene11AddressEditFv`: src 0x35c base 0x35c insns 215/215.
|
||||
- One ctxdiff invocation used the wrong mangled spelling for start_point_event. Corrected from the object symbol table below.
|
||||
- Final ctxdiff `start_point_event__Q33ipl5scene11AddressEditFPCcPQ33ipl10controller9Interface`: src 0x2d8 base 0x2d8 insns 182/182, diffs 0.
|
||||
- Final ctxdiff `start_trig_event__Q33ipl5scene11AddressEditFPCc`: src 0x1c0 base 0x1c0 insns 112/112, diffs 0.
|
||||
- Final ctxdiff `setDefaultTitleText__Q33ipl5scene11AddressEditFPCwb`: src 0xfc base 0xfc insns 63/63, diffs 0.
|
||||
- Final ctxdiff `Init__Q44nw4r3snd6detail9AxManagerFv`: src 0xfc base 0xfc insns 63/63, diffs 0.
|
||||
- Source commit setting: `3f946af9e6f68553d12314dab89652fd9d0b56be`.
|
||||
- Source commit kitayama: `3896bec3f879af024b8042fe76eaea1284acb85b`.
|
||||
- Source commit address: `7d74f57dec6e658a3e371dbc5e8658e1cf7bd9ab`.
|
||||
- Source commit ax: `fa054a047ec782a46d68ff170a03300d4d67cdb4`.
|
||||
|
||||
## Retained result
|
||||
|
||||
- iplSetting.cpp: removed 11 gotos through region-constant font selection and screen-mode dispatch; renamed render-copy locals. scanAP IRO 1 stays because removal changes 14 instructions. The volatile render copy stays because removing either qualifier changes .text and a normal struct copy also changes sizes and relocations. Both have one-line compiler notes.
|
||||
- iplKitayamaTest.cpp: removed push/IRO 2/pop by giving each write branch its own buffer local. Removed three comments that repeated the statements. Default compiler settings now reproduce the same 464 calcNormal instructions, data, and resolved relocations; only local compiler label names change.
|
||||
- iplAddressEdit.cpp: removed all 47 gotos, dead create_mode_done label, unnecessary common-block scope, and redundant member parentheses. Structured title, keyboard state, fadeout, point, and trigger dispatch retain the original fallthrough and call order. Uses existing keyboard, region, and address-mode constants. All three IRO 1 pragmas stay; removal changes create 329 instructions, get_friendinfo 68, and update_friendinfo 2. Added concise notes explaining the retained settings.
|
||||
- snd_AxManager.cpp: retained IRO 0 because default lowering hoists the indexed voice address and removes one instruction. Three readable loop rewrites also changed bytes. Replaced the unclear uh comment with the specific compiler requirement.
|
||||
- Final full build and report generation passed; DECOMPLETE_OK; DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. All 243 owned functions and all owned sections remain 100%; fresh baseline comparison found 0 regressions in all 1028 units. All 15 focused ctxdiff checks have diffs 0 and equal instruction counts.
|
||||
|
||||
## Final gate
|
||||
|
||||
Command: `python3 /mnt/drive2/projects/wii-ipl-workers/_restore0928-tools/gate.py src/scene/setting/iplSetting src/scene/kitayamaTest/iplKitayamaTest src/scene/address/iplAddressEdit libs/NW4R/src/snd/snd_AxManager --quick`. The cleanup brief explicitly requires --quick.
|
||||
|
||||
```text
|
||||
full build: ok
|
||||
main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
[src/scene/setting/iplSetting] pool: IDENTICAL
|
||||
[src/scene/setting/iplSetting] objdiff: code 37884/37884 data 5696/5696 functions 112/112 fuzzy 100.0000 linked code 37884
|
||||
[src/scene/setting/iplSetting] instruction-exact functions: 112/112
|
||||
[src/scene/setting/iplSetting] section .bss size 456 match 100.0
|
||||
[src/scene/setting/iplSetting] section .data size 4016 match 100.0
|
||||
[src/scene/setting/iplSetting] section .rodata size 640 match 100.0
|
||||
[src/scene/setting/iplSetting] section .sbss size 16 match 100.0
|
||||
[src/scene/setting/iplSetting] section .sdata size 504 match 100.0
|
||||
[src/scene/setting/iplSetting] section .sdata2 size 64 match 100.0
|
||||
[src/scene/setting/iplSetting] section .text size 37884 match 100.0
|
||||
[src/scene/setting/iplSetting] baseline: code 37884/37884 data 5696 functions 112 fuzzy 100.0000
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] pool: IDENTICAL
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] objdiff: code 2520/2520 data 632/632 functions 12/12 fuzzy 100.0000 linked code 2520
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] instruction-exact functions: 12/12
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] section .data size 632 match 100.0
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] section .text size 2520 match 100.0
|
||||
[src/scene/kitayamaTest/iplKitayamaTest] baseline: code 2520/2520 data 632 functions 12 fuzzy 100.0000
|
||||
[src/scene/address/iplAddressEdit] pool: IDENTICAL
|
||||
[src/scene/address/iplAddressEdit] objdiff: code 27112/27112 data 2560/2560 functions 94/94 fuzzy 100.0000 linked code 27112
|
||||
[src/scene/address/iplAddressEdit] instruction-exact functions: 94/94
|
||||
[src/scene/address/iplAddressEdit] section .bss size 320 match 100.0
|
||||
[src/scene/address/iplAddressEdit] section .data size 2152 match 100.0
|
||||
[src/scene/address/iplAddressEdit] section .rodata size 40 match 100.0
|
||||
[src/scene/address/iplAddressEdit] section .sdata size 24 match 100.0
|
||||
[src/scene/address/iplAddressEdit] section .sdata2 size 24 match 100.0
|
||||
[src/scene/address/iplAddressEdit] section .text size 27112 match 100.0
|
||||
[src/scene/address/iplAddressEdit] baseline: code 27112/27112 data 2560 functions 94 fuzzy 100.0000
|
||||
[libs/NW4R/src/snd/snd_AxManager] pool: IDENTICAL
|
||||
[libs/NW4R/src/snd/snd_AxManager] objdiff: code 6364/6364 data 42040/42040 functions 25/25 fuzzy 100.0000 linked code 6364
|
||||
[libs/NW4R/src/snd/snd_AxManager] instruction-exact functions: 25/25
|
||||
[libs/NW4R/src/snd/snd_AxManager] section .bss size 42008 match 100.0
|
||||
[libs/NW4R/src/snd/snd_AxManager] section .sbss size 8 match 100.0
|
||||
[libs/NW4R/src/snd/snd_AxManager] section .sdata2 size 24 match 100.0
|
||||
[libs/NW4R/src/snd/snd_AxManager] section .text size 6364 match 100.0
|
||||
[libs/NW4R/src/snd/snd_AxManager] baseline: code 6364/6364 data 42040 functions 25 fuzzy 100.0000
|
||||
regressions vs baseline: 0
|
||||
global matched_code_percent: 100.00000 -> 100.00000
|
||||
global fuzzy_match_percent: 99.99989 -> 99.99989
|
||||
global complete_code_percent: 100.00000 -> 100.00000
|
||||
global matched_data_percent: 100.00000 -> 100.00000
|
||||
forbidden patterns added (net, per file): 0
|
||||
readability warnings (net, per file; must be 0 in the final result): 0
|
||||
GATE PASS
|
||||
```
|
||||
|
||||
Post-gate report regenerated; DECOMPLETE_OK; DOL SHA1 verified again. Only the assigned source files and this log are committed. Existing untracked files remain untouched. No push, PR, merge, rebase, or cross-worktree edit.
|
||||
91
tools/decomp-assist/cleanup-c5.attempts.md
Normal file
91
tools/decomp-assist/cleanup-c5.attempts.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# cleanup-c5 attempts
|
||||
|
||||
Worktree: `/mnt/drive2/projects/wii-ipl-workers/data-d5`
|
||||
Branch: `agent/w1009/cleanup-c5`
|
||||
Baseline: `f1db6b656e386063a8bc263fb75a299f36ae4803`
|
||||
|
||||
Full build first passed: all 1028 units, 12563 functions, code and data 100% matched and linked.
|
||||
DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d`. Completion check: `DECOMPLETE_OK`.
|
||||
|
||||
## Compiler pragmas
|
||||
|
||||
- Removing all scoped pragmas changed KBDSetModState and kbdProcMod by four register operands each, shortened kbd_led_handler from 25 to 22 instructions, shortened each texture setter by one instruction, and changed FAT32 builder control flow from 222 to 216 instructions. Restored.
|
||||
- Removing only pfd_sddrv_init's IRO 0 scope preserves the entire sd_drv object byte for byte. Accepted.
|
||||
- kbd_lib: remove KBDSetModState IRO 1 only: KBDSetModState: 4 instruction differences. Restored.
|
||||
- kbd_lib: without setter IRO, load modifier directly into bitfield: kbdProcMod: 4 instruction differences; KBDSetModState: 4 instruction differences. Restored.
|
||||
- kbd_lib: without setter IRO, use a word for old modifiers: KBDSetModState: 4 instruction differences. Restored.
|
||||
- kbd_lib: remove kbdProcMod propagation scope only: kbdProcMod: 4 instruction differences. Restored.
|
||||
- kbd_lib: without propagation scope, pass modifiers directly: kbdProcMod: 4 instruction differences. Restored.
|
||||
- kbd_lib: without propagation scope, update modifier word before setter call: kbdProcMod: 256 -> 257 instructions. Restored.
|
||||
- kbd_lib: remove LED IRO 0 only: kbd_led_handler: 25 -> 22 instructions. Restored.
|
||||
- kbd_lib: without LED IRO, select callback result with ternary: kbd_led_handler: 25 -> 22 instructions. Restored.
|
||||
- kbd_lib: without LED IRO, initialize failure and override on success: kbd_led_handler: 25 -> 22 instructions. Restored.
|
||||
- sd_drv: remove FAT32 builder IRO only: pfd_sddrv_full_format: 3 instruction differences; pfd_sddrv_build_fat32_mbr_bpb: 222 -> 216 instructions; .data changed. Restored.
|
||||
- sd_drv: without FAT32 IRO, combine media checks: pfd_sddrv_full_format: 3 instruction differences; pfd_sddrv_build_fat32_mbr_bpb: 222 -> 208 instructions; .data changed. Restored.
|
||||
- sd_drv: without FAT32 IRO, pass write-block arguments directly: pfd_sddrv_full_format: 3 instruction differences; pfd_sddrv_build_fat32_mbr_bpb: 222 -> 216 instructions; .data changed. Restored.
|
||||
- sd_drv: without FAT32 IRO, define reserved-sector helper after caller: pfd_sddrv_full_format: 3 instruction differences; pfd_sddrv_build_fat32_mbr_bpb: 222 -> 216 instructions; .data changed. Restored.
|
||||
- Texture_MCUtoRGBA8: remove setter optimization scope only: TMCJPEGDEC_converterYUV411toRGBA8: 6 instruction differences; TMCJPEGDEC_set_converterRGBA8: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: without setter scope, initialize buffer and state at declaration: TMCJPEGDEC_converterYUV411toRGBA8: 6 instruction differences; TMCJPEGDEC_set_converterRGBA8: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: without setter scope, put row locals in their sampling cases: TMCJPEGDEC_converterYUV411toRGBA8: 6 instruction differences; TMCJPEGDEC_set_converterRGBA8: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: with setter scope retained, put row locals in their sampling cases: TMCJPEGDEC_set_converterRGBA8: 44 instruction differences. Restored.
|
||||
- Texture_MCUtoRGB565: remove setter optimization scope only: TMCJPEGDEC_set_converterRGB565: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGB565: without setter scope, initialize buffer and state at declaration: TMCJPEGDEC_set_converterRGB565: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGB565: without setter scope, put row locals in their sampling cases: TMCJPEGDEC_set_converterRGB565: 170 -> 169 instructions. Restored.
|
||||
- Texture_MCUtoRGB565: with setter scope retained, put row locals in their sampling cases: TMCJPEGDEC_set_converterRGB565: 44 instruction differences. Restored.
|
||||
- Texture_MCUtoY8U8V8: remove setter optimization scope only: TMCJPEGDEC_set_converterY8U8V8: 196 -> 195 instructions. Restored.
|
||||
- Texture_MCUtoY8U8V8: without setter scope, initialize buffer and state at declaration: TMCJPEGDEC_set_converterY8U8V8: 196 -> 195 instructions. Restored.
|
||||
- Texture_MCUtoY8U8V8: without setter scope, put row locals in their sampling cases: TMCJPEGDEC_set_converterY8U8V8: 196 -> 195 instructions. Restored.
|
||||
- Texture_MCUtoY8U8V8: with setter scope retained, put row locals in their sampling cases: TMCJPEGDEC_set_converterY8U8V8: 58 instruction differences. Restored.
|
||||
- kbd_lib: retain propagation scope, remove finalState temporary: whole object identical. Accepted.
|
||||
- kbd_lib: retain setter IRO, replace old union with modifier word: object metadata or relocation bytes changed. Restored.
|
||||
- kbd_lib: remove channel initialization overwritten by for loops: whole object identical. Accepted.
|
||||
- sd_drv: store aligned little-endian words through the typed field: pfd_sddrv_store_bpb_buf: 4 instruction differences; pfd_sddrv_store_mbr_buf: 2 instruction differences; pfd_sddrv_store_fat32_mbr_buf: 2 instruction differences; pfd_sddrv_store_fat32_bpb_buf: 4 instruction differences. Restored.
|
||||
- sd_drv: use format and settings sizes in memset calls: whole object identical. Accepted.
|
||||
- sd_drv: use existing SDDev type size instead of 0x28: whole object identical. Accepted.
|
||||
- Texture_MCUtoRGBA8: separate first-store output and tile-row assignments: TMCJPEGDEC_converterYUV411toRGBA8: 242 -> 243 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: separate first-store assignments in row-before-output order: TMCJPEGDEC_converterYUV411toRGBA8: 242 -> 243 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: compute output and tile-row addresses once per row: TMCJPEGDEC_converterYUV411toRGBA8: 5 instruction differences. Restored.
|
||||
- Texture_MCUtoRGBA8: separate first-store assignments with row-scoped tileRow: compile failed. Restored.
|
||||
- kbd_lib: retain setter IRO, use a word for old modifiers with metadata-aware comparison: all code, data, symbols and relocations identical; only compiler string metadata changed. Accepted.
|
||||
- Texture_MCUtoRGBA8: separate first-store assignments with a row-local tileRow, corrected scope: TMCJPEGDEC_converterYUV411toRGBA8: 242 -> 243 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: write opaque-alpha red words with a bit mask: TMCJPEGDEC_converterYUV411toRGBA8: 242 -> 238 instructions; TMCJPEGDEC_converterYUV411toRGBA8edge: 112 -> 111 instructions; TMCJPEGDEC_converterYUV422toRGBA8: 148 -> 146 instructions; TMCJPEGDEC_converterYUV422toRGBA8edge: 113 -> 112 instructions; TMCJPEGDEC_converterYUV420toRGBA8: 153 -> 151 instructions; TMCJPEGDEC_converterYUV420toRGBA8edge: 120 -> 119 instructions; TMCJPEGDEC_converterYUV211toRGBA8: 104 -> 103 instructions; TMCJPEGDEC_converterYUV211toRGBA8edge: 115 -> 114 instructions; TMCJPEGDEC_converterYUV444toRGBA8: 97 -> 96 instructions; TMCJPEGDEC_converterYUV444toRGBA8edge: 110 -> 109 instructions; TMCJPEGDEC_converterYUV400toRGBA8: 76 -> 75 instructions; TMCJPEGDEC_converterYUV400toRGBA8edge: 89 -> 88 instructions. Restored.
|
||||
- Texture_MCUtoRGBA8: remove cancelling high-word addition from opaque-alpha stores: TMCJPEGDEC_converterYUV411toRGBA8: 242 -> 238 instructions; TMCJPEGDEC_converterYUV411toRGBA8edge: 112 -> 111 instructions; TMCJPEGDEC_converterYUV422toRGBA8: 148 -> 146 instructions; TMCJPEGDEC_converterYUV422toRGBA8edge: 113 -> 112 instructions; TMCJPEGDEC_converterYUV420toRGBA8: 153 -> 151 instructions; TMCJPEGDEC_converterYUV420toRGBA8edge: 120 -> 119 instructions; TMCJPEGDEC_converterYUV211toRGBA8: 104 -> 103 instructions; TMCJPEGDEC_converterYUV211toRGBA8edge: 115 -> 114 instructions; TMCJPEGDEC_converterYUV444toRGBA8: 97 -> 96 instructions; TMCJPEGDEC_converterYUV444toRGBA8edge: 110 -> 109 instructions; TMCJPEGDEC_converterYUV400toRGBA8: 76 -> 75 instructions; TMCJPEGDEC_converterYUV400toRGBA8edge: 89 -> 88 instructions. Restored.
|
||||
|
||||
## Retained changes
|
||||
|
||||
- kbd_lib.c: removed three channel assignments overwritten by their for-loop initializers and the finalState copy. Old modifier state is now a u32 instead of a union used only as a word. Only compiler-generated label strings change in the object; code, data, symbol offsets and relocations remain identical.
|
||||
- sd_drv.c: removed the pfd_sddrv_init IRO scope; replaced format/settings/device memset lengths with sizeof of the existing types. The complete object remains identical.
|
||||
- All three texture setters retain optimization_level 1: ordinary default optimization folds away the shared conversion-buffer base and changes register allocation. Function-local declarations in the sampling cases also change the registers.
|
||||
- Keyboard scopes remain: default optimization swaps four register operands in each modifier function and eliminates the LED handler callback reload and conditional branch.
|
||||
- FAT32 builder IRO 0 remains: ordinary optimization eliminates its reserved-sector error path and the associated strings. Direct field stores also change boot-sector addressing.
|
||||
- RGBA8 first-store assignments and full-width alpha arithmetic remain: separate statements add an instruction; opaque-alpha bit masks or cancelling-add removal shorten all converters.
|
||||
- Added one-line MWCC requirements at the retained scopes and tested source workarounds.
|
||||
|
||||
## File commits
|
||||
|
||||
- `3537cc8576f8ce2d979e324c3d55f9b4769fb334`: `libs/RVL_SDK/src/kbd/kbd_lib.c`.
|
||||
- `0ae3719590c72c0c4787f52c80e727fade3c4b1b`: `libs/RVL_SDK/src/fa/driver/sd_drv.c`.
|
||||
- `d19ec502fdac3a027222ce4f3f0cb1b6d84df9f2`: `libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8.c`.
|
||||
- `fbbb88ed142ee16e15bce96ac0a5f3fadc7b567b`: `libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGB565.c`.
|
||||
- `7ed8b7edf17ed04f9050a032a68590dbf6bcefb9`: `libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoY8U8V8.c`.
|
||||
|
||||
The leaf checker run from this assigned worktree rejects its own current directory as the integration root. Git worktree records independently confirm the assigned leaf path and branch; parent integration must run that checker from its integration tree. No other worktree was changed.
|
||||
|
||||
## Final validation
|
||||
|
||||
`gate.py` ran once at the end over all five assigned units with `--quick`.
|
||||
|
||||
- full build: ok
|
||||
- main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
|
||||
- regressions vs baseline: 0
|
||||
- forbidden patterns added (net, per file): 0
|
||||
- readability warnings (net, per file; must be 0 in the final result): 0
|
||||
- GATE PASS
|
||||
- Fresh `build/43U/report.json` and completion checker: `DECOMPLETE_OK`.
|
||||
- `kbd_lib`: 21/21 exact functions; all code, data, sections and link measures 100%.
|
||||
- `sd_drv`: 26/26 exact functions; all code, data, sections and link measures 100%.
|
||||
- `Texture_MCUtoRGBA8`: 13/13 exact functions; all code, data, sections and link measures 100%.
|
||||
- `Texture_MCUtoRGB565`: 13/13 exact functions; all code, data, sections and link measures 100%.
|
||||
- `Texture_MCUtoY8U8V8`: 13/13 exact functions; all code, data, sections and link measures 100%.
|
||||
- Baseline-to-final object comparison: SD and all three texture objects are fully identical; keyboard differs only in compiler label strings, with code/data/symbol offsets/relocations identical.
|
||||
- No source, headers or configuration outside the five assigned files changed; no pushes, PRs, merges or rebases.
|
||||
171
tools/decomp-assist/cleanup-c6.attempts.md
Normal file
171
tools/decomp-assist/cleanup-c6.attempts.md
Normal file
@@ -0,0 +1,171 @@
|
||||
# cleanup-c6 attempts
|
||||
|
||||
Worktree `/mnt/drive2/projects/wii-ipl-workers/data-d7`, branch `agent/w1009/cleanup-c6`, baseline `f1db6b65`.
|
||||
|
||||
Initial full 43U build passed. DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`; completion checker `DECOMPLETE_OK`. Every owned unit is Matching and every code/data/function measure is 100%.
|
||||
|
||||
Compare each compiled trial with the baseline object, including every loadable section and normalized relocation. Restore every trial that changes bytes. Prior o2-bs2mach, o3-small, o4-aosslink and sol-audit logs explain the existing compiler constraints.
|
||||
|
||||
## Compiled trials
|
||||
|
||||
- dvd-state-declaration: Declare DVDCommandBlock.state volatile and remove every owned per-use cast. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 4 diffs, 1940/1940 instructions"]}, {"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [], "functions": []}].
|
||||
|
||||
- dvd-qualified-local-pointers: Use const volatile local block views for asynchronous state reads, keeping ordinary state writes. Build 2; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 4 diffs, 1940/1940 instructions"]}, {"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [], "functions": []}].
|
||||
|
||||
- dvd-qualified-local-scopes: Declare asynchronous read views at the start of C scopes. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["BS2StartGCGame: 5 diffs, 228/228 instructions", "BS2StartGame: 5 diffs, 393/393 instructions", "BS2Tick: 417 diffs, 1941/1940 instructions"]}, {"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [], "functions": []}].
|
||||
|
||||
- bs2-cover-late-view: Assign the asynchronous read view after StartingGame, limiting its lifetime to polling. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2StartGCGame: 5 diffs, 228/228 instructions", "BS2StartGame: 5 diffs, 393/393 instructions"]}].
|
||||
|
||||
- bs2-flag-DvdReadPending: Remove only DvdReadPending declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2DVDCallback: 5 diffs, 81/81 instructions", "BS2Tick: 2 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-StartingGame: Remove only StartingGame declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2StartGCGame: 5 diffs, 228/228 instructions", "BS2StartGame: 5 diffs, 393/393 instructions"]}].
|
||||
|
||||
- bs2-flag-RestartRequested: Remove only RestartRequested declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 5 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-PartitionOpen: Remove only PartitionOpen declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 3 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-LoadingTitle: Remove only LoadingTitle declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 2 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-FatalErrorFlag: Remove only FatalErrorFlag declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 2 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-AbortFlag: Remove only AbortFlag declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 3 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-CacheFailed: Remove only CacheFailed declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2NANDCallback: 3 diffs, 25/25 instructions"]}].
|
||||
|
||||
- bs2-flag-RegionValid: Remove only RegionValid declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2Tick: 3 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-NandPending: Remove only NandPending declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2StartGCGame: 1 diffs, 228/228 instructions", "BS2StartGame: 1 diffs, 393/393 instructions", "CheckBS2CommandStatus: 69 diffs, 406/406 instructions"]}].
|
||||
|
||||
- bs2-flag-CancelNand: Remove only CancelNand declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2NANDDivideCallback: 3 diffs, 128/128 instructions"]}].
|
||||
|
||||
- bs2-flag-LowReadResult: Remove only LowReadResult declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["BS2StartGame: 165 diffs, 389/393 instructions"]}].
|
||||
|
||||
- bs2-flag-DvdTransferred: Remove only DvdTransferred declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2DVDCallback: 2 diffs, 81/81 instructions", "BS2Tick: 4 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-DvdTransferLength: Remove only DvdTransferLength declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2DVDCallback: 3 diffs, 81/81 instructions", "BS2Tick: 6 diffs, 1940/1940 instructions"]}].
|
||||
|
||||
- bs2-flag-BannerLength: Remove only BannerLength declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["BS2Tick: 611 diffs, 1939/1940 instructions", "CheckBS2CommandStatus: 64 diffs, 403/406 instructions"]}].
|
||||
|
||||
- bs2-flag-CacheLength: Remove only CacheLength declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["CheckBS2CommandStatus: 321 diffs, 396/406 instructions"]}].
|
||||
|
||||
- bs2-flag-LoaderLength: Remove only LoaderLength declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["CheckBS2CommandStatus: 88 diffs, 405/406 instructions"]}].
|
||||
|
||||
- bs2-flag-NandCompletion: Remove only NandCompletion declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2NANDDivideCallback: 5 diffs, 128/128 instructions", "BS2NANDDivideReadAsync: 10 diffs, 47/47 instructions", "BS2NANDDivideWriteAsync: 10 diffs, 47/47 instructions"]}].
|
||||
|
||||
- bs2-flag-NandOperation: Remove only NandOperation declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.text", ".text"], "functions": ["BS2NANDDivideReadAsync: 6 diffs, 47/47 instructions", "BS2NANDDivideWriteAsync: 6 diffs, 47/47 instructions"]}].
|
||||
|
||||
- bs2-flag-NandLength: Remove only NandLength declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["BS2NANDDivideCallback: 69 diffs, 125/128 instructions", "BS2NANDDivideReadAsync: 41 diffs, 45/47 instructions", "BS2NANDDivideWriteAsync: 41 diffs, 45/47 instructions"]}].
|
||||
|
||||
- bs2-flag-NandTransferred: Remove only NandTransferred declaration volatility. Build 0; [{"unit": "src/BS2/BS2Mach", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["BS2NANDDivideCallback: 108 diffs, 124/128 instructions", "BS2NANDDivideReadAsync: 4 diffs, 47/47 instructions", "BS2NANDDivideWriteAsync: 4 diffs, 47/47 instructions"]}].
|
||||
|
||||
- bs2-state-inline-helper: Read asynchronous state through an inline function with a qualified parameter. Build 0; all loadable sections and relocations identical.
|
||||
|
||||
- dvd-all-state-reads-qualified: Use the same const volatile local view for every status read in DVDGetCommandBlockStatus. Build 0; all loadable sections and relocations identical.
|
||||
|
||||
- dvd-flag-CommandInfoCounter: Remove only CommandInfoCounter declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.sdata", ".rela.text", ".text"], "functions": ["ResetAlarmHandler: 128 diffs, 132/148 instructions", "StampCommand: 31 diffs, 37/45 instructions", "StampIntType: 11 diffs, 24/25 instructions", "cbForStateBusy: 611 diffs, 623/632 instructions", "cbForStateCheckID1: 99 diffs, 113/114 instructions", "cbForStateCheckID2: 91 diffs, 100/101 instructions", "cbForStateCoverClosed: 40 diffs, 53/54 instructions", "cbForStateDownRotation: 130 diffs, 135/144 instructions", "cbForStateGettingError: 302 diffs, 304/321 instructions", "cbForStateGoToRetry: 129 diffs, 143/144 instructions", "cbForStateOpenPartition: 85 diffs, 90/98 instructions", "cbForStateOpenPartition2: 75 diffs, 88/89 instructions", "cbForStateReadingFST: 81 diffs, 88/97 instructions", "cbForStateReadingPartitionInfo: 269 diffs, 271/286 instructions", "cbForStateReadingTOC: 90 diffs, 96/104 instructions", "cbForStoreErrorCode3: 38 diffs, 41/49 instructions", "cbForUnrecoveredError: 104 diffs, 103/120 instructions", "cbForUnrecoveredErrorRetry: 39 diffs, 52/53 instructions", "stateBusy: 340 diffs, 340/364 instructions", "stateCheckID: 176 diffs, 177/206 instructions", "stateCoverClosed_CMD: 46 diffs, 86/94 instructions", "stateDownRotation: 37 diffs, 42/50 instructions", "stateReadingFST: 53 diffs, 86/94 instructions"]}].
|
||||
|
||||
- dvd-flag-ResumeFromHere: Remove only ResumeFromHere declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["cbForStateGoToRetry: 2 diffs, 144/144 instructions", "stateReady: 150 diffs, 201/202 instructions"]}].
|
||||
|
||||
- dvd-flag-NumInternalRetry: Remove only NumInternalRetry declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["CategorizeError: 25 diffs, 60/61 instructions", "ResetAlarmHandler: 3 diffs, 148/148 instructions", "cbForStateBusy: 6 diffs, 632/632 instructions", "cbForStateCheckID1: 3 diffs, 114/114 instructions", "cbForStateDownRotation: 3 diffs, 144/144 instructions", "cbForStateGoToRetry: 3 diffs, 144/144 instructions", "cbForStateOpenPartition2: 3 diffs, 89/89 instructions", "stateCoverClosed_CMD: 3 diffs, 94/94 instructions"]}].
|
||||
|
||||
- dvd-flag-__DVDLayoutFormat: Remove only __DVDLayoutFormat declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["cbForStateCheckID2: 43 diffs, 99/101 instructions", "stateReadingFST: 67 diffs, 92/94 instructions"]}].
|
||||
|
||||
- dvd-flag-__BS2DVDLowIntType: Remove only __BS2DVDLowIntType declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["__DVDGetCoverStatus: 42 diffs, 51/50 instructions", "__DVDResetWithNoSpinup: 8 diffs, 19/17 instructions"]}].
|
||||
|
||||
- dvd-flag-CurrCommand: Remove only CurrCommand declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["cbForPrepareCoverRegister: 5 diffs, 98/98 instructions", "cbForStateBusy: 588 diffs, 618/632 instructions", "cbForStateGoToRetry: 100 diffs, 136/144 instructions", "stateReady: 162 diffs, 199/202 instructions"]}].
|
||||
|
||||
- aoss-remove-first-guard: Remove the first constant guard with no other logic change. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".text"], "functions": ["AOSSi_WLANConnect: 2 diffs, 155/155 instructions"]}].
|
||||
|
||||
- aoss-result-before-ssid: Initialize result before-ssid without a constant guard. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 2 diffs, 155/155 instructions", "AOSSi_WLANGetBSSList: 87 diffs, 226/227 instructions"]}].
|
||||
|
||||
- aoss-result-before-first-memset: Initialize result before-first-memset without a constant guard. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 2 diffs, 155/155 instructions", "AOSSi_WLANGetBSSList: 87 diffs, 226/227 instructions"]}].
|
||||
|
||||
- aoss-result-after-ip-memset: Initialize result after-ip-memset without a constant guard. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 109 diffs, 154/155 instructions", "AOSSi_WLANGetBSSList: 87 diffs, 226/227 instructions"]}].
|
||||
|
||||
- aoss-result-before-ip-submit: Initialize result before-ip-submit without a constant guard. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 47 diffs, 155/155 instructions", "AOSSi_WLANGetBSSList: 87 diffs, 226/227 instructions"]}].
|
||||
|
||||
- aoss-result-at-declaration: Initialize result at declaration and remove the first guard. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 2 diffs, 155/155 instructions", "AOSSi_WLANGetBSSList: 87 diffs, 226/227 instructions"]}].
|
||||
|
||||
- mbr-const-input: Use an ordinary const input buffer. Build 0; [{"unit": "libs/RVL_SDK/src/fa/pdm_partition", "sections": [".text"], "functions": ["pdm_part_is_master_boot_sector: 26 diffs, 84/84 instructions"]}].
|
||||
|
||||
- mbr-byte-locals: Name all four ordinary byte reads before assembling each sector value. Build 0; [{"unit": "libs/RVL_SDK/src/fa/pdm_partition", "sections": [".text"], "functions": ["pdm_part_is_master_boot_sector: 26 diffs, 84/84 instructions"]}].
|
||||
|
||||
- mbr-sequential-accumulation: Decode each little-endian word through a plain inline accumulator. Build 0; [{"unit": "libs/RVL_SDK/src/fa/pdm_partition", "sections": [".text"], "functions": ["pdm_part_is_master_boot_sector: 45 diffs, 84/84 instructions"]}].
|
||||
|
||||
The first five result-placement trials also removed an earlier BSS-list assignment because their text replacement was not scoped to WLANConnect. Those trials were discarded; the following trials restrict every edit to WLANConnect.
|
||||
|
||||
- aoss-scoped-before-ssid: Move result initialization before-ssid within WLANConnect only. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 8 diffs, 155/155 instructions"]}].
|
||||
|
||||
- aoss-scoped-before-first-memset: Move result initialization before-first-memset within WLANConnect only. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 71 diffs, 155/155 instructions"]}].
|
||||
|
||||
- aoss-scoped-after-ip-memset: Move result initialization after-ip-memset within WLANConnect only. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 109 diffs, 154/155 instructions"]}].
|
||||
|
||||
- aoss-scoped-before-ip-submit: Move result initialization before-ip-submit within WLANConnect only. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 47 diffs, 155/155 instructions"]}].
|
||||
|
||||
- aoss-scoped-declaration: Initialize WLANConnect result at declaration. Build 0; [{"unit": "src/scene/setting/AOSSLink", "sections": [".rela.text", ".text"], "functions": ["AOSSi_WLANConnect: 71 diffs, 155/155 instructions"]}].
|
||||
|
||||
- pud-flat-fallback-at-declaration: Remove the carrier and unread pointer, initializing the scalar fallback at declaration. Build 0; [{"unit": "libs/RVLMiddleware/eZiText/src/clib/zi8pud2", "sections": [".rela.text", ".relaextabindex", ".text", "extabindex"], "functions": ["Zi8MatchPUDdata_ZHS: 339 diffs, 353/354 instructions"]}].
|
||||
|
||||
- pud-live-error-workspace: Replace the carrier with scalar locals and use the saved workspace in every error-report call. Build 0; [{"unit": "libs/RVLMiddleware/eZiText/src/clib/zi8pud2", "sections": [".rela.text", ".relaextabindex", ".text", "extab", "extabindex"], "functions": ["Zi8MatchPUDdata_ZHS: 293 diffs, 364/354 instructions"]}].
|
||||
|
||||
- pud-small-fallback: Remove the unread pointer and represent the fallback as a byte flag. Build 0; [{"unit": "libs/RVLMiddleware/eZiText/src/clib/zi8pud2", "sections": [".rela.text", ".relaextabindex", ".text", "extabindex"], "functions": ["Zi8MatchPUDdata_ZHS: 339 diffs, 353/354 instructions"]}].
|
||||
|
||||
- dvd-flag-PauseFlag: Remove only PauseFlag declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["DVDCancelAllAsync: 3 diffs, 59/59 instructions", "DVDResume: 3 diffs, 20/20 instructions", "__DVDPrepareReset: 3 diffs, 77/77 instructions", "__DVDPrepareResetAsync: 3 diffs, 71/71 instructions"]}].
|
||||
|
||||
- dvd-flag-PausingFlag: Remove only PausingFlag declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["DVDCancelAllAsync: 3 diffs, 59/59 instructions", "DVDResume: 3 diffs, 20/20 instructions", "__DVDPrepareReset: 3 diffs, 77/77 instructions", "__DVDPrepareResetAsync: 3 diffs, 71/71 instructions"]}].
|
||||
|
||||
- dvd-flag-Canceling: Remove only Canceling declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["ResetAlarmHandler: 3 diffs, 148/148 instructions", "cbForStateCheckID1: 3 diffs, 114/114 instructions", "cbForStateDownRotation: 3 diffs, 144/144 instructions", "cbForStateGoToRetry: 2 diffs, 144/144 instructions", "cbForStateOpenPartition2: 3 diffs, 89/89 instructions", "stateCoverClosed_CMD: 3 diffs, 94/94 instructions"]}].
|
||||
|
||||
- dvd-flag-WaitingForCoverOpen: Remove only WaitingForCoverOpen declaration volatility. Build 0; all loadable sections and relocations identical.
|
||||
|
||||
- dvd-flag-WaitingForCoverClose: Remove only WaitingForCoverClose declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.data", ".rela.text", ".text"], "functions": ["cbForPrepareCoverRegister: 85 diffs, 97/98 instructions"]}].
|
||||
|
||||
- dvd-flag-PreparingCover: Remove only PreparingCover declaration volatility. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["cbForPrepareCoverRegister: 2 diffs, 98/98 instructions"]}].
|
||||
|
||||
- dvd-flag-Prepared: Remove only Prepared declaration volatility. Build 2; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["cbForPrepareCoverRegister: 2 diffs, 98/98 instructions"]}].
|
||||
|
||||
- dvd-flag-Prepared: Remove only Prepared declaration volatility. Build 2; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["cbForPrepareCoverRegister: 2 diffs, 98/98 instructions"]}].
|
||||
|
||||
- dvd-flag-Prepared-declarations: Remove volatility from both declarations of Prepared. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".text"], "functions": ["__DVDPrepareReset: 1 diffs, 77/77 instructions"]}].
|
||||
|
||||
- dvd-LastResetEnd: Remove declaration volatility from the shared reset timestamp. Build 0; [{"unit": "libs/RVL_SDK/src/dvd/dvd", "sections": [".rela.text", ".text"], "functions": ["__DVDGetCoverStatus: 12 diffs, 50/50 instructions", "cbForStateBusy: 12 diffs, 632/632 instructions"]}].
|
||||
|
||||
## Retained changes
|
||||
|
||||
- BS2Mach: replace all three DVD state casts with BS2ReadDVDState, an inline reader taking a const volatile block. All sections and relocations stay identical. Keep all 21 flag qualifiers; removing any one changes code. Add one compiler-ordering comment for the flags.
|
||||
- dvd.c: replace both per-use casts with a const volatile local block view and use it for all status reads. Keep interrupt-shared qualifiers. WaitingForCoverOpen alone is byte-identical without its qualifier, but asynchronous callbacks write it while cancellation/state routines read it; preserve that source contract. The initial Prepared trial removed only one of its two declarations and failed compilation; the corrected two-declaration trial changes one instruction.
|
||||
- dvd.h: retain an ordinary state field and explain the read/store distinction in one line. Declaring the field volatile changes BS2Tick by four instructions.
|
||||
- pdm_partition: retain the volatile input parameter with a one-line comment. The three plain-buffer alternatives change 26, 26 and 45 instructions.
|
||||
- AOSSLink: retain the constant first-step guard with a one-line comment. Removing it changes two scheduled instructions; scoped result initialization alternatives also fail exactness.
|
||||
- zi8pud2: retain the carrier and unread pointer store with one explanatory line. Honest removal loses the target store and gives 353/354 instructions. A real workspace use adds loads and gives 364/354.
|
||||
|
||||
No function-scoped optimization pragmas occur in the owned files. No trial change that alters code, data or relocations is retained.
|
||||
|
||||
- final-owned-objects: Rebuild all owned objects after the accepted cleanup and explanatory comments. Build 0; all loadable sections and relocations identical.
|
||||
|
||||
## Final verification
|
||||
|
||||
`gate.py src/BS2/BS2Mach libs/RVL_SDK/src/dvd/dvd libs/RVL_SDK/src/fa/pdm_partition src/scene/setting/AOSSLink libs/RVLMiddleware/eZiText/src/clib/zi8pud2 --quick`: **GATE PASS**, 0 regressions, 0 added forbidden patterns, 0 readability warnings. Full build passed; every owned section is 100%.
|
||||
|
||||
The new DVD local view triggers one advisory volatile-declaration note. Its entire unit is byte-identical to baseline and DVDGetCommandBlockStatus is 50/50 instructions, diffs 0. It replaces casts with a qualified declaration and introduces no use-site cast.
|
||||
|
||||
| Unit | Exact functions before/after | Code/data and linked code/data | Pool |
|
||||
| --- | --- | --- | --- |
|
||||
| BS2Mach | 29/29 -> 29/29 | 100% | 91/91 identical |
|
||||
| dvd | 65/65 -> 65/65 | 100% | 1/1 identical |
|
||||
| pdm_partition | 20/20 -> 20/20 | 100% | empty, identical |
|
||||
| AOSSLink | 14/14 -> 14/14 | 100% | empty, identical |
|
||||
| zi8pud2 | 7/7 -> 7/7 | 100% | empty, identical |
|
||||
|
||||
Fresh ctxdiff checks: BS2StartGame 393/393, BS2StartGCGame 228/228, BS2Tick 1940/1940, DVDGetCommandBlockStatus 50/50, pdm_part_is_master_boot_sector 84/84, AOSSi_WLANConnect 155/155, Zi8MatchPUDdata_ZHS 354/354. All report diffs 0.
|
||||
|
||||
Fresh report generation completed; completion checker **DECOMPLETE_OK**. DOL SHA1 `26116613f624061ba99c8d1a299aaa6efa85670d`. Git diff whitespace check passed. Gate log `/tmp/cleanup-c6-gate.log`; focused checks `/tmp/cleanup-c6-focused-validation.log`.
|
||||
|
||||
## Source commits
|
||||
|
||||
- `bf57e7f5` src/BS2/BS2Mach.c
|
||||
- `5f4657c3` libs/RVL_SDK/src/dvd/dvd.c
|
||||
- `1215b163` libs/RVL_SDK/include/revolution/dvd.h
|
||||
- `bf52561d` libs/RVL_SDK/src/fa/pdm_partition.c
|
||||
- `008d7688` src/scene/setting/AOSSLink.c
|
||||
- `b3c7f9ba` libs/RVLMiddleware/eZiText/src/clib/zi8pud2.c
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user