Compare commits

..

1 Commits

Author SHA1 Message Date
coah
87a084da31 cleanup(iplSettingButton): rename Unk ring-buffer placeholders
Unk -> CmdEntry; unk_0x64 -> mCmdQueue; capacity/count/read/write
indices. Byte-identical (DOL sha1 unchanged).
2026-10-02 14:06:01 -05:00
135 changed files with 1565 additions and 17802 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start --> <!-- progress:start -->
| Decompiled | Matched | Linked | Data | | Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:| |:---:|:---:|:---:|:---:|
| 99.59% | 91.16% | 74.57% | 99.56% | | 99.59% | 90.81% | 71.43% | 99.37% |
units 964/1027 complete, functions 12378/12563 matched. units 956/1027 complete, functions 12365/12563 matched.
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end --> <!-- progress:end -->

View File

@@ -37,9 +37,6 @@ force_active:
# textinput::toolbar::csPaneToAnimation points one past the end of csAninationFile. # textinput::toolbar::csPaneToAnimation points one past the end of csAninationFile.
block_relocations: block_relocations:
# Run establishes a fixed stack at 0x81600000, not __pformatter + 0x280.
- source: .text:0x8137B468
- source: .text:0x8137B46C
- source: .data:0x8165E15C - source: .data:0x8165E15C
- source: .data:0x8165E19C - source: .data:0x8165E19C

View File

@@ -13904,15 +13904,10 @@ lbl_81610608 = .rodata:0x81610608; // type:object size:0x300
lbl_81610908 = .rodata:0x81610908; // type:object size:0x10 lbl_81610908 = .rodata:0x81610908; // type:object size:0x10
sCaptureSizes__Q23ipl5scene = .rodata:0x81610918; // type:object size:0x10 sCaptureSizes__Q23ipl5scene = .rodata:0x81610918; // type:object size:0x10
lbl_81610928 = .rodata:0x81610928; // type:object size:0x20 data:4byte lbl_81610928 = .rodata:0x81610928; // type:object size:0x20 data:4byte
scAnmTable__Q23ipl5scene = .rodata:0x81610948; // type:object size:0xE8 scope:local scAnmTable__Q23ipl5scene = .rodata:0x81610948; // type:object size:0x1A8 scope:local
@17203 = .rodata:0x81610A30; // type:object size:0x1C scope:local lbl_81610AF0 = .rodata:0x81610AF0; // type:object size:0x30 data:4byte
@17212 = .rodata:0x81610A4C; // type:object size:0x30 scope:local lbl_81610B20 = .rodata:0x81610B20; // type:object size:0x60 data:4byte
@17223 = .rodata:0x81610A7C; // type:object size:0x28 scope:local lbl_81610B80 = .rodata:0x81610B80; // type:object size:0x20 data:wstring
@17227 = .rodata:0x81610AA4; // type:object size:0x30 scope:local
@17254 = .rodata:0x81610AD4; // type:object size:0x1C scope:local
@18816 = .rodata:0x81610AF0; // type:object size:0x30 scope:local data:4byte
@18818 = .rodata:0x81610B20; // type:object size:0x60 scope:local data:4byte
@19272 = .rodata:0x81610B80; // type:object size:0x20 scope:local data:wstring
scNumber__Q23ipl5scene = .rodata:0x81610BA0; // type:object size:0x14 scope:local data:2byte scNumber__Q23ipl5scene = .rodata:0x81610BA0; // type:object size:0x14 scope:local data:2byte
scNumber2__Q23ipl5scene = .rodata:0x81610BB4; // type:object size:0x14 scope:local data:2byte scNumber2__Q23ipl5scene = .rodata:0x81610BB4; // type:object size:0x14 scope:local data:2byte
lbl_81610BC8 = .rodata:0x81610BC8; // type:object size:0x1000 lbl_81610BC8 = .rodata:0x81610BC8; // type:object size:0x1000
@@ -17170,23 +17165,7 @@ sSettingAPPaneNames__Q23ipl5scene = .data:0x81656978; // type:object size:0x68 d
sSettingAPAnimations__Q23ipl5scene = .data:0x81656B6C; // type:object size:0x4C data:4byte sSettingAPAnimations__Q23ipl5scene = .data:0x81656B6C; // type:object size:0x4C data:4byte
@25442 = .data:0x81656BB8; // type:object size:0xF scope:local data:string @25442 = .data:0x81656BB8; // type:object size:0xF scope:local data:string
@25443 = .data:0x81656BC7; // type:object size:0x1C scope:local data:string @25443 = .data:0x81656BC7; // type:object size:0x1C scope:local data:string
@25501 = .data:0x81656BE3; // type:object size:0xF scope:local data:string
@25502 = .data:0x81656BF2; // type:object size:0x14 scope:local data:string
@25503 = .data:0x81656C06; // type:object size:0x18 scope:local data:string
@25505 = .data:0x81656C1E; // type:object size:0x1A scope:local data:string
@25506 = .data:0x81656C38; // type:object size:0x13 scope:local data:string
@25508 = .data:0x81656C4B; // type:object size:0x9 scope:local data:string
@25509 = .data:0x81656C54; // type:object size:0x12 scope:local data:string
@25510 = .data:0x81656C66; // type:object size:0xC scope:local data:string
@25616 = .data:0x81656C72; // type:object size:0xD scope:local data:string
@25618 = .data:0x81656C7F; // type:object size:0xF scope:local data:string @25618 = .data:0x81656C7F; // type:object size:0xF scope:local data:string
@25620 = .data:0x81656C8E; // type:object size:0x14 scope:local data:string
@25621 = .data:0x81656CA2; // type:object size:0x1A scope:local data:string
@25622 = .data:0x81656CBC; // type:object size:0x19 scope:local data:string
@25623 = .data:0x81656CD5; // type:object size:0xE scope:local data:string
@25624 = .data:0x81656CE3; // type:object size:0x13 scope:local data:string
@25625 = .data:0x81656CF6; // type:object size:0x18 scope:local data:string
@25628 = .data:0x81656D0E; // type:object size:0x19 scope:local data:string
@17193 = .data:0x81656D27; // type:object size:0xC scope:local data:string @17193 = .data:0x81656D27; // type:object size:0xC scope:local data:string
@17194 = .data:0x81656D33; // type:object size:0x20 scope:local data:string @17194 = .data:0x81656D33; // type:object size:0x20 scope:local data:string
@17197 = .data:0x81656D53; // type:object size:0xD scope:local data:string @17197 = .data:0x81656D53; // type:object size:0xD scope:local data:string
@@ -17200,32 +17179,10 @@ sSettingAPAnimations__Q23ipl5scene = .data:0x81656B6C; // type:object size:0x4C
@17250 = .data:0x81656DFA; // type:object size:0x11 scope:local data:string @17250 = .data:0x81656DFA; // type:object size:0x11 scope:local data:string
@17251 = .data:0x81656E0B; // type:object size:0x9 scope:local data:string @17251 = .data:0x81656E0B; // type:object size:0x9 scope:local data:string
@17252 = .data:0x81656E14; // type:object size:0xD scope:local data:string @17252 = .data:0x81656E14; // type:object size:0xD scope:local data:string
@25720 = .data:0x81656E21; // type:object size:0x23 scope:local data:string
@25721 = .data:0x81656E44; // type:object size:0xD scope:local data:string
@25722 = .data:0x81656E51; // type:object size:0xD scope:local data:string
@25723 = .data:0x81656E5E; // type:object size:0xD scope:local data:string
@25724 = .data:0x81656E6B; // type:object size:0x25 scope:local data:string
@25726 = .data:0x81656E90; // type:object size:0x15 scope:local data:string
@25747 = .data:0x81656EA5; // type:object size:0x1B scope:local data:string @25747 = .data:0x81656EA5; // type:object size:0x1B scope:local data:string
@25766 = .data:0x81656EC0; // type:object size:0x1D scope:local data:string
@25767 = .data:0x81656EDD; // type:object size:0x11 scope:local data:string
@25768 = .data:0x81656EEE; // type:object size:0x1D scope:local data:string
@26292 = .data:0x81656F0B; // type:object size:0xF scope:local data:string @26292 = .data:0x81656F0B; // type:object size:0xF scope:local data:string
@26293 = .data:0x81656F1A; // type:object size:0xD scope:local data:string
@26294 = .data:0x81656F27; // type:object size:0x11 scope:local data:string
@26295 = .data:0x81656F38; // type:object size:0x11 scope:local data:string
@26296 = .data:0x81656F49; // type:object size:0xA scope:local data:string
@26297 = .data:0x81656F53; // type:object size:0xD scope:local data:string
@26300 = .data:0x81656F60; // type:object size:0x1A0 scope:local @26300 = .data:0x81656F60; // type:object size:0x1A0 scope:local
@26299 = .data:0x81657100; // type:object size:0x48 scope:local @26299 = .data:0x81657100; // type:object size:0x48 scope:local
@26346 = .data:0x81657148; // type:object size:0x26 scope:local data:string
@26347 = .data:0x8165716E; // type:object size:0xF scope:local data:string
@26348 = .data:0x8165717D; // type:object size:0xE scope:local data:string
@26349 = .data:0x8165718B; // type:object size:0xA scope:local data:string
@26350 = .data:0x81657195; // type:object size:0xB scope:local data:string
@26351 = .data:0x816571A0; // type:object size:0x16 scope:local data:string
@26353 = .data:0x816571B6; // type:object size:0x11 scope:local data:string
@26354 = .data:0x816571C7; // type:object size:0x16 scope:local data:string
@26502 = .data:0x816571DD; // type:object size:0xF scope:local data:string @26502 = .data:0x816571DD; // type:object size:0xF scope:local data:string
@26534 = .data:0x816571EC; // type:object size:0x18 scope:local data:string @26534 = .data:0x816571EC; // type:object size:0x18 scope:local data:string
@26536 = .data:0x81657204; // type:object size:0x44 scope:local @26536 = .data:0x81657204; // type:object size:0x44 scope:local
@@ -17259,11 +17216,6 @@ sSettingAPAnimations__Q23ipl5scene = .data:0x81656B6C; // type:object size:0x4C
@28326 = .data:0x81657642; // type:object size:0x2A scope:local data:string @28326 = .data:0x81657642; // type:object size:0x2A scope:local data:string
@28370 = .data:0x8165766C; // type:object size:0x10 scope:local data:string @28370 = .data:0x8165766C; // type:object size:0x10 scope:local data:string
@28383 = .data:0x8165767C; // type:object size:0x14 scope:local data:string @28383 = .data:0x8165767C; // type:object size:0x14 scope:local data:string
@28436 = .data:0x81657690; // type:object size:0x16 scope:local data:string
@28437 = .data:0x816576A6; // type:object size:0xF scope:local data:string
@28438 = .data:0x816576B5; // type:object size:0x13 scope:local data:string
@28439 = .data:0x816576C8; // type:object size:0x1A scope:local data:string
@28440 = .data:0x816576E2; // type:object size:0x1B scope:local data:string
@28442 = .data:0x81657700; // type:object size:0x84 scope:local @28442 = .data:0x81657700; // type:object size:0x84 scope:local
__vt__Q33ipl5scene7APEvent = .data:0x81657784; // type:object size:0x18 __vt__Q33ipl5scene7APEvent = .data:0x81657784; // type:object size:0x18
__vt__Q33ipl5scene7Setting = .data:0x8165779C; // type:object size:0x68 __vt__Q33ipl5scene7Setting = .data:0x8165779C; // type:object size:0x68
@@ -18106,7 +18058,7 @@ __vt__Q49textinput6extend4memo15AppearMemoState = .data:0x81667FA0; // type:obje
__vt__Q49textinput6extend4memo13DispMemoState = .data:0x81667FF8; // type:object size:0x58 __vt__Q49textinput6extend4memo13DispMemoState = .data:0x81667FF8; // type:object size:0x58
__vt__Q49textinput6extend4memo5State = .data:0x81668050; // type:object size:0x58 __vt__Q49textinput6extend4memo5State = .data:0x81668050; // type:object size:0x58
__vt__Q49textinput6extend4memo7Manager = .data:0x816680A8; // type:object size:0x140 __vt__Q49textinput6extend4memo7Manager = .data:0x816680A8; // type:object size:0x140
lbl_816681E8 = .data:0x816681E8; // type:object size:0x24 lbl_816681E8 = .data:0x816681E8; // type:object size:0x28
lbl_81668210 = .data:0x81668210; // type:object size:0x9 data:string lbl_81668210 = .data:0x81668210; // type:object size:0x9 data:string
lbl_8166821C = .data:0x8166821C; // type:object size:0x9 data:string lbl_8166821C = .data:0x8166821C; // type:object size:0x9 data:string
lbl_81668228 = .data:0x81668228; // type:object size:0x9 data:string lbl_81668228 = .data:0x81668228; // type:object size:0x9 data:string
@@ -22421,93 +22373,93 @@ lbl_81696FD0 = .sdata:0x81696FD0; // type:object size:0x6 data:wstring
lbl_81696FD6 = .sdata:0x81696FD6; // type:object size:0x4 data:wstring lbl_81696FD6 = .sdata:0x81696FD6; // type:object size:0x4 data:wstring
lbl_81696FDA = .sdata:0x81696FDA; // type:object size:0x7 data:string lbl_81696FDA = .sdata:0x81696FDA; // type:object size:0x7 data:string
lbl_81696FE1 = .sdata:0x81696FE1; // type:object size:0x7 data:string lbl_81696FE1 = .sdata:0x81696FE1; // type:object size:0x7 data:string
@16789 = .sdata:0x81696FE8; // type:object size:0x6 data:string lbl_81696FE8 = .sdata:0x81696FE8; // type:object size:0x6 data:string
@16790 = .sdata:0x81696FEE; // type:object size:0x6 data:string lbl_81696FEE = .sdata:0x81696FEE; // type:object size:0x6 data:string
@16791 = .sdata:0x81696FF4; // type:object size:0x6 data:string lbl_81696FF4 = .sdata:0x81696FF4; // type:object size:0x6 data:string
@16792 = .sdata:0x81696FFA; // type:object size:0x6 data:string lbl_81696FFA = .sdata:0x81696FFA; // type:object size:0x6 data:string
@16793 = .sdata:0x81697000; // type:object size:0x7 data:string lbl_81697000 = .sdata:0x81697000; // type:object size:0x7 data:string
@16794 = .sdata:0x81697007; // type:object size:0x7 data:string lbl_81697007 = .sdata:0x81697007; // type:object size:0x7 data:string
sSettingArrowNames__Q23ipl5scene = .sdata:0x81697010; // type:object size:0x8 data:4byte lbl_81697010 = .sdata:0x81697010; // type:object size:0x8 data:4byte
@16795 = .sdata:0x81697018; // type:object size:0x8 data:string lbl_81697018 = .sdata:0x81697018; // type:object size:0x8 data:string
@16796 = .sdata:0x81697020; // type:object size:0x8 data:string lbl_81697020 = .sdata:0x81697020; // type:object size:0x8 data:string
@16797 = .sdata:0x81697028; // type:object size:0x8 data:string lbl_81697028 = .sdata:0x81697028; // type:object size:0x8 data:string
@16798 = .sdata:0x81697030; // type:object size:0x8 data:string lbl_81697030 = .sdata:0x81697030; // type:object size:0x8 data:string
@16799 = .sdata:0x81697038; // type:object size:0x8 data:string lbl_81697038 = .sdata:0x81697038; // type:object size:0x8 data:string
@16800 = .sdata:0x81697040; // type:object size:0x8 data:string lbl_81697040 = .sdata:0x81697040; // type:object size:0x8 data:string
@16801 = .sdata:0x81697048; // type:object size:0x6 data:string lbl_81697048 = .sdata:0x81697048; // type:object size:0x6 data:string
@16802 = .sdata:0x8169704E; // type:object size:0x6 data:string lbl_8169704E = .sdata:0x8169704E; // type:object size:0x6 data:string
@16803 = .sdata:0x81697054; // type:object size:0x6 data:string lbl_81697054 = .sdata:0x81697054; // type:object size:0x6 data:string
@16804 = .sdata:0x8169705A; // type:object size:0x6 data:string lbl_8169705A = .sdata:0x8169705A; // type:object size:0x6 data:string
@16805 = .sdata:0x81697060; // type:object size:0x6 data:string lbl_81697060 = .sdata:0x81697060; // type:object size:0x6 data:string
@16806 = .sdata:0x81697066; // type:object size:0x6 data:string lbl_81697066 = .sdata:0x81697066; // type:object size:0x6 data:string
@16809 = .sdata:0x8169706C; // type:object size:0x7 data:string lbl_8169706C = .sdata:0x8169706C; // type:object size:0x7 data:string
@16810 = .sdata:0x81697073; // type:object size:0x7 data:string lbl_81697073 = .sdata:0x81697073; // type:object size:0x7 data:string
@16811 = .sdata:0x8169707A; // type:object size:0x8 data:string lbl_8169707A = .sdata:0x8169707A; // type:object size:0x8 data:string
@16812 = .sdata:0x81697082; // type:object size:0x7 data:string lbl_81697082 = .sdata:0x81697082; // type:object size:0x7 data:string
@16813 = .sdata:0x81697089; // type:object size:0x6 data:string lbl_81697089 = .sdata:0x81697089; // type:object size:0x6 data:string
@16814 = .sdata:0x8169708F; // type:object size:0x6 data:string lbl_8169708F = .sdata:0x8169708F; // type:object size:0x6 data:string
@16815 = .sdata:0x81697095; // type:object size:0x6 data:string lbl_81697095 = .sdata:0x81697095; // type:object size:0x6 data:string
@16816 = .sdata:0x8169709B; // type:object size:0x6 data:string lbl_8169709B = .sdata:0x8169709B; // type:object size:0x6 data:string
@16817 = .sdata:0x816970A1; // type:object size:0x6 data:string lbl_816970A1 = .sdata:0x816970A1; // type:object size:0x6 data:string
@16818 = .sdata:0x816970A7; // type:object size:0x6 data:string lbl_816970A7 = .sdata:0x816970A7; // type:object size:0x6 data:string
@16819 = .sdata:0x816970AD; // type:object size:0x6 data:string lbl_816970AD = .sdata:0x816970AD; // type:object size:0x6 data:string
@16820 = .sdata:0x816970B3; // type:object size:0x6 data:string lbl_816970B3 = .sdata:0x816970B3; // type:object size:0x6 data:string
@16827 = .sdata:0x816970B9; // type:object size:0x8 data:string lbl_816970B9 = .sdata:0x816970B9; // type:object size:0x8 data:string
@16828 = .sdata:0x816970C1; // type:object size:0x8 data:string lbl_816970C1 = .sdata:0x816970C1; // type:object size:0x8 data:string
@16829 = .sdata:0x816970C9; // type:object size:0x8 data:string lbl_816970C9 = .sdata:0x816970C9; // type:object size:0x8 data:string
@16830 = .sdata:0x816970D1; // type:object size:0x8 data:string lbl_816970D1 = .sdata:0x816970D1; // type:object size:0x8 data:string
@16831 = .sdata:0x816970D9; // type:object size:0x8 data:string lbl_816970D9 = .sdata:0x816970D9; // type:object size:0x8 data:string
@16832 = .sdata:0x816970E1; // type:object size:0x8 data:string lbl_816970E1 = .sdata:0x816970E1; // type:object size:0x8 data:string
@25504 = .sdata:0x816970E9; // type:object size:0x4 data:string lbl_816970E9 = .sdata:0x816970E9; // type:object size:0x4 data:string
@25507 = .sdata:0x816970ED; // type:object size:0x4 data:string lbl_816970ED = .sdata:0x816970ED; // type:object size:0x4 data:string
@25617 = .sdata:0x816970F1; // type:object size:0x5 data:string lbl_816970F1 = .sdata:0x816970F1; // type:object size:0x5 data:string
@25619 = .sdata:0x816970F6; // type:object size:0x4 data:string lbl_816970F6 = .sdata:0x816970F6; // type:object size:0x4 data:string
@25626 = .sdata:0x816970FA; // type:object size:0x7 data:string lbl_816970FA = .sdata:0x816970FA; // type:object size:0x7 data:string
@25627 = .sdata:0x81697101; // type:object size:0x7 data:string lbl_81697101 = .sdata:0x81697101; // type:object size:0x7 data:string
@17202 = .sdata:0x81697108; // type:object size:0x3 data:string lbl_81697108 = .sdata:0x81697108; // type:object size:0x3 data:string
@17205 = .sdata:0x8169710B; // type:object size:0x6 data:string lbl_8169710B = .sdata:0x8169710B; // type:object size:0x6 data:string
@17206 = .sdata:0x81697111; // type:object size:0x7 data:string lbl_81697111 = .sdata:0x81697111; // type:object size:0x7 data:string
@17207 = .sdata:0x81697118; // type:object size:0x6 data:string lbl_81697118 = .sdata:0x81697118; // type:object size:0x6 data:string
@17208 = .sdata:0x8169711E; // type:object size:0x1 lbl_8169711E = .sdata:0x8169711E; // type:object size:0x1
@17209 = .sdata:0x8169711F; // type:object size:0x6 data:string lbl_8169711F = .sdata:0x8169711F; // type:object size:0x6 data:string
@17210 = .sdata:0x81697125; // type:object size:0x6 data:string lbl_81697125 = .sdata:0x81697125; // type:object size:0x6 data:string
@17211 = .sdata:0x8169712B; // type:object size:0x6 data:string lbl_8169712B = .sdata:0x8169712B; // type:object size:0x6 data:string
@17214 = .sdata:0x81697131; // type:object size:0x4 data:string lbl_81697131 = .sdata:0x81697131; // type:object size:0x4 data:string
@17215 = .sdata:0x81697135; // type:object size:0x4 data:string lbl_81697135 = .sdata:0x81697135; // type:object size:0x4 data:string
@17216 = .sdata:0x81697139; // type:object size:0x4 data:string lbl_81697139 = .sdata:0x81697139; // type:object size:0x4 data:string
@17217 = .sdata:0x8169713D; // type:object size:0x4 data:string lbl_8169713D = .sdata:0x8169713D; // type:object size:0x4 data:string
@17218 = .sdata:0x81697141; // type:object size:0x4 data:string lbl_81697141 = .sdata:0x81697141; // type:object size:0x4 data:string
@17219 = .sdata:0x81697145; // type:object size:0x4 data:string lbl_81697145 = .sdata:0x81697145; // type:object size:0x4 data:string
@17220 = .sdata:0x81697149; // type:object size:0x4 data:string lbl_81697149 = .sdata:0x81697149; // type:object size:0x4 data:string
@17221 = .sdata:0x8169714D; // type:object size:0x4 data:string lbl_8169714D = .sdata:0x8169714D; // type:object size:0x4 data:string
@17222 = .sdata:0x81697151; // type:object size:0x4 data:string lbl_81697151 = .sdata:0x81697151; // type:object size:0x4 data:string
@17248 = .sdata:0x81697155; // type:object size:0x8 data:string lbl_81697155 = .sdata:0x81697155; // type:object size:0x8 data:string
@17249 = .sdata:0x8169715D; // type:object size:0x6 data:string lbl_8169715D = .sdata:0x8169715D; // type:object size:0x6 data:string
@17253 = .sdata:0x81697163; // type:object size:0x7 data:string lbl_81697163 = .sdata:0x81697163; // type:object size:0x7 data:string
@25725 = .sdata:0x8169716A; // type:object size:0x4 data:string lbl_8169716A = .sdata:0x8169716A; // type:object size:0x4 data:string
@26352 = .sdata:0x8169716E; // type:object size:0x5 data:string lbl_8169716E = .sdata:0x8169716E; // type:object size:0x5 data:string
@26503 = .sdata:0x81697173; // type:object size:0x7 data:string lbl_81697173 = .sdata:0x81697173; // type:object size:0x7 data:string
@26504 = .sdata:0x8169717A; // type:object size:0x5 data:string lbl_8169717A = .sdata:0x8169717A; // type:object size:0x5 data:string
@26505 = .sdata:0x8169717F; // type:object size:0x5 data:string lbl_8169717F = .sdata:0x8169717F; // type:object size:0x5 data:string
@26506 = .sdata:0x81697184; // type:object size:0x5 data:string lbl_81697184 = .sdata:0x81697184; // type:object size:0x5 data:string
@26625 = .sdata:0x8169718A; // type:object size:0x2 lbl_8169718A = .sdata:0x8169718A; // type:object size:0x2
@26851 = .sdata:0x8169718C; // type:object size:0x3 data:string lbl_8169718C = .sdata:0x8169718C; // type:object size:0x3 data:string
@18811 = .sdata:0x8169718F; // type:object size:0x2 data:string lbl_8169718F = .sdata:0x8169718F; // type:object size:0x2 data:string
@18812 = .sdata:0x81697191; // type:object size:0x2 data:string lbl_81697191 = .sdata:0x81697191; // type:object size:0x2 data:string
@18813 = .sdata:0x81697193; // type:object size:0x2 data:string lbl_81697193 = .sdata:0x81697193; // type:object size:0x2 data:string
@18814 = .sdata:0x81697195; // type:object size:0x2 data:string lbl_81697195 = .sdata:0x81697195; // type:object size:0x2 data:string
@18815 = .sdata:0x81697197; // type:object size:0x2 data:string lbl_81697197 = .sdata:0x81697197; // type:object size:0x2 data:string
@27404 = .sdata:0x81697199; // type:object size:0x6 data:string lbl_81697199 = .sdata:0x81697199; // type:object size:0x6 data:string
@27405 = .sdata:0x8169719F; // type:object size:0x6 data:string lbl_8169719F = .sdata:0x8169719F; // type:object size:0x6 data:string
@27406 = .sdata:0x816971A5; // type:object size:0x6 data:string lbl_816971A5 = .sdata:0x816971A5; // type:object size:0x6 data:string
@27407 = .sdata:0x816971AB; // type:object size:0x6 data:string lbl_816971AB = .sdata:0x816971AB; // type:object size:0x6 data:string
@27556 = .sdata:0x816971B1; // type:object size:0x6 data:string lbl_816971B1 = .sdata:0x816971B1; // type:object size:0x6 data:string
@27557 = .sdata:0x816971B7; // type:object size:0x6 data:string lbl_816971B7 = .sdata:0x816971B7; // type:object size:0x6 data:string
@27558 = .sdata:0x816971BD; // type:object size:0x6 data:string lbl_816971BD = .sdata:0x816971BD; // type:object size:0x6 data:string
@27559 = .sdata:0x816971C3; // type:object size:0x6 data:string lbl_816971C3 = .sdata:0x816971C3; // type:object size:0x6 data:string
@27560 = .sdata:0x816971C9; // type:object size:0x7 data:string lbl_816971C9 = .sdata:0x816971C9; // type:object size:0x7 data:string
@27862 = .sdata:0x816971D0; // type:object size:0x3 data:string lbl_816971D0 = .sdata:0x816971D0; // type:object size:0x3 data:string
@28152 = .sdata:0x816971D4; // type:object size:0x8 data:wstring lbl_816971D4 = .sdata:0x816971D4; // type:object size:0x8 data:wstring
@12299 = .sdata:0x816971E0; // type:object size:0x5 scope:local data:string @12299 = .sdata:0x816971E0; // type:object size:0x5 scope:local data:string
@12302 = .sdata:0x816971E5; // type:object size:0x5 scope:local data:string @12302 = .sdata:0x816971E5; // type:object size:0x5 scope:local data:string
lbl_816971F0 = .sdata:0x816971F0; // type:object size:0x4 data:string lbl_816971F0 = .sdata:0x816971F0; // type:object size:0x4 data:string
@@ -23275,7 +23227,7 @@ lbl_81698388 = .sdata:0x81698388; // type:object size:0x2 data:string
lbl_8169838C = .sdata:0x8169838C; // type:object size:0x4 data:string lbl_8169838C = .sdata:0x8169838C; // type:object size:0x4 data:string
lbl_81698390 = .sdata:0x81698390; // type:object size:0x1 data:byte lbl_81698390 = .sdata:0x81698390; // type:object size:0x1 data:byte
lbl_81698391 = .sdata:0x81698391; // type:object size:0x1 data:byte lbl_81698391 = .sdata:0x81698391; // type:object size:0x1 data:byte
lbl_81698394 = .sdata:0x81698394; // type:object size:0x4 data:string lbl_81698394 = .sdata:0x81698394; // type:object size:0x2 data:string
lbl_81698398 = .sdata:0x81698398; // type:object size:0x2 data:string lbl_81698398 = .sdata:0x81698398; // type:object size:0x2 data:string
lbl_8169839C = .sdata:0x8169839C; // type:object size:0x4 lbl_8169839C = .sdata:0x8169839C; // type:object size:0x4
drvInitFunc = .sdata:0x816983A0; // type:object size:0x8 scope:local data:4byte drvInitFunc = .sdata:0x816983A0; // type:object size:0x8 scope:local data:4byte

View File

@@ -766,9 +766,9 @@ config.libs = [
] ]
), ),
IPLSection("channelSelect", [ IPLSection("channelSelect", [
Object(Matching, "scene/channelSelect/iplChannelSelect.cpp"), Object(Equivalent, "scene/channelSelect/iplChannelSelect.cpp"),
Object(Matching, "scene/channelSelect/iplClock.cpp"), Object(Matching, "scene/channelSelect/iplClock.cpp"),
Object(Matching, "scene/channelSelect/iplChannelObj.cpp"), Object(Equivalent, "scene/channelSelect/iplChannelObj.cpp"),
] ]
), ),
IPLSection("channelTitle", [ IPLSection("channelTitle", [
@@ -1299,7 +1299,7 @@ config.libs = [
Object(Matching, "ut/ut_RomFont.cpp"), Object(Matching, "ut/ut_RomFont.cpp"),
Object(Matching, "ut/ut_ResFontBase.cpp"), Object(Matching, "ut/ut_ResFontBase.cpp"),
Object(Matching, "ut/ut_ResFont.cpp"), Object(Matching, "ut/ut_ResFont.cpp"),
Object(Matching, "ut/ut_ArchiveFontBase.cpp"), Object(NonMatching, "ut/ut_ArchiveFontBase.cpp"),
Object(Matching, "ut/ut_ArchiveFont.cpp"), Object(Matching, "ut/ut_ArchiveFont.cpp"),
Object(Matching, "ut/ut_CharWriter.cpp"), Object(Matching, "ut/ut_CharWriter.cpp"),
Object(Matching, "ut/ut_TextWriterBase.cpp"), Object(Matching, "ut/ut_TextWriterBase.cpp"),
@@ -1388,7 +1388,7 @@ config.libs = [
] ]
), ),
RVLSDKLib("vi", [ RVLSDKLib("vi", [
Object(Matching, "vi/vi.c"), Object(NonMatching, "vi/vi.c"),
Object(Matching, "vi/i2c.c"), Object(Matching, "vi/i2c.c"),
Object(Matching, "vi/vi3in1.c"), Object(Matching, "vi/vi3in1.c"),
] ]
@@ -1970,7 +1970,7 @@ config.libs = [
Object(Matching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]), Object(Matching, "MSL_Common/time.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wctype.c"), Object(Matching, "MSL_Common/wctype.c"),
Object(Matching, "MSL_Common/wmem.c"), Object(Matching, "MSL_Common/wmem.c"),
Object(Matching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]), Object(NonMatching, "MSL_Common/wprintf.c", extra_cflags=["-Cpp_exceptions on"]),
Object(Matching, "MSL_Common/wstring.c"), Object(Matching, "MSL_Common/wstring.c"),
Object(Matching, "MSL_Common/wchar_io.c"), Object(Matching, "MSL_Common/wchar_io.c"),
Object(Matching, "PPC_EABI/time.dolphin.c"), Object(Matching, "PPC_EABI/time.dolphin.c"),

View File

@@ -43,7 +43,7 @@ private:
bool mIsPlaying; // 0xB2 bool mIsPlaying; // 0xB2
bool mIsSetBuf; // 0xB3 bool mIsSetBuf; // 0xB3
bool mThreadRunning; // 0xB4 bool mThreadRunning; // 0xB4
bool mbFillInCallback; // 0xB5 bool unk_0xB5; // 0xB5
WaveFileAiff mAiff; // 0xB8 WaveFileAiff mAiff; // 0xB8
WaveFileWav mWav; // 0xE8 WaveFileWav mWav; // 0xE8

View File

@@ -16,12 +16,12 @@ public:
AXVPB* getAXVPB() { return mpVPB; } AXVPB* getAXVPB() { return mpVPB; }
u32 getState() { return mState; } u32 getState() { return mState; }
u32 getUnk_0x08() { return unk_0x08; } u32 getUnk_0x08() { return unk_0x08; }
int getUpdateFlag() { return mUpdateFlag; } int getUnk_0x0C() { return unk_0x0C; }
void setAXVPB(AXVPB* newVal) { mpVPB = newVal; } void setAXVPB(AXVPB* newVal) { mpVPB = newVal; }
void setState(u32 newVal) { mState = newVal; } void setState(u32 newVal) { mState = newVal; }
void setUnk_0x08(u32 newVal) { unk_0x08 = newVal; } void setUnk_0x08(u32 newVal) { unk_0x08 = newVal; }
void setUpdateFlag(u32 newVal) { mUpdateFlag = newVal; } void setUnk_0x0C(u32 newVal) { unk_0x0C = newVal; }
AXPBMIX* getMix() { return &mMix; } AXPBMIX* getMix() { return &mMix; }
@@ -31,7 +31,7 @@ private:
AXVPB* mpVPB; // 0x00 AXVPB* mpVPB; // 0x00
u32 mState; // 0x04 u32 mState; // 0x04
u32 unk_0x08; // 0x08 u32 unk_0x08; // 0x08
int mUpdateFlag; // 0x0c int unk_0x0C; // 0x0c
AXPBMIX mMix; // 0x10 AXPBMIX mMix; // 0x10
}; };

View File

@@ -163,9 +163,6 @@ namespace ipl {
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD,
f32 speed = 1.0f); f32 speed = 1.0f);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
f32 get() const;
#else
f32 get() const { f32 get() const {
f32 var_f27 = mFrame; f32 var_f27 = mFrame;
f32 var_f28 = 1.0f / mMaxFrame; f32 var_f28 = 1.0f / mMaxFrame;
@@ -184,7 +181,6 @@ namespace ipl {
return r; return r;
} }
#endif
protected: protected:
f32 mStart; f32 mStart;
@@ -270,32 +266,6 @@ namespace ipl {
}; };
#endif #endif
#ifdef IPL_CHANNEL_SELECT_CPP
template <>
class HermiteIntp<f32> : public utility::FrameController {
public:
HermiteIntp() {}
virtual ~HermiteIntp() {}
void init(const f32& start, const f32& end, f32 maxFrame, f32 startTangent,
f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) {
mStart = start;
mEnd = end;
utility::FrameController::init(playback, maxFrame, 0.0f, speed);
mStartTangent = startTangent;
mEndTangent = endTangent;
}
inline f32 get() const;
protected:
f32 mStart;
f32 mEnd;
f32 mStartTangent;
f32 mEndTangent;
};
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP #ifdef IPL_SD_CHANNEL_SELECT_CPP
} // namespace math } // namespace math
} // namespace ipl } // namespace ipl

View File

@@ -103,7 +103,7 @@ namespace ipl {
y = r.y; y = r.y;
z = 0.0f; z = 0.0f;
} }
#if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP) #if defined(IPL_ADDRESS_EDIT_CPP) || defined(IPL_SD_CHANNEL_SELECT_CPP) || defined(IPL_GC_WINDOW_CPP)
VEC3(f32 fx, f32 fy, f32 fz); VEC3(f32 fx, f32 fy, f32 fz);
#else #else
VEC3(f32 fx, f32 fy, f32 fz) { VEC3(f32 fx, f32 fy, f32 fz) {

View File

@@ -18,11 +18,11 @@ namespace ipl {
class line_collision { class line_collision {
public: public:
line_collision() : mLeft(0.0f), mRight(0.0f), mY(0.0f) {} line_collision() : unk_0x00(0.0f), unk_0x04(0.0f), unk_0x08(0.0f) {}
f32 mLeft; f32 unk_0x00;
f32 mRight; f32 unk_0x04;
f32 mY; f32 unk_0x08;
nw4r::ut::Link mLinkList; // 0x0C nw4r::ut::Link mLinkList; // 0x0C
}; };
@@ -31,9 +31,9 @@ namespace ipl {
url_collision(); url_collision();
~url_collision(); ~url_collision();
int mTagNo; int unk_0x00;
wchar_t* mpStart; wchar_t* unk_0x04;
wchar_t* mpEnd; wchar_t* unk_0x08;
nw4r::ut::Link mLinkList; // 0x0C nw4r::ut::Link mLinkList; // 0x0C
nw4r::ut::List mLineCollisions; // 0x14 nw4r::ut::List mLineCollisions; // 0x14
}; };
@@ -53,19 +53,19 @@ namespace ipl {
void parse(nw4r::ut::PrintContext<wchar_t>* context); void parse(nw4r::ut::PrintContext<wchar_t>* context);
BOOL is_focused() const; BOOL is_focused() const;
void select(int tagNo); void select(int unk);
int get_focused_tagno(int chan) const; int get_focused_tagno(int chan) const;
url_collision* get_selected_col(); url_collision* get_selected_col();
void get_url(char* urlOut, u32 urlLen); void get_url(char* urlOut, u32 urlLen);
void setHitYOffset(f32 val) { mHitYOffset = val; } void setUnk_0x40(f32 val) { unk_0x40 = val; }
void setMemoTranslateY(f32 val) { mMemoTranslateY = val; } void setUnk_0x44(f32 val) { unk_0x44 = val; }
void setFocusEnabled(bool val) { mbFocusEnabled = val; } void setUnk_0x53(bool val) { unk_0x53 = val; }
u8 getColorPass() const { return mbColorPass; } u8 getUnk_0x50() const { return unk_0x50; }
void setColorPass(u8 val) { mbColorPass = val; } void setUnk_0x50(u8 val) { unk_0x50 = val; }
private: private:
typedef struct { typedef struct {
@@ -75,14 +75,14 @@ namespace ipl {
con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00 con_data mConData[WPAD_MAX_CONTROLLERS]; // 0x00
nw4r::ut::List mUrlCollisions; // 0x34 nw4r::ut::List mUrlCollisions; // 0x34
f32 mHitYOffset; f32 unk_0x40;
f32 mMemoTranslateY; f32 unk_0x44;
int mCurTagNo; int unk_0x48;
int mSelectedTagNo; int unk_0x4C;
u8 mbColorPass; u8 unk_0x50;
u8 mbInTag; u8 unk_0x51;
u8 mbHoverOffset; u8 unk_0x52;
u8 mbFocusEnabled; u8 unk_0x53;
}; };
} // namespace scene } // namespace scene
} // namespace ipl } // namespace ipl

View File

@@ -259,8 +259,8 @@ namespace ipl {
f32 mChanThumbOff_X; // 0xD0 f32 mChanThumbOff_X; // 0xD0
f32 mChanThumbOff_Y; // 0xD4 f32 mChanThumbOff_Y; // 0xD4
math::VEC3 mOrthoTrans; math::VEC3 unk_0xD8;
math::VEC2 mOrthoScale; math::VEC2 unk_0xE4;
f32 mScaleAdjust; // 0xEC f32 mScaleAdjust; // 0xEC
int mDiskState; // 0xF0 int mDiskState; // 0xF0

View File

@@ -31,12 +31,8 @@ namespace ipl {
virtual void calc(); virtual void calc();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void initCalcNormal();
#else
virtual void initCalcNormal() { virtual void initCalcNormal() {
} // 0x4C } // 0x4C
#endif
virtual void initCalcFadeout() { virtual void initCalcFadeout() {
} // 0x50 } // 0x50
@@ -53,12 +49,8 @@ namespace ipl {
return FADER_SCN_NEXT; return FADER_SCN_NEXT;
} // 0x60 } // 0x60
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual void calcCommonAfter();
#else
virtual void calcCommonAfter() { virtual void calcCommonAfter() {
} // 0x64 } // 0x64
#endif
int getSceneFadeState() { int getSceneFadeState() {
return mScnFadeState; return mScnFadeState;

View File

@@ -62,11 +62,7 @@ namespace ipl {
virtual ~Base(); virtual ~Base();
/** @brief If the scene is ready */ /** @brief If the scene is ready */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isReady() const;
#else
virtual BOOL isReady() const { return FALSE; } virtual BOOL isReady() const { return FALSE; }
#endif
/** @brief If the user can power off/reset the system */ /** @brief If the user can power off/reset the system */
#ifdef IPL_SD_CHANNEL_TITLE_CPP #ifdef IPL_SD_CHANNEL_TITLE_CPP
@@ -77,11 +73,7 @@ namespace ipl {
/** @brief The scene running code when powering off/resetting the system */ /** @brief The scene running code when powering off/resetting the system */
virtual void startResetting() {} virtual void startResetting() {}
/** @brief If the scene has finished its powering off/resetting task */ /** @brief If the scene has finished its powering off/resetting task */
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual BOOL isResetProcessDone();
#else
virtual BOOL isResetProcessDone() { return TRUE; } virtual BOOL isResetProcessDone() { return TRUE; }
#endif
/** @brief Prepare to create scene */ /** @brief Prepare to create scene */
virtual void prepare() {} virtual void prepare() {}
@@ -94,17 +86,10 @@ namespace ipl {
/** @brief Destroy the scene and clear from memory */ /** @brief Destroy the scene and clear from memory */
virtual void destroy() {} virtual void destroy() {}
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual Base* getParent();
virtual Base* getChild();
virtual Base* getNext();
virtual Base* getPrev();
#else
virtual Base* getParent() { return (Base*)mpParent; } virtual Base* getParent() { return (Base*)mpParent; }
virtual Base* getChild() { return (Base*)mpChild; } virtual Base* getChild() { return (Base*)mpChild; }
virtual Base* getNext() { return (Base*)mpNext; } virtual Base* getNext() { return (Base*)mpNext; }
virtual Base* getPrev() { return (Base*)mpPrev; } virtual Base* getPrev() { return (Base*)mpPrev; }
#endif
/** @brief Check if scene has been created.*/ /** @brief Check if scene has been created.*/
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); } bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }

View File

@@ -185,8 +185,8 @@ namespace ipl {
gui::PaneManager* mpGui; // 0x74 gui::PaneManager* mpGui; // 0x74
BOOL mbHovered[BTN_MAX]; // 0x78 BOOL mbHovered[BTN_MAX]; // 0x78
u32 mPendingSceneId; u32 unk_0x90;
u32 mExitSeqStep; u32 unk_0x94;
static const char* smButtonName[BTN_MAX]; static const char* smButtonName[BTN_MAX];
}; };

View File

@@ -365,8 +365,8 @@ namespace ipl {
int getChJumpChanPage() { return mChJumpPage; } int getChJumpChanPage() { return mChJumpPage; }
int getChJumpChanIndex() { return mChJumpIndex; } int getChJumpChanIndex() { return mChJumpIndex; }
void setDiskChannelReady(bool flag) { mbDiskChannelReady = flag; } void setUnk_0x1B81(bool flag) { unk_0x1B81 = flag; }
bool isDiskChannelReady() { return mbDiskChannelReady; } bool isUnk_0x1B81() { return unk_0x1B81; }
void resetChJumpLoad() { mbLoadedChJump = false; } void resetChJumpLoad() { mbLoadedChJump = false; }
bool hasLoadedChJump() { return mbLoadedChJump; } bool hasLoadedChJump() { return mbLoadedChJump; }
@@ -399,7 +399,7 @@ namespace ipl {
int mBS2State; // 0x1B7C int mBS2State; // 0x1B7C
bool mbCanRefresh; // 0x1B80 bool mbCanRefresh; // 0x1B80
bool mbDiskChannelReady; bool unk_0x1B81;
u8* mpDiskIconBuf; // 0x1B84 u8* mpDiskIconBuf; // 0x1B84
u8* mpDiskBannerBuf; // 0x1B88 u8* mpDiskBannerBuf; // 0x1B88

View File

@@ -33,7 +33,7 @@ namespace ipl {
u64 titleId; // 0x10 u64 titleId; // 0x10
bool threadTerminated; // 0x18 bool threadTerminated; // 0x18
bool unk_0x19; bool unk_0x19;
bool mbHasNewMessage; // 0x1A bool unk_0x1A;
EGG::ExpHeap* getHeap() { return heap; } EGG::ExpHeap* getHeap() { return heap; }
} CSData; } CSData;

View File

@@ -118,26 +118,26 @@ namespace ipl {
public: public:
Base(int chan, KPADStatus& status) { Base(int chan, KPADStatus& status) {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
mbPinching = 0; unk_0x1D = 0;
mbWasPinching = 0; unk_0x1E = 0;
mpKpadStatus = &status; unk_0x20 = &status;
} }
Base(int chan, int type, KPADStatus& status) { Base(int chan, int type, KPADStatus& status) {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = type; mType = type;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
} }
@@ -152,15 +152,15 @@ namespace ipl {
protected: protected:
u8 mButton; u8 mButton;
u32 mDecideHoldCount; u32 unk_0x08;
OSTick mLastRumbleTime; OSTick mLastRumbleTime;
s32 mRumbleType; s32 mRumbleType;
u32 mChan; u32 mChan;
u32 mType; u32 mType;
u8 mbForceInvalid; u8 unk_0x1C;
u8 mbPinching; u8 unk_0x1D;
u8 mbWasPinching; u8 unk_0x1E;
KPADStatus* mpKpadStatus; KPADStatus* unk_0x20;
}; };
class Revolution : public Base { class Revolution : public Base {
@@ -206,8 +206,8 @@ namespace ipl {
virtual BOOL isValidDpdClassic() const; virtual BOOL isValidDpdClassic() const;
private: private:
math::VEC2 mClassicCursorPos; math::VEC2 unk_0x24;
int mClassicCursorTimer; int unk_0x2C;
}; };
class Master : public Interface { class Master : public Interface {
@@ -264,18 +264,18 @@ namespace ipl {
public: public:
Base(int chan, KPADStatus& arg1) { Base(int chan, KPADStatus& arg1) {
mButton = 0; mButton = 0;
mDecideHoldCount = 0; unk_0x08 = 0;
mLastRumbleTime = 0; mLastRumbleTime = 0;
mRumbleType = -1; mRumbleType = -1;
mChan = chan; mChan = chan;
mType = 2; mType = 2;
mbForceInvalid = 0; unk_0x1C = 0;
KPADEnableDPD(chan); KPADEnableDPD(chan);
mbPinching = 0; unk_0x1D = 0;
mbWasPinching = 0; unk_0x1E = 0;
mpKpadStatus = &arg1; unk_0x20 = &arg1;
} }
virtual ~Base(); // 0x08 virtual ~Base(); // 0x08
@@ -326,15 +326,15 @@ namespace ipl {
// protected: // protected:
u8 mButton; // 0x4 u8 mButton; // 0x4
u32 mDecideHoldCount; // 0x8 u32 unk_0x08; // 0x8
OSTick mLastRumbleTime; // 0xC OSTick mLastRumbleTime; // 0xC
s32 mRumbleType; // 0x10 s32 mRumbleType; // 0x10
u32 mChan; // 0x14 u32 mChan; // 0x14
u32 mType; // 0x18 u32 mType; // 0x18
u8 mbForceInvalid; u8 unk_0x1C;
u8 mbPinching; // 0x1D u8 unk_0x1D; // 0x1D
u8 mbWasPinching; // 0x1E u8 unk_0x1E; // 0x1E
KPADStatus* mpKpadStatus; // 0x20 KPADStatus* unk_0x20; // 0x20
}; };
class Interface : public Base { class Interface : public Base {
@@ -446,8 +446,8 @@ namespace ipl {
virtual BOOL isValidDpdClassic() const; // 0x8C virtual BOOL isValidDpdClassic() const; // 0x8C
private: private:
math::VEC2 mClassicCursorPos; math::VEC2 unk_0x24;
int mClassicCursorTimer; int unk_0x2C;
}; };
class Manager { class Manager {

View File

@@ -60,9 +60,9 @@ namespace ipl {
int mMessageID; // 0x08 int mMessageID; // 0x08
int mArg2; int unk_0x0C;
int mArg3; int unk_0x10;
char mArg1[4]; char unk_0x14[4];
u8* mpArcData; // 0x18 u8* mpArcData; // 0x18
u32 mArcSize; // 0x1C u32 mArcSize; // 0x1C

View File

@@ -65,13 +65,8 @@ namespace ipl {
/** @brief Writes the file contents. */ /** @brief Writes the file contents. */
virtual void write(); // 0x10 virtual void write(); // 0x10
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual bool isFinished();
virtual int checkData();
#else
virtual bool isFinished() { return mbDoneTask; } // 0x14 virtual bool isFinished() { return mbDoneTask; } // 0x14
virtual int checkData() { return mResult; } // 0x18 virtual int checkData() { return mResult; } // 0x18
#endif
virtual bool isFatalError(); // 0x1C virtual bool isFatalError(); // 0x1C
u8* getBuffer() const { return mpBuffer; } u8* getBuffer() const { return mpBuffer; }

View File

@@ -139,7 +139,7 @@ namespace ipl {
bool received() { return mbReviecedMsg; } bool received() { return mbReviecedMsg; }
void prepNextReceive() { mbReviecedMsg = false; } void prepNextReceive() { mbReviecedMsg = false; }
volatile bool isReceivingIdle() { return mbReceiving == false; } volatile bool isUnk0xA31() { return unk_0xA31 == false; }
BOOL isAppDlEnableLock(u32 appId) { BOOL isAppDlEnableLock(u32 appId) {
utility::autoMutexLock lock(mAutoLock); utility::autoMutexLock lock(mAutoLock);
@@ -175,9 +175,9 @@ namespace ipl {
OSMutex mAutoLock; // 0xA18 OSMutex mAutoLock; // 0xA18
bool mbReviecedMsg; bool mbReviecedMsg;
bool mbReceiving; bool unk_0xA31;
bool mbReceivePaused; // 0xA32 bool mbReceivePaused; // 0xA32
bool mbNewTitleTblReady; bool unk_0xA33;
static Arg smArg; static Arg smArg;

View File

@@ -50,7 +50,7 @@ namespace ipl {
static BOOL IsLastTicketExpired(ESTitleId* titleId); static BOOL IsLastTicketExpired(ESTitleId* titleId);
static void DeleteExpiredFlagFile(); static void DeleteExpiredFlagFile();
static s32 DeleteUnauthorizedData(EGG::Heap* heap); static void DeleteUnauthorizedData(EGG::Heap* heap);
static u32 CheckTmdCountryCode(ESTmdView* tmdView); static u32 CheckTmdCountryCode(ESTmdView* tmdView);
static u32 CheckTmdParentalControl(ESTmdView* tmdView); static u32 CheckTmdParentalControl(ESTmdView* tmdView);

View File

@@ -27,11 +27,7 @@ namespace ipl {
void init(int type, f32 maxFrame, f32 minFrame, f32 speed = 1.0f); void init(int type, f32 maxFrame, f32 minFrame, f32 speed = 1.0f);
void initFrame(); void initFrame();
#ifdef IPL_CHANNEL_SELECT_CPP
virtual inline void calc();
#else
virtual void calc(); // 0x0C virtual void calc(); // 0x0C
#endif
void setMaxFrame(f32 value) { mMaxFrame = value; } void setMaxFrame(f32 value) { mMaxFrame = value; }
f32 getMaxFrame() const { return mMaxFrame; } f32 getMaxFrame() const { return mMaxFrame; }

View File

@@ -51,17 +51,12 @@ namespace ipl {
mArg.mOrthoScale = scale; mArg.mOrthoScale = scale;
} }
#ifdef IPL_SD_CHANNEL_TITLE_CPP
static void setOrthoTrans(const math::VEC3& translate);
static void setOrthoScale(const math::VEC2& scale);
#else
static void setOrthoTrans(const math::VEC3& translate) { mArg.mOrthoTrans = translate; } static void setOrthoTrans(const math::VEC3& translate) { mArg.mOrthoTrans = translate; }
static void setOrthoScale(const math::VEC2& scale) NO_INLINE { static void setOrthoScale(const math::VEC2& scale) NO_INLINE {
mArg.mOrthoScale.x = scale.x; mArg.mOrthoScale.x = scale.x;
mArg.mOrthoScale.y = scale.y; mArg.mOrthoScale.y = scale.y;
} }
#endif
private: private:
static Arg mArg; static Arg mArg;

View File

@@ -1120,28 +1120,32 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
case 's': case 's':
if (format.argument_options == wchar_argument) { if (format.argument_options == wchar_argument) {
wchar_t* wcs_ptr = va_arg(args, wchar_t*); wchar_t* wcs_ptr = va_arg(args, wchar_t*);
int wideLength;
if (wcs_ptr == NULL) { if (wcs_ptr == NULL) {
wcs_ptr = L""; wcs_ptr = L"";
} }
if (format.alternate_form) { if (format.alternate_form) {
num_chars = (unsigned char)*wcs_ptr++; wchar_t first = *wcs_ptr++;
wideLength = (unsigned char)first;
if (format.precision_specified && num_chars > format.precision) { if (format.precision_specified && wideLength > format.precision) {
num_chars = format.precision; wideLength = format.precision;
} }
} else if (format.precision_specified) { } else if (format.precision_specified) {
num_chars = format.precision; wideLength = format.precision;
if ((string_end = wmemchr(wcs_ptr, 0, num_chars)) != 0) { if ((string_end = wmemchr((wchar_t*)wcs_ptr, 0, wideLength)) != 0) {
num_chars = string_end - wcs_ptr; wideLength = string_end - wcs_ptr;
} }
} else { } else {
num_chars = wcslen(wcs_ptr); wideLength = wcslen(wcs_ptr);
} }
num_chars = wideLength;
buff_ptr = wcs_ptr; buff_ptr = wcs_ptr;
break; break;
} else { } else {
@@ -1152,7 +1156,7 @@ static int __wpformatter(void* (*write_proc)(void*, const wchar_t*, size_t),
} }
if (format.alternate_form) { if (format.alternate_form) {
num_chars = (unsigned char)*buff_ptr; num_chars = (unsigned char)*(const wchar_t*)wcs_ptr;
if (format.precision_specified && num_chars > format.precision) { if (format.precision_specified && num_chars > format.precision) {
num_chars = format.precision; num_chars = format.precision;

View File

@@ -9,7 +9,7 @@ namespace nw4r {
namespace ut { namespace ut {
class Rect { class Rect {
public: public:
#if defined(IPL_SOUND_RECT_OUT_OF_LINE) || defined(IPL_SD_CHANNEL_TITLE_CPP) #ifdef IPL_SOUND_RECT_OUT_OF_LINE
Rect(); Rect();
#else #else
Rect() : left(), top(), right(), bottom() {} Rect() : left(), top(), right(), bottom() {}
@@ -20,7 +20,7 @@ namespace nw4r {
Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {} Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {}
#endif #endif
#if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP) && !defined(IPL_SD_CHANNEL_TITLE_CPP) #if !defined(IPL_CONTROLLER_TRIVIAL_RECT_DTOR) && !defined(IPL_MEMORYCARD_BASE_CPP)
~Rect() {} ~Rect() {}
#endif #endif

View File

@@ -37,7 +37,7 @@ namespace nw4r {
} // namespace detail } // namespace detail
template <typename TDerived, typename TBase> template <typename TDerived, typename TBase>
#if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP) || defined(IPL_SD_CHANNEL_TITLE_CPP) #if defined(IPL_BOARD_OBJECT_EXTERNAL_DYNAMIC_CAST) || defined(IPL_MEMORYCARD_BASE_CPP)
TDerived DynamicCast(TBase* pPtr); TDerived DynamicCast(TBase* pPtr);
#else #else
inline TDerived DynamicCast(TBase* pPtr) { inline TDerived DynamicCast(TBase* pPtr) {

View File

@@ -252,17 +252,14 @@ namespace nw4r {
} }
inline void updateSheetFlags(const void* glgrHdr, u32 groupIdx, u16* sheetOffsets, u32 flagsStep, const u32* sheetFlags) { inline void updateSheetFlags(const void* glgrHdr, u32 groupIdx, u16* sheetOffsets, u32 flagsStep, const u32* sheetFlags) {
const GlyphGroups* glgr = (const GlyphGroups*)((const u8*)glgrHdr + sizeof(BinaryBlockHeader)); const GlyphGroups* glgr = (GlyphGroups*)((u8*)glgrHdr + sizeof(BinaryBlockHeader));
int sheetIndex; for (int sheetI = 0; sheetI < glgr->sheetCount; sheetI++) {
u32 groupBitOffset; u32 groupBitIdx = sheetI + groupIdx * flagsStep * 8;
u16* sheetOffset = sheetOffsets;
groupBitOffset = groupIdx * flagsStep * 8;
for (sheetIndex = 0; sheetIndex < glgr->sheetCount; sheetOffset++, sheetIndex++) {
u32 groupBitIdx = sheetIndex + groupBitOffset;
const u32* bitBlockPtr = sheetFlags + (groupBitIdx & ~0x1F) / 32; const u32* bitBlockPtr = sheetFlags + (groupBitIdx & ~0x1F) / 32;
u32 bitBlock = *bitBlockPtr; u32 bitBlock = *(u32*)bitBlockPtr;
if (((bitBlock << (groupBitIdx & 0x1F)) & 0x80000000) != 0) { if (((bitBlock << (groupBitIdx & 0x1F)) & 0x80000000) != 0) {
*sheetOffset = 1; sheetOffsets[sheetI] = 1;
} }
} }
} }
@@ -271,16 +268,14 @@ namespace nw4r {
const u32* bitBlocksPtr, u32 sheetFlagsSize) { const u32* bitBlocksPtr, u32 sheetFlagsSize) {
HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr; HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr;
int i; for (int i = 0; i < pGlgr->inner.sheetCount; i++) {
u16* sheetOffset; sheetOffsets[i] = 0;
for (i = 0, sheetOffset = sheetOffsets; i < pGlgr->inner.sheetCount; sheetOffset++, i++) {
*sheetOffset = 0;
} }
for (int i = 0; i < pGlgr->inner.nameCount; i++) { for (int i = 0; i < pGlgr->inner.nameCount; i++) {
const char* includedGroups = ctx->pIncludedGroups; const char* includedGroups = ctx->pIncludedGroups;
u16 offset = pGlgr->inner.nameOffsets[i]; u16 offset = pGlgr->inner.nameOffsets[i];
char* name = (char*)(offset + (u32)hdr); char* name = (char*)((u8*)hdr + offset);
if (*includedGroups != 0) { if (*includedGroups != 0) {
if (!ArchiveFontBase::IncludeName(includedGroups, name)) { if (!ArchiveFontBase::IncludeName(includedGroups, name)) {
continue; continue;
@@ -293,23 +288,21 @@ namespace nw4r {
inline void convertSheetOffsetBooleansToOffsets(const void* glgrHdr, u16* sheetOffsets) { inline void convertSheetOffsetBooleansToOffsets(const void* glgrHdr, u16* sheetOffsets) {
HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr; HeaderedGlyphGroups* pGlgr = (HeaderedGlyphGroups*)glgrHdr;
int i;
u16 glyphIdxOffset = 0; u16 glyphIdxOffset = 0;
u16* sheetOffset; for (int i = 0; i < pGlgr->inner.sheetCount; i++) {
for (i = 0, sheetOffset = sheetOffsets; i < pGlgr->inner.sheetCount; sheetOffset++, i++) { if (sheetOffsets[i] == 1) {
if (*sheetOffset == 1) { sheetOffsets[i] = glyphIdxOffset;
*sheetOffset = glyphIdxOffset;
} else { } else {
*sheetOffset = -1; sheetOffsets[i] = -1;
glyphIdxOffset += pGlgr->inner.sheetGlyphCount; glyphIdxOffset += pGlgr->inner.sheetGlyphCount;
} }
} }
} }
inline void copyFlagOffsets(ArchiveFontBase::ConstructContext* ctx, u16* sheetOffsetsScratch, u32 workSize, const u16* sheetOffsetsScratchEnd) { inline void copyFlagOffsets(ArchiveFontBase::ConstructContext* ctx, u16* sheetOffsetsScratch, u32 workSize, u32 scratchSize) {
u8* sheetOffsets = ctx->pWorkCurr; u8* sheetOffsets = ctx->pWorkCurr;
ctx->pWorkCurr = sheetOffsets + workSize; ctx->pWorkCurr = sheetOffsets + workSize;
memmove(sheetOffsets, sheetOffsetsScratch, (sheetOffsetsScratchEnd - sheetOffsetsScratch) * sizeof(u16)); memmove(sheetOffsets, sheetOffsetsScratch, scratchSize);
ctx->pSheetOffsets = (u16*)sheetOffsets; ctx->pSheetOffsets = (u16*)sheetOffsets;
} }
@@ -318,64 +311,31 @@ namespace nw4r {
// *sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)fontData + remWorkSpace) - sheetOffsetsSize, 2); // *sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)fontData + remWorkSpace) - sheetOffsetsSize, 2);
// return sheetOffsetsSize; // return sheetOffsetsSize;
// } // }
class FontGlyphGroupsAcs {
public:
explicit FontGlyphGroupsAcs(const ArchiveFontBinaryLayout* font)
: mFont(font), mGroups(&font->glgr) {}
const GlyphGroups& GetGroups() const { return mGroups->inner; }
void SetSheetFlags(u32 flagsStep, const u32* sheetFlags) {
mFlagsStep = flagsStep;
mSheetFlags = sheetFlags;
}
u16 GetNumSheet() const { return mGroups->inner.sheetCount; }
int GetGlyphsPerSheet() const { return mGroups->inner.sheetGlyphCount; }
u16 GetNumSet() const { return mGroups->inner.nameCount; }
const char* GetSetName(int groupIndex) const {
const u16 nameOffset = mGroups->inner.nameOffsets[groupIndex];
return (const char*)(nameOffset + (u32)mFont);
}
bool IsUseSheet(int groupIndex, int sheetIndex) const {
const u32 groupBitIndex = sheetIndex + groupIndex * mFlagsStep * 8;
const u32* bitBlock = mSheetFlags + (groupBitIndex & ~0x1F) / 32;
return ((*bitBlock << (groupBitIndex & 0x1F)) & 0x80000000) != 0;
}
private:
const ArchiveFontBinaryLayout* mFont;
const HeaderedGlyphGroups* mGroups;
u32 mFlagsStep;
const u32* mSheetFlags;
};
ArchiveFontBase::ConstructState ArchiveFontBase::ConstructOpAnalyzeGLGR(ConstructContext* ctx, CachedStreamReader* reader) { ArchiveFontBase::ConstructState ArchiveFontBase::ConstructOpAnalyzeGLGR(ConstructContext* ctx, CachedStreamReader* reader) {
const u32* flagsSheets;
u32 sheetOffsetsSize;
u32 flagsSheetsOff;
u32 glgrInnerLen; u32 glgrInnerLen;
const ArchiveFontBinaryLayout* font;
u16 sheetGlyphCount;
u32 countSheet;
HeaderedGlyphGroups* pGlgr; HeaderedGlyphGroups* pGlgr;
const ArchiveFontBinaryLayout* font;
u8* glgrEnd; u8* glgrEnd;
u32 expectedMaxSize; u32 expectedMaxSize;
u32 dataBlockCount;
u16* sheetOffsetsScratch;
int groupIndex;
font = (ArchiveFontBinaryLayout*)ctx->pWorkCurr; font = (ArchiveFontBinaryLayout*)ctx->pWorkCurr;
glgrInnerLen = ctx->mNextBlockHdr.size - sizeof(BinaryBlockHeader); glgrInnerLen = ctx->mNextBlockHdr.size - sizeof(BinaryBlockHeader);
// Check for RFNA
if (font->hdr.signature != SIGNATURE_FONT_ARCHIVE) { if (font->hdr.signature != SIGNATURE_FONT_ARCHIVE) {
return CONSTRUCT_STATE_FATAL_ERR; return CONSTRUCT_STATE_FATAL_ERR;
} }
// Check that there's enough data available, and the space to
// put that data
ENSURE_READER_HAS_SIZE(ctx, reader, glgrInnerLen); ENSURE_READER_HAS_SIZE(ctx, reader, glgrInnerLen);
ENSURE_WORK_HAS_SIZE(ctx, glgrInnerLen); ENSURE_WORK_HAS_SIZE(ctx, glgrInnerLen);
expectedMaxSize = ctx->mNextBlockHdr.size + sizeof(BinaryFileHeader); expectedMaxSize = ctx->mNextBlockHdr.size + sizeof(BinaryFileHeader);
// Copy the glgr to work
{ {
pGlgr = (HeaderedGlyphGroups*)&font->glgr; pGlgr = (HeaderedGlyphGroups*)&font->glgr;
glgrEnd = (u8*)pGlgr + (u32)ctx->mNextBlockHdr.size; glgrEnd = (u8*)pGlgr + (u32)ctx->mNextBlockHdr.size;
@@ -388,45 +348,80 @@ namespace nw4r {
return CONSTRUCT_STATE_FATAL_ERR; return CONSTRUCT_STATE_FATAL_ERR;
} }
FontGlyphGroupsAcs gg(font); // Before here is fine (other than regswaps)
sheetGlyphCount = gg.GetGlyphsPerSheet(); // u16 sheetGlyphCount = FORCE_REACCESS_2(font->glgr.inner.sheetGlyphCount, u16); // 0x1C
dataBlockCount = font->hdr.dataBlocks; // u16 dataBlockCount = FORCE_REACCESS_2(font->hdr.dataBlocks, u16); // 0x0E
countSheet = gg.GetNumSheet(); // FORCE_REACCESS_2(font->glgr.inner.sheetCount, u16);
const u32 stepSheetFlags = detail::CalcSizeFlagSet(countSheet); // return ConstructOpAnalyzeGLGRInner(ctx, font, pGlgr, glgrEnd);
flagsSheetsOff = detail::CalcOffsetSheetFlags(gg.GetGroups().nameCount, countSheet, gg.GetGroups().smthCount_0x0a,
gg.GetGroups().smthCount_0x0c);
flagsSheets = (const u32*)((flagsSheetsOff & ~3) + (u32)font);
gg.SetSheetFlags(stepSheetFlags, flagsSheets);
sheetOffsetsSize = (RoundUp)(countSheet * sizeof(u16), 4); // u32 fontSizeToEndOfGlgr;
u16 countSheet;
u16 sheetGlyphCount, dataBlockCount;
u32 stepSheetFlags;
u32 flagsSheetsOff;
const u32* flagsSheets;
u32 sheetOffsetsSize;
u16* sheetOffsetsScratch;
u32 sheetOffsetsScratchSize;
sheetGlyphCount = font->glgr.inner.sheetGlyphCount; // 0x1C
dataBlockCount = font->hdr.dataBlocks; // 0x0E
// countName = font->glgr.inner.nameCount;
countSheet = font->glgr.inner.sheetCount;
// count0A = font->glgr.inner.smthCount_0x0a;
// count0C = font->glgr.inner.smthCount_0x0c;
stepSheetFlags = detail::CalcSizeFlagSet(countSheet);
flagsSheetsOff = detail::CalcOffsetSheetFlags(font->glgr.inner.nameCount, countSheet, font->glgr.inner.smthCount_0x0a,
font->glgr.inner.smthCount_0x0c);
flagsSheets = (const u32*)font + (flagsSheetsOff >> 2);
sheetOffsetsSize = ROUNDUP(countSheet * sizeof(u16), 4);
sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2); sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2);
pGlgr = (HeaderedGlyphGroups*)&font->glgr; pGlgr = (HeaderedGlyphGroups*)&font->glgr;
ENSURE_WORK_HAS_SIZE(ctx, glgrEnd - (u8*)font + sheetOffsetsSize); ENSURE_WORK_HAS_SIZE(ctx, glgrEnd - (u8*)font + sheetOffsetsSize);
// if (ctx->pWorkEnd - workCurr < fontSizeToEndOfGlgr + sheetOffsetsSize) {
// return CONSTRUCT_STATE_FATAL_ERR;
// }
{ // Clear sheet offsets scratch
u16* sheetOffset; // for (s32 i = 0; i < pGlgr->inner.sheetCount; i++) {
int sheetIndex; // sheetOffsetsScratch[i] = 0;
for (sheetIndex = 0, sheetOffset = sheetOffsetsScratch; sheetIndex < gg.GetNumSheet(); sheetOffset++, sheetIndex++) { // }
*sheetOffset = 0;
}
for (groupIndex = 0; groupIndex < gg.GetNumSet(); groupIndex++) {
const char* includedGroups = ctx->pIncludedGroups;
const char* name = gg.GetSetName(groupIndex);
if (*includedGroups && !ArchiveFontBase::IncludeName(includedGroups, name)) {
continue;
}
for (int sheetIndex = 0; sheetIndex < gg.GetNumSheet(); sheetIndex++) {
if (gg.IsUseSheet(groupIndex, sheetIndex)) {
sheetOffsetsScratch[sheetIndex] = 1;
}
}
}
}
// for (s32 i = 0; i < pGlgr->inner.nameCount; i++) {
// // const char* includedGroups = ctx->pIncludedGroups;
// u16 offset = pGlgr->inner.nameOffsets[i];
// const char* name = (char*)((u8*)font + offset);
// if (*ctx->pIncludedGroups != 0) {
// if (!ArchiveFontBase::IncludeName(ctx->pIncludedGroups, name)) {
// continue;
// }
// }
// updateSheetFlags(pGlgr, i, sheetOffsetsScratch, stepSheetFlags, flagsSheets);
// }
setSheetOffsetBooleans(ctx, pGlgr, font, sheetOffsetsScratch, flagsSheets, stepSheetFlags);
// u16 glyphIdxOffset = 0;
// for (s32 i = 0; i < pGlgr->inner.sheetCount; i++) {
// if (sheetOffsetsScratch[i] == 1) {
// sheetOffsetsScratch[i] = glyphIdxOffset;
// } else {
// sheetOffsetsScratch[i] = -1;
// glyphIdxOffset += pGlgr->inner.sheetGlyphCount;
// }
// }
convertSheetOffsetBooleansToOffsets(pGlgr, sheetOffsetsScratch); convertSheetOffsetBooleansToOffsets(pGlgr, sheetOffsetsScratch);
copyFlagOffsets(ctx, sheetOffsetsScratch, sheetOffsetsSize, sheetOffsetsScratch + (u16)countSheet); sheetOffsetsScratchSize = (u32)countSheet << 1;
sheetOffsetsScratchSize += (sheetOffsetsScratchSize >> 31);
sheetOffsetsScratchSize &= ~1;
copyFlagOffsets(ctx, sheetOffsetsScratch, sheetOffsetsSize, sheetOffsetsScratchSize);
ctx->mSheetCount = countSheet; ctx->mSheetCount = countSheet;
ctx->mGlyphsPerSheet = sheetGlyphCount; ctx->mGlyphsPerSheet = sheetGlyphCount;

View File

@@ -63,7 +63,7 @@ typedef struct {
u8 mcuYRem; // 0x0F u8 mcuYRem; // 0x0F
u16 mcuYCount; // 0x10 u16 mcuYCount; // 0x10
u16 mcuXCount2; // 0x12 u16 mcuXCount2; // 0x12
u32 mcuTotal; // 0x14 u32 unk_0x14;
u8 remX; // 0x18 u8 remX; // 0x18
u8 remY; // 0x19 u8 remY; // 0x19
u8 compCount; // 0x1A u8 compCount; // 0x1A
@@ -142,7 +142,7 @@ struct TMCCJPEGDecWork_t {
u8 mcuYRem; // 0x17FF u8 mcuYRem; // 0x17FF
u16 mcuYCount; // 0x1800 u16 mcuYCount; // 0x1800
u16 mcuXCount2; // 0x1802 u16 mcuXCount2; // 0x1802
u32 mcuTotal; // 0x1804 u32 unk_0x1804;
u8 remX; // 0x1808 u8 remX; // 0x1808
u8 remY; // 0x1809 u8 remY; // 0x1809
u8 compCount; // 0x180A u8 compCount; // 0x180A

View File

@@ -15,11 +15,11 @@ static void readHuffmanLimit(const TMCHuffmanEntry* entries, TMCHuffmanEntry* li
limit->symbol = entries->symbol; limit->symbol = entries->symbol;
} }
static inline s32 decodeLongHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) { static inline s32 decodeLongHuffman(s32 bitCount, const TMCHuffmanEntry* table, const u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
u16* entry;
u32 bitData; u32 bitData;
u32 code; u32 code;
u32 length; u32 length;
const TMCHuffmanEntry* entry;
if (bitCount <= 17) { if (bitCount <= 17) {
s32 result = TMCJPEGDEC_load_buff(work); s32 result = TMCJPEGDEC_load_buff(work);
@@ -28,16 +28,16 @@ static inline s32 decodeLongHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TM
} }
} }
bitCount = work->bitCount; bitCount = work->bitCount;
entry = (u16*)(huff_tbl + 9);
bitData = work->bitBuf; bitData = work->bitBuf;
length = 9;
bitCount -= 9; bitCount -= 9;
code = (bitData >> bitCount) & 0x1FF; code = (bitData >> bitCount) & 0x1FF;
work->bitCount = bitCount; work->bitCount = bitCount;
length = 9;
entry = table + 9;
goto read_entry; goto read_entry;
while (1) { while (1) {
length++; length++;
entry += 2; entry++;
if (length > 16) { if (length > 16) {
return TMCC_ERROR_OVERFLOW; return TMCC_ERROR_OVERFLOW;
} }
@@ -49,23 +49,21 @@ static inline s32 decodeLongHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TM
code |= (bitData >> bitCount) & 1; code |= (bitData >> bitCount) & 1;
read_entry: read_entry:
{ {
limit->bitLength = entry[0]; readHuffmanLimit(entry, limit);
limit->symbol = entry[1];
*decoded = *limit; *decoded = *limit;
if (code > (u32)decoded->bitLength) { if (code > (u32)decoded->bitLength) {
continue; continue;
} }
{ {
u32 relativeCode = code - limit->bitLength; u32 relativeCode = code - entry->bitLength;
u32 symbolIndex = relativeCode + limit->symbol; u32 symbolIndex = relativeCode + entry->symbol;
return symbols[symbolIndex & 0xFF]; return symbols[symbolIndex & 0xFF];
} }
} }
} }
} }
static inline s32 decodeACHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) { static inline s32 decodeACHuffman(s32 bitCount, const TMCHuffmanEntry* entry, const u8* symbols, TMCCJPEGDecWork* work, TMCHuffmanEntry* limit, TMCHuffmanEntry* decoded) {
u16* entry;
u32 bitData; u32 bitData;
u32 code; u32 code;
u32 length; u32 length;
@@ -77,16 +75,16 @@ static inline s32 decodeACHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCC
} }
} }
bitCount = work->bitCount; bitCount = work->bitCount;
entry = (u16*)(huff_tbl + 9);
bitData = work->bitBuf; bitData = work->bitBuf;
length = 9;
bitCount -= 9; bitCount -= 9;
code = (bitData >> bitCount) & 0x1FF; code = (bitData >> bitCount) & 0x1FF;
work->bitCount = bitCount; work->bitCount = bitCount;
length = 9;
entry += 9;
goto read_entry; goto read_entry;
while (1) { while (1) {
length++; length++;
entry += 2; entry++;
if (length > 16) { if (length > 16) {
return TMCC_ERROR_OVERFLOW; return TMCC_ERROR_OVERFLOW;
} }
@@ -98,22 +96,20 @@ static inline s32 decodeACHuffman(s32 bitCount, u32* huff_tbl, u8* symbols, TMCC
code |= (bitData >> bitCount) & 1; code |= (bitData >> bitCount) & 1;
read_entry: read_entry:
{ {
limit->bitLength = entry[0]; readHuffmanLimit(entry, limit);
limit->symbol = entry[1];
*decoded = *limit; *decoded = *limit;
if (code > (u32)decoded->bitLength) { if (code > (u32)decoded->bitLength) {
continue; continue;
} }
{ {
u32 relativeCode = code - limit->bitLength; u32 relativeCode = code - entry->bitLength;
u32 symbolIndex = relativeCode + limit->symbol; u32 symbolIndex = relativeCode + entry->symbol;
return symbols[symbolIndex & 0xFF]; return symbols[symbolIndex & 0xFF];
} }
} }
} }
} }
s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_ptr, TMCCJPEGDecWork* work) { s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_ptr, TMCCJPEGDecWork* work) {
TMCHuffmanEntry dcEntry; TMCHuffmanEntry dcEntry;
TMCHuffmanEntry dcDecoded; TMCHuffmanEntry dcDecoded;
@@ -121,7 +117,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
TMCHuffmanEntry acDecoded; TMCHuffmanEntry acDecoded;
TMCHuffmanEntry acLimit; TMCHuffmanEntry acLimit;
u8* huff_sym; u8* huff_sym;
u16* ac_fast; const TMCHuffmanEntry* ac_fast;
s32 idx; s32 idx;
u32* huff_tbl; u32* huff_tbl;
s32 bit_pos; s32 bit_pos;
@@ -134,13 +130,11 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
s32 t; s32 t;
s32 zz; s32 zz;
s32 q; s32 q;
u16* dc_fast; const TMCHuffmanEntry* dc_fast;
const u8* zztbl; const u8* zztbl;
s32* conv_row;
conv_row = (s32*)conv_row_ptr;
bit_pos = work->bitCount; bit_pos = work->bitCount;
dc_fast = work->pDCFast; dc_fast = (const TMCHuffmanEntry*)work->pDCFast;
if (bit_pos <= 8) { if (bit_pos <= 8) {
r = TMCJPEGDEC_load_buff(work); r = TMCJPEGDEC_load_buff(work);
@@ -152,7 +146,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
bit_pos = work->bitCount; bit_pos = work->bitCount;
bit_data = work->bitBuf; bit_data = work->bitBuf;
{ {
dcEntry = readHuffmanEntry((const TMCHuffmanEntry*)dc_fast, (bit_data >> (bit_pos - 8)) & 0xFF); dcEntry = readHuffmanEntry(dc_fast, (bit_data >> (bit_pos - 8)) & 0xFF);
r = dcEntry.bitLength; r = dcEntry.bitLength;
extra = dcEntry.symbol; extra = dcEntry.symbol;
} }
@@ -163,28 +157,30 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
} else { } else {
huff_sym = work->pDCHuffSym; huff_sym = work->pDCHuffSym;
huff_tbl = work->pDCHuffTbl; huff_tbl = work->pDCHuffTbl;
r = decodeLongHuffman(bit_pos, huff_tbl, huff_sym, work, &dcLimit, &dcDecoded); r = decodeLongHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work, &dcLimit, &dcDecoded);
if (r < 0) { if (r < 0) {
return r; return r;
} }
} }
blk0 = conv_row[0]; blk0 = ((s32*)conv_row_ptr)[0];
if (r != 0) { if (r != 0) {
if (work->bitCount <= r) { bit_pos = work->bitCount;
s32 load_ret; if (bit_pos <= r) {
if (load_ret = TMCJPEGDEC_load_buff(work), load_ret < 0) { s32 load_ret = TMCJPEGDEC_load_buff(work);
if (load_ret < 0) {
return load_ret; return load_ret;
} }
} }
tmp = 1UL << r; bit_pos = work->bitCount;
bit_pos = work->bitCount - r;
work->bitCount = bit_pos;
bit_data = work->bitBuf; bit_data = work->bitBuf;
tmp = 1 << r;
extra = tmp - 1; extra = tmp - 1;
bit_pos -= r;
work->bitCount = bit_pos;
extra = extra & (bit_data >> bit_pos); extra = extra & (bit_data >> bit_pos);
if (((s32)tmp >> 1) > extra) { if (((s32)tmp >> 1) > extra) {
extra -= (tmp - 1); extra -= tmp - 1;
} }
dc_predict_row_ptr[0] += extra; dc_predict_row_ptr[0] += extra;
} }
@@ -192,7 +188,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
*block = dc_predict_row_ptr[0] * blk0; *block = dc_predict_row_ptr[0] * blk0;
{ {
ac_fast = work->pACFast; ac_fast = (const TMCHuffmanEntry*)work->pACFast;
huff_tbl = work->pACHuffTbl; huff_tbl = work->pACHuffTbl;
huff_sym = work->pACHuffSym; huff_sym = work->pACHuffSym;
@@ -210,7 +206,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
zztbl = TMCJPEGDEC_Zigzag_data; zztbl = TMCJPEGDEC_Zigzag_data;
bit_data = work->bitBuf; bit_data = work->bitBuf;
t = bit_pos - 8; t = bit_pos - 8;
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, (bit_data >> t) & 0xFF); acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
do { do {
s32 ac_thresh = acEntry.bitLength; s32 ac_thresh = acEntry.bitLength;
@@ -221,7 +217,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
r = acEntry.symbol; r = acEntry.symbol;
} else { } else {
bit_pos = work->bitCount; bit_pos = work->bitCount;
r = decodeACHuffman(bit_pos, huff_tbl, huff_sym, work, &acLimit, &acDecoded); r = decodeACHuffman(bit_pos, (const TMCHuffmanEntry*)huff_tbl, huff_sym, work, &acLimit, &acDecoded);
if (r < 0) { if (r < 0) {
return r; return r;
} }
@@ -245,18 +241,19 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
return r; return r;
} }
} }
tmp = 1UL << t; bit_pos = work->bitCount;
bit_pos = work->bitCount - t; tmp = 1 << t;
work->bitCount = bit_pos;
bit_data = work->bitBuf; bit_data = work->bitBuf;
extra = tmp - 1; extra = tmp - 1;
extra = extra & (bit_data >> bit_pos); bit_pos -= t;
work->bitCount = bit_pos;
t = bit_pos - 8; t = bit_pos - 8;
q = conv_row[(u8)zz]; extra = extra & (bit_data >> bit_pos);
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, (bit_data >> t) & 0xFF); q = ((s32*)conv_row_ptr)[(u8)zz];
acEntry = readHuffmanEntry(ac_fast, (bit_data >> t) & 0xFF);
if (((s32)tmp >> 1) > extra) { if (((s32)tmp >> 1) > extra) {
extra -= (tmp - 1); extra -= tmp - 1;
} }
block[(u8)zz] = extra * q; block[(u8)zz] = extra * q;
@@ -277,7 +274,7 @@ s32 TMCJPEGDEC_decode_iquant(s32* block, u8* conv_row_ptr, u32* dc_predict_row_p
bit_pos = work->bitCount; bit_pos = work->bitCount;
t = bit_pos - 8; t = bit_pos - 8;
tmp = ((bit_data >> t) & 0xFF) << 2; tmp = ((bit_data >> t) & 0xFF) << 2;
acEntry = readHuffmanEntry((const TMCHuffmanEntry*)ac_fast, tmp >> 2); acEntry = readHuffmanEntry(ac_fast, tmp >> 2);
idx += 16; idx += 16;
} }

View File

@@ -92,20 +92,18 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
dst[0] = val; dst[0] = val;
} else { } else {
s32 oddLowSum; s32 oddLowSum;
s32 oddLowDifference;
s32 oddHighSum; s32 oddHighSum;
s32 oddHighDifference;
s32 dcValue; s32 dcValue;
t = b2 - b6; t = b2 - b6;
oddLowSum = b5 + b3; oddLowSum = b5 + b3;
oddLowDifference = b5 - b3; b5 = b5 - b3;
oddHighSum = b1 + b7; oddHighSum = b1 + b7;
oddHighDifference = b1 - b7; b1 = b1 - b7;
u = b6 + b2; u = b6 + b2;
t = t * 0xB5 >> 8; t = t * 0xB5 >> 8;
x_factor = oddHighSum - oddLowSum; x_factor = oddHighSum - oddLowSum;
z_factor = oddLowDifference + oddHighDifference; z_factor = b5 + b1;
dcValue = block[0]; dcValue = block[0];
a = dcValue - b4; a = dcValue - b4;
x = x_factor * 0xB5 >> 8; x = x_factor * 0xB5 >> 8;
@@ -115,14 +113,14 @@ void TMCJPEGDEC_IdctBlock_Lumi(s32* block, u8* conv_row_ptr, u16 pitch, s32 zigz
z = z_factor * 0x62 >> 8; z = z_factor * 0x62 >> 8;
w = d + u; w = d + u;
y = d - u; y = d - u;
m_part = oddHighDifference * 0x14E >> 8; m_part = b1 * 0x14E >> 8;
e = a - t; e = a - t;
m = m_part - z; m = m_part - z;
oddLowSum += m; oddLowSum += m;
n = oddHighSum + oddLowSum; n = oddHighSum + oddLowSum;
o = x + m; o = x + m;
dst[0] = w + n; dst[0] = w + n;
p_part = oddLowDifference * 0x8B; p_part = b5 * 0x8B;
dst[7] = w - n; dst[7] = w - n;
p_part >>= 8; p_part >>= 8;
dst[1] = v + o; dst[1] = v + o;

View File

@@ -51,7 +51,7 @@ s32 TMCJPEGDEC_Setsize(TMCCJPEGDecWork* work) {
} }
state->componentCount = work->componentCount; state->componentCount = work->componentCount;
state->result = work->mcuTotal; state->result = work->unk_0x1804;
state->maxX = work->mcuYCount; state->maxX = work->mcuYCount;
state->maxY = work->mcuXCount2; state->maxY = work->mcuXCount2;

View File

@@ -567,7 +567,7 @@ s32 TMCJPEGDEC_scan_varinit(TMCCJPEGDecWork* work) {
p->mcuYCount = p->mcuYCount + ((u8)remX != 0 ? 1 : 0); p->mcuYCount = p->mcuYCount + ((u8)remX != 0 ? 1 : 0);
p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0); p->mcuXCount2 = p->mcuXCount2 + ((u8)remY != 0 ? 1 : 0);
p->mcuTotal = (u32)p->mcuYCount * (u32)p->mcuXCount2; p->unk_0x14 = (u32)p->mcuYCount * (u32)p->mcuXCount2;
for (idx = 0; idx < (s32)p->scanCompCount; idx++) { for (idx = 0; idx < (s32)p->scanCompCount; idx++) {
u8 compId; u8 compId;
@@ -1929,7 +1929,7 @@ static s32 TMCJPEGDEC_parse_sof(TMCCJPEGDecWork* work) {
mcuCountY += yr; mcuCountY += yr;
frameInfo->mcuYCount = mcuCountX; frameInfo->mcuYCount = mcuCountX;
frameInfo->mcuXCount2 = mcuCountY; frameInfo->mcuXCount2 = mcuCountY;
work->mcuTotal = (u32)mcuCountX * (u32)mcuCountY; work->unk_0x1804 = (u32)mcuCountX * (u32)mcuCountY;
} }
compCount2 = frameInfo->compCount; compCount2 = frameInfo->compCount;

View File

@@ -816,6 +816,7 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
u8* luminance; u8* luminance;
u8* cb; u8* cb;
u8* cr; u8* cr;
s32 value;
s32 column; s32 column;
s32 xEnd; s32 xEnd;
s32 cbValue; s32 cbValue;
@@ -843,17 +844,17 @@ static void TMCJPEGDEC_converterYUV444toRGB565(TMCCJPEGDecWork* work, s32 x, s32
for (column = x; column < xEnd; column++) { for (column = x; column < xEnd; column++) {
cbValue = (s8)*cb++; cbValue = (s8)*cb++;
crValue = (s8)*cr++; crValue = (s8)*cr++;
red = *luminance++; value = *luminance++;
green = red + (-(cbValue * 88 + crValue * 183) >> 8); green = value + (-(cbValue * 88 + crValue * 183) >> 8);
blue = red + ((cbValue * 454) >> 8); red = value + ((crValue * 359) >> 8);
red = red + ((crValue * 359) >> 8); blue = value + ((cbValue * 454) >> 8);
if ((blue | green | red) >> 8) { if ((blue | green | red) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue; blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green; green = green > 255 ? 255 : green < 0 ? 0 : green;
red = red > 255 ? 255 : red < 0 ? 0 : red; red = red > 255 ? 255 : red < 0 ? 0 : red;
} }
output[(column & 3) + (((column >> 2) + tileRow) << 4)] = output[(column & 3) + (((column >> 2) + tileRow) << 4)] =
((blue & 0xF8) >> 3) + (((red & 0xF8) << 8) + ((green & 0xFC) << 3)); ((blue & 0xF8) >> 3) + ((red & 0xF8) << 8) + ((green & 0xFC) << 3);
} }
luminance += rowSkip; luminance += rowSkip;
cb += rowSkip; cb += rowSkip;

View File

@@ -656,10 +656,10 @@ static void TMCJPEGDEC_converterYUV420toRGBA8edge(TMCCJPEGDecWork* work, s32 x,
blueOffset = (cbValue * 454) >> 8; blueOffset = (cbValue * 454) >> 8;
} }
{ {
s32 red = *luminance++; s32 value = *luminance++;
s32 green = red + greenOffset; s32 green = value + greenOffset;
s32 blue = red + blueOffset; s32 red = value + redOffset;
red = red + redOffset; s32 blue = value + blueOffset;
if ((green | red | blue) >> 8) { if ((green | red | blue) >> 8) {
blue = blue > 255 ? 255 : blue < 0 ? 0 : blue; blue = blue > 255 ? 255 : blue < 0 ? 0 : blue;
green = green > 255 ? 255 : green < 0 ? 0 : green; green = green > 255 ? 255 : green < 0 ? 0 : green;

View File

@@ -163,12 +163,12 @@ typedef struct _ziGetParam {
ziWChar* candidates; // 0x18 ziWChar* candidates; // 0x18
ziU8 maxCandidates; // 0x1C ziU8 maxCandidates; // 0x1C
ziWChar firstCandidate; // 0x1E ziWChar firstCandidate; // 0x1E
ziU8 count; // 0x20 (EZTXGetParam.count) ziU8 unk_0x20; // 0x20
ziU8 letters; // 0x21 ziU8 letters; // 0x21
ziU8 completion; // 0x22 (EZTXGetParam.completion) ziU8 count; // 0x22
ziU8* scratch; // 0x24 ziU8* scratch; // 0x24
ziU32 unk_0x28; // 0x28 ziU32 unk_0x28; // 0x28
} ziGetParam; } ziGetParam;
typedef struct _ziLanguageEntry { typedef struct _ziLanguageEntry {
@@ -195,7 +195,7 @@ typedef struct _zi8DawgCtx {
ziU8* table; // 0x10 ziU8* table; // 0x10
ziU8* p14; // 0x14 ziU8* p14; // 0x14
zi8DawgRec recs[0x32]; // 0x18 zi8DawgRec recs[0x32]; // 0x18
ziU32 endNode; // 0x338 ziU32 unk_0x338; // 0x338
} zi8DawgCtx; } zi8DawgCtx;
typedef struct _ziUwdNode { typedef struct _ziUwdNode {
@@ -204,34 +204,34 @@ typedef struct _ziUwdNode {
} ziUwdNode; } ziUwdNode;
struct __zi8_work_data_s { struct __zi8_work_data_s {
ziU8 getcPhase; // 0x00 ziU8 unk_0x00;
ziU8 countOnly; // 0x01 ziU8 countOnly; // 0x01
ziU8 unk_0x02[2]; ziU8 unk_0x02[2];
ziLanguageEntry* langEntries; // 0x04 ziLanguageEntry* langEntries; // 0x04
ziU8 unk_0x08; ziU8 unk_0x08;
ziU8 unk_0x09; ziU8 unk_0x09;
ziU8 maxWordLength; ziU8 unk_0x0A;
ziU8 unk_0x0B; ziU8 unk_0x0B;
ziU32 targetCount; // 0x0C ziU32 unk_0x0C;
ziU32 unk_0x10; ziU32 unk_0x10;
ziU16 unk_0x14; ziU16 unk_0x14;
ziU8 cangjieEnabled; // 0x16 ziU8 cangjieEnabled; // 0x16
ziU8 zhPudMinPrefix; ziU8 unk_0x17;
ziU8 subLanguage; // 0x18 ziU8 subLanguage; // 0x18
ziU8 unk_0x19; ziU8 unk_0x19;
ziU16 separator; // 0x1A ziU16 separator; // 0x1A
ziU8 unk_0x1C[3]; ziU8 unk_0x1C[3];
ziU8 ignoreCase; ziU8 unk_0x1F;
ziU16 unk_0x20[0x40]; ziU16 unk_0x20[0x40];
ziU16 unk_0xA0[0x42]; ziU16 unk_0xA0[0x42];
ziU16* unk_0x124[1]; ziU16* unk_0x124[1];
ziU8* unk_0x128; ziU8* unk_0x128;
ziU8 uwdPtrCount; // 0x12C ziU8 unk_0x12C;
ziU8 unk_0x12D; ziU8 unk_0x12D;
ziU8 uwdPrioritySort; // 0x12E ziU8 unk_0x12E;
ziU8 unk_0x12F; ziU8 unk_0x12F;
ziPtr uwdDicts[2]; // 0x130 ziPtr unk_0x130[2];
ziU8 uwdDictCount; // 0x138 ziU8 unk_0x138;
ziU8 unk_0x139[3]; ziU8 unk_0x139[3];
ziU32 unk_0x13C; ziU32 unk_0x13C;
ziU8 unk_0x140; ziU8 unk_0x140;
@@ -265,22 +265,22 @@ struct __zi8_work_data_s {
ziPtr unk_0x11FC; ziPtr unk_0x11FC;
ziPtr userKeys[0x83]; // 0x1200 ziPtr userKeys[0x83]; // 0x1200
ziU8 unk_0x140C[4]; ziU8 unk_0x140C[4];
ziU32 formats; // 0x1410 ziU32 unk_0x1410;
ziU8 unk_0x1414[4]; ziU8 unk_0x1414[4];
ziU8 formatCount; ziU8 unk_0x1418;
ziU8 unk_0x1419; ziU8 unk_0x1419;
ziU16 capacity; // 0x141A ziU16 unk_0x141A;
ziU8 forceAltGraph; // 0x141C (lang FI + group 0xC -> graphTableId 0x10) ziU8 unk_0x141C;
ziU8 advanceGroup; // 0x141D (nonzero: skip first dawg group) ziU8 unk_0x141D;
ziU8 graphTableId; // 0x141E ziU8 unk_0x141E;
ziU8 maxCnt; // 0x141F ziU8 unk_0x141F;
ziU8 unk_0x1420[4]; ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424 zi8DawgCtx dawgCtx; // 0x1424
ziU8 unk_0x1760[4]; // 0x1760 ziU8 unk_0x1760[4]; // 0x1760
ziU8* groupPtr; // 0x1764 ziU8* unk_0x1764; // 0x1764
ziU8 unk_0x1768; ziU8 unk_0x1768;
ziU8 unk_0x1769[0x81]; ziU8 unk_0x1769[0x81];
ziU16 matchOffset; // 0x17EA ziU16 unk_0x17EA;
ziU8 unk_0x17EC; ziU8 unk_0x17EC;
ziU8 unk_0x17ED[3]; ziU8 unk_0x17ED[3];
ziU8* dawgGroup; // 0x17F0 ziU8* dawgGroup; // 0x17F0
@@ -309,26 +309,26 @@ struct __zi8_work_data_s {
ziWChar unk_0x1A92[0x41]; ziWChar unk_0x1A92[0x41];
ziU8 unk_0x1B14; ziU8 unk_0x1B14;
ziU8 unk_0x1B15[3]; ziU8 unk_0x1B15[3];
ziU16* unicodeMap; // 0x1B18 ziU16* unk_0x1B18;
ziU16 unicodeRange1Min; // 0x1B1C ziU16 unk_0x1B1C;
ziU16 unicodeRange1Max; // 0x1B1E ziU16 unk_0x1B1E;
ziU16 unicodeRange2Min; // 0x1B20 ziU16 unk_0x1B20;
ziU16 unicodeRange2Max; // 0x1B22 ziU16 unk_0x1B22;
ziU8 unicodeMapSubLang; // 0x1B24 ziU8 unk_0x1B24;
ziU8 unk_0x1B25[3]; ziU8 unk_0x1B25[3];
union { union {
ziU32 word; ziU32 word;
struct { struct {
ziU32 msb : 1; ziU32 msb : 1;
} bits; } bits;
} pyFuzzy; // 0x1B28 } unk_0x1B28;
union { union {
ziU32 word; ziU32 word;
struct { struct {
ziU32 msb : 1; ziU32 msb : 1;
} bits; } bits;
} unk_0x1B2C; } unk_0x1B2C;
ziU8 koAltTables; // 0x1B30 ziU8 unk_0x1B30;
ziU8 unk_0x1B31; ziU8 unk_0x1B31;
ziU16 unk_0x1B32; ziU16 unk_0x1B32;
ziU16 unk_0x1B34; ziU16 unk_0x1B34;

View File

@@ -21,7 +21,7 @@ ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
} }
if (fc == 0) { if (fc == 0) {
count++; count++;
if (ZI_WORK->getcPhase == 0) { if (ZI_WORK->unk_0x00 == 0) {
param->candidates[i++] = Zi8PunctTable[j]; param->candidates[i++] = Zi8PunctTable[j];
if ((param->context & 0x10) != 0) { if ((param->context & 0x10) != 0) {
param->candidates[i++] = 0x20; param->candidates[i++] = 0x20;
@@ -33,7 +33,7 @@ ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
break; break;
} }
} else { } else {
if (count >= (ziS32)ZI_WORK->targetCount) { if (count >= (ziS32)ZI_WORK->unk_0x0C) {
return count; return count;
} }
} }
@@ -42,7 +42,7 @@ ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
} }
j++; j++;
} }
if (ZI_WORK->getcPhase == 0) { if (ZI_WORK->unk_0x00 == 0) {
param->letters = count; param->letters = count;
} }
return count; return count;

View File

@@ -2,14 +2,14 @@
#include <zi8clib/zitypes.h> #include <zi8clib/zitypes.h>
ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) { ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) {
if (ZI_WORK->uwdPtrCount == 0) { if (ZI_WORK->unk_0x12C == 0) {
*arg0 = 0; *arg0 = 0;
*arg1 = 0; *arg1 = 0;
Zi8LogError(0x1A5, ZI_WORK); Zi8LogError(0x1A5, ZI_WORK);
return 0; return 0;
} else { } else {
*arg1 = ZI_WORK->unk_0x124[ZI_WORK->uwdPtrCount - 1][1] / 3; *arg1 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][1] / 3;
*arg0 = (ziU32)ZI_WORK->unk_0x124[ZI_WORK->uwdPtrCount - 1]; *arg0 = (ziU32)ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1];
*arg0 += 8; *arg0 += 8;
Zi8LogError(0x64, ZI_WORK); Zi8LogError(0x64, ZI_WORK);
return 1; return 1;

View File

@@ -920,7 +920,8 @@ selectDictionary:
if ((((wordLength == 0) && (*punctuationCursor != 0)) && (dictionaryExact != 0)) && if ((((wordLength == 0) && (*punctuationCursor != 0)) && (dictionaryExact != 0)) &&
((((ZiAlphaWork*)workData)->singleCharacter != 0 && (parameters->elementCount == 2)))) { ((((ZiAlphaWork*)workData)->singleCharacter != 0 && (parameters->elementCount == 2)))) {
*wordCursor = ((ZiAlphaWork*)workData)->singleCharacter; *wordCursor = ((ZiAlphaWork*)workData)->singleCharacter;
wordCursor[1] = *punctuationCursor++; wordCursor[1] = *punctuationCursor;
punctuationCursor = punctuationCursor + 1;
wordCursor[2] = 0; wordCursor[2] = 0;
wordLength = 2; wordLength = 2;
} }
@@ -1067,7 +1068,7 @@ filterVowelCandidate:
(((ZiAlphaWork*)workData)->requiredLength != parameters->elementCount)) && (((ZiAlphaWork*)workData)->requiredLength != parameters->elementCount)) &&
(((((ZiAlphaWork*)workData)->prefixLength == '\0' || (((((ZiAlphaWork*)workData)->prefixLength == '\0' ||
(((ZiAlphaWork*)workData)->prefixLength + 1 >= parameters->elementCount)) && (dictionaryExact != 0))) (((ZiAlphaWork*)workData)->prefixLength + 1 >= parameters->elementCount)) && (dictionaryExact != 0)))
))) && ((((currentVowelRestriction && (prefixCount == 0)) && (dictionaryKind != 0xb)) && ))) && ((((completionAllowed && (prefixCount == 0)) && (dictionaryKind != 0xb)) &&
((((int)dictionaryIndex < (int)(unsigned int)((ZiAlphaWork*)workData)->dictionaryCount && ((((int)dictionaryIndex < (int)(unsigned int)((ZiAlphaWork*)workData)->dictionaryCount &&
(((ZiAlphaOptions*)optionData)->lookupMode == '\0')) && (((ZiAlphaOptions*)optionData)->lookupMode == '\0')) &&
(((ZiAlphaWork*)workData)->dictionaries[language] == 0)))))) { (((ZiAlphaWork*)workData)->dictionaries[language] == 0)))))) {
@@ -1083,7 +1084,7 @@ filterVowelCandidate:
goto retryDictionary; goto retryDictionary;
} }
} }
if ((((((dictionaryExact == 0) || (!currentVowelRestriction)) || (prefixCount != 0)) || if ((((((dictionaryExact == 0) || (!completionAllowed)) || (prefixCount != 0)) ||
((dictionaryKind == 0xb || ((dictionaryKind == 0xb ||
(dictionaryIndex >= ((ZiAlphaWork*)workData)->dictionaryCount)))) || (dictionaryIndex >= ((ZiAlphaWork*)workData)->dictionaryCount)))) ||
(elements == 0)) || (elements == 0)) ||
@@ -1207,8 +1208,10 @@ emitCandidate:
if (((ZiAlphaOptions*)optionData)->maxResults <= candidateCount) goto finishCandidates; if (((ZiAlphaOptions*)optionData)->maxResults <= candidateCount) goto finishCandidates;
} else { } else {
if (((ZiAlphaOptions*)optionData)->lookupMode != '\0') { if (((ZiAlphaOptions*)optionData)->lookupMode != '\0') {
for (index = 0; index <= wordLength; index++) { for (index = 0;
if (wordCursor[index] != ((ZiAlphaOptions*)optionData)->dictionary[index]) break; (index <= (int)wordLength &&
(wordCursor[index] == ((ZiAlphaOptions*)optionData)->dictionary[index]));
index = index + 1) {
} }
if ((((((ZiAlphaWork*)workData)->operation != '\0') || ((int)wordLength <= index)) if ((((((ZiAlphaWork*)workData)->operation != '\0') || ((int)wordLength <= index))
&& ((((ZiAlphaWork*)workData)->operation == '\0' || && ((((ZiAlphaWork*)workData)->operation == '\0' ||
@@ -1364,7 +1367,7 @@ emitCandidate:
} }
} }
retryDictionary:; retryDictionary:;
} while (dictionaryIndex != 0); } while (dictionaryKind != 0);
} }
finishDictionaryPass:; finishDictionaryPass:;
} }
@@ -1379,17 +1382,21 @@ finishDictionaryPass:;
} }
if (((candidateCount == 0) && (punctuationCandidate)) && (firstCandidate == 0)) { if (((candidateCount == 0) && (punctuationCandidate)) && (firstCandidate == 0)) {
candidateCount = 1; candidateCount = 1;
if (((ZiAlphaOptions*)optionData)->countOnly != 0 || (parameters->getOptions & 0xFD) == 0x81) { if ((((ZiAlphaOptions*)optionData)->countOnly == '\0') && ((parameters->getOptions & 0xfd) != 0x81)) {
*encodedOutput = 0x3e;
encodedOutput[2] = 0;
encodedOutput[1] = 0;
}
else {
if (parameters->getMode == 1) { if (parameters->getMode == 1) {
*wordCursor = *elements; *wordCursor = *elements;
} else {
*wordCursor = 0x3E;
} }
wordCursor[1] = wordCursor[2] = 0; else {
wordCursor += 2; *wordCursor = 0x3e;
} else { }
*encodedOutput = 0x3E; wordCursor[2] = 0;
encodedOutput[1] = encodedOutput[2] = 0; wordCursor[1] = 0;
wordCursor = wordCursor + 2;
} }
if (((ZiAlphaOptions*)optionData)->lookupMode == '\0') { if (((ZiAlphaOptions*)optionData)->lookupMode == '\0') {
((ZiAlphaWork*)workData)->singleCharacter = 0; ((ZiAlphaWork*)workData)->singleCharacter = 0;
@@ -1399,13 +1406,13 @@ finishDictionaryPass:;
secondLanguagePass = ZI8_TRUE; secondLanguagePass = ZI8_TRUE;
languagePassCount = 0; languagePassCount = 0;
language = parameters->subLanguage; language = parameters->subLanguage;
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
dictionaryStatus[9] = 0; dictionaryStatus[9] = 0;
dictionaryStatus[5] = 0; dictionaryStatus[5] = 0;
dictionaryStatus[6] = 0; dictionaryStatus[6] = 0;
dictionaryStatus[7] = 0; dictionaryStatus[7] = 0;
dictionaryStatus[8] = 0; dictionaryStatus[8] = 0;
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
if (switchedLanguage) { if (switchedLanguage) {
secondLanguagePass = ZI8_FALSE; secondLanguagePass = ZI8_FALSE;
dictionaryStatus[1] = 0; dictionaryStatus[1] = 0;
@@ -1419,15 +1426,14 @@ finishDictionaryPass:;
if (language == 0) { if (language == 0) {
language = parameters->language; language = parameters->language;
} }
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
if (language == parameters->language) { if (language == parameters->language) {
completionAllowed = primaryCompletionAllowed; completionAllowed = primaryCompletionAllowed;
currentVowelRestriction = primaryVowelRestriction; currentVowelRestriction = primaryVowelRestriction;
} else {
completionAllowed = secondaryCompletionAllowed;
currentVowelRestriction = secondaryVowelRestriction;
} }
if ((((ZiAlphaOptions*)optionData)->lookupMode != '\0') || ((!completionAllowed && (!currentVowelRestriction)))) goto finishCandidates; if ((((ZiAlphaOptions*)optionData)->lookupMode != '\0') || ((!currentVowelRestriction && (!completionAllowed)))) goto finishCandidates;
if ((currentVowelRestriction) && if ((completionAllowed) &&
((((((ZiAlphaWork*)workData)->suffixMode == '\0' && (2 < (int)elementCount)) && ((((((ZiAlphaWork*)workData)->suffixMode == '\0' && (2 < (int)elementCount)) &&
(elements[elementCount - 2] == 0xeff1)) && (elements[elementCount - 2] == 0xeff1)) &&
((int)((ZiAlphaWork*)workData)->prefixCount == elementCount - 2)))) { ((int)((ZiAlphaWork*)workData)->prefixCount == elementCount - 2)))) {
@@ -1438,65 +1444,66 @@ finishDictionaryPass:;
prefixPrepared = ZI8_TRUE; prefixPrepared = ZI8_TRUE;
goto preparePrefix; goto preparePrefix;
} }
if (currentVowelRestriction && ((ZiAlphaWork*)workData)->suffixMode != 0 && if (!((((completionAllowed) && (((ZiAlphaWork*)workData)->suffixMode != '\0')) &&
((ZiAlphaWork*)workData)->suffixLocked == 0 && elementCount > 2 && ((((ZiAlphaWork*)workData)->suffixLocked == '\0' && (2 < (int)elementCount)))) &&
((elements[elementCount - 2] == 0xEFF1 && (((elements[elementCount - 2] == 0xeff1 &&
((ZiAlphaWork*)workData)->suffixCount == elementCount - 2) || ((int)((ZiAlphaWork*)workData)->suffixCount == elementCount - 2)) ||
(((ZiAlphaWork*)workData)->suffixCount == elementCount - 1 && (((int)((ZiAlphaWork*)workData)->suffixCount == elementCount - 1 &&
Zi8IsAlphaPunct(elements[elementCount - 1]) != 0))) { ((Zi8IsAlphaPunct(elements[elementCount - 1])) != '\0'))))))) {
if (((ZiAlphaWork*)workData)->prefixEnabled >= 1 && elements[elementCount - 1] == 0xEFF1) { tryAlternatePrefix:
goto checkPrefixPunctuation; if ((prefixPrepared) && (1 < ((ZiAlphaWork*)workData)->alternatePrefixCount)) {
} if (language == parameters->language) {
if (!primaryMatched && !secondaryMatched) { if (primaryMatched) {
((ZiAlphaWork*)workData)->suffixLocked = 1; ((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
((ZiAlphaWork*)workData)->suffixElementCount = parameters->elementCount - 1; }
if (prefixCount != 0) { }
else if (secondaryMatched) {
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
if (((ZiAlphaWork*)workData)->alternatePrefixCount != '\0') {
wordCursor -= prefixCount; wordCursor -= prefixCount;
elements -= prefixCount; elements -= prefixCount;
elementCount = elementCount + prefixCount; elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount; wordCapacity = wordCapacity + prefixCount;
prefixCount = 0; prefixCount = 0;
} prefixPrepared = ZI8_FALSE;
goto preparePrefix; ((ZiAlphaWork*)workData)->suffixMode = 0;
} ((ZiAlphaWork*)workData)->suffixLocked = 0;
} ((ZiAlphaWork*)workData)->suffixCount = 0;
if ((prefixPrepared) && (1 < ((ZiAlphaWork*)workData)->alternatePrefixCount)) { for (index = 0; index < (int)(unsigned int)((ZiAlphaWork*)workData)->alternatePrefixCount; index = index + 1) {
if (language == parameters->language) { ((ZiAlphaWork*)workData)->prefix[index] =
if (primaryMatched) { ((ZiAlphaWork*)workData)->alternatePrefix[index];
}
((ZiAlphaWork*)workData)->prefixCount = (ziU8)index;
if (((ZiAlphaWork*)workData)->language == parameters->language) {
((ZiAlphaWork*)workData)->language = parameters->subLanguage;
}
else {
((ZiAlphaWork*)workData)->language = parameters->language;
}
((ZiAlphaWork*)workData)->alternatePrefixCount = 0; ((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
} }
} }
else if (secondaryMatched) { if ((((primaryMatched) && (secondaryMatched)) || (elementCount == 0)) ||
((ZiAlphaWork*)workData)->alternatePrefixCount = 0; (((language == parameters->language && (primaryMatched)) || ((language == parameters->subLanguage && (secondaryMatched))))))
goto finishCandidates;
if (completionAllowed) goto checkPrefixPunctuation;
} else {
if ((((ZiAlphaWork*)workData)->prefixEnabled == '\0') || (elements[elementCount - 1] != 0xeff1)) {
if ((!primaryMatched) && (!secondaryMatched)) {
((ZiAlphaWork*)workData)->suffixLocked = 1;
((ZiAlphaWork*)workData)->suffixElementCount = parameters->elementCount - 1;
if (prefixCount != 0) {
wordCursor -= prefixCount;
elements -= prefixCount;
elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount;
prefixCount = 0;
}
goto preparePrefix;
}
goto tryAlternatePrefix;
} }
if (((ZiAlphaWork*)workData)->alternatePrefixCount != '\0') {
wordCursor -= prefixCount;
elements -= prefixCount;
elementCount = elementCount + prefixCount;
wordCapacity = wordCapacity + prefixCount;
prefixCount = 0;
prefixPrepared = ZI8_FALSE;
((ZiAlphaWork*)workData)->suffixMode = 0;
((ZiAlphaWork*)workData)->suffixLocked = 0;
((ZiAlphaWork*)workData)->suffixCount = 0;
for (index = 0; index < (int)(unsigned int)((ZiAlphaWork*)workData)->alternatePrefixCount; index = index + 1) {
((ZiAlphaWork*)workData)->prefix[index] =
((ZiAlphaWork*)workData)->alternatePrefix[index];
}
((ZiAlphaWork*)workData)->prefixCount = (ziU8)index;
if (((ZiAlphaWork*)workData)->language == parameters->language) {
((ZiAlphaWork*)workData)->language = parameters->subLanguage;
}
else {
((ZiAlphaWork*)workData)->language = parameters->language;
}
((ZiAlphaWork*)workData)->alternatePrefixCount = 0;
}
}
if ((((primaryMatched) && (secondaryMatched)) || (elementCount == 0)) ||
(((language == parameters->language && (primaryMatched)) || ((language == parameters->subLanguage && (secondaryMatched))))))
goto finishCandidates;
if (currentVowelRestriction) {
checkPrefixPunctuation: checkPrefixPunctuation:
if ((1 < ((ZiAlphaWork*)workData)->prefixEnabled) && if ((1 < ((ZiAlphaWork*)workData)->prefixEnabled) &&
(parameters->elements[parameters->elementCount - 1] != 0xEFF1)) (parameters->elements[parameters->elementCount - 1] != 0xEFF1))

View File

@@ -425,8 +425,8 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
charset <<= 4; charset <<= 4;
skipCount = request->firstCandidate; skipCount = request->firstCandidate;
request->letters = 0; request->letters = 0;
request->completion = 0;
request->count = 0; request->count = 0;
request->unk_0x20 = 0;
if (getMode != 7 && getMode != 10 && getMode != 8 && getMode != 9) { if (getMode != 7 && getMode != 10 && getMode != 8 && getMode != 9) {
Zi8PrepareMatch(request, &match, 0, work); Zi8PrepareMatch(request, &match, 0, work);
} else { } else {
@@ -577,27 +577,27 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
if (getMode == 1) { if (getMode == 1) {
switch ((int)match.phon2[index] >> 9) { switch ((int)match.phon2[index] >> 9) {
case 24: case 25: case 24: case 25:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->cANDch) ordinalIndex = 0xFDFF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->cANDch) ordinalIndex = 0xFDFF;
break; break;
case 26: case 27: case 26: case 27:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->sANDsh) ordinalIndex = 0xFDFF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->sANDsh) ordinalIndex = 0xFDFF;
break; break;
case 28: case 29: case 28: case 29:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->zANDzh) ordinalIndex = 0xFDFF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->zANDzh) ordinalIndex = 0xFDFF;
break; break;
case 56: case 59: case 56: case 59:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->fANDh) ordinalIndex = 0xF9FF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->fANDh) ordinalIndex = 0xF9FF;
break; break;
case 38: case 38:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->nANDl) ordinalIndex = 0xE5FF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->nANDl) ordinalIndex = 0xE5FF;
break; break;
case 43: case 43:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->nANDl && ((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->lANDr) ordinalIndex = 0xE1FF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->nANDl && ((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->lANDr) ordinalIndex = 0xE1FF;
else if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->lANDr) ordinalIndex = 0xF1FF; else if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->lANDr) ordinalIndex = 0xF1FF;
else if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->nANDl) ordinalIndex = 0xE5FF; else if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->nANDl) ordinalIndex = 0xE5FF;
break; break;
case 44: case 44:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->lANDr) ordinalIndex = 0xF1FF; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->lANDr) ordinalIndex = 0xF1FF;
break; break;
} }
} else { } else {
@@ -650,13 +650,13 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
if (getMode == 1) { if (getMode == 1) {
switch (match.phon2[index] & 0x1F0) { switch (match.phon2[index] & 0x1F0) {
case 0x10: case 0x80: case 0x100: case 0x10: case 0x80: case 0x100:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->anANDang) ordinalIndex = 0xFFF7; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->anANDang) ordinalIndex = 0xFFF7;
break; break;
case 0x180: case 0x180:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->enANDeng) ordinalIndex = 0xFFF7; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->enANDeng) ordinalIndex = 0xFFF7;
break; break;
case 0x60: case 0x60:
if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->pyFuzzy.word)->inANDing) ordinalIndex = 0xFFF7; if (((ziFuzzyPYPairs*)&((struct __zi8_work_data_s*)work)->unk_0x1B28.word)->inANDing) ordinalIndex = 0xFFF7;
break; break;
} }
} else { } else {
@@ -720,7 +720,7 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
return 0; return 0;
} }
emitWords = 1; emitWords = 1;
if (request->completion) request->completion = request->elementCount; if (request->count) request->count = request->elementCount;
} }
if (!options->candidateMode) Zi8InitDupWordBuf(work); if (!options->candidateMode) Zi8InitDupWordBuf(work);
records = (ziU8*)Zi8GetTableAddress(1, 0, work); records = (ziU8*)Zi8GetTableAddress(1, 0, work);
@@ -930,13 +930,13 @@ engine_search:
output[outputIndex++] = ' '; output[outputIndex++] = ' ';
if (outputIndex > outputLimit) { if (outputIndex > outputLimit) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} else output[emittedCount++] = character; } else output[emittedCount++] = character;
if (emittedCount >= request->maxCandidates) { if (emittedCount >= request->maxCandidates) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} }
@@ -981,7 +981,7 @@ pud_candidate:
++rangeIndex; ++rangeIndex;
} }
if (rangeIndex == request->elementCount) { if (rangeIndex == request->elementCount) {
if (!(request->context & 0x10)) request->completion = request->elementCount; if (!(request->context & 0x10)) request->count = request->elementCount;
candidateStatus = 1; candidateStatus = 1;
character = currentSpelling[wordLength]; character = currentSpelling[wordLength];
candidateOrdinal = 0xFFFF; candidateOrdinal = 0xFFFF;
@@ -1108,13 +1108,13 @@ pud_charset:
output[outputIndex++] = ' '; output[outputIndex++] = ' ';
if (outputIndex > outputLimit) { if (outputIndex > outputLimit) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} else output[emittedCount++] = character; } else output[emittedCount++] = character;
if (emittedCount >= request->maxCandidates) { if (emittedCount >= request->maxCandidates) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} }
@@ -1302,13 +1302,13 @@ context_word_lookup:
output[outputIndex++] = ' '; output[outputIndex++] = ' ';
if (outputIndex > outputLimit) { if (outputIndex > outputLimit) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} else output[emittedCount++] = previousOrdinal; } else output[emittedCount++] = previousOrdinal;
if (emittedCount >= request->maxCandidates) { if (emittedCount >= request->maxCandidates) {
request->letters = emittedCount; request->letters = emittedCount;
request->count = emittedCount; request->unk_0x20 = emittedCount;
goto engine_finish; goto engine_finish;
} }
} }
@@ -1321,7 +1321,7 @@ context_phrase_next:
} }
} }
context_results_done: context_results_done:
if (request->wordCharCount) request->count = emittedCount; if (request->wordCharCount) request->unk_0x20 = emittedCount;
if (getOptions == 5) goto engine_finish; if (getOptions == 5) goto engine_finish;
if ((wordLength && (getMode == 1 || getMode == 2) && match.nCand > 1) || if ((wordLength && (getMode == 1 || getMode == 2) && match.nCand > 1) ||
(wordLength && getMode == 0 && match.nSeg > 1)) { (wordLength && getMode == 0 && match.nSeg > 1)) {
@@ -1752,7 +1752,7 @@ tone_candidates:
} }
} }
user_character_search: user_character_search:
if (((struct __zi8_work_data_s*)work)->uwdPtrCount && (getMode != 0 || !firstPhoneticPass) && if (((struct __zi8_work_data_s*)work)->unk_0x12C && (getMode != 0 || !firstPhoneticPass) &&
!options->countOnly && (match.nCand <= 1 || (getMode != 1 && getMode != 2)) && !options->countOnly && (match.nCand <= 1 || (getMode != 1 && getMode != 2)) &&
Zi8GetZHuwdPtr(&userEntries, &userCount, work) && (getMode != 0 || match.nSeg <= 1)) { Zi8GetZHuwdPtr(&userEntries, &userCount, work) && (getMode != 0 || match.nSeg <= 1)) {
userIndex = 0; userIndex = 0;
@@ -2572,7 +2572,7 @@ filtered_accept:
if (totalResults >= options->maxResults) goto engine_finish; if (totalResults >= options->maxResults) goto engine_finish;
} else if (!options->countOnly) { } else if (!options->countOnly) {
if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0; if (++((ZiChineseWork*)work)->duplicateIndex >= 64) ((ZiChineseWork*)work)->duplicateIndex = 0;
if (filteringMode == 4) request->count = emittedCount + 1; if (filteringMode == 4) request->unk_0x20 = emittedCount + 1;
if (emitWords) { if (emitWords) {
++emittedCount; ++emittedCount;
outputIndex += rangeCount; outputIndex += rangeCount;

View File

@@ -32,17 +32,17 @@ ziU32 Zi8MatchROMdata0(ziWChar* elements, ziU8 count, ziU8 language,
if (language != context->lang || graphTable != context->key) records[0].key = 0; if (language != context->lang || graphTable != context->key) records[0].key = 0;
if (count == 1 && mode != 0 && graphTable == 0xe) goto finish_graph; if (count == 1 && mode != 0 && graphTable == 0xe) goto finish_graph;
if (status != 0) { if (status != 0) {
if (records[context->cnt - 1].node == (ziU8*)context->endNode) goto finish_graph; if (records[context->cnt - 1].node == (ziU8*)context->unk_0x338) goto finish_graph;
for (index = 0; index < count; index++) { for (index = 0; index < count; index++) {
if (records[index].key != elements[index] && if (records[index].key != elements[index] &&
(ziU16)records[index].attr != elements[index]) goto finish_graph; (ziU16)records[index].attr != elements[index]) goto finish_graph;
} }
if (mode == 1) acceptPrefix = 0; if (mode == 1) acceptPrefix = 0;
} else { } else {
if (ZI_WORK->graphTableId != 0 && graphTable == 0xc && if (ZI_WORK->unk_0x141E != 0 && graphTable == 0xc &&
Zi8GetTableSize(language, ZI_WORK->graphTableId, ZI_WORK) != 0) { Zi8GetTableSize(language, ZI_WORK->unk_0x141E, ZI_WORK) != 0) {
graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->graphTableId, ZI_WORK); graphData = (ziU8*)Zi8GetTableAddress(language, ZI_WORK->unk_0x141E, ZI_WORK);
keyTable = ZI_WORK->graphTableId + 1; keyTable = ZI_WORK->unk_0x141E + 1;
} else { } else {
if (Zi8GetTableSize(language, graphTable, ZI_WORK) == 0) { if (Zi8GetTableSize(language, graphTable, ZI_WORK) == 0) {
Zi8LogError(0x961, ZI_WORK); Zi8LogError(0x961, ZI_WORK);
@@ -82,7 +82,7 @@ check_keys:
records[0].node = ZiDAWGGetGraphInfo(context, keyData, (ziS16*)keys); records[0].node = ZiDAWGGetGraphInfo(context, keyData, (ziS16*)keys);
} else { } else {
records[0].node = ZiDAWGGetGraph(context); records[0].node = ZiDAWGGetGraph(context);
context->endNode = 0; context->unk_0x338 = 0;
context->p14 = 0; context->p14 = 0;
} }
records[0].key = 0; records[0].key = 0;
@@ -98,7 +98,7 @@ check_keys:
} }
searching = 1; searching = 1;
current = &records[context->cnt - 1]; current = &records[context->cnt - 1];
while (searching && context->cnt != 0 && current->node != (ziU8*)context->endNode) { while (searching && context->cnt != 0 && current->node != (ziU8*)context->unk_0x338) {
if (capacity < context->cnt) goto finish_graph; if (capacity < context->cnt) goto finish_graph;
current->attr = ZiDAWGgetCHARattribute(context, current->node, ZI_WORK); current->attr = ZiDAWGgetCHARattribute(context, current->node, ZI_WORK);
if (context->cnt <= count) { if (context->cnt <= count) {
@@ -136,7 +136,7 @@ descend:
records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node); records[context->cnt].node = ZiDAWGGetChild(records[context->cnt - 1].node);
if (records[context->cnt].node == (ziU8*)0) goto next_sibling; if (records[context->cnt].node == (ziU8*)0) goto next_sibling;
context->cnt++; context->cnt++;
if (ZI_WORK->maxCnt < context->cnt) ZI_WORK->maxCnt = context->cnt; if (ZI_WORK->unk_0x141F < context->cnt) ZI_WORK->unk_0x141F = context->cnt;
goto update_current; goto update_current;
next_sibling: next_sibling:
while (context->cnt != 0) { while (context->cnt != 0) {
@@ -159,7 +159,7 @@ ziU8* NextDawgGroup(ziU8* group, ziU8 language, ziPtr __zi8_work_data)
Zi8LogError(0x962,ZI_WORK); Zi8LogError(0x962,ZI_WORK);
return 0; return 0;
} }
if (ZI_WORK->advanceGroup == 0) { if (ZI_WORK->unk_0x141D == 0) {
return group; return group;
} }
} }
@@ -184,36 +184,36 @@ unsigned int Zi8MatchROMdata1(ziWChar *elements, ziU8 count, ziU8 language, ziWC
result = 0; result = 0;
if (status == 0) { if (status == 0) {
ZI_WORK->groupPtr = (ziU8*)group; ZI_WORK->unk_0x1764 = (ziU8*)group;
if (ZI_WORK->groupPtr == 0) { if (ZI_WORK->unk_0x1764 == 0) {
if (Zi8GetTableSize(language & 0xff,0xb,ZI_WORK) != 0) { if (Zi8GetTableSize(language & 0xff,0xb,ZI_WORK) != 0) {
ZI_WORK->groupPtr = (ziU8*)(tableAddress = Zi8GetTableAddress(language & 0xff,0xb,ZI_WORK)); ZI_WORK->unk_0x1764 = (ziU8*)(tableAddress = Zi8GetTableAddress(language & 0xff,0xb,ZI_WORK));
} }
} }
if (ZI_WORK->groupPtr != 0) { if (ZI_WORK->unk_0x1764 != 0) {
for (; (*ZI_WORK->groupPtr != 0xff && ((groupIndex & 0xff) != 0)); for (; (*ZI_WORK->unk_0x1764 != 0xff && ((groupIndex & 0xff) != 0));
groupIndex = groupIndex - 1) { groupIndex = groupIndex - 1) {
while (*ZI_WORK->groupPtr != 0xff) { while (*ZI_WORK->unk_0x1764 != 0xff) {
ZI_WORK->groupPtr += 2; ZI_WORK->unk_0x1764 += 2;
} }
ZI_WORK->groupPtr++; ZI_WORK->unk_0x1764++;
} }
} }
} }
if (ZI_WORK->groupPtr == 0) { if (ZI_WORK->unk_0x1764 == 0) {
result = Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity & 0xffff, result = Zi8MatchROMdata0(elements,count,language & 0xff,output,capacity & 0xffff,
mode & 0xff,status & 0xff,0,1,acceptPrefix,0,&ZI_WORK->dawgCtx, mode & 0xff,status & 0xff,0,1,acceptPrefix,0,&ZI_WORK->dawgCtx,
ZI_WORK->unk_0x1760,ZI_WORK); ZI_WORK->unk_0x1760,ZI_WORK);
} }
else { else {
while (*ZI_WORK->groupPtr != 0xff) { while (*ZI_WORK->unk_0x1764 != 0xff) {
result = Zi8MatchROMdata0(elements,count,language & 0xff,output, result = Zi8MatchROMdata0(elements,count,language & 0xff,output,
capacity & 0xffff,mode & 0xff,status & 0xff, capacity & 0xffff,mode & 0xff,status & 0xff,
*ZI_WORK->groupPtr, *ZI_WORK->unk_0x1764,
ZI_WORK->groupPtr[1],acceptPrefix,0, ZI_WORK->unk_0x1764[1],acceptPrefix,0,
&ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK); &ZI_WORK->dawgCtx,ZI_WORK->unk_0x1760,ZI_WORK);
if ((result & 0xff) != 0) break; if ((result & 0xff) != 0) break;
ZI_WORK->groupPtr += 2; ZI_WORK->unk_0x1764 += 2;
status = 0; status = 0;
} }
} }
@@ -230,31 +230,31 @@ unsigned int Zi8MatchROMdata2(ziWChar* elements, ziU8 count, ziU8 language,
if (reservedMode != 0) return 0; if (reservedMode != 0) return 0;
if (status == 0) { if (status == 0) {
ZI_WORK->unk_0x1768 = 0; ZI_WORK->unk_0x1768 = 0;
ZI_WORK->matchOffset = 0; ZI_WORK->unk_0x17EA = 0;
if (group != 0 && *group == 0xc && language == 10 && ZI_WORK->forceAltGraph != 0) { if (group != 0 && *group == 0xc && language == 10 && ZI_WORK->unk_0x141C != 0) {
ZI_WORK->graphTableId = 0x10; ZI_WORK->unk_0x141E = 0x10;
} else { } else {
ZI_WORK->graphTableId = 0; ZI_WORK->unk_0x141E = 0;
} }
} }
search_segment: search_segment:
ZI_WORK->maxCnt = 1; ZI_WORK->unk_0x141F = 1;
result = Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
count - ZI_WORK->matchOffset, language, count - ZI_WORK->unk_0x17EA, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
mode, status, ZI_WORK->unk_0x1768, (char*)group, mode, status, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK); acceptPrefix, ZI_WORK);
if ((ziU8)result != 0) { if ((ziU8)result != 0) {
for (index = (ziU8)(ZI_WORK->matchOffset + result); index != 0; index--) { for (index = (ziU8)(ZI_WORK->unk_0x17EA + result); index != 0; index--) {
output[index - 1] = ZI_WORK->unk_0x17F4[index - 1]; output[index - 1] = ZI_WORK->unk_0x17F4[index - 1];
} }
result = (ziU8)(result + ZI_WORK->matchOffset); result = (ziU8)(result + ZI_WORK->unk_0x17EA);
} else { } else {
if (status != 0 || count == 1) goto finish_segments; if (status != 0 || count == 1) goto finish_segments;
if (mode == 1 && ZI_WORK->unk_0x1768 == 0 && if (mode == 1 && ZI_WORK->unk_0x1768 == 0 &&
(ziU8)Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, (ziU8)Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA,
count - ZI_WORK->matchOffset, language, count - ZI_WORK->unk_0x17EA, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
0, status, ZI_WORK->unk_0x1768, (char*)group, 0, status, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK) != 0) goto finish_segments; acceptPrefix, ZI_WORK) != 0) goto finish_segments;
if ((Zi8GetTableCount(language, 0x1f, ZI_WORK) & 4) == 0) { if ((Zi8GetTableCount(language, 0x1f, ZI_WORK) & 4) == 0) {
@@ -262,25 +262,25 @@ search_segment:
if (elements[index] == 0xeff1) goto finish_segments; if (elements[index] == 0xeff1) goto finish_segments;
} }
} }
if (ZI_WORK->maxCnt > capacity) goto finish_segments; if (ZI_WORK->unk_0x141F > capacity) goto finish_segments;
for (index = ZI_WORK->maxCnt; index != 0; index--) { for (index = ZI_WORK->unk_0x141F; index != 0; index--) {
result = Zi8MatchROMdata1(elements + ZI_WORK->matchOffset, index, language, result = Zi8MatchROMdata1(elements + ZI_WORK->unk_0x17EA, index, language,
&ZI_WORK->unk_0x17F4[ZI_WORK->matchOffset], capacity, &ZI_WORK->unk_0x17F4[ZI_WORK->unk_0x17EA], capacity,
1, 0, ZI_WORK->unk_0x1768, (char*)group, 1, 0, ZI_WORK->unk_0x1768, (char*)group,
acceptPrefix, ZI_WORK); acceptPrefix, ZI_WORK);
if ((ziU8)result != 0) { if ((ziU8)result != 0) {
ZI_WORK->matchOffset += (ziU8)result; ZI_WORK->unk_0x17EA += (ziU8)result;
if (ZI_WORK->matchOffset == count) return 0; if (ZI_WORK->unk_0x17EA == count) return 0;
ZI_WORK->unk_0x1768++; ZI_WORK->unk_0x1768++;
status = 0; status = 0;
ZI_WORK->graphTableId = 0; ZI_WORK->unk_0x141E = 0;
if (ZI_WORK->dawgCtx.key == 0 && language == 10) { if (ZI_WORK->dawgCtx.key == 0 && language == 10) {
for (index = 0; index < ZI_WORK->matchOffset; index++) { for (index = 0; index < ZI_WORK->unk_0x17EA; index++) {
switch (ZI_WORK->unk_0x17F4[index]) { switch (ZI_WORK->unk_0x17F4[index]) {
case 0x61: case 0x61:
case 0x6f: case 0x6f:
case 0x75: case 0x75:
ZI_WORK->graphTableId = 0x10; ZI_WORK->unk_0x141E = 0x10;
goto search_segment; goto search_segment;
} }
} }

View File

@@ -8,15 +8,11 @@ extern ziU8 Zi8SyllablesROMdata(ziWChar* keys, ziU8 count, ziU8 lang, ziWChar* o
ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK); ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK);
typedef struct _ziSwParam { typedef struct _ziSwParam {
ziU8 countOnly; // 0x00 - same layout as ZiCandidateOptions ziU8 flag;
ziU8 maxWordLength; // 0x01 ziU8 unk_0x01[0xB];
ziU8 lookupMode; // 0x02 ziS32 count;
ziU8 suffixOnly; // 0x03 ziU16 cap;
ziU8 controls[8]; // 0x04 ziU8 unk_0x12[2];
ziS32 maxCount; // 0x0C - signed view of ZiCandidateOptions.maxCount
ziU16 capacity; // 0x10
ziU8 minWordLength; // 0x12
ziU8 flags; // 0x13
} ziSwParam; } ziSwParam;
ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) { ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
@@ -58,16 +54,16 @@ ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
goto end; goto end;
} }
if (sw->countOnly != 0 || (param->getOptions & 0xFD) != 0x81) { if (sw->flag != 0 || (param->getOptions & 0xFD) != 0x81) {
out = buf; out = buf;
rem = 0x40; rem = 0x40;
} else { } else {
out = (ziWChar*)param->candidates; out = (ziWChar*)param->candidates;
rem = sw->capacity - 1; rem = sw->cap - 1;
} }
if ((param->getOptions & 0xFD) == 0x80) { if ((param->getOptions & 0xFD) == 0x80) {
u28 = (ziU8*)param->candidates; u28 = (ziU8*)param->candidates;
rem = sw->capacity - 1; rem = sw->cap - 1;
} }
if (rem <= param->elementCount) { if (rem <= param->elementCount) {
@@ -98,8 +94,8 @@ ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
firstCand--; firstCand--;
goto L5dc; goto L5dc;
} }
if (sw->countOnly != 0) { if (sw->flag != 0) {
if (++count >= sw->maxCount) goto end; if (++count >= sw->count) goto end;
goto L5dc; goto L5dc;
} }
@@ -151,8 +147,8 @@ L464b:
firstCand--; firstCand--;
goto L560; goto L560;
} }
if (sw->countOnly != 0) { if (sw->flag != 0) {
if (++count >= sw->maxCount) goto end; if (++count >= sw->count) goto end;
goto L560; goto L560;
} }
if (u28 != 0) { if (u28 != 0) {
@@ -206,7 +202,7 @@ dec:
goto L560; goto L560;
end: end:
if (sw->countOnly != 0) { if (sw->flag != 0) {
param->letters = 0; param->letters = 0;
} else { } else {
param->letters = (ziU8)count; param->letters = (ziU8)count;

View File

@@ -32,9 +32,9 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairs ZI_NEED_WORK) { ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairs ZI_NEED_WORK) {
if (pairs.ziDefault) { if (pairs.ziDefault) {
ZI_WORK->pyFuzzy.word = *(const ziU32*)&Zi8PYdefaultFuzzyPairs; ZI_WORK->unk_0x1B28.word = *(const ziU32*)&Zi8PYdefaultFuzzyPairs;
} else { } else {
ZI_WORK->pyFuzzy.word = *(ziU32*)&pairs; ZI_WORK->unk_0x1B28.word = *(ziU32*)&pairs;
} }
return 1; return 1;
} }
@@ -50,11 +50,11 @@ ziBool Zi8ZHsetZYfuzzyPairs(ziFuzzyZYPairs pairs ZI_NEED_WORK) {
ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) { ziBool Zi8SetLatinSearchOrder(ziU8* searchArray, ziU8 searchSize ZI_NEED_WORK) {
if (searchArray == 0 || *searchArray == 0) { if (searchArray == 0 || *searchArray == 0) {
ZI_WORK->formats = (ziU32)Zi8SOdefaultArray; ZI_WORK->unk_0x1410 = (ziU32)Zi8SOdefaultArray;
ZI_WORK->formatCount = 9; ZI_WORK->unk_0x1418 = 9;
} else { } else {
ZI_WORK->formats = (ziU32)searchArray; ZI_WORK->unk_0x1410 = (ziU32)searchArray;
ZI_WORK->formatCount = searchSize; ZI_WORK->unk_0x1418 = searchSize;
} }
return 1; return 1;
} }
@@ -158,7 +158,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
length = length - parameters->firstCandidate; length = length - parameters->firstCandidate;
if (countOnly != 0) { if (countOnly != 0) {
parameters->letters = length; parameters->letters = length;
ZI_WORK->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 0xff;
return 1; return 1;
} }
if (parameters->maxCandidates < length) length = parameters->maxCandidates; if (parameters->maxCandidates < length) length = parameters->maxCandidates;
@@ -175,7 +175,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
current = signatures.first; current = signatures.first;
length = signatures.length; length = signatures.length;
} }
if (length > ZI_WORK->maxWordLength) length = ZI_WORK->maxWordLength; if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] || if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) { (parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
length = parameters->elementCount; length = parameters->elementCount;
@@ -185,7 +185,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
if (parameters->letters == 2) { if (parameters->letters == 2) {
current = signatures.second; current = signatures.second;
length = secondLength; length = secondLength;
if (length > ZI_WORK->maxWordLength) length = ZI_WORK->maxWordLength; if (length > ZI_WORK->unk_0x0A) length = ZI_WORK->unk_0x0A;
if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] || if ((parameters->elementCount < ZI_WORK->unk_0x140C[0] ||
(parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) { (parameters->getOptions & 0x7e) == 2) && length > parameters->elementCount) {
length = parameters->elementCount; length = parameters->elementCount;
@@ -194,7 +194,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
*output++ = 0; *output++ = 0;
} }
*output++ = 0; *output++ = 0;
ZI_WORK->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 0xff;
return 1; return 1;
} }
@@ -226,7 +226,7 @@ static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WO
length = length - parameters->firstCandidate; length = length - parameters->firstCandidate;
if (countOnly != 0) { if (countOnly != 0) {
parameters->letters = length; parameters->letters = length;
ZI_WORK->maxWordLength = 0xff; ZI_WORK->unk_0x0A = 0xff;
return 1; return 1;
} }
if (parameters->maxCandidates < length) length = parameters->maxCandidates; if (parameters->maxCandidates < length) length = parameters->maxCandidates;
@@ -279,13 +279,13 @@ static ziBool Zi8ZhSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED_WO
ziU8 _Zi8GetCandidates(ziGetParam* parameters ZI_NEED_WORK) { ziU8 _Zi8GetCandidates(ziGetParam* parameters ZI_NEED_WORK) {
ZiCandidateOptions options = {0}; ZiCandidateOptions options = {0};
options.capacity = ZI_WORK->capacity; options.capacity = ZI_WORK->unk_0x141A;
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK); return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
} }
ziU8 _Zi8CheckCandidates(ziGetParam* parameters ZI_NEED_WORK) { ziU8 _Zi8CheckCandidates(ziGetParam* parameters ZI_NEED_WORK) {
ZiCandidateOptions options = {0}; ZiCandidateOptions options = {0};
options.capacity = ZI_WORK->capacity; options.capacity = ZI_WORK->unk_0x141A;
options.flags = 1; options.flags = 1;
return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK); return Zi8GetCandidatesOrCount(parameters, &options, ZI_WORK);
} }
@@ -324,7 +324,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
saved.savedCandidates = 0; saved.savedCandidates = 0;
saved.restoreCandidates = 0; saved.restoreCandidates = 0;
if (options->lookupMode == '\0') { if (options->lookupMode == '\0') {
if (((ZI_WORK->getcPhase == '\t') && (parameters->elementCount != 0)) && if (((ZI_WORK->unk_0x00 == '\t') && (parameters->elementCount != 0)) &&
(((parameters->elements[parameters->elementCount - 1] == 0xEFF8 && (((parameters->elements[parameters->elementCount - 1] == 0xEFF8 &&
((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) || ((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) ||
((parameters->elements[parameters->elementCount - 1] == 0xEF04 && ((parameters->elements[parameters->elementCount - 1] == 0xEF04 &&
@@ -339,22 +339,22 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
if ((parameters->elementCount == 1) && (parameters->firstCandidate == 0)) { if ((parameters->elementCount == 1) && (parameters->firstCandidate == 0)) {
switch (parameters->language) { switch (parameters->language) {
case 1: case 1:
if ((ZI_WORK->getcPhase == '\0') || (ZI_WORK->countOnly == options->countOnly)) { if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->countOnly == options->countOnly)) {
switch(ZI_WORK->getcPhase) { switch(ZI_WORK->unk_0x00) {
case '\0': case '\0':
if (parameters->elements[0] == 0xEF04) { if (parameters->elements[0] == 0xEF04) {
ZI_WORK->countOnly = options->countOnly; ZI_WORK->countOnly = options->countOnly;
ZI_WORK->getcPhase = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
break; break;
case '\x02': case '\x02':
case '\x04': case '\x04':
case '\x06': case '\x06':
if (parameters->elements[0] == 0xEF04) { if (parameters->elements[0] == 0xEF04) {
++ZI_WORK->getcPhase; ++ZI_WORK->unk_0x00;
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x01': case '\x01':
@@ -362,17 +362,17 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
case '\x05': case '\x05':
case '\a': case '\a':
if (parameters->elements[0] == 0xEF01) { if (parameters->elements[0] == 0xEF01) {
++ZI_WORK->getcPhase; ++ZI_WORK->unk_0x00;
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\b': case '\b':
case '\t': case '\t':
if ((parameters->elements[0] == 0xEF04) && if ((parameters->elements[0] == 0xEF04) &&
((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)) { ((ziU8)Zi8ZhSignature(parameters,options->countOnly,ZI_WORK) != 0)) {
ZI_WORK->getcPhase = '\t'; ZI_WORK->unk_0x00 = '\t';
candidateCount = (unsigned int)parameters->letters; candidateCount = (unsigned int)parameters->letters;
if (options->countOnly != '\0') { if (options->countOnly != '\0') {
parameters->letters = 0; parameters->letters = 0;
@@ -381,10 +381,10 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
return candidateCount; return candidateCount;
} }
default: default:
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
if ((ZI_WORK->getcPhase == '\0') && (parameters->elements[0] == 0xEF04)) { if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEF04)) {
ZI_WORK->getcPhase = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
} }
break; break;
@@ -400,75 +400,75 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
break; break;
case 0x11: case 0x11:
default: default:
if ((ZI_WORK->getcPhase == '\0') || (ZI_WORK->countOnly == options->countOnly)) { if ((ZI_WORK->unk_0x00 == '\0') || (ZI_WORK->countOnly == options->countOnly)) {
switch(ZI_WORK->getcPhase) { switch(ZI_WORK->unk_0x00) {
case '\0': case '\0':
if (parameters->elements[0] == 0xEFF2) { if (parameters->elements[0] == 0xEFF2) {
ZI_WORK->countOnly = options->countOnly; ZI_WORK->countOnly = options->countOnly;
ZI_WORK->getcPhase = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
break; break;
case '\x01': case '\x01':
if (parameters->elements[0] == 0xEFF3) { if (parameters->elements[0] == 0xEFF3) {
ZI_WORK->getcPhase = '\x02'; ZI_WORK->unk_0x00 = '\x02';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x02': case '\x02':
if (parameters->elements[0] == 0xEFF5) { if (parameters->elements[0] == 0xEFF5) {
ZI_WORK->getcPhase = '\x03'; ZI_WORK->unk_0x00 = '\x03';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x03': case '\x03':
if (parameters->elements[0] == 0xEFF7) { if (parameters->elements[0] == 0xEFF7) {
ZI_WORK->getcPhase = '\x04'; ZI_WORK->unk_0x00 = '\x04';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x04': case '\x04':
if (parameters->elements[0] == 0xEFF8) { if (parameters->elements[0] == 0xEFF8) {
ZI_WORK->getcPhase = '\x05'; ZI_WORK->unk_0x00 = '\x05';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x05': case '\x05':
if (parameters->elements[0] == 0xEFF9) { if (parameters->elements[0] == 0xEFF9) {
ZI_WORK->getcPhase = '\x06'; ZI_WORK->unk_0x00 = '\x06';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\x06': case '\x06':
if (parameters->elements[0] == 0xEFF2) { if (parameters->elements[0] == 0xEFF2) {
ZI_WORK->getcPhase = '\a'; ZI_WORK->unk_0x00 = '\a';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\a': case '\a':
if (parameters->elements[0] == 0xEFF5) { if (parameters->elements[0] == 0xEFF5) {
ZI_WORK->getcPhase = '\b'; ZI_WORK->unk_0x00 = '\b';
} }
else { else {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
break; break;
case '\b': case '\b':
case '\t': case '\t':
if ((parameters->elements[0] == 0xEFF8) && if ((parameters->elements[0] == 0xEFF8) &&
((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) { ((ziU8)Zi8AlphaSignature(parameters,options->countOnly,ZI_WORK) != 0)) {
ZI_WORK->getcPhase = '\t'; ZI_WORK->unk_0x00 = '\t';
candidateCount = (unsigned int)parameters->letters; candidateCount = (unsigned int)parameters->letters;
if (options->countOnly != '\0') { if (options->countOnly != '\0') {
parameters->letters = 0; parameters->letters = 0;
@@ -477,24 +477,24 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
return candidateCount; return candidateCount;
} }
default: default:
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
if ((ZI_WORK->getcPhase == '\0') && (parameters->elements[0] == 0xEFF2)) { if ((ZI_WORK->unk_0x00 == '\0') && (parameters->elements[0] == 0xEFF2)) {
ZI_WORK->getcPhase = '\x01'; ZI_WORK->unk_0x00 = '\x01';
} }
} }
break; break;
} }
} }
else if (1 < parameters->elementCount) { else if (1 < parameters->elementCount) {
ZI_WORK->getcPhase = '\0'; ZI_WORK->unk_0x00 = '\0';
} }
} }
ZI_WORK->subLanguage = parameters->subLanguage; ZI_WORK->subLanguage = parameters->subLanguage;
ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1,ZI_WORK) & 2; ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1,ZI_WORK) & 2;
options->maxCount = ZI_WORK->unk_0x10; options->maxCount = ZI_WORK->unk_0x10;
options->maxWordLength = ZI_WORK->maxWordLength; options->maxWordLength = ZI_WORK->unk_0x0A;
ZI_WORK->maxWordLength = -1; ZI_WORK->unk_0x0A = -1;
if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) { if ((ziU8)Zi8LangSupported(parameters->language,ZI_WORK) == 0) {
Zi8LogError(0x163,ZI_WORK); Zi8LogError(0x163,ZI_WORK);
return 0; return 0;
@@ -521,7 +521,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
((ziU8)Zi8IsCharacter(parameters->elements[0],ZI_WORK) != 0)))) { ((ziU8)Zi8IsCharacter(parameters->elements[0],ZI_WORK) != 0)))) {
saved.convertedElementCount = Zi8GetCharInfo(parameters->elements[0],characterInfo,0x10,1,ZI_WORK); saved.convertedElementCount = Zi8GetCharInfo(parameters->elements[0],characterInfo,0x10,1,ZI_WORK);
if (saved.convertedElementCount == 0) { if (saved.convertedElementCount == 0) {
parameters->letters = parameters->completion = parameters->count = 0; parameters->letters = parameters->count = parameters->unk_0x20 = 0;
candidateCount = 0; candidateCount = 0;
error = 900; error = 900;
} }
@@ -540,7 +540,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
parameters->elements = saved.savedElements; parameters->elements = saved.savedElements;
parameters->elementCount = saved.savedElementCount; parameters->elementCount = saved.savedElementCount;
parameters->getMode = saved.savedGetMode; parameters->getMode = saved.savedGetMode;
parameters->completion = 1; parameters->count = 1;
} }
} }
else if ((parameters->language == 1) && (parameters->getMode == 0xf)) { else if ((parameters->language == 1) && (parameters->getMode == 0xf)) {
@@ -711,6 +711,6 @@ void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count) {
} }
ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) { ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) {
ZI_WORK->maxWordLength = length; ZI_WORK->unk_0x0A = length;
return 1; return 1;
} }

View File

@@ -18,12 +18,12 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
Zi8Memset(__zi8_work_data, 0, 0x1B44); Zi8Memset(__zi8_work_data, 0, 0x1B44);
ZI_WORK->unk_0x08 = 1; ZI_WORK->unk_0x08 = 1;
ZI_WORK->unk_0x09 = 1; ZI_WORK->unk_0x09 = 1;
ZI_WORK->maxWordLength = 0xFF; ZI_WORK->unk_0x0A = 0xFF;
ZI_WORK->unk_0x10 = 0x64; ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->targetCount = 0xFFFF; *(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->separator = 0x20; ZI_WORK->separator = 0x20;
ZI_WORK->unk_0x1C[2] = 0; ZI_WORK->unk_0x1C[2] = 0;
ZI_WORK->koAltTables = 0; ZI_WORK->unk_0x1B30 = 0;
ZI_WORK->unk_0x1B3A = 0; ZI_WORK->unk_0x1B3A = 0;
ZI_WORK->unk_0x1B36 = 0; ZI_WORK->unk_0x1B36 = 0;
ZI_WORK->unk_0x1B32 = 0; ZI_WORK->unk_0x1B32 = 0;
@@ -44,17 +44,17 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ZI_WORK->unk_0x1874 = 0x2D; ZI_WORK->unk_0x1874 = 0x2D;
ZI_WORK->language = 0; ZI_WORK->language = 0;
ZI_WORK->unk_0x1C[3] = 0; ZI_WORK->unk_0x1C[3] = 0;
ZI_WORK->capacity = 0x100; ZI_WORK->unk_0x141A = 0x100;
Zi8SetLatinSearchOrder(0, 0, ZI_WORK); Zi8SetLatinSearchOrder(0, 0, ZI_WORK);
ZADP_Zi8SetPDremoveOpt(1, ZI_WORK); ZADP_Zi8SetPDremoveOpt(1, ZI_WORK);
ZI_WORK->zhPudMinPrefix = 5; ZI_WORK->unk_0x17 = 5;
ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1, ZI_WORK) & 2; ZI_WORK->cangjieEnabled = Zi8GetFormatVersion(1, ZI_WORK) & 2;
ZI_WORK->pyFuzzy.bits.msb = 1; ZI_WORK->unk_0x1B28.bits.msb = 1;
ZI_WORK->unk_0x1B2C.bits.msb = 1; ZI_WORK->unk_0x1B2C.bits.msb = 1;
zyFuzzy = ZI_WORK->unk_0x1B2C.word; zyFuzzy = ZI_WORK->unk_0x1B2C.word;
pzyFuzzy = &zyFuzzy; pzyFuzzy = &zyFuzzy;
Zi8ZHsetZYfuzzyPairs(pzyFuzzy, ZI_WORK); Zi8ZHsetZYfuzzyPairs(pzyFuzzy, ZI_WORK);
pyFuzzy = ZI_WORK->pyFuzzy.word; pyFuzzy = ZI_WORK->unk_0x1B28.word;
ppyFuzzy = &pyFuzzy; ppyFuzzy = &pyFuzzy;
Zi8ZHsetPYfuzzyPairs(ppyFuzzy, ZI_WORK); Zi8ZHsetPYfuzzyPairs(ppyFuzzy, ZI_WORK);
Zi8SetParentalControls(2, ZI_WORK); Zi8SetParentalControls(2, ZI_WORK);

View File

@@ -65,19 +65,19 @@ ziU16 Zi8Uni2Ptr(ziU16 ch, ziE12* buf ZI_NEED_WORK) {
} }
} }
e = (ziU8*)table; e = (ziU8*)table;
if (WORKP->unicodeMap != ZI8_NULL && WORKP->unicodeMapSubLang == WORKP->subLanguage) { if (WORKP->unk_0x1B18 != ZI8_NULL && WORKP->unk_0x1B24 == WORKP->subLanguage) {
if ((ziU16)ch >= WORKP->unicodeRange1Min && (ziU16)ch <= WORKP->unicodeRange1Max) { if ((ziU16)ch >= WORKP->unk_0x1B1C && (ziU16)ch <= WORKP->unk_0x1B1E) {
i = (ziU16)(ch - WORKP->unicodeRange1Min); i = (ziU16)(ch - WORKP->unk_0x1B1C);
goto map; goto map;
} }
if ((ziU16)ch >= WORKP->unicodeRange2Min && (ziU16)ch <= WORKP->unicodeRange2Max) { if ((ziU16)ch >= WORKP->unk_0x1B20 && (ziU16)ch <= WORKP->unk_0x1B22) {
i = (ziU16)(WORKP->unicodeRange1Max + (ch - WORKP->unicodeRange2Min) - i = (ziU16)(WORKP->unk_0x1B1E + (ch - WORKP->unk_0x1B20) -
WORKP->unicodeRange1Min + 1); WORKP->unk_0x1B1C + 1);
goto map; goto map;
} }
return 0xFFFF; return 0xFFFF;
map: map:
i = WORKP->unicodeMap[i]; i = WORKP->unk_0x1B18[i];
if (i != 0xFFFF) { if (i != 0xFFFF) {
e = (ziU8*)table + i * 0xC; e = (ziU8*)table + i * 0xC;
if (hi == e[6] && lo == e[7]) { if (hi == e[6] && lo == e[7]) {

View File

@@ -102,7 +102,7 @@ ziU32 Zi8MatchPUDdata_ZHS(ziWChar* pattern, ziU8 length, ziU8 language, ziWChar*
wordSize = *word++; wordSize = *word++;
entrySize = wordSize; entrySize = wordSize;
if (language == 1) { if (language == 1) {
if (ZI_WORK->zhPudMinPrefix > *word) goto next; if (ZI_WORK->unk_0x17 > *word) goto next;
wordSize--; wordSize--;
entrySize--; entrySize--;
word++; word++;
@@ -126,7 +126,7 @@ matchText:
if (pattern[index] != Zi8ConvertUC2Key(word[index], language, __zi8_work_data)) goto next; if (pattern[index] != Zi8ConvertUC2Key(word[index], language, __zi8_work_data)) goto next;
} else { } else {
folded = Zi8ConvertUC2WC(word[index], language, __zi8_work_data); folded = Zi8ConvertUC2WC(word[index], language, __zi8_work_data);
if (folded != pattern[index] && (!ZI_WORK->ignoreCase || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[index])) goto next; if (folded != pattern[index] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[index])) goto next;
} }
} }
matched: matched:

View File

@@ -41,7 +41,7 @@ ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
current = ZI_WORK->uwdList; current = ZI_WORK->uwdList;
while (current != 0) { while (current != 0) {
candidate = (ziUserWord*)current->word; candidate = (ziUserWord*)current->word;
if (ZI_WORK->uwdPrioritySort == 1 && candidate->priority < word->priority) break; if (ZI_WORK->unk_0x12E == 1 && candidate->priority < word->priority) break;
if (candidate->length == length) { if (candidate->length == length) {
position = 0; position = 0;
while (position < length) { while (position < length) {
@@ -105,11 +105,11 @@ ziU8 Zi8MatchUWDdata(ziWChar* pattern, ziU8 length, ziWChar* currentWord, ziU16
int position; int position;
int prefixLength; int prefixLength;
Zi8LogError(100, __zi8_work_data); Zi8LogError(100, __zi8_work_data);
if (!(ZI_WORK->uwdDictCount <= 2 && ZI_WORK->uwdDictCount != 0 && ZI_WORK->uwdDicts[ZI_WORK->uwdDictCount - 1] != 0)) { if (!(ZI_WORK->unk_0x138 <= 2 && ZI_WORK->unk_0x138 != 0 && ZI_WORK->unk_0x130[ZI_WORK->unk_0x138 - 1] != 0)) {
Zi8ReplaceLastError(0x19C, __zi8_work_data); Zi8ReplaceLastError(0x19C, __zi8_work_data);
return 0; return 0;
} }
dictionary = ZI_WORK->uwdDicts[ZI_WORK->uwdDictCount - 1]; dictionary = ZI_WORK->unk_0x130[ZI_WORK->unk_0x138 - 1];
if (continuation != 0) { if (continuation != 0) {
text = (ziU8*)Zi8_814803F4(__zi8_work_data); text = (ziU8*)Zi8_814803F4(__zi8_work_data);
entryLength = 0; entryLength = 0;
@@ -148,7 +148,7 @@ ziU8 Zi8MatchUWDdata(ziWChar* pattern, ziU8 length, ziWChar* currentWord, ziU16
folded = currentWord[position]; folded = currentWord[position];
ZI_WORK->unk_0x141[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data); ZI_WORK->unk_0x141[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
ZI_WORK->unk_0x184[previousOffset] = 0; ZI_WORK->unk_0x184[previousOffset] = 0;
if (ZI_WORK->ignoreCase != 0) { if (ZI_WORK->unk_0x1F != 0) {
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data)) Zi8ChangeCharCase(0, &folded, language, __zi8_work_data); if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data)) Zi8ChangeCharCase(0, &folded, language, __zi8_work_data);
ZI_WORK->unk_0x184[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data); ZI_WORK->unk_0x184[previousOffset] = Zi8ConvertWC2UC(folded, language, __zi8_work_data);
} }
@@ -192,7 +192,7 @@ next:
if (pattern[position] != Zi8ConvertUC2Key(text[position], language, __zi8_work_data)) goto next; if (pattern[position] != Zi8ConvertUC2Key(text[position], language, __zi8_work_data)) goto next;
} else { } else {
folded = Zi8ConvertUC2WC(text[position], language, __zi8_work_data); folded = Zi8ConvertUC2WC(text[position], language, __zi8_work_data);
if (folded != pattern[position] && (!ZI_WORK->ignoreCase || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[position])) goto next; if (folded != pattern[position] && (!ZI_WORK->unk_0x1F || !Zi8ChangeCharCase(0, &folded, language, __zi8_work_data) || folded != pattern[position])) goto next;
} }
} }
if (ZI_WORK->unk_0x140 != 0) { if (ZI_WORK->unk_0x140 != 0) {

View File

@@ -199,10 +199,10 @@ checkEntry:
} }
result = graph + (ziU32)entry[4] * 0x10000 + (((ziU16)entry[5] << 8) + entry[6]); result = graph + (ziU32)entry[4] * 0x10000 + (((ziU16)entry[5] << 8) + entry[6]);
((zi8DawgCtx*)context)->endNode = ((zi8DawgCtx*)context)->unk_0x338 =
graph + (ziU32)entry[7] * 0x10000 + (((ziU16)entry[8] << 8) + entry[9]); graph + (ziU32)entry[7] * 0x10000 + (((ziU16)entry[8] << 8) + entry[9]);
if (((zi8DawgCtx*)context)->endNode == graph) { if (((zi8DawgCtx*)context)->unk_0x338 == graph) {
((zi8DawgCtx*)context)->endNode = 0; ((zi8DawgCtx*)context)->unk_0x338 = 0;
} }
if ((((ziU16)entry[0] << 8) + entry[1]) == 0) { if ((((ziU16)entry[0] << 8) + entry[1]) == 0) {

View File

@@ -52,7 +52,7 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
result = 0; result = 0;
state.characterIndex = 0xFF; state.characterIndex = 0xFF;
state.currentCandidate = params->firstCandidate; state.currentCandidate = params->firstCandidate;
params->letters = params->completion = params->count = 0; params->letters = params->count = params->unk_0x20 = 0;
if ((argument != 0) && (*argument != 0)) { if ((argument != 0) && (*argument != 0)) {
Zi8LogError(0x7D0, workData); Zi8LogError(0x7D0, workData);
return 0; return 0;
@@ -104,7 +104,7 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
state.characterIndex, state.characterIndex,
(state.elementIndex - currentCharacter) - 1, (state.elementIndex - currentCharacter) - 1,
workData); workData);
if ((((struct __zi8_work_data_s*)workData)->koAltTables == 1)) { if ((((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 1)) {
switch (state.characterIndex) { switch (state.characterIndex) {
case 1: case 1:
selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1E, workData); selectedTable = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 0x1E, workData);
@@ -179,13 +179,13 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
} else { } else {
params->candidates[(ziU8)result] = params->candidates[(ziU8)result] =
((ziU16)selectedTable[state.nextIndex * 2] << 8) | (selectedTable + state.nextIndex * 2)[1]; ((ziU16)selectedTable[state.nextIndex * 2] << 8) | (selectedTable + state.nextIndex * 2)[1];
if ((state.tableCount6 != 0) && (((struct __zi8_work_data_s*)workData)->koAltTables == 0)) { if ((state.tableCount6 != 0) && (((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 0)) {
params->candidates[(ziU8)result] += state.inputIndex * state.tableCount3; params->candidates[(ziU8)result] += state.inputIndex * state.tableCount3;
} }
result++; result++;
} }
if (currentCharacter == 0) { if (currentCharacter == 0) {
params->completion = state.matched + 1; params->count = state.matched + 1;
} }
currentCharacter += state.matched; currentCharacter += state.matched;
} else { } else {
@@ -199,14 +199,14 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
state.currentCandidate--; state.currentCandidate--;
} }
if (currentCharacter == 0) { if (currentCharacter == 0) {
params->completion = 1; params->count = 1;
} }
} else { } else {
for (state.index = 0; state.index < state.tableCount31; state.index++) { for (state.index = 0; state.index < state.tableCount31; state.index++) {
if ((state.table31[(state.index * 3)] == buffer[currentCharacter]) && if ((state.table31[(state.index * 3)] == buffer[currentCharacter]) &&
((state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1])) { ((state.table31 + state.index * 3)[1] == buffer[currentCharacter + 1])) {
if (currentCharacter == 0) { if (currentCharacter == 0) {
params->completion = 1; params->count = 1;
} }
params->candidates[(ziU8)result] = params->candidates[(ziU8)result] =
state.tableCount0 + (state.table31 + state.index * 3)[2]; state.tableCount0 + (state.table31 + state.index * 3)[2];
@@ -218,7 +218,7 @@ ziU32 Zi8GetKoreanCandidates(ziGetParam* params, ziU8* argument,
if (state.index == state.tableCount31) { if (state.index == state.tableCount31) {
if ((params->candidates[(ziU8)result] = buffer[currentCharacter]) < 0xFF) { if ((params->candidates[(ziU8)result] = buffer[currentCharacter]) < 0xFF) {
if (currentCharacter == 0) { if (currentCharacter == 0) {
params->completion = 1; params->count = 1;
} }
params->candidates[(ziU8)result] += state.tableCount0; params->candidates[(ziU8)result] += state.tableCount0;
result++; result++;
@@ -249,7 +249,7 @@ ziU8 Zi8MatchKoreanSequence(ziU16* resultIndex, ziU16* input, ziU8 type, ziU16 c
firstCharacter = input[0]; firstCharacter = input[0];
mappedCharacter = 0xFF; mappedCharacter = 0xFF;
if (((struct __zi8_work_data_s*)workData)->koAltTables == 0) { if (((struct __zi8_work_data_s*)workData)->unk_0x1B30 == 0) {
table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 3, workData); table = (ziU8*)Zi8GetTableAddress(ZI8_LANG_KO, 3, workData);
tableCount = Zi8GetTableCount(ZI8_LANG_KO, 3, workData); tableCount = Zi8GetTableCount(ZI8_LANG_KO, 3, workData);
} else { } else {

View File

@@ -45,8 +45,8 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
ziWChar* cursor; ziWChar* cursor;
ziU8* data; ziU8* data;
ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0}; ziU8 formats[8] = {1, 5, 0, 0, 0, 0, 0, 0};
ziU32 savedFormats = ZI_WORK->formats; ziU32 savedFormats = ZI_WORK->unk_0x1410;
ziU8 savedCount = ZI_WORK->formatCount; ziU8 savedCount = ZI_WORK->unk_0x1418;
ziSearchState search = {0}; ziSearchState search = {0};
Zi8LogError(100, __zi8_work_data); Zi8LogError(100, __zi8_work_data);
if (word == 0 || *word == 0) { if (word == 0 || *word == 0) {
@@ -73,22 +73,22 @@ ziBool Zi8IsWordW(ziWChar* word, ziU8 language ZI_NEED_WORK) {
request.candidates = ordinals; request.candidates = ordinals;
request.maxCandidates = 1; request.maxCandidates = 1;
request.firstCandidate = 0; request.firstCandidate = 0;
ZI_WORK->formats = (ziU32)formats; ZI_WORK->unk_0x1410 = (ziU32)formats;
if (ZI_WORK->unk_0x1C[0] == 2) { if (ZI_WORK->unk_0x1C[0] == 2) {
ZI_WORK->formatCount = 0; ZI_WORK->unk_0x1418 = 0;
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->formatCount++] = 1; if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 1;
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->formatCount++] = 2; if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 2;
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->formatCount++] = 3; if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 3;
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->formatCount++] = 4; if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 4;
if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->formatCount++] = 5; if (ZI_WORK->unk_0x09 & 1) formats[ZI_WORK->unk_0x1418++] = 5;
if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->formatCount++] = 6; if (ZI_WORK->unk_0x09 & 4) formats[ZI_WORK->unk_0x1418++] = 6;
if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->formatCount++] = 7; if (ZI_WORK->unk_0x09 & 2) formats[ZI_WORK->unk_0x1418++] = 7;
if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->formatCount++] = 8; if (ZI_WORK->unk_0x09 & 8) formats[ZI_WORK->unk_0x1418++] = 8;
} else if (ZI_WORK->unk_0x1C[0] != 0) ZI_WORK->formatCount = 2; } else if (ZI_WORK->unk_0x1C[0] != 0) ZI_WORK->unk_0x1418 = 2;
else ZI_WORK->formatCount = 1; else ZI_WORK->unk_0x1418 = 1;
count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data); count = Zi8GetCandidatesOrCount(&request, &search, __zi8_work_data);
ZI_WORK->formats = savedFormats; ZI_WORK->unk_0x1410 = savedFormats;
ZI_WORK->formatCount = savedCount; ZI_WORK->unk_0x1418 = savedCount;
if (count != 0) return 1; if (count != 0) return 1;
} }
if (language != 1) { if (language != 1) {

View File

@@ -309,7 +309,7 @@ ziU32 Zi8GetKOcandidates(ziGetParam* param, ZiKoreanCandidateOptions* options ZI
} }
if (options->countOnly == 0) { if (options->countOnly == 0) {
param->letters = 0; param->letters = 0;
param->count = 0; param->unk_0x20 = 0;
param->candidates[0] = 0; param->candidates[0] = 0;
} }
Zi8LogError(100, ZI_WORK); Zi8LogError(100, ZI_WORK);
@@ -365,22 +365,22 @@ match_word:
return options->maxCount; return options->maxCount;
} }
param->candidates[search.candidateCount++] = search.character; param->candidates[search.candidateCount++] = search.character;
++param->count; ++param->unk_0x20;
if (++param->letters >= param->maxCandidates) { if (++param->letters >= param->maxCandidates) {
return param->letters; return param->letters;
} }
} }
} else { } else {
param->candidates[search.candidateCount++] = search.character; param->candidates[search.candidateCount++] = search.character;
++param->count; ++param->unk_0x20;
if (++param->letters >= param->maxCandidates) { if (++param->letters >= param->maxCandidates) {
Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK); Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK);
param->count = search.candidateCount; param->unk_0x20 = search.candidateCount;
param->letters = search.candidateCount; param->letters = search.candidateCount;
if (search.candidateCount < param->maxCandidates) goto skip_word; if (search.candidateCount < param->maxCandidates) goto skip_word;
if (options->countOnly != 0) { if (options->countOnly != 0) {
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount; if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
param->count = 0; param->unk_0x20 = 0;
param->letters = 0; param->letters = 0;
search.candidateCount = 0; search.candidateCount = 0;
} else { } else {
@@ -395,17 +395,17 @@ match_word:
if ((search.candidateIndex == search.candidateCount) && if ((search.candidateIndex == search.candidateCount) &&
(Zi8_814833F0(param, search.character, ZI_WORK) == 0)) { (Zi8_814833F0(param, search.character, ZI_WORK) == 0)) {
param->candidates[search.candidateCount++] = search.character; param->candidates[search.candidateCount++] = search.character;
++param->count; ++param->unk_0x20;
if (++param->letters < param->maxCandidates) { if (++param->letters < param->maxCandidates) {
goto skip_word; goto skip_word;
} }
Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK); Zi8_814834AC(param, &search.remainingCandidates, &search.candidateCount, &search.inserted, ZI_WORK);
param->count = search.candidateCount; param->unk_0x20 = search.candidateCount;
param->letters = search.candidateCount; param->letters = search.candidateCount;
if (search.candidateCount < param->maxCandidates) goto skip_word; if (search.candidateCount < param->maxCandidates) goto skip_word;
if (options->countOnly != 0) { if (options->countOnly != 0) {
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount; if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
param->count = 0; param->unk_0x20 = 0;
param->letters = 0; param->letters = 0;
search.candidateCount = 0; search.candidateCount = 0;
} else { } else {
@@ -435,7 +435,7 @@ search_table:
if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount; if ((search.prefixCount += search.candidateCount) >= (ziS32)options->maxCount) return options->maxCount;
search.resultCount = search.prefixCount; search.resultCount = search.prefixCount;
} }
param->count = search.candidateCount; param->unk_0x20 = search.candidateCount;
param->letters = search.candidateCount; param->letters = search.candidateCount;
} }
if (param->elementCount > 9) { if (param->elementCount > 9) {

View File

@@ -45,7 +45,7 @@ posEntry:
if (pattern[position] == Zi8ConvertWC2Key(word[position], language, __zi8_work_data)) continue; if (pattern[position] == Zi8ConvertWC2Key(word[position], language, __zi8_work_data)) continue;
break; break;
} else if (word[position] != pattern[position]) { } else if (word[position] != pattern[position]) {
if (!ZI_WORK->ignoreCase || language == 1) break; if (!ZI_WORK->unk_0x1F || language == 1) break;
folded = pattern[position]; folded = pattern[position];
if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data) || folded != word[position]) break; if (!Zi8ChangeCharCase(1, &folded, language, __zi8_work_data) || folded != word[position]) break;
} }

View File

@@ -239,7 +239,7 @@ ziBool Zi8PrepareMatch(ziGetParam* request, ziMatchParam* match, ziU8 skipMode Z
} }
if ((request->getMode == '\x01') || (request->getMode == '\f')) { if ((request->getMode == '\x01') || (request->getMode == '\f')) {
match->nCand = Zi8GetPyPhonetic(request->elements,elementCount,match->phon,match->phon2, match->nCand = Zi8GetPyPhonetic(request->elements,elementCount,match->phon,match->phon2,
&request->completion,&match->first,&match->first2,__zi8_work_data); &request->count,&match->first,&match->first2,__zi8_work_data);
} }
else { else {
initial = 0; initial = 0;
@@ -250,7 +250,7 @@ ziBool Zi8PrepareMatch(ziGetParam* request, ziMatchParam* match, ziU8 skipMode Z
previousFinal = 0; previousFinal = 0;
buffers.phoneticInput = request->elements; buffers.phoneticInput = request->elements;
match->nCand = 0; match->nCand = 0;
request->completion = request->elementCount; request->count = request->elementCount;
phoneticLength = 1; phoneticLength = 1;
for (index = 0; index < elementCount; index++) { for (index = 0; index < elementCount; index++) {
stroke = Zi8GetBpmfPhonetic(buffers.phoneticInput,phoneticLength,&initial,&final,&bestInitial,&bestFinal, stroke = Zi8GetBpmfPhonetic(buffers.phoneticInput,phoneticLength,&initial,&final,&bestInitial,&bestFinal,
@@ -287,7 +287,7 @@ savePhonetic:
goto savePhonetic; goto savePhonetic;
} }
if (match->nCand == 1) { if (match->nCand == 1) {
request->completion = phoneticLength - 1; request->count = phoneticLength - 1;
} }
buffers.phoneticInput = buffers.phoneticInput + phoneticLength - 1; buffers.phoneticInput = buffers.phoneticInput + phoneticLength - 1;
phoneticLength = 0; phoneticLength = 0;
@@ -306,7 +306,7 @@ savePhonetic:
} }
} }
if (((request->context & contextMask) != 0) && if (((request->context & contextMask) != 0) &&
((1 < match->nCand || (request->completion != elementCount)))) { ((1 < match->nCand || (request->count != elementCount)))) {
match->phon[0] = 0xFFFF; match->phon[0] = 0xFFFF;
match->phon2[0] = 0xFFFF; match->phon2[0] = 0xFFFF;
match->nCand = 0; match->nCand = 0;

View File

@@ -152,10 +152,10 @@ u32 __SCGetConfBufSize();
typedef struct SC_BT_DEV_INFO { typedef struct SC_BT_DEV_INFO {
u8 devName[20]; // 0x00 u8 devName[20]; // 0x00
u8 pad_0x14; // 0x14 u8 unk_0x14;
u8 pad_0x15[0xB]; // 0x15 u8 unk_0x15[0xB];
LINK_KEY linkKey; // 0x20 LINK_KEY linkKey; // 0x20
u8 pad_0x30[0x10]; // 0x30 u8 unk_0x30[0x10];
} SC_BT_DEV_INFO; } SC_BT_DEV_INFO;
typedef struct SCBtDeviceInfo { typedef struct SCBtDeviceInfo {

View File

@@ -10,7 +10,7 @@ extern "C" {
#endif #endif
typedef void (*USBCallback)(IOSError result, void* arg); typedef void (*USBCallback)(IOSError result, void* arg);
typedef void (*USBIsoCallback)(IOSError err, void* isoArg, void* cbArg); typedef void (*USBIsoCallback)(IOSError err, void* unkIsoArg, void* cbArg);
IOSError IUSB_OpenLib(); IOSError IUSB_OpenLib();
IOSError IUSB_CloseLib(); IOSError IUSB_CloseLib();

View File

@@ -133,11 +133,11 @@ typedef struct WPADExtConfig {
union { union {
struct WPADFSConfig { struct WPADFSConfig {
s16 stickXCenter; // 0x00 s16 stickXCenter; // 0x00
s16 stickXMin; // 0x02 s16 unk_0x02; // 0x02
s16 stickXMax; // 0x04 s16 unk_0x04; // 0x04
s16 stickYCenter; // 0x06 s16 stickYCenter; // 0x06
s16 stickYMin; // 0x08 s16 unk_0x08; // 0x08
s16 stickYMax; // 0x0A s16 unk_0x0A; // 0x0A
s16 accX0g; // 0x0C s16 accX0g; // 0x0C
s16 accY0g; // 0x0E s16 accY0g; // 0x0E
@@ -150,18 +150,18 @@ typedef struct WPADExtConfig {
struct WPADCLConfig { struct WPADCLConfig {
s16 lStickXCenter; // 0x00 s16 lStickXCenter; // 0x00
s16 lStickXMin; // 0x02 s16 unk_0x02; // 0x02
s16 lStickXMax; // 0x04 s16 unk_0x04; // 0x04
s16 lStickYCenter; // 0x06 s16 lStickYCenter; // 0x06
s16 lStickYMin; // 0x08 s16 unk_0x08; // 0x08
s16 lStickYMax; // 0x0A s16 unk_0x0A; // 0x0A
s16 rStickXCenter; // 0x0C s16 rStickXCenter; // 0x0C
s16 rStickXMin; // 0x0E s16 unk_0x0E; // 0x0E
s16 rStickXMax; // 0x10 s16 unk_0x10; // 0x10
s16 rStickYCenter; // 0x12 s16 rStickYCenter; // 0x12
s16 rStickYMin; // 0x14 s16 unk_0x14; // 0x14
s16 rStickYMax; // 0x16 s16 unk_0x16; // 0x16
u8 triggerLZero; // 0x18 u8 triggerLZero; // 0x18
u8 triggerRZero; // 0x19 u8 triggerRZero; // 0x19
@@ -171,7 +171,7 @@ typedef struct WPADExtConfig {
typedef struct WPADCB { typedef struct WPADCB {
WPADGameInfo gameInfo; // 0x00 WPADGameInfo gameInfo; // 0x00
s32 gameInfoStatus[2]; // 0x38 s32 unk_0x38[2];
u8 rxBufMain[RX_BUFFER_SIZE]; // 0x40 u8 rxBufMain[RX_BUFFER_SIZE]; // 0x40
u8 rxBufs[2][RX_BUFFER_SIZE]; // 0xA0 u8 rxBufs[2][RX_BUFFER_SIZE]; // 0xA0
WPADCommandQueue stdCmdQueue; // 0x160 WPADCommandQueue stdCmdQueue; // 0x160
@@ -223,7 +223,7 @@ typedef struct WPADCB {
u16 filterDiffExt; // 0x900 u16 filterDiffExt; // 0x900
u16 filterSameExt; // 0x902 u16 filterSameExt; // 0x902
s64 lastReportSendTime; // 0x908 s64 lastReportSendTime; // 0x908
u8 suppressDisconnect; // 0x910 u8 unk_0x910;
u8 calibrated; // 0x911 u8 calibrated; // 0x911
u16 comboHeld; // 0x912 u16 comboHeld; // 0x912
u8 encryptionKey[16]; // 0x914 u8 encryptionKey[16]; // 0x914
@@ -242,8 +242,8 @@ typedef struct WPADCB {
WPADCallback getInfoCB; // 0x988 WPADCallback getInfoCB; // 0x988
u8 getInfoBusy; // 0x98C u8 getInfoBusy; // 0x98C
u8 encStatus; // 0x98D u8 unk_0x98D; // 0x98D
u8 continuous; // 0x98E u8 unk_0x98E; // 0x98E
u8 unk_0x98F[0x9A0 - 0x990]; u8 unk_0x98F[0x9A0 - 0x990];
} WPADCB; } WPADCB;
@@ -261,7 +261,7 @@ void WPADiExcludeButton(s32 chan);
void WPADiCopyOut(s32 chan); void WPADiCopyOut(s32 chan);
BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback); BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback);
BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL continuous, WPADCallback pCallback); BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback);
BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); BOOL WPADiSendEnableDPD(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback);
BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback); BOOL WPADiSendEnableSpeaker(WPADCommandQueue* pQueue, BOOL enable, WPADCallback pCallback);
BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback); BOOL WPADiSendGetContStat(WPADCommandQueue* pQueue, WPADInfo* pInfo, WPADCallback pCallback);

View File

@@ -24,7 +24,7 @@ typedef struct WPADMemBlock {
int unk_0x04; // 0x04 int unk_0x04; // 0x04
s16 unk_0x08; // 0x08 s16 unk_0x08; // 0x08
int unk_0x0C; // 0x0C int unk_0x0C; // 0x0C
WPADCallback callback; // 0x10 WPADCallback unk_0x10; // 0x10
} WPADMemBlock; } WPADMemBlock;
typedef struct WPADGameInfo { typedef struct WPADGameInfo {

View File

@@ -26,7 +26,7 @@ typedef struct USBKBDCmdLED {
typedef struct USBKBDCmdLEDAsync { typedef struct USBKBDCmdLEDAsync {
USBKBDCmdLED base; // 0x00 USBKBDCmdLED base; // 0x00
u8 pad_0x08[0x10]; // 0x08 u8 unk_0x08[0x10];
USBKBDCmdLEDCallback cb; // 0x18 USBKBDCmdLEDCallback cb; // 0x18
void* cbArg; // 0x1C void* cbArg; // 0x1C
} USBKBDCmdLEDAsync; } USBKBDCmdLEDAsync;

View File

@@ -66,16 +66,16 @@
typedef struct typedef struct
{ {
HC_BT_HDR *p_rx_msg[3]; // 0x00 HC_BT_HDR *at_0x00[3]; // 0x00
UINT16 bytes_left[3]; // 0x0c UINT16 at_0x0c[3]; // 0x0c
UINT16 buf_size; // 0x12 UINT16 at_0x12; // 0x12
UINT8 pkt_type[3]; // 0x14 UINT8 at_0x14[3]; // 0x14
UINT8 len_hi[3]; // 0x17 UINT8 at_0x17[3]; // 0x17
UINT8 rx_state[3]; // 0x1a UINT8 at_0x1a[3]; // 0x1a
char pad4_[1]; // 0x1d char pad4_[1]; // 0x1d
UINT8 open_state; // 0x1e UINT8 at_0x1e; // 0x1e
UINT8 task_id; // 0x1f UINT8 at_0x1f; // 0x1f
UINT8 mbox; // 0x20 UINT8 at_0x20; // 0x20
char pad5_[2]; // 0x21 char pad5_[2]; // 0x21
/* 1 byte padding */ /* 1 byte padding */
} tHCISU_H2_CB; // size 0x24 } tHCISU_H2_CB; // size 0x24
@@ -135,7 +135,7 @@ UINT16 hcisu_h2_receive_msg(UINT16 pipe, tHCISU_H2_CB *p_cb)
UINT8 msg_received; UINT8 msg_received;
UINT16 r27; UINT16 r27;
if (p_cb->open_state != 2) if (p_cb->at_0x1e != 2)
return 0; return 0;
r27 = pipe + 1; r27 = pipe + 1;
@@ -148,36 +148,36 @@ UINT16 hcisu_h2_receive_msg(UINT16 pipe, tHCISU_H2_CB *p_cb)
++bytes_read; ++bytes_read;
msg_received = FALSE; msg_received = FALSE;
switch (p_cb->rx_state[pipe]) switch (p_cb->at_0x1a[pipe])
{ {
case 0: case 0:
if (r27 == 1) if (r27 == 1)
{ {
p_cb->p_rx_msg[pipe] = GKI_getpoolbuf(GKI_POOL_ID_2); p_cb->at_0x00[pipe] = GKI_getpoolbuf(GKI_POOL_ID_2);
p_cb->pkt_type[pipe] = 4; p_cb->at_0x14[pipe] = 4;
} }
else if (r27 == 2) else if (r27 == 2)
{ {
p_cb->p_rx_msg[pipe] = GKI_getpoolbuf(GKI_POOL_ID_3); p_cb->at_0x00[pipe] = GKI_getpoolbuf(GKI_POOL_ID_3);
p_cb->pkt_type[pipe] = 2; p_cb->at_0x14[pipe] = 2;
} }
else if (r27 == 3) else if (r27 == 3)
{ {
p_cb->p_rx_msg[pipe] = GKI_getpoolbuf(GKI_POOL_ID_1); p_cb->at_0x00[pipe] = GKI_getpoolbuf(GKI_POOL_ID_1);
p_cb->pkt_type[pipe] = 3; p_cb->at_0x14[pipe] = 3;
} }
else else
{ {
break; break;
} }
if (p_cb->p_rx_msg[pipe]) if (p_cb->at_0x00[pipe])
{ {
p_cb->p_rx_msg[pipe]->len = 0; p_cb->at_0x00[pipe]->len = 0;
p_cb->p_rx_msg[pipe]->event = p_cb->at_0x00[pipe]->event =
hcisu_msg_evt_table[p_cb->pkt_type[pipe] - 1]; hcisu_msg_evt_table[p_cb->at_0x14[pipe] - 1];
p_cb->p_rx_msg[pipe]->offset = 0; p_cb->at_0x00[pipe]->offset = 0;
p_cb->rx_state[pipe] = 1; p_cb->at_0x1a[pipe] = 1;
} }
else else
{ {
@@ -185,54 +185,54 @@ UINT16 hcisu_h2_receive_msg(UINT16 pipe, tHCISU_H2_CB *p_cb)
"HCIS: Unable to allocate buffer for incoming HCI " "HCIS: Unable to allocate buffer for incoming HCI "
"message."); "message.");
p_cb->rx_state[pipe] = 2; p_cb->at_0x1a[pipe] = 2;
} }
p_cb->bytes_left[pipe] = p_cb->at_0x0c[pipe] =
hcisu_preamble_table[p_cb->pkt_type[pipe] - 1]; hcisu_preamble_table[p_cb->at_0x14[pipe] - 1];
/* fallthrough */ /* fallthrough */
case 1: case 1:
*((UINT8 *)(p_cb->p_rx_msg[pipe] + 1) *((UINT8 *)(p_cb->at_0x00[pipe] + 1)
+ p_cb->p_rx_msg[pipe]->len++) = byte; + p_cb->at_0x00[pipe]->len++) = byte;
--p_cb->bytes_left[pipe]; --p_cb->at_0x0c[pipe];
if (p_cb->bytes_left[pipe] == 0) if (p_cb->at_0x0c[pipe] == 0)
{ {
msg_len = byte; msg_len = byte;
if (p_cb->pkt_type[pipe] == 2) if (p_cb->at_0x14[pipe] == 2)
{ {
msg_len = (msg_len << 8) + p_cb->len_hi[pipe]; msg_len = (msg_len << 8) + p_cb->at_0x17[pipe];
if ((p_cb->p_rx_msg[pipe] = if ((p_cb->at_0x00[pipe] =
(HC_BT_HDR *)l2cap_link_chk_pkt_start( (HC_BT_HDR *)l2cap_link_chk_pkt_start(
(BT_HDR *)p_cb->p_rx_msg[pipe])) (BT_HDR *)p_cb->at_0x00[pipe]))
== 0) == 0)
{ {
p_cb->bytes_left[pipe] = msg_len; p_cb->at_0x0c[pipe] = msg_len;
if (msg_len == 0) if (msg_len == 0)
p_cb->rx_state[pipe] = 0; p_cb->at_0x1a[pipe] = 0;
else else
p_cb->rx_state[pipe] = 4; p_cb->at_0x1a[pipe] = 4;
break; break;
} }
} }
p_cb->bytes_left[pipe] = msg_len; p_cb->at_0x0c[pipe] = msg_len;
if (sizeof(HC_BT_HDR) if (sizeof(HC_BT_HDR)
+ hcisu_preamble_table[p_cb->pkt_type[pipe] - 1] + hcisu_preamble_table[p_cb->at_0x14[pipe] - 1]
+ msg_len + msg_len
> GKI_get_buf_size(p_cb->p_rx_msg[pipe])) > GKI_get_buf_size(p_cb->at_0x00[pipe]))
{ {
GKI_freebuf(p_cb->p_rx_msg[pipe]); GKI_freebuf(p_cb->at_0x00[pipe]);
p_cb->p_rx_msg[pipe] = NULL; p_cb->at_0x00[pipe] = NULL;
p_cb->rx_state[pipe] = 4; p_cb->at_0x1a[pipe] = 4;
BT_TRACE(HCI, ERROR, BT_TRACE(HCI, ERROR,
"HCIS: Invalid length for incoming HCI message."); "HCIS: Invalid length for incoming HCI message.");
@@ -242,85 +242,85 @@ UINT16 hcisu_h2_receive_msg(UINT16 pipe, tHCISU_H2_CB *p_cb)
if (msg_len != 0) if (msg_len != 0)
{ {
p_cb->rx_state[pipe] = 3; p_cb->at_0x1a[pipe] = 3;
} }
else else
{ {
msg_received = TRUE; msg_received = TRUE;
p_cb->rx_state[pipe] = 0; p_cb->at_0x1a[pipe] = 0;
} }
} }
else else
{ {
p_cb->len_hi[pipe] = byte; p_cb->at_0x17[pipe] = byte;
} }
break; break;
case 2: case 2:
--p_cb->bytes_left[pipe]; --p_cb->at_0x0c[pipe];
if (p_cb->bytes_left[pipe] == 0) if (p_cb->at_0x0c[pipe] == 0)
{ {
msg_len = byte; msg_len = byte;
if (p_cb->pkt_type[pipe] == 2) if (p_cb->at_0x14[pipe] == 2)
msg_len = (msg_len << 8) + p_cb->len_hi[pipe]; msg_len = (msg_len << 8) + p_cb->at_0x17[pipe];
p_cb->bytes_left[pipe] = msg_len; p_cb->at_0x0c[pipe] = msg_len;
p_cb->rx_state[pipe] = 4; p_cb->at_0x1a[pipe] = 4;
} }
else else
{ {
p_cb->len_hi[pipe] = byte; p_cb->at_0x17[pipe] = byte;
} }
break; break;
case 3: case 3:
*((UINT8 *)(p_cb->p_rx_msg[pipe] + 1) *((UINT8 *)(p_cb->at_0x00[pipe] + 1)
+ p_cb->p_rx_msg[pipe]->len++) = byte; + p_cb->at_0x00[pipe]->len++) = byte;
--p_cb->bytes_left[pipe]; --p_cb->at_0x0c[pipe];
len = UUSB_Read(pipe + 1, len = UUSB_Read(pipe + 1,
(UINT8 *)(p_cb->p_rx_msg[pipe] + 1) (UINT8 *)(p_cb->at_0x00[pipe] + 1)
+ p_cb->p_rx_msg[pipe]->len, + p_cb->at_0x00[pipe]->len,
p_cb->bytes_left[pipe]); p_cb->at_0x0c[pipe]);
p_cb->p_rx_msg[pipe]->len += len; p_cb->at_0x00[pipe]->len += len;
p_cb->bytes_left[pipe] -= len; p_cb->at_0x0c[pipe] -= len;
bytes_read += len; bytes_read += len;
if (p_cb->bytes_left[pipe] == 0) if (p_cb->at_0x0c[pipe] == 0)
{ {
if (p_cb->pkt_type[pipe] == 2 if (p_cb->at_0x14[pipe] == 2
&& l2cap_link_chk_pkt_end() == 0) && l2cap_link_chk_pkt_end() == 0)
{ {
p_cb->rx_state[pipe] = 0; p_cb->at_0x1a[pipe] = 0;
} }
else else
{ {
msg_received = TRUE; msg_received = TRUE;
p_cb->rx_state[pipe] = 0; p_cb->at_0x1a[pipe] = 0;
} }
} }
break; break;
case 4: case 4:
--p_cb->bytes_left[pipe]; --p_cb->at_0x0c[pipe];
if (p_cb->bytes_left[pipe] == 0) if (p_cb->at_0x0c[pipe] == 0)
p_cb->rx_state[pipe] = 0; p_cb->at_0x1a[pipe] = 0;
break; break;
} }
if (msg_received) if (msg_received)
{ {
GKI_send_msg(hcisu_h2_cb.task_id, 0, p_cb->p_rx_msg[pipe]); GKI_send_msg(hcisu_h2_cb.at_0x1f, 0, p_cb->at_0x00[pipe]);
p_cb->p_rx_msg[pipe] = NULL; p_cb->at_0x00[pipe] = NULL;
} }
} }
@@ -382,7 +382,7 @@ void hcisu_h2_send_msg_now(tHCISU_H2_CB *cb, HC_BT_HDR *p_msg)
{ {
p_msg->event = MSG_HC_TO_STACK_L2C_SEG_XMIT; p_msg->event = MSG_HC_TO_STACK_L2C_SEG_XMIT;
GKI_send_msg(hcisu_h2_cb.task_id, 0, p_msg); GKI_send_msg(hcisu_h2_cb.at_0x1f, 0, p_msg);
return; return;
} }
@@ -405,15 +405,15 @@ void hcisu_h2_send_msg(tHCISU_H2_CB *p_cb, HC_BT_HDR *p_msg)
void hcisu_h2_init(UINT8 taskId, UINT8 mbox, UINT16 bufSize) void hcisu_h2_init(UINT8 taskId, UINT8 mbox, UINT16 bufSize)
{ {
hcisu_h2_cb.open_state = 0; hcisu_h2_cb.at_0x1e = 0;
hcisu_h2_cb.rx_state[0] = 0; hcisu_h2_cb.at_0x1a[0] = 0;
hcisu_h2_cb.rx_state[1] = 0; hcisu_h2_cb.at_0x1a[1] = 0;
hcisu_h2_cb.rx_state[2] = 0; hcisu_h2_cb.at_0x1a[2] = 0;
hcisu_h2_cb.task_id = taskId; hcisu_h2_cb.at_0x1f = taskId;
hcisu_h2_cb.mbox = mbox; hcisu_h2_cb.at_0x20 = mbox;
hcisu_h2_cb.buf_size = bufSize; hcisu_h2_cb.at_0x12 = bufSize;
} }
BOOLEAN hcisu_h2_open(tHCI_CFG *_p_cfg) BOOLEAN hcisu_h2_open(tHCI_CFG *_p_cfg)
@@ -424,9 +424,9 @@ BOOLEAN hcisu_h2_open(tHCI_CFG *_p_cfg)
uusb.at_0x0b = 0; uusb.at_0x0b = 0;
uusb.at_0x04 = p_cfg->at_0x00; uusb.at_0x04 = p_cfg->at_0x00;
uusb.at_0x06 = p_cfg->at_0x02; uusb.at_0x06 = p_cfg->at_0x02;
uusb.at_0x08 = hcisu_h2_cb.task_id; uusb.at_0x08 = hcisu_h2_cb.at_0x1f;
hcisu_h2_cb.open_state = 2; hcisu_h2_cb.at_0x1e = 2;
UUSB_Register(&uusb); UUSB_Register(&uusb);
UUSB_Open(&uusb, &hcisu_h2_usb_cback); UUSB_Open(&uusb, &hcisu_h2_usb_cback);
@@ -436,7 +436,7 @@ BOOLEAN hcisu_h2_open(tHCI_CFG *_p_cfg)
void hcisu_h2_close(void) void hcisu_h2_close(void)
{ {
hcisu_h2_cb.open_state = 0; hcisu_h2_cb.at_0x1e = 0;
UUSB_Close(); UUSB_Close();
UUSB_Unregister(); UUSB_Unregister();
@@ -454,7 +454,7 @@ int hcisu_h2_handle_event(UINT16 len)
UINT16 bytes_read; UINT16 bytes_read;
bytes_read = hcisu_h2_receive_msg( bytes_read = hcisu_h2_receive_msg(
len - sizeof(HC_BT_HDR) - hcisu_h2_cb.buf_size, &hcisu_h2_cb); len - sizeof(HC_BT_HDR) - hcisu_h2_cb.at_0x12, &hcisu_h2_cb);
return 0; return 0;
} }

View File

@@ -33,7 +33,7 @@ typedef struct
u8 bulkEndpoint1; u8 bulkEndpoint1;
u8 bulkEndpoint2; u8 bulkEndpoint2;
u8 intrEndpoint1; u8 intrEndpoint1;
u8 intrEndpoint2; char at_0x13; // intrEndpoint2?
int vid; int vid;
int pid; int pid;
UINT8 cmd_buffer_pool; UINT8 cmd_buffer_pool;
@@ -46,9 +46,9 @@ typedef struct
char pad4_[1]; char pad4_[1];
UINT8 reading_intr_data; UINT8 reading_intr_data;
BUFFER_Q bulk_buffer_q; BUFFER_Q bulk_buffer_q;
UINT8 bulk_outstanding; UINT8 at_0x38;
BUFFER_Q intr_buffer_q; BUFFER_Q intr_buffer_q;
UINT8 intr_outstanding; UINT8 at_0x48;
char pad8_[3]; char pad8_[3];
} tUUSB_CB; } tUUSB_CB;
@@ -158,7 +158,7 @@ static void uusb_CloseDeviceCB(long result, void *p_data)
usb.bulkEndpoint1 = 0; usb.bulkEndpoint1 = 0;
usb.bulkEndpoint2 = 0; usb.bulkEndpoint2 = 0;
usb.intrEndpoint1 = 0; usb.intrEndpoint1 = 0;
usb.intrEndpoint2 = 0; usb.at_0x13 = 0;
usb.fd = 0; usb.fd = 0;
@@ -363,12 +363,12 @@ static void uusb_WriteCtrlDataCB(long result, void *p_data)
GKI_disable(); GKI_disable();
--usb.intr_outstanding; --usb.at_0x48;
GKI_enable(); GKI_enable();
} }
if (usb.intr_outstanding >= 5) if (usb.at_0x48 >= 5)
return; return;
if (usb.intr_buffer_q.count == 0) if (usb.intr_buffer_q.count == 0)
@@ -389,7 +389,7 @@ static void uusb_WriteCtrlDataCB(long result, void *p_data)
{ {
GKI_disable(); GKI_disable();
++usb.intr_outstanding; ++usb.at_0x48;
GKI_enable(); GKI_enable();
} }
@@ -411,12 +411,12 @@ static void uusb_WriteBulkDataCB(long result, void *p_data)
GKI_disable(); GKI_disable();
--usb.bulk_outstanding; --usb.at_0x38;
GKI_enable(); GKI_enable();
} }
if (usb.bulk_outstanding >= 5) if (usb.at_0x38 >= 5)
return; return;
if (usb.bulk_buffer_q.count == 0) if (usb.bulk_buffer_q.count == 0)
@@ -436,7 +436,7 @@ static void uusb_WriteBulkDataCB(long result, void *p_data)
{ {
GKI_disable(); GKI_disable();
++usb.bulk_outstanding; ++usb.at_0x38;
GKI_enable(); GKI_enable();
} }
@@ -504,7 +504,7 @@ void UUSB_Register(tUUSB *uusb)
usb.bulkEndpoint1 = 0; usb.bulkEndpoint1 = 0;
usb.bulkEndpoint2 = 0; usb.bulkEndpoint2 = 0;
usb.intrEndpoint1 = 0; usb.intrEndpoint1 = 0;
usb.intrEndpoint2 = 0; usb.at_0x13 = 0;
if (uusb_get_devId(usb.vid, usb.pid) < 0) if (uusb_get_devId(usb.vid, usb.pid) < 0)
return; return;
@@ -512,13 +512,13 @@ void UUSB_Register(tUUSB *uusb)
usb.bulkEndpoint1 = 2; usb.bulkEndpoint1 = 2;
usb.bulkEndpoint2 = 130; usb.bulkEndpoint2 = 130;
usb.intrEndpoint1 = 129; usb.intrEndpoint1 = 129;
usb.intrEndpoint2 = 0; usb.at_0x13 = 0;
GKI_init_q(&usb.bulk_buffer_q); GKI_init_q(&usb.bulk_buffer_q);
usb.bulk_outstanding = 0; usb.at_0x38 = 0;
GKI_init_q(&usb.intr_buffer_q); GKI_init_q(&usb.intr_buffer_q);
usb.intr_outstanding = 0; usb.at_0x48 = 0;
usb.cmd_buffer_pool = GKI_create_pool(660, 45, 1, NULL); usb.cmd_buffer_pool = GKI_create_pool(660, 45, 1, NULL);
usb.acl_buffer_pool = GKI_create_pool(1800, 30, 1, NULL); usb.acl_buffer_pool = GKI_create_pool(1800, 30, 1, NULL);
@@ -607,7 +607,7 @@ UINT16 UUSB_Write(UINT8 pipe, void *p_data, UINT16 len, void *unused)
memcpy(p_buffer, p_data, len); memcpy(p_buffer, p_data, len);
if (usb.intr_outstanding < 5 && usb.intr_buffer_q.count == 0) if (usb.at_0x48 < 5 && usb.intr_buffer_q.count == 0)
{ {
ret = IUSB_WriteCtrlMsgAsync(usb.fd, 0x20, 0, 0, 0, len, p_buffer, ret = IUSB_WriteCtrlMsgAsync(usb.fd, 0x20, 0, 0, 0, len, p_buffer,
uusb_WriteCtrlDataCB, p_buf); uusb_WriteCtrlDataCB, p_buf);
@@ -634,7 +634,7 @@ UINT16 UUSB_Write(UINT8 pipe, void *p_data, UINT16 len, void *unused)
{ {
GKI_disable(); GKI_disable();
++usb.intr_outstanding; ++usb.at_0x48;
GKI_enable(); GKI_enable();
} }
@@ -658,7 +658,7 @@ UINT16 UUSB_Write(UINT8 pipe, void *p_data, UINT16 len, void *unused)
if (len > 190) if (len > 190)
UUSBDBG(" woah ! thats pretty Big ! :%d", len); UUSBDBG(" woah ! thats pretty Big ! :%d", len);
if (usb.bulk_outstanding < 5 && usb.bulk_buffer_q.count == 0) if (usb.at_0x38 < 5 && usb.bulk_buffer_q.count == 0)
{ {
ret = IUSB_WriteBlkMsgAsync(usb.fd, usb.bulkEndpoint1, len, ret = IUSB_WriteBlkMsgAsync(usb.fd, usb.bulkEndpoint1, len,
p_buffer, uusb_WriteBulkDataCB, p_buf); p_buffer, uusb_WriteBulkDataCB, p_buf);
@@ -685,7 +685,7 @@ UINT16 UUSB_Write(UINT8 pipe, void *p_data, UINT16 len, void *unused)
{ {
GKI_disable(); GKI_disable();
++usb.bulk_outstanding; ++usb.at_0x38;
GKI_enable(); GKI_enable();
} }

View File

@@ -353,41 +353,38 @@ static void reset_kpad(KPADInside* kpad) {
} }
void KPADGetProjectionPos(Vec2* dest, Vec2* src, const Rect* rect, f32 scale) { void KPADGetProjectionPos(Vec2* dest, Vec2* src, const Rect* rect, f32 scale) {
f32 aspect; f64 scaled;
f32 halfHeight; f32 height = rect->bottom - rect->top;
f32 half; f32 halfHeight = height * 0.5f;
f32 x; f32 x = src->x * halfHeight;
f32 height; f32 y = src->y * halfHeight;
height = rect->bottom - rect->top; x *= 1.2f;
half = 0.5f; y *= 1.2f;
halfHeight = height * half; scaled = 0.908 * scale;
x = src->x * halfHeight; dest->y = y;
aspect = 1.2f; dest->x = (f32)(x * scaled);
x = aspect * x;
dest->y = aspect * (src->y * halfHeight);
dest->x = (f32)(x * (0.908 * scale));
} }
void KPADSetSensorHeight(s32 chan, f32 sensorHeight) { void KPADSetSensorHeight(s32 chan, f32 sensorHeight) {
KPADInside* kpad; KPADInside* kpad;
f32 halfHeightSquared;
f32 halfHeight; f32 halfHeight;
f32 barOffsetX; f32 barOffsetX;
f32 barDiagonal; f32 barDiagonal;
f32 halfWidthSquared; f32 halfWidthSquared;
f32 halfWidth; f32 halfWidth;
f32 negativeSensorHeight; f32 negativeSensorHeight;
f32 zero; f32 barDiagonalSquared;
f32 halfHeightSquared;
halfWidth = 1.0f; halfWidth = 1.0f;
kpad = chan + inside_kpads; kpad = &inside_kpads[chan];
halfHeight = 0.75f; halfHeight = 0.75f;
negativeSensorHeight = -sensorHeight; negativeSensorHeight = -sensorHeight;
halfWidthSquared = halfWidth * halfWidth; halfWidthSquared = halfWidth * halfWidth;
halfHeightSquared = halfHeight * halfHeight; halfHeightSquared = halfHeight * halfHeight;
zero = 0.0f; kpad->sensorBarCenter.x = 0.0f;
kpad->sensorBarCenter.x = zero;
kpad->sensorBarCenter.y = negativeSensorHeight; kpad->sensorBarCenter.y = negativeSensorHeight;
barDiagonal = (f32)sqrt(halfWidthSquared + halfHeightSquared); barDiagonalSquared = halfWidthSquared + halfHeightSquared;
barDiagonal = (f32)sqrt(barDiagonalSquared);
barOffsetX = kpad->sensorBarCenter.x; barOffsetX = kpad->sensorBarCenter.x;
if (barOffsetX < 0.0f) { if (barOffsetX < 0.0f) {
halfWidth += barOffsetX; halfWidth += barOffsetX;
@@ -468,24 +465,29 @@ static void calc_button_repeat(KPADInside* kpad, u8 extension, s32 elapsed) {
} }
static void calc_acc_horizon(KPADInside* kpad) { static void calc_acc_horizon(KPADInside* kpad) {
f32 magnitude; f32 magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);
f32 normalizedX; f32 normalizedX;
f32 normalizedY; f32 normalizedY;
f32 targetY;
f32 targetX;
f32 productX;
f32 oldX;
f32 oldY;
f32 blend; f32 blend;
f32 projectedX; f32 projectedX;
f32 smoothing;
f32 deltaX; f32 deltaX;
f32 nextX; f32 nextX;
f32 nextY; f32 nextY;
f32 normalized; f32 normalized;
f32 oldCircleY;
f32 circleX;
f32 oldCircleX;
f32 unitY;
f32 unitX; f32 unitX;
f32 oldCircleX;
f32 oldCircleY;
f32 unitY;
f32 circleX;
f32 deltaCircleX; f32 deltaCircleX;
f32 circleY; f32 circleY;
f32 deltaCircleY; f32 deltaCircleY;
magnitude = (f32)sqrt(kpad->acceleration.x * kpad->acceleration.x + kpad->acceleration.y * kpad->acceleration.y);
if (magnitude == 0.0f || magnitude >= 2.0f) { if (magnitude == 0.0f || magnitude >= 2.0f) {
return; return;
} }
@@ -495,12 +497,17 @@ static void calc_acc_horizon(KPADInside* kpad) {
if (magnitude > 1.0f) { if (magnitude > 1.0f) {
magnitude = 2.0f - magnitude; magnitude = 2.0f - magnitude;
} }
targetY = kpad->accelNormal.y;
targetX = kpad->accelNormal.x;
productX = targetX * normalizedX;
oldX = kpad->horizonAxis.x;
oldY = kpad->horizonAxis.y;
blend = magnitude * kp_acc_horizon_pw; blend = magnitude * kp_acc_horizon_pw;
projectedX = kpad->accelNormal.x * normalizedX + kpad->accelNormal.y * normalizedY; projectedX = productX + targetY * normalizedY;
magnitude *= blend; smoothing = magnitude * blend;
deltaX = magnitude * (projectedX - kpad->horizonAxis.x); deltaX = smoothing * (projectedX - oldX);
nextX = kpad->horizonAxis.x + deltaX; nextX = oldX + deltaX;
nextY = kpad->horizonAxis.y + magnitude * (((kpad->accelNormal.y * normalizedX) - (kpad->accelNormal.x * normalizedY)) - kpad->horizonAxis.y); nextY = oldY + smoothing * (((targetY * normalizedX) - (targetX * normalizedY)) - oldY);
normalized = (f32)sqrt(nextX * nextX + nextY * nextY); normalized = (f32)sqrt(nextX * nextX + nextY * nextY);
if (normalized != 0.0f) { if (normalized != 0.0f) {
unitX = nextX / normalized; unitX = nextX / normalized;
@@ -781,18 +788,24 @@ nextObject:
static s8 select_1obj_first(KPADInside* kpad) { static s8 select_1obj_first(KPADInside* kpad) {
KPADDPDObject* object = kpad->dpdState.objects; KPADDPDObject* object = kpad->dpdState.objects;
f32 offsetX = kpad->horizonTangent.x * kpad->horizonAxis.x + kpad->horizonTangent.y * kpad->horizonAxis.y; KPADDPDObject* end = kpad->dpdState.candidates;
f32 offsetY = kpad->horizonTangent.y * kpad->horizonAxis.x - kpad->horizonTangent.x * kpad->horizonAxis.y; f32 scale = kpad->dpdObjectScale;
offsetX *= kpad->dpdObjectScale; f32 productX = kpad->horizonTangent.x * kpad->horizonAxis.x;
offsetY *= kpad->dpdObjectScale; f32 productY = kpad->horizonTangent.y * kpad->horizonAxis.x;
f32 offsetX = productX + kpad->horizonTangent.y * kpad->horizonAxis.y;
f32 offsetY = productY - kpad->horizonTangent.x * kpad->horizonAxis.y;
offsetX *= scale;
offsetY *= scale;
do { do {
if ((s8)object->metadata.bytes.flags == 0) { if ((s8)object->metadata.bytes.flags == 0) {
f32 x = object->x;
f32 y = object->y;
Vec2 leftPosition; Vec2 leftPosition;
Vec2 rightPosition; Vec2 rightPosition;
leftPosition.x = object->x - offsetX; leftPosition.x = x - offsetX;
leftPosition.y = object->y - offsetY; leftPosition.y = y - offsetY;
rightPosition.x = object->x + offsetX; rightPosition.x = x + offsetX;
rightPosition.y = object->y + offsetY; rightPosition.y = y + offsetY;
if (leftPosition.x <= kpad->value4F4 || leftPosition.x >= kpad->value4FC || leftPosition.y <= kpad->value4F8 || leftPosition.y >= kpad->value500) { if (leftPosition.x <= kpad->value4F4 || leftPosition.x >= kpad->value4FC || leftPosition.y <= kpad->value4F8 || leftPosition.y >= kpad->value500) {
if (rightPosition.x > kpad->value4F4 && rightPosition.x < kpad->value4FC && rightPosition.y > kpad->value4F8 && rightPosition.y < kpad->value500) { if (rightPosition.x > kpad->value4F4 && rightPosition.x < kpad->value4FC && rightPosition.y > kpad->value4F8 && rightPosition.y < kpad->value500) {
kpad->dpdState.candidates[1] = *object; kpad->dpdState.candidates[1] = *object;
@@ -809,7 +822,7 @@ static s8 select_1obj_first(KPADInside* kpad) {
return -1; return -1;
} }
} }
} while (++object < kpad->dpdState.candidates); } while (++object < end);
return 0; return 0;
} }

View File

@@ -41,13 +41,13 @@ typedef struct USBCommandBlock {
USBCallback callback; // 0x00 USBCallback callback; // 0x00
USBIsoCallback isoCallback; // 0x04 USBIsoCallback isoCallback; // 0x04
void* callbackArg; // 0x08 void* callbackArg; // 0x08
void* isoArg; // 0x0C void* unkIsoArg; // 0x0C
char pad_0x10[0x4]; char unk_0x10[0x4];
void* clean[USB_NCLEAN_MAX]; // 0x14 void* clean[USB_NCLEAN_MAX]; // 0x14
u32 nclean; // 0x34 u32 nclean; // 0x34
char pad_0x38[0x40 - 0x38]; char unk_0x38[0x40 - 0x38];
union { union {
char path[FS_MAX_PATH]; char path[FS_MAX_PATH];
USBMsg msg; USBMsg msg;
@@ -174,7 +174,7 @@ static s32 _intrBlkCtrlIsoCb(s32 result, void* arg) {
block->callback(result, block->callbackArg); block->callback(result, block->callbackArg);
} else if (block->isoCallback != NULL) { } else if (block->isoCallback != NULL) {
USB_LOG("calling iso callback\n"); USB_LOG("calling iso callback\n");
block->isoCallback(result, block->isoArg, block->callbackArg); block->isoCallback(result, block->unkIsoArg, block->callbackArg);
} }
IOSFree(block); IOSFree(block);

View File

@@ -7,9 +7,9 @@
static struct { static struct {
struct { struct {
OSMessageQueue* queue; // 0x00 OSMessageQueue* queue; // 0x00
void* messages; // 0x04 (OSMessage* array for OSInitMessageQueue) void* unk_0x04;
} entries[MAX_PUH_SEM]; // 0x00 } entries[MAX_PUH_SEM]; // 0x00
void* pad_0x14; // unused void* unk_0x14;
} st_uhs_ker_msg_mng; } st_uhs_ker_msg_mng;
s32 uhf_ker_send_message(int index, void* message) { s32 uhf_ker_send_message(int index, void* message) {

View File

@@ -7,12 +7,12 @@
static struct { static struct {
struct { struct {
OSSemaphore* sem; // 0x00 OSSemaphore* sem; // 0x00
u32 initCount; u32 unk_0x04;
u32 flags; u32 unk_0x08;
} entries[MAX_PUH_SEM]; // 0x00 } entries[MAX_PUH_SEM]; // 0x00
u32 usedCount; u32 unk_0x90;
OSSemaphore* lockSem; OSSemaphore* unk_0x94;
u8 pad[0x0C]; u8 unk_0x98[0x0C];
} st_uhs_ker_sem_mng; } st_uhs_ker_sem_mng;
static OSSemaphore st_uhf_ker_sem[MAX_PUH_SEM]; static OSSemaphore st_uhf_ker_sem[MAX_PUH_SEM];
@@ -20,17 +20,17 @@ static OSSemaphore st_uhf_ker_sem[MAX_PUH_SEM];
static s32 st_uhs_ker_sem_status; static s32 st_uhs_ker_sem_status;
static int uhf_ker_sem_inline_0() { static int uhf_ker_sem_inline_0() {
if (st_uhs_ker_sem_status != 1 || st_uhs_ker_sem_mng.lockSem == 0) { if (st_uhs_ker_sem_status != 1 || st_uhs_ker_sem_mng.unk_0x94 == 0) {
return -1; return -1;
} else { } else {
OSWaitSemaphore(st_uhs_ker_sem_mng.lockSem); OSWaitSemaphore(st_uhs_ker_sem_mng.unk_0x94);
return 0; return 0;
} }
} }
static void uhf_ker_sem_inline_1() { static void uhf_ker_sem_inline_1() {
if (st_uhs_ker_sem_status == 1 && st_uhs_ker_sem_mng.lockSem != 0) { if (st_uhs_ker_sem_status == 1 && st_uhs_ker_sem_mng.unk_0x94 != 0) {
OSSignalSemaphore(st_uhs_ker_sem_mng.lockSem); OSSignalSemaphore(st_uhs_ker_sem_mng.unk_0x94);
} }
} }
@@ -48,7 +48,7 @@ s32 uhf_ker_create_sem(u32 initCount, int flags) {
return -5; return -5;
} }
if (st_uhs_ker_sem_mng.usedCount == 12) { if (st_uhs_ker_sem_mng.unk_0x90 == 12) {
uhf_ker_sem_inline_1(); uhf_ker_sem_inline_1();
return -24; return -24;
} }
@@ -65,9 +65,9 @@ s32 uhf_ker_create_sem(u32 initCount, int flags) {
} }
st_uhs_ker_sem_mng.entries[i].sem = sem; st_uhs_ker_sem_mng.entries[i].sem = sem;
st_uhs_ker_sem_mng.entries[i].initCount = initCount; st_uhs_ker_sem_mng.entries[i].unk_0x04 = initCount;
st_uhs_ker_sem_mng.entries[i].flags = flags; st_uhs_ker_sem_mng.entries[i].unk_0x08 = flags;
st_uhs_ker_sem_mng.usedCount++; st_uhs_ker_sem_mng.unk_0x90++;
uhf_ker_sem_inline_1(); uhf_ker_sem_inline_1();
@@ -97,9 +97,9 @@ s32 uhf_ker_delete_sem(int sem) {
} }
st_uhs_ker_sem_mng.entries[sem - 1].sem = NULL; st_uhs_ker_sem_mng.entries[sem - 1].sem = NULL;
st_uhs_ker_sem_mng.entries[sem - 1].initCount = 0; st_uhs_ker_sem_mng.entries[sem - 1].unk_0x04 = 0;
st_uhs_ker_sem_mng.entries[sem - 1].flags = 0; st_uhs_ker_sem_mng.entries[sem - 1].unk_0x08 = 0;
st_uhs_ker_sem_mng.usedCount--; st_uhs_ker_sem_mng.unk_0x90--;
uhf_ker_sem_inline_1(); uhf_ker_sem_inline_1();

View File

@@ -6,13 +6,13 @@
static struct { static struct {
struct { struct {
OSThread* thread; // 0x00 OSThread* unk_0x00;
u8 stack[0x33C]; // 0x04 u8 unk_0x04[0x33C];
} entries[MAX_PUH_TSK]; // 0x00 } entries[MAX_PUH_TSK]; // 0x00
u32 pad_0x680; u32 unk_0x680;
u32 pad_0x684; u32 unk_0x684;
u32 pad_0x688; u32 unk_0x688;
u32 pad_0x68C; u32 unk_0x68C;
} st_uhs_ker_tsk_mng; } st_uhs_ker_tsk_mng;
s32 uhf_ker_set_priority(int tsk, int priority) { s32 uhf_ker_set_priority(int tsk, int priority) {
@@ -24,9 +24,9 @@ s32 uhf_ker_set_priority(int tsk, int priority) {
return -5; return -5;
} }
if (st_uhs_ker_tsk_mng.entries[tsk - 1].thread == NULL) { if (st_uhs_ker_tsk_mng.entries[tsk - 1].unk_0x00 == NULL) {
return -1; return -1;
} }
return OSSetThreadPriority(st_uhs_ker_tsk_mng.entries[tsk - 1].thread, priority) ? 0 : -20; return OSSetThreadPriority(st_uhs_ker_tsk_mng.entries[tsk - 1].unk_0x00, priority) ? 0 : -20;
} }

View File

@@ -20,7 +20,7 @@ typedef struct _usbKbdAsyncMem {
u32 state; // 0x00 u32 state; // 0x00
void* kbd; // 0x04 void* kbd; // 0x04
char modifiers; // 0x08 char modifiers; // 0x08
u8 reserved; // 0x09 u8 unk_0x09;
u8 keys[6]; // 0x0A u8 keys[6]; // 0x0A
} usbKbdAsyncMem; } usbKbdAsyncMem;

View File

@@ -580,7 +580,7 @@ void VIInit(void)
u16 displayConfig; u16 displayConfig;
u32 __VIDVDStopFlag_Enable_old; u32 __VIDVDStopFlag_Enable_old;
s32 format; s32 format;
u16 value; u32 value;
u32 tv; u32 tv;
u32 bootromTv; u32 bootromTv;

View File

@@ -190,7 +190,7 @@ static s32 WPADiSendData(s32 chan, WPADCommand command) {
if (status == WPAD_ERR_COMMUNICATION_ERROR) { if (status == WPAD_ERR_COMMUNICATION_ERROR) {
if ((s32)OSTicksToSeconds(__OSGetSystemTime() - p->lastReportSendTime) > 1 && _sleepTime != 0) { if ((s32)OSTicksToSeconds(__OSGetSystemTime() - p->lastReportSendTime) > 1 && _sleepTime != 0) {
if (!p->suppressDisconnect) { if (!p->unk_0x910) {
p->lastReportSendTime = __OSGetSystemTime(); p->lastReportSendTime = __OSGetSystemTime();
WPADiDisconnect(chan, FALSE); WPADiDisconnect(chan, FALSE);
} else { } else {
@@ -1263,7 +1263,7 @@ static void __ClearControlBlock(s32 chan) {
p->lastControllerDataUpdate = __OSGetSystemTime(); p->lastControllerDataUpdate = __OSGetSystemTime();
p->lastReportSendTime = __OSGetSystemTime(); p->lastReportSendTime = __OSGetSystemTime();
p->suppressDisconnect = 0; p->unk_0x910 = 0;
p->unk_0x8C9 = 0; p->unk_0x8C9 = 0;
p->unk_0x8C4 = 0; p->unk_0x8C4 = 0;
p->wmReadDataPtr = NULL; p->wmReadDataPtr = NULL;
@@ -1283,7 +1283,7 @@ static void __ClearControlBlock(s32 chan) {
p->sleeping = TRUE; p->sleeping = TRUE;
p->getInfoBusy = FALSE; p->getInfoBusy = FALSE;
p->getInfoCB = NULL; p->getInfoCB = NULL;
p->continuous = 0; p->unk_0x98E = 0;
memset(&p->wpInfo, 0, sizeof(p->wpInfo)); memset(&p->wpInfo, 0, sizeof(p->wpInfo));
memset(&p->wmReadDataBuf, 0, sizeof(p->wmReadDataBuf)); memset(&p->wmReadDataBuf, 0, sizeof(p->wmReadDataBuf));
@@ -1298,8 +1298,8 @@ static void __ClearControlBlock(s32 chan) {
memset(&p->decryptXorTable, 0, sizeof(p->decryptXorTable)); memset(&p->decryptXorTable, 0, sizeof(p->decryptXorTable));
memset(&p->gameInfo, 0, sizeof(WPADGameInfo)); memset(&p->gameInfo, 0, sizeof(WPADGameInfo));
p->gameInfoStatus[0] = -1; p->unk_0x38[0] = -1;
p->gameInfoStatus[1] = -1; p->unk_0x38[1] = -1;
p->stdCmdQueue.buffer = p->stdCmdQueueList; p->stdCmdQueue.buffer = p->stdCmdQueueList;
p->stdCmdQueue.capacity = ARRAY_LENGTH(p->stdCmdQueueList); p->stdCmdQueue.capacity = ARRAY_LENGTH(p->stdCmdQueueList);
@@ -1315,7 +1315,7 @@ static void __ClearControlBlock(s32 chan) {
_wmb[chan].unk_0x04 = 0; _wmb[chan].unk_0x04 = 0;
_wmb[chan].unk_0x08 = 0; _wmb[chan].unk_0x08 = 0;
_wmb[chan].unk_0x0C = 0; _wmb[chan].unk_0x0C = 0;
_wmb[chan].callback = NULL; _wmb[chan].unk_0x10 = NULL;
_rumbleCnt[chan] = 0; _rumbleCnt[chan] = 0;
} }
@@ -1551,7 +1551,7 @@ static void firmwareCheckCallback(s32 chan, s32 status) {
DEBUGPrint(" ==>this error means that the firmware is for NDEV %s\n", p->configIndex != 0 ? "2.0" : "2.1 or later"); DEBUGPrint(" ==>this error means that the firmware is for NDEV %s\n", p->configIndex != 0 ? "2.0" : "2.1 or later");
WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->continuous, &abortConnCallback); WPADiSendSetReportType(&p->stdCmdQueue, WPAD_FMT_CORE_BTN, p->unk_0x98E, &abortConnCallback);
WPADiSendDPDCSB(&p->stdCmdQueue, FALSE, &abortConnCallback); WPADiSendDPDCSB(&p->stdCmdQueue, FALSE, &abortConnCallback);
WPADiSendSetPort(&p->stdCmdQueue, port, &abortConnCallback); WPADiSendSetPort(&p->stdCmdQueue, port, &abortConnCallback);
@@ -1626,7 +1626,7 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) {
p->status = WPAD_ERR_OK; p->status = WPAD_ERR_OK;
p->radioSensitivity = 100; p->radioSensitivity = 100;
p->sleeping = FALSE; p->sleeping = FALSE;
p->encStatus = FALSE; p->unk_0x98D = FALSE;
WPADiSendReadData(&p->stdCmdQueue, p->wmReadDataBuf, 1, WM_ADDR_MEM_1770, firmwareCheckCallback); WPADiSendReadData(&p->stdCmdQueue, p->wmReadDataBuf, 1, WM_ADDR_MEM_1770, firmwareCheckCallback);
@@ -1643,8 +1643,8 @@ static void WPADiConnCallback(WUDDevInfo* devInfo, u8 open) {
if (p->cmdBlkCB != NULL) { if (p->cmdBlkCB != NULL) {
p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER); p->cmdBlkCB(chan, WPAD_ERR_NO_CONTROLLER);
} else if (_wmb[chan].callback != NULL) { } else if (_wmb[chan].unk_0x10 != NULL) {
_wmb[chan].callback(chan, WPAD_ERR_NO_CONTROLLER); _wmb[chan].unk_0x10(chan, WPAD_ERR_NO_CONTROLLER);
} }
do { do {
@@ -1886,7 +1886,7 @@ s32 WPADSetDataFormat(s32 chan, u32 format) {
} }
if (currFormat != format) { if (currFormat != format) {
if (!WPADiSendSetReportType(&p->stdCmdQueue, format, p->continuous, NULL)) { if (!WPADiSendSetReportType(&p->stdCmdQueue, format, p->unk_0x98E, NULL)) {
status = WPAD_ERR_COMMUNICATION_ERROR; status = WPAD_ERR_COMMUNICATION_ERROR;
} else { } else {
enabled = OSDisableInterrupts(); enabled = OSDisableInterrupts();
@@ -2692,7 +2692,7 @@ static void __SendData(s32 chan, WPADCommand command) {
u32 time; u32 time;
memcpy(&time, command.dataBuf, sizeof(u32)); memcpy(&time, command.dataBuf, sizeof(u32));
p->lastReportSendTime = __OSGetSystemTime() + time; p->lastReportSendTime = __OSGetSystemTime() + time;
p->suppressDisconnect = 1; p->unk_0x910 = 1;
return; return;
} }
default: { default: {
@@ -2704,7 +2704,7 @@ static void __SendData(s32 chan, WPADCommand command) {
p->cmdBlkCB = command.cmdCB; p->cmdBlkCB = command.cmdCB;
p->lastReportID = reportID; p->lastReportID = reportID;
p->lastReportSendTime = __OSGetSystemTime() + OSSecondsToTicks(2); p->lastReportSendTime = __OSGetSystemTime() + OSSecondsToTicks(2);
p->suppressDisconnect = 0; p->unk_0x910 = 0;
OSRestoreInterrupts(enabled); OSRestoreInterrupts(enabled);
} }
@@ -2741,13 +2741,13 @@ BOOL WPADiSendSetPort(WPADCommandQueue* pQueue, u8 port, WPADCallback pCallback)
return success; return success;
} }
BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL continuous, WPADCallback pCallback) { BOOL WPADiSendSetReportType(WPADCommandQueue* pQueue, s32 format, BOOL unk, WPADCallback pCallback) {
BOOL success; BOOL success;
WPADCommand command; WPADCommand command;
command.reportID = RPTID_SET_DATA_REPORT_MODE; command.reportID = RPTID_SET_DATA_REPORT_MODE;
command.dataLength = RPT12_SIZE; command.dataLength = RPT12_SIZE;
command.dataBuf[RPT12_CONT_REPORT] = continuous ? 0 : 4; // Always continuous reporting command.dataBuf[RPT12_CONT_REPORT] = unk ? 0 : 4; // Always continuous reporting
command.cmdCB = pCallback; command.cmdCB = pCallback;
switch (format) { switch (format) {

View File

@@ -111,8 +111,8 @@ static void initExtension(s32 chan) {
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat,
p_wpd->continuous, abortInitExtension); p_wpd->unk_0x98E, abortInitExtension);
p_wpd->encStatus = 1; p_wpd->unk_0x98D = 1;
WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0x55, 0x04a400f0, WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0x55, 0x04a400f0,
abortInitExtension); abortInitExtension);
WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0, 0x04a400fb, WPADiSendWriteDataCmd(&p_wpd->extCmdQueue, 0, 0x04a400fb,
@@ -127,7 +127,7 @@ static void abortInitExtension(s32 chan, s32 result) {
if (result != WPAD_ERR_NONE) { if (result != WPAD_ERR_NONE) {
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
p_wpd->encStatus = 0; p_wpd->unk_0x98D = 0;
if (result == WPAD_ERR_NO_CONTROLLER) { if (result == WPAD_ERR_NO_CONTROLLER) {
type = WPAD_DEV_NOT_FOUND; type = WPAD_DEV_NOT_FOUND;
} }
@@ -142,7 +142,7 @@ static void abortInitExtension(s32 chan, s32 result) {
else { else {
DEBUGPrint("detaching extension during initialization.\n"); DEBUGPrint("detaching extension during initialization.\n");
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->continuous, NULL); WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->unk_0x98E, NULL);
return; return;
} }
p_wpd->devType = (u8)type; p_wpd->devType = (u8)type;
@@ -393,48 +393,48 @@ static void getExtConfig(s32 chan, s32 result) {
p_wpd->extConfig.u.fs.accX1g = (s16)((u16)(((u16)(p_buf[index + 4]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7]) >> 4) & 3)); p_wpd->extConfig.u.fs.accX1g = (s16)((u16)(((u16)(p_buf[index + 4]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7]) >> 4) & 3));
p_wpd->extConfig.u.fs.accY1g = (s16)((u16)(((u16)(p_buf[index + 5]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7]) >> 2) & 3)); p_wpd->extConfig.u.fs.accY1g = (s16)((u16)(((u16)(p_buf[index + 5]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7]) >> 2) & 3));
p_wpd->extConfig.u.fs.accZ1g = (s16)((u16)(((u16)(p_buf[index + 6]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7])) & 3)); p_wpd->extConfig.u.fs.accZ1g = (s16)((u16)(((u16)(p_buf[index + 6]) << 2) & 0xFFFC) | (u16)(((u16)(p_buf[index + 7])) & 3));
p_wpd->extConfig.u.fs.stickXMax = (s8)p_buf[index + 8]; p_wpd->extConfig.u.fs.unk_0x04 = (s8)p_buf[index + 8];
p_wpd->extConfig.u.fs.stickXMin = (s8)p_buf[index + 9]; p_wpd->extConfig.u.fs.unk_0x02 = (s8)p_buf[index + 9];
p_wpd->extConfig.u.fs.stickXCenter = (s8)p_buf[index + 10]; p_wpd->extConfig.u.fs.stickXCenter = (s8)p_buf[index + 10];
p_wpd->extConfig.u.fs.stickYMax = (s8)p_buf[index + 11]; p_wpd->extConfig.u.fs.unk_0x0A = (s8)p_buf[index + 11];
p_wpd->extConfig.u.fs.stickYMin = (s8)p_buf[index + 12]; p_wpd->extConfig.u.fs.unk_0x08 = (s8)p_buf[index + 12];
p_wpd->extConfig.u.fs.stickYCenter = (s8)p_buf[index + 13]; p_wpd->extConfig.u.fs.stickYCenter = (s8)p_buf[index + 13];
DEBUGPrint("0G: fsaccX = %d, fsaccY = %d, fsaccZ = %d\n", p_wpd->extConfig.u.fs.accX0g, p_wpd->extConfig.u.fs.accY0g, DEBUGPrint("0G: fsaccX = %d, fsaccY = %d, fsaccZ = %d\n", p_wpd->extConfig.u.fs.accX0g, p_wpd->extConfig.u.fs.accY0g,
p_wpd->extConfig.u.fs.accZ0g); p_wpd->extConfig.u.fs.accZ0g);
DEBUGPrint("1G: fsaccX = %d, fsaccY = %d, fsaccZ = %d\n", p_wpd->extConfig.u.fs.accX1g, p_wpd->extConfig.u.fs.accY1g, DEBUGPrint("1G: fsaccX = %d, fsaccY = %d, fsaccZ = %d\n", p_wpd->extConfig.u.fs.accX1g, p_wpd->extConfig.u.fs.accY1g,
p_wpd->extConfig.u.fs.accZ1g); p_wpd->extConfig.u.fs.accZ1g);
DEBUGPrint("FS: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.fs.stickXCenter, p_wpd->extConfig.u.fs.stickXMax, DEBUGPrint("FS: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.fs.stickXCenter, p_wpd->extConfig.u.fs.unk_0x04,
p_wpd->extConfig.u.fs.stickXMin); p_wpd->extConfig.u.fs.unk_0x02);
DEBUGPrint("FS: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.fs.stickYCenter, p_wpd->extConfig.u.fs.stickYMax, DEBUGPrint("FS: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.fs.stickYCenter, p_wpd->extConfig.u.fs.unk_0x0A,
p_wpd->extConfig.u.fs.stickYMin); p_wpd->extConfig.u.fs.unk_0x08);
} }
break; break;
case WPAD_DEV_CLASSIC: case WPAD_DEV_CLASSIC:
p_wpd->extConfig.u.cl.lStickXMax = (s8)p_buf[index + 0]; p_wpd->extConfig.u.cl.unk_0x04 = (s8)p_buf[index + 0];
p_wpd->extConfig.u.cl.lStickXMin = (s8)p_buf[index + 1]; p_wpd->extConfig.u.cl.unk_0x02 = (s8)p_buf[index + 1];
p_wpd->extConfig.u.cl.lStickXCenter = (s8)p_buf[index + 2]; p_wpd->extConfig.u.cl.lStickXCenter = (s8)p_buf[index + 2];
p_wpd->extConfig.u.cl.lStickYMax = (s8)p_buf[index + 3]; p_wpd->extConfig.u.cl.unk_0x0A = (s8)p_buf[index + 3];
p_wpd->extConfig.u.cl.lStickYMin = (s8)p_buf[index + 4]; p_wpd->extConfig.u.cl.unk_0x08 = (s8)p_buf[index + 4];
p_wpd->extConfig.u.cl.lStickYCenter = (s8)p_buf[index + 5]; p_wpd->extConfig.u.cl.lStickYCenter = (s8)p_buf[index + 5];
p_wpd->extConfig.u.cl.rStickXMax = (s8)p_buf[index + 6]; p_wpd->extConfig.u.cl.unk_0x10 = (s8)p_buf[index + 6];
p_wpd->extConfig.u.cl.rStickXMin = (s8)p_buf[index + 7]; p_wpd->extConfig.u.cl.unk_0x0E = (s8)p_buf[index + 7];
p_wpd->extConfig.u.cl.rStickXCenter = (s8)p_buf[index + 8]; p_wpd->extConfig.u.cl.rStickXCenter = (s8)p_buf[index + 8];
p_wpd->extConfig.u.cl.rStickYMax = (s8)p_buf[index + 9]; p_wpd->extConfig.u.cl.unk_0x16 = (s8)p_buf[index + 9];
p_wpd->extConfig.u.cl.rStickYMin = (s8)p_buf[index + 10]; p_wpd->extConfig.u.cl.unk_0x14 = (s8)p_buf[index + 10];
p_wpd->extConfig.u.cl.rStickYCenter = (s8)p_buf[index + 11]; p_wpd->extConfig.u.cl.rStickYCenter = (s8)p_buf[index + 11];
p_wpd->extConfig.u.cl.triggerLZero = p_buf[index + 12]; p_wpd->extConfig.u.cl.triggerLZero = p_buf[index + 12];
p_wpd->extConfig.u.cl.triggerRZero = p_buf[index + 13]; p_wpd->extConfig.u.cl.triggerRZero = p_buf[index + 13];
DEBUGPrint("CL: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.cl.lStickXCenter, p_wpd->extConfig.u.cl.lStickXMax, DEBUGPrint("CL: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.cl.lStickXCenter, p_wpd->extConfig.u.cl.unk_0x04,
p_wpd->extConfig.u.cl.lStickXMin); p_wpd->extConfig.u.cl.unk_0x02);
DEBUGPrint("CL: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.cl.lStickYCenter, p_wpd->extConfig.u.cl.lStickYMax, DEBUGPrint("CL: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.cl.lStickYCenter, p_wpd->extConfig.u.cl.unk_0x0A,
p_wpd->extConfig.u.cl.lStickYMin); p_wpd->extConfig.u.cl.unk_0x08);
DEBUGPrint("CR: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.cl.rStickXCenter, p_wpd->extConfig.u.cl.rStickXMax, DEBUGPrint("CR: X = %d, X max = %d, X min = %d\n", p_wpd->extConfig.u.cl.rStickXCenter, p_wpd->extConfig.u.cl.unk_0x10,
p_wpd->extConfig.u.cl.rStickXMin); p_wpd->extConfig.u.cl.unk_0x0E);
DEBUGPrint("CR: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.cl.rStickYCenter, p_wpd->extConfig.u.cl.rStickYMax, DEBUGPrint("CR: Y = %d, Y max = %d, Y min = %d\n", p_wpd->extConfig.u.cl.rStickYCenter, p_wpd->extConfig.u.cl.unk_0x16,
p_wpd->extConfig.u.cl.rStickYMin); p_wpd->extConfig.u.cl.unk_0x14);
DEBUGPrint("LR: L = %d, R = %d\n", p_wpd->extConfig.u.cl.triggerLZero, p_wpd->extConfig.u.cl.triggerRZero); DEBUGPrint("LR: L = %d, R = %d\n", p_wpd->extConfig.u.cl.triggerLZero, p_wpd->extConfig.u.cl.triggerRZero);
break; break;
} }
@@ -509,7 +509,7 @@ static void getExtType(s32 chan, s32 result) {
} }
} else { } else {
if (isExtEncMain(_devType[chan])) { if (isExtEncMain(_devType[chan])) {
p_wpd->encStatus = 2; p_wpd->unk_0x98D = 2;
WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension); WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension);
WPADiCreateKey(chan); WPADiCreateKey(chan);
WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension);
@@ -517,7 +517,7 @@ static void getExtType(s32 chan, s32 result) {
WPADiSendWriteData(cmdq, p_wpd->encryptionKey + 12, 4, 0x4A4004C, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey + 12, 4, 0x4A4004C, abortInitExtension);
WPADiSendReadData(cmdq, p_wpd->wmReadDataBuf, 32, 0x4A40020, p_wpd->extensionCB); WPADiSendReadData(cmdq, p_wpd->wmReadDataBuf, 32, 0x4A40020, p_wpd->extensionCB);
} else { } else {
p_wpd->encStatus = 3; p_wpd->unk_0x98D = 3;
WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension); WPADiSendWriteDataCmd(cmdq, 0xAA, 0x4A400F0, abortInitExtension);
WPADiCreateKeyFor3rd(chan); WPADiCreateKeyFor3rd(chan);
WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension); WPADiSendWriteData(cmdq, p_wpd->encryptionKey, 6, 0x4A40040, abortInitExtension);
@@ -547,9 +547,9 @@ static void getGameInfo(s32 chan, s32 result, u8 index) {
if (p_info->checksum == sum) { if (p_info->checksum == sum) {
memcpy(&p_wpd->gameInfo, p_buf, sizeof(WPADMEMGameInfo)); memcpy(&p_wpd->gameInfo, p_buf, sizeof(WPADMEMGameInfo));
p_wpd->gameInfoStatus[index] = WPAD_ERR_NONE; p_wpd->unk_0x38[index] = WPAD_ERR_NONE;
} else { } else {
p_wpd->gameInfoStatus[index] = WPAD_ERR_INVALID; p_wpd->unk_0x38[index] = WPAD_ERR_INVALID;
} }
} }
} }
@@ -651,7 +651,7 @@ void __a1_20_status_report(u8 chan, u8* data) {
p_wpd->devMode = 0; p_wpd->devMode = 0;
WPADiClearQueue(&p_wpd->extCmdQueue); WPADiClearQueue(&p_wpd->extCmdQueue);
WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->continuous, NULL); WPADiSendSetReportType(&p_wpd->extCmdQueue, p_wpd->dataFormat, p_wpd->unk_0x98E, NULL);
if (attach) { if (attach) {
if (p_wpd->extensionCB) { if (p_wpd->extensionCB) {
@@ -741,11 +741,11 @@ void __a1_21_user_data(u8 chan, u8* data) {
DEBUGPrint("length : %d\n", p_wpd->wmReadLength); DEBUGPrint("length : %d\n", p_wpd->wmReadLength);
status = (p_wpd->wmReadHadError < 0) ? WPAD_ERR_TRANSFER : 0; status = (p_wpd->wmReadHadError < 0) ? WPAD_ERR_TRANSFER : 0;
DEBUGPrint("i2c = %04x\n", i2c); DEBUGPrint("i2c = %04x\n", i2c);
DEBUGPrint("enc = %d\n", p_wpd->encStatus); DEBUGPrint("enc = %d\n", p_wpd->unk_0x98D);
if (i2c == 0x04a4) { if (i2c == 0x04a4) {
DEBUGPrint("Access to extension register.\n"); DEBUGPrint("Access to extension register.\n");
if (p_wpd->encStatus == 2 || p_wpd->encStatus == 3) { if (p_wpd->unk_0x98D == 2 || p_wpd->unk_0x98D == 3) {
DEBUGPrint("Decode!!!!\n"); DEBUGPrint("Decode!!!!\n");
DEBUGPrint(" len = %d, addr = %04x\n", len, base); DEBUGPrint(" len = %d, addr = %04x\n", len, base);

View File

@@ -19,7 +19,7 @@ typedef struct _CDBRecordFile {
#else #else
u8 unk_0x00[0x1C - 0x00]; u8 unk_0x00[0x1C - 0x00];
#endif #endif
int allocFlag; // 0x1C int unk_0x1C;
CDBAttr attr; // 0x20 CDBAttr attr; // 0x20
CDBBridgeFile bridgeFile; // 0x42C CDBBridgeFile bridgeFile; // 0x42C
u8 unk_0x434[0x438 - 0x434]; u8 unk_0x434[0x438 - 0x434];

View File

@@ -17,9 +17,9 @@ typedef struct NWC24FLHeader {
u32 version; // 0x04 u32 version; // 0x04
u32 infoCount; // 0x08 u32 infoCount; // 0x08
u32 registeredCount; // 0x0C u32 registeredCount; // 0x0C
u32 confirmedBits[4]; // 0x10 u32 unk_0x10[4];
u32 pad_0x20[7]; // unused u32 unk_0x20[7];
u32 listFlags; // 0x3C u32 unk_0x3C;
NWC24UserId friendIds[NWC24_FRIEND_INFO_MAX]; // 0x40 NWC24UserId friendIds[NWC24_FRIEND_INFO_MAX]; // 0x40
} NWC24FLHeader; } NWC24FLHeader;

View File

@@ -24,7 +24,7 @@ typedef struct NWC24MsgObjPrivate {
#ifdef NWC24_MSG_READ #ifdef NWC24_MSG_READ
u32 headerSize; u32 headerSize;
#elif defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT) #elif defined(NWC24_MBOX_CTRL) || defined(NWC24_MSG_COMMIT)
u32 headerSize; // 0x10 u32 unk_0x10;
#else #else
u8 unk_0x10[0x4]; u8 unk_0x10[0x4];
#endif #endif
@@ -46,8 +46,8 @@ typedef struct NWC24MsgObjPrivate {
#endif #endif
u32 date; // 0x28 u32 date; // 0x28
u32 receivedDate; // 0x2C u32 receivedDate; // 0x2C
NWC24Data fromData; // 0x30 NWC24Data unk_0x30;
NWC24Data toData; // 0x38 NWC24Data unk_0x38;
NWC24Data subject; // 0x40 NWC24Data subject; // 0x40
NWC24Data text; // 0x48 NWC24Data text; // 0x48
NWC24Data unk_0x50; NWC24Data unk_0x50;
@@ -73,15 +73,15 @@ typedef struct NWC24MsgObjPrivate {
}; };
u32 raw; u32 raw;
} msgBoardFlags; // 0xCC } msgBoardFlags; // 0xCC
NWC24Data extraData; // 0xD0 NWC24Data unk_0xD0;
NWC24Data faceData; // 0xD8 NWC24Data faceData; // 0xD8
NWC24Data altName; // 0xE0 NWC24Data altName; // 0xE0
u32 textSize; // 0xE4 u32 textSize; // 0xE4
u32 dwcId; // 0xEC u32 dwcId; // 0xEC
u32 iconNew; // 0xF0 u32 iconNew; // 0xF0
u32 pad_0xF4; u32 unk_0xF4;
u32 pad_0xF8; u32 unk_0xF8;
u32 pad_0xFC; u32 unk_0xFC;
} NWC24MsgObjPrivate; } NWC24MsgObjPrivate;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -26,9 +26,9 @@ extern struct NWC24Work {
u8 configData[1024]; // 0x1300 u8 configData[1024]; // 0x1300
u8 sendMbcHeader[128]; // 0x1700 u8 unk_0x1700[128]; // 0x1700
u8 recvMbcHeader[128]; // 0x1780 u8 unk_0x1780[128]; // 0x1780
u8 mbcEntry[256]; // 0x1800 u8 unk_0x1800[256]; // 0x1800
u8 base64Work[256]; // 0x1900 u8 base64Work[256]; // 0x1900
u8 unk_0x1A00[4096]; // 0x1A00 u8 unk_0x1A00[4096]; // 0x1A00

View File

@@ -62,7 +62,7 @@ typedef struct _CDBRecordKey {
} CDBRecordKey; } CDBRecordKey;
typedef struct _CDBRecord { typedef struct _CDBRecord {
u32 database; // 0x00 u32 unk_0x00;
void* cryptBuf; // 0x04 void* cryptBuf; // 0x04
CDBRecordKey key; // 0x08 CDBRecordKey key; // 0x08
void* file; // 0x38 void* file; // 0x38

View File

@@ -57,8 +57,8 @@ void CDBRecordInstanceInit(CDBRecordFile* recordFile, CDBRecord* record, int typ
OSLockMutex((OSMutex*)recordFile); OSLockMutex((OSMutex*)recordFile);
recordFile->used = 1; recordFile->used = 1;
OSUnlockMutex((OSMutex*)recordFile); OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = type; recordFile->unk_0x1C = type;
recordFile->database = record->database; recordFile->database = record->unk_0x00;
CDBAttrInit(&recordFile->attr); CDBAttrInit(&recordFile->attr);
CDBRecordKeyCopy(&recordFile->key, &record->key); CDBRecordKeyCopy(&recordFile->key, &record->key);
} }
@@ -73,7 +73,7 @@ BOOL CDBRecordInstanceIsUsed(CDBRecordFile* recordFile) {
void CDBRecordInitDescriptor(CDBRecord* record, CDBDatabase* database, CDBRecordKey* key) { void CDBRecordInitDescriptor(CDBRecord* record, CDBDatabase* database, CDBRecordKey* key) {
CDBLock(); CDBLock();
record->database = (u32)database; record->unk_0x00 = (u32)database;
CDBRecordKeyCopy(&record->key, key); CDBRecordKeyCopy(&record->key, key);
record->cryptBuf = NULL; record->cryptBuf = NULL;
record->file = NULL; record->file = NULL;
@@ -95,7 +95,7 @@ CDBErr CDBRecordCreateAtOnce(CDBRecord* record, CDBDatabase* database, const cha
CDBRecordKeyInit(&key, epoch, gameCode, makerCode, 0, fileType, CDB_FS_LOCATION_NAND); CDBRecordKeyInit(&key, epoch, gameCode, makerCode, 0, fileType, CDB_FS_LOCATION_NAND);
CDBLock(); CDBLock();
record->database = (u32)database; record->unk_0x00 = (u32)database;
CDBRecordKeyCopy(&record->key, &key); CDBRecordKeyCopy(&record->key, &key);
record->cryptBuf = NULL; record->cryptBuf = NULL;
record->file = NULL; record->file = NULL;
@@ -128,7 +128,7 @@ CDBErr CDBRecordOpen_(CDBRecord* record) {
CDBDatabase* database; CDBDatabase* database;
CDBRecordDatabaseState* instance; CDBRecordDatabaseState* instance;
database = (CDBDatabase*)record->database; database = (CDBDatabase*)record->unk_0x00;
instance = database->instance; instance = database->instance;
record->cryptBuf = NULL; record->cryptBuf = NULL;
if (instance == NULL) { if (instance == NULL) {
@@ -292,7 +292,7 @@ CDBErr CDBRecordWrite_(CDBRecord* record, void* buffer, u32 size) {
CDBErr result; CDBErr result;
CDBRecordDatabaseState* instance; CDBRecordDatabaseState* instance;
database = (CDBDatabase*)record->database; database = (CDBDatabase*)record->unk_0x00;
instance = database->instance; instance = database->instance;
recordFile = record->file; recordFile = record->file;
if (record->key.location == CDB_FS_LOCATION_SD) { if (record->key.location == CDB_FS_LOCATION_SD) {
@@ -310,7 +310,7 @@ CDBErr CDBRecordWrite_(CDBRecord* record, void* buffer, u32 size) {
CDBReportError("can't write data in the record; the record is closed\n"); CDBReportError("can't write data in the record; the record is closed\n");
return CDB_ERROR_27; return CDB_ERROR_27;
} }
if ((recordFile->allocFlag & 2) == 0) { if ((recordFile->unk_0x1C & 2) == 0) {
CDBReportError("can't write data in the record; the record is opened as READONLY\n"); CDBReportError("can't write data in the record; the record is opened as READONLY\n");
return CDB_ERROR_27; return CDB_ERROR_27;
} }
@@ -393,67 +393,6 @@ CDBErr CDBRecordGetDataSize(CDBRecord* record, u32* size) {
return err; return err;
} }
CDBErr CDBRecordReduceFileSize(CDBRecord* record, u32 newFileSize) {
CDBRecordFile* recordFile;
CDBErr err;
u32 fileSize;
recordFile = record->file;
if (recordFile == NULL) {
CDBReportError("can't reduce file size of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't reduce file size of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
CDBAttrGetFileSize(&recordFile->attr, &fileSize);
if (newFileSize > fileSize) {
CDBReportError("can't reduce file size of the record ; file size must be over %d bytes\n", fileSize);
return CDB_ERROR_26;
}
CDBAttrSetFileSize(&recordFile->attr, newFileSize);
recordFile->attr.dirty = TRUE;
err = CDBRecordFileWriteAttrBuf(record);
if (err != CDB_ERROR_OK) {
return err;
}
return CDB_ERROR_OK;
}
CDBErr CDBRecordReduceDataSize(CDBRecord* record, u32 newDataSize) {
CDBRecordFile* recordFile;
CDBErr err = CDB_ERROR_OK;
u32 dataSize;
recordFile = record->file;
if (recordFile == NULL) {
CDBReportError("can't reduce data size of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't reduce data size of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
if (!CDBRecordBelongedDBOpenedAsRW(record)) {
CDBReportError("can't reduce data size of the record; permission denied\n");
return CDB_ERROR_ACCESS_DENIED;
}
err = CDBRecordFileGetDataSize(record, &dataSize);
if (err != CDB_ERROR_OK) {
return err;
}
if (newDataSize < dataSize) {
CDBAttrSetFileSize(&recordFile->attr, newDataSize);
recordFile->attr.dirty = TRUE;
}
err = CDBRecordFileWriteAttrBuf(record);
if (err != CDB_ERROR_OK) {
return err;
}
return CDB_ERROR_OK;
}
CDBErr CDBRecordRemove(CDBRecord* record) { CDBErr CDBRecordRemove(CDBRecord* record) {
CDBErr err; CDBErr err;
CDBLock(); CDBLock();
@@ -491,50 +430,6 @@ void CDBRecordGetTypeForce(CDBRecord* record, char* type) {
CDBUnlock(); CDBUnlock();
} }
CDBErr CDBRecordSetFileType(CDBRecord* record, const char* fileType) {
CDBRecordDatabaseState* instance;
CDBRecordFile* recordFile;
CDBErr err;
instance = ((CDBDatabase*)record->database)->instance;
recordFile = record->file;
if ((instance->openFlags & 2) == 0) {
CDBReportError("can't set file type of the record; the database is opened as READONLY\n");
return CDB_ERROR_26;
}
if (recordFile == NULL) {
CDBReportError("can't set file type of the record ; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't set file type of the record ; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
if (record->key.location != CDB_FS_LOCATION_NAND) {
CDBReportError("can't set file type of the record ; the record must exsist on NAND\n");
return CDB_ERROR_26;
}
CDBLock();
strcpy(CDBKeyStrType(record->key.keyString), fileType);
CDBAttrSetKeyStr(&recordFile->attr, &record->key);
err = CDBRecordFileWriteAttrBuf(record);
CDBUnlock();
return err;
}
CDBErr CDBRecordGetFileType(CDBRecord* record, char* fileType) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get file type of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToType(record->key.keyString, fileType);
}
CDBUnlock();
return err;
}
void CDBRecordGetGameCodeForce(CDBRecord* record, char* gameCode) { void CDBRecordGetGameCodeForce(CDBRecord* record, char* gameCode) {
u32 value; u32 value;
CDBLock(); CDBLock();
@@ -543,122 +438,12 @@ void CDBRecordGetGameCodeForce(CDBRecord* record, char* gameCode) {
CDBUnlock(); CDBUnlock();
} }
CDBErr CDBRecordGetGameCode(CDBRecord* record, u32* gameCode) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get game code of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToGameCode(record->key.keyString, gameCode);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetMakerCode(CDBRecord* record, u32* makerCode) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get maker code of the record ; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToMakerCode(record->key.keyString, makerCode);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetModifiedTime(CDBRecord* record, u32* modifiedTime) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get modified time of the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
*modifiedTime = ((CDBRecordFile*)record->file)->attr.buf.lastModifiedDate;
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetModifiedCount(CDBRecord* record, u32* modifiedCount) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get modified count of the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBAttrGetModifiedCount(&((CDBRecordFile*)record->file)->attr, modifiedCount);
}
CDBUnlock();
return err;
}
void CDBRecordGetKeyForce(CDBRecord* record, CDBRecordKey* key) { void CDBRecordGetKeyForce(CDBRecord* record, CDBRecordKey* key) {
CDBLock(); CDBLock();
CDBRecordKeyCopy(key, &record->key); CDBRecordKeyCopy(key, &record->key);
CDBUnlock(); CDBUnlock();
} }
CDBErr CDBRecordSetName(CDBRecord* record, const char* name, const char* keyword) {
CDBRecordDatabaseState* instance;
CDBRecordFile* recordFile;
CDBErr err;
instance = ((CDBDatabase*)record->database)->instance;
recordFile = record->file;
if ((instance->openFlags & 2) == 0) {
CDBReportError("can't set a name of the record; the database is opened as READONLY\n");
return CDB_ERROR_26;
}
if (!CDBRecordBelongedDBOpenedAsRW(record)) {
CDBReportError("can't add keyword to the record; permission denied\n");
return CDB_ERROR_ACCESS_DENIED;
}
if (recordFile == NULL) {
CDBReportError("can't set a name of the record; the record is closed\n");
return CDB_ERROR_27;
}
if ((recordFile->allocFlag & 2) == 0) {
CDBReportError("can't set a name of the record; the record is opened as READONLY\n");
return CDB_ERROR_27;
}
CDBLock();
strncpy(recordFile->attr.buf.desc, name, CDB_ATTR_BUF_MAX_DESC_LEN);
recordFile->attr.buf.descLength = strlen(name);
recordFile->attr.dirty = TRUE;
err = CDBRecordFileWriteAttrBuf(record);
CDBUnlock();
return err;
}
CDBErr CDBRecordGetKeyword(CDBRecord* record, char* keyword) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get keyword from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
strcpy(keyword, ((CDBRecordFile*)record->file)->attr.buf.desc);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetKey(CDBRecord* record, CDBRecordKey* key) {
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get key from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBRecordKeyCopy(key, &record->key);
}
CDBUnlock();
return err;
}
void CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) { void CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
char epochString[64]; char epochString[64];
CDBDate epoch; CDBDate epoch;
@@ -669,23 +454,6 @@ void CDBRecordGetCalendarTimeForce(CDBRecord* record, int* year, int* month, int
CDBUnlock(); CDBUnlock();
} }
CDBErr CDBRecordGetCalendarTime(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
char epochString[64];
CDBDate epoch;
CDBErr err = CDB_ERROR_OK;
CDBLock();
if (record->file == NULL) {
CDBReportError("can't get calender time from the record; the record is closed\n");
err = CDB_ERROR_27;
} else {
CDBConvKeyStrToEpochStr(record->key.keyString, epochString);
CDBConvEpochStrToEpochValue(epochString, &epoch);
CDBConvEpochValueToDate(epoch, year, month, day, hour, min, sec);
}
CDBUnlock();
return err;
}
CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id) { CDBErr CDBRecordGetId(CDBRecord* record, CDBId* id) {
CDBErr err = CDB_ERROR_OK; CDBErr err = CDB_ERROR_OK;
CDBRecordFile* recordFile; CDBRecordFile* recordFile;
@@ -740,7 +508,7 @@ CDBErr CDBRecordUpdateModifiedDate(CDBRecord* record) {
ticks = OSGetTime(); ticks = OSGetTime();
modifiedDate = ticks / (OS_BUS_CLOCK / 4); modifiedDate = ticks / (OS_BUS_CLOCK / 4);
recordFile = record->file; recordFile = record->file;
if ((((CDBRecordDatabaseState*)((CDBDatabase*)record->database)->instance)->openFlags & 2) == 0) { if ((((CDBRecordDatabaseState*)((CDBDatabase*)record->unk_0x00)->instance)->openFlags & 2) == 0) {
CDBReportError("can't set modified time of the record; the database is opened as READONLY\n"); CDBReportError("can't set modified time of the record; the database is opened as READONLY\n");
return CDB_ERROR_26; return CDB_ERROR_26;
} }
@@ -764,27 +532,6 @@ CDBErr CDBRecordUpdateModifiedDate(CDBRecord* record) {
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }
CDBErr CDBRecordDuplicate(CDBRecord* record, CDBRecord* newRecord) {
CDBRecordFile* recordFile;
CDBErr err;
if (record->key.location != CDB_FS_LOCATION_NAND && record->key.location != CDB_FS_LOCATION_SD) {
OSPanic(__FILE__, __LINE__, "CDBRecordDuplicate invalud location\n");
return CDB_ERROR_1;
}
recordFile = record->file;
if (recordFile == NULL) {
return CDB_ERROR_27;
}
CDBLock();
CDBRecordKeyCopy(&newRecord->key, &record->key);
newRecord->file = NULL;
newRecord->database = record->database;
err = CDBRecordFileCreateBlank(newRecord);
CDBUnlock();
return err;
}
CDBErr CDBRecordBackupToSD(CDBRecord* record) { CDBErr CDBRecordBackupToSD(CDBRecord* record) {
CDBErr err; CDBErr err;
CDBLock(); CDBLock();
@@ -823,7 +570,7 @@ CDBErr CDBRecordBackupToSD_(CDBRecord* record) {
CDBRecordKeyCopy(&localRecord.key, &record->key); CDBRecordKeyCopy(&localRecord.key, &record->key);
localRecord.file = NULL; localRecord.file = NULL;
localRecord.key.location = CDB_FS_LOCATION_SD; localRecord.key.location = CDB_FS_LOCATION_SD;
localRecord.database = record->database; localRecord.unk_0x00 = record->unk_0x00;
err = CDBRecordFileCreateBlank(&localRecord); err = CDBRecordFileCreateBlank(&localRecord);
if (err != CDB_ERROR_OK) { if (err != CDB_ERROR_OK) {
CDBLock(); CDBLock();
@@ -867,7 +614,7 @@ CDBErr CDBRecordBackupToSD_(CDBRecord* record) {
CDBLock(); CDBLock();
recordFile = localRecord.file; recordFile = localRecord.file;
CDBRecordKeyCopy(&record->key, &localRecord.key); CDBRecordKeyCopy(&record->key, &localRecord.key);
record->database = localRecord.database; record->unk_0x00 = localRecord.unk_0x00;
record->file = localRecord.file; record->file = localRecord.file;
record->cryptBuf = localRecord.cryptBuf; record->cryptBuf = localRecord.cryptBuf;
CDBRecordKeyCopy(&recordFile->key, &localRecord.key); CDBRecordKeyCopy(&recordFile->key, &localRecord.key);
@@ -940,7 +687,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
if ((s32)recordFile == 0) { if ((s32)recordFile == 0) {
return CDB_ERROR_27; return CDB_ERROR_27;
} }
if (recordFile->allocFlag == 1) { if (recordFile->unk_0x1C == 1) {
return CDB_ERROR_26; return CDB_ERROR_26;
} }
if ((s32)buffer == 0) { if ((s32)buffer == 0) {
@@ -948,10 +695,11 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
} }
{ {
CDBErr result; CDBErr result;
CDBRecordFile* tempFile = record->file; CDBRecordFile* tempFile;
tempFile = record->file;
if ((s32)tempFile == 0) { if ((s32)tempFile == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (tempFile->allocFlag == 1) { } else if (tempFile->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrSetWiiId(&tempFile->attr, CDBGetWiiId()); CDBAttrSetWiiId(&tempFile->attr, CDBGetWiiId());
@@ -965,7 +713,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result; CDBErr result;
if ((s32)record->file == 0) { if ((s32)record->file == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) { } else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrInitIV(&((CDBRecordFile*)record->file)->attr); CDBAttrInitIV(&((CDBRecordFile*)record->file)->attr);
@@ -979,7 +727,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr result; CDBErr result;
if ((s32)record->file == 0) { if ((s32)record->file == 0) {
result = CDB_ERROR_27; result = CDB_ERROR_27;
} else if (((CDBRecordFile*)record->file)->allocFlag == 1) { } else if (((CDBRecordFile*)record->file)->unk_0x1C == 1) {
result = CDB_ERROR_26; result = CDB_ERROR_26;
} else { } else {
CDBAttrSetKeyStr(&((CDBRecordFile*)record->file)->attr, key); CDBAttrSetKeyStr(&((CDBRecordFile*)record->file)->attr, key);
@@ -1077,7 +825,7 @@ CDBErr CDBRecordEncrypt(CDBRecord* record, void* buffer, CDBRecordKey* key, u32
CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize, CDBRecordKey* key) { CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize, CDBRecordKey* key) {
CDBErr status; CDBErr status;
s32 fileOffset; int fileOffset;
CDBRecordFile* recordFile; CDBRecordFile* recordFile;
u32 fileDataSize; u32 fileDataSize;
u32 fileSize; u32 fileSize;
@@ -1212,32 +960,3 @@ CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize
} }
return CDB_ERROR_OK; return CDB_ERROR_OK;
} }
CDBErr CDBRecordPrivateChangeOwner(CDBRecord* record, u64 newWiiId) {
CDBRecordFile* recordFile;
char fullPath[256];
char newPath[256];
CDBErr err;
u64 preWiiId;
u64 recordWiiId;
CDBReportError("CDBRecordPrivateChangeOwner\n");
recordFile = record->file;
if (recordFile == NULL) {
return CDB_ERROR_27;
}
preWiiId = CDBGetWiiId();
recordWiiId = record->key.wiiId;
OSReport(" i_pre-wiiid = %lX\n", preWiiId);
OSReport(" record-wiiid = %lX\n", recordWiiId);
CDBConvKeyToFullPath(&record->key, fullPath);
record->key.wiiId = newWiiId;
CDBConvKeyToFullPath(&record->key, newPath);
OSReport("path =%s\n", fullPath);
OSReport("path2=%s\n", newPath);
CDBLock();
err = CDBAttrSetWiiId(&recordFile->attr, newWiiId);
CDBUnlock();
return err;
}

View File

@@ -265,7 +265,7 @@ CDBErr CDBRecordFree(CDBRecord* record) {
OSLockMutex((OSMutex*)recordFile); OSLockMutex((OSMutex*)recordFile);
*(u32*)&recordFile->unk_0x00[0x18] = 0; *(u32*)&recordFile->unk_0x00[0x18] = 0;
OSUnlockMutex((OSMutex*)recordFile); OSUnlockMutex((OSMutex*)recordFile);
recordFile->allocFlag = 0; recordFile->unk_0x1C = 0;
record->file = NULL; record->file = NULL;
OSUnlockMutex(&s_mutex); OSUnlockMutex(&s_mutex);
} }

View File

@@ -197,9 +197,8 @@ void AESiEncryptBlock(AESContext* context, u32* output, const u32* input) {
void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) { void AESiDecryptBlock(AESContext* context, u32* output, const u32* input) {
u32 rounds=context->rounds; u32 rounds=context->rounds;
u32* key=context->keys; u32* key=context->keys + rounds*4;
u32 a,b,c,d; u32 a,b,c,d;
key += rounds*4;
if (context->needsTransform) { if (context->needsTransform) {
u32 round; u32 round;
for (round=1; round<context->rounds; ++round) { for (round=1; round<context->rounds; ++round) {

View File

@@ -68,14 +68,8 @@ void NETMD5GetDigest(NETMD5Context* context, void* digest) {
memset(context, 0, sizeof(*context)); memset(context, 0, sizeof(*context));
} }
static inline u32 rotateSum(u32 state, const u32* word, u32 constant, int shift) { #define ROTATE(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
// Each rotation half reads its own byte-reversed message word. #define STEP(a, b, c, d, f, word, n) ((a) += (f), (a) = (b) + ROTATE(__lwbrx(0, (int)(word)) + (*constant + (a)), n))
u32 right = __lwbrx((void*)word, 0);
u32 left = __lwbrx((void*)word, 0);
return ((state + (constant + left)) << shift) | ((constant + (state + right)) >> (32 - shift));
}
#define STEP(a, b, c, d, f, word, n) ((a) = (b) + rotateSum((a) + (f), word, *constant, n))
static void ProcessBlock(NETMD5Context* context) { static void ProcessBlock(NETMD5Context* context) {
static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391}; static u32 constants[64] = {0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, 0xF57C0FAF, 0x4787C62A, 0xA8304613, 0xFD469501, 0x698098D8, 0x8B44F7AF, 0xFFFF5BB1, 0x895CD7BE, 0x6B901122, 0xFD987193, 0xA679438E, 0x49B40821, 0xF61E2562, 0xC040B340, 0x265E5A51, 0xE9B6C7AA, 0xD62F105D, 0x02441453, 0xD8A1E681, 0xE7D3FBC8, 0x21E1CDE6, 0xC33707D6, 0xF4D50D87, 0x455A14ED, 0xA9E3E905, 0xFCEFA3F8, 0x676F02D9, 0x8D2A4C8A, 0xFFFA3942, 0x8771F681, 0x6D9D6122, 0xFDE5380C, 0xA4BEEA44, 0x4BDECFA9, 0xF6BB4B60, 0xBEBFBC70, 0x289B7EC6, 0xEAA127FA, 0xD4EF3085, 0x04881D05, 0xD9D4D039, 0xE6DB99E5, 0x1FA27CF8, 0xC4AC5665, 0xF4292244, 0x432AFF97, 0xAB9423A7, 0xFC93A039, 0x655B59C3, 0x8F0CCC92, 0xFFEFF47D, 0x85845DD1, 0x6FA87E4F, 0xFE2CE6E0, 0xA3014314, 0x4E0811A1, 0xF7537E82, 0xBD3AF235, 0x2AD7D2BB, 0xEB86D391};
@@ -89,13 +83,13 @@ static void ProcessBlock(NETMD5Context* context) {
block = context->buffer32; block = context->buffer32;
word = block; word = block;
constant = constants; constant = constants;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & c) | (~b & d),word++,7); ++constant;
STEP(d,a,b,c,(a & b) | (~a & c),word++,12); ++constant;
STEP(c,d,a,b,(d & a) | (~d & b),word++,17); ++constant;
STEP(b,c,d,a,(c & d) | (~c & a),word++,22); ++constant;
}
index = indices; index = indices;
for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & c) | (~b & d),word,7); ++word; ++constant;
STEP(d,a,b,c,(a & b) | (~a & c),word,12); ++word; ++constant;
STEP(c,d,a,b,(d & a) | (~d & b),word,17); ++word; ++constant;
STEP(b,c,d,a,(c & d) | (~c & a),word,22); ++word; ++constant;
}
for (round = 0; round < 4; ++round) { for (round = 0; round < 4; ++round) {
STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant; STEP(a,b,c,d,(b & d) | (c & ~d),block + *index,5); ++index; ++constant;
STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant; STEP(d,a,b,c,(a & c) | (b & ~c),block + *index,9); ++index; ++constant;

View File

@@ -548,7 +548,7 @@ NWC24Err NWC24DumpDlTask(NWC24DlTask* dlTask) {
NWC24Err NWC24IterateDlTask(NWC24DlId* dlIterateId, BOOL begin) { NWC24Err NWC24IterateDlTask(NWC24DlId* dlIterateId, BOOL begin) {
DlTaskListHeader* entriesHeader; DlTaskListHeader* entriesHeader;
const NWC24Work* work; NWC24Work* work;
u16 taskId; u16 taskId;
u16 maxTaskCount; u16 maxTaskCount;
DlTaskListHeader* header; DlTaskListHeader* header;

View File

@@ -27,7 +27,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header);
static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength); static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength);
static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo); static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo);
static u32 GetConfirmedBit(u32 index) { static u32 GetUnkFlag(u32 index) {
NWC24Err result; NWC24Err result;
NWC24FLHeader* header; NWC24FLHeader* header;
u32 data; u32 data;
@@ -37,11 +37,11 @@ static u32 GetConfirmedBit(u32 index) {
return result; return result;
} }
data = header->confirmedBits[index >> 5] >> (index & 0x1f) & 1; data = header->unk_0x10[index >> 5] >> (index & 0x1f) & 1;
return (NWC24Err)data; return (NWC24Err)data;
} }
static NWC24Err SetConfirmedBit(u32 index, int flag) { static NWC24Err SetUnkFlag(u32 index, int flag) {
NWC24Err result; NWC24Err result;
NWC24FLHeader* header; NWC24FLHeader* header;
@@ -50,11 +50,11 @@ static NWC24Err SetConfirmedBit(u32 index, int flag) {
return result; return result;
} }
header->confirmedBits[index >> 5] = ~(1 << (index & 0x1f)) & header->confirmedBits[index >> 5] | flag << (index & 0x1f); header->unk_0x10[index >> 5] = ~(1 << (index & 0x1f)) & header->unk_0x10[index >> 5] | flag << (index & 0x1f);
return NWC24_OK; return NWC24_OK;
} }
static NWC24Err SetListFlag(int flag) { static NWC24Err SetUnkFlag2(int flag) {
NWC24Err result; NWC24Err result;
NWC24FLHeader* header; NWC24FLHeader* header;
@@ -63,7 +63,7 @@ static NWC24Err SetListFlag(int flag) {
return result; return result;
} }
header->listFlags |= flag; header->unk_0x3C |= flag;
return NWC24_OK; return NWC24_OK;
} }
@@ -101,7 +101,7 @@ NWC24Err NWC24ReadFriendInfo(NWC24FriendInfo* info, u32 index) {
Mail_memset(&info->addr.mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr) - sizeof(NWC24UserId)); Mail_memset(&info->addr.mailAddr[sizeof(NWC24UserId)], 0, sizeof(NWC24UserMailAddr) - sizeof(NWC24UserId));
} }
result = GetConfirmedBit(index); result = GetUnkFlag(index);
if (result == 1) { if (result == 1) {
info->attr.status = NWC24_FRIENDSTATUS_CONFIRMED; info->attr.status = NWC24_FRIENDSTATUS_CONFIRMED;
} }
@@ -189,9 +189,9 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
tmpFriendAddr = (NWC24FriendAddr*)&friendInfo->addr; tmpFriendAddr = (NWC24FriendAddr*)&friendInfo->addr;
} }
SetListFlag(1); SetUnkFlag2(1);
result = SetConfirmedBit(index, 0); result = SetUnkFlag(index, 0);
if (result != NWC24_OK) { if (result != NWC24_OK) {
return result; return result;
} }
@@ -347,7 +347,7 @@ NWC24Err NWC24DeleteFriendInfo(u32 index) {
if (resultWrite == NWC24_OK) { if (resultWrite == NWC24_OK) {
header->friendIds[index] = 0; header->friendIds[index] = 0;
header->registeredCount--; header->registeredCount--;
result = SetConfirmedBit(index, 0); result = SetUnkFlag(index, 0);
if (result == NWC24_OK) { if (result == NWC24_OK) {
NWC24FSeek(&file, 0, NWC24_SEEK_BEG); NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file); resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file);
@@ -374,8 +374,8 @@ NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) {
u32 fileOffset1; u32 fileOffset1;
u32 fileOffset2; u32 fileOffset2;
int confirmedBit1; int friendUnkFlag1;
int confirmedBit2; int friendUnkFlag2;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) { if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
@@ -429,10 +429,10 @@ NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) {
header->friendIds[index2] = tmp; header->friendIds[index2] = tmp;
// Swap some flag // Swap some flag
confirmedBit1 = GetConfirmedBit(index1); friendUnkFlag1 = GetUnkFlag(index1);
confirmedBit2 = GetConfirmedBit(index2); friendUnkFlag2 = GetUnkFlag(index2);
SetConfirmedBit(index1, confirmedBit2); SetUnkFlag(index1, friendUnkFlag2);
SetConfirmedBit(index2, confirmedBit1); SetUnkFlag(index2, friendUnkFlag1);
// Write new header // Write new header
NWC24FSeek(&file, 0, NWC24_SEEK_BEG); NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
@@ -629,10 +629,10 @@ NWC24Err NWC24iCreateFriendList() {
header->version = FRIEND_LIST_VERSION; header->version = FRIEND_LIST_VERSION;
header->infoCount = NWC24_FRIEND_INFO_MAX; header->infoCount = NWC24_FRIEND_INFO_MAX;
header->registeredCount = 0; header->registeredCount = 0;
header->confirmedBits[0] = 0; header->unk_0x10[0] = 0;
header->confirmedBits[1] = 0; header->unk_0x10[1] = 0;
header->confirmedBits[2] = 0; header->unk_0x10[2] = 0;
header->confirmedBits[3] = 0; header->unk_0x10[3] = 0;
result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_WRITE); result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_WRITE);
if (result != NWC24_OK) { if (result != NWC24_OK) {

View File

@@ -170,7 +170,7 @@ NWC24Err NWC24GetMsgObj(NWC24MsgObj* msg, NWC24MBoxType type, u32 id) {
u32 count = 0; u32 count = 0;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
if (id == 0) if (id == 0)
return NWC24_ERR_HIDDEN; return NWC24_ERR_HIDDEN;
@@ -251,7 +251,7 @@ NWC24Err NWC24GetMsgIdList(NWC24MBoxType type, u32* ids, u32 maxLength) {
MBCEntry* entry; MBCEntry* entry;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
err = GetCachedMBCHeader(type, &header); err = GetCachedMBCHeader(type, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -307,11 +307,11 @@ NWC24Err NWC24iOpenMBox(void) {
NWC24File recvFile, sendFile; NWC24File recvFile, sendFile;
char* path = NWC24WorkP->pathWork; char* path = NWC24WorkP->pathWork;
NWC24Err err; NWC24Err err;
Mail_memset(NWC24WorkP->sendMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1700, 0, 128);
err = GetCachedMBCHeader(NWC24_MBOX_TYPE_SEND, &header); err = GetCachedMBCHeader(NWC24_MBOX_TYPE_SEND, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
Mail_memset(NWC24WorkP->recvMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1780, 0, 128);
err = GetCachedMBCHeader(NWC24_MBOX_TYPE_RECV, &header); err = GetCachedMBCHeader(NWC24_MBOX_TYPE_RECV, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -340,11 +340,11 @@ NWC24Err NWC24iInitMBox(void) {
NWC24File recvFile, sendFile; NWC24File recvFile, sendFile;
NWC24Err recvResult, sendResult, err, sendStatus; NWC24Err recvResult, sendResult, err, sendStatus;
char* path = NWC24WorkP->pathWork; char* path = NWC24WorkP->pathWork;
Mail_memset(NWC24WorkP->sendMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1700, 0, 128);
sendResult = CreateCtrlFile(NWC24_MBOX_TYPE_SEND, FALSE); sendResult = CreateCtrlFile(NWC24_MBOX_TYPE_SEND, FALSE);
if (sendResult < 0) if (sendResult < 0)
return sendResult; return sendResult;
Mail_memset(NWC24WorkP->recvMbcHeader, 0, 128); Mail_memset(NWC24WorkP->unk_0x1780, 0, 128);
recvResult = CreateCtrlFile(NWC24_MBOX_TYPE_RECV, FALSE); recvResult = CreateCtrlFile(NWC24_MBOX_TYPE_RECV, FALSE);
if (recvResult < 0) if (recvResult < 0)
return recvResult; return recvResult;
@@ -616,11 +616,11 @@ static NWC24Err CreateCtrlFile(NWC24MBoxType type, BOOL force) {
err = MakeCtrlPath(path, type); err = MakeCtrlPath(path, type);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
entry = (MBCEntry*)NWC24WorkP->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
header = (MBCHeader*)NWC24WorkP->sendMbcHeader; header = (MBCHeader*)NWC24WorkP->unk_0x1700;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
header = (MBCHeader*)NWC24WorkP->recvMbcHeader; header = (MBCHeader*)NWC24WorkP->unk_0x1780;
else else
return NWC24_ERR_INVALID_VALUE; return NWC24_ERR_INVALID_VALUE;
result = err; result = err;
@@ -676,7 +676,7 @@ static NWC24Err DeleteMsg(NWC24MBoxType type, u32 id, BOOL protect) {
NWC24Err err, deleteResult, closeResult; NWC24Err err, deleteResult, closeResult;
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool())
return NWC24_ERR_LIB_NOT_OPENED; return NWC24_ERR_LIB_NOT_OPENED;
entry = (MBCEntry*)NWC24WorkP->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
err = GetCachedMBCHeader(type, &header); err = GetCachedMBCHeader(type, &header);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -754,7 +754,7 @@ static NWC24Err DuplicationCheck(MBCHeader* header, const NWC24MsgObjPrivate* ms
NWC24Err clearResult, deleteResult; NWC24Err clearResult, deleteResult;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
return NWC24_OK; return NWC24_OK;
entry = (MBCEntry*)NWC24WorkP->mbcEntry; entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
for (offset = 128; offset < header->fileSize; offset += 128) { for (offset = 128; offset < header->fileSize; offset += 128) {
if (count >= header->numMessages) if (count >= header->numMessages)
break; break;
@@ -783,7 +783,7 @@ static NWC24Err DuplicationCheck(MBCHeader* header, const NWC24MsgObjPrivate* ms
continue; continue;
} }
if (msg->unk_0x1C != 0 && entry->crc == msg->unk_0x1C && entry->type == msg->type && entry->length == msg->length && if (msg->unk_0x1C != 0 && entry->crc == msg->unk_0x1C && entry->type == msg->type && entry->length == msg->length &&
entry->flags == msg->headerSize && (s32)entry->date == (s32)msg->date) { entry->flags == msg->unk_0x10 && (s32)entry->date == (s32)msg->date) {
duplicateId = entry->msgId; duplicateId = entry->msgId;
duplicateOffset = offset; duplicateOffset = offset;
continue; continue;
@@ -809,9 +809,9 @@ static NWC24Err GetCachedMBCHeader(NWC24MBoxType type, MBCHeader** header) {
char* path; char* path;
NWC24Err err = NWC24_OK, closeResult; NWC24Err err = NWC24_OK, closeResult;
if (type == NWC24_MBOX_TYPE_SEND) if (type == NWC24_MBOX_TYPE_SEND)
*header = (MBCHeader*)NWC24WorkP->sendMbcHeader; *header = (MBCHeader*)NWC24WorkP->unk_0x1700;
else if (type == NWC24_MBOX_TYPE_RECV) else if (type == NWC24_MBOX_TYPE_RECV)
*header = (MBCHeader*)NWC24WorkP->recvMbcHeader; *header = (MBCHeader*)NWC24WorkP->unk_0x1780;
else { else {
*header = NULL; *header = NULL;
return NWC24_ERR_INVALID_VALUE; return NWC24_ERR_INVALID_VALUE;
@@ -874,7 +874,7 @@ static NWC24Err InitMBCHeader(MBCHeader* header, NWC24MBoxType type) {
static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NWC24File* file) { static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NWC24File* file) {
u32 offset = header->freeOffset; u32 offset = header->freeOffset;
MBCEntry* entry = (MBCEntry*)NWC24WorkP->mbcEntry; MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
u32 next; u32 next;
NWC24Err err; NWC24Err err;
if (offset == 0) if (offset == 0)
@@ -906,7 +906,7 @@ static NWC24Err AddMBCEntry(MBCHeader* header, const NWC24MsgObjPrivate* msg, NW
} }
static NWC24Err ClearMBCEntry(MBCHeader* header, NWC24File* file, u32 offset) { static NWC24Err ClearMBCEntry(MBCHeader* header, NWC24File* file, u32 offset) {
MBCEntry* entry = (MBCEntry*)NWC24WorkP->mbcEntry; MBCEntry* entry = (MBCEntry*)NWC24WorkP->unk_0x1800;
NWC24Err err = NWC24FSeek(file, offset, NWC24_SEEK_BEG); NWC24Err err = NWC24FSeek(file, offset, NWC24_SEEK_BEG);
if (err != NWC24_OK) if (err != NWC24_OK)
return err; return err;
@@ -947,8 +947,8 @@ static NWC24Err MountVFMBox(NWC24MBoxType type) {
} }
static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entry) { static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entry) {
u32 field1 = ((u32)msg->fromData.ptr & 0xFFFFF) | (msg->fromData.size << 20); u32 field1 = ((u32)msg->unk_0x30.ptr & 0xFFFFF) | (msg->unk_0x30.size << 20);
u32 field2 = ((u32)msg->toData.ptr & 0xFFFFF) | (msg->toData.size << 20); u32 field2 = ((u32)msg->unk_0x38.ptr & 0xFFFFF) | (msg->unk_0x38.size << 20);
u32 field3 = ((u32)msg->subject.ptr & 0xFFFFF) | (msg->subject.size << 20); u32 field3 = ((u32)msg->subject.ptr & 0xFFFFF) | (msg->subject.size << 20);
u32 field4 = ((u32)msg->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20); u32 field4 = ((u32)msg->unk_0x50.ptr & 0xFFFFF) | (msg->unk_0x50.size << 20);
u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20); u32 field5 = ((u32)msg->unk_0x58.ptr & 0xFFFFF) | (msg->unk_0x58.size << 20);
@@ -956,7 +956,7 @@ static NWC24Err CopyMsgObjToMBCFmt(const NWC24MsgObjPrivate* msg, MBCEntry* entr
entry->type = msg->type; entry->type = msg->type;
entry->length = msg->length; entry->length = msg->length;
entry->appId = msg->appId; entry->appId = msg->appId;
entry->flags = msg->headerSize; entry->flags = msg->unk_0x10;
entry->tag = msg->tag; entry->tag = msg->tag;
entry->ledPattern = msg->ledPattern; entry->ledPattern = msg->ledPattern;
entry->crc = msg->unk_0x1C; entry->crc = msg->unk_0x1C;
@@ -1003,7 +1003,7 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->type = entry->type; msg->type = entry->type;
msg->length = entry->length; msg->length = entry->length;
msg->appId = entry->appId; msg->appId = entry->appId;
msg->headerSize = entry->flags; msg->unk_0x10 = entry->flags;
msg->tag = entry->tag; msg->tag = entry->tag;
msg->ledPattern = entry->ledPattern; msg->ledPattern = entry->ledPattern;
msg->unk_0x1C = entry->crc; msg->unk_0x1C = entry->crc;
@@ -1019,10 +1019,10 @@ static NWC24Err CopyMsgObjToPrvFmt(const MBCEntry* entry, NWC24MsgObjPrivate* ms
msg->textSize = entry->textSize; msg->textSize = entry->textSize;
msg->dwcId = entry->dwcId; msg->dwcId = entry->dwcId;
msg->iconNew = entry->iconNew; msg->iconNew = entry->iconNew;
msg->fromData.ptr = (void*)offset1; msg->unk_0x30.ptr = (void*)offset1;
msg->fromData.size = size1; msg->unk_0x30.size = size1;
msg->toData.ptr = (void*)offset2; msg->unk_0x38.ptr = (void*)offset2;
msg->toData.size = size2; msg->unk_0x38.size = size2;
msg->subject.ptr = (void*)offset3; msg->subject.ptr = (void*)offset3;
msg->subject.size = size3; msg->subject.size = size3;
msg->unk_0x50.ptr = (void*)offset4; msg->unk_0x50.ptr = (void*)offset4;

View File

@@ -243,11 +243,11 @@ static inline NWC24Err WriteMBDelayField(NWC24MsgObjPrivate* msg) {
static inline NWC24Err WriteExtraFields(NWC24MsgObjPrivate* msg) { static inline NWC24Err WriteExtraFields(NWC24MsgObjPrivate* msg) {
NWC24Err err; NWC24Err err;
if (msg->extraData.size == 0) if (msg->unk_0xD0.size == 0)
return NWC24_OK; return NWC24_OK;
err = NWC24FWrite(msg->extraData.ptr, msg->extraData.size, m_pFile); err = NWC24FWrite(msg->unk_0xD0.ptr, msg->unk_0xD0.size, m_pFile);
if (err == NWC24_OK) if (err == NWC24_OK)
msg->length += msg->extraData.size; msg->length += msg->unk_0xD0.size;
return err; return err;
} }
@@ -330,7 +330,7 @@ static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType ty
} }
CHECK_WRITE(WriteString(msg, buffer)); CHECK_WRITE(WriteString(msg, buffer));
if (msg->type & 0x10000) { if (msg->type & 0x10000) {
msg->headerSize = msg->length; msg->unk_0x10 = msg->length;
buffer = NWC24WorkP->stringWork; buffer = NWC24WorkP->stringWork;
Mail_memset(buffer, 0, 1024); Mail_memset(buffer, 0, 1024);
Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider); Mail_sprintf(buffer, "\r\n--%s", MultiPartDivider);
@@ -339,7 +339,7 @@ static NWC24Err NWC24CommitMsgInternal(NWC24MsgObjPrivate* msg, NWC24MBoxType ty
} }
CHECK_WRITE(WriteContentTypeField(msg)); CHECK_WRITE(WriteContentTypeField(msg));
if (!(msg->type & 0x10000)) if (!(msg->type & 0x10000))
msg->headerSize = msg->length; msg->unk_0x10 = msg->length;
text.ptr = (const void*)msg->length; text.ptr = (const void*)msg->length;
{ NWC24Err textResult = WritePlainText(msg); { NWC24Err textResult = WritePlainText(msg);
err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult; } err = textResult == NWC24_ERR_NULL ? NWC24_OK : textResult; }
@@ -577,7 +577,7 @@ static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg) {
Mail_memset(buffer, 0, 1024); Mail_memset(buffer, 0, 1024);
Mail_strncat(buffer, "From: ", 1022); Mail_strncat(buffer, "From: ", 1022);
address = buffer + 6; address = buffer + 6;
msg->fromData.ptr = (const void*)(msg->length + 6); msg->unk_0x30.ptr = (const void*)(msg->length + 6);
type = 1; type = 1;
if (msg->type & 0x100000) if (msg->type & 0x100000)
type = 2; type = 2;
@@ -596,7 +596,7 @@ static NWC24Err WriteFromField(NWC24MsgObjPrivate* msg) {
err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile); err = NWC24FWrite(NWC24WorkP->stringWork, total, m_pFile);
if (err == NWC24_OK) { if (err == NWC24_OK) {
msg->length += total; msg->length += total;
msg->fromData.size = msg->length - (u32)msg->fromData.ptr - 2; msg->unk_0x30.size = msg->length - (u32)msg->unk_0x30.ptr - 2;
} }
} }
return err; return err;
@@ -612,7 +612,7 @@ static NWC24Err WriteToField(NWC24MsgObjPrivate* msg) {
cursor += 4; cursor += 4;
index = 0; index = 0;
total = 4; total = 4;
msg->toData.ptr = (const void*)(msg->length + 4); msg->unk_0x38.ptr = (const void*)(msg->length + 4);
remaining = 1018; remaining = 1018;
for (; index < msg->numTo; ++index) { for (; index < msg->numTo; ++index) {
err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length); err = SynthesizeAddrStr(&msg->toAddrs[index], msg->type, cursor, remaining, &length);
@@ -641,7 +641,7 @@ static NWC24Err WriteToField(NWC24MsgObjPrivate* msg) {
err = NWC24FWrite(NWC24WorkP->stringWork, total + 2, m_pFile); err = NWC24FWrite(NWC24WorkP->stringWork, total + 2, m_pFile);
if (err == NWC24_OK) { if (err == NWC24_OK) {
msg->length += total + 2; msg->length += total + 2;
msg->toData.size = msg->length - (u32)msg->toData.ptr - 2; msg->unk_0x38.size = msg->length - (u32)msg->unk_0x38.ptr - 2;
} }
} }
return err; return err;

View File

@@ -73,11 +73,11 @@ NWC24Err NWC24InitMsgObj(NWC24MsgObj* msg, NWC24MsgType type) {
msgObj->attachedType[i] = NWC24_TEXT_PLAIN; msgObj->attachedType[i] = NWC24_TEXT_PLAIN;
} }
NWC24Data_Init(&msgObj->fromData); NWC24Data_Init(&msgObj->unk_0x30);
NWC24Data_Init(&msgObj->toData); NWC24Data_Init(&msgObj->unk_0x38);
NWC24Data_Init(&msgObj->unk_0x50); NWC24Data_Init(&msgObj->unk_0x50);
NWC24Data_Init(&msgObj->unk_0x58); NWC24Data_Init(&msgObj->unk_0x58);
NWC24Data_Init(&msgObj->extraData); NWC24Data_Init(&msgObj->unk_0xD0);
NWC24Data_Init(&msgObj->faceData); NWC24Data_Init(&msgObj->faceData);
NWC24Data_Init(&msgObj->altName); NWC24Data_Init(&msgObj->altName);

View File

@@ -289,7 +289,7 @@ NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* address, u32 capacit
default: default:
return result; return result;
} }
if (privateMsg->fromData.size == 0) if (privateMsg->unk_0x30.size == 0)
return NWC24_ERR_NULL; return NWC24_ERR_NULL;
result = NWC24iMBoxOpenStoredMsg(type, privateMsg->msgId, &file); result = NWC24iMBoxOpenStoredMsg(type, privateMsg->msgId, &file);
switch (result) { switch (result) {
@@ -300,9 +300,9 @@ NWC24Err NWC24ReadMsgFromAddr(const NWC24MsgObj* msg, char* address, u32 capacit
} }
result = NWC24FStreamInit(&stream, &file, 0, privateMsg->length, buffer, 1024); result = NWC24FStreamInit(&stream, &file, 0, privateMsg->length, buffer, 1024);
if (result == NWC24_OK) { if (result == NWC24_OK) {
result = NWC24FStreamSeek(&stream, (u32)privateMsg->fromData.ptr); result = NWC24FStreamSeek(&stream, (u32)privateMsg->unk_0x30.ptr);
if (result == NWC24_OK) if (result == NWC24_OK)
result = NWC24iExtractAddrSpec(&stream, privateMsg->fromData.size, 0, address, capacity); result = NWC24iExtractAddrSpec(&stream, privateMsg->unk_0x30.size, 0, address, capacity);
} }
closeResult = NWC24iMBoxCloseMsg(&file); closeResult = NWC24iMBoxCloseMsg(&file);
if (result != NWC24_OK) if (result != NWC24_OK)

View File

@@ -242,63 +242,14 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
extern vu32 BS2VideoMode; extern vu32 BS2VideoMode;
extern vu32 __DVDLayoutFormat; extern vu32 __DVDLayoutFormat;
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) { void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
// clang-format off u8 *block = start;
#ifdef __MWERKS__ for (; blockCount != 0; --blockCount) {
nofralloc __dcbz(block, 0);
__dcbf(block, 0);
mtctr r5 block += 32;
mtlr r3 }
((void (*)(u32))entryPoint)(argument);
li r0, 0
li r2, 0
li r3, 0
li r5, 0
li r7, 0
li r8, 0
li r9, 0
li r10, 0
li r11, 0
li r12, 0
li r13, 0
li r14, 0
li r15, 0
li r16, 0
li r17, 0
li r18, 0
li r19, 0
li r20, 0
li r21, 0
li r22, 0
li r23, 0
li r24, 0
li r25, 0
li r26, 0
li r27, 0
li r28, 0
li r29, 0
li r30, 0
li r31, 0
// The application stack is fixed; it is unrelated to the formatter.
lis r1, 0x8160
ori r1, r1, 0
li r6, 0
b Run_loop_entry
Run_loop:
dcbz r4, r0
dcbf r4, r0
addi r4, r4, 0x20
bdnz Run_loop
b Run_done
Run_done:
li r4, 0
blr
Run_loop_entry:
b Run_loop
#endif
// clang-format on
} }
BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) { BOOL BS2GetLockedTitles(ESTitleId *pTitleIds, u32 *count) {
@@ -852,7 +803,7 @@ void BS2StartGCGame() {
OSTime time; OSTime time;
StartingGame = TRUE; StartingGame = TRUE;
while (CoverBlock.state != DVD_STATE_IDLE) { while (DVDGetCommandBlockStatus(&CoverBlock) != DVD_STATE_IDLE) {
} }
soundMode = SCGetSoundMode(); soundMode = SCGetSoundMode();
@@ -1845,12 +1796,11 @@ invalidRvlRegion:
State = BS2_STT_RESET_SYSTEM; State = BS2_STT_RESET_SYSTEM;
break; break;
} }
if (GamePartition != 0) if (GamePartition == 0) {
State = BS2_STT_37;
else {
State = BS2_STT_54; State = BS2_STT_54;
break; break;
} }
State = BS2_STT_37;
case 0x25: case 0x25:
if (BS2BootFromCache != 0) { if (BS2BootFromCache != 0) {
BS2Report("Open partition from cache.dat\n"); BS2Report("Open partition from cache.dat\n");

View File

@@ -64,13 +64,13 @@ void SimpleWavePlayer::wavePacketCallback(WavePacketCallbackStatus status, WaveP
return; return;
} }
if (self->mbFillInCallback) { if (self->unk_0xB5) {
MakeWave(player, packet, self); MakeWave(player, packet, self);
} }
} }
SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_PCM_S16, 32000, 1.0f, 1) { SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_PCM_S16, 32000, 1.0f, 1) {
mbFillInCallback = true; unk_0xB5 = true;
unk_0xB0 = false; unk_0xB0 = false;
mIsSetData = false; mIsSetData = false;
mIsPlaying = false; mIsPlaying = false;
@@ -196,7 +196,7 @@ void SimpleWavePlayer::stop() {
void SimpleWavePlayer::update() { void SimpleWavePlayer::update() {
if (mIsPlaying) { if (mIsPlaying) {
if (!mbFillInCallback) { if (!unk_0xB5) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (mWavePackets[i].GetAppendFlag()) { if (mWavePackets[i].GetAppendFlag()) {
continue; continue;

View File

@@ -53,7 +53,7 @@ void AudioFrameCallback() {
for (i = 0; i < AX_VOICE_MAX; i++) { for (i = 0; i < AX_VOICE_MAX; i++) {
VoiceInfo* currVoice = &Voices[i]; VoiceInfo* currVoice = &Voices[i];
if (currVoice->getAXVPB() == NULL && currVoice->getUpdateFlag() != 2) { if (currVoice->getAXVPB() == NULL && currVoice->getUnk_0x0C() != 2) {
continue; continue;
} }
@@ -108,7 +108,7 @@ void AudioFrameCallback() {
currVoice->setState(0); currVoice->setState(0);
currVoice->setUnk_0x08(0); currVoice->setUnk_0x08(0);
} }
currVoice->setUpdateFlag(0); currVoice->setUnk_0x0C(0);
} }
return; return;
} }
@@ -370,7 +370,7 @@ clean_up:
} }
Voices[axVoiceBuf[i]->index].setAXVPB(axVoiceBuf[i]); Voices[axVoiceBuf[i]->index].setAXVPB(axVoiceBuf[i]);
Voices[axVoiceBuf[i]->index].setState(1); Voices[axVoiceBuf[i]->index].setState(1);
Voices[axVoiceBuf[i]->index].setUpdateFlag(1); Voices[axVoiceBuf[i]->index].setUnk_0x0C(1);
} }
if (handle != NULL) { if (handle != NULL) {
for (u32 i = 0; i < chanCount; i++) { for (u32 i = 0; i < chanCount; i++) {
@@ -397,7 +397,7 @@ bool AxAdpcmHandle::setVolume(f32 newVolume) {
mix.vR = newVolume * mpVoices[i]->getMix()->vR; mix.vR = newVolume * mpVoices[i]->getMix()->vR;
AXSetVoiceMix(mpVoices[i]->getAXVPB(), &mix); AXSetVoiceMix(mpVoices[i]->getAXVPB(), &mix);
mpVoices[i]->setUpdateFlag(1); mpVoices[i]->setUnk_0x0C(1);
a = true; a = true;
} }
return a; return a;
@@ -416,7 +416,7 @@ void AxAdpcmSimplePlayer::stop(AxAdpcmHandle* handle) {
} }
handle->getVoice(i)->setState(7); handle->getVoice(i)->setState(7);
handle->getVoice(i)->setUpdateFlag(1); handle->getVoice(i)->setUnk_0x0C(1);
if (handle->getVoice(i)->getUnk_0x08() != 0) { if (handle->getVoice(i)->getUnk_0x08() != 0) {
handle->getVoice(i)->setUnk_0x08(0); handle->getVoice(i)->setUnk_0x08(0);
} }
@@ -440,8 +440,8 @@ void AxAdpcmSimplePlayer::setVolume(AxAdpcmHandle* handle, f32 volume) {
void AxAdpcmSimplePlayer::calc() { void AxAdpcmSimplePlayer::calc() {
for (int i = 0; i < AX_VOICE_MAX; i++) { for (int i = 0; i < AX_VOICE_MAX; i++) {
if (Voices[i].getUpdateFlag() == 1) { if (Voices[i].getUnk_0x0C() == 1) {
Voices[i].setUpdateFlag(2); Voices[i].setUnk_0x0C(2);
} }
} }
} }

View File

@@ -7207,7 +7207,7 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
u32 cmpLow; u32 cmpLow;
struct { struct {
CHANSVmObjType operandTypes[2]; CHANSVmObjType operandTypes[2];
double floatLiteral; u64 floatBits;
CHANSVmObjHdr copies[2]; CHANSVmObjHdr copies[2];
CHANSVmObjHdr load; CHANSVmObjHdr load;
CHANSVmObjHdr operand; CHANSVmObjHdr operand;
@@ -7291,8 +7291,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
case CHANS_VM_OP_LOAD_FLOAT: { case CHANS_VM_OP_LOAD_FLOAT: {
opSize = 9; opSize = 9;
operandBuf = VmGetOperand(vm, 1, 9); operandBuf = VmGetOperand(vm, 1, 9);
memcpy(&scratch.floatLiteral, operandBuf, 8); memcpy(&scratch.floatBits, operandBuf, 8);
result = CHANSVmSetFloat(vm, &pVm->accumulator, scratch.floatLiteral); result = CHANSVmSetFloat(vm, &pVm->accumulator, *(double*)&scratch.floatBits);
break; break;
} }
@@ -7441,7 +7441,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
} }
if (leftOp == vmNull || rightOp == vmNull) { if (leftOp == vmNull || rightOp == vmNull) {
return CHANS_VM_ERR_RESULT_TYPE; result = CHANS_VM_ERR_RESULT_TYPE;
break;
} }
result = opFunc(vm, convTypeIdx, &pVm->accumulator, leftOp, rightOp); result = opFunc(vm, convTypeIdx, &pVm->accumulator, leftOp, rightOp);
@@ -7716,27 +7717,30 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
CHANSVmObjHdr* pAcc; CHANSVmObjHdr* pAcc;
CHANSVmExecutionCtx* ctx; CHANSVmExecutionCtx* ctx;
CHANSVmModule* dbg; CHANSVmModule* dbg;
CHANSVmErr loadResult;
opSize = 3; opSize = 3;
operandBuf = VmGetOperand(vm, 1, 3); operandBuf = VmGetOperand(vm, 1, 3);
if (operandBuf == vmNull) { if (operandBuf == vmNull) {
return CHANS_VM_ERR_CODE_RANGE; return CHANS_VM_ERR_CODE_RANGE;
} }
pAcc = &pVm->accumulator; pAcc = &pVm->accumulator;
loadResult = CHANSVmDeleteObject(vm, pAcc); result = CHANSVmDeleteObject(vm, pAcc);
if (loadResult == CHANS_VM_OK) { if (result == CHANS_VM_OK) {
imm16Val = VM_READ_BE_U16(operandBuf, 0); imm16Val = VM_READ_BE_U16(operandBuf, 0);
ctx = pVm->pActiveCtx; ctx = pVm->pActiveCtx;
dbg = ctx->pDbg; dbg = ctx->pDbg;
if (imm16Val >= dbg->stringCount || dbg->pStringTbl[imm16Val].pStringData == vmNull) { if (imm16Val < dbg->stringCount) {
loadResult = CHANS_VM_ERR_LOAD_STRING_CONST; if (dbg->pStringTbl[imm16Val].pStringData != vmNull) {
} else { goto load_str_ok;
pAcc->type = CHANS_VM_OBJ_TYPE_STRING; }
pAcc->hasData = vmTrue;
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
} }
} }
result = loadResult; result = CHANS_VM_ERR_LOAD_STRING_CONST;
break;
load_str_ok:
pAcc->type = CHANS_VM_OBJ_TYPE_STRING;
pAcc->hasData = vmTrue;
pAcc->value.wstring_v = (vmWStringObjVal*)&ctx->pDbg->pStringTbl[imm16Val];
break; break;
} }
@@ -7769,8 +7773,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
arrayIdx = (u32)stackPtr->value.int_v; arrayIdx = (u32)stackPtr->value.int_v;
goto set_index_ok; goto set_index_ok;
case CHANS_VM_OBJ_TYPE_FLOAT: { case CHANS_VM_OBJ_TYPE_FLOAT: {
double stackFloat = stackPtr->value.float_v; double stackFloat = *(double*)stackPtr;
if (stackFloat >= 0.0 && stackFloat <= 4294967294.0) { if (stackFloat <= 4294967294.0 && 0.0 <= stackFloat) {
arrayIdx = (u32)stackFloat; arrayIdx = (u32)stackFloat;
goto set_index_ok; goto set_index_ok;
} }
@@ -7881,7 +7885,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
computedAddr += pVm->pActiveCtx->pc + 5; computedAddr += pVm->pActiveCtx->pc + 5;
} }
if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) { if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) {
return CHANS_VM_ERR_CODE_RANGE; result = CHANS_VM_ERR_CODE_RANGE;
break;
} }
pVm->pActiveCtx->pc = computedAddr; pVm->pActiveCtx->pc = computedAddr;
opSize = 0; opSize = 0;
@@ -7929,7 +7934,8 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
computedAddr += pVm->pActiveCtx->pc + 4; computedAddr += pVm->pActiveCtx->pc + 4;
} }
if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) { if (computedAddr < 1 || computedAddr >= pVm->pActiveCtx->pDbg->codeSize) {
return CHANS_VM_ERR_CODE_RANGE; result = CHANS_VM_ERR_CODE_RANGE;
break;
} }
pVm->pActiveCtx->pc = computedAddr; pVm->pActiveCtx->pc = computedAddr;
opSize = 0; opSize = 0;
@@ -7954,13 +7960,11 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
} }
case CHANS_VM_OP_DELETE_INDIRECT: { case CHANS_VM_OP_DELETE_INDIRECT: {
CHANSVmObjHdr* accumulator = &pVm->accumulator; result = CHANS_VM_ERR_DELETE_INDIRECT;
CHANSVmErr deleteResult = CHANS_VM_ERR_DELETE_INDIRECT; if (pVm->accumulator.type == CHANS_VM_TYPE_INDEX_REF) {
if (accumulator->type == CHANS_VM_TYPE_INDEX_REF) { foundObj = VmGetArrayElement(vm, &pVm->accumulator, *((u32*)&pVm->accumulator.value + 1), vmFalse);
foundObj = VmGetArrayElement(vm, accumulator, accumulator->value.data.len, vmFalse); result = VmDeleteCommon(vm, foundObj);
deleteResult = VmDeleteCommon(vm, foundObj);
} }
result = deleteResult;
break; break;
} }
@@ -8004,27 +8008,34 @@ CHANSVmErr CHANSVmStep(CHANSVm* vm, int stepCount) {
if (pVm->pActiveCtx->stackDepth != 0 && pVm->pObjStackTopBuf + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) { if (pVm->pActiveCtx->stackDepth != 0 && pVm->pObjStackTopBuf + sizeof(CHANSVmObjHdr) <= pVm->pHeapEnd) {
CHANSVmObjHdr* stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf; CHANSVmObjHdr* stackTop = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
isTypeMatch = 0; isTypeMatch = 0;
if (stackTop->type == pVm->accumulator.type) { if (pVm->accumulator.type == stackTop->type) {
switch (stackTop->type) { switch (stackTop->type) {
case CHANS_VM_OBJ_TYPE_INTEGER: { case CHANS_VM_OBJ_TYPE_INTEGER: {
isTypeMatch = stackTop->value.int_v == pVm->accumulator.value.int_v; u32 low1 = *(u32*)stackTop;
u32 low2 = *(u32*)&pVm->accumulator;
u32 high1 = *((u32*)stackTop + 1);
u32 high2 = *((u32*)&pVm->accumulator + 1);
u32 xor1 = low1 ^ low2;
u32 xor2 = high1 ^ high2;
isTypeMatch = !(xor1 | xor2);
goto end_branch_check; goto end_branch_check;
} }
case CHANS_VM_OBJ_TYPE_FLOAT: { case CHANS_VM_OBJ_TYPE_FLOAT: {
isTypeMatch = stackTop->value.float_v == pVm->accumulator.value.float_v; double stackFloat = stackTop->value.float_v;
double accFloat = pVm->accumulator.value.float_v;
isTypeMatch = stackFloat == accFloat ? 1 : 0;
goto end_branch_check; goto end_branch_check;
} }
case CHANS_VM_OBJ_TYPE_STRING: { case CHANS_VM_OBJ_TYPE_STRING: {
u32 len1, len2; u32 len1, len2;
const vmWStringObjVal* accumulatorString = pVm->accumulator.value.wstring_v; CHANSVmObjHdr* stackObj = (CHANSVmObjHdr*)pVm->pObjStackTopBuf;
const vmWStringObjVal* stackString = stackTop->value.wstring_v;
u32 strEqual; u32 strEqual;
isTypeMatch = 0; isTypeMatch = 0;
len1 = stackString->len; len1 = stackObj->value.wstring_v->len;
len2 = accumulatorString->len; len2 = pVm->accumulator.value.wstring_v->len;
if (len1 == len2) { if (len1 == len2) {
strEqual = 0; strEqual = 0;
if (len1 == 0 || memcmp(stackString->spData, accumulatorString->spData, len1) == 0) { if (len1 == 0 || memcmp(stackObj->value.wstring_v->spData, pVm->accumulator.value.wstring_v->spData, len1) == 0) {
strEqual = 1; strEqual = 1;
} }
if (strEqual) { if (strEqual) {

View File

@@ -16,7 +16,7 @@ namespace ipl {
namespace cs { namespace cs {
namespace savedata { namespace savedata {
struct data { struct data {
char sMountPath[MAX_PATH_LENGTH + sizeof(wchar_t)]; // 0x00 char unk_0x00[MAX_PATH_LENGTH + sizeof(wchar_t)]; // 0x00
char sPath[MAX_PATH_LENGTH + sizeof(wchar_t)]; // 0x42 char sPath[MAX_PATH_LENGTH + sizeof(wchar_t)]; // 0x42
u8 flag; // 0x84 u8 flag; // 0x84
u8* pData; // 0x88 u8* pData; // 0x88
@@ -67,7 +67,7 @@ namespace ipl {
data* data = static_cast<savedata::data*>(*hdr->value.ptr_v); data* data = static_cast<savedata::data*>(*hdr->value.ptr_v);
if (data->pData == NULL && data->size == 0) { if (data->pData == NULL && data->size == 0) {
if (data->sMountPath[0] == 0) { if (data->unk_0x00[0] == 0) {
error = load_nand_(vm, data, heap, offset, size, 0x20); error = load_nand_(vm, data, heap, offset, size, 0x20);
} else { } else {
error = load_vf_(vm, data, heap, offset, size, 0x20); error = load_vf_(vm, data, heap, offset, size, 0x20);
@@ -127,7 +127,7 @@ namespace ipl {
} }
} }
if (data->sMountPath[0] == '\0') { if (data->unk_0x00[0] == '\0') {
error = load_nand_(vm, data, csHeap, 0, size, -0x20); error = load_nand_(vm, data, csHeap, 0, size, -0x20);
} else { } else {
error = load_vf_(vm, data, csHeap, 0, size, -0x20); error = load_vf_(vm, data, csHeap, 0, size, -0x20);
@@ -591,7 +591,7 @@ namespace ipl {
memset(data, 0, sizeof(savedata::data)); memset(data, 0, sizeof(savedata::data));
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
if (arg1 != NULL) { if (arg1 != NULL) {
util::utf16_to_ascii(data->sMountPath, temp, MAX_PATH_LENGTH, arg0); util::utf16_to_ascii(data->unk_0x00, temp, MAX_PATH_LENGTH, arg0);
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
util::utf16_to_ascii(data->sPath, temp, MAX_PATH_LENGTH, arg1); util::utf16_to_ascii(data->sPath, temp, MAX_PATH_LENGTH, arg1);
} else { } else {

View File

@@ -1179,10 +1179,10 @@ namespace ipl {
return; return;
} }
switch (mState) { if (mState != STATE_NORMAL || mMode != 0) {
case STATE_NORMAL: return;
switch (mMode) { }
case 0:
if (!mpFriendCache->isThere(buttonNo + mPage * BTN_MAX)) { if (!mpFriendCache->isThere(buttonNo + mPage * BTN_MAX)) {
return; return;
} }
@@ -1240,8 +1240,6 @@ namespace ipl {
snd::getSystem()->startSEwithPos("WIPL_SE_CH_HOLD", mDrag.mPos.x); snd::getSystem()->startSEwithPos("WIPL_SE_CH_HOLD", mDrag.mPos.x);
mState = STATE_DRAG; mState = STATE_DRAG;
}
}
} }
void Address::start_drag_point_event(const char* paneName, controller::Interface* con) { void Address::start_drag_point_event(const char* paneName, controller::Interface* con) {
@@ -1427,7 +1425,10 @@ namespace ipl {
if (con->downTrg(controller::BTN_INTERACT)) { if (con->downTrg(controller::BTN_INTERACT)) {
Button* button = static_cast<Button*>(System::getScene(SCENE_BUTTON)); Button* button = static_cast<Button*>(System::getScene(SCENE_BUTTON));
if (mState == STATE_COVER_NORMAL || mState == STATE_NORMAL) { if (mState != STATE_COVER_NORMAL && mState != STATE_NORMAL) {
break;
}
if (Button::cmpButtonName(paneName, Button::BTN_EXIT) == 0) { if (Button::cmpButtonName(paneName, Button::BTN_EXIT) == 0) {
MailAddressSelect* mailAddrSel = static_cast<MailAddressSelect*>(System::getScene(SCENE_MAIL_ADDRESS_SELECT)); MailAddressSelect* mailAddrSel = static_cast<MailAddressSelect*>(System::getScene(SCENE_MAIL_ADDRESS_SELECT));
button->animation(Button::IDANIM_SELECT_CALENDAR_EXIT); button->animation(Button::IDANIM_SELECT_CALENDAR_EXIT);
@@ -1476,7 +1477,7 @@ namespace ipl {
snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC"); snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC");
onPreviousPage(); onPreviousPage();
} }
} break;
} }
// fallthrough // fallthrough
} }
@@ -1782,15 +1783,13 @@ namespace ipl {
nw4r::math::VEC3 baseTrans = mpLayout->FindPaneByName("N_base_move")->GetTranslate(); nw4r::math::VEC3 baseTrans = mpLayout->FindPaneByName("N_base_move")->GetTranslate();
math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos(); math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos();
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName("T_name_move")); nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName("T_name_move"));
const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name;
f32 width = 0.0f; f32 width = 0.0f;
if (textBox != NULL) { if (textBox != NULL && name != NULL) {
const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name; textBox->GetFont()->GetWidth();
if (name != NULL) { for (; *name != 0; name++) {
textBox->GetFont()->GetWidth(); width += textBox->GetFont()->GetCharWidth(*name);
for (; *name != 0; name++) {
width += textBox->GetFont()->GetCharWidth(*name);
}
} }
} }
width += 0.01f; width += 0.01f;
@@ -1947,10 +1946,11 @@ namespace ipl {
} }
void FriendListCache::update(u32 index, const wchar_t* name, u64 fdId) { void FriendListCache::update(u32 index, const wchar_t* name, u64 fdId) {
mInfos[index].attr.fdId = fdId; NWC24FriendInfo* info = &mInfos[index];
memset(mInfos[index].attr.name, 0, sizeof(mInfos[index].attr.name)); info->attr.fdId = fdId;
wcsncpy((wchar_t*)getInfo(index).attr.name, name, 10); memset(info->attr.name, 0, sizeof(info->attr.name));
System::getNwc24Manager()->updateFriendInfo(&getInfo(index), index); wcsncpy((wchar_t*)info->attr.name, name, 10);
System::getNwc24Manager()->updateFriendInfo(info, index);
} }
void FriendListCache::del(u32 index) { void FriendListCache::del(u32 index) {

View File

@@ -521,8 +521,7 @@ void ipl::scene::AddressEdit::create() {
set_textbox(textPane, friendText); set_textbox(textPane, friendText);
textPane = (mpCodeLayout) textPane = (mpCodeLayout)
->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true); ->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true);
friendText = mString.mDisplayText; set_textbox(textPane, mString.mDisplayText);
set_textbox(textPane, friendText);
mState = 0; mState = 0;
break; break;
} }
@@ -2780,7 +2779,7 @@ void ipl::scene::AddressEdit::set_err_msg(wchar_t* outErrMsg, u32 outErrMsgLen,
swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), L"%06d\n", errorCode); swprintf(nwc24ErrStr, sizeof(nwc24ErrStr) / sizeof(wchar_t), L"%06d\n", errorCode);
wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg)); wcsncat(outErrMsg, nwc24ErrStr, outErrMsgLen - wcslen(outErrMsg));
u32 messageId; u32 messageId = MESG_ERROR_NWC24_SERVER;
switch (nwc24Err) { switch (nwc24Err) {
case NWC24_ERR_NETWORK: case NWC24_ERR_NETWORK:
messageId = MESG_ERROR_NWC24_NETWORK; messageId = MESG_ERROR_NWC24_NETWORK;
@@ -2866,7 +2865,10 @@ void ipl::scene::AddressEdit::get_friendinfo() {
memcpy(&ipl::scene::sFriendInfo, &mpFriendCache->getInfo(mSelectedFriend), memcpy(&ipl::scene::sFriendInfo, &mpFriendCache->getInfo(mSelectedFriend),
sizeof(ipl::scene::sFriendInfo)); sizeof(ipl::scene::sFriendInfo));
mString.setName(reinterpret_cast<const wchar_t*>(ipl::scene::sFriendInfo.attr.name)); mString.setName(reinterpret_cast<const wchar_t*>(ipl::scene::sFriendInfo.attr.name));
set_textbox(mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_name_00", true), mString.mName); const wchar_t* name = mString.mName;
nw4r::lyt::Pane* namePane =
mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_name_00", true);
set_textbox(namePane, name);
wchar_t wiiNo[0x100]; wchar_t wiiNo[0x100];
wchar_t email[0x102]; wchar_t email[0x102];
@@ -2879,7 +2881,10 @@ void ipl::scene::AddressEdit::get_friendinfo() {
ipl::utility::CharacterCode::ANSIToUTF16(email, reinterpret_cast<const u8*>(&ipl::scene::sFriendInfo.addr), 0x102); ipl::utility::CharacterCode::ANSIToUTF16(email, reinterpret_cast<const u8*>(&ipl::scene::sFriendInfo.addr), 0x102);
mString.setEMail(email); mString.setEMail(email);
} }
set_textbox(mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true), mString.mDisplayText); const wchar_t* displayText = mString.mDisplayText;
nw4r::lyt::Pane* friendCodePane =
mpCodeLayout->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true);
set_textbox(friendCodePane, displayText);
memcpy(&mCreateID, &ipl::scene::sFriendInfo.attr.fdId, sizeof(mCreateID)); memcpy(&mCreateID, &ipl::scene::sFriendInfo.attr.fdId, sizeof(mCreateID));
} }

View File

@@ -930,13 +930,13 @@ namespace ipl {
math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate()); math::VEC3 translate(mpLayout->FindPaneByName("N_Memo")->GetTranslate());
mURLProc.clear_prev_drawing(); mURLProc.clear_prev_drawing();
mURLProc.setMemoTranslateY(translate.y); mURLProc.setUnk_0x44(translate.y);
bool result = false; bool result = false;
if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) { if (mState == STATE_NORMAL && mScroller.is_busy() == FALSE) {
result = true; result = true;
} }
mURLProc.setFocusEnabled(result); mURLProc.setUnk_0x53(result);
if (translate.y < 500.0f) { if (translate.y < 500.0f) {
mpLayout->draw("N_Header"); mpLayout->draw("N_Header");
@@ -983,8 +983,8 @@ namespace ipl {
mpLayout->draw("ReplyMask"); mpLayout->draw("ReplyMask");
} }
if (!mURLProc.getColorPass()) { if (!mURLProc.getUnk_0x50()) {
mURLProc.setColorPass(1); mURLProc.setUnk_0x50(1);
} }
} }
@@ -1512,7 +1512,7 @@ namespace ipl {
mURLProc.init(); mURLProc.init();
if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) { if (mpBoardObj->mLetterType == BoardObject::TYPE_MEMO) {
mURLProc.setHitYOffset(8.0f); mURLProc.setUnk_0x40(8.0f);
} }
nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter"); nw4r::lyt::Pane* pane = mpLayout->FindPaneByName("T_Letter");

View File

@@ -15,16 +15,16 @@ namespace ipl {
} }
void UrlProcessor::init() { void UrlProcessor::init() {
mbHoverOffset = 0; unk_0x52 = 0;
mbInTag = 0; unk_0x51 = 0;
mbColorPass = 0; unk_0x50 = 0;
mbFocusEnabled = 1; unk_0x53 = 1;
mHitYOffset = 0.0f; unk_0x40 = 0.0f;
mMemoTranslateY = 0.0f; unk_0x44 = 0.0f;
mCurTagNo = 0; unk_0x48 = 0;
mSelectedTagNo = -1; unk_0x4C = -1;
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
mConData[i].valid = false; mConData[i].valid = false;
@@ -60,14 +60,14 @@ namespace ipl {
} }
void UrlProcessor::clear_prev_drawing() { void UrlProcessor::clear_prev_drawing() {
mCurTagNo = 0; unk_0x48 = 0;
mbHoverOffset = 0; unk_0x52 = 0;
mbInTag = 0; unk_0x51 = 0;
} }
nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) { nw4r::ut::Operation UrlProcessor::Process(u16 code, nw4r::ut::PrintContext<wchar_t>* context) {
if (code == SEPERATOR || code == (u16)'\n') { if (code == SEPERATOR || code == (u16)'\n') {
if (mbColorPass == 0) { if (unk_0x50 == 0) {
make_collision(context, code); make_collision(context, code);
} else if (code == SEPERATOR) { } else if (code == SEPERATOR) {
parse(context); parse(context);
@@ -78,42 +78,42 @@ namespace ipl {
void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) { void UrlProcessor::make_collision(nw4r::ut::PrintContext<wchar_t>* context, u16 code) {
if (code == SEPERATOR) { if (code == SEPERATOR) {
if (mbInTag == 0) { if (unk_0x51 == 0) {
url_collision* const url_col = new (System::getMem2App(), 4) url_collision(); url_collision* const url_col = new (System::getMem2App(), 4) url_collision();
line_collision* const line_col = new (System::getMem2App(), 4) line_collision(); line_collision* const line_col = new (System::getMem2App(), 4) line_collision();
url_col->mTagNo = mCurTagNo; url_col->unk_0x00 = unk_0x48;
url_col->mpStart = (wchar_t*)context->str; url_col->unk_0x04 = (wchar_t*)context->str;
line_col->mLeft = context->writer->GetCursorX(); line_col->unk_0x00 = context->writer->GetCursorX();
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col); nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
nw4r::ut::List_Append(&mUrlCollisions, url_col); nw4r::ut::List_Append(&mUrlCollisions, url_col);
mbInTag = 1; unk_0x51 = 1;
} else { } else {
void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); void* url_col_raw = nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL); void* line_col_raw = nw4r::ut::List_GetPrev(&((url_collision*)url_col_raw)->mLineCollisions, NULL);
url_collision* url_col = (url_collision*)url_col_raw; url_collision* url_col = (url_collision*)url_col_raw;
line_collision* line_col = (line_collision*)line_col_raw; line_collision* line_col = (line_collision*)line_col_raw;
line_col->mRight = context->writer->GetCursorX(); line_col->unk_0x04 = context->writer->GetCursorX();
line_col->mY = context->writer->GetCursorY(); line_col->unk_0x08 = context->writer->GetCursorY();
url_col->mpEnd = (wchar_t*)context->str; url_col->unk_0x08 = (wchar_t*)context->str;
mbInTag = 0; unk_0x51 = 0;
mCurTagNo++; unk_0x48++;
} }
} else { } else {
if (mbInTag != 0) { if (unk_0x51 != 0) {
url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL); url_collision* url_col = (url_collision*)nw4r::ut::List_GetPrev(&mUrlCollisions, NULL);
line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL); line_collision* line_col = (line_collision*)nw4r::ut::List_GetPrev(&url_col->mLineCollisions, NULL);
line_col->mRight = context->writer->GetCursorX(); line_col->unk_0x04 = context->writer->GetCursorX();
line_col->mY = context->writer->GetCursorY(); line_col->unk_0x08 = context->writer->GetCursorY();
line_col = new (System::getMem2App(), 4) line_collision(); line_col = new (System::getMem2App(), 4) line_collision();
line_col->mLeft = -208.0f; line_col->unk_0x00 = -208.0f;
nw4r::ut::List_Append(&url_col->mLineCollisions, line_col); nw4r::ut::List_Append(&url_col->mLineCollisions, line_col);
} }
@@ -122,41 +122,41 @@ namespace ipl {
void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) { void UrlProcessor::parse(nw4r::ut::PrintContext<wchar_t>* context) {
f32 curY = context->writer->GetCursorY(); f32 curY = context->writer->GetCursorY();
if (mbInTag == 0) { if (unk_0x51 == 0) {
if (mSelectedTagNo == mCurTagNo) { if (unk_0x4C == unk_0x48) {
context->writer->SetTextColor(0xFFE664FF); context->writer->SetTextColor(0xFFE664FF);
} else if (mbFocusEnabled != 0 && is_focused()) { } else if (unk_0x53 != 0 && is_focused()) {
context->writer->SetCursorY(curY - 2.0f); context->writer->SetCursorY(curY - 2.0f);
context->writer->SetTextColor(0xF06E28FF); context->writer->SetTextColor(0xF06E28FF);
mbHoverOffset = 1; unk_0x52 = 1;
} else { } else {
context->writer->SetTextColor(0x34BEEDFF); context->writer->SetTextColor(0x34BEEDFF);
} }
mbInTag = 1; unk_0x51 = 1;
} else { } else {
if (mbHoverOffset != 0) { if (unk_0x52 != 0) {
context->writer->SetCursorY(2.0f + curY); context->writer->SetCursorY(2.0f + curY);
mbHoverOffset = 0; unk_0x52 = 0;
} }
context->writer->SetTextColor(0x646464FF); context->writer->SetTextColor(0x646464FF);
mbInTag = 0; unk_0x51 = 0;
mCurTagNo++; unk_0x48++;
} }
} }
BOOL UrlProcessor::is_focused() const { BOOL UrlProcessor::is_focused() const {
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) { for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
if (mCurTagNo == get_focused_tagno(i)) { if (unk_0x48 == get_focused_tagno(i)) {
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
void UrlProcessor::select(int tagNo) { void UrlProcessor::select(int unk) {
mSelectedTagNo = tagNo; unk_0x4C = unk;
} }
int UrlProcessor::get_focused_tagno(int chan) const { int UrlProcessor::get_focused_tagno(int chan) const {
@@ -174,13 +174,13 @@ namespace ipl {
while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) { while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) {
while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) { while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) {
f32 left = line_col->mLeft - var_f28; f32 left = line_col->unk_0x00 - var_f28;
f32 right = var_f28 + line_col->mRight; f32 right = var_f28 + line_col->unk_0x04;
f32 temp_f0 = ((mMemoTranslateY + mHitYOffset) - line_col->mY); f32 temp_f0 = ((unk_0x44 + unk_0x40) - line_col->unk_0x08);
f32 top = (var_f29 + temp_f0) - var_f28; f32 top = (var_f29 + temp_f0) - var_f28;
f32 bottom = var_f28 + (var_f30 + temp_f0); f32 bottom = var_f28 + (var_f30 + temp_f0);
if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) { if (left <= var_f31 && var_f31 <= right && top <= -pos.y && -pos.y <= bottom) {
return url_col->mTagNo; return url_col->unk_0x00;
} }
} }
} }
@@ -194,7 +194,7 @@ namespace ipl {
url_collision* url_col = NULL; url_collision* url_col = NULL;
while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) { while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) {
if (got->mTagNo == mSelectedTagNo) { if (got->unk_0x00 == unk_0x4C) {
url_col = got; url_col = got;
break; break;
} }
@@ -210,10 +210,10 @@ namespace ipl {
int chIdx2 = 0; int chIdx2 = 0;
int chIdx = 0; int chIdx = 0;
u32 count = (u32)url_col->mpEnd - (u32)url_col->mpStart; u32 count = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
count >>= 1; count >>= 1;
for (u32 i = 0; i < count; i++) { for (u32 i = 0; i < count; i++) {
wchar_t wch = url_col->mpStart[i]; wchar_t wch = url_col->unk_0x04[i];
if (wch != SEPERATOR && chIdx2 < 0x200) { if (wch != SEPERATOR && chIdx2 < 0x200) {
url[chIdx2++] = wch; url[chIdx2++] = wch;
} }
@@ -226,9 +226,9 @@ namespace ipl {
} }
UrlProcessor::url_collision::url_collision() { UrlProcessor::url_collision::url_collision() {
mTagNo = 0; unk_0x00 = 0;
mpStart = NULL; unk_0x04 = NULL;
mpEnd = NULL; unk_0x08 = NULL;
nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList)); nw4r::ut::List_Init(&mLineCollisions, offsetof(line_collision, mLinkList));
} }

View File

@@ -436,10 +436,10 @@ namespace ipl {
data.titleId = System::getChannelManager()->getTitleID(mChanPage, mChanIndex); data.titleId = System::getChannelManager()->getTitleID(mChanPage, mChanIndex);
data.threadTerminated = mbModuleTerminated; data.threadTerminated = mbModuleTerminated;
data.unk_0x19 = true; data.unk_0x19 = true;
data.mbHasNewMessage = true; data.unk_0x1A = true;
if (!(System::getNwc24Manager() != NULL && System::getNwc24Manager()->isNewMessageThere(ES_TITLE_CODE(data.titleId)))) { if (!(System::getNwc24Manager() != NULL && System::getNwc24Manager()->isNewMessageThere(ES_TITLE_CODE(data.titleId)))) {
data.mbHasNewMessage = false; data.unk_0x1A = false;
} }
System::getCSManager()->setData(data); System::getCSManager()->setData(data);
@@ -674,8 +674,7 @@ namespace ipl {
if (foundLangGroup) { if (foundLangGroup) {
nw4r::lyt::Group* group = layout->FindGroupByName(langGroup); nw4r::lyt::Group* group = layout->FindGroupByName(langGroup);
nw4r::lyt::Group* const& groupView = group; for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) {
for (nw4r::lyt::PaneLinkList::Iterator it = groupView->GetPaneList().GetBeginIter(); it != groupView->GetPaneList().GetEndIter(); it++) {
it->mTarget->SetVisible(true); it->mTarget->SetVisible(true);
} }
} else { } else {
@@ -686,8 +685,7 @@ namespace ipl {
} }
if (strcmp(scModuleData.langGroupLookup[region][i], langCodeBuf[scLangLookup[region][i]]) == 0) { if (strcmp(scModuleData.langGroupLookup[region][i], langCodeBuf[scLangLookup[region][i]]) == 0) {
nw4r::lyt::Group* group = layout->FindGroupByName(scModuleData.langGroupLookup[region][i]); nw4r::lyt::Group* group = layout->FindGroupByName(scModuleData.langGroupLookup[region][i]);
nw4r::lyt::Group* const& groupView = group; for (nw4r::lyt::PaneLinkList::Iterator it = group->GetPaneList().GetBeginIter(); it != group->GetPaneList().GetEndIter(); it++) {
for (nw4r::lyt::PaneLinkList::Iterator it = groupView->GetPaneList().GetBeginIter(); it != groupView->GetPaneList().GetEndIter(); it++) {
it->mTarget->SetVisible(true); it->mTarget->SetVisible(true);
} }
break; break;

View File

@@ -1,5 +1,3 @@
#define IPL_CHANNEL_SELECT_CPP
#include <decomp/ide.h> #include <decomp/ide.h>
#include "iplSceneUI.h" #include "iplSceneUI.h"
@@ -45,7 +43,8 @@ namespace ipl {
return r; return r;
} }
inline f32 HermiteIntp<f32>::get() const { template <>
f32 HermiteIntp<f32>::get() const {
f32 var_f27 = mFrame; f32 var_f27 = mFrame;
f32 var_f28 = 1.0f / mMaxFrame; f32 var_f28 = 1.0f / mMaxFrame;
f32 r = (mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - f32 r = (mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
@@ -330,8 +329,8 @@ namespace ipl {
setSceneParentFlags(SCN_PARENTFLAG_DRAW | SCN_PARENTFLAG_CALC); setSceneParentFlags(SCN_PARENTFLAG_DRAW | SCN_PARENTFLAG_CALC);
mOrthoTrans = math::VEC3(0.0f, 0.0f, 0.0f); unk_0xD8 = math::VEC3(0.0f, 0.0f, 0.0f);
mOrthoScale = math::VEC2(1.0f, 1.0f); unk_0xE4 = math::VEC2(1.0f, 1.0f);
nw4r::ut::Rect proj4x3; nw4r::ut::Rect proj4x3;
System::getProjectionRect4x3(&proj4x3); System::getProjectionRect4x3(&proj4x3);
@@ -648,7 +647,7 @@ namespace ipl {
void ChannelSelect::draw() { void ChannelSelect::draw() {
if (mState != STATE_INACTIVE && System::getSceneManager()->onDrawLayer(scene::DRAW_LAYER_DEFAULT)) { if (mState != STATE_INACTIVE && System::getSceneManager()->onDrawLayer(scene::DRAW_LAYER_DEFAULT)) {
if (mState == STATE_NORMAL_FADE_ZOOM || mState == STATE_NORMAL_DONE_FADE_ZOOM || mState == STATE_NORMAL_RESTART) { if (mState == STATE_NORMAL_FADE_ZOOM || mState == STATE_NORMAL_DONE_FADE_ZOOM || mState == STATE_NORMAL_RESTART) {
utility::Graphics::setOrthoTransAndScale(mOrthoTrans, mOrthoScale); utility::Graphics::setOrthoTransAndScale(unk_0xD8, unk_0xE4);
} }
utility::Graphics::setOrtho(); utility::Graphics::setOrtho();
@@ -1845,7 +1844,7 @@ namespace ipl {
initChanZoomParam(myVec, 1); initChanZoomParam(myVec, 1);
setChanZoomOrtho(); setChanZoomOrtho();
if (System::getChannelManager()->isDiskChannelReady()) { if (System::getChannelManager()->isUnk_0x1B81()) {
if (System::getBS2Manager()->getIPLState() == bs2::IPL_STATE_RVL_GAME || if (System::getBS2Manager()->getIPLState() == bs2::IPL_STATE_RVL_GAME ||
System::getBS2Manager()->getIPLState() == bs2::IPL_STATE_DISK_UPDATE) { System::getBS2Manager()->getIPLState() == bs2::IPL_STATE_DISK_UPDATE) {
if (mspDiskID != NULL) { if (mspDiskID != NULL) {
@@ -1857,7 +1856,7 @@ namespace ipl {
if (strncmp(diskID, mspDiskID, 4) == 0) { if (strncmp(diskID, mspDiskID, 4) == 0) {
if (strncmp(diskMaker, mspDiskMaker, 2) == 0) { if (strncmp(diskMaker, mspDiskMaker, 2) == 0) {
System::getChannelManager()->setDiskChannelReady(false); System::getChannelManager()->setUnk_0x1B81(false);
} }
} }
} }
@@ -1910,10 +1909,10 @@ namespace ipl {
u16 efbHeight; u16 efbHeight;
if (mState == STATE_NORMAL_FADE_ZOOM || mState == STATE_NORMAL_DONE_FADE_ZOOM || mState == STATE_NORMAL_RESTART) { if (mState == STATE_NORMAL_FADE_ZOOM || mState == STATE_NORMAL_DONE_FADE_ZOOM || mState == STATE_NORMAL_RESTART) {
nw4r::math::MTX44 mtx; nw4r::math::MTX44 mtx;
f32 right = mOrthoTrans.x + projRect.right / mOrthoScale.x; f32 right = unk_0xD8.x + projRect.right / unk_0xE4.x;
f32 left = mOrthoTrans.x + projRect.left / mOrthoScale.x; f32 left = unk_0xD8.x + projRect.left / unk_0xE4.x;
f32 bottom = mOrthoTrans.y - projRect.bottom / mOrthoScale.y; f32 bottom = unk_0xD8.y - projRect.bottom / unk_0xE4.y;
f32 top = mOrthoTrans.y - projRect.top / mOrthoScale.y; f32 top = unk_0xD8.y - projRect.top / unk_0xE4.y;
MTXOrtho(mtx, top, bottom, left, right, -100.0f, 100.0f); MTXOrtho(mtx, top, bottom, left, right, -100.0f, 100.0f);
nw4r::math::VEC4 vec4_in(vec.x, vec.y, 0.0f, 1.0f); nw4r::math::VEC4 vec4_in(vec.x, vec.y, 0.0f, 1.0f);
nw4r::math::VEC4 vec4; nw4r::math::VEC4 vec4;
@@ -1921,10 +1920,10 @@ namespace ipl {
fbWidth = rMode->fbWidth; fbWidth = rMode->fbWidth;
efbHeight = rMode->efbHeight; efbHeight = rMode->efbHeight;
f32 projectionWidth = projRect.GetWidth(); f32 projectionWidth = projRect.GetWidth();
scissorX = ((1.0f + vec4.x) * fbWidth / 2) - ((mChanThumbOff_X * mOrthoScale.x) * (fbWidth / projectionWidth)); scissorX = ((1.0f + vec4.x) * fbWidth / 2) - ((mChanThumbOff_X * unk_0xE4.x) * (fbWidth / projectionWidth));
scissorY = (efbHeight - ((1.0f + vec4.y) * efbHeight / 2)) - (mChanThumbOff_Y * mOrthoScale.y); scissorY = (efbHeight - ((1.0f + vec4.y) * efbHeight / 2)) - (mChanThumbOff_Y * unk_0xE4.y);
scissorWidth = 2.0f * (mChanThumbOff_X * mOrthoScale.x) * (fbWidth / projectionWidth); scissorWidth = 2.0f * (mChanThumbOff_X * unk_0xE4.x) * (fbWidth / projectionWidth);
scissorHeight = 2.0f * (mChanThumbOff_Y * mOrthoScale.y); scissorHeight = 2.0f * (mChanThumbOff_Y * unk_0xE4.y);
} else { } else {
fbWidth = rMode->fbWidth; fbWidth = rMode->fbWidth;
efbHeight = rMode->efbHeight; efbHeight = rMode->efbHeight;
@@ -2003,8 +2002,8 @@ namespace ipl {
nw4r::ut::Rect projRect; nw4r::ut::Rect projRect;
System::getProjectionRect(&projRect); System::getProjectionRect(&projRect);
mOrthoTrans = math::VEC3((frames[0].x + frames[1].x) / 2, (frames[0].y + frames[2].y) / 2, 0.0f); unk_0xD8 = math::VEC3((frames[0].x + frames[1].x) / 2, (frames[0].y + frames[2].y) / 2, 0.0f);
mOrthoScale = math::VEC2(projRect.GetWidth() / (frames[1].x - frames[0].x), projRect.GetHeight() / (frames[0].y - frames[2].y)); unk_0xE4 = math::VEC2(projRect.GetWidth() / (frames[1].x - frames[0].x), projRect.GetHeight() / (frames[0].y - frames[2].y));
} }
int ChannelSelect::isInChannelPaneNames(const char* name) const { int ChannelSelect::isInChannelPaneNames(const char* name) const {

View File

@@ -467,7 +467,7 @@ namespace ipl {
mpDiskBnrLayout->calc(); mpDiskBnrLayout->calc();
} else { } else {
calcModuleChannel(); calcModuleChannel();
System::getChannelManager()->setDiskChannelReady(false); System::getChannelManager()->setUnk_0x1B81(false);
} }
if ((mState == STATE_NORMAL || mState == STATE_WAIT_TMD || mState == STATE_PREPARE_BOOT || mState == STATE_BOOT_SCENE) && !unk_0x90 && if ((mState == STATE_NORMAL || mState == STATE_WAIT_TMD || mState == STATE_PREPARE_BOOT || mState == STATE_BOOT_SCENE) && !unk_0x90 &&
@@ -648,7 +648,7 @@ namespace ipl {
} }
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped()) { if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped()) {
if (System::getNwc24Manager() && !System::getNwc24Manager()->isReceivingIdle()) { if (System::getNwc24Manager() && !System::getNwc24Manager()->isUnk0xA31()) {
goto scn_continue; goto scn_continue;
} }
@@ -1220,7 +1220,7 @@ namespace ipl {
#pragma ppc_iro_level 0 #pragma ppc_iro_level 0
void ChannelTitle::calcNormalParentalDialog() { void ChannelTitle::calcNormalParentalDialog() {
if (mChanSceneID == SCENE_DISK_CHANNEL && if (mChanSceneID == SCENE_DISK_CHANNEL &&
(System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_RVL_GAME || System::getChannelManager()->isDiskChannelReady())) { (System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_RVL_GAME || System::getChannelManager()->isUnk_0x1B81())) {
mParentalState = PARENTAL_STATE_FAILED; mParentalState = PARENTAL_STATE_FAILED;
} }
@@ -1767,7 +1767,7 @@ namespace ipl {
data.threadTerminated = mbModuleTerminated; data.threadTerminated = mbModuleTerminated;
if (System::getNwc24Manager() == NULL || !System::getNwc24Manager()->isNewMessageThere(ES_TITLE_CODE(data.titleId))) { if (System::getNwc24Manager() == NULL || !System::getNwc24Manager()->isNewMessageThere(ES_TITLE_CODE(data.titleId))) {
data.mbHasNewMessage = false; data.unk_0x1A = false;
} }
System::getCSManager()->setData(data); System::getCSManager()->setData(data);
if (!System::getCSManager()->init(mpModuleFile, mpModuleThread)) { if (!System::getCSManager()->init(mpModuleFile, mpModuleThread)) {
@@ -2064,7 +2064,7 @@ namespace ipl {
break; break;
} }
case DISK_STATE_WII_DISK_IDLE: { case DISK_STATE_WII_DISK_IDLE: {
if (BS2State != bs2::IPL_STATE_RVL_GAME || System::getChannelManager()->isDiskChannelReady()) { if (BS2State != bs2::IPL_STATE_RVL_GAME || System::getChannelManager()->isUnk_0x1B81()) {
mDiskState = DISK_STATE_EJECT; mDiskState = DISK_STATE_EJECT;
mpDiskBnrAnims[DISK_ANIM_GRP_ALL][DISK_ANIM_DISK_EJECT]->play(); mpDiskBnrAnims[DISK_ANIM_GRP_ALL][DISK_ANIM_DISK_EJECT]->play();
mpDiskBnrLayout->GetRootPane()->SetVisible(true); mpDiskBnrLayout->GetRootPane()->SetVisible(true);

View File

@@ -237,7 +237,10 @@ bool MemoryCardManager::isIconValidate(u8 slot, s16 index) {
bool MemoryCardManager::isBannerEnable(u8 slot, s16 index) { bool MemoryCardManager::isBannerEnable(u8 slot, s16 index) {
CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray()); CardIcons* icons = reinterpret_cast<CardIcons*>(memorycard::getIconStateArray());
return icons[slot][mFile[slot][index].fileNo].bannerEnable != 0; u32 file = mFile[slot][index].fileNo;
memorycard::IconState* icon = &icons[slot][file];
u8 enabled = icon->bannerEnable;
return enabled != 0;
} }
void MemoryCardManager::update_icon_anm() { void MemoryCardManager::update_icon_anm() {

View File

@@ -25,16 +25,16 @@ typedef struct {
undefined4 result; undefined4 result;
undefined4 errCode; undefined4 errCode;
HTTPTestState httpTestState; HTTPTestState httpTestState;
undefined4 natState; undefined4 unk_0x030;
undefined4 gsAvailable; undefined4 unk_0x034;
undefined4 natTimedOut; undefined4 unk_0x038;
undefined4 natFailed; undefined4 unk_0x03c;
OSTime detectStartTime; OSTime detectStartTime;
NHTTPConnection httpConnection; NHTTPConnection httpConnection;
NHTTPRequest* httpRequest; NHTTPRequest* httpRequest;
NHTTPResponse* httpResponse; NHTTPResponse* httpResponse;
NCDProxyProfile proxy; NCDProxyProfile proxy;
void* httpBuf; void* unk_0x7f0;
NAT nat; NAT nat;
} StaticSession; } StaticSession;
@@ -64,14 +64,14 @@ void IPLContestInitialize(void* heapBuf, NCDProxyProfile* proxy) {
g_session.result = 0xFF00; g_session.result = 0xFF00;
g_session.errCode = 0; g_session.errCode = 0;
g_session.httpTestState = HTTP_TEST_NOT_STARTED; g_session.httpTestState = HTTP_TEST_NOT_STARTED;
g_session.natState = 0; g_session.unk_0x030 = 0;
g_session.detectStartTime = 0; g_session.detectStartTime = 0;
g_session.httpConnection = 0; g_session.httpConnection = 0;
g_session.httpRequest = 0; g_session.httpRequest = 0;
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
g_session.gsAvailable = 0; g_session.unk_0x034 = 0;
g_session.natTimedOut = 0; g_session.unk_0x038 = 0;
g_session.natFailed = 1; g_session.unk_0x03c = 1;
g_session.proxy = *proxy; g_session.proxy = *proxy;
} }
@@ -100,7 +100,7 @@ int IPLContestProcess() {
g_session.errCode = g_session.errCode != 0 ? g_session.errCode : -52200; g_session.errCode = g_session.errCode != 0 ? g_session.errCode : -52200;
OSReport("[error] Failed to start up NHTTP.\n"); OSReport("[error] Failed to start up NHTTP.\n");
} else { } else {
g_session.httpBuf = IPLContestAlloc(0x400); g_session.unk_0x7f0 = IPLContestAlloc(0x400);
g_session.httpTestState = HTTP_TEST_STARTED; g_session.httpTestState = HTTP_TEST_STARTED;
OSReport("Starting HTTP conectting test.\n"); OSReport("Starting HTTP conectting test.\n");
} }
@@ -108,7 +108,7 @@ int IPLContestProcess() {
} }
case HTTP_TEST_STARTED: { case HTTP_TEST_STARTED: {
g_session.httpRequest = g_session.httpRequest =
NHTTPCreateRequest("http://conntest.nintendowifi.net/", 0, g_session.httpBuf, 0x400, sNHTTPReqCallback, 0); NHTTPCreateRequest("http://conntest.nintendowifi.net/", 0, g_session.unk_0x7f0, 0x400, sNHTTPReqCallback, 0);
if (g_session.httpRequest == 0) { if (g_session.httpRequest == 0) {
g_session.httpTestState = HTTP_TEST_RESPONSE_ERRORED; g_session.httpTestState = HTTP_TEST_RESPONSE_ERRORED;
g_session.result |= 4; g_session.result |= 4;
@@ -156,9 +156,9 @@ int IPLContestProcess() {
NHTTPDestroyResponse(g_session.httpResponse); NHTTPDestroyResponse(g_session.httpResponse);
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
} }
if (g_session.httpBuf != NULL) { if (g_session.unk_0x7f0 != NULL) {
IPLContestFree(g_session.httpBuf, 0); IPLContestFree(g_session.unk_0x7f0, 0);
g_session.httpBuf = NULL; g_session.unk_0x7f0 = NULL;
} }
g_session.httpTestState = HTTP_TEST_DONE; g_session.httpTestState = HTTP_TEST_DONE;
NHTTPCleanupAsync(sNHTTPCleanupCallback); NHTTPCleanupAsync(sNHTTPCleanupCallback);
@@ -176,9 +176,9 @@ int IPLContestProcess() {
NHTTPDestroyResponse(g_session.httpResponse); NHTTPDestroyResponse(g_session.httpResponse);
g_session.httpResponse = NULL; g_session.httpResponse = NULL;
} }
if (g_session.httpBuf != NULL) { if (g_session.unk_0x7f0 != NULL) {
IPLContestFree(g_session.httpBuf, 0); IPLContestFree(g_session.unk_0x7f0, 0);
g_session.httpBuf = NULL; g_session.unk_0x7f0 = NULL;
} }
g_session.httpTestState = HTTP_TEST_DONE; g_session.httpTestState = HTTP_TEST_DONE;
NHTTPCleanupAsync(sNHTTPCleanupCallback); NHTTPCleanupAsync(sNHTTPCleanupCallback);
@@ -198,11 +198,11 @@ int IPLContestProcess() {
OSReport("Port mapping detectioning test has been skipped.\n"); OSReport("Port mapping detectioning test has been skipped.\n");
} else } else
switch (g_session.natState) { switch (g_session.unk_0x030) {
case 0: { case 0: {
gsiMemoryCallbacksSet(IPLContestGSMalloc, IPLContestGSFree, IPLContestGSRealloc, IPLContestGSMemalign); gsiMemoryCallbacksSet(IPLContestGSMalloc, IPLContestGSFree, IPLContestGSRealloc, IPLContestGSMemalign);
GSIStartAvailableCheckA("wiinat"); GSIStartAvailableCheckA("wiinat");
g_session.natState = 1; g_session.unk_0x030 = 1;
OSReport("Starting GameSpy available check.\n"); OSReport("Starting GameSpy available check.\n");
break; break;
} }
@@ -212,14 +212,14 @@ int IPLContestProcess() {
break; break;
} }
case GSIACAvailable: { case GSIACAvailable: {
g_session.gsAvailable = 1; g_session.unk_0x034 = 1;
g_session.natState = 2; g_session.unk_0x030 = 2;
OSReport("GameSpy server is currently available.\n"); OSReport("GameSpy server is currently available.\n");
break; break;
} }
default: { default: {
g_session.gsAvailable = 0; g_session.unk_0x034 = 0;
g_session.natState = 5; g_session.unk_0x030 = 5;
OSReport("GameSpy server is currently unavailable.\n"); OSReport("GameSpy server is currently unavailable.\n");
break; break;
} }
@@ -228,7 +228,7 @@ int IPLContestProcess() {
} }
case 2: { case 2: {
NNStartNatDetection(onNatDetectionDone); NNStartNatDetection(onNatDetectionDone);
g_session.natState = 3; g_session.unk_0x030 = 3;
OSReport("Port mapping detectioning test has been started.\n"); OSReport("Port mapping detectioning test has been started.\n");
g_session.detectStartTime = OSGetTime(); g_session.detectStartTime = OSGetTime();
break; break;
@@ -238,8 +238,8 @@ int IPLContestProcess() {
if (OSGetTime() - g_session.detectStartTime < OSMillisecondsToTicks((OSTime)90000)) { if (OSGetTime() - g_session.detectStartTime < OSMillisecondsToTicks((OSTime)90000)) {
break; break;
} }
g_session.natState = 5; g_session.unk_0x030 = 5;
g_session.natTimedOut = 1; g_session.unk_0x038 = 1;
OSReport("[error] NAT timeout.\n"); OSReport("[error] NAT timeout.\n");
break; break;
} }
@@ -289,10 +289,10 @@ int IPLGetNATSupportCode(int conntype) {
nat = g_session.nat; nat = g_session.nat;
if (g_session.gsAvailable != 0) { if (g_session.unk_0x034 != 0) {
if (g_session.natTimedOut != 0) { if (g_session.unk_0x038 != 0) {
code = 11180; code = 11180;
} else if (g_session.natFailed != 0) { } else if (g_session.unk_0x03c != 0) {
code = 11170; code = 11170;
} else { } else {
if (nat.mappingScheme == 0 && nat.mappings[2].publicPort == nat.mappings[1].publicPort * 2 - nat.mappings[0].publicPort) { if (nat.mappingScheme == 0 && nat.mappings[2].publicPort == nat.mappings[1].publicPort * 2 - nat.mappings[0].publicPort) {
@@ -464,10 +464,10 @@ void sNHTTPCleanupCallback() {
void onNatDetectionDone(gsi_bool success, NAT nat) { void onNatDetectionDone(gsi_bool success, NAT nat) {
if (success) { if (success) {
g_session.nat = nat; g_session.nat = nat;
g_session.natFailed = 0; g_session.unk_0x03c = 0;
} else { } else {
g_session.natFailed = 1; g_session.unk_0x03c = 1;
} }
g_session.natState = 4; g_session.unk_0x030 = 4;
return; return;
} }

View File

@@ -1341,11 +1341,13 @@ namespace ipl {
wchar_t* titleName = System::getChannelManager()->getTitleName( wchar_t* titleName = System::getChannelManager()->getTitleName(
page, channelIndex, 0); page, channelIndex, 0);
memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a); memcpy(titleNames + *titleCount * 0x2a, titleName, 0x2a);
++*titleCount; u32 nextTitleCount = *titleCount + 1;
*titleCount = nextTitleCount;
if (bytes >= secondUsage[0] && blocks >= secondUsage[1]) { if (bytes < secondUsage[0] || blocks < secondUsage[1]) {
return true; continue;
} }
return true;
} }
} }
} }

View File

@@ -3,10 +3,6 @@
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR #define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR #define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
#define IPL_CHANNEL_TITLE_NOVTABLE
#include "math/iplInterporation.h"
#undef IPL_CHANNEL_TITLE_NOVTABLE
#include "scene/sdChannelTitle/iplSDChannelTitle.h" #include "scene/sdChannelTitle/iplSDChannelTitle.h"
#include "scene/sdChannelSelect/iplSDChannelSelect.h" #include "scene/sdChannelSelect/iplSDChannelSelect.h"
#include "system/iplSystem.h" #include "system/iplSystem.h"
@@ -357,7 +353,7 @@ FaderSceneCommand SDChannelTitle::calcFadeout() {
mWpadStopTick = OSGetTick(); mWpadStopTick = OSGetTick();
} }
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped() && if (System::getFader()->getStatus() == EGG::Fader::PREPARE_IN && System::isReceiveScheduleStopped() &&
(!System::getNwc24Manager() || System::getNwc24Manager()->isReceivingIdle())) { (!System::getNwc24Manager() || System::getNwc24Manager()->isUnk0xA31())) {
OSReport("NWC24 Scheduler stopped.\n"); OSReport("NWC24 Scheduler stopped.\n");
NandSDWorker* worker = mpChannelSelect->getWorker(); NandSDWorker* worker = mpChannelSelect->getWorker();
if (mNextScene == 17) { if (mNextScene == 17) {
@@ -1122,7 +1118,7 @@ extern "C" void iplSDChannelTitle_updateScriptLoad(SDChannelTitle* scene) {
data.titleId = scene->mTitleId; data.titleId = scene->mTitleId;
data.threadTerminated = scene->mbScriptFailed; data.threadTerminated = scene->mbScriptFailed;
if (!System::getNwc24Manager() || !System::getNwc24Manager()->isNewMessageThere(static_cast<u32>(data.titleId & 0xffffffffULL))) { if (!System::getNwc24Manager() || !System::getNwc24Manager()->isNewMessageThere(static_cast<u32>(data.titleId & 0xffffffffULL))) {
data.mbHasNewMessage = false; data.unk_0x1A = false;
} }
System::getCSManager()->setData(data); System::getCSManager()->setData(data);
if (!System::getCSManager()->init(scene->mpScriptFile, scene->mpRsoThread)) { if (!System::getCSManager()->init(scene->mpScriptFile, scene->mpRsoThread)) {
@@ -1558,5 +1554,15 @@ void SDChannelTitle::startResetting() {
snd::getSystem()->resetAllSound(); snd::getSystem()->resetAllSound();
} }
extern "C" void iplSDChannelTitle_onTitleButtonEvent(SDTitleButtonEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEventDerived(component, event, controller);
}
extern "C" void iplSDChannelTitle_onTitlePaneEvent(SDTitlePaneEventHandler* handler, u32 component,
u32 event, const controller::Interface* controller) {
handler->onEvent(component, event, const_cast<controller::Interface*>(controller));
}
} }
} }

View File

@@ -462,6 +462,7 @@ namespace ipl {
directPagePath = "index03.html"; directPagePath = "index03.html";
break; break;
case 7: case 7:
default:
directPagePath = "index01.html"; directPagePath = "index01.html";
break; break;
} }
@@ -1379,34 +1380,30 @@ namespace ipl {
return; return;
} }
// One pointer, overwritten by the standard-buffer fetch, so the ext_ead::www::BrowserThread* browser = surface->GetBrowserThread();
// browser `this` and standardBuffer share a callee-saved reg. if (browser == NULL) {
void* held = surface->GetBrowserThread();
if (held == NULL) {
return; return;
} }
if (static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL) == NULL) { if (browser->GetTextureBuffer(0, NULL) == NULL) {
return; return;
} }
ext_ead::www::BrowserWindow* browserWindow = ext_ead::www::BrowserWindow* browserWindow =
static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]); static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
if ((browserWindow == NULL ? 0 : browserWindow->unk_0x2C4[3]) != 0) { if ((browserWindow != NULL ? browserWindow->unk_0x2C4[3] : 0) != 0) {
unk_0x91C[2] = 1; unk_0x91C[2] = 1;
mState = 0; mState = 0;
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(static_cast<ext_ead::www::BrowserThread*>(held)->mpBrowserWindows[0]); browserWindow = static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
if (browserWindow != NULL) { if (browserWindow != NULL) {
browserWindow->unk_0x2C4[3] = 0; browserWindow->unk_0x2C4[3] = 0;
} }
www::trasition::ScrollState scrollState = www::trasition::GetScrollState(); www::trasition::ScrollState scrollState = www::trasition::GetScrollState();
if (scrollState == www::trasition::SCROLL_LEFT) { browserScrollDirection = scrollState == www::trasition::SCROLL_LEFT
browserScrollDirection = 1; ? 1
} else { : (scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0);
browserScrollDirection = scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0;
}
www::trasition::ResetScrollState(); www::trasition::ResetScrollState();
void* changedWideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, NULL); void* changedWideBuffer = browser->GetTextureBuffer(1, NULL);
void* changedStandardBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, NULL); void* changedStandardBuffer = browser->GetTextureBuffer(0, NULL);
OSReport("changed %p %p\n", changedStandardBuffer, changedWideBuffer); OSReport("changed %p %p\n", changedStandardBuffer, changedWideBuffer);
ext_ead::www::Heap::reportLeaHeap(); ext_ead::www::Heap::reportLeaHeap();
} }
@@ -1419,9 +1416,8 @@ namespace ipl {
WWWRect* standardRect; WWWRect* standardRect;
WWWRect* wideRect; WWWRect* wideRect;
void* wideBuffer = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(1, &wideRect); void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
held = static_cast<ext_ead::www::BrowserThread*>(held)->GetTextureBuffer(0, &standardRect); void* standardBuffer = browser->GetTextureBuffer(0, &standardRect);
void* standardBuffer = held;
nw4r::ut::Rect projection4x3; nw4r::ut::Rect projection4x3;
System::getProjectionRect4x3(&projection4x3); System::getProjectionRect4x3(&projection4x3);
int screenWidth = abs(static_cast<int>(projection4x3.GetWidth())); int screenWidth = abs(static_cast<int>(projection4x3.GetWidth()));
@@ -1448,33 +1444,33 @@ namespace ipl {
int wideWidth = abs(static_cast<int>(projection16x9.GetWidth())); int wideWidth = abs(static_cast<int>(projection16x9.GetWidth()));
int wideHeight = abs(static_cast<int>(projection16x9.GetHeight())); int wideHeight = abs(static_cast<int>(projection16x9.GetHeight()));
f32 wideLeft = -wideWidth / 2; f32 wideLeft = -wideWidth / 2;
f32 wideTopL = wideHeight / 2; f32 wideTop = wideHeight / 2;
f32 wideRight = wideWidth / 2; f32 wideRight = wideWidth / 2;
f32 wideTopR = wideHeight / 2; nw4r::ut::Rect leftSide(wideLeft, wideTop,
nw4r::ut::Rect leftSide(wideLeft, wideTopL,
wideLeft + sideDescriptor->textureHeader->width, wideLeft + sideDescriptor->textureHeader->width,
wideTopL - sideDescriptor->textureHeader->height); wideTop - sideDescriptor->textureHeader->height);
nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width, nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width,
wideTopR, wideRight, wideTopR - sideDescriptor->textureHeader->height); wideTop, wideRight, wideTop - sideDescriptor->textureHeader->height);
if (browserScrollDirection != 0) { if (browserScrollDirection != 0) {
void* wideMaterial = nw4r::lyt::Material* wideMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0"); mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0");
nw4r::lyt::Material* firstStandardMaterial = nw4r::lyt::Material* firstStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1"); mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1");
nw4r::lyt::Material* secondStandardMaterial = nw4r::lyt::Material* secondStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2"); mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2");
static_cast<nw4r::lyt::Material*>(wideMaterial)->SetTexture(0, wideTexture); wideMaterial->SetTexture(0, wideTexture);
firstStandardMaterial->SetTexture(0, standardTexture); firstStandardMaterial->SetTexture(0, standardTexture);
secondStandardMaterial->SetTexture(0, standardTexture); secondStandardMaterial->SetTexture(0, standardTexture);
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true); mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
if (browserScrollDirection == 1) { if (browserScrollDirection == 1) {
wideMaterial = mpSecondAnimation; utility::FrameController* animation = mpSecondAnimation;
static_cast<utility::FrameController*>(wideMaterial)->initFrame(); animation->initFrame();
static_cast<utility::FrameController*>(wideMaterial)->restart(); animation->restart();
} else { } else {
wideMaterial = mpFirstAnimation; utility::FrameController* animation = mpFirstAnimation;
static_cast<utility::FrameController*>(wideMaterial)->initFrame(); animation->initFrame();
static_cast<utility::FrameController*>(wideMaterial)->restart(); animation->restart();
} }
mpChangeLayout->calc(); mpChangeLayout->calc();
browserScrollDirection = 0; browserScrollDirection = 0;
@@ -1514,44 +1510,13 @@ namespace ipl {
} }
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) { if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
GXRenderModeObj* pRmode = System::getRenderModeObj(); GXRenderModeObj renderMode = *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;
}
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];
u32 left; u32 left;
u32 top; u32 top;
u32 width; u32 width;
u32 height; u32 height;
GXGetScissor(&left, &top, &width, &height); GXGetScissor(&left, &top, &width, &height);
GXSetScissor(0, dstMode->efbHeight / 2 - 0xA4, dstMode->fbWidth, 0x132); GXSetScissor(0, renderMode.efbHeight / 2 - 0xA4, renderMode.fbWidth, 0x132);
mpMainLayout->draw(); mpMainLayout->draw();
GXSetScissor(left, top, width, height); GXSetScissor(left, top, width, height);
} }
@@ -1641,10 +1606,10 @@ namespace ipl {
OSReport("initKeyboard formId:%d\n", mpWiiSettingData->data[0x11]); OSReport("initKeyboard formId:%d\n", mpWiiSettingData->data[0x11]);
memset(unk_0x938, 0, sizeof(unk_0x938)); memset(unk_0x938, 0, sizeof(unk_0x938));
int stringLimit;
keyboard::Manager::KeyboardType keyboardType = keyboard::Manager::LETTER;
int rowLimit;
int invalidInput = 0; int invalidInput = 0;
keyboard::Manager::KeyboardType keyboardType = keyboard::Manager::LETTER;
int rowLimit = 0;
int stringLimit = 0;
int productArea = static_cast<s8>(SCGetProductArea()); int productArea = static_cast<s8>(SCGetProductArea());
switch (mpWiiSettingData->data[0x11]) { switch (mpWiiSettingData->data[0x11]) {
@@ -1746,16 +1711,14 @@ namespace ipl {
} }
if (productArea == 11) { if (productArea == 11) {
void* systemDic = System::getKeyboard()->getZiSystemDic(); System::getKeyboard()->memoFrm()->setZiDictionary(System::getKeyboard()->getZiOemDic(), System::getKeyboard()->getZiSystemDic());
void* oemDic = System::getKeyboard()->getZiOemDic();
System::getKeyboard()->memoFrm()->setZiDictionary(oemDic, systemDic);
} }
keyboard::Manager::KeyboardSetting setting; keyboard::Manager::KeyboardSetting setting;
setting.rowLimit = rowLimit; setting.type = keyboardType;
setting.wcString = reinterpret_cast<const wchar_t*>(unk_0x938); setting.wcString = reinterpret_cast<const wchar_t*>(unk_0x938);
setting.stringLimit = stringLimit; setting.stringLimit = stringLimit;
setting.type = keyboardType; setting.rowLimit = rowLimit;
System::getKeyboard()->start(0, setting); System::getKeyboard()->start(0, setting);
if (invalidInput != 0) { if (invalidInput != 0) {
@@ -1775,6 +1738,7 @@ namespace ipl {
if (mKeyboardState.pressOK) { if (mKeyboardState.pressOK) {
onTextInputOK(); onTextInputOK();
u8 formId = mpWiiSettingData->data[0x11]; u8 formId = mpWiiSettingData->data[0x11];
formText = NULL;
switch (formId) { switch (formId) {
case 1: case 1:
formText = mpStringBuffer->nickname; formText = mpStringBuffer->nickname;
@@ -1845,8 +1809,7 @@ namespace ipl {
memcpy(mpStringBuffer->asterisks, mpStringBuffer->securityKey, sizeof(mpStringBuffer->securityKey)); memcpy(mpStringBuffer->asterisks, mpStringBuffer->securityKey, sizeof(mpStringBuffer->securityKey));
mpStringBuffer->asterisks[0x41] = 0; mpStringBuffer->asterisks[0x41] = 0;
while (mpStringBuffer->asterisks[index] != 0) { while (mpStringBuffer->asterisks[index] != 0) {
mpStringBuffer->asterisks[index] = '*'; mpStringBuffer->asterisks[index++] = '*';
index++;
} }
if (index > 0x20) { if (index > 0x20) {
mpStringBuffer->asterisks[0x20] = '\n'; mpStringBuffer->asterisks[0x20] = '\n';
@@ -1858,6 +1821,7 @@ namespace ipl {
} }
} else { } else {
u8 formId = mpWiiSettingData->data[0x11]; u8 formId = mpWiiSettingData->data[0x11];
formText = NULL;
switch (formId) { switch (formId) {
case 1: case 1:
formText = mpStringBuffer->nickname; formText = mpStringBuffer->nickname;

View File

@@ -30,7 +30,7 @@ namespace ipl {
SettingSelect::SettingSelect(EGG::Heap* heap, int arg) SettingSelect::SettingSelect(EGG::Heap* heap, int arg)
: Base(heap), ::gui::EventHandler(), mState(STATE_WAIT_BUTTON_FADE_IN), mPrevState(STATE_WAIT_BUTTON_FADE_IN), mSettingArg(arg), : Base(heap), ::gui::EventHandler(), mState(STATE_WAIT_BUTTON_FADE_IN), mPrevState(STATE_WAIT_BUTTON_FADE_IN), mSettingArg(arg),
mpLayout(NULL), mpLayoutFile(NULL), mpGui(NULL), mPendingSceneId(0), mExitSeqStep(0) { mpLayout(NULL), mpLayoutFile(NULL), mpGui(NULL), unk_0x90(0), unk_0x94(0) {
setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW); setSceneParentFlags(SCN_PARENTFLAG_CALC | SCN_PARENTFLAG_DRAW);
} }
@@ -222,7 +222,7 @@ namespace ipl {
void SettingSelect::stt_1st_fadeout() { void SettingSelect::stt_1st_fadeout() {
if (is_stopped_all_anm()) { if (is_stopped_all_anm()) {
if (mPendingSceneId != 0) { if (unk_0x90 != 0) {
System::getFader()->fadeOut(); System::getFader()->fadeOut();
CHANGE_STATE(STATE_WAIT_BLACK_OUT); CHANGE_STATE(STATE_WAIT_BLACK_OUT);
} else { } else {
@@ -247,7 +247,7 @@ namespace ipl {
void SettingSelect::stt_2nd_fadeout() { void SettingSelect::stt_2nd_fadeout() {
if (is_stopped_all_anm()) { if (is_stopped_all_anm()) {
if (mPendingSceneId != 0) { if (unk_0x90 != 0) {
CHANGE_STATE(STATE_WAIT_CHILD); CHANGE_STATE(STATE_WAIT_CHILD);
reset_gui(); reset_gui();
} else { } else {
@@ -309,7 +309,7 @@ namespace ipl {
case STATE_1ST_NORMAL: { case STATE_1ST_NORMAL: {
System::getChannelManager()->refreshAsync(); System::getChannelManager()->refreshAsync();
System::getFader()->fadeOut(); System::getFader()->fadeOut();
mPendingSceneId = SCENE_BOARD; unk_0x90 = 4;
reserveAllSceneDestruction(SCENE_BOARD, NULL); reserveAllSceneDestruction(SCENE_BOARD, NULL);
@@ -369,8 +369,8 @@ namespace ipl {
int backAnim = -1; int backAnim = -1;
int inAnim = -1; int inAnim = -1;
switch (mPendingSceneId) { switch (unk_0x90) {
case SCENE_MEMORY: { case 13: {
#ifndef KOREAN_BUILD #ifndef KOREAN_BUILD
backAnim = ANIM_WII_SAVE_DATA_BACK; backAnim = ANIM_WII_SAVE_DATA_BACK;
inAnim = ANIM_GC_SAVE_DATA_IN; inAnim = ANIM_GC_SAVE_DATA_IN;
@@ -380,12 +380,12 @@ namespace ipl {
#endif #endif
break; break;
} }
case SCENE_MEMORY_CARD: { case 14: {
backAnim = ANIM_GC_SAVE_DATA_BACK; backAnim = ANIM_GC_SAVE_DATA_BACK;
inAnim = ANIM_WII_SAVE_DATA_IN; inAnim = ANIM_WII_SAVE_DATA_IN;
break; break;
} }
case SCENE_CHANNEL_EDIT: { case 12: {
backAnim = ANIM_CHANNEL_BACK; backAnim = ANIM_CHANNEL_BACK;
inAnim = ANIM_SAVE_DATA_IN; inAnim = ANIM_SAVE_DATA_IN;
if (mSettingArg == SettingSelectArg::ARG_START_SAVE_DATA) { if (mSettingArg == SettingSelectArg::ARG_START_SAVE_DATA) {
@@ -404,14 +404,14 @@ namespace ipl {
void SettingSelect::stt_wait_child_anm() { void SettingSelect::stt_wait_child_anm() {
if (is_stopped_all_anm()) { if (is_stopped_all_anm()) {
switch (mPendingSceneId) { switch (unk_0x90) {
case SCENE_CHANNEL_EDIT: { case 12: {
static_cast<SettingButton*>(System::getScene(SCENE_SETTING_BUTTON))->showWii(); static_cast<SettingButton*>(System::getScene(SCENE_SETTING_BUTTON))->showWii();
CHANGE_STATE(STATE_2ND_NORMAL); CHANGE_STATE(STATE_2ND_NORMAL);
break; break;
} }
case SCENE_MEMORY: case 13:
case SCENE_MEMORY_CARD: { case 14: {
static_cast<SettingButton*>(System::getScene(SCENE_SETTING_BUTTON))->showWii(); static_cast<SettingButton*>(System::getScene(SCENE_SETTING_BUTTON))->showWii();
#ifndef KOREAN_BUILD #ifndef KOREAN_BUILD
CHANGE_STATE(STATE_3RD_NORMAL); CHANGE_STATE(STATE_3RD_NORMAL);
@@ -422,7 +422,7 @@ namespace ipl {
} }
} }
mPendingSceneId = 0; unk_0x90 = 0;
} }
} }
@@ -587,7 +587,7 @@ namespace ipl {
break; break;
} }
case BTN_SETTING: { case BTN_SETTING: {
mPendingSceneId = SCENE_SETTING; unk_0x90 = 18;
flashAnim = ANIM_SETTING_FLASH; flashAnim = ANIM_SETTING_FLASH;
outAnim = ANIM_DATA_MANAGE_OUT; outAnim = ANIM_DATA_MANAGE_OUT;
reserveAllSceneDestruction(SCENE_SETTING, (void*)Setting::ARG_NORMAL_PAGE); reserveAllSceneDestruction(SCENE_SETTING, (void*)Setting::ARG_NORMAL_PAGE);
@@ -596,7 +596,7 @@ namespace ipl {
} }
case BTN_SAVEDATA: { case BTN_SAVEDATA: {
#ifdef KOREAN_BUILD #ifdef KOREAN_BUILD
mPendingSceneId = SCENE_MEMORY; unk_0x90 = 13;
#endif #endif
flashAnim = ANIM_SAVE_DATA_FLASH; flashAnim = ANIM_SAVE_DATA_FLASH;
outAnim = ANIM_CHANNEL_OUT; outAnim = ANIM_CHANNEL_OUT;
@@ -611,7 +611,7 @@ namespace ipl {
break; break;
} }
case BTN_CHANNEL: { case BTN_CHANNEL: {
mPendingSceneId = SCENE_CHANNEL_EDIT; unk_0x90 = 12;
flashAnim = ANIM_CHANNEL_FLASH; flashAnim = ANIM_CHANNEL_FLASH;
outAnim = ANIM_SAVE_DATA_OUT; outAnim = ANIM_SAVE_DATA_OUT;
createChildScene(SCENE_CHANNEL_EDIT, this, NULL); createChildScene(SCENE_CHANNEL_EDIT, this, NULL);
@@ -623,7 +623,7 @@ namespace ipl {
break; break;
} }
case BTN_WII_SAVE: { case BTN_WII_SAVE: {
mPendingSceneId = SCENE_MEMORY; unk_0x90 = 13;
flashAnim = ANIM_WII_SAVE_DATA_FLASH; flashAnim = ANIM_WII_SAVE_DATA_FLASH;
outAnim = ANIM_GC_SAVE_DATA_OUT; outAnim = ANIM_GC_SAVE_DATA_OUT;
createChildScene(SCENE_MEMORY, this, NULL); createChildScene(SCENE_MEMORY, this, NULL);
@@ -632,7 +632,7 @@ namespace ipl {
break; break;
} }
case BTN_GC_SAVE: { case BTN_GC_SAVE: {
mPendingSceneId = SCENE_MEMORY_CARD; unk_0x90 = 14;
flashAnim = ANIM_GC_SAVE_DATA_FLASH; flashAnim = ANIM_GC_SAVE_DATA_FLASH;
outAnim = ANIM_WII_SAVE_DATA_OUT; outAnim = ANIM_WII_SAVE_DATA_OUT;
createChildScene(SCENE_MEMORY_CARD, this, NULL); createChildScene(SCENE_MEMORY_CARD, this, NULL);
@@ -689,7 +689,7 @@ namespace ipl {
} }
void SettingSelect::calc_exit_sequence() { void SettingSelect::calc_exit_sequence() {
switch (mExitSeqStep) { switch (unk_0x94) {
case 0: { case 0: {
prepare_exit_abort(); prepare_exit_abort();
break; break;
@@ -720,13 +720,13 @@ namespace ipl {
System::getBS2Manager()->abort(); System::getBS2Manager()->abort();
System::stopReceiveSchedule(); System::stopReceiveSchedule();
mExitSeqStep = 1; unk_0x94 = 1;
} }
} }
void SettingSelect::wait_decide_se() { void SettingSelect::wait_decide_se() {
if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) { if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) {
mExitSeqStep = 2; unk_0x94 = 2;
} }
} }
@@ -734,7 +734,7 @@ namespace ipl {
__WPADReconnect(TRUE); __WPADReconnect(TRUE);
snd::getSystem()->stopAllSound(20); snd::getSystem()->stopAllSound(20);
System::getFader()->fadeOut(); System::getFader()->fadeOut();
mExitSeqStep = 3; unk_0x94 = 3;
} }
void SettingSelect::finish_exit_reboot() { void SettingSelect::finish_exit_reboot() {

Some files were not shown because too many files have changed in this diff Show More