Compare commits

..

11 Commits

Author SHA1 Message Date
Devin AI
b2521ae15a nwc24: MBoxCtrl CancelMsg structure + CreateCtrlFile tail + PrvFmt temps
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 11:46:49 +00:00
Devin AI
a8c28a85d4 nwc24: NWC24iDetectBreakPoint + SetMsgSubjectAndText structural fixes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 11:27:42 +00:00
Devin AI
4602507d10 nwc24: Mime CopyWithoutLinearWhiteSpaces exact; DecodeWord/ExtractCharset/EncodedText near-count-equal
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 10:23:17 +00:00
Devin AI
2cb5852df1 nwc24: Mime CopyWithoutLinearWhiteSpaces exact; DecodeWord/ExtractCharset/EncodedText count-equal
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 10:23:10 +00:00
Devin AI
c0646f394a nwc24-msg: MsgRead MB-field readers exact
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 09:40:12 +00:00
Devin AI
bc7ef44a94 nwc24: decomp NWC24MsgCommit.c 17/18 fns + NWC24iAddr/NWC24Data unions
- Ported from RVL_SDK NWC24MsgCommit.c (ogws reference) with 4.3U
  additions: X-Wii-IconNew field, recv-time flag-24 date override,
  HACA appId guard, per-field remainSize budgeting
- data/sdata/sbss byte-identical (base tail pads only)
- CommitMsgInternal: 827/827 insns, 14 callee-reg renames (tie-break)

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 08:45:55 +00:00
Devin AI
a0ee1d05b1 nwc24: drop stale NWC24iMBoxCheck extern (real decl in NWC24MBox.h)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 08:10:56 +00:00
Devin AI
341d5163a3 nwc24: match NWC24MBoxCtrl.c (partial - 11 fns exact)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 08:10:46 +00:00
Devin AI
a19cd33c67 flip NWC24DateParser.c to Matching (DOL hash OK)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 06:34:15 +00:00
Devin AI
cea939b665 decomp NWC24Mime.c 12/16 fns (97.1%)
Base64/QP encode+decode, EncodeWord, ConcatEncodedText,
NWC24DecodeMIMEHeaderFieldBody exact. Remaining: DecodeWord,
ExtractCharset, ExtractEncodedText (scan-loop branch-form +
regalloc tie-breaks), CopyWithoutLinearWhiteSpaces (2-insn sched).

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 06:31:05 +00:00
Devin AI
75ca887184 decomp NWC24DateParser.c 100% (8/8 fns, code+data)
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-09-29 05:21:21 +00:00
119 changed files with 7214 additions and 47966 deletions

View File

@@ -1,62 +0,0 @@
name: README progress
# runs on the self-hosted runner on cole's server so it doesn't use hosted minutes.
# only push/schedule/manual triggers, never pull_request, so fork PRs can't reach this machine.
on:
push:
branches: [main]
paths-ignore: [README.md]
schedule:
- cron: "*/30 * * * *"
workflow_dispatch:
concurrency:
group: readme-progress
cancel-in-progress: true
permissions:
contents: write
jobs:
progress:
runs-on: [self-hosted, wii-ipl-local]
timeout-minutes: 60
env:
ORIG_APP: /mnt/drive2/projects/wiichannels/wii-ipl/orig/43U/00000008.app
TOOL_CACHE: /mnt/drive2/projects/wiichannels/wii-ipl/build
NINJA: /home/cole/projects/tests/.venv/bin/ninja
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 1
- name: Prepare
run: |
mkdir -p build orig/43U
cp "$ORIG_APP" orig/43U/00000008.app
[ -d build/compilers ] || cp -a "$TOOL_CACHE/compilers" build/
[ -d build/tools ] || cp -a "$TOOL_CACHE/tools" build/
- name: Build
run: |
python3 configure.py --version 43U
"$NINJA"
"$NINJA" build/43U/ok
- name: Report
run: build/tools/objdiff-cli report generate -p . -o build/43U/report.json -f json
- name: Update README
run: python3 tools/update_readme_progress.py build/43U/report.json README.md "$GITHUB_SHA"
- name: Commit
run: |
if git diff --quiet README.md; then exit 0; fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs: update progress [skip ci]"
git pull --rebase origin main || { git rebase --abort; echo "main moved, next run will update"; exit 0; }
git push origin HEAD:main

View File

@@ -50,16 +50,6 @@ Supported versions:
Progress
========
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 80.98% | 72.11% | 56.76% | 86.16% |
units 748/1027 complete, functions 10570/12563 matched. updated 2026-09-29 22:58 UTC from `test` by the self-hosted progress job
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->
| Version | Progress |
|-----------------------|------------------------------------------------------------------------------|
| [Wii Menu 4.3U][V43U] | [![FuncBadgeV43U]][V43U] [![DecompBadgeV43U]][V43U] [![LinkBadgeV43U]][V43U] |

View File

@@ -4596,21 +4596,21 @@ updateChannelNotices__Q33ipl5scene15SDChannelSelectFii = .text:0x813DC7EC; // ty
processWorkerState__Q33ipl5scene15SDChannelSelectFv = .text:0x813DC938; // type:function size:0x18C
updateDialogAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DCAC4; // type:function size:0x42C
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
findAdjacentChannel__Q33ipl5scene15SDChannelSelectCFiPiPi = .text:0x813DDBB4; // type:function size:0xB4
setCurrentPageAndRefresh__Q33ipl5scene15SDChannelSelectFiiPQ33ipl5scene12SDChannelObj = .text:0x813DDC68; // type:function size:0x18
handleFourPageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDC80; // type:function size:0x58
flushSaveDataAndMountSD__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDCD8; // type:function size:0x8C
handleThreePageDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDD64; // type:function size:0x58
finishCardDialog__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDDBC; // type:function size:0x5C
finishDialogOperation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDE18; // type:function size:0x2C
finishDialogTransition__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDE44; // type:function size:0x24
iplSDChannelSelect_813DCF14 = .text:0x813DCF14; // type:function size:0xCC
iplSDChannelSelect_813DCFE0 = .text:0x813DCFE0; // type:function size:0xCC
iplSDChannelSelect_813DD0AC = .text:0x813DD0AC; // type:function size:0x194
iplSDChannelSelect_813DD240 = .text:0x813DD240; // type:function size:0x198
iplSDChannelSelect_813DD3D8 = .text:0x813DD3D8; // type:function size:0x1F8
iplSDChannelSelect_813DD5D0 = .text:0x813DD5D0; // type:function size:0x5A4
iplSDChannelSelect_813DDB74 = .text:0x813DDB74; // type:function size:0x40
iplSDChannelSelect_813DDBB4 = .text:0x813DDBB4; // type:function size:0xB4
iplSDChannelSelect_813DDC68 = .text:0x813DDC68; // type:function size:0x18
iplSDChannelSelect_813DDC80 = .text:0x813DDC80; // type:function size:0x58
iplSDChannelSelect_813DDCD8 = .text:0x813DDCD8; // type:function size:0x8C
iplSDChannelSelect_813DDD64 = .text:0x813DDD64; // type:function size:0x58
iplSDChannelSelect_813DDDBC = .text:0x813DDDBC; // type:function size:0x5C
iplSDChannelSelect_813DDE18 = .text:0x813DDE18; // type:function size:0x2C
iplSDChannelSelect_813DDE44 = .text:0x813DDE44; // type:function size:0x24
isResetProcessDone__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDE68; // type:function size:0x28
calcCommon__Q33ipl5scene15SDChannelSelectFv = .text:0x813DDE90; // type:function size:0x1B0
calcFadein__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE040; // type:function size:0x30
@@ -4623,60 +4623,60 @@ createBaseLayout__Q33ipl5scene15SDChannelSelectFv = .text:0x813DE9FC; // type:fu
updateChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DEE3C; // type:function size:0x5C
updateChannelObject__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene12SDChannelObj = .text:0x813DEE98; // type:function size:0x78
calcChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DEF10; // type:function size:0x58
drawChannelTransitionObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DEF68; // type:function size:0x27C
isChannelReady__Q33ipl5scene15SDChannelSelectFPCQ33ipl5scene12SDChannelObj = .text:0x813DF1E4; // type:function size:0x14
iplSDChannelSelect_813DEF68 = .text:0x813DEF68; // type:function size:0x27C
iplSDChannelSelect_813DF1E4 = .text:0x813DF1E4; // type:function size:0x14
drawChannelObjects__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF1F8; // type:function size:0xB0
processNormalInput__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF2A8; // type:function size:0x138
setPageActionFrame__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF3E0; // type:function size:0x1C
finishPageScroll__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF3FC; // type:function size:0x110
advancePageAnimation__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF50C; // type:function size:0x4C
initializeNormalPage__Q33ipl5scene15SDChannelSelectFv = .text:0x813DF558; // type:function size:0x178
refreshPageObjects__Q33ipl5scene15SDChannelSelectFiPQ33ipl5scene12SDChannelObji = .text:0x813DF6D0; // type:function size:0x164
iplSDChannelSelect_813DF2A8 = .text:0x813DF2A8; // type:function size:0x138
iplSDChannelSelect_813DF3E0 = .text:0x813DF3E0; // type:function size:0x1C
iplSDChannelSelect_813DF3FC = .text:0x813DF3FC; // type:function size:0x110
iplSDChannelSelect_813DF50C = .text:0x813DF50C; // type:function size:0x4C
iplSDChannelSelect_813DF558 = .text:0x813DF558; // type:function size:0x178
iplSDChannelSelect_813DF6D0 = .text:0x813DF6D0; // type:function size:0x164
createChannelList__Q33ipl5scene15SDChannelSelectFib = .text:0x813DF834; // type:function size:0x110
createChannelObject__Q33ipl5scene15SDChannelSelectFii = .text:0x813DF944; // type:function size:0x84
destroyUnusedChannelObjects__Q33ipl5scene15SDChannelSelectFiPQ33ipl5scene12SDChannelObj = .text:0x813DF9C8; // type:function size:0xF8
refreshChannelList__Q33ipl5scene15SDChannelSelectFv = .text:0x813DFAC0; // type:function size:0xFC
refreshAfterSDTitleList__Q33ipl5scene15SDChannelSelectFv = .text:0x813DFBBC; // type:function size:0xE4
destroyChannelObject__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene12SDChannelObj = .text:0x813DFCA0; // type:function size:0x50
updateChannelObjectOrder__Q33ipl5scene15SDChannelSelectFi = .text:0x813DFCF0; // type:function size:0x74
moveChannelObjectsToDrawOrder__Q33ipl5scene15SDChannelSelectFii = .text:0x813DFD64; // type:function size:0x154
iplSDChannelSelect_813DFCF0 = .text:0x813DFCF0; // type:function size:0x74
iplSDChannelSelect_813DFD64 = .text:0x813DFD64; // type:function size:0x154
findChannelObject__Q33ipl5scene15SDChannelSelectCFii = .text:0x813DFEB8; // type:function size:0x74
updateArrowVisibility__Q33ipl5scene15SDChannelSelectFv = .text:0x813DFF2C; // type:function size:0x1C0
iplSDChannelSelect_813DFF2C = .text:0x813DFF2C; // type:function size:0x1C0
hasChannelObject__Q33ipl5scene15SDChannelSelectCFii = .text:0x813E00EC; // type:function size:0x140
isChannelInCalc__Q33ipl5scene15SDChannelSelectCFiii = .text:0x813E022C; // type:function size:0x68
isPageCreated__Q33ipl5scene15SDChannelSelectCFi = .text:0x813E0294; // type:function size:0x104
setStateAndPlaySelectSound__Q33ipl5scene15SDChannelSelectFi = .text:0x813E0398; // type:function size:0x18
setLayoutFrame__Q33ipl5scene15SDChannelSelectFi = .text:0x813E03B0; // type:function size:0xA0
selectChannel__Q33ipl5scene15SDChannelSelectFii = .text:0x813E0450; // type:function size:0xEC
tellStartingZoomAnm__Q33ipl5scene15SDChannelSelectFv = .text:0x813E053C; // type:function size:0x84
prepareRestarting__Q33ipl5scene15SDChannelSelectFi = .text:0x813E05C0; // type:function size:0x64
startPageTransition__Q33ipl5scene15SDChannelSelectFii = .text:0x813E0624; // type:function size:0xB4
iplSDChannelSelect_813E0294 = .text:0x813E0294; // type:function size:0x104
iplSDChannelSelect_813E0398 = .text:0x813E0398; // type:function size:0x18
iplSDChannelSelect_813E03B0 = .text:0x813E03B0; // type:function size:0xA0
iplSDChannelSelect_813E0450 = .text:0x813E0450; // type:function size:0xEC
iplSDChannelSelect_813E053C = .text:0x813E053C; // type:function size:0x84
iplSDChannelSelect_813E05C0 = .text:0x813E05C0; // type:function size:0x64
iplSDChannelSelect_813E0624 = .text:0x813E0624; // type:function size:0xB4
getChannelBasePane__Q33ipl5scene15SDChannelSelectCFiii = .text:0x813E06D8; // type:function size:0xAC
getCenterChannelPane__Q33ipl5scene15SDChannelSelectCFi = .text:0x813E0784; // type:function size:0x30
getChannelPane__Q33ipl5scene15SDChannelSelectCFi = .text:0x813E07B4; // type:function size:0x30
getChannelPanePosition__Q33ipl5scene15SDChannelSelectFPQ33ipl5scene15SDChannelSelecti = .text:0x813E07E4; // type:function size:0x64
setChannelScissor__Q33ipl5scene15SDChannelSelectCFPCQ33ipl5scene12SDChannelObj = .text:0x813E0848; // type:function size:0x3A4
initPageAnimations__Q33ipl5scene15SDChannelSelectFRCQ33ipl4math4VEC3i = .text:0x813E0BEC; // type:function size:0x294
iplSDChannelSelect_813E0848 = .text:0x813E0848; // type:function size:0x3A4
iplSDChannelSelect_813E0BEC = .text:0x813E0BEC; // type:function size:0x294
calcPageAnimations__Q33ipl5scene15SDChannelSelectFv = .text:0x813E0E80; // type:function size:0x60
updatePageTransform__Q33ipl5scene15SDChannelSelectFv = .text:0x813E0EE0; // type:function size:0x26C
getCenterChannelIndex__Q33ipl5scene15SDChannelSelectCFPCc = .text:0x813E114C; // type:function size:0x78
createSceneLayouts__Q33ipl5scene15SDChannelSelectFv = .text:0x813E11C4; // type:function size:0x3A4
updateDragState__Q33ipl5scene15SDChannelSelectFv = .text:0x813E1568; // type:function size:0x124
updateDragPageTransition__Q33ipl5scene15SDChannelSelectFv = .text:0x813E168C; // type:function size:0x2D0
finishDragWait__Q33ipl5scene15SDChannelSelectFv = .text:0x813E195C; // type:function size:0x6C
finishDragPageTransition__Q33ipl5scene15SDChannelSelectFv = .text:0x813E19C8; // type:function size:0x68
applyChannelMove__Q33ipl5scene15SDChannelSelectFv = .text:0x813E1A30; // type:function size:0x208
finishChannelMove__Q33ipl5scene15SDChannelSelectFv = .text:0x813E1C38; // type:function size:0x118
resetDragPreview__Q33ipl5scene15SDChannelSelectFv = .text:0x813E1D50; // type:function size:0xFC
finishDragPageChange__Q33ipl5scene15SDChannelSelectFv = .text:0x813E1E4C; // type:function size:0x19C
onEventDerived__Q33ipl5scene15SDChannelSelectFPCcUlPQ33ipl10controller9Interface = .text:0x813E1FE8; // type:function size:0x1A4
onButtonEvent__Q33ipl5scene15SDChannelSelectFPCcUlPCQ33ipl10controller9Interface = .text:0x813E218C; // type:function size:0x16C
startDrag__Q33ipl5scene15SDChannelSelectFPCQ33ipl10controller9Interfaceii = .text:0x813E22F8; // type:function size:0x1E0
finishDrag__Q33ipl5scene15SDChannelSelectFv = .text:0x813E24D8; // type:function size:0x204
isChannelMoveTarget__Q33ipl5scene15SDChannelSelectCFii = .text:0x813E26DC; // type:function size:0x74
moveDrag__Q33ipl5scene15SDChannelSelectFv = .text:0x813E2750; // type:function size:0x164
onEvent__Q43ipl5scene32@unnamed@iplSDChannelSelect_cpp@27SDChannelSelectEventHandlerFUlUlPv = .text:0x813E28B4; // type:function size:0x2A0
onEventDerived__Q43ipl5scene32@unnamed@iplSDChannelSelect_cpp@33SDChannelSelectButtonEventHandlerFUlUlPCQ33ipl10controller9Interface = .text:0x813E2B54; // type:function size:0x240
iplSDChannelSelect_813E0EE0 = .text:0x813E0EE0; // type:function size:0x26C
iplSDChannelSelect_813E114C = .text:0x813E114C; // type:function size:0x78
iplSDChannelSelect_813E11C4 = .text:0x813E11C4; // type:function size:0x3A4
iplSDChannelSelect_813E1568 = .text:0x813E1568; // type:function size:0x124
iplSDChannelSelect_813E168C = .text:0x813E168C; // type:function size:0x2D0
iplSDChannelSelect_813E195C = .text:0x813E195C; // type:function size:0x6C
iplSDChannelSelect_813E19C8 = .text:0x813E19C8; // type:function size:0x68
iplSDChannelSelect_813E1A30 = .text:0x813E1A30; // type:function size:0x208
iplSDChannelSelect_813E1C38 = .text:0x813E1C38; // type:function size:0x118
iplSDChannelSelect_813E1D50 = .text:0x813E1D50; // type:function size:0xFC
iplSDChannelSelect_813E1E4C = .text:0x813E1E4C; // type:function size:0x19C
iplSDChannelSelect_813E1FE8 = .text:0x813E1FE8; // type:function size:0x1A4
iplSDChannelSelect_813E218C = .text:0x813E218C; // type:function size:0x16C
iplSDChannelSelect_813E22F8 = .text:0x813E22F8; // type:function size:0x1E0
iplSDChannelSelect_813E24D8 = .text:0x813E24D8; // type:function size:0x204
iplSDChannelSelect_813E26DC = .text:0x813E26DC; // type:function size:0x74
iplSDChannelSelect_813E2750 = .text:0x813E2750; // type:function size:0x164
iplSDChannelSelect_813E28B4 = .text:0x813E28B4; // type:function size:0x2A0
iplSDChannelSelect_813E2B54 = .text:0x813E2B54; // type:function size:0x240
startResetting__Q33ipl5scene15SDChannelSelectFv = .text:0x813E2D94; // type:function size:0x44
pop__Q33ipl5scene26SDChannelSelectNoticeQueueFv = .text:0x813E2DD8; // type:function size:0x4C
push__Q33ipl5scene27SDChannelSelectCommandQueueFRCQ33ipl5scene22SDChannelSelectCommand = .text:0x813E2E24; // type:function size:0x80
@@ -4694,7 +4694,7 @@ iplSDChannelObj_813E322C = .text:0x813E322C; // type:function size:0x9C
iplSDChannelObj_813E32C8 = .text:0x813E32C8; // type:function size:0x3C
iplSDChannelObj_813E3304 = .text:0x813E3304; // type:function size:0x8
iplSDChannelObj_813E330C = .text:0x813E330C; // type:function size:0x14
getTranslate__Q33ipl5scene12SDChannelObjCFv = .text:0x813E3320; // type:function size:0x10
iplSDChannelObj_813E3320 = .text:0x813E3320; // type:function size:0x10
iplSDChannelObj_813E3330 = .text:0x813E3330; // type:function size:0x24
iplSDChannelObj_813E3354 = .text:0x813E3354; // type:function size:0x98
iplSDChannelObj_813E33EC = .text:0x813E33EC; // type:function size:0x94
@@ -4837,7 +4837,7 @@ onEvent__Q33ipl5scene22SDMenuEventHandlerBaseFUlUlPv = .text:0x813EB51C; // type
onEventDerived__Q33ipl5scene22SDMenuEventHandlerBaseFUlUlPCQ33ipl10controller9Interface = .text:0x813EB5E8; // type:function size:0x4
__ct__Q33ipl5scene8SDMemoryFv = .text:0x813EB5EC; // type:function size:0x48
__dt__Q33ipl5scene8SDMemoryFv = .text:0x813EB634; // type:function size:0x5C
create__Q33ipl5scene8SDMemoryFPQ23EGG4HeapPQ33ipl4nand10LayoutFilePQ33ipl5scene15SDChannelSelect = .text:0x813EB690; // type:function size:0x10A0
create__Q33ipl5scene8SDMemoryFPQ23EGG4HeapPQ33ipl4nand10LayoutFilePQ33ipl5scene17NandSDCardManager = .text:0x813EB690; // type:function size:0x10A0
setTitleLists__Q33ipl5scene8SDMemoryFRCQ43ipl5scene8SDMemory10TitleRangeRCQ43ipl5scene8SDMemory10TitleRange = .text:0x813EC730; // type:function size:0xD4
setScrollLimit__Q33ipl5scene8SDMemoryFv = .text:0x813EC804; // type:function size:0x144
init__Q33ipl7utility8ScrollerFv = .text:0x813EC948; // type:function size:0x20
@@ -4879,28 +4879,28 @@ onDialogState21__Q33ipl5scene8SDMemoryFv = .text:0x813EEB94; // type:function si
onDialogState22__Q33ipl5scene8SDMemoryFv = .text:0x813EECDC; // type:function size:0x11C
onDialogState23__Q33ipl5scene8SDMemoryFv = .text:0x813EEDF8; // type:function size:0x78
onDialogState24__Q33ipl5scene8SDMemoryFv = .text:0x813EEE70; // type:function size:0xC0
draw__Q33ipl5scene8SDMemoryFv = .text:0x813EEF30; // type:function size:0x88
drawTransferTitles__Q33ipl5scene8SDMemoryFv = .text:0x813EEFB8; // type:function size:0x70C
iplSDMemory_813EEF30 = .text:0x813EEF30; // type:function size:0x88
iplSDMemory_813EEFB8 = .text:0x813EEFB8; // type:function size:0x70C
writeFourFlagBytes__Q23ipl5sceneFPUcUcUcUcUc = .text:0x813EF6C4; // type:function size:0x14
setTitleRowColors__Q23ipl5sceneFPQ34nw4r3lyt7TextBoxRCQ34nw4r2ut5ColorRCQ34nw4r2ut5Color = .text:0x813EF6D8; // type:function size:0x48
iplSDMemory_813EF6D8 = .text:0x813EF6D8; // type:function size:0x48
GetBeginIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF720; // type:function size:0x8
GetEndIter__Q34nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>Fv = .text:0x813EF728; // type:function size:0x8
iplSDMemory_813EF728 = .text:0x813EF728; // type:function size:0x8
__ne__Q24nw4r2utFQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8IteratorQ44nw4r2ut28LinkList<Q34nw4r3lyt4Pane,4>8Iterator = .text:0x813EF730; // type:function size:0x18
getControlPaneIndex__Q33ipl5scene8SDMemoryFPCc = .text:0x813EF748; // type:function size:0x74
activateControlPane__Q33ipl5scene8SDMemoryFPCcPQ23gui9Component = .text:0x813EF7BC; // type:function size:0x128
deactivateControlPane__Q33ipl5scene8SDMemoryFPCc = .text:0x813EF8E4; // type:function size:0xF0
cancelControlPane__Q33ipl5scene8SDMemoryFPCc = .text:0x813EF9D4; // type:function size:0x120
onEvent__Q43ipl5scene8SDMemory23ControlPaneEventHandlerFUlUlPv = .text:0x813EFAF4; // type:function size:0xD8
getTitlePaneIndex__Q33ipl5scene8SDMemoryFPCc = .text:0x813EFBCC; // type:function size:0xC0
activateTitlePane__Q33ipl5scene8SDMemoryFPCcPQ23gui9Component = .text:0x813EFC8C; // type:function size:0x160
deactivateTitlePane__Q33ipl5scene8SDMemoryFPCc = .text:0x813EFDEC; // type:function size:0x128
selectTitlePane__Q33ipl5scene8SDMemoryFPCc = .text:0x813EFF14; // type:function size:0x24C
onEvent__Q43ipl5scene8SDMemory21TitlePaneEventHandlerFUlUlPv = .text:0x813F0160; // type:function size:0xD8
getDialogPaneIndex__Q33ipl5scene8SDMemoryFPCc = .text:0x813F0238; // type:function size:0x74
activateDialogPane__Q33ipl5scene8SDMemoryFPCcPQ23gui9Component = .text:0x813F02AC; // type:function size:0x144
deactivateDialogPane__Q33ipl5scene8SDMemoryFPCc = .text:0x813F03F0; // type:function size:0x10C
selectDialogPane__Q33ipl5scene8SDMemoryFPCc = .text:0x813F04FC; // type:function size:0x1A0
onEvent__Q43ipl5scene8SDMemory22DialogPaneEventHandlerFUlUlPv = .text:0x813F069C; // type:function size:0xD8
iplSDMemory_813EF7BC = .text:0x813EF7BC; // type:function size:0x128
iplSDMemory_813EF8E4 = .text:0x813EF8E4; // type:function size:0xF0
iplSDMemory_813EF9D4 = .text:0x813EF9D4; // type:function size:0x120
iplSDMemory_813EFAF4 = .text:0x813EFAF4; // type:function size:0xD8
iplSDMemory_813EFBCC = .text:0x813EFBCC; // type:function size:0xC0
iplSDMemory_813EFC8C = .text:0x813EFC8C; // type:function size:0x160
iplSDMemory_813EFDEC = .text:0x813EFDEC; // type:function size:0x128
iplSDMemory_813EFF14 = .text:0x813EFF14; // type:function size:0x24C
iplSDMemory_813F0160 = .text:0x813F0160; // type:function size:0xD8
iplSDMemory_813F0238 = .text:0x813F0238; // type:function size:0x74
iplSDMemory_813F02AC = .text:0x813F02AC; // type:function size:0x144
iplSDMemory_813F03F0 = .text:0x813F03F0; // type:function size:0x10C
iplSDMemory_813F04FC = .text:0x813F04FC; // type:function size:0x1A0
iplSDMemory_813F069C = .text:0x813F069C; // type:function size:0xD8
__ct__Q33ipl5scene7SettingFPQ23EGG4Heapi = .text:0x813F0774; // type:function size:0xF8
isAnimating__Q33ipl5scene7SettingFv = .text:0x813F086C; // type:function size:0x3C
getFuncMsgQ__Q33ipl5scene7SettingFv = .text:0x813F08A8; // type:function size:0x68
@@ -16752,73 +16752,73 @@ __vt__Q33ipl5scene14ParentalDialog = .data:0x81653ED8; // type:object size:0x68
@10007 = .data:0x81653FD8; // type:object size:0xE scope:local data:string
__vt__Q33ipl5scene6Reboot = .data:0x81653FE8; // type:object size:0x4C
__vt__Q33ipl5scene9RootScene = .data:0x81654038; // type:object size:0x4C
@16632 = .data:0x81654088; // type:object size:0x9 scope:local data:string
@16633 = .data:0x81654091; // type:object size:0x9 scope:local data:string
@16634 = .data:0x8165409A; // type:object size:0x9 scope:local data:string
@16635 = .data:0x816540A3; // type:object size:0x9 scope:local data:string
@16636 = .data:0x816540AC; // type:object size:0x9 scope:local data:string
@16637 = .data:0x816540B5; // type:object size:0x9 scope:local data:string
@16638 = .data:0x816540BE; // type:object size:0x9 scope:local data:string
@16639 = .data:0x816540C7; // type:object size:0x9 scope:local data:string
@16640 = .data:0x816540D0; // type:object size:0x9 scope:local data:string
@16641 = .data:0x816540D9; // type:object size:0x9 scope:local data:string
@16642 = .data:0x816540E2; // type:object size:0x9 scope:local data:string
@16643 = .data:0x816540EB; // type:object size:0x9 scope:local data:string
@16644 = .data:0x816540F4; // type:object size:0x9 scope:local data:string
@16645 = .data:0x816540FD; // type:object size:0x9 scope:local data:string
@16646 = .data:0x81654106; // type:object size:0x9 scope:local data:string
@16647 = .data:0x8165410F; // type:object size:0x9 scope:local data:string
@16648 = .data:0x81654118; // type:object size:0x9 scope:local data:string
@16649 = .data:0x81654121; // type:object size:0x9 scope:local data:string
@16650 = .data:0x8165412A; // type:object size:0x9 scope:local data:string
@16651 = .data:0x81654133; // type:object size:0x9 scope:local data:string
@16652 = .data:0x8165413C; // type:object size:0x9 scope:local data:string
@16653 = .data:0x81654145; // type:object size:0x9 scope:local data:string
@16654 = .data:0x8165414E; // type:object size:0x9 scope:local data:string
@16655 = .data:0x81654157; // type:object size:0x9 scope:local data:string
@16656 = .data:0x81654160; // type:object size:0x9 scope:local data:string
@16657 = .data:0x81654169; // type:object size:0x9 scope:local data:string
@16658 = .data:0x81654172; // type:object size:0x9 scope:local data:string
@16659 = .data:0x8165417B; // type:object size:0x9 scope:local data:string
@16660 = .data:0x81654184; // type:object size:0x9 scope:local data:string
@16661 = .data:0x8165418D; // type:object size:0x9 scope:local data:string
@16662 = .data:0x81654196; // type:object size:0x9 scope:local data:string
@16663 = .data:0x8165419F; // type:object size:0x9 scope:local data:string
@16664 = .data:0x816541A8; // type:object size:0x9 scope:local data:string
@16665 = .data:0x816541B1; // type:object size:0x9 scope:local data:string
@16666 = .data:0x816541BA; // type:object size:0x9 scope:local data:string
@16667 = .data:0x816541C3; // type:object size:0x9 scope:local data:string
@16668 = .data:0x816541CC; // type:object size:0x9 scope:local data:string
@16669 = .data:0x816541D5; // type:object size:0x9 scope:local data:string
@16670 = .data:0x816541DE; // type:object size:0x9 scope:local data:string
@16671 = .data:0x816541E7; // type:object size:0x9 scope:local data:string
@16672 = .data:0x816541F0; // type:object size:0x9 scope:local data:string
@16673 = .data:0x816541F9; // type:object size:0x9 scope:local data:string
lbl_81654088 = .data:0x81654088; // type:object size:0x9 data:string
lbl_81654091 = .data:0x81654091; // type:object size:0x9 data:string
lbl_8165409A = .data:0x8165409A; // type:object size:0x9 data:string
lbl_816540A3 = .data:0x816540A3; // type:object size:0x9 data:string
lbl_816540AC = .data:0x816540AC; // type:object size:0x9 data:string
lbl_816540B5 = .data:0x816540B5; // type:object size:0x9 data:string
lbl_816540BE = .data:0x816540BE; // type:object size:0x9 data:string
lbl_816540C7 = .data:0x816540C7; // type:object size:0x9 data:string
lbl_816540D0 = .data:0x816540D0; // type:object size:0x9 data:string
lbl_816540D9 = .data:0x816540D9; // type:object size:0x9 data:string
lbl_816540E2 = .data:0x816540E2; // type:object size:0x9 data:string
lbl_816540EB = .data:0x816540EB; // type:object size:0x9 data:string
lbl_816540F4 = .data:0x816540F4; // type:object size:0x9 data:string
lbl_816540FD = .data:0x816540FD; // type:object size:0x9 data:string
lbl_81654106 = .data:0x81654106; // type:object size:0x9 data:string
lbl_8165410F = .data:0x8165410F; // type:object size:0x9 data:string
lbl_81654118 = .data:0x81654118; // type:object size:0x9 data:string
lbl_81654121 = .data:0x81654121; // type:object size:0x9 data:string
lbl_8165412A = .data:0x8165412A; // type:object size:0x9 data:string
lbl_81654133 = .data:0x81654133; // type:object size:0x9 data:string
lbl_8165413C = .data:0x8165413C; // type:object size:0x9 data:string
lbl_81654145 = .data:0x81654145; // type:object size:0x9 data:string
lbl_8165414E = .data:0x8165414E; // type:object size:0x9 data:string
lbl_81654157 = .data:0x81654157; // type:object size:0x9 data:string
lbl_81654160 = .data:0x81654160; // type:object size:0x9 data:string
lbl_81654169 = .data:0x81654169; // type:object size:0x9 data:string
lbl_81654172 = .data:0x81654172; // type:object size:0x9 data:string
lbl_8165417B = .data:0x8165417B; // type:object size:0x9 data:string
lbl_81654184 = .data:0x81654184; // type:object size:0x9 data:string
lbl_8165418D = .data:0x8165418D; // type:object size:0x9 data:string
lbl_81654196 = .data:0x81654196; // type:object size:0x9 data:string
lbl_8165419F = .data:0x8165419F; // type:object size:0x9 data:string
lbl_816541A8 = .data:0x816541A8; // type:object size:0x9 data:string
lbl_816541B1 = .data:0x816541B1; // type:object size:0x9 data:string
lbl_816541BA = .data:0x816541BA; // type:object size:0x9 data:string
lbl_816541C3 = .data:0x816541C3; // type:object size:0x9 data:string
lbl_816541CC = .data:0x816541CC; // type:object size:0x9 data:string
lbl_816541D5 = .data:0x816541D5; // type:object size:0x9 data:string
lbl_816541DE = .data:0x816541DE; // type:object size:0x9 data:string
lbl_816541E7 = .data:0x816541E7; // type:object size:0x9 data:string
lbl_816541F0 = .data:0x816541F0; // type:object size:0x9 data:string
lbl_816541F9 = .data:0x816541F9; // type:object size:0x9 data:string
lbl_81654204 = .data:0x81654204; // type:object size:0xF0
@16674 = .data:0x816542F4; // type:object size:0xA scope:local data:string
@16675 = .data:0x816542FE; // type:object size:0xA scope:local data:string
@16676 = .data:0x81654308; // type:object size:0xA scope:local data:string
@16677 = .data:0x81654312; // type:object size:0xA scope:local data:string
lbl_816542F4 = .data:0x816542F4; // type:object size:0xA data:string
lbl_816542FE = .data:0x816542FE; // type:object size:0xA data:string
lbl_81654308 = .data:0x81654308; // type:object size:0xA data:string
lbl_81654312 = .data:0x81654312; // type:object size:0xA data:string
lbl_8165431C = .data:0x8165431C; // type:object size:0x20
@16679 = .data:0x8165433C; // type:object size:0xB scope:local data:string
@16680 = .data:0x81654347; // type:object size:0xB scope:local data:string
@16681 = .data:0x81654352; // type:object size:0xB scope:local data:string
@16682 = .data:0x8165435D; // type:object size:0xB scope:local data:string
lbl_8165433C = .data:0x8165433C; // type:object size:0xB data:string
lbl_81654347 = .data:0x81654347; // type:object size:0xB data:string
lbl_81654352 = .data:0x81654352; // type:object size:0xB data:string
lbl_8165435D = .data:0x8165435D; // type:object size:0xB data:string
lbl_81654368 = .data:0x81654368; // type:object size:0x20
lbl_81654388 = .data:0x81654388; // type:object size:0x14 data:4byte
sFourPageDialogPages__Q23ipl5scene = .data:0x8165439C; // type:object size:0x70
sThreePageDialogPages__Q23ipl5scene = .data:0x8165440C; // type:object size:0x54
@16689 = .data:0x81654460; // type:object size:0x9 scope:local data:string
@16690 = .data:0x81654469; // type:object size:0x9 scope:local data:string
lbl_8165439C = .data:0x8165439C; // type:object size:0x70
lbl_8165440C = .data:0x8165440C; // type:object size:0x54
lbl_81654460 = .data:0x81654460; // type:object size:0x9 data:string
lbl_81654469 = .data:0x81654469; // type:object size:0x9 data:string
lbl_81654472 = .data:0x81654472; // type:object size:0x16
@24438 = .data:0x81654488; // type:object size:0xE scope:local data:string
@24439 = .data:0x81654496; // type:object size:0x11 scope:local data:string
@24489 = .data:0x816544A7; // type:object size:0x19 scope:local data:string
@24490 = .data:0x816544C0; // type:object size:0x1B scope:local data:string
lbl_81654488 = .data:0x81654488; // type:object size:0xE data:string
lbl_81654496 = .data:0x81654496; // type:object size:0x11 data:string
lbl_816544A7 = .data:0x816544A7; // type:object size:0x19 data:string
lbl_816544C0 = .data:0x816544C0; // type:object size:0x1B data:string
jumptable_816544DC = .data:0x816544DC; // type:object size:0x38 scope:local
jumptable_81654514 = .data:0x81654514; // type:object size:0x40 scope:local
@24961 = .data:0x81654554; // type:object size:0xB scope:local data:string
@24962 = .data:0x8165455F; // type:object size:0xE scope:local data:string
lbl_81654554 = .data:0x81654554; // type:object size:0xB data:string
lbl_8165455F = .data:0x8165455F; // type:object size:0xE data:string
jumptable_81654570 = .data:0x81654570; // type:object size:0x3C scope:local
jumptable_816545AC = .data:0x816545AC; // type:object size:0x40 scope:local
jumptable_816545EC = .data:0x816545EC; // type:object size:0x40 scope:local
@@ -16826,16 +16826,16 @@ jumptable_8165462C = .data:0x8165462C; // type:object size:0x40 scope:local
jumptable_8165466C = .data:0x8165466C; // type:object size:0x28 scope:local
jumptable_81654694 = .data:0x81654694; // type:object size:0x78 scope:local
lbl_8165473B = .data:0x8165473B; // type:object size:0xD4
@26032 = .data:0x8165480F; // type:object size:0xE scope:local data:string
@26047 = .data:0x8165481D; // type:object size:0xB scope:local data:string
@26062 = .data:0x81654828; // type:object size:0x10 scope:local data:string
lbl_8165480F = .data:0x8165480F; // type:object size:0xE data:string
lbl_8165481D = .data:0x8165481D; // type:object size:0xB data:string
lbl_81654828 = .data:0x81654828; // type:object size:0x10 data:string
lbl_81654838 = .data:0x81654838; // type:object size:0x146
@26231 = .data:0x8165497E; // type:object size:0x16 scope:local data:string
@26266 = .data:0x81654994; // type:object size:0x10 scope:local data:string
@26311 = .data:0x816549A4; // type:object size:0xF scope:local data:string
@26312 = .data:0x816549B3; // type:object size:0x14 scope:local data:string
@26336 = .data:0x816549C7; // type:object size:0x10 scope:local data:string
@26559 = .data:0x816549D7; // type:object size:0xF scope:local data:string
lbl_8165497E = .data:0x8165497E; // type:object size:0x16 data:string
lbl_81654994 = .data:0x81654994; // type:object size:0x10 data:string
lbl_816549A4 = .data:0x816549A4; // type:object size:0xF data:string
lbl_816549B3 = .data:0x816549B3; // type:object size:0x14 data:string
lbl_816549C7 = .data:0x816549C7; // type:object size:0x10 data:string
lbl_816549D7 = .data:0x816549D7; // type:object size:0xF data:string
lbl_81654A08 = .data:0x81654A08; // type:object size:0x1C
lbl_81654A24 = .data:0x81654A24; // type:object size:0x18
lbl_81654A3C = .data:0x81654A3C; // type:object size:0xFC
@@ -22014,20 +22014,20 @@ natType = .sdata:0x81696D30; // type:object size:0x4 scope:local data:4byte
@11124 = .sdata:0x81696D69; // type:object size:0x7 scope:local data:string
@11125 = .sdata:0x81696D70; // type:object size:0x7 scope:local data:string
@11250 = .sdata:0x81696D78; // type:object size:0x2 scope:local
@16631 = .sdata:0x81696D80; // type:object size:0x1 scope:local
@16684 = .sdata:0x81696D81; // type:object size:0x6 scope:local data:string
@16685 = .sdata:0x81696D87; // type:object size:0x6 scope:local data:string
@16686 = .sdata:0x81696D8D; // type:object size:0x6 scope:local data:string
@16687 = .sdata:0x81696D93; // type:object size:0x6 scope:local data:string
@16688 = .sdata:0x81696D99; // type:object size:0x6 scope:local data:string
@16692 = .sdata:0x81696D9F; // type:object size:0x7 scope:local data:string
lbl_81696D80 = .sdata:0x81696D80; // type:object size:0x1
lbl_81696D81 = .sdata:0x81696D81; // type:object size:0x6 data:string
lbl_81696D87 = .sdata:0x81696D87; // type:object size:0x6 data:string
lbl_81696D8D = .sdata:0x81696D8D; // type:object size:0x6 data:string
lbl_81696D93 = .sdata:0x81696D93; // type:object size:0x6 data:string
lbl_81696D99 = .sdata:0x81696D99; // type:object size:0x6 data:string
lbl_81696D9F = .sdata:0x81696D9F; // type:object size:0x7 data:string
lbl_81696DA8 = .sdata:0x81696DA8; // type:object size:0x4 data:4byte
lbl_81696DAC = .sdata:0x81696DAC; // type:object size:0x6 data:wstring
@25675 = .sdata:0x81696DB2; // type:object size:0x4 scope:local data:string
@25689 = .sdata:0x81696DB6; // type:object size:0x7 scope:local data:string
@25710 = .sdata:0x81696DBD; // type:object size:0x1 scope:local
@26199 = .sdata:0x81696DBE; // type:object size:0x4 scope:local data:string
@26201 = .sdata:0x81696DC2; // type:object size:0x5 scope:local data:string
lbl_81696DB2 = .sdata:0x81696DB2; // type:object size:0x4 data:string
lbl_81696DB6 = .sdata:0x81696DB6; // type:object size:0x7 data:string
lbl_81696DBD = .sdata:0x81696DBD; // type:object size:0x1
lbl_81696DBE = .sdata:0x81696DBE; // type:object size:0x4 data:string
lbl_81696DC2 = .sdata:0x81696DC2; // type:object size:0x5 data:string
lbl_81696DC7 = .sdata:0x81696DC7; // type:object size:0x8 data:string
lbl_81696DD0 = .sdata:0x81696DD0; // type:object size:0x4 data:4byte
lbl_81696DD4 = .sdata:0x81696DD4; // type:object size:0x4 data:4byte

View File

@@ -815,7 +815,7 @@ config.libs = [
Object(NonMatching, "scene/memoryCard/iplMemoryCard.cpp"),
Object(NonMatching, "scene/memoryCard/iplMemoryCardBase.cpp"),
Object(NonMatching, "scene/memoryCard/iplMemoryCardManager.cpp"),
Object(Matching, "scene/memoryCard/iplGCSaveData.cpp"),
Object(NonMatching, "scene/memoryCard/iplGCSaveData.cpp"),
Object(NonMatching, "scene/memoryCard/iplGCWindow.cpp"),
]
),
@@ -875,7 +875,7 @@ config.libs = [
Object(Matching, "scene/setting/iplAPScanThread.cpp"),
Object(NonMatching, "scene/setting/iplUSBAP.cpp"),
Object(NonMatching, "scene/setting/iplUSBAPThread.cpp"),
Object(Matching, "scene/setting/iplAOSSThread.cpp"),
Object(NonMatching, "scene/setting/iplAOSSThread.cpp"),
Object(NonMatching, "scene/setting/AOSSLink.c"),
Object(NonMatching, "scene/setting/iplRakuRakuThread.cpp"),
Object(NonMatching, "scene/setting/AOSS.c"),
@@ -985,21 +985,21 @@ config.libs = [
Object(NonMatching, "clib/zconvert.c"),
Object(NonMatching, "clib/zi81key.c"),
Object(NonMatching, "clib/zi8alpha.c"),
Object(Matching, "clib/zi8alts.c"),
Object(NonMatching, "clib/zi8alts.c"),
Object(NonMatching, "clib/zi8cgetc.c"),
Object(NonMatching, "clib/zi8cinfo.c"),
Object(Matching, "clib/zi8copy.c"),
Object(NonMatching, "clib/zi8dawg.c"),
Object(Matching, "clib/zi8getc.c"),
Object(NonMatching, "clib/zi8getc.c"),
Object(NonMatching, "clib/zi8getc2.c"),
Object(Matching, "clib/zi8getSW.c"),
Object(Matching, "clib/zi8initd.c"),
Object(Matching, "clib/zi8is.c"),
Object(NonMatching, "clib/zi8getSW.c"),
Object(NonMatching, "clib/zi8initd.c"),
Object(NonMatching, "clib/zi8is.c"),
Object(NonMatching, "clib/zi8match.c"),
Object(Matching, "clib/zi8misc.c"),
Object(NonMatching, "clib/zi8misc.c"),
Object(NonMatching, "clib/zi8pud2.c"),
Object(Matching, "clib/Zi8punct.c"),
Object(Matching, "clib/zi8space.c"),
Object(NonMatching, "clib/Zi8punct.c"),
Object(NonMatching, "clib/zi8space.c"),
Object(NonMatching, "clib/zi8uwd.c"),
Object(Matching, "clib/zi8ver.c"),
Object(Matching, "clib/zi8ZHuwd.c"),
@@ -1053,19 +1053,19 @@ config.libs = [
]
),
RevoEXLib("nhttp", [
Object(Matching, "nhttp/NHTTP_bgnend.c"),
Object(Matching, "nhttp/NHTTP_control.c"),
Object(Matching, "nhttp/NHTTP_list.c"),
Object(Matching, "nhttp/NHTTP_os_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_bgnend.c"),
Object(NonMatching, "nhttp/NHTTP_control.c"),
Object(NonMatching, "nhttp/NHTTP_list.c"),
Object(NonMatching, "nhttp/NHTTP_os_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_recvbuf.c"),
Object(Matching, "nhttp/NHTTP_request.c"),
Object(Matching, "nhttp/NHTTP_response.c"),
Object(NonMatching, "nhttp/NHTTP_request.c"),
Object(NonMatching, "nhttp/NHTTP_response.c"),
Object(NonMatching, "nhttp/NHTTP_socket_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_stdlib_RVL.c"),
Object(NonMatching, "nhttp/NHTTP_thread.c"),
Object(NonMatching, "nhttp/d_nhttp_private.c"),
Object(Matching, "nhttp/d_nhttp.c"),
Object(Matching, "nhttp/d_nhttp_common.c"),
Object(NonMatching, "nhttp/d_nhttp.c"),
Object(NonMatching, "nhttp/d_nhttp_common.c"),
]
),
RevoEXLib("nwc24", [
@@ -1083,13 +1083,13 @@ config.libs = [
Object(NonMatching, "nwc24/NWC24MsgRead.c"),
Object(NonMatching, "nwc24/NWC24MsgSubject.c"),
Object(Matching, "nwc24/NWC24Schedule.c"),
Object(NonMatching, "nwc24/NWC24DateParser.c"),
Object(Matching, "nwc24/NWC24DateParser.c"),
Object(Matching, "nwc24/NWC24FriendList.c"),
Object(Matching, "nwc24/NWC24SecretFList.c"),
Object(Matching, "nwc24/NWC24UserId.c"),
Object(Matching, "nwc24/NWC24Time.c"),
Object(Matching, "nwc24/NWC24Ipc.c"),
Object(Equivalent, "nwc24/NWC24Download.c"),
Object(NonMatching, "nwc24/NWC24Download.c"),
Object(Matching, "nwc24/NWC24CHJump.c"),
Object(NonMatching, "nwc24/NWC24System.c"),
]

View File

@@ -1,68 +0,0 @@
#ifndef IPL_MEMORY_CARD_LIB_H
#define IPL_MEMORY_CARD_LIB_H
#include <revolution/types.h>
namespace ipl {
namespace memorycard {
typedef struct FileInfo {
u16 fileNo; // 0x00
u16 size; // 0x02
u8 canCopy; // 0x04
u8 canMove; // 0x05
u16 unk_0x06; // 0x06
u32 key; // 0x08
} FileInfo; // 0x0C
typedef struct CardState {
vu8 unk_0x00; // 0x00
vu8 changed; // 0x01
vs16 state; // 0x02
vu16 unk_0x04; // 0x04
vu16 unk_0x06; // 0x06
vu32 key; // 0x08
vu16 unk_0x0C; // 0x0C
vu16 unk_0x0E; // 0x0E
vu16 freeBlocks; // 0x10
vu16 unk_0x12; // 0x12
} CardState; // 0x14
typedef struct IconState {
u8 bannerEnable; // 0x00
u8 unk_0x01; // 0x01
u8 unk_0x02; // 0x02
u8 bannerType; // 0x03
s8 anmDelta; // 0x04
u8 anmType; // 0x05
u8 unk_0x06; // 0x06
u8 unk_0x07; // 0x07
u8 iconFmt[8]; // 0x08
u16 anmFrameBits; // 0x10
s16 anmMax; // 0x12
u32 bannerOffset; // 0x14
u32 bannerTlutOffset; // 0x18
u32 iconOffset[8]; // 0x1C
u32 iconTlutOffset; // 0x3C
} IconState; // 0x40
void probeCard();
CardState* getCardSlotState();
FileInfo* getCardDirState();
IconState* getIconStateArray();
long getCardLastSendCmd();
long getCardLastSrcSlot();
long getCardLastCMDFCmdResult();
void sendCardFormatCmd(u8 slot);
void sendCardCopyCmd(u8 slot, s16 fileNo);
void sendCardMoveCmd(u8 slot, s16 fileNo);
void sendCardDeleteCmd(u8 slot, s16 fileNo);
const char* getIconComment(u8 slot, s16 fileNo);
void initCardThread();
bool shutdownCardThread();
} // namespace memorycard
} // namespace ipl
#endif // IPL_MEMORY_CARD_LIB_H

View File

@@ -122,14 +122,6 @@ extern WWWProtocolFinalizeFn WWWProtocolFinished;
extern WWWProtocolFinalizeFn WWWProtocolFailed;
extern WWWAddProtocolFn WWWAddProtocol;
#ifdef IPL_SETTING_IMPLEMENTATION
namespace ipl {
namespace scene {
class Setting;
}
}
#endif
namespace www {
namespace arcreader {
class ArcContainer;
@@ -214,9 +206,6 @@ namespace ext_ead {
WWWHandle* GetHandle() { return mpBrowserHandle; }
private:
#ifdef IPL_SETTING_IMPLEMENTATION
friend class ::ipl::scene::Setting;
#endif
static BOOL SNotifyCallback_(WWWHandle* wwwBrowser, WWWHandlewindow* wwwWindow, WWWEvent event, WWWHandleEventData* eventData);
BOOL NotifyCallback_(WWWHandle* wwwBrowser, WWWHandlewindow* wwwWindow, WWWEvent event, WWWHandleEventData* eventData);

View File

@@ -14,15 +14,7 @@ namespace textinput {
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
LayoutByNW4R(nw4r::lyt::MultiArcResourceAccessor* multiArc, const char* layoutName, EventObserver* event)
: nw4rmanager::Layout(multiArc, layoutName, event) {}
#endif
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual ~LayoutByNW4R();
#else
virtual ~LayoutByNW4R() {}
#endif
virtual void create(MEMAllocator* allocator);
virtual void init();

View File

@@ -20,10 +20,6 @@ namespace textinput {
virtual void moveNigaoeButton() {}
};
#ifdef MYTIINPUTFORM_IMPLEMENTATION
class ScrollButton;
#endif
class InputForm : public textinput::InputForm {
public:
typedef enum EditMode {
@@ -34,51 +30,14 @@ namespace textinput {
EM_Last
} EditMode;
#ifdef MYTIMANAGER_IMPLEMENTATION
InputForm(textinput::Manager* manager, nw4r::lyt::MultiArcResourceAccessor* multiArc,
const char* layoutName, EventObserver* event, const char* fontName)
: textinput::InputForm(manager, multiArc, layoutName, event, fontName),
unk_0x308(NULL), unk_0x30C(NULL), unk_0x310(NULL), unk_0x314(NULL),
mfScroll(0.0f), mfScrollFrom(0.0f), mfScrollTo(0.0f), mnLine(0),
mDrawRect(), mDefaultDrawSize(), mDefaultBoundSize(), mExScrollAnm(),
mpNigaoeObserver(NULL), mpDefaultNigaoe(NULL), mpSendString(NULL),
mbEdited(false), mbGoodBye(false), mbEditScrollUp(false), mbEditScrollDown(false),
mbCloseWithSend(false), mpScrollButton(NULL), mbScrollUp(false), mbScrollDown(false),
meEditMode(EM_Disp) {}
#endif
~InputForm();
#ifdef MYTIINPUTFORM_IMPLEMENTATION
virtual void moveCursorUp();
virtual void moveCursorDown();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(input::HKBManager& hkbManager);
virtual void init();
virtual void draw();
virtual void calc();
virtual void doScroll(Scroll* scroll);
virtual u32 calcCursorPos(f32 x, f32 y);
virtual void drawCursor(f32 x, f32 y);
virtual nw4r::math::VEC2 getScale() const;
virtual void preDraw(u32 pos);
virtual void doLineFeed();
virtual void finishDraw(u32 pos);
virtual bool isInScroll();
#endif
virtual void setScroll(f32 scroll);
virtual void setAddScroll(f32 scroll, bool up, bool down);
virtual f32 getScroll() { return mfScroll; }
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual f32 getScrollFrom();
virtual f32 getScrollTo();
#else
virtual f32 getScrollFrom() { return mfScrollFrom; }
virtual f32 getScrollTo() { return mfScrollTo; }
#endif
virtual void open();
virtual void close();
@@ -131,11 +90,7 @@ namespace textinput {
void setEditScrollDown(bool editScrollDown) { mbEditScrollUp = editScrollDown; }
void setCloseWithSend(bool closeWithSend) { mbCloseWithSend = closeWithSend; }
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
void setEditMode(EditMode editMode);
#else
void setEditMode(EditMode editMode) { meEditMode = editMode; }
#endif
bool isEdited() { return mbEdited; }
bool isGoodBye() { return mbGoodBye; }
@@ -148,19 +103,9 @@ namespace textinput {
tistring::Decolated* getSendString() { return mpSendString; }
private:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
nw4r::lyt::Pane* mpMemoPane;
nw4r::lyt::Pane* mpMemoRootPane;
nw4r::lyt::Pane* mpBoundPane;
nw4r::lyt::Pane* mpDrawPane;
#else
#ifdef MYTIMANAGER_IMPLEMENTATION
undefined4* unk_0x308;
#endif
undefined4* unk_0x30C;
undefined4* unk_0x310;
undefined4* unk_0x314;
#endif
f32 mfScroll; // 0x318
f32 mfScrollFrom; // 0x31C
f32 mfScrollTo; // 0x320
@@ -172,11 +117,7 @@ namespace textinput {
nw4r::lyt::Size mDefaultBoundSize; // 0x358
Mtx mDrawMtx; // 0x360
Mtx mBoundMtx; // 0x390
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
util::Animation mExScrollAnm; // 0x3C0
#else
u8 /*todo*/ mExScrollAnm[32]; // 0x3C0
#endif
NigaoeEventObserver* mpNigaoeObserver; // 0x3E0
GXTexObj* mpDefaultNigaoe; // 0x3E4
tistring::Decolated* mpSendString; // 0x3E8
@@ -186,11 +127,7 @@ namespace textinput {
bool mbEditScrollDown; // 0x3EF
bool mbCloseWithSend; // 0x3F0
u8 padding[3]; // 0x3F1
#ifdef MYTIINPUTFORM_IMPLEMENTATION
ScrollButton* mpScrollButton;
#else
undefined4* mpScrollButton;
#endif
undefined4* mpScrollButton; // 0x3F4
bool mbScrollUp; // 0x3F8
bool mbScrollDown; // 0x3F9
EditMode meEditMode; // 0x3FC

View File

@@ -16,13 +16,6 @@ namespace textinput {
T_Last,
} Type;
#ifdef MYTIMANAGER_IMPLEMENTATION
InputForm(textinput::Manager* manager, nw4r::lyt::MultiArcResourceAccessor* multiArc,
const char* layoutName, EventObserver* event, const char* fontName)
: textinput::MemoInputForm(manager, multiArc, layoutName, event, fontName),
unk_0x400(0), mbPhotoDraw(false), meType(T_MailAddressSel) {}
#endif
virtual nw4r::lyt::Material* getPhotoPaneMaterial();
virtual void onPhotoTrig();

View File

@@ -28,9 +28,6 @@ namespace textinput {
CT_NumericWithSeparator,
CT_NormalWithoutLineFeedWithSign,
CT_PredictWithoutLineFeed,
#ifdef MYTIMANAGER_IMPLEMENTATION
CT_PredictBigText,
#endif
CT_Last
} ConfigType;
@@ -81,11 +78,7 @@ namespace textinput {
virtual void start();
virtual void end();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual textinput::InputForm* createInputForm();
#else
virtual InputForm* createInputForm();
#endif
virtual void memoDraw();
@@ -100,16 +93,8 @@ namespace textinput {
virtual ConfigType getConfigType() { return meConfigType; }
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual void setSaveData();
#else
virtual void setSaveData_();
#endif
virtual void reflectSaveData();
#ifdef MYTIMANAGER_IMPLEMENTATION
void reflectSaveDataRev1();
void reflectSaveDataDefault();
#endif
virtual void configDefault();
virtual void configLetter();
@@ -126,21 +111,10 @@ namespace textinput {
virtual void configNormalWithoutLineFeedWithSign();
virtual void configPredictWithoutLineFeed();
virtual void configPredictBigText();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual textinput::MemoInputForm* createMemoInputForm();
virtual textinput::LetterInputForm* createLetterInputForm();
virtual textinput::InputForm* createBigTextInputForm();
virtual void* createBG();
#else
virtual void createMemoInputForm();
virtual void createLetterInputForm();
virtual void createBigTextInputForm();
virtual void createBG();
#endif
#ifdef MYTIMANAGER_IMPLEMENTATION
void* getBackGround() const { return mpBackGround; }
#endif
private:
State* mpCurrentState; // 0x40
@@ -161,11 +135,6 @@ namespace textinput {
class State {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
State() : mpManager(NULL) {}
Manager* getManager() const { return mpManager; }
void setManager(Manager* manager) { mpManager = manager; }
#endif
virtual ~State();
virtual Manager::StateType getStateType();
@@ -184,18 +153,6 @@ namespace textinput {
virtual void start();
virtual void end();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual InputForm* InputForm();
virtual keyboard::hwkey::HWKeyboard* HWKeyboard();
virtual keyboard::pctype::LayoutByNW4R* PCKeyboard();
virtual keyboard::cellphonetype::LayoutByNW4R* CellPhoneKeyboard();
virtual void* SignKeyboard();
virtual candidatebox::LayoutByNW4R* CandidateBox();
virtual toolbar::LayoutByNW4R* ToolBar();
virtual void* PredictLanguageSelectDialog();
virtual void* BG();
#endif
private:
Manager* mpManager; // 0x04
};

View File

@@ -309,11 +309,7 @@ namespace textinput {
virtual u16 getScroll() { return mTextArea.GetDispOffset(); } // 0x100
virtual bool isInScroll(); // 0x104
virtual void setActive(bool active); // 0x108
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isActive() const { return mbActive; }
#else
virtual bool isActive() const;
#endif // 0x10C
virtual bool isActive() const; // 0x10C
virtual void setSelectedTextPane(int pane) { mTextArea.SetSelectedText(pane); } // 0x110
virtual void setFocusedTextPane(int pane) { mTextArea.SetFocusedText(pane); } // 0x114
virtual int getFocusedTextPane() { return mTextArea.GetFocusedText(); } // 0x118

View File

@@ -2,57 +2,13 @@
#define TEXTINPUT_CELL_PHONE_H
#include "tiNw4rManager.h"
#ifdef MYTIMANAGER_IMPLEMENTATION
#include "tiKeyboard.h"
#endif
namespace textinput {
namespace keyboard {
namespace cellphonetype {
#ifdef MYTIMANAGER_IMPLEMENTATION
class Base : public textinput::keyboard::KeyboardBase {
#else
class Base {
#endif
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
enum InputMode {
IM_00,
IM_01,
IM_02,
IM_03,
IM_04,
};
virtual ~Base();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void updateFromReceiver(u32, void*) override;
virtual void onKey(u32, void*) override;
virtual void getType() override;
virtual void onActive() override;
virtual void calc();
virtual void draw();
virtual InputMode getInputMode() const;
virtual bool isLocked() const;
virtual bool isNumeric() const;
virtual bool isNumericWithDot() const;
virtual bool isHoldingButton() const;
virtual void doNumericMode(bool);
virtual void changeInputMode(InputMode);
virtual bool isUpperCase();
virtual void setInputMode(InputMode);
virtual void setUpperCaseJP(bool);
virtual void setLangKeyActive(bool);
virtual bool onClose();
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void setAbcMode(bool);
virtual bool isZiActive();
virtual bool isAtokActive();
virtual void doInput();
virtual void updateFixMode();
#else
// TODO
virtual void vt_0x08();
virtual void vt_0x0C();
virtual void vt_0x10();
@@ -74,11 +30,7 @@ namespace textinput {
virtual void vt_0x4C();
virtual void vt_0x50();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual void doNumericMode(bool);
#else
virtual void vt_0x54();
#endif
virtual void vt_0x58();
virtual void vt_0x5C();
virtual void vt_0x60();
@@ -86,48 +38,17 @@ namespace textinput {
virtual void vt_0x68(bool);
virtual bool onClose();
#endif
// TODO enum?
int getInputType() const;
#ifdef MYTIMANAGER_IMPLEMENTATION
private:
u32 mPreviousInputMode;
u32 mCurrentInputMode;
bool mbInputModeLocked;
bool mbNumericMode;
bool mbNumericWithDotMode;
bool mbUpperCaseMode;
bool mbAbcMode;
bool mbLanguageKeyMode;
u32 mHoldingButton;
void* mpInputModeTable;
MEMAllocator* mpAllocator;
void* mpInputSettings;
u32 mInputState;
#endif
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual void doNumericMode(bool);
virtual void setPredictLanguageDialog(void*);
virtual void setSignWindow(void*);
virtual void doNumericWithDotMode(bool);
virtual void setLineFeedButton(bool);
virtual void setPredictLanguageButton(bool);
virtual void setSignWindowButton(bool);
#endif
virtual bool onClose();
void onPressedShift(bool shift);
void onReleasedShift();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override;
virtual bool updateInput(input::HKBManager& hkbManager) override;
#endif
};
} // namespace cellphonetype

View File

@@ -19,24 +19,6 @@ namespace textinput {
u32 GetModifierState() const;
void SetModifierState(u32, u32);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
class KeySet {
public:
u8 GetKey() const;
wchar_t GetWChar() const;
bool IsValid() const;
KeySet GetNext() const;
private:
const HKBManager* mpManager;
u8 mKind;
s8 mIndex;
u8 mDevice;
u16 mCharacter;
};
KeySet GetTriggeredKeySet() const;
KeySet GetRepeatedKeySet() const;
void SetForceModifierState(u32 mask, u32 state);
#else
class KeySet {
private:
keyboard::cellphonetype::PaneNameToCharCode* pPaneNameToCharCode; // 0x00
@@ -45,7 +27,6 @@ namespace textinput {
u16 uType; // 0x28
};
#endif
private:
u8 unk_0x00[0xFC];

View File

@@ -14,15 +14,8 @@ namespace textinput {
~HWKeyboard();
virtual void init();
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
wchar_t convertWCCode(wchar_t code) const;
#endif
#ifdef MYTIMANAGER_IMPLEMENTATION
void updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
#else
virtual void updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
#endif
virtual bool updateInput(input::HKBManager& hkbManager);
private:

View File

@@ -17,9 +17,6 @@ namespace textinput {
namespace inputform {
class EditBuffer {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
void create(MEMAllocator* allocator);
#endif
~EditBuffer();
private:
@@ -30,10 +27,6 @@ namespace textinput {
};
class DeadKeyStream {
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
public:
static wchar_t ToIndependentClass(wchar_t code);
#endif
private:
KPRQueue mKPRQueue; // 0x00
};
@@ -144,12 +137,7 @@ namespace textinput {
virtual void enableSpaceByRight(bool rightWithSpace);
virtual void onClose();
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
tistring::WithAtok* getCurrentString(bool fixed);
virtual bool canConvert() { return getCurrentString(false) == mpUnfixString; }
#else
virtual bool canConvert();
#endif
virtual void setString(const wchar_t* string);
@@ -179,10 +167,6 @@ namespace textinput {
virtual void onSE(sound::SE seId);
#ifdef MYTIMANAGER_IMPLEMENTATION
void dirtyCacheAll();
#endif
virtual void clear();
virtual u32 calcCursorPos(f32 x, f32 y);
@@ -199,19 +183,8 @@ namespace textinput {
virtual void makeUpCursorPos(CursorPos* cursorPos, u32 pos, s32 startLine, s32 endLine);
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
void setCursorPos(tistring::Decolated* string, u32 pos);
void resetRelation();
void calcCursorTimer();
#else
private:
#endif
#ifdef MYTIINPUTFORM_IMPLEMENTATION
nw4r::ut::Rect mRect;
#else
Rect mRect;
#endif
Rect mRect; // 0x120
nw4r::math::MTX34 mMtx; // 0x130
Destination meDestination; // 0x160
tistring::Decolated* mpString; // 0x164
@@ -255,9 +228,6 @@ namespace textinput {
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
#ifdef MYTIMANAGER_IMPLEMENTATION
LayoutByNW4R(textinput::Manager*, nw4r::lyt::MultiArcResourceAccessor*, const char*, EventObserver*, const char*);
#endif
~LayoutByNW4R();
virtual void init();
@@ -284,31 +254,8 @@ namespace textinput {
virtual void visibleSeparator(bool flag);
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
const void* mpLayoutData;
const void* mpLanguageData;
const char* mpFontName;
bool mbUpVisible;
bool mbDownVisible;
bool mbRepeat;
nw4rmanager::TiEventHandler* mpInputEventHandler;
nw4r::ut::ResFont mFont;
int mUpRepeat;
int mDownRepeat;
int mLeftRepeat;
int mRightRepeat;
int mDeleteRepeat;
int mConfirmRepeat;
u32 mRepeatButtons;
#else
private:
#ifdef MYTIMANAGER_IMPLEMENTATION
u8 unk_0x2C0[0x48];
#else
u8 unk_0x2C0[0x4C];
#endif
#endif
};
}
typedef inputform::LayoutByNW4R InputForm;

View File

@@ -9,31 +9,16 @@ namespace textinput {
class KeyboardBase : public CommandSender {
public:
virtual ~KeyboardBase() {}
#ifndef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void create(MEMAllocator* alloc) override;
virtual void init() override;
virtual void setCommandReceiver(CommandReceiver* receiver) override;
virtual void sendCommand(u32 command, void*) override;
#endif
virtual void updateFromReceiver(u32, void*) override;
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(TI_PC_KEYBOARD_IMPLEMENTATION)
virtual void onKey(u32, void*);
#else
virtual void onKey(u32);
#endif
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual int getType();
#else
virtual void getType();
#endif
virtual void setLanguage(Language language);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual Language getLanguage() const { return meLanguage; }
virtual void update() {}
#else
virtual Language getLanguage() const;
virtual void update();
#endif
virtual void onActive();
protected:

View File

@@ -19,10 +19,6 @@ namespace textinput {
bool isHoldingShift() const {
return isHWPressedShift() || isPressedShiftB();
}
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
u8 isCapsLock() const { return mbCpasLock; }
void setPressedShiftB(bool pressed) { mbPressedShiftB = pressed; }
#endif
u8 isHWPressedShift() const { return mbPressedShift; }
u8 isPressedShiftB() const { return mbPressedShiftB; }
void setHWPressedShift(const u8& arg) { mbPressedShift = arg; }

View File

@@ -56,9 +56,6 @@ namespace textinput {
virtual void setLanguage(Language language);
virtual Language getLanguage() const { return meLanguage; }
#ifdef MYTIMANAGER_IMPLEMENTATION
Language getLanguageForMemo() const { return meLanguage; }
#endif
virtual void setDestination(Destination destination);
@@ -69,30 +66,6 @@ namespace textinput {
virtual void setAspectRatio(bool b4x3);
#ifdef MYTIMANAGER_IMPLEMENTATION
MEMAllocator* getAllocatorForMemo() const { return mpAllocator; }
inputform::EditBuffer* getEditBufferForMemo() const { return mpEditBuffer; }
void setEditBufferForMemo(inputform::EditBuffer* editBuffer) { mpEditBuffer = editBuffer; }
void setHWKeyboardForMemo(keyboard::hwkey::HWKeyboard* keyboard) { mpHWKeyboard = keyboard; }
nw4r::lyt::MultiArcResourceAccessor* getMultiArcForMemo() const { return mpMultiArcResourceAccessor; }
EventObserver* getEventObserverForMemo() const { return mpEventObserver; }
InputForm* getInputFormForMemo() const { return mpInputForm; }
void setInputFormForMemo(InputForm* inputForm) { mpInputForm = inputForm; }
toolbar::LayoutByNW4R* getToolBarForMemo() const { return mpToolBar; }
candidatebox::LayoutByNW4R* getCandidateBoxForMemo() const { return mpCandidateBox; }
void setPCKeyboardForMemo(keyboard::pctype::LayoutByNW4R* keyboard) { mpPCKeyboard = keyboard; }
void setCellPhoneKeyboardForMemo(keyboard::cellphonetype::LayoutByNW4R* keyboard) { mpCellPhoneKeyboard = keyboard; }
void setCandidateBoxForMemo(candidatebox::LayoutByNW4R* candidateBox) { mpCandidateBox = candidateBox; }
void setToolBarForMemo(toolbar::LayoutByNW4R* toolBar) { mpToolBar = toolBar; }
void setPredictLanguageDialogForMemo(void* dialog) { mpPredictLanguageDialog = dialog; }
void setSignWindowForMemo(void* signWindow) { mpSignWindow = signWindow; }
void* getSignWindowForMemo() const { return mpSignWindow; }
keyboard::pctype::LayoutByNW4R* getPCKeyboardForMemo() const { return mpPCKeyboard; }
keyboard::cellphonetype::LayoutByNW4R* getCellPhoneKeyboardForMemo() const { return mpCellPhoneKeyboard; }
Destination getDestinationForMemo() const { return meDestination; }
void initAspect();
#endif
virtual void setSecretInputMode(bool secretInputMode) { mpInputForm->setSecretModeOn(secretInputMode); }
#ifdef IPL_ADDRESS_EDIT_CPP
void enableKSXFilter(bool compatibleFilter);

View File

@@ -86,29 +86,11 @@ namespace textinput {
virtual void init() {} // 0x08
virtual void calc(); // 0x0C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void onAnmEvent(AnmPaneEvent) {}
#else
virtual void onAnmEvent(AnmPaneEvent paneEvent);
#endif // 0x10
virtual void onAnmEvent(AnmPaneEvent paneEvent); // 0x10
virtual void changeAnimation(u32 id); // 0x14
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual bool isInAnimation() { return mpCurrentAnim != NULL; }
#else
virtual bool isInAnimation();
#endif // 0x18
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual Anim* searchAnimation(u32 id) {
for (Anim* animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, NULL)); animation != NULL;
animation = static_cast<Anim*>(nw4r::ut::List_GetNext(&mAnms, animation))) {
if (animation->muID == id) return animation;
}
return NULL;
}
#else
virtual Anim* searchAnimation(u32 id);
#endif // 0x1C
virtual bool isInAnimation(); // 0x18
virtual Anim* searchAnimation(u32 id); // 0x1C
virtual ~AnmPane(); // 0x20
@@ -146,11 +128,6 @@ namespace textinput {
class AnimPaneGroup {
public:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
AnimPaneGroup(nw4r::lyt::Group* group) : mpGroup(group) {
nw4r::ut::List_Init(&mAnmPaneList, offsetof(AnmPane, mGroupLink));
}
#endif
virtual void create() {} // 0x08
virtual void init() {} // 0x0C
@@ -204,11 +181,7 @@ namespace textinput {
virtual nw4r::lyt::Pane* get(int i) { return mpaFifo[i]; } // 0x10
virtual nw4r::lyt::Pane* getLast() { // 0x14
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
for (int i = MAX_COUNT-1; i > -1; i--) {
#else
for (int i = MAX_COUNT-1; i > -1; i++) {
#endif
if (mpaFifo[i] != NULL) {
return mpaFifo[i];
}
@@ -253,16 +226,8 @@ namespace textinput {
virtual void setProjectionMtx(); // 0x48
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* pane) { mAnmPaneFifo.push(pane); }
#else
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw);
#endif // 0x4C
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void initPaneLastDrawReceived() { mAnmPaneFifo.init(); }
#else
virtual void initPaneLastDrawReceived();
#endif // 0x50
virtual void setPaneLastDrawReceived(nw4r::lyt::Pane* paneLastDraw); // 0x4C
virtual void initPaneLastDrawReceived(); // 0x50
virtual void setVisible(const char* paneName, bool flag); // 0x54
virtual bool isVisible(const char* paneName, bool* result) const; // 0x58

View File

@@ -1,15 +1,8 @@
#ifndef TEXTINPUT_PC_KEYBOARD_H
#define TEXTINPUT_PC_KEYBOARD_H
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
#include "tiPcKeyboardImpl.h"
#else
#include "tiNw4rManager.h"
#include "tiTextInputBase.h"
#ifdef MYTIMANAGER_IMPLEMENTATION
#include "tiKeyboard.h"
#endif
namespace textinput {
class Manager;
@@ -18,22 +11,8 @@ namespace textinput {
namespace pctype {
#ifdef MYTIMANAGER_IMPLEMENTATION
class UIObj {
public:
class Listener {
public:
virtual void onEvent(UIObj*, u32, void*);
};
};
#endif
// TODO
#ifdef MYTIMANAGER_IMPLEMENTATION
class Base : public textinput::keyboard::KeyboardBase {
#else
class Base : public CommandSender {
#endif
public:
enum TranslateMode {
TM_00,
@@ -47,48 +26,6 @@ namespace textinput {
IT_04,
};
#ifdef MYTIMANAGER_IMPLEMENTATION
enum InputMode {
IM_00,
IM_01,
IM_02,
IM_03,
IM_04,
};
virtual ~Base();
virtual void create(MEMAllocator* allocator) override;
virtual void init() override;
virtual void updateFromReceiver(u32, void*) override;
virtual void onKey(u32, void*) override;
virtual void getType() override;
virtual void setLanguage(Language) override;
virtual void onActive() override;
virtual void inputCharCode(u16);
virtual void getState();
virtual bool isShiftOn() const;
virtual bool isCapsOn() const;
virtual bool isABC();
virtual void setABC(bool);
virtual InputMode getABCInputMode() const;
virtual InputMode getAIUInputMode() const;
virtual TranslateMode getTranslateMode() const;
virtual void setTranslateMode(TranslateMode);
virtual void onlyQwerty(bool);
virtual void setLangKeyActive(bool);
virtual void setInputModeJP(bool, u32, u32);
virtual void setInputModeCK(u32);
virtual void refreshState();
virtual void changeABCInputMode(InputMode);
virtual void changeAIUInputMode(InputMode);
virtual void onClose();
virtual void getWCCode(char*);
virtual void getControlKey(char*);
virtual void sendInputWChar(u16, bool);
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void updateFixMode();
#else
virtual ~Base();
virtual void create(MEMAllocator* allocator);
virtual void init();
@@ -124,57 +61,17 @@ namespace textinput {
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void updateFixMode();
#endif
#ifdef MYTIMANAGER_IMPLEMENTATION
private:
u8 mKeyboardInputFlags[8];
const void* mpKeyStateTable;
u32 mTranslateMode;
u32 mABCInputMode;
u32 mAIUInputMode;
u32 mCurrentInputType;
u32 mInputState;
const void* mpLanguageData;
bool mbOnlyQwerty;
bool mbLanguageKeyActive;
u16 mKeyboardFlags;
void* mpInputSettings;
void* mpCurrentKeyState;
public:
u32 getTranslateModeForMemo() const { return mTranslateMode; }
u32 getABCInputModeForMemo() const { return mABCInputMode; }
u32 getAIUInputModeForMemo() const { return mAIUInputMode; }
#endif
};
// TODO
class LayoutByNW4R : public Base, public nw4rmanager::Layout
#ifdef MYTIMANAGER_IMPLEMENTATION
, public UIObj::Listener
#endif
{
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
public:
// TODO - ...
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual void draw();
virtual void calc();
virtual void setPredictLanguageDialog(void*);
virtual void setSignWindow(void*);
virtual void setLineFeedButton(bool);
virtual void setPredictLanguageButton(bool);
virtual void setSignWindowButton(bool);
#endif
virtual void onClose();
void onPressedShift(bool shift);
void onReleasedShift();
#ifdef MYTIMANAGER_IMPLEMENTATION
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) override;
virtual bool updateInput(input::HKBManager& hkbManager) override;
#endif
};
} // namespace pctype
@@ -183,5 +80,4 @@ namespace textinput {
} // namespace textinput
#endif
#endif // TEXTINPUT_HW_KEYBOARD_H

View File

@@ -1,311 +0,0 @@
#ifndef TEXTINPUT_PC_KEYBOARD_IMPL_H
#define TEXTINPUT_PC_KEYBOARD_IMPL_H
#include "tiKeyboard.h"
#include "tiNw4rManager.h"
#include "tiPkData.h"
namespace textinput {
class Manager;
namespace predictlang {
class LayoutByNW4R;
}
namespace keyboard {
namespace signwindow {
class LayoutByNW4R;
}
}
namespace keyboard {
namespace signwindow {
class Base : public KeyboardBase {
public:
virtual bool isLocked();
virtual void setPage(u8 page);
virtual u8 getPage();
virtual void movePrevSignPage();
virtual void moveNextSignPage();
virtual void close();
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public nw4rmanager::AnmObserver {
public:
virtual void draw();
virtual void open(KeyboardBase* keyboard, bool repeat);
virtual bool isActive();
};
}
namespace pctype {
struct GridKey {
char paneName[18];
wchar_t codes[4];
};
struct ControlKey {
char paneName[20];
u32 key;
};
struct VisiblePanes {
u16 visibleCount;
u16 hiddenCount;
const char* visible[24];
const char* hidden[24];
};
struct Ablaut {
wchar_t code;
wchar_t alternatives[7];
};
struct LanguageData {
const PaneNameToCharCodeWithModeAscii* ascii;
const GridKey* grid;
const ControlKey* controls;
const VisiblePanes* panes;
const Ablaut* ablaut;
};
class Base : public KeyboardBase {
public:
enum TranslateMode {
TM_Direct,
TM_Roman,
TM_Kana
};
enum InputMode {
IM_Direct,
IM_01,
IM_02,
IM_03,
IM_04,
IM_05,
IM_Hiragana,
IM_Katakana
};
enum InputType {
IT_00,
IT_01,
IT_02,
IT_03,
IT_04
};
struct State {
bool rejected;
u8 inputFlags[7];
};
class KeyState {
public:
void refresh_();
void refreshText(nw4r::lyt::Pane* root);
void setABCFlag(u32 flags);
wchar_t getWCCode(u32 index);
wchar_t getWCCode(char* paneName);
void setABCMode(u32 mode) {
if ((abcFlags & 15) != mode) {
abcFlags = (abcFlags & ~15) | (mode & 15);
refresh_();
}
}
void setAIUMode(u32 mode) {
if ((aiuFlags & 15) != mode) {
aiuFlags = (aiuFlags & ~15) | (mode & 15);
refresh_();
}
}
u32 abcFlags;
u32 inputType;
u32 aiuFlags;
Language language;
const LanguageData* data;
Base* owner;
};
virtual ~Base();
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void updateFromReceiver(u32 command, void* data);
virtual void onKey(u32 event, void* data);
virtual int getType();
virtual void setLanguage(Language language);
virtual void onActive();
virtual void inputCharCode(wchar_t code);
virtual State* getState();
virtual bool isShiftOn() const;
virtual bool isCapsOn() const;
virtual bool isABC();
virtual void setABC(bool abc);
virtual InputMode getABCInputMode() const;
virtual InputMode getAIUInputMode() const;
virtual TranslateMode getTranslateMode() const;
virtual void setTranslateMode(TranslateMode mode);
virtual void onlyQwerty(bool only);
virtual void setLangKeyActive(bool active);
virtual void setInputModeJP(bool, u32, u32);
virtual void setInputModeCK(u32);
virtual void refreshState();
virtual void changeABCInputMode(InputMode mode);
virtual void changeAIUInputMode(InputMode mode);
virtual void onClose();
virtual wchar_t getWCCode(char* paneName);
virtual u32 getControlKey(char* paneName);
virtual void sendInputWChar(wchar_t code, bool repeat);
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void updateFixMode();
protected:
State mState;
const LanguageData* mpInitialLanguageData;
KeyState mKeyState;
MEMAllocator* mpAllocator;
bool mbOnlyQwerty;
bool mbLanguageKeyActive;
Manager* mpManager;
};
class LayoutByNW4R;
class AnmPane : public nw4rmanager::AnmPane {
public:
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer), mAnimation(0) {}
virtual void init();
virtual void changeAnimation(u32 animation);
virtual ~AnmPane();
virtual int getState() const { return mAnimation; }
virtual int getKeyType() const { return mKeyType; }
protected:
int mAnimation;
int mKeyType;
};
class NormalButtonAnmPane : public AnmPane {
public:
NormalButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 0; }
virtual ~NormalButtonAnmPane();
virtual void onAnmEvent(AnmPaneEvent event);
};
class ShiftCapsAnmPane : public AnmPane {
public:
ShiftCapsAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer), mbOn(false) { mKeyType = 1; }
virtual ~ShiftCapsAnmPane();
virtual void onAnmEvent(AnmPaneEvent event);
bool isFocused() const;
private:
bool mbOn;
};
class ToggleButtonAnmPane : public AnmPane {
public:
ToggleButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 2; }
virtual ~ToggleButtonAnmPane();
virtual void onAnmEvent(AnmPaneEvent event);
};
class OnOffButtonAnmPane : public AnmPane {
public:
OnOffButtonAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { mKeyType = 3; }
virtual ~OnOffButtonAnmPane();
virtual void onAnmEvent(AnmPaneEvent event);
};
class UIObj : public gui::EventHandler {
public:
class Listener {
public:
virtual void onEvent(UIObj*, u32, void*) = 0;
};
UIObj(u32 id, LayoutByNW4R* layout, Listener* listener) : mId(id), mpLayout(layout), mpListener(listener) {}
virtual ~UIObj();
virtual void onEvent(gui::GUIComponent& component, u32 event, void* data);
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
protected:
u32 mId;
LayoutByNW4R* mpLayout;
Listener* mpListener;
};
class UIModifierButton : public UIObj {
public:
UIModifierButton(u32 id, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModifierButton();
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
gui::PaneComponent* mpPaneComponent;
gui::PaneComponent* mpBoundingComponent;
AnmPane* mpAnimation;
bool mbOn;
};
class UIModePanel : public UIObj {
public:
UIModePanel(u32 id, LayoutByNW4R* layout, Listener* listener);
virtual ~UIModePanel();
virtual void onGUIEvent(gui::PaneComponent& component, u32 event, nw4rmanager::TiEventHandler::Input* input);
void Create(nw4rmanager::Layout* layout);
u32 mMode;
gui::PaneComponent* mpPaneComponents[5];
gui::PaneComponent* mpBoundingComponents[5];
AnmPane* mpAnimations[5];
nw4r::lyt::Pane* mpEnglishText;
nw4r::lyt::Pane* mpHangulText;
nw4r::lyt::Pane* mpModeSelect;
GXTexObj mDirectTexture;
GXTexObj mPinyinTexture;
GXTexObj mEnglishTexture;
GXTexObj mHangulTexture;
};
class EventHandler : public nw4rmanager::TiEventHandler {
public:
EventHandler(LayoutByNW4R* layout) : mpKeyboard(layout) {}
virtual ~EventHandler();
virtual void onTiEvent(gui::PaneComponent* component, u32 event, Input* input);
private:
LayoutByNW4R* mpKeyboard;
};
class LayoutByNW4R : public Base, public nw4rmanager::Layout, public UIObj::Listener {
public:
virtual ~LayoutByNW4R();
virtual void create(MEMAllocator* allocator);
virtual void init();
virtual void updateFromReceiver(u32 command, void* data);
virtual void onKey(u32 event, void* data);
virtual void setLanguage(Language language);
virtual void onActive();
virtual void inputCharCode(wchar_t code);
virtual void setABC(bool abc);
virtual void setTranslateMode(TranslateMode mode);
virtual void onlyQwerty(bool only);
virtual void setLangKeyActive(bool active);
virtual void setInputModeJP(bool abc, u32 abcMode, u32 aiuMode);
virtual void setInputModeCK(u32 mode);
virtual void refreshState();
virtual void onClose();
virtual void sendInputWChar(wchar_t code, bool repeat);
virtual void goSignInputMode();
virtual void changePredictLanguage();
virtual void draw();
virtual void calc();
virtual void setPredictLanguageDialog(predictlang::LayoutByNW4R* dialog);
virtual void setSignWindow(signwindow::LayoutByNW4R* window);
virtual void setLineFeedButton(bool visible);
virtual void setPredictLanguageButton(bool visible);
virtual void setSignWindowButton(bool visible);
virtual bool updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data);
virtual bool updateInput(input::HKBManager& hkb);
virtual void changeAnimationAllToNormal();
virtual void throwReleaseForAll();
virtual void cancelStateFocusIn();
virtual void updatePredictLanguage(CommandReceiver::ChangePredictMode* mode);
virtual void updateDakuten();
virtual void initLayout();
virtual void onEvent(UIObj* object, u32 event, void* data);
void onPressedCaps();
void onPressedShift(bool shift);
void onReleasedShift();
void createAnmPane_(MEMAllocator* allocator);
private:
EventHandler* mpKeyboardEventHandler;
predictlang::LayoutByNW4R* mpPredictDialog;
signwindow::LayoutByNW4R* mpSignWindow;
bool mbLineFeed;
UIModifierButton mShiftButton;
UIModifierButton mCapsButton;
UIModePanel mModePanel;
};
}
}
}
#endif

View File

@@ -9,11 +9,7 @@
namespace textinput {
namespace textdrawer {
#if defined(MYTIMANAGER_IMPLEMENTATION) || defined(MYTIINPUTFORM_IMPLEMENTATION)
class Base : public nw4r::ut::CharWriter {
#else
class Base : nw4r::ut::CharWriter {
#endif
public:
typedef struct ViewPort {
f32 xOrig; // 0x00
@@ -90,14 +86,7 @@ namespace textinput {
private:
u8 unk_0x50[0x78];
bool mbSecretMode; // 0xC8
#ifdef MYTIINPUTFORM_IMPLEMENTATION
protected:
u8 mDrawState[0x27];
f32 mfDrawScrollY;
u8 mDrawCacheState[0x14];
#else
u8 unk_0xCC[0x3C];
#endif
};
}
}

View File

@@ -50,21 +50,11 @@ namespace textinput {
class CommandSender;
class CommandReceiver : public Base {
public:
#ifdef MYTIINPUTFORM_IMPLEMENTATION
struct Scroll {
bool absY;
f32 x;
f32 y;
};
#endif
typedef enum INPUT_COMMAND {
INPUT_COMMAND_0 = 0,
INPUT_COMMAND_37 = 37,
} INPUT_COMMAND;
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
struct ChangePredictMode { u32 mode; bool enabled; };
#endif
virtual void clearSender();
virtual void onCommand(INPUT_COMMAND command, void* data);
virtual void addSender(CommandSender* cmdSend);
@@ -78,13 +68,7 @@ namespace textinput {
CommandSender() : mpCommandReceiver(NULL) {}
virtual void setCommandReceiver(CommandReceiver* cmdRecv);
#ifdef TI_PC_KEYBOARD_IMPLEMENTATION
virtual void sendCommand(u32 command, void* data) {
if (mpCommandReceiver != NULL) mpCommandReceiver->onCommand(static_cast<CommandReceiver::INPUT_COMMAND>(command), data);
}
#else
virtual void sendCommand(u32, void*);
#endif
virtual void updateFromReceiver(u32, void*) {}
nw4r::ut::Link mLink; // 0x00

View File

@@ -8,21 +8,15 @@
#include <cstring>
#include "global/decomp/utils.h"
namespace ipl {
namespace gui {
class PaneComponent : public ::gui::PaneComponent {};
class PaneManager : public ::gui::PaneManager {
public:
#ifdef IPL_GCW_PANEMANAGER_CTOR_OUT_OF_LINE
PaneManager(::gui::EventHandler* event, const nw4r::lyt::DrawInfo* drawInfo, EGG::Heap* heap, EGG::Allocator* allocator, bool bDisableCon = false) NO_INLINE;
#else
PaneManager(::gui::EventHandler* event, const nw4r::lyt::DrawInfo* drawInfo, EGG::Heap* heap, EGG::Allocator* allocator, bool bDisableCon = false) :
::gui::PaneManager(event, allocator, drawInfo),
mpHeap(heap),
mbDisableCon(bDisableCon) {}
#endif
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
virtual ~PaneManager();

View File

@@ -7,10 +7,6 @@
#include "utility/iplFrameController.h"
#ifdef IPL_GCW_INTP_CTOR_OUT_OF_LINE
#include "global/decomp/utils.h"
#endif
namespace ipl {
namespace math {
template <typename T>
@@ -41,9 +37,6 @@ namespace ipl {
template <typename T>
class LinearIntp : public Interporation<T> {
public:
#ifdef IPL_GCW_INTP_CTOR_OUT_OF_LINE
LinearIntp() NO_INLINE;
#endif
#ifdef IPL_BOARD_OBJECT_INLINE_INTERPOLATION_DTORS
virtual ~LinearIntp();
#endif
@@ -57,7 +50,6 @@ namespace ipl {
T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); }
};
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
template <typename T>
class __declspec(novtable) HermiteIntp : public utility::FrameController {

View File

@@ -85,9 +85,6 @@ namespace ipl {
}
const utility::BScroller& getBInst() { return mBScroller; }
#ifdef IPL_SDMEMORY_SCROLLER_BINST_RESET
void resetBInst() { mBScroller.reset(); }
#endif
bool isDownEnd() const { return mScroller.isDownEnd(); }
bool isUpEnd() const { return mScroller.isUpEnd(); }
@@ -101,9 +98,6 @@ namespace ipl {
void setDownLimit(f32 v) { mScroller.setDownLimit(v); }
void setUpLimit(f32 v) { mScroller.setUpLimit(v); }
#ifdef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
void setState(int state) { mScroller.setState(state); }
#endif
bool isActive() const { return mScroller.isActive(); }

View File

@@ -1,44 +0,0 @@
#ifndef IPL_SCENE_GC_SAVE_DATA_H
#define IPL_SCENE_GC_SAVE_DATA_H
#include <nw4r/ut.h>
#include "scene/memoryCard/iplMemoryCardBase.h"
#include "math/iplMathTypes.h"
namespace ipl {
namespace scene {
class GCSaveData : public MemoryBase {
friend class MemoryCard;
public:
GCSaveData(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName,
math::VEC3 translate);
virtual ~GCSaveData();
virtual void onPoint(const char* paneName, controller::Interface* controller);
virtual void onLeft(const char* paneName);
virtual void onTrig(const char* paneName);
void calc();
void draw();
void update();
void init();
void setTranslate(const nw4r::math::VEC3& translate);
const nw4r::math::VEC3* getTranslate();
void setBalloon(TextBalloon* balloon);
private:
MemoryBaseEvent* mpEvent; // 0x34
TextBalloon* mpBalloon; // 0x38
u8 mSlot; // 0x3C
s16 mIndex; // 0x3E
nw4r::ut::Link mLink; // 0x40
};
} // namespace scene
} // namespace ipl
#endif // IPL_SCENE_GC_SAVE_DATA_H

View File

@@ -3,87 +3,14 @@
#include "iplSceneHeader.h"
#include "scene/memoryCard/iplMemoryCardBase.h"
#include "scene/memoryCard/iplMemoryCardManager.h"
#include "math/iplMathTypes.h"
namespace ipl {
namespace scene {
class GCSaveData;
class GCWindow;
class SavedataEditWindow;
class MemoryCard : public Base, public MemoryBase {
SCENE_CLASS(MemoryCard) {
public:
MemoryCard(EGG::Heap* heap);
virtual ~MemoryCard();
virtual BOOL isResetAcceptable() const;
virtual void prepare();
virtual void create();
virtual void calc();
virtual void draw();
virtual void onPoint(const char* paneName, controller::Interface* controller);
virtual void onLeft(const char* paneName);
virtual void onTrig(const char* paneName);
void onFocus(void* data);
void onRelease();
MemoryCardManager* getManager() { return mpManager; }
MemoryCard(EGG::Heap * heap);
private:
enum {
SLOT_A = 0,
SLOT_B,
};
void on_fadein1st();
void on_fadein2nd();
void on_normal();
void on_scroll_r();
void on_scroll_l();
void on_change_tag1st();
void on_change_tag2nd();
void on_fadeout1st();
void on_fadeout2nd();
void on_error();
void on_insert_card();
void on_detach_card();
void start_savedata_fadein();
void start_savedata_fadeout();
void start_errormessage_fadein();
int update_slot();
void show_arw();
void show_capacity(u8 slot);
void scroll_common();
void start_scroll_r();
void start_scroll_l();
private:
s32 mState; // 0x88
s32 mPrevState; // 0x8C
u8 mSlot; // 0x90
u8 unk_0x91[3]; // 0x91
s32 mSlotState[2]; // 0x94
s16 mIconIndex; // 0x9C
s16 mIconCount; // 0x9E
u8 mShowArwR; // 0xA0
u8 mShowArwL; // 0xA1
u8 unk_0xA2[2]; // 0xA2
MemoryCardManager* mpManager; // 0xA4
MemoryBaseEvent* mpEvent; // 0xA8
nw4r::ut::List mSaveDataList; // 0xAC
nand::LayoutFile* mBalloonLayoutFile; // 0xB8
nw4r::ut::List mBalloonList; // 0xBC
GCSaveData* mpFocusSaveData; // 0xC8
GCWindow* mpGCWindow; // 0xCC
u8 unk_0x54[0x7C];
};
} // namespace scene
} // namespace ipl

View File

@@ -1,144 +0,0 @@
#ifndef IPL_SCENE_MEMORY_CARD_BASE_H
#define IPL_SCENE_MEMORY_CARD_BASE_H
#include <nw4r/ut.h>
#include "layout/iplLayout.h"
#include "layout/iplGuiManager.h"
#include "system/iplController.h"
namespace ipl {
namespace scene {
class TextBalloon;
class SettingButton;
class MemoryBase;
}
namespace nand {
class LayoutFile;
}
namespace scene {
class MemoryBaseEvent : public ::gui::EventHandler {
public:
#ifdef IPL_MEMORYCARD_BASE_EVENT_OUT_OF_LINE
MemoryBaseEvent(MemoryBase* base);
#else
MemoryBaseEvent(MemoryBase* base) : mpBase(base) {}
#endif
virtual ~MemoryBaseEvent();
virtual void onEvent(u32 componentID, u32 event, void* data);
private:
MemoryBase* mpBase; // 0x0C
};
class MemoryBase {
public:
class Anm {
public:
Anm(layout::GroupAnimator* anim) : mAnim(anim) {}
virtual ~Anm();
layout::GroupAnimator* mAnim; // 0x04
nw4r::ut::Link mLink; // 0x08
};
class Button {
public:
Button(nw4r::lyt::Pane* pane) : unk_0x04(0), mPane(pane) {}
virtual ~Button();
u32 unk_0x04; // 0x04
nw4r::lyt::Pane* mPane; // 0x08
nw4r::ut::Link mLink; // 0x0C
};
class AnmButton {
public:
AnmButton(const char* name, Anm* anm1, Anm* anm2, Anm* anm3)
: unk_0x04(0), mName(name), mCurrentAnm(NULL), mAnm1(anm1), mAnm2(anm2), mAnm3(anm3),
unk_0x24(0), mLastCmd(0), mpBalloon(NULL) {}
virtual ~AnmButton();
void calc();
void onCmdRecv(int command);
void setBalloon(TextBalloon* balloon);
int unk_0x04; // 0x04
const char* mName; // 0x08
Anm* mCurrentAnm; // 0x0C
Anm* mAnm1; // 0x10
Anm* mAnm2; // 0x14
Anm* mAnm3; // 0x18
nw4r::ut::Link mLink; // 0x1C
u32 unk_0x24; // 0x24
int mLastCmd; // 0x28
TextBalloon* mpBalloon; // 0x2C
};
struct AnmName {
const char* anmFile;
const char* groupName;
};
#ifdef IPL_MEMORYCARD_BASE_CTOR_OUT_OF_LINE
MemoryBase();
#else
MemoryBase() : mpLayout(NULL), unk_0x08(NULL) {
nw4r::ut::List_Init(&mAnmList, offsetof(Anm, mLink));
nw4r::ut::List_Init(&mButtonList, offsetof(Button, mLink));
nw4r::ut::List_Init(&mAnmButtonList, offsetof(AnmButton, mLink));
}
#endif
#ifdef IPL_MEMORYCARD_BASE_OUT_OF_LINE
virtual ~MemoryBase();
#else
virtual ~MemoryBase() {}
#endif
virtual void onPoint(const char* paneName, controller::Interface* controller);
virtual void onLeft(const char* paneName);
virtual void onMove(const char* paneName);
virtual void onTrig(const char* paneName);
virtual void add_button(const char** paneNames, int count);
virtual void add_anmbutton(const char* paneName, Anm* anm1, Anm* anm2, Anm* anm3);
virtual Button* get_button(const char* paneName);
virtual AnmButton* get_anmbutton(const char* paneName);
virtual void clear_button(const char* paneName);
virtual void add_animation(const AnmName* anmNames, int count);
virtual Anm* get_animation(int index);
virtual void do_animation(int index);
virtual void do_animation(int index, bool flag);
virtual void stop_animation(int index);
virtual bool is_animation(int index);
virtual bool is_fadein_enable();
virtual void set_visible(const char* paneName, bool flag);
void set_textbox(const char* paneName, u32 message);
void set_textbox(const char* paneName, u32 message, int x, int y);
void set_textbox(const char* paneName, const wchar_t* text, f32 x, f32 y);
void set_textbox(const char* paneName, const wchar_t* text);
SettingButton* get_setting_button();
void change_button_text_close();
void change_button_text_return();
void change_button_text_ok();
void show_button_return();
void show_button_ok();
protected:
layout::Object* mpLayout; // 0x04
nand::LayoutFile* unk_0x08; // 0x08
gui::PaneManager* mpPaneManager; // 0x0C
nw4r::ut::List mAnmList; // 0x10
nw4r::ut::List mButtonList; // 0x1C
nw4r::ut::List mAnmButtonList; // 0x28
};
} // namespace scene
} // namespace ipl
#endif // IPL_SCENE_MEMORY_CARD_BASE_H

View File

@@ -1,107 +0,0 @@
#ifndef IPL_SCENE_MEMORY_CARD_MANAGER_H
#define IPL_SCENE_MEMORY_CARD_MANAGER_H
#include <revolution/types.h>
#include <revolution/gx.h>
#include <private/card.h>
#include <wchar.h>
#include "iplMemoryCardLib.h"
namespace ipl {
namespace scene {
class MemCardEventHandler {
public:
MemCardEventHandler() {}
virtual ~MemCardEventHandler();
virtual void onMemEvent(long event, u8 slot);
};
typedef struct MCFile {
u32 fileNo; // 0x00
u32 unk_0x04; // 0x04
u32 unk_0x08; // 0x08
s32 sortKey; // 0x0C
} MCFile; // 0x10
typedef struct MCFileCell {
wchar_t comment[2][0x40]; // 0x000
s16 iconAnmCounter; // 0x100
u16 unk_0x102; // 0x102
GXTexObj icon; // 0x104
GXTexObj banner; // 0x124
GXTlutObj iconTlut; // 0x144
GXTlutObj bannerTlut; // 0x150
} MCFileCell; // 0x15C
class MemoryCardManager {
public:
MemoryCardManager() {
MCFileCell* pCell = mFileCell[0];
do {
pCell->iconAnmCounter = 0;
wmemset(pCell->comment[0], 0, 0x40);
pCell++;
} while (pCell < mFileCell[2]);
mLastResult = 0;
mLastCmd = 0;
__CARDSetDiskID(NULL);
memorycard::initCardThread();
sort_file_array(0);
sort_file_array(1);
}
virtual ~MemoryCardManager();
void calc();
bool isSlotReady(u8 slot);
bool isSlotNoCard(u8 slot);
long isSlotWrongDevice(u8 slot);
void sort_file_array(u8 slot);
void sendCardCmdMove(u8 slot, s16 index);
void sendCardCmdCopy(u8 slot, s16 index);
void sendCardCmdDelete(u8 slot, s16 index);
void sendCardCmdFormat(u8 slot);
bool isDistSlot(u8 slot, long* pState);
bool isMoveEnable(u8 slot, u32 index, long* pCode);
bool isCopyEnable(u8 slot, u32 index, long* pCode);
bool isIconValidate(u8 slot, s16 index);
bool isBannerEnable(u8 slot, s16 index);
void update_icon_anm();
void update_file_array(u8 slot);
void update_change_cardstate(u8 slot);
GXTexObj* create_icon(u8 slot, s16 index);
GXTexObj* create_icon(u8 slot, s16 index, long start);
GXTexObj* _create_icon(u8 slot, s16 fileNo, long start);
const wchar_t* getComment(u8 slot, s16 index, int which);
GXTexObj* create_banner(u8 slot, s16 index);
u16 getBlocks(u8 slot, s16 index);
u16 getFreeBlocks(u8 slot);
void setEventHandler(MemCardEventHandler* eventHandler) {
mpEventHandler = eventHandler;
}
private:
u32 unk_0x04; // 0x00004
MCFile mFile[2][0x7F]; // 0x00008
MCFileCell mFileCell[2][0x7F]; // 0x00FE8
s32 mLastResult; // 0x16930
s32 mLastCmd; // 0x16934
u32 unk_0x16938; // 0x16938
MemCardEventHandler* mpEventHandler; // 0x1693C
};
} // namespace scene
} // namespace ipl
#endif // IPL_SCENE_MEMORY_CARD_MANAGER_H

View File

@@ -11,12 +11,6 @@
namespace ipl {
namespace scene {
#ifdef IPL_SD_CHANNEL_SELECT_CPP
namespace {
class SDChannelSelectButtonEventHandler;
}
#endif
class SDButtonEventHandlerBase : public ::gui::EventHandler {
public:
virtual void onEvent(u32 compId, u32 event, void* data);
@@ -97,17 +91,8 @@ namespace ipl {
void startLeftEvent(const char* paneName);
bool isActive() const;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
bool isLeftArrowVisible() const { return mbArrowVisible[ARROW_BTN_LEFT]; }
static const char* getButtonName(int button) { return smButtonName[button]; }
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP
void setEventHandler(::gui::EventHandler * event,
::gui::EventHandler * optOutEvent = NULL);
#else
void setEventHandler(::gui::EventHandler * event, ::gui::EventHandler * optOutEvent);
#endif
void setText(const char* paneName, u32 msgId);
void setText(const char* paneName, const wchar_t* text);
@@ -171,10 +156,6 @@ namespace ipl {
friend class SDArrow;
friend class SDButtonEventHandlerBase;
#ifdef IPL_SD_CHANNEL_SELECT_CPP
friend class SDChannelSelect;
friend class SDChannelSelectButtonEventHandler;
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -10,8 +10,6 @@
namespace ipl {
namespace scene {
class SDChannelSelect;
class SDMemory {
public:
struct TitleRange {
@@ -22,10 +20,9 @@ namespace ipl {
SDMemory();
~SDMemory();
void create(EGG::Heap* heap, nand::LayoutFile* layoutFile, SDChannelSelect* channelSelect);
void create(EGG::Heap* heap, nand::LayoutFile* layoutFile, NandSDCardManager* manager);
void setTitleLists(const TitleRange& nandTitles, const TitleRange& sdTitles);
bool calc();
void draw();
void setScrollLimit();
void updateSideArrows();
void resetScrollArrows();
@@ -39,13 +36,8 @@ namespace ipl {
void hideLeftArrow();
void hideRightArrow();
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
s32 updateState();
void drawTransferTitles();
void onDialogState0();
void onDialogState2();
bool onDialogState3();
@@ -71,44 +63,6 @@ namespace ipl {
bool onDialogState24();
void resetDialogPaneAnimations();
s32 getControlPaneIndex(const char* paneName);
void activateControlPane(const char* paneName, ::gui::Component* component);
void deactivateControlPane(const char* paneName);
void cancelControlPane(const char* paneName);
s32 getTitlePaneIndex(const char* paneName);
void activateTitlePane(const char* paneName, ::gui::Component* component);
void deactivateTitlePane(const char* paneName);
void selectTitlePane(const char* paneName);
s32 getDialogPaneIndex(const char* paneName);
void activateDialogPane(const char* paneName, ::gui::Component* component);
void deactivateDialogPane(const char* paneName);
void selectDialogPane(const char* paneName);
class ControlPaneEventHandler : public ::gui::EventHandler {
public:
ControlPaneEventHandler(SDMemory* instance) : ::gui::EventHandler(), mpInstance(instance) {}
virtual void onEvent(u32 compId, u32 event, void* data);
private:
SDMemory* mpInstance;
};
class TitlePaneEventHandler : public ::gui::EventHandler {
public:
TitlePaneEventHandler(SDMemory* instance) : ::gui::EventHandler(), mpInstance(instance) {}
virtual void onEvent(u32 compId, u32 event, void* data);
private:
SDMemory* mpInstance;
};
class DialogPaneEventHandler : public ::gui::EventHandler {
public:
DialogPaneEventHandler(SDMemory* instance) : ::gui::EventHandler(), mpInstance(instance) {}
virtual void onEvent(u32 compId, u32 event, void* data);
private:
SDMemory* mpInstance;
};
layout::Object* mpMainLayout;
layout::Object* mpTitleLayout;
@@ -123,7 +77,7 @@ namespace ipl {
u32 mPanelStates[3];
u32 mTitlePanelStates[5];
u32 mPanelAnimationStates[4];
SDChannelSelect* mpSDChannelSelect;
NandSDCardManager* mpNandSDCardManager;
TitleRange mNandTitleRange;
TitleRange mSDTitleRange;
u32 mTitleCount;
@@ -132,11 +86,11 @@ namespace ipl {
ESTitleId mTitleIds[96];
wchar_t mTitleNames[96][21];
u32 mTitleNameCount;
u32 mSDTitleCount;
ESTitleId mSDTitleIds[96];
u32 mNandTitleCount;
u32 mNandTitleNameCount;
ESTitleId mNandTitleIds[96];
u32 mNandTitleCount;
u32 mSDTitleCount;
ESTitleId mSDTitleIds[96];
wchar_t mCurrentTitleName[0x840];
u8 mTransferFlags[4];
u32 mTransferStatus;
@@ -153,10 +107,8 @@ namespace ipl {
scroller mScroller;
s32 mButtonState;
u8 mControllerFlags[4];
#ifndef IPL_SD_CHANNEL_TITLE_CPP
u32 mFinalState[3];
u8 mFinalFlags[4];
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -10,14 +10,6 @@
namespace ipl {
namespace scene {
#ifdef IPL_SD_CHANNEL_SELECT_CPP
class SDChannelSelect;
namespace {
class SDChannelSelectEventHandler;
class SDChannelSelectButtonEventHandler;
}
#endif
class SDChannelObj {
public:
SDChannelObj(EGG::Heap* heap, int page, int index);
@@ -26,13 +18,8 @@ namespace ipl {
EGG::Heap* getHeap() const { return mpHeap; }
int getPage() const { return mPage; }
int getIndex() const { return mIndex; }
nw4r::math::VEC3& getTranslate() const;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
friend class SDChannelSelect;
nw4r::ut::Link mListLink;
@@ -73,16 +60,10 @@ namespace ipl {
extern "C" void iplSDChannelObj_813E311C(SDChannelObj* channel, EGG::ExpHeap* firstHeap,
EGG::ExpHeap* secondHeap);
extern "C" void iplSDChannelObj_813E322C(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E32C8(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E34E0(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E3178(SDChannelObj* channel, nw4r::lyt::Pane* pane);
extern "C" void iplSDChannelObj_813E3180(SDChannelObj* channel, nand::LayoutFile* layoutFile);
extern "C" void iplSDChannelObj_813E3304(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E330C(SDChannelObj* channel);
extern "C" void iplSDChannelObj_813E3354(SDChannelObj* channel, int state);
extern "C" void iplSDChannelObj_813E33EC(SDChannelObj* channel, int state);
extern "C" void iplSDChannelObj_813E3480(SDChannelObj* channel, bool selected);
extern "C" void iplSDChannelObj_813E34E8(SDChannelObj* channel, int enabled);
extern "C" void* iplSDChannelObj_813E3128(SDChannelObj* channel);
extern "C" bool iplSDChannelObj_813E3330(SDChannelObj* channel);
@@ -144,11 +125,6 @@ namespace ipl {
SDChannelSelect(EGG::Heap* heap);
virtual ~SDChannelSelect();
NandSDWorker::WorkSDState getSDState() const {
return static_cast<NandSDWorker::WorkSDState>(mCurrentSDState);
}
NandSDWorker* getWorker() const { return mpSDWorker; }
virtual BOOL isResetProcessDone();
virtual void startResetting();
virtual void prepare();
@@ -161,14 +137,6 @@ namespace ipl {
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
void onButtonEvent(const char* paneName, u32 event,
const controller::Interface* controller);
BOOL onEventDerived(const char* paneName, u32 event,
controller::Interface* controller);
bool collectTitlesByUsage(const s32* firstUsage, const s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
static const char* mscChannelPaneNames[PAGE_COUNT][MAX_CHANNEL_INDEX];
static const char* mscBasePaneNames[PAGE_COUNT];
static const char* mscPicturePaneNames[PAGE_COUNT];
@@ -176,15 +144,7 @@ namespace ipl {
static const char* mscClockPaneNames[3];
static const char* mscMaskPaneName;
#ifdef IPL_SD_CHANNEL_TITLE_CPP
public:
#else
private:
#endif
#ifdef IPL_SD_CHANNEL_SELECT_CPP
friend class SDChannelSelectEventHandler;
friend class SDChannelSelectButtonEventHandler;
#endif
void enqueueStartNotice();
bool enqueueFinishNotice();
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
@@ -202,40 +162,16 @@ namespace ipl {
void calcChannelObjects();
void updateChannelObjects();
void updateChannelObject(SDChannelObj* channel);
void drawChannelTransitionObjects();
void drawChannelObjects();
bool isChannelInCalc(int page, int index, int currentPage) const;
nw4r::lyt::Pane* getChannelBasePane(int page, int index, int currentPage) const;
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);
void calcPageAnimations();
void processNormalInput();
void updateArrowVisibility();
void processWorkerState();
void updateDialogAnimation();
void initializeNormalPage();
void updatePageTransform();
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,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesFromNandUsage(const s32* firstUsage, const s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesBySpecialChannels(const s32* firstUsage, const s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount);
bool collectTitlesForMode(const s32* firstUsage, const s32* secondUsage,
ESTitleId* titleIds, char* titleNames,
u32* titleCount, int searchMode);
bool findAdjacentChannel(int direction, int* page, int* index) const;
void setStateAndPlaySelectSound(int state) NO_INLINE;
void finishDialogOperation();
void finishDialogTransition();
void processWorkerCommands();
void handleWorkerStartup();
void handleNandTitleCount();
@@ -269,38 +205,9 @@ namespace ipl {
SDChannelObj* findChannelObject(int page, int index) const;
void createChannelObject(int page, int index);
void createBaseLayout();
void createSceneLayouts();
BOOL isChannelMoveTarget(int page, int index) const;
void selectChannel(int page, int index);
BOOL prepareRestarting(int page);
void startPageTransition(int page, int index);
void setCurrentPageAndRefresh(int page, int index, SDChannelObj* keepChannel);
void handleFourPageDialog();
void handleThreePageDialog();
void setPageActionFrame();
void advancePageAnimation();
void finishPageScroll();
void finishCardDialog();
void flushSaveDataAndMountSD();
void startDrag(const controller::Interface* controller, int page, int index);
void finishDrag();
void moveDrag();
void updateDragState();
void updateDragPageTransition();
void finishDragWait();
void finishDragPageTransition();
void applyChannelMove();
void finishChannelMove();
void resetDragPreview();
void finishDragPageChange();
BOOL isPageCreated(int page) const;
void refreshPageObjects(int page, SDChannelObj* keepChannel, int noticeIndex);
void updateChannelObjectOrder(int page);
void moveChannelObjectsToDrawOrder(int page, int mode);
void setLayoutFrame(int state);
BOOL tellStartingZoomAnm();
void initPageAnimations(const math::VEC3& position, int direction);
static BOOL isChannelReady(const SDChannelObj* channel);
void updateNoCardLayouts();
void createChannelThumbnails();
nw4r::ut::List mChannelObjects;
nand::LayoutFile* mpLayoutFile;
layout::Object* mpLayout;
@@ -316,7 +223,7 @@ namespace ipl {
int mCurrentChannelIndex;
f32 mThumbOffsetX;
f32 mThumbOffsetY;
math::VEC3 mPosition;
nw4r::math::VEC3 mPosition;
math::VEC2 mScale;
f32 mAspectRatioScale;
bool mbLeftArrowVisible;
@@ -339,9 +246,9 @@ namespace ipl {
bool mbButtonEnabled;
bool mbDialogActive;
u16 mInputFlags;
void* mpCurrentChannel;
SDChannelObj* mpCurrentChannel;
layout::Object* mpStateLayout;
layout::Animator* mpHelpLayout;
layout::Object* mpHelpLayout;
EGG::ExpHeap* mpRsoHeap;
channel::RsoThread* mpRsoThread;
u32 mCommandQueueState;
@@ -357,8 +264,8 @@ namespace ipl {
ESTitleId32* mpSDTitleIds;
SDChannelSelectTitleInfo* mpSDTitleInfo;
NandSDWorker::TitleUsage* mpNandTitleInfo;
s32 mFirstTitleCount;
s32 mSecondTitleCount;
u32 mFirstTitleCount;
u32 mSecondTitleCount;
SDChannelObj* mpCurrentLoadedChannel;
u32 mSDTitleCount;
u32 mNandTitleCount;
@@ -372,8 +279,8 @@ namespace ipl {
u8 mbShowNoCardMessage;
u8 mbOperationActive;
u8 mbSDCardBroken;
int mOperationState;
int mDialogState;
u32 mOperationState;
u32 mDialogState;
nand::File* mpSaveDataFile;
u32 mAnimationState;
u32 mAnimationTarget;

View File

@@ -3,104 +3,15 @@
#include "iplSceneHeader.h"
#ifdef IPL_SD_CHANNEL_TITLE_CPP
#include "math/iplInterporation.h"
#include "scene/sdChannelMemory/iplSDMemory.h"
#include "system/iplChannelRsoThread.h"
#include "utility/iplCapture.h"
#include <private/es.h>
#include <nw4r/snd/SoundHandle.h>
#endif
namespace ipl {
namespace scene {
class SDChannelSelect;
class SDButtonEventHandlerBase;
FADER_SCENE_CLASS(SDChannelTitle) {
public:
SDChannelTitle(EGG::Heap * heap, SDChannelSelect * chanSel);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
virtual ~SDChannelTitle();
virtual void prepare();
virtual void create();
virtual void calcCommon();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual void initCalcFadeout();
virtual FaderSceneCommand calcFadeout();
virtual void draw();
virtual void destroy();
BOOL isResetAcceptable();
virtual void startResetting();
using Base::reserveAllSceneDestruction;
using Base::createChildScene;
s32 mState;
EGG::ExpHeap* mpBannerHeap;
EGG::ExpHeap* mpCaptureHeap;
s32 mPage;
s32 mIndex;
s32 mPageCount;
s32 mNextScene;
s32 mParentalResult;
math::VEC3 mPosition;
u32 mLaunchFrame;
s32 mStartButtonState;
bool mbBannerStarting;
layout::Animator* mpButtonAnimations[7][6];
math::HermiteIntp<f32>* mpFade;
SDChannelSelect* mpChannelSelect;
nand::LayoutFile* mpLayoutFile;
layout::Object* mpLayout;
gui::PaneManager* mpPaneManager;
layout::Object* mpIconLayout;
EGG::ExpHeap* mpIconHeap;
layout::Object* mpProgressLayout;
s32 mLoadedIndex;
nand::LayoutFile* mpBannerFiles[2];
nand::File* mpSoundFiles[2];
layout::Object* mpBannerLayout;
layout::Animator* mpBannerAnimations[3];
nw4r::snd::SoundHandle* mpSoundHandle;
nand::File* mpSaveFile;
u32 mWpadStopTick;
s32 mHoverCounts[2];
SDButtonEventHandlerBase* mpButtonEventHandler;
utility::Capture* mpScreenCapture;
utility::Capture* mpBannerCapture;
ESTmdView* mpTmd;
u8 mbTmdReady;
u8 mTitleFlags;
u16 mMakerCode;
u8 mbStartAnimation;
s32 mScriptState;
s32 mScriptEnabled;
bool mbStopScript;
u32 mScriptFrame;
u32 mScriptDuration;
nand::File* mpScriptFile;
EGG::ExpHeap* mpScriptHeaps[2];
s32 mScriptHeapIndex;
channel::RsoThread* mpRsoThread;
EGG::ExpHeap* mpRsoHeap;
layout::Animator* mpScriptAnimations[16];
bool mbScriptFailed;
EGG::ExpHeap* mpScriptHeap;
ESTitleId mTitleId;
SDMemory::TitleRange mTitleRange;
u8 mUnknownTitleWork[0x800];
SDMemory mMemory;
u32 mErrorMessage;
s32 mChangeFrame;
u8 mbCopiedTitle;
u8 mbResetAcceptable;
nw4r::snd::SoundHandle* mpCopySound;
#else
private:
u8 unk_0x58[0x3460];
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -1,32 +0,0 @@
#ifndef IPL_SCENE_SETTING_AOSS_H
#define IPL_SCENE_SETTING_AOSS_H
#include <revolution/ncd/NCDTypes.h>
#include <revolution/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct AOSSInitInput {
u16 flags;
u8 mode;
u8 reserved;
u16 ssidLength;
u8 ssid[0x100];
s16 options[5];
u8 optionData[6];
u8 status;
u8 result[0x154];
} AOSSInitInput;
int AOSSi_Init(AOSSInitInput* input);
int AOSS_Init_old(AOSSInitInput* input);
void* AOSSi_Alloc(u32 size);
void AOSSi_Free(void* block);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -17,11 +17,7 @@ namespace ipl {
virtual ~APScanThread(); // 0x08
virtual void* Run(); // 0x0C
#ifdef IPL_SETTING_IMPLEMENTATION
virtual void unk_0x2C();
#else
virtual void unk_0x2C() = 0;
#endif
virtual void unk_0x2C() = 0; // 0x2C
void setResultData(unsigned short* buffer);
void setParam();

View File

@@ -3,171 +3,14 @@
#include "iplSceneHeader.h"
#ifdef IPL_SETTING_IMPLEMENTATION
#include <revolution/os.h>
#include "layout/iplGuiManager.h"
#include "layout/GUIManager.h"
#include "iplwww/www_wiisetting.h"
#include "iplwww/www_browser.h"
#include "system/iplKeyboard.h"
#include "system/iplNand.h"
#include "utility/iplThread.h"
extern "C" {
#include <revolution/wd.h>
}
#endif
namespace ipl {
namespace controller {
class Interface;
}
}
namespace ipl {
namespace scene {
#ifdef IPL_SETTING_IMPLEMENTATION
class Setting;
class APScanThread;
class APEvent : public ::gui::EventHandler {
public:
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
virtual void onEvent(u32 componentID, u32 event, void* data);
private:
Setting* mpSetting;
};
struct SettingAnimation {
u8 unknown[0x14];
int state;
};
struct SettingAPScanList {
u8 unknown[0x14];
u16 count;
u8 entries[0x7fe];
union {
WDBssDesc_* currentDescriptor;
u16* currentDescriptorWords;
};
};
#endif
FADER_SCENE_CLASS(Setting) {
public:
Setting(EGG::Heap * heap, int arg);
#ifdef IPL_SETTING_IMPLEMENTATION
virtual ~Setting();
bool isAnimating();
void getFuncMsgQ();
void resetFuncMsgQ();
void createBrowser();
void initDirectUrl();
void initString();
void initWiiSettingData();
void initNickName();
void initSecurityKey();
void initSSID();
void initIP();
void initDNS();
void initProxy();
void initBasic();
void initMTU();
void initSecA();
void initVersion();
void updateController_();
void setSE();
void changeVideoMode();
bool isInitialSequenceExit(const ::ipl::controller::Interface* input);
bool updateScreenMode();
void initHTMLText();
void initMessage();
void initKeyboard(const char* text);
bool checkInputString(const wchar_t* text);
int checkIPString(const wchar_t* text);
void setDefaultBackString();
void calcKeyboard();
void calcSetting();
void onTextInputOK();
void setDisPos();
void setNickName();
void setSecurityKey();
void setSSID();
void setIP();
void setDNS();
void setProxy();
void setBasic();
void setMTU();
void setParePass();
void setPareRePass();
void setPareJudgePass();
void setSecA();
void setReSecA();
void setMasterKey();
void adjustSecA(wchar_t* text);
void reAdjustSecA();
u8 checkTextNum(const char* text);
bool checkSpace();
void convertIP(char* destination, const u8* address);
void convertRevIP(u8* destination, const char* address);
void initScroll();
void updateScroll();
void setAPDraw();
int getRadioLevel(const WDBssDesc_* descriptor);
void setUseEULA_Init_();
void setUseEULA_Cancel_();
void setUseEULA_Start_();
void setUseEULA_WaitStopMotor_();
bool validateEULA_();
void setUpdate_Init_();
void setUpdate_WaitAcceptDialog_();
void setUpdate_ConnectTestStart_();
void setUpdate_ConnectTestCreateWait_();
void setUpdate_ConnectTestRun_();
void setUpdate_ConnectTestFailed_();
void setUpdate_SuccessDialog_();
void setUpdate_NoUpdateDialog_();
void setUpdate_EULAInit_();
void setUpdate_Reboot_();
void makeErrorMessage();
bool calcSafeMode();
void waitStart();
void waitFinish();
bool isWaitPlaying();
void initAP();
void resetAP();
void redrawAP();
void scanAP();
void setNUP();
void setUSBAP();
void cancelUSBAP();
void AOSSProcess();
void RakuProcess();
void setUpdate_();
void setUseEULA_();
void start_point_event(const char* pageName);
void start_trig_event(const char* pageName);
void start_left_event(const char* pageName);
int get_arw_no(const char* paneName);
int get_ap_no(const char* buttonName);
void makeSupportCode();
int getErrorNum();
virtual void destroy();
virtual void prepare();
virtual void create();
virtual void calc();
virtual void draw();
virtual FaderSceneCommand calcFadein();
virtual FaderSceneCommand calcNormal();
virtual FaderSceneCommand calcFadeout();
virtual BOOL isResetAcceptable() const;
#endif
void setInitializeResult(bool, int);
u16 getProfileID();
void setInitializeResult(bool, int);
void setConnectTestResult(int, int, bool, int);
int getUpdateTiming();
@@ -182,85 +25,7 @@ namespace ipl {
};
private:
#ifdef IPL_SETTING_IMPLEMENTATION
int mUpdateTiming;
u8 unk_0x5C;
u8 unk_0x5D[3];
nand::Base* mpWWWLibraryFile;
nand::Base* mpSettingHTMLFile;
nand::Base* mpWWWArchiveFile;
nand::Base* mpFontFile;
nand::Base* mpBackgroundTPLFile;
int unk_0x74;
int unk_0x78;
int unk_0x7C;
int mProfileIDMode;
int unk_0x84;
int mAOSSState;
int mRakuState;
int mFuncMsgPending;
int unk_0x94;
ESTitleId mUpdateTitleId;
u32 mPrepareTick;
u8 mSettingData[0x16];
u8 unk_0xBA[2];
nand::LayoutFile* mpSettingLayoutFile;
layout::Object* mpChangeLayout;
layout::Object* mpMainLayout;
layout::Object* mpWaitLayout;
SettingAnimation* mpFirstAnimation;
SettingAnimation* mpSecondAnimation;
APEvent* mpEventHandler;
gui::PaneManager* mpPaneManager;
void* mpUSBAPThread;
utility::ut_thread* mpAOSSThread;
utility::ut_thread* mpRakuRakuThread;
APScanThread* mpAPScanThread;
SettingAPScanList mAPScanList;
void* mpMem1BrowserBuffer;
u32 unk_0x908;
void* mpMem2BrowserBuffer;
void* mpBrowserStringBuffer;
int unk_0x914;
int unk_0x918;
u8 unk_0x91C[4];
ext_ead::www::ImeData* mpBrowserData;
www::wiisetting::WiiData* mpWiiSettingData;
www::wiisetting::WiiFlag* mpWiiSettingFlag;
u8 unk_0x92C;
u8 unk_0x92D[3];
int unk_0x930;
www::wiisetting::SetStringBuf* mpStringBuffer;
#ifdef IPL_SETTING_IMPLEMENTATION
wchar_t unk_0x938[0x101];
#else
u8 unk_0x938[0x202];
#endif
u8 unk_0xB3A;
u8 mBrowserCreated;
keyboard::Manager::State mKeyboardState;
int mInitialArgument;
int mAspectRatio;
int mProgressiveMode;
int mEuRgb60Mode;
u8 mIsResetAcceptable;
u8 unk_0xB5D[3];
OSMessageQueue mFuncMessageQueue;
OSMessage mFuncMessages[5];
int unk_0xB94;
int mState;
int unk_0xB9C;
OSTime mCreatePageTime;
u32 unk_0xBA8;
u8 unk_0xBAC;
u8 unk_0xBAD[3];
u8 unk_0xBB0[0x10];
static void* mem1Buffer_;
static void* mem2Buffer_;
#else
u8 unk_0x58[0xB68];
#endif
};
} // namespace scene
} // namespace ipl

View File

@@ -36,11 +36,6 @@
#define MAX_CHANNEL_INFO_SIZE CHANNEL_INFO_SIZE(MAX_CHANNEL_PAGE, MAX_CHANNEL_INDEX)
namespace ipl {
#ifdef IPL_SD_CHANNEL_SELECT_CPP
namespace scene {
class SDChannelSelect;
}
#endif
namespace channel {
enum {
PRIMARY_TYPE_NONE = 0,
@@ -373,9 +368,6 @@ namespace ipl {
char* getChJumpData() { return mChJumpData; }
private:
#ifdef IPL_SD_CHANNEL_SELECT_CPP
friend class ipl::scene::SDChannelSelect;
#endif
typedef struct MD5Head {
u8 magic[4]; // 0x00 (`IMD5`; "IPL MD5"?)
u32 length; // 0x04

View File

@@ -327,9 +327,6 @@ namespace ipl {
void setProgBarLength(int len) { mProgBarLen = len; }
/** @return The current length of the progress bar */
int getProgBarLength() { return mProgBarLen; }
#ifdef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
int getProgBarFrame() const { return mProgBarFrame; }
#endif
/**
* Dialog component handler (Automatically executed by the GUI manager)

View File

@@ -63,15 +63,8 @@ namespace ipl {
textinput::MemoManager::StateType type; // 0x00
KeyboardState iplType; // 0x04
bool pressOK; // 0x08
#ifdef IPL_SETTING_IMPLEMENTATION
u8 reservedByte;
#else
u8 unused_0x09;
#endif
wchar_t* wcString; // 0x0C
#ifdef IPL_SETTING_IMPLEMENTATION
State& operator=(const State& other);
#endif
} State;
Manager() : mpManager(NULL), mEvent(), mCurrentConChan(0), mbActivated(false), mpSaveFile(NULL) {}

View File

@@ -151,10 +151,6 @@ namespace ipl {
BOOL is_terminated();
BOOL is_working();
#ifdef IPL_SD_CHANNEL_SELECT_CPP
void requestCancel() { unk_0x04 = true; }
#endif
WIISaveBannerFile* get_cached_nand_save_banner(ESTitleId titleId);
void* get_cached_nand_app_thumbnail(ESTitleId titleId, u32*);
WIISaveBannerFile* get_cached_sd_save_banner(ESTitleId32 titleId);
@@ -183,10 +179,6 @@ namespace ipl {
static const int SD_APP_BACKUP_THUMBNAIL_LENGTH = 0xC800;
#ifdef IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
static int getCompletionPct() { return s_completion_pct; }
#endif
protected:
static const int FAT_PAGES = 8;
static const int DATA_PAGES = 32;

View File

@@ -15,11 +15,6 @@
#define SAVEDATA_VERSION 3
namespace ipl {
#ifdef IPL_SD_CHANNEL_SELECT_ACCESS
namespace scene {
class SDChannelSelect;
}
#endif
namespace channel {
class Manager;
}
@@ -34,9 +29,6 @@ namespace ipl {
void initManager();
void setPrevPage(int prevPage);
#ifdef IPL_SD_CHANNEL_TITLE_CPP
int& getSDPrevPage() { return mData.prevSDPage; }
#endif
void setChanInfo(int page, int index, const channel::SInfo& chanInfo);
void setMemoSetting(const textinput::extend::savedata::MemoSetting& memoSetting);
@@ -62,7 +54,6 @@ namespace ipl {
int getLastSDPrevPage() { return mLastSDPrevPage; }
void setLastSDPrevPage(int page) { mLastSDPrevPage = page; }
BOOL didntGotoSDMenu() const { return mData.didntGotoSDMenu; }
void setDidntGotoSDMenu(BOOL value) { mData.didntGotoSDMenu = value; }
#endif
bool hasPhotoMP3Dummy() { return mbPhotoMP3; }
@@ -77,9 +68,6 @@ namespace ipl {
void iplSavedata_813596B8(ESTitleId titleId);
private:
#ifdef IPL_SD_CHANNEL_SELECT_ACCESS
friend class ipl::scene::SDChannelSelect;
#endif
BOOL checkValidApp(ESTitleId titleId);
static void initManagerTask(void* work);

View File

@@ -73,9 +73,6 @@ namespace ipl {
void setDownLimit(f32 v) { mDownLimit = v; }
void setUpLimit(f32 v) { mUpLimit = v; }
#ifdef IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
void setState(int state) { mState = state; }
#endif
void addScroll(f32 v) { mScroll += v; }

View File

@@ -55,12 +55,6 @@ namespace nw4r {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
return mTextColors[type];
}
#ifdef IPL_SDMEMORY_SET_TEXT_COLORS
void SetTextColors(const ut::Color& first, const ut::Color& second) {
mTextColors[0] = first;
mTextColors[1] = second;
}
#endif
void SetTextColor(u32 type, ut::Color value) {
NW4R_ASSERT(type < TEXTCOLOR_MAX);
mTextColors[type] = value;

View File

@@ -157,15 +157,11 @@ namespace nw4r {
y = pF[1];
z = pF[2];
}
#if defined(IPL_SD_CHANNEL_SELECT_CPP)
VEC3(f32 fx, f32 fy, f32 fz);
#else
VEC3(f32 fx, f32 fy, f32 fz) {
x = fx;
y = fy;
z = fz;
}
#endif
operator Vec*() { return reinterpret_cast<Vec*>(this); }
operator const Vec*() const { return reinterpret_cast<const Vec*>(this); }

View File

@@ -160,12 +160,11 @@ typedef struct _ziGetParam {
ziWChar* candidates; // 0x18
ziU8 maxCandidates; // 0x1C
ziWChar firstCandidate; // 0x1E
ziU8 unk_0x20; // 0x20
ziU8 wordCandidates; // 0x1F
ziU8 count; // 0x20
ziU8 letters; // 0x21
ziU8 count; // 0x22
ziU8* scratch; // 0x24
ziU32 unk_0x28; // 0x28
ziU8* scratch; // 0x22
} ziGetParam;
typedef struct _ziLanguageEntry {
@@ -173,195 +172,20 @@ typedef struct _ziLanguageEntry {
ziU8* tableData; // 0x04
} ziLanguageEntry;
typedef struct _zi8DawgRec {
ziU8* node;
ziU32 attr;
ziU16 key;
ziU8 unk_0x0A[2];
ziU8* back;
} zi8DawgRec;
typedef struct _zi8DawgCtx {
ziU8 lang; // 0x00
ziU8 key; // 0x01
ziU16 cnt; // 0x02
ziU16 cap; // 0x04
ziU8 unk_0x06[2];
ziU8* p08; // 0x08
ziU8* p0C; // 0x0C
ziU8* table; // 0x10
ziU8* p14; // 0x14
zi8DawgRec recs[0x32]; // 0x18
ziU32 unk_0x338; // 0x338
} zi8DawgCtx;
typedef struct _ziUwdNode {
struct _ziUwdNode* next;
ziU8* word;
} ziUwdNode;
struct __zi8_work_data_s {
ziU8 unk_0x00;
ziU8 unk_0x01;
ziU8 unk_0x02[2];
ziLanguageEntry* langEntries; // 0x04
ziU8 unk_0x08;
ziU8 unk_0x09;
ziU8 unk_0x0A;
ziU8 unk_0x0B;
ziU32 unk_0x08;
ziU32 unk_0x0C;
ziU32 unk_0x10;
ziU16 unk_0x14;
ziU8 unk_0x16;
ziU8 unk_0x17;
ziU32 unk_0x14;
ziU8 unk_0x18;
ziU8 unk_0x19;
ziU16 unk_0x1A;
ziU8 unk_0x1C[3];
ziU8 unk_0x1F;
ziU16 unk_0x20[0x40];
ziU16 unk_0xA0[0x42];
ziU8 unk_0x1C[0x108];
ziU16* unk_0x124[1];
ziU8* unk_0x128;
ziU8 unk_0x12C;
ziU8 unk_0x12D;
ziU8 unk_0x12E;
ziU8 unk_0x12F;
ziPtr unk_0x130[2];
ziU8 unk_0x138;
ziU8 unk_0x139[3];
ziU32 unk_0x13C;
ziU8 unk_0x140;
ziU8 unk_0x141[0x43];
ziU8 unk_0x184[0x43];
ziU8 uwdCount; // 0x1C7
ziUwdNode uwdNodes[0x20]; // 0x1C8
ziUwdNode* uwdList; // 0x2C8
ziU32 pudTable[0x10]; // 0x2CC
ziU8 pudCount; // 0x30C
ziU8 unk_0x30D[3];
ziU32 unk_0x310;
ziU32 unk_0x314;
ziU32 unk_0x318;
ziU8 pdRemoveOpt; // 0x31C
ziU8 unk_0x31D;
ziU8 unk_0x31E;
ziU8 unk_0x31F;
ziU8 (*oemMatch)(ziU16 idx, ziWChar* buf, ziU8 len, ziPtr data); //0x320
ziU16 oemLen; //0x324
ziU8 unk_0x326[2];
ziU32 oemIdx; //0x328
ziPtr oemData; //0x32C
ziU8 unk_0x330[8];
ziU32 unk_0x338;
ziU8 unk_0x33C[0x1FC];
ziU8 unk_0x538;
ziU8 unk_0x539;
ziU8 unk_0x53A[0x40];
ziWChar unk_0x57A[0x641];
ziPtr unk_0x11FC;
ziPtr userKeys[0x83]; // 0x1200
ziU8 unk_0x140C[4];
ziU32 unk_0x1410;
ziU8 unk_0x1414[4];
ziU8 unk_0x1418;
ziU8 unk_0x1419;
ziU16 unk_0x141A;
ziU8 unk_0x141C;
ziU8 unk_0x141D;
ziU8 unk_0x141E;
ziU8 unk_0x141F;
ziU8 unk_0x1420[4];
zi8DawgCtx dawgCtx; // 0x1424
ziU8 unk_0x1760[4]; // 0x1760
ziU8* unk_0x1764; // 0x1764
ziU8 unk_0x1768;
ziU8 unk_0x1769[0x81];
ziU16 unk_0x17EA;
ziU8 unk_0x17EC;
ziU8 unk_0x17ED[3];
ziU8* unk_0x17F0;
ziWChar unk_0x17F4[0x40]; // 0x17F4..0x1874
ziU16 unk_0x1874;
ziU8 unk_0x1876;
ziU8 unk_0x1877;
ziU8 unk_0x1878;
ziU8 unk_0x1879;
ziWChar unk_0x187A[0x41];
ziU8 unk_0x18FC;
ziU8 unk_0x18FD;
ziWChar unk_0x18FE[0x41];
ziU8 unk_0x1980;
ziU8 unk_0x1981;
ziU8 unk_0x1982;
ziU8 unk_0x1983;
ziU8 unk_0x1984;
ziU8 unk_0x1985;
ziU8 unk_0x1986;
ziU8 unk_0x1987;
ziWChar unk_0x1988[0x41];
ziU8 unk_0x1A0A;
ziU8 unk_0x1A0B[0x85];
ziWChar unk_0x1A90;
ziWChar unk_0x1A92[0x41];
ziU8 unk_0x1B14;
ziU8 unk_0x1B15[3];
ziU16* unk_0x1B18;
ziU16 unk_0x1B1C;
ziU16 unk_0x1B1E;
ziU16 unk_0x1B20;
ziU16 unk_0x1B22;
ziU8 unk_0x1B24;
ziU8 unk_0x1B25[3];
union {
ziU32 word;
struct {
ziU32 msb : 1;
} bits;
} unk_0x1B28;
union {
ziU32 word;
struct {
ziU32 msb : 1;
} bits;
} unk_0x1B2C;
ziU8 unk_0x1B30;
ziU8 unk_0x1B31;
ziU16 unk_0x1B32;
ziU16 unk_0x1B34;
ziU16 unk_0x1B36;
ziU16 unk_0x1B38;
ziU8 unk_0x1B3A;
ziU8 unk_0x1B3B;
ziU8 unk_0x1B3C;
ziU8 unk_0x1B3D;
ziU8 unk_0x1B3E;
ziU8 unk_0x1B3F;
ziU16 unk_0x1B40;
ziU8 unk_0x1B42[2];
};
typedef struct ziMatchParam {
ziU8 count; // 0x00
ziU8 arr1[0xC]; // 0x01
ziU8 arrD[0xC]; // 0x0D
ziU8 arr19[4]; // 0x19
ziU8 arr1D[4]; // 0x1D
ziU8 pad_0x21; // 0x21
ziU16 field22; // 0x22
ziU8 length; // 0x24
ziU8 nCand; // 0x25
ziWChar phon[0x10]; // 0x26
ziWChar phon2[0x10]; // 0x46
ziWChar first; // 0x66
ziWChar first2; // 0x68
ziWChar comp; // 0x6A
ziU8 nSeg; // 0x6C
ziU8 segs1[0xC0]; // 0x6D
ziU8 segsD[0xC0]; // 0x12D
ziU8 pad_0x1ED; // 0x1ED
} ziMatchParam;
#define ZI_WORK ((struct __zi8_work_data_s*)__zi8_work_data)
#define ZI_NEED_WORK , ziPtr __zi8_work_data

View File

@@ -1,49 +0,0 @@
#include <zi8clib/zitypes.h>
const ziWChar Zi8PunctTable[40] = {
0xFF0C, 0x3002, 0x3001, 0xFF1A, 0xFF1F, 0xFF01, 0x3005, 0x2026,
0x2015, 0xFF1B, 0xFF0E, 0x30FB, 0x201C, 0x201D, 0xFF08, 0xFF09,
0x300C, 0x300D, 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15,
0xFF16, 0xFF17, 0xFF18, 0xFF19, 0xFF0F, 0xFF05, 0xFFE5, 0xFF04,
0xFFE1, 0x20AC, 0x203B, 0xFF20, 0x0000,
};
ziS32 Zi8Punctuation(ziGetParam* param ZI_NEED_WORK) {
ziS32 limit = ((ziU16*)__zi8_work_data)[8] - 1;
ziS32 count = 0;
ziU8 i = 0;
ziU16 fc = param->firstCandidate;
ziU16 j = 0;
for (;;) {
if (Zi8PunctTable[j] == 0) {
break;
}
if (fc == 0) {
count++;
if (ZI_WORK->unk_0x00 == 0) {
param->candidates[i++] = Zi8PunctTable[j];
if ((param->context & 0x10) != 0) {
param->candidates[i++] = 0x20;
if ((ziU8)i >= limit) {
break;
}
}
if (count >= param->maxCandidates) {
break;
}
} else {
if (count >= (ziS32)ZI_WORK->unk_0x0C) {
return count;
}
}
} else {
fc--;
}
j++;
}
if (ZI_WORK->unk_0x00 == 0) {
param->letters = count;
}
return count;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,108 +0,0 @@
#include <zi8clib/zitypes.h>
ziU16 Zi8MatchAltSound(ziU8* elements, ziU16 count, ziU8* table, ziU16 ch,
ziU32 mask, ziU16 target, ziU8 flags ZI_NEED_WORK) {
ziU8 hi;
ziU8 lo;
ziS32 i;
ziS32 j;
ziS32 mid;
ziU16 off;
ziU16 w;
hi = (ziU8)((ziU16)ch >> 8);
lo = (ziU8)ch;
flags = (ziU8)(flags >> 3);
if (count == 0) {
return 0;
}
j = 0;
i = count - 1;
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
j = i;
goto up;
}
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
goto up;
}
goto search;
up:
i = j;
body:
if (((elements + i * 4)[3] & 0xE) == 0 ||
((elements + i * 4)[3] & flags) != 0) {
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
(table[off] | ((ziU16)table[off + 1] << 8)));
if (target == (w & (ziU16)mask)) {
return w;
}
}
i++;
if (i >= count) {
goto down_start;
}
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
goto body;
}
down_start:
i = j;
goto dec;
down_body:
if (((elements + i * 4)[3] & 0xE) == 0 ||
((elements + i * 4)[3] & flags) != 0) {
off = (ziU16)(((ziU16)(elements + i * 4)[2] |
(((ziU16)(elements + i * 4)[3] & 1) << 8)) << 1);
w = (ziU16)((((ziU16)(elements + i * 4)[3] & 0xF0) >> 4) |
(table[off] | ((ziU16)table[off + 1] << 8)));
if (target == (w & (ziU16)mask)) {
return w;
}
}
dec:
i--;
if (i < 0) {
goto fail;
}
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
goto down_body;
}
fail:
return 0;
search:
if ((elements + j * 4)[1] == hi && (elements + j * 4)[0] == lo) {
goto up;
}
if ((((ziU16)(elements + j * 4)[1] << 8) | (ziU16)(elements + j * 4)[0]) > ch) {
return 0;
}
mid = (j + i) / 2;
if (mid == j) {
return 0;
}
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
i = mid;
goto hi_check;
}
j = mid;
goto search;
hi_check:
if ((elements + i * 4)[1] == hi && (elements + i * 4)[0] == lo) {
j = i;
goto up;
}
if ((((ziU16)(elements + i * 4)[1] << 8) | (ziU16)(elements + i * 4)[0]) < ch) {
return 0;
}
mid = (j + i) / 2;
if (mid == j) {
return 0;
}
if ((((ziU16)(elements + mid * 4)[1] << 8) | (ziU16)(elements + mid * 4)[0]) >= ch) {
i = mid;
goto hi_check;
}
j = mid;
goto search;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,212 +0,0 @@
#include <zi8clib/zierror.h>
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU8 Zi8getKeyLayout(ziU8 lang, ziU16 key, ziWChar* layout, ziU8 mode ZI_NEED_WORK);
extern ziChar Zi8ConvertWC2UC(ziWChar ch, ziU8 language ZI_NEED_WORK);
extern ziU32 Zi8AlphaGetCandidates(ziGetParam* param, ziPtr sw ZI_NEED_WORK);
extern ziU8 Zi8SyllablesROMdata(ziWChar* keys, ziU8 count, ziU8 lang, ziWChar* out,
ziU16 a, ziU8 b, ziU8* cntOut, ziU8 c ZI_NEED_WORK);
typedef struct _ziSwParam {
ziU8 flag;
ziU8 unk_0x01[0xB];
ziS32 count;
ziU16 cap;
ziU8 unk_0x12[2];
} ziSwParam;
ziU32 Zi8GetSyllablesCandidates(ziGetParam* param, ziSwParam* sw ZI_NEED_WORK) {
ziWChar buf[0x40];
ziWChar buf2[0x32];
ziS32 rem;
ziS32 cur;
ziS32 firstCand;
ziS32 count;
ziWChar* pNext;
ziU16 err;
ziU8 flag14;
ziU8 flag13;
ziU8 flag12;
ziU8 flag11;
ziU8 sylCnt;
ziWChar* out;
ziU8* u28;
ziS32 i;
firstCand = param->firstCandidate;
count = 0;
u28 = 0;
pNext = 0;
flag14 = 1;
flag13 = 1;
flag12 = 0;
flag11 = 0;
sylCnt = 0;
err = 0x64;
if (param->currentWord != 0 && param->wordCharCount != 0 &&
param->currentWord[param->wordCharCount - 1] != 0x20) {
flag11 = 1;
}
if (param->elementCount == 0 || (param->elementCount == 1 && flag11 == 0)) {
count = Zi8AlphaGetCandidates(param, sw, ZI_WORK);
goto end;
}
if (sw->flag != 0 || (param->getOptions & 0xFD) != 0x81) {
out = buf;
rem = 0x40;
} else {
out = (ziWChar*)param->candidates;
rem = sw->cap - 1;
}
if ((param->getOptions & 0xFD) == 0x80) {
u28 = (ziU8*)param->candidates;
rem = sw->cap - 1;
}
if (rem <= param->elementCount) {
err = 0x168;
goto end;
}
if ((Zi8GetTableCount(param->language, 0x1F, ZI_WORK) & 8) != 0) {
flag14 = 0;
}
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf, 1, ZI_WORK);
}
out[0] = buf[0];
Zi8SyllablesROMdata(param->elements, param->elementCount, param->language, out,
(ziU16)rem, 0, &sylCnt, flag11, ZI_WORK);
if (sylCnt != 0) {
cur = sylCnt;
} else {
cur = 1;
}
if (cur == param->elementCount) goto L5dc;
if (firstCand != 0) {
firstCand--;
goto L5dc;
}
if (sw->flag != 0) {
if (++count >= sw->count) goto end;
goto L5dc;
}
for (i = cur; i < param->elementCount; i += sylCnt) {
if (param->elements[i] == 0xEFF1 && param->elementCount - i > 1 && flag14 != 0) {
buf2[0] = 0x2D;
} else {
Zi8getKeyLayout(param->language, param->elements[i], buf2, 1, ZI_WORK);
}
out[i] = buf2[0];
Zi8SyllablesROMdata(param->elements + i, param->elementCount - i, param->language,
out + i, (ziU16)rem, 0, &sylCnt, 1, ZI_WORK);
if (sylCnt == 0) {
sylCnt = 1;
}
}
if (u28 != 0) {
for (i = 0; i < param->elementCount; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
out[i++] = 0;
out[i] = 0;
out += i;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem > param->elementCount) goto L5dc;
goto end;
L5dc:
while (cur >= 1) {
flag12 = 0;
goto rom;
found:
flag12 = 1;
if (cur == 1) {
flag13 = 0;
}
L464:
if (out[0] >= 0xEFF1 && out[0] <= 0xF010) {
goto dec;
}
L464b:
if (firstCand != 0) {
firstCand--;
goto L560;
}
if (sw->flag != 0) {
if (++count >= sw->count) goto end;
goto L560;
}
if (u28 != 0) {
for (i = 0; i < cur; i++) {
u28[i] = Zi8ConvertWC2UC(out[i], param->language, ZI_WORK);
}
u28[i++] = 0;
u28[i] = 0;
u28 += i;
} else {
i = cur;
out[i++] = 0;
out[i] = 0;
out += i;
}
rem -= i;
if (++count >= param->maxCandidates) goto end;
if (rem <= cur) goto end;
L560:
if (pNext != 0) {
if (*pNext == 0) goto end;
out[0] = *pNext++;
goto L464b;
}
rom:
if (Zi8SyllablesROMdata(param->elements, (ziU8)cur, param->language, out,
(ziU16)rem, flag12, 0, flag11, ZI_WORK) != 0) {
goto found;
}
dec:
cur--;
}
if (flag13 == 0) goto end;
if (param->elements[0] == 0xEFF1 && param->elementCount > 1 && flag14 != 0) {
buf2[0] = 0x2D;
buf2[1] = 0;
Zi8getKeyLayout(param->language, param->elements[0], &buf2[1], 1, ZI_WORK);
for (i = 1; buf2[i] != 0; i++) {
if (buf2[i] == 0x2D) break;
}
while (buf2[i] != 0) {
buf2[i] = buf2[i + 1];
i++;
}
} else {
Zi8getKeyLayout(param->language, param->elements[0], buf2, 1, ZI_WORK);
}
cur = 1;
pNext = buf2;
goto L560;
end:
if (sw->flag != 0) {
param->letters = 0;
} else {
param->letters = (ziU8)count;
}
Zi8LogError(err, ZI_WORK);
return count;
}

View File

@@ -1,15 +0,0 @@
#include <zi8clib/zi8getc.h>
#include <zi8clib/zitypes.h>
extern ziU8 _Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK);
ziU8 Zi8GetCandidates(ziGetParam* getParam ZI_NEED_WORK) {
ZI_WORK->unk_0x1B3A = 0;
ZI_WORK->unk_0x1B3C = 0;
ZI_WORK->unk_0x1B3B = 0;
ZI_WORK->unk_0x1B3D = 0;
ZI_WORK->unk_0x1B36 = 0;
ZI_WORK->unk_0x1B32 = 0;
ZI_WORK->unk_0x1B34 = 0;
return _Zi8GetCandidates(getParam, ZI_WORK);
}

View File

@@ -1,75 +0,0 @@
#include <zi8clib/zitypes.h>
#include <zi8clib/zierror.h>
extern void Zi8Memset(ziPtr p, ziU32 v, ziU32 len);
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);
extern void Zi8ZHsetZYfuzzyPairs(ziU32* a ZI_NEED_WORK);
extern void Zi8ZHsetPYfuzzyPairs(ziU32* a ZI_NEED_WORK);
extern void Zi8SetParentalControls(ziU8 a ZI_NEED_WORK);
ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
ziU32 zyFuzzy;
ziU32 pyFuzzy;
ziU32* pzyFuzzy;
ziU32* ppyFuzzy;
Zi8Memset(__zi8_work_data, 0, 0x1B44);
ZI_WORK->unk_0x08 = 1;
ZI_WORK->unk_0x09 = 1;
ZI_WORK->unk_0x0A = 0xFF;
ZI_WORK->unk_0x10 = 0x64;
*(ziU16*)&ZI_WORK->unk_0x0C = 0xFFFF;
ZI_WORK->unk_0x1A = 0x20;
ZI_WORK->unk_0x1C[2] = 0;
ZI_WORK->unk_0x1B30 = 0;
ZI_WORK->unk_0x1B3A = 0;
ZI_WORK->unk_0x1B36 = 0;
ZI_WORK->unk_0x1B32 = 0;
ZI_WORK->unk_0x1B34 = 0;
ZI_WORK->unk_0x1B3B = 0;
ZI_WORK->unk_0x1B3C = 0;
ZI_WORK->unk_0x1B40 = 0;
ZI_WORK->unk_0x1B38 = 0;
ZI_WORK->langEntries = langEntries;
if (ZI_WORK->langEntries == ZI8_NULL) {
Zi8LogError(0x578, ZI_WORK);
return 0;
}
if (ZI_WORK->langEntries->language == 0) {
Zi8LogError(0x582, ZI_WORK);
return 0;
}
ZI_WORK->unk_0x1874 = 0x2D;
ZI_WORK->unk_0x538 = 0;
ZI_WORK->unk_0x1C[3] = 0;
ZI_WORK->unk_0x141A = 0x100;
Zi8SetLatinSearchOrder(0, 0, ZI_WORK);
ZADP_Zi8SetPDremoveOpt(1, ZI_WORK);
ZI_WORK->unk_0x17 = 5;
ZI_WORK->unk_0x16 = Zi8GetFormatVersion(1, ZI_WORK) & 2;
ZI_WORK->unk_0x1B28.bits.msb = 1;
ZI_WORK->unk_0x1B2C.bits.msb = 1;
zyFuzzy = ZI_WORK->unk_0x1B2C.word;
pzyFuzzy = &zyFuzzy;
Zi8ZHsetZYfuzzyPairs(pzyFuzzy, ZI_WORK);
pyFuzzy = ZI_WORK->unk_0x1B28.word;
ppyFuzzy = &pyFuzzy;
Zi8ZHsetPYfuzzyPairs(ppyFuzzy, ZI_WORK);
Zi8SetParentalControls(2, ZI_WORK);
Zi8LogError(0x64, ZI_WORK);
return 1;
}
ziU8 Zi8IsZicorpSignature(ziU16* p, ziU16 len) {
if ((ziU16)len > 6 && p[0] == 0x7A && p[1] == 0x69 && p[2] == 0x63 &&
p[3] == 0x6F && p[4] == 0x72 && p[5] == 0x70) {
return 1;
}
if ((ziU16)len > 6 && p[0] == 0x39 && p[1] == 0x34 && p[2] == 0x32 &&
p[3] == 0x36 && p[4] == 0x37 && p[5] == 0x37) {
return 1;
}
return 0;
}

View File

@@ -1,138 +0,0 @@
#include <zi8clib/zi8is.h>
#include <zi8clib/zierror.h>
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);
ziU8 Zi8GetZHCharSet(ziPtr workData) {
ziU8 charSet = 0;
ziU8 bak;
ziU16 v0;
ziU16 v1;
ziU16 v2;
ziU32 addr;
ziU8* p;
ziWChar candBuf[0x10];
ziGetParam getParam;
Zi8LogError(0x64, workData);
if (Zi8LangSupported(1, workData) == 0) {
Zi8ReplaceLastError(0x26C, workData);
return 0;
}
if (Zi8GetTableCount(1, 10, workData) != 0) {
bak = ((struct __zi8_work_data_s*)workData)->unk_0x18;
((struct __zi8_work_data_s*)workData)->unk_0x18 = 1;
addr = Zi8GetTableAddress(1, 10, workData);
p = (ziU8*)addr;
v0 = (ziU16)((ziU16)p[0] | ((ziU16)p[1] << 8));
((struct __zi8_work_data_s*)workData)->unk_0x18 = 0;
addr = Zi8GetTableAddress(1, 10, workData);
p = (ziU8*)addr;
v1 = (ziU16)((ziU16)p[2] | ((ziU16)p[3] << 8));
v2 = (ziU16)((ziU16)p[4] | ((ziU16)p[5] << 8));
((struct __zi8_work_data_s*)workData)->unk_0x18 = bak;
if (v0 != 0) {
if (v0 > 0x4E20) {
charSet |= 8;
} else {
charSet |= 1;
}
}
if (v1 != 0) {
if (v1 > 0x2710) {
charSet |= 2;
} else {
charSet |= 0x10;
}
}
if (v2 != 0) {
charSet |= 4;
}
return charSet;
}
Zi8Memset(&getParam, 0, 0x2C);
getParam.language = 1;
getParam.context = 1;
getParam.getOptions = 0;
getParam.candidates = candBuf;
getParam.maxCandidates = 1;
getParam.subLanguage = 1;
retry:
getParam.getMode = 0;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
goto next;
}
getParam.getMode = 1;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
goto next;
}
getParam.getMode = 2;
if (_Zi8GetCandidates(&getParam, workData) != 0) {
charSet |= getParam.subLanguage;
}
next:
if (getParam.subLanguage == 1) {
getParam.subLanguage = 4;
goto retry;
}
if (getParam.subLanguage == 4) {
getParam.subLanguage = 2;
goto retry;
}
return charSet;
}
ziBool Zi8IsComponent(ziWChar ch ZI_NEED_WORK) {
if (ch >= 0xEF10 && ch < 0xF305) {
return 1;
}
return 0;
}
ziBool Zi8IsCharacter(ziWChar ch ZI_NEED_WORK) {
ziU16 count;
ziU8 hi;
ziU8 lo;
ziU32 addr;
ziU8* table;
ziU16 i;
if (ch >= 0x3105 && ch <= 0x3129) {
return 1;
}
switch (ch) {
case 0x2C7:
case 0x2C9:
case 0x2CA:
case 0x2CB:
case 0x2D9:
return 1;
}
switch (ch) {
case 0x3002:
case 0xFF01:
case 0xFF0C:
case 0xFF1F:
return 1;
}
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
lo = (ziU8)ch;
count = Zi8GetTableCount(1, 0, ZI_WORK);
addr = Zi8GetTableAddress(1, 0, ZI_WORK);
table = (ziU8*)addr;
for (i = 0; i < count; i++) {
if (table[6] == hi && table[7] == lo) {
return 1;
}
table += 0xC;
}
return 0;
}

View File

@@ -1,144 +0,0 @@
#include <zi8clib/zitypes.h>
#include <zi8clib/zierror.h>
extern ziU16 Zi8GetTableCount(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
extern ziU32 Zi8GetTableAddress(ziU8 lang, ziU8 tableIdx ZI_NEED_WORK);
typedef struct { ziU8 b[0xC]; } ziE12;
#define WORKP ((struct __zi8_work_data_s*)__zi8_work_data)
ziU16 Zi8Uni2Ptr(ziU16 ch, ziE12* buf ZI_NEED_WORK) {
ziU8 hi;
ziU8 lo;
ziU16 count;
ziU32 table;
ziU32 table2;
ziU16 i;
ziU8* e;
ziU8* p;
hi = (ziU8)(((ziU16)ch >> 8) & 0xFF);
lo = (ziU8)ch;
count = Zi8GetTableCount(1, 0, __zi8_work_data);
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
table2 = Zi8GetTableAddress(1, 1, __zi8_work_data);
if (buf == ZI8_NULL) {
for (i = 0; i < 0x40; i++) {
if (ch == WORKP->unk_0x20[i]) {
i = WORKP->unk_0xA0[i];
e = (ziU8*)table + i * 0xC;
if (i >= count) {
break;
}
if (hi != e[6] || lo != e[7]) {
break;
}
p = (ziU8*)(table2 +
(((e[9] & 0xF) << 16) |
(e[0xB] | (e[0xA] << 8))));
if (WORKP->unk_0x16 != 0) {
switch (p[0] & 7) {
case 2:
p += 2;
break;
case 3:
case 4:
p += 3;
break;
case 5:
p += 4;
break;
default:
p += 1;
break;
}
}
if ((p[0] & 0x80) == 0) {
break;
}
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
}
}
e = (ziU8*)table;
if (WORKP->unk_0x1B18 != ZI8_NULL && WORKP->unk_0x1B24 == WORKP->unk_0x18) {
if ((ziU16)ch >= WORKP->unk_0x1B1C && (ziU16)ch <= WORKP->unk_0x1B1E) {
i = (ziU16)(ch - WORKP->unk_0x1B1C);
goto map;
}
if ((ziU16)ch >= WORKP->unk_0x1B20 && (ziU16)ch <= WORKP->unk_0x1B22) {
i = (ziU16)(WORKP->unk_0x1B1E + (ch - WORKP->unk_0x1B20) -
WORKP->unk_0x1B1C + 1);
goto map;
}
return 0xFFFF;
map:
i = WORKP->unk_0x1B18[i];
if (i != 0xFFFF) {
e = (ziU8*)table + i * 0xC;
if (hi == e[6] && lo == e[7]) {
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
}
return 0xFFFF;
}
i = 0;
while (i < count) {
if (lo == e[7] && hi == e[6]) {
if (buf != ZI8_NULL) {
*buf = *(ziE12*)e;
}
return i;
}
e += 0xC;
i++;
}
return 0xFFFF;
}
ziU16 Zi8Uni2Ord(ziU16 ch ZI_NEED_WORK) {
return Zi8Uni2Ptr(ch, ZI8_NULL, __zi8_work_data);
}
ziU16 Zi8Ord2Uni(ziU16 ord ZI_NEED_WORK) {
ziU8* p;
if ((ziU16)ord >= Zi8GetTableCount(1, 0, __zi8_work_data)) {
Zi8LogError(0x132, __zi8_work_data);
return 0;
}
p = (ziU8*)Zi8GetTableAddress(1, 0, __zi8_work_data);
p += ord * 0xC;
Zi8LogError(0x64, __zi8_work_data);
return (ziU16)(((ziU16)p[6] << 8) + p[7]);
}
ziU16 Zi8Ord2Ord(ziU16 ord ZI_NEED_WORK) {
ziU32 table;
ziU16 count;
ziU8* p;
count = Zi8GetTableCount(1, 0, __zi8_work_data);
table = Zi8GetTableAddress(1, 0, __zi8_work_data);
if (ord == 0 || (ziU16)ord >= count) {
Zi8LogError(0x132, __zi8_work_data);
return ord;
}
p = (ziU8*)table + (ord - 1) * 0xC;
while (ord != 0) {
if (p[6] != p[0x12] || p[7] != p[0x13]) {
break;
}
p -= 0xC;
ord--;
}
Zi8LogError(0x64, __zi8_work_data);
return ord;
}

View File

@@ -1,99 +0,0 @@
#include <zi8clib/zi8space.h>
#include <zi8clib/zierror.h>
#include <zi8clib/zitypes.h>
extern ziU8 Zi8GetPyPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b, ziU8* c,
ziU16* d, ziU16* e ZI_NEED_WORK);
extern ziU8 Zi8GetBpmfPhonetic(ziWChar* src, ziU8 i, ziWChar* a, ziWChar* b,
ziU16* d, ziU16* e ZI_NEED_WORK);
ziU8 Zi8ZHaddSpace(ziWChar* src, ziU8 count, ziWChar* dst,
ziU16 maxLen ZI_NEED_WORK) {
ziWChar candBuf[0x10];
ziWChar pyBuf[0x10];
ziU16 m;
ziU16 vE;
ziU16 vC;
ziU8 n;
ziU8 flag;
ziU8 v9;
ziU8 isPy;
int i;
int k;
ziWChar* psrc;
ziWChar* pdst;
psrc = src;
n = count;
pdst = dst;
m = maxLen;
if (n == 0) {
Zi8LogError(0x137, ZI_WORK);
return 0;
}
if ((psrc[0] >= 0xF361 && psrc[0] <= 0xF37A) ||
(psrc[0] >= 0xF341 && psrc[0] <= 0xF35A)) {
isPy = 1;
} else if (psrc[0] >= 0xF305 && psrc[0] <= 0xF329) {
isPy = 0;
} else {
goto fail;
}
i = 2;
while (i <= n) {
if (isPy) {
flag = Zi8GetPyPhonetic(psrc, i, candBuf, pyBuf, &v9, &vE, &vC, ZI_WORK);
if (i == v9) {
i++;
continue;
}
} else {
if ((psrc[i - 1] == 0xF360 && psrc[i - 2] != 0xF360) ||
Zi8GetBpmfPhonetic(psrc, i, candBuf, pyBuf, &vE, &vC, ZI_WORK) !=
0) {
i++;
continue;
}
}
if (i-- >= m - 1) {
goto fail;
}
m -= i + 1;
for (k = 0; k < i; k++) {
pdst[k] = psrc[k];
}
if (pdst[k - 1] != 0xF360 &&
(pdst[k - 1] < 0xF331 || pdst[k - 1] > 0xF335)) {
pdst[k++] = ZI_WORK->unk_0x1A;
}
psrc += i;
n -= i;
pdst += k;
i = 2;
}
if (i-- > m) {
goto fail;
}
for (k = 0; k < i; k++) {
pdst[k] = psrc[k];
}
pdst[k] = 0;
Zi8LogError(0x64, ZI_WORK);
return 1;
fail:
if ((ziU8)count >= (ziU16)maxLen) {
count = (ziU8)(maxLen - 1);
}
for (i = 0; i < count; i++) {
dst[i] = src[i];
}
dst[i] = 0;
Zi8LogError(0x64, ZI_WORK);
return 1;
}

View File

@@ -8,13 +8,8 @@ extern "C" {
#endif
void __VISetRGBModeImm();
#ifdef VI_MATCHING_SOURCE
BOOL __VIResetRFIdle();
BOOL __VIResetSIIdle();
#else
void __VIResetRFIdle();
void __VIResetSIIdle();
#endif
void __VIGetCurrentPosition(s16* x, s16* y);

View File

@@ -150,11 +150,7 @@ typedef struct DVDErrorInfo {
void DVDInit();
BOOL DVDReadAbsAsyncPrio(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio);
#ifdef BS2_MACH_FIVE_ARG_READ
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback);
#else
BOOL DVDReadAbsAsyncForBS(DVDCommandBlock* block, void* addr, s32 length, u32 offset, DVDCommandCallback callback, s32 prio);
#endif
BOOL DVDReadDiskID(DVDCommandBlock* block, DVDDiskID* diskID, DVDCommandCallback callback);
BOOL DVDCompareDiskID(const DVDDiskID* id1, const DVDDiskID* id2);

View File

@@ -27,13 +27,8 @@ void VISetNextFrameBuffer(void* fb);
void VISetBlack(BOOL setBlack);
void VISetTrapFilter(BOOL setTrap);
#ifdef VI_MATCHING_SOURCE
BOOL VIResetDimmingCount();
BOOL VIEnableDimming(BOOL enableDim);
#else
void VIResetDimmingCount();
void VIEnableDimming(BOOL enableDim);
#endif
u32 VIGetRetraceCount();
u32 VIGetDTVStatus();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -232,7 +232,7 @@ static s32 _WADBackupGetFiles(const char* path, u32 flags, MEMAllocator* allocat
u32* fileCount, WADBackupFileHeader* files);
static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* contentMask,
u32 fileCount, WADBackupFileHeader* files, u32* titleMetaSize,
u32* contentDataSize, u32* fileDataSize, u32* totalSize);
u32* contentDataSize, u32* totalSize);
static s32 _WADCheckContents(ESTmdView* titleMeta, ESContentMask* contentMask);
static void _WADRandPad(void* buffer, u32 size);
static s32 _WADVerifySavedataZD(WADSaveDataHeader* header, WADStream* stream,
@@ -432,14 +432,14 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
blocks->unkBlocks += (workspace.unpackInfo.sectionSize + 0x3FFF) >> 14;
blocks->unkInodes = 1;
}
if (workspace.unpackInfo.cidxMode >= 1) {
if (workspace.unpackInfo.cidxMode < 1) {
contentCount = titleMeta->head.numContents;
} else {
contentCount = _WADGetCidxCount(workspace.unpackInfo.contentIndex);
if (contentCount > titleMeta->head.numContents) {
result = -3001;
goto cleanup;
}
} else {
contentCount = titleMeta->head.numContents;
}
contentMeta = titleMeta->contents;
for (index = 0; index < contentCount; index++) {
@@ -453,12 +453,12 @@ s32 WADImportGetBlocks(char* path, MEMAllocator* allocator, WADLocation location
contentMeta = titleMeta->contents + selectedIndex;
result = 0;
}
if ((contentMeta->type & 0x8000) != 0) {
blocks->sharedInodes++;
blocks->sharedBlocks += ((u32)contentMeta->size + 0x3FFF) >> 14;
} else {
if ((contentMeta->type & 0x8000) == 0) {
blocks->privateInodes++;
blocks->privateBlocks += ((u32)contentMeta->size + 0x3FFF) >> 14;
} else {
blocks->sharedInodes++;
blocks->sharedBlocks += ((u32)contentMeta->size + 0x3FFF) >> 14;
}
contentMeta++;
}
@@ -1338,7 +1338,7 @@ s32 WADBackupEx(u64 titleId, u32 ticketId, MEMAllocator* allocator, char* path,
}
}
result = _WADBackupGetSize(flags, titleMeta, &existingContentMask, fileCount, files,
&titleMetaSize, &contentDataSize, &fileDataSize, &totalSize);
&titleMetaSize, &contentDataSize, &fileDataSize);
if (result != 0) {
goto cleanup;
}
@@ -1346,8 +1346,9 @@ s32 WADBackupEx(u64 titleId, u32 ticketId, MEMAllocator* allocator, char* path,
result = -3002;
goto cleanup;
}
totalSize = titleMetaSize + contentDataSize + fileDataSize + 0x340;
if (path == 0) {
*sizeOut = totalSize + 0x340;
*sizeOut = totalSize;
result = 0;
goto cleanup;
}
@@ -1793,51 +1794,48 @@ s32 _WADGetCidxCount(const ESContentMask* contentMask) {
if ((contentMask->data[bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
count++;
}
bitIndex++;
if ((contentMask->data[bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
if ((contentMask->data[(bitIndex + 1) >> 3] & (1 << ((bitIndex + 1) & 7))) != 0) {
count++;
}
bitIndex++;
if ((contentMask->data[bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
if ((contentMask->data[(bitIndex + 2) >> 3] & (1 << ((bitIndex + 2) & 7))) != 0) {
count++;
}
bitIndex++;
if ((contentMask->data[bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
if ((contentMask->data[(bitIndex + 3) >> 3] & (1 << ((bitIndex + 3) & 7))) != 0) {
count++;
}
bitIndex++;
bitIndex += 4;
}
return count;
}
static s32 _WADGetCidx(const ESContentMask* contentMask, u32 contentNumber) {
u32 remaining = contentNumber + 1;
s32 bitIndex = 0;
s32 nextIndex;
u32 bitIndex = 0;
u32 nextIndex;
for (bitIndex = 0; bitIndex < 0x200; bitIndex += 4) {
if ((contentMask->data[bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
if ((contentMask->data[(s32)bitIndex >> 3] & (1 << (bitIndex & 7))) != 0) {
remaining--;
}
if (remaining == 0) {
return bitIndex;
}
nextIndex = bitIndex + 1;
if ((contentMask->data[nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
if ((contentMask->data[(s32)nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
remaining--;
}
if (remaining == 0) {
return nextIndex;
}
nextIndex = bitIndex + 2;
if ((contentMask->data[nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
if ((contentMask->data[(s32)nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
remaining--;
}
if (remaining == 0) {
return nextIndex;
}
nextIndex = bitIndex + 3;
if ((contentMask->data[nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
if ((contentMask->data[(s32)nextIndex >> 3] & (1 << (nextIndex & 7))) != 0) {
remaining--;
}
if (remaining == 0) {
@@ -2043,8 +2041,8 @@ cleanup:
static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* contentMask,
u32 fileCount, WADBackupFileHeader* files, u32* titleMetaSize,
u32* contentDataSize, u32* fileDataSize, u32* totalSize) {
u32 titleSize = 0x80;
u32* contentDataSize, u32* fileDataSize) {
u32 titleSize = 0;
u32 contentSize = 0;
u32 filesSize = 0;
u32 selectedCount;
@@ -2052,26 +2050,26 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
u32 fileIndex;
s32 result = 0;
if ((titleMeta != 0) && (titleMetaSize != 0)) {
if (((flags & 1) != 0) || ((flags & 0x20) != 0)) {
result = ES_GetTmdSizeFromView(titleMeta, titleMetaSize);
if (result != 0) {
return result;
}
titleSize += (*titleMetaSize + 0x3F) & ~0x3F;
if (titleMeta == 0) {
if (titleMetaSize != 0) {
*titleMetaSize = 0;
}
if ((flags & 1) != 0) {
selectedCount = _WADGetCidxCount(contentMask);
for (contentIndex = 0; contentIndex < selectedCount; contentIndex++) {
s32 tmdIndex = _WADGetCidx(contentMask, contentIndex);
if ((tmdIndex < 0) || (titleMeta->head.numContents <= tmdIndex)) {
return -3009;
}
contentSize += (titleMeta->contents[tmdIndex].size + 0x3F) & ~0x3F;
}
} else if (((flags & 1) != 0) || ((flags & 0x20) != 0)) {
result = ES_GetTmdSizeFromView(titleMeta, &titleSize);
if (result != 0) {
return result;
}
titleSize = (titleSize + 0x3F) & ~0x3F;
}
if (((flags & 1) != 0) && (titleMeta != 0)) {
selectedCount = _WADGetCidxCount(contentMask);
for (contentIndex = 0; contentIndex < selectedCount; contentIndex++) {
s32 tmdIndex = _WADGetCidx(contentMask, contentIndex);
if ((tmdIndex < 0) || (titleMeta->head.numContents <= tmdIndex)) {
return -3009;
}
contentSize += (titleMeta->contents[tmdIndex].size + 0x3F) & ~0x3F;
}
} else if ((titleMeta == 0) && (titleMetaSize != 0)) {
*titleMetaSize = 0;
}
if ((fileCount != 0) && (files != 0)) {
for (fileIndex = 0; fileIndex < fileCount; fileIndex++) {
@@ -2087,9 +2085,6 @@ static s32 _WADBackupGetSize(u32 flags, ESTmdView* titleMeta, ESContentMask* con
if (fileDataSize != 0) {
*fileDataSize = filesSize;
}
if (totalSize != 0) {
*totalSize = titleSize + contentSize + filesSize;
}
return result;
}
#pragma dont_inline reset
@@ -3003,13 +2998,13 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
DVDFileInfo fileInfo;
WADBootImportParts parts;
WADHeader* header;
u8* readBuffer;
BOOL fileOpened = FALSE;
ESTitleMeta* titleMeta = 0;
ESTitleMeta* titleMeta;
u8* readBuffer = buffer;
void* applicationData;
u32 paddedFileSize;
u32 sectionOffset;
u32 applicationSize;
BOOL fileOpened = FALSE;
s32 result;
if ((path == 0) || (buffer == 0)) {
@@ -3020,7 +3015,6 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
return -3004;
}
fileOpened = TRUE;
readBuffer = buffer;
paddedFileSize = (fileInfo.length + 0x1F) & ~0x1F;
if (paddedFileSize > bufferSize) {
result = -3003;
@@ -3063,10 +3057,10 @@ s32 WADImportDVDForBS(const char* path, void* buffer, u32 bufferSize) {
}
if (header->tmdSize != 0) {
parts.titleMetaSize = header->tmdSize;
titleMeta = (ESTitleMeta*)(readBuffer + sectionOffset);
parts.titleMeta = titleMeta;
parts.titleMeta = readBuffer + sectionOffset;
sectionOffset += (header->tmdSize + 0x3F) & ~0x3F;
}
titleMeta = parts.titleMeta;
applicationSize = ((u32)titleMeta->contents[0].size + 0xF) & ~0xF;
applicationData = readBuffer + sectionOffset;
if ((titleMeta != 0) && (titleMeta->head.titleId == ES_TITLE_ID(1, 1))) {
@@ -3099,8 +3093,8 @@ cleanup:
s32 WADImportDVDExForBS(const char* path, void* buffer, u32 bufferSize) {
WADHeader header ALIGN32;
DVDFileInfo fileInfo;
WADBootImportParts parts;
DVDFileInfo fileInfo;
u8* readBuffer = buffer;
u8* contentBuffer;
ESTitleMeta* titleMeta;

View File

@@ -1,182 +0,0 @@
#ifndef PRIVATE_NHTTP_H
#define PRIVATE_NHTTP_H
#include <revolution/nhttp.h>
#include <revolution/os.h>
#include <revolution/ssl.h>
#define STR_POSTBOUND "--t9Sf4yfjf1RtvDu3AA"
#define LEN_POSTBOUND 18
#define LEN_URLBUF 256
#define MIN(AA, BB) (((AA) > (BB)) ? (BB) : (AA))
typedef struct NHTTPBgnEndInfo NHTTPBgnEndInfo;
typedef struct NHTTPRequestInfo NHTTPRequestInfo;
#define NHTTP_CONN_RECVBUF_SIZE 0x8000
typedef struct NHTTPConnectionInfo NHTTPConnectionInfo;
typedef enum NHTTPConnectionEvent
{
NHTTP_EVENT_NONE,
NHTTP_EVENT_POST_SEND,
NHTTP_EVENT_BODY_RECV_FULL,
NHTTP_EVENT_BODY_RECV_DONE,
NHTTP_EVENT_COMPLETE,
NHTTP_CALLBACK_EVENT_MAX,
} NHTTPConnectionEvent;
typedef s32 (*NHTTPConnectionCallback)(NHTTPConnectionInfo* connection,
NHTTPConnectionEvent event, void* arg);
typedef struct NHTTPConnectionCallbackParam
{
void* value;
u32 _unk4;
u32 _unk8;
u32 _unkC;
} NHTTPConnectionCallbackParam;
typedef struct NHTTPPostSendArg
{
const char* label;
char* buf;
u32 size;
u32 offset;
} NHTTPPostSendArg;
typedef struct NHTTPBodyBufArg
{
char* buf;
u32 size;
u32 offset;
} NHTTPBodyBufArg;
typedef struct NHTTPHeader
{
struct NHTTPHeader* next;
struct NHTTPHeader* prev;
char* name;
char* value;
u32 length;
u32 _unk14;
} NHTTPHeader;
typedef struct NHTTPReqQueue
{
struct NHTTPReqQueue* next;
struct NHTTPReqQueue* prev;
s32 requestId;
NHTTPRequestInfo* volatile request;
s32 _unk10;
} NHTTPReqQueue;
typedef struct NHTTPListInfo
{
NHTTPReqQueue* reqQueue;
s32 nextRequestId;
} NHTTPListInfo;
typedef struct NHTTPReqInfo
{
NHTTPReqQueue* reqQueue;
} NHTTPReqInfo;
typedef struct NHTTPi_HDRBUFLIST
{
struct NHTTPi_HDRBUFLIST* next_p;
u8 block[NHTTP_HDRRECVBUF_BLOCKLEN];
} NHTTPi_HDRBUFLIST;
typedef struct NHTTPResponseInfo
{
volatile s32 headerLen;
volatile s32 bodyLen;
volatile s32 totalBodyLen;
volatile s32 contentLength;
s32 isSuccess;
s32 isHeaderParse;
s32 httpStatus;
u32 recvBufLen;
char* allHeader_p;
char* foundHeader_p;
char* recvBuf_p;
NHTTPResponseCallback bufFull;
NHTTPResponseCleanup freeBuf;
NHTTPi_HDRBUFLIST* hdrBufBlock_p;
u8 hdrBufFirst[NHTTP_HDRRECVBUF_INILEN];
void* param_p;
} NHTTPResponseInfo;
struct NHTTPRequestInfo
{
BOOL cancel;
s32 state;
BOOL secure;
BOOL proxyEnabled;
BOOL isRawData;
s32 hostEnd;
s32 pathStart;
s32 method;
u32 port;
char* url;
char* host;
NHTTPResponseInfo* response;
NHTTPHeader* headers;
NHTTPHeader* postData;
char multipartBoundary[LEN_POSTBOUND + 2];
char authorization[0x5C];
s32 authorizationLength;
SSLId sslId;
const char* clientCertData;
u32 clientCertSize;
const char* privateKeyData;
u32 privateKeySize;
const char* rootCAData;
u32 rootCASize;
BOOL clientCertDefault;
u32 verifyOption;
NHTTPEncodingType encodingType;
void* _unkD4;
u32 builtinRootCA;
u32 builtinClientCert;
char proxyServer[0x100];
u32 proxyPort;
char proxyAuthorization[0x5C];
s32 proxyAuthorizationLength;
u32 recvBufferSize;
const void* postBuffer;
u32 postBufferSize;
void* _unk250;
};
struct NHTTPConnectionInfo
{
BOOL started;
s32 state;
s32 sslError;
u32 _unkC;
NHTTPRequestInfo* request;
NHTTPResponseInfo* response;
s32 requestId;
NHTTPConnectionCallback callback;
NHTTPConnectionInfo* next;
u32 _unk24;
u32 _unk28;
u32 virtualContentLength;
NHTTPReqCallback requestCallback;
u32 _unk34;
u32 _unk38;
u32 _unk3C;
u8 recvBuf[0x8000];
u32 recvBufOffset;
u32 recvBufDataLen;
u32 _unk8048;
u32 _unk804C;
u32 _unk8050;
u32 _unk8054;
u32 _unk8058;
u32 _unk805C;
};
#endif // PRIVATE_NHTTP_H

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
#ifndef REVOLUTION_NHTTP_H
#define REVOLUTION_NHTTP_H
@@ -5,80 +6,49 @@
#include <revolution/nhttp/nhttp_err.h>
#define NHTTP_HDRRECVBUF_INILEN 1024
#define NHTTP_HDRRECVBUF_BLOCKSHIFT 9
#define NHTTP_HDRRECVBUF_BLOCKLEN (1 << NHTTP_HDRRECVBUF_BLOCKSHIFT)
#define NHTTP_HDRRECVBUF_BLOCKMASK (NHTTP_HDRRECVBUF_BLOCKLEN - 1)
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef struct {
u8 dummy[1];
} NHTTPRequest;
typedef struct {
u8 dummy[1];
} NHTTPResponse;
typedef int NHTTPConnection;
typedef void* (*NHTTPAlloc)(u32 size, int align);
typedef void (*NHTTPFree)(void* buf);
typedef void (*NHTTPRequestCallback)(int, NHTTPResponse*);
typedef void (*NHTTPCleanupCallback)();
typedef struct NHTTPRequestInfo NHTTPRequest;
typedef struct NHTTPResponseInfo NHTTPResponse;
typedef s32 NHTTPConnection;
int NHTTPStartup(NHTTPAlloc alloc, NHTTPFree free, u32 priority);
int NHTTPCleanupAsync(NHTTPCleanupCallback);
int NHTTPGetError();
typedef enum NHTTPReqMethod {
NHTTP_REQMETHOD_GET,
NHTTP_REQMETHOD_POST,
NHTTP_REQMETHOD_HEAD,
} NHTTPReqMethod;
typedef enum NHTTPEncodingType {
NHTTP_ENCODING_TYPE_AUTO,
NHTTP_ENCODING_TYPE_URL,
NHTTP_ENCODING_TYPE_MULTIPART,
NHTTP_ENCODING_TYPE_MAX,
} NHTTPEncodingType;
typedef void (*NHTTPReqCallback)();
typedef void* (*NHTTPResponseCallback)(void** buffer, void* data,
u32 contentLength, NHTTPAlloc alloc,
NHTTPFree free, void* userParam);
typedef void (*NHTTPResponseCleanup)(void* buffer, NHTTPFree free,
void* userParam);
s32 NHTTPStartup(NHTTPAlloc alloc, NHTTPFree free, u32 priority);
void NHTTPCleanupAsync(NHTTPCleanupCallback callback);
s32 NHTTPGetError(void);
NHTTPRequest* NHTTPCreateRequest(const char* url, NHTTPReqMethod method,
void* buffer, u32 bufferSize,
NHTTPReqCallback callback, void* userParam);
NHTTPRequest* NHTTPCreateRequestEx(const char* url, NHTTPReqMethod method,
void* buffer, u32 bufferSize,
NHTTPReqCallback callback, void* userParam,
NHTTPResponseCallback responseCallback,
NHTTPResponseCleanup cleanup);
s32 NHTTPAddHeaderField(NHTTPRequest* request, const char* name,
const char* value);
s32 NHTTPAddPostDataRaw(NHTTPRequest* request, const void* data,
u32 size, const char* label);
s32 NHTTPDeleteRequest(NHTTPRequest* request);
NHTTPRequest* NHTTPCreateRequest(char* url, undefined4, void* buf, u32 bufSize, NHTTPRequestCallback reqCallback, undefined4);
NHTTPRequest* NHTTPCreateRequestEx(char* url, undefined4, void* buf, u32 bufSize, NHTTPRequestCallback reqCallback, undefined4, undefined4,
undefined4);
int NHTTPDeleteRequest(NHTTPRequest* request);
NHTTPConnection NHTTPSendRequestAsync(NHTTPRequest* request);
s32 NHTTPCancelRequestAsync(NHTTPConnection connection);
int NHTTPCancelRequestAsync(NHTTPConnection connection);
s32 NHTTPGetProgress(u32* complete, u32* total);
void NHTTPGetProgress(u32* complete, u32* total);
void NHTTPDestroyResponse(NHTTPResponse* response);
s32 NHTTPGetHeaderAll(NHTTPResponse* response, const char** header);
s32 NHTTPGetHeaderField(NHTTPResponse* response, const char* name,
const char** value);
int NHTTPDestroyResponse(NHTTPResponse* response);
u32 NHTTPGetHeaderField(NHTTPResponse* response, const char* name, const char** value);
s32 NHTTPGetBodyAll(NHTTPResponse* response, void** buffer);
s32 NHTTPGetResultCode(NHTTPResponse* response);
int NHTTPGetResultCode(NHTTPResponse* res);
s32 NHTTPSetVerifyOption(NHTTPRequest* request, u32 option);
s32 NHTTPSetProxy(NHTTPRequest* request, const char* server, u16 port,
const char* username, const char* password);
s32 NHTTPSetProxyDefault(NHTTPRequest* request);
s32 NHTTPSetClientCertDefault(NHTTPRequest* request);
s32 NHTTPSetRootCADefault(NHTTPRequest* request);
int NHTTPSetVerifyOption(NHTTPRequest* request, u32 option);
int NHTTPSetProxyDefault(NHTTPRequest* request);
int NHTTPSetRootCADefault(NHTTPRequest* request);
int NHTTPSetClientCertDefault(NHTTPRequest* request);
#ifdef __cplusplus
}

View File

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

View File

@@ -102,16 +102,13 @@ struct SOAddrInfo {
SOAddrInfo* next; // 0x20
};
#define SO_ENOTCONN -56
int SOSocket(int pf, int type, int protocol);
int __SOCreateSocket(int pf, int type, int protocol);
int SOClose(int s);
int SOConnect(int s, void* sockAddr);
int SORecv(int s, void* buf, int len, int flags);
int SOSend(int s, const void* buf, int len, int flags);
int SOSend(int s, void* buf, int len, int flags);
int SOFcntl(int s, int cmd, ...);
int SOShutdown(int s, int how);

View File

@@ -14,7 +14,6 @@ typedef struct IPAddrEntry {
} IPAddrEntry;
int SOGetInterfaceOpt(void* unk, int level, int optname, void* optval, int* optlen);
int SOSetSockOpt(int s, int level, int optname, const void* optval, int optlen);
#ifdef __cplusplus
}

View File

@@ -1,179 +0,0 @@
#include <revolution/nhttp.h>
#include <revolution/ncd.h>
#include <revolution/os.h>
#include <stdio.h>
int SOClose(int s);
typedef struct NHTTPBgnEndInfo
{
NCDIpConfig ipConfig;
NHTTPAlloc alloc;
NHTTPFree free;
BOOL started;
s32 socket;
s32 sslError;
NHTTPErr error;
u32 _unk7DC;
void* threadStack;
u32 _unk7E4;
} NHTTPBgnEndInfo;
NHTTPBgnEndInfo* NHTTPi_GetSystemInfoP(void);
NHTTPBgnEndInfo* NHTTPi_GetBgnEndInfoP(void* systemInfo);
void* NHTTPi_GetListInfoP(void* systemInfo);
void* NHTTPi_GetReqInfoP(void* systemInfo);
void* NHTTPi_GetMutexInfoP(void* systemInfo);
void* NHTTPi_GetThreadInfoP(void* systemInfo);
void NHTTPi_InitListInfo(void* listInfo);
void NHTTPi_InitRequestInfo(void* reqInfo);
void NHTTPi_initLockReqList(void* mutexInfo);
void NHTTPi_exitLockReqList(void);
BOOL NHTTPi_createCommThread(void* threadInfo, u32 priority, void* stack);
void NHTTPi_destroyCommThread(void* threadInfo, NHTTPBgnEndInfo* bgnEndInfo);
void NHTTPi_CheckCurrentThread(void* threadInfo, BOOL allowCommThread);
void NHTTPi_cancelAllRequests(void* systemInfo);
int NHTTPi_GetConnectionListLength(void);
void NHTTPi_InitConnectionList(void);
void NHTTPi_InitBgnEndInfo(NHTTPBgnEndInfo* info)
{
info->sslError = 0;
info->error = NHTTP_ERROR_NONE;
info->alloc = NULL;
info->free = NULL;
info->started = FALSE;
info->socket = -1;
info->_unk7DC = 0;
info->threadStack = NULL;
info->_unk7E4 = 0;
}
void* NHTTPi_alloc(u32 size, int align)
{
NHTTPBgnEndInfo* info = NHTTPi_GetSystemInfoP();
if (info->alloc != NULL)
{
return info->alloc(size, align);
}
return NULL;
}
void NHTTPi_free(void* buf)
{
NHTTPBgnEndInfo* info = NHTTPi_GetSystemInfoP();
if (info->free != NULL)
{
info->free(buf);
}
}
void NHTTPi_SetError(NHTTPBgnEndInfo* info, NHTTPErr error)
{
info->error = error;
}
void NHTTPi_SetSSLError(NHTTPBgnEndInfo* info, s32 error)
{
info->sslError = error;
}
s32 NHTTPi_GetSSLError(NHTTPBgnEndInfo* info)
{
return info->sslError;
}
BOOL NHTTPi_Startup(void* systemInfo, NHTTPAlloc alloc, NHTTPFree free,
u32 priority)
{
NHTTPBgnEndInfo* bgnEndInfo = NHTTPi_GetBgnEndInfoP(systemInfo);
void* listInfo = NHTTPi_GetListInfoP(systemInfo);
void* reqInfo = NHTTPi_GetReqInfoP(systemInfo);
void* mutexInfo = NHTTPi_GetMutexInfoP(systemInfo);
void* threadInfo = NHTTPi_GetThreadInfoP(systemInfo);
void* stack;
NCDErr result;
bgnEndInfo->alloc = alloc;
bgnEndInfo->free = free;
bgnEndInfo->error = NHTTP_ERROR_NONE;
bgnEndInfo->sslError = 0;
bgnEndInfo->_unk7DC = 0;
NHTTPi_InitListInfo(listInfo);
NHTTPi_InitRequestInfo(reqInfo);
NHTTPi_initLockReqList(mutexInfo);
NHTTPi_InitConnectionList();
bgnEndInfo->socket = -1;
stack = NHTTPi_alloc(0x2000, 8);
bgnEndInfo->threadStack = stack;
if (stack == NULL)
{
bgnEndInfo->error = NHTTP_ERROR_ALLOC;
NHTTPi_exitLockReqList();
return FALSE;
}
if (!NHTTPi_createCommThread(threadInfo, priority, stack))
{
bgnEndInfo->error = NHTTP_ERROR_REVOLUTIONSDK;
NHTTPi_free(bgnEndInfo->threadStack);
bgnEndInfo->threadStack = NULL;
NHTTPi_exitLockReqList();
return FALSE;
}
result = NCDGetCurrentIpConfig(&bgnEndInfo->ipConfig);
if (result < 0)
{
OSReport("NCDGetCurrentIpConfig err = %d\n", result);
OSPanic("NHTTP_bgnend.c", 230, "NCDGetCurrentIpConfig");
}
bgnEndInfo->started = TRUE;
return TRUE;
}
void NHTTPi_CleanupAsync(void* systemInfo, NHTTPCleanupCallback callback)
{
NHTTPBgnEndInfo* bgnEndInfo = NHTTPi_GetBgnEndInfoP(systemInfo);
void* threadInfo = NHTTPi_GetThreadInfoP(systemInfo);
int connectionCount;
NHTTPi_CheckCurrentThread(threadInfo, TRUE);
NHTTPi_cancelAllRequests(systemInfo);
NHTTPi_destroyCommThread(threadInfo, bgnEndInfo);
NHTTPi_free(bgnEndInfo->threadStack);
bgnEndInfo->threadStack = NULL;
NHTTPi_exitLockReqList();
bgnEndInfo->started = FALSE;
if (callback != NULL)
{
callback();
}
connectionCount = NHTTPi_GetConnectionListLength();
if (connectionCount != 0)
{
printf("*warning: %d connections rests! Please free connections.\n",
connectionCount);
}
if (bgnEndInfo->socket >= 0)
{
SOClose(bgnEndInfo->socket);
bgnEndInfo->socket = -1;
}
}
s32 NHTTPi_GetError(NHTTPBgnEndInfo* info)
{
return info->error;
}

View File

@@ -1,102 +0,0 @@
#include <private/nhttp.h>
#include <stdio.h>
s32 NHTTPi_compareToken(const char* lhs, const char* rhs);
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_SetError(NHTTPBgnEndInfo* info, NHTTPErr error);
static BOOL addHdrList(NHTTPHeader** list, NHTTPBgnEndInfo* info, char* name,
char* value)
{
BOOL found = FALSE;
NHTTPHeader* header = *list;
if (header != NULL)
{
if (NHTTPi_compareToken(name, header->name) != 0)
{
header = header->prev;
while (header != *list)
{
if (NHTTPi_compareToken(name, header->name) == 0)
{
found = TRUE;
break;
}
header = header->prev;
}
}
else
{
found = TRUE;
}
}
if (found)
{
header->value = value;
}
else
{
header = NHTTPi_alloc(sizeof(NHTTPHeader), 4);
if (header == NULL)
{
printf("failed to allocate memory\n");
NHTTPi_SetError(info, NHTTP_ERROR_ALLOC);
return FALSE;
}
header->name = name;
header->value = value;
header->length = 0;
header->_unk14 = 0;
if (*list != NULL)
{
header->next = (*list)->next;
header->prev = *list;
(*list)->next->prev = header;
(*list)->next = header;
}
else
{
header->prev = header;
header->next = header;
*list = header;
}
}
return TRUE;
}
NHTTPHeader* NHTTPi_getHdrFromList(NHTTPHeader** list)
{
NHTTPHeader* header = *list;
if (header != NULL)
{
if (header != header->next)
{
header->next->prev = header->prev;
header->prev->next = header->next;
*list = header->prev;
}
else
{
*list = NULL;
}
}
return header;
}
BOOL NHTTP_AddHeaderField(NHTTPRequestInfo* request, NHTTPBgnEndInfo* info,
char* name, char* value)
{
if (request->state != 0)
{
return FALSE;
}
return addHdrList(&request->headers, info, name, value);
}

View File

@@ -1,126 +0,0 @@
#include <private/nhttp.h>
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_free(void* ptr);
NHTTPConnectionInfo* NHTTPi_Request2Connection(void* mutexInfo,
NHTTPRequestInfo* request);
void NHTTPi_destroyRequestObject(void* mutexInfo, NHTTPRequestInfo* request);
void NHTTPi_CompleteCallback(void* mutexInfo, NHTTPConnectionInfo* connection);
NHTTPHeader* NHTTPi_getHdrFromList(NHTTPHeader** list);
void NHTTPi_InitListInfo(NHTTPListInfo* info)
{
info->reqQueue = NULL;
info->nextRequestId = 0;
}
s32 NHTTPi_setReqQueue(NHTTPListInfo* info, NHTTPRequestInfo* request)
{
s32 requestId = -1;
NHTTPReqQueue* queue = NHTTPi_alloc(sizeof(NHTTPReqQueue), 4);
if (queue != NULL)
{
if (info->reqQueue != NULL)
{
queue->next = info->reqQueue->next;
queue->prev = info->reqQueue;
info->reqQueue->next->prev = queue;
info->reqQueue->next = queue;
}
else
{
queue->next = queue;
queue->prev = queue;
info->reqQueue = queue;
}
queue->requestId = info->nextRequestId++;
queue->request = request;
queue->_unk10 = -1;
requestId = queue->requestId;
if (info->nextRequestId < 0)
{
info->nextRequestId = 0;
}
}
return requestId;
}
BOOL NHTTPi_freeReqQueue(NHTTPListInfo* info, void* mutexInfo, s32 requestId)
{
NHTTPReqQueue* current;
NHTTPReqQueue* queue = info->reqQueue;
NHTTPReqQueue* found = NULL;
BOOL result = FALSE;
if (queue != NULL)
{
if (queue->requestId == requestId)
{
found = queue;
}
else
{
current = queue->prev;
while (current != queue)
{
if (current->requestId == requestId)
{
found = current;
break;
}
current = current->prev;
}
}
}
if (found != NULL)
{
NHTTPConnectionInfo* connection;
if (queue != queue->next)
{
found->next->prev = found->prev;
found->prev->next = found->next;
if (info->reqQueue == found)
{
info->reqQueue = found->prev;
}
}
else
{
info->reqQueue = NULL;
}
connection = NHTTPi_Request2Connection(mutexInfo, found->request);
NHTTPi_destroyRequestObject(mutexInfo, found->request);
NHTTPi_free(found);
if (connection != NULL)
{
connection->state = 8;
NHTTPi_CompleteCallback(mutexInfo, connection);
}
result = TRUE;
}
return result;
}
void NHTTPi_allFreeReqQueue(NHTTPListInfo* info, void* mutexInfo)
{
while (info->reqQueue != NULL)
{
NHTTPi_freeReqQueue(info, mutexInfo, info->reqQueue->requestId);
}
}
NHTTPReqQueue* NHTTPi_getReqFromReqQueue(NHTTPReqQueue** queue)
{
return (NHTTPReqQueue*)NHTTPi_getHdrFromList((NHTTPHeader**)queue);
}

View File

@@ -1,120 +0,0 @@
#include <revolution/nhttp.h>
#include <revolution/ncd.h>
#include <revolution/os.h>
typedef struct NHTTPMutexInfo
{
OSMutex mutex;
BOOL initialized;
} NHTTPMutexInfo;
typedef struct NHTTPBgnEndInfo
{
NCDIpConfig ipConfig;
NHTTPAlloc alloc;
NHTTPFree free;
BOOL started;
s32 socket;
s32 sslError;
NHTTPErr error;
u32 _unk7DC;
void* threadStack;
u32 _unk7E4;
} NHTTPBgnEndInfo;
typedef struct NHTTPThreadInfo
{
OSMessageQueue messageQueue;
OSMessage messages[3];
OSThread thread;
BOOL isCreateCommThreadMessageQueue;
u8 _unk34C[0x14];
char commBuf[0x100];
} NHTTPThreadInfo;
BOOL NHTTPi_IsCreateCommThreadMessageQueue(NHTTPThreadInfo* info);
void NHTTPi_IsCreateCommThreadMessageQueueOn(NHTTPThreadInfo* info);
void NHTTPi_CommThreadProcMain(void* argument);
void NHTTPi_InitMutexInfo(NHTTPMutexInfo* info)
{
info->initialized = FALSE;
}
void NHTTPi_initLockReqList(NHTTPMutexInfo* info)
{
if (!info->initialized)
{
OSInitMutex(&info->mutex);
info->initialized = TRUE;
}
}
void NHTTPi_exitLockReqList(void)
{
}
void NHTTPi_lockReqList(NHTTPMutexInfo* info)
{
OSLockMutex(&info->mutex);
}
void NHTTPi_unlockReqList(NHTTPMutexInfo* info)
{
OSUnlockMutex(&info->mutex);
}
void* NHTTPi_CommThreadProc(void* argument);
BOOL NHTTPi_createCommThread(NHTTPThreadInfo* info, s32 priority, void* stack)
{
if (!NHTTPi_IsCreateCommThreadMessageQueue(info))
{
OSInitMessageQueue(&info->messageQueue, info->messages, 3);
NHTTPi_IsCreateCommThreadMessageQueueOn(info);
}
OSCreateThread(&info->thread, NHTTPi_CommThreadProc, NULL, (u8*)stack + 0x2000, 0x2000, priority, 0);
OSResumeThread(&info->thread);
return TRUE;
}
void NHTTPi_destroyCommThread(NHTTPThreadInfo* info, NHTTPBgnEndInfo* bgnEndInfo)
{
bgnEndInfo->_unk7DC = 1;
OSSendMessage(&info->messageQueue, NULL, 0);
OSJoinThread(&info->thread, NULL);
}
void NHTTPi_idleCommThread(NHTTPThreadInfo* info)
{
OSMessage message;
OSReceiveMessage(&info->messageQueue, &message, OS_MESSAGE_BLOCK);
}
void NHTTPi_kickCommThread(NHTTPThreadInfo* info)
{
OSSendMessage(&info->messageQueue, NULL, 0);
}
void NHTTPi_CheckCurrentThread(NHTTPThreadInfo* info, BOOL notCommThread)
{
OSThread* current = OSGetCurrentThread();
OSThread* commThread = &info->thread;
if (current != NULL
&& ((!notCommThread && current != commThread)
|| (notCommThread && current == commThread)))
{
OSReport("%s:illegal thread\n", __FUNCTION__);
OSPanic(__FILE__, 223, "halt\n");
}
}
void* NHTTPi_CommThreadProc(void* argument)
{
NHTTPi_CommThreadProcMain(argument);
return NULL;
}

View File

@@ -1,487 +0,0 @@
#include <private/nhttp.h>
const char NHTTPi_strMultipartBound[] = STR_POSTBOUND;
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_free(void* ptr);
void NHTTPi_SetError(NHTTPBgnEndInfo* info, NHTTPErr error);
void* NHTTPi_memclr(void* destination, u32 size);
s32 NHTTPi_strlen(const char* string);
void* NHTTPi_memcpy(void* destination, const void* source, u32 size);
s32 NHTTPi_strnicmp(const char* left, const char* right, s32 size);
s32 NHTTPi_strToHex(const char* string, s32 length);
s32 NHTTPi_strtonum(const char* string, s32 length);
NHTTPBgnEndInfo* NHTTPi_GetBgnEndInfoP(void* systemInfo);
NHTTPListInfo* NHTTPi_GetListInfoP(void* systemInfo);
NHTTPReqInfo* NHTTPi_GetReqInfoP(void* systemInfo);
void* NHTTPi_GetMutexInfoP(void* systemInfo);
void* NHTTPi_GetThreadInfoP(void* systemInfo);
NHTTPConnectionInfo* NHTTPi_Request2Connection(void* mutexInfo,
NHTTPRequestInfo* request);
void NHTTPi_lockReqList(void* mutexInfo);
void NHTTPi_unlockReqList(void* mutexInfo);
s32 NHTTPi_setReqQueue(NHTTPListInfo* listInfo, NHTTPRequestInfo* request);
void NHTTPi_kickCommThread(void* threadInfo);
void NHTTPi_SocCancel(void* mutexInfo, NHTTPRequestInfo* request, s32 socket);
BOOL NHTTPi_freeReqQueue(NHTTPListInfo* listInfo, void* mutexInfo,
s32 requestId);
void NHTTPi_allFreeReqQueue(NHTTPListInfo* listInfo, void* mutexInfo);
void NHTTPi_InitRequestInfo(NHTTPReqInfo* info)
{
info->reqQueue = NULL;
}
NHTTPRequestInfo* NHTTP_CreateRequest(NHTTPBgnEndInfo* bgnEndInfo_p,
const char* url_p, s32 method, void* buf_p, u32 len, void* param_p,
NHTTPResponseCallback bufFull, NHTTPResponseCleanup freeBuf)
{
int i;
int suflen, urllen, prelen;
int nhostenc, deccount;
int declen, hostend;
int port;
int decode_urllen;
char a_url[LEN_URLBUF];
char* prefix_p;
NHTTPRequestInfo* req_p = NULL;
if (method >= 3 || method < 0)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_UNKNOWN);
goto errend;
}
req_p = NHTTPi_alloc(sizeof(NHTTPRequestInfo), 4);
if (!req_p)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_ALLOC);
goto errend;
}
NHTTPi_memclr(req_p, sizeof(NHTTPRequestInfo));
req_p->response = NHTTPi_alloc(sizeof(NHTTPResponseInfo), 4);
if (!req_p->response)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_ALLOC);
goto errend;
}
NHTTPi_memclr(req_p->response, sizeof(NHTTPResponseInfo));
req_p->response->recvBuf_p = buf_p;
req_p->response->recvBufLen = len;
req_p->response->bufFull = bufFull;
req_p->response->freeBuf = freeBuf;
urllen = NHTTPi_strlen(url_p);
if (urllen <= 7)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
NHTTPi_memclr(a_url, urllen);
NHTTPi_memcpy(a_url, url_p, urllen);
req_p->port = 80;
suflen = 7;
if (NHTTPi_strnicmp(a_url, "http://", 7) != 0)
{
if (NHTTPi_strnicmp(a_url, "https://", 8) != 0)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
req_p->secure = TRUE;
req_p->port = 443;
suflen = 8;
}
prefix_p = a_url + suflen;
prelen = urllen - suflen;
if (prelen <= 0)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
for (i = 0, nhostenc = 0, deccount = 0;
(i < prelen) && (prefix_p[i] != '/'); i++)
{
if (deccount == 2)
{
deccount--;
}
else if (deccount == 1)
{
s8 c = (s8)NHTTPi_strToHex(&prefix_p[i - 1], 2);
deccount--;
if (c < 0)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
if (c == '/')
{
nhostenc--;
break;
}
}
else if (prefix_p[i] == '%')
{
deccount = 2;
nhostenc++;
}
}
if (deccount)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
decode_urllen = suflen + prelen - nhostenc * 2 + 1;
req_p->url = NHTTPi_alloc(decode_urllen, 4);
if (!req_p->url)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_ALLOC);
goto errend;
}
NHTTPi_memclr(req_p->url, decode_urllen);
NHTTPi_memcpy(req_p->url, a_url, suflen);
for (i = 0, declen = 0, deccount = 0, hostend = FALSE;
i < prelen; i++)
{
if (deccount == 2)
{
deccount--;
}
else if (deccount == 1)
{
char c = (char)NHTTPi_strToHex(&prefix_p[i - 1], 2);
deccount--;
req_p->url[suflen + declen - 1] = c;
if (c == '/')
{
hostend = TRUE;
}
}
else
{
if (prefix_p[i] == '/')
{
hostend = TRUE;
}
if (!hostend & (prefix_p[i] == '%'))
{
deccount = 2;
}
else
{
req_p->url[suflen + declen] = prefix_p[i];
}
declen++;
}
}
req_p->url[suflen + declen] = 0;
prefix_p = &req_p->url[suflen];
prelen = declen;
for (i = 0; i < prelen; i++)
{
if ((prefix_p[i] == '/') || (prefix_p[i] == ':'))
{
req_p->hostEnd = i + suflen;
break;
}
}
if (i == prelen)
{
req_p->pathStart = req_p->hostEnd = i + suflen;
}
else if (prefix_p[i] == '/')
{
req_p->pathStart = req_p->hostEnd;
}
else if (prefix_p[i] == ':')
{
for (; i < prelen; i++)
{
if (prefix_p[i] == '/')
{
req_p->pathStart = i + suflen;
break;
}
}
if (i == prelen)
{
req_p->pathStart = i + suflen;
}
else
{
port = NHTTPi_strtonum(&req_p->url[req_p->hostEnd + 1],
(int)(req_p->pathStart - (req_p->hostEnd + 1)));
if (port < 0)
{
port = req_p->port;
}
else if (port > 65535)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_DNS);
goto errend;
}
req_p->port = (u16)port;
}
}
{
u32 a_hostnameLen = (u32)(req_p->hostEnd - (req_p->secure ? 8 : 7));
req_p->host = NHTTPi_alloc(a_hostnameLen + 1, 4);
if (!req_p->host)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_ALLOC);
goto errend;
}
NHTTPi_memclr(req_p->host, (int)(a_hostnameLen + 1));
NHTTPi_memcpy(req_p->host,
req_p->url + (req_p->secure ? 8 : 7), (int)a_hostnameLen);
}
NHTTPi_memcpy(req_p->multipartBoundary, NHTTPi_strMultipartBound,
sizeof(req_p->multipartBoundary));
req_p->method = method;
req_p->sslId = 0;
req_p->clientCertData = NULL;
req_p->clientCertSize = 0;
req_p->privateKeyData = NULL;
req_p->privateKeySize = 0;
req_p->rootCAData = NULL;
req_p->rootCASize = 0;
req_p->clientCertDefault = FALSE;
req_p->verifyOption = 0;
req_p->_unkD4 = NULL;
req_p->response->param_p = param_p;
req_p->proxyEnabled = FALSE;
req_p->recvBufferSize = 0;
return req_p;
errend:
if (req_p)
{
if (req_p->url)
{
NHTTPi_free(req_p->url);
}
if (req_p->host)
{
NHTTPi_free(req_p->host);
}
if (req_p->response)
{
NHTTPi_free(req_p->response);
}
NHTTPi_free(req_p);
}
return NULL;
}
void NHTTP_DestroyRequest(void* systemInfo, NHTTPRequestInfo* request)
{
NHTTPConnectionInfo* connection;
NHTTPHeader* header;
NHTTPHeader* next;
NHTTPHeader* post;
NHTTPHeader* nextPost;
void* mutexInfo = NHTTPi_GetMutexInfoP(systemInfo);
connection = NHTTPi_Request2Connection(mutexInfo, request);
if (connection != NULL)
{
connection->response = NULL;
}
NHTTPi_free(request->response);
connection = NHTTPi_Request2Connection(mutexInfo, request);
if (connection != NULL)
{
connection->request = NULL;
}
header = request->headers;
while (header != NULL)
{
if (header != header->next)
{
next = header->next->next;
NHTTPi_free(header->next);
header->next = next;
}
else
{
NHTTPi_free(header);
header = NULL;
}
}
post = request->postData;
while (post != NULL)
{
if (post != post->next)
{
nextPost = post->next->next;
NHTTPi_free(post->next);
post->next = nextPost;
}
else
{
NHTTPi_free(post);
post = NULL;
}
}
NHTTPi_free(request->url);
NHTTPi_free(request->host);
NHTTPi_free(request);
}
BOOL NHTTPi_destroyRequestObject(void* mutexInfo, NHTTPRequestInfo* request)
{
NHTTPConnectionInfo* connection;
NHTTPHeader* header;
NHTTPHeader* next;
NHTTPHeader* post;
NHTTPHeader* nextPost;
connection = NHTTPi_Request2Connection(mutexInfo, request);
if (connection != NULL)
{
connection->request = NULL;
}
header = request->headers;
while (header != NULL)
{
if (header != header->next)
{
next = header->next->next;
NHTTPi_free(header->next);
header->next = next;
}
else
{
NHTTPi_free(header);
header = NULL;
}
}
post = request->postData;
while (post != NULL)
{
if (post != post->next)
{
nextPost = post->next->next;
NHTTPi_free(post->next);
post->next = nextPost;
}
else
{
NHTTPi_free(post);
post = NULL;
}
}
NHTTPi_free(request->url);
NHTTPi_free(request->host);
NHTTPi_free(request);
return TRUE;
}
s32 NHTTP_SendRequestAsync(void* systemInfo, NHTTPRequestInfo* request)
{
NHTTPBgnEndInfo* info = NHTTPi_GetBgnEndInfoP(systemInfo);
void* threadInfo = NHTTPi_GetThreadInfoP(systemInfo);
void* mutexInfo = NHTTPi_GetMutexInfoP(systemInfo);
s32 requestId;
if (request->state != 0)
{
NHTTPi_SetError(info, NHTTP_ERROR_UNKNOWN);
return -1;
}
NHTTPi_lockReqList(mutexInfo);
requestId = NHTTPi_setReqQueue(NHTTPi_GetListInfoP(systemInfo), request);
if (requestId >= 0)
{
request->state = 1;
NHTTPi_kickCommThread(threadInfo);
}
else
{
NHTTPi_SetError(info, NHTTP_ERROR_ALLOC);
}
NHTTPi_unlockReqList(mutexInfo);
return requestId;
}
BOOL NHTTP_CancelRequestAsync(void* sysInfo_p, s32 id)
{
BOOL rc = FALSE;
NHTTPReqInfo* reqInfo_p = NHTTPi_GetReqInfoP(sysInfo_p);
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
volatile NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
NHTTPi_lockReqList(mutexInfo_p);
if (reqCurrent_p)
{
if (reqCurrent_p->requestId == id)
{
if (!reqCurrent_p->request->cancel)
{
reqCurrent_p->request->cancel = TRUE;
NHTTPi_SocCancel(mutexInfo_p, reqCurrent_p->request,
reqCurrent_p->_unk10);
rc = TRUE;
}
}
}
if (!rc)
{
NHTTPListInfo* listInfo_p = NHTTPi_GetListInfoP(sysInfo_p);
rc = NHTTPi_freeReqQueue(listInfo_p, mutexInfo_p, id);
}
NHTTPi_unlockReqList(mutexInfo_p);
return rc;
}
void NHTTPi_cancelAllRequests(void* sysInfo_p)
{
NHTTPReqInfo* reqInfo_p = NHTTPi_GetReqInfoP(sysInfo_p);
NHTTPListInfo* listInfo_p = NHTTPi_GetListInfoP(sysInfo_p);
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
volatile NHTTPReqQueue* reqCurrent_p = reqInfo_p->reqQueue;
NHTTPi_lockReqList(mutexInfo_p);
if (reqCurrent_p)
{
if (!reqCurrent_p->request->cancel)
{
reqCurrent_p->request->cancel = TRUE;
NHTTPi_SocCancel(mutexInfo_p, reqCurrent_p->request,
reqCurrent_p->_unk10);
}
}
NHTTPi_allFreeReqQueue(listInfo_p, mutexInfo_p);
NHTTPi_unlockReqList(mutexInfo_p);
}

View File

@@ -1,202 +0,0 @@
#include <private/nhttp.h>
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_free(void* ptr);
void NHTTPi_SetError(NHTTPBgnEndInfo* info, NHTTPErr error);
s32 NHTTPi_loadFromHdrRecvBuf(NHTTPResponseInfo* res_p, char* dst, s32 pos,
s32 size);
s32 NHTTPi_strcmp(const char* lhs, const char* rhs);
s32 NHTTPi_getHeaderValue(const NHTTPResponseInfo* res_p, const char* label_p,
s32* pos_p);
NHTTPConnectionInfo* NHTTPi_Response2Connection(void* mutexInfo_p,
NHTTPResponseInfo* res_p);
s32 NHTTPi_findNextLineHdrRecvBuf(const NHTTPResponseInfo* res_p, s32 pos,
s32 limit, s32* colon_pos_p, s32* return_code_size_p);
s32 NHTTPi_compareTokenN_HdrRecvBuf(const NHTTPResponseInfo* res_p, s32 pos,
s32 limit, const char* str_p, s8 extdeli);
s32 NHTTPi_skipSpaceHdrRecvBuf(
const NHTTPResponseInfo* res_p, s32 pos, s32 limit);
void NHTTP_DestroyResponse(void* mutexInfo_p, NHTTPResponseInfo* res_p)
{
NHTTPi_HDRBUFLIST* list_p = NULL;
while (res_p->hdrBufBlock_p)
{
list_p = res_p->hdrBufBlock_p->next_p;
NHTTPi_free(res_p->hdrBufBlock_p);
res_p->hdrBufBlock_p = list_p;
}
if (res_p->allHeader_p)
{
NHTTPi_free(res_p->allHeader_p);
}
if (res_p->foundHeader_p)
{
NHTTPi_free(res_p->foundHeader_p);
}
if (res_p->freeBuf != NULL)
{
res_p->freeBuf(res_p->recvBuf_p, NHTTPi_free, res_p->param_p);
res_p->recvBuf_p = NULL;
res_p->recvBufLen = 0;
}
{
NHTTPConnectionInfo* connection_p =
NHTTPi_Response2Connection(mutexInfo_p, res_p);
if (connection_p != NULL)
{
connection_p->response = NULL;
}
}
NHTTPi_free(res_p);
}
s32 NHTTPi_getHeaderValue(const NHTTPResponseInfo* res_p, const char* label_p,
s32* pos_p)
{
s32 linetop, nextlinetop;
s32 labeltop, labelend;
s32 valuetop, valueend;
s32 return_code_size = 0;
linetop = NHTTPi_findNextLineHdrRecvBuf(
res_p, 12, res_p->headerLen, &labelend, &return_code_size);
while (linetop > 0)
{
nextlinetop = NHTTPi_findNextLineHdrRecvBuf(res_p, linetop,
res_p->headerLen, &labelend, &return_code_size);
if (labelend > 0)
{
labeltop = linetop;
if (NHTTPi_compareTokenN_HdrRecvBuf(
res_p, labeltop, labelend, label_p, 0)
== 0)
{
if (labelend + 1 < res_p->headerLen)
{
valueend = NHTTPi_findNextLineHdrRecvBuf(res_p,
labelend + 1, res_p->headerLen, NULL,
&return_code_size);
if (valueend <= 0)
{
valueend = res_p->headerLen;
}
else
{
if (valueend < return_code_size)
{
return -1;
}
valueend -= return_code_size;
}
valuetop = NHTTPi_skipSpaceHdrRecvBuf(
res_p, labelend + 1, valueend);
if (valuetop < 0)
{
valuetop = valueend;
}
*pos_p = valuetop;
return valueend - valuetop;
}
else
{
return 0;
}
}
}
linetop = nextlinetop;
}
return -1;
}
s32 NHTTP_GetHeaderField(NHTTPResponseInfo* res_p, const char* label_p,
const char** value_p)
{
s32 pos;
s32 length;
if (res_p->isHeaderParse == 0)
{
return -1;
}
if (res_p->foundHeader_p != NULL)
{
NHTTPi_free(res_p->foundHeader_p);
res_p->foundHeader_p = NULL;
}
length = NHTTPi_getHeaderValue(res_p, label_p, &pos);
if (length >= 0)
{
res_p->foundHeader_p = NHTTPi_alloc(length + 1, 4);
if (res_p->foundHeader_p == NULL)
{
return -1;
}
res_p->foundHeader_p[length] = 0;
NHTTPi_loadFromHdrRecvBuf(res_p, res_p->foundHeader_p, pos, length);
*value_p = res_p->foundHeader_p;
return length;
}
if (NHTTPi_strcmp("HTTPSTATUSCODE", label_p) == 0)
{
res_p->foundHeader_p = NHTTPi_alloc(4, 4);
if (res_p->foundHeader_p == NULL)
{
return -1;
}
res_p->foundHeader_p[3] = 0;
NHTTPi_loadFromHdrRecvBuf(res_p, res_p->foundHeader_p, 9, 3);
*value_p = res_p->foundHeader_p;
return 3;
}
return -1;
}
s32 NHTTP_GetHeaderAll(void* bgnEndInfo_p, NHTTPResponseInfo* res_p,
const char** header_p)
{
if (res_p->isHeaderParse == 0 || res_p->headerLen == 0)
{
return -1;
}
if (res_p->headerLen < NHTTP_HDRRECVBUF_INILEN)
{
*header_p = (const char*)res_p->hdrBufFirst;
}
else
{
if (res_p->allHeader_p == NULL)
{
res_p->allHeader_p = NHTTPi_alloc(res_p->headerLen, 4);
if (res_p->allHeader_p == NULL)
{
NHTTPi_SetError(bgnEndInfo_p, NHTTP_ERROR_ALLOC);
return -1;
}
NHTTPi_loadFromHdrRecvBuf(res_p, res_p->allHeader_p, 0,
res_p->headerLen);
}
*header_p = res_p->allHeader_p;
}
return res_p->headerLen;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,673 +0,0 @@
#include <private/nhttp.h>
#include <revolution/ncd.h>
#include <string.h>
#include <stdio.h>
struct NHTTPBgnEndInfo
{
NCDIpConfig ipConfig;
};
typedef s32 (*NHTTPPostSend)(const char* label, char** value_p,
u32* length_p, s32 offset, void* userParam);
void* NHTTPi_GetSystemInfoP(void);
NHTTPBgnEndInfo* NHTTPi_GetBgnEndInfoP(void* systemInfo);
void* NHTTPi_GetMutexInfoP(void* systemInfo);
BOOL NHTTPi_Startup(void* systemInfo, NHTTPAlloc alloc, NHTTPFree free,
u32 priority);
void NHTTPi_CleanupAsync(void* systemInfo, NHTTPCleanupCallback callback);
s32 NHTTPi_GetError(NHTTPBgnEndInfo* info);
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_free(void* buffer);
s32 NHTTPi_strlen(const char* string);
void* NHTTPi_memcpy(void* destination, const void* source, u32 size);
void* NHTTPi_memclr(void* destination, u32 size);
s32 NHTTPi_Base64Encode(char* destination, const char* source);
NHTTPConnectionInfo* NHTTPCreateConnection(const char* url, s32 method,
void* buffer, u32 bufferSize, NHTTPConnectionCallback callback,
void* userParam);
s32 NHTTPStartConnection(NHTTPConnectionInfo* connection);
s32 NHTTPGetBodyBuffer(NHTTPConnectionInfo* connection, void** buffer,
u32* bufferSize);
void* NHTTPGetUserParam(NHTTPConnectionInfo* connection);
s32 NHTTPGetConnectionError(NHTTPConnectionInfo* connection);
NHTTPConnectionInfo* NHTTPi_GetConnection(void* mutexInfo,
NHTTPConnectionInfo* connection);
NHTTPRequestInfo* NHTTPi_Connection2Request(void* mutexInfo,
NHTTPConnectionInfo* connection);
NHTTPResponseInfo* NHTTPi_Connection2Response(void* mutexInfo,
NHTTPConnectionInfo* connection);
NHTTPConnectionInfo* NHTTPi_Request2Connection(void* mutexInfo,
NHTTPRequestInfo* request);
NHTTPConnectionInfo* NHTTPi_Response2Connection(void* mutexInfo,
NHTTPResponseInfo* response);
NHTTPRequestInfo* NHTTPi_GetRequest(void* mutexInfo,
NHTTPRequestInfo* request);
NHTTPResponseInfo* NHTTPi_GetResponse(void* mutexInfo,
NHTTPResponseInfo* response);
s32 NHTTPi_OmitConnectionList(void* mutexInfo,
NHTTPConnectionInfo* connection);
u32 NHTTPi_GetVirtualContentLength(NHTTPConnectionInfo* connection);
BOOL NHTTP_AddHeaderField(NHTTPRequestInfo* request, NHTTPBgnEndInfo* info,
const char* name, const char* value);
BOOL NHTTP_AddPostDataAscii(NHTTPRequestInfo* request, NHTTPBgnEndInfo* info,
const char* name, const char* value);
BOOL NHTTP_CancelRequestAsync(void* systemInfo, s32 requestId);
void NHTTP_DestroyRequest(void* systemInfo, NHTTPRequestInfo* request);
void NHTTP_DestroyResponse(void* mutexInfo, NHTTPResponseInfo* response);
static s32 nhttpRegistered = 0;
const char* __NHTTPVersion = "<< RVL_SDK - NHTTP \trelease build: Jun 27 2007 16:27:59 (0x4199_60726) >>";
char __NHTTPUnofficialVersion[] = "<< RVL_SDK - NHTTP \trelease build: Jun 27 2007 16:27:59 (0x4199_60726) UNOFFICIAL >>";
s32 NHTTPStartup(NHTTPAlloc alloc, NHTTPFree free, u32 priority)
{
void* system = NHTTPi_GetSystemInfoP();
if (nhttpRegistered == 0)
{
OSRegisterVersion(__NHTTPVersion);
nhttpRegistered = TRUE;
}
return NHTTPi_Startup(system, alloc, free, priority) ? 0 : -1;
}
void NHTTPCleanupAsync(NHTTPCleanupCallback callback)
{
NHTTPi_CleanupAsync(NHTTPi_GetSystemInfoP(), callback);
}
s32 NHTTPGetError(void)
{
return NHTTPi_GetError(NHTTPi_GetSystemInfoP());
}
static s32 NHTTPi_PostSendCallbackWrap(void* mutexInfo_p,
NHTTPConnectionInfo* connection_p, void* arg_p)
{
if (connection_p != NULL)
{
NHTTPRequestInfo* req_p =
NHTTPi_Connection2Request(mutexInfo_p, connection_p);
if (req_p != NULL)
{
NHTTPPostSend postSend = (NHTTPPostSend)req_p->_unk250;
if (postSend != NULL)
{
NHTTPPostSendArg* postSendArg_p = arg_p;
return postSend(postSendArg_p->label,
&postSendArg_p->buf, &postSendArg_p->size,
postSendArg_p->offset,
NHTTPGetUserParam(connection_p));
}
}
}
return -1;
}
static s32 NHTTPi_BufFullCallbackWrap(void* mutexInfo_p,
NHTTPConnectionInfo* connection_p, void* arg_p)
{
if (connection_p != NULL)
{
NHTTPResponseInfo* res_p =
NHTTPi_Connection2Response(mutexInfo_p, connection_p);
if (res_p != NULL)
{
NHTTPResponseCallback bufFull = res_p->bufFull;
if (bufFull != NULL)
{
NHTTPBodyBufArg* bodyBufArg_p = arg_p;
char* oldBuf_p = bodyBufArg_p->buf;
u32 contentLength =
NHTTPi_GetVirtualContentLength(connection_p);
bodyBufArg_p->buf = bufFull((void**)&oldBuf_p,
&bodyBufArg_p->size, contentLength, NHTTPi_alloc,
NHTTPi_free, NHTTPGetUserParam(connection_p));
if (bodyBufArg_p->buf != NULL && oldBuf_p != NULL)
{
bodyBufArg_p->offset = 0;
}
}
}
}
return 0;
}
static s32 NHTTPi_CompleteCallbackWrap(void* mutexInfo_p,
NHTTPConnectionInfo* connection_p)
{
if (connection_p != NULL)
{
NHTTPReqCallback reqCallback = connection_p->requestCallback;
if (reqCallback != NULL)
{
NHTTPResponseInfo* res_p =
NHTTPi_Connection2Response(mutexInfo_p, connection_p);
if (res_p != NULL)
{
NHTTPErr result = NHTTPGetConnectionError(connection_p);
reqCallback(
result, res_p, NHTTPGetUserParam(connection_p));
}
}
}
return 0;
}
s32 NHTTPi_TemplateConnectionCallback(NHTTPConnectionInfo* handle,
NHTTPConnectionEvent event, void* arg_p)
{
void* sysInfo_p = NHTTPi_GetSystemInfoP();
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
NHTTPConnectionInfo* connection_p =
NHTTPi_GetConnection(mutexInfo_p, handle);
s32 ret = 0;
switch (event)
{
case NHTTP_EVENT_POST_SEND:
ret = NHTTPi_PostSendCallbackWrap(
mutexInfo_p, connection_p, arg_p);
break;
case NHTTP_EVENT_BODY_RECV_FULL:
ret = NHTTPi_BufFullCallbackWrap(
mutexInfo_p, connection_p, arg_p);
break;
case NHTTP_EVENT_BODY_RECV_DONE:
break;
case NHTTP_EVENT_COMPLETE:
ret = NHTTPi_CompleteCallbackWrap(mutexInfo_p, connection_p);
break;
default:
break;
}
return ret;
}
NHTTPRequest* NHTTPCreateRequest(const char* url, NHTTPReqMethod method,
void* buffer, u32 bufferSize, NHTTPReqCallback callback, void* userParam)
{
return NHTTPCreateRequestEx(url, method, buffer, bufferSize, callback, userParam, NULL, NULL);
}
NHTTPRequest* NHTTPCreateRequestEx(const char* url, NHTTPReqMethod method,
void* buffer, u32 bufferSize, NHTTPReqCallback callback, void* userParam,
NHTTPResponseCallback responseCallback, NHTTPResponseCleanup cleanup)
{
void* systemInfo;
void* mutexInfo;
NHTTPConnectionInfo* connection;
NHTTPRequestInfo* request;
connection = NHTTPCreateConnection(url, method, buffer, bufferSize, NHTTPi_TemplateConnectionCallback, userParam);
request = NULL;
if (connection != NULL)
{
systemInfo = NHTTPi_GetSystemInfoP();
mutexInfo = NHTTPi_GetMutexInfoP(systemInfo);
connection = NHTTPi_GetConnection(mutexInfo, connection);
request = NHTTPi_Connection2Request(mutexInfo, connection);
if (request != NULL)
{
if (request->response != NULL)
{
connection->requestCallback = callback;
request->response->bufFull = responseCallback;
request->response->freeBuf = cleanup;
return request;
}
else
{
NHTTP_DestroyRequest(systemInfo, request);
NHTTPi_OmitConnectionList(mutexInfo, connection);
NHTTPi_free(connection);
request = NULL;
}
}
}
return request;
}
s32 NHTTPDeleteRequest(NHTTPRequest* request)
{
NHTTPConnectionInfo* connection = NHTTPi_Request2Connection(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), request);
if (connection != NULL)
{
NHTTPDeleteConnection(connection);
}
}
s32 NHTTPAddHeaderField(NHTTPRequest* handle, const char* name,
const char* value)
{
void* systemInfo;
NHTTPRequestInfo* request;
void* bgnEndInfo;
systemInfo = NHTTPi_GetSystemInfoP();
request = NHTTPi_GetRequest(NHTTPi_GetMutexInfoP(systemInfo), handle);
bgnEndInfo = NHTTPi_GetBgnEndInfoP(systemInfo);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
static char name[] = "NHTTPAddHeaderField";
printf("%s can be called before NHTTPStartConnection()\n", name);
return -1;
}
return NHTTP_AddHeaderField(request, bgnEndInfo, name, value) ? 0 : -1;
}
s32 NHTTPAddPostDataAscii(NHTTPRequest* handle, const char* name,
const char* value)
{
NHTTPRequestInfo* request;
void* bgnEndInfo;
bgnEndInfo = NHTTPi_GetBgnEndInfoP(NHTTPi_GetSystemInfoP());
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
printf("%s can be called before NHTTPStartConnection()\n",
"NHTTPAddPostDataAscii");
return -1;
}
return NHTTP_AddPostDataAscii(request, bgnEndInfo, name, value)
? 0
: -1;
}
s32 NHTTPAddPostDataBinary(NHTTPRequest* handle, const char* name,
const char* value)
{
NHTTPRequestInfo* request;
void* bgnEndInfo;
bgnEndInfo = NHTTPi_GetBgnEndInfoP(NHTTPi_GetSystemInfoP());
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
printf("%s can be called before NHTTPStartConnection()\n",
"NHTTPAddPostDataBinary");
return -1;
}
return NHTTP_AddPostDataAscii(request, bgnEndInfo, name, value)
? 0
: -1;
}
s32 NHTTPAddPostDataRaw(NHTTPRequest* handle, const void* data,
u32 size, const char* label)
{
NHTTPRequestInfo* request;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
printf("%s can be called before NHTTPStartConnection()\n",
"NHTTPAddPostDataRaw");
return -1;
}
if (request->postData != NULL)
{
printf("already called NHTTPAddPostDataAscii or NHTTPAddPostDataBinary (exclusive fucntion)\n");
return -1;
}
request->isRawData = TRUE;
request->postBuffer = data;
request->postBufferSize = size;
return 0;
}
s32 NHTTPSetPostDataEncoding(NHTTPRequest* handle, u32 encodingType)
{
NHTTPRequestInfo* request;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
printf("%s can be called before NHTTPStartConnection()\n",
"NHTTPSetPostDataEncoding");
return -1;
}
request->encodingType = encodingType;
return 0;
}
NHTTPConnection NHTTPSendRequestAsync(NHTTPRequest* request)
{
NHTTPConnectionInfo* connection;
s32 result;
connection = NHTTPi_Request2Connection(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), request);
if (connection != NULL && NHTTPStartConnection(connection) == 0)
{
result = connection->requestId;
}
else
{
result = -1;
}
return result;
}
s32 NHTTPCancelRequestAsync(NHTTPConnection connection)
{
return NHTTP_CancelRequestAsync(NHTTPi_GetSystemInfoP(), connection)
? 0
: -1;
}
s32 NHTTPGetProgress(u32* complete, u32* total)
{
s32 result;
result = NHTTP_GetProgress(NHTTPi_GetSystemInfoP(), complete, total)
== 0;
return -result;
}
void NHTTPDestroyResponse(NHTTPResponse* handle)
{
void* mutexInfo;
NHTTPConnectionInfo* connection;
mutexInfo = NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP());
connection = NHTTPi_Response2Connection(mutexInfo, handle);
if (connection != NULL)
{
if (NHTTPi_Connection2Response(mutexInfo, connection) != NULL)
{
NHTTP_DestroyResponse(mutexInfo, connection->response);
}
NHTTPi_OmitConnectionList(mutexInfo, connection);
NHTTPi_free(connection);
}
}
s32 NHTTPGetHeaderField(NHTTPResponse* response, const char* name,
const char** value)
{
void* mutexInfo;
NHTTPResponseInfo* res;
mutexInfo = NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP());
res = NHTTPi_GetResponse(mutexInfo, response);
if (res == NULL)
{
return -1;
}
return NHTTP_GetHeaderField(res, name, value);
}
s32 NHTTPGetHeaderAll(NHTTPResponse* response, const char** header)
{
void* systemInfo;
NHTTPBgnEndInfo* bgnEndInfo;
NHTTPResponseInfo* res;
systemInfo = NHTTPi_GetSystemInfoP();
bgnEndInfo = NHTTPi_GetBgnEndInfoP(systemInfo);
res = NHTTPi_GetResponse(NHTTPi_GetMutexInfoP(systemInfo), response);
if (res == NULL)
{
return -1;
}
return NHTTP_GetHeaderAll(bgnEndInfo, res, header);
}
s32 NHTTPGetBodyAll(NHTTPResponse* response, void** buffer)
{
NHTTPConnectionInfo* connection;
u32 bufferSize;
s32 result;
connection = NHTTPi_Response2Connection(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), response);
if (connection != NULL)
{
bufferSize = 0;
result = NHTTPGetBodyBuffer(connection, buffer, &bufferSize);
}
else
{
result = -1;
}
return result;
}
s32 NHTTPGetResultCode(NHTTPResponse* handle)
{
NHTTPResponseInfo* response;
response = NHTTPi_GetResponse(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (response == NULL)
return -1;
if (response->isHeaderParse != FALSE)
return response->httpStatus;
return -1;
}
s32 NHTTPSetVerifyOption(NHTTPRequest* handle, u32 option)
{
NHTTPRequestInfo* request;
s32 result;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
result = -1;
}
else
{
request->verifyOption = option;
result = 0;
}
return result;
}
s32 NHTTPSetProxy(NHTTPRequest* handle, const char* proxy_p, u16 port,
const char* username_p, const char* password_p)
{
void* sysInfo_p = NHTTPi_GetSystemInfoP();
void* mutexInfo_p = NHTTPi_GetMutexInfoP(sysInfo_p);
NHTTPRequestInfo* req_p = NHTTPi_GetRequest(mutexInfo_p, handle);
s32 proxyLen = 0;
if (req_p == NULL || proxy_p == NULL)
{
return -1;
}
proxyLen = NHTTPi_strlen(proxy_p);
if (proxyLen > 0x100)
{
printf("proxy-address exceeded 256 characters\n");
return -1;
}
NHTTPi_memcpy(req_p->proxyServer, proxy_p, proxyLen);
req_p->proxyPort = port;
if (username_p != NULL && password_p != NULL)
{
s32 username_len;
s32 password_len;
char tmpbuf[0x41];
username_len = NHTTPi_strlen(username_p);
password_len = NHTTPi_strlen(password_p);
if (username_len > 0x20)
{
printf("username exceeded 32 characters\n");
return -1;
}
if (password_len > 0x20)
{
printf("password exceeded 32 characters\n");
return -1;
}
NHTTPi_memclr(tmpbuf, sizeof(tmpbuf));
NHTTPi_memcpy(tmpbuf, username_p, username_len);
NHTTPi_memcpy(&(tmpbuf[username_len]), ":", 1);
NHTTPi_memcpy(
&(tmpbuf[(username_len + 1)]), password_p, password_len);
req_p->proxyAuthorizationLength =
NHTTPi_Base64Encode(req_p->proxyAuthorization, tmpbuf);
}
req_p->proxyEnabled = TRUE;
return 0;
}
s32 NHTTPSetProxyDefault(NHTTPRequest* handle)
{
NCDProxyServerProfile* proxy;
void* systemInfo;
NHTTPBgnEndInfo* bgnEndInfo;
NHTTPRequestInfo* request;
const char* username;
const char* password;
s32 result;
systemInfo = NHTTPi_GetSystemInfoP();
request = NHTTPi_GetRequest(NHTTPi_GetMutexInfoP(systemInfo), handle);
bgnEndInfo = NHTTPi_GetBgnEndInfoP(systemInfo);
if (request->secure != FALSE)
{
proxy = &bgnEndInfo->ipConfig.proxy.ssl;
}
else
{
proxy = &bgnEndInfo->ipConfig.proxy.http;
}
if (proxy->mode == 1)
{
username = NULL;
password = NULL;
if (proxy->authType == 1)
{
username = proxy->username;
password = proxy->password;
}
OSReport("Using proxy server %s:%d (%s/%s).\n", proxy->server, proxy->port, username != NULL ? username : "[no-auth]", password != NULL ? password : "[no-auth]");
result = NHTTPSetProxy(request, proxy->server, proxy->port, username, password);
if (result < 0)
{
OSReport("NHTTPSetProxy failed.(%d)\n", result);
OSPanic("d_nhttp.c", 0x37d, "NHTTPSetProxy");
}
else
{
return 0;
}
}
else
{
printf("NCD proxy-settings are disabled\n");
}
return -1;
}
s32 NHTTPSetRootCADefault(NHTTPRequest* handle)
{
s32 result;
NHTTPRequestInfo* request;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
result = -1;
}
else
{
request->builtinRootCA = FALSE;
request->rootCAData = NULL;
request->rootCASize = 0;
result = 0;
}
return result;
}
s32 NHTTPSetClientCertDefault(NHTTPRequest* handle)
{
s32 result;
NHTTPRequestInfo* request;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
result = -1;
}
else
{
request->builtinClientCert = FALSE;
request->clientCertDefault = TRUE;
request->clientCertData = NULL;
request->clientCertSize = 0;
request->privateKeyData = NULL;
request->privateKeySize = 0;
result = 0;
}
return result;
}
s32 NHTTPDisableVerifyOptionForDebug(NHTTPRequest* handle, u32 option)
{
NHTTPRequestInfo* request;
request = NHTTPi_GetRequest(
NHTTPi_GetMutexInfoP(NHTTPi_GetSystemInfoP()), handle);
if (request == NULL)
{
return -1;
}
if (request->state != 0)
{
printf("%s can be called before NHTTPStartConnection()\n",
"NHTTPDisableVerifyOptionForDebug");
return -1;
}
{
static s32 debugSet;
if (debugSet == 0)
{
debugSet = 1;
}
}
request->verifyOption &= ~option;
return 0;
}

View File

@@ -1,421 +0,0 @@
#include <private/nhttp.h>
#include <stdio.h>
typedef struct NHTTPSysInfo
{
u8 bgnEndInfo[0x800];
NHTTPListInfo listInfo;
NHTTPReqInfo reqInfo;
u8 mutexInfo[0x34];
u8 threadInfo[0x460];
} NHTTPSysInfo;
typedef struct NHTTPStaticResource
{
BOOL initialized;
OSMutex mutex;
OSCond cond;
u32 _unk24;
u8 _unk28[0x18];
} NHTTPStaticResource;
static NHTTPSysInfo sysInfo;
static NHTTPSysInfo* sysInfo_p;
static NHTTPConnectionInfo* sConnectionList;
static NHTTPStaticResource NHTTPiStaticResource;
void NHTTPi_lockReqList(void* mutexInfo);
void NHTTPi_unlockReqList(void* mutexInfo);
void NHTTPi_InitBgnEndInfo(NHTTPBgnEndInfo* info);
void NHTTPi_InitListInfo(NHTTPListInfo* info);
void NHTTPi_InitRequestInfo(NHTTPReqInfo* info);
void NHTTPi_InitMutexInfo(void* info);
void NHTTPi_InitThreadInfo(void* info);
NHTTPBgnEndInfo* NHTTPi_GetBgnEndInfoP(NHTTPSysInfo* sysInfo_p);
NHTTPListInfo* NHTTPi_GetListInfoP(NHTTPSysInfo* sysInfo_p);
NHTTPReqInfo* NHTTPi_GetReqInfoP(NHTTPSysInfo* sysInfo_p);
void* NHTTPi_GetThreadInfoP(NHTTPSysInfo* sysInfo_p);
void* NHTTPi_GetMutexInfoP(NHTTPSysInfo* sysInfo_p);
void NHTTPi_WaitForCompletion(NHTTPConnectionInfo* connection)
{
NHTTPStaticResource* res_p = &NHTTPiStaticResource;
if (!res_p->initialized)
{
OSInitMutex(&res_p->mutex);
OSInitCond(&res_p->cond);
res_p->initialized = TRUE;
}
OSLockMutex(&res_p->mutex);
while (connection->_unkC != 0)
{
OSWaitCond(&res_p->cond, &res_p->mutex);
}
OSUnlockMutex(&res_p->mutex);
}
void NHTTPi_NotifyCompletion(NHTTPConnectionInfo* connection)
{
NHTTPStaticResource* res_p = &NHTTPiStaticResource;
if (!res_p->initialized)
{
OSInitMutex(&res_p->mutex);
OSInitCond(&res_p->cond);
res_p->initialized = TRUE;
}
OSLockMutex(&res_p->mutex);
connection->_unkC = 0;
OSSignalCond(&res_p->cond);
OSUnlockMutex(&res_p->mutex);
}
NHTTPConnectionInfo* NHTTPi_ControlConnectionList(void* mutexInfo,
void* handle, u32 mode)
{
NHTTPConnectionInfo* connection;
NHTTPConnectionInfo* result;
NHTTPConnectionInfo** current;
result = NULL;
NHTTPi_lockReqList(mutexInfo);
if (mode == 3)
{
connection = handle;
connection->next = sConnectionList;
sConnectionList = connection;
result = connection;
}
else
{
current = &sConnectionList;
while (*current != NULL)
{
connection = *current;
switch (mode)
{
case 0:
if (connection == handle)
{
result = connection;
}
break;
case 1:
if (connection->request == handle)
{
result = connection;
}
break;
case 2:
if (connection->response == handle)
{
result = connection;
}
break;
case 4:
if (connection == handle)
{
*current = connection->next;
result = connection;
}
break;
}
if (result != NULL)
{
break;
}
current = &(*current)->next;
}
}
NHTTPi_unlockReqList(mutexInfo);
return result;
}
s32 NHTTPi_CommitConnectionList(void* mutexInfo_p,
NHTTPConnectionInfo* connection_p)
{
return ((NHTTPi_ControlConnectionList(mutexInfo_p, connection_p, 3)
!= NULL)
? 0
: -1);
}
s32 NHTTPi_OmitConnectionList(void* mutexInfo_p,
NHTTPConnectionInfo* connection_p)
{
return ((NHTTPi_ControlConnectionList(mutexInfo_p, connection_p, 4)
!= NULL)
? 0
: -1);
}
NHTTPRequestInfo* NHTTPi_Connection2Request(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
connection = NHTTPi_ControlConnectionList(mutexInfo, connection, 0);
return connection != NULL ? connection->request : NULL;
}
NHTTPResponseInfo* NHTTPi_Connection2Response(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
connection = NHTTPi_ControlConnectionList(mutexInfo, connection, 0);
return connection != NULL ? connection->response : NULL;
}
NHTTPConnectionInfo* NHTTPi_Request2Connection(void* mutexInfo,
NHTTPRequestInfo* request)
{
return NHTTPi_ControlConnectionList(
mutexInfo, request, 1);
}
NHTTPConnectionInfo* NHTTPi_Response2Connection(void* mutexInfo,
NHTTPResponseInfo* response)
{
return NHTTPi_ControlConnectionList(
mutexInfo, response, 2);
}
NHTTPConnectionInfo* NHTTPi_GetConnection(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
return NHTTPi_ControlConnectionList(mutexInfo, connection, 0);
}
NHTTPRequestInfo* NHTTPi_GetRequest(void* mutexInfo,
NHTTPRequestInfo* request)
{
NHTTPConnectionInfo* connection;
connection = NHTTPi_ControlConnectionList(
mutexInfo, request, 0);
return connection != NULL ? connection->request : request;
}
NHTTPResponseInfo* NHTTPi_GetResponse(void* mutexInfo,
NHTTPResponseInfo* response)
{
NHTTPConnectionInfo* connection;
connection = NHTTPi_ControlConnectionList(
mutexInfo, response, 0);
return connection != NULL ? connection->response : response;
}
s32 NHTTPi_GetConnectionListLength(void)
{
NHTTPConnectionInfo* connection;
s32 length;
connection = sConnectionList;
length = 0;
while (connection != NULL)
{
connection = connection->next;
length++;
}
return length;
}
s32 NHTTPi_PostSendCallback(void* mutexInfo,
NHTTPConnectionInfo* connection, void* value, u32 arg)
{
u32 callbackArg4;
u32 callbackArg8;
s32 result;
NHTTPResponseInfo* response;
NHTTPConnectionCallbackParam param;
result = -1;
if (NHTTPi_GetConnection(mutexInfo, connection) != NULL)
{
response = NHTTPi_Connection2Response(mutexInfo, connection);
if (response != NULL && connection->callback != NULL)
{
param.value = value;
param._unk4 = connection->_unk24;
param._unk8 = connection->_unk28;
param._unkC = arg;
result = connection->callback(connection, 1, &param);
callbackArg8 = param._unk8;
callbackArg4 = param._unk4;
connection = NHTTPi_GetConnection(mutexInfo, connection);
if (connection != NULL)
{
connection->_unk24 = callbackArg4;
connection->_unk28 = callbackArg8;
}
}
}
return result;
}
void NHTTPi_BufferFullCallback(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
void* buffer;
u32 bufferSize;
s32 responseResult;
NHTTPResponseInfo* response;
NHTTPConnectionCallbackParam param;
if (NHTTPi_GetConnection(mutexInfo, connection) != NULL)
{
response = NHTTPi_Connection2Response(mutexInfo, connection);
if (response != NULL && connection->callback != NULL)
{
param.value = response->recvBuf_p;
param._unk4 = response->recvBufLen;
param._unk8 = response->bodyLen;
connection->callback(connection, 2, &param);
responseResult = param._unk8;
bufferSize = param._unk4;
buffer = param.value;
connection = NHTTPi_GetConnection(mutexInfo, connection);
if (connection != NULL)
{
response = NHTTPi_Connection2Response(mutexInfo, connection);
if (response != NULL)
{
response->recvBuf_p = buffer;
response->recvBufLen = bufferSize;
response->bodyLen = responseResult;
}
}
}
}
}
void NHTTPi_ReceivedCallback(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
void* buffer;
u32 bufferSize;
s32 responseResult;
NHTTPResponseInfo* response;
NHTTPConnectionCallbackParam param;
if (NHTTPi_GetConnection(mutexInfo, connection) != NULL)
{
response = NHTTPi_Connection2Response(mutexInfo, connection);
if (response != NULL && connection->callback != NULL)
{
param.value = response->recvBuf_p;
param._unk4 = response->recvBufLen;
param._unk8 = response->bodyLen;
connection->callback(connection, 3, &param);
responseResult = param._unk8;
bufferSize = param._unk4;
buffer = param.value;
connection = NHTTPi_GetConnection(mutexInfo, connection);
if (connection != NULL)
{
response = NHTTPi_Connection2Response(mutexInfo, connection);
if (response != NULL)
{
response->recvBuf_p = buffer;
response->recvBufLen = bufferSize;
response->bodyLen = responseResult;
}
}
}
}
}
void NHTTPi_CompleteCallback(void* mutexInfo,
NHTTPConnectionInfo* connection)
{
if (NHTTPi_GetConnection(mutexInfo, connection) != NULL
&& connection->callback != NULL)
{
connection->callback(connection, 4, NULL);
}
}
static void NHTTPi_InitSystemInfo(NHTTPSysInfo* sysInfo_p)
{
NHTTPi_InitBgnEndInfo(NHTTPi_GetBgnEndInfoP(sysInfo_p));
NHTTPi_InitListInfo(NHTTPi_GetListInfoP(sysInfo_p));
NHTTPi_InitRequestInfo(NHTTPi_GetReqInfoP(sysInfo_p));
NHTTPi_InitMutexInfo(NHTTPi_GetMutexInfoP(sysInfo_p));
NHTTPi_InitThreadInfo(NHTTPi_GetThreadInfoP(sysInfo_p));
}
NHTTPSysInfo* NHTTPi_GetSystemInfoP(void)
{
if (sysInfo_p == NULL)
{
sysInfo_p = &sysInfo;
NHTTPi_InitSystemInfo(sysInfo_p);
}
return sysInfo_p;
}
NHTTPBgnEndInfo* NHTTPi_GetBgnEndInfoP(NHTTPSysInfo* sysInfo_p)
{
return (NHTTPBgnEndInfo*)sysInfo_p->bgnEndInfo;
}
NHTTPListInfo* NHTTPi_GetListInfoP(NHTTPSysInfo* sysInfo_p)
{
return &sysInfo_p->listInfo;
}
NHTTPReqInfo* NHTTPi_GetReqInfoP(NHTTPSysInfo* sysInfo_p)
{
return &sysInfo_p->reqInfo;
}
void* NHTTPi_GetThreadInfoP(NHTTPSysInfo* sysInfo_p)
{
return sysInfo_p->threadInfo;
}
void* NHTTPi_GetMutexInfoP(NHTTPSysInfo* sysInfo_p)
{
return sysInfo_p->mutexInfo;
}
void NHTTPi_SetVirtualContentLength(NHTTPConnectionInfo* connection,
u32 length)
{
if (connection != NULL)
{
connection->virtualContentLength = length;
}
}
u32 NHTTPi_GetVirtualContentLength(NHTTPConnectionInfo* connection)
{
return connection != NULL ? connection->virtualContentLength : 0;
}
void NHTTPi_InitConnectionList(void)
{
NHTTPConnectionInfo* connection;
s32 count;
connection = sConnectionList;
if (connection != NULL)
{
count = 0;
while (connection != NULL)
{
connection = connection->next;
count++;
}
if (count != 0)
{
printf("*warning: %d connections rests! Please free connections.\n",
count);
}
}
sConnectionList = NULL;
}

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,796 +0,0 @@
#define MYTIINPUTFORM_IMPLEMENTATION
#include "keyboard/MyTiInputForm.h"
#include "keyboard/tiUtil.h"
#include <nw4r/lyt/group.h>
#include <nw4r/lyt/material.h>
#include <nw4r/lyt/textbox.h>
#include <new>
namespace textinput {
namespace inputform {
class EventHandler : public nw4rmanager::TiEventHandler {
public:
EventHandler(textinput::InputForm* form) : mpInputForm(form) {}
virtual ~EventHandler() {}
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
protected:
textinput::InputForm* mpInputForm;
};
}
namespace extend {
namespace memo {
class AnmPane : public nw4rmanager::AnmPane {
protected:
AnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer)
: nw4rmanager::AnmPane(pane, observer), meState(0) {}
public:
virtual ~AnmPane();
virtual void init();
virtual void changeAnimation(u32 id);
virtual u32 getState();
virtual u32 getKeyType() const;
protected:
u32 meState;
u32 meKeyType;
};
class WholePane : public AnmPane {
public:
WholePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 0; }
virtual ~WholePane() {}
virtual void onAnmEvent(AnmPaneEvent event);
};
class NigaoePane : public AnmPane {
public:
NigaoePane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : AnmPane(pane, observer) { meKeyType = 1; }
virtual ~NigaoePane() {}
virtual void onAnmEvent(AnmPaneEvent event);
};
class SimpleAnmPane : public nw4rmanager::AnmPane {
public:
SimpleAnmPane(nw4r::lyt::Pane* pane, nw4rmanager::AnmObserver* observer) : nw4rmanager::AnmPane(pane, observer) {}
virtual ~SimpleAnmPane() {}
virtual void init();
virtual void changeAnimation(u32 id);
};
class ScrollButton {
public:
ScrollButton(TiLayout* layout) : muGroup(0), muAnimation(0), mpLayout(layout), mbLeftPressed(false), mbRightPressed(false) {}
virtual void create(MEMAllocator*, nw4r::lyt::MultiArcResourceAccessor*);
virtual void init();
virtual void calc();
virtual void changeAnimation(bool left, u32 id);
private:
u32 muGroup;
u32 muAnimation;
TiLayout* mpLayout;
nw4rmanager::AnimPaneGroup* mGroups[9];
bool mbGroupChanged[9];
bool mbLeftPressed;
bool mbRightPressed;
};
class EventHandler : public inputform::EventHandler {
public:
EventHandler(InputForm* form) : inputform::EventHandler(form), mpMemoForm(form) {}
virtual ~EventHandler() {}
virtual void onTiEvent(gui::PaneComponent*, u32, Input*);
private:
InputForm* mpMemoForm;
};
static const char* scPaneName[] = {
"N_Header", "N_Body", "B_Body", "N_Footer", "Nigaoe",
"T_Nigaoe", "B_Nigaoe", "T_Letter", "T_TouchLetter"
};
struct AnimationFile {
u32 id;
char name[64];
};
static const AnimationFile csAninationFile[] = {
{0, "my_Memo_a_normal.brlan"},
{1, "my_Memo_a_MailIn.brlan"},
{2, "my_Memo_a_MailOut.brlan"},
{3, "my_Memo_a_SendOut.brlan"},
{4, "my_Memo_a_NigaoeFoucusIn.brlan"},
{5, "my_Memo_a_NigaoeFoucusOut.brlan"}
};
struct PaneAnimations {
u32 type;
const char* paneName;
u32 count;
const AnimationFile* animations[12];
};
static const PaneAnimations csPaneToAnimation[] = {
{0, "N_Memo", 4, {&csAninationFile[0], &csAninationFile[1], &csAninationFile[2], &csAninationFile[3]}},
{1, "Nigaoe", 2, {&csAninationFile[4], &csAninationFile[5]}}
};
static const AnimationFile csGroupAninationFile[] = {
{0, "my_Memo_a_Off.brlan"},
{1, "my_Memo_a_Appear.brlan"},
{2, "my_Memo_a_Lost.brlan"},
{3, "my_Memo_a_HDActionEnd.brlan"},
{4, "my_Memo_a_HDActionStart.brlan"},
{5, "my_Memo_a_Loop.brlan"},
{6, "my_Memo_a_Select.brlan"},
{7, "my_Memo_a_FocusOff.brlan"},
{8, "my_Memo_a_FocusOn.brlan"}
};
struct GroupAnimations {
u32 group;
u32 animations[3];
};
static const GroupAnimations csGroupToAnimation[] = {
{0, {5, 9, 9}}, {1, {8, 7, 9}}, {2, {8, 7, 9}},
{3, {6, 9, 9}}, {4, {6, 9, 9}}, {5, {2, 1, 9}},
{6, {2, 1, 9}}, {7, {4, 3, 9}}, {8, {4, 3, 9}}
};
InputForm::~InputForm() {
mpSendString->~Decolated();
MEMFreeToAllocator(mpAllocator, mpSendString);
MEMFreeToAllocator(mpAllocator, mpDefaultNigaoe);
}
void InputForm::setAddScroll(f32 scroll, bool up, bool down) {
setScroll(mfScroll + scroll);
if (up && !mbScrollUp) {
mpScrollButton->changeAnimation(false, 4);
} else if (down && !mbScrollDown) {
mpScrollButton->changeAnimation(true, 4);
}
if (!up && mbScrollUp) {
mpScrollButton->changeAnimation(false, 3);
} else if (!down && mbScrollDown) {
mpScrollButton->changeAnimation(true, 3);
}
mbScrollUp = up;
mbScrollDown = down;
}
void InputForm::moveCursorUp() {
f32 y = 1.0f + (mfCursorY - getLineHeight());
if (y <= 0.0f) {
u32 start, end;
mpString->getCursorPos(&start, &end);
if (start == 0 && end == 0) onSE(sound::SE_CHAR_CURSOR_FIX);
else onSE(sound::SE_CHAR_CURSOR);
setCursorPos(mpString, 0);
} else {
setCursorPos(mpString, calcCursorPos(mfCursorX, y - mfScroll));
onSE(sound::SE_CHAR_CURSOR);
}
meScrollFlag = SF_ScrollOn;
}
void InputForm::moveCursorDown() {
f32 y = 1.0f + (mfCursorY + getLineHeight());
if (y / getLineHeight() >= getLine()) {
u32 start, end;
mpString->getCursorPos(&start, &end);
if (start == mpString->getLength() && end == mpString->getLength()) onSE(sound::SE_CHAR_CURSOR_FIX);
else onSE(sound::SE_CHAR_CURSOR);
setCursorPos(mpString, mpString->getLength());
} else {
setCursorPos(mpString, calcCursorPos(mfCursorX, y - mfScroll));
onSE(sound::SE_CHAR_CURSOR);
}
meScrollFlag = SF_ScrollOn;
}
void InputForm::onCommand(INPUT_COMMAND command, void* data) {
if (meEditMode == EM_Edit) onCommandOnEditMode(command, data);
else if (meEditMode == EM_Disp) onCommandOnDispMode(command, data);
else {
switch (command) {
case 6: case 21: case 29: case 31:
textinput::InputForm::onCommand(command, data);
break;
case 7: case 8: case 9: case 10: case 11: case 12: case 13:
case 14: case 15: case 16: case 17: case 18: case 19: case 20:
case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 30:
break;
}
}
}
void InputForm::onCommandOnEditMode(INPUT_COMMAND command, void* data) {
switch (command) {
case 24:
if (!mExScrollAnm.isActive()) {
if (static_cast<Scroll*>(data)->y < 0.0f)
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll + getLineHeight(), 15.0f, NULL);
else
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll - getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
break;
default:
textinput::InputForm::onCommand(command, data);
break;
}
}
void InputForm::onCommandOnDispMode(INPUT_COMMAND command, void* data) {
switch (command) {
case 14: {
nw4r::math::VEC2 position = getGlobalLeftTopPos();
nw4r::math::VEC2* point = static_cast<nw4r::math::VEC2*>(data);
int line = (point->y - position.y) / getLineHeight();
if (line > getLine() - 1) line = getLine() - 1;
if (getLine() > 1 && line >= getLine() - 1) line = getLine() - 2;
mfScrollFrom = mfScroll;
mfScrollTo = line * getLineHeight();
nw4r::math::VEC2 editPoint;
editPoint.x = point->x;
editPoint.y = point->y - mfScroll;
textinput::InputForm::onCommand(static_cast<INPUT_COMMAND>(14), &editPoint);
int relationLine = line;
struct Relation { int type; int* line; } relation = {0, &relationLine};
textinput::InputForm::onCommand(INPUT_COMMAND_37, &relation);
mbEdited = true;
candidatebox::CandidateBoxCaller::resetCandidate();
candidatebox::CandidateBoxCaller::makeEmptyCandidate();
break;
}
case 29: case 31: case 41:
textinput::InputForm::onCommand(command, data);
break;
}
}
void InputForm::create(MEMAllocator* allocator, inputform::EditBuffer* editBuffer) {
textinput::InputForm::create(allocator, editBuffer);
void* stringMemory = MEMAllocFromAllocator(allocator, sizeof(tistring::Decolated));
mpSendString = new (stringMemory) tistring::Decolated(1024);
mpSendString->create(allocator);
MEMFreeToAllocator(allocator, mpInputEventHandler);
void* handlerMemory = MEMAllocFromAllocator(allocator, sizeof(EventHandler));
mpInputEventHandler = new (handlerMemory) EventHandler(this);
mpInputEventHandler->setEventObserver(mpEventObserver);
mpPaneManager->changeEventHandler(mpInputEventHandler);
mpDefaultNigaoe = static_cast<GXTexObj*>(MEMAllocFromAllocator(allocator, sizeof(GXTexObj)));
getNigaoePaneMaterial()->GetTexture(mpDefaultNigaoe, 0);
setVisible("P_2l_TextBox", true);
mpBoundPane = mpLayout->GetRootPane()->FindPaneByName("T_2l_TextBox", true);
mDefaultBoundTrans = mpBoundPane->GetTranslate();
mDefaultBoundSize = mpBoundPane->GetSize();
mpDrawPane = mpLayout->GetRootPane()->FindPaneByName("B_2l_TextBox", true);
mpPaneManager->getPaneComponentByPane(mpDrawPane)->setTriggerTarget(false);
mDrawRect = mpDrawPane->GetPaneRect(mDrawInfo);
mDefaultDrawTrans = mpDrawPane->GetTranslate();
mDefaultDrawSize = mpDrawPane->GetSize();
mpMemoPane = mpLayout->GetRootPane()->FindPaneByName("N_Memo", true);
mpMemoRootPane = mpLayout->GetRootPane()->FindPaneByName("N_MemoRoot", true);
setScroll(0.0f);
mnLine = 1;
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
PSMTXIdentity(mDrawMtx);
PSMTXIdentity(mBoundMtx);
createAnimation(allocator);
void* scrollMemory = MEMAllocFromAllocator(allocator, sizeof(ScrollButton));
mpScrollButton = new (scrollMemory) ScrollButton(mpLayout);
mpScrollButton->create(allocator, mpMultiArcResourceAccessor);
}
void InputForm::createAnimation(MEMAllocator* allocator) {
for (u16 i = 0; i < 2; i++) {
const PaneAnimations& entry = csPaneToAnimation[i];
AnmPane* pane = NULL;
switch (entry.type) {
case 0: {
void* memory = MEMAllocFromAllocator(allocator, sizeof(WholePane));
pane = new (memory) WholePane(getPane(entry.paneName), NULL);
break;
}
case 1: {
void* memory = MEMAllocFromAllocator(allocator, sizeof(NigaoePane));
pane = new (memory) NigaoePane(getPane(entry.paneName), NULL);
break;
}
}
nw4r::ut::List_Append(&mAnmPanes, pane);
for (u16 j = 0; j < entry.count; j++) {
const void* resource = mpMultiArcResourceAccessor->GetResource(0, entry.animations[j]->name, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(getLayout()->CreateAnimTransform(resource, mpMultiArcResourceAccessor));
pane->addAnimation(allocator, entry.animations[j]->id, transform, false, true);
}
}
}
AnmPane::~AnmPane() {}
static const char* csGroupName[] = {
"G_ArwRoop", "G_ArwR_Focus", "G_ArwL_Focus", "G_ArwR_Ac", "G_ArwL_Ac",
"G_ArwL_End", "G_ArwR_End", "G_ArwL_HDAc", "G_ArwR_HDAc"
};
void ScrollButton::create(MEMAllocator* allocator, nw4r::lyt::MultiArcResourceAccessor* accessor) {
for (int i = 0; i < 9; i++) {
mbGroupChanged[i] = false;
nw4r::lyt::Group* group = mpLayout->GetGroupContainer()->FindGroupByName(csGroupName[i]);
void* groupMemory = MEMAllocFromAllocator(allocator, sizeof(nw4rmanager::AnimPaneGroup));
mGroups[i] = new (groupMemory) nw4rmanager::AnimPaneGroup(group);
nw4r::lyt::PaneLinkList& panes = group->GetPaneList();
for (nw4r::lyt::PaneLinkList::Iterator it = panes.GetBeginIter(); it != panes.GetEndIter(); ++it) {
void* memory = MEMAllocFromAllocator(allocator, sizeof(SimpleAnmPane));
SimpleAnmPane* pane = new (memory) SimpleAnmPane(it->mTarget, NULL);
for (u16 j = 0; j < 3; j++) {
int id = csGroupToAnimation[i].animations[j];
if (id != 9) {
const void* resource = accessor->GetResource(0, csGroupAninationFile[id].name, NULL);
AnimTransformPane* transform = static_cast<AnimTransformPane*>(mpLayout->CreateAnimTransform(resource, accessor));
bool loop = false;
if (id == 5) loop = true;
pane->addAnimation(allocator, id, transform, loop, false);
}
}
mGroups[i]->addAnimPane(pane);
}
}
changeAnimation(true, 5);
changeAnimation(false, 5);
changeAnimation(true, 2);
changeAnimation(false, 2);
for (int i = 0; i < 10; i++) calc();
}
void ScrollButton::calc() {
for (int i = 0; i < 9; i++) mGroups[i]->calc();
}
void ScrollButton::changeAnimation(bool left, u32 id) {
muAnimation = id;
if (left) {
switch (id) {
case 0: muGroup = 0; break;
case 1: muGroup = 5; break;
case 2: muGroup = 5; break;
case 3: if (!mbLeftPressed) return; muGroup = 8; mbLeftPressed = false; break;
case 4: if (mbLeftPressed) return; muGroup = 8; mbLeftPressed = true; break;
case 5: muGroup = 0; break;
case 6: muGroup = 4; break;
case 7: muGroup = 2; break;
case 8: muGroup = 2; break;
}
} else {
switch (id) {
case 0: muGroup = 0; break;
case 1: muGroup = 6; break;
case 2: muGroup = 6; break;
case 3: if (!mbRightPressed) return; muGroup = 7; mbRightPressed = false; break;
case 4: if (mbRightPressed) return; muGroup = 7; mbRightPressed = true; break;
case 5: muGroup = 0; break;
case 6: muGroup = 3; break;
case 7: muGroup = 1; break;
case 8: muGroup = 1; break;
}
}
mbGroupChanged[muGroup] = true;
mGroups[muGroup]->changeAnimation(id);
}
void InputForm::onArrowRPoint() {
if (meEditMode == EM_Disp) {
mpScrollButton->changeAnimation(false, 8);
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onArrowRLeft() {
if (meEditMode == EM_Disp) mpScrollButton->changeAnimation(false, 7);
}
void InputForm::onArrowLPoint() {
if (meEditMode == EM_Disp) {
mpScrollButton->changeAnimation(true, 8);
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onArrowLLeft() {
if (meEditMode == EM_Disp) mpScrollButton->changeAnimation(true, 7);
}
void InputForm::onArrowRTrig() {
if (meEditMode == EM_Disp && !mExScrollAnm.isActive()) {
mpScrollButton->changeAnimation(false, 6);
f32 scroll = mfScroll - 3.0f * getLineHeight();
if (scroll <= getScrollMin()) scroll = getScrollMin();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
void InputForm::onArrowLTrig() {
if (meEditMode == EM_Disp && !mExScrollAnm.isActive()) {
mpScrollButton->changeAnimation(true, 6);
f32 scroll = mfScroll + 3.0f * getLineHeight();
if (scroll >= getScrollMax()) scroll = getScrollMax();
mExScrollAnm.startAnm(NULL, mfScroll, scroll, 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
bool InputForm::updateInput(int chan, f32 x, f32 y, u32 trig, u32 hold, u32 release, void* data) {
if (meEditMode == EM_Disp) {
if (hold & 0x400) return textinput::InputForm::updateInput(chan, 0.0f, 0.0f, 0, 0, 0, data);
if (trig & 8) mpScrollButton->changeAnimation(false, 4);
if (release & 8) mpScrollButton->changeAnimation(false, 3);
if (trig & 4) mpScrollButton->changeAnimation(true, 4);
if (release & 4) mpScrollButton->changeAnimation(true, 3);
if (hold & 8) {
if (getScrollMin() <= mfScroll) {
setScroll(mfScroll - 3.5f);
if (mfScroll <= getScrollMin()) setScroll(getScrollMin());
else onSE(sound::SE_MESSAGE_SCROLL);
}
mpScrollButton->changeAnimation(false, 4);
} else mpScrollButton->changeAnimation(false, 3);
if (hold & 4) {
if (getScrollMax() >= mfScroll) {
setScroll(3.5f + mfScroll);
if (mfScroll >= getScrollMax()) setScroll(getScrollMax());
else onSE(sound::SE_MESSAGE_SCROLL);
}
mpScrollButton->changeAnimation(true, 4);
} else mpScrollButton->changeAnimation(true, 3);
}
return textinput::InputForm::updateInput(chan, x, y, trig, hold, release, data);
}
bool InputForm::updateInput(input::HKBManager& hkbManager) {
return textinput::InputForm::updateInput(hkbManager);
}
void InputForm::init() {
if (mpBoundPane != NULL) mCharColor.Set(20, 20, 20, 255);
mbUpVisible = false;
mbDownVisible = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
mbGoodBye = false;
mbEditScrollUp = false;
mbEditScrollDown = false;
setScroll(0.0f);
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
resetRelation();
updateCandidateState_();
setLineDrawInfo(true, 10);
}
void InputForm::draw() {
setProjectionMtx();
drawHeader();
drawBody();
drawFooter();
if (meEditMode == EM_Edit) getPane("N_txt_scrl")->Draw(mDrawInfo);
inputform::Base::draw();
if (meEditMode == EM_Disp) {
setProjectionMtx();
getPane("N_TopBtn_00")->Animate(0);
getPane("N_TopBtn_00")->CalculateMtx(mDrawInfo);
getPane("N_TopBtn_00")->Draw(mDrawInfo);
}
mnLine = getLine();
if (mnLine <= 4) mnLine = 4;
}
void InputForm::setScroll(f32 scroll) {
mfScroll = scroll;
mfDrawScrollY = meEditMode == EM_Edit ? -mfScroll : 0.0f;
}
static nw4r::math::VEC2 transformedOrigin(const nw4r::ut::Rect& rect, const Mtx& matrix) {
nw4r::math::VEC3 position;
position.x = rect.left;
position.y = rect.bottom;
position.z = 0.0f;
PSMTXMultVec(matrix, reinterpret_cast<const Vec*>(&position), reinterpret_cast<Vec*>(&position));
return nw4r::math::VEC2(position.x, -position.y);
}
void InputForm::calc() {
nw4rmanager::Layout::calc();
muGlobalAlpha = getLayout()->GetRootPane()->GetAlpha();
mpLayout->Animate(0);
mpLayout->CalculateMtx(mDrawInfo);
mpLayout->GetRootPane()->FindPaneByName("N_Memo", true)->SetTranslate(nw4r::math::VEC2(0.0f, mfScroll));
f32 height = mnLine * getLineHeight();
f32 drawY = mDefaultDrawTrans.y - (height - mDefaultDrawSize.height) / 2.0f;
mpDrawPane->SetSize(nw4r::lyt::Size(mpDrawPane->GetSize().width, height));
mpDrawPane->SetTranslate(nw4r::math::VEC2(mDefaultDrawTrans.x, drawY));
mpDrawPane->CalculateMtx(mDrawInfo);
AdjustPaneMtx(mDrawMtx, mDrawInfo, mpDrawPane->GetGlobalMtx());
nw4r::ut::Rect rect;
rect = mpDrawPane->GetPaneRect(mDrawInfo);
nw4r::math::VEC2 scale(getScale().x, 1.0f);
nw4r::math::VEC2 position = transformedOrigin(rect, mDrawMtx);
mDrawRect.left = position.x;
mDrawRect.bottom = position.y;
mDrawRect.right = position.x + scale.x * (rect.right - rect.left);
mDrawRect.top = position.y + scale.y * (rect.top - rect.bottom);
height = mnLine * getLineHeight();
f32 halfHeight = height - mDefaultBoundSize.height;
halfHeight *= 0.5f;
f32 boundY = mDefaultBoundTrans.y - halfHeight;
if (meEditMode == EM_Edit) {
height = 2.0f * getLineHeight();
boundY = (mDefaultBoundTrans.y - (height - mDefaultBoundSize.height) / 2.0f) - mfScroll;
} else mfDrawScrollY = 0.0f;
mpBoundPane->SetSize(nw4r::lyt::Size(mpBoundPane->GetSize().width, height));
mpBoundPane->SetTranslate(nw4r::math::VEC2(mDefaultBoundTrans.x, boundY));
mpBoundPane->CalculateMtx(mDrawInfo);
AdjustPaneMtx(mBoundMtx, mDrawInfo, mpBoundPane->GetGlobalMtx());
AdjustPaneMtx(mMtx.m, mDrawInfo, mpBoundPane->GetGlobalMtx());
mRect = mpBoundPane->GetPaneRect(mDrawInfo);
muGlobalAlpha = mpBoundPane->GetAlpha();
mExScrollAnm.calc();
if (mExScrollAnm.isActive()) {
setScroll(mExScrollAnm.getValue());
} else if (meEditMode == EM_Edit) {
doAutoScroll();
if (!mExScrollAnm.isActive()) {
f32 halfLine = getLineHeight();
halfLine *= 0.5f;
if (mfScroll - halfLine > 0.0f) {
if (!mbUpVisible) {
searchAnmPane("P_txtScrll_UP")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_UP"))->init();
}
mbUpVisible = true;
} else {
if (mbUpVisible) searchAnmPane("P_txtScrll_UP")->changeAnimation(6);
mbUpVisible = false;
}
f32 textHeight = getLine() * getLineHeight();
f32 lowerHalfLine = getLineHeight();
lowerHalfLine *= 0.5f;
f32 lowerEdge = mfScroll + height;
lowerEdge += lowerHalfLine;
if (lowerEdge < textHeight) {
if (!mbDownVisible) {
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(5);
mpPaneManager->getPaneComponentByPane(getPane("B_txtScrll_DOWN"))->init();
}
mbDownVisible = true;
} else {
if (mbDownVisible) searchAnmPane("P_txtScrll_DOWN")->changeAnimation(6);
mbDownVisible = false;
}
}
} else {
mbUpVisible = false;
mbDownVisible = false;
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
getPane("N_txt_scrl")->Animate(0);
getPane("N_txt_scrl")->CalculateMtx(mDrawInfo);
}
nw4r::lyt::Pane* scrollPane = getPane("N_txt_scrl");
scrollPane->SetTranslate(nw4r::math::VEC2(scrollPane->GetTranslate().x, 0.0f));
if (meEditMode == EM_Disp) {
mpScrollButton->calc();
if (!mbGoodBye) {
if (mbEditScrollUp && getScrollMin() >= mfScroll) {
mbEditScrollUp = false;
mpScrollButton->changeAnimation(false, 2);
} else if (!mbEditScrollUp && getScrollMin() < mfScroll) {
mbEditScrollUp = true;
mpScrollButton->changeAnimation(false, 1);
}
if (mbEditScrollDown && getScrollMax() <= mfScroll) {
mbEditScrollDown = false;
mpScrollButton->changeAnimation(true, 2);
}
if (!mbEditScrollDown && getScrollMax() > mfScroll) {
mbEditScrollDown = true;
mpScrollButton->changeAnimation(true, 1);
}
if (mpNigaoeObserver != NULL) mpNigaoeObserver->moveNigaoeButton();
}
}
calcCursorTimer();
}
void InputForm::doAutoScroll() {
if (!mExScrollAnm.isActive() && (meScrollFlag == SF_ScrollOn || meScrollFlag == SF_ScrollByBS)) {
if (meEditMode == EM_Edit) {
f32 lineHeight = getLineHeight();
lineHeight *= 0.5f;
f32 cursorBottom = mfCursorY + lineHeight;
if (mfScroll > cursorBottom) {
int lines = (mfScroll - mfCursorY) / getLineHeight();
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll - lines * getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
if (mfScroll + 2.0f * getLineHeight() < cursorBottom) {
f32 lineHeight = getLineHeight();
int lines = static_cast<int>((cursorBottom - (mfScroll + 2.0f * getLineHeight())) / lineHeight) + 1;
mExScrollAnm.startAnm(NULL, mfScroll, mfScroll + lines * getLineHeight(), 15.0f, NULL);
onSE(sound::SE_LINE_SCROLL);
}
}
meScrollFlag = SF_NoScroll;
}
}
void InputForm::beginDraw(const nw4r::ut::Rect&) {
if (mDrawRect.left == mDrawRect.right) mDrawRect.right += 0.1f;
if (mDrawRect.top == mDrawRect.bottom) mDrawRect.top += 0.1f;
textdrawer::Base::beginDraw(mDrawRect);
}
void InputForm::doScroll(Scroll*) {}
u32 InputForm::calcCursorPos(f32 x, f32 y) {
u32 lines = getLine();
if (lines > muLimitRowNum) lines = muLimitRowNum;
f32 lineHeight = getLineHeight();
f32 cursorY = y + mfScroll;
if (cursorY > lines * lineHeight) return inputform::Base::calcCursorPos(x, lines * getLineHeight());
return inputform::Base::calcCursorPos(x, cursorY);
}
void InputForm::drawCursor(f32 x, f32 y) {
if (meEditMode != EM_Disp) inputform::Base::drawCursor(x, y);
}
nw4r::math::VEC2 InputForm::getScale() const {
if (mpMemoRootPane == NULL) return nw4r::math::VEC2(1.0f, 1.0f);
return mpMemoRootPane->GetScale();
}
void InputForm::drawHeader() {
getPane(scPaneName[0])->Draw(mDrawInfo);
getPane("Nigaoe")->Draw(mDrawInfo);
getPane("T_Nigaoe")->Draw(mDrawInfo);
}
void InputForm::drawBody() {
nw4r::lyt::Pane* body = getPane(scPaneName[1]);
f32 y = 0.0f;
for (int i = 0; i < mnLine; i++) {
body->SetTranslate(nw4r::math::VEC2(0.0f, y));
body->CalculateMtx(mDrawInfo);
body->Draw(mDrawInfo);
y -= body->GetSize().height;
}
if (!mbEdited) getPane("T_TouchLetter")->Draw(mDrawInfo);
}
void InputForm::drawFooter() {
f32 y = (mnLine - 1) * (-1.0f * getPane(scPaneName[1])->GetSize().height);
nw4r::lyt::Pane* footer = getPane(scPaneName[3]);
footer->SetTranslate(nw4r::math::VEC2(0.0f, y));
footer->CalculateMtx(mDrawInfo);
footer->Draw(mDrawInfo);
}
void InputForm::open() {
setScroll(0.0f);
mfScrollFrom = 0.0f;
mfScrollTo = 0.0f;
mpLayout->GetRootPane()->SetTranslate(nw4r::math::VEC2(0.0f, 0.0f));
searchAnmPane("N_Memo")->changeAnimation(1);
searchAnmPane("P_txtScrll_UP")->changeAnimation(7);
searchAnmPane("P_txtScrll_DOWN")->changeAnimation(7);
}
void InputForm::close() {
if (!mbCloseWithSend) searchAnmPane("N_Memo")->changeAnimation(2);
else searchAnmPane("N_Memo")->changeAnimation(3);
if (mbEditScrollUp) {
mpScrollButton->changeAnimation(false, 2);
mbEditScrollUp = false;
}
if (mbEditScrollDown) {
mpScrollButton->changeAnimation(true, 2);
mbEditScrollDown = false;
}
mbGoodBye = true;
}
bool InputForm::isWholePaneInAnimation() {
return searchAnmPane("N_Memo")->isInAnimation();
}
void InputForm::setHeaderCaption(const wchar_t* caption) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_Header", true))->SetString(caption, 0);
}
void InputForm::setMiiName(const wchar_t* name) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_Nigaoe", true))->SetString(name, 0);
}
void InputForm::setTouchLetterCaption(const wchar_t* caption) {
static_cast<nw4r::lyt::TextBox*>(mpLayout->GetRootPane()->FindPaneByName("T_TouchLetter", true))->SetString(caption, 0);
mbEdited = false;
}
nw4r::lyt::Pane* InputForm::getNigaoePane() {
return getPane("Nigaoe");
}
nw4r::lyt::Material* InputForm::getNigaoePaneMaterial() {
return getPane("Nigaoe")->FindMaterialByName("Nigaoe", true);
}
f32 InputForm::getScrollMin() { return 0.0f; }
f32 InputForm::getScrollMax() { return getDrawBoxHeight() - 100.0f; }
f32 InputForm::getDrawBoxHeight() { return mnLine * getLineHeight(); }
void InputForm::onNigaoeButtonTrig() {
if (meEditMode == EM_Disp && mpNigaoeObserver != NULL && mpNigaoeObserver->onNigaoeButton()) onSE(sound::SE_DECIDE);
}
void InputForm::onNigaoeButtonPoint() {
if (meEditMode == EM_Disp) {
searchAnmPane("Nigaoe")->changeAnimation(4);
if (mpNigaoeObserver != NULL) mpNigaoeObserver->pointNigaoeButton();
onSE(sound::SE_BT_TARGETTING);
}
}
void InputForm::onNigaoeButtonLeft() {
if (meEditMode == EM_Disp) {
if (mpNigaoeObserver != NULL) mpNigaoeObserver->leftNigaoeButton();
searchAnmPane("Nigaoe")->changeAnimation(5);
}
}
void InputForm::setDefaultNigaoe() {
getNigaoePaneMaterial()->SetTexture(0, *mpDefaultNigaoe);
}
void InputForm::setEditMode(EditMode mode) {
meEditMode = mode;
switch (mode) {
case EM_Disp: getPane("N_txt_scrl")->SetVisible(false); break;
case EM_Edit: getPane("N_txt_scrl")->SetVisible(true); break;
case EM_Disappear:
onCommand(static_cast<INPUT_COMMAND>(6), NULL);
candidatebox::CandidateBoxCaller::resetCandidate();
candidatebox::CandidateBoxCaller::makeEmptyCandidate();
break;
}
}
void InputForm::preDraw(u32 pos) {
if (meEditMode == EM_Disp) mpSendString->clear();
inputform::Base::preDraw(pos);
}
void InputForm::doLineFeed() {
if (meEditMode == EM_Disp) mpSendString->pushBack(L'\n');
inputform::Base::doLineFeed();
}
void InputForm::put(wchar_t ch) {
if (meEditMode == EM_Disp) mpSendString->pushBack(ch);
textdrawer::Base::put(ch);
}
void InputForm::finishDraw(u32) {
if (meEditMode == EM_Disp) mpSendString->pushBack(0);
}
void WholePane::onAnmEvent(AnmPaneEvent) {}
void EventHandler::onTiEvent(gui::PaneComponent* component, u32 event, Input* input) {
inputform::EventHandler::onTiEvent(component, event, input);
const char* name = component->getPane()->GetName();
if (name[0] == 'B') {
if (event == 4 && (input->field_0x0C & 0x800)) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonTrig();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRTrig();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLTrig();
}
if (event == 0) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonPoint();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRPoint();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLPoint();
}
if (event == 1) {
if (util::strcmp("B_Nigaoe", name)) mpMemoForm->onNigaoeButtonLeft();
if (util::strcmp("B_ArwR", name)) mpMemoForm->onArrowRLeft();
if (util::strcmp("B_ArwL", name)) mpMemoForm->onArrowLLeft();
}
}
}
void SimpleAnmPane::changeAnimation(u32 id) { nw4rmanager::AnmPane::changeAnimation(id); }
void SimpleAnmPane::init() {}
void ScrollButton::init() {}
u32 AnmPane::getState() { return meState; }
void AnmPane::changeAnimation(u32 id) {
meState = id;
nw4rmanager::AnmPane::changeAnimation(id);
}
u32 AnmPane::getKeyType() const { return meKeyType; }
void AnmPane::init() { meState = 0; }
void NigaoePane::onAnmEvent(AnmPaneEvent) {}
bool InputForm::isInScroll() { return mExScrollAnm.isActive(); }
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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