Compare commits
40 Commits
agent/w092
...
agent/fix/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d5a629567 | ||
|
|
22e6bbed24 | ||
|
|
f49f337c6b | ||
|
|
c3cad09b66 | ||
|
|
11dd7f505a | ||
|
|
52c9ea4b70 | ||
|
|
eef15925f4 | ||
|
|
46baf56e38 | ||
|
|
23b77a337c | ||
|
|
77cf359837 | ||
|
|
af7146a850 | ||
|
|
16023905ce | ||
|
|
f9ebd2f4cc | ||
|
|
ca98b14ad6 | ||
|
|
58a1da1cb3 | ||
|
|
8a0436a92f | ||
|
|
52f4e19325 | ||
|
|
77314b30e0 | ||
|
|
a3f8fc2779 | ||
|
|
2df2f8d6c7 | ||
|
|
6a82485817 | ||
|
|
6d67bbb6eb | ||
|
|
c3dbaf8c8e | ||
|
|
7c6393f96c | ||
|
|
1fd0970728 | ||
|
|
712bd2fc11 | ||
|
|
75c5997851 | ||
|
|
3b9b5e081c | ||
|
|
e75d7024ab | ||
|
|
7c064bc18b | ||
|
|
fe7381b4bc | ||
|
|
f762dfefbd | ||
|
|
8cddc82c43 | ||
|
|
9925a95779 | ||
|
|
f18082e88b | ||
|
|
9ca4385ffb | ||
|
|
8fd7e1cede | ||
|
|
73139514df | ||
|
|
25326f9774 | ||
|
|
8188d9e3c6 |
@@ -11,6 +11,9 @@ splits: 'config/43U/splits.txt'
|
||||
ldscript_template: 'config/ldscript_ipl2.lcf'
|
||||
|
||||
force_active:
|
||||
- SORead
|
||||
- SOFcntl
|
||||
- SOInetPtoN
|
||||
- SOGetSockOpt
|
||||
- SOSetInterfaceOpt
|
||||
- fprintf
|
||||
|
||||
@@ -897,13 +897,16 @@ src/scene/setting/iplRakuRakuThread.cpp:
|
||||
.sbss start:0x81698C60 end:0x81698C70
|
||||
|
||||
src/scene/setting/AOSS.c:
|
||||
.bss start:0x810BDEF8 end:0x810BECA0
|
||||
.bss start:0x810BDEF8 end:0x810BE838
|
||||
.text start:0x813FE27C end:0x814021BC
|
||||
.data start:0x81657C48 end:0x81657DB8
|
||||
.sdata2 start:0x81694C78 end:0x81694C80
|
||||
.sdata start:0x81697200 end:0x81697218
|
||||
.sbss start:0x81698C70 end:0x81698C90
|
||||
|
||||
src/scene/setting/AOSSData.c:
|
||||
.bss start:0x810BE838 end:0x810BECA0
|
||||
|
||||
src/scene/setting/ATERM.c:
|
||||
.bss start:0x810BECA0 end:0x810C0C80
|
||||
.text start:0x814021BC end:0x81406CC0
|
||||
|
||||
@@ -93,8 +93,8 @@ sRakuMsgQueue = .bss:0x810BDED4; // type:object size:0x20
|
||||
AOSS_810BDEF8 = .bss:0x810BDEF8; // type:object size:0x20 data:4byte
|
||||
AOSS_810BDF18 = .bss:0x810BDF18; // type:object size:0x6A0
|
||||
AOSS_810BE5B8 = .bss:0x810BE5B8; // type:object size:0x280
|
||||
AOSS_810BE838 = .bss:0x810BE838; // type:object size:0x68
|
||||
AOSS_810BE8A0 = .bss:0x810BE8A0; // type:object size:0x400
|
||||
s_packetState = .bss:0x810BE838; // type:object size:0x68
|
||||
s_crcTable = .bss:0x810BE8A0; // type:object size:0x400
|
||||
gAtermIpConfig = .bss:0x810BECA0; // type:object size:0x7C4 data:4byte
|
||||
gAtermIfConfig = .bss:0x810BF464; // type:object size:0x15E
|
||||
ATERM_810BF5C4 = .bss:0x810BF5C4; // type:object size:0x24
|
||||
@@ -144,7 +144,7 @@ lbl_810C8A80 = .bss:0x810C8A80; // type:object size:0x40 align:32
|
||||
lbl_810C8AC0 = .bss:0x810C8AC0; // type:object size:0x40 align:32
|
||||
s_mutex = .bss:0x810C8B00; // type:object size:0x18 scope:local
|
||||
s_cdbWiiId = .bss:0x810C8B20; // type:object size:0x40 scope:local
|
||||
ncdMutex = .bss:0x810C8B60; // type:object size:0x20
|
||||
ncdMutex = .bss:0x810C8B60; // type:object size:0x18
|
||||
ncdCommonResult = .bss:0x810C8B80; // type:object size:0x20 align:32 data:4byte
|
||||
ncdCommonVector = .bss:0x810C8BA0; // type:object size:0x20 align:32 data:4byte
|
||||
NHTTPiStaticResource = .bss:0x810C8BC0; // type:object size:0x40 data:4byte
|
||||
@@ -4617,11 +4617,11 @@ updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // ty
|
||||
setDialogMessage__Q33ipl5scene15SDChannelSelectFUlUl = .text:0x813DCEF0; // type:function size:0x24
|
||||
isCurrentTitleUsageEnough__Q33ipl5scene15SDChannelSelectCFPCl = .text:0x813DCF14; // type:function size:0xCC
|
||||
getCurrentTitleUsage__Q33ipl5scene15SDChannelSelectCFPlPl = .text:0x813DCFE0; // type:function size:0xCC
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPClPClPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
collectTitlesByUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD0AC; // type:function size:0x194
|
||||
collectTitlesFromNandUsage__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD240; // type:function size:0x198
|
||||
collectTitlesByChannelOrder__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD3D8; // type:function size:0x1F8
|
||||
collectTitlesBySpecialChannels__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUl = .text:0x813DD5D0; // type:function size:0x5A4
|
||||
collectTitlesForMode__Q33ipl5scene15SDChannelSelectFPlPlPUxPcPUli = .text:0x813DDB74; // type:function size:0x40
|
||||
findAdjacentChannel__Q33ipl5scene15SDChannelSelectCFiPiPi = .text:0x813DDBB4; // type:function size:0xB4
|
||||
setCurrentPageAndRefresh__Q33ipl5scene15SDChannelSelectFiiPQ33ipl5scene12SDChannelObj = .text:0x813DDC68; // type:function size:0x18
|
||||
handleFourPageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDC80; // type:function size:0x58
|
||||
@@ -13963,7 +13963,7 @@ lbl_816152D0 = .rodata:0x816152D0; // type:object size:0x10 scope:local data:4by
|
||||
csAninationFile__Q29textinput12candidatebox = .rodata:0x816152E0; // type:object size:0x374 scope:local
|
||||
lbl_81615658 = .rodata:0x81615658; // type:object size:0xA0 scope:local data:4byte
|
||||
csAninationFile__Q29textinput7toolbar = .rodata:0x816156F8; // type:object size:0x1DC scope:local data:4byte
|
||||
csAninationFile__Q29textinput11predictlang = .rodata:0x816158D8; // type:object size:0x268 scope:local
|
||||
csAninationFile__Q29textinput11predictlang = .rodata:0x816158D8; // type:object size:0x264 scope:local
|
||||
csAninationFileForSign__Q39textinput8keyboard10signwindow = .rodata:0x81615B40; // type:object size:0x268 scope:local
|
||||
csPaneNameToControlKey__Q39textinput8keyboard10signwindow = .rodata:0x81615DA8; // type:object size:0x48 scope:local
|
||||
csLanguageDependencyData__Q39textinput8keyboard10signwindow = .rodata:0x81615DF0; // type:object size:0x50 scope:local
|
||||
@@ -15632,7 +15632,7 @@ __vt__Q33ipl4math28LinearIntp<Q33ipl4math4VEC2> = .data:0x8164B5E0; // type:obje
|
||||
__vt__Q33ipl4math31Interporation<Q33ipl4math4VEC2> = .data:0x8164B5F0; // type:object size:0x10
|
||||
@10018 = .data:0x8164B698; // type:object size:0xB scope:local data:string
|
||||
@10019 = .data:0x8164B6A3; // type:object size:0xF scope:local data:string
|
||||
__vt__Q33ipl5scene12UrlProcessor = .data:0x8164B6B8; // type:object size:0x18
|
||||
__vt__Q33ipl5scene12UrlProcessor = .data:0x8164B6B8; // type:object size:0x14
|
||||
lbl_8164B6D0 = .data:0x8164B6D0; // type:object size:0x10 data:string
|
||||
lbl_8164B6E0 = .data:0x8164B6E0; // type:object size:0x1D data:string
|
||||
lbl_8164B6FD = .data:0x8164B6FD; // type:object size:0x1B data:string
|
||||
@@ -15765,7 +15765,8 @@ lbl_8164C53A = .data:0x8164C53A; // type:object size:0x14
|
||||
lbl_8164C54E = .data:0x8164C54E; // type:object size:0x18
|
||||
lbl_8164C566 = .data:0x8164C566; // type:object size:0xC
|
||||
lbl_8164C572 = .data:0x8164C572; // type:object size:0xA
|
||||
__vt__Q33ipl5scene8Calendar = .data:0x8164C57C; // type:object size:0xA4
|
||||
__vt__Q33ipl5scene8Calendar = .data:0x8164C57C; // type:object size:0x88
|
||||
__vt__Q23gui12EventHandler = .data:0x8164C604; // type:object size:0x18 scope:weak
|
||||
scN_CalDay_r = .data:0x8164C620; // type:object size:0xB data:string
|
||||
scDateAnimPaneNames = .data:0x8164C62C; // type:object size:0x14 data:4byte
|
||||
scMyIplTopFBrlan = .data:0x8164C640; // type:object size:0x12 data:string
|
||||
@@ -17726,12 +17727,20 @@ __vt__Q39textinput4util9Animation = .data:0x8165D258; // type:object size:0x24
|
||||
@STRING@GetTextColor__Q34nw4r3lyt7TextBoxCFUl = .data:0x8165D28C; // type:object size:0x41 data:string
|
||||
scT_prdc_Text_00 = .data:0x8165D2D0; // type:object size:0xF data:string
|
||||
scP_prdc_scrl_Left = .data:0x8165D2E0; // type:object size:0x11 data:string
|
||||
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x68C
|
||||
scPaneNameTable = .data:0x8165D984; // type:object size:0x84
|
||||
scW_predictWindow = .data:0x8165DA08; // type:object size:0x10 data:string
|
||||
scN_predictInput = .data:0x8165DA18; // type:object size:0xF data:string
|
||||
scW_OnOff_Area = .data:0x8165DA28; // type:object size:0xD data:string
|
||||
scN_prdc_Texts = .data:0x8165DA38; // type:object size:0xD data:string
|
||||
scCandidatePaneData = .data:0x8165D2F8; // type:object size:0x680
|
||||
@9934 = .data:0x8165D978; // type:object size:0x9 scope:local data:string
|
||||
@9935 = .data:0x8165D984; // type:object size:0x9 scope:local data:string
|
||||
@9936 = .data:0x8165D990; // type:object size:0xB scope:local data:string
|
||||
@9937 = .data:0x8165D99C; // type:object size:0xB scope:local data:string
|
||||
@9938 = .data:0x8165D9A8; // type:object size:0xA scope:local data:string
|
||||
@9939 = .data:0x8165D9B4; // type:object size:0x11 scope:local data:string
|
||||
@9940 = .data:0x8165D9C8; // type:object size:0x11 scope:local data:string
|
||||
@9941 = .data:0x8165D9DC; // type:object size:0x11 scope:local data:string
|
||||
@9942 = .data:0x8165D9F0; // type:object size:0x11 scope:local data:string
|
||||
@9943 = .data:0x8165DA08; // type:object size:0x10 scope:local data:string
|
||||
@10036 = .data:0x8165DA18; // type:object size:0xF scope:local data:string
|
||||
@10037 = .data:0x8165DA28; // type:object size:0xD scope:local data:string
|
||||
@10041 = .data:0x8165DA38; // type:object size:0xD scope:local data:string
|
||||
@10530 = .data:0x8165DA48; // type:object size:0x1C scope:local
|
||||
@6761 = .data:0x8165DA64; // type:object size:0xF scope:local data:string
|
||||
@6762 = .data:0x8165DA74; // type:object size:0xF scope:local data:string
|
||||
@@ -22773,10 +22782,7 @@ lbl_81697824 = .sdata:0x81697824; // type:object size:0x8 data:string
|
||||
lbl_8169782C = .sdata:0x8169782C; // type:object size:0x8 data:string
|
||||
lbl_81697834 = .sdata:0x81697834; // type:object size:0x8 data:string
|
||||
lbl_8169783C = .sdata:0x8169783C; // type:object size:0x8 data:string
|
||||
scCsFatalColorR = .sdata:0x81697844; // type:object size:0x1 data:byte
|
||||
scCsFatalColorG = .sdata:0x81697845; // type:object size:0x1 data:byte
|
||||
scCsFatalColorB = .sdata:0x81697846; // type:object size:0x1 data:byte
|
||||
scCsFatalColorA = .sdata:0x81697847; // type:object size:0x1 data:byte
|
||||
scCsFatalColor = .sdata:0x81697844; // type:object size:0x4 data:byte
|
||||
lbl_81697848 = .sdata:0x81697848; // type:object size:0x8 data:string
|
||||
lbl_81697850 = .sdata:0x81697850; // type:object size:0x6 data:string
|
||||
lbl_81697858 = .sdata:0x81697858; // type:object size:0x6 data:string
|
||||
|
||||
33
configure.py
33
configure.py
@@ -678,7 +678,7 @@ config.libs = [
|
||||
Object(Matching, "utility/iplThread.cpp"),
|
||||
Object(Matching, "utility/iplMessageBase.cpp"),
|
||||
Object(Matching, "utility/iplJpegDecoder.cpp"),
|
||||
Object(NonMatching, "utility/iplESMisc.cpp"),
|
||||
Object(Matching, "utility/iplESMisc.cpp"),
|
||||
Object(Matching, "utility/iplCSFlags.cpp"),
|
||||
]
|
||||
),
|
||||
@@ -849,12 +849,12 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("sdChannelSelect", [
|
||||
Object(NonMatching, "scene/sdChannelSelect/iplSDChannelSelect.cpp"),
|
||||
Object(Matching, "scene/sdChannelSelect/iplSDChannelSelect.cpp"),
|
||||
Object(Matching, "scene/sdChannelSelect/iplSDChannelObj.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("sdChannelTitle", [
|
||||
Object(NonMatching, "scene/sdChannelTitle/iplSDChannelTitle.cpp"),
|
||||
Object(Matching, "scene/sdChannelTitle/iplSDChannelTitle.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("sdButton", [
|
||||
@@ -868,7 +868,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("setting", [
|
||||
Object(NonMatching, "scene/setting/iplSetting.cpp"),
|
||||
Object(Matching, "scene/setting/iplSetting.cpp"),
|
||||
Object(Matching, "scene/setting/iplSensitivity.cpp"),
|
||||
Object(Matching, "scene/setting/iplNCDSetting.cpp"),
|
||||
Object(Matching, "scene/setting/iplParental.cpp"),
|
||||
@@ -879,6 +879,7 @@ config.libs = [
|
||||
Object(NonMatching, "scene/setting/AOSSLink.c"),
|
||||
Object(Matching, "scene/setting/iplRakuRakuThread.cpp"),
|
||||
Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]),
|
||||
Object(Matching, "scene/setting/AOSSData.c"),
|
||||
Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline on"]),
|
||||
]
|
||||
),
|
||||
@@ -917,7 +918,7 @@ config.libs = [
|
||||
Object(Matching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiAtokString.cpp", extra_cflags=["-O4,p"]), # for 4.3J
|
||||
Object(NonMatching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
|
||||
Object(Matching, "keyboard/tiZiString.cpp", extra_cflags=["-O4,p"]), # for 4.3U and 4.3E
|
||||
Object(Matching, "keyboard/tiTextDrawer.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiNw4rManager.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiKeyboard.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -983,10 +984,10 @@ config.libs = [
|
||||
ZI8Lib("zi8clib", [
|
||||
Object(Matching, "clib/zaddress.c"),
|
||||
Object(Matching, "clib/zconvert.c"),
|
||||
Object(NonMatching, "clib/zi81key.c"),
|
||||
Object(NonMatching, "clib/zi8alpha.c"),
|
||||
Object(Matching, "clib/zi81key.c"),
|
||||
Object(Matching, "clib/zi8alpha.c"),
|
||||
Object(Matching, "clib/zi8alts.c"),
|
||||
Object(NonMatching, "clib/zi8cgetc.c"),
|
||||
Object(Matching, "clib/zi8cgetc.c"),
|
||||
Object(Matching, "clib/zi8cinfo.c"),
|
||||
Object(Matching, "clib/zi8copy.c"),
|
||||
Object(Matching, "clib/zi8dawg.c"),
|
||||
@@ -1000,7 +1001,7 @@ config.libs = [
|
||||
Object(Matching, "clib/zi8pud2.c"),
|
||||
Object(Matching, "clib/Zi8punct.c"),
|
||||
Object(Matching, "clib/zi8space.c"),
|
||||
Object(NonMatching, "clib/zi8uwd.c"),
|
||||
Object(Matching, "clib/zi8uwd.c"),
|
||||
Object(Matching, "clib/zi8ver.c"),
|
||||
Object(Matching, "clib/zi8ZHuwd.c"),
|
||||
Object(Matching, "clib/zidawg1.c"),
|
||||
@@ -1010,7 +1011,7 @@ config.libs = [
|
||||
Object(Matching, "clib/zierror.c"),
|
||||
Object(Matching, "clib/zmtkey.c"),
|
||||
Object(Matching, "clib/zoemdata.c"),
|
||||
Object(NonMatching, "clib/zprepare.c"),
|
||||
Object(Matching, "clib/zprepare.c"),
|
||||
]
|
||||
),
|
||||
# RevoEX
|
||||
@@ -1057,11 +1058,11 @@ config.libs = [
|
||||
Object(Matching, "nhttp/NHTTP_control.c"),
|
||||
Object(Matching, "nhttp/NHTTP_list.c"),
|
||||
Object(Matching, "nhttp/NHTTP_os_RVL.c"),
|
||||
Object(NonMatching, "nhttp/NHTTP_recvbuf.c"),
|
||||
Object(Matching, "nhttp/NHTTP_recvbuf.c", mw_version="GC/3.0a5"),
|
||||
Object(Matching, "nhttp/NHTTP_request.c"),
|
||||
Object(Matching, "nhttp/NHTTP_response.c"),
|
||||
Object(Matching, "nhttp/NHTTP_socket_RVL.c"),
|
||||
Object(NonMatching, "nhttp/NHTTP_stdlib_RVL.c"),
|
||||
Object(Matching, "nhttp/NHTTP_stdlib_RVL.c", mw_version="GC/3.0a5"),
|
||||
Object(Matching, "nhttp/NHTTP_thread.c"),
|
||||
Object(Matching, "nhttp/d_nhttp_private.c"),
|
||||
Object(Matching, "nhttp/d_nhttp.c"),
|
||||
@@ -1096,7 +1097,7 @@ config.libs = [
|
||||
),
|
||||
RevoEXLib("so", [
|
||||
Object(Matching, "so/SOCommon.c"),
|
||||
Object(NonMatching, "so/SOBasic.c"),
|
||||
Object(Matching, "so/SOBasic.c"),
|
||||
Object(Matching, "so/SOInformation.c"),
|
||||
Object(Matching, "so/SOOption.c"),
|
||||
]
|
||||
@@ -1209,7 +1210,7 @@ config.libs = [
|
||||
Object(Matching, "jpegdec/jdec_main.c"),
|
||||
Object(Matching, "jpegdec/jpformat.c"),
|
||||
|
||||
Object(NonMatching, "exif/exif_parse.c"),
|
||||
Object(Matching, "exif/exif_parse.c"),
|
||||
|
||||
Object(Matching, "reschange/iqdec_resolution_change_a3.c"),
|
||||
Object(Matching, "reschange/idct_resolution_change_var.c"),
|
||||
@@ -1323,7 +1324,7 @@ config.libs = [
|
||||
Object(Matching, "lyt/lyt_layout.cpp"),
|
||||
Object(Matching, "lyt/lyt_picture.cpp"),
|
||||
Object(Matching, "lyt/lyt_textBox.cpp"),
|
||||
Object(Equivalent, "lyt/lyt_window.cpp"),
|
||||
Object(Matching, "lyt/lyt_window.cpp"),
|
||||
Object(Matching, "lyt/lyt_bounding.cpp"),
|
||||
Object(Matching, "lyt/lyt_material.cpp"),
|
||||
Object(Matching, "lyt/lyt_drawinfo.cpp"),
|
||||
@@ -1854,7 +1855,7 @@ config.libs = [
|
||||
Object(Matching, "fa/kernel/pfk_api.c"),
|
||||
|
||||
Object(Matching, "fa/driver/nand_drv.c"),
|
||||
Object(NonMatching, "fa/driver/sd_drv.c"),
|
||||
Object(Matching, "fa/driver/sd_drv.c"),
|
||||
Object(Matching, "fa/driver/pfd_cmn.c"),
|
||||
Object(Matching, "fa/driver/msc_drv.c"),
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Assembly inventory
|
||||
|
||||
4.3U, 2026-10-05. 173 functions contain 175 assembly
|
||||
bodies/blocks: 162 ORIGINAL functions and 11 PLACEHOLDER functions.
|
||||
4.3U, 2026-10-08. 166 functions contain 168 assembly
|
||||
bodies/blocks: 162 ORIGINAL functions and 4 PLACEHOLDER functions.
|
||||
|
||||
Run `python3 tools/check_asm_inventory.py`. Completion requires exit 0, complete
|
||||
coverage and zero placeholders. The checker also rejects stale/duplicate rows,
|
||||
@@ -88,9 +88,7 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
|
||||
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb0 FPSCR_NI_BIT`. |
|
||||
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCSetFpNonIEEEMode` | ORIGINAL | Special-register or synchronization operation: `mtfsb1 FPSCR_NI_BIT`. |
|
||||
| `libs/RVL_SDK/src/base/PPCArch.c` | `PPCMthid4` | ORIGINAL | Both branches write HID4 with mtspr; the fallback preserves the Broadway H4A bit. |
|
||||
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `CNTCACHEClear` | PLACEHOLDER | NAND/token logic; best C 93.364235%, 147/151 instructions, four missing pool literals, [rx30][rx30]. |
|
||||
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `_CNTCACHEIsTitleRemovable` | PLACEHOLDER | NAND/TMD checks; best diagnostic C 93.70731%, 82/82 instructions, status-register interference, [rx18][rx18]. |
|
||||
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `_CNTCACHEDeleteContent` | PLACEHOLDER | Token parsing and ES deletion; best C 95.793106%, 143/145 instructions, missing reload/copy, [rx18][rx18]. |
|
||||
| `libs/RVL_SDK/src/cntcache/cntcache.c` | `CNTCACHEClear` | PLACEHOLDER | NAND/token logic; best C 47/151 differing, 149/151 instructions; pool solved with stripped writer literals, two post-delete compares missing, [rx30][rx30], [opus-cntc](../tools/decomp-assist/opus-cntc.attempts.md). |
|
||||
| `libs/RVL_SDK/src/db/db.c` | `__DBExceptionDestination` | ORIGINAL | mfmsr/mtmsr enable address translation before the exception-handler tail branch. |
|
||||
| `libs/RVL_SDK/src/gx/GXLight.c` | `PushLight` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
|
||||
| `libs/RVL_SDK/src/gx/GXTransform.c` | `WriteProjPS` | ORIGINAL | psq_l/psq_st transfers paired-single values for the GX command stream. |
|
||||
@@ -162,7 +160,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
|
||||
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__init_hardware` | ORIGINAL | Before normal C startup, mfmsr/mtmsr enables the FPU and r31 holds LR across init calls. |
|
||||
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__flush_cache` | ORIGINAL | dcbst/sync/icbi/isync make freshly initialized code visible to instruction fetch. |
|
||||
| `libs/RVL_SDK/src/os/__ppc_eabi_init.cpp` | `__init_user` | ORIGINAL | fralloc/bl __init_cpp/frfree/blr matches the public [SDK startup assembly][sdk-init]. |
|
||||
| `libs/RevoEX/src/nwc24/NWC24UserId.c` | `getUnScrambleId` | PLACEHOLDER | Integer byte permutation; best C 76.27329%, 161/161 instructions, 97 register/scheduling differences, [rx30][rx30]. |
|
||||
| `libs/Runtime/src/Gecko_setjmp.c` | `__setjmp` | ORIGINAL | Saves or restores caller GPRs/FPRs, LR, CR, and stack state across nonlocal returns. |
|
||||
| `libs/Runtime/src/Gecko_setjmp.c` | `longjmp` | ORIGINAL | Saves or restores caller GPRs/FPRs, LR, CR, and stack state across nonlocal returns. |
|
||||
| `libs/Runtime/src/__init_cpp_exceptions.cpp` | `__exception_info_constants` | ORIGINAL | Reads the caller ABI TOC register r2 directly for exception registration. |
|
||||
@@ -189,11 +186,7 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
|
||||
| `src/BS2/BS2Start.c` | `__start` | ORIGINAL | Runs before the C stack and ABI registers exist; constructs the initial stack. |
|
||||
| `src/BS2/BS2Start.c` | `__init_registers` | ORIGINAL | Initializes GPRs, r1, r2, and r13 for the C runtime. |
|
||||
| `src/scene/nakamuraTest/gamespy/common/gsPlatformUtil.c` | `GetTicks` | ORIGINAL | Inactive PS2 branch reads the CP0 Count register with mfc0 $9. |
|
||||
| `src/system/TVRC.cpp` | `TVRCSendStartAsync` | PLACEHOLDER | IR command setup; best recorded C 99.77273%, 198/198 instructions, seven differences, [rx2](../tools/decomp-assist/rx2.attempts.md); newer [rx17][rx17] 99.747475%. |
|
||||
| `src/system/iplChannelManager.cpp` | `getTitleName__Q33ipl7channel7ManagerCFiii` | PLACEHOLDER | Channel-name copying; best C 99.57746%, 71/71 instructions, four address-order differences, [rx17][rx17]. |
|
||||
| `src/system/iplSaveDataManager.cpp` | `Manager::hasChannel` | PLACEHOLDER | Title-slot search; best C 98.87324%, 71/71 instructions, 14 mask/base register differences, [rx30][rx30]. |
|
||||
| `src/system/iplSaveDataManager.cpp` | `Manager::makePriorTitleIDList` | PLACEHOLDER | Title filtering; best recorded C 80.22556%, 124/133 instructions, address CSE, [da1](../tools/decomp-assist/da1.attempts.md); newer [rx17][rx17] 79.827065%. |
|
||||
| `src/system/iplSaveDataManager.cpp` | `Manager::doUpdateChanInfos` | PLACEHOLDER | Channel metadata updates; best C 93.35821%, 68/67 instructions, extra memset base, [rx17][rx17]. |
|
||||
| `src/system/iplSaveDataManager.cpp` | `Manager::hasChannel` | PLACEHOLDER | Title-slot search; best C 71/71 instructions, 12 mask/base register differences, [sol-ph1](../tools/decomp-assist/sol-ph1.attempts.md). |
|
||||
| `src/system/iplSystem.cpp` | `System::warning_run` | PLACEHOLDER | Scene/render calls; best C 98.66477%, 176/176 instructions, 47 saved-register differences, [rx17][rx17]. |
|
||||
| `src/system/rvl_dec.c` | `Rvl_decode` | ORIGINAL | Direct beq decoder entries preserve r3/r4 and LR; lis/ori builds the format signatures. |
|
||||
| `src/system/rvl_dec.c` | `Rvl_decode_szs` | ORIGINAL | Original SZS decoder convention: nofralloc, r0 retains output length, fixed r3..r10/CTR byte-copy pipeline. |
|
||||
@@ -201,7 +194,6 @@ found. Historical logs absent from this branch have commit IDs and excerpts in
|
||||
| `src/system/rvl_dec.c` | `Rvl_decode_asr` | ORIGINAL | nofralloc hand-built 0x40 frame saves r21..31 with stmw; work address uses lis @h/ori @l. |
|
||||
|
||||
[rx17]: ../tools/decomp-assist/rx36.attempts.md#rx17
|
||||
[rx18]: ../tools/decomp-assist/rx36.attempts.md#rx18
|
||||
[rx24]: ../tools/decomp-assist/rx36.attempts.md#rx24
|
||||
[rx30]: ../tools/decomp-assist/rx36.attempts.md#rx30
|
||||
[rx36-osinit]: ../tools/decomp-assist/rx36.attempts.md#osinit
|
||||
|
||||
@@ -96,7 +96,11 @@ namespace textinput {
|
||||
#else
|
||||
virtual void sendCommand(u32, void*);
|
||||
#endif
|
||||
#ifdef TI_PREDICTLANG_SAMPLE_CLASS
|
||||
virtual void updateFromReceiver(u32, void*);
|
||||
#else
|
||||
virtual void updateFromReceiver(u32, void*) {}
|
||||
#endif
|
||||
|
||||
nw4r::ut::Link mLink; // 0x00
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace ipl {
|
||||
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
template <typename T>
|
||||
class __declspec(novtable) HermiteIntp : public utility::FrameController {
|
||||
class HermiteIntp : public utility::FrameController {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
@@ -296,45 +296,6 @@ namespace ipl {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef IPL_SD_CHANNEL_SELECT_CPP
|
||||
} // namespace math
|
||||
} // namespace ipl
|
||||
#include "math/iplMathTypes.h"
|
||||
namespace ipl {
|
||||
namespace math {
|
||||
template <>
|
||||
class HermiteIntp<VEC3> : public utility::FrameController {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
void init(const VEC3& start, const VEC3& end, f32 maxFrame, f32 startTangent, f32 endTangent, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
||||
VEC3 get() const {
|
||||
f32 frame = mFrame;
|
||||
f32 inverseDuration = 1.0f / mMaxFrame;
|
||||
VEC3 result =
|
||||
(mStart * (1.0f + (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))))) -
|
||||
(mEnd * (inverseDuration * (inverseDuration *
|
||||
(inverseDuration * (frame * (2.0f * frame * frame)))) -
|
||||
inverseDuration * (inverseDuration * (3.0f * frame * frame))));
|
||||
f32 frameSquared = frame * frame;
|
||||
f32 cubic = inverseDuration * (inverseDuration * (frame * frameSquared));
|
||||
f32 tangent = mStartTangent * (frame + (cubic -
|
||||
inverseDuration * (2.0f * frame * frame))) +
|
||||
mEndTangent * (cubic - inverseDuration * frameSquared);
|
||||
result.x += tangent;
|
||||
result.y += tangent;
|
||||
result.z += tangent;
|
||||
return result;
|
||||
}
|
||||
protected:
|
||||
VEC3 mStart;
|
||||
VEC3 mEnd;
|
||||
f32 mStartTangent;
|
||||
f32 mEndTangent;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace math
|
||||
} // namespace ipl
|
||||
|
||||
@@ -180,6 +180,7 @@ namespace ipl {
|
||||
|
||||
BOOL is_url_end_code(wchar_t ch) const;
|
||||
BOOL is_url_protocol(const wchar_t* url) const;
|
||||
BOOL is_url_ext(const wchar_t* url) const;
|
||||
int get_url_end(const wchar_t* url) const;
|
||||
|
||||
BOOL is_buffer_over(const wchar_t* text, u32 textLen) const;
|
||||
|
||||
@@ -35,11 +35,7 @@ namespace ipl {
|
||||
MemoryBase* mpBase; // 0x0C
|
||||
};
|
||||
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
class __declspec(novtable) MemoryBase {
|
||||
#else
|
||||
class MemoryBase {
|
||||
#endif
|
||||
public:
|
||||
class Anm {
|
||||
public:
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace ipl {
|
||||
const controller::Interface* controller);
|
||||
BOOL onEventDerived(const char* paneName, u32 event,
|
||||
controller::Interface* controller);
|
||||
bool collectTitlesByUsage(const s32* firstUsage, const s32* secondUsage,
|
||||
bool collectTitlesByUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
u32* titleCount);
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace ipl {
|
||||
int getCenterChannelIndex(const char* paneName) const;
|
||||
nw4r::lyt::Pane* getCenterChannelPane(int index) const;
|
||||
nw4r::lyt::Pane* getChannelPane(int index) const;
|
||||
static math::VEC3 getChannelPanePosition(SDChannelSelect* scene, int index);
|
||||
static nw4r::math::VEC3 getChannelPanePosition(SDChannelSelect* scene, int index);
|
||||
void calcPageAnimations();
|
||||
void processNormalInput();
|
||||
void updateArrowVisibility();
|
||||
@@ -232,16 +232,16 @@ namespace ipl {
|
||||
void setChannelScissor(const SDChannelObj* channel) const;
|
||||
bool isCurrentTitleUsageEnough(const s32* usage) const;
|
||||
void getCurrentTitleUsage(s32* bytes, s32* blocks) const;
|
||||
bool collectTitlesByChannelOrder(const s32* firstUsage, const s32* secondUsage,
|
||||
bool collectTitlesByChannelOrder(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
u32* titleCount);
|
||||
bool collectTitlesFromNandUsage(const s32* firstUsage, const s32* secondUsage,
|
||||
bool collectTitlesFromNandUsage(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
u32* titleCount);
|
||||
bool collectTitlesBySpecialChannels(const s32* firstUsage, const s32* secondUsage,
|
||||
bool collectTitlesBySpecialChannels(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
u32* titleCount);
|
||||
bool collectTitlesForMode(const s32* firstUsage, const s32* secondUsage,
|
||||
bool collectTitlesForMode(s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames,
|
||||
u32* titleCount, int searchMode);
|
||||
bool findAdjacentChannel(int direction, int* page, int* index) const;
|
||||
|
||||
@@ -20,6 +20,19 @@ typedef struct AOSSInitInput {
|
||||
u8 result[0x154];
|
||||
} AOSSInitInput;
|
||||
|
||||
typedef struct AOSSKeyMaterial {
|
||||
u8 nonce[2];
|
||||
u8 address[8];
|
||||
} AOSSKeyMaterial;
|
||||
|
||||
typedef struct AOSSPacketState {
|
||||
AOSSKeyMaterial key;
|
||||
u8 payload[0x5e];
|
||||
} AOSSPacketState;
|
||||
|
||||
extern AOSSPacketState s_packetState;
|
||||
extern u32 s_crcTable[0x100];
|
||||
|
||||
int AOSSi_Init(AOSSInitInput* input);
|
||||
int AOSS_Init_old(AOSSInitInput* input);
|
||||
void* AOSSi_Alloc(u32 size);
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace ipl {
|
||||
static void makeMasterkey();
|
||||
|
||||
static char* getRequestNum();
|
||||
static void dump();
|
||||
|
||||
private:
|
||||
static void _initRating();
|
||||
|
||||
@@ -277,6 +277,9 @@ namespace ipl {
|
||||
/* SEntry */
|
||||
bool hasLoadedBnr(int page, int index) const { return mChannels[page][index].loadedBnr; }
|
||||
int getSceneID(int page, int index) const { return mChannels[page][index].loadedBnr ? mChannels[page][index].info.sceneID : 0; }
|
||||
ESTitleId getEntryTitleID(int page, int index) const {
|
||||
return mChannels[page][index].loadedBnr ? ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode) : 0;
|
||||
}
|
||||
|
||||
/* SMetaBlockHeader */
|
||||
u32 getIconRSOIdx(int page, int index) const {
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace ipl {
|
||||
|
||||
static ESError GetValidTicketIndex(EGG::Heap* heap, ESTitleId titleId, ESTicketView* ticket = NULL, u32 ticketLength = 0);
|
||||
|
||||
static ESError DeleteSharedContent(EGG::Heap* heap);
|
||||
|
||||
static BOOL IsLastTicketExpired(ESTitleId* titleId);
|
||||
static void DeleteExpiredFlagFile();
|
||||
|
||||
|
||||
@@ -552,8 +552,6 @@ long double __strtold(int max_width, int (*ReadProc)(void*, int, int), void* Rea
|
||||
if (sig_negative && success(scan_state)) {
|
||||
result = -result;
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
unsigned mantissa_bit, dbl_bit;
|
||||
unsigned one_bit;
|
||||
@@ -630,9 +628,8 @@ long double __strtold(int max_width, int (*ReadProc)(void*, int, int), void* Rea
|
||||
}
|
||||
|
||||
result = *(long double*)dbl_bits;
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
double strtod(const char* str, char** end) {
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
#include <nw4r/db/assert.h>
|
||||
#include <nw4r/lyt/window.h>
|
||||
|
||||
#include <nw4r/lyt/common.h>
|
||||
#include <nw4r/lyt/layout.h>
|
||||
#include <nw4r/lyt/resources.h>
|
||||
#include <nw4r/lyt/types.h>
|
||||
|
||||
|
||||
#include <nw4r/math.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
extern "C" const u8 scLytFatalColorR;
|
||||
extern "C" const u8 scLytFatalColorG;
|
||||
extern "C" const u8 scLytFatalColorB;
|
||||
extern "C" const u8 scLytFatalColorA;
|
||||
extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
extern "C" char scLytFatalMsg[];
|
||||
|
||||
#undef NW4R_ASSERT
|
||||
#define NW4R_GLOBAL_ASSERT(x) \
|
||||
@@ -26,18 +37,6 @@ extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system
|
||||
} \
|
||||
}
|
||||
|
||||
#include <nw4r/lyt/window.h>
|
||||
|
||||
#include <nw4r/lyt/common.h>
|
||||
#include <nw4r/lyt/layout.h>
|
||||
#include <nw4r/lyt/resources.h>
|
||||
#include <nw4r/lyt/types.h>
|
||||
|
||||
|
||||
#include <nw4r/math.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
NW4R_UT_GET_DERIVED_RUNTIME_TYPEINFO(Window, Pane);
|
||||
@@ -174,8 +173,22 @@ namespace {
|
||||
flipInfo.coords[VERTEXCOLOR_RB][iy] +
|
||||
polSize.height / ((flipInfo.coords[VERTEXCOLOR_RT][iy] - flipInfo.coords[VERTEXCOLOR_RB][iy]) * tSz[iy]);
|
||||
}
|
||||
|
||||
inline void SetFrameTexOrigin(math::VEC2* texCds, int corner, int ix, int iy, u8 originX, u8 originY) {
|
||||
texCds[corner][ix] = texCds[corner ^ 2][ix] = originX;
|
||||
texCds[corner][iy] = texCds[corner ^ 1][iy] = originY;
|
||||
}
|
||||
|
||||
inline void SetFrameTexExtent(math::VEC2* texCds, const Size& polSize, const Size& texSize, const TextureFlipInfo& flipInfo, int corner, int ix,
|
||||
int iy, u8 originX, u8 originY) {
|
||||
const math::VEC2 tSz(texSize.width, texSize.height);
|
||||
texCds[corner ^ 3][ix] = texCds[corner ^ 1][ix] = originX + polSize.width / ((flipInfo.coords[corner ^ 1][ix] - originX) * tSz[ix]);
|
||||
texCds[corner ^ 3][iy] = texCds[corner ^ 2][iy] = originY + polSize.height / ((flipInfo.coords[corner ^ 2][iy] - originY) * tSz[iy]);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C" char scLytFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
Window::Window(const res::Window* pBlock, const ResBlockSet& resBlockSet) : Pane(pBlock) {
|
||||
@@ -388,7 +401,17 @@ namespace nw4r {
|
||||
detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha); \
|
||||
}
|
||||
|
||||
DRAW_QUAD_FOR_FRAME_1(LT, TEXTUREFLIP_NONE);
|
||||
GetLTFrameSize(&polPt, &polSize, basePt, mSize, frameSize);
|
||||
{
|
||||
TextureFlipInfo& flipInfo = GetTexutreFlipInfo(TEXTUREFLIP_NONE);
|
||||
int iy = flipInfo.idx[FLIPINDEX_Y];
|
||||
int ix = flipInfo.idx[FLIPINDEX_X];
|
||||
const u8 originX = flipInfo.coords[VERTEXCOLOR_LT][ix];
|
||||
const u8 originY = flipInfo.coords[VERTEXCOLOR_LT][iy];
|
||||
SetFrameTexOrigin(*texCds, VERTEXCOLOR_LT, ix, iy, originX, originY);
|
||||
SetFrameTexExtent(*texCds, polSize, texSize, flipInfo, VERTEXCOLOR_LT, ix, iy, originX, originY);
|
||||
}
|
||||
detail::DrawQuad(polPt, polSize, GX_TEXMAP1, texCds, bUseVtxCol ? vtxColors : NULL, alpha);
|
||||
DRAW_QUAD_FOR_FRAME_1(RT, TEXTUREFLIP_H);
|
||||
DRAW_QUAD_FOR_FRAME_1(RB, TEXTUREFLIP_180);
|
||||
DRAW_QUAD_FOR_FRAME_1(LB, TEXTUREFLIP_V);
|
||||
|
||||
@@ -13,6 +13,8 @@ enum TMCExifFormat {
|
||||
|
||||
enum TMCExifTag {
|
||||
TMC_EXIF_TAG_COMPRESSION = 0x0103,
|
||||
TMC_EXIF_TAG_MAKE = 0x010F,
|
||||
TMC_EXIF_TAG_MODEL = 0x0110,
|
||||
TMC_EXIF_TAG_STRIP_OFFSETS = 0x0111,
|
||||
TMC_EXIF_TAG_ORIENTATION = 0x0112,
|
||||
TMC_EXIF_TAG_X_RESOLUTION = 0x011A,
|
||||
@@ -69,6 +71,14 @@ static u32 readU32(const u8* p, u16 byteOrder) {
|
||||
return (raw >> 24) | ((raw >> 8) & 0xFF00) | ((raw & 0xFF00) << 8) | ((raw & 0xFF) << 24);
|
||||
}
|
||||
|
||||
static inline void convertExifWord(u32* result, u32 raw, u16 byteOrder) {
|
||||
if (byteOrder == TMC_EXIF_LITTLE_ENDIAN) {
|
||||
*result = raw;
|
||||
} else {
|
||||
*result = (raw >> 24) | ((raw >> 8) & 0xFF00) | ((raw & 0xFF00) << 8) | ((raw & 0xFF) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
s32 TMCCJPEGDecGetOffsetEXIF(u32* pOffset, u32* pSize, TMCCJPEGDecInitParam* pParam) {
|
||||
TMCCJPEGDecWork* work;
|
||||
u16 segSize;
|
||||
@@ -388,9 +398,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
|
||||
switch (tag) {
|
||||
case TMC_EXIF_TAG_COMPRESSION:
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: {
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS: {
|
||||
break;
|
||||
}
|
||||
case TMC_EXIF_TAG_ORIENTATION: {
|
||||
@@ -398,17 +406,27 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
return;
|
||||
}
|
||||
case TMC_EXIF_TAG_X_RESOLUTION: {
|
||||
u32 offset = readU32(entry->value, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
const u8* base;
|
||||
const u8* p;
|
||||
u32 offsetRaw;
|
||||
u32 offset;
|
||||
u32 numeratorRaw;
|
||||
u32 value;
|
||||
offsetRaw = entry->value[1] << 8 | entry->value[0] | entry->value[2] << 16 | entry->value[3] << 24;
|
||||
convertExifWord(&offset, offsetRaw, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNum = readU32(p, byteOrder);
|
||||
p = pInfo->thumbnailData + (offset + sizeof(u32));
|
||||
if (pInfo->thumbnailData > p) {
|
||||
numeratorRaw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
convertExifWord(&value, numeratorRaw, byteOrder);
|
||||
pInfo->xResNum = value;
|
||||
base = pInfo->thumbnailData;
|
||||
p = base + (offset + sizeof(u32));
|
||||
if (base > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
@@ -418,17 +436,27 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
return;
|
||||
}
|
||||
case TMC_EXIF_TAG_Y_RESOLUTION: {
|
||||
u32 offset = readU32(entry->value, byteOrder);
|
||||
const u8* p = pInfo->thumbnailData + offset;
|
||||
const u8* base;
|
||||
const u8* p;
|
||||
u32 offsetRaw;
|
||||
u32 offset;
|
||||
u32 numeratorRaw;
|
||||
u32 value;
|
||||
offsetRaw = entry->value[1] << 8 | entry->value[0] | entry->value[2] << 16 | entry->value[3] << 24;
|
||||
convertExifWord(&offset, offsetRaw, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->yResNum = readU32(p, byteOrder);
|
||||
p = pInfo->thumbnailData + (offset + sizeof(u32));
|
||||
if (pInfo->thumbnailData > p) {
|
||||
numeratorRaw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
convertExifWord(&value, numeratorRaw, byteOrder);
|
||||
pInfo->yResNum = value;
|
||||
base = pInfo->thumbnailData;
|
||||
p = base + (offset + sizeof(u32));
|
||||
if (base > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
@@ -525,6 +553,12 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
} else if (type == TMC_EXIF_TYPE_LONG) {
|
||||
pInfo->pixelYDim = readU32(entry->value, byteOrder);
|
||||
}
|
||||
}
|
||||
case TMC_EXIF_TAG_MAKE:
|
||||
case TMC_EXIF_TAG_MODEL:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT:
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH:
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -534,25 +568,18 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
s32 tag = readU16(entry->tag, byteOrder);
|
||||
|
||||
switch (tag) {
|
||||
case TMC_EXIF_TAG_DATE_TIME:
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS:
|
||||
case TMC_EXIF_TAG_ORIENTATION:
|
||||
case TMC_EXIF_TAG_TRANSFER_FUNCTION:
|
||||
case TMC_EXIF_TAG_YCBCR_POSITIONING:
|
||||
case TMC_EXIF_TAG_EXIF_IFD:
|
||||
case TMC_EXIF_TAG_EXIF_VERSION:
|
||||
case TMC_EXIF_TAG_COMPONENTS_CONFIGURATION:
|
||||
case TMC_EXIF_TAG_PLANAR_CONFIGURATION:
|
||||
case TMC_EXIF_TAG_FLASHPIX_VERSION:
|
||||
case TMC_EXIF_TAG_COLOR_SPACE:
|
||||
case TMC_EXIF_TAG_PIXEL_X_DIMENSION:
|
||||
case TMC_EXIF_TAG_PIXEL_Y_DIMENSION: {
|
||||
case TMC_EXIF_TAG_STRIP_OFFSETS: {
|
||||
break;
|
||||
}
|
||||
case TMC_EXIF_TAG_X_RESOLUTION: {
|
||||
u32 offset;
|
||||
const u8* base;
|
||||
const u8* p;
|
||||
offset = readU32(entry->value, byteOrder);
|
||||
u32 offsetRaw;
|
||||
u32 offset;
|
||||
u32 numeratorRaw;
|
||||
u32 value;
|
||||
offsetRaw = entry->value[1] << 8 | entry->value[0] | entry->value[2] << 16 | entry->value[3] << 24;
|
||||
convertExifWord(&offset, offsetRaw, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
@@ -560,9 +587,12 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->xResNumIfd1 = readU32(p, byteOrder);
|
||||
p = pInfo->thumbnailData + (offset + sizeof(u32));
|
||||
if (pInfo->thumbnailData > p) {
|
||||
numeratorRaw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
convertExifWord(&value, numeratorRaw, byteOrder);
|
||||
pInfo->xResNumIfd1 = value;
|
||||
base = pInfo->thumbnailData;
|
||||
p = base + (offset + sizeof(u32));
|
||||
if (base > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
@@ -572,9 +602,14 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
return;
|
||||
}
|
||||
case TMC_EXIF_TAG_Y_RESOLUTION: {
|
||||
u32 offset;
|
||||
const u8* base;
|
||||
const u8* p;
|
||||
offset = readU32(entry->value, byteOrder);
|
||||
u32 offsetRaw;
|
||||
u32 offset;
|
||||
u32 numeratorRaw;
|
||||
u32 value;
|
||||
offsetRaw = entry->value[1] << 8 | entry->value[0] | entry->value[2] << 16 | entry->value[3] << 24;
|
||||
convertExifWord(&offset, offsetRaw, byteOrder);
|
||||
p = pInfo->thumbnailData + offset;
|
||||
if (pInfo->thumbnailData > p) {
|
||||
return;
|
||||
@@ -582,9 +617,12 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
return;
|
||||
}
|
||||
pInfo->planarConfigIfd1 = readU32(p, byteOrder);
|
||||
p = pInfo->thumbnailData + (offset + sizeof(u32));
|
||||
if (pInfo->thumbnailData > p) {
|
||||
numeratorRaw = p[1] << 8 | p[0] | p[2] << 16 | p[3] << 24;
|
||||
convertExifWord(&value, numeratorRaw, byteOrder);
|
||||
pInfo->planarConfigIfd1 = value;
|
||||
base = pInfo->thumbnailData;
|
||||
p = base + (offset + sizeof(u32));
|
||||
if (base > p) {
|
||||
return;
|
||||
}
|
||||
if (p > pInfo->dataEnd - sizeof(u32)) {
|
||||
@@ -607,6 +645,21 @@ static void TMCJPEGDEC_IFD1_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder,
|
||||
}
|
||||
case TMC_EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: {
|
||||
pInfo->thumbnailLength = readU32(entry->value, byteOrder);
|
||||
}
|
||||
case TMC_EXIF_TAG_DATE_TIME:
|
||||
case TMC_EXIF_TAG_ORIENTATION:
|
||||
case TMC_EXIF_TAG_TRANSFER_FUNCTION:
|
||||
case TMC_EXIF_TAG_YCBCR_POSITIONING:
|
||||
case TMC_EXIF_TAG_EXIF_IFD:
|
||||
case TMC_EXIF_TAG_EXIF_VERSION:
|
||||
case TMC_EXIF_TAG_COMPONENTS_CONFIGURATION:
|
||||
case TMC_EXIF_TAG_FLASHPIX_VERSION:
|
||||
case TMC_EXIF_TAG_COLOR_SPACE:
|
||||
case TMC_EXIF_TAG_PIXEL_X_DIMENSION:
|
||||
case TMC_EXIF_TAG_PIXEL_Y_DIMENSION:
|
||||
case TMC_EXIF_TAG_MAKE:
|
||||
case TMC_EXIF_TAG_MODEL:
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ extern ziU16 Zi8Ord2Ord(ziU16, ziPtr);
|
||||
extern ziU8 Zi8LangSupported(ziU8, ziPtr);
|
||||
extern ziU16 Zi8GetTableCount(ziU8,ziU8,ziPtr);
|
||||
extern ziU32 Zi8GetTableAddress(ziU8,ziU8,ziPtr);
|
||||
extern void Zi8Memset(ziU8*,ziU32,ziS32);
|
||||
extern ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
extern ziU8 _Zi8GetCandidates(ziGetParam*,ziPtr);
|
||||
extern void Zi8InitDupWordBuf(ziPtr);
|
||||
extern ziU32 Zi8GetPInfo(ziU32,ziWChar *,ziU8,ziPtr);
|
||||
@@ -778,7 +778,7 @@ ziU32 Zi8Get1KeyPressSpelling(ziGetParam *params,Zi8OneKeyOptions *options,Zi8On
|
||||
if (options->countOnly == '\0') {
|
||||
*output++ = spellingBuffer[spellingIndex];
|
||||
*output++ = 0;
|
||||
candidateCount = candidateCount + 1;
|
||||
++candidateCount;
|
||||
}
|
||||
else if ((int)totalCandidates >= options->maxCount) goto finishSpelling;
|
||||
if (candidateCount >= params->maxCandidates) goto finishSpelling;
|
||||
@@ -1321,8 +1321,7 @@ ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8
|
||||
wordBuffer[params->wordCharCount + wordLength] = 0;
|
||||
}
|
||||
if (optionsMask == 5) {
|
||||
totalCandidates++;
|
||||
if (totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
if (++totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
} else if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
@@ -1390,8 +1389,7 @@ ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8
|
||||
wordBuffer[params->wordCharCount + wordLength] = 0;
|
||||
}
|
||||
if (optionsMask == 5) {
|
||||
totalCandidates++;
|
||||
if (totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
if (++totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
} else if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
@@ -1431,7 +1429,7 @@ ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8
|
||||
}
|
||||
if ((*phraseEntries & 0x80) != 0) {
|
||||
entryRemaining = 0;
|
||||
phraseEntries = phraseEntries + ((int)(*phraseEntries & 0x7f) >> 4) + 1;
|
||||
phraseEntries += ((int)(*phraseEntries & 0x7f) >> 4) + 1;
|
||||
} else {
|
||||
entryRemaining = 0x80;
|
||||
}
|
||||
@@ -1513,8 +1511,7 @@ ziU32 Zi8Get1KeyPressCandidates(ziGetParam *params,Zi8OneKeyOptions *options,Zi8
|
||||
output[outputIndex + wordLength] = 0;
|
||||
}
|
||||
if (optionsMask == 5) {
|
||||
totalCandidates++;
|
||||
if (totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
if (++totalCandidates >= options->maxCount) goto finishCandidates;
|
||||
} else if (remaining == 0) {
|
||||
totalCandidates++;
|
||||
candidateCount++;
|
||||
|
||||
@@ -295,7 +295,7 @@ void Zi8ChangeWordCase(ziWChar* word, ziU8 language, ZiAlphaWork* work) {
|
||||
while (*word != 0) Zi8ChangeCharCase(upper, word++, language, work);
|
||||
}
|
||||
|
||||
ziU32 Zi8DeTokenization(ziWChar* word, ziU32 length, ziU16 capacity, ziU16 language);
|
||||
ziU16 Zi8DeTokenization(ziWChar* word, ziU16 length, ziU16 capacity, ziU16 language);
|
||||
ziU32 Zi8GetTableAddress(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU16 Zi8GetTableCount(ziU8 language, ziU8 table, ziPtr work);
|
||||
void Zi8InitDupWordBuf(ziPtr work);
|
||||
@@ -306,7 +306,7 @@ ziU8 Zi8MatchOEMdata(ziWChar* elements, ziU8 count, ziU8 language, ziWChar* word
|
||||
ziU8 Zi8MatchPUDdata(ziWChar* elements, ziU8 count, ziU8 language, ziWChar* word, ziU16 capacity, ziU8 mode, ziU8 status, ziPtr work);
|
||||
ziU8 Zi8MatchROMdata(ziWChar* elements, ziU8 count, ziU8 language, ziWChar* word, ziU16 capacity, ziU8 mode, ziU8 status, ziBool reservedMode, ziBool exactLength, ziPtr work);
|
||||
ziU8 Zi8MatchUWDdata(ziWChar* elements, ziU8 count, ziWChar* currentWord, ziU16 currentLength, ziU8 language, ziWChar* word, ziU16 capacity, ziU8 mode, ziU8 status, ziPtr work);
|
||||
void Zi8Memset(ziPtr destination, ziU32 value, ziU32 count);
|
||||
ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
ziU16 Zi8WCharCount(ziWChar* word, ziPtr work);
|
||||
ziBool Zi8ZHCheckSpelling(ziWChar* word, ziWChar* elements, ziU8 count, ziPtr work);
|
||||
ziU8 Zi8getKeyLayout(ziU8 language, ziWChar key, ziWChar* characters, ziU8 capacity, ziPtr work);
|
||||
@@ -550,7 +550,6 @@ int Zi8AlphaGetCandidates(ziGetParam* parameters, ziPtr optionData, ziPtr workDa
|
||||
secondaryCompletionAllowed = 0;
|
||||
}
|
||||
Zi8InitDupWordBuf(workData);
|
||||
dictionaryIndex = 0;
|
||||
if ((((((ZiAlphaOptions*)optionData)->lookupMode == '\0') && (!phoneticInput)) && (!phoneticSeparator)) &&
|
||||
((((parameters->getOptions & 0xfd) != 0x80 && (parameters->elementCount != 0)) &&
|
||||
((parameters->elements[parameters->elementCount - 1] != 0xEFF1 &&
|
||||
@@ -559,8 +558,7 @@ int Zi8AlphaGetCandidates(ziGetParam* parameters, ziPtr optionData, ziPtr workDa
|
||||
if (((ZiAlphaWork*)workData)->highlightedWord[elementIndex] != parameters->elements[elementIndex]) break;
|
||||
wordCursor[elementIndex] = ((ZiAlphaWork*)workData)->highlightedWord[elementIndex];
|
||||
}
|
||||
wordCursor[elementIndex] = parameters->elements[elementIndex];
|
||||
elementIndex++;
|
||||
wordCursor[elementIndex++] = parameters->elements[elementIndex];
|
||||
if (parameters->elementCount == 1) ((ZiAlphaWork*)workData)->singleCharacter = *wordCursor;
|
||||
if (elementIndex == parameters->elementCount &&
|
||||
(firstCandidate == 0 || ((ZiAlphaWork*)workData)->reuseHighlightedWord != 0)) {
|
||||
@@ -654,7 +652,7 @@ foundHighlightedDictionary:
|
||||
}
|
||||
goto prepareDictionaryOrder;
|
||||
preparePrefix:
|
||||
prefixMode = ((ZiAlphaWork*)workData)->suffixMode;
|
||||
prefixMode = (ziU8)((ZiAlphaWork*)workData)->suffixMode;
|
||||
prefixTableFlags = Zi8GetTableCount(language,0x1f,workData);
|
||||
prefixVowelFlags = prefixTableFlags & 0x10;
|
||||
if (((((language == 0x3f) || (language == 4)) ||
|
||||
@@ -900,19 +898,19 @@ selectDictionary:
|
||||
}
|
||||
else {
|
||||
if (alternateSingleCharacter != 2) {
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount & 0xff,language,wordCursor,
|
||||
wordCapacity & 0xffff,matchMode,
|
||||
dictionaryStatus[dictionaryKind] & 0xff,0,exactLengthOnly,workData);
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount,language,wordCursor,
|
||||
wordCapacity,matchMode,
|
||||
dictionaryStatus[dictionaryKind],0,exactLengthOnly,workData);
|
||||
}
|
||||
if ((alternateSingleCharacter != 0) && ((wordLength == 0 || (*wordCursor == *elements)))) {
|
||||
if (alternateSingleCharacter == 1) {
|
||||
alternateSingleCharacter = 2;
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount & 0xff,parameters->subLanguage,wordCursor,
|
||||
wordCapacity & 0xffff,1,0,0,exactLengthOnly,workData);
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount,parameters->subLanguage,wordCursor,
|
||||
wordCapacity,1,0,0,exactLengthOnly,workData);
|
||||
}
|
||||
else {
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount & 0xff,parameters->subLanguage,wordCursor,
|
||||
wordCapacity & 0xffff,1,1,0,exactLengthOnly,workData);
|
||||
wordLength = Zi8MatchROMdata(elements,elementCount,parameters->subLanguage,wordCursor,
|
||||
wordCapacity,1,1,0,exactLengthOnly,workData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -922,27 +920,24 @@ selectDictionary:
|
||||
if ((((wordLength == 0) && (*punctuationCursor != 0)) && (dictionaryExact != 0)) &&
|
||||
((((ZiAlphaWork*)workData)->singleCharacter != 0 && (parameters->elementCount == 2)))) {
|
||||
*wordCursor = ((ZiAlphaWork*)workData)->singleCharacter;
|
||||
wordCursor[2] = 0;
|
||||
wordCursor[1] = *punctuationCursor++;
|
||||
wordCursor[2] = 0;
|
||||
wordLength = 2;
|
||||
}
|
||||
if (((apostropheIndex != 0) && (wordLength != 0)) && (elementCount == parameters->elementCount)) {
|
||||
if (language == 0x2f) {
|
||||
index = Zi8ITspecialExclusion
|
||||
(wordCursor + apostropheIndex,apostropheIndex,wordLength - apostropheIndex);
|
||||
if (index != '\0') {
|
||||
if (Zi8ITspecialExclusion
|
||||
(wordCursor + apostropheIndex,apostropheIndex,wordLength - apostropheIndex) != 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
else if (language == 0x58) {
|
||||
index = Zi8_814659E8(wordCursor + apostropheIndex,apostropheIndex,wordLength - apostropheIndex);
|
||||
if (index != '\0') {
|
||||
if (Zi8_814659E8(wordCursor + apostropheIndex,apostropheIndex,wordLength - apostropheIndex) != 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
index = Zi8IsVowel(language,wordCursor[apostropheIndex]);
|
||||
if (index == '\0') {
|
||||
if (Zi8IsVowel(language,wordCursor[apostropheIndex]) == 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
@@ -961,20 +956,17 @@ filterVowelCandidate:
|
||||
goto finishDictionaryPass;
|
||||
}
|
||||
if (language == 0x2f) {
|
||||
index = Zi8ITspecialExclusion(wordCursor,prefixCount,wordLength);
|
||||
if (index != '\0') {
|
||||
if (Zi8ITspecialExclusion(wordCursor,prefixCount,wordLength) != 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
else if (language == 0x58) {
|
||||
index = Zi8_814659E8(wordCursor,prefixCount,wordLength);
|
||||
if (index != '\0') {
|
||||
if (Zi8_814659E8(wordCursor,prefixCount,wordLength) != 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
index = Zi8IsVowel(language,*wordCursor);
|
||||
if (index == '\0') {
|
||||
if (Zi8IsVowel(language,*wordCursor) == 0) {
|
||||
wordLength = 0;
|
||||
}
|
||||
}
|
||||
@@ -998,9 +990,9 @@ filterVowelCandidate:
|
||||
case 2:
|
||||
case 6:
|
||||
if (elementCount != 0) {
|
||||
wordLength = Zi8MatchPUDdata(elements,elementCount & 0xff,language,wordCursor,
|
||||
wordCapacity & 0xffff,dictionaryExact,
|
||||
dictionaryStatus[dictionaryKind] & 0xff,workData);
|
||||
wordLength = Zi8MatchPUDdata(elements,elementCount,language,wordCursor,
|
||||
wordCapacity,dictionaryExact,
|
||||
dictionaryStatus[dictionaryKind],workData);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@@ -1008,8 +1000,8 @@ filterVowelCandidate:
|
||||
while( ZI8_TRUE ) {
|
||||
wordLength = Zi8MatchUWDdata(elements,elementCount,
|
||||
parameters->currentWord,parameters->wordCharCount,
|
||||
language,wordCursor,wordCapacity & 0xffff,dictionaryExact,
|
||||
dictionaryStatus[dictionaryKind] & 0xff,workData);
|
||||
language,wordCursor,wordCapacity,dictionaryExact,
|
||||
dictionaryStatus[dictionaryKind],workData);
|
||||
if (((elementCount != 0) || (wordLength != 1)) || (*wordCursor != 0x20)) break;
|
||||
dictionaryStatus[dictionaryKind] = 1;
|
||||
}
|
||||
@@ -1019,7 +1011,7 @@ filterVowelCandidate:
|
||||
if (elementCount != 0) {
|
||||
wordLength = Zi8MatchOEMdata(elements,elementCount,language,wordCursor,
|
||||
wordCapacity,dictionaryExact,
|
||||
dictionaryStatus[dictionaryKind] & 0xff,workData);
|
||||
dictionaryStatus[dictionaryKind],workData);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
@@ -1074,8 +1066,12 @@ filterVowelCandidate:
|
||||
(((ZiAlphaOptions*)optionData)->lookupMode == '\0')) &&
|
||||
(((ZiAlphaWork*)workData)->dictionaries[language] == 0)))))) {
|
||||
if (language != ((ZiAlphaWork*)workData)->language) break;
|
||||
index = ((ZiAlphaWork*)workData)->dictionaryKinds[dictionaryIndex + 1];
|
||||
if (index == 0xc || (index < 9 && index >= 5)) {
|
||||
switch (((ZiAlphaWork*)workData)->dictionaryKinds[dictionaryIndex + 1]) {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 12:
|
||||
if (Zi8getKeyLayout(language,0xeff1,&punctuationBuffer[0],1,workData) == 0) {
|
||||
punctuationBuffer[0] = 0;
|
||||
}
|
||||
@@ -1094,8 +1090,17 @@ filterVowelCandidate:
|
||||
(((((ZiAlphaWork*)workData)->rememberedWord[0] == 0 || (((ZiAlphaOptions*)optionData)->lookupMode != '\0')) ||
|
||||
(((ZiAlphaWork*)workData)->dictionaries[language] != 0)))))) ||
|
||||
(languagePassCount == 2)))) break;
|
||||
index = ((ZiAlphaWork*)workData)->dictionaryKinds[dictionaryIndex + 1];
|
||||
if ((index != 0xc) && (((0xb < index || (8 < index)) || (index < 5)))) break;
|
||||
switch (((ZiAlphaWork*)workData)->dictionaryKinds[dictionaryIndex + 1]) {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 12:
|
||||
goto prepareRememberedPunctuation;
|
||||
default:
|
||||
goto finishDictionaryPass;
|
||||
}
|
||||
prepareRememberedPunctuation:
|
||||
if (Zi8getKeyLayout(language,0xeff1,&punctuationBuffer[0],1,workData) == 0) {
|
||||
punctuationBuffer[0] = 0;
|
||||
}
|
||||
@@ -1127,8 +1132,8 @@ prepareCandidate:
|
||||
wordLength = elementCount;
|
||||
wordCursor[wordLength] = 0;
|
||||
}
|
||||
wordLength = (ziU16)Zi8DeTokenization(wordCursor,wordLength & 0xffff,wordCapacity & 0xffff,language);
|
||||
if (((phoneticInput) && ((unsigned int)parameters->elementCount < (wordLength & 0xff))) &&
|
||||
wordLength = Zi8DeTokenization(wordCursor,wordLength,wordCapacity,language);
|
||||
if (((phoneticInput) && ((ziU8)parameters->elementCount < (wordLength & 0xffU))) &&
|
||||
((wordCursor[wordLength - 1] == 0xf360 || (wordCursor[wordLength - 1] == 0x27)))) {
|
||||
wordLength = wordLength - 1;
|
||||
wordCursor[wordLength] = 0;
|
||||
@@ -1145,7 +1150,7 @@ prepareCandidate:
|
||||
wordCursor[wordLength] = 0;
|
||||
}
|
||||
if (((int)((ZiAlphaOptions*)optionData)->maxWordLength < (int)(wordLength + prefixCount)) ||
|
||||
((Zi8IsDupWordW(wordCursor - prefixCount,wordLength + prefixCount & 0xff,
|
||||
((Zi8IsDupWordW(wordCursor - prefixCount,wordLength + prefixCount,
|
||||
workData)) != '\0')) {
|
||||
if ((prefixCount != 0) && (((ZiAlphaOptions*)optionData)->maxWordLength <= prefixCount)) break;
|
||||
}
|
||||
@@ -1163,7 +1168,7 @@ checkKeyLayout:
|
||||
candidateCharacterCount = wordLength + prefixCount;
|
||||
for (index = 0; (int)index < (int)(unsigned int)keyLayoutCount; index = index + 1) {
|
||||
if (*keyLayoutCursor < candidateCharacterCount) {
|
||||
keyLayoutCursor = keyLayoutCursor + *keyLayoutCursor + 1;
|
||||
keyLayoutCursor += *keyLayoutCursor + 1;
|
||||
} else {
|
||||
if (*keyLayoutCursor++ > candidateCharacterCount) {
|
||||
index = (unsigned int)keyLayoutCount;
|
||||
@@ -1541,8 +1546,7 @@ checkPrefixPunctuation:
|
||||
((ZiAlphaWork*)workData)->letterHyphen = 0x2e;
|
||||
}
|
||||
if (elements[((ZiAlphaWork*)workData)->prefixCount] != 0xEFF1 && Zi8IsAlphaPunct(elements[((ZiAlphaWork*)workData)->prefixCount]) != 0) {
|
||||
((ZiAlphaWork*)workData)->prefix[((ZiAlphaWork*)workData)->prefixCount] = elements[((ZiAlphaWork*)workData)->prefixCount];
|
||||
((ZiAlphaWork*)workData)->prefixCount++;
|
||||
((ZiAlphaWork*)workData)->prefix[((ZiAlphaWork*)workData)->prefixCount++] = elements[((ZiAlphaWork*)workData)->prefixCount];
|
||||
} else {
|
||||
((ZiAlphaWork*)workData)->prefix[((ZiAlphaWork*)workData)->prefixCount++] = ((ZiAlphaWork*)workData)->letterHyphen;
|
||||
}
|
||||
@@ -1637,7 +1641,7 @@ finishCandidates:
|
||||
|
||||
|
||||
|
||||
ziU32 Zi8DeTokenization(ziWChar* word, ziU32 length, ziU16 capacity, ziU16 language) {
|
||||
ziU16 Zi8DeTokenization(ziWChar* word, ziU16 length, ziU16 capacity, ziU16 language) {
|
||||
ziU16 index;
|
||||
ziBool changed = ZI8_FALSE;
|
||||
ziU16 outputCount = 0;
|
||||
|
||||
@@ -176,8 +176,8 @@ extern ziBool Zi8PriMatchNextComp(ziU8* component, ziU8 firstByteMask, ziU8 firs
|
||||
extern ziBool Zi8SecMatchComp(ziU8* component, ziMatchParam* match, ziU8* dictionary, ziPtr work);
|
||||
extern void Zi8InitDupWordBuf(ziPtr work);
|
||||
extern ziU8 Zi8MatchPUDdata_ZHS(ziWChar* word, ziU8 length, ziU8 language, ziWChar* spelling, ziU16 spellingCapacity, ziWChar* candidate, ziU16 candidateCapacity, ziU8 mode, ziU8 next, ziPtr work);
|
||||
extern ziPtr Zi8Memcpy(ziPtr destination, ziPtr source, ziS32 length);
|
||||
extern void Zi8Memset(ziPtr destination, int value, ziU32 size);
|
||||
extern ziPtr Zi8Memcpy(ziPtr destination, ziPtr source, ziS32 count);
|
||||
extern ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
|
||||
static int Zi8NewMatchPhonetic(ziGetParam* request, ZiChineseRecord* records,
|
||||
ziPtr indexTable, ziU16 indexCount, ziPtr dictionary,
|
||||
@@ -753,10 +753,11 @@ static int zi8InternalGetZH(ziGetParam* request, ZiChineseOptions* options, ziPt
|
||||
if (!componentTable) {
|
||||
componentCount = Zi8GetTableCount(1, 7, work);
|
||||
componentOrdinals = (ziU8*)Zi8GetTableAddress(1, 7, work);
|
||||
componentTable = componentCursor = (ziU8*)Zi8GetTableAddress(1, 2, work);
|
||||
componentCursor = (ziU8*)Zi8GetTableAddress(1, 2, work);
|
||||
componentTable = componentCursor;
|
||||
componentCursor += 8;
|
||||
componentIndex = componentCount - 1;
|
||||
--componentCount;
|
||||
componentIndex = componentCount;
|
||||
alternateCharacter = 0;
|
||||
phoneticRetry = 1;
|
||||
}
|
||||
@@ -1299,8 +1300,8 @@ context_word_lookup:
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
outputIndex += emittedWords;
|
||||
output[outputIndex] = ' ';
|
||||
if (++outputIndex > outputLimit) {
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) {
|
||||
request->letters = emittedCount;
|
||||
request->count = emittedCount;
|
||||
goto engine_finish;
|
||||
@@ -1434,8 +1435,8 @@ candidate_dictionary_search:
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex] = ' ';
|
||||
if (++outputIndex > outputLimit) goto engine_finish;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
}
|
||||
@@ -1499,7 +1500,7 @@ character_range_next:
|
||||
record += 12;
|
||||
continue;
|
||||
character_range_accept:
|
||||
ordinalIndex = remainingOrdinals - candidateCount + firstOrdinal - 1;
|
||||
ordinalIndex = firstOrdinal + (remainingOrdinals - candidateCount - 1);
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
if (charsetTable) {
|
||||
@@ -1676,8 +1677,8 @@ tone_candidates:
|
||||
if (emitWords) {
|
||||
++emittedCount;
|
||||
output[outputIndex++] = character;
|
||||
output[outputIndex] = ' ';
|
||||
if (++outputIndex > outputLimit) goto engine_finish;
|
||||
output[outputIndex++] = ' ';
|
||||
if (outputIndex > outputLimit) goto engine_finish;
|
||||
} else output[emittedCount++] = character;
|
||||
if (emittedCount >= request->maxCandidates) goto engine_finish;
|
||||
} else if (totalResults >= options->maxResults) goto engine_finish;
|
||||
@@ -1957,7 +1958,7 @@ component_retry:
|
||||
goto character_pass_done;
|
||||
}
|
||||
if (!(ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work)) goto component_record_next;
|
||||
ordinalIndex = remainingOrdinals - candidateCount + firstOrdinal - 1;
|
||||
ordinalIndex = firstOrdinal + (remainingOrdinals - candidateCount - 1);
|
||||
if (charsetTable) charsetEntry = charsetTable + ordinalIndex;
|
||||
if (charsetTable && !(charsetEntry[0] & charsetFilter)) goto component_record_next;
|
||||
currentSpelling[0] = ((ZiChineseWork*)work)->duplicateCharacters[((ZiChineseWork*)work)->duplicateIndex] = candidateOrdinal;
|
||||
@@ -2052,7 +2053,7 @@ component_record_next:
|
||||
if (getMode != 5) {
|
||||
while (exactPhrase) {
|
||||
while (match.count) {
|
||||
if ((candidateCount -= 1) == 0xFFFF) goto frequency_range_retry;
|
||||
if (candidateCount-- == 0) goto frequency_range_retry;
|
||||
if (match.recordValues[0] == (record[0] & match.recordMasks[0]) &&
|
||||
(ziU8)Zi8SecMatchChar(record, componentTable, &match, &candidateOrdinal, work)) goto frequency_accept;
|
||||
record += 12;
|
||||
@@ -2072,7 +2073,7 @@ frequency_range_retry:
|
||||
continue;
|
||||
}
|
||||
frequency_accept:
|
||||
ordinalIndex = remainingOrdinals - candidateCount + firstOrdinal - 1;
|
||||
ordinalIndex = firstOrdinal + (remainingOrdinals - candidateCount - 1);
|
||||
if (charsetTable) charsetEntry = charsetTable + ordinalIndex;
|
||||
if (charsetTable && !(charsetEntry[0] & charsetFilter)) goto frequency_record_next;
|
||||
((ZiChineseWork*)work)->duplicateOrdinals[((ZiChineseWork*)work)->duplicateIndex] = ordinalIndex;
|
||||
@@ -2298,7 +2299,7 @@ phonetic_pair_next:
|
||||
alternateCursor += 4;
|
||||
}
|
||||
phonetic_group_next:
|
||||
ordinalIndex += 1;
|
||||
ordinalIndex++;
|
||||
frequencyCursor += 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ ziU16 Zi8GetTableCount(ziU8 language, ziU8 table, ziPtr work);
|
||||
ziU16 Zi8GetVersion(ziPtr work);
|
||||
ziU16 Zi8GetOEMID(ziPtr work);
|
||||
ziU16 Zi8GetBuildID(ziPtr work);
|
||||
void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count);
|
||||
ziPtr Zi8Memcpy(ziPtr destination, ziPtr source, ziS32 count);
|
||||
ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* options, ziPtr work);
|
||||
|
||||
ziBool Zi8ZHsetPYfuzzyPairs(ziFuzzyPYPairs pairs ZI_NEED_WORK) {
|
||||
@@ -700,14 +700,16 @@ ziBool Zi8IsDupWordW(ziWChar* word, ziU8 length ZI_NEED_WORK) {
|
||||
return duplicate;
|
||||
}
|
||||
|
||||
void Zi8Memset(ziU8* destination, ziU32 value, ziS32 count) {
|
||||
ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count) {
|
||||
ziS32 index;
|
||||
for (index = 0; index < count; index++) destination[index] = (ziU8)value;
|
||||
for (index = 0; index < count; index++) ((ziU8*)destination)[index] = (ziU8)value;
|
||||
return destination;
|
||||
}
|
||||
|
||||
void Zi8Memcpy(ziU8* destination, ziU8* source, ziS32 count) {
|
||||
ziPtr Zi8Memcpy(ziPtr destination, ziPtr source, ziS32 count) {
|
||||
ziS32 index;
|
||||
for (index = 0; index < count; index++) destination[index] = source[index];
|
||||
for (index = 0; index < count; index++) ((ziU8*)destination)[index] = ((ziU8*)source)[index];
|
||||
return destination;
|
||||
}
|
||||
|
||||
ziBool Zi8SetMaxWordLength(ziU8 length ZI_NEED_WORK) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
|
||||
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
|
||||
extern ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
extern void Zi8SetLatinSearchOrder(ziU32 a, ziU8 b ZI_NEED_WORK);
|
||||
extern void ZADP_Zi8SetPDremoveOpt(ziU8 a ZI_NEED_WORK);
|
||||
extern ziU16 Zi8GetFormatVersion(ziU8 a ZI_NEED_WORK);
|
||||
|
||||
@@ -5,7 +5,7 @@ extern ziU8 Zi8LangSupported(ziU8 lang ZI_NEED_WORK);
|
||||
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
|
||||
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
|
||||
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
|
||||
extern ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
|
||||
ziU8 Zi8GetZHCharSet(ziPtr __zi8_work_data) {
|
||||
ziU8 charSet = 0;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stddef.h>
|
||||
#include <zi8clib/zitypes.h>
|
||||
#include <zi8clib/zierror.h>
|
||||
#include <zi8clib/zconvert.h>
|
||||
@@ -7,19 +8,25 @@ typedef struct ziUserWord {
|
||||
ziU8 size, language, length, priority;
|
||||
ziU8 text[1];
|
||||
} ziUserWord;
|
||||
|
||||
enum {
|
||||
ZI_UWD_LENGTH_OFFSET = offsetof(ziUserWord, length),
|
||||
ZI_UWD_PRIORITY_OFFSET = offsetof(ziUserWord, priority),
|
||||
ZI_UWD_TEXT_OFFSET = offsetof(ziUserWord, text),
|
||||
};
|
||||
typedef struct ziUserDictionary {
|
||||
ziU16 flags, end, current, boundary;
|
||||
ziU8 entries[1];
|
||||
} ziUserDictionary;
|
||||
void Zi8Memset(ziPtr, ziU32, ziU32);
|
||||
ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
|
||||
ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
|
||||
ziBool Zi8_81480224(ziU8* word ZI_NEED_WORK) {
|
||||
ziU8 length;
|
||||
ziUwdNode* previous;
|
||||
ziUwdNode* current;
|
||||
ziUwdNode* added;
|
||||
ziU8 position;
|
||||
ziUserWord* candidate;
|
||||
ziU8* candidate;
|
||||
if (ZI_WORK->uwdCount >= 32) {
|
||||
Zi8LogError(0x19D, __zi8_work_data);
|
||||
return 0;
|
||||
@@ -28,7 +35,7 @@ ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
|
||||
Zi8LogError(0x19F, __zi8_work_data);
|
||||
return 0;
|
||||
}
|
||||
length = word->length;
|
||||
length = word[ZI_UWD_LENGTH_OFFSET];
|
||||
if (length == 0) {
|
||||
Zi8LogError(0x193, __zi8_work_data);
|
||||
return 0;
|
||||
@@ -40,12 +47,12 @@ ziBool Zi8_81480224(ziUserWord* word ZI_NEED_WORK) {
|
||||
previous = 0;
|
||||
current = ZI_WORK->uwdList;
|
||||
while (current != 0) {
|
||||
candidate = (ziUserWord*)current->word;
|
||||
if (ZI_WORK->uwdPrioritySort == 1 && word->priority > candidate->priority) break;
|
||||
if (candidate->length == length) {
|
||||
candidate = current->word;
|
||||
if (ZI_WORK->uwdPrioritySort == 1 && word[ZI_UWD_PRIORITY_OFFSET] > candidate[ZI_UWD_PRIORITY_OFFSET]) break;
|
||||
if (candidate[ZI_UWD_LENGTH_OFFSET] == length) {
|
||||
position = 0;
|
||||
while (position < length) {
|
||||
if (candidate->text[position] != word->text[position]) break;
|
||||
if (candidate[position + ZI_UWD_TEXT_OFFSET] != word[position + ZI_UWD_TEXT_OFFSET]) break;
|
||||
position++;
|
||||
}
|
||||
if (position == length) {
|
||||
@@ -203,7 +210,7 @@ next:
|
||||
if (ZI_WORK->uwdContextRecord[prefixLength] != ((ziU8*)previous)[prefixLength] && ZI_WORK->uwdContextAlternateCase[prefixLength] != ((ziU8*)previous)[prefixLength]) goto next;
|
||||
}
|
||||
}
|
||||
Zi8_81480224((ziUserWord*)cursor, __zi8_work_data);
|
||||
Zi8_81480224(cursor, __zi8_work_data);
|
||||
}
|
||||
goto next;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <zi8clib/zitypes.h>
|
||||
|
||||
void Zi8Memset(ziPtr, ziU32, ziU32);
|
||||
void Zi8Memcpy(ziPtr, ziPtr, ziU32);
|
||||
ziPtr Zi8Memset(ziPtr destination, ziU32 value, ziS32 count);
|
||||
ziPtr Zi8Memcpy(ziPtr destination, ziPtr source, ziS32 count);
|
||||
ziBool Zi8IsComponent(ziWChar ZI_NEED_WORK);
|
||||
ziU32 Zi8GetTableAddress(ziU8, ziU8 ZI_NEED_WORK);
|
||||
ziU16 Zi8GetTableCount(ziU8, ziU8 ZI_NEED_WORK);
|
||||
@@ -60,15 +60,14 @@ ziBool Zi8PrepareMatch(ziGetParam* request, ziMatchParam* match, ziU8 skipMode Z
|
||||
}
|
||||
}
|
||||
if (elementCount != 0) {
|
||||
element = request->elements[0];
|
||||
match->comp = element;
|
||||
match->comp = element = request->elements[0];
|
||||
if (Zi8IsComponent(element,__zi8_work_data) != 0) {
|
||||
elementIndex++;
|
||||
hasComponent = 1;
|
||||
buffers.component = (ziU8*)Zi8GetTableAddress(1,2,__zi8_work_data);
|
||||
buffers.componentIndex = (ziU8*)Zi8GetTableAddress(1,6,__zi8_work_data);
|
||||
buffers.componentIndex += (element - 0xef10) * 2;
|
||||
match->componentIndex = ((buffers.componentIndex[1] & 0x3f) << 8) + *buffers.componentIndex;
|
||||
match->componentIndex = (((ziU16)buffers.componentIndex[1] & 0x3f) << 8) + *buffers.componentIndex;
|
||||
buffers.component += (ziU32)match->componentIndex * 8;
|
||||
switch(*buffers.component & 0xf) {
|
||||
case 0:
|
||||
@@ -249,8 +248,10 @@ ziBool Zi8PrepareMatch(ziGetParam* request, ziMatchParam* match, ziU8 skipMode Z
|
||||
else {
|
||||
initial = 0;
|
||||
final = 0;
|
||||
bestFinal = bestInitial = 0;
|
||||
previousFinal = previousInitial = 0;
|
||||
bestInitial = 0;
|
||||
bestFinal = 0;
|
||||
previousInitial = 0;
|
||||
previousFinal = 0;
|
||||
buffers.phoneticInput = request->elements;
|
||||
match->nCand = 0;
|
||||
request->completion = request->elementCount;
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct CXUncompContextLZ {
|
||||
} CXUncompContextLZ;
|
||||
|
||||
typedef union CXHuffmanDecodeTableEntry {
|
||||
u8 raw;
|
||||
volatile u8 raw;
|
||||
struct {
|
||||
u8 leafR : 1; // 10000000
|
||||
u8 leafL : 1; // 01000000
|
||||
|
||||
@@ -72,11 +72,7 @@ struct DVDCommandBlock {
|
||||
DVDCommandBlock* prev; // 0x04
|
||||
|
||||
u32 command; // 0x08
|
||||
#ifdef BS2_MACH_VOLATILE_DVD_STATE
|
||||
volatile s32 state;
|
||||
#else
|
||||
s32 state; // 0x0C
|
||||
#endif
|
||||
|
||||
u32 offset; // 0x10
|
||||
u32 length; // 0x14
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OSSemaphore {
|
||||
s32 count;
|
||||
volatile s32 count;
|
||||
OSThreadQueue queue;
|
||||
} OSSemaphore;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <private/axfx.h>
|
||||
#include <revolution/AXFX.h>
|
||||
#include <revolution/MEM.h>
|
||||
#include <revolution/OS.h>
|
||||
#include <revolution/axfx.h>
|
||||
#include <revolution/mem.h>
|
||||
#include <revolution/os.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
@@ -371,10 +371,9 @@ static void __FreeDelayLine(AXFX_REVERBHI_EXP* fx) {
|
||||
}
|
||||
}
|
||||
|
||||
DECOMP_FORCE_LITERAL(AXFXReverbHiExp_c, -3.0f, 10.0);
|
||||
|
||||
static BOOL __InitParams(AXFX_REVERBHI_EXP* reverb) {
|
||||
u32 ch, i;
|
||||
f32 attenuation;
|
||||
|
||||
if (reverb->earlyMode >= 8)
|
||||
return FALSE;
|
||||
@@ -421,7 +420,8 @@ static BOOL __InitParams(AXFX_REVERBHI_EXP* reverb) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
reverb->combPos[i] = 0;
|
||||
reverb->combLength[i] = __FilterSizeTable[reverb->fusedMode][i];
|
||||
reverb->combCoef[i] = pow(10.0f, (-3.0f * (f32)(reverb->combLength[i]) / (f32)(reverb->fusedTime * 32000)));
|
||||
attenuation = -3.0f * (f32)reverb->combLength[i] / (reverb->fusedTime * 32000);
|
||||
reverb->combCoef[i] = pow(10.0, attenuation);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <private/axfx.h>
|
||||
#include <revolution/AXFX.h>
|
||||
#include <revolution/MEM.h>
|
||||
#include <revolution/OS.h>
|
||||
#include <revolution/axfx.h>
|
||||
#include <revolution/mem.h>
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/ax.h>
|
||||
|
||||
#include <math.h>
|
||||
@@ -385,10 +385,9 @@ static void __FreeDelayLine(AXFX_REVERBHI_EXP_DPL2* fx) {
|
||||
}
|
||||
}
|
||||
|
||||
DECOMP_FORCE_LITERAL(AXFXReverbHiExpDpl2_c, -3.0f, 10.0);
|
||||
|
||||
static BOOL __InitParams(AXFX_REVERBHI_EXP_DPL2* reverb) {
|
||||
u32 ch, i;
|
||||
f32 attenuation;
|
||||
|
||||
if (reverb->earlyMode >= 8)
|
||||
return FALSE;
|
||||
@@ -435,7 +434,8 @@ static BOOL __InitParams(AXFX_REVERBHI_EXP_DPL2* reverb) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
reverb->combPos[i] = 0;
|
||||
reverb->combLength[i] = __FilterSizeTable[reverb->fusedMode][i];
|
||||
reverb->combCoef[i] = pow(10.0f, (-3.0f * (f32)(reverb->combLength[i]) / (f32)(reverb->fusedTime * 32000)));
|
||||
attenuation = -3.0f * (f32)reverb->combLength[i] / (reverb->fusedTime * 32000);
|
||||
reverb->combCoef[i] = pow(10.0, attenuation);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
@@ -11,9 +11,27 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
DECOMP_FORCE_ACTIVE(cnt_c, "<< RVL_SDK - CNT \trelease build: Apr 20 2010 11:21:37 (0x4199_60831) >>");
|
||||
DECOMP_FORCE_ACTIVE(cnt_c, "/content%d");
|
||||
DECOMP_FORCE_ACTIVE(cnt_c, "Warning: CNTInitHandle(): directory '%s' is not found under '/'\n");
|
||||
void CNTInit(void) {
|
||||
const char* __CNTVersion = "<< RVL_SDK - CNT \trelease build: Apr 20 2010 11:21:37 (0x4199_60831) >>";
|
||||
OSRegisterVersion(__CNTVersion);
|
||||
}
|
||||
|
||||
s32 CNTInitHandle(u32 contentId, CNTHandleDVD* cntHandle, MEMAllocator* allocator) {
|
||||
char path[32];
|
||||
s32 entryNum;
|
||||
|
||||
sprintf(path, "/content%d", contentId);
|
||||
entryNum = DVDConvertPathToEntrynum(path);
|
||||
if (entryNum < 0) {
|
||||
OSReport("Warning: CNTInitHandle(): directory '%s' is not found under '/'\n", path);
|
||||
return CNT_RESULT_INVALID;
|
||||
}
|
||||
|
||||
cntHandle->index = contentId;
|
||||
cntHandle->rootDir = entryNum;
|
||||
cntHandle->currDir = entryNum;
|
||||
return CNT_RESULT_OK;
|
||||
}
|
||||
|
||||
typedef struct FSTEntry {
|
||||
u32 isDirAndStringOff; // 0x00
|
||||
|
||||
@@ -31,8 +31,6 @@ char scCntCacheSpaceNl[3] = {0x20, 0x0a, 0x00};
|
||||
|
||||
extern void _savegpr_23();
|
||||
extern void _restgpr_23();
|
||||
extern void _savegpr_26();
|
||||
extern void _restgpr_26();
|
||||
|
||||
OSMutex _CNTCACHEMutex;
|
||||
long long _CNTCACHEUnused816997A8;
|
||||
@@ -263,254 +261,102 @@ void _CNTCACHEDeleteTitle() {
|
||||
}
|
||||
}
|
||||
|
||||
asm int _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
|
||||
clrlwi r11, r1, 0x1b
|
||||
mr r12, r1
|
||||
subfic r11, r11, -0x2100
|
||||
stwux r1, r1, r11
|
||||
mflr r0
|
||||
lis r5, scCntCacheTitleDataFmt@ha
|
||||
stw r0, 4(r12)
|
||||
li r0, 1
|
||||
addi r5, r5, scCntCacheTitleDataFmt@l
|
||||
stw r31, -4(r12)
|
||||
stw r30, -8(r12)
|
||||
mr r30, r3
|
||||
addi r3, r1, 0x40
|
||||
stw r29, -0xc(r12)
|
||||
mr r29, r4
|
||||
li r4, -1
|
||||
stw r0, 0x20(r1)
|
||||
and r6, r30, r4
|
||||
and r7, r29, r4
|
||||
li r4, 0x40
|
||||
stw r0, 0x24(r1)
|
||||
crclr 4*cr1+eq
|
||||
bl snprintf
|
||||
addi r3, r1, 0x40
|
||||
addi r4, r1, 0x20
|
||||
addi r5, r1, 0x24
|
||||
bl NANDSecretGetUsage
|
||||
cmpwi r3, -0xc
|
||||
mr r4, r3
|
||||
bne L_418
|
||||
li r4, 2
|
||||
b L_444
|
||||
L_418:
|
||||
cmpwi r3, 0
|
||||
blt L_444
|
||||
lwz r0, 0x24(r1)
|
||||
cmplwi r0, 1
|
||||
bne L_440
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_440
|
||||
li r4, 1
|
||||
b L_444
|
||||
L_440:
|
||||
li r4, 0
|
||||
L_444:
|
||||
cmpwi r4, 1
|
||||
bne L_4bc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
addi r31, r1, 0x80
|
||||
addi r6, r1, 0x28
|
||||
li r5, 0
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
beq L_470
|
||||
b L_4c0
|
||||
L_470:
|
||||
lwz r0, 0x28(r1)
|
||||
cmplwi r0, 0x2060
|
||||
ble L_484
|
||||
li r3, -0x400
|
||||
b L_4c0
|
||||
L_484:
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
mr r5, r31
|
||||
addi r6, r1, 0x28
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
beq L_4a4
|
||||
b L_4c0
|
||||
L_4a4:
|
||||
lhz r0, 0xd8(r1)
|
||||
rlwinm. r0, r0, 0x18, 0x18, 0x1f
|
||||
bne L_4b8
|
||||
li r4, 1
|
||||
b L_4bc
|
||||
L_4b8:
|
||||
li r4, 0
|
||||
L_4bc:
|
||||
mr r3, r4
|
||||
L_4c0:
|
||||
lwz r10, 0(r1)
|
||||
lwz r0, 4(r10)
|
||||
lwz r31, -4(r10)
|
||||
lwz r30, -8(r10)
|
||||
lwz r29, -0xc(r10)
|
||||
mtlr r0
|
||||
mr r1, r10
|
||||
blr
|
||||
static s32 GetSaveDataUsage(ESTitleId titleId) {
|
||||
s32 ret = -1;
|
||||
char nandPath[64] ALIGN32;
|
||||
u32 usedBlocks = 1;
|
||||
u32 usedINodes = 1;
|
||||
|
||||
snprintf(nandPath, (int)sizeof(nandPath), scCntCacheTitleDataFmt, NANDTitleIdHi(titleId), NANDTitleIdLo(titleId));
|
||||
ret = NANDSecretGetUsage(nandPath, &usedBlocks, &usedINodes);
|
||||
|
||||
if (ret == NAND_RESULT_NOEXISTS) {
|
||||
ret = 2;
|
||||
} else if (ret >= NAND_RESULT_OK) {
|
||||
if (usedINodes == 1 && usedBlocks == 0) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
asm void _CNTCACHEDeleteContent() {
|
||||
clrlwi r11, r1, 0x1b
|
||||
mr r12, r1
|
||||
subfic r11, r11, -0x2100
|
||||
stwux r1, r1, r11
|
||||
mflr r0
|
||||
mr r11, r12
|
||||
stw r0, 4(r12)
|
||||
bl _savegpr_26
|
||||
li r3, 0
|
||||
la r4, scCntCacheSpaceNl
|
||||
bl strtok
|
||||
li r31, 0
|
||||
li r4, 0
|
||||
stw r31, errno(r0)
|
||||
li r5, 0x10
|
||||
bl strtoull
|
||||
lwz r0, errno(r0)
|
||||
mr r29, r4
|
||||
mr r30, r3
|
||||
cmpwi r0, 0
|
||||
bne L_708
|
||||
li r0, -1
|
||||
and r5, r3, r0
|
||||
addis r0, r5, -1
|
||||
cmplwi r0, 5
|
||||
bne L_708
|
||||
addi r28, r1, 0x80
|
||||
addi r6, r1, 0x28
|
||||
li r5, 0
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, -0x6a
|
||||
beq L_708
|
||||
cmpwi r3, 0
|
||||
bne L_708
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
mr r5, r28
|
||||
addi r6, r1, 0x28
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
bne L_708
|
||||
lwz r3, 0x94(r1)
|
||||
rlwinm. r0, r3, 0, 0x1c, 0x1c
|
||||
beq L_6f0
|
||||
rlwinm. r0, r3, 0, 0x1b, 0x1b
|
||||
beq L_6f0
|
||||
li r3, 0
|
||||
la r4, scCntCacheSpaceNl
|
||||
bl strtok
|
||||
li r26, 1
|
||||
lis r27, scCntCacheTitleDataFmt@ha
|
||||
b L_6e8
|
||||
L_5b0:
|
||||
stw r31, errno(r0)
|
||||
li r4, 0
|
||||
li r5, 0xa
|
||||
bl strtoul
|
||||
lwz r0, errno(r0)
|
||||
cmpwi r0, 0
|
||||
bne L_6dc
|
||||
cmplwi r3, 0x1fe
|
||||
bgt L_6dc
|
||||
lhz r0, 0xda(r1)
|
||||
li r4, 0
|
||||
mtctr r0
|
||||
cmplwi r0, 0
|
||||
ble L_6dc
|
||||
L_5e8:
|
||||
add r5, r28, r4
|
||||
lhz r0, 0x60(r5)
|
||||
cmplw r3, r0
|
||||
bne L_6d4
|
||||
lhz r0, 0x62(r5)
|
||||
rlwinm. r0, r0, 0, 0x10, 0x10
|
||||
bne L_6dc
|
||||
lwz r5, 0x5c(r5)
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
bl ES_DeleteContent
|
||||
cmpwi r3, 0
|
||||
bne L_6dc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
addi r6, r1, 0x2c
|
||||
li r5, 0
|
||||
bl ES_ListTitleContentsOnCard
|
||||
cmpwi r3, 0
|
||||
bne L_6dc
|
||||
lwz r0, 0x2c(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_6dc
|
||||
li r0, -1
|
||||
stw r26, 0x20(r1)
|
||||
addi r3, r1, 0x40
|
||||
addi r5, r27, scCntCacheTitleDataFmt@l
|
||||
stw r26, 0x24(r1)
|
||||
and r6, r30, r0
|
||||
and r7, r29, r0
|
||||
li r4, 0x40
|
||||
crclr 4*cr1+eq
|
||||
bl snprintf
|
||||
addi r3, r1, 0x40
|
||||
addi r4, r1, 0x20
|
||||
addi r5, r1, 0x24
|
||||
bl NANDSecretGetUsage
|
||||
cmpwi r3, -0xc
|
||||
mr r0, r3
|
||||
bne L_690
|
||||
li r0, 2
|
||||
b L_6bc
|
||||
L_690:
|
||||
cmpwi r3, 0
|
||||
blt L_6bc
|
||||
lwz r0, 0x24(r1)
|
||||
cmplwi r0, 1
|
||||
bne L_6b8
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_6b8
|
||||
li r0, 1
|
||||
b L_6bc
|
||||
L_6b8:
|
||||
li r0, 0
|
||||
L_6bc:
|
||||
cmpwi r0, 1
|
||||
bne L_6dc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
bl ES_DeleteTitle
|
||||
b L_6dc
|
||||
L_6d4:
|
||||
addi r4, r4, 0x10
|
||||
bdnz L_5e8
|
||||
L_6dc:
|
||||
li r3, 0
|
||||
la r4, scCntCacheSpaceNl
|
||||
bl strtok
|
||||
L_6e8:
|
||||
cmpwi r3, 0
|
||||
bne L_5b0
|
||||
L_6f0:
|
||||
lwz r5, 0x28(r1)
|
||||
addi r3, r1, 0x80
|
||||
li r4, 0
|
||||
addi r0, r5, 0x1f
|
||||
rlwinm r5, r0, 0, 0, 0x1a
|
||||
bl memset
|
||||
L_708:
|
||||
lwz r10, 0(r1)
|
||||
mr r11, r10
|
||||
bl _restgpr_26
|
||||
lwz r0, 4(r10)
|
||||
mtlr r0
|
||||
mr r1, r10
|
||||
blr
|
||||
BOOL _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
|
||||
u8 tmdBuf[OSRoundUp32B(sizeof(ESTmdView))] ALIGN32;
|
||||
u32 tmdSize;
|
||||
ESTmdView* tmd;
|
||||
s32 ret;
|
||||
|
||||
ret = GetSaveDataUsage(titleId);
|
||||
if (ret == 1) {
|
||||
tmd = (ESTmdView*)tmdBuf;
|
||||
ret = ES_GetTmdView(titleId, NULL, &tmdSize);
|
||||
if (ret != ES_ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
if (tmdSize > sizeof(tmdBuf)) {
|
||||
return ES_ERR_MEMORY_ERROR;
|
||||
}
|
||||
ret = ES_GetTmdView(titleId, tmd, &tmdSize);
|
||||
if (ret != ES_ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (((tmd->head.titleVersion >> 8) & 0xFF) == 0) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void _CNTCACHEDeleteContent() {
|
||||
u8 buf[OSRoundUp32B(sizeof(ESTmdView))] ALIGN32;
|
||||
u32 numOnCard;
|
||||
u32 size;
|
||||
ESTitleId titleId;
|
||||
ESTmdView* tmd;
|
||||
ESError result;
|
||||
char* token;
|
||||
|
||||
token = strtok(NULL, scCntCacheSpaceNl);
|
||||
errno = 0;
|
||||
titleId = strtoull(token, NULL, 16);
|
||||
if (errno == 0 && NANDTitleIdHi(titleId) == 0x00010005) {
|
||||
tmd = (ESTmdView*)buf;
|
||||
result = ES_GetTmdView(titleId, NULL, &size);
|
||||
if (result == ES_ERR_DONT_EXISTS) {
|
||||
return;
|
||||
}
|
||||
if (result == ES_ERR_OK && ES_GetTmdView(titleId, tmd, &size) == ES_ERR_OK) {
|
||||
if ((tmd->head.titleType & 8) && (tmd->head.titleType & 0x10)) {
|
||||
token = strtok(NULL, scCntCacheSpaceNl);
|
||||
while (token) {
|
||||
u32 index;
|
||||
u32 i;
|
||||
|
||||
errno = 0;
|
||||
index = strtoul(token, NULL, 10);
|
||||
if (errno == 0 && index <= 510) {
|
||||
for (i = 0; i < tmd->head.numContents; i++) {
|
||||
if (index == tmd->contents[i].index) {
|
||||
if (!(tmd->contents[i].type & 0x8000) &&
|
||||
ES_DeleteContent(titleId, tmd->contents[i].cid) == ES_ERR_OK &&
|
||||
ES_ListTitleContentsOnCard(titleId, NULL, &numOnCard) == ES_ERR_OK &&
|
||||
numOnCard == 0 && GetSaveDataUsage(titleId) == 1) {
|
||||
ES_DeleteTitle(titleId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
token = strtok(NULL, scCntCacheSpaceNl);
|
||||
}
|
||||
}
|
||||
memset(buf, 0, OSRoundUp32B(size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ CXStreamingResult CXReadUncompHuffman(CXUncompContextHuffman* context, const voi
|
||||
|
||||
while (context->bitsLeft) {
|
||||
BOOL currBit = context->bits >> 31;
|
||||
int c = (*(vu8*)context->decodeTable << currBit) & 0x80; // ?
|
||||
int c = (context->decodeTable->raw << currBit) & 0x80;
|
||||
|
||||
context->decodeTable = GetNextNode((CXHuffmanDecodeTableEntry*)context->decodeTable, currBit);
|
||||
context->bits <<= 1;
|
||||
|
||||
@@ -597,11 +597,10 @@ static void cbForStateGettingError(u32 intType) {
|
||||
if (error == REQUEST_ERROR_053000h) {
|
||||
StampCommand(COMMAND_STOP_MOTOR, 0, 0);
|
||||
DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1);
|
||||
return;
|
||||
} else {
|
||||
stateError(NAND_ERROR_GENERIC);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
stateError(NAND_ERROR_GENERIC);
|
||||
return;
|
||||
@@ -1708,12 +1707,11 @@ static void cbForStateBusy(u32 intType) {
|
||||
NumInternalRetry = 0;
|
||||
|
||||
stateReady();
|
||||
return;
|
||||
} else {
|
||||
StampCommand(COMMAND_STOP_MOTOR, 0, 0);
|
||||
DVDLowStopMotor(FALSE, FALSE, cbForStateCheckID1);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (CurrCommand == COMMAND_GET_PARTITION_PARAMS) {
|
||||
@@ -1896,7 +1894,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
|
||||
if (block->state == DVD_STATE_COVER_CLOSED) {
|
||||
retVal = DVD_STATE_BUSY;
|
||||
} else if (((volatile DVDCommandBlock*)block)->state == DVD_STATE_COVER_OPENED) {
|
||||
} else if (block->state == DVD_STATE_COVER_OPENED) {
|
||||
retVal = DVD_STATE_NO_DISK;
|
||||
} else if (executing == &__DVDStopMotorCommandBlock) {
|
||||
next = __DVDGetNextWaitingQueue();
|
||||
@@ -1914,7 +1912,7 @@ s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
retVal = ((volatile DVDCommandBlock*)block)->state;
|
||||
retVal = block->state;
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
@@ -39,6 +39,29 @@ enum {
|
||||
DVD_IOCTLV_GET_NO_DISC_BUFFER_SIZE = 0x92,
|
||||
};
|
||||
|
||||
typedef struct DVDVideoPhysical {
|
||||
u8 data[2048];
|
||||
} DVDVideoPhysical;
|
||||
|
||||
typedef struct DVDVideoDiscKey {
|
||||
u8 data[2048];
|
||||
} DVDVideoDiscKey;
|
||||
|
||||
typedef struct DVDDiskBca {
|
||||
u8 optionalInfo[52];
|
||||
u8 manufacturerCode[2];
|
||||
u8 recorderDeviceCode[2];
|
||||
u8 APMRecorderDeviceCode[1];
|
||||
u8 discManufactureDate[2];
|
||||
u8 discManufactureTime[2];
|
||||
u8 discNumber[3];
|
||||
} DVDDiskBca;
|
||||
|
||||
typedef struct DVDLowDriveSer {
|
||||
u8 data[12];
|
||||
u8 reserved[20];
|
||||
} DVDLowDriveSer;
|
||||
|
||||
typedef struct DVDLowContext {
|
||||
DVDLowCallback callback;
|
||||
int callbackType;
|
||||
@@ -74,7 +97,7 @@ static u32 statusRegister[8] ALIGN32;
|
||||
static u32 coverStatus[8] ALIGN32;
|
||||
static u32 statusRegister[8] ALIGN32;
|
||||
|
||||
static DVDLowContext dvdContexts[4] ALIGN32;
|
||||
static DVDLowContext dvdContexts[4] ALIGN32 = {0};
|
||||
static DVDLowRegValues diRegValCache ALIGN32;
|
||||
static u32 registerBuf[8] ALIGN32;
|
||||
static IOSIoVector ioVec[10] ALIGN32;
|
||||
@@ -99,8 +122,6 @@ static bool requestInProgress;
|
||||
|
||||
#define IS_ALIGNED(addr) (((u32)(addr) & 0x1F) == 0)
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, dvdContexts);
|
||||
|
||||
IOSError doTransactionCallback(IOSError ret, void* context) {
|
||||
DVDLowContext* dvdContext = context;
|
||||
|
||||
@@ -135,7 +156,32 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(doCoverCallback) Error - context mangled!\n");
|
||||
static IOSError doCoverCallback(IOSError ret, void* context) {
|
||||
DVDLowContext* dvdContext;
|
||||
|
||||
requestInProgress = false;
|
||||
dvdContext = (DVDLowContext*)context;
|
||||
if (dvdContext->contextMagic != 0xfeebdaed) {
|
||||
OSReport("(doCoverCallback) Error - context mangled!\n");
|
||||
dvdContext->contextMagic = 0xfeebdaed;
|
||||
goto out;
|
||||
}
|
||||
if (dvdContext->callback != NULL) {
|
||||
s32 callbackArg;
|
||||
callbackInProgress = true;
|
||||
callbackArg = ret;
|
||||
if (breakRequested == true) {
|
||||
breakRequested = false;
|
||||
callbackArg |= 0x00000008;
|
||||
}
|
||||
dvdContext->callback((u32)callbackArg);
|
||||
callbackInProgress = false;
|
||||
}
|
||||
out:
|
||||
dvdContext->inUse = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
IOSError doPrepareCoverRegisterCallback(IOSError ret, void* context) {
|
||||
DVDLowContext* dvdContext;
|
||||
@@ -402,14 +448,65 @@ bool DVDLowOpenPartition(u32 partitionWordOffset, ESTicket* eTicket, u32 numCert
|
||||
return true;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, coverStatus);
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, coverRegister);
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "DVDLowOpenPartitionWithTmdAndTicket");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) eTicket memory is unaligned\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) tmd parameter cannot be NULL\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) tmd memory is unaligned\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(%s) eTicket parameter cannot be NULL\n");
|
||||
bool DVDLowOpenPartitionWithTmdAndTicket(const u32 partitionWordOffset, const ESTicket* const eTicket, const u32 numTmdBytes,
|
||||
const ESTitleMeta* const tmd, const u32 numCertBytes, const u8* const certificates,
|
||||
DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
if (eTicket != NULL && !(((u32)(eTicket) & 0x1F) == 0)) {
|
||||
OSReport("(%s) eTicket memory is unaligned\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
if (certificates != NULL && !(((u32)(certificates) & 0x1F) == 0)) {
|
||||
return false;
|
||||
}
|
||||
if (tmd == NULL) {
|
||||
OSReport("(%s) tmd parameter cannot be NULL\n", __FUNCTION__);
|
||||
return false;
|
||||
} else if (!(((u32)(tmd) & 0x1F) == 0)) {
|
||||
OSReport("(%s) tmd memory is unaligned\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
if (eTicket == NULL) {
|
||||
OSReport("(%s) eTicket parameter cannot be NULL\n", __FUNCTION__);
|
||||
return false;
|
||||
} else if (!(((u32)(eTicket) & 0x1F) == 0)) {
|
||||
OSReport("(%s) eTicket memory is unaligned\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x93;
|
||||
diCommand[freeCommandBuf].arg[0] = partitionWordOffset;
|
||||
ioVec[0].base = (u8*)&(diCommand[freeCommandBuf]);
|
||||
ioVec[0].length = sizeof(DVDLowCommand);
|
||||
ioVec[1].base = (u8*)eTicket;
|
||||
ioVec[1].length = sizeof(ESTicket);
|
||||
ioVec[2].base = (u8*)tmd;
|
||||
ioVec[2].length = numTmdBytes;
|
||||
ioVec[3].base = (u8*)certificates;
|
||||
if (certificates == NULL) {
|
||||
ioVec[3].length = 0;
|
||||
} else {
|
||||
ioVec[3].length = numCertBytes;
|
||||
}
|
||||
ioVec[4].base = (u8*)&(lastTicketError[0]);
|
||||
ioVec[4].length = sizeof(lastTicketError);
|
||||
|
||||
rv = IOS_IoctlvAsync(DiFD, 0x93, 4, 1, ioVec, doTransactionCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowOpenPartition) IOS_IoctlvAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DVDLowOpenPartitionWithTmdAndTicketView(u32 partitionWordOffset, ESTicketView* eTicketView, u32 numTmdBytes, ESTitleMeta* tmd, u32 numCertBytes,
|
||||
u8* certificates, DVDLowCallback callback) {
|
||||
@@ -581,7 +678,49 @@ bool DVDLowGetNoDiscOpenPartitionParams(const u32 partitionWordOffset, ESTicket*
|
||||
return true;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "DVDLowNoDiscOpenPartition");
|
||||
bool DVDLowNoDiscOpenPartition(const ESTicket* const eTicket, const u32 numTmdBytes, const ESTitleMeta* const tmd, const u32 numCertBytes,
|
||||
const u8* const certificates, const u32 dataWordOffset, const u8* const h3HashPtr, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
if (eTicket == NULL || tmd == NULL || certificates == NULL) {
|
||||
OSReport("(%s) Error: NULL pointer argument\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
if (!(((u32)(eTicket) & 0x1F) == 0) || !(((u32)(tmd) & 0x1F) == 0) || !(((u32)(certificates) & 0x1F) == 0) ||
|
||||
!(((u32)(dataWordOffset) & 0x1F) == 0) || !(((u32)(h3HashPtr) & 0x1F) == 0)) {
|
||||
OSReport("(%s) pointer argument is unaligned\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x91;
|
||||
diCommand[freeCommandBuf].arg[0] = dataWordOffset;
|
||||
ioVec[0].base = (u8*)&(diCommand[freeCommandBuf]);
|
||||
ioVec[0].length = sizeof(DVDLowCommand);
|
||||
ioVec[1].base = (u8*)eTicket;
|
||||
ioVec[1].length = sizeof(ESTicket);
|
||||
ioVec[2].base = (u8*)tmd;
|
||||
ioVec[2].length = numTmdBytes;
|
||||
ioVec[3].base = (u8*)certificates;
|
||||
ioVec[3].length = numCertBytes;
|
||||
ioVec[4].base = (u8*)h3HashPtr;
|
||||
ioVec[4].length = (96 * 1024);
|
||||
ioVec[5].base = (u8*)&(lastTicketError[0]);
|
||||
ioVec[5].length = sizeof(u32);
|
||||
|
||||
rv = IOS_IoctlvAsync(DiFD, 0x91, 5, 1, ioVec, doTransactionCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (%s) IOS_IoctlvAsync returned error: %d\n", __FUNCTION__, rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DVDLowClosePartition(DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
@@ -652,12 +791,49 @@ bool DVDLowStopMotor(bool eject, bool saving, DVDLowCallback callback) {
|
||||
return true;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowWaitForCoverClose) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowInquiry) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowRequestError) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(DVDLowSetSpinupFlag): Synch functions can't be called in callbacks\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowNotifyReset) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReset) IOS_IoctlAsync returned error: %d\n");
|
||||
bool DVDLowWaitForCoverClose(DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 2);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x79;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0x79, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), NULL, 0, doCoverCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowWaitForCoverClose) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
static char inquiryErrorMessage[] = "@@@ (DVDLowInquiry) IOS_IoctlAsync returned error: %d\n";
|
||||
static char requestErrorMessage[] = "@@@ (DVDLowRequestError) IOS_IoctlAsync returned error: %d\n";
|
||||
bool DVDLowNotifyReset(void) {
|
||||
IOSError rv;
|
||||
|
||||
if (callbackInProgress == true) {
|
||||
OSReport("(DVDLowSetSpinupFlag): Synch functions can't be called in callbacks\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x7E;
|
||||
|
||||
rv = IOS_Ioctl(DiFD, 0x7E, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), NULL, 0);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowNotifyReset) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
static char resetErrorMessage[] = "@@@ (DVDLowReset) IOS_IoctlAsync returned error: %d\n";
|
||||
|
||||
bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
@@ -673,7 +849,7 @@ bool DVDLowInquiry(DVDDriveInfo* info, DVDLowCallback callback) {
|
||||
ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_INQUIRY, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), info, sizeof(DVDDriveInfo),
|
||||
doTransactionCallback, dvdContext);
|
||||
if (ret != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowInquiry) IOS_IoctlAsync returned error: %d\n", ret);
|
||||
OSReport(inquiryErrorMessage, ret);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
@@ -695,7 +871,7 @@ bool DVDLowRequestError(DVDLowCallback callback) {
|
||||
ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_REQUEST_ERROR, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues),
|
||||
doTransactionCallback, dvdContext);
|
||||
if (ret != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowRequestError) IOS_IoctlAsync returned error: %d\n", ret);
|
||||
OSReport(requestErrorMessage, ret);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
@@ -722,7 +898,7 @@ bool DVDLowReset(DVDLowCallback callback) {
|
||||
|
||||
ret = IOS_IoctlAsync(DiFD, DVD_IOCTL_RESET, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), 0, 0, doTransactionCallback, dvdContext);
|
||||
if (ret != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReset) IOS_IoctlAsync returned error: %d\n", ret);
|
||||
OSReport(resetErrorMessage, ret);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
@@ -754,20 +930,305 @@ bool DVDLowAudioBufferConfig(BOOL enable, u32 size, DVDLowCallback callback) {
|
||||
return true;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(DVDLowGetCoverStatus): Synch functions can't be called in callbacks\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowGetCoverStatus) IOS_Ioctl returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDVD) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDVDConfig) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDvdCopyright) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDvdPhysical) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDvdDiscKey) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReportKey) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowOffset) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowStopLaser) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowReadDiskBca) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowSerMeasControl) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowRequestDiscStatus) IOS_IoctlAsync returned error: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowRequestRetryNumber) IOS_IoctlAsync returned error: %d\n");
|
||||
u32 DVDLowGetCoverStatus(void) {
|
||||
IOSError rv;
|
||||
|
||||
if (callbackInProgress == true) {
|
||||
OSReport("(DVDLowGetCoverStatus): Synch functions can't be called in callbacks\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x88;
|
||||
|
||||
rv = IOS_Ioctl(DiFD, 0x88, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), coverStatus, sizeof(u32) * 8);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowGetCoverStatus) IOS_Ioctl returned error: %d\n", rv);
|
||||
return 0xdeaddead;
|
||||
}
|
||||
|
||||
return coverStatus[0];
|
||||
}
|
||||
bool DVDLowReadDvd(u32 strm, u32 retry, void* destAddr, u32 lengthInSectors, u32 lsn, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xD0;
|
||||
if (strm == 0) {
|
||||
diCommand[freeCommandBuf].arg[0] = 0x0;
|
||||
} else {
|
||||
diCommand[freeCommandBuf].arg[0] = 0x1;
|
||||
}
|
||||
if (retry == 0) {
|
||||
diCommand[freeCommandBuf].arg[1] = 0x0;
|
||||
} else {
|
||||
diCommand[freeCommandBuf].arg[1] = 0x1;
|
||||
}
|
||||
diCommand[freeCommandBuf].arg[2] = lengthInSectors;
|
||||
diCommand[freeCommandBuf].arg[3] = lsn;
|
||||
readLength = lengthInSectors * 2048;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xD0, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), destAddr, lengthInSectors * 2048, doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDVD) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReadDvdConfig(bool set, u32 type, u32 config, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xD1;
|
||||
diCommand[freeCommandBuf].arg[0] = set;
|
||||
diCommand[freeCommandBuf].arg[1] = type;
|
||||
diCommand[freeCommandBuf].arg[2] = config;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xD1, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDVDConfig) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReadDvdCopyright(u32 layer, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x81;
|
||||
diCommand[freeCommandBuf].arg[0] = layer;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0x81, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDvdCopyright) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReadDvdPhysical(DVDVideoPhysical* physical, u32 layer, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x80;
|
||||
diCommand[freeCommandBuf].arg[0] = layer;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0x80, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), physical, sizeof(DVDVideoPhysical), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDvdPhysical) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReadDvdDiscKey(DVDVideoDiscKey* diskKey, u32 layer, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x82;
|
||||
diCommand[freeCommandBuf].arg[0] = layer;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0x82, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), diskKey, sizeof(DVDVideoDiscKey), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDvdDiscKey) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReportKey(DVDVideoReportKey* reportKey, u32 format, u32 lsn, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xA4;
|
||||
diCommand[freeCommandBuf].arg[0] = format >> 16;
|
||||
diCommand[freeCommandBuf].arg[1] = lsn;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xA4, &diCommand[freeCommandBuf], sizeof(DVDLowCommand), reportKey, sizeof(DVDVideoReportKey), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReportKey) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowOffset(u32 subcmd, u32 offset_4_byte, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xD9;
|
||||
if (subcmd == 0) {
|
||||
diCommand[freeCommandBuf].arg[0] = 0x0;
|
||||
} else {
|
||||
diCommand[freeCommandBuf].arg[0] = 0x1;
|
||||
}
|
||||
diCommand[freeCommandBuf].arg[1] = offset_4_byte;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xD9, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowOffset) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowStopLaser(DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xD2;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xD2, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowStopLaser) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowReadDiskBca(DVDDiskBca* diskBca, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xDA;
|
||||
rv =
|
||||
IOS_IoctlAsync(DiFD, 0xDA, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), diskBca, sizeof(DVDDiskBca), doTransactionCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowReadDiskBca) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowSerMeasControl(DVDLowDriveSer* ser, bool clear, bool enable, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xDF;
|
||||
diCommand[freeCommandBuf].arg[0] = clear;
|
||||
diCommand[freeCommandBuf].arg[1] = enable;
|
||||
rv =
|
||||
IOS_IoctlAsync(DiFD, 0xDF, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), ser, sizeof(DVDLowDriveSer), doTransactionCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowSerMeasControl) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowRequestDiscStatus(DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xDB;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xDB, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowRequestDiscStatus) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool DVDLowRequestRetryNumber(DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0xDC;
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0xDC, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), &diRegValCache, sizeof(DVDLowRegValues), doTransactionCallback,
|
||||
dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowRequestRetryNumber) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DVDLowSetMaximumRotation(u32 subcmd, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
@@ -844,8 +1305,26 @@ bool DVDLowSeek(u32 wordOffset, DVDLowCallback callback) {
|
||||
return true;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "(DVDLowGetCoverReg): Synch functions can't be called in callbacks\n");
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowGetCoverReg) IOS_Ioctl returned error: %d\n");
|
||||
u32 DVDLowGetCoverReg(void) {
|
||||
IOSError rv;
|
||||
|
||||
if (callbackInProgress == true) {
|
||||
OSReport("(DVDLowGetCoverReg): Synch functions can't be called in callbacks\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x7A;
|
||||
|
||||
rv = IOS_Ioctl(DiFD, 0x7A, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), coverRegister, sizeof(u32) * 8);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowGetCoverReg) IOS_Ioctl returned error: %d\n", rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
return coverRegister[0];
|
||||
}
|
||||
|
||||
u32 DVDLowGetCoverRegister() {
|
||||
return diRegValCache.diCoverReg;
|
||||
@@ -941,4 +1420,23 @@ BOOL __DVDLowTestAlarm(OSAlarm* alarm) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(dvd_broadway_c, "@@@ (DVDLowEnableDvdVideo) IOS_IoctlAsync returned error: %d\n"); // DVD video...
|
||||
bool DVDLowEnableDvdVideo(const bool enable, DVDLowCallback callback) {
|
||||
DVDLowContext* dvdContext;
|
||||
IOSError rv;
|
||||
|
||||
nextCommandBuf(&freeCommandBuf);
|
||||
diCommand[freeCommandBuf].diCmd = 0x8E;
|
||||
diCommand[freeCommandBuf].arg[0] = enable;
|
||||
requestInProgress = true;
|
||||
dvdContext = newContext(callback, 1);
|
||||
|
||||
rv = IOS_IoctlAsync(DiFD, 0x8E, &(diCommand[freeCommandBuf]), sizeof(DVDLowCommand), NULL, 0, doTransactionCallback, dvdContext);
|
||||
|
||||
if (rv != IPC_RESULT_OK) {
|
||||
OSReport("@@@ (DVDLowEnableDvdVideo) IOS_IoctlAsync returned error: %d\n", rv);
|
||||
dvdContext->inUse = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
while (TRUE) {
|
||||
state = ((DVDCommandBlock*)block)->state;
|
||||
state = block->state;
|
||||
|
||||
if (state == DVD_STATE_IDLE) {
|
||||
retVal = block->transferredSize;
|
||||
|
||||
@@ -29,13 +29,13 @@ typedef struct PFD_SDDRV_FORMAT_DATA {
|
||||
u32 total_sectors;
|
||||
} PFD_SDDRV_FORMAT_DATA;
|
||||
|
||||
PFD_SDDRV_INFO g_pfd_sddrv_info;
|
||||
PFD_SDDEV_STORAGE g_pfd_sddev;
|
||||
volatile PFD_SDDRV_INFO g_pfd_sddrv_info;
|
||||
PFD_SDDEV_STORAGE g_pfd_sddev ATTRIBUTE_ALIGN(32);
|
||||
u8 g_pfd_sddrv_buf[0x200];
|
||||
|
||||
static FAInsertCallback g_attach_func = 0;
|
||||
static FAEjectCallback g_detach_func = 0;
|
||||
u32 g_event;
|
||||
u32 g_event ATTRIBUTE_ALIGN(32);
|
||||
|
||||
extern u8 pfd_get_media_drv_char(FADisk*, s8*, u32);
|
||||
extern void pdm_disk_notify_media_insert(FADisk*);
|
||||
@@ -243,39 +243,23 @@ static inline void clear_mount_flag(void) {
|
||||
g_pfd_sddrv_info.flags &= ~2;
|
||||
}
|
||||
|
||||
static inline u32 pfd_sddrv_flags(const PFD_SDDRV_INFO* info) {
|
||||
return info->flags;
|
||||
}
|
||||
|
||||
static inline SDDev* pfd_sddrv_device(const PFD_SDDRV_INFO* info) {
|
||||
return info->device;
|
||||
}
|
||||
|
||||
static inline FADisk* pfd_sddrv_disk(const PFD_SDDRV_INFO* info) {
|
||||
return info->disk;
|
||||
}
|
||||
|
||||
static inline s8 pfd_sddrv_drive(const PFD_SDDRV_INFO* info) {
|
||||
return info->drive;
|
||||
}
|
||||
|
||||
s32 pfd_st_inter_callback(s32 status, void* data) {
|
||||
s32 result;
|
||||
|
||||
if ((status & 1) != 1) {
|
||||
return 0;
|
||||
}
|
||||
if (pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
|
||||
if (g_pfd_sddrv_info.device != 0) {
|
||||
g_event = 2;
|
||||
result = ISD_RegisterDeviceIntrHandler(g_pfd_sddrv_info.device, (SDDevIntrCallback)pfd_st_removal_callback, &g_event);
|
||||
if (result != 0) {
|
||||
OSReport("ERR:Failed to regist intr handler. pfd_st_inter_callback()\n");
|
||||
}
|
||||
}
|
||||
if (pfd_sddrv_disk(&g_pfd_sddrv_info) != 0) {
|
||||
if (g_pfd_sddrv_info.disk != 0) {
|
||||
update_media_drive();
|
||||
pdm_disk_notify_media_insert(g_pfd_sddrv_info.disk);
|
||||
if (pfd_sddrv_drive(&g_pfd_sddrv_info) != 0 && g_attach_func != 0) {
|
||||
if (g_pfd_sddrv_info.drive != 0 && g_attach_func != 0) {
|
||||
g_attach_func(g_pfd_sddrv_info.drive);
|
||||
}
|
||||
}
|
||||
@@ -291,36 +275,39 @@ s32 pfd_st_removal_callback(s32 status, void* data) {
|
||||
return 0;
|
||||
}
|
||||
g_pfd_sddrv_info.media_inserted = 0;
|
||||
if (g_pfd_sddrv_info.media_inserted == 0 && pfd_sddrv_device(&g_pfd_sddrv_info) != 0) {
|
||||
if (g_pfd_sddrv_info.device != 0) {
|
||||
g_event = 1;
|
||||
result = ISD_RegisterDeviceIntrHandler(g_pfd_sddrv_info.device, (SDDevIntrCallback)pfd_st_inter_callback, &g_event);
|
||||
if (result != 0) {
|
||||
OSReport("ERR:Failed to regist intr handler. pfd_st_removal_callback()\n");
|
||||
}
|
||||
}
|
||||
if (pfd_sddrv_disk(&g_pfd_sddrv_info) != 0) {
|
||||
if (g_pfd_sddrv_info.disk != 0) {
|
||||
update_media_drive();
|
||||
pdm_disk_notify_media_eject(g_pfd_sddrv_info.disk);
|
||||
if (pfd_sddrv_drive(&g_pfd_sddrv_info) != 0 && g_detach_func != 0) {
|
||||
if (g_pfd_sddrv_info.drive != 0 && g_detach_func != 0) {
|
||||
g_detach_func(g_pfd_sddrv_info.drive);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
s32 pfd_sddrv_init(FADisk* disk) {
|
||||
s32 sd_result;
|
||||
SDDev* device;
|
||||
u32 status;
|
||||
|
||||
if (disk == 0) {
|
||||
if (disk == NULL) {
|
||||
return -30;
|
||||
}
|
||||
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 1) != 0) {
|
||||
if ((g_pfd_sddrv_info.flags & 1) != 0) {
|
||||
OSReport("INFO SD Card driver is already initialize. pfd_sddrv_init()\n");
|
||||
if (disk != g_pfd_sddrv_info.disk) {
|
||||
return -44;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
if ((g_pfd_sddrv_info.flags & 4) == 0) {
|
||||
g_pfd_sddrv_info.bytes_per_sector = 0x200;
|
||||
@@ -372,6 +359,7 @@ s32 pfd_sddrv_init(FADisk* disk) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
s32 pfd_sddrv_mount(FADisk* disk) {
|
||||
s32 result;
|
||||
@@ -473,7 +461,7 @@ s32 pfd_sddrv_unmount(FADisk* disk) {
|
||||
if (disk == 0) {
|
||||
return -30;
|
||||
}
|
||||
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 2) != 0) {
|
||||
if ((g_pfd_sddrv_info.flags & 2) != 0) {
|
||||
clear_mount_flag();
|
||||
}
|
||||
return 0;
|
||||
@@ -485,7 +473,7 @@ s32 pfd_sddrv_finalize(FADisk* disk) {
|
||||
if (disk == 0) {
|
||||
return -30;
|
||||
}
|
||||
if ((pfd_sddrv_flags(&g_pfd_sddrv_info) & 2) != 0) {
|
||||
if ((g_pfd_sddrv_info.flags & 2) != 0) {
|
||||
clear_mount_flag();
|
||||
}
|
||||
if ((g_pfd_sddrv_info.flags & 1) != 0) {
|
||||
@@ -1371,22 +1359,24 @@ s32 pfd_sddrv_store_fat32_bpb_buf(PFD_SDDRV_FORMAT_DATA* format_data, u8* sector
|
||||
|
||||
static s32 pfd_sddrv_store_fat32_reserved_buf(u8* sector_buffer) {
|
||||
PFD_SDDRV_RESERVED_BOOT_SECTOR* reserved_boot_sector;
|
||||
s32 result = -30;
|
||||
|
||||
if (sector_buffer != 0) {
|
||||
pf_memset(sector_buffer, 0, 0x200);
|
||||
reserved_boot_sector = (PFD_SDDRV_RESERVED_BOOT_SECTOR*)sector_buffer;
|
||||
if (((u32)reserved_boot_sector->signature.bytes & 1) != 0) {
|
||||
reserved_boot_sector->signature.bytes[0] = 0x55;
|
||||
reserved_boot_sector->signature.bytes[1] = 0xaa;
|
||||
} else {
|
||||
reserved_boot_sector->signature.value = 0x55aa;
|
||||
}
|
||||
result = 0;
|
||||
pf_memset(sector_buffer, 0, 0x200);
|
||||
reserved_boot_sector = (PFD_SDDRV_RESERVED_BOOT_SECTOR*)sector_buffer;
|
||||
if (((u32)reserved_boot_sector->signature.bytes & 1) != 0) {
|
||||
reserved_boot_sector->signature.bytes[0] = 0x55;
|
||||
reserved_boot_sector->signature.bytes[1] = 0xaa;
|
||||
} else {
|
||||
reserved_boot_sector->signature.value = 0x55aa;
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline s32 pfd_sddrv_write_sector(u32 sector) {
|
||||
return ISD_WriteBlock(g_pfd_sddrv_info.device, sector, g_pfd_sddrv_buf, 1);
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
PFD_SDDRV_FORMAT_DATA format_data;
|
||||
s32 result;
|
||||
@@ -1408,12 +1398,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
if (g_pfd_sddrv_info.media_ejected != 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 6, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 6);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
@@ -1429,12 +1419,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
if (g_pfd_sddrv_info.media_ejected != 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 1, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 1);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 7, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 7);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
@@ -1451,12 +1441,12 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
if (g_pfd_sddrv_info.media_ejected != 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 2, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 2);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, format_data.partition_start_sector + 8, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(format_data.partition_start_sector + 8);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write BPB fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
@@ -1472,13 +1462,14 @@ s32 pfd_sddrv_build_fat32_mbr_bpb(u32 total_sectors) {
|
||||
if (g_pfd_sddrv_info.media_ejected != 0) {
|
||||
return -33;
|
||||
}
|
||||
result = ISD_WriteBlock(g_pfd_sddrv_info.device, 0, g_pfd_sddrv_buf, 1);
|
||||
result = pfd_sddrv_write_sector(0);
|
||||
if (result != 0) {
|
||||
OSReport("ERR Failed to write MBR fields. ISD_WriteBlock()\n");
|
||||
return -36;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
s32 pfd_sddrv_full_format(void) {
|
||||
FADiskInfo geometry;
|
||||
|
||||
@@ -7,14 +7,12 @@
|
||||
static u32 IpcNumPendingReqs = 0;
|
||||
static u32 IpcNumUnIssuedReqs = 0;
|
||||
|
||||
static s32 IpcFdArray[MAX_REQUEST];
|
||||
static s32 IpcFdArray[MAX_REQUEST] = {0};
|
||||
static u32 IpcReqPtrArray[MAX_REQUEST];
|
||||
|
||||
static void AddReqInfo(void* ptr, s32 fd);
|
||||
static void DelReqInfo(void* ptr, s32 fd);
|
||||
|
||||
DECOMP_FORCE_ACTIVE(ipcProfile_c, IpcFdArray); // Force `IpcFdArray` to be first
|
||||
|
||||
void IPCiProfInit() {
|
||||
u32 i;
|
||||
|
||||
|
||||
@@ -19,14 +19,222 @@
|
||||
|
||||
|
||||
/* some string pooling (the first one is used but is just pooled first...)*/
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "\nOSExec(): Failed to exec %d in %d\n");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "\nOSExec(): The specified game doesn't exist in the disc\n");
|
||||
static char execFailure[] = "\nOSExec(): Failed to exec %d in %d\n";
|
||||
|
||||
extern BOOL __OSInIPL;
|
||||
extern BOOL __OSInNandBoot;
|
||||
|
||||
BOOL __OSInReboot;
|
||||
|
||||
static volatile u32 DVDLowIntType;
|
||||
static u32 DesiredPartitionType;
|
||||
|
||||
extern void IPCReInit(void);
|
||||
extern s32 IPCCltReInit(void);
|
||||
|
||||
static void ExecLowCallback(u32 intType) {
|
||||
DVDLowIntType = intType;
|
||||
}
|
||||
|
||||
static BOOL ExecLowOk(u32 line) {
|
||||
while (DVDLowIntType == 0) {
|
||||
}
|
||||
|
||||
if (DVDLowIntType != DVD_INTTYPE_TC) {
|
||||
OSReport(execFailure, DVDLowIntType, line);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DVDLowIntType = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void __OSLaunchNextFirmware(void) {
|
||||
u8 i;
|
||||
s32 rc = -1;
|
||||
u32 ticketCnt = 1;
|
||||
ESTicketView* ticket;
|
||||
ESTicketView* diTicket;
|
||||
ESTitleId version = 0x0000000100000003;
|
||||
u32 mem2Size;
|
||||
u32 mem2End;
|
||||
DVDGameTOC* gameToc;
|
||||
DVDPartitionInfo* partInfo;
|
||||
DVDPartitionInfo* bootPart;
|
||||
DVDPartitionInfo* partPtr;
|
||||
ESTitleMeta* tmd;
|
||||
u32 numTmdBytes = 0;
|
||||
|
||||
gameToc = (DVDGameTOC*)OSAllocFromMEM1ArenaLo(OSRoundUp32B(sizeof(DVDGameTOC)), DEFAULT_ALIGN);
|
||||
partInfo = (DVDPartitionInfo*)OSAllocFromMEM1ArenaLo(OSRoundUp32B(sizeof(DVDPartitionInfo) * 256), DEFAULT_ALIGN);
|
||||
tmd = (ESTitleMeta*)OSAllocFromMEM1ArenaLo(OSRoundUp32B(sizeof(ESTitleMeta)), 64);
|
||||
diTicket = (ESTicketView*)OSAllocFromMEM1ArenaLo(OSRoundUp32B(sizeof(ESTicketView)), DEFAULT_ALIGN);
|
||||
|
||||
if (DesiredPartitionType == __OSLaunchPartitionType && *(u32*)OSPhysicalToCached(OS_ADDR_BOOT_PART_OFFSET) != 0) {
|
||||
rc = ESP_InitLib();
|
||||
if (rc == ES_ERR_OK) {
|
||||
rc = ESP_DiGetTicketView(NULL, diTicket);
|
||||
}
|
||||
if (rc == ES_ERR_OK) {
|
||||
rc = ESP_DiGetTmd(NULL, &numTmdBytes);
|
||||
}
|
||||
if (rc == ES_ERR_OK) {
|
||||
rc = ESP_DiGetTmd(tmd, &numTmdBytes);
|
||||
}
|
||||
ESP_CloseLib();
|
||||
|
||||
{
|
||||
OSPlayTimeType playType = OS_PLAYTIME_PERMANENT;
|
||||
u32 remain = 0xFFFFFFFF;
|
||||
|
||||
if (__OSGetPlayTime(diTicket, &playType, &remain) == ES_ERR_OK && playType == OS_PLAYTIME_TIME_LIMIT && remain == 0) {
|
||||
__OSWriteExpiredFlag();
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rc == ES_ERR_OK) {
|
||||
bootPart = partInfo;
|
||||
bootPart->partitionType = __OSLaunchPartitionType;
|
||||
bootPart->partition = (DVDGamePartition*)*(u32*)OSPhysicalToCached(OS_ADDR_BOOT_PART_OFFSET);
|
||||
} else {
|
||||
DVDLowIntType = 0;
|
||||
DVDLowClosePartition(ExecLowCallback);
|
||||
if (!ExecLowOk(0x378)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
DVDLowUnencryptedRead(gameToc, OSRoundUp32B(sizeof(DVDGameTOC)), 0x40000 >> 2, ExecLowCallback);
|
||||
if (!ExecLowOk(0x382)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
DVDLowUnencryptedRead(partInfo, OSRoundUp32B(sizeof(DVDPartitionInfo) * 256), (u32)gameToc->partitionInfo, ExecLowCallback);
|
||||
if (!ExecLowOk(0x38E)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
bootPart = NULL;
|
||||
partPtr = partInfo;
|
||||
for (i = 0; i < gameToc->partitionCount; i++) {
|
||||
if (partPtr->partitionType == DesiredPartitionType) {
|
||||
bootPart = partPtr;
|
||||
}
|
||||
partPtr++;
|
||||
}
|
||||
|
||||
if (bootPart == NULL) {
|
||||
gameToc++;
|
||||
partPtr = partInfo + 4;
|
||||
for (i = 0; i < gameToc->partitionCount; i++) {
|
||||
if (partPtr->partitionType == DesiredPartitionType) {
|
||||
bootPart = partPtr;
|
||||
}
|
||||
partPtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (bootPart == NULL) {
|
||||
OSReport("\nOSExec(): The specified game doesn't exist in the disc\n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
__OSLaunchPartitionType = bootPart->partitionType;
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_BOOT_PART_OFFSET) = (u32)bootPart->partition;
|
||||
|
||||
DVDLowIntType = 0;
|
||||
if (__OSLockedAppType == OS_APP_TYPE_DVD) {
|
||||
DVDLowOpenPartitionWithTmdAndTicketView((u32)bootPart->partition, diTicket, numTmdBytes, tmd, 0, NULL, ExecLowCallback);
|
||||
} else {
|
||||
DVDLowOpenPartition((u32)bootPart->partition, NULL, 0, NULL, tmd, ExecLowCallback);
|
||||
}
|
||||
if (!ExecLowOk(0x3CB)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
DVDLowClosePartition(ExecLowCallback);
|
||||
if (!ExecLowOk(0x3D5)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
}
|
||||
|
||||
version = tmd->head.sysVersion;
|
||||
|
||||
rc = ESP_InitLib();
|
||||
if (rc != ES_ERR_OK) {
|
||||
OSReport(execFailure, rc, 0x3E0);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
rc = ESP_GetTicketViews(version, NULL, &ticketCnt);
|
||||
if (ticketCnt != 1 || rc != ES_ERR_OK) {
|
||||
OSReport(execFailure, rc, 0x3E9);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
ticket = (ESTicketView*)OSAllocFromMEM1ArenaLo(OSRoundUp32B(sizeof(ESTicketView) * ticketCnt), DEFAULT_ALIGN);
|
||||
rc = ESP_GetTicketViews(version, ticket, &ticketCnt);
|
||||
if (rc != ES_ERR_OK) {
|
||||
OSReport(execFailure, rc, 0x3F2);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
DVDLowFinalize();
|
||||
|
||||
mem2Size = *(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE);
|
||||
mem2End = *(u32*)OSPhysicalToCached(OS_ADDR_ACCESSIBLE_MEM2);
|
||||
DCStoreRange(OSPhysicalToCached(OS_ADDR_PHYSICAL_MEM1_SIZE), OS_ADDR_MEMORY_MAP_SIZE);
|
||||
|
||||
rc = ESP_LaunchTitle(version, ticket);
|
||||
if (rc != ES_ERR_OK) {
|
||||
OSReport(execFailure, rc, 0x402);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
ESP_CloseLib();
|
||||
DCInvalidateRange(OSPhysicalToCached(OS_ADDR_PHYSICAL_MEM1_SIZE), OS_ADDR_MEMORY_MAP_SIZE);
|
||||
|
||||
if (mem2Size < *(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE)) {
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_ACCESSIBLE_MEM2) =
|
||||
mem2Size - (*(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE) - *(u32*)OSPhysicalToCached(OS_ADDR_ACCESSIBLE_MEM2));
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM2_END) =
|
||||
mem2Size - (*(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE) - *(u32*)OSPhysicalToCached(OS_ADDR_AVAILABLE_MEM2_END));
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_IPC_BUFFER_START) =
|
||||
mem2Size - (*(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE) - *(u32*)OSPhysicalToCached(OS_ADDR_IPC_BUFFER_START));
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_IPC_BUFFER_END) =
|
||||
mem2Size - (*(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE) - *(u32*)OSPhysicalToCached(OS_ADDR_IPC_BUFFER_END));
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_SIMULATED_MEM2_SIZE) = mem2Size;
|
||||
}
|
||||
|
||||
if (mem2End < *(u32*)OSPhysicalToCached(OS_ADDR_ACCESSIBLE_MEM2)) {
|
||||
__OSInitMemoryProtection();
|
||||
}
|
||||
|
||||
__OSInitIPCBuffer();
|
||||
IPCReInit();
|
||||
IPCCltReInit();
|
||||
|
||||
DVDLowInit();
|
||||
DVDLowIntType = 0;
|
||||
{
|
||||
DVDDiskID diskId;
|
||||
DVDLowReadDiskID(&diskId, ExecLowCallback);
|
||||
}
|
||||
if (!ExecLowOk(0x42E)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
if (__OSLockedAppType == OS_APP_TYPE_DVD) {
|
||||
DVDLowOpenPartitionWithTmdAndTicketView((u32)bootPart->partition, diTicket, numTmdBytes, tmd, 0, NULL, ExecLowCallback);
|
||||
} else {
|
||||
DVDLowOpenPartition((u32)bootPart->partition, NULL, 0, NULL, tmd, ExecLowCallback);
|
||||
}
|
||||
if (!ExecLowOk(0x445)) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
}
|
||||
|
||||
#define BI2_ROUND(x, a) (((x) & ~((a) - 1)))
|
||||
|
||||
BOOL PackArgs(void* addr, int argc, char** argv) {
|
||||
@@ -384,13 +592,13 @@ void LaunchCommon(ESTitleId titleId, u32 launchArg, const char** argv, BOOL laun
|
||||
} else {
|
||||
ret = ESP_InitLib();
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("\nOSExec(): Failed to exec %d in %d\n", ret, 1712);
|
||||
OSReport(execFailure, ret, 1712);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
ret = ESP_GetTitleId(&title);
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("\nOSExec(): Failed to exec %d in %d\n", ret, 1720);
|
||||
OSReport(execFailure, ret, 1720);
|
||||
__OSHotResetForError();
|
||||
}
|
||||
}
|
||||
@@ -493,11 +701,95 @@ void __OSReturnToMenul(u32 launchArg, const char* arg0, ...) {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
/* more string pooling...*/
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "OSLaunchDisk(): You can't call this API from DVD application. \n");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "OSLaunchDisk(): You must call DVDPrepareDisk before launching disc.\n");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "OSLaunchDisk(): Specified id is different from one specified to DVDPrepareDisk.\n");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "0000000000000000");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "2004/02/01");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "OSLaunchPartition(): You can't call this API from NAND application. \n");
|
||||
DECOMP_FORCE_ACTIVE(OSExec_c, "OSLaunchPartition(): Specified title ID is not DISC application. \n");
|
||||
static void OSLaunchDiskv(const DVDDiskID* id, u32 launchCode, const char** argv) {
|
||||
char idBuf[20];
|
||||
ESTitleId titleId ALIGN32;
|
||||
|
||||
if (OSGetAppType() == OS_APP_TYPE_DVD) {
|
||||
OSReport("OSLaunchDisk(): You can't call this API from DVD application. \n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
if (DVDGetCurrentDiskID()->gameName[0] == '\0') {
|
||||
OSReport("OSLaunchDisk(): You must call DVDPrepareDisk before launching disc.\n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
if (id != NULL && !DVDCompareDiskID(id, DVDGetCurrentDiskID())) {
|
||||
OSReport("OSLaunchDisk(): Specified id is different from one specified to DVDPrepareDisk.\n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
strcpy(idBuf, "0000000000000000");
|
||||
if (argv != NULL && argv[0] != NULL) {
|
||||
strncpy(idBuf, argv[0], 16);
|
||||
idBuf[16] = '\0';
|
||||
}
|
||||
if (launchCode == 0xA0000000 && ESP_GetTitleId(&titleId) == ES_ERR_OK) {
|
||||
sprintf(idBuf, "%016llx", titleId);
|
||||
}
|
||||
if (idBuf[0] == '\0') {
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
DesiredPartitionType = 0;
|
||||
__OSLaunchNextFirmware();
|
||||
}
|
||||
|
||||
void OSLaunchDisk(const DVDDiskID* id, u32 launchCode, const char* firstArg, ...) {
|
||||
char** argv;
|
||||
|
||||
__COPY_VA_ARGS_TO_ARRAY(firstArg, argv);
|
||||
OSLaunchDiskv(id, launchCode, (const char**)argv);
|
||||
}
|
||||
|
||||
BOOL IsNewApploader(const char* date) {
|
||||
if (strncmp(date, "2004/02/01", 10) > 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void OSLaunchPartitionv(ESTitleId titleId, u32 launchCode, const char** argv) {
|
||||
u8* bi2;
|
||||
int argc = 0;
|
||||
int i;
|
||||
char** argList;
|
||||
|
||||
if (OSGetAppType() != OS_APP_TYPE_DVD) {
|
||||
OSReport("OSLaunchPartition(): You can't call this API from NAND application. \n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
if (NANDTitleIdHi(titleId) != 0x00010000) {
|
||||
OSReport("OSLaunchPartition(): Specified title ID is not DISC application. \n");
|
||||
__OSReturnToMenuForError();
|
||||
}
|
||||
|
||||
if (argv != NULL) {
|
||||
while (argv[argc] != NULL) {
|
||||
argc++;
|
||||
}
|
||||
}
|
||||
|
||||
bi2 = (u8*)OSAllocFromMEM1ArenaLo(0x2000, 64);
|
||||
argList = (char**)OSAllocFromMEM1ArenaLo((argc + 1) * sizeof(char*), 1);
|
||||
for (i = 0; i < argc; i++) {
|
||||
argList[i] = (char*)argv[i];
|
||||
}
|
||||
argList[argc] = NULL;
|
||||
PackArgs(bi2, argc, argList);
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_NAND_TITLE_LAUNCH_CODE) = launchCode;
|
||||
*(u32*)OSPhysicalToCached(OS_ADDR_LAUNCH_EXEC_PARAMS) = (u32)bi2;
|
||||
|
||||
DesiredPartitionType = NANDTitleIdLo(titleId);
|
||||
__OSLaunchNextFirmware();
|
||||
}
|
||||
|
||||
void OSLaunchPartition(ESTitleId titleId, u32 launchCode, const char* firstArg, ...) {
|
||||
char** argv;
|
||||
|
||||
__COPY_VA_ARGS_TO_ARRAY(firstArg, argv);
|
||||
OSLaunchPartitionv(titleId, launchCode, (const char**)argv);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
#include <private/os.h>
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/nwc24/NWC24Err.h>
|
||||
|
||||
NWC24Err NWC24iPrepareShutdown(void) NO_INLINE;
|
||||
s32 NWC24SuspendScheduler(void) NO_INLINE;
|
||||
s32 NWC24ResumeScheduler(void) NO_INLINE;
|
||||
|
||||
#include <private/nwc24.h>
|
||||
#include <revolution/nwc24.h>
|
||||
|
||||
static s32 nwc24ShtFd = -1;
|
||||
static s32 nwc24ShtRetryRest;
|
||||
static OSShutdownFunctionInfo ShutdownFuncInfo;
|
||||
|
||||
static NWC24Err CheckCallingStatus(const char* callerName) NO_INLINE;
|
||||
BOOL NWC24Shutdown_(BOOL final, u32 event) NO_INLINE;
|
||||
NWC24Err NWC24iRequestShutdown(u32 event, s32* result) NO_INLINE;
|
||||
NWC24Err NWC24iSetRtcCounter_(s32 rtc, BOOL save) NO_INLINE;
|
||||
|
||||
void __OSInitNet() {
|
||||
NWC24Err ret;
|
||||
OSIOSRev iosRev;
|
||||
@@ -38,11 +52,157 @@ s32 __OSSyncTimeWithNetRM() {
|
||||
return NWC24iSynchronizeRtcCounter(FALSE);
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24iPrepareShutdown");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "/dev/net/kd/request");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24SuspendScheduler");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24ResumeScheduler");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24iRequestShutdown");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24Shutdown_: Give up!\n"); // Give up!
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "NWC24iSetRtcCounter_");
|
||||
DECOMP_FORCE_ACTIVE(OSNet_c, "/dev/net/kd/time");
|
||||
static NWC24Err CheckCallingStatus(const char* callerName) NO_INLINE {
|
||||
if (OSGetCurrentThread() == 0) {
|
||||
return NWC24_ERR_FATAL;
|
||||
}
|
||||
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
DECL_WEAK NWC24Err NWC24iPrepareShutdown(void) NO_INLINE {
|
||||
NWC24Err result = NWC24_OK;
|
||||
|
||||
ShutdownFuncInfo.func = NWC24Shutdown_;
|
||||
ShutdownFuncInfo.priority = 110;
|
||||
OSRegisterShutdownFunction(&ShutdownFuncInfo);
|
||||
|
||||
if (nwc24ShtFd < 0) {
|
||||
result = NWC24iOpenResourceManager("NWC24iPrepareShutdown", "/dev/net/kd/request", &nwc24ShtFd, 1);
|
||||
}
|
||||
|
||||
nwc24ShtRetryRest = 5;
|
||||
|
||||
if (result == NWC24_OK) {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_WEAK s32 NWC24SuspendScheduler(void) NO_INLINE {
|
||||
static u8 susResult[0x20] ALIGN32;
|
||||
NWC24Err result;
|
||||
NWC24Err closeResult;
|
||||
s32 fd;
|
||||
|
||||
result = CheckCallingStatus("NWC24SuspendScheduler");
|
||||
if (result < NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = NWC24iOpenResourceManager("NWC24SuspendScheduler", "/dev/net/kd/request", &fd, 0);
|
||||
if (result >= NWC24_OK) {
|
||||
result = NWC24iIoctlResourceManager("NWC24SuspendScheduler", fd, NWC24_IOCTL_SUSPEND_SCHEDULER, NULL, 0, susResult, sizeof(susResult));
|
||||
if (result >= NWC24_OK) {
|
||||
result = *(NWC24Err*)susResult;
|
||||
}
|
||||
|
||||
closeResult = NWC24iCloseResourceManager("NWC24SuspendScheduler", fd);
|
||||
if (closeResult < NWC24_OK) {
|
||||
result = closeResult;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DECL_WEAK s32 NWC24ResumeScheduler(void) NO_INLINE {
|
||||
static u8 resResult[0x20] ALIGN32;
|
||||
NWC24Err result;
|
||||
NWC24Err closeResult;
|
||||
s32 fd;
|
||||
|
||||
result = CheckCallingStatus("NWC24ResumeScheduler");
|
||||
if (result < NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = NWC24iOpenResourceManager("NWC24ResumeScheduler", "/dev/net/kd/request", &fd, 0);
|
||||
if (result >= NWC24_OK) {
|
||||
result = NWC24iIoctlResourceManager("NWC24ResumeScheduler", fd, NWC24_IOCTL_RESUME_SCHEDULER, NULL, 0, resResult, sizeof(resResult));
|
||||
if (result >= NWC24_OK) {
|
||||
result = *(NWC24Err*)resResult;
|
||||
}
|
||||
|
||||
closeResult = NWC24iCloseResourceManager("NWC24ResumeScheduler", fd);
|
||||
if (closeResult < NWC24_OK) {
|
||||
result = closeResult;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24iRequestShutdown(u32 event, s32* result) NO_INLINE {
|
||||
static u32 shtBuffer[8] ALIGN32;
|
||||
static u32 shtResult[8] ALIGN32;
|
||||
|
||||
shtBuffer[0] = event;
|
||||
return NWC24iIoctlResourceManagerAsync("NWC24iRequestShutdown", nwc24ShtFd, NWC24_IOCTL_SHUTDOWN, shtBuffer, sizeof(shtBuffer), shtResult,
|
||||
sizeof(shtResult), result);
|
||||
}
|
||||
|
||||
BOOL NWC24Shutdown_(BOOL final, u32 event) NO_INLINE {
|
||||
static BOOL shuttingdown;
|
||||
static s32 result;
|
||||
|
||||
if (final) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (shuttingdown) {
|
||||
if (NWC24iIsAsyncRequestPending()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (result >= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (nwc24ShtRetryRest > 0) {
|
||||
shuttingdown = FALSE;
|
||||
nwc24ShtRetryRest--;
|
||||
} else {
|
||||
OSReport("NWC24Shutdown_: Give up!\n");
|
||||
return TRUE;
|
||||
}
|
||||
} else if (NWC24iRequestShutdown(event, &result) >= NWC24_OK) {
|
||||
shuttingdown = TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u32 nwc24TimeCommonBuffer[8] ALIGN32;
|
||||
static u32 nwc24TimeCommonResult[8] ALIGN32;
|
||||
|
||||
NWC24Err NWC24iSetRtcCounter_(s32 rtc, BOOL save) NO_INLINE {
|
||||
NWC24Err result;
|
||||
NWC24Err closeResult;
|
||||
s32 fd;
|
||||
|
||||
result = CheckCallingStatus("NWC24iSetRtcCounter_");
|
||||
if (result < NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = NWC24iOpenResourceManager("NWC24iSetRtcCounter_", "/dev/net/kd/time", &fd, 0);
|
||||
if (result >= NWC24_OK) {
|
||||
nwc24TimeCommonBuffer[0] = rtc;
|
||||
nwc24TimeCommonBuffer[1] = save;
|
||||
|
||||
result = NWC24iIoctlResourceManager("NWC24iSetRtcCounter_", fd, NWC24_IOCTL_SET_RTC_COUNTER, nwc24TimeCommonBuffer,
|
||||
sizeof(nwc24TimeCommonBuffer), nwc24TimeCommonResult, sizeof(nwc24TimeCommonResult));
|
||||
if (result >= NWC24_OK) {
|
||||
result = *(s32*)nwc24TimeCommonResult;
|
||||
}
|
||||
|
||||
closeResult = NWC24iCloseResourceManager("NWC24iSetRtcCounter_", fd);
|
||||
if (result >= NWC24_OK) {
|
||||
result = closeResult;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@ static NANDFileInfo FileInfo;
|
||||
static NANDCommandBlock Block;
|
||||
static OSAlarm PlayRecordAlarm;
|
||||
|
||||
DECOMP_FORCE_ACTIVE(OSPlayRecord_c, PlayRecord);
|
||||
|
||||
static BOOL PlayRecordGet = FALSE;
|
||||
static s32 PlayRecordState = OS_RECORD_STATE_STOPPED;
|
||||
static BOOL PlayRecordError = FALSE;
|
||||
|
||||
@@ -63,11 +63,39 @@ vBOOL __OSIsReturnToIdle;
|
||||
}
|
||||
|
||||
// They're used but pooled first.
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "OSReset.c");
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "__OSHotReset(): Falied to reset system.\n");
|
||||
static char resetSource[] = "OSReset.c";
|
||||
static char hotResetFailure[] = "__OSHotReset(): Falied to reset system.\n";
|
||||
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "OSReturnToMenu(): Falied to boot system menu.\n");
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "OSReturnToDataManager(): Falied to boot system menu.\n");
|
||||
void __OSReturnToMenu(u8 menuMode) {
|
||||
OSStateFlags state;
|
||||
|
||||
__OSStopPlayRecord();
|
||||
__OSUnRegisterStateEvent();
|
||||
__DVDPrepareReset();
|
||||
__OSReadStateFlags(&state);
|
||||
state.discState = __OSGetDiscState(state.discState);
|
||||
state.shutdownType = OS_STATE_FLAGS_SHUTDOWN_RETURN_MENU;
|
||||
state.menuMode = menuMode;
|
||||
__OSClearRTCFlags();
|
||||
__OSWriteStateFlags(&state);
|
||||
OSDisableScheduler();
|
||||
__OSShutdownDevices(OS_SHUTDOWN_RETURN_MENU);
|
||||
OSEnableScheduler();
|
||||
__OSLaunchMenu();
|
||||
OSDisableScheduler();
|
||||
__VISetRGBModeImm();
|
||||
__OSHotResetForError();
|
||||
}
|
||||
|
||||
DECL_WEAK void OSReturnToMenu(void) {
|
||||
__OSReturnToMenu(OS_STATE_FLAGS_MENUMODE_MENU);
|
||||
OSPanic(resetSource, __LINE__, "OSReturnToMenu(): Falied to boot system menu.\n");
|
||||
}
|
||||
|
||||
void OSReturnToDataManager(void) {
|
||||
__OSReturnToMenu(OS_STATE_FLAGS_MENUMODE_DATA_MANAGER);
|
||||
OSPanic(resetSource, __LINE__, "OSReturnToDataManager(): Falied to boot system menu.\n");
|
||||
}
|
||||
|
||||
enum {
|
||||
LAUNCH_ARG_MENU = 0,
|
||||
@@ -212,7 +240,7 @@ void OSReturnToSetting(u8 setting) {
|
||||
}
|
||||
default: {
|
||||
OSReport("OSReturnToSetting(): You can't specify %d. \n", setting);
|
||||
OSHalt("", 910);
|
||||
OSPanic(resetSource, 910, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +262,7 @@ void __OSReturnToMenuForError() {
|
||||
__VISetRGBModeImm();
|
||||
__OSHotResetForError();
|
||||
|
||||
OSHalt("__OSReturnToMenu(): Falied to boot system menu.\n", 949);
|
||||
OSPanic(resetSource, 949, "__OSReturnToMenu(): Falied to boot system menu.\n");
|
||||
}
|
||||
|
||||
void __OSHotResetForError() {
|
||||
@@ -242,7 +270,7 @@ void __OSHotResetForError() {
|
||||
__OSInitSTM();
|
||||
}
|
||||
__OSHotReset();
|
||||
OSHalt("__OSHotReset(): Falied to reset system.\n", 973);
|
||||
OSPanic(resetSource, 973, hotResetFailure);
|
||||
}
|
||||
|
||||
u32 OSGetResetCode() {
|
||||
@@ -255,5 +283,11 @@ u32 OSGetResetCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "OSResetSystem() is obsoleted. It doesn't work any longer.\n");
|
||||
DECOMP_FORCE_ACTIVE(OSReset_c, "OSSetBootDol() is obsoleted. It doesn't work any longer.\n");
|
||||
void OSResetSystem(int reset, u32 resetCode, int forceMenu) {
|
||||
OSPanic(resetSource, __LINE__, "OSResetSystem() is obsoleted. It doesn't work any longer.\n");
|
||||
}
|
||||
|
||||
u32 OSSetBootDol(u32 dolOffset) {
|
||||
OSPanic(resetSource, __LINE__, "OSSetBootDol() is obsoleted. It doesn't work any longer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ s32 OSWaitSemaphore(OSSemaphore* sem) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
s32 count;
|
||||
|
||||
while ((count = ((volatile OSSemaphore*)sem)->count) <= 0) {
|
||||
while ((count = sem->count) <= 0) {
|
||||
OSSleepThread(&sem->queue);
|
||||
}
|
||||
sem->count--;
|
||||
@@ -28,7 +28,7 @@ s32 OSSignalSemaphore(OSSemaphore* sem) {
|
||||
s32 count;
|
||||
|
||||
count = sem->count;
|
||||
sem->count++;
|
||||
sem->count = count + 1;
|
||||
|
||||
OSWakeupThread(&sem->queue);
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ static IOSFd sduOpenFD(u32 slot) {
|
||||
switch (ret) {
|
||||
case IPC_RESULT_ACCESS:
|
||||
case IPC_RESULT_EXISTS: {
|
||||
int dummy = 0;
|
||||
ASSERTLINE(ret >= 0, 314);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -37,13 +37,42 @@ typedef struct USBMsg {
|
||||
u16 length; // 0x04
|
||||
} USBMsg;
|
||||
|
||||
typedef struct {
|
||||
u8 bLength;
|
||||
u8 bDescriptorType;
|
||||
u16 bcdUSB;
|
||||
u8 bDeviceClass;
|
||||
u8 bDeviceSubClass;
|
||||
u8 bDeviceProtocol;
|
||||
u8 bMaxPacketSize0;
|
||||
u16 idVendor;
|
||||
u16 idProduct;
|
||||
u16 bcdDevice;
|
||||
u8 iManufacturer;
|
||||
u8 iProduct;
|
||||
u8 iSerialNumber;
|
||||
u8 bNumConfigurations;
|
||||
} USBDeviceDescriptor;
|
||||
|
||||
typedef struct USBDeviceInfo {
|
||||
IOSFd fd;
|
||||
u16 vid;
|
||||
u16 pid;
|
||||
} USBDeviceInfo;
|
||||
|
||||
typedef struct USBIsoTransfer {
|
||||
void* buf;
|
||||
u8 numPackets;
|
||||
u16* packets;
|
||||
} USBIsoTransfer;
|
||||
|
||||
typedef struct USBCommandBlock {
|
||||
USBCallback callback; // 0x00
|
||||
USBIsoCallback isoCallback; // 0x04
|
||||
void* callbackArg; // 0x08
|
||||
void* isoArg; // 0x0C
|
||||
|
||||
char pad_0x10[0x4];
|
||||
void* spare;
|
||||
|
||||
void* clean[USB_NCLEAN_MAX]; // 0x14
|
||||
u32 nclean; // 0x34
|
||||
@@ -51,6 +80,7 @@ typedef struct USBCommandBlock {
|
||||
union {
|
||||
char path[FS_MAX_PATH];
|
||||
USBMsg msg;
|
||||
USBDeviceDescriptor descriptor;
|
||||
}; // 0x40
|
||||
} USBCommandBlock;
|
||||
|
||||
@@ -213,16 +243,40 @@ end:
|
||||
return result;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "OpenDevice\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "OpenDeviceIdsAsync: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "CloseDevice\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "CloseDevice returned: %d\n");
|
||||
IOSError IUSB_OpenDeviceIdsAsync(const char* interface, u16 vid, u16 pid, USBCallback callback, void* callbackArg) {
|
||||
IOSError result;
|
||||
USBCommandBlock* block;
|
||||
|
||||
USB_LOG("OpenDevice\n");
|
||||
block = IOSAlloc(sizeof(USBCommandBlock));
|
||||
if (block == NULL) {
|
||||
USB_ERR("OpenDeviceIdsAsync: Not enough memory\n");
|
||||
return IPC_RESULT_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
memset(block, 0, sizeof(USBCommandBlock));
|
||||
block->callback = callback;
|
||||
block->callbackArg = callbackArg;
|
||||
block->nclean = USB_NCLEAN_CLOSEDEVICE;
|
||||
|
||||
snprintf(block->path, sizeof(block->path), "/dev/usb/%s/%x/%x", interface, vid, pid);
|
||||
USB_LOG("OpenDevice - %s\n", block->path);
|
||||
result = IOS_OpenAsync(block->path, 0, _intrBlkCtrlIsoCb, block);
|
||||
USB_LOG("OpenDevice returned: %d\n", result);
|
||||
if (result < IPC_RESULT_OK) {
|
||||
IOSFree(block);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static char closeDeviceMessage[] = "CloseDevice\n";
|
||||
static char closeDeviceResult[] = "CloseDevice returned: %d\n";
|
||||
|
||||
IOSError IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, void* callbackArg) {
|
||||
IOSError result;
|
||||
USBCommandBlock* block;
|
||||
|
||||
USB_LOG("CloseDevice\n");
|
||||
USB_LOG(closeDeviceMessage);
|
||||
|
||||
block = IOSAlloc(sizeof(USBCommandBlock));
|
||||
if (block == NULL) {
|
||||
@@ -238,7 +292,7 @@ IOSError IUSB_CloseDeviceAsync(s32 fd, USBCallback callback, void* callbackArg)
|
||||
block->nclean = USB_NCLEAN_CLOSEDEVICE;
|
||||
|
||||
result = IOS_CloseAsync(fd, _intrBlkCtrlIsoCb, block);
|
||||
USB_LOG("CloseDevice returned: %d\n", result);
|
||||
USB_LOG(closeDeviceResult, result);
|
||||
|
||||
if (result < 0) {
|
||||
IOSFree(block);
|
||||
@@ -248,8 +302,83 @@ end:
|
||||
return result;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "openDevice: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "getDeviceList: Not enough memory\n");
|
||||
static IOSFd __openDevice(const char* path) {
|
||||
IOSFd rv;
|
||||
char* pathBuf;
|
||||
USBCommandBlock* ctx = IOSAlloc(OSRoundUp32B(sizeof(USBCommandBlock)));
|
||||
|
||||
if (ctx == 0) {
|
||||
USB_ERR("openDevice: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto done;
|
||||
}
|
||||
|
||||
pathBuf = ctx->path;
|
||||
strncpy(pathBuf, path, 64);
|
||||
rv = IOS_Open(pathBuf, 0);
|
||||
IOSFree(ctx);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_GetDeviceList(const char* path, USBDeviceInfo* deviceList, u8 maxDev, u8 deviceClass, u8* numDev) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
IOSIoVector* vector = NULL;
|
||||
u8* smaxDev = NULL;
|
||||
u8* sclass = NULL;
|
||||
u8* snumDev = NULL;
|
||||
IOSFd fd;
|
||||
|
||||
if ((u32)deviceList & 0x1f) {
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto out;
|
||||
}
|
||||
if ((fd = __openDevice(path)) < 0) {
|
||||
rv = fd;
|
||||
goto out;
|
||||
}
|
||||
|
||||
vector = IOSAlloc(OSRoundUp32B(sizeof(IOSIoVector)) * 4);
|
||||
smaxDev = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
sclass = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
snumDev = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
if (NULL == smaxDev || NULL == sclass || NULL == snumDev || NULL == vector) {
|
||||
USB_ERR("getDeviceList: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*smaxDev = maxDev;
|
||||
*sclass = deviceClass;
|
||||
*snumDev = 0;
|
||||
|
||||
vector[0].base = smaxDev;
|
||||
vector[0].length = sizeof(u8);
|
||||
vector[1].base = sclass;
|
||||
vector[1].length = sizeof(u8);
|
||||
vector[2].base = (u8*)snumDev;
|
||||
vector[2].length = sizeof(u8);
|
||||
vector[3].base = (u8*)deviceList;
|
||||
vector[3].length = sizeof(USBDeviceInfo) * maxDev;
|
||||
|
||||
DCInvalidateRange(deviceList, sizeof(USBDeviceInfo) * maxDev);
|
||||
DCInvalidateRange(snumDev, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(sclass, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(smaxDev, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(vector, OSRoundUp32B(sizeof(IOSIoVector)) * 4);
|
||||
|
||||
rv = IOS_Ioctlv(fd, 12, 2, 2, vector);
|
||||
*numDev = *snumDev;
|
||||
IOS_Close(fd);
|
||||
|
||||
out:
|
||||
IOSFree(snumDev);
|
||||
IOSFree(smaxDev);
|
||||
IOSFree(sclass);
|
||||
IOSFree(vector);
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError __IntrBlkMsgInt(s32 fd, u32 endpoint, u32 length, void* buffer, u8 ioctl, USBCallback callback, void* callbackArg, u8 async) {
|
||||
IOSError result;
|
||||
@@ -479,44 +608,397 @@ end_async:
|
||||
return result;
|
||||
}
|
||||
|
||||
IOSError IUSB_ReadCtrlMsgAsync(IOSFd fd, u8 reqType, u8 request, u16 value, u16 index, u16 buflen, char* buf, USBCallback cb, void* cbArg) {
|
||||
DCInvalidateRange(buf, buflen);
|
||||
return __CtrlMsgInt(fd, reqType, request, value, index, buflen, buf, cb, cbArg, 1);
|
||||
}
|
||||
|
||||
IOSError IUSB_WriteCtrlMsgAsync(s32 fd, u8 requestType, u8 request, u16 value, u16 index, u16 length, void* buffer, USBCallback callback,
|
||||
void* callbackArg) {
|
||||
DCFlushRange(buffer, length);
|
||||
return __CtrlMsgInt(fd, requestType, request, value, index, length, buffer, callback, callbackArg, TRUE);
|
||||
}
|
||||
|
||||
// oh my
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "CloseDeviceAsync: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "openDevice: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "getDeviceList: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "getDeviceList: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "__IntrBlkMsgInt: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "intr/blk ioctl returned: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "IntBlkMsgInt (async): Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "intrblkmsg: cb = 0x%x cbArg = 0x%x\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "ctrlmsg: bad data buffer\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Ctrl Msg: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "CtrlMsgInt (async): Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "ctrlmsgint: cb = 0x%x cbArg = 0x%x\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Ctrl Msg async returned: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetStrCb returned: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetStrCb: buf = 0x%x buflen = %u\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Failed to convert buffer from unicode 2 ascii\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "calling cb 0x%x with arg 0x%x\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Failed __CtrlMsg: %d");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Failed to convert unicode 2 ascii\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetStr - _GetStrCb\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, " GetAsciiStrAsync: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "__CtrlMsgInt failed %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDescrCb returned: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDevDescr\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDevDescr: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDevDescr: %d\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDevDescr - _GetDescrCb\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "GetDevDescrAsync: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "DeviceRemovalNotifyAsync\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "packet %u too big: %u\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Invalid parameters for ISO transfer request\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "IUSB_IsoMsgAsync: Not enough memory\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Open(%s) failed\n");
|
||||
DECOMP_FORCE_ACTIVE(usb_c, "Invalid path or devClass in insertion notification call\n");
|
||||
static s8 unicode2ascii(char* tbuf, int buflen) {
|
||||
char buf[128];
|
||||
s8 di, si;
|
||||
|
||||
if (tbuf[1] != 0x03) {
|
||||
di = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (di = 0, si = 2; si < tbuf[0] && si < buflen; si += 2) {
|
||||
if (di >= (sizeof(buf) - 1))
|
||||
break;
|
||||
if (tbuf[si + 1])
|
||||
buf[di++] = '?';
|
||||
else
|
||||
buf[di++] = tbuf[si];
|
||||
}
|
||||
|
||||
buf[di] = 0;
|
||||
memcpy(tbuf, buf, (u32)di);
|
||||
|
||||
out:
|
||||
return di;
|
||||
}
|
||||
|
||||
static void _GetStrCb(IOSError ret, void* ctxt) {
|
||||
IOSError rv = ret;
|
||||
USBCommandBlock* req = (USBCommandBlock*)ctxt;
|
||||
char* buf;
|
||||
u16 buflen;
|
||||
s8 len;
|
||||
|
||||
USB_LOG("GetStrCb returned: %d\n", rv);
|
||||
if (rv <= 0)
|
||||
goto out;
|
||||
|
||||
buf = (char*)req->msg.buffer;
|
||||
buflen = req->msg.length;
|
||||
USB_LOG("GetStrCb: buf = 0x%x buflen = %u\n", buf, buflen);
|
||||
if ((len = unicode2ascii(buf, buflen)) < 0)
|
||||
USB_ERR("Failed to convert buffer from unicode 2 ascii\n");
|
||||
else
|
||||
buf[len] = '\0';
|
||||
|
||||
out:
|
||||
if (req->callback) {
|
||||
USB_LOG("calling cb 0x%x with arg 0x%x\n", req->callback, req->callbackArg);
|
||||
req->callback(ret, req->callbackArg);
|
||||
}
|
||||
IOSFree(req);
|
||||
return;
|
||||
}
|
||||
|
||||
IOSError IUSB_GetAsciiStr(IOSFd fd, u8 ep, u16 index, u16 langId, char* buf, u16 buflen) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
s8 len;
|
||||
|
||||
USB_LOG("GetStr\n");
|
||||
|
||||
DCInvalidateRange(buf, (u32)buflen);
|
||||
rv = __CtrlMsgInt(fd, 0x80, 0x06, (u16)((0x03 << 8) + index), langId, buflen, buf, NULL, NULL, 0);
|
||||
if (rv <= 0) {
|
||||
USB_ERR("Failed __CtrlMsg: %d", rv);
|
||||
goto out;
|
||||
}
|
||||
if ((len = unicode2ascii(buf, buflen)) < 0)
|
||||
USB_ERR("Failed to convert unicode 2 ascii\n");
|
||||
else
|
||||
buf[len] = '\0';
|
||||
|
||||
out:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_GetAsciiStrAsync(IOSFd fd, u8 ep, u16 index, u16 langId, char* buf, u16 buflen, USBCallback cb, void* cbArg) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
USBCommandBlock* req;
|
||||
|
||||
USB_LOG("GetStr - _GetStrCb\n");
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
if (req == 0) {
|
||||
USB_ERR(" GetAsciiStrAsync: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(req, 0, sizeof(USBCommandBlock));
|
||||
|
||||
req->callback = cb;
|
||||
req->callbackArg = cbArg;
|
||||
req->nclean = 0;
|
||||
req->msg.buffer = buf;
|
||||
req->msg.length = buflen;
|
||||
DCInvalidateRange(buf, buflen);
|
||||
rv = __CtrlMsgInt(fd, 0x80, 0x06, (u16)((0x03 << 8) + index), langId, buflen, buf, _GetStrCb, req, 1);
|
||||
if (rv < 0) {
|
||||
USB_ERR("__CtrlMsgInt failed %d\n", rv);
|
||||
IOSFree(req);
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void _GetDescrCb(IOSError ret, void* ctxt) {
|
||||
IOSError rv = ret;
|
||||
USBCommandBlock* req = (USBCommandBlock*)ctxt;
|
||||
|
||||
USB_LOG("GetDescrCb returned: %d\n", rv);
|
||||
if (rv <= 0)
|
||||
goto out;
|
||||
|
||||
*(USBDeviceDescriptor*)req->spare = req->descriptor;
|
||||
|
||||
out:
|
||||
if (req->callback)
|
||||
req->callback(ret, req->callbackArg);
|
||||
IOSFree(req);
|
||||
return;
|
||||
}
|
||||
|
||||
IOSError IUSB_GetDevDescr(IOSFd fd, USBDeviceDescriptor* des) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
USBCommandBlock* req = 0;
|
||||
|
||||
USB_LOG("GetDevDescr\n");
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
if (req == 0) {
|
||||
USB_ERR("GetDevDescr: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(req, 0, sizeof(USBCommandBlock));
|
||||
DCInvalidateRange(&req->descriptor, (u32)sizeof(*des));
|
||||
rv = __CtrlMsgInt(fd, 0x80, 0x06, 0x100, 0, sizeof(*des), &req->descriptor, NULL, NULL, 0);
|
||||
if (rv < 0) {
|
||||
USB_ERR("Failed __CtrlMsg: %d", rv);
|
||||
goto out;
|
||||
}
|
||||
USB_LOG("GetDevDescr: %d\n", rv);
|
||||
*des = req->descriptor;
|
||||
|
||||
out:
|
||||
IOSFree(req);
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_GetDevDescrAsync(IOSFd fd, USBDeviceDescriptor* des, USBCallback cb, void* cbArg) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
USBCommandBlock* req;
|
||||
|
||||
USB_LOG("GetDevDescr - _GetDescrCb\n");
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
if (req == 0) {
|
||||
USB_ERR("GetDevDescrAsync: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(req, 0, sizeof(USBCommandBlock));
|
||||
|
||||
req->callback = cb;
|
||||
req->callbackArg = cbArg;
|
||||
req->nclean = 0;
|
||||
req->spare = des;
|
||||
|
||||
rv = IUSB_ReadCtrlMsgAsync(fd, 0x80, 0x06, 0x100, 0, sizeof(*des), (char*)&req->descriptor, _GetDescrCb, req);
|
||||
if (rv < 0) {
|
||||
IOSFree(req);
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_DeviceRemovalNotifyAsync(IOSFd fd, IOSIpcCb cb, void* cbArg) {
|
||||
IOSError rv;
|
||||
|
||||
USB_LOG("DeviceRemovalNotifyAsync\n");
|
||||
rv = IOS_IoctlAsync(fd, 26, 0, 0, 0, 0, cb, cbArg);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static IOSError __checkIsoArgs(USBIsoTransfer* xfer, u16* buflen) {
|
||||
IOSError rv = IPC_RESULT_INVALID;
|
||||
|
||||
if (NULL == xfer || NULL == xfer->buf || 0 == xfer->numPackets || xfer->numPackets > 8 || NULL == xfer->packets) {
|
||||
goto out;
|
||||
}
|
||||
{
|
||||
u32 i;
|
||||
*buflen = 0;
|
||||
for (i = 0; i < xfer->numPackets; ++i) {
|
||||
if (xfer->packets[i] > 1023) {
|
||||
USB_ERR("packet %u too big: %u\n", i, xfer->packets[i]);
|
||||
goto out;
|
||||
}
|
||||
*buflen += xfer->packets[i];
|
||||
}
|
||||
}
|
||||
rv = IPC_RESULT_OK;
|
||||
|
||||
out:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_IsoMsgAsync(IOSFd fd, u8 ep, USBIsoTransfer* xfer, USBIsoCallback cb, void* cbArg) {
|
||||
IOSError rv = IPC_RESULT_OK;
|
||||
u8 *sep, *snumPackets;
|
||||
u16* sbuflen;
|
||||
IOSIoVector* vector;
|
||||
USBCommandBlock* req;
|
||||
u16 buflen;
|
||||
|
||||
if (0 == ep || NULL == cb || (__checkIsoArgs(xfer, &buflen) < 0)) {
|
||||
USB_ERR("Invalid parameters for ISO transfer request\n");
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto out;
|
||||
}
|
||||
|
||||
vector = IOSAlloc(OSRoundUp32B(sizeof(IOSIoVector)) * 5);
|
||||
sep = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
sbuflen = IOSAlloc(OSRoundUp32B(sizeof(u16)));
|
||||
snumPackets = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
if (NULL == vector || NULL == sep || NULL == sbuflen || NULL == req) {
|
||||
USB_ERR("IUSB_IsoMsgAsync: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
IOSFree(req);
|
||||
goto clean;
|
||||
}
|
||||
|
||||
memset(req, 0, sizeof(USBCommandBlock));
|
||||
*sep = ep;
|
||||
*sbuflen = buflen;
|
||||
*snumPackets = xfer->numPackets;
|
||||
|
||||
vector[0].base = (u8*)sep;
|
||||
vector[0].length = sizeof(u8);
|
||||
vector[1].base = (u8*)sbuflen;
|
||||
vector[1].length = sizeof(u16);
|
||||
vector[2].base = snumPackets;
|
||||
vector[2].length = sizeof(u8);
|
||||
vector[3].base = (u8*)xfer->packets;
|
||||
vector[3].length = sizeof(u16) * xfer->numPackets;
|
||||
vector[4].base = xfer->buf;
|
||||
vector[4].length = buflen;
|
||||
|
||||
DCFlushRange(sep, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(sbuflen, OSRoundUp32B(sizeof(u16)));
|
||||
DCFlushRange(snumPackets, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(vector, OSRoundUp32B(sizeof(IOSIoVector)) * 5);
|
||||
|
||||
req->isoCallback = cb;
|
||||
req->isoArg = xfer;
|
||||
req->callbackArg = cbArg;
|
||||
req->nclean = 4;
|
||||
req->clean[0] = sep;
|
||||
req->clean[1] = sbuflen;
|
||||
req->clean[2] = snumPackets;
|
||||
req->clean[3] = vector;
|
||||
|
||||
rv = IOS_IoctlvAsync(fd, 9, 3, 2, vector, _intrBlkCtrlIsoCb, req);
|
||||
if (rv < 0) {
|
||||
IOSFree(req);
|
||||
goto clean;
|
||||
}
|
||||
goto out;
|
||||
|
||||
clean:
|
||||
IOSFree(sep);
|
||||
IOSFree(sbuflen);
|
||||
IOSFree(snumPackets);
|
||||
IOSFree(vector);
|
||||
|
||||
out:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_DeviceInsertionNotifyAsync(const char* path, u16 vid, u16 pid, USBCallback cb, void* cbArg) {
|
||||
IOSError rv;
|
||||
IOSFd fd;
|
||||
IOSIoVector* vector;
|
||||
u16 *svid, *spid;
|
||||
USBCommandBlock* req;
|
||||
|
||||
if (NULL == path || 0 == vid || 0 == pid) {
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if ((fd = IOS_Open(path, 0)) < 0) {
|
||||
rv = fd;
|
||||
USB_ERR("Open(%s) failed\n", path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
vector = IOSAlloc(OSRoundUp32B(sizeof(IOSIoVector)) * 2);
|
||||
spid = IOSAlloc(OSRoundUp32B(sizeof(u16)));
|
||||
svid = IOSAlloc(OSRoundUp32B(sizeof(u16)));
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
if (NULL == vector || NULL == spid || NULL == svid || NULL == req) {
|
||||
USB_ERR("getDeviceList: Not enough memory\n");
|
||||
rv = IPC_RESULT_ALLOC_FAILED;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
memset(req, 0, sizeof(USBCommandBlock));
|
||||
*svid = vid;
|
||||
*spid = pid;
|
||||
|
||||
vector[0].base = (u8*)svid;
|
||||
vector[0].length = sizeof(u16);
|
||||
vector[1].base = (u8*)spid;
|
||||
vector[1].length = sizeof(u16);
|
||||
DCFlushRange(svid, OSRoundUp32B(sizeof(u16)));
|
||||
DCFlushRange(spid, OSRoundUp32B(sizeof(u16)));
|
||||
DCFlushRange(vector, OSRoundUp32B(sizeof(IOSIoVector)) * 2);
|
||||
req->callback = cb;
|
||||
req->callbackArg = cbArg;
|
||||
req->nclean = 3;
|
||||
req->clean[0] = svid;
|
||||
req->clean[1] = spid;
|
||||
req->clean[2] = vector;
|
||||
|
||||
rv = IOS_IoctlvAsync(fd, 27, 2, 0, vector, _intrBlkCtrlIsoCb, req);
|
||||
if (rv < 0) {
|
||||
goto clean;
|
||||
}
|
||||
IOS_Close(fd);
|
||||
goto done;
|
||||
|
||||
clean:
|
||||
IOSFree(svid);
|
||||
IOSFree(spid);
|
||||
IOSFree(vector);
|
||||
IOSFree(req);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
IOSError IUSB_DeviceClassInsertionNotifyAsync(const char* path, u8 devClass, USBCallback cb, void* cbArg) {
|
||||
IOSError rv;
|
||||
IOSFd fd;
|
||||
IOSIoVector* vector;
|
||||
u8* sdevClass;
|
||||
USBCommandBlock* req;
|
||||
|
||||
if (NULL == path || 0 == devClass) {
|
||||
OSReport("Invalid path or devClass in insertion notification call\n");
|
||||
rv = IPC_RESULT_INVALID;
|
||||
goto done;
|
||||
}
|
||||
if ((fd = IOS_Open(path, 0)) < 0) {
|
||||
rv = fd;
|
||||
OSReport("Open(%s) failed\n", path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
vector = IOSAlloc(OSRoundUp32B(sizeof(IOSIoVector)) * 2);
|
||||
sdevClass = IOSAlloc(OSRoundUp32B(sizeof(u8)));
|
||||
req = IOSAlloc(OSRoundUp32B(sizeof(*req)));
|
||||
*sdevClass = devClass;
|
||||
|
||||
vector[0].base = (u8*)sdevClass;
|
||||
vector[0].length = sizeof(u8);
|
||||
DCFlushRange(sdevClass, OSRoundUp32B(sizeof(u8)));
|
||||
DCFlushRange(vector, OSRoundUp32B(sizeof(IOSIoVector)) * 2);
|
||||
req->callback = cb;
|
||||
req->callbackArg = cbArg;
|
||||
req->nclean = 2;
|
||||
req->clean[0] = sdevClass;
|
||||
req->clean[1] = vector;
|
||||
|
||||
rv = IOS_IoctlvAsync(fd, 28, 1, 0, vector, _intrBlkCtrlIsoCb, req);
|
||||
IOS_Close(fd);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -238,11 +238,7 @@ static void DeleteFlushCallback(SCStatus status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == SC_STATUS_OK) {
|
||||
p->deleteState = WUD_STATE_DELETE_DONE;
|
||||
} else {
|
||||
p->deleteState = WUD_STATE_DELETE_DONE;
|
||||
}
|
||||
p->deleteState = WUD_STATE_DELETE_DONE;
|
||||
}
|
||||
|
||||
static void ShutFlushCallback(SCStatus status) {
|
||||
@@ -1054,7 +1050,7 @@ static BOOL WUDiDeviceExists(u8* addr) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(WUD_c, "name : %s\n")
|
||||
static char deviceNameFormat[] = "name : %s\n";
|
||||
|
||||
static WUDInitState WUDiGetRegisteredDevice() {
|
||||
int i, j;
|
||||
@@ -1114,7 +1110,7 @@ static WUDInitState WUDiGetRegisteredDevice() {
|
||||
|
||||
DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3],
|
||||
pInfo->devAddr[4], pInfo->devAddr[5]);
|
||||
DEBUGPrint("name : %s\n", pInfo->conf.devName);
|
||||
DEBUGPrint(deviceNameFormat, pInfo->conf.devName);
|
||||
|
||||
a++;
|
||||
arrayNum--;
|
||||
@@ -1160,7 +1156,7 @@ static WUDInitState WUDiGetRegisteredDevice() {
|
||||
|
||||
WUD_DEBUGPrint("addr : %02x:%02x:%02x:%02x:%02x:%02x\n", pInfo->devAddr[0], pInfo->devAddr[1], pInfo->devAddr[2], pInfo->devAddr[3],
|
||||
pInfo->devAddr[4], pInfo->devAddr[5]);
|
||||
WUD_DEBUGPrint("name : %s\n", pInfo->conf.devName);
|
||||
WUD_DEBUGPrint(deviceNameFormat, pInfo->conf.devName);
|
||||
|
||||
WUDiMoveTopSmpDevInfoPtr(pInfo);
|
||||
|
||||
@@ -1613,8 +1609,30 @@ static BOOL StopSync() {
|
||||
return success;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(WUD_c1, "WUDStartSyncSpDevice()\n");
|
||||
DECOMP_FORCE_ACTIVE(WUD_c2, "WUDCancelSyncDevice()\n");
|
||||
BOOL WUDStartSyncSpDevice(u8 type) {
|
||||
WUDCB* p_wcb = &_wcb;
|
||||
WUDSyncDeviceCallback cb;
|
||||
BOOL enable;
|
||||
BOOL busy;
|
||||
|
||||
WUD_DEBUGPrint("WUDStartSyncSpDevice()\n");
|
||||
busy = StartSyncDevice(1, -1, type, FALSE);
|
||||
|
||||
enable = OSDisableInterrupts();
|
||||
cb = p_wcb->syncSmpCB;
|
||||
OSRestoreInterrupts(enable);
|
||||
|
||||
if (!busy && cb) {
|
||||
cb(-1, 0);
|
||||
}
|
||||
|
||||
return busy;
|
||||
}
|
||||
|
||||
BOOL WUDCancelSyncDevice(void) {
|
||||
WUD_DEBUGPrint("WUDCancelSyncDevice()\n");
|
||||
return StopSync();
|
||||
}
|
||||
|
||||
BOOL WUDStopSyncSimple() {
|
||||
return StopSync();
|
||||
@@ -1981,7 +1999,29 @@ void WUDiAutoSync() {
|
||||
}
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(WUD_c3, "WUDiCancelSync()\n");
|
||||
void WUDiCancelSync() {
|
||||
WUDCB* p_wcb = &_wcb;
|
||||
WUDSyncDeviceCallback callback;
|
||||
BOOL enable;
|
||||
|
||||
WUD_DEBUGPrint("WUDiCancelSync()\n");
|
||||
|
||||
enable = OSDisableInterrupts();
|
||||
if (p_wcb->syncState != 0) {
|
||||
if (p_wcb->syncState == 3) {
|
||||
BTA_DmSearchCancel();
|
||||
}
|
||||
OSCancelAlarm(&p_wcb->alarm);
|
||||
|
||||
callback = (p_wcb->syncType == 0) ? p_wcb->syncStdCB : p_wcb->syncSmpCB;
|
||||
if (callback) {
|
||||
callback(1, p_wcb->syncedNum);
|
||||
}
|
||||
|
||||
p_wcb->syncState = 0;
|
||||
}
|
||||
OSRestoreInterrupts(enable);
|
||||
}
|
||||
|
||||
void WUDiDeleteAllLinkKeys() {
|
||||
WUDCB* p = &_wcb;
|
||||
@@ -2954,10 +2994,61 @@ u8 _WUDGetLinkNumber() {
|
||||
return num;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(WUD_c4, "_WUDEnableTestMode\n")
|
||||
DECOMP_FORCE_ACTIVE(WUD_c5, "_WUDStartSyncDevice()\n")
|
||||
DECOMP_FORCE_ACTIVE(WUD_c6, "_WUDDeleteStoreDevice()\n")
|
||||
DECOMP_FORCE_ACTIVE(WUD_c7, "dev number = %d\n")
|
||||
BOOL _WUDEnableTestMode() {
|
||||
tBTM_STATUS status;
|
||||
BOOL enable;
|
||||
|
||||
WUD_DEBUGPrint("_WUDEnableTestMode\n");
|
||||
|
||||
status = BTM_EnableTestMode();
|
||||
enable = (status == BTM_SUCCESS) ? TRUE : FALSE;
|
||||
|
||||
return enable;
|
||||
}
|
||||
|
||||
void _WUDStartSyncDevice(BD_ADDR bd_addr, u8* bd_name) {
|
||||
WUDCB* p_wcb = &_wcb;
|
||||
BOOL enable;
|
||||
s32 status;
|
||||
|
||||
WUD_DEBUGPrint("_WUDStartSyncDevice()\n");
|
||||
|
||||
enable = OSDisableInterrupts();
|
||||
status = p_wcb->libStatus;
|
||||
OSRestoreInterrupts(enable);
|
||||
|
||||
if (status == 3) {
|
||||
if (WUDIsBusy() == FALSE) {
|
||||
WUD_DEBUGPrint("start\n");
|
||||
enable = OSDisableInterrupts();
|
||||
p_wcb->syncState = 5;
|
||||
p_wcb->syncedNum = 0;
|
||||
memcpy(_discResp.devName, bd_name, 64);
|
||||
memcpy(_discResp.devAddr, bd_addr, BD_ADDR_LEN);
|
||||
OSCreateAlarm(&p_wcb->alarm);
|
||||
OSSetPeriodicAlarm(&p_wcb->alarm, OSGetTime(), OSMillisecondsToTicks(20), SyncHandler0);
|
||||
OSRestoreInterrupts(enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _WUDDeleteStoredDevice() {
|
||||
WUDCB* p_wcb = &_wcb;
|
||||
BOOL enabled;
|
||||
u8 deleteState;
|
||||
|
||||
WUD_DEBUGPrint("_WUDDeleteStoreDevice()\n");
|
||||
|
||||
WUDiDeleteAllLinkKeys();
|
||||
|
||||
do {
|
||||
enabled = OSDisableInterrupts();
|
||||
deleteState = p_wcb->deleteState;
|
||||
OSRestoreInterrupts(enabled);
|
||||
} while (deleteState != WUD_STATE_DELETE_START);
|
||||
|
||||
WUD_DEBUGPrint("dev number = %d\n", WUDiGetDevNumber());
|
||||
}
|
||||
|
||||
static u8 reset_auth_count_cmd[] = {0x30, 0x36, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -2966,4 +3057,21 @@ void WUDResetAuthFailCount() {
|
||||
BTM_VendorSpecificCommand(BT_VSC_NINTENDO_WRITE_PATCH, (u8)sizeof(reset_auth_count_cmd), reset_auth_count_cmd, NULL);
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(WUD_c8, "Nintendo RVL-WBC")
|
||||
WUDDevInfo* WUDiGetRemoveWbcDevice() {
|
||||
WUDCB* p_wcb = &_wcb;
|
||||
WUDDevInfo* p_info = NULL;
|
||||
WUDDevInfoList* ptr;
|
||||
BOOL enable;
|
||||
|
||||
enable = OSDisableInterrupts();
|
||||
ptr = p_wcb->stdListHead;
|
||||
while (ptr != NULL) {
|
||||
if (!memcmp(ptr->devInfo->conf.devName, "Nintendo RVL-WBC", 16)) {
|
||||
p_info = ptr->devInfo;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
}
|
||||
OSRestoreInterrupts(enable);
|
||||
|
||||
return p_info;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void CDBConvMinuteValueToMinuteStr(char* minuteStr, int minute) {
|
||||
sprintf(minuteStr, "%02d", minute);
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(CDBConv_c, "%08X");
|
||||
static char wiiIdFormat[] = "%08X";
|
||||
|
||||
void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId) {
|
||||
u32 wiiIdHi, wiiIdLo;
|
||||
@@ -153,8 +153,8 @@ void CDBGenRootPath(char* rootPath, CDBLocation location, u64* wiiId) {
|
||||
|
||||
strcpy(rootPath, CDB_SD_ROOT_PATH_LS);
|
||||
|
||||
sprintf(wiiIdHiPath, "%08X", wiiIdHi);
|
||||
sprintf(wiiIdLoPath, "%08X", wiiIdLo);
|
||||
sprintf(wiiIdHiPath, wiiIdFormat, wiiIdHi);
|
||||
sprintf(wiiIdLoPath, wiiIdFormat, wiiIdLo);
|
||||
|
||||
CDBFSConcatenatePath(rootPath, wiiIdHiPath);
|
||||
CDBFSConcatenatePath(rootPath, wiiIdLoPath);
|
||||
@@ -312,7 +312,9 @@ void CDBConvEpochValueToDate(CDBDate epoch, int* year, int* month, int* day, int
|
||||
|
||||
void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation location, u64* wiiId);
|
||||
|
||||
DECOMP_FORCE_ACTIVE(CDBConv_c, "%04d%02d%02d");
|
||||
void CDBConvDateValueToDateStr(char* dateStr, int year, int month, int day) {
|
||||
sprintf(dateStr, "%04d%02d%02d", year, month, day);
|
||||
}
|
||||
|
||||
CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath) {
|
||||
BOOL ret = CDBRecordKeyIsValid(recordKey);
|
||||
@@ -326,7 +328,8 @@ CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath) {
|
||||
}
|
||||
|
||||
void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation location, u64* wiiId) {
|
||||
char fileNameStr[8];
|
||||
char epochString[CDB_KEYSTR_EPOCH_SIZE + 1];
|
||||
char fileNameStr[sizeof("00000000.000")];
|
||||
char yearStr[8];
|
||||
char monthStr[8];
|
||||
char dayStr[8];
|
||||
@@ -345,18 +348,9 @@ void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation locat
|
||||
CDBDate fileEpoch;
|
||||
char fileEpochStr[40];
|
||||
|
||||
{
|
||||
union {
|
||||
char storage[20];
|
||||
struct {
|
||||
char prefix[8];
|
||||
char value[12];
|
||||
} epoch;
|
||||
} epochBuffer;
|
||||
strncpy(epochBuffer.epoch.value, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE);
|
||||
epochBuffer.epoch.value[CDB_KEYSTR_EPOCH_SIZE] = 0;
|
||||
sscanf(epochBuffer.epoch.value, "%ul", &epoch);
|
||||
}
|
||||
strncpy(epochString, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE);
|
||||
epochString[CDB_KEYSTR_EPOCH_SIZE] = 0;
|
||||
sscanf(epochString, "%ul", &epoch);
|
||||
CDBConvEpochValueToDate(epoch, &year, &month, &day, &hour, &min, NULL);
|
||||
|
||||
CDBConvYearValueToYearStr(yearStr, year);
|
||||
|
||||
@@ -350,25 +350,23 @@ CDBErr CDBDatabaseFindByKey(CDBDatabase* database, CDBRecord* record, CDBRecordK
|
||||
}
|
||||
|
||||
CDBErr CDBDatabaseSearchConditionsIsMatch(CDBSearchConditions* conditions, char* key) {
|
||||
struct {
|
||||
u16 makerCode;
|
||||
u32 gameCode;
|
||||
CDBDate date;
|
||||
char type[8];
|
||||
} decoded;
|
||||
CDBConvKeyStrToEpochValue(key, &decoded.date);
|
||||
if (conditions->beginDate > decoded.date || decoded.date > conditions->endDate) return CDB_ERROR_OK;
|
||||
char type[CDB_RECORD_KEY_STRING_LEN - offsetof(CDBRecordKey, keyStrStruct.type)];
|
||||
CDBDate date;
|
||||
u32 gameCode;
|
||||
u16 makerCode;
|
||||
CDBConvKeyStrToEpochValue(key, &date);
|
||||
if (conditions->beginDate > date || date > conditions->endDate) return CDB_ERROR_OK;
|
||||
if (conditions->makerCode != 0xFFFF) {
|
||||
CDBConvKeyStrToMakerCode(key, (u32*)&decoded.makerCode);
|
||||
if (conditions->makerCode != decoded.makerCode) return CDB_ERROR_OK;
|
||||
CDBConvKeyStrToMakerCode(key, (u32*)&makerCode);
|
||||
if (conditions->makerCode != makerCode) return CDB_ERROR_OK;
|
||||
}
|
||||
if (conditions->gameCode != 0xFFFFFFFF) {
|
||||
CDBConvKeyStrToGameCode(key, &decoded.gameCode);
|
||||
if (conditions->gameCode != decoded.gameCode) return CDB_ERROR_OK;
|
||||
CDBConvKeyStrToGameCode(key, &gameCode);
|
||||
if (conditions->gameCode != gameCode) return CDB_ERROR_OK;
|
||||
}
|
||||
if (conditions->type != NULL) {
|
||||
CDBConvKeyStrToType(key, decoded.type);
|
||||
if (CDBCompareTypeStr(conditions->type, decoded.type)) return CDB_ERROR_OK;
|
||||
CDBConvKeyStrToType(key, type);
|
||||
if (CDBCompareTypeStr(conditions->type, type)) return CDB_ERROR_OK;
|
||||
}
|
||||
return CDB_ERROR_1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <private/cdb.h>
|
||||
#include <revolution/cdb.h>
|
||||
|
||||
#include <private/nand.h>
|
||||
#include <revolution/vf.h>
|
||||
|
||||
#include <string.h>
|
||||
@@ -10,22 +11,59 @@ char CDB_WIIID_DAT_PATH[NAND_MAX_PATH];
|
||||
char CDB_VFF_FILE_NAME[NAND_MAX_PATH];
|
||||
u32 CDB_VFF_FILE_SIZE;
|
||||
|
||||
// Left over unused logs
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDCreateDir %s\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDCreateDir() error = %d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDPrivateGetStatus %s = %d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "ownerId=%u, groupId=%u, attribute=%u, permission=");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "(other-group-owner)\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "nocopy/cdbwiiid.dat");
|
||||
s32 CDBFSCreateDirNAND(const char* path, u8 perm, u8 attr) {
|
||||
s32 result;
|
||||
|
||||
CDBReportInfo("NANDCreateDir %s\n", path);
|
||||
result = NANDCreateDir(path, perm, attr);
|
||||
if (result != NAND_RESULT_OK) {
|
||||
CDBReportInfo("NANDCreateDir() error = %d\n", result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void CDBFSReportNANDPermission(u8 permission);
|
||||
|
||||
void CDBFSReportNANDStatus(const char* path) {
|
||||
NANDStatus status;
|
||||
s32 result;
|
||||
|
||||
result = NANDPrivateGetStatus(path, &status);
|
||||
CDBReportInfo("NANDPrivateGetStatus %s = %d\n", path, result);
|
||||
if (result != NAND_RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
CDBReportInfo("ownerId=%u, groupId=%u, attribute=%u, permission=", status.ownerId, status.groupId, status.attribute);
|
||||
CDBFSReportNANDPermission(status.permission);
|
||||
}
|
||||
|
||||
void CDBFSReportNANDPermission(u8 permission) {
|
||||
char text[7];
|
||||
|
||||
text[0] = (permission & NAND_PERM_BOTH_READ) ? 'r' : '-';
|
||||
text[1] = (permission & NAND_PERM_BOTH_WRITE) ? 'w' : '-';
|
||||
text[2] = (permission & NAND_PERM_GROUP_READ) ? 'r' : '-';
|
||||
text[3] = (permission & NAND_PERM_GROUP_WRITE) ? 'w' : '-';
|
||||
text[4] = (permission & NAND_PERM_USER_READ) ? 'r' : '-';
|
||||
text[5] = (permission & NAND_PERM_USER_WRITE) ? 'w' : '-';
|
||||
text[6] = '\0';
|
||||
CDBReportInfo(text);
|
||||
CDBReportInfo("(other-group-owner)\n");
|
||||
}
|
||||
|
||||
void CDBFSReportWiiIdDat(void) {
|
||||
CDBFSReportNANDStatus("nocopy/cdbwiiid.dat");
|
||||
}
|
||||
|
||||
// These ones are used but they are pooled somewhere else
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFMountDriveNANDFlashEx VFErr=%d(%s)\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "home=%s\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFCreateSystemFileNANDFlashEx DEVErr=%d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFMountDriveNANDFlashEx VFErr=%d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFFormatDrive VFErr=%d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFMountDriveNANDFlashEx %s->%s succeeded\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "VFChangeDir %s %s\n");
|
||||
static char mountError[] = "VFMountDriveNANDFlashEx VFErr=%d(%s)\n";
|
||||
static char homeDirectory[] = "home=%s\n";
|
||||
static char createFileError[] = "VFCreateSystemFileNANDFlashEx DEVErr=%d\n";
|
||||
static char retryMountError[] = "VFMountDriveNANDFlashEx VFErr=%d\n";
|
||||
static char formatError[] = "VFFormatDrive VFErr=%d\n";
|
||||
static char mountSuccess[] = "VFMountDriveNANDFlashEx %s->%s succeeded\n";
|
||||
static char changeDirectoryError[] = "VFChangeDir %s %s\n";
|
||||
|
||||
static inline CDBErr CDBFSInitVFFile(void* cacheBuffer, u32 cacheSize) {
|
||||
VFErr vfErr;
|
||||
@@ -33,7 +71,7 @@ static inline CDBErr CDBFSInitVFFile(void* cacheBuffer, u32 cacheSize) {
|
||||
|
||||
vfErr = VFMountDriveNANDFlashCacheEx(CDB_CFG_VF_DRIVE_LETTER, CDB_VFF_FILE_NAME, cacheBuffer, cacheSize);
|
||||
if (vfErr != VF_ERR_SUCCESS) {
|
||||
CDBReportInfo("VFMountDriveNANDFlashEx VFErr=%d(%s)\n", vfErr, VFGetApiErrorString(vfErr));
|
||||
CDBReportInfo(mountError, vfErr, VFGetApiErrorString(vfErr));
|
||||
|
||||
if (vfErr == VF_ERR_NOT_EXIST_FILE) {
|
||||
u32 nandCheck;
|
||||
@@ -65,43 +103,48 @@ static inline CDBErr CDBFSInitVFFile(void* cacheBuffer, u32 cacheSize) {
|
||||
char nandHomeDir[64];
|
||||
NANDGetHomeDir(nandHomeDir);
|
||||
|
||||
CDBReportFatal("home=%s\n", nandHomeDir);
|
||||
CDBReportFatal("VFCreateSystemFileNANDFlashEx DEVErr=%d\n", vfErr);
|
||||
CDBReportFatal(homeDirectory, nandHomeDir);
|
||||
CDBReportFatal(createFileError, vfErr);
|
||||
return CDBOnNANDErrorOccured(vfErr);
|
||||
}
|
||||
|
||||
vfErr = VFMountDriveNANDFlashCacheEx(CDB_CFG_VF_DRIVE_LETTER, CDB_VFF_FILE_NAME, cacheBuffer, cacheSize);
|
||||
if (vfErr != VF_ERR_SUCCESS) {
|
||||
CDBReportFatal("VFMountDriveNANDFlashEx VFErr=%d\n", vfErr);
|
||||
CDBReportFatal(retryMountError, vfErr);
|
||||
return CDBOnVFErrorOccured(vfErr);
|
||||
}
|
||||
|
||||
vfErr = VFFormatDrive(CDB_CFG_VF_DRIVE_LETTER);
|
||||
if (vfErr != VF_ERR_SUCCESS) {
|
||||
CDBReportFatal("VFFormatDrive VFErr=%d\n", vfErr);
|
||||
CDBReportFatal(formatError, vfErr);
|
||||
return CDBOnVFErrorOccured(vfErr);
|
||||
}
|
||||
} else {
|
||||
CDBReportFatal("VFMountDriveNANDFlashEx VFErr=%d(%s)\n", vfErr, VFGetApiErrorString(vfErr));
|
||||
CDBReportFatal(mountError, vfErr, VFGetApiErrorString(vfErr));
|
||||
return CDBOnVFErrorOccured(vfErr);
|
||||
}
|
||||
}
|
||||
|
||||
CDBReportInfo("VFMountDriveNANDFlashEx %s->%s succeeded\n", CDB_VFF_FILE_NAME, CDB_CFG_VF_DRIVE_LETTER);
|
||||
CDBReportInfo(mountSuccess, CDB_VFF_FILE_NAME, CDB_CFG_VF_DRIVE_LETTER);
|
||||
|
||||
vfErr = VFChangeDir(CDB_CFG_VF_DRIVE_ROOT "/");
|
||||
if (vfErr != VF_ERR_SUCCESS) {
|
||||
CDBReportFatal("VFChangeDir %s %s\n", CDB_CFG_VF_DRIVE_ROOT "/", VFGetApiErrorString(vfErr));
|
||||
CDBReportFatal(changeDirectoryError, CDB_CFG_VF_DRIVE_ROOT "/", VFGetApiErrorString(vfErr));
|
||||
return CDBOnVFErrorOccured(vfErr);
|
||||
}
|
||||
|
||||
return CDBSetVFSyncMode(0);
|
||||
}
|
||||
|
||||
// More unused
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDPrivateDelete %s-->\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "NANDPrivateDelete=%d\n");
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, "<--NANDPrivateDelete\n");
|
||||
s32 CDBFSDeleteNAND(const char* path) {
|
||||
s32 result;
|
||||
|
||||
CDBReportInfo("NANDPrivateDelete %s-->\n", path);
|
||||
result = NANDPrivateDelete(path);
|
||||
CDBReportInfo("NANDPrivateDelete=%d\n", result);
|
||||
CDBReportInfo("<--NANDPrivateDelete\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
CDBErr CDBFSInit(void* cacheBuffer, u32 cacheSize) {
|
||||
VFErr vfErr;
|
||||
|
||||
@@ -283,5 +283,3 @@ BOOL CDBFSSDIsEjected() {
|
||||
BOOL CDBFSSDIsInserted() {
|
||||
return s_fssdWork.isInserted;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(CDBFileSystem_c, CDB_SD_VFF_FILE_NAME); // Unused but linked
|
||||
|
||||
@@ -29,25 +29,23 @@ BOOL CDBRecordKeyIsValid(CDBRecordKey* recordKey) {
|
||||
}
|
||||
|
||||
void CDBRecordKeyInit(CDBRecordKey* recordKey, CDBDate epoch, int gameCode, u16 makerCode, int serialNumber, char* fileType, int recordLocation) {
|
||||
struct {
|
||||
char mcStr[4];
|
||||
char typeStr[8];
|
||||
char gcStr[8];
|
||||
} strings;
|
||||
char gcStr[CDB_KEYSTR_GAME_CODE_SIZE + 1];
|
||||
char typeStr[6];
|
||||
char mcStr[CDB_KEYSTR_MAKER_CODE_SIZE + 1];
|
||||
|
||||
u32 typeLength;
|
||||
|
||||
CDBConvMCValueToMCStr(makerCode, strings.mcStr);
|
||||
CDBConvGCValueToGCStr(gameCode, strings.gcStr);
|
||||
CDBConvMCValueToMCStr(makerCode, mcStr);
|
||||
CDBConvGCValueToGCStr(gameCode, gcStr);
|
||||
|
||||
recordKey->wiiId = CDBGetWiiId();
|
||||
recordKey->location = recordLocation;
|
||||
|
||||
typeLength = strlen(fileType);
|
||||
strcpy(strings.typeStr, fileType);
|
||||
CDBToLower(((char*)strings.typeStr), typeLength);
|
||||
strcpy(typeStr, fileType);
|
||||
CDBToLower(typeStr, typeLength);
|
||||
|
||||
sprintf(recordKey->keyString, "%010u_%s_%s_%03d.%s", epoch, strings.gcStr, strings.mcStr, serialNumber, strings.typeStr);
|
||||
sprintf(recordKey->keyString, "%010u_%s_%s_%03d.%s", epoch, gcStr, mcStr, serialNumber, typeStr);
|
||||
}
|
||||
|
||||
void CDBRecordKeySetSerialNumber(CDBRecordKey* recordKey, int serialNum) {
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
static NCDConfig* ncdCommonBuffer;
|
||||
static u32 ncdInitialized;
|
||||
|
||||
struct NCDMutex {
|
||||
OSMutex mutex;
|
||||
u8 padding[8];
|
||||
} ncdMutex;
|
||||
OSMutex ncdMutex;
|
||||
s32 ncdCommonResult[8] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector ncdCommonVector[4] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
@@ -51,24 +48,25 @@ NCDErr NCDWriteConfig(const NCDConfig* config) {
|
||||
return ExecConfigCommand("NCDWriteConfig", (NCDConfig*)config, 6);
|
||||
}
|
||||
|
||||
static inline void RegisterUnofficialVersion(void) {
|
||||
BOOL enabled;
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 2)) {
|
||||
OSRegisterVersion(__NCDUnofficialVersion);
|
||||
ncdInitialized |= 2;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig) {
|
||||
union {
|
||||
BOOL enabled;
|
||||
NCDConfig* config;
|
||||
} state;
|
||||
NCDConfig* config;
|
||||
NCDErr lockErr;
|
||||
NCDProfile* profile;
|
||||
NCDErr result;
|
||||
s32 i;
|
||||
u32 count;
|
||||
|
||||
state.enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 2)) {
|
||||
OSRegisterVersion(__NCDUnofficialVersion);
|
||||
ncdInitialized |= 2;
|
||||
}
|
||||
OSRestoreInterrupts(state.enabled);
|
||||
|
||||
RegisterUnofficialVersion();
|
||||
|
||||
if (ifConfig == NULL) {
|
||||
return -3;
|
||||
@@ -82,25 +80,25 @@ NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig) {
|
||||
if (lockErr == 0) {
|
||||
result = ExecConfigCommand("NCDSetIfConfig", NULL, 3);
|
||||
if (result == 0) {
|
||||
state.config = ncdCommonBuffer;
|
||||
config = ncdCommonBuffer;
|
||||
|
||||
if (ifConfig->selectedMedia != 1 && ifConfig->selectedMedia != 2) {
|
||||
state.config->selectedMedia = 0;
|
||||
config->selectedMedia = 0;
|
||||
} else {
|
||||
state.config->selectedMedia = ifConfig->selectedMedia;
|
||||
profile = state.config->profiles;
|
||||
config->selectedMedia = ifConfig->selectedMedia;
|
||||
profile = config->profiles;
|
||||
i = 0;
|
||||
state.config->linkTimeout = ifConfig->linkTimeout;
|
||||
config->linkTimeout = ifConfig->linkTimeout;
|
||||
count = 0;
|
||||
for (; i < NCD_MAX_PROFILE; i++, profile++) {
|
||||
if (state.config->profiles[i].flags & 0x80) {
|
||||
if (config->profiles[i].flags & 0x80) {
|
||||
switch (ifConfig->selectedMedia) {
|
||||
case 1:
|
||||
state.config->profiles[i].flags &= ~1;
|
||||
config->profiles[i].flags &= ~1;
|
||||
memcpy(&profile->netif, &ifConfig->netif, 0x15c);
|
||||
break;
|
||||
case 2:
|
||||
state.config->profiles[i].flags |= 1;
|
||||
config->profiles[i].flags |= 1;
|
||||
memcpy(&profile->netif, &ifConfig->netif, 4);
|
||||
break;
|
||||
}
|
||||
@@ -109,22 +107,22 @@ NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig) {
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
state.config->profiles[0].flags |= 0x80;
|
||||
config->profiles[0].flags |= 0x80;
|
||||
switch (ifConfig->selectedMedia) {
|
||||
case 1:
|
||||
state.config->profiles[0].flags &= ~1;
|
||||
memcpy(&state.config->profiles[0].netif.wireless, &ifConfig->netif, 0x15c);
|
||||
config->profiles[0].flags &= ~1;
|
||||
memcpy(&config->profiles[0].netif.wireless, &ifConfig->netif, 0x15c);
|
||||
break;
|
||||
case 2:
|
||||
state.config->profiles[0].flags |= 1;
|
||||
memcpy(&state.config->profiles[0].netif.wired, &ifConfig->netif, 4);
|
||||
config->profiles[0].flags |= 1;
|
||||
memcpy(&config->profiles[0].netif.wired, &ifConfig->netif, 4);
|
||||
break;
|
||||
}
|
||||
memset(&state.config->profiles[0].adjust, 0, 0xc);
|
||||
state.config->profiles[0].flags |= 6;
|
||||
memset(&state.config->profiles[0].ip, 0, 0x14);
|
||||
state.config->profiles[0].flags &= ~0x10;
|
||||
memset(&state.config->profiles[0].proxy, 0, 0x79c);
|
||||
memset(&config->profiles[0].adjust, 0, 0xc);
|
||||
config->profiles[0].flags |= 6;
|
||||
memset(&config->profiles[0].ip, 0, 0x14);
|
||||
config->profiles[0].flags &= ~0x10;
|
||||
memset(&config->profiles[0].proxy, 0, 0x79c);
|
||||
}
|
||||
}
|
||||
result = ExecConfigCommand("NCDSetIfConfig", NULL, 4);
|
||||
@@ -137,7 +135,7 @@ NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig) {
|
||||
} else {
|
||||
result = -2;
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -224,7 +222,7 @@ NCDErr NCDSetIpConfig(NCDIpConfig* ipConfig) {
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -266,7 +264,7 @@ NCDErr NCDGetCurrentIpConfig(NCDIpConfig* ipConfig) {
|
||||
}
|
||||
}
|
||||
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -302,7 +300,7 @@ NCDErr NCDGetLinkStatus(void) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -359,7 +357,7 @@ NCDErr NCDiGetWirelessMacAddress(u8* macAddr) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -395,7 +393,7 @@ NCDErr NCDLockWirelessDriver(void) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -433,7 +431,7 @@ NCDErr NCDUnlockWirelessDriver(s32 id) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -459,7 +457,7 @@ s32 NCDRestoreConfig(void) {
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -493,7 +491,7 @@ NCDErr NCDiGetEnabledConfigList(u32* list0, u32* list1, u32* list2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
|
||||
if (list0 != NULL) {
|
||||
*list0 = mask0;
|
||||
@@ -557,7 +555,7 @@ static NCDErr ExecConfigCommand(const char* name, NCDConfig* config, u32 command
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex(&ncdMutex.mutex);
|
||||
OSUnlockMutex(&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -568,7 +566,7 @@ static void LockRight(void) {
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 1)) {
|
||||
OSRegisterVersion(__NCDVersion);
|
||||
OSInitMutex(&ncdMutex.mutex);
|
||||
OSInitMutex(&ncdMutex);
|
||||
lo = (void*)OSRoundUp32B(IPCGetBufferLo());
|
||||
if ((u32)IPCGetBufferHi() - (u32)lo < NCD_IPC_HEAP_SIZE) {
|
||||
OSPanic("ncdsystem.c", 0x5B1, "Could not reserve heap for NCD library from IPC arena");
|
||||
@@ -581,5 +579,5 @@ static void LockRight(void) {
|
||||
ncdInitialized |= 1;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
OSLockMutex(&ncdMutex.mutex);
|
||||
OSLockMutex(&ncdMutex);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
void* NHTTPi_memcpy(void*, const void*, u32);
|
||||
s32 NHTTPi_SocRecv(void*, NHTTPRequestInfo*, s32, void*, s32, s32);
|
||||
|
||||
#define NHTTPi_TOLOWER(c) ((((c) >= 'A') & ((c) <= 'Z')) ? (c) + ('a' - 'A') : (c))
|
||||
|
||||
static void FindHeaderBlock(const NHTTPResponseInfo* response, s32 position, NHTTPi_HDRBUFLIST** block, s32* offset) {
|
||||
if(position<NHTTP_HDRRECVBUF_INILEN) { *offset=position; *block=NULL; }
|
||||
else {
|
||||
@@ -22,10 +24,6 @@ static int ReadHeaderChar(const NHTTPResponseInfo* response, NHTTPi_HDRBUFLIST**
|
||||
return (*block)->block[(*offset)++];
|
||||
}
|
||||
|
||||
static int LowerCase(int character) {
|
||||
return ((character >= 'A') & (character <= 'Z')) ? character + ('a' - 'A') : character;
|
||||
}
|
||||
|
||||
s32 NHTTPi_findNextLineHdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, s32* colon, s32* newlineLength) {
|
||||
NHTTPi_HDRBUFLIST* block;
|
||||
s32 offset;
|
||||
@@ -75,16 +73,48 @@ s32 NHTTPi_skipSpaceHdrRecvBuf(const NHTTPResponseInfo* response, s32 position,
|
||||
s32 NHTTPi_compareTokenN_HdrRecvBuf(const NHTTPResponseInfo* response, s32 position, s32 limit, const char* token, s8 delimiter) {
|
||||
NHTTPi_HDRBUFLIST* block;
|
||||
s32 offset;
|
||||
int character;
|
||||
s32 i;
|
||||
s32 tokenChar;
|
||||
s32 character;
|
||||
|
||||
if (position < limit) {
|
||||
FindHeaderBlock(response, position, &block, &offset);
|
||||
character = ReadHeaderChar(response, &block, &offset);
|
||||
while (LowerCase((s8)character) == LowerCase(*token)) {
|
||||
if (*token == 0 || *token == ' ' || *token == delimiter || position == limit - 1) return 0;
|
||||
character = ReadHeaderChar(response, &block, &offset);
|
||||
++position;
|
||||
++token;
|
||||
|
||||
if (block == NULL) {
|
||||
if (offset < NHTTP_HDRRECVBUF_INILEN) {
|
||||
character = (s8)response->hdrBufFirst[offset++];
|
||||
goto compare_characters;
|
||||
}
|
||||
block = response->hdrBufBlock_p;
|
||||
offset = 0;
|
||||
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
|
||||
offset = 0;
|
||||
block = block->next_p;
|
||||
}
|
||||
character = block->block[offset++];
|
||||
|
||||
compare_characters:
|
||||
i = position;
|
||||
while (NHTTPi_TOLOWER((s8)character) == NHTTPi_TOLOWER((s8)*token)) {
|
||||
tokenChar = (s8)*token;
|
||||
if (tokenChar == '\0' || tokenChar == ' ' || tokenChar == delimiter || i == limit - 1) return 0;
|
||||
|
||||
if (block == NULL) {
|
||||
if (offset < NHTTP_HDRRECVBUF_INILEN) {
|
||||
character = (s8)response->hdrBufFirst[offset++];
|
||||
goto advance_token;
|
||||
}
|
||||
block = response->hdrBufBlock_p;
|
||||
offset = 0;
|
||||
} else if (offset == NHTTP_HDRRECVBUF_BLOCKLEN) {
|
||||
offset = 0;
|
||||
block = block->next_p;
|
||||
}
|
||||
character = block->block[offset++];
|
||||
|
||||
advance_token:
|
||||
i++;
|
||||
token++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <revolution/types.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NHTTPi_TOLOWER(c) ((((c) >= 'A') & ((c) <= 'Z')) ? (c) + ('a' - 'A') : (c))
|
||||
|
||||
void* NHTTPi_memcpy(void* destination, const void* source, u32 size)
|
||||
{
|
||||
return memcpy(destination, source, size);
|
||||
@@ -26,28 +28,33 @@ static int LowerCase(int character)
|
||||
return ((character >= 'A') & (character <= 'Z')) ? character + 32 : character;
|
||||
}
|
||||
|
||||
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 length)
|
||||
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 size)
|
||||
{
|
||||
while (length > 0)
|
||||
char leftChar;
|
||||
char rightChar;
|
||||
|
||||
while (size > 0)
|
||||
{
|
||||
int a = *left++, b = *right++;
|
||||
if (a == 0 || b == 0)
|
||||
leftChar = *left++;
|
||||
rightChar = *right++;
|
||||
|
||||
if (leftChar == '\0' || rightChar == '\0')
|
||||
{
|
||||
if (a == 0 && b == 0)
|
||||
if (leftChar == '\0' && rightChar == '\0')
|
||||
{
|
||||
length = 0;
|
||||
size = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
b = LowerCase(b);
|
||||
a = LowerCase(a);
|
||||
if (a != b)
|
||||
|
||||
if (NHTTPi_TOLOWER(leftChar) != NHTTPi_TOLOWER(rightChar))
|
||||
{
|
||||
break;
|
||||
}
|
||||
--length;
|
||||
size--;
|
||||
}
|
||||
return length;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static BOOL UrlPlain(int character)
|
||||
@@ -237,18 +244,18 @@ s32 NHTTPi_intToStr(char* destination, u32 value)
|
||||
return length + 1;
|
||||
}
|
||||
|
||||
s32 NHTTPi_compareToken(const char* left, const char* right)
|
||||
s32 NHTTPi_compareToken(const char* string, const char* token)
|
||||
{
|
||||
u32 rawLeft;
|
||||
while (LowerCase((s8)(rawLeft = *(const u8*)left)) == LowerCase((s8)*(const u8*)right))
|
||||
while (NHTTPi_TOLOWER(*string) == NHTTPi_TOLOWER(*token))
|
||||
{
|
||||
if ((s8)rawLeft == 0 || (s8)rawLeft == ' ')
|
||||
if (*string == '\0' || *string == ' ')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
++left;
|
||||
++right;
|
||||
string++;
|
||||
token++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -661,13 +661,6 @@ s32 NHTTPDisableVerifyOptionForDebug(NHTTPRequest* handle, u32 option)
|
||||
"NHTTPDisableVerifyOptionForDebug");
|
||||
return -1;
|
||||
}
|
||||
{
|
||||
static s32 debugSet;
|
||||
if (debugSet == 0)
|
||||
{
|
||||
debugSet = 1;
|
||||
}
|
||||
}
|
||||
request->verifyOption &= ~option;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -561,29 +561,27 @@ static inline void GetOldestMsgId(const MBCHeader* header, volatile u32* id) {
|
||||
|
||||
NWC24Err NWC24iMBoxCheck(NWC24MBoxType type, u32 size) {
|
||||
u32 required;
|
||||
struct {
|
||||
volatile u32 oldestId;
|
||||
MBCHeader* header;
|
||||
} mailbox;
|
||||
MBCHeader* header;
|
||||
volatile u32 oldestId;
|
||||
NWC24Err err;
|
||||
if (size >= 0x31C00)
|
||||
return NWC24_ERR_OVERFLOW;
|
||||
required = size + 0x4000;
|
||||
err = GetCachedMBCHeader(type, &mailbox.header);
|
||||
err = GetCachedMBCHeader(type, &header);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
if (type == NWC24_MBOX_TYPE_SEND) {
|
||||
if (mailbox.header->numMessages >= mailbox.header->capacity)
|
||||
if (header->numMessages >= header->capacity)
|
||||
return NWC24_ERR_FULL;
|
||||
if (mailbox.header->freeBytes <= required)
|
||||
if (header->freeBytes <= required)
|
||||
return NWC24_ERR_FULL;
|
||||
} else if (type == NWC24_MBOX_TYPE_RECV) {
|
||||
while (mailbox.header->numMessages >= mailbox.header->capacity || mailbox.header->freeBytes <= required) {
|
||||
GetOldestMsgId(mailbox.header, &mailbox.oldestId);
|
||||
err = DeleteMsg(type, mailbox.oldestId, FALSE);
|
||||
while (header->numMessages >= header->capacity || header->freeBytes <= required) {
|
||||
GetOldestMsgId(header, &oldestId);
|
||||
err = DeleteMsg(type, oldestId, FALSE);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
err = GetCachedMBCHeader(type, &mailbox.header);
|
||||
err = GetCachedMBCHeader(type, &header);
|
||||
if (err != NWC24_OK)
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -202,40 +202,41 @@ static inline NWC24Err WriteMBNoReplyField(NWC24MsgObjPrivate* msg) {
|
||||
return err;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
u32 flags;
|
||||
char* buffer;
|
||||
} MBFieldWork;
|
||||
static inline u32 GetMBFlags(const NWC24MsgObjPrivate* msg, u32 mask) {
|
||||
return msg->msgBoardFlags.raw & mask;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteMBRegDateField(NWC24MsgObjPrivate* msg) {
|
||||
MBFieldWork field;
|
||||
u32 flags;
|
||||
char* buffer;
|
||||
NWC24Err err;
|
||||
s32 length;
|
||||
field.flags = msg->msgBoardFlags.raw & 0xFFFF;
|
||||
if (!field.flags)
|
||||
flags = GetMBFlags(msg, 0xFFFF);
|
||||
if (!flags)
|
||||
return NWC24_OK;
|
||||
field.buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(field.buffer, 0, 1024);
|
||||
Mail_sprintf(field.buffer, "X-Wii-MB-RegDate: %04X\r\n", field.flags);
|
||||
length = STD_strnlen(field.buffer, 1024);
|
||||
err = NWC24FWrite(field.buffer, length, m_pFile);
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-MB-RegDate: %04X\r\n", flags);
|
||||
length = STD_strnlen(buffer, 1024);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline NWC24Err WriteMBDelayField(NWC24MsgObjPrivate* msg) {
|
||||
MBFieldWork field;
|
||||
u32 flags;
|
||||
char* buffer;
|
||||
NWC24Err err;
|
||||
s32 length;
|
||||
field.flags = msg->msgBoardFlags.raw & 0xFF0000;
|
||||
if (!field.flags)
|
||||
flags = GetMBFlags(msg, 0xFF0000);
|
||||
if (!flags)
|
||||
return NWC24_OK;
|
||||
field.buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(field.buffer, 0, 1024);
|
||||
Mail_sprintf(field.buffer, "X-Wii-MB-Delay: %02X\r\n", field.flags >> 16);
|
||||
length = STD_strnlen(field.buffer, 1024);
|
||||
err = NWC24FWrite(field.buffer, length, m_pFile);
|
||||
buffer = NWC24WorkP->stringWork;
|
||||
Mail_memset(buffer, 0, 1024);
|
||||
Mail_sprintf(buffer, "X-Wii-MB-Delay: %02X\r\n", flags >> 16);
|
||||
length = STD_strnlen(buffer, 1024);
|
||||
err = NWC24FWrite(buffer, length, m_pFile);
|
||||
if (err == NWC24_OK)
|
||||
msg->length += length;
|
||||
return err;
|
||||
|
||||
@@ -182,8 +182,7 @@ NWC24Err NWC24ExecDownloadTask(u32 flags, u16 taskId, u32 subTaskMask) {
|
||||
if (result >= NWC24_OK && saveMail) {
|
||||
result = NWC24iSaveMailNow();
|
||||
} else if (result == NWC24_ERR_PROTECTED) {
|
||||
// Stripped out but left out if statement
|
||||
u32 dummy = 0;
|
||||
ASSERTLINE(result != NWC24_ERR_PROTECTED, 184);
|
||||
}
|
||||
|
||||
if (result < NWC24_OK) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <revolution/nwc24.h>
|
||||
|
||||
static const u8 TtableInv[] = {13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4};
|
||||
static const u8 ExcTable[] = {1, 5, 0, 4, 2, 3, 6, 7};
|
||||
extern void _savegpr_27(void);
|
||||
extern void _restgpr_27(void);
|
||||
extern void __shr2u(void);
|
||||
@@ -53,166 +54,34 @@ NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
static asm NWC24UserId getUnScrambleId(register NWC24UserId id) {
|
||||
li r9,-1
|
||||
lis r7,0x20
|
||||
lis r6,0x5e5e
|
||||
stwu r1,-0x20(r1)
|
||||
subi r7,r7,1
|
||||
and r8,r4,r9
|
||||
addi r0,r6,0x5e5e
|
||||
stw r31,0x1c(r1)
|
||||
and r3,r3,r7
|
||||
lis r5,-1
|
||||
xor r8,r8,r0
|
||||
stw r30,0x18(r1)
|
||||
and r8,r8,r9
|
||||
xori r3,r3,0x5e5e
|
||||
rlwinm r0,r8,0x15,0xa,0xa
|
||||
li r6,-0x100
|
||||
and r3,r3,r7
|
||||
rlwinm r8,r8,0x1f,0,0x1f
|
||||
or r3,r3,r0
|
||||
stw r29,0x14(r1)
|
||||
rlwimi r8,r3,0x1f,0,0
|
||||
lis r4,-0xff
|
||||
rlwinm r7,r3,0x1f,1,0x1f
|
||||
addi r5,r5,0xff
|
||||
rlwinm r30,r8,0x18,0,0x1f
|
||||
rlwinm r29,r3,0x17,0x18,0x1f
|
||||
and r12,r7,r9
|
||||
li r0,0
|
||||
rlwimi r30,r3,0x17,0,7
|
||||
and r31,r8,r6
|
||||
rlwimi r31,r30,0,0x18,0x1f
|
||||
rlwinm r11,r3,0x1f,0x10,0x17
|
||||
and r30,r31,r5
|
||||
and r12,r12,r9
|
||||
rlwimi r0,r29,8,0x18,0x1f
|
||||
subi r4,r4,1
|
||||
or r12,r12,r0
|
||||
or r11,r30,r11
|
||||
and r30,r11,r4
|
||||
rlwinm r31,r8,0,0x18,0x1f
|
||||
li r0,0
|
||||
rlwinm r11,r8,0x10,8,0xf
|
||||
lis r10,0x100
|
||||
and r12,r12,r9
|
||||
rlwimi r0,r31,0x10,0x10,0x1f
|
||||
or r30,r30,r11
|
||||
or r29,r12,r0
|
||||
rlwinm r12,r3,0x1f,0x18,0x1f
|
||||
subi r0,r10,1
|
||||
li r10,0
|
||||
rlwimi r10,r12,0x18,8,0x1f
|
||||
and r11,r29,r9
|
||||
and r12,r30,r0
|
||||
rlwinm r3,r3,0x17,0,7
|
||||
or r3,r12,r3
|
||||
or r12,r11,r10
|
||||
and r10,r3,r9
|
||||
lis r3,TtableInv@ha
|
||||
and r31,r10,r9
|
||||
rlwinm r30,r8,0x10,0,0x1f
|
||||
rlwinm r11,r31,0x1c,0x1c,0x1f
|
||||
addi r3,r3,TtableInv@l
|
||||
rlwimi r30,r7,0x10,0,0xf
|
||||
rlwinm r10,r31,0,0x1c,0x1f
|
||||
and r29,r12,r6
|
||||
rlwinm r12,r8,8,0,0x1f
|
||||
lbzx r11,r3,r11
|
||||
rlwimi r12,r7,8,0,0x17
|
||||
lbzx r7,r3,r10
|
||||
rlwimi r29,r30,0,0x18,0x1f
|
||||
rlwinm r8,r11,4,0,0x1b
|
||||
rlwinm r10,r12,8,0x10,0x17
|
||||
and r11,r29,r5
|
||||
or r10,r11,r10
|
||||
or r7,r8,r7
|
||||
and r11,r31,r6
|
||||
li r8,0
|
||||
rlwimi r11,r7,0,0x18,0x1f
|
||||
and r12,r10,r9
|
||||
rlwinm r10,r11,0x18,0,0x1f
|
||||
li r7,0
|
||||
rlwimi r10,r12,0x18,0,7
|
||||
and r31,r11,r5
|
||||
rlwinm r11,r10,0x1c,0x1c,0x1f
|
||||
and r12,r12,r9
|
||||
rlwinm r10,r10,0,0x1c,0x1f
|
||||
lbzx r11,r3,r11
|
||||
lbzx r10,r3,r10
|
||||
rlwinm r11,r11,4,0,0x1b
|
||||
or r10,r11,r10
|
||||
rlwinm r11,r10,0,0x18,0x1f
|
||||
rlwinm r10,r10,8,0x10,0x17
|
||||
rlwimi r8,r11,8,0x18,0x1f
|
||||
or r10,r31,r10
|
||||
or r8,r12,r8
|
||||
rlwinm r12,r10,0x10,0,0x1f
|
||||
and r11,r10,r4
|
||||
rlwimi r12,r8,0x10,0,0xf
|
||||
and r10,r8,r9
|
||||
rlwinm r8,r12,0x1c,0x1c,0x1f
|
||||
rlwinm r4,r12,0,0x1c,0x1f
|
||||
lbzx r8,r3,r8
|
||||
lbzx r4,r3,r4
|
||||
rlwinm r8,r8,4,0,0x1b
|
||||
or r4,r8,r4
|
||||
rlwinm r8,r4,0,0x18,0x1f
|
||||
rlwinm r4,r4,0x10,8,0xf
|
||||
or r29,r11,r4
|
||||
rlwimi r7,r8,0x10,0x10,0x1f
|
||||
or r11,r10,r7
|
||||
lis r4,1
|
||||
rlwinm r8,r29,8,0,0x1f
|
||||
and r31,r29,r0
|
||||
rlwimi r8,r11,8,0,0x17
|
||||
and r12,r11,r9
|
||||
rlwinm r10,r8,0x1c,0x1c,0x1f
|
||||
subi r0,r4,0x4c4d
|
||||
lbzx r11,r3,r10
|
||||
rlwinm r8,r8,0,0x1c,0x1f
|
||||
lbzx r10,r3,r8
|
||||
li r8,0
|
||||
rlwinm r11,r11,4,0,0x1b
|
||||
lis r7,-0x4c4c
|
||||
or r11,r11,r10
|
||||
rlwinm r10,r11,0,0x18,0x1f
|
||||
subi r7,r7,0x4c4d
|
||||
rlwimi r8,r10,0x18,8,0x1f
|
||||
rlwinm r4,r11,0x18,0,7
|
||||
or r10,r12,r8
|
||||
rlwinm r8,r10,0x1c,0x1c,0x1f
|
||||
or r12,r31,r4
|
||||
rlwinm r4,r10,0,0x1c,0x1f
|
||||
lbzx r8,r3,r8
|
||||
and r11,r10,r6
|
||||
lbzx r4,r3,r4
|
||||
rlwinm r6,r8,4,0,0x1b
|
||||
and r8,r12,r9
|
||||
or r4,r6,r4
|
||||
rlwimi r11,r4,0,0x18,0x1f
|
||||
and r10,r8,r9
|
||||
rlwinm r6,r11,0x14,0x1c,0x1f
|
||||
rlwinm r4,r11,0x18,0x1c,0x1f
|
||||
lbzx r6,r3,r6
|
||||
lbzx r3,r3,r4
|
||||
and r8,r11,r5
|
||||
rlwinm r5,r6,4,0,0x1b
|
||||
and r4,r10,r9
|
||||
or r3,r5,r3
|
||||
rlwinm r3,r3,8,0x10,0x17
|
||||
or r3,r8,r3
|
||||
rlwinm r5,r3,0xa,0xb,0x15
|
||||
rlwinm r3,r3,0x15,0x16,0x1f
|
||||
rlwimi r5,r4,0xa,0x16,0x1f
|
||||
rlwimi r3,r4,0xa,0,0x15
|
||||
xor r4,r3,r7
|
||||
xor r3,r5,r0
|
||||
lwz r31,0x1c(r1)
|
||||
lwz r30,0x18(r1)
|
||||
lwz r29,0x14(r1)
|
||||
addi r1,r1,0x20
|
||||
blr
|
||||
static u8 getByte(u64 value, u8 index) {
|
||||
return (value >> (index * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
static u64 setByte(u64 value, u8 index, u8 byte) {
|
||||
return (value & ~(0xFFULL << ((u64)8 * index))) | ((u64)byte << ((u64)8 * index));
|
||||
}
|
||||
|
||||
static NWC24UserId getUnScrambleId(NWC24UserId id) {
|
||||
u64 copy;
|
||||
u8 i;
|
||||
|
||||
id &= 0x001FFFFFFFFFFFFFULL;
|
||||
id ^= 0x00005E5E5E5E5E5EULL;
|
||||
id &= 0x001FFFFFFFFFFFFFULL;
|
||||
id |= (((id & 0xFF) << 5) & 0x20) << 48;
|
||||
id >>= 1;
|
||||
|
||||
copy = id;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
id = setByte(id, i, getByte(copy, ExcTable[i]));
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; ++i) {
|
||||
id = setByte(id, i, (TtableInv[(getByte(id, i) >> 4) & 0xF] << 4) | TtableInv[getByte(id, i) & 0xF]);
|
||||
}
|
||||
|
||||
id = ((id & 0x7FFFFFFFFFFULL) << 10) | ((id >> 43) & 0x3FF);
|
||||
id ^= 0x0000B3B3B3B3B3B3ULL;
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ int SOGetSockName(int socket, void* address) {
|
||||
if(!request) result=-49;
|
||||
else {
|
||||
request->socket=socket;
|
||||
reply=&request->address;
|
||||
memcpy(reply,addr,addr->len);
|
||||
reply=(SOSockAddr*)(((u8*)request)+32);
|
||||
memcpy(((u8*)request)+32,addr,addr->len);
|
||||
result=IOS_Ioctl(rm,7,request,4,reply,addr->len);
|
||||
if(result>=0) memcpy(addr,reply,reply->len);
|
||||
SOiFree(12,request,size);
|
||||
|
||||
@@ -169,7 +169,6 @@ static pf_u16 VFiPFPATH_GetNextCharOfPattern(PF_STR* p_pattern, pf_u16 name_kind
|
||||
wc = ((pf_u8)pattern[1] << 8) + (pf_u8)pattern[0];
|
||||
if (name_kind == 0) {
|
||||
VFipf_vol_set.codeset.unicode2oem(&wc, (pf_s8*)&tmp_wc);
|
||||
tmp_wc = (pf_u16)tmp_wc;
|
||||
if (VFipf_vol_set.codeset.is_oem_mb_char((pf_u8)(tmp_wc >> 8), 1) != 0) {
|
||||
wc = tmp_wc;
|
||||
} else {
|
||||
@@ -179,7 +178,7 @@ static pf_u16 VFiPFPATH_GetNextCharOfPattern(PF_STR* p_pattern, pf_u16 name_kind
|
||||
}
|
||||
wc = (wc >= 'a') && (wc <= 'z') ? wc - ' ' : wc;
|
||||
if (name_kind == 1) {
|
||||
if (VFiPFPATH_UNI_ConvertFWchar((pf_u16)wc, &twc) == 1) {
|
||||
if (VFiPFPATH_UNI_ConvertFWchar(wc, &twc) == 1) {
|
||||
wc = twc;
|
||||
}
|
||||
} else if (VFiPFPATH_OEM_ConvertFWchar(pattern, &twc) == 1) {
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
const u8 scRsnOui0 = 0;
|
||||
const u8 scRsnOui1 = 0x0F;
|
||||
const u8 scRsnOui2 = 0xAC;
|
||||
@@ -18,7 +16,6 @@ const u8 scWpaOui0 = 0;
|
||||
const u8 scWpaOui1 = 0x50;
|
||||
const u8 scWpaOui2 = 0xF2;
|
||||
const u8 scWpaOuiPad = 0;
|
||||
#pragma pop
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
const u8 scWpaFindOui0 = 0;
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct AppLoaderHeader {
|
||||
u8 pad_0x1C[4];
|
||||
} AppLoaderHeader;
|
||||
|
||||
u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32;
|
||||
static u8 TicketViewsBuf[OSRoundUp32B(sizeof(ESTicketView) * 64)] ALIGN32;
|
||||
ESTicketView *TicketViews = (ESTicketView *)TicketViewsBuf;
|
||||
DVDDiskID UpdateDiskID ALIGN32;
|
||||
OSBootInfo2 bi2 ALIGN32;
|
||||
@@ -39,42 +39,42 @@ AppLoaderHeader AppLoaderHdr ALIGN32;
|
||||
OSBootInfo3 bi3 ALIGN32;
|
||||
u8 GameTOCBuf[OSRoundUp32B(sizeof(DVDGameTOC))] ALIGN32;
|
||||
DVDDriveInfo DriveInfo ALIGN32;
|
||||
DVDDiskID DiskID ALIGN32;
|
||||
DVDPartitionParams PartitionParams ALIGN32;
|
||||
static DVDDiskID DiskID ALIGN32;
|
||||
static DVDPartitionParams PartitionParams ALIGN32;
|
||||
NANDCommandBlock BS2NandBlock;
|
||||
NANDFileInfo BS2CacheFileInfo;
|
||||
DVDCommandBlock CoverBlock;
|
||||
u8 PartitionInfoBuf[OSRoundUp32B(sizeof(DVDPartitionInfo) * 256)] ALIGN32;
|
||||
DVDCommandBlock Block;
|
||||
|
||||
BS2State State = BS2_STT_BEGIN;
|
||||
vu32 DvdReadPending = 0;
|
||||
u32 BannerAllocation = 0;
|
||||
u32 BannerBuffer = 0;
|
||||
u32 BannerAvailable = 0;
|
||||
u32 Allocator = 0;
|
||||
BOOL StartingGame = FALSE;
|
||||
u32 RestartRequested = 0;
|
||||
u32 PartitionOpen = 0;
|
||||
u32 CacheSeekComplete = 0;
|
||||
u32 LoadingTitle = 0;
|
||||
static BS2State State = BS2_STT_BEGIN;
|
||||
static vu32 DvdReadPending = 0;
|
||||
static u32 BannerAllocation = 0;
|
||||
static u32 BannerBuffer = 0;
|
||||
static u32 BannerAvailable = 0;
|
||||
static u32 Allocator = 0;
|
||||
volatile BOOL StartingGame = FALSE;
|
||||
static u32 RestartRequested = 0;
|
||||
static u32 PartitionOpen = 0;
|
||||
static u32 CacheSeekComplete = 0;
|
||||
static u32 LoadingTitle = 0;
|
||||
BOOL FatalErrorFlag = FALSE;
|
||||
BOOL RetryErrorFlag = FALSE;
|
||||
BOOL UpdateErrorFlag = FALSE;
|
||||
BOOL AbortFlag = FALSE;
|
||||
volatile int CacheFailed = 0;
|
||||
volatile int RegionValid = 0;
|
||||
volatile int NandPending = 0;
|
||||
vu32 CancelNand = 0;
|
||||
vu32 LowReadResult = 0;
|
||||
u32 CacheCommandComplete = 0;
|
||||
u32 AudioBufferUnconfigured = 0;
|
||||
u64 ResetTime = 0;
|
||||
u64 SpinupDeadline = 0;
|
||||
static volatile int NandPending = 0;
|
||||
static vu32 CancelNand = 0;
|
||||
static vu32 LowReadResult = 0;
|
||||
static u32 CacheCommandComplete = 0;
|
||||
static u32 AudioBufferUnconfigured = 0;
|
||||
static u64 ResetTime = 0;
|
||||
static u64 SpinupDeadline = 0;
|
||||
u64 CoverPollTime = 0;
|
||||
u32 DriveWasReset = 0;
|
||||
u32 TitleTicketView = 0;
|
||||
u32 CurrentTmd = 0;
|
||||
static u32 TitleTicketView = 0;
|
||||
static u32 CurrentTmd = 0;
|
||||
u32 TitleCode = 0;
|
||||
u32 RequiredIosHigh = 0;
|
||||
u32 RequiredIosLow = 0;
|
||||
@@ -95,13 +95,13 @@ u32 LoaderOffset = 0;
|
||||
vu32 LoaderLength = 0;
|
||||
u32 LoaderAddress = 0;
|
||||
vu32 CacheLength = 0;
|
||||
vu32 BannerLength = 0;
|
||||
vu32 DvdTransferLength = 0;
|
||||
vu32 DvdTransferred = 0;
|
||||
u32 *DvdProgress = 0;
|
||||
u32 LoaderClose = 0;
|
||||
u32 LoaderMain = 0;
|
||||
u32 LoaderInit = 0;
|
||||
static vu32 BannerLength = 0;
|
||||
static vu32 DvdTransferLength = 0;
|
||||
static vu32 DvdTransferred = 0;
|
||||
static u32 *DvdProgress = 0;
|
||||
static u32 LoaderClose = 0;
|
||||
static u32 LoaderMain = 0;
|
||||
static u32 LoaderInit = 0;
|
||||
|
||||
|
||||
void BS2Report(const char *msg, ...) {
|
||||
@@ -243,7 +243,7 @@ BOOL BS2IsDiagDisc() { return (u8)(*(u8 *)OSPhysicalToCached(OS_ADDR_BOOT_INFO)
|
||||
extern vu32 BS2VideoMode;
|
||||
extern vu32 __DVDLayoutFormat;
|
||||
|
||||
asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
static asm void Run(u32 entryPoint, void *start, u32 blockCount, u32 argument) {
|
||||
// clang-format off
|
||||
#ifdef __MWERKS__
|
||||
nofralloc
|
||||
@@ -491,16 +491,13 @@ BOOL BS2StartLoadingTitle(ESTitleId titleId, ESTicketView *pTicketView) {
|
||||
|
||||
static void callback(u32 result) { LowReadResult = result; }
|
||||
|
||||
ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *views, u32 *count) {
|
||||
struct {
|
||||
ESTitleId title[4];
|
||||
u32 count[56];
|
||||
} work ALIGN32;
|
||||
static ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *views, u32 *count) {
|
||||
u8 work[256] ALIGN32;
|
||||
IOSIoVector vectors[4] ALIGN32;
|
||||
ESError result;
|
||||
IOSIoVector *request = vectors;
|
||||
ESTitleId *title = work.title;
|
||||
u32 *ticketCount = work.count;
|
||||
ESTitleId *title = (ESTitleId *)work;
|
||||
u32 *ticketCount = (u32 *)(work + 0x20);
|
||||
|
||||
if (*descriptor < 0 || !count) {
|
||||
return ES_ERR_INVALID;
|
||||
@@ -532,11 +529,9 @@ ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *
|
||||
request[2].length = *count * sizeof(*views);
|
||||
return IOS_Ioctlv(*descriptor, 0x13, 2, 1, request);
|
||||
}
|
||||
void BS2Reboot(void) {
|
||||
static void BS2Reboot(void) {
|
||||
ESTicketView ticket ALIGN32;
|
||||
struct {
|
||||
ESTitleId title[32];
|
||||
} launchWork ALIGN32;
|
||||
u8 work[256] ALIGN32;
|
||||
OSStateFlags flags ALIGN32;
|
||||
IOSIoVector vectors[4] ALIGN32;
|
||||
IOSFd descriptor;
|
||||
@@ -583,7 +578,7 @@ void BS2Reboot(void) {
|
||||
{
|
||||
s32 launchResult;
|
||||
IOSIoVector *request = vectors;
|
||||
ESTitleId *title = launchWork.title;
|
||||
ESTitleId *title = (ESTitleId *)work;
|
||||
if (descriptor < 0) {
|
||||
launchResult = -0x3f9;
|
||||
} else if ((u32)&ticket % 32 != 0) {
|
||||
@@ -839,9 +834,6 @@ void BS2StartGCGame() {
|
||||
static u8 gameCubeLanguages[] = {0, 0, 1, 2, 3, 4, 5};
|
||||
s32 ret;
|
||||
u32 rtc;
|
||||
u32 counterBias;
|
||||
u32 seconds;
|
||||
u32 timerFrequency;
|
||||
u32 soundMode;
|
||||
s8 productVideoMode;
|
||||
u8 progressiveMode;
|
||||
@@ -883,10 +875,7 @@ void BS2StartGCGame() {
|
||||
}
|
||||
|
||||
__OSGetRTC(&rtc);
|
||||
counterBias = SCGetCounterBias();
|
||||
seconds = rtc + counterBias;
|
||||
timerFrequency = OS_BUS_CLOCK >> 2;
|
||||
time = (OSTime)seconds * timerFrequency;
|
||||
time = OS_TIMER_CLOCK * (OSTime)(rtc + SCGetCounterBias());
|
||||
__OSSetTime(time);
|
||||
|
||||
sram = __OSLockSram();
|
||||
@@ -960,7 +949,7 @@ void BS2StartGCGame() {
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
|
||||
static BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
|
||||
if (State == 0x3A) {
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1023,11 +1012,11 @@ BOOL CheckDVDCommandStatus(DVDCommandBlock *block) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block);
|
||||
void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
|
||||
void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
|
||||
static void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block);
|
||||
static void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
|
||||
static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block);
|
||||
|
||||
void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
|
||||
static void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
|
||||
s32 ret;
|
||||
|
||||
if (CancelNand != 0) {
|
||||
@@ -1068,7 +1057,7 @@ void BS2NANDDivideCallback(s32 result, NANDCommandBlock *block) {
|
||||
}
|
||||
}
|
||||
|
||||
void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
|
||||
static void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
|
||||
NandCompletion = callback;
|
||||
NandOperation = 2;
|
||||
NandLength = length;
|
||||
@@ -1084,7 +1073,7 @@ void BS2NANDDivideReadAsync(NANDFileInfo *info, void *buffer, u32 length, NANDCa
|
||||
}
|
||||
}
|
||||
|
||||
void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
|
||||
static void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length, NANDCallback callback, NANDCommandBlock *block) {
|
||||
NandCompletion = callback;
|
||||
NandOperation = 1;
|
||||
NandLength = length;
|
||||
@@ -1100,7 +1089,7 @@ void BS2NANDDivideWriteAsync(NANDFileInfo *info, const void *buffer, u32 length,
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CheckBS2CommandStatus() {
|
||||
static BOOL CheckBS2CommandStatus() {
|
||||
if (CheckDVDCommandStatus(&Block) == 0) {
|
||||
BS2Report("DVD command is issuing\n");
|
||||
return 0;
|
||||
@@ -1304,7 +1293,7 @@ BOOL CheckBS2CommandStatus() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
|
||||
static void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
|
||||
if (BS2BootFromCache) {
|
||||
BS2Report("Unencrypted read from cache.dat\n");
|
||||
NandPending = 1;
|
||||
@@ -1314,7 +1303,7 @@ void BS2InquiryAsync(void *buffer, s32 length, u32 offset) {
|
||||
}
|
||||
}
|
||||
|
||||
void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
|
||||
static void BS2ReadDiskID(void *buffer, s32 length, u32 offset) {
|
||||
if (BS2BootFromCache) {
|
||||
BS2Report("Read from cache.dat\n");
|
||||
NandPending = 1;
|
||||
|
||||
@@ -42,7 +42,6 @@ static u32 VersionES = 0;
|
||||
static u32 ConsoleType = 0;
|
||||
static void* FatalFunc = NULL;
|
||||
|
||||
#pragma force_active on
|
||||
char* getSuffix(const char* path) {
|
||||
char* suffix = strrchr(path, '.');
|
||||
if (suffix != NULL) {
|
||||
@@ -50,7 +49,6 @@ char* getSuffix(const char* path) {
|
||||
}
|
||||
return suffix;
|
||||
}
|
||||
#pragma force_active off
|
||||
|
||||
static void* UpdateThread(void* argument);
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
namespace ipl {
|
||||
namespace cs {
|
||||
namespace mtx34 {
|
||||
// used but pooled first
|
||||
DECOMP_FORCE_ACTIVE(iplCSMtx_cpp, "MTX34");
|
||||
static char className[] = "MTX34";
|
||||
|
||||
#define PROPERTY_COUNT 13
|
||||
extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT];
|
||||
@@ -151,7 +150,7 @@ namespace ipl {
|
||||
BOOL init(CHANSVm* vm) {
|
||||
BOOL result = FALSE;
|
||||
// Create class
|
||||
CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, "MTX34", ctor, NULL);
|
||||
CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, className, ctor, NULL);
|
||||
if (cls != NULL) {
|
||||
// Add properties
|
||||
result = CHANSVmAddNativePropertyAccessorsList(vm, cls, cPropertyList, PROPERTY_COUNT) == CHANS_VM_OK;
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#include <revolution/gx/GXStruct.h>
|
||||
#include <revolution/os/OSError.h>
|
||||
|
||||
extern "C" const char scCsFatalMsg[];
|
||||
extern "C" const u8 scCsFatalColorR;
|
||||
extern "C" const u8 scCsFatalColorG;
|
||||
extern "C" const u8 scCsFatalColorB;
|
||||
extern "C" const u8 scCsFatalColorA;
|
||||
extern "C" char scCsFatalMsg[];
|
||||
extern "C" GXColor scCsFatalColor;
|
||||
|
||||
#define NW4R_DB_ASSERT_H
|
||||
#define NW4R_ASSERT(x) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
GXColor front = {scCsFatalColorR, scCsFatalColorG, scCsFatalColorB, scCsFatalColorA}; \
|
||||
GXColor front = scCsFatalColor; \
|
||||
GXColor back = {0, 0, 0, 0}; \
|
||||
OSFatal(front, back, scCsFatalMsg); \
|
||||
} \
|
||||
@@ -620,18 +617,9 @@ namespace ipl {
|
||||
namespace ipl {
|
||||
namespace cs {
|
||||
namespace pane {
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scCsFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
#pragma pop
|
||||
extern "C" char scCsFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
|
||||
#pragma push
|
||||
#pragma section data_type ".sdata"
|
||||
extern "C" __declspec(section ".sdata") const u8 scCsFatalColorR = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 scCsFatalColorG = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 scCsFatalColorB = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 scCsFatalColorA = 0;
|
||||
#pragma pop
|
||||
extern "C" GXColor scCsFatalColor = {0xff, 0xff, 0xff, 0};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,10 +618,13 @@ namespace ipl {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Force get_int<N> specializations to be emitted here
|
||||
DECOMP_FORCE_LITERAL(iplCSSavedata_cpp, util::get_int<COMPRESSION_LZ>)
|
||||
DECOMP_FORCE_LITERAL(iplCSSavedata_cpp, util::get_int<COMPRESSION_HUFFMAN>)
|
||||
DECOMP_FORCE_LITERAL(iplCSSavedata_cpp, util::get_int<COMPRESSION_RL>)
|
||||
}
|
||||
namespace util {
|
||||
template BOOL get_int<savedata::COMPRESSION_LZ>(CHANSVm*, CHANSVmObjHdr*, CHANSVmObjHdr*);
|
||||
template BOOL get_int<savedata::COMPRESSION_HUFFMAN>(CHANSVm*, CHANSVmObjHdr*, CHANSVmObjHdr*);
|
||||
template BOOL get_int<savedata::COMPRESSION_RL>(CHANSVm*, CHANSVmObjHdr*, CHANSVmObjHdr*);
|
||||
}
|
||||
namespace savedata {
|
||||
|
||||
template <>
|
||||
BOOL get<s8>(CHANSVm* vm, CHANSVmObjHdr* parentObj, CHANSVmObjHdr* returnObj);
|
||||
|
||||
@@ -43,7 +43,6 @@ void HBMFreeMem(void* pBlock) {
|
||||
MEMFreeToAllocator(spAllocator, pBlock);
|
||||
}
|
||||
|
||||
#pragma force_active on
|
||||
static HBMAllocatorType getAllocatorType(const HBMDataInfo* pDataInfo) {
|
||||
if (pDataInfo->pAllocator != NULL) {
|
||||
return HBM_ALLOCATOR_APPLI;
|
||||
@@ -55,7 +54,6 @@ static HBMAllocatorType getAllocatorType(const HBMDataInfo* pDataInfo) {
|
||||
|
||||
return HBM_ALLOCATOR_NW4R;
|
||||
}
|
||||
#pragma force_active off
|
||||
|
||||
void HBMCreate(const HBMDataInfo* pDataInfo) {
|
||||
MEMiHeapHead* hExpHeap;
|
||||
|
||||
@@ -12,23 +12,16 @@ extern "C" void GetFont__Q34nw4r3lyt8TextBoxCFv();
|
||||
namespace textinput {
|
||||
namespace candidatebox {
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scT_prdc_Text_00[15] = "T_prdc_Text_00";
|
||||
extern "C" const char scP_prdc_scrl_Left[17] = "P_prdc_scrl_Left";
|
||||
#pragma pop
|
||||
extern "C" char scT_prdc_Text_00[15] = "T_prdc_Text_00";
|
||||
extern "C" char scP_prdc_scrl_Left[17] = "P_prdc_scrl_Left";
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
extern "C" const char* scCommonTextAnimName = scT_prdc_Text_00;
|
||||
extern "C" const char* scCommonScrollAnimName = scP_prdc_scrl_Left;
|
||||
#pragma explicit_zero_data on
|
||||
extern "C" const wchar_t scEmptyWChars[4] = {0, 0, 0, 0};
|
||||
extern "C" wchar_t scEmptyWChars[4] = {0, 0, 0, 0};
|
||||
#pragma explicit_zero_data reset
|
||||
extern "C" const char scP_OnBtn[8] = "P_OnBtn";
|
||||
extern "C" const char scB_OnBtn[8] = "B_OnBtn";
|
||||
#pragma pop
|
||||
|
||||
extern "C" char scP_OnBtn[8] = "P_OnBtn";
|
||||
extern "C" char scB_OnBtn[8] = "B_OnBtn";
|
||||
|
||||
#define COMMON_TEXT_ANIM scCommonTextAnimName
|
||||
#define COMMON_SCROLL_ANIM scCommonScrollAnimName
|
||||
@@ -69,7 +62,6 @@ namespace textinput {
|
||||
|
||||
struct CandidatePaneData {
|
||||
PaneToAnimation panes[26];
|
||||
char tail[12];
|
||||
};
|
||||
|
||||
extern "C" const CandidatePaneData scCandidatePaneData __attribute__((aligned(8))) = {{
|
||||
@@ -203,25 +195,7 @@ namespace textinput {
|
||||
6,
|
||||
NULL,
|
||||
{&csAninationFile[0], &csAninationFile[8], &csAninationFile[9], &csAninationFile[10], &csAninationFile[11], &csAninationFile[12]}},
|
||||
}, {"P_OffBtn"}};
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scPaneNameTable[132] =
|
||||
"B_OffBtn\0\0\0\0"
|
||||
"P_JPOffBtn\0\0"
|
||||
"P_CNOffBtn\0\0"
|
||||
"P_CNOnBtn\0\0\0"
|
||||
"B_prdc_scrl_Left\0\0\0\0"
|
||||
"P_prdc_scrl_Left\0\0\0\0"
|
||||
"B_prdc_scrl_Rght\0\0\0\0"
|
||||
"P_prdc_scrl_Rght\0\0\0\0"
|
||||
"\0\0\0";
|
||||
extern "C" char scW_predictWindow[16] = "W_predictWindow";
|
||||
extern "C" const char scN_predictInput[15] = "N_predictInput";
|
||||
extern "C" const char scW_OnOff_Area[13] = "W_OnOff_Area";
|
||||
extern "C" const char scN_prdc_Texts[13] = "N_prdc_Texts";
|
||||
#pragma pop
|
||||
}};
|
||||
|
||||
void CandidateBoxCaller::Candidates::addCandidate(const wchar_t* wcString) {
|
||||
wcsncpy(szwcPredicted[mNumCandidate], wcString, ARRAY_LENGTH(szwcPredicted[0]));
|
||||
@@ -393,27 +367,20 @@ namespace textinput {
|
||||
mTextArea.Init();
|
||||
mOnOffButton.Create(this);
|
||||
mOnOffButton.Init();
|
||||
const char* paneNames = scPaneNameTable;
|
||||
const char* leftScrollBoundName = paneNames + 48;
|
||||
const char* leftScrollPaneName = paneNames + 68;
|
||||
mLeftScroll.Create(this, leftScrollPaneName, leftScrollBoundName);
|
||||
const char* rightScrollBoundName = paneNames + 88;
|
||||
const char* rightScrollPaneName = paneNames + 108;
|
||||
mRightScroll.Create(this, rightScrollPaneName, rightScrollBoundName);
|
||||
mLeftScroll.Create(this, "P_prdc_scrl_Left", "B_prdc_scrl_Left");
|
||||
mRightScroll.Create(this, "P_prdc_scrl_Rght", "B_prdc_scrl_Rght");
|
||||
mLeftScroll.Init();
|
||||
mRightScroll.Init();
|
||||
const char* windowName = scW_predictWindow;
|
||||
mTextWindow.Create(this, windowName);
|
||||
mTextWindow.Create(this, "W_predictWindow");
|
||||
init();
|
||||
}
|
||||
|
||||
void LayoutByNW4R::createAnmPane_(MEMAllocator* allocator) {
|
||||
CandidateTextAnmPane* pane;
|
||||
u16 j;
|
||||
const char* forceAddName;
|
||||
u16 i;
|
||||
for (i = 0; i < ARRAY_LENGTH(scCandidatePaneData.panes); i++) {
|
||||
pane = NULL;
|
||||
const PaneToAnimation& p = scCandidatePaneData.panes[i];
|
||||
CandidateTextAnmPane* pane = NULL;
|
||||
switch (p.type) {
|
||||
case KT_ScrollButton: {
|
||||
void* pBtnBuf = MEMAllocFromAllocator(allocator, sizeof(CandidateScrollAnmPane));
|
||||
@@ -440,9 +407,8 @@ namespace textinput {
|
||||
|
||||
nw4r::ut::List_Append(&mAnmPanes, pane);
|
||||
|
||||
const char* forceAddName = p.forceAddName;
|
||||
u32 animationCount = p.count;
|
||||
for (j = 0; j < animationCount; j++) {
|
||||
forceAddName = p.forceAddName;
|
||||
for (u16 j = 0; j < p.count; j++) {
|
||||
const AnimationFile* const& animation = p.pAnims[j];
|
||||
void* pResource = mpMultiArcResourceAccessor->GetResource(0, animation->fileName);
|
||||
AnimTransformPane* transform =
|
||||
@@ -458,7 +424,7 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void LayoutByNW4R::init() {
|
||||
searchAnmPane(scN_predictInput)->changeAnimation(ANM_Normal);
|
||||
searchAnmPane("N_predictInput")->changeAnimation(ANM_Normal);
|
||||
Base::setInvalid(false);
|
||||
setActive(true);
|
||||
setOnOff(false);
|
||||
@@ -471,7 +437,7 @@ namespace textinput {
|
||||
mpLayout->CalculateMtx(mDrawInfo);
|
||||
if (meLanguage == KR) {
|
||||
mTextWindow.SetVisible(false);
|
||||
getPane(scW_OnOff_Area)->SetVisible(false);
|
||||
getPane("W_OnOff_Area")->SetVisible(false);
|
||||
} else if (meLanguage == CN) {
|
||||
setOnOff(true);
|
||||
mTextWindow.SetVisible(true);
|
||||
@@ -481,16 +447,16 @@ namespace textinput {
|
||||
} else {
|
||||
mTextWindow.ChangeAnimation(ANM_Normal);
|
||||
}
|
||||
getPane(scW_OnOff_Area)->SetVisible(false);
|
||||
getPane("W_OnOff_Area")->SetVisible(false);
|
||||
} else {
|
||||
getPane(scW_OnOff_Area)->SetVisible(true);
|
||||
getPane("W_OnOff_Area")->SetVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void LayoutByNW4R::draw() {
|
||||
getPane(scN_prdc_Texts)->SetVisible(false);
|
||||
getPane("N_prdc_Texts")->SetVisible(false);
|
||||
nw4rmanager::Layout::draw();
|
||||
getPane(scN_prdc_Texts)->SetVisible(true);
|
||||
getPane("N_prdc_Texts")->SetVisible(true);
|
||||
if (!isInvalid()) {
|
||||
mTextArea.Draw(mDrawInfo);
|
||||
}
|
||||
@@ -500,8 +466,8 @@ namespace textinput {
|
||||
nw4rmanager::Layout::calc();
|
||||
mTextArea.Calc();
|
||||
if (mbAnimOn) {
|
||||
getPane(scN_prdc_Texts)->Animate(0);
|
||||
getPane(scN_prdc_Texts)->CalculateMtx(mDrawInfo);
|
||||
getPane("N_prdc_Texts")->Animate(0);
|
||||
getPane("N_prdc_Texts")->CalculateMtx(mDrawInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,7 +475,7 @@ namespace textinput {
|
||||
Base::setLanguage(language);
|
||||
init();
|
||||
// Maybe inlines, maybe not
|
||||
nw4r::math::VEC3 pos = searchAnmPane(scW_predictWindow)->getPane()->GetTranslate();
|
||||
nw4r::math::VEC3 pos = searchAnmPane("W_predictWindow")->getPane()->GetTranslate();
|
||||
if (meLanguage == CN || meLanguage == KR) {
|
||||
Base::checkValidation();
|
||||
// Potentially an inline
|
||||
@@ -524,7 +490,7 @@ namespace textinput {
|
||||
pos.x = 202.0f;
|
||||
}
|
||||
|
||||
searchAnmPane(scW_predictWindow)->getPane()->SetTranslate(pos);
|
||||
searchAnmPane("W_predictWindow")->getPane()->SetTranslate(pos);
|
||||
if (meLanguage == CN) {
|
||||
mTextArea.ApplyFontScale(1.2f);
|
||||
} else if (meLanguage == KR) {
|
||||
@@ -641,7 +607,7 @@ namespace textinput {
|
||||
current = reinterpret_cast<CandidateBoxCaller::Candidates*>(reinterpret_cast<u8*>(current) + sizeof(current->szwcPredicted[0]));
|
||||
}
|
||||
}
|
||||
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? scB_OnBtn : scPaneNameTable);
|
||||
gui::PaneComponent* p = mpPaneManager->searchPaneComponent(isOn() ? scB_OnBtn : "B_OffBtn");
|
||||
if (p != NULL) {
|
||||
p->lockInitialize(true);
|
||||
}
|
||||
@@ -1019,7 +985,7 @@ namespace textinput {
|
||||
mpBoundingPane[i]->setListener(this);
|
||||
}
|
||||
mpTextAreaPane = mgr->searchPaneComponent("N_prdcTextArea");
|
||||
mpTextsPane = mgr->searchPaneComponent(scN_prdc_Texts);
|
||||
mpTextsPane = mgr->searchPaneComponent("N_prdc_Texts");
|
||||
mSize = mpTextBoxPane[0]->getTextPane()->GetFontSize();
|
||||
mpTextAreaPane->setListener(this);
|
||||
}
|
||||
@@ -1504,7 +1470,7 @@ namespace textinput {
|
||||
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
|
||||
return;
|
||||
}
|
||||
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
if (!mgr()->isInvalid()) {
|
||||
switch (event) {
|
||||
case gui::EventHandler::ON_TRIG:
|
||||
@@ -1655,7 +1621,7 @@ namespace textinput {
|
||||
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
|
||||
return;
|
||||
}
|
||||
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
if (!mgr()->isInvalid()) {
|
||||
switch (event) {
|
||||
case gui::EventHandler::ON_TRIG:
|
||||
@@ -1701,15 +1667,15 @@ namespace textinput {
|
||||
mpOnPictPane = mgr->searchPaneComponent(scP_OnBtn);
|
||||
mpOnBoundPane = mgr->searchPaneComponent(scB_OnBtn);
|
||||
mpOnAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scP_OnBtn));
|
||||
mpOffPictPane = mgr->searchPaneComponent(scCandidatePaneData.tail);
|
||||
mpOffBoundPane = mgr->searchPaneComponent(scPaneNameTable);
|
||||
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane(scCandidatePaneData.tail));
|
||||
mpOffPictPane = mgr->searchPaneComponent("P_OffBtn");
|
||||
mpOffBoundPane = mgr->searchPaneComponent("B_OffBtn");
|
||||
mpOffAnmPane = static_cast<OnOffAnmPane*>(layout->searchAnmPane("P_OffBtn"));
|
||||
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName(scCandidatePaneData.tail)->GetMaterial()->GetTexture(&mOffTexDefault, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 12)->GetMaterial()->GetTexture(&mOffTexJP, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 24)->GetMaterial()->GetTexture(&mOffTexCN, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName("P_OffBtn")->GetMaterial()->GetTexture(&mOffTexDefault, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName("P_JPOffBtn")->GetMaterial()->GetTexture(&mOffTexJP, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName("P_CNOffBtn")->GetMaterial()->GetTexture(&mOffTexCN, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName(scP_OnBtn)->GetMaterial()->GetTexture(&mOnTexDefault, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName(scPaneNameTable + 36)->GetMaterial()->GetTexture(&mOnTexCN, 0);
|
||||
layout->getLayout()->GetRootPane()->FindPaneByName("P_CNOnBtn")->GetMaterial()->GetTexture(&mOnTexCN, 0);
|
||||
|
||||
mpOffBoundPane->setListener(this);
|
||||
mpOnBoundPane->setListener(this);
|
||||
@@ -1765,7 +1731,7 @@ namespace textinput {
|
||||
if (mgr()->isInScroll() && event != gui::EventHandler::ON_LEFT && event != gui::EventHandler::ON_POINT) {
|
||||
return;
|
||||
}
|
||||
if (!mgr()->searchAnmPane(scW_predictWindow)->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
if (!mgr()->searchAnmPane("W_predictWindow")->isInAnimation() || event == gui::EventHandler::ON_LEFT) {
|
||||
OnOffAnmPane* p;
|
||||
if (&component == mpOnBoundPane) {
|
||||
p = mpOnAnmPane;
|
||||
|
||||
@@ -175,13 +175,6 @@ namespace textinput {
|
||||
return table->keySets[mode]->pPaneNameToCharCode;
|
||||
}
|
||||
|
||||
struct NumericKeyView {
|
||||
const PaneNameToCharCode& key;
|
||||
NumericKeyView(const KeySet& set, u16 index) : key(set.pPaneNameToCharCode[index]) {}
|
||||
bool matches(const char* paneName) const { return util::strcmp(key.szPaneName, paneName); }
|
||||
wchar_t character() const { return key.wc[0]; }
|
||||
};
|
||||
|
||||
static inline const PaneNameToCharCode* findLowerCaseKey(const LanguageDependencyData* table, const char* paneName) {
|
||||
u16 index = 0;
|
||||
const PaneNameToCharCode* keys = table->keySets[Base::IM_01]->pPaneNameToCharCode;
|
||||
@@ -323,9 +316,8 @@ namespace textinput {
|
||||
}
|
||||
} else {
|
||||
for (u16 index = 0; index < 12; index++) {
|
||||
const NumericKeyView key(csKeySetNumber, index);
|
||||
if (key.matches(paneName)) {
|
||||
wchar_t character = key.character();
|
||||
if (util::strcmp(csKeySetNumber.pPaneNameToCharCode[index].szPaneName, paneName)) {
|
||||
wchar_t character = csKeySetNumber.pPaneNameToCharCode[index].wc[0];
|
||||
ConfirmInput commandData = {0};
|
||||
commandData.character = character;
|
||||
commandData.letterMode = mCurrentInputMode;
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
namespace textinput {
|
||||
namespace debug {
|
||||
struct iVertex {
|
||||
iVertex(f32 posX, f32 posY, f32 posZ, u32 red, u32 green, u32 blue, u32 alpha)
|
||||
: x(posX), y(posY), z(posZ), r(red), g(green), b(blue), a(alpha) {
|
||||
}
|
||||
iVertex(f32 posX, f32 posY, u32 red, u32 green, u32 blue, u32 alpha);
|
||||
|
||||
f32 x, y, z; // 0x00
|
||||
|
||||
u32 r, g, b, a; // 0x0C
|
||||
};
|
||||
|
||||
DECOMP_FORCE_LITERAL(tiDebug_cpp, 0.0f);
|
||||
iVertex::iVertex(f32 posX, f32 posY, u32 red, u32 green, u32 blue, u32 alpha)
|
||||
: x(posX), y(posY), z(0.0f), r(red), g(green), b(blue), a(alpha) {
|
||||
}
|
||||
|
||||
static void draw_rect(const iVertex& v0, const iVertex& v1, const iVertex& v2, const iVertex& v3) {
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
@@ -59,10 +59,10 @@ namespace textinput {
|
||||
MTXConcat(mtx, mtxScale, mtx);
|
||||
GXLoadPosMtxImm(mtx, GX_PNMTX0);
|
||||
|
||||
draw_rect(iVertex(left - centerX, top - centerY, 0, color.r, color.g, color.b, color.a),
|
||||
iVertex(right - centerX, top - centerY, 0, color.r, color.g, color.b, color.a),
|
||||
iVertex(left - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a),
|
||||
iVertex(right - centerX, bottom - centerY, 0, color.r, color.g, color.b, color.a));
|
||||
draw_rect(iVertex(left - centerX, top - centerY, color.r, color.g, color.b, color.a),
|
||||
iVertex(right - centerX, top - centerY, color.r, color.g, color.b, color.a),
|
||||
iVertex(left - centerX, bottom - centerY, color.r, color.g, color.b, color.a),
|
||||
iVertex(right - centerX, bottom - centerY, color.r, color.g, color.b, color.a));
|
||||
|
||||
Mtx mtx2;
|
||||
MTXIdentity(mtx2);
|
||||
|
||||
@@ -137,23 +137,20 @@ extern "C" asm void calc__Q39textinput9inputform4BaseFv();
|
||||
extern "C" asm void calc__Q39textinput11nw4rmanager6LayoutFv();
|
||||
extern "C" asm void draw__Q39textinput11nw4rmanager6LayoutFv();
|
||||
extern "C" asm void searchPaneComponent__Q39textinput3gui11PaneManagerFPCc();
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scP_txtScrll_UP[];
|
||||
extern "C" const char scP_txtScrll_DOWN[];
|
||||
extern "C" const char scN_JPNUSAEUR[];
|
||||
extern "C" const char scN_separateBarAll[];
|
||||
extern "C" const char scT_2l_TextBox[];
|
||||
extern "C" const char scT_title_textJPN[];
|
||||
extern "C" const char scN_separateBarKOR[];
|
||||
extern "C" const char scT_2l_TextBoxKOR[];
|
||||
extern "C" const char scT_title_textKOR[];
|
||||
extern "C" const char scN_separateBarCHN[];
|
||||
extern "C" const char scT_2l_TextBoxCHN[];
|
||||
extern "C" const char scT_title_textCHN[];
|
||||
extern "C" char scP_txtScrll_UP[];
|
||||
extern "C" char scP_txtScrll_DOWN[];
|
||||
extern "C" char scN_JPNUSAEUR[];
|
||||
extern "C" char scN_separateBarAll[];
|
||||
extern "C" char scT_2l_TextBox[];
|
||||
extern "C" char scT_title_textJPN[];
|
||||
extern "C" char scN_separateBarKOR[];
|
||||
extern "C" char scT_2l_TextBoxKOR[];
|
||||
extern "C" char scT_title_textKOR[];
|
||||
extern "C" char scN_separateBarCHN[];
|
||||
extern "C" char scT_2l_TextBoxCHN[];
|
||||
extern "C" char scT_title_textCHN[];
|
||||
extern "C" const char scN_KOR[];
|
||||
extern "C" const char scN_CHN[];
|
||||
#pragma pop
|
||||
extern "C" const f32 scInputFormZeroF;
|
||||
extern "C" void _savegpr_20();
|
||||
extern "C" void _restgpr_20();
|
||||
@@ -321,8 +318,6 @@ struct InputFormAnimationFile {
|
||||
char fileName[0x40];
|
||||
};
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".rodata"
|
||||
extern "C" const InputFormAnimationFile csAninationFile__Q29textinput9inputform[8] = {
|
||||
{0, "fs_VK_textBox_a_normal.brlan"},
|
||||
{1, "fs_VK_textBox_a_Foucus_IN.brlan"},
|
||||
@@ -334,7 +329,6 @@ extern "C" const InputFormAnimationFile csAninationFile__Q29textinput9inputform[
|
||||
{7, "fs_VK_textBox_a_Off.brlan"},
|
||||
};
|
||||
|
||||
#pragma section data_type ".rodata"
|
||||
extern "C" const VisiblePanes csVisiblePaneUEJ__Q29textinput9inputform = {
|
||||
1, 2,
|
||||
{scN_JPNUSAEUR, NULL, NULL, NULL},
|
||||
@@ -347,7 +341,7 @@ extern "C" const VisiblePanes csVisiblePaneKOR__Q29textinput9inputform = {
|
||||
{"N_CHN", scN_JPNUSAEUR, NULL, NULL},
|
||||
};
|
||||
|
||||
extern "C" const void* csVisiblePaneCHN__Q29textinput9inputform[10] = {
|
||||
extern "C" const void* const csVisiblePaneCHN__Q29textinput9inputform[10] = {
|
||||
(const void*)0x00010002,
|
||||
"N_CHN",
|
||||
0,
|
||||
@@ -380,11 +374,9 @@ extern "C" const LanguagePaneData csLanguageDependencyDataCHN__Q29textinput9inpu
|
||||
scT_2l_TextBoxCHN,
|
||||
scT_title_textCHN,
|
||||
};
|
||||
#pragma section data_type ".data"
|
||||
|
||||
extern "C" const wchar_t pppURLCheck[2][10] = {L"http://", L"https://"};
|
||||
|
||||
#pragma pop
|
||||
|
||||
extern "C" const f32 scInputFormZeroF = 0.0f;
|
||||
extern "C" const f32 scInputForm640F = 640.0f;
|
||||
@@ -415,10 +407,8 @@ f32 sfColorPhase;
|
||||
|
||||
bool mbHyphen = true;
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scP_txtScrll_UP[] = "P_txtScrll_UP";
|
||||
extern "C" const char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
|
||||
extern "C" char scP_txtScrll_UP[] = "P_txtScrll_UP";
|
||||
extern "C" char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
|
||||
struct ButtonAnimations {
|
||||
KeyType type;
|
||||
const char* paneName;
|
||||
@@ -427,7 +417,7 @@ struct ButtonAnimations {
|
||||
const InputFormAnimationFile* files[12];
|
||||
};
|
||||
|
||||
const ButtonAnimations csButtonAnimations[] = {
|
||||
ButtonAnimations csButtonAnimations[] = {
|
||||
{KT_NormalButton, scP_txtScrll_UP, 8, NULL, {
|
||||
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
|
||||
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
|
||||
@@ -439,18 +429,20 @@ const ButtonAnimations csButtonAnimations[] = {
|
||||
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
|
||||
&csAninationFile__Q29textinput9inputform[6], &csAninationFile__Q29textinput9inputform[7]}}
|
||||
};
|
||||
extern "C" const char scN_JPNUSAEUR[] = "N_JPNUSAEUR";
|
||||
extern "C" const char scN_separateBarAll[] = "N_separateBarAll";
|
||||
extern "C" const char scT_2l_TextBox[] = "T_2l_TextBox";
|
||||
extern "C" const char scT_title_textJPN[] = "T_title_textJPN";
|
||||
extern "C" const char scN_separateBarKOR[] = "N_separateBarKOR";
|
||||
extern "C" const char scT_2l_TextBoxKOR[] = "T_2l_TextBoxKOR";
|
||||
extern "C" const char scT_title_textKOR[] = "T_title_textKOR";
|
||||
extern "C" const char scN_separateBarCHN[] = "N_separateBarCHN";
|
||||
extern "C" const char scT_2l_TextBoxCHN[] = "T_2l_TextBoxCHN";
|
||||
extern "C" const char scT_title_textCHN[] = "T_title_textCHN";
|
||||
extern "C" char scN_JPNUSAEUR[] = "N_JPNUSAEUR";
|
||||
extern "C" char scN_separateBarAll[] = "N_separateBarAll";
|
||||
extern "C" char scT_2l_TextBox[] = "T_2l_TextBox";
|
||||
extern "C" char scT_title_textJPN[] = "T_title_textJPN";
|
||||
extern "C" char scN_separateBarKOR[] = "N_separateBarKOR";
|
||||
extern "C" char scT_2l_TextBoxKOR[] = "T_2l_TextBoxKOR";
|
||||
extern "C" char scT_title_textKOR[] = "T_title_textKOR";
|
||||
extern "C" char scN_separateBarCHN[] = "N_separateBarCHN";
|
||||
extern "C" char scT_2l_TextBoxCHN[] = "T_2l_TextBoxCHN";
|
||||
extern "C" char scT_title_textCHN[] = "T_title_textCHN";
|
||||
bool DeadKeyStream::sbCompatibleFilterEnabled = true;
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
inline bool DeadKeyStream::isCompatible(wchar_t character) {
|
||||
const wchar_t excluded[] = {
|
||||
0x00a4, 0x00ac, 0x00af, 0x00b2, 0x00b3, 0x00b6, 0x00b8, 0x00b9,
|
||||
@@ -462,6 +454,7 @@ inline bool DeadKeyStream::isCompatible(wchar_t character) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
inline wchar_t DeadKeyStream::getChar() {
|
||||
wchar_t character = KPRGetChar(&mKPRQueue);
|
||||
@@ -1349,7 +1342,6 @@ void LayoutByNW4R::onCommand(INPUT_COMMAND command, void* data) {
|
||||
}
|
||||
|
||||
|
||||
#pragma pop
|
||||
|
||||
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
|
||||
char animationName[17];
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace textinput {
|
||||
{ANM_RollOver, "fs_prdicSelWidw_a_PRDC_Roll_over.brlan"}, {ANM_ToggleOff, "fs_prdicSelWidw_a_PRDC_toggle-OFF.brlan"},
|
||||
{ANM_ToggleOn, "fs_prdicSelWidw_a_PRDC_toggle-ON.brlan"}};
|
||||
|
||||
extern "C" __declspec(section ".rodata") const u32 tiPredictLang_rodata_pad = 0;
|
||||
|
||||
static const PaneToAnimation csPaneToAnimation[] = {
|
||||
{KT_Whole, "N_PRDCkeytop_all", 3, NULL, {&csAninationFile[0], &csAninationFile[4], &csAninationFile[5]}},
|
||||
@@ -514,8 +513,11 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: weak function order
|
||||
DECOMP_FORCE_ACTIVE(tiPredictLang_cpp, (((CommandSender*)(NULL))->updateFromReceiver(0, NULL), 0))
|
||||
}
|
||||
|
||||
void CommandSender::updateFromReceiver(u32, void*) {}
|
||||
|
||||
namespace predictlang {
|
||||
|
||||
void LayoutByNW4R::draw() {
|
||||
nw4rmanager::Layout::draw();
|
||||
|
||||
@@ -295,13 +295,40 @@ confirmLetters:
|
||||
update();
|
||||
}
|
||||
|
||||
static inline void CopyWordSuffix(u16* word, u32 length) {
|
||||
u32 wordLength;
|
||||
u32 copied;
|
||||
wordLength = wcslen((wchar_t*)word) & 0xff;
|
||||
for (copied = 0; copied < length; ++copied) {
|
||||
word[copied] = word[(wordLength - length) + copied];
|
||||
}
|
||||
word[copied] = 0;
|
||||
}
|
||||
|
||||
void WithZi::update() {
|
||||
u16* koreanOutput;
|
||||
u16* keyOutput;
|
||||
wchar_t* candidateOutput;
|
||||
u16* destination;
|
||||
u32 copyLength;
|
||||
u16 keyCharacter;
|
||||
u16* wordOutput;
|
||||
u16* letter;
|
||||
u32 count;
|
||||
s32 elementCount;
|
||||
u16* source;
|
||||
s32 keyIndex;
|
||||
s32 position;
|
||||
s32 candidateLength;
|
||||
u16 character;
|
||||
s32 index;
|
||||
|
||||
if (mbDictionaryOpen == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mSelectedCandidate = 0;
|
||||
s32 elementCount = static_cast<u16>(setElementBuffer());
|
||||
elementCount = static_cast<u16>(setElementBuffer());
|
||||
mSearch.language = getPredictLanguage();
|
||||
mSearch.subLanguage = 7;
|
||||
mSearch.getMode = 0;
|
||||
@@ -339,24 +366,23 @@ void WithZi::update() {
|
||||
CandidatedWord[0] = L'>';
|
||||
CandidatedWord[1] = 0;
|
||||
mCandidateCount = 1;
|
||||
u16* output = CandidatedWord + 0x40;
|
||||
for (s32 keyIndex = 1; keyIndex < 16; ++keyIndex) {
|
||||
u16 candidate = static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[keyIndex - 1];
|
||||
if (candidate != 0) {
|
||||
output[0] = candidate;
|
||||
output[1] = 0;
|
||||
keyOutput = CandidatedWord;
|
||||
for (keyIndex = 1; keyIndex < 16; ++keyIndex) {
|
||||
keyCharacter = static_cast<keyboard::cellphonetype::PaneNameToCharCode*>(mpHoldingKey)->wc[keyIndex - 1];
|
||||
if (keyCharacter != 0) {
|
||||
keyOutput[keyIndex * 0x40] = keyCharacter;
|
||||
keyOutput[keyIndex * 0x40 + 1] = 0;
|
||||
++mCandidateCount;
|
||||
}
|
||||
output += 0x40;
|
||||
}
|
||||
EZTXGetCandidates(&mSearch, mpDictionaryWork);
|
||||
}
|
||||
else {
|
||||
memcpy(PredictionBuffer, CandidatesBuffer, 0x200);
|
||||
ChangeDictionaryLanguage(getPredictLanguage());
|
||||
u32 count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
|
||||
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH && count == 0x61) {
|
||||
wchar_t* candidateOutput = reinterpret_cast<wchar_t*>(PredictionBuffer);
|
||||
candidateOutput = reinterpret_cast<wchar_t*>(PredictionBuffer);
|
||||
mSearch.firstCandidate = 0x61;
|
||||
mSearch.candidates = candidateOutput + 0xC2;
|
||||
mSearch.maxCandidates = 199;
|
||||
@@ -369,13 +395,8 @@ void WithZi::update() {
|
||||
}
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH && mbContextChanged != 0 &&
|
||||
(mbContextChanged = 0, mSearch.count == 0)) {
|
||||
u32 length = mCurrentWordLength;
|
||||
u32 wordLength = wcslen((wchar_t*)LatestWord) & 0xff;
|
||||
u32 copied;
|
||||
for (copied = 0; copied < length; ++copied) {
|
||||
LatestWord[copied] = LatestWord[(wordLength - length) + copied];
|
||||
}
|
||||
LatestWord[copied] = 0;
|
||||
copyLength = mCurrentWordLength;
|
||||
CopyWordSuffix(LatestWord, copyLength);
|
||||
mSearch.wordCharCount = wcslen((wchar_t*)LatestWord);
|
||||
count = EZTXGetCandidates(&mSearch, mpDictionaryWork) & 0xff;
|
||||
}
|
||||
@@ -392,28 +413,25 @@ void WithZi::update() {
|
||||
memset(CandidatedWord, 0, 0x1400);
|
||||
mCandidateCount = 0;
|
||||
if (elementCount != 0 || mSearch.wordCharCount != 0) {
|
||||
u16* source = reinterpret_cast<u16*>(mSearch.candidates);
|
||||
u16* destination = CandidatedWord;
|
||||
for (s32 index = 0; index < static_cast<s32>(count); index++) {
|
||||
source = reinterpret_cast<u16*>(mSearch.candidates);
|
||||
destination = CandidatedWord;
|
||||
for (index = 0; index < static_cast<s32>(count); index++) {
|
||||
if (getPredictLanguage() == ZI8_LANG_ZH) {
|
||||
u16* output;
|
||||
s32 length;
|
||||
length = 0;
|
||||
output = destination;
|
||||
candidateLength = 0;
|
||||
wordOutput = destination;
|
||||
for (; *source != L' ' && *source != 0; source++) {
|
||||
*output++ = *source;
|
||||
++length;
|
||||
*wordOutput++ = *source;
|
||||
++candidateLength;
|
||||
}
|
||||
++source;
|
||||
destination[length] = 0;
|
||||
destination[candidateLength] = 0;
|
||||
} else if (mPredictLanguage == PL_11) {
|
||||
*destination = *source++;
|
||||
destination[1] = 0;
|
||||
} else if (getPredictLanguage() == ZI8_LANG_KO) {
|
||||
u16* output = destination;
|
||||
u16 character;
|
||||
koreanOutput = destination;
|
||||
while ((character = *source) >= 0x100) {
|
||||
*output++ = character;
|
||||
*koreanOutput++ = character;
|
||||
++source;
|
||||
}
|
||||
} else if (EZTXCopy(reinterpret_cast<wchar_t*>(destination), &mSearch, index & 0xff, mpDictionaryWork) == 0) {
|
||||
@@ -421,20 +439,18 @@ void WithZi::update() {
|
||||
}
|
||||
++mCandidateCount;
|
||||
{
|
||||
u16* candidate;
|
||||
s32 position;
|
||||
position = 0;
|
||||
for (candidate = destination; *candidate != 0; ++candidate, ++position) {
|
||||
for (letter = destination; *letter != 0; ++letter, ++position) {
|
||||
switch (mLetterMode) {
|
||||
case LM_1:
|
||||
*candidate = util::toWLower(*candidate);
|
||||
*letter = util::toWLower(*letter);
|
||||
break;
|
||||
case LM_2:
|
||||
*candidate = util::toWUpper(*candidate);
|
||||
*letter = util::toWUpper(*letter);
|
||||
break;
|
||||
case LM_0:
|
||||
if (position == 0) *candidate = util::toWUpper(*candidate);
|
||||
else *candidate = util::toWLower(*candidate);
|
||||
if (position == 0) *letter = util::toWUpper(*letter);
|
||||
else *letter = util::toWLower(*letter);
|
||||
break;
|
||||
case LM_3:
|
||||
break;
|
||||
|
||||
@@ -1625,12 +1625,10 @@ namespace ipl {
|
||||
|
||||
void Address::set_err_msg(wchar_t* errMsg, u32 errMsgLen, NWC24Err err) {
|
||||
memset(errMsg, 0, errMsgLen * sizeof(wchar_t));
|
||||
union MessageValue {
|
||||
const wchar_t* text;
|
||||
u32 id;
|
||||
} message;
|
||||
message.text = System::getMessage(MESG_ERROR_CODE);
|
||||
wcsncat(errMsg, message.text, errMsgLen - wcslen(errMsg));
|
||||
const wchar_t* messageText;
|
||||
u32 messageId;
|
||||
messageText = System::getMessage(MESG_ERROR_CODE);
|
||||
wcsncat(errMsg, messageText, errMsgLen - wcslen(errMsg));
|
||||
|
||||
wchar_t errCode[32];
|
||||
memset(errCode, 0, sizeof(errCode));
|
||||
@@ -1639,22 +1637,18 @@ namespace ipl {
|
||||
|
||||
switch (err) {
|
||||
case NWC24_ERR_NETWORK: {
|
||||
message.id = MESG_ERROR_NWC24_NETWORK;
|
||||
messageId = MESG_ERROR_NWC24_NETWORK;
|
||||
break;
|
||||
}
|
||||
case NWC24_ERR_SERVER:
|
||||
case NWC24_ERR_FULL: {
|
||||
message.id = MESG_ERROR_NWC24_SERVER;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
message.id = reinterpret_cast<u32>(message.text);
|
||||
messageId = MESG_ERROR_NWC24_SERVER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
message.text = System::getMessage(message.id);
|
||||
wcsncat(errMsg, message.text, errMsgLen - wcslen(errMsg));
|
||||
messageText = System::getMessage(messageId);
|
||||
wcsncat(errMsg, messageText, errMsgLen - wcslen(errMsg));
|
||||
}
|
||||
|
||||
void Address::entry_friend() {
|
||||
|
||||
@@ -1243,14 +1243,30 @@ namespace ipl {
|
||||
return result;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".html");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".htm");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".shtml");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".shtm");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".cgi");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".php");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".asp");
|
||||
DECOMP_FORCE_ACTIVE(iplFocusObject_cpp, L".jsp");
|
||||
BOOL focus_object::is_url_ext(const wchar_t* url) const {
|
||||
BOOL result = FALSE;
|
||||
u32 len = wcslen(url);
|
||||
const wchar_t* exts[8];
|
||||
int i;
|
||||
|
||||
exts[0] = L".html";
|
||||
exts[1] = L".htm";
|
||||
exts[2] = L".shtml";
|
||||
exts[3] = L".shtm";
|
||||
exts[4] = L".cgi";
|
||||
exts[5] = L".php";
|
||||
exts[6] = L".asp";
|
||||
exts[7] = L".jsp";
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
u32 extLen = wcslen(exts[i]);
|
||||
if (len >= extLen && wcsncmp(url + (len - extLen), exts[i], extLen) == 0) {
|
||||
result = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int focus_object::get_url_end(const wchar_t* url) const {
|
||||
int i;
|
||||
|
||||
@@ -242,12 +242,3 @@ namespace ipl {
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
__declspec(weak) u32 url_processor_data_pad() {
|
||||
static const u32 pad __attribute__((section(".data"), aligned(1))) = 0;
|
||||
return *((volatile const u32*)&pad);
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "iplSystem.h"
|
||||
|
||||
__declspec(section ".sdata") extern char scPaneName_B_Stop[];
|
||||
extern char scPaneName_B_Stop[7];
|
||||
extern char scPaneName_T_Stop[];
|
||||
extern "C" BOOL push_button_queue(void*, const void*);
|
||||
|
||||
|
||||
@@ -879,7 +879,6 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL Calendar::is_lower_limit() {
|
||||
static const f32 pad0 __attribute__((section(".data"), aligned(1), used)) = 0.0f;
|
||||
return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month;
|
||||
}
|
||||
} // namespace scene
|
||||
|
||||
@@ -13,10 +13,7 @@ namespace ipl {
|
||||
extern "C" char scInfo_a[];
|
||||
extern "C" char scB_Cal[];
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scN_CalDay_r[] = "N_CalDay_r";
|
||||
#pragma pop
|
||||
extern "C" char scN_CalDay_r[] = "N_CalDay_r";
|
||||
|
||||
// clang-format off
|
||||
extern "C" const char* scDateAnimPaneNames[Date::ANIM_PANE_MAX] = {
|
||||
@@ -27,21 +24,15 @@ namespace ipl {
|
||||
scInfo_a,
|
||||
};
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scMyIplTopFBrlan[] = "my_IplTop_f.brlan";
|
||||
extern "C" const char scN_CalDay_t[] = "N_CalDay_t";
|
||||
extern "C" const char scSEDateFocus[] = "WIPL_SE_DATE_FOCUS";
|
||||
#pragma pop
|
||||
extern "C" char scMyIplTopFBrlan[] = "my_IplTop_f.brlan";
|
||||
extern "C" char scN_CalDay_t[] = "N_CalDay_t";
|
||||
extern "C" char scSEDateFocus[] = "WIPL_SE_DATE_FOCUS";
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".sdata"
|
||||
extern "C" char scW_Cal[] = "W_Cal";
|
||||
extern "C" char scT_Cal[] = "T_Cal";
|
||||
extern "C" char scCal_Ac[] = "Cal_Ac";
|
||||
extern "C" char scInfo_a[] = "Info_a";
|
||||
extern "C" char scB_Cal[] = "B_Cal";
|
||||
#pragma pop
|
||||
|
||||
static const Date::AnmFrame scAnmFrame[] = {
|
||||
{ Date::ANIM_PANE_BTN_HOVER, 0.0f, 6.0f },
|
||||
@@ -62,10 +53,6 @@ namespace ipl {
|
||||
utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY);
|
||||
utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY);
|
||||
|
||||
u8 padding[0x10];
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplDate_cpp, padding);
|
||||
|
||||
Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName)
|
||||
: ::gui::EventHandler(), mbAppearMsg(0), mFocusState(0), mPendingFocusCmd(0), mpLayout(NULL), mpCurrentPaneAnim(0), mPointCount(0) {
|
||||
// Layout
|
||||
@@ -184,7 +171,11 @@ namespace ipl {
|
||||
const char* paneName = component->getPane()->GetName();
|
||||
controller::Interface* con = static_cast<controller::Interface*>(data);
|
||||
|
||||
int unused = con != NULL ? con->getChannel() : getLatestEventCtrlNo();
|
||||
if (con != NULL) {
|
||||
con->getChannel();
|
||||
} else {
|
||||
getLatestEventCtrlNo();
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
// Pointer on button
|
||||
@@ -310,9 +301,7 @@ namespace ipl {
|
||||
onCmdRecv(3);
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" const f32 scDateZeroF = 0.0f;
|
||||
#pragma pop
|
||||
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -2,30 +2,25 @@
|
||||
|
||||
#include "scene/channelEdit/iplChannelEdit.h"
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char scBrlan_SaveDataIn[] = "it_ObjChannelEdit_b_SaveDataIn.brlan";
|
||||
extern "C" const char scBrlan_SaveDataOut[] = "it_ObjChannelEdit_b_SaveDataOut.brlan";
|
||||
extern "C" const char scBrlan_SaveDataFocusIn[] = "it_ObjChannelEdit_b_SaveDataFoucusIn.brlan";
|
||||
extern "C" const char scBrlan_SaveDataFocusOut[] = "it_ObjChannelEdit_b_SaveDataFoucusOut.brlan";
|
||||
extern "C" const char scPaneName_N_Data16x9[] = "N_Data16x9";
|
||||
extern "C" const char scPaneName_N_Data4x3[] = "N_Data4x3";
|
||||
extern "C" const char scPaneName_B_Data_01[] = "B_Data_01";
|
||||
extern "C" const char scPaneName_B_Data_00[] = "B_Data_00";
|
||||
extern "C" const char scPaneName_N_Atari16x9[] = "N_Atari16x9";
|
||||
extern "C" const char scPaneName_N_Data_01[] = "N_Data_01";
|
||||
extern "C" const char scPaneName_N_Atari4x3[] = "N_Atari4x3";
|
||||
extern "C" const char scPaneName_N_Data_00[] = "N_Data_00";
|
||||
extern "C" const char scPaneName_DataBaseCover_00[] = "DataBaseCover_00";
|
||||
extern "C" const char scPaneName_DataBaseCover_01[] = "DataBaseCover_01";
|
||||
#pragma section const_type ".sdata"
|
||||
extern "C" __declspec(section ".sdata") const char scGroup_G_Data[] = "G_Data";
|
||||
extern "C" __declspec(section ".sdata") const wchar_t scUnknownWstr[] = L"???";
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" __declspec(section ".sdata2") const f32 scHalfF = 0.5f;
|
||||
extern "C" __declspec(section ".sdata2") const f32 scTwoF = 2.0f;
|
||||
extern "C" __declspec(section ".sdata2") const f64 scF2IBias = 4503599627370496.0;
|
||||
#pragma pop
|
||||
extern "C" char scBrlan_SaveDataIn[] = "it_ObjChannelEdit_b_SaveDataIn.brlan";
|
||||
extern "C" char scBrlan_SaveDataOut[] = "it_ObjChannelEdit_b_SaveDataOut.brlan";
|
||||
extern "C" char scBrlan_SaveDataFocusIn[] = "it_ObjChannelEdit_b_SaveDataFoucusIn.brlan";
|
||||
extern "C" char scBrlan_SaveDataFocusOut[] = "it_ObjChannelEdit_b_SaveDataFoucusOut.brlan";
|
||||
extern "C" char scPaneName_N_Data16x9[] = "N_Data16x9";
|
||||
extern "C" char scPaneName_N_Data4x3[] = "N_Data4x3";
|
||||
extern "C" char scPaneName_B_Data_01[] = "B_Data_01";
|
||||
extern "C" char scPaneName_B_Data_00[] = "B_Data_00";
|
||||
extern "C" char scPaneName_N_Atari16x9[] = "N_Atari16x9";
|
||||
extern "C" char scPaneName_N_Data_01[] = "N_Data_01";
|
||||
extern "C" char scPaneName_N_Atari4x3[] = "N_Atari4x3";
|
||||
extern "C" char scPaneName_N_Data_00[] = "N_Data_00";
|
||||
extern "C" char scPaneName_DataBaseCover_00[] = "DataBaseCover_00";
|
||||
extern "C" char scPaneName_DataBaseCover_01[] = "DataBaseCover_01";
|
||||
extern "C" char scGroup_G_Data[] = "G_Data";
|
||||
extern "C" wchar_t scUnknownWstr[] = L"???";
|
||||
extern "C" const f32 scHalfF = 0.5f;
|
||||
extern "C" const f32 scTwoF = 2.0f;
|
||||
extern "C" const f64 scF2IBias = 4503599627370496.0;
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
|
||||
@@ -28,11 +28,6 @@ namespace ipl {
|
||||
{85.f, 48.f},
|
||||
};
|
||||
|
||||
// TODO: Figure out what this might've been/why it isn't inlining
|
||||
void CHANAPPEDIT_dummyFunctionToKeepAConstructorStuffFromInlining(nw4r::math::VEC3& vec) {
|
||||
math::VEC3 end(vec);
|
||||
}
|
||||
|
||||
ChanAppEdit::ChanAppEdit(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* layoutDir, const char* layoutFileName)
|
||||
: AnmController(heap), ::gui::EventHandler(), mState(STATE_IDLE), mLinearInterp(), mpChanAppBox(NULL), mMsgId(0), mpThumbnail(NULL) {
|
||||
mpLayout = new (heap) layout::Object(heap, layoutFile, layoutDir, layoutFileName);
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
static inline wchar_t* letterWriterCaption(wchar_t* caption) {
|
||||
return caption;
|
||||
static inline void setLetterHeaderCaption(LetterWriter* writer, const wchar_t* name) {
|
||||
const wchar_t* caption = writer->makeHeaderCaption(name);
|
||||
writer->getLetterInputForm()->setHeaderCaption(caption);
|
||||
}
|
||||
|
||||
LetterWriter::LetterWriter(EGG::Heap* heap, int type)
|
||||
@@ -145,8 +146,7 @@ namespace ipl {
|
||||
Address* address = static_cast<Address*>(System::getScene(SCENE_ADDRESS));
|
||||
memcpy(&mFriendInfo, &address->getFriendCache()->getInfo(address->getChosenFriendIndex()), sizeof(NWC24FriendInfo));
|
||||
|
||||
const wchar_t* caption = letterWriterCaption(makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name));
|
||||
getLetterInputForm()->setHeaderCaption(caption);
|
||||
setLetterHeaderCaption(this, (const wchar_t*)mFriendInfo.attr.name);
|
||||
|
||||
mbToFriend = true;
|
||||
mLetterState = LETTER_STATE_NORMAL;
|
||||
|
||||
@@ -212,6 +212,8 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void SDChannelSelect::create() {
|
||||
mpSDWorker = new (System::getMem2App(), 4) NandSDWorker();
|
||||
mpWorkerHeap = (EGG::Heap*)System::getMem2App()->alloc(0x3EA60, 0x40);
|
||||
@@ -253,6 +255,7 @@ namespace ipl {
|
||||
utility::CSFlags::UpdateFlagsFile();
|
||||
}
|
||||
|
||||
#pragma pop
|
||||
void SDChannelSelect::enqueueStartNotice() {
|
||||
SDChannelSelectCommand command;
|
||||
command.type = 1;
|
||||
@@ -1322,7 +1325,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
bool SDChannelSelect::collectTitlesByUsage(
|
||||
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
@@ -1357,7 +1360,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
bool SDChannelSelect::collectTitlesFromNandUsage(
|
||||
const s32* firstUsage, const s32* secondUsage,
|
||||
s32* firstUsage, s32* secondUsage,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
@@ -1396,7 +1399,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
bool SDChannelSelect::collectTitlesByChannelOrder(
|
||||
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
static const int channelOrder[MAX_CHANNEL_INDEX] = {
|
||||
11, 7, 3, 10, 6, 2, 9, 5, 1, 8, 4, 0,
|
||||
@@ -1406,17 +1409,10 @@ namespace ipl {
|
||||
getCurrentTitleUsage(&bytes, &blocks);
|
||||
*titleCount = 0;
|
||||
|
||||
ESTitleId titleId;
|
||||
for (int page = MAX_CHANNEL_PAGE - 1; page >= 0; --page) {
|
||||
for (int order = 0; order < MAX_CHANNEL_INDEX; ++order) {
|
||||
int channelIndex = channelOrder[order];
|
||||
const channel::SEntry& channelInfo =
|
||||
System::getChannelManager()->mChannels[page][channelIndex];
|
||||
if (channelInfo.loadedBnr) {
|
||||
titleId = ES_TITLE_ID(channelInfo.info.titleType, channelInfo.info.titleCode);
|
||||
} else {
|
||||
titleId = 0;
|
||||
}
|
||||
ESTitleId titleId =
|
||||
System::getChannelManager()->getEntryTitleID(page, channelOrder[order]);
|
||||
if (titleId == 0 || titleId == 0x48415A41) {
|
||||
continue;
|
||||
}
|
||||
@@ -1448,7 +1444,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
bool SDChannelSelect::collectTitlesBySpecialChannels(
|
||||
const s32* firstUsage, const s32* secondUsage, ESTitleId* titleIds,
|
||||
s32* firstUsage, s32* secondUsage, ESTitleId* titleIds,
|
||||
char* titleNames, u32* titleCount) {
|
||||
s32 bytes;
|
||||
s32 blocks;
|
||||
@@ -1578,7 +1574,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
bool SDChannelSelect::collectTitlesForMode(
|
||||
const s32* requiredBytes, const s32* requiredBlocks,
|
||||
s32* requiredBytes, s32* requiredBlocks,
|
||||
ESTitleId* titleIds, char* titleNames, u32* titleCount, int searchMode) {
|
||||
switch (searchMode) {
|
||||
case 0:
|
||||
@@ -1647,6 +1643,8 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void SDChannelSelect::flushSaveDataAndMountSD() {
|
||||
if (System::getDialog()->getLastResult() != DialogWindow::RESULT_NONE) {
|
||||
mpPointerLayout->getAnim(0)->initAnmFrame();
|
||||
@@ -1658,6 +1656,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma pop
|
||||
void SDChannelSelect::handleThreePageDialog() {
|
||||
if (System::getDialog()->callBtn2Multi(sThreePageDialogPages, 3, 10)) {
|
||||
mState = 27;
|
||||
@@ -1902,7 +1901,7 @@ namespace ipl {
|
||||
pageText->SetString(pageNumber, 0);
|
||||
nw4r::lyt::Pane* clockPane = mpLayout->FindPaneByName(mscClockPaneNames[page]);
|
||||
nw4r::math::MTX34 paneMatrix = clockPane->GetGlobalMtx();
|
||||
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
PSMTXMultVec(paneMatrix, position, position);
|
||||
mpDialogLayout->GetRootPane()->SetTranslate(position);
|
||||
mpDialogLayout->calcMtx();
|
||||
@@ -2699,8 +2698,8 @@ namespace ipl {
|
||||
return mpLayout->FindPaneByName(mscChannelPaneNames[2][index]);
|
||||
}
|
||||
|
||||
math::VEC3 SDChannelSelect::getChannelPanePosition(SDChannelSelect* scene, int index) {
|
||||
math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
nw4r::math::VEC3 SDChannelSelect::getChannelPanePosition(SDChannelSelect* scene, int index) {
|
||||
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
|
||||
MTXMultVec(scene->getCenterChannelPane(index)->GetGlobalMtx(), position, position);
|
||||
return position;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#define IPL_CHANNEL_TITLE_NOVTABLE
|
||||
#include "math/iplInterporation.h"
|
||||
#undef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
|
||||
#include "scene/sdChannelTitle/iplSDChannelTitle.h"
|
||||
#undef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
#include "scene/sdChannelSelect/iplSDChannelSelect.h"
|
||||
#include "system/iplSystem.h"
|
||||
#include "sound/iplSound.h"
|
||||
@@ -1351,6 +1351,8 @@ extern "C" void iplSDChannelTitle_prepareSceneExit(SDChannelTitle* scene, int ne
|
||||
}
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int nextScene) {
|
||||
int page;
|
||||
int index;
|
||||
@@ -1358,10 +1360,10 @@ extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int
|
||||
System::getSaveData()->pushTitleCache(scene->mTitleId);
|
||||
}
|
||||
System::getSaveData()->getSDPrevPage() = scene->mPage;
|
||||
EGG::Heap* saveHeap = System::getMem2App();
|
||||
scene->mpSaveFile = System::getSaveData()->flushAsync(saveHeap);
|
||||
scene->mpSaveFile = System::getSaveData()->flushAsync(System::getMem2App());
|
||||
__WPADReconnect(TRUE);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
extern "C" void iplSDChannelTitle_rebootSystem(SDChannelTitle*) {
|
||||
snd::getSystem()->stopAllSound(0);
|
||||
|
||||
@@ -167,11 +167,6 @@ typedef struct AOSSKeySchedule {
|
||||
u32 length;
|
||||
} AOSSKeySchedule;
|
||||
|
||||
typedef struct AOSSKeyMaterial {
|
||||
u8 nonce[2];
|
||||
u8 address[8];
|
||||
} AOSSKeyMaterial;
|
||||
|
||||
typedef struct AOSSReceiveBuffer {
|
||||
s32 socket;
|
||||
u32 length;
|
||||
@@ -261,11 +256,6 @@ typedef struct AOSSConfigData {
|
||||
static AOSSRuntimeState s_runtime;
|
||||
static AOSSConfigData s_configData;
|
||||
static u8 s_networkBuffer[0x280];
|
||||
static struct {
|
||||
AOSSKeyMaterial key;
|
||||
u8 payload[0x5e];
|
||||
} s_packetState;
|
||||
static u32 s_crcTable[0x100];
|
||||
|
||||
static s32 s_socket = -1;
|
||||
static char s_manufacturer[] = "MELCO";
|
||||
@@ -2324,16 +2314,16 @@ int AOSSSendDiscoveryRequest(void* packet, AOSSRequestRecords* request, int sock
|
||||
}
|
||||
|
||||
int AOSSSendHelloRequest(void* packet, void* request, int socket) {
|
||||
AOSSHelloPacket* response = (AOSSHelloPacket*)s_responseBuffer;
|
||||
AOSSHelloPayload* payload;
|
||||
AOSSRequestRecords* requestRecords = (AOSSRequestRecords*)request;
|
||||
struct {
|
||||
AOSSSocketAddress destination;
|
||||
AOSSHelloRecord hello;
|
||||
u8 accessPointName[8];
|
||||
AOSSKeySchedule schedule;
|
||||
} construction;
|
||||
u32 checksum;
|
||||
AOSSRequestRecords* requestRecords = (AOSSRequestRecords*)request;
|
||||
u8 accessPointName[8];
|
||||
AOSSHelloRecord hello;
|
||||
AOSSSocketAddress destination;
|
||||
AOSSKeySchedule schedule;
|
||||
int sequence;
|
||||
u32 crc;
|
||||
AOSSHelloPacket* response = (AOSSHelloPacket*)s_responseBuffer;
|
||||
u16 nonce;
|
||||
u32 stateLength;
|
||||
u32 index;
|
||||
@@ -2341,72 +2331,68 @@ int AOSSSendHelloRequest(void* packet, void* request, int socket) {
|
||||
u32 firstByte;
|
||||
u32 secondIndex;
|
||||
u8* state;
|
||||
u32 i;
|
||||
const u8* input;
|
||||
u8 value;
|
||||
u8 swap;
|
||||
s16 responseLength;
|
||||
s16 sendLength;
|
||||
int sequence;
|
||||
int encryptionResult;
|
||||
|
||||
checksum = 0;
|
||||
sequence = 0;
|
||||
memset(&construction.hello, 0, sizeof(construction.hello));
|
||||
memset(&hello, 0, sizeof(hello));
|
||||
memset(response, 0, 0x5dc);
|
||||
payload = &response->payload;
|
||||
construction.hello.data.fields.type = 2;
|
||||
construction.hello.data.fields.reserved01 = 0;
|
||||
construction.hello.data.fields.length = SOHtoNs(4);
|
||||
construction.hello.data.fields.supportedModes = s_runtime.flags;
|
||||
construction.hello.data.fields.supportedModes = SOHtoNl(construction.hello.data.fields.supportedModes);
|
||||
hello.data.fields.type = 2;
|
||||
hello.data.fields.reserved01 = 0;
|
||||
hello.data.fields.length = SOHtoNs(4);
|
||||
hello.data.fields.supportedModes = s_runtime.flags;
|
||||
hello.data.fields.supportedModes = SOHtoNl(hello.data.fields.supportedModes);
|
||||
responseLength = 8;
|
||||
|
||||
if ((s32)s_connectionState == 1) {
|
||||
const u32* crcTable;
|
||||
sequence = 1;
|
||||
checksum = 0xffffffff;
|
||||
crc = 0xffffffff;
|
||||
AOSSInitCrc32Table(0, s_crcTable);
|
||||
crcTable = s_crcTable;
|
||||
{
|
||||
u32 part;
|
||||
for (part = 0; part < 4; part++) {
|
||||
for (index = 0; index < 2; index++) {
|
||||
checksum = (checksum >> 8) ^ crcTable[(checksum ^ construction.hello.data.bytes[part * 2 + index]) & 0xff];
|
||||
}
|
||||
}
|
||||
index = 0;
|
||||
while (index < 8) {
|
||||
crc = (crc >> 8) ^ s_crcTable[(crc ^ hello.data.bytes[index++]) & 0xff];
|
||||
}
|
||||
checksum = (checksum ^ 0xffffffff) & 0xff;
|
||||
checksum = (crc ^ 0xffffffff) & 0xff;
|
||||
|
||||
construction.schedule.bytes = (u8*)AOSSi_Alloc(8);
|
||||
if (construction.schedule.bytes != 0) {
|
||||
schedule.bytes = (u8*)AOSSi_Alloc(8);
|
||||
if (schedule.bytes != 0) {
|
||||
nonce = (u16)rand();
|
||||
memcpy(&payload->encrypted.key.nonce, &nonce, 2);
|
||||
memcpy(s_packetState.key.nonce, payload->encrypted.key.nonceBytes, 2);
|
||||
memcpy(s_packetState.key.address, s_accessPointName, 8);
|
||||
AOSSInitKeySchedule(&construction.schedule, (const u8*)&s_packetState.key, sizeof(s_packetState.key), 8);
|
||||
for (index = 0; index < 8; index++) {
|
||||
state = construction.schedule.bytes;
|
||||
firstIndex = (construction.schedule.i + 1) % construction.schedule.length & 0xff;
|
||||
AOSSInitKeySchedule(&schedule, (const u8*)&s_packetState.key, sizeof(s_packetState.key), 8);
|
||||
input = hello.data.bytes;
|
||||
for (i = 0; i < 8; i++) {
|
||||
state = schedule.bytes;
|
||||
firstIndex = (schedule.i + 1) % schedule.length & 0xff;
|
||||
firstByte = state[firstIndex];
|
||||
secondIndex = (firstByte + construction.schedule.j) % construction.schedule.length & 0xff;
|
||||
secondIndex = (firstByte + schedule.j) % schedule.length & 0xff;
|
||||
swap = state[secondIndex];
|
||||
stateLength = firstByte + swap;
|
||||
construction.schedule.i = firstIndex;
|
||||
construction.schedule.j = secondIndex;
|
||||
schedule.i = firstIndex;
|
||||
schedule.j = secondIndex;
|
||||
state[secondIndex] = (u8)firstByte;
|
||||
state[firstIndex] = swap;
|
||||
value = state[stateLength % construction.schedule.length] ^ construction.hello.data.bytes[index];
|
||||
payload->bytes[index + 4] = value;
|
||||
value = state[stateLength % schedule.length];
|
||||
payload->bytes[i + 4] = value ^ *input++;
|
||||
}
|
||||
AOSSi_Free(construction.schedule.bytes);
|
||||
AOSSi_Free(schedule.bytes);
|
||||
}
|
||||
payload->encrypted.length = SOHtoNs(8);
|
||||
responseLength = 0x0c;
|
||||
} else {
|
||||
memcpy(payload->bytes, &construction.hello, 8);
|
||||
memcpy(payload->bytes, &hello, 8);
|
||||
}
|
||||
|
||||
memcpy(construction.accessPointName, &requestRecords->records[1], 8);
|
||||
encryptionResult = AOSSXorBufferWithKey(construction.accessPointName, 8, s_manufacturer, 6);
|
||||
memcpy(accessPointName, &requestRecords->records[1], 8);
|
||||
encryptionResult = AOSSXorBufferWithKey(accessPointName, 8, s_manufacturer, 6);
|
||||
if (encryptionResult != 0) {
|
||||
s_errorCode = 2;
|
||||
return -1;
|
||||
@@ -2421,17 +2407,17 @@ int AOSSSendHelloRequest(void* packet, void* request, int socket) {
|
||||
response->header.finalSequence = SOHtoNs(sequence);
|
||||
response->header.reserved = checksum;
|
||||
response->header.messageType = 0x11;
|
||||
memcpy(response->header.messageIdentity, construction.accessPointName, 8);
|
||||
memcpy(response->header.messageIdentity, accessPointName, 8);
|
||||
sendLength = (s16)(responseLength + 0x18);
|
||||
memset(&construction.destination, 0, sizeof(construction.destination));
|
||||
construction.destination.family = 2;
|
||||
construction.destination.port = SOHtoNs(0x5790);
|
||||
construction.destination.address = SOHtoNl(s_runtime.ipAddress);
|
||||
memset(&destination, 0, sizeof(destination));
|
||||
destination.family = 2;
|
||||
destination.port = SOHtoNs(0x5790);
|
||||
destination.address = SOHtoNl(s_runtime.ipAddress);
|
||||
if ((s8)s_runtime.active == 0) {
|
||||
construction.destination.address = 0xffffffff;
|
||||
destination.address = 0xffffffff;
|
||||
}
|
||||
construction.destination.length = 8;
|
||||
SOSendTo(socket, response, sendLength, 0, &construction.destination);
|
||||
destination.length = 8;
|
||||
SOSendTo(socket, response, sendLength, 0, &destination);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
4
src/scene/setting/AOSSData.c
Normal file
4
src/scene/setting/AOSSData.c
Normal file
@@ -0,0 +1,4 @@
|
||||
#include "scene/setting/AOSS.h"
|
||||
|
||||
u32 s_crcTable[0x100];
|
||||
AOSSPacketState s_packetState;
|
||||
@@ -324,16 +324,18 @@ namespace ipl {
|
||||
return mRequestNum;
|
||||
}
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "flags:%d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "rating:%d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "password:%s\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "secretQuestion:%d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "secretAnswer:%s\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "secretAnswerLength:%d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "net contents restrictions:%02x\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "www channel restriction :%d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "requestNum:%s\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "masterkey:%s\n");
|
||||
DECOMP_FORCE_ACTIVE(iplParental_cpp, "country: %d\n");
|
||||
void Parental::dump() {
|
||||
OSReport("flags:%d\n", m_sc.info.enable);
|
||||
OSReport("rating:%d\n", m_sc.info.rating);
|
||||
OSReport("password:%s\n", m_sc.info.password);
|
||||
OSReport("secretQuestion:%d\n", m_sc.info.secretQuestion);
|
||||
OSReport("secretAnswer:%s\n", m_sc.info.secretAnswer);
|
||||
OSReport("secretAnswerLength:%d\n", m_sc.info.secretAnswerLength);
|
||||
OSReport("net contents restrictions:%02x\n", SCGetNetContentRestrictions());
|
||||
OSReport("www channel restriction :%d\n", m_sc.wwwRestrict);
|
||||
OSReport("requestNum:%s\n", mRequestNum);
|
||||
OSReport("masterkey:%s\n", mMasterKey);
|
||||
OSReport("country: %d\n", getCountry());
|
||||
}
|
||||
} // namespace parental
|
||||
} // namespace ipl
|
||||
|
||||
@@ -2705,6 +2705,8 @@ namespace ipl {
|
||||
mUiStatus[2] = 0;
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 1
|
||||
void Setting::scanAP() {
|
||||
BOOL playing = FALSE;
|
||||
switch (mAPScanState) {
|
||||
@@ -2753,9 +2755,8 @@ namespace ipl {
|
||||
mpPaneManager->update();
|
||||
break;
|
||||
case 6: {
|
||||
int animationIndex = mAPAnimationIndex;
|
||||
mInputDelayFrame = 1;
|
||||
playing |= mpMainLayout->getAnim(animationIndex)->isPlaying();
|
||||
playing |= mpMainLayout->getAnim(mAPAnimationIndex)->isPlaying();
|
||||
if (!playing) {
|
||||
mAPScanState = 5;
|
||||
setAPDraw();
|
||||
@@ -2780,9 +2781,8 @@ namespace ipl {
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
int animationIndex = mAPAnimationIndex;
|
||||
mInputDelayFrame = 1;
|
||||
playing |= mpMainLayout->getAnim(animationIndex)->isPlaying();
|
||||
playing |= mpMainLayout->getAnim(mAPAnimationIndex)->isPlaying();
|
||||
if (!playing) {
|
||||
updateScroll();
|
||||
mAPScanState = 6;
|
||||
@@ -2806,6 +2806,7 @@ namespace ipl {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
void Setting::initScroll() {
|
||||
if (mUiStatus[2] == 0) {
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#include <revolution/gx/GXStruct.h>
|
||||
#include <revolution/os/OSError.h>
|
||||
|
||||
extern "C" const unsigned char scRsoFatalColorR;
|
||||
extern "C" const unsigned char scRsoFatalColorG;
|
||||
extern "C" const unsigned char scRsoFatalColorB;
|
||||
extern "C" const unsigned char scRsoFatalColorA;
|
||||
extern "C" const char scRsoFatalMsg[65];
|
||||
extern "C" char scRsoFatalMsg[];
|
||||
extern GXColor scRsoFatalColor;
|
||||
|
||||
#define NW4R_DB_ASSERT_H
|
||||
#define NW4R_ASSERT(x) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
GXColor front = {*((volatile const unsigned char*)&scRsoFatalColorR), *((volatile const unsigned char*)&scRsoFatalColorG), *((volatile const unsigned char*)&scRsoFatalColorB), *((volatile const unsigned char*)&scRsoFatalColorA)}; \
|
||||
GXColor front = scRsoFatalColor; \
|
||||
GXColor back = {0, 0, 0, 0}; \
|
||||
OSFatal((GXColor)front, (GXColor)back, scRsoFatalMsg); \
|
||||
} \
|
||||
@@ -241,7 +238,6 @@ void IplRso_DebugSetPollInterval(u32 val) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma force_active on
|
||||
static layout::Animator* IplRso_getAnim(int idx) {
|
||||
if (idx < 0 || idx >= channel::MAX_ANIMS) {
|
||||
return NULL;
|
||||
@@ -256,7 +252,6 @@ static layout::Animator* IplRso_getAnim(int idx) {
|
||||
}
|
||||
return ((scene::ChannelSelect*)scn)->getRsoAnimator(idx);
|
||||
}
|
||||
#pragma force_active off
|
||||
|
||||
// Do not run this function
|
||||
// It's sole purpose is to make sure that it exports SDK functions for IplRso.
|
||||
@@ -326,15 +321,8 @@ __declspec(export) void IplRso_symbolMaker() {
|
||||
wideTextWriter->CalcStringRect(&rect, L"");
|
||||
}
|
||||
|
||||
extern "C" __declspec(section ".sdata") const unsigned char scRsoFatalColorR = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char scRsoFatalColorG = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char scRsoFatalColorB = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char scRsoFatalColorA = 0;
|
||||
GXColor scRsoFatalColor = {255, 255, 255, 0};
|
||||
|
||||
extern "C" __declspec(section ".data") const char scRsoFatalMsg[65] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
extern "C" char scRsoFatalMsg[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const f32 rso_data_pad_f32 = 0.0f;
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const u16 rso_data_pad_u16 = 0;
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const u8 rso_data_pad_u8 = 0;
|
||||
|
||||
extern "C" __declspec(section ".sdata2") const f32 scRsoZeroF = 0.0f;
|
||||
extern "C" const f32 scRsoZeroF = 0.0f;
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
|
||||
#pragma sym on
|
||||
|
||||
#pragma push
|
||||
#pragma section data_type ".sdata"
|
||||
extern "C" char scTvrcFileHeader[5] = {'T', 'V', 'R', '0', '\0'};
|
||||
#pragma pop
|
||||
|
||||
namespace LibTVRC {
|
||||
const char* TVRC_FILE_HEADER = scTvrcFileHeader;
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void getLanguage__Q23ipl6SystemFv();
|
||||
extern "C" void getRegion__Q23ipl6SystemFv();
|
||||
|
||||
namespace ipl {
|
||||
namespace channel {
|
||||
u32 Manager::mNumFinished;
|
||||
@@ -469,85 +464,34 @@ namespace ipl {
|
||||
System::getSaveData()->setChanInfo(page1, index1, blankInfo);
|
||||
}
|
||||
|
||||
extern "C" asm void getTitleName__Q33ipl7channel7ManagerCFiii() {
|
||||
nofralloc
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
stw r0, 0x24(r1)
|
||||
addi r11, r1, 0x20
|
||||
bl _savegpr_27
|
||||
mulli r28, r4, 0x540
|
||||
mr r27, r3
|
||||
mulli r29, r5, 0x70
|
||||
add r0, r3, r28
|
||||
add r31, r0, r29
|
||||
lbz r0, 0x24(r31)
|
||||
cmpwi r0, 0
|
||||
bne getTitleName_L1
|
||||
li r3, 0
|
||||
b getTitleName_L8
|
||||
getTitleName_L1:
|
||||
mulli r30, r6, 0x2a
|
||||
bl getLanguage__Q23ipl6SystemFv
|
||||
mulli r0, r3, 0x54
|
||||
lwz r3, 0x10(r31)
|
||||
add r0, r30, r0
|
||||
add r3, r3, r0
|
||||
lhz r0, 0x5c(r3)
|
||||
cmpwi r0, 0
|
||||
beq getTitleName_L3
|
||||
bl getLanguage__Q23ipl6SystemFv
|
||||
mulli r3, r3, 0x54
|
||||
lwz r0, 0x10(r31)
|
||||
add r0, r0, r3
|
||||
add r3, r0, r30
|
||||
addi r3, r3, 0x5c
|
||||
b getTitleName_L8
|
||||
getTitleName_L3:
|
||||
bl getRegion__Q23ipl6SystemFv
|
||||
lis r5, scLangLookup__Q23ipl7channel@ha
|
||||
add r4, r27, r28
|
||||
slwi r3, r3, 6
|
||||
li r0, 0x10
|
||||
addi r5, r5, scLangLookup__Q23ipl7channel@l
|
||||
add r6, r29, r4
|
||||
add r8, r5, r3
|
||||
li r3, 0
|
||||
mtctr r0
|
||||
getTitleName_L4:
|
||||
lwzx r7, r8, r3
|
||||
lwz r0, 0x10(r6)
|
||||
mulli r5, r7, 0x54
|
||||
add r0, r0, r30
|
||||
add r4, r5, r0
|
||||
lhz r0, 0x5c(r4)
|
||||
cmpwi r0, 0
|
||||
beq getTitleName_L6
|
||||
lwz r0, 0x10(r31)
|
||||
add r0, r0, r5
|
||||
add r3, r0, r30
|
||||
addi r3, r3, 0x5c
|
||||
b getTitleName_L8
|
||||
getTitleName_L6:
|
||||
addis r0, r7, 1
|
||||
cmplwi r0, 0xffff
|
||||
beq getTitleName_L7
|
||||
addi r3, r3, 4
|
||||
bdnz getTitleName_L4
|
||||
getTitleName_L7:
|
||||
lwz r0, 0(r8)
|
||||
lwz r3, 0x10(r31)
|
||||
mulli r0, r0, 0x54
|
||||
add r0, r3, r0
|
||||
add r3, r0, r30
|
||||
addi r3, r3, 0x5c
|
||||
getTitleName_L8:
|
||||
addi r11, r1, 0x20
|
||||
bl _restgpr_27
|
||||
lwz r0, 0x24(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
wchar_t* Manager::getTitleName(int page, int index, int nameIndex) const {
|
||||
u32 language;
|
||||
const u32* languages;
|
||||
|
||||
if (!mChannels[page][index].loadedBnr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const wchar_t* preferredName = (const wchar_t*)(
|
||||
(const u8*)mChannels[page][index].metaHdr +
|
||||
(nameIndex * (s32)sizeof(mChannels[page][index].metaHdr->names[0][0]) +
|
||||
System::getLanguage() * sizeof(mChannels[page][index].metaHdr->names[0])) +
|
||||
offsetof(SChanMgrMetaHeader, names));
|
||||
if (preferredName[0]) {
|
||||
return mChannels[page][index].metaHdr->names[System::getLanguage()][nameIndex];
|
||||
}
|
||||
|
||||
languages = scLangLookup[System::getRegion()];
|
||||
for (int i = 0; i < 16; i++) {
|
||||
language = languages[i];
|
||||
if (mChannels[page][index].metaHdr->names[(int)language][nameIndex][0]) {
|
||||
return mChannels[page][index].metaHdr->names[language][nameIndex];
|
||||
}
|
||||
if (language == -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mChannels[page][index].metaHdr->names[languages[0]][nameIndex];
|
||||
}
|
||||
|
||||
BOOL Manager::checkNeedUpdate(int page, int index) const {
|
||||
@@ -1191,9 +1135,6 @@ namespace ipl {
|
||||
return (wchar_t*)diskInMsgs->messages[lookup[SC_LANG_JAPANESE]];
|
||||
}
|
||||
|
||||
// Unused?!!! force.
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
BOOL Manager::nand_error_handling(int code) {
|
||||
BOOL result = FALSE;
|
||||
|
||||
@@ -1233,8 +1174,6 @@ namespace ipl {
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma pop
|
||||
|
||||
SEntry* Manager::findEntryByTitleId(ESTitleId titleId) {
|
||||
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
|
||||
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
|
||||
|
||||
@@ -152,11 +152,10 @@ namespace ipl {
|
||||
EGG::Heap* heap1 = mpHeap;
|
||||
EGG::Heap* heap2 = mCSData.heap;
|
||||
|
||||
/* ??? (not even a `(void)heap->getEndAddress()`)*/
|
||||
void* unused1 = heap1->getEndAddress();
|
||||
void* unused2 = heap2->getEndAddress();
|
||||
void* end1 = heap1->getEndAddress();
|
||||
void* end2 = heap2->getEndAddress();
|
||||
|
||||
return heap1->isHeapPointer(addr) || heap2->isHeapPointer(addr);
|
||||
return (heap1->getStartAddress() <= addr && addr < end1) || (heap2->getStartAddress() <= addr && addr < end2);
|
||||
}
|
||||
|
||||
void ChannelScriptManager::calcCSThread() {
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace ipl {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
#pragma force_active on
|
||||
static int getFirstController() {
|
||||
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
|
||||
if (System::getController(i) != NULL) {
|
||||
@@ -54,7 +53,6 @@ namespace ipl {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma force_active off
|
||||
|
||||
void EventObserver::onCommand(textinput::CommandReceiver::INPUT_COMMAND command, void* data) {
|
||||
if (command == textinput::CommandReceiver::INPUT_COMMAND_37 && ((u32*)data)[0] == 0) {
|
||||
|
||||
@@ -275,10 +275,8 @@ namespace ipl {
|
||||
|
||||
DCStoreRange(mpBuffer, mFileLength);
|
||||
|
||||
// Seems like there was going to be logic when close_ returns false, but it seemed like it was not included on release.
|
||||
// However it did left the compare instruction!
|
||||
if (!close_()) {
|
||||
u32 dummy = 0;
|
||||
ASSERTLINE(false, 278);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -931,22 +931,22 @@ namespace ipl {
|
||||
memset(fullDlUrl, 0, sizeof(fullDlUrl));
|
||||
|
||||
NWC24DlId dlIds[4] = {
|
||||
*(volatile const NWC24DlId*)&DL_ID_0,
|
||||
*(volatile const NWC24DlId*)&DL_ID_1,
|
||||
*(volatile const NWC24DlId*)&DL_ID_5,
|
||||
*(volatile const NWC24DlId*)&DL_ID_6,
|
||||
DL_ID_0,
|
||||
DL_ID_1,
|
||||
DL_ID_5,
|
||||
DL_ID_6,
|
||||
};
|
||||
u16 dlIntervals[4] = {
|
||||
*(volatile const u16*)&DL_INTERVAL_0,
|
||||
*(volatile const u16*)&DL_INTERVAL_1,
|
||||
*(volatile const u16*)&DL_INTERVAL_2,
|
||||
*(volatile const u16*)&DL_INTERVAL_3,
|
||||
DL_INTERVAL_0,
|
||||
DL_INTERVAL_1,
|
||||
DL_INTERVAL_2,
|
||||
DL_INTERVAL_3,
|
||||
};
|
||||
u8 dlPrios[4] = {
|
||||
*(volatile const u8*)&DL_PRIORITY_0,
|
||||
*(volatile const u8*)&DL_PRIORITY_1,
|
||||
*(volatile const u8*)&DL_PRIORITY_2,
|
||||
*(volatile const u8*)&DL_PRIORITY_3,
|
||||
DL_PRIORITY_0,
|
||||
DL_PRIORITY_1,
|
||||
DL_PRIORITY_2,
|
||||
DL_PRIORITY_3,
|
||||
};
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
|
||||
@@ -596,155 +596,47 @@ namespace ipl {
|
||||
extern "C" void makeTmpList__Q33ipl8savedata7ManagerFPUxUlPUxUl();
|
||||
extern "C" void moveTitleTmpToPrior__Q33ipl8savedata7ManagerFPUxPCUx();
|
||||
|
||||
asm void Manager::makePriorTitleIDList(register ESTitleId* titleIdsOut, register ESTitleId* titleIdsIn, register u32 titleCount) {
|
||||
nofralloc
|
||||
stwu r1, -0x50(r1)
|
||||
mflr r0
|
||||
stw r0, 0x54(r1)
|
||||
addi r11, r1, 0x50
|
||||
bl _savegpr_14
|
||||
mr r15, r3
|
||||
mr r16, r4
|
||||
mr r17, r5
|
||||
mr r18, r6
|
||||
li r23, 0
|
||||
li r31, 0
|
||||
li r30, 0
|
||||
lis r26, 0x4841
|
||||
li r14, -0x100
|
||||
li r27, 0
|
||||
makePriorTitleIDList_L1:
|
||||
add r25, r15, r31
|
||||
li r22, 0
|
||||
li r29, 0
|
||||
makePriorTitleIDList_L2:
|
||||
add r3, r25, r29
|
||||
lbz r0, 0x30(r3)
|
||||
cmplwi r0, 3
|
||||
bne makePriorTitleIDList_L8
|
||||
lwz r21, 0x38(r3)
|
||||
add r24, r22, r30
|
||||
lwz r20, 0x3c(r3)
|
||||
li r19, 0
|
||||
li r28, 0
|
||||
b makePriorTitleIDList_L7C
|
||||
makePriorTitleIDList_L3:
|
||||
add r3, r17, r28
|
||||
lwzx r0, r17, r28
|
||||
lwz r3, 4(r3)
|
||||
or. r0, r3, r0
|
||||
beq makePriorTitleIDList_L7
|
||||
slwi r0, r24, 3
|
||||
add r4, r16, r0
|
||||
lwzx r3, r16, r0
|
||||
lwz r4, 4(r4)
|
||||
or. r0, r4, r3
|
||||
beq makePriorTitleIDList_L4
|
||||
mr r21, r3
|
||||
mr r20, r4
|
||||
b makePriorTitleIDList_L6
|
||||
makePriorTitleIDList_L4:
|
||||
li r0, -1
|
||||
lis r4, 1
|
||||
and r3, r20, r14
|
||||
addi r5, r26, 0x4100
|
||||
and r0, r21, r0
|
||||
addi r6, r4, 2
|
||||
xor r5, r3, r5
|
||||
xor r4, r0, r6
|
||||
or. r4, r5, r4
|
||||
beq makePriorTitleIDList_L5
|
||||
addi r5, r26, 0x5900
|
||||
xor r4, r0, r6
|
||||
xor r5, r3, r5
|
||||
or. r4, r5, r4
|
||||
beq makePriorTitleIDList_L5
|
||||
addi r5, r26, 0x5a00
|
||||
xoris r4, r0, 1
|
||||
xor r5, r3, r5
|
||||
or. r4, r5, r4
|
||||
bne makePriorTitleIDList_L6
|
||||
makePriorTitleIDList_L5:
|
||||
lwz r4, 0x4f8(r15)
|
||||
lwz r5, 0x4fc(r15)
|
||||
xor r0, r0, r4
|
||||
xor r3, r3, r5
|
||||
or. r0, r3, r0
|
||||
beq makePriorTitleIDList_L6
|
||||
ori r20, r5, 0x41
|
||||
mr r21, r4
|
||||
makePriorTitleIDList_L6:
|
||||
add r4, r17, r28
|
||||
lwzx r7, r17, r28
|
||||
lwz r8, 4(r4)
|
||||
mr r3, r15
|
||||
mr r6, r20
|
||||
mr r5, r21
|
||||
bl isEqualChannel__Q33ipl8savedata7ManagerFUxUx
|
||||
cmpwi r3, -2
|
||||
beq makePriorTitleIDList_L6A
|
||||
cmpwi r3, 0
|
||||
bne makePriorTitleIDList_L6B
|
||||
makePriorTitleIDList_L6A:
|
||||
mr r3, r15
|
||||
mr r6, r20
|
||||
mr r5, r21
|
||||
bl checkValidApp__Q33ipl8savedata7ManagerFUx
|
||||
cmpwi r3, 0
|
||||
beq makePriorTitleIDList_L6C
|
||||
slwi r0, r24, 3
|
||||
add r3, r16, r0
|
||||
stw r20, 4(r3)
|
||||
stwx r21, r16, r0
|
||||
makePriorTitleIDList_L6C:
|
||||
add r3, r17, r28
|
||||
stw r27, 4(r3)
|
||||
stwx r27, r17, r28
|
||||
b makePriorTitleIDList_L7
|
||||
makePriorTitleIDList_L6B:
|
||||
cmpwi r3, 1
|
||||
bne makePriorTitleIDList_L7
|
||||
add r4, r17, r28
|
||||
lwzx r5, r17, r28
|
||||
lwz r6, 4(r4)
|
||||
mr r3, r15
|
||||
bl checkValidApp__Q33ipl8savedata7ManagerFUx
|
||||
cmpwi r3, 0
|
||||
beq makePriorTitleIDList_L6D
|
||||
slwi r0, r24, 3
|
||||
add r5, r17, r28
|
||||
add r3, r16, r0
|
||||
lwzx r4, r17, r28
|
||||
lwz r0, 4(r5)
|
||||
stw r0, 4(r3)
|
||||
stw r4, 0(r3)
|
||||
makePriorTitleIDList_L6D:
|
||||
add r3, r17, r28
|
||||
stw r27, 4(r3)
|
||||
stwx r27, r17, r28
|
||||
makePriorTitleIDList_L7:
|
||||
addi r19, r19, 1
|
||||
addi r28, r28, 8
|
||||
makePriorTitleIDList_L7C:
|
||||
cmplw r19, r18
|
||||
blt makePriorTitleIDList_L3
|
||||
makePriorTitleIDList_L8:
|
||||
addi r22, r22, 1
|
||||
addi r29, r29, 0x10
|
||||
cmpwi r22, 0xc
|
||||
blt makePriorTitleIDList_L2
|
||||
addi r23, r23, 1
|
||||
addi r30, r30, 0xc
|
||||
cmpwi r23, 4
|
||||
addi r31, r31, 0xc0
|
||||
blt makePriorTitleIDList_L1
|
||||
addi r11, r1, 0x50
|
||||
bl _restgpr_14
|
||||
lwz r0, 0x54(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x50
|
||||
blr
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
void Manager::makePriorTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
|
||||
int outputIndex;
|
||||
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
|
||||
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
|
||||
if (mData.chanInfo[page][index].primaryType == channel::PRIMARY_TYPE_CHANNEL) {
|
||||
outputIndex = index + page * MAX_CHANNEL_INDEX;
|
||||
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
|
||||
for (u32 inputIndex = 0; inputIndex < titleCount; inputIndex++) {
|
||||
if (titleIdsIn[inputIndex] == TITLE_NULL) {
|
||||
continue;
|
||||
}
|
||||
if (titleIdsOut[outputIndex] != TITLE_NULL) {
|
||||
titleId = titleIdsOut[outputIndex];
|
||||
} else {
|
||||
ESTitleId titleCode = TITLE_NO_REGION(titleId);
|
||||
if (titleCode == TITLE_PHOTO || titleCode == TITLE_PHOTO_2 || titleCode == TITLE_PHOTO_2_CHECK) {
|
||||
if (titleCode != mPhotoId) {
|
||||
titleId = mPhotoId | TITLE_REGION_ALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
int match = isEqualChannel(titleId, titleIdsIn[inputIndex]);
|
||||
if (match == -2 || match == 0) {
|
||||
if (checkValidApp(titleId)) {
|
||||
titleIdsOut[outputIndex] = titleId;
|
||||
}
|
||||
titleIdsIn[inputIndex] = TITLE_NULL;
|
||||
} else if (match == 1) {
|
||||
if (checkValidApp(titleIdsIn[inputIndex])) {
|
||||
titleIdsOut[outputIndex] = titleIdsIn[inputIndex];
|
||||
}
|
||||
titleIdsIn[inputIndex] = TITLE_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
void Manager::integrateTitleIDList(ESTitleId* titleIdsOut, ESTitleId* titleIdsIn, u32 titleCount) {
|
||||
ESTitleId temporaryTitleIds[0x36] = {0};
|
||||
@@ -804,81 +696,35 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
asm BOOL Manager::doUpdateChanInfos(register ESTitleId* titleIds) {
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
mflr r0
|
||||
stw r0, 0x44(r1)
|
||||
addi r11, r1, 0x40
|
||||
bl _savegpr_20
|
||||
mr r27, r3
|
||||
mr r28, r4
|
||||
li r3, 0
|
||||
li r30, 0
|
||||
li r26, 0
|
||||
li r25, 0
|
||||
li r20, 3
|
||||
li r21, 0
|
||||
li r22, 0xe
|
||||
li r23, -1
|
||||
doUpdateChanInfos_L1:
|
||||
add r31, r27, r26
|
||||
li r29, 0
|
||||
li r24, 0
|
||||
doUpdateChanInfos_L2:
|
||||
add r4, r31, r24
|
||||
lbz r0, 0x30(r4)
|
||||
cmplwi r0, 1
|
||||
beq doUpdateChanInfos_L5
|
||||
add r0, r29, r25
|
||||
lwz r9, 0x38(r4)
|
||||
slwi r0, r0, 3
|
||||
lwz r5, 0x3c(r4)
|
||||
add r8, r28, r0
|
||||
lwzx r6, r28, r0
|
||||
lwz r7, 4(r8)
|
||||
xor r0, r9, r6
|
||||
xor r5, r5, r7
|
||||
or. r0, r5, r0
|
||||
beq doUpdateChanInfos_L5
|
||||
or. r0, r7, r6
|
||||
bne doUpdateChanInfos_L4
|
||||
addi r3, r4, 0x30
|
||||
li r4, 0
|
||||
li r5, 0x10
|
||||
bl memset
|
||||
b doUpdateChanInfos_L6
|
||||
doUpdateChanInfos_L4:
|
||||
stb r20, 0x30(r4)
|
||||
stb r21, 0x31(r4)
|
||||
stb r21, 0x32(r4)
|
||||
stb r21, 0x33(r4)
|
||||
stw r22, 0x34(r4)
|
||||
lwz r0, 0(r8)
|
||||
and r0, r0, r23
|
||||
stw r0, 0x38(r4)
|
||||
lwz r0, 4(r8)
|
||||
and r0, r0, r23
|
||||
stw r0, 0x3c(r4)
|
||||
doUpdateChanInfos_L6:
|
||||
li r3, 1
|
||||
doUpdateChanInfos_L5:
|
||||
addi r29, r29, 1
|
||||
addi r24, r24, 0x10
|
||||
cmpwi r29, 0xc
|
||||
blt doUpdateChanInfos_L2
|
||||
addi r30, r30, 1
|
||||
addi r25, r25, 0xc
|
||||
cmpwi r30, 4
|
||||
addi r26, r26, 0xc0
|
||||
blt doUpdateChanInfos_L1
|
||||
addi r11, r1, 0x40
|
||||
bl _restgpr_20
|
||||
lwz r0, 0x44(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x40
|
||||
blr
|
||||
#pragma push
|
||||
#pragma ppc_iro_level 0
|
||||
BOOL Manager::doUpdateChanInfos(ESTitleId* titleIds) {
|
||||
BOOL changed = FALSE;
|
||||
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
|
||||
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
|
||||
if (mData.chanInfo[page][index].primaryType != channel::PRIMARY_TYPE_DISK) {
|
||||
ESTitleId titleId = ES_TITLE_ID(mData.chanInfo[page][index].titleType, mData.chanInfo[page][index].titleCode);
|
||||
int n = index + page * MAX_CHANNEL_INDEX;
|
||||
if (titleId != titleIds[n]) {
|
||||
if (titleIds[n] == TITLE_NULL) {
|
||||
memset(&mData.chanInfo[page][index], 0, sizeof(channel::SInfo));
|
||||
} else {
|
||||
mData.chanInfo[page][index].primaryType = channel::PRIMARY_TYPE_CHANNEL;
|
||||
mData.chanInfo[page][index].secondaryType = channel::SECONARY_TYPE_NORMAL;
|
||||
mData.chanInfo[page][index].reserved[0] = 0;
|
||||
mData.chanInfo[page][index].reserved[1] = 0;
|
||||
mData.chanInfo[page][index].sceneID = SCENE_NORMAL_CHANNEL;
|
||||
mData.chanInfo[page][index].titleType = ES_TITLE_TYPE(titleIds[n]);
|
||||
mData.chanInfo[page][index].titleCode = ES_TITLE_CODE(titleIds[n]);
|
||||
}
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
#pragma pop
|
||||
#endif
|
||||
|
||||
BOOL Manager::checkValidApp(ESTitleId titleId) {
|
||||
|
||||
@@ -1482,12 +1482,10 @@ namespace ipl {
|
||||
} // namespace ipl
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#pragma force_active on
|
||||
extern "C" const f32 scOrthoLeft = -304.0f;
|
||||
extern "C" const f32 scOrthoRight = 304.0f;
|
||||
extern "C" const f32 scOrthoBottom = 228.0f;
|
||||
extern "C" const f32 scOrthoTop = -228.0f;
|
||||
extern "C" const f32 scWideOrthoLeft = -416.0f;
|
||||
extern "C" const f32 scWideOrthoRight = 416.0f;
|
||||
#pragma force_active off
|
||||
#endif
|
||||
|
||||
@@ -361,18 +361,132 @@ namespace ipl {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// DeleteSharedContent did not survive
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: MEMAllocate for TMD err\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_ListSharedContents1 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: MEMAllocate for SHA-1 hash err\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_ListSharedContents2 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_ListTitlesOnCard1 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: MEMAllocate for Title List err\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: MEMAllocate for Title List err\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_ListTitlesOnCard2 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_GetTmd1 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_GetTmd2 err %d\n");
|
||||
DECOMP_FORCE_ACTIVE(iplESMisc_cpp, "DeleteSharedContent: ES_DeleteSharedContent err %d\n");
|
||||
extern "C" ESError ES_DeleteSharedContent(const u8* hash);
|
||||
|
||||
ESError ESMisc::DeleteSharedContent(EGG::Heap* heap) {
|
||||
ESTitleMeta* tmd = NULL;
|
||||
ESHash* hashes = NULL;
|
||||
u8* used = NULL;
|
||||
ESTitleId* titleIds = NULL;
|
||||
u32 numShared = 0;
|
||||
u32 numTitles = 0;
|
||||
ESError ret;
|
||||
|
||||
tmd = (ESTitleMeta*)heap->alloc(OSRoundUp32B(sizeof(ESTitleMeta)), -DEFAULT_ALIGN);
|
||||
if (tmd == NULL) {
|
||||
OSReport("DeleteSharedContent: MEMAllocate for TMD err\n");
|
||||
return ES_ERR_MEMORY_ERROR;
|
||||
}
|
||||
|
||||
ret = ES_ListSharedContents(&numShared, NULL);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_ListSharedContents1 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (numShared == 0) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
hashes = (ESHash*)heap->alloc(OSRoundUp32B(numShared * sizeof(ESHash)), -DEFAULT_ALIGN);
|
||||
if (hashes == NULL) {
|
||||
OSReport("DeleteSharedContent: MEMAllocate for SHA-1 hash err\n");
|
||||
ret = ES_ERR_MEMORY_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ES_ListSharedContents(&numShared, hashes);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_ListSharedContents2 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
used = (u8*)heap->alloc(OSRoundUp32B(numShared), -DEFAULT_ALIGN);
|
||||
if (used == NULL) {
|
||||
ret = ES_ERR_MEMORY_ERROR;
|
||||
goto out;
|
||||
}
|
||||
memset(used, 0, numShared);
|
||||
|
||||
ret = ES_ListTitlesOnCard(NULL, &numTitles);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_ListTitlesOnCard1 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (numTitles != 0) {
|
||||
titleIds = (ESTitleId*)heap->alloc(OSRoundUp32B(numTitles * sizeof(ESTitleId)), -DEFAULT_ALIGN);
|
||||
if (titleIds == NULL) {
|
||||
OSReport("DeleteSharedContent: MEMAllocate for Title List err\n");
|
||||
ret = ES_ERR_MEMORY_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ES_ListTitlesOnCard(titleIds, &numTitles);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_ListTitlesOnCard2 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < numTitles; i++) {
|
||||
u32 tmdSize = 0;
|
||||
|
||||
ret = ES_GetTmd(titleIds[i], NULL, &tmdSize);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_GetTmd1 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (tmdSize == 0 || tmdSize > sizeof(ESTitleMeta)) {
|
||||
ret = ES_ERR_INVALID;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ES_GetTmd(titleIds[i], tmd, &tmdSize);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_GetTmd2 err %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (u16 c = 0; c < tmd->head.numContents; c++) {
|
||||
if ((tmd->contents[c].type & 0x8000) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (u32 h = 0; h < numShared; h++) {
|
||||
if (memcmp(tmd->contents[c].hash, hashes[h], sizeof(ESHash)) == 0) {
|
||||
used[h] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 h = 0; h < numShared; h++) {
|
||||
if (used[h] != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = ES_DeleteSharedContent(hashes[h]);
|
||||
if (ret < ES_ERR_OK) {
|
||||
OSReport("DeleteSharedContent: ES_DeleteSharedContent err %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (titleIds != NULL) {
|
||||
heap->free(titleIds);
|
||||
}
|
||||
if (used != NULL) {
|
||||
heap->free(used);
|
||||
}
|
||||
if (hashes != NULL) {
|
||||
heap->free(hashes);
|
||||
}
|
||||
heap->free(tmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL ESMisc::IsLastTicketExpired(ESTitleId* titleId) {
|
||||
s32 ret;
|
||||
@@ -884,12 +998,24 @@ namespace ipl {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void verifySavedataZD(EGG::Heap* heap, ESTitleId titleId, NANDFileInfo* fileInfo) {
|
||||
char path[NAND_MAX_PATH];
|
||||
static inline void verifySavedataZD(EGG::Heap* heap, ESTitleId requestedTitleId, NANDFileInfo* fileInfo) {
|
||||
ESTitleId titleId;
|
||||
u32 offset;
|
||||
u32 j;
|
||||
BOOL valid;
|
||||
BOOL fileOpen;
|
||||
u8* firstBlock;
|
||||
u8* secondBlock;
|
||||
BOOL deleteSaveData;
|
||||
s32 ret;
|
||||
u8* saveData = NULL;
|
||||
BOOL fileOpen = FALSE;
|
||||
BOOL deleteSaveData = FALSE;
|
||||
u8* saveData;
|
||||
titleId = requestedTitleId;
|
||||
|
||||
char path[NAND_MAX_PATH];
|
||||
|
||||
saveData = NULL;
|
||||
fileOpen = FALSE;
|
||||
deleteSaveData = FALSE;
|
||||
|
||||
sprintf(path, "/title/%08x/%08x/data/%s", (u32)((titleId & 0x00FFFFFFFFFFFFFFULL) >> 32), (u32)(titleId & 0x00FFFFFFFFFFFFFFULL), "zeldaTp.dat");
|
||||
if (!ESMisc::ChangeUid(titleId)) {
|
||||
@@ -916,17 +1042,17 @@ namespace ipl {
|
||||
OSReport("%s::%s: File size is not correct: %d\n", __FILE__, __FUNCTION__, ret);
|
||||
deleteSaveData = TRUE;
|
||||
} else {
|
||||
u32 offset = 8;
|
||||
u32 j = 0;
|
||||
BOOL valid = FALSE;
|
||||
offset = 8;
|
||||
valid = FALSE;
|
||||
j = 0;
|
||||
while (j < 3) {
|
||||
u8* block = saveData + offset;
|
||||
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x58, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x72, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x8e, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
|
||||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
|
||||
firstBlock = saveData + offset;
|
||||
if (!checkForNullTermination((char*)firstBlock + 0x4e, 8) ||
|
||||
!checkForNullTermination((char*)firstBlock + 0x58, 8) ||
|
||||
!checkForNullTermination((char*)firstBlock + 0x72, 8) ||
|
||||
!checkForNullTermination((char*)firstBlock + 0x8e, 8) ||
|
||||
!checkForNullTermination((char*)firstBlock + 0x1b4, 0x11) ||
|
||||
!checkForNullTermination((char*)firstBlock + 0x1c5, 0x11)) {
|
||||
goto verify_failed;
|
||||
}
|
||||
j++;
|
||||
@@ -936,13 +1062,13 @@ namespace ipl {
|
||||
offset = 0x2008;
|
||||
j = 0;
|
||||
while (j < 3) {
|
||||
u8* block = saveData + offset;
|
||||
if (!checkForNullTermination((char*)block + 0x4e, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x58, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x72, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x8e, 8) ||
|
||||
!checkForNullTermination((char*)block + 0x1b4, 0x11) ||
|
||||
!checkForNullTermination((char*)block + 0x1c5, 0x11)) {
|
||||
secondBlock = saveData + offset;
|
||||
if (!checkForNullTermination((char*)secondBlock + 0x4e, 8) ||
|
||||
!checkForNullTermination((char*)secondBlock + 0x58, 8) ||
|
||||
!checkForNullTermination((char*)secondBlock + 0x72, 8) ||
|
||||
!checkForNullTermination((char*)secondBlock + 0x8e, 8) ||
|
||||
!checkForNullTermination((char*)secondBlock + 0x1b4, 0x11) ||
|
||||
!checkForNullTermination((char*)secondBlock + 0x1c5, 0x11)) {
|
||||
goto verify_failed;
|
||||
}
|
||||
j++;
|
||||
@@ -979,8 +1105,11 @@ namespace ipl {
|
||||
}
|
||||
|
||||
static inline s32 DeleteTicketsForce(EGG::Heap* heap, ESTitleId titleId, u8* ticketViews, u32* ticketViewCount) {
|
||||
ESTicketView* ticketViewList = NULL;
|
||||
s32 ret;
|
||||
u32 j;
|
||||
ESTicketView* ticketViewList;
|
||||
ticketViewList = NULL;
|
||||
|
||||
memset(ticketViews, 0, OSRoundUp32B(sizeof(ESTicketView)));
|
||||
ret = ES_GetTicketViews(titleId, NULL, ticketViewCount);
|
||||
if (ret != ES_ERR_OK) {
|
||||
@@ -996,7 +1125,7 @@ namespace ipl {
|
||||
OSReport("%s::%s: ES_GetTicketViews failed: %d for %016llx\n", __FILE__, __FUNCTION__, ret, titleId);
|
||||
goto cleanup;
|
||||
}
|
||||
for (u32 j = 0; j < *ticketViewCount; j++) {
|
||||
for (j = 0; j < *ticketViewCount; j++) {
|
||||
memcpy(ticketViews, &ticketViewList[j], sizeof(ESTicketView));
|
||||
ret = ES_DeleteTicket((ESTicketView*)ticketViews);
|
||||
if (ret != ES_ERR_OK) {
|
||||
@@ -1012,12 +1141,16 @@ namespace ipl {
|
||||
}
|
||||
|
||||
static inline s32 InitSavedata(EGG::Heap* heap) {
|
||||
u32 i;
|
||||
s32 ret;
|
||||
ESTitleId* titleIds;
|
||||
u8* ticketScratch;
|
||||
u8 ticketViews[OSRoundUp32B(sizeof(ESTicketView))] ALIGN32;
|
||||
NANDFileInfo fileInfo ALIGN32;
|
||||
u32 ticketViewCount;
|
||||
ESTitleId* titleIds = NULL;
|
||||
titleIds = NULL;
|
||||
u32 titleCount = 0;
|
||||
s32 ret = ES_ListTitlesOnCard(NULL, &titleCount);
|
||||
ret = ES_ListTitlesOnCard(NULL, &titleCount);
|
||||
|
||||
if (ret != ES_ERR_OK) {
|
||||
OSReport("%s::%s: Failed to ES_ListTitlesOnCard1: %d\n", __FILE__, __FUNCTION__, ret);
|
||||
@@ -1037,8 +1170,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
{
|
||||
u8* ticketScratch = ticketViews;
|
||||
for (u32 i = 0; i < titleCount; i++) {
|
||||
ticketScratch = ticketViews;
|
||||
for (i = 0; i < titleCount; i++) {
|
||||
if ((titleIds[i] & 0xFFFFFFFFFFFFFF00ULL) == 0x00010000525A4400ULL) {
|
||||
verifySavedataZD(heap, titleIds[i], &fileInfo);
|
||||
continue;
|
||||
@@ -1063,10 +1196,6 @@ namespace ipl {
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
|
||||
return InitSavedata(heap);
|
||||
}
|
||||
|
||||
BOOL checkForNullTermination(char* str, u32 len) {
|
||||
for (u32 i = 0; i < len; i++) {
|
||||
if (*str == 0) {
|
||||
@@ -1077,6 +1206,10 @@ namespace ipl {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 ESMisc::DeleteUnauthorizedData(EGG::Heap* heap) {
|
||||
return InitSavedata(heap);
|
||||
}
|
||||
|
||||
TMDFile::TMDFile(EGG::Heap* heap) : mpHeap(heap), mbFileOpen(FALSE), mFileLength(0) {
|
||||
memset(&mFile, 0, sizeof(mFile));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
EXPECTED_DOL_SHA1 = "26116613f624061ba99c8d1a299aaa6efa85670d"
|
||||
EXPECTED_TOTAL_UNITS = 1027
|
||||
EXPECTED_TOTAL_UNITS = 1028
|
||||
EXPECTED_TOTAL_CODE = 2995176
|
||||
EXPECTED_TOTAL_DATA = 1832684
|
||||
EXPECTED_TOTAL_FUNCTIONS = 12563
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user