Compare commits
226 Commits
codex/butt
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7832ae88f2 | ||
|
|
5ffea56c30 | ||
|
|
3dfeacd4f6 | ||
|
|
36f3716be7 | ||
|
|
784a463f27 | ||
|
|
fadf50ce43 | ||
|
|
a824e02a30 | ||
|
|
75c7a24c2f | ||
|
|
12c7a67d2c | ||
|
|
e2c26aad07 | ||
|
|
622b7e678e | ||
|
|
ddbb9b1ab9 | ||
|
|
4b71db7dfd | ||
|
|
e052c9ae0c | ||
|
|
a843f0770f | ||
|
|
c356c90f22 | ||
|
|
6af767089f | ||
|
|
bee0a51dbf | ||
|
|
d9e7306a99 | ||
|
|
f214b726b5 | ||
|
|
cbe489cd37 | ||
|
|
d78ab4cfd1 | ||
|
|
311b437e5f | ||
|
|
8581b15e80 | ||
|
|
16317c11e2 | ||
|
|
667b9f6fa2 | ||
|
|
bf479c7e3f | ||
|
|
5ce99fb34c | ||
|
|
44a074bdce | ||
|
|
59e3ec6007 | ||
|
|
f9a70d7d43 | ||
|
|
e5adf3de29 | ||
|
|
373ea6a875 | ||
|
|
84c3af7235 | ||
|
|
1f0ce55081 | ||
|
|
002e2e7e36 | ||
|
|
6713cca2e3 | ||
|
|
43fb4f1bb7 | ||
|
|
e926be4585 | ||
|
|
8d95ccd8ab | ||
|
|
cf3d7c4393 | ||
|
|
da448d002b | ||
|
|
d6c74589e5 | ||
|
|
63492be139 | ||
|
|
bede348ee3 | ||
|
|
75bdcc3e2c | ||
|
|
4872b6e925 | ||
|
|
7b96616b53 | ||
|
|
b9895bb3d6 | ||
|
|
22961c86a3 | ||
|
|
e4b8d405ed | ||
|
|
584dbb6906 | ||
|
|
2f865cb308 | ||
|
|
476e471184 | ||
|
|
45514dad2d | ||
|
|
9e2b86d38a | ||
|
|
86ed50ab79 | ||
|
|
4a30cfa843 | ||
|
|
bb3365c7da | ||
|
|
511b8d2a57 | ||
|
|
98f0f11dc7 | ||
|
|
e194e9ccd4 | ||
|
|
9b89894ee2 | ||
|
|
71c1c07d3b | ||
|
|
12e0ec188d | ||
|
|
93b2f44cfc | ||
|
|
9df26503a6 | ||
|
|
836a348b64 | ||
|
|
8201dbba31 | ||
|
|
1711e860c7 | ||
|
|
0c3af7ea2e | ||
|
|
fb539fe968 | ||
|
|
cd2a126243 | ||
|
|
620f8c8b4e | ||
|
|
7bf0665f40 | ||
|
|
f5ccda1cb4 | ||
|
|
4c84325f64 | ||
|
|
380c8a059c | ||
|
|
df19b05818 | ||
|
|
e27bb4c191 | ||
|
|
6aafa4acfe | ||
|
|
704850f5dd | ||
|
|
ca4acc8625 | ||
|
|
9e9c6bcd54 | ||
|
|
1975cefade | ||
|
|
721f9907df | ||
|
|
21c1e8a207 | ||
|
|
34f121b783 | ||
|
|
8647740dd8 | ||
|
|
84d8c7fe7a | ||
|
|
8923728dc4 | ||
|
|
71b4ac3296 | ||
|
|
21c4d9b7d9 | ||
|
|
558bb52727 | ||
|
|
cacffaa5ee | ||
|
|
d4cb1ee2ee | ||
|
|
ec93b2aad3 | ||
|
|
f026821af2 | ||
|
|
dd369fbb8c | ||
|
|
47f78dcead | ||
|
|
d951489ea3 | ||
|
|
2afb673a8e | ||
|
|
5b7475fe54 | ||
|
|
51f1c36f3f | ||
|
|
eb2d67bfe3 | ||
|
|
e167441313 | ||
|
|
fcf28f93e2 | ||
|
|
956f076799 | ||
|
|
3283047615 | ||
|
|
d0f6f8a7b9 | ||
|
|
8bec89c069 | ||
|
|
84ce6d4198 | ||
|
|
fba54700b6 | ||
|
|
748265e71b | ||
|
|
06e8788815 | ||
|
|
44a7f17e41 | ||
|
|
e1bd339ba5 | ||
|
|
0532e405d3 | ||
|
|
961a1b0431 | ||
|
|
e65297484f | ||
|
|
10f3bbc57c | ||
|
|
747e87959f | ||
|
|
0f89a4218d | ||
|
|
d0127008b2 | ||
|
|
8f31470be5 | ||
|
|
8a46eaae2d | ||
|
|
55946192bf | ||
|
|
f5486c85f4 | ||
|
|
bcbffb2c06 | ||
|
|
3793ce8c4e | ||
|
|
5cd7bcb31f | ||
|
|
c6ae812dd3 | ||
|
|
eeb6e310cf | ||
|
|
2242c861de | ||
|
|
ded8d62531 | ||
|
|
2c9e8eb028 | ||
|
|
a8c6bcf550 | ||
|
|
aa72085db7 | ||
|
|
4f747f363b | ||
|
|
2dce7103d1 | ||
|
|
f812a3bf87 | ||
|
|
25177c690e | ||
|
|
912546fd58 | ||
|
|
39aef1c7c0 | ||
|
|
872f55c573 | ||
|
|
ba46047e4d | ||
|
|
3e41051d36 | ||
|
|
fa2c5714ad | ||
|
|
cebdd7236d | ||
|
|
87cf5dacc3 | ||
|
|
9424c50f7b | ||
|
|
020ba288c3 | ||
|
|
1ab4726f50 | ||
|
|
2b016f9144 | ||
|
|
29984adbed | ||
|
|
e2832af0d2 | ||
|
|
df3f27980e | ||
|
|
28a693c7ad | ||
|
|
1d16705416 | ||
|
|
1ccf72e0d5 | ||
|
|
11b63fc609 | ||
|
|
3ae7c32d1c | ||
|
|
1171037c9b | ||
|
|
0a6a722237 | ||
|
|
18e76c8e59 | ||
|
|
0391409f25 | ||
|
|
b9ceb6a11a | ||
|
|
cc637c0b19 | ||
|
|
7c26f15caa | ||
|
|
e505b1cf9e | ||
|
|
39c8fe9e3a | ||
|
|
b5423d6815 | ||
|
|
cf00659e46 | ||
|
|
0eedd89260 | ||
|
|
69ff7c2582 | ||
|
|
a95c8a4b1d | ||
|
|
953b301d76 | ||
|
|
5166ef739e | ||
|
|
f86495f54a | ||
|
|
537c072886 | ||
|
|
1e9dd58f0d | ||
|
|
e174009388 | ||
|
|
7760bedf22 | ||
|
|
e55aea86ee | ||
|
|
8b42d4167b | ||
|
|
d05fcb1f10 | ||
|
|
532b492c2a | ||
|
|
3ec0698529 | ||
|
|
649ad2fe37 | ||
|
|
a1be1860d9 | ||
|
|
af7a696da6 | ||
|
|
0105e3de85 | ||
|
|
a1167cd128 | ||
|
|
1bb030e16a | ||
|
|
41f01f5012 | ||
|
|
4b24a65552 | ||
|
|
44e895f70b | ||
|
|
42173aa970 | ||
|
|
c936e893db | ||
|
|
4fdd7f9cd5 | ||
|
|
914007736f | ||
|
|
def5006961 | ||
|
|
a5b26387d3 | ||
|
|
e46089fbb9 | ||
|
|
1683c2bb9c | ||
|
|
1f04477528 | ||
|
|
87377fa984 | ||
|
|
2a2f0f8868 | ||
|
|
cd729d24cb | ||
|
|
a6ac7282b7 | ||
|
|
bd1ebcb624 | ||
|
|
cfe2a8bc1a | ||
|
|
b62e543654 | ||
|
|
349e33fb24 | ||
|
|
1eaf680f40 | ||
|
|
3e35807542 | ||
|
|
bbce167648 | ||
|
|
2c1b255aa2 | ||
|
|
171cd52bab | ||
|
|
7f1fb7e588 | ||
|
|
aa825369da | ||
|
|
42390e0343 | ||
|
|
5c1af96b02 | ||
|
|
ce15782426 | ||
|
|
cb232daee1 | ||
|
|
46c6772ada |
92
AGENTS.md
92
AGENTS.md
@@ -2,6 +2,8 @@
|
||||
|
||||
Guidance for AI agents working in this repository.
|
||||
|
||||
Keep code comments to cases where they are necessary.
|
||||
|
||||
## CRITICAL RULE: never touch upstream
|
||||
|
||||
**Do not open a pull request against `koopthekoopa/wii-ipl`. Do not push to it.
|
||||
@@ -156,51 +158,34 @@ and `splits.txt`), not in whatever order looks convenient.
|
||||
7. `ctxdiff.py` next. Work through the instruction diff.
|
||||
8. Only then look at register allocation.
|
||||
|
||||
## ReAgent and parallel worker workflow
|
||||
## Subagent and PR workflow
|
||||
|
||||
This repository targets only Wii Menu 4.3U. Do not configure or build 43E,
|
||||
43J, or 43K while doing matching work.
|
||||
|
||||
Use the installed ReAgent environment for evidence-driven reversal work:
|
||||
Most workers should pursue exact matching or safe linking; assign the remainder
|
||||
to decompilation. Keep up to 75 live workers when the runtime allows it, while
|
||||
reserving capacity for fixer and validation workers. Fill completed slots with
|
||||
disjoint tasks. Never duplicate a source file or function
|
||||
range. Workers return changed paths, exact objdiff measurements, and validation
|
||||
results. Fuzzy-only results are not accepted.
|
||||
|
||||
```
|
||||
/home/cole/projects/tests/reagent-venv/bin/re-agent doctor
|
||||
/home/cole/projects/tests/reagent-venv/bin/re-agent status
|
||||
```
|
||||
Workers must do the work through tool calls and avoid conversational messages.
|
||||
Send findings to the parent only through the collaboration tool, with concise
|
||||
paths, measurements, and validation evidence. Put PR discussion on the PR when
|
||||
needed. Do not send user-facing status chatter; the orchestrator follows the
|
||||
reporting rule below.
|
||||
|
||||
ReAgent should use the authenticated local Codex provider with the requested
|
||||
model and a small per-function call cap. The Codex provider uses the local
|
||||
Codex login rather than an API key; API billing is not created by ReAgent, but
|
||||
the account's normal model or plan usage still applies. Do not start a model
|
||||
run until `doctor` reports the backend and acceptance configuration clearly.
|
||||
### Worker loop
|
||||
|
||||
If the launcher cannot import, or `doctor` reports `ready: false`, record the
|
||||
exact failure and do not claim ReAgent evidence. Repair a broken editable
|
||||
install with a fresh checkout and a non-editable install before retrying. If
|
||||
the decompile capability still lacks Java/Ghidra, workers may continue only in
|
||||
the explicitly labeled manual/objdiff fallback using fresh object builds,
|
||||
`pool_diff.py`, `ctxdiff.py`, full 43U builds, and the DOL hash. The fallback
|
||||
does not count as ReAgent execution.
|
||||
|
||||
For parallel work, orchestrate up to ten workers at once when the agent runtime
|
||||
has the capacity. Use `gpt-5.6-luna` at maximum reasoning effort with the fast
|
||||
service tier when those settings are available. If the runtime cannot host ten
|
||||
live workers, queue the remainder; never duplicate a source file or function
|
||||
range just to fill a slot. Each worker must own a disjoint translation unit or
|
||||
function range and return the changed paths, exact-match measurements, and
|
||||
validation results. Workers may propose code, but a candidate is not accepted
|
||||
when it is only fuzzy, uses an uninitialized value, or hides a mismatch behind
|
||||
artificial assembly.
|
||||
|
||||
### Ten-worker exact-match loop
|
||||
|
||||
The worker keeps iterating on its assigned function until exact-name `objdiff`
|
||||
reports `100.0%`. A worker must not stop at a fuzzy score, push to a remote,
|
||||
open a PR, or merge. It may make a local commit on its isolated leaf branch if
|
||||
needed to preserve its work. If the worker believes the remaining difference is
|
||||
a compiler tie-break, it reports the evidence and waits for the orchestrator to
|
||||
terminate or reassign the leaf; it does not self-accept a near-match. Reaching
|
||||
`100.0%` is only the handoff point; it is not acceptance.
|
||||
Workers iterate until exact-name `objdiff` reports `100.0%`. They must not stop
|
||||
at a fuzzy score, push, open a PR, or merge. A local commit is fine. Compiler
|
||||
tie-breaks should be reported with evidence, not hidden behind artificial
|
||||
assembly or uninitialized values. Exact matching is the handoff point, not
|
||||
acceptance. A candidate is incomplete until every owned code and data section
|
||||
and its link metrics are 100%; matching a few functions alone is not enough.
|
||||
Write new matches as readable C or C++ and keep new inline assembly out of the
|
||||
source unless the existing target structure makes it unavoidable.
|
||||
|
||||
Worker measurements are advisory. Only a fresh orchestrator verification can
|
||||
accept, push, open, or merge a candidate. Workers are persistent across
|
||||
@@ -219,9 +204,11 @@ The orchestrator must independently rebuild the owned object and verify:
|
||||
1. `pool_diff.py` reports identical pools, with no first divergence.
|
||||
2. Exact-name `objdiff` reports `100.0%` for the requested symbol.
|
||||
3. `ctxdiff.py` reports `diffs 0` and identical instruction counts.
|
||||
4. The focused source diff is minimal, readable, and free of artificial
|
||||
4. Unit-level code, data, function, and link measures for the owned range are
|
||||
100%, including every owned section.
|
||||
5. The focused source diff is minimal, readable, and free of artificial
|
||||
assembly, uninitialized values, or unrelated edits.
|
||||
5. The full 4.3U build passes and `build/43U/main.dol` has SHA1
|
||||
6. The full 4.3U build passes and `build/43U/main.dol` has SHA1
|
||||
`26116613f624061ba99c8d1a299aaa6efa85670d`.
|
||||
|
||||
If any orchestrator gate fails, do not promote, push, open a PR, or merge the
|
||||
@@ -238,8 +225,9 @@ For each candidate, the worker must:
|
||||
4. Iterate until exact-name objdiff reaches `100.0%`, while preserving the
|
||||
pool and source-quality requirements above.
|
||||
5. Return the focused exact match to the parent agent for review. The parent
|
||||
reruns every gate and runs `/home/cole/projects/tests/.venv/bin/ninja -C .
|
||||
build/43U/ok`; the worker does not push, open a PR, or merge.
|
||||
reruns every gate, runs `tools/decomp_status.py` and
|
||||
`tools/check_decomp_complete.py`, and runs `/home/cole/projects/tests/.venv/bin/ninja -C . build/43U/ok`;
|
||||
the worker does not push, open a PR, or merge.
|
||||
|
||||
The main agent reviews every worker result before accepting it. After each
|
||||
accepted merge, record the new report from `build/43U/report.json` and keep
|
||||
@@ -259,9 +247,8 @@ candidate fails validation, return it to its worker; do not fix the candidate
|
||||
inline in the orchestrator.
|
||||
|
||||
A new thread must begin by reading this file, checking the live 43U report and
|
||||
remote branch, running the ReAgent doctor/status checks, and then dispatching
|
||||
the worker pool. The orchestrator must not claim a match based on its own
|
||||
decompilation because it must not do that work.
|
||||
remote branch, and dispatching the worker pool. The parent must not claim a
|
||||
match without fresh independent verification.
|
||||
|
||||
### Worktrees, branches, and PR integration
|
||||
|
||||
@@ -318,6 +305,21 @@ After a successful merge:
|
||||
worktree and local branch. A failed or conflicted leaf keeps its worktree
|
||||
and worker alive.
|
||||
|
||||
### User-facing progress reports
|
||||
|
||||
Keep user-facing messages to a minimum and use as few tokens as possible.
|
||||
Do not send routine status updates or commentary while workers are running or
|
||||
PRs are open. After each matching-work PR is merged and the live progress
|
||||
report has been regenerated, send only the current linked, fuzzy, and data
|
||||
percentages in this format:
|
||||
|
||||
```
|
||||
Linked: <percent> | Fuzzy: <percent> | Data: <percent>
|
||||
```
|
||||
|
||||
Do not report stale values, unmerged PR results, or add other text to that
|
||||
update. Continue all required verification and coordination silently.
|
||||
|
||||
## Goal completion contract
|
||||
|
||||
The decompilation loop does not stop after a successful wave, a convenient
|
||||
|
||||
@@ -10,6 +10,33 @@ splits: 'config/43U/splits.txt'
|
||||
|
||||
ldscript_template: 'config/ldscript_ipl2.lcf'
|
||||
|
||||
force_active:
|
||||
- labs
|
||||
- itoa
|
||||
- strpbrk
|
||||
- strspn
|
||||
- strcspn
|
||||
- atol
|
||||
- padding__Q23ipl5scene
|
||||
- lbl_81695063
|
||||
- lbl_81695067
|
||||
- __vt__Q49textinput6extend4memo19NigaoeEventObserver
|
||||
|
||||
# textinput::toolbar::csPaneToAnimation points one past the end of csAninationFile.
|
||||
block_relocations:
|
||||
- source: .data:0x8165E15C
|
||||
- source: .data:0x8165E19C
|
||||
|
||||
add_relocations:
|
||||
- source: .data:0x8165E15C
|
||||
type: abs
|
||||
target: csAninationFile__Q29textinput7toolbar
|
||||
addend: 0x1DC
|
||||
- source: .data:0x8165E19C
|
||||
type: abs
|
||||
target: csAninationFile__Q29textinput7toolbar
|
||||
addend: 0x1DC
|
||||
|
||||
quick_analysis: true
|
||||
fill_gaps: false
|
||||
|
||||
|
||||
@@ -13938,7 +13938,7 @@ pppURLCheck = .rodata:0x816152A8; // type:object size:0x28 scope:local
|
||||
lbl_816152D0 = .rodata:0x816152D0; // type:object size:0x10 scope:local data:4byte
|
||||
csAninationFile__Q29textinput12candidatebox = .rodata:0x816152E0; // type:object size:0x378 scope:local
|
||||
lbl_81615658 = .rodata:0x81615658; // type:object size:0xA0 scope:local data:4byte
|
||||
csAninationFile__Q29textinput7toolbar = .rodata:0x816156F8; // type:object size:0x1E0 scope:local data:4byte
|
||||
csAninationFile__Q29textinput7toolbar = .rodata:0x816156F8; // type:object size:0x1DC scope:local data:4byte
|
||||
csAninationFile__Q29textinput11predictlang = .rodata:0x816158D8; // type:object size:0x268 scope:local
|
||||
csAninationFileForSign__Q39textinput8keyboard10signwindow = .rodata:0x81615B40; // type:object size:0x268 scope:local
|
||||
csPaneNameToControlKey__Q39textinput8keyboard10signwindow = .rodata:0x81615DA8; // type:object size:0x48 scope:local
|
||||
@@ -15733,47 +15733,47 @@ panes__Q23ipl5scene = .data:0x8164C8A4; // type:object size:0xB4 scope:local
|
||||
@16662 = .data:0x8164CBF4; // type:object size:0xC scope:local data:string
|
||||
@16898 = .data:0x8164CC00; // type:object size:0x1A scope:local data:string
|
||||
__vt__Q33ipl5scene11ChannelEdit = .data:0x8164CC1C; // type:object size:0x4C
|
||||
lbl_8164CC68 = .data:0x8164CC68; // type:object size:0x21 data:string
|
||||
lbl_8164CC89 = .data:0x8164CC89; // type:object size:0xA data:string
|
||||
lbl_8164CC93 = .data:0x8164CC93; // type:object size:0x22 data:string
|
||||
lbl_8164CCB5 = .data:0x8164CCB5; // type:object size:0x23 data:string
|
||||
lbl_8164CCD8 = .data:0x8164CCD8; // type:object size:0x9 data:string
|
||||
lbl_8164CCE1 = .data:0x8164CCE1; // type:object size:0x2C data:string
|
||||
lbl_8164CD0D = .data:0x8164CD0D; // type:object size:0xC data:string
|
||||
lbl_8164CD19 = .data:0x8164CD19; // type:object size:0x2D data:string
|
||||
lbl_8164CD46 = .data:0x8164CD46; // type:object size:0x29 data:string
|
||||
lbl_8164CD6F = .data:0x8164CD6F; // type:object size:0x25 data:string
|
||||
lbl_8164CD94 = .data:0x8164CD94; // type:object size:0xB data:string
|
||||
lbl_8164CD9F = .data:0x8164CD9F; // type:object size:0x26 data:string
|
||||
lbl_8164CDC5 = .data:0x8164CDC5; // type:object size:0x28 data:string
|
||||
lbl_8164CDED = .data:0x8164CDED; // type:object size:0x20 data:string
|
||||
lbl_8164CE0D = .data:0x8164CE0D; // type:object size:0x20 data:string
|
||||
lbl_8164CE2D = .data:0x8164CE2D; // type:object size:0x21 data:string
|
||||
lbl_8164CE4E = .data:0x8164CE4E; // type:object size:0xA data:string
|
||||
lbl_8164CE58 = .data:0x8164CE58; // type:object size:0xA data:string
|
||||
lbl_8164CE62 = .data:0x8164CE62; // type:object size:0x22 data:string
|
||||
lbl_8164CE84 = .data:0x8164CE84; // type:object size:0xD data:string
|
||||
lbl_8164CE91 = .data:0x8164CE91; // type:object size:0xD data:string
|
||||
lbl_8164CE9E = .data:0x8164CE9E; // type:object size:0x23 data:string
|
||||
lbl_8164CEC1 = .data:0x8164CEC1; // type:object size:0x1F data:string
|
||||
lbl_8164CEE0 = .data:0x8164CEE0; // type:object size:0xA data:string
|
||||
lbl_8164CEEA = .data:0x8164CEEA; // type:object size:0x21 data:string
|
||||
lbl_8164CF0B = .data:0x8164CF0B; // type:object size:0xB data:string
|
||||
lbl_8164CF16 = .data:0x8164CF16; // type:object size:0xB data:string
|
||||
lbl_8164CF21 = .data:0x8164CF21; // type:object size:0x1F data:string
|
||||
lbl_8164CF40 = .data:0x8164CF40; // type:object size:0x25 data:string
|
||||
lbl_8164CF65 = .data:0x8164CF65; // type:object size:0xB data:string
|
||||
lbl_8164CF70 = .data:0x8164CF70; // type:object size:0x26 data:string
|
||||
lbl_8164CF96 = .data:0x8164CF96; // type:object size:0xF data:string
|
||||
lbl_8164CFA5 = .data:0x8164CFA5; // type:object size:0xF data:string
|
||||
lbl_8164CFB4 = .data:0x8164CFB4; // type:object size:0xE data:string
|
||||
lbl_8164CFC2 = .data:0x8164CFC2; // type:object size:0xE data:string
|
||||
lbl_8164CFD0 = .data:0x8164CFD0; // type:object size:0xB data:string
|
||||
lbl_8164CFDB = .data:0x8164CFDB; // type:object size:0xA data:string
|
||||
lbl_8164CFE5 = .data:0x8164CFE5; // type:object size:0xA data:string
|
||||
lbl_8164CFEF = .data:0x8164CFEF; // type:object size:0xF data:string
|
||||
lbl_8164CFFE = .data:0x8164CFFE; // type:object size:0xE data:string
|
||||
jumptable_8164D00C = .data:0x8164D00C; // type:object size:0x30 scope:local
|
||||
@17285 = .data:0x8164CC68; // type:object size:0x21 scope:local data:string
|
||||
@17286 = .data:0x8164CC89; // type:object size:0xA scope:local data:string
|
||||
@17287 = .data:0x8164CC93; // type:object size:0x22 scope:local data:string
|
||||
@17288 = .data:0x8164CCB5; // type:object size:0x23 scope:local data:string
|
||||
@17289 = .data:0x8164CCD8; // type:object size:0x9 scope:local data:string
|
||||
@17290 = .data:0x8164CCE1; // type:object size:0x2C scope:local data:string
|
||||
@17291 = .data:0x8164CD0D; // type:object size:0xC scope:local data:string
|
||||
@17292 = .data:0x8164CD19; // type:object size:0x2D scope:local data:string
|
||||
@17293 = .data:0x8164CD46; // type:object size:0x29 scope:local data:string
|
||||
@17294 = .data:0x8164CD6F; // type:object size:0x25 scope:local data:string
|
||||
@17295 = .data:0x8164CD94; // type:object size:0xB scope:local data:string
|
||||
@17296 = .data:0x8164CD9F; // type:object size:0x26 scope:local data:string
|
||||
@17297 = .data:0x8164CDC5; // type:object size:0x28 scope:local data:string
|
||||
@17298 = .data:0x8164CDED; // type:object size:0x20 scope:local data:string
|
||||
@17300 = .data:0x8164CE0D; // type:object size:0x20 scope:local data:string
|
||||
@17301 = .data:0x8164CE2D; // type:object size:0x21 scope:local data:string
|
||||
@17302 = .data:0x8164CE4E; // type:object size:0xA scope:local data:string
|
||||
@17303 = .data:0x8164CE58; // type:object size:0xA scope:local data:string
|
||||
@17304 = .data:0x8164CE62; // type:object size:0x22 scope:local data:string
|
||||
@17305 = .data:0x8164CE84; // type:object size:0xD scope:local data:string
|
||||
@17306 = .data:0x8164CE91; // type:object size:0xD scope:local data:string
|
||||
@17307 = .data:0x8164CE9E; // type:object size:0x23 scope:local data:string
|
||||
@17308 = .data:0x8164CEC1; // type:object size:0x1F scope:local data:string
|
||||
@17309 = .data:0x8164CEE0; // type:object size:0xA scope:local data:string
|
||||
@17310 = .data:0x8164CEEA; // type:object size:0x21 scope:local data:string
|
||||
@17311 = .data:0x8164CF0B; // type:object size:0xB scope:local data:string
|
||||
@17312 = .data:0x8164CF16; // type:object size:0xB scope:local data:string
|
||||
@17313 = .data:0x8164CF21; // type:object size:0x1F scope:local data:string
|
||||
@17314 = .data:0x8164CF40; // type:object size:0x25 scope:local data:string
|
||||
@17315 = .data:0x8164CF65; // type:object size:0xB scope:local data:string
|
||||
@17316 = .data:0x8164CF70; // type:object size:0x26 scope:local data:string
|
||||
@17317 = .data:0x8164CF96; // type:object size:0xF scope:local data:string
|
||||
@17318 = .data:0x8164CFA5; // type:object size:0xF scope:local data:string
|
||||
@17319 = .data:0x8164CFB4; // type:object size:0xE scope:local data:string
|
||||
@17320 = .data:0x8164CFC2; // type:object size:0xE scope:local data:string
|
||||
@17321 = .data:0x8164CFD0; // type:object size:0xB scope:local data:string
|
||||
@17325 = .data:0x8164CFDB; // type:object size:0xA scope:local data:string
|
||||
@17326 = .data:0x8164CFE5; // type:object size:0xA scope:local data:string
|
||||
@17329 = .data:0x8164CFEF; // type:object size:0xF scope:local data:string
|
||||
@17330 = .data:0x8164CFFE; // type:object size:0xE scope:local data:string
|
||||
@17390 = .data:0x8164D00C; // type:object size:0x30 scope:local
|
||||
__vt__Q33ipl5scene11ChanAppBase = .data:0x8164D03C; // type:object size:0x28
|
||||
__vt__Q33ipl5scene13AnmController = .data:0x8164D0F8; // type:object size:0xC scope:weak
|
||||
lbl_8164D108 = .data:0x8164D108; // type:object size:0x25 data:string
|
||||
@@ -15791,56 +15791,56 @@ lbl_8164D1F4 = .data:0x8164D1F4; // type:object size:0xA data:string
|
||||
lbl_8164D1FE = .data:0x8164D1FE; // type:object size:0x11 data:string
|
||||
lbl_8164D20F = .data:0x8164D20F; // type:object size:0x11 data:string
|
||||
__vt__Q33ipl5scene10ChanAppBox = .data:0x8164D220; // type:object size:0x28
|
||||
lbl_8164D2E8 = .data:0x8164D2E8; // type:object size:0x20 data:string
|
||||
lbl_8164D308 = .data:0x8164D308; // type:object size:0x21 data:string
|
||||
lbl_8164D329 = .data:0x8164D329; // type:object size:0x26 data:string
|
||||
lbl_8164D34F = .data:0x8164D34F; // type:object size:0x27 data:string
|
||||
lbl_8164D376 = .data:0x8164D376; // type:object size:0x23 data:string
|
||||
lbl_8164D399 = .data:0x8164D399; // type:object size:0xC data:string
|
||||
lbl_8164D3A5 = .data:0x8164D3A5; // type:object size:0x25 data:string
|
||||
lbl_8164D3CA = .data:0x8164D3CA; // type:object size:0x26 data:string
|
||||
lbl_8164D3F0 = .data:0x8164D3F0; // type:object size:0x22 data:string
|
||||
lbl_8164D412 = .data:0x8164D412; // type:object size:0xB data:string
|
||||
lbl_8164D41D = .data:0x8164D41D; // type:object size:0x23 data:string
|
||||
lbl_8164D440 = .data:0x8164D440; // type:object size:0x9 data:string
|
||||
lbl_8164D449 = .data:0x8164D449; // type:object size:0x24 data:string
|
||||
lbl_8164D46D = .data:0x8164D46D; // type:object size:0x26 data:string
|
||||
lbl_8164D493 = .data:0x8164D493; // type:object size:0x1E data:string
|
||||
lbl_8164D4B1 = .data:0x8164D4B1; // type:object size:0x26 data:string
|
||||
lbl_8164D4D7 = .data:0x8164D4D7; // type:object size:0x26 data:string
|
||||
lbl_8164D4FD = .data:0x8164D4FD; // type:object size:0x27 data:string
|
||||
lbl_8164D524 = .data:0x8164D524; // type:object size:0x23 data:string
|
||||
lbl_8164D547 = .data:0x8164D547; // type:object size:0xC data:string
|
||||
lbl_8164D553 = .data:0x8164D553; // type:object size:0xA data:string
|
||||
lbl_8164D55D = .data:0x8164D55D; // type:object size:0xA data:string
|
||||
lbl_8164D567 = .data:0x8164D567; // type:object size:0x9 data:string
|
||||
lbl_8164D570 = .data:0x8164D570; // type:object size:0xB data:string
|
||||
lbl_8164D57B = .data:0x8164D57B; // type:object size:0xB data:string
|
||||
lbl_8164D586 = .data:0x8164D586; // type:object size:0xD data:string
|
||||
lbl_8164D593 = .data:0x8164D593; // type:object size:0xB data:string
|
||||
lbl_8164D59E = .data:0x8164D59E; // type:object size:0xB data:string
|
||||
lbl_8164D5A9 = .data:0x8164D5A9; // type:object size:0xB data:string
|
||||
lbl_8164D5B4 = .data:0x8164D5B4; // type:object size:0xB data:string
|
||||
lbl_8164D5BF = .data:0x8164D5BF; // type:object size:0x9 data:string
|
||||
lbl_8164D5C8 = .data:0x8164D5C8; // type:object size:0xB data:string
|
||||
lbl_8164D5D3 = .data:0x8164D5D3; // type:object size:0xB data:string
|
||||
lbl_8164D5DE = .data:0x8164D5DE; // type:object size:0xA data:string
|
||||
lbl_8164D5E8 = .data:0x8164D5E8; // type:object size:0xB data:string
|
||||
lbl_8164D5F3 = .data:0x8164D5F3; // type:object size:0xD data:string
|
||||
lbl_8164D600 = .data:0x8164D600; // type:object size:0x10 data:string
|
||||
lbl_8164D610 = .data:0x8164D610; // type:object size:0xB data:string
|
||||
lbl_8164D61B = .data:0x8164D61B; // type:object size:0xE data:string
|
||||
lbl_8164D629 = .data:0x8164D629; // type:object size:0xA data:string
|
||||
lbl_8164D633 = .data:0x8164D633; // type:object size:0xA data:string
|
||||
lbl_8164D63D = .data:0x8164D63D; // type:object size:0x9 data:string
|
||||
jumptable_8164D648 = .data:0x8164D648; // type:object size:0x34 scope:local
|
||||
lbl_8164D67C = .data:0x8164D67C; // type:object size:0xF data:string
|
||||
lbl_8164D68B = .data:0x8164D68B; // type:object size:0xE data:string
|
||||
lbl_8164D699 = .data:0x8164D699; // type:object size:0xA data:string
|
||||
lbl_8164D6A3 = .data:0x8164D6A3; // type:object size:0xC data:string
|
||||
lbl_8164D6AF = .data:0x8164D6AF; // type:object size:0xC data:string
|
||||
lbl_8164D6BB = .data:0x8164D6BB; // type:object size:0xB data:string
|
||||
lbl_8164D6C6 = .data:0x8164D6C6; // type:object size:0xF data:string
|
||||
@18429 = .data:0x8164D2E8; // type:object size:0x20 scope:local data:string
|
||||
@18431 = .data:0x8164D308; // type:object size:0x21 scope:local data:string
|
||||
@18432 = .data:0x8164D329; // type:object size:0x26 scope:local data:string
|
||||
@18434 = .data:0x8164D34F; // type:object size:0x27 scope:local data:string
|
||||
@18435 = .data:0x8164D376; // type:object size:0x23 scope:local data:string
|
||||
@18436 = .data:0x8164D399; // type:object size:0xC scope:local data:string
|
||||
@18437 = .data:0x8164D3A5; // type:object size:0x25 scope:local data:string
|
||||
@18439 = .data:0x8164D3CA; // type:object size:0x26 scope:local data:string
|
||||
@18440 = .data:0x8164D3F0; // type:object size:0x22 scope:local data:string
|
||||
@18441 = .data:0x8164D412; // type:object size:0xB scope:local data:string
|
||||
@18442 = .data:0x8164D41D; // type:object size:0x23 scope:local data:string
|
||||
@18443 = .data:0x8164D440; // type:object size:0x9 scope:local data:string
|
||||
@18444 = .data:0x8164D449; // type:object size:0x24 scope:local data:string
|
||||
@18445 = .data:0x8164D46D; // type:object size:0x26 scope:local data:string
|
||||
@18446 = .data:0x8164D493; // type:object size:0x1E scope:local data:string
|
||||
@18448 = .data:0x8164D4B1; // type:object size:0x26 scope:local data:string
|
||||
@18450 = .data:0x8164D4D7; // type:object size:0x26 scope:local data:string
|
||||
@18452 = .data:0x8164D4FD; // type:object size:0x27 scope:local data:string
|
||||
@18453 = .data:0x8164D524; // type:object size:0x23 scope:local data:string
|
||||
@18454 = .data:0x8164D547; // type:object size:0xC scope:local data:string
|
||||
@18455 = .data:0x8164D553; // type:object size:0xA scope:local data:string
|
||||
@18456 = .data:0x8164D55D; // type:object size:0xA scope:local data:string
|
||||
@18457 = .data:0x8164D567; // type:object size:0x9 scope:local data:string
|
||||
@18458 = .data:0x8164D570; // type:object size:0xB scope:local data:string
|
||||
@18460 = .data:0x8164D57B; // type:object size:0xB scope:local data:string
|
||||
@18461 = .data:0x8164D586; // type:object size:0xD scope:local data:string
|
||||
@18462 = .data:0x8164D593; // type:object size:0xB scope:local data:string
|
||||
@18463 = .data:0x8164D59E; // type:object size:0xB scope:local data:string
|
||||
@18464 = .data:0x8164D5A9; // type:object size:0xB scope:local data:string
|
||||
@18465 = .data:0x8164D5B4; // type:object size:0xB scope:local data:string
|
||||
@18467 = .data:0x8164D5BF; // type:object size:0x9 scope:local data:string
|
||||
@18469 = .data:0x8164D5C8; // type:object size:0xB scope:local data:string
|
||||
@18470 = .data:0x8164D5D3; // type:object size:0xB scope:local data:string
|
||||
@18471 = .data:0x8164D5DE; // type:object size:0xA scope:local data:string
|
||||
@18472 = .data:0x8164D5E8; // type:object size:0xB scope:local data:string
|
||||
@18473 = .data:0x8164D5F3; // type:object size:0xD scope:local data:string
|
||||
@18474 = .data:0x8164D600; // type:object size:0x10 scope:local data:string
|
||||
@18475 = .data:0x8164D610; // type:object size:0xB scope:local data:string
|
||||
@18476 = .data:0x8164D61B; // type:object size:0xE scope:local data:string
|
||||
@18477 = .data:0x8164D629; // type:object size:0xA scope:local data:string
|
||||
@18478 = .data:0x8164D633; // type:object size:0xA scope:local data:string
|
||||
@18479 = .data:0x8164D63D; // type:object size:0x9 scope:local data:string
|
||||
@18554 = .data:0x8164D648; // type:object size:0x34 scope:local
|
||||
@18692 = .data:0x8164D67C; // type:object size:0xF scope:local data:string
|
||||
@18693 = .data:0x8164D68B; // type:object size:0xE scope:local data:string
|
||||
@18695 = .data:0x8164D699; // type:object size:0xA scope:local data:string
|
||||
@18696 = .data:0x8164D6A3; // type:object size:0xC scope:local data:string
|
||||
@18697 = .data:0x8164D6AF; // type:object size:0xC scope:local data:string
|
||||
@18698 = .data:0x8164D6BB; // type:object size:0xB scope:local data:string
|
||||
@18826 = .data:0x8164D6C6; // type:object size:0xF scope:local data:string
|
||||
__vt__Q33ipl5scene11ChanAppEdit = .data:0x8164D6D8; // type:object size:0x28
|
||||
@15167 = .data:0x8164D7C0; // type:object size:0x7C scope:local
|
||||
...data.0 = .data:0x8164D7C0; // type:label scope:local
|
||||
@@ -17535,20 +17535,20 @@ __vt__Q39textinput12candidatebox4Base = .data:0x8165DFA8; // type:object size:0x
|
||||
__vt__Q39textinput12candidatebox18CandidateBoxCaller = .data:0x8165DFFC; // type:object size:0x1C
|
||||
__vt__Q39textinput11nw4rmanager11AnmObserver = .data:0x8165E018; // type:object size:0x4C
|
||||
__vt__Q39textinput4util12AnimObserver = .data:0x8165E064; // type:object size:0xC
|
||||
lbl_8165E070 = .data:0x8165E070; // type:object size:0xC data:string
|
||||
lbl_8165E080 = .data:0x8165E080; // type:object size:0x10 data:string
|
||||
lbl_8165E090 = .data:0x8165E090; // type:object size:0xD data:string
|
||||
lbl_8165E0A0 = .data:0x8165E0A0; // type:object size:0xC data:string
|
||||
@6142 = .data:0x8165E070; // type:object size:0xC scope:local data:string
|
||||
@6143 = .data:0x8165E080; // type:object size:0x10 scope:local data:string
|
||||
@6144 = .data:0x8165E090; // type:object size:0xD scope:local data:string
|
||||
@6145 = .data:0x8165E0A0; // type:object size:0xC scope:local data:string
|
||||
csPaneToAnimation__Q29textinput7toolbar = .data:0x8165E0B0; // type:object size:0x100
|
||||
lbl_8165E1B0 = .data:0x8165E1B0; // type:object size:0xD data:string
|
||||
lbl_8165E1C0 = .data:0x8165E1C0; // type:object size:0xC data:string
|
||||
lbl_8165E1CC = .data:0x8165E1CC; // type:object size:0xD data:string
|
||||
lbl_8165E1DC = .data:0x8165E1DC; // type:object size:0xC data:string
|
||||
lbl_8165E1E8 = .data:0x8165E1E8; // type:object size:0xC data:string
|
||||
lbl_8165E1F8 = .data:0x8165E1F8; // type:object size:0x10 data:string
|
||||
jumptable_8165E208 = .data:0x8165E208; // type:object size:0x30 scope:local
|
||||
lbl_8165E238 = .data:0x8165E238; // type:object size:0xC data:string
|
||||
jumptable_8165E244 = .data:0x8165E244; // type:object size:0x1C scope:local
|
||||
@6802 = .data:0x8165E1B0; // type:object size:0xD scope:local data:string
|
||||
@6805 = .data:0x8165E1C0; // type:object size:0xC scope:local data:string
|
||||
@6808 = .data:0x8165E1CC; // type:object size:0xD scope:local data:string
|
||||
@6812 = .data:0x8165E1DC; // type:object size:0xC scope:local data:string
|
||||
@6816 = .data:0x8165E1E8; // type:object size:0xC scope:local data:string
|
||||
@6817 = .data:0x8165E1F8; // type:object size:0x10 scope:local data:string
|
||||
@6837 = .data:0x8165E208; // type:object size:0x30 scope:local
|
||||
@6894 = .data:0x8165E238; // type:object size:0xC scope:local data:string
|
||||
@6937 = .data:0x8165E244; // type:object size:0x1C scope:local
|
||||
__vt__Q39textinput7toolbar19ToggleButtonAnmPane = .data:0x8165E260; // type:object size:0x2C
|
||||
__vt__Q39textinput7toolbar19NormalButtonAnmPane = .data:0x8165E28C; // type:object size:0x2C
|
||||
__vt__Q39textinput7toolbar7AnmPane = .data:0x8165E2B8; // type:object size:0x2C
|
||||
@@ -22266,10 +22266,10 @@ lbl_816973C4 = .sdata:0x816973C4; // type:object size:0x4 data:4byte
|
||||
lbl_816973C8 = .sdata:0x816973C8; // type:object size:0x8
|
||||
lbl_816973D0 = .sdata:0x816973D0; // type:object size:0x8 data:string
|
||||
lbl_816973D8 = .sdata:0x816973D8; // type:object size:0x8 data:string
|
||||
lbl_816973E0 = .sdata:0x816973E0; // type:object size:0x4 data:4byte
|
||||
lbl_816973E4 = .sdata:0x816973E4; // type:object size:0x4 data:4byte
|
||||
lbl_816973E8 = .sdata:0x816973E8; // type:object size:0x5 data:string
|
||||
lbl_816973F0 = .sdata:0x816973F0; // type:object size:0x7 data:string
|
||||
COMMON_BUTTON_ANIM__Q29textinput7toolbar = .sdata:0x816973E0; // type:object size:0x4 scope:local data:4byte
|
||||
COMMON_CHG_ANIM__Q29textinput7toolbar = .sdata:0x816973E4; // type:object size:0x4 scope:local data:4byte
|
||||
@6901 = .sdata:0x816973E8; // type:object size:0x5 scope:local data:string
|
||||
@6908 = .sdata:0x816973F0; // type:object size:0x7 scope:local data:string
|
||||
lbl_816973F8 = .sdata:0x816973F8; // type:object size:0x4 data:4byte
|
||||
lbl_81697400 = .sdata:0x81697400; // type:object size:0x4 data:4byte
|
||||
lbl_81697404 = .sdata:0x81697404; // type:object size:0x4 data:4byte
|
||||
|
||||
@@ -8,6 +8,7 @@ MEMORY {
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
IPL_WWW_SURFACE_ZERO__Q37ext_ead3www5print = 0;
|
||||
GROUP: {
|
||||
.init ALIGN(0x20): {}
|
||||
extab ALIGN(0x20): {}
|
||||
@@ -35,3 +36,7 @@ SECTIONS {
|
||||
__ArenaLo = (_db_stack_addr + 0x1F) & ~0x1F;
|
||||
__ArenaHi = $ARENAHI;
|
||||
}
|
||||
|
||||
FORCEACTIVE {
|
||||
$FORCEACTIVE
|
||||
}
|
||||
|
||||
174
configure.py
174
configure.py
@@ -623,12 +623,12 @@ config.libs = [
|
||||
Object(Matching, "system/enc_dummy.c"),
|
||||
Object(Matching, "system/rvl_dec.c"),
|
||||
Object(Matching, "system/RIPL_BoardRecord.c"),
|
||||
Object(Equivalent, "system/iplSystem.cpp"),
|
||||
Object(Matching, "system/iplSystem.cpp"),
|
||||
Object(NonMatching, "system/iplController.cpp"),
|
||||
Object(Matching, "system/iplChannelManager.cpp"),
|
||||
Object(Matching, "system/iplChannelScriptManager.cpp"),
|
||||
Object(Matching, "system/iplNand.cpp"),
|
||||
Object(NonMatching, "system/iplNandShared.cpp"),
|
||||
Object(Matching, "system/iplNandShared.cpp"),
|
||||
Object(Matching, "system/iplNandMeta.cpp"),
|
||||
Object(Matching, "system/iplNandManager.cpp"),
|
||||
Object(Matching, "system/iplNandWall.cpp"),
|
||||
@@ -641,7 +641,7 @@ config.libs = [
|
||||
Object(Matching, "system/iplCdbManager.cpp"),
|
||||
Object(Matching, "system/iplCdbWrapper.cpp"),
|
||||
Object(Matching, "system/iplPlayTimeLog.cpp"),
|
||||
Object(Equivalent, "system/iplNwc24Manager.cpp"),
|
||||
Object(Matching, "system/iplNwc24Manager.cpp"),
|
||||
Object(Matching, "system/iplPointer.cpp"),
|
||||
Object(Matching, "system/iplPointerCore.cpp"),
|
||||
Object(Matching, "system/iplDialogWindow.cpp"),
|
||||
@@ -655,14 +655,14 @@ config.libs = [
|
||||
Object(Matching, "system/iplPostmanManager.cpp"),
|
||||
Object(NonMatching, "system/iplSaveDataManager.cpp"),
|
||||
Object(Matching, "system/iplChannelRsoThread.cpp"),
|
||||
Object(Equivalent, "system/RsoSystem.cpp"),
|
||||
Object(Matching, "system/RsoSystem.cpp"),
|
||||
Object(Matching, "system/iplCdbBackup.cpp"),
|
||||
Object(NonMatching, "system/odh.cpp"),
|
||||
Object(Matching, "system/iplSDVFWorker.cpp"),
|
||||
Object(Matching, "system/iplNandWrapper.cpp"),
|
||||
Object(Matching, "system/main.cpp"),
|
||||
Object(Matching, "system/iplBS2Manager.cpp"),
|
||||
Object(NonMatching, "system/TVRC.cpp"),
|
||||
Object(Matching, "system/TVRC.cpp"),
|
||||
Object(Matching, "system/iplTVRCManager.cpp"),
|
||||
Object(Matching, "system/_DATA_.c"),
|
||||
]
|
||||
@@ -673,7 +673,7 @@ config.libs = [
|
||||
Object(Matching, "utility/iplFrameController.cpp"),
|
||||
Object(Equivalent, "utility/iplGraphics.cpp"),
|
||||
Object(Matching, "utility/iplCapture.cpp"),
|
||||
Object(Equivalent, "utility/iplUtility.cpp"),
|
||||
Object(Matching, "utility/iplUtility.cpp"),
|
||||
Object(Matching, "utility/iplThread.cpp"),
|
||||
Object(Matching, "utility/iplMessageBase.cpp"),
|
||||
Object(Matching, "utility/iplJpegDecoder.cpp"),
|
||||
@@ -692,19 +692,19 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("iplwww", [
|
||||
Object(Equivalent, "iplwww/www_browser.cpp"),
|
||||
Object(Matching, "iplwww/www_browser.cpp"),
|
||||
Object(Matching, "iplwww/www_message.cpp"),
|
||||
Object(Equivalent, "iplwww/www_surface.cpp"),
|
||||
Object(Matching, "iplwww/www_surface.cpp"),
|
||||
Object(Matching, "iplwww/www_thread.cpp"),
|
||||
Object(Matching, "iplwww/www_print.cpp"),
|
||||
Object(Equivalent, "iplwww/www_window.cpp"),
|
||||
Object(Matching, "iplwww/www_window.cpp"),
|
||||
Object(Matching, "iplwww/www_trasition.cpp"),
|
||||
Object(Equivalent, "iplwww/www_wiisetting.cpp"),
|
||||
Object(Matching, "iplwww/www_arcreader.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("homebutton", [
|
||||
Object(Equivalent, "homebutton/HBMBase.cpp"),
|
||||
Object(Matching, "homebutton/HBMBase.cpp"),
|
||||
Object(Matching, "homebutton/HBMAnmController.cpp"),
|
||||
Object(Matching, "homebutton/HBMController.cpp"),
|
||||
Object(Matching, "homebutton/HBMFrameController.cpp"),
|
||||
@@ -740,25 +740,25 @@ config.libs = [
|
||||
Object(Equivalent, "scene/board/iplBoard.cpp"),
|
||||
Object(Equivalent, "scene/board/iplBoardObject.cpp"),
|
||||
Object(Matching, "scene/board/iplBoardSD.cpp"),
|
||||
Object(Equivalent, "scene/board/iplUrlProcessor.cpp"),
|
||||
Object(Matching, "scene/board/iplUrlProcessor.cpp"),
|
||||
Object(Equivalent, "scene/board/iplFocusObject.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("button", [
|
||||
Object(Equivalent, "scene/button/iplButton.cpp"),
|
||||
Object(Matching, "scene/button/iplButton.cpp"),
|
||||
Object(Matching, "scene/button/iplArrow.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("calendar", [
|
||||
Object(Equivalent, "scene/calendar/iplCalendar.cpp"),
|
||||
Object(Equivalent, "scene/calendar/iplDate.cpp"),
|
||||
Object(Matching, "scene/calendar/iplCalendar.cpp"),
|
||||
Object(Matching, "scene/calendar/iplDate.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("channelEdit", [
|
||||
Object(Matching, "scene/channelEdit/iplChannelEdit.cpp"),
|
||||
Object(Equivalent, "scene/channelEdit/iplChanAppBase.cpp"),
|
||||
Object(Equivalent, "scene/channelEdit/iplChanAppBox.cpp"),
|
||||
Object(Equivalent, "scene/channelEdit/iplChanAppEdit.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplChanAppBase.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplChanAppBox.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplChanAppEdit.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplAnmController.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplNandSDCardManager.cpp"),
|
||||
Object(Matching, "scene/channelEdit/iplThumbnail.cpp"),
|
||||
@@ -783,12 +783,12 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("kitayamaTest", [
|
||||
Object(Equivalent, "scene/kitayamaTest/iplKitayamaTest.cpp"),
|
||||
Object(Matching, "scene/kitayamaTest/iplKitayamaTest.cpp"),
|
||||
Object(Matching, "scene/kitayamaTest/nandsdworker_autotest.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("letterWriter", [
|
||||
Object(Equivalent, "scene/letterWriter/iplLetterWriter.cpp"),
|
||||
Object(Matching, "scene/letterWriter/iplLetterWriter.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("limitOver", [
|
||||
@@ -890,16 +890,16 @@ config.libs = [
|
||||
IPLSection("sceneSystem", [
|
||||
Object(Matching, "scene/sceneSystem/iplSceneBase.cpp"),
|
||||
Object(Matching, "scene/sceneSystem/iplSceneCreator.cpp"),
|
||||
Object(Equivalent, "scene/sceneSystem/iplSceneManager.cpp"),
|
||||
Object(Matching, "scene/sceneSystem/iplSceneManager.cpp"),
|
||||
Object(Matching, "scene/sceneSystem/iplFaderSceneBase.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("textWriter", [
|
||||
Object(Equivalent, "scene/textWriter/iplTextWriter.cpp"),
|
||||
Object(Matching, "scene/textWriter/iplTextWriter.cpp"),
|
||||
]
|
||||
),
|
||||
IPLSection("bannerSound", [
|
||||
Object(Equivalent, "bannerSound/AudioWavePlayer.cpp"),
|
||||
Object(Matching, "bannerSound/AudioWavePlayer.cpp"),
|
||||
Object(Equivalent, "bannerSound/AxAdpcmPlayer.cpp"),
|
||||
Object(Matching, "bannerSound/BannerSoundPlayer.cpp"),
|
||||
Object(Matching, "bannerSound/AudioWaveUtility.cpp"),
|
||||
@@ -911,7 +911,7 @@ config.libs = [
|
||||
Object(NonMatching, "keyboard/tiCellPhone.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiInputForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiCandidateBox.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiToolBar.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiPredictLang.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiSignWindow.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiString.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -931,7 +931,7 @@ config.libs = [
|
||||
Object(NonMatching, "keyboard/MyTiLetterForm.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/MyTiBg.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiDebug.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Equivalent, "keyboard/tiGUIManager.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiGUIManager.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiHKBManager.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(NonMatching, "keyboard/tiHwKeyboard.cpp", extra_cflags=["-O4,p"]),
|
||||
Object(Matching, "keyboard/tiLayout.cpp", extra_cflags=["-O4,p"]),
|
||||
@@ -944,7 +944,7 @@ config.libs = [
|
||||
Object(Matching, "channelScript/systemmenu/VmSystem.c"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSSystem.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSLayout.cpp"),
|
||||
Object(Equivalent, "channelScript/systemmenu/iplCSPane.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSPane.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSMaterial.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSTexture.cpp"),
|
||||
Object(Matching, "channelScript/systemmenu/iplCSSavedata.cpp"),
|
||||
@@ -980,7 +980,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
ZI8Lib("zi8clib", [
|
||||
Object(NonMatching, "clib/zaddress.c"),
|
||||
Object(Matching, "clib/zaddress.c"),
|
||||
Object(NonMatching, "clib/zconvert.c"),
|
||||
Object(NonMatching, "clib/zi81key.c"),
|
||||
Object(NonMatching, "clib/zi8alpha.c"),
|
||||
@@ -1001,7 +1001,7 @@ config.libs = [
|
||||
Object(NonMatching, "clib/zi8space.c"),
|
||||
Object(NonMatching, "clib/zi8uwd.c"),
|
||||
Object(Matching, "clib/zi8ver.c"),
|
||||
Object(NonMatching, "clib/zi8ZHuwd.c"),
|
||||
Object(Matching, "clib/zi8ZHuwd.c"),
|
||||
Object(NonMatching, "clib/zidawg1.c"),
|
||||
Object(NonMatching, "clib/zikorean.c"),
|
||||
Object(NonMatching, "clib/ziswordw.c"),
|
||||
@@ -1015,15 +1015,15 @@ config.libs = [
|
||||
# RevoEX
|
||||
RevoEXLib("cdb", [
|
||||
Object(Matching, "cdb/cdb.c"),
|
||||
Object(Equivalent, "cdb/CDBConv.c"), # hmm
|
||||
Object(NonMatching, "cdb/CDBDatabase.c"),
|
||||
Object(Equivalent, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBConv.c"), # hmm
|
||||
Object(Matching, "cdb/CDBDatabase.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBFileSystem.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemVF.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemSD.c"),
|
||||
Object(NonMatching, "cdb/CDBRecord.c"),
|
||||
Object(Matching, "cdb/CDBRecordFile.c"),
|
||||
Object(NonMatching, "cdb/CDBRecordKey.c"),
|
||||
Object(Matching, "cdb/CDBRecordKey.c"),
|
||||
Object(NonMatching, "cdb/CDBIntArray.c"),
|
||||
Object(NonMatching, "cdb/CDBSystem.c"),
|
||||
Object(Equivalent, "cdb/CDBAttr.c"),
|
||||
@@ -1031,7 +1031,7 @@ config.libs = [
|
||||
Object(Matching, "cdb/CDBFBridgeVF.c"),
|
||||
Object(Matching, "cdb/CDBFBridgeSD.c"),
|
||||
Object(Matching, "cdb/CDBId.c"),
|
||||
Object(NonMatching, "cdb/CDBCrypt.c"),
|
||||
Object(Matching, "cdb/CDBCrypt.c"),
|
||||
]
|
||||
),
|
||||
RevoEXLib("ncd", [
|
||||
@@ -1068,12 +1068,12 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RevoEXLib("nwc24", [
|
||||
Object(NonMatching, "nwc24/NWC24StdAPI.c"),
|
||||
Object(Matching, "nwc24/NWC24StdAPI.c"),
|
||||
Object(Matching, "nwc24/NWC24FileAPI.c"),
|
||||
Object(Matching, "nwc24/NWC24Config.c"),
|
||||
Object(Matching, "nwc24/NWC24Utils.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Manage.c"),
|
||||
Object(NonMatching, "nwc24/NWC24MsgObj.c"),
|
||||
Object(Matching, "nwc24/NWC24Manage.c"),
|
||||
Object(Matching, "nwc24/NWC24MsgObj.c"),
|
||||
Object(NonMatching, "nwc24/NWC24MBoxCtrl.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Mime.c"),
|
||||
Object(Matching, "nwc24/NWC24Stream.c"),
|
||||
@@ -1083,18 +1083,18 @@ config.libs = [
|
||||
Object(NonMatching, "nwc24/NWC24MsgSubject.c"),
|
||||
Object(Matching, "nwc24/NWC24Schedule.c"),
|
||||
Object(NonMatching, "nwc24/NWC24DateParser.c"),
|
||||
Object(Equivalent, "nwc24/NWC24FriendList.c"),
|
||||
Object(Matching, "nwc24/NWC24FriendList.c"),
|
||||
Object(Matching, "nwc24/NWC24SecretFList.c"),
|
||||
Object(NonMatching, "nwc24/NWC24UserId.c"),
|
||||
Object(Matching, "nwc24/NWC24UserId.c"),
|
||||
Object(Matching, "nwc24/NWC24Time.c"),
|
||||
Object(Matching, "nwc24/NWC24Ipc.c"),
|
||||
Object(NonMatching, "nwc24/NWC24Download.c"),
|
||||
Object(Equivalent, "nwc24/NWC24CHJump.c"),
|
||||
Object(Matching, "nwc24/NWC24CHJump.c"),
|
||||
Object(NonMatching, "nwc24/NWC24System.c"),
|
||||
]
|
||||
),
|
||||
RevoEXLib("so", [
|
||||
Object(NonMatching, "so/SOCommon.c"),
|
||||
Object(Matching, "so/SOCommon.c"),
|
||||
Object(NonMatching, "so/SOBasic.c"),
|
||||
Object(NonMatching, "so/SOInformation.c"),
|
||||
Object(NonMatching, "so/SOOption.c"),
|
||||
@@ -1159,19 +1159,19 @@ config.libs = [
|
||||
Object(Matching, "vf/system/pf_system.c"),
|
||||
|
||||
Object(Matching, "vf/develop/d_vf.c"),
|
||||
Object(NonMatching, "vf/develop/d_vf_sys.c"),
|
||||
Object(Matching, "vf/develop/d_vf_sys.c"),
|
||||
Object(Matching, "vf/develop/d_hash.c"),
|
||||
Object(Matching, "vf/develop/d_time.c"),
|
||||
Object(Matching, "vf/develop/d_common.c"),
|
||||
Object(NonMatching, "vf/develop/nand_drv.c"),
|
||||
Object(NonMatching, "vf/develop/sd_drv.c"),
|
||||
Object(Matching, "vf/develop/sd_drv.c"),
|
||||
]
|
||||
),
|
||||
RevoEXLib("wd", [
|
||||
Object(Matching, "wd/wd_misc.c"),
|
||||
Object(Matching, "wd/wd_request.c"),
|
||||
Object(Matching, "wd/wd_init.c"),
|
||||
Object(NonMatching, "wd/WDScan.c"),
|
||||
Object(Matching, "wd/WDScan.c"),
|
||||
]
|
||||
),
|
||||
# RVLFaceLib
|
||||
@@ -1197,20 +1197,20 @@ config.libs = [
|
||||
# TMC JPEG
|
||||
TMCJpegLib(
|
||||
[
|
||||
Object(NonMatching, "buffer/mkhdec3.c"),
|
||||
Object(Matching, "buffer/mkhdec3.c"),
|
||||
Object(Matching, "buffer/buffer_system.c"),
|
||||
Object(Equivalent, "buffer/getcode.c"),
|
||||
Object(Matching, "buffer/getcode.c"),
|
||||
Object(NonMatching, "buffer/idct_block_var.c"),
|
||||
|
||||
Object(Matching, "api/decapi.c"),
|
||||
|
||||
Object(Matching, "jpegdec/jdec.c"),
|
||||
Object(NonMatching, "jpegdec/jdec_main.c"),
|
||||
Object(Matching, "jpegdec/jdec_main.c"),
|
||||
Object(Matching, "jpegdec/jpformat.c"),
|
||||
|
||||
Object(NonMatching, "exif/exif_parse.c"),
|
||||
|
||||
Object(Equivalent, "reschange/iqdec_resolution_change_a3.c"),
|
||||
Object(Matching, "reschange/iqdec_resolution_change_a3.c"),
|
||||
Object(NonMatching, "reschange/idct_resolution_change_var.c"),
|
||||
|
||||
Object(NonMatching, "texturecvtr/Texture_MCUtoY8U8V8.c"),
|
||||
@@ -1299,7 +1299,7 @@ config.libs = [
|
||||
Object(Matching, "ut/ut_ResFontBase.cpp"),
|
||||
Object(Matching, "ut/ut_ResFont.cpp"),
|
||||
Object(NonMatching, "ut/ut_ArchiveFontBase.cpp"),
|
||||
Object(NonMatching, "ut/ut_ArchiveFont.cpp"),
|
||||
Object(Matching, "ut/ut_ArchiveFont.cpp"),
|
||||
Object(Matching, "ut/ut_CharWriter.cpp"),
|
||||
Object(Matching, "ut/ut_TextWriterBase.cpp"),
|
||||
]
|
||||
@@ -1446,7 +1446,7 @@ config.libs = [
|
||||
RVLSDKLib("axfx", [
|
||||
Object(Matching, "axfx/AXFXReverbHi.c"),
|
||||
Object(Matching, "axfx/AXFXReverbHiDpl2.c"),
|
||||
Object(NonMatching, "axfx/AXFXReverbHiExp.c"),
|
||||
Object(Matching, "axfx/AXFXReverbHiExp.c"),
|
||||
Object(NonMatching, "axfx/AXFXReverbHiExpDpl2.c"),
|
||||
Object(Matching, "axfx/AXFXDelay.c"),
|
||||
Object(Matching, "axfx/AXFXReverbStd.c"),
|
||||
@@ -1483,7 +1483,7 @@ config.libs = [
|
||||
Object(Matching, "card/CARDBios.c"),
|
||||
Object(Matching, "card/CARDUnlock.c"),
|
||||
Object(Matching, "card/CARDRdwr.c"),
|
||||
Object(Equivalent, "card/CARDBlock.c"),
|
||||
Object(Matching, "card/CARDBlock.c"),
|
||||
Object(Matching, "card/CARDDir.c"),
|
||||
Object(Matching, "card/CARDCheck.c"),
|
||||
Object(Matching, "card/CARDMount.c"),
|
||||
@@ -1550,7 +1550,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("wpad", [
|
||||
Object(Equivalent, "wpad/WPAD.c"),
|
||||
Object(Matching, "wpad/WPAD.c"),
|
||||
Object(NonMatching, "wpad/WPADHIDParser.c"),
|
||||
Object(Matching, "wpad/WPADMem.c"),
|
||||
Object(Matching, "wpad/WPADEncrypt.c"),
|
||||
@@ -1699,7 +1699,7 @@ config.libs = [
|
||||
Object(NonMatching, "fa/pf_fat12.c"),
|
||||
Object(NonMatching, "fa/pf_fat16.c"),
|
||||
Object(NonMatching, "fa/pf_fat32.c"),
|
||||
Object(NonMatching, "fa/pf_fatfs.c"),
|
||||
Object(Matching, "fa/pf_fatfs.c"),
|
||||
Object(NonMatching, "fa/pf_file.c"),
|
||||
Object(NonMatching, "fa/pf_path.c"),
|
||||
Object(NonMatching, "fa/pf_sector.c"),
|
||||
@@ -1714,7 +1714,7 @@ config.libs = [
|
||||
Object(NonMatching, "fa/pf_chdmod.c"),
|
||||
Object(NonMatching, "fa/pf_chmod.c"),
|
||||
Object(NonMatching, "fa/pf_cinsert.c"),
|
||||
Object(NonMatching, "fa/pf_closedir.c"),
|
||||
Object(Matching, "fa/pf_closedir.c"),
|
||||
Object(NonMatching, "fa/pf_combine.c"),
|
||||
Object(NonMatching, "fa/pf_create.c"),
|
||||
Object(NonMatching, "fa/pf_createdir.c"),
|
||||
@@ -1722,27 +1722,27 @@ config.libs = [
|
||||
Object(NonMatching, "fa/pf_derrnum.c"),
|
||||
Object(NonMatching, "fa/pf_detach.c"),
|
||||
Object(NonMatching, "fa/pf_divide.c"),
|
||||
Object(NonMatching, "fa/pf_errnum.c"),
|
||||
Object(Matching, "fa/pf_errnum.c"),
|
||||
Object(NonMatching, "fa/pf_fadjust.c"),
|
||||
Object(NonMatching, "fa/pf_fappend.c"),
|
||||
Object(NonMatching, "fa/pf_fchdir.c"),
|
||||
Object(NonMatching, "fa/pf_fclose.c"),
|
||||
Object(Matching, "fa/pf_fclose.c"),
|
||||
Object(NonMatching, "fa/pf_fconcat.c"),
|
||||
Object(NonMatching, "fa/pf_feof.c"),
|
||||
Object(NonMatching, "fa/pf_ferror.c"),
|
||||
Object(Matching, "fa/pf_feof.c"),
|
||||
Object(Matching, "fa/pf_ferror.c"),
|
||||
Object(NonMatching, "fa/pf_finfo.c"),
|
||||
Object(NonMatching, "fa/pf_flock.c"),
|
||||
Object(Matching, "fa/pf_flock.c"),
|
||||
Object(NonMatching, "fa/pf_fopen.c"),
|
||||
Object(NonMatching, "fa/pf_format.c"),
|
||||
Object(NonMatching, "fa/pf_fread.c"),
|
||||
Object(Matching, "fa/pf_fread.c"),
|
||||
Object(NonMatching, "fa/pf_fseek.c"),
|
||||
Object(NonMatching, "fa/pf_fsetclstlink.c"),
|
||||
Object(NonMatching, "fa/pf_fsexec.c"),
|
||||
Object(NonMatching, "fa/pf_fsfirst.c"),
|
||||
Object(NonMatching, "fa/pf_fsnext.c"),
|
||||
Object(NonMatching, "fa/pf_fstat.c"),
|
||||
Object(NonMatching, "fa/pf_fsync.c"),
|
||||
Object(NonMatching, "fa/pf_fwrite.c"),
|
||||
Object(Matching, "fa/pf_fsync.c"),
|
||||
Object(Matching, "fa/pf_fwrite.c"),
|
||||
Object(NonMatching, "fa/pf_getdev.c"),
|
||||
Object(NonMatching, "fa/pf_getvol.c"),
|
||||
Object(NonMatching, "fa/pf_getvolcfg.c"),
|
||||
@@ -1831,19 +1831,19 @@ config.libs = [
|
||||
Object(NonMatching, "fa/api/FACreatedir.c"),
|
||||
Object(NonMatching, "fa/api/FADetach.c"),
|
||||
Object(NonMatching, "fa/api/FAErrnum.c"),
|
||||
Object(NonMatching, "fa/api/FAFclose.c"),
|
||||
Object(NonMatching, "fa/api/FAFinfo.c"),
|
||||
Object(Matching, "fa/api/FAFclose.c"),
|
||||
Object(Matching, "fa/api/FAFinfo.c"),
|
||||
Object(NonMatching, "fa/api/FAFopen.c"),
|
||||
Object(NonMatching, "fa/api/FAFormat.c"),
|
||||
Object(NonMatching, "fa/api/FAFread.c"),
|
||||
Object(Matching, "fa/api/FAFread.c"),
|
||||
Object(NonMatching, "fa/api/FAFseek.c"),
|
||||
Object(NonMatching, "fa/api/FAFsfirst.c"),
|
||||
Object(NonMatching, "fa/api/FAFsnext.c"),
|
||||
Object(NonMatching, "fa/api/FAFstat.c"),
|
||||
Object(NonMatching, "fa/api/FAFwrite.c"),
|
||||
Object(Matching, "fa/api/FAFwrite.c"),
|
||||
Object(NonMatching, "fa/api/FAGetdev.c"),
|
||||
Object(NonMatching, "fa/api/FAInit.c"),
|
||||
Object(NonMatching, "fa/api/FAInitDiskManager.c"),
|
||||
Object(Matching, "fa/api/FAInitDiskManager.c"),
|
||||
Object(NonMatching, "fa/api/FAMount.c"),
|
||||
Object(NonMatching, "fa/api/FARegistCB.c"),
|
||||
Object(NonMatching, "fa/api/FARemove.c"),
|
||||
@@ -1863,7 +1863,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("sdi", [
|
||||
Object(NonMatching, "sdi/sdi_api.c"),
|
||||
Object(Matching, "sdi/sdi_api.c"),
|
||||
]
|
||||
),
|
||||
RVLSDKLib("nup", [
|
||||
@@ -1899,17 +1899,17 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
RVLSDKLib("cntcache", [
|
||||
Object(NonMatching, "cntcache/cntcache.c"),
|
||||
Object(Matching, "cntcache/cntcache.c"),
|
||||
]
|
||||
),
|
||||
# EGG library (for Nintendo EAD software)
|
||||
EGGLib(
|
||||
[
|
||||
Object(Matching, "core/eggAllocator.cpp"),
|
||||
Object(Equivalent, "core/eggAudioArcPlayerMgr.cpp"),
|
||||
Object(Matching, "core/eggAudioArcPlayerMgr.cpp"),
|
||||
Object(Equivalent, "core/eggAudioExpMgr.cpp"),
|
||||
Object(Matching, "core/eggAudioFxMgr.cpp"),
|
||||
Object(Equivalent, "core/eggAudioMgr.cpp"),
|
||||
Object(Matching, "core/eggAudioMgr.cpp"),
|
||||
Object(Matching, "core/eggAudioHeapMgr.cpp"),
|
||||
Object(Matching, "core/eggColorFader.cpp"),
|
||||
Object(Matching, "core/eggDisposer.cpp"),
|
||||
@@ -1940,44 +1940,44 @@ config.libs = [
|
||||
),
|
||||
# MSL Library
|
||||
MSLLib("MSL_C.PPCEABI.bare.H", [
|
||||
Object(NonMatching, "MSL_Common/alloc.c"),
|
||||
Object(Matching, "MSL_Common/alloc.c"),
|
||||
Object(Matching, "MSL_Common/errno.c"),
|
||||
Object(NonMatching, "MSL_Common/ansi_files.c"),
|
||||
Object(Matching, "MSL_Common/ansi_files.c"),
|
||||
Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c"),
|
||||
Object(Matching, "MSL_Common/ctype.c"),
|
||||
Object(NonMatching, "MSL_Common/locale.c"),
|
||||
Object(NonMatching, "MSL_Common/arith.c"),
|
||||
Object(NonMatching, "MSL_Common/bsearch.c"),
|
||||
Object(NonMatching, "MSL_Common/buffer_io.c"),
|
||||
Object(NonMatching, "MSL_Common/direct_io.c"),
|
||||
Object(Matching, "MSL_Common/arith.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/bsearch.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/buffer_io.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/direct_io.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/file_io.c"),
|
||||
Object(NonMatching, "MSL_Common/FILE_POS.c"),
|
||||
Object(NonMatching, "MSL_Common/mbstring.c"),
|
||||
Object(Matching, "MSL_Common/FILE_POS.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/mbstring.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/mem.c"),
|
||||
Object(Matching, "MSL_Common/mem_funcs.c"),
|
||||
Object(Matching, "MSL_Common/math_api.c"),
|
||||
Object(NonMatching, "MSL_Common/misc_io.c"),
|
||||
Object(Matching, "MSL_Common/misc_io.c"),
|
||||
Object(NonMatching, "MSL_Common/printf.c"),
|
||||
Object(NonMatching, "MSL_Common/qsort.c"),
|
||||
Object(Matching, "MSL_Common/qsort.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/rand.c"),
|
||||
Object(NonMatching, "MSL_Common/scanf.c"),
|
||||
Object(NonMatching, "MSL_Common/signal.c"),
|
||||
Object(NonMatching, "MSL_Common/string.c"),
|
||||
Object(Matching, "MSL_Common/signal.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/string.c"),
|
||||
Object(Matching, "MSL_Common/float.c"),
|
||||
Object(NonMatching, "MSL_Common/strtold.c"),
|
||||
Object(NonMatching, "MSL_Common/strtoul.c"),
|
||||
Object(Matching, "MSL_Common/strtoul.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/time.c"),
|
||||
Object(NonMatching, "MSL_Common/wctype.c"),
|
||||
Object(Matching, "MSL_Common/wctype.c"),
|
||||
Object(Matching, "MSL_Common/wmem.c"),
|
||||
Object(NonMatching, "MSL_Common/wprintf.c"),
|
||||
Object(NonMatching, "MSL_Common/wstring.c"),
|
||||
Object(NonMatching, "MSL_Common/wchar_io.c"),
|
||||
Object(Matching, "MSL_Common/wstring.c"),
|
||||
Object(Matching, "MSL_Common/wchar_io.c"),
|
||||
Object(Matching, "PPC_EABI/time.dolphin.c"),
|
||||
Object(Matching, "PPC_EABI/sysenv.GCN.c"),
|
||||
Object(Matching, "PPC_EABI/uart_console_io_gcn.c"),
|
||||
Object(Matching, "PPC_EABI/abort_exit_ppc_eabi.c"),
|
||||
Object(NonMatching, "MSL_Common/math_sun.c"),
|
||||
Object(NonMatching, "MSL_Common/extras.c"),
|
||||
Object(Matching, "MSL_Common/math_sun.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(Matching, "MSL_Common/extras.c"),
|
||||
|
||||
Object(Matching, "MSL_Common_Embedded/Math/e_acos.c"),
|
||||
Object(Matching, "MSL_Common_Embedded/Math/e_asin.c"),
|
||||
|
||||
@@ -30,9 +30,9 @@ private:
|
||||
class WaveFileAiff : public WaveFile {
|
||||
public:
|
||||
WaveFileAiff();
|
||||
virtual ~WaveFileAiff() {}
|
||||
|
||||
virtual u32 getBit() const override;
|
||||
virtual ~WaveFileAiff();
|
||||
virtual int getChannels() const override { return mNumChans; }
|
||||
virtual f64 getSamplingRate() const override { return mSamplingRate; }
|
||||
virtual s32 getFrames() const override;
|
||||
@@ -67,9 +67,9 @@ private:
|
||||
class WaveFileWav : public WaveFile {
|
||||
public:
|
||||
WaveFileWav();
|
||||
virtual ~WaveFileWav() {}
|
||||
|
||||
virtual u32 getBit() const override;
|
||||
virtual ~WaveFileWav();
|
||||
virtual int getChannels() const override { return mNumChans; }
|
||||
virtual f64 getSamplingRate() const override { return mSamplingRate; }
|
||||
virtual s32 getFrames() const override;
|
||||
|
||||
@@ -272,20 +272,20 @@ namespace homebutton {
|
||||
f32 mFadeOutSeTime; // 0x798
|
||||
|
||||
private:
|
||||
static const int scSoundHeapSize_but2;
|
||||
static const int scSoundHeapSize_but3;
|
||||
static const int scSoundThreadPrio;
|
||||
static const int scDvdThreadPrio;
|
||||
static const int scSoundHeapSize_but2 = 0x60000;
|
||||
static const int scSoundHeapSize_but3 = 0x6f800;
|
||||
static const int scSoundThreadPrio = 4;
|
||||
static const int scDvdThreadPrio = 3;
|
||||
|
||||
static const int scReConnectTime;
|
||||
static const int scReConnectTime2;
|
||||
static const int scPadDrawWaitTime;
|
||||
static const int scGetPadInfoTime;
|
||||
static const int scForcusSEWaitTime;
|
||||
static const int scReConnectTime = 3600;
|
||||
static const int scReConnectTime2 = 3570;
|
||||
static const int scPadDrawWaitTime = 5;
|
||||
static const int scGetPadInfoTime = 100;
|
||||
static const int scForcusSEWaitTime = 2;
|
||||
static const f32 scOnPaneVibTime;
|
||||
static const f32 scOnPaneVibWaitTime;
|
||||
static const int scWaitStopMotorTime;
|
||||
static const int scWaitDisConnectTime;
|
||||
static const int scWaitStopMotorTime = 30;
|
||||
static const int scWaitDisConnectTime = 180;
|
||||
|
||||
static const char* scCursorLytName[res::eCursorLyt_Max];
|
||||
static const char* scCursorPaneName;
|
||||
|
||||
@@ -139,6 +139,9 @@ namespace ext_ead {
|
||||
u32 unk_0x14; // 0x14
|
||||
u32 unk_0x18; // 0x18
|
||||
u32 maxLength; // 0x1c
|
||||
|
||||
ImeData& operator=(const ImeData&);
|
||||
|
||||
} ImeData;
|
||||
|
||||
class BrowserThread : public ut_thread {
|
||||
@@ -170,6 +173,9 @@ namespace ext_ead {
|
||||
} updateIme; // ID 4
|
||||
u32 raw[6];
|
||||
} data;
|
||||
|
||||
CmdPacket& operator=(const CmdPacket&);
|
||||
|
||||
};
|
||||
|
||||
BrowserThread();
|
||||
|
||||
@@ -48,13 +48,21 @@ namespace ext_ead {
|
||||
extern const char* Message[6];
|
||||
|
||||
// TODO: sort out this messy match hack
|
||||
#ifdef IPL_WWW_SURFACE_MESSAGE
|
||||
#define IPL_WWW_SURFACE_ZERO_DECL __declspec(weak) extern const char IPL_WWW_SURFACE_ZERO[];
|
||||
#define IPL_WWW_STRIPPED_MESSAGE print::IPL_WWW_SURFACE_ZERO
|
||||
#else
|
||||
#define IPL_WWW_SURFACE_ZERO_DECL
|
||||
#define IPL_WWW_STRIPPED_MESSAGE ""
|
||||
#endif
|
||||
IPL_WWW_SURFACE_ZERO_DECL
|
||||
#define IPL_WWW_REPORT_REDEFINE_MESSAGE(RESPECT_STRIP) \
|
||||
char MSG_TICK_TIMER_TAG[12] = "[TickTimer]"; \
|
||||
char MSG_WARNING_TAG[10] = "[Warning]"; \
|
||||
char MSG_EVENT_TAG[10] = "[[Event]]"; \
|
||||
const char* Message[] = { \
|
||||
RESPECT_STRIP ? NULL : MSG_TICK_TIMER_TAG, RESPECT_STRIP ? NULL : MSG_WARNING_TAG, RESPECT_STRIP ? NULL : "[Info]", \
|
||||
RESPECT_STRIP ? NULL : "[Debug]", RESPECT_STRIP ? "" : MSG_EVENT_TAG, RESPECT_STRIP ? NULL : "", \
|
||||
RESPECT_STRIP ? NULL : "[Debug]", RESPECT_STRIP ? IPL_WWW_STRIPPED_MESSAGE : MSG_EVENT_TAG, RESPECT_STRIP ? NULL : "", \
|
||||
};
|
||||
} // namespace print
|
||||
} // namespace www
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace textinput {
|
||||
public:
|
||||
PaneComponent(u32 id) : GUIComponent(id) { mpPane = NULL; }
|
||||
|
||||
virtual ~PaneComponent() {} // 0x08
|
||||
virtual ~PaneComponent(); // 0x08
|
||||
|
||||
virtual void draw(); // 0x1C
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ namespace textinput {
|
||||
virtual void autoScroll();
|
||||
|
||||
virtual bool doWordWrap(const wchar_t* string, u32, f32);
|
||||
f32 getWordWrapRectWidth() const { return mRect.right - mRect.left; }
|
||||
virtual void drawFixString(u32);
|
||||
|
||||
virtual void onSE(sound::SE seId);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace textinput {
|
||||
virtual void isEnableCursorCache();
|
||||
virtual void getDrawModifyStartLine();
|
||||
virtual void getDrawModifyEndLine();
|
||||
virtual void getDrawCacheStartPos();
|
||||
virtual u32 getDrawCacheStartPos() const;
|
||||
virtual void dirtyDrawCache();
|
||||
virtual void dirtyCursorCache();
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ namespace textinput {
|
||||
namespace toolbar {
|
||||
class Base {
|
||||
public:
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
Base(Manager* manager) : mQwerty(true), meLanguage(USA), mpAllocator(NULL), mpManager(manager) {}
|
||||
#endif
|
||||
|
||||
virtual void create(MEMAllocator* allocator) { mpAllocator = allocator; }
|
||||
virtual void init() {}
|
||||
virtual bool isQwerty() const { return mQwerty; }
|
||||
@@ -31,6 +35,12 @@ namespace textinput {
|
||||
|
||||
class LayoutByNW4R : public Base, public nw4rmanager::Layout {
|
||||
public:
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
LayoutByNW4R(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
|
||||
: Base(manager), nw4rmanager::Layout(resAccessor, "fs_VK_toolbar_a.brlyt", observer), mpEventHandler(NULL),
|
||||
mbIsEnableQwertyChg(false) {}
|
||||
#endif
|
||||
|
||||
virtual ~LayoutByNW4R();
|
||||
virtual void create(MEMAllocator* allocator) override;
|
||||
virtual void init() override;
|
||||
@@ -107,7 +117,16 @@ namespace textinput {
|
||||
KeyType meKeyType; // 0x30
|
||||
};
|
||||
|
||||
#ifdef TI_TOOLBAR_SAMPLE_CLASS
|
||||
class Sample : public LayoutByNW4R {
|
||||
public:
|
||||
Sample(Manager* manager, nw4r::lyt::MultiArcResourceAccessor* resAccessor, EventObserver* observer)
|
||||
: LayoutByNW4R(manager, resAccessor, observer) {}
|
||||
virtual ~Sample() {}
|
||||
};
|
||||
#else
|
||||
class Sample {};
|
||||
#endif
|
||||
|
||||
class NormalButtonAnmPane : public AnmPane {
|
||||
public:
|
||||
|
||||
@@ -30,10 +30,18 @@ namespace gui {
|
||||
virtual void draw(Mtx& mtx) {} // 0x14 (0x05)
|
||||
virtual void draw() {} // 0x18 (0x06)
|
||||
|
||||
virtual ~Interface() {} // 0x1C (0x07)
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
virtual ~Interface(); // 0x1C (0x07)
|
||||
#else
|
||||
virtual ~Interface() {} // 0x1C (0x07)
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
class __declspec(novtable) EventHandler {
|
||||
#else
|
||||
class EventHandler {
|
||||
#endif
|
||||
public:
|
||||
enum {
|
||||
ON_TRIG = 0,
|
||||
|
||||
@@ -11,14 +11,18 @@
|
||||
namespace ipl {
|
||||
namespace gui {
|
||||
class PaneComponent : public ::gui::PaneComponent {};
|
||||
class PaneManager : public ::gui::PaneManager {
|
||||
class PaneManager : public ::gui::PaneManager {
|
||||
public:
|
||||
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) {}
|
||||
|
||||
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
||||
virtual ~PaneManager();
|
||||
#else
|
||||
virtual ~PaneManager() {}
|
||||
#endif
|
||||
|
||||
void update();
|
||||
void update(int chan);
|
||||
|
||||
@@ -44,6 +44,94 @@ 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 {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
|
||||
void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
||||
|
||||
T get() const {
|
||||
f32 var_f27 = mFrame;
|
||||
f32 var_f28 = 1.0f / mMaxFrame;
|
||||
T r =
|
||||
(mStart *
|
||||
(1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) -
|
||||
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
||||
r +=
|
||||
(unkVal0 *
|
||||
(var_f27 +
|
||||
((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
||||
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (var_f27 * var_f27))));
|
||||
|
||||
return r;
|
||||
|
||||
/*f32 var_f27 = mMaxFrame;
|
||||
f32 var_f28 = 1.0f / mMaxFrame;
|
||||
T sp28 = mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))));
|
||||
T sp1C = mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
||||
T r = sp1C - sp28;
|
||||
|
||||
f32 temp_f4 = var_f27 * var_f27;
|
||||
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
||||
f32 temp_f3 =
|
||||
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
||||
r = r + temp_f3;
|
||||
return r;*/
|
||||
}
|
||||
|
||||
protected:
|
||||
T mStart;
|
||||
T mEnd;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
|
||||
template <>
|
||||
class HermiteIntp<f32> : public utility::FrameController {
|
||||
public:
|
||||
HermiteIntp() {}
|
||||
virtual ~HermiteIntp();
|
||||
|
||||
void init(const f32& start, const f32& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD,
|
||||
f32 speed = 1.0f);
|
||||
|
||||
f32 get() const {
|
||||
f32 var_f27 = mFrame;
|
||||
f32 var_f28 = 1.0f / mMaxFrame;
|
||||
f32 r =
|
||||
(mStart *
|
||||
(1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) -
|
||||
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
||||
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
||||
r +=
|
||||
(unkVal0 *
|
||||
(var_f27 + ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
||||
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
||||
(var_f28 * (var_f27 * var_f27))));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
protected:
|
||||
f32 mStart;
|
||||
f32 mEnd;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
|
||||
#pragma dont_instantiate HermiteIntp<float>
|
||||
#else
|
||||
template <typename T>
|
||||
class HermiteIntp : public Interporation<T> {
|
||||
public:
|
||||
@@ -94,6 +182,8 @@ namespace ipl {
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace math
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -3,7 +3,15 @@
|
||||
|
||||
#include <revolution/types.h>
|
||||
|
||||
#ifdef IPL_ANM_CONTROLLER_FORWARD_GUI
|
||||
namespace ipl {
|
||||
namespace gui {
|
||||
class PaneManager;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#include "layout/iplGuiManager.h"
|
||||
#endif
|
||||
#include "layout/iplLayout.h"
|
||||
|
||||
namespace ipl {
|
||||
|
||||
@@ -404,7 +404,12 @@ namespace ipl {
|
||||
int mModuleIndex; // 0x400
|
||||
EGG::ExpHeap* mpCSHeap; // 0x404
|
||||
|
||||
static ESTicketView msTicketView;
|
||||
struct TicketViewStorage {
|
||||
ESTicketView view;
|
||||
u8 pad[8];
|
||||
};
|
||||
|
||||
static TicketViewStorage msTicketView;
|
||||
static ESTicketView msUnlockTicket;
|
||||
|
||||
static const char* mscBtnNames[BTN_MAX];
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace EGG {
|
||||
|
||||
class SoundHeapMgr {
|
||||
public:
|
||||
SoundHeapMgr() NO_INLINE {}
|
||||
SoundHeapMgr();
|
||||
|
||||
~SoundHeapMgr() { destroySoundHeap(); }
|
||||
|
||||
|
||||
@@ -17,14 +17,7 @@ namespace EGG {
|
||||
s32 soundThreadPrio; // 0x08
|
||||
s32 dvdThreadPrio; // 0x0C
|
||||
|
||||
Arg() NO_INLINE {
|
||||
pHeap = NULL;
|
||||
|
||||
soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY;
|
||||
dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY;
|
||||
|
||||
unk_0x04 = 0;
|
||||
}
|
||||
Arg();
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
@@ -44,32 +44,32 @@ namespace EGG {
|
||||
mpArchive = &mDvdSoundArchive;
|
||||
|
||||
if (pDvdArchive->Open(pPath)) {
|
||||
u32 headerSize;
|
||||
u32 setupSize;
|
||||
u32 strmSize;
|
||||
u32 stringSize;
|
||||
mbIsOpeningArchive = true;
|
||||
headerSize = pDvdArchive->GetHeaderSize();
|
||||
|
||||
u32 headerSize = pDvdArchive->GetHeaderSize();
|
||||
void* pHeaderBuffer = pHeap->Alloc(headerSize, NULL, NULL);
|
||||
|
||||
if (!pDvdArchive->LoadHeader(pHeaderBuffer, headerSize)) {
|
||||
if (!pDvdArchive->LoadHeader(pHeap->Alloc(headerSize, NULL, NULL), headerSize)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 setupSize = mSoundArchivePlayer.GetRequiredMemSize(pDvdArchive);
|
||||
u32 strmSize = mSoundArchivePlayer.GetRequiredStrmBufferSize(pDvdArchive);
|
||||
void* pSetupBuffer = pHeap->Alloc(setupSize, NULL, NULL);
|
||||
void* pStrmBuffer = pHeap->Alloc(strmSize, NULL, NULL);
|
||||
setupSize = mSoundArchivePlayer.GetRequiredMemSize(pDvdArchive);
|
||||
strmSize = mSoundArchivePlayer.GetRequiredStrmBufferSize(pDvdArchive);
|
||||
|
||||
if (!mSoundArchivePlayer.Setup(pDvdArchive, pSetupBuffer, setupSize, pStrmBuffer, strmSize)) {
|
||||
if (!mSoundArchivePlayer.Setup(pDvdArchive, pHeap->Alloc(setupSize, NULL, NULL), setupSize,
|
||||
pHeap->Alloc(strmSize, NULL, NULL), strmSize)) {
|
||||
mbIsOpeningArchive = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 stringSize = pDvdArchive->GetLabelStringDataSize();
|
||||
void* pStringBuffer = pHeap->Alloc(stringSize, NULL, NULL);
|
||||
stringSize = pDvdArchive->GetLabelStringDataSize();
|
||||
|
||||
pDvdArchive->LoadLabelStringData(pStringBuffer, stringSize);
|
||||
pDvdArchive->LoadLabelStringData(pHeap->Alloc(stringSize, NULL, NULL), stringSize);
|
||||
|
||||
mStorage = SARC_STORAGE_DVD;
|
||||
mbIsOpeningArchive = false;
|
||||
mStorage = SARC_STORAGE_DVD;
|
||||
return &mSoundArchivePlayer;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
#include <revolution/ax.h>
|
||||
|
||||
namespace EGG {
|
||||
IAudioMgr::Arg::Arg() {
|
||||
pHeap = NULL;
|
||||
|
||||
soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY;
|
||||
dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY;
|
||||
|
||||
unk_0x04 = 0;
|
||||
}
|
||||
|
||||
SimpleAudioMgr::SimpleAudioMgrArg::SimpleAudioMgrArg() {
|
||||
soundHeapSize = DEFAULT_SOUND_HEAP_SIZE;
|
||||
}
|
||||
@@ -14,6 +23,8 @@ namespace EGG {
|
||||
SimpleAudioMgr::SimpleAudioMgr() : ArcPlayer(&getSoundHeap()) {
|
||||
}
|
||||
|
||||
SoundHeapMgr::SoundHeapMgr() {}
|
||||
|
||||
SimpleAudioMgr::~SimpleAudioMgr() {
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,19 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIGNAL_ACTION_DEFAULT ((__signal_func_ptr)0)
|
||||
#define SIGNAL_ACTION_IGNORE ((__signal_func_ptr)1)
|
||||
|
||||
#define SIGNAL_ABORT 1
|
||||
#define SIGNAL_UNK2 2
|
||||
#define SIGNAL_UNK3 3
|
||||
#define SIGNAL_UNK4 4
|
||||
#define SIGNAL_UNK5 5
|
||||
#define SIGNAL_UNK6 6
|
||||
#define SIGNAL_UNK7 7
|
||||
|
||||
typedef void (*__signal_func_ptr)(int);
|
||||
|
||||
int raise(int signal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
112
libs/MSL/src/MSL_Common/FILE_POS.c
Normal file
112
libs/MSL/src/MSL_Common/FILE_POS.c
Normal file
@@ -0,0 +1,112 @@
|
||||
#include <errno.h>
|
||||
#include <internal/file_struct.h>
|
||||
#include <stdio.h>
|
||||
|
||||
enum file_kinds {
|
||||
file_closed,
|
||||
file_disk,
|
||||
file_console,
|
||||
file_unavailable
|
||||
};
|
||||
|
||||
enum io_states {
|
||||
neutral,
|
||||
writing,
|
||||
reading,
|
||||
rereading
|
||||
};
|
||||
|
||||
enum io_modes {
|
||||
io_read = 1,
|
||||
io_write = 2,
|
||||
io_append = 4
|
||||
};
|
||||
|
||||
int __flush_buffer(FILE* file, size_t* pos);
|
||||
|
||||
long _ftell(FILE* file) {
|
||||
int buf = 0;
|
||||
int pos;
|
||||
|
||||
unsigned char file_kind = file->mode.file_kind;
|
||||
if (!(file_kind == file_disk || file_kind == file_console) || file->state.error) {
|
||||
errno = EFPOS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->state.io_state == neutral) {
|
||||
return file->pos;
|
||||
}
|
||||
|
||||
pos = file->buffer_pos + (file->buffer_ptr - file->buffer);
|
||||
|
||||
if (file->state.io_state >= rereading) {
|
||||
buf = file->state.io_state - reading;
|
||||
pos -= buf;
|
||||
}
|
||||
|
||||
if (!file->mode.binary_io) {
|
||||
int n = file->buffer_ptr - file->buffer - buf;
|
||||
unsigned char* p = file->buffer;
|
||||
|
||||
while (n-- != 0) {
|
||||
if (*p++ == '\n') {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
long ftell(FILE* stream) {
|
||||
return _ftell(stream);
|
||||
}
|
||||
|
||||
int _fseek(FILE* file, long offset, int whence) {
|
||||
if (file->mode.file_kind != file_disk || file->state.error != 0) {
|
||||
errno = EFPOS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (file->state.io_state == writing) {
|
||||
if (__flush_buffer(file, 0) != 0) {
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
errno = EFPOS;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (whence == 1) {
|
||||
whence = 0;
|
||||
offset += _ftell(file);
|
||||
}
|
||||
|
||||
if ((whence != 2) && file->mode.io_mode != (io_read | io_write) && (file->state.io_state == reading || file->state.io_state == rereading)) {
|
||||
if ((offset >= file->pos) || offset < file->buffer_pos) {
|
||||
file->state.io_state = neutral;
|
||||
} else {
|
||||
file->buffer_ptr = file->buffer + (offset - file->buffer_pos);
|
||||
file->buffer_len = file->pos - offset;
|
||||
file->state.io_state = reading;
|
||||
}
|
||||
} else {
|
||||
file->state.io_state = neutral;
|
||||
}
|
||||
|
||||
if (file->state.io_state == neutral) {
|
||||
if (file->pos_proc != 0 && (*file->pos_proc)(file->handle, &offset, whence, file->ref)) {
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
errno = EFPOS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
file->state.eof = 0;
|
||||
file->pos = offset;
|
||||
file->buffer_len = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3,144 +3,151 @@
|
||||
#pragma exceptions on
|
||||
|
||||
extern void __sys_free(void* ptr);
|
||||
|
||||
typedef struct Block {
|
||||
struct Block* prev;
|
||||
struct Block* next;
|
||||
unsigned int max_size;
|
||||
unsigned int size;
|
||||
} Block;
|
||||
|
||||
typedef struct SubBlock {
|
||||
unsigned int size;
|
||||
Block* block;
|
||||
struct SubBlock* prev;
|
||||
struct SubBlock* next;
|
||||
} SubBlock;
|
||||
|
||||
struct FixSubBlock;
|
||||
|
||||
typedef struct FixBlock {
|
||||
struct FixBlock* prev_;
|
||||
struct FixBlock* next_;
|
||||
unsigned int client_size_;
|
||||
struct FixSubBlock* start_;
|
||||
unsigned int n_allocated_;
|
||||
} FixBlock;
|
||||
|
||||
typedef struct FixSubBlock {
|
||||
FixBlock* block_;
|
||||
struct FixSubBlock* next_;
|
||||
} FixSubBlock;
|
||||
|
||||
typedef struct FixStart {
|
||||
FixBlock* tail_;
|
||||
FixBlock* head_;
|
||||
} FixStart;
|
||||
|
||||
typedef struct __mem_pool_obj {
|
||||
Block* start_;
|
||||
FixStart fix_start[6];
|
||||
} __mem_pool_obj;
|
||||
extern void* __sys_alloc(unsigned int size);
|
||||
|
||||
typedef struct __mem_pool {
|
||||
void* reserved[14];
|
||||
} __mem_pool;
|
||||
|
||||
typedef int tag_word;
|
||||
typedef struct Block {
|
||||
struct Block* pPrev;
|
||||
struct Block* pNext;
|
||||
unsigned int maxSize;
|
||||
unsigned int size;
|
||||
} Block;
|
||||
|
||||
typedef struct block_header {
|
||||
tag_word tag;
|
||||
struct block_header* prev;
|
||||
struct block_header* next;
|
||||
} block_header;
|
||||
typedef struct SubBlock {
|
||||
unsigned int size;
|
||||
Block* pBlock;
|
||||
struct SubBlock* pPrev;
|
||||
struct SubBlock* pNext;
|
||||
} SubBlock;
|
||||
|
||||
typedef struct list_header {
|
||||
block_header* rover;
|
||||
block_header header;
|
||||
} list_header;
|
||||
struct FixSubBlock;
|
||||
|
||||
typedef struct heap_header {
|
||||
struct heap_header* prev;
|
||||
struct heap_header* next;
|
||||
} heap_header;
|
||||
typedef struct FixBlock {
|
||||
struct FixBlock* pPrev;
|
||||
struct FixBlock* pNext;
|
||||
unsigned int clientSize;
|
||||
struct FixSubBlock* pStart;
|
||||
unsigned int allocatedSize;
|
||||
} FixBlock;
|
||||
|
||||
struct mem_pool_obj;
|
||||
typedef void* (*sys_alloc_ptr)(unsigned int, struct mem_pool_obj*);
|
||||
typedef void (*sys_free_ptr)(void*, struct mem_pool_obj*);
|
||||
typedef struct FixSubBlock {
|
||||
FixBlock* pBlock;
|
||||
struct FixSubBlock* pNext;
|
||||
} FixSubBlock;
|
||||
|
||||
typedef struct pool_options {
|
||||
sys_alloc_ptr sys_alloc_func;
|
||||
sys_free_ptr sys_free_func;
|
||||
unsigned int min_heap_size;
|
||||
int always_search_first;
|
||||
} pool_options;
|
||||
typedef struct FixStart {
|
||||
FixBlock* pTail;
|
||||
FixBlock* pHead;
|
||||
} FixStart;
|
||||
|
||||
typedef struct mem_pool_obj {
|
||||
list_header free_list;
|
||||
pool_options options;
|
||||
heap_header* heap_list;
|
||||
void* userData;
|
||||
|
||||
} mem_pool_obj;
|
||||
|
||||
mem_pool_obj __malloc_pool;
|
||||
static int initialized = 0;
|
||||
typedef struct __mem_pool_obj {
|
||||
Block* pStart;
|
||||
FixStart fixStart[6];
|
||||
} __mem_pool_obj;
|
||||
|
||||
static SubBlock* SubBlock_merge_prev(SubBlock*, SubBlock**);
|
||||
static void SubBlock_merge_next(SubBlock*, SubBlock**);
|
||||
static SubBlock* Block_subBlock(Block*, unsigned int, unsigned int*);
|
||||
static void* allocate_from_var_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static void* soft_allocate_from_var_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static void FixBlock_construct(FixBlock*, FixBlock*, FixBlock*, unsigned int, void*, unsigned int);
|
||||
static void* allocate_from_fixed_pools(__mem_pool_obj*, unsigned int, unsigned int*);
|
||||
static unsigned int __pool_allocate_resize(__mem_pool_obj*, void*, unsigned int, unsigned int*);
|
||||
|
||||
static const unsigned int fix_pool_sizes[] = {4, 12, 20, 36, 52, 68};
|
||||
const unsigned int fix_pool_sizes[] = {4, 12, 20, 36, 52, 68};
|
||||
|
||||
#define SubBlock_size(ths) ((ths)->size & 0xFFFFFFF8)
|
||||
#define SubBlock_block(ths) ((Block*)((unsigned int)((ths)->block) & ~0x1))
|
||||
#define SubBlock_block(ths) ((Block*)((unsigned int)((ths)->pBlock) & ~0x1))
|
||||
#define Block_size(ths) ((ths)->size & 0xFFFFFFF8)
|
||||
#define Block_start(ths) (*(SubBlock**)((char*)(ths) + Block_size((ths)) - sizeof(unsigned int)))
|
||||
|
||||
#define SubBlock_set_free(ths) \
|
||||
unsigned int this_size = SubBlock_size((ths)); \
|
||||
(ths)->size &= ~0x2; \
|
||||
*(unsigned int*)((char*)(ths) + this_size) &= ~0x4; \
|
||||
((SubBlock*)((char*)(ths) + this_size))->size &= ~0x4; \
|
||||
*(unsigned int*)((char*)(ths) + this_size - sizeof(unsigned int)) = this_size
|
||||
|
||||
#define SubBlock_is_free(ths) !((ths)->size & 2)
|
||||
#define SubBlock_set_size(ths, sz) \
|
||||
(ths)->size &= ~0xFFFFFFF8; \
|
||||
(ths)->size |= (sz) & 0xFFFFFFF8; \
|
||||
if (SubBlock_is_free((ths))) \
|
||||
*(unsigned int*)((char*)(ths) + (sz) - sizeof(unsigned int)) = (sz)
|
||||
if (SubBlock_is_free((ths))) { \
|
||||
*(unsigned int*)((char*)(ths) + (sz) - sizeof(unsigned int)) = (sz); \
|
||||
}
|
||||
|
||||
#define SubBlock_from_pointer(ptr) ((SubBlock*)((char*)(ptr) - 8))
|
||||
#define FixSubBlock_from_pointer(ptr) ((FixSubBlock*)((char*)(ptr) - 4))
|
||||
|
||||
#define FixBlock_client_size(ths) ((ths)->client_size_)
|
||||
#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->block_))
|
||||
#define FixBlock_client_size(ths) ((ths)->clientSize)
|
||||
#define FixSubBlock_size(ths) (FixBlock_client_size((ths)->pBlock))
|
||||
|
||||
#define classify(ptr) (*(unsigned int*)((char*)(ptr) - sizeof(unsigned int)) & 1)
|
||||
#define classify(ptr) ((unsigned int)FixSubBlock_from_pointer(ptr)->pBlock & 1)
|
||||
#define __msize_inline(ptr) (!classify(ptr) ? FixSubBlock_size(FixSubBlock_from_pointer(ptr)) : SubBlock_size(SubBlock_from_pointer(ptr)) - 8)
|
||||
|
||||
#define Block_empty(ths) (_sb = (SubBlock*)((char*)(ths) + 16)), SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24
|
||||
#define Block_empty(ths) (_sb = (SubBlock*)(ths + 1)), SubBlock_is_free(_sb) && SubBlock_size(_sb) == Block_size((ths)) - 24
|
||||
|
||||
void Block_link(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
SubBlock_set_free(sb);
|
||||
st = &Block_start(ths);
|
||||
void Block_link(Block*, SubBlock*);
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj*, void*, unsigned int);
|
||||
void* malloc(unsigned int);
|
||||
void* calloc(unsigned int, unsigned int);
|
||||
void* realloc(void*, unsigned int);
|
||||
void free(void*);
|
||||
|
||||
if (*st != 0) {
|
||||
sb->prev = (*st)->prev;
|
||||
sb->prev->next = sb;
|
||||
sb->next = *st;
|
||||
(*st)->prev = sb;
|
||||
*st = sb;
|
||||
*st = SubBlock_merge_prev(*st, st);
|
||||
SubBlock_merge_next(*st, st);
|
||||
} else {
|
||||
*st = sb;
|
||||
sb->prev = sb;
|
||||
sb->next = sb;
|
||||
static void SubBlock_construct(SubBlock* ths, unsigned int size, Block* bp, int prev_alloc, int this_alloc) {
|
||||
ths->pBlock = (Block*)((unsigned int)bp | 1);
|
||||
ths->size = size;
|
||||
if (prev_alloc) {
|
||||
ths->size |= 4;
|
||||
}
|
||||
if (this_alloc) {
|
||||
ths->size |= 2;
|
||||
((SubBlock*)((char*)ths + size))->size |= 4;
|
||||
} else {
|
||||
*(unsigned int*)((char*)ths + size - sizeof(unsigned int)) = size;
|
||||
}
|
||||
}
|
||||
|
||||
static SubBlock* SubBlock_split(SubBlock* ths, unsigned int sz) {
|
||||
unsigned int origsize;
|
||||
int isfree;
|
||||
int isprevalloc;
|
||||
SubBlock* np;
|
||||
Block* bp;
|
||||
origsize = SubBlock_size(ths);
|
||||
isfree = SubBlock_is_free(ths);
|
||||
isprevalloc = (int)(ths->size & 4);
|
||||
np = (SubBlock*)((char*)ths + sz);
|
||||
bp = SubBlock_block(ths);
|
||||
SubBlock_construct(ths, sz, bp, isprevalloc, !isfree);
|
||||
SubBlock_construct(np, origsize - sz, bp, !isfree, !isfree);
|
||||
if (isfree) {
|
||||
np->pNext = ths->pNext;
|
||||
np->pNext->pPrev = np;
|
||||
np->pPrev = ths;
|
||||
ths->pNext = np;
|
||||
}
|
||||
return np;
|
||||
}
|
||||
|
||||
static void Block_unlink(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
unsigned int this_size = SubBlock_size(sb);
|
||||
sb->size |= 2;
|
||||
((SubBlock*)((char*)sb + this_size))->size |= 4;
|
||||
st = &Block_start(ths);
|
||||
if (*st == sb) {
|
||||
*st = sb->pNext;
|
||||
}
|
||||
if (*st == sb) {
|
||||
*st = NULL;
|
||||
ths->maxSize = 0;
|
||||
} else {
|
||||
sb->pNext->pPrev = sb->pPrev;
|
||||
sb->pPrev->pNext = sb->pNext;
|
||||
}
|
||||
if (ths->max_size < SubBlock_size(*st))
|
||||
ths->max_size = SubBlock_size(*st);
|
||||
}
|
||||
|
||||
static SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) {
|
||||
@@ -149,72 +156,39 @@ static SubBlock* SubBlock_merge_prev(SubBlock* ths, SubBlock** start) {
|
||||
|
||||
if (!(ths->size & 0x04)) {
|
||||
prevsz = *(unsigned int*)((char*)ths - sizeof(unsigned int));
|
||||
if (prevsz & 0x2)
|
||||
if (prevsz & 0x2) {
|
||||
return ths;
|
||||
}
|
||||
p = (SubBlock*)((char*)ths - prevsz);
|
||||
SubBlock_set_size(p, prevsz + SubBlock_size(ths));
|
||||
|
||||
if (*start == ths)
|
||||
*start = (*start)->next;
|
||||
ths->next->prev = ths->prev;
|
||||
ths->next->prev->next = ths->next;
|
||||
if (*start == ths) {
|
||||
*start = (*start)->pNext;
|
||||
}
|
||||
ths->pNext->pPrev = ths->pPrev;
|
||||
ths->pNext->pPrev->pNext = ths->pNext;
|
||||
return p;
|
||||
}
|
||||
return ths;
|
||||
}
|
||||
|
||||
static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) {
|
||||
SubBlock* next_sub_block;
|
||||
unsigned int this_cur_size;
|
||||
|
||||
next_sub_block = (SubBlock*)((char*)pBlock + (pBlock->size & 0xFFFFFFF8));
|
||||
|
||||
if (!(next_sub_block->size & 2)) {
|
||||
this_cur_size = (pBlock->size & 0xFFFFFFF8) + (next_sub_block->size & 0xFFFFFFF8);
|
||||
|
||||
pBlock->size &= ~0xFFFFFFF8;
|
||||
pBlock->size |= this_cur_size & 0xFFFFFFF8;
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)(pBlock) + (this_cur_size)-4) = (this_cur_size);
|
||||
}
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size) &= ~4;
|
||||
} else {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size) |= 4;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = (*pStart)->next;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = 0;
|
||||
}
|
||||
|
||||
next_sub_block->next->prev = next_sub_block->prev;
|
||||
next_sub_block->prev->next = next_sub_block->next;
|
||||
}
|
||||
}
|
||||
|
||||
static Block* __unlink(__mem_pool_obj* pool_obj, Block* bp) {
|
||||
Block* result = bp->next;
|
||||
Block* result = bp->pNext;
|
||||
if (result == bp) {
|
||||
result = 0;
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
if (pool_obj->start_ == bp) {
|
||||
pool_obj->start_ = result;
|
||||
if (pool_obj->pStart == bp) {
|
||||
pool_obj->pStart = result;
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
result->prev = bp->prev;
|
||||
result->prev->next = result;
|
||||
if (result != NULL) {
|
||||
result->pPrev = bp->pPrev;
|
||||
result->pPrev->pNext = result;
|
||||
}
|
||||
|
||||
bp->next = 0;
|
||||
bp->prev = 0;
|
||||
bp->pNext = NULL;
|
||||
bp->pPrev = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -231,12 +205,13 @@ static void deallocate_from_var_pools(__mem_pool_obj* pool_obj, void* ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void __init_pool_obj(__mem_pool* pool_obj) {
|
||||
static void __init_pool_obj(__mem_pool* pool_obj) {
|
||||
memset(pool_obj, 0, sizeof(__mem_pool_obj));
|
||||
}
|
||||
|
||||
__mem_pool protopool;
|
||||
|
||||
static __mem_pool* get_malloc_pool() {
|
||||
static __mem_pool protopool;
|
||||
static unsigned char init = 0;
|
||||
if (!init) {
|
||||
__init_pool_obj(&protopool);
|
||||
@@ -246,67 +221,11 @@ static __mem_pool* get_malloc_pool() {
|
||||
return &protopool;
|
||||
}
|
||||
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned int size) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixBlock* b;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
|
||||
fs = &pool_obj->fix_start[i];
|
||||
p = FixSubBlock_from_pointer(ptr);
|
||||
b = p->block_;
|
||||
|
||||
if (b->start_ == 0 && fs->head_ != b) {
|
||||
if (fs->tail_ == b) {
|
||||
fs->head_ = fs->head_->prev_;
|
||||
fs->tail_ = fs->tail_->prev_;
|
||||
} else {
|
||||
b->prev_->next_ = b->next_;
|
||||
b->next_->prev_ = b->prev_;
|
||||
b->next_ = fs->head_;
|
||||
b->prev_ = b->next_->prev_;
|
||||
b->prev_->next_ = b;
|
||||
b->next_->prev_ = b;
|
||||
fs->head_ = b;
|
||||
}
|
||||
}
|
||||
|
||||
p->next_ = b->start_;
|
||||
b->start_ = p;
|
||||
|
||||
if (--b->n_allocated_ == 0) {
|
||||
if (fs->head_ == b) {
|
||||
fs->head_ = b->next_;
|
||||
}
|
||||
|
||||
if (fs->tail_ == b) {
|
||||
fs->tail_ = b->prev_;
|
||||
}
|
||||
|
||||
b->prev_->next_ = b->next_;
|
||||
b->next_->prev_ = b->prev_;
|
||||
|
||||
if (fs->head_ == b) {
|
||||
fs->head_ = 0;
|
||||
}
|
||||
|
||||
if (fs->tail_ == b) {
|
||||
fs->tail_ = 0;
|
||||
}
|
||||
|
||||
deallocate_from_var_pools(pool_obj, b);
|
||||
}
|
||||
}
|
||||
|
||||
void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
static void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
__mem_pool_obj* pool_obj;
|
||||
unsigned int size;
|
||||
|
||||
if (ptr == 0) {
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,6 +239,559 @@ void __pool_free(__mem_pool* pool, void* ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
static void link(__mem_pool_obj* pool, Block* bp) {
|
||||
if (pool->pStart != NULL) {
|
||||
bp->pPrev = pool->pStart->pPrev;
|
||||
bp->pPrev->pNext = bp;
|
||||
bp->pNext = pool->pStart;
|
||||
pool->pStart->pPrev = bp;
|
||||
pool->pStart = bp;
|
||||
} else {
|
||||
pool->pStart = bp;
|
||||
bp->pPrev = bp;
|
||||
bp->pNext = bp;
|
||||
}
|
||||
}
|
||||
|
||||
static void Block_construct(Block* ths, unsigned int size) {
|
||||
SubBlock* sb;
|
||||
|
||||
ths->size = size | 3;
|
||||
((SubBlock*)((char*)ths + size - 8))->size = ths->size;
|
||||
|
||||
sb = (SubBlock*)(ths + 1);
|
||||
sb->pBlock = (Block*)((unsigned int)ths | 1);
|
||||
sb->size = size - 0x18;
|
||||
*(unsigned int*)((char*)sb + (size - 0x18) - sizeof(unsigned int)) = size - 0x18;
|
||||
|
||||
ths->maxSize = size - 0x18;
|
||||
Block_start(ths) = NULL;
|
||||
|
||||
Block_link(ths, sb);
|
||||
}
|
||||
|
||||
static Block* link_new_block(__mem_pool_obj* pool, unsigned int size) {
|
||||
Block* bp;
|
||||
|
||||
size = (size + 31) & ~7;
|
||||
if (size < 0x10000) {
|
||||
size = 0x10000;
|
||||
}
|
||||
|
||||
bp = (Block*)__sys_alloc(size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Block_construct(bp, size);
|
||||
link(pool, bp);
|
||||
return bp;
|
||||
}
|
||||
|
||||
static SubBlock* Block_subBlock(Block* bp, unsigned int size, unsigned int* out) {
|
||||
SubBlock* st;
|
||||
SubBlock* sb;
|
||||
unsigned int sb_size;
|
||||
unsigned int max_found;
|
||||
st = Block_start(bp);
|
||||
if (st == NULL) {
|
||||
bp->maxSize = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sb = st;
|
||||
sb_size = SubBlock_size(sb);
|
||||
max_found = sb_size;
|
||||
|
||||
while (sb_size < size) {
|
||||
sb = sb->pNext;
|
||||
sb_size = SubBlock_size(sb);
|
||||
if (max_found < sb_size) {
|
||||
max_found = sb_size;
|
||||
}
|
||||
if (sb == st) {
|
||||
bp->maxSize = max_found;
|
||||
if (out != NULL) {
|
||||
*out = max_found - 8;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (sb_size - size >= 0x50) {
|
||||
SubBlock_split(sb, size);
|
||||
}
|
||||
|
||||
Block_start(bp) = sb->pNext;
|
||||
Block_unlink(bp, sb);
|
||||
|
||||
if (out != NULL) {
|
||||
*out = SubBlock_size(sb) - 8;
|
||||
}
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
static void Block_link(Block* ths, SubBlock* sb) {
|
||||
SubBlock** st;
|
||||
SubBlock_set_free(sb);
|
||||
st = &Block_start(ths);
|
||||
|
||||
if (*st != NULL) {
|
||||
sb->pPrev = (*st)->pPrev;
|
||||
sb->pPrev->pNext = sb;
|
||||
sb->pNext = *st;
|
||||
(*st)->pPrev = sb;
|
||||
*st = sb;
|
||||
*st = SubBlock_merge_prev(*st, st);
|
||||
SubBlock_merge_next(*st, st);
|
||||
} else {
|
||||
*st = sb;
|
||||
sb->pPrev = sb;
|
||||
sb->pNext = sb;
|
||||
}
|
||||
if (ths->maxSize < SubBlock_size(*st)) {
|
||||
ths->maxSize = SubBlock_size(*st);
|
||||
}
|
||||
}
|
||||
|
||||
static void SubBlock_merge_next(SubBlock* pBlock, SubBlock** pStart) {
|
||||
SubBlock* next_sub_block;
|
||||
unsigned int this_cur_size;
|
||||
|
||||
next_sub_block = (SubBlock*)((char*)pBlock + (pBlock->size & 0xFFFFFFF8));
|
||||
|
||||
if (!(next_sub_block->size & 2)) {
|
||||
this_cur_size = (pBlock->size & 0xFFFFFFF8) + (next_sub_block->size & 0xFFFFFFF8);
|
||||
|
||||
pBlock->size &= ~0xFFFFFFF8;
|
||||
pBlock->size |= this_cur_size & 0xFFFFFFF8;
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
*(unsigned int*)((char*)pBlock + this_cur_size - sizeof(unsigned int)) = this_cur_size;
|
||||
}
|
||||
|
||||
if (!(pBlock->size & 2)) {
|
||||
((SubBlock*)((char*)pBlock + this_cur_size))->size &= ~4;
|
||||
} else {
|
||||
((SubBlock*)((char*)pBlock + this_cur_size))->size |= 4;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = (*pStart)->pNext;
|
||||
}
|
||||
|
||||
if (*pStart == next_sub_block) {
|
||||
*pStart = NULL;
|
||||
}
|
||||
|
||||
next_sub_block->pNext->pPrev = next_sub_block->pPrev;
|
||||
next_sub_block->pPrev->pNext = next_sub_block->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
static void* allocate_from_var_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
Block* bp;
|
||||
SubBlock* ptr;
|
||||
|
||||
if (out != NULL) {
|
||||
*out = 0;
|
||||
}
|
||||
|
||||
size = (size + 15) & ~7;
|
||||
if (size < 0x50) {
|
||||
size = 0x50;
|
||||
}
|
||||
|
||||
bp = pool->pStart != NULL ? pool->pStart : link_new_block(pool, size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
if (size <= bp->maxSize) {
|
||||
ptr = Block_subBlock(bp, size, out);
|
||||
if (ptr != NULL) {
|
||||
pool->pStart = bp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bp = bp->pNext;
|
||||
if (bp == pool->pStart) {
|
||||
bp = link_new_block(pool, size);
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ptr = Block_subBlock(bp, size, out);
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return (char*)ptr + 8;
|
||||
}
|
||||
|
||||
static void* soft_allocate_from_var_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
register Block* bp;
|
||||
register SubBlock* ptr;
|
||||
|
||||
size = (size + 15) & ~7;
|
||||
if (size < 0x50) {
|
||||
size = 0x50;
|
||||
}
|
||||
*out = 0;
|
||||
bp = pool->pStart;
|
||||
if (bp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
if (size <= bp->maxSize) {
|
||||
ptr = Block_subBlock(bp, size, NULL);
|
||||
if (ptr != NULL) {
|
||||
pool->pStart = bp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bp->maxSize > 8 && *out < bp->maxSize - 8) {
|
||||
*out = bp->maxSize - 8;
|
||||
}
|
||||
bp = bp->pNext;
|
||||
if (bp == pool->pStart) {
|
||||
return NULL;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return (char*)ptr + 8;
|
||||
}
|
||||
|
||||
static void FixBlock_construct(FixBlock* this, FixBlock* prev, FixBlock* next, unsigned int poolIdx, void* start, unsigned int totalSize) {
|
||||
unsigned int fixSubBlockSize;
|
||||
unsigned int n;
|
||||
char* p;
|
||||
unsigned int i;
|
||||
char* np;
|
||||
|
||||
this->pPrev = prev;
|
||||
this->pNext = next;
|
||||
prev->pNext = this;
|
||||
next->pPrev = this;
|
||||
this->clientSize = fix_pool_sizes[poolIdx];
|
||||
fixSubBlockSize = fix_pool_sizes[poolIdx] + 4;
|
||||
n = totalSize / fixSubBlockSize;
|
||||
p = (char*)start;
|
||||
for (i = 0; i < n - 1; ++i) {
|
||||
np = p + fixSubBlockSize;
|
||||
((FixSubBlock*)p)->pBlock = this;
|
||||
((FixSubBlock*)p)->pNext = (FixSubBlock*)np;
|
||||
p = np;
|
||||
}
|
||||
((FixSubBlock*)p)->pBlock = this;
|
||||
((FixSubBlock*)p)->pNext = NULL;
|
||||
this->pStart = (FixSubBlock*)start;
|
||||
this->allocatedSize = 0;
|
||||
}
|
||||
|
||||
static void* allocate_from_fixed_pools(__mem_pool_obj* pool, unsigned int size, unsigned int* out) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
fs = &pool->fixStart[i];
|
||||
if (fs->pHead == NULL || fs->pHead->pStart == NULL) {
|
||||
unsigned int size_requested = 0x1000;
|
||||
char* newblock;
|
||||
unsigned int size_received;
|
||||
unsigned int n, nsave, size_has;
|
||||
|
||||
n = (size_requested - sizeof(FixBlock)) / (fix_pool_sizes[i] + 4);
|
||||
if (n > 0x100) {
|
||||
n = 0x100;
|
||||
}
|
||||
nsave = n;
|
||||
while (n >= 10) {
|
||||
size_requested = n * (fix_pool_sizes[i] + 4) + sizeof(FixBlock);
|
||||
newblock = (char*)soft_allocate_from_var_pools(pool, size_requested, &size_has);
|
||||
if (newblock != NULL) {
|
||||
break;
|
||||
}
|
||||
if (size_has > sizeof(FixBlock)) {
|
||||
n = (size_has - sizeof(FixBlock)) / (fix_pool_sizes[i] + 4);
|
||||
} else {
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
if (newblock == NULL) {
|
||||
unsigned int cr_backup;
|
||||
n = nsave;
|
||||
while (1) {
|
||||
size_requested = n * (fix_pool_sizes[i] + 4) + sizeof(FixBlock);
|
||||
newblock = (char*)allocate_from_var_pools(pool, size_requested, &cr_backup);
|
||||
if (newblock != NULL) {
|
||||
break;
|
||||
}
|
||||
n = cr_backup / (fix_pool_sizes[i] + sizeof(FixBlock) + 4);
|
||||
if (n < 10) {
|
||||
if (out != NULL) {
|
||||
*out = 0;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
size_received = __msize_inline(newblock);
|
||||
if (fs->pHead == NULL) {
|
||||
fs->pHead = (FixBlock*)newblock;
|
||||
fs->pTail = (FixBlock*)newblock;
|
||||
}
|
||||
FixBlock_construct((FixBlock*)newblock, fs->pTail, fs->pHead, i, (FixSubBlock*)((FixBlock*)newblock + 1), size_received - sizeof(FixBlock));
|
||||
fs->pHead = (FixBlock*)newblock;
|
||||
}
|
||||
p = fs->pHead->pStart;
|
||||
fs->pHead->pStart = p->pNext;
|
||||
++fs->pHead->allocatedSize;
|
||||
if (fs->pHead->pStart == NULL) {
|
||||
fs->pHead = fs->pHead->pNext;
|
||||
fs->pTail = fs->pTail->pNext;
|
||||
}
|
||||
if (out != NULL) {
|
||||
*out = fix_pool_sizes[i];
|
||||
}
|
||||
return (char*)p + 4;
|
||||
}
|
||||
|
||||
void deallocate_from_fixed_pools(__mem_pool_obj* pool_obj, void* ptr, unsigned int size) {
|
||||
unsigned int i = 0;
|
||||
FixSubBlock* p;
|
||||
FixBlock* b;
|
||||
FixStart* fs;
|
||||
|
||||
while (size > fix_pool_sizes[i]) {
|
||||
++i;
|
||||
}
|
||||
|
||||
fs = &pool_obj->fixStart[i];
|
||||
p = FixSubBlock_from_pointer(ptr);
|
||||
b = p->pBlock;
|
||||
|
||||
if (b->pStart == NULL && fs->pHead != b) {
|
||||
if (fs->pTail == b) {
|
||||
fs->pHead = fs->pHead->pPrev;
|
||||
fs->pTail = fs->pTail->pPrev;
|
||||
} else {
|
||||
b->pPrev->pNext = b->pNext;
|
||||
b->pNext->pPrev = b->pPrev;
|
||||
b->pNext = fs->pHead;
|
||||
b->pPrev = b->pNext->pPrev;
|
||||
b->pPrev->pNext = b;
|
||||
b->pNext->pPrev = b;
|
||||
fs->pHead = b;
|
||||
}
|
||||
}
|
||||
|
||||
p->pNext = b->pStart;
|
||||
b->pStart = p;
|
||||
|
||||
if (--b->allocatedSize == 0) {
|
||||
if (fs->pHead == b) {
|
||||
fs->pHead = b->pNext;
|
||||
}
|
||||
|
||||
if (fs->pTail == b) {
|
||||
fs->pTail = b->pPrev;
|
||||
}
|
||||
|
||||
b->pPrev->pNext = b->pNext;
|
||||
b->pNext->pPrev = b->pPrev;
|
||||
|
||||
if (fs->pHead == b) {
|
||||
fs->pHead = NULL;
|
||||
}
|
||||
|
||||
if (fs->pTail == b) {
|
||||
fs->pTail = NULL;
|
||||
}
|
||||
|
||||
deallocate_from_var_pools(pool_obj, b);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int __pool_allocate_resize(__mem_pool_obj* pool, void* ptr, unsigned int size, unsigned int* out) {
|
||||
unsigned int sz;
|
||||
unsigned int this_size;
|
||||
unsigned int orig_size;
|
||||
SubBlock* sb;
|
||||
SubBlock* next_sub;
|
||||
|
||||
orig_size = __msize_inline(ptr);
|
||||
|
||||
if (size == orig_size) {
|
||||
if (out != NULL) {
|
||||
*out = orig_size;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (classify(ptr)) {
|
||||
if (size > 0xFFFFFF7F) {
|
||||
size = 0xFFFFFF7F;
|
||||
}
|
||||
sz = size + 8;
|
||||
sz = (sz + 7) & ~7;
|
||||
if (sz < 0x50) {
|
||||
sz = 0x50;
|
||||
}
|
||||
|
||||
sb = SubBlock_from_pointer(ptr);
|
||||
this_size = orig_size + 8;
|
||||
next_sub = (SubBlock*)((char*)sb + this_size);
|
||||
|
||||
if (SubBlock_is_free(next_sub) && sz <= this_size + SubBlock_size(next_sub)) {
|
||||
SubBlock_merge_next(sb, &Block_start(SubBlock_block(sb)));
|
||||
this_size = SubBlock_size(sb);
|
||||
}
|
||||
|
||||
if (this_size >= sz + 0x50) {
|
||||
Block_link(SubBlock_block(sb), SubBlock_split(sb, sz));
|
||||
this_size = SubBlock_size(sb);
|
||||
}
|
||||
|
||||
this_size -= 8;
|
||||
|
||||
if (out != NULL) {
|
||||
*out = this_size;
|
||||
}
|
||||
|
||||
if (size > orig_size) {
|
||||
if (out != NULL && size > this_size && SubBlock_is_free(next_sub)) {
|
||||
*out += SubBlock_size(next_sub);
|
||||
}
|
||||
return size <= this_size;
|
||||
}
|
||||
|
||||
return this_size < orig_size;
|
||||
}
|
||||
|
||||
if (out != NULL) {
|
||||
*out = orig_size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* malloc(register unsigned int size) {
|
||||
void* rv;
|
||||
register __mem_pool_obj* pool_obj;
|
||||
|
||||
if (size == 0) {
|
||||
goto null_return;
|
||||
}
|
||||
|
||||
pool_obj = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
if (size > ~0x30u) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (size <= 68) {
|
||||
rv = allocate_from_fixed_pools(pool_obj, size, NULL);
|
||||
} else {
|
||||
rv = allocate_from_var_pools(pool_obj, size, NULL);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
null_return:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void free(void* ptr) {
|
||||
__pool_free(get_malloc_pool(), ptr);
|
||||
}
|
||||
|
||||
void* realloc(void* ptr, unsigned int size) {
|
||||
register unsigned int rv = size;
|
||||
register __mem_pool_obj* pool;
|
||||
unsigned int current_size;
|
||||
unsigned int orig_size;
|
||||
|
||||
pool = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
if (ptr == NULL) {
|
||||
if (rv > ~0x30u) {
|
||||
return NULL;
|
||||
}
|
||||
if (rv <= 68) {
|
||||
return allocate_from_fixed_pools(pool, rv, NULL);
|
||||
}
|
||||
return allocate_from_var_pools(pool, rv, NULL);
|
||||
}
|
||||
|
||||
if (rv == 0) {
|
||||
if (ptr != NULL) {
|
||||
current_size = __msize_inline(ptr);
|
||||
if (current_size <= 68) {
|
||||
deallocate_from_fixed_pools(pool, ptr, current_size);
|
||||
} else {
|
||||
deallocate_from_var_pools(pool, ptr);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
orig_size = __msize_inline(ptr);
|
||||
{
|
||||
unsigned int result = __pool_allocate_resize(pool, ptr, rv, NULL);
|
||||
if (result || rv <= orig_size) {
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv > ~0x30u) {
|
||||
rv = 0;
|
||||
} else if (rv <= 68) {
|
||||
rv = (unsigned int)allocate_from_fixed_pools(pool, rv, NULL);
|
||||
} else {
|
||||
rv = (unsigned int)allocate_from_var_pools(pool, rv, NULL);
|
||||
}
|
||||
|
||||
if (rv != 0) {
|
||||
memcpy((void*)rv, ptr, orig_size);
|
||||
if (ptr != NULL) {
|
||||
unsigned int cur_sz = __msize_inline(ptr);
|
||||
if (cur_sz <= 68) {
|
||||
deallocate_from_fixed_pools(pool, ptr, cur_sz);
|
||||
} else {
|
||||
deallocate_from_var_pools(pool, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (void*)rv;
|
||||
}
|
||||
|
||||
void* calloc(unsigned int nmemb, unsigned int size) {
|
||||
register void* ptr;
|
||||
register unsigned int total;
|
||||
__mem_pool_obj* pool_obj;
|
||||
|
||||
pool_obj = (__mem_pool_obj*)get_malloc_pool();
|
||||
|
||||
total = size * nmemb;
|
||||
|
||||
if (total > ~0x30u) {
|
||||
ptr = NULL;
|
||||
} else if (total <= 68) {
|
||||
ptr = allocate_from_fixed_pools(pool_obj, total, NULL);
|
||||
} else {
|
||||
ptr = allocate_from_var_pools(pool_obj, total, NULL);
|
||||
}
|
||||
|
||||
if (ptr != NULL) {
|
||||
memset(ptr, 0, total);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
123
libs/MSL/src/MSL_Common/ansi_files.c
Normal file
123
libs/MSL/src/MSL_Common/ansi_files.c
Normal file
@@ -0,0 +1,123 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int __read_console(unsigned long, unsigned char*, size_t*, void*);
|
||||
extern int __write_console(unsigned long, unsigned char*, size_t*, void*);
|
||||
extern int __close_console(unsigned long);
|
||||
|
||||
#pragma exceptions on
|
||||
|
||||
unsigned char stdin_buff[0x100];
|
||||
unsigned char stdout_buff[0x100];
|
||||
unsigned char stderr_buff[0x100];
|
||||
|
||||
FILE __files[4] = {
|
||||
{
|
||||
0,
|
||||
{0, 1, 1, 2, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdin_buff,
|
||||
0x100,
|
||||
stdin_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
&__files[1],
|
||||
},
|
||||
{
|
||||
1,
|
||||
{0, 2, 1, 2, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stdout_buff,
|
||||
0x100,
|
||||
stdout_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
&__files[2],
|
||||
},
|
||||
{
|
||||
2,
|
||||
{0, 2, 0, 2, 0, 0},
|
||||
{0, 0, 0, 0},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0, 0},
|
||||
{0, 0},
|
||||
0,
|
||||
stderr_buff,
|
||||
0x100,
|
||||
stderr_buff,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
__read_console,
|
||||
__write_console,
|
||||
__close_console,
|
||||
0,
|
||||
&__files[3],
|
||||
},
|
||||
{0},
|
||||
};
|
||||
|
||||
void __close_all(void) {
|
||||
FILE* file;
|
||||
FILE* current;
|
||||
|
||||
for (file = __files; file != 0;) {
|
||||
if (file->mode.file_kind != 0) {
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
current = file;
|
||||
file = file->next_file;
|
||||
if (current->is_dyn_alloc != 0) {
|
||||
free(current);
|
||||
} else {
|
||||
current->mode.file_kind = 3;
|
||||
if (file != 0 && file->is_dyn_alloc != 0) {
|
||||
current->next_file = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int __flush_all(void) {
|
||||
int result = 0;
|
||||
FILE* file;
|
||||
|
||||
for (file = __files; file != 0; file = file->next_file) {
|
||||
if (file->mode.file_kind != 0 && fflush(file) != 0) {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
142
libs/MSL/src/MSL_Common/arith.c
Normal file
142
libs/MSL/src/MSL_Common/arith.c
Normal file
@@ -0,0 +1,142 @@
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct ldiv_t {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
#undef abs
|
||||
|
||||
int abs(int n) {
|
||||
int mask = n >> 31;
|
||||
return (mask ^ n) - mask;
|
||||
}
|
||||
|
||||
long labs(long n) {
|
||||
long mask = n >> 31;
|
||||
return (mask ^ n) - mask;
|
||||
}
|
||||
|
||||
div_t div(int numerator, int denominator) {
|
||||
int n_sign, d_sign;
|
||||
div_t value;
|
||||
|
||||
n_sign = 1;
|
||||
d_sign = 1;
|
||||
if (numerator < 0) {
|
||||
numerator = -numerator;
|
||||
n_sign = -1;
|
||||
}
|
||||
if (denominator < 0) {
|
||||
denominator = -denominator;
|
||||
d_sign = -1;
|
||||
}
|
||||
value.quot = (numerator / denominator) * (n_sign * d_sign);
|
||||
value.rem = (numerator * n_sign) - (value.quot * denominator * d_sign);
|
||||
return value;
|
||||
}
|
||||
|
||||
int __msl_add(int* a, int b) {
|
||||
int val = *a;
|
||||
|
||||
if (b < 0) {
|
||||
if (val < 0 && b < (-LONG_MAX - 1) - val) {
|
||||
return 0;
|
||||
}
|
||||
} else if (val > 0 && b > LONG_MAX - val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val + b;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __msl_ladd(long* a, long b) {
|
||||
long val = *a;
|
||||
|
||||
if (b < 0) {
|
||||
if (val < 0 && b < (-LONG_MAX - 1L) - val) {
|
||||
return 0;
|
||||
}
|
||||
} else if (val > 0 && b > LONG_MAX - val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val + b;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __msl_lmul(long* a, long b) {
|
||||
long val = *a;
|
||||
int sign = (val < 0) ^ (b < 0) ? -1 : 1;
|
||||
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
}
|
||||
|
||||
if (val > LONG_MAX / b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*a = val * b * sign;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ldiv_t __msl_div(long a, long b) {
|
||||
ldiv_t ret;
|
||||
long quotient, a_sign, b_sign, sign, remainder;
|
||||
|
||||
a_sign = 1;
|
||||
b_sign = 1;
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
a_sign = -1;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
b_sign = -1;
|
||||
}
|
||||
sign = a_sign * b_sign;
|
||||
quotient = (a / b) * sign;
|
||||
remainder = a * a_sign - b_sign * (quotient * b);
|
||||
|
||||
if (remainder != 0 && sign < 0) {
|
||||
quotient--;
|
||||
remainder += b * b_sign;
|
||||
}
|
||||
|
||||
ret.quot = quotient;
|
||||
ret.rem = remainder;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __msl_mod(int a, int b) {
|
||||
int quotient, remainder, a_sign, b_sign, sign;
|
||||
|
||||
a_sign = 1;
|
||||
b_sign = 1;
|
||||
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
a_sign = -1;
|
||||
}
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
b_sign = -1;
|
||||
}
|
||||
|
||||
sign = a_sign * b_sign;
|
||||
quotient = (a / b) * sign;
|
||||
remainder = (a * a_sign) - (quotient * b * b_sign);
|
||||
|
||||
if (remainder && sign < 0) {
|
||||
quotient -= 1;
|
||||
remainder += b * b_sign;
|
||||
}
|
||||
|
||||
return remainder;
|
||||
}
|
||||
43
libs/MSL/src/MSL_Common/bsearch.c
Normal file
43
libs/MSL/src/MSL_Common/bsearch.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <search.h>
|
||||
|
||||
void* bsearch(const void* key, const void* ptr, size_t count, size_t size, COMPARE_FUNC comp) {
|
||||
const char* p;
|
||||
int cmp;
|
||||
size_t low, high, mid;
|
||||
|
||||
if (key == NULL || ptr == NULL || count == 0 || size == 0 || comp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = (const char*)ptr;
|
||||
cmp = comp(key, p);
|
||||
|
||||
if (cmp == 0) {
|
||||
return (void*)p;
|
||||
}
|
||||
|
||||
if (cmp < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
low = 1;
|
||||
high = count - 1;
|
||||
|
||||
while (low <= high) {
|
||||
mid = (low + high) >> 1;
|
||||
p = (const char*)ptr + size * mid;
|
||||
cmp = comp(key, p);
|
||||
|
||||
if (cmp == 0) {
|
||||
return (void*)p;
|
||||
}
|
||||
|
||||
if (cmp < 0) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
146
libs/MSL/src/MSL_Common/direct_io.c
Normal file
146
libs/MSL/src/MSL_Common/direct_io.c
Normal file
@@ -0,0 +1,146 @@
|
||||
#include <internal/file_struct.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
enum file_kinds {
|
||||
file_closed,
|
||||
file_disk,
|
||||
file_console,
|
||||
file_unavailable
|
||||
};
|
||||
|
||||
enum io_states {
|
||||
neutral,
|
||||
writing,
|
||||
reading,
|
||||
rereading
|
||||
};
|
||||
|
||||
enum io_modes {
|
||||
io_read = 1,
|
||||
io_write = 2,
|
||||
io_append = 4
|
||||
};
|
||||
|
||||
enum buffer_modes {
|
||||
buffer_none,
|
||||
buffer_full,
|
||||
buffer_line
|
||||
};
|
||||
|
||||
void __prep_buffer(FILE* file);
|
||||
int __flush_buffer(FILE* file, size_t* pos);
|
||||
void __stdio_atexit(void);
|
||||
int _fseek(FILE* file, long offset, int whence);
|
||||
void* __memrchr(const void* ptr, int ch, size_t count);
|
||||
|
||||
size_t __fwrite(const void* ptr, size_t memb_size, size_t num_memb, FILE* file) {
|
||||
unsigned char* cur_ptr;
|
||||
size_t num_bytes, rem_bytes, bytes_written;
|
||||
int res, buff;
|
||||
|
||||
if (fwide(file, 0) == 0) {
|
||||
fwide(file, -1);
|
||||
}
|
||||
|
||||
rem_bytes = memb_size * num_memb;
|
||||
|
||||
if (rem_bytes == 0 || file->state.error || file->mode.file_kind == file_closed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (file->mode.file_kind == file_console) {
|
||||
__stdio_atexit();
|
||||
}
|
||||
|
||||
buff = !file->mode.binary_io || file->mode.buffer_mode == buffer_line || file->mode.buffer_mode == buffer_full;
|
||||
|
||||
if (file->state.io_state == neutral && file->mode.io_mode & io_write) {
|
||||
if (file->mode.io_mode & io_append) {
|
||||
if (_fseek(file, 0, 2)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
file->state.io_state = writing;
|
||||
__prep_buffer(file);
|
||||
}
|
||||
|
||||
if (file->state.io_state != writing) {
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cur_ptr = (unsigned char*)ptr;
|
||||
bytes_written = 0;
|
||||
|
||||
if (rem_bytes && (file->buffer_ptr != file->buffer || buff)) {
|
||||
file->buffer_len = file->buffer_size - (file->buffer_ptr - file->buffer);
|
||||
|
||||
do {
|
||||
unsigned char* nw = NULL;
|
||||
num_bytes = file->buffer_len;
|
||||
|
||||
if (num_bytes > rem_bytes) {
|
||||
num_bytes = rem_bytes;
|
||||
}
|
||||
|
||||
if (file->mode.buffer_mode == buffer_full && num_bytes) {
|
||||
if ((nw = (unsigned char*)__memrchr(cur_ptr, '\n', num_bytes)) != NULL) {
|
||||
num_bytes = nw + 1 - cur_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_bytes != 0) {
|
||||
memcpy(file->buffer_ptr, cur_ptr, num_bytes);
|
||||
cur_ptr += num_bytes;
|
||||
rem_bytes -= num_bytes;
|
||||
file->buffer_ptr += num_bytes;
|
||||
file->buffer_len -= num_bytes;
|
||||
}
|
||||
|
||||
if (file->buffer_len == 0 || nw != 0 || file->mode.buffer_mode == buffer_none) {
|
||||
res = __flush_buffer(file, 0);
|
||||
|
||||
if (res != 0) {
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
rem_bytes = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bytes_written += num_bytes;
|
||||
|
||||
} while (rem_bytes && buff);
|
||||
}
|
||||
|
||||
if (rem_bytes && buff == 0) {
|
||||
unsigned char* save_buf = file->buffer;
|
||||
size_t save_size = file->buffer_size;
|
||||
|
||||
file->buffer = cur_ptr;
|
||||
file->buffer_size = rem_bytes;
|
||||
file->buffer_ptr = cur_ptr + rem_bytes;
|
||||
|
||||
if (__flush_buffer(file, &num_bytes) != 0) {
|
||||
file->state.error = 1;
|
||||
file->buffer_len = 0;
|
||||
} else {
|
||||
bytes_written += num_bytes;
|
||||
}
|
||||
|
||||
file->buffer = save_buf;
|
||||
file->buffer_size = save_size;
|
||||
__prep_buffer(file);
|
||||
file->buffer_len = 0;
|
||||
}
|
||||
|
||||
if (file->mode.buffer_mode != buffer_line) {
|
||||
file->buffer_len = 0;
|
||||
}
|
||||
|
||||
return bytes_written / memb_size;
|
||||
}
|
||||
73
libs/MSL/src/MSL_Common/extras.c
Normal file
73
libs/MSL/src/MSL_Common/extras.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include <ctype.h>
|
||||
#include <internal/locale.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int __msl_strnicmp(const char*, const char*, int);
|
||||
extern char* __msl_itoa(int, char*, int);
|
||||
|
||||
int stricmp(const char* s1, const char* s2) {
|
||||
char c1, c2;
|
||||
|
||||
while (true) {
|
||||
c1 = tolower(*s1++);
|
||||
c2 = tolower(*s2++);
|
||||
|
||||
if (c1 < c2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c1 > c2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (c1 == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int strnicmp(const char* s1, const char* s2, size_t n) {
|
||||
return __msl_strnicmp(s1, s2, n);
|
||||
}
|
||||
|
||||
int strcmpi(const char* s1, const char* s2) {
|
||||
return stricmp(s1, s2);
|
||||
}
|
||||
|
||||
char* itoa(int value, char* buffer, int radix) {
|
||||
return __msl_itoa(value, buffer, radix);
|
||||
}
|
||||
|
||||
int wcsnicmp(const char* s1, const char* s2, size_t n) {
|
||||
const wchar_t* p1 = (const wchar_t*)s1;
|
||||
const wchar_t* p2 = (const wchar_t*)s2;
|
||||
unsigned int c1;
|
||||
unsigned int c2;
|
||||
struct _loc_ctype_cmpt* ctype_cmpt = _current_locale.ctype_cmpt_ptr;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
c1 = *p1++;
|
||||
c1 = (c1 >= 256) ? c1 : ctype_cmpt->wlower_map_ptr[(unsigned short)c1];
|
||||
c1 &= 0xFFFF;
|
||||
|
||||
c2 = *p2++;
|
||||
c2 = (c2 >= 256) ? c2 : ctype_cmpt->wlower_map_ptr[(unsigned short)c2];
|
||||
c2 &= 0xFFFF;
|
||||
|
||||
if (c1 < c2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (c1 > c2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (c1 == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
libs/MSL/src/MSL_Common/math_sun.c
Normal file
10
libs/MSL/src/MSL_Common/math_sun.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <math.h>
|
||||
|
||||
double scalbn(double x, int n) {
|
||||
double man;
|
||||
int exponent;
|
||||
|
||||
man = frexp(x, &exponent);
|
||||
exponent += n;
|
||||
return ldexp(man, exponent);
|
||||
}
|
||||
97
libs/MSL/src/MSL_Common/mbstring.c
Normal file
97
libs/MSL/src/MSL_Common/mbstring.c
Normal file
@@ -0,0 +1,97 @@
|
||||
#include <internal/locale.h>
|
||||
#include <string.h>
|
||||
|
||||
int mbtowc(wchar_t* pwc, const char* s, size_t n) {
|
||||
return _current_locale.ctype_cmpt_ptr->decode_mb(pwc, s, n);
|
||||
}
|
||||
|
||||
int __mbtowc_noconv(wchar_t* pwc, const char* s, size_t n) {
|
||||
if (s == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pwc != NULL) {
|
||||
*pwc = (unsigned char)*s;
|
||||
}
|
||||
|
||||
if (!*s) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int __wctomb_noconv(char* s, wchar_t wchar) {
|
||||
if (s == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*s = (char)wchar;
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t mbstowcs(wchar_t* dest, const char* src, size_t len) {
|
||||
int count;
|
||||
char* src_ptr;
|
||||
size_t slen;
|
||||
|
||||
slen = strlen(src);
|
||||
|
||||
if (dest != NULL) {
|
||||
src_ptr = (char*)src;
|
||||
|
||||
for (count = 0; count < len; count++) {
|
||||
if (*src_ptr) {
|
||||
int res = mbtowc(dest++, src_ptr, slen);
|
||||
|
||||
if (res > 0) {
|
||||
src_ptr += res;
|
||||
slen -= res;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
*dest = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n) {
|
||||
int result;
|
||||
int chars_written = 0;
|
||||
char temp[3];
|
||||
wchar_t* source;
|
||||
|
||||
if (s == NULL || pwcs == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
source = (wchar_t*)pwcs;
|
||||
|
||||
while (chars_written <= n) {
|
||||
if (!*source) {
|
||||
*(s + chars_written) = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
result = _current_locale.ctype_cmpt_ptr->encode_wc(temp, *source++);
|
||||
if (chars_written + result > n) {
|
||||
break;
|
||||
}
|
||||
|
||||
strncpy(s + chars_written, temp, result);
|
||||
chars_written += result;
|
||||
}
|
||||
|
||||
return chars_written;
|
||||
}
|
||||
6
libs/MSL/src/MSL_Common/misc_io.c
Normal file
6
libs/MSL/src/MSL_Common/misc_io.c
Normal file
@@ -0,0 +1,6 @@
|
||||
extern void (*__stdio_exit)(void);
|
||||
void __close_all(void);
|
||||
|
||||
void __stdio_atexit(void) {
|
||||
__stdio_exit = __close_all;
|
||||
}
|
||||
73
libs/MSL/src/MSL_Common/qsort.c
Normal file
73
libs/MSL/src/MSL_Common/qsort.c
Normal file
@@ -0,0 +1,73 @@
|
||||
#include <search.h>
|
||||
|
||||
#define swap(dst, src, cnt) \
|
||||
do { \
|
||||
char* p; \
|
||||
char* q; \
|
||||
size_t n = cnt; \
|
||||
unsigned long tmp; \
|
||||
for (p = (char*)src - 1, q = (char*)dst - 1, n++; --n;) { \
|
||||
tmp = *++q; \
|
||||
*q = *++p; \
|
||||
*p = tmp; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void qsort(void* table_base, size_t num_members, size_t member_size, COMPARE_FUNC compare_members) {
|
||||
size_t cur_ofs;
|
||||
size_t neg_size;
|
||||
size_t l, r, j;
|
||||
char* lp;
|
||||
char* rp;
|
||||
char* ip;
|
||||
char* jp;
|
||||
char* kp;
|
||||
|
||||
if (num_members < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = num_members;
|
||||
l = (r / 2) + 1;
|
||||
lp = (char*)table_base + member_size * (l - 1);
|
||||
rp = (char*)table_base + member_size * (r - 1);
|
||||
neg_size = (long)(member_size - member_size * 2);
|
||||
cur_ofs = l * member_size;
|
||||
|
||||
for (;;) {
|
||||
if (l > 1) {
|
||||
l--;
|
||||
cur_ofs -= member_size;
|
||||
lp -= member_size;
|
||||
} else {
|
||||
swap(lp, rp, member_size);
|
||||
if (--r == 1) {
|
||||
return;
|
||||
}
|
||||
rp -= member_size;
|
||||
}
|
||||
|
||||
j = l;
|
||||
jp = (char*)table_base + (cur_ofs + neg_size);
|
||||
|
||||
while (j * 2 <= r) {
|
||||
j *= 2;
|
||||
ip = jp;
|
||||
jp = (char*)table_base + member_size * (j - 1);
|
||||
|
||||
if (j < r) {
|
||||
kp = jp + member_size;
|
||||
if (compare_members(jp, kp) < 0) {
|
||||
j++;
|
||||
jp = kp;
|
||||
}
|
||||
}
|
||||
|
||||
if (compare_members(ip, jp) < 0) {
|
||||
swap(ip, jp, member_size);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
libs/MSL/src/MSL_Common/signal.c
Normal file
30
libs/MSL/src/MSL_Common/signal.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <signal.h>
|
||||
|
||||
int exit(int);
|
||||
|
||||
__signal_func_ptr signal_funcs[8];
|
||||
|
||||
int raise(int sig) {
|
||||
__signal_func_ptr signal_func;
|
||||
|
||||
if (sig < SIGNAL_ABORT || sig > SIGNAL_UNK7) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
signal_func = signal_funcs[sig - 1];
|
||||
|
||||
if (signal_func != SIGNAL_ACTION_IGNORE) {
|
||||
signal_funcs[sig - 1] = SIGNAL_ACTION_DEFAULT;
|
||||
}
|
||||
|
||||
if (signal_func == SIGNAL_ACTION_IGNORE || (signal_func == SIGNAL_ACTION_DEFAULT && sig == SIGNAL_ABORT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (signal_func == SIGNAL_ACTION_DEFAULT) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
(*signal_func)(sig);
|
||||
return 0;
|
||||
}
|
||||
382
libs/MSL/src/MSL_Common/strtoul.c
Normal file
382
libs/MSL/src/MSL_Common/strtoul.c
Normal file
@@ -0,0 +1,382 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
enum __ReadProcActions {
|
||||
__GetAChar,
|
||||
__UngetAChar,
|
||||
__TestForError
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char* spNextChar;
|
||||
int nullCharDetected;
|
||||
} __InStrCtrl;
|
||||
|
||||
int __StringRead(void* ptr, int ch, int act);
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
enum scan_states {
|
||||
start = 0x01,
|
||||
check_for_zero = 0x02,
|
||||
leading_zero = 0x04,
|
||||
need_digit = 0x08,
|
||||
digit_loop = 0x10,
|
||||
finished = 0x20,
|
||||
failure = 0x40
|
||||
};
|
||||
|
||||
#define final_state(scan_state) (scan_state & (finished | failure))
|
||||
#define success(scan_state) (scan_state & (leading_zero | digit_loop | finished))
|
||||
#define fetch() (count++, (*ReadProc)(ReadProcArg, 0, __GetAChar))
|
||||
#define unfetch(c) (*ReadProc)(ReadProcArg, c, __UngetAChar)
|
||||
|
||||
unsigned long __strtoul(int base, int max_width, int (*ReadProc)(void*, int, int), void* ReadProcArg, int* chars_scanned, int* negative,
|
||||
int* overflow) {
|
||||
int scan_state = start;
|
||||
int count = 0;
|
||||
int spaces = 0;
|
||||
unsigned long value = 0;
|
||||
unsigned long value_max = 0;
|
||||
int c;
|
||||
|
||||
*negative = *overflow = 0;
|
||||
|
||||
if (base < 0 || base == 1 || base > 36 || max_width < 1) {
|
||||
scan_state = failure;
|
||||
} else {
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if (base != 0) {
|
||||
value_max = ULONG_MAX / base;
|
||||
}
|
||||
|
||||
while (count <= max_width && c != -1 && !final_state(scan_state)) {
|
||||
switch (scan_state) {
|
||||
case start: {
|
||||
if (isspace(c)) {
|
||||
c = fetch();
|
||||
count--;
|
||||
spaces++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '+') {
|
||||
c = fetch();
|
||||
} else if (c == '-') {
|
||||
c = fetch();
|
||||
*negative = 1;
|
||||
}
|
||||
|
||||
scan_state = check_for_zero;
|
||||
break;
|
||||
}
|
||||
|
||||
case check_for_zero: {
|
||||
if (base == 0 || base == 16) {
|
||||
if (c == '0') {
|
||||
scan_state = leading_zero;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scan_state = need_digit;
|
||||
break;
|
||||
}
|
||||
|
||||
case leading_zero: {
|
||||
if (c == 'X' || c == 'x') {
|
||||
base = 16;
|
||||
scan_state = need_digit;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
if (base == 0) {
|
||||
base = 8;
|
||||
}
|
||||
|
||||
scan_state = digit_loop;
|
||||
break;
|
||||
}
|
||||
|
||||
case need_digit:
|
||||
case digit_loop: {
|
||||
if (base == 0) {
|
||||
base = 10;
|
||||
}
|
||||
|
||||
if (!value_max) {
|
||||
value_max = ULONG_MAX / base;
|
||||
}
|
||||
|
||||
if (isdigit(c)) {
|
||||
if ((c -= '0') >= base) {
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
|
||||
c += '0';
|
||||
break;
|
||||
}
|
||||
} else if (!isalpha(c) || (toupper(c) - 'A' + 10) >= base) {
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
c = toupper(c) - 'A' + 10;
|
||||
}
|
||||
|
||||
if (value > value_max) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
value *= base;
|
||||
|
||||
if (c > (ULONG_MAX - value)) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
value += c;
|
||||
scan_state = digit_loop;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!success(scan_state)) {
|
||||
count = 0;
|
||||
value = 0;
|
||||
*chars_scanned = 0;
|
||||
} else {
|
||||
count--;
|
||||
*chars_scanned = count + spaces;
|
||||
}
|
||||
|
||||
unfetch(c);
|
||||
return value;
|
||||
}
|
||||
|
||||
unsigned long long __strtoull(int base, int max_width, int (*ReadProc)(void*, int, int), void* ReadProcArg, int* chars_scanned, int* negative,
|
||||
int* overflow) {
|
||||
int scan_state = start;
|
||||
int count = 0;
|
||||
int spaces = 0;
|
||||
unsigned long long value = 0;
|
||||
unsigned long long value_max = 0;
|
||||
int c;
|
||||
|
||||
*negative = *overflow = 0;
|
||||
|
||||
if (base < 0 || base == 1 || base > 36 || max_width < 1) {
|
||||
scan_state = failure;
|
||||
} else {
|
||||
c = fetch();
|
||||
}
|
||||
|
||||
if (base != 0) {
|
||||
value_max = ULLONG_MAX / base;
|
||||
}
|
||||
|
||||
while (count <= max_width && c != -1 && !final_state(scan_state)) {
|
||||
switch (scan_state) {
|
||||
case start: {
|
||||
if (isspace(c)) {
|
||||
c = fetch();
|
||||
count--;
|
||||
spaces++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '+') {
|
||||
c = fetch();
|
||||
} else if (c == '-') {
|
||||
c = fetch();
|
||||
*negative = 1;
|
||||
}
|
||||
|
||||
scan_state = check_for_zero;
|
||||
break;
|
||||
}
|
||||
|
||||
case check_for_zero: {
|
||||
if (base == 0 || base == 16) {
|
||||
if (c == '0') {
|
||||
scan_state = leading_zero;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
scan_state = need_digit;
|
||||
break;
|
||||
}
|
||||
|
||||
case leading_zero: {
|
||||
if (c == 'X' || c == 'x') {
|
||||
base = 16;
|
||||
scan_state = need_digit;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
|
||||
if (base == 0) {
|
||||
base = 8;
|
||||
}
|
||||
|
||||
scan_state = digit_loop;
|
||||
break;
|
||||
}
|
||||
|
||||
case need_digit:
|
||||
case digit_loop: {
|
||||
if (base == 0) {
|
||||
base = 10;
|
||||
}
|
||||
|
||||
if (!value_max) {
|
||||
value_max = ULLONG_MAX / base;
|
||||
}
|
||||
|
||||
if (isdigit(c)) {
|
||||
if ((c -= '0') >= base) {
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
|
||||
c += '0';
|
||||
break;
|
||||
}
|
||||
} else if (!isalpha(c) || (toupper(c) - 'A' + 10) >= base) {
|
||||
if (scan_state == digit_loop) {
|
||||
scan_state = finished;
|
||||
} else {
|
||||
scan_state = failure;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
c = toupper(c) - 'A' + 10;
|
||||
}
|
||||
|
||||
if (value > value_max) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
value *= base;
|
||||
|
||||
if (c > (ULLONG_MAX - value)) {
|
||||
*overflow = 1;
|
||||
}
|
||||
|
||||
value += c;
|
||||
scan_state = digit_loop;
|
||||
c = fetch();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!success(scan_state)) {
|
||||
count = 0;
|
||||
value = 0;
|
||||
*chars_scanned = 0;
|
||||
} else {
|
||||
count--;
|
||||
*chars_scanned = count + spaces;
|
||||
}
|
||||
|
||||
unfetch(c);
|
||||
return value;
|
||||
}
|
||||
|
||||
unsigned long strtoul(const char* str, char** end, int base) {
|
||||
unsigned long value;
|
||||
int count, negative, overflow;
|
||||
__InStrCtrl isc;
|
||||
|
||||
isc.spNextChar = (char*)str;
|
||||
isc.nullCharDetected = 0;
|
||||
|
||||
value = __strtoul(base, INT_MAX, &__StringRead, &isc, &count, &negative, &overflow);
|
||||
|
||||
if (end) {
|
||||
*end = (char*)str + count;
|
||||
}
|
||||
|
||||
if (overflow) {
|
||||
value = ULONG_MAX;
|
||||
errno = ERANGE;
|
||||
} else if (negative) {
|
||||
value = -value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
unsigned long long strtoull(const char* str, char** end, int base) {
|
||||
unsigned long long value;
|
||||
int count, negative, overflow;
|
||||
__InStrCtrl isc;
|
||||
|
||||
isc.spNextChar = (char*)str;
|
||||
isc.nullCharDetected = 0;
|
||||
|
||||
value = __strtoull(base, INT_MAX, &__StringRead, &isc, &count, &negative, &overflow);
|
||||
|
||||
if (end) {
|
||||
*end = (char*)str + count;
|
||||
}
|
||||
|
||||
if (overflow) {
|
||||
value = ULLONG_MAX;
|
||||
errno = ERANGE;
|
||||
} else if (negative) {
|
||||
value = -value;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
long strtol(const char* str, char** end, int base) {
|
||||
unsigned long uvalue;
|
||||
long svalue;
|
||||
int count, negative, overflow;
|
||||
__InStrCtrl isc;
|
||||
|
||||
isc.spNextChar = (char*)str;
|
||||
isc.nullCharDetected = 0;
|
||||
|
||||
uvalue = __strtoul(base, INT_MAX, &__StringRead, &isc, &count, &negative, &overflow);
|
||||
|
||||
if (end) {
|
||||
*end = (char*)str + count;
|
||||
}
|
||||
|
||||
if (overflow || (!negative && uvalue > LONG_MAX) || (negative && uvalue > -(unsigned long)LONG_MIN)) {
|
||||
svalue = (negative ? -(unsigned long)LONG_MIN : LONG_MAX);
|
||||
errno = ERANGE;
|
||||
} else {
|
||||
svalue = (negative ? -(long)uvalue : (long)uvalue);
|
||||
}
|
||||
|
||||
return svalue;
|
||||
}
|
||||
|
||||
int atoi(const char* str) {
|
||||
return (int)strtol(str, NULL, 10);
|
||||
}
|
||||
|
||||
long atol(const char* str) {
|
||||
return strtol(str, NULL, 10);
|
||||
}
|
||||
44
libs/MSL/src/MSL_Common/wchar_io.c
Normal file
44
libs/MSL/src/MSL_Common/wchar_io.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "internal/file_struct.h"
|
||||
|
||||
enum file_kinds {
|
||||
file_closed
|
||||
};
|
||||
|
||||
enum file_orientation {
|
||||
file_unoriented,
|
||||
file_char_oriented,
|
||||
file_wide_oriented
|
||||
};
|
||||
|
||||
int fwide(FILE* file, int file_mode) {
|
||||
int orientation;
|
||||
int res;
|
||||
|
||||
if (file == NULL || file->mode.file_kind == file_closed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
orientation = file->mode.file_orientation;
|
||||
|
||||
switch (orientation) {
|
||||
case file_unoriented:
|
||||
if (file_mode > 0) {
|
||||
file->mode.file_orientation = file_wide_oriented;
|
||||
} else if (file_mode < 0) {
|
||||
file->mode.file_orientation = file_char_oriented;
|
||||
}
|
||||
|
||||
res = file_mode;
|
||||
break;
|
||||
|
||||
case file_wide_oriented:
|
||||
res = 1;
|
||||
break;
|
||||
|
||||
case file_char_oriented:
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
104
libs/MSL/src/MSL_Common/wctype.c
Normal file
104
libs/MSL/src/MSL_Common/wctype.c
Normal file
@@ -0,0 +1,104 @@
|
||||
const unsigned int __wctype_mapC[128] = {
|
||||
0x00040004, 0x00040004, 0x00040004, 0x00040004,
|
||||
0x00040106, 0x01040104, 0x01040104, 0x00040004,
|
||||
0x00040004, 0x00040004, 0x00040004, 0x00040004,
|
||||
0x00040004, 0x00040004, 0x00040004, 0x00040004,
|
||||
0x014200D0, 0x00D000D0, 0x00D000D0, 0x00D000D0,
|
||||
0x00D000D0, 0x00D000D0, 0x00D000D0, 0x00D000D0,
|
||||
0x04580458, 0x04580458, 0x04580458, 0x04580458,
|
||||
0x04580458, 0x00D000D0, 0x00D000D0, 0x00D000D0,
|
||||
0x00D00651, 0x06510651, 0x06510651, 0x06510251,
|
||||
0x02510251, 0x02510251, 0x02510251, 0x02510251,
|
||||
0x02510251, 0x02510251, 0x02510251, 0x02510251,
|
||||
0x02510251, 0x025100D0, 0x00D000D0, 0x00D000D0,
|
||||
0x00D00471, 0x04710471, 0x04710471, 0x04710071,
|
||||
0x00710071, 0x00710071, 0x00710071, 0x00710071,
|
||||
0x00710071, 0x00710071, 0x00710071, 0x00710071,
|
||||
0x00710071, 0x007100D0, 0x00D000D0, 0x00D00004,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
const unsigned int __wlower_mapC[128] = {
|
||||
0x00000001, 0x00020003, 0x00040005, 0x00060007,
|
||||
0x00080009, 0x000A000B, 0x000C000D, 0x000E000F,
|
||||
0x00100011, 0x00120013, 0x00140015, 0x00160017,
|
||||
0x00180019, 0x001A001B, 0x001C001D, 0x001E001F,
|
||||
0x00200021, 0x00220023, 0x00240025, 0x00260027,
|
||||
0x00280029, 0x002A002B, 0x002C002D, 0x002E002F,
|
||||
0x00300031, 0x00320033, 0x00340035, 0x00360037,
|
||||
0x00380039, 0x003A003B, 0x003C003D, 0x003E003F,
|
||||
0x00400061, 0x00620063, 0x00640065, 0x00660067,
|
||||
0x00680069, 0x006A006B, 0x006C006D, 0x006E006F,
|
||||
0x00700071, 0x00720073, 0x00740075, 0x00760077,
|
||||
0x00780079, 0x007A005B, 0x005C005D, 0x005E005F,
|
||||
0x00600061, 0x00620063, 0x00640065, 0x00660067,
|
||||
0x00680069, 0x006A006B, 0x006C006D, 0x006E006F,
|
||||
0x00700071, 0x00720073, 0x00740075, 0x00760077,
|
||||
0x00780079, 0x007A007B, 0x007C007D, 0x007E007F,
|
||||
0x00800081, 0x00820083, 0x00840085, 0x00860087,
|
||||
0x00880089, 0x008A008B, 0x008C008D, 0x008E008F,
|
||||
0x00900091, 0x00920093, 0x00940095, 0x00960097,
|
||||
0x00980099, 0x009A009B, 0x009C009D, 0x009E009F,
|
||||
0x00A000A1, 0x00A200A3, 0x00A400A5, 0x00A600A7,
|
||||
0x00A800A9, 0x00AA00AB, 0x00AC00AD, 0x00AE00AF,
|
||||
0x00B000B1, 0x00B200B3, 0x00B400B5, 0x00B600B7,
|
||||
0x00B800B9, 0x00BA00BB, 0x00BC00BD, 0x00BE00BF,
|
||||
0x00C000C1, 0x00C200C3, 0x00C400C5, 0x00C600C7,
|
||||
0x00C800C9, 0x00CA00CB, 0x00CC00CD, 0x00CE00CF,
|
||||
0x00D000D1, 0x00D200D3, 0x00D400D5, 0x00D600D7,
|
||||
0x00D800D9, 0x00DA00DB, 0x00DC00DD, 0x00DE00DF,
|
||||
0x00E000E1, 0x00E200E3, 0x00E400E5, 0x00E600E7,
|
||||
0x00E800E9, 0x00EA00EB, 0x00EC00ED, 0x00EE00EF,
|
||||
0x00F000F1, 0x00F200F3, 0x00F400F5, 0x00F600F7,
|
||||
0x00F800F9, 0x00FA00FB, 0x00FC00FD, 0x00FE00FF,
|
||||
};
|
||||
|
||||
const unsigned int __wupper_mapC[128] = {
|
||||
0x00000001, 0x00020003, 0x00040005, 0x00060007,
|
||||
0x00080009, 0x000A000B, 0x000C000D, 0x000E000F,
|
||||
0x00100011, 0x00120013, 0x00140015, 0x00160017,
|
||||
0x00180019, 0x001A001B, 0x001C001D, 0x001E001F,
|
||||
0x00200021, 0x00220023, 0x00240025, 0x00260027,
|
||||
0x00280029, 0x002A002B, 0x002C002D, 0x002E002F,
|
||||
0x00300031, 0x00320033, 0x00340035, 0x00360037,
|
||||
0x00380039, 0x003A003B, 0x003C003D, 0x003E003F,
|
||||
0x00400041, 0x00420043, 0x00440045, 0x00460047,
|
||||
0x00480049, 0x004A004B, 0x004C004D, 0x004E004F,
|
||||
0x00500051, 0x00520053, 0x00540055, 0x00560057,
|
||||
0x00580059, 0x005A005B, 0x005C005D, 0x005E005F,
|
||||
0x00600041, 0x00420043, 0x00440045, 0x00460047,
|
||||
0x00480049, 0x004A004B, 0x004C004D, 0x004E004F,
|
||||
0x00500051, 0x00520053, 0x00540055, 0x00560057,
|
||||
0x00580059, 0x005A007B, 0x007C007D, 0x007E007F,
|
||||
0x00800081, 0x00820083, 0x00840085, 0x00860087,
|
||||
0x00880089, 0x008A008B, 0x008C008D, 0x008E008F,
|
||||
0x00900091, 0x00920093, 0x00940095, 0x00960097,
|
||||
0x00980099, 0x009A009B, 0x009C009D, 0x009E009F,
|
||||
0x00A000A1, 0x00A200A3, 0x00A400A5, 0x00A600A7,
|
||||
0x00A800A9, 0x00AA00AB, 0x00AC00AD, 0x00AE00AF,
|
||||
0x00B000B1, 0x00B200B3, 0x00B400B5, 0x00B600B7,
|
||||
0x00B800B9, 0x00BA00BB, 0x00BC00BD, 0x00BE00BF,
|
||||
0x00C000C1, 0x00C200C3, 0x00C400C5, 0x00C600C7,
|
||||
0x00C800C9, 0x00CA00CB, 0x00CC00CD, 0x00CE00CF,
|
||||
0x00D000D1, 0x00D200D3, 0x00D400D5, 0x00D600D7,
|
||||
0x00D800D9, 0x00DA00DB, 0x00DC00DD, 0x00DE00DF,
|
||||
0x00E000E1, 0x00E200E3, 0x00E400E5, 0x00E600E7,
|
||||
0x00E800E9, 0x00EA00EB, 0x00EC00ED, 0x00EE00EF,
|
||||
0x00F000F1, 0x00F200F3, 0x00F400F5, 0x00F600F7,
|
||||
0x00F800F9, 0x00FA00FB, 0x00FC00FD, 0x00FE00FF,
|
||||
};
|
||||
160
libs/MSL/src/MSL_Common/wstring.c
Normal file
160
libs/MSL/src/MSL_Common/wstring.c
Normal file
@@ -0,0 +1,160 @@
|
||||
#include <wchar.h>
|
||||
|
||||
size_t wcslen(const wchar_t* str) {
|
||||
const wchar_t* p = str - 1;
|
||||
size_t len = -1;
|
||||
|
||||
do {
|
||||
len++;
|
||||
} while (*++p != 0);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
wchar_t* wcscpy(wchar_t* dest, const wchar_t* src) {
|
||||
const wchar_t* s = src - 1;
|
||||
wchar_t* d = dest - 1;
|
||||
wchar_t c;
|
||||
|
||||
do {
|
||||
c = *++s;
|
||||
*++d = c;
|
||||
} while (c != 0);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
wchar_t* wcsncpy(wchar_t* dest, const wchar_t* src, size_t num) {
|
||||
const wchar_t* s = src - 1;
|
||||
wchar_t* d = dest - 1;
|
||||
wchar_t c;
|
||||
size_t n = num + 1;
|
||||
|
||||
while (--n != 0) {
|
||||
c = *++s;
|
||||
*++d = c;
|
||||
if (c == 0) {
|
||||
while (--n != 0) {
|
||||
*++d = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
wchar_t* wcscat(wchar_t* dest, const wchar_t* src) {
|
||||
const wchar_t* s = src - 1;
|
||||
wchar_t* d = dest - 1;
|
||||
|
||||
while (*++d != 0)
|
||||
;
|
||||
d--;
|
||||
do {
|
||||
*++d = *++s;
|
||||
} while (*s != 0);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
wchar_t* wcsncat(wchar_t* dest, const wchar_t* src, size_t num) {
|
||||
const wchar_t* s = src - 1;
|
||||
wchar_t* d = dest - 1;
|
||||
wchar_t c;
|
||||
size_t n;
|
||||
|
||||
while (*++d != 0)
|
||||
;
|
||||
d--;
|
||||
n = num + 1;
|
||||
|
||||
while (--n != 0) {
|
||||
c = *++s;
|
||||
*++d = c;
|
||||
if (c == 0) {
|
||||
d--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*++d = 0;
|
||||
return dest;
|
||||
}
|
||||
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t num) {
|
||||
wchar_t c2;
|
||||
wchar_t c1;
|
||||
const wchar_t* p1;
|
||||
const wchar_t* p2;
|
||||
size_t n;
|
||||
|
||||
p1 = s1 - 1;
|
||||
p2 = s2 - 1;
|
||||
n = num + 1;
|
||||
|
||||
while (--n != 0) {
|
||||
c1 = *++p1;
|
||||
c2 = *++p2;
|
||||
if (c1 != c2) {
|
||||
return (int)(c1 - c2);
|
||||
}
|
||||
if (c1 == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* wcschr(wchar_t* ws, wchar_t wc) {
|
||||
wchar_t* p = ws - 1;
|
||||
wchar_t ch;
|
||||
|
||||
while ((ch = *++p) != 0) {
|
||||
if (ch == wc) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
if (wc == 0) {
|
||||
return p;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2) {
|
||||
const wchar_t* p1;
|
||||
wchar_t c;
|
||||
wchar_t c1;
|
||||
wchar_t c2;
|
||||
|
||||
c = *s2;
|
||||
p1 = s1 - 1;
|
||||
if (c == 0) {
|
||||
return (wchar_t*)s1;
|
||||
}
|
||||
|
||||
while ((c1 = *++p1) != 0) {
|
||||
if (c1 == c) {
|
||||
wchar_t ic1;
|
||||
const wchar_t* ps1;
|
||||
const wchar_t* p2;
|
||||
ps1 = p1 - 1;
|
||||
p2 = s2 - 1;
|
||||
do {
|
||||
ic1 = *++ps1;
|
||||
c2 = *++p2;
|
||||
if (ic1 != c2) {
|
||||
break;
|
||||
}
|
||||
} while (ic1 != 0);
|
||||
|
||||
if (c2 == 0) {
|
||||
return (wchar_t*)p1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace nw4r {
|
||||
b = blue;
|
||||
a = alpha;
|
||||
}
|
||||
} Color;
|
||||
} ATTRIBUTE_ALIGN(4) Color;
|
||||
} // namespace ut
|
||||
} // namespace nw4r
|
||||
|
||||
|
||||
@@ -34,20 +34,29 @@ namespace nw4r {
|
||||
const u32* flags0A;
|
||||
const u32* flags0C;
|
||||
|
||||
int i, j;
|
||||
int i;
|
||||
int entryI;
|
||||
const HeaderedGlyphGroups* offsetPGlgr;
|
||||
const u8* offsetFlags;
|
||||
u32 loadedSheetCount, loadedSmth0ASize, loadedSmth0CSize;
|
||||
u32 flagWord;
|
||||
const u8* offsetFlags;
|
||||
const char* groupName;
|
||||
const u32* offsetData;
|
||||
int j;
|
||||
|
||||
u32 sheetOffsetsSize;
|
||||
u32 loadedSheetsSize;
|
||||
u32 neededCharacterSize;
|
||||
u32 baseSize;
|
||||
|
||||
u32 count0CWork;
|
||||
|
||||
u32& neededCharacterSizeRef = neededCharacterSize;
|
||||
|
||||
u32 loadedSizeRef;
|
||||
|
||||
u32 groupOffset;
|
||||
|
||||
if (!ArchiveFontBase::IsValidResource(fontData, 0x4000)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -55,29 +64,30 @@ namespace nw4r {
|
||||
font = (ArchiveFontBinaryLayout*)fontData;
|
||||
pGlgr = &font->glgr;
|
||||
|
||||
countName = font->glgr.inner.nameCount;
|
||||
countSheet = font->glgr.inner.sheetCount;
|
||||
count0A = font->glgr.inner.smthCount_0x0a;
|
||||
count0C = font->glgr.inner.smthCount_0x0c;
|
||||
countName = pGlgr->inner.nameCount;
|
||||
countSheet = pGlgr->inner.sheetCount;
|
||||
count0A = pGlgr->inner.smthCount_0x0a;
|
||||
count0C = pGlgr->inner.smthCount_0x0c;
|
||||
count0CWork = count0C;
|
||||
|
||||
stepSheets = ((s32)countSheet + 0x1f) / 32 * 4;
|
||||
step0A = ((s32)count0A + 0x1f) / 32 * 4;
|
||||
step0C = ((s32)count0C + 0x1f) / 32 * 4;
|
||||
step0C = ((s32)count0CWork + 0x1f) / 32 * 4;
|
||||
|
||||
dataSheetsOff = ROUNDUP(offsetof(ArchiveFontBinaryLayout, glgr.inner.nameOffsets) + countName * sizeof(u16), 4);
|
||||
data0AOff = ROUNDUP(dataSheetsOff + countSheet * sizeof(u32), 4);
|
||||
data0COff = ROUNDUP(data0AOff + count0A * sizeof(u32), 4);
|
||||
dataSheets = lyt::detail::ConvertOffsToPtr<u32>(fontData, dataSheetsOff);
|
||||
data0A = lyt::detail::ConvertOffsToPtr<u32>(fontData, data0AOff);
|
||||
data0C = lyt::detail::ConvertOffsToPtr<u32>(fontData, data0COff);
|
||||
dataSheets = (const u32*)((u32)dataSheetsOff + (u32)fontData);
|
||||
data0A = (const u32*)((u32)data0AOff + (u32)fontData);
|
||||
data0C = (const u32*)((u32)data0COff + (u32)fontData);
|
||||
|
||||
flagsSheetsOff = ROUNDUP(data0COff + count0C * sizeof(u32), 4);
|
||||
flagsSheetsOff = ROUNDUP(data0COff + count0CWork * sizeof(u32), 4);
|
||||
flags0AOff = ROUNDUP(flagsSheetsOff + stepSheets * countName, 4);
|
||||
flags0COff = ROUNDUP(flags0AOff + step0A * countName, 4);
|
||||
|
||||
flagsSheets = lyt::detail::ConvertOffsToPtr<u32>(fontData, flagsSheetsOff);
|
||||
flags0A = lyt::detail::ConvertOffsToPtr<u32>(fontData, flags0AOff);
|
||||
flags0C = lyt::detail::ConvertOffsToPtr<u32>(fontData, flags0COff);
|
||||
flagsSheets = (const u32*)((u32)flagsSheetsOff + (u32)fontData);
|
||||
flags0A = (const u32*)((u32)flags0AOff + (u32)fontData);
|
||||
flags0C = (const u32*)((u32)flags0COff + (u32)fontData);
|
||||
|
||||
loadedSheetCount = 0;
|
||||
loadedSmth0ASize = 0;
|
||||
@@ -90,7 +100,7 @@ namespace nw4r {
|
||||
flagWord = 0;
|
||||
for (j = 0, offsetPGlgr = pGlgr; j < pGlgr->inner.nameCount;
|
||||
offsetPGlgr = (const HeaderedGlyphGroups*)((const u8*)offsetPGlgr + 2), j++) {
|
||||
groupName = (const char*)fontData + offsetPGlgr->inner.nameOffsets[0];
|
||||
groupName = (const char*)((u32)offsetPGlgr->inner.nameOffsets[0] + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * stepSheets, 4));
|
||||
}
|
||||
@@ -101,12 +111,13 @@ namespace nw4r {
|
||||
// getLoadedSheetCount(pGlgr, flagsSheets, stepSheets, fontData, includedGroups, &loadedSheetCount);
|
||||
|
||||
// Get the SIZE of unk_0x0a that should be loaded
|
||||
for (i = 0, entryI = 0; entryI < pGlgr->inner.smthCount_0x0a; entryI += 32, i++) {
|
||||
for (i = 0; i * 32 < pGlgr->inner.smthCount_0x0a; i++) {
|
||||
offsetFlags = (const u8*)flags0A + i * sizeof(u32);
|
||||
|
||||
flagWord = 0;
|
||||
for (j = 0; j < pGlgr->inner.nameCount; j++) {
|
||||
groupName = (const char*)fontData + pGlgr->inner.nameOffsets[j];
|
||||
groupOffset = pGlgr->inner.nameOffsets[j];
|
||||
groupName = (const char*)(groupOffset + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * step0A, 4));
|
||||
}
|
||||
@@ -121,12 +132,13 @@ namespace nw4r {
|
||||
}
|
||||
|
||||
// Get the SIZE of unk_0x0C that should be loaded
|
||||
for (i = 0, entryI = 0; entryI < pGlgr->inner.smthCount_0x0c; entryI += 32, i++) {
|
||||
for (i = 0; i * 32 < pGlgr->inner.smthCount_0x0c; i++) {
|
||||
offsetFlags = (const u8*)flags0C + i * sizeof(u32);
|
||||
|
||||
flagWord = 0;
|
||||
for (j = 0; j < pGlgr->inner.nameCount; j++) {
|
||||
groupName = (const char*)fontData + pGlgr->inner.nameOffsets[j];
|
||||
groupOffset = pGlgr->inner.nameOffsets[j];
|
||||
groupName = (const char*)(groupOffset + (u32)fontData);
|
||||
if (*includedGroups == '\0' || detail::ArchiveFontBase::IncludeName(includedGroups, groupName)) {
|
||||
flagWord |= *(const u32*)((const u8*)offsetFlags + ROUNDDOWN(j * step0C, 4));
|
||||
}
|
||||
@@ -145,13 +157,14 @@ namespace nw4r {
|
||||
sheetOffsetsSize = ROUNDUP(pGlgr->inner.sheetCount * 2, 4);
|
||||
loadedSheetsSize = ROUNDUP(loadedSheetCount * pGlgr->inner.uncompSheetSize, 4);
|
||||
|
||||
neededCharacterSize = sizeof(CXUncompContextHuffman);
|
||||
if (loadedSmth0ASize + loadedSmth0CSize >= sizeof(CXUncompContextHuffman)) {
|
||||
neededCharacterSize = loadedSmth0ASize + loadedSmth0CSize;
|
||||
loadedSizeRef = loadedSmth0ASize + loadedSmth0CSize;
|
||||
neededCharacterSizeRef = sizeof(CXUncompContextHuffman);
|
||||
if (loadedSizeRef >= sizeof(CXUncompContextHuffman)) {
|
||||
neededCharacterSize = loadedSizeRef;
|
||||
}
|
||||
|
||||
baseSize = OSRoundUp32B(sizeof(FontInformation) + sizeof(FontTextureGlyph) + sheetOffsetsSize);
|
||||
return baseSize + neededCharacterSize + loadedSheetsSize;
|
||||
return (baseSize + loadedSheetsSize) + neededCharacterSize;
|
||||
}
|
||||
|
||||
detail::ArchiveFontBase::ConstructState ArchiveFont::StreamingConstruct(ConstructContext* ctx, const void* fontData, u32 fontDataSize) {
|
||||
@@ -164,8 +177,9 @@ namespace nw4r {
|
||||
}
|
||||
|
||||
state = CONSTRUCT_STATE_WORKING;
|
||||
reader = &ctx->mReader;
|
||||
reader->Attach(fontData, fontDataSize);
|
||||
CachedStreamReader& readerRef = ctx->mReader;
|
||||
reader = &readerRef;
|
||||
readerRef.Attach(fontData, fontDataSize);
|
||||
|
||||
while (state == CONSTRUCT_STATE_WORKING) {
|
||||
switch (ctx->mNextCmd) {
|
||||
|
||||
@@ -57,6 +57,46 @@ void RFLiInitCtrlBuf(MEMiHeapHead* sysHeap) {
|
||||
}
|
||||
}
|
||||
|
||||
int RFLiGetControllerData(RFLiCharInfo* dst, s32 chan, u8 index, BOOL hiddenAvailable) {
|
||||
RFLiCtrlManager* manager;
|
||||
RFLiCtrlBuffer* buffer;
|
||||
u16 flag;
|
||||
|
||||
RFLi_ASSERTLINE_RANGE(chan, 0, WPAD_MAX_CONTROLLERS, 1412);
|
||||
RFLi_ASSERTLINE_RANGE(index, 0, RFL_MAX_CTRL_BUFFER, 1413);
|
||||
|
||||
if (chan < 0 || chan >= WPAD_MAX_CONTROLLERS) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (index >= RFL_MAX_CTRL_BUFFER) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
manager = RFLiGetCtrlBufManager();
|
||||
if (manager == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!manager->mIsLoaded[chan]) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
flag = (1 << index);
|
||||
buffer = manager->mBuffer[chan];
|
||||
if (!RFLiIsValidID((RFLCreateID*)&buffer->mData[index].createID)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!hiddenAvailable && (buffer->mSecretFlag & flag) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RFLiConvertRaw2Info(&buffer->mData[index], dst);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL RFLiCheckCtrlBufferCore(const RFLiCtrlBuffer* buffer, u8 index, RFLiCtrlCheckType type) {
|
||||
u16 flag = (1 << index);
|
||||
|
||||
@@ -771,46 +811,6 @@ int RFLiSetControllerData(const RFLiCharInfo* src, s32 chan, u8 index) {
|
||||
return setDataCore_(src, chan, index, FALSE);
|
||||
}
|
||||
|
||||
int RFLiGetControllerData(RFLiCharInfo* dst, s32 chan, u8 index, BOOL hiddenAvailable) {
|
||||
RFLiCtrlManager* manager;
|
||||
RFLiCtrlBuffer* buffer;
|
||||
u16 flag;
|
||||
|
||||
RFLi_ASSERTLINE_RANGE(chan, 0, WPAD_MAX_CONTROLLERS, 1412);
|
||||
RFLi_ASSERTLINE_RANGE(index, 0, RFL_MAX_CTRL_BUFFER, 1413);
|
||||
|
||||
if (chan < 0 || chan >= WPAD_MAX_CONTROLLERS) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (index >= RFL_MAX_CTRL_BUFFER) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
manager = RFLiGetCtrlBufManager();
|
||||
if (manager == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!manager->mIsLoaded[chan]) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
flag = (1 << index);
|
||||
buffer = manager->mBuffer[chan];
|
||||
if (!RFLiIsValidID((RFLCreateID*)&buffer->mData[index].createID)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!hiddenAvailable && (buffer->mSecretFlag & flag) != 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RFLiConvertRaw2Info(&buffer->mData[index], dst);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RFLErrcode RFLUnloadController(s32 chan) {
|
||||
RFLi_ASSERTLINE_RANGE(chan, 0, WPAD_MAX_CONTROLLERS, 1461);
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ void RFLi_MakeRandomFace_Core(RFLiCharInfo* pCharInfo, RFLi_SEX argSex, RFLi_AGE
|
||||
pCharInfo->personal.localonly = FALSE;
|
||||
}
|
||||
|
||||
u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetFacelineType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 facelineTypeTable[RFLSex_All * RFLAge_All * RFLRace_All][10] = {
|
||||
/* Male, Child, Black */ {0, 0, 0, 1, 1, 1, 2, 3, 4, 5},
|
||||
@@ -272,7 +272,7 @@ u8 RFLi_GetHairType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
return hair_parts[index][RFLi_GetRandU32(hair_parts_num[index])];
|
||||
}
|
||||
|
||||
u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
u8 eye_parts[RFLSex_All * RFLAge_All * RFLRace_All][48] = {
|
||||
/* Male, Child, Black */ { 2, 3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 18, 27, 29, 32, 34, 36, 38, 39, 41, 43, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
@@ -307,7 +307,7 @@ u8 RFLi_GetEyeType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
return eye_parts[index][RFLi_GetRandU32(eye_parts_num[index])];
|
||||
}
|
||||
|
||||
u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 eyebrow_parts[RFLSex_All * RFLAge_All * RFLRace_All][24] = {
|
||||
/* Male, Child, Black */ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 18, 20, 0, 0, 0, 0, 0, 0},
|
||||
@@ -342,7 +342,7 @@ u8 RFLi_GetEyebrowType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
return eyebrow_parts[index][RFLi_GetRandU32(eyebrow_parts_num[index])];
|
||||
}
|
||||
|
||||
u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
u8 nose_parts[RFLSex_All * RFLAge_All * RFLRace_All][12] = {
|
||||
/* Male, Child, Black */ { 0, 1, 2, 3, 4, 5, 7, 8, 10, 0, 0, 0},
|
||||
@@ -377,7 +377,7 @@ u8 RFLi_GetNoseType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
return nose_parts[index][RFLi_GetRandU32(nose_parts_num[index])];
|
||||
}
|
||||
|
||||
u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
u8 mouth_parts[RFLSex_All * RFLAge_All * RFLRace_All][24] = {
|
||||
/* Male, Child, Black */ { 0, 2, 3, 6, 7, 8, 9, 10, 12, 14, 15, 17, 18, 19, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0},
|
||||
@@ -412,7 +412,7 @@ u8 RFLi_GetMouthType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
return mouth_parts[index][RFLi_GetRandU32(mouth_parts_num[index])];
|
||||
}
|
||||
|
||||
u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetFaceTexType(RFLi_SEX sex, RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 faceTexTypeTable[RFLSex_All * RFLAge_All * RFLRace_All][20] = {
|
||||
/* Male, Child, Black */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3},
|
||||
@@ -507,7 +507,7 @@ u8 RFLi_GetGlassType(RFLi_AGE age) {
|
||||
}
|
||||
}
|
||||
|
||||
u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race) {
|
||||
static u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 faceColorTable[RFLSex_All * RFLRace_All][10] = {
|
||||
/* Male, Black */ { 2, 2, 4, 4, 4, 4, 5, 5, 5, 5 },
|
||||
@@ -526,7 +526,7 @@ u8 RFLi_GetFaceColor(RFLi_SEX sex, RFLi_RACE race) {
|
||||
return faceColorTable[(sex * RFLRace_All) + race][RFLi_GetRandU32(GET_ARRAY_LENGTH(faceColorTable[0]))];
|
||||
}
|
||||
|
||||
u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race) {
|
||||
static u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 hairColorTable[RFLAge_All * RFLRace_All][20] = {
|
||||
/* Black, Child */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
@@ -547,7 +547,7 @@ u8 RFLi_GetHairColor(RFLi_AGE age, RFLi_RACE race) {
|
||||
return hairColorTable[(race * 4 - race) + age][RFLi_GetRandU32(GET_ARRAY_LENGTH(hairColorTable[0]))];
|
||||
}
|
||||
|
||||
u8 RFLi_GetEyeColor(RFLi_RACE race) {
|
||||
static u8 RFLi_GetEyeColor(RFLi_RACE race) {
|
||||
// clang-format off
|
||||
static const u8 eyeColorTable[RFLRace_All][10] = {
|
||||
/* Black */ {0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
||||
@@ -561,6 +561,6 @@ u8 RFLi_GetEyeColor(RFLi_RACE race) {
|
||||
return eyeColorTable[race][RFLi_GetRandU32(GET_ARRAY_LENGTH(eyeColorTable[0]))];
|
||||
}
|
||||
|
||||
u32 RFLi_GetRandU32(u32 max) {
|
||||
static u32 RFLi_GetRandU32(u32 max) {
|
||||
return OSGetTick() % max;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ void RFLExit() {
|
||||
}
|
||||
}
|
||||
|
||||
RFLErrcode RFLiBootLoad() {
|
||||
static inline RFLErrcode RFLiBootLoad() {
|
||||
RFLiBootLoadAsync();
|
||||
return RFLWaitAsync();
|
||||
}
|
||||
@@ -223,7 +223,7 @@ static void bootloadDB2Res_() {
|
||||
}
|
||||
}
|
||||
|
||||
RFLErrcode RFLiBootLoadAsync() {
|
||||
static inline RFLErrcode RFLiBootLoadAsync() {
|
||||
return RFLiBootLoadDatabaseAsync(bootloadDB2Res_);
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ void RFLiFree(void* block) {
|
||||
MEMFreeToExpHeap(RFLiGetManager()->mTmpHeap, block);
|
||||
}
|
||||
|
||||
u32 RFLiGetUsedWorkSize() {
|
||||
static inline u32 RFLiGetUsedWorkSize() {
|
||||
if (RFLAvailable()) {
|
||||
MEMiHeapHead* heap = RFLiGetManager()->mTmpHeap;
|
||||
return MEMGetAllocatableSizeForExpHeap(heap) - MEMGetTotalFreeSizeForExpHeap(heap);
|
||||
@@ -397,7 +397,7 @@ BOOL RFLiNeedRepairError() {
|
||||
return ((*list & (1 << RFLiFileBrokenType_DBBroken)) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL RFLiCriticalError() {
|
||||
static inline BOOL RFLiCriticalError() {
|
||||
u8* list = &sRFLBrokenType;
|
||||
BOOL ret = FALSE; // Unused
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ ziU32 Zi8GetZHuwdPtr(ziU32* arg0, ziU16* arg1 ZI_NEED_WORK) {
|
||||
return 0;
|
||||
} else {
|
||||
*arg1 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][1] / 3;
|
||||
*arg0 = ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1][0];
|
||||
*arg0 = (ziU32)ZI_WORK->unk_0x124[ZI_WORK->unk_0x12C - 1];
|
||||
*arg0 += 8;
|
||||
Zi8LogError(0x64, ZI_WORK);
|
||||
return 1;
|
||||
|
||||
@@ -247,7 +247,12 @@ typedef struct WPADCB {
|
||||
u8 unk_0x98F[0x9A0 - 0x990];
|
||||
} WPADCB;
|
||||
|
||||
extern WPADCB _wpd[WPAD_MAX_CONTROLLERS];
|
||||
typedef struct WPADStorage {
|
||||
WPADCB controllers[WPAD_MAX_CONTROLLERS];
|
||||
u8 unk_0x26C0[0x48];
|
||||
} WPADStorage;
|
||||
|
||||
extern WPADStorage _wpd;
|
||||
extern WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS];
|
||||
|
||||
void WPADiInitSub();
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct AXFX_REVERBHI_EXP {
|
||||
f32 sendGain; // 0x144
|
||||
} AXFX_REVERBHI_EXP;
|
||||
|
||||
u32 AXFXReverbHiExpGetMemSize(const AXFX_REVERBHI_EXP* fx);
|
||||
u32 AXFXReverbHiExpGetMemSize(AXFX_REVERBHI_EXP* fx);
|
||||
BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx);
|
||||
void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx);
|
||||
BOOL AXFXReverbHiExpSettings(AXFX_REVERBHI_EXP* fx);
|
||||
|
||||
@@ -10,7 +10,16 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _GXColor {
|
||||
#ifdef IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
union {
|
||||
struct {
|
||||
u8 r, g, b, a;
|
||||
};
|
||||
u32 value;
|
||||
};
|
||||
#else
|
||||
u8 r, g, b, a; // 0x00
|
||||
#endif
|
||||
} GXColor;
|
||||
|
||||
typedef struct _GXColorS10 {
|
||||
|
||||
447
libs/RVL_SDK/src/axfx/AXFXReverbHiExp.c
Normal file
447
libs/RVL_SDK/src/axfx/AXFXReverbHiExp.c
Normal file
@@ -0,0 +1,447 @@
|
||||
#include <private/axfx.h>
|
||||
#include <revolution/AXFX.h>
|
||||
#include <revolution/MEM.h>
|
||||
#include <revolution/OS.h>
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
static BOOL __AllocDelayLine(AXFX_REVERBHI_EXP* fx);
|
||||
static void __BzeroDelayLines(AXFX_REVERBHI_EXP* fx);
|
||||
static void __FreeDelayLine(AXFX_REVERBHI_EXP* fx);
|
||||
static BOOL __InitParams(AXFX_REVERBHI_EXP* fx);
|
||||
|
||||
static u32 __EarlySizeTable[8][3] = {{157, 479, 829}, {317, 809, 1117}, {479, 941, 1487}, {641, 1259, 1949},
|
||||
{797, 1667, 2579}, {967, 1901, 2903}, {1123, 2179, 3413}, {1279, 2477, 3889}};
|
||||
|
||||
static f32 __EarlyCoefTable[8][3] = {{0.4f, -1.0f, 0.3f}, {0.5f, -0.95f, 0.3f}, {0.6f, -0.9f, 0.3f}, {0.75f, -0.85f, 0.3f},
|
||||
{-0.9f, 0.8f, 0.3f}, {-1.0f, 0.7f, 0.3f}, {-1.0f, 0.7f, 0.3f}, {-1.0f, 0.7f, 0.3f}};
|
||||
|
||||
static u32 __FilterSizeTable[7][8] = {{1789, 1999, 2333, 433, 149, 47, 73, 67}, {149, 293, 449, 251, 103, 47, 73, 67},
|
||||
{947, 1361, 1531, 433, 137, 47, 73, 67}, {1279, 1531, 1973, 509, 149, 47, 73, 67},
|
||||
{1531, 1847, 2297, 563, 179, 47, 73, 67}, {1823, 2357, 2693, 571, 137, 47, 73, 67},
|
||||
{1823, 2357, 2693, 571, 179, 47, 73, 67}};
|
||||
|
||||
u32 AXFXReverbHiExpGetMemSize(AXFX_REVERBHI_EXP* fx) {
|
||||
u32 sum = 0;
|
||||
u32 i = 0;
|
||||
|
||||
sum += __EarlySizeTable[7][2];
|
||||
sum += (int)(fx->preDelayTimeMax * 32000);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
sum += __FilterSizeTable[6][i];
|
||||
}
|
||||
|
||||
sum *= 3;
|
||||
|
||||
for (i = 5; i < 8; i++) {
|
||||
sum += __FilterSizeTable[6][i];
|
||||
}
|
||||
|
||||
sum *= 4;
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx) {
|
||||
u32 ch, i;
|
||||
BOOL result = TRUE;
|
||||
BOOL mask = OSDisableInterrupts();
|
||||
|
||||
fx->active = 1;
|
||||
|
||||
if (fx->preDelayTimeMax < 0.0f) {
|
||||
AXFXReverbHiExpShutdown(fx);
|
||||
OSRestoreInterrupts(mask);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fx->earlyMaxLength = __EarlySizeTable[8 - 1][2];
|
||||
fx->preDelayMaxLength = (u32)(fx->preDelayTimeMax * 32000);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
fx->combMaxLength[i] = __FilterSizeTable[6][i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
fx->allpassMaxLength[i] = __FilterSizeTable[6][3 + i];
|
||||
}
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
fx->lastAllpassMaxLength[ch] = __FilterSizeTable[6][5 + ch];
|
||||
}
|
||||
|
||||
result = __AllocDelayLine(fx);
|
||||
if (result == FALSE) {
|
||||
AXFXReverbHiExpShutdown(fx);
|
||||
OSRestoreInterrupts(mask);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
__BzeroDelayLines(fx);
|
||||
result = __InitParams(fx);
|
||||
if (result == FALSE) {
|
||||
AXFXReverbHiExpShutdown(fx);
|
||||
OSRestoreInterrupts(mask);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fx->active &= ~1;
|
||||
OSRestoreInterrupts(mask);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AXFXReverbHiExpSettings(AXFX_REVERBHI_EXP* fx) {
|
||||
BOOL mask = OSDisableInterrupts();
|
||||
fx->active = fx->active | 1;
|
||||
AXFXReverbHiExpShutdown(fx);
|
||||
|
||||
if (!AXFXReverbHiExpInit(fx)) {
|
||||
AXFXReverbHiExpShutdown(fx);
|
||||
OSRestoreInterrupts(mask);
|
||||
return FALSE;
|
||||
} else {
|
||||
fx->active |= 2;
|
||||
fx->active &= ~1;
|
||||
OSRestoreInterrupts(mask);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx) {
|
||||
BOOL mask = OSDisableInterrupts();
|
||||
fx->active |= 1;
|
||||
__FreeDelayLine(fx);
|
||||
OSRestoreInterrupts(mask);
|
||||
}
|
||||
|
||||
void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_REVERBHI_EXP* fx) {
|
||||
u32 ch, i;
|
||||
u32 samp;
|
||||
s32* input[3];
|
||||
f32 data;
|
||||
f32 output[3];
|
||||
f32* earlyLine;
|
||||
f32 earlyOut;
|
||||
f32* preDelayLine;
|
||||
f32 preDelayOut;
|
||||
f32 filterOut;
|
||||
f32* combLine;
|
||||
f32 combOutOne;
|
||||
f32* allpass;
|
||||
f32 outTmp;
|
||||
f32 allpassIn;
|
||||
f32 allpassCoef;
|
||||
f32 lpfOut;
|
||||
f32 lpfCoef1;
|
||||
f32 lpfCoef2;
|
||||
f32 fusedOut[3];
|
||||
f32 fusedGain;
|
||||
f32 crosstalkGain;
|
||||
f32 crosstalkL;
|
||||
f32 crosstalkR;
|
||||
f32 crosstalkS;
|
||||
s32* inBusData[3];
|
||||
s32* outBusData[3];
|
||||
|
||||
if (fx->active != 0) {
|
||||
fx->active &= ~2;
|
||||
return;
|
||||
}
|
||||
|
||||
input[0] = bufferUpdate->left;
|
||||
input[1] = bufferUpdate->right;
|
||||
input[2] = bufferUpdate->surround;
|
||||
|
||||
if (fx->busIn != NULL) {
|
||||
inBusData[0] = fx->busIn->left;
|
||||
inBusData[1] = fx->busIn->right;
|
||||
inBusData[2] = fx->busIn->surround;
|
||||
}
|
||||
|
||||
if (fx->busOut != NULL) {
|
||||
outBusData[0] = fx->busOut->left;
|
||||
outBusData[1] = fx->busOut->right;
|
||||
outBusData[2] = fx->busOut->surround;
|
||||
}
|
||||
|
||||
lpfCoef1 = 1.0f - fx->lpfCoef;
|
||||
lpfCoef2 = fx->lpfCoef;
|
||||
allpassCoef = fx->allpassCoef;
|
||||
fusedGain = fx->fusedGain * 0.6f;
|
||||
crosstalkGain = fx->crosstalk * 0.5f;
|
||||
|
||||
for (samp = 0; samp < 96; samp++) {
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
if (fx->busIn != NULL) {
|
||||
data = (f32)(*(input[ch]) + *(inBusData[ch]++));
|
||||
} else {
|
||||
data = (f32)(*input[ch]);
|
||||
}
|
||||
|
||||
earlyLine = fx->earlyLine[ch];
|
||||
earlyOut = earlyLine[fx->earlyPos[0]] * fx->earlyCoef[0] + earlyLine[fx->earlyPos[1]] * fx->earlyCoef[1] +
|
||||
earlyLine[fx->earlyPos[2]] * fx->earlyCoef[2];
|
||||
|
||||
earlyLine[fx->earlyPos[2]] = data;
|
||||
|
||||
if (fx->preDelayLength != 0) {
|
||||
preDelayLine = fx->preDelayLine[ch];
|
||||
preDelayOut = preDelayLine[fx->preDelayPos];
|
||||
preDelayLine[fx->preDelayPos] = data;
|
||||
} else {
|
||||
preDelayOut = data;
|
||||
}
|
||||
|
||||
filterOut = 0.0f;
|
||||
for (i = 0; i < 3; i++) {
|
||||
combLine = fx->combLine[ch][i];
|
||||
combOutOne = combLine[fx->combPos[i]];
|
||||
combLine[fx->combPos[i]] = preDelayOut + (combOutOne * fx->combCoef[i]);
|
||||
filterOut += combOutOne;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
allpass = fx->allpassLine[ch][i];
|
||||
outTmp = allpass[fx->allpassPos[i]];
|
||||
allpassIn = filterOut + outTmp * allpassCoef;
|
||||
allpass[fx->allpassPos[i]] = allpassIn;
|
||||
filterOut = outTmp - allpassIn * allpassCoef;
|
||||
}
|
||||
|
||||
lpfOut = lpfCoef1 * filterOut + lpfCoef2 * fx->lastLpfOut[ch];
|
||||
fx->lastLpfOut[ch] = lpfOut;
|
||||
allpass = fx->lastAllpassLine[ch];
|
||||
outTmp = allpass[fx->lastAllpassPos[ch]];
|
||||
allpassIn = lpfOut + outTmp * allpassCoef;
|
||||
allpass[fx->lastAllpassPos[ch]] = allpassIn;
|
||||
fusedOut[ch] = outTmp - allpassIn * allpassCoef;
|
||||
if (++fx->lastAllpassPos[ch] >= fx->lastAllpassLength[ch]) {
|
||||
fx->lastAllpassPos[ch] = 0;
|
||||
}
|
||||
|
||||
fusedOut[ch] *= fusedGain;
|
||||
fusedOut[ch] += earlyOut;
|
||||
}
|
||||
|
||||
crosstalkL = fusedOut[1] + fusedOut[2];
|
||||
crosstalkR = fusedOut[0] + fusedOut[2];
|
||||
crosstalkS = fusedOut[0] + fusedOut[1];
|
||||
|
||||
output[0] = fusedOut[0] + crosstalkL * crosstalkGain;
|
||||
output[1] = fusedOut[1] + crosstalkR * crosstalkGain;
|
||||
output[2] = fusedOut[2] + crosstalkS * crosstalkGain;
|
||||
|
||||
*(input[0]++) = (s32)(output[0] * fx->outGain);
|
||||
*(input[1]++) = (s32)(output[1] * fx->outGain);
|
||||
*(input[2]++) = (s32)(output[2] * fx->outGain);
|
||||
|
||||
if (fx->busOut != NULL) {
|
||||
*(outBusData[0]++) = (s32)(output[0] * fx->sendGain);
|
||||
*(outBusData[1]++) = (s32)(output[1] * fx->sendGain);
|
||||
*(outBusData[2]++) = (s32)(output[2] * fx->sendGain);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (++fx->earlyPos[i] >= fx->earlyLength) {
|
||||
fx->earlyPos[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (fx->preDelayLength != 0) {
|
||||
if (++fx->preDelayPos >= fx->preDelayLength) {
|
||||
fx->preDelayPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (++fx->combPos[i] >= fx->combLength[i]) {
|
||||
fx->combPos[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (++fx->allpassPos[i] >= fx->allpassLength[i]) {
|
||||
fx->allpassPos[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL __AllocDelayLine(AXFX_REVERBHI_EXP* fx) {
|
||||
u32 ch, i;
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
fx->earlyLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * fx->earlyMaxLength);
|
||||
if (fx->earlyLine[ch] == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (fx->preDelayMaxLength != 0) {
|
||||
fx->preDelayLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * fx->preDelayMaxLength);
|
||||
if (fx->preDelayLine[ch] == NULL)
|
||||
return FALSE;
|
||||
} else {
|
||||
fx->preDelayLine[ch] = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
fx->combLine[ch][i] = (f32*)__AXFXAlloc(sizeof(f32) * fx->combMaxLength[i]);
|
||||
if (fx->combLine[ch][i] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
fx->allpassLine[ch][i] = (f32*)__AXFXAlloc(sizeof(f32) * fx->allpassMaxLength[i]);
|
||||
if (fx->allpassLine[ch][i] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fx->lastAllpassLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * fx->lastAllpassMaxLength[ch]);
|
||||
if (fx->lastAllpassLine[ch] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void __BzeroDelayLines(AXFX_REVERBHI_EXP* fx) {
|
||||
u32 ch, i;
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
if (fx->earlyLine[ch] != NULL) {
|
||||
memset(fx->earlyLine[ch], 0, sizeof(f32) * fx->earlyMaxLength);
|
||||
}
|
||||
|
||||
if (fx->preDelayLine[ch] != NULL) {
|
||||
memset(fx->preDelayLine[ch], 0, sizeof(f32) * fx->preDelayMaxLength);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (fx->combLine[ch][i] != NULL) {
|
||||
memset(fx->combLine[ch][i], 0, sizeof(f32) * fx->combMaxLength[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (fx->allpassLine[ch][i] != NULL) {
|
||||
memset(fx->allpassLine[ch][i], 0, sizeof(f32) * fx->allpassMaxLength[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (fx->lastAllpassLine[ch] != NULL) {
|
||||
memset(fx->lastAllpassLine[ch], 0, sizeof(f32) * fx->lastAllpassMaxLength[ch]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void __FreeDelayLine(AXFX_REVERBHI_EXP* fx) {
|
||||
u32 ch, i;
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
if (fx->earlyLine[ch] != NULL) {
|
||||
__AXFXFree(fx->earlyLine[ch]);
|
||||
fx->earlyLine[ch] = NULL;
|
||||
}
|
||||
|
||||
if (fx->preDelayLine[ch] != NULL) {
|
||||
__AXFXFree(fx->preDelayLine[ch]);
|
||||
fx->preDelayLine[ch] = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (fx->combLine[ch][i] != NULL) {
|
||||
__AXFXFree(fx->combLine[ch][i]);
|
||||
fx->combLine[ch][i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (fx->allpassLine[ch][i] != NULL) {
|
||||
__AXFXFree(fx->allpassLine[ch][i]);
|
||||
fx->allpassLine[ch][i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (fx->lastAllpassLine[ch] != NULL) {
|
||||
__AXFXFree(fx->lastAllpassLine[ch]);
|
||||
fx->lastAllpassLine[ch] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DECOMP_FORCE_LITERAL(AXFXReverbHiExp_c, -3.0f, 10.0);
|
||||
|
||||
static BOOL __InitParams(AXFX_REVERBHI_EXP* reverb) {
|
||||
u32 ch, i;
|
||||
|
||||
if (reverb->earlyMode >= 8)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->preDelayTime < 0.0f || reverb->preDelayTime > reverb->preDelayTimeMax)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->fusedMode >= 6)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->fusedTime < 0.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->coloration < 0.0f || reverb->coloration > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->damping < 0.0f || reverb->damping > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->crosstalk < 0.0f || reverb->crosstalk > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->earlyGain < 0.0f || reverb->earlyGain > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->fusedGain < 0.0f || reverb->fusedGain > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->outGain < 0.0f || reverb->outGain > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
if (reverb->sendGain < 0.0f || reverb->sendGain > 1.0f)
|
||||
return FALSE;
|
||||
|
||||
reverb->earlyLength = __EarlySizeTable[reverb->earlyMode][2];
|
||||
for (i = 0; i < 3; i++) {
|
||||
reverb->earlyPos[i] = reverb->earlyLength - __EarlySizeTable[reverb->earlyMode][i];
|
||||
reverb->earlyCoef[i] = __EarlyCoefTable[reverb->earlyMode][i] * reverb->earlyGain * 0.6f;
|
||||
}
|
||||
|
||||
reverb->preDelayPos = 0;
|
||||
reverb->preDelayLength = (u32)(reverb->preDelayTime * (f32)32000);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
reverb->combPos[i] = 0;
|
||||
reverb->combLength[i] = __FilterSizeTable[reverb->fusedMode][i];
|
||||
reverb->combCoef[i] = pow(10.0f, (-3.0f * (f32)(reverb->combLength[i]) / (f32)(reverb->fusedTime * 32000)));
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
reverb->allpassPos[i] = 0;
|
||||
reverb->allpassLength[i] = __FilterSizeTable[reverb->fusedMode][3 + i];
|
||||
}
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
reverb->lastAllpassPos[ch] = 0;
|
||||
reverb->lastAllpassLength[ch] = __FilterSizeTable[reverb->fusedMode][5 + ch];
|
||||
}
|
||||
|
||||
reverb->allpassCoef = reverb->coloration;
|
||||
reverb->lpfCoef = 1.0f - reverb->damping;
|
||||
if (reverb->lpfCoef > 0.95f)
|
||||
reverb->lpfCoef = 0.95f;
|
||||
|
||||
for (ch = 0; ch < 3; ch++) {
|
||||
reverb->lastLpfOut[ch] = 0.0f;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1,35 +1,55 @@
|
||||
#include <revolution/verdefs.h>
|
||||
|
||||
#include <revolution/os.h>
|
||||
|
||||
#include <private/nand.h>
|
||||
#include <revolution/nand.h>
|
||||
|
||||
#include <private/es.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
SDKDefineVersion(CNTCACHE, "Apr 20 2010", "14:15:28");
|
||||
char lbl_81693350[0xd0] = {
|
||||
0x3c, 0x3c, 0x20, 0x52, 0x56, 0x4c, 0x5f, 0x53, 0x44, 0x4b, 0x20, 0x2d, 0x20, 0x43, 0x4e, 0x54,
|
||||
0x43, 0x41, 0x43, 0x48, 0x45, 0x20, 0x09, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x20, 0x62,
|
||||
0x75, 0x69, 0x6c, 0x64, 0x3a, 0x20, 0x41, 0x70, 0x72, 0x20, 0x32, 0x30, 0x20, 0x32, 0x30, 0x31,
|
||||
0x30, 0x20, 0x31, 0x34, 0x3a, 0x31, 0x35, 0x3a, 0x32, 0x38, 0x20, 0x28, 0x30, 0x78, 0x34, 0x31,
|
||||
0x39, 0x39, 0x5f, 0x36, 0x30, 0x38, 0x33, 0x31, 0x29, 0x20, 0x3e, 0x3e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x32, 0x2f, 0x63, 0x6e, 0x74, 0x63, 0x61, 0x63, 0x68,
|
||||
0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69,
|
||||
0x74, 0x6c, 0x65, 0x20, 0x00, 0x00, 0x00, 0x00, 0x25, 0x30, 0x31, 0x36, 0x6c, 0x6c, 0x78, 0x20,
|
||||
0x00, 0x00, 0x00, 0x00, 0x2f, 0x74, 0x6d, 0x70, 0x2f, 0x63, 0x6e, 0x74, 0x63, 0x61, 0x63, 0x68,
|
||||
0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x00, 0x00, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x32,
|
||||
0x00, 0x00, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x20, 0x00, 0x00, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x00,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00
|
||||
};
|
||||
char lbl_81693420[0x16] = {
|
||||
0x2f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x2f, 0x25, 0x30, 0x38, 0x78, 0x2f, 0x25, 0x30, 0x38, 0x78,
|
||||
0x2f, 0x64, 0x61, 0x74, 0x61, 0x00,
|
||||
};
|
||||
const char* __CNTCACHEVersion = lbl_81693350;
|
||||
char lbl_816985DC[3] = {0x20, 0x0a, 0x00};
|
||||
|
||||
extern void _savegpr_23();
|
||||
extern void _restgpr_23();
|
||||
extern void _savegpr_26();
|
||||
extern void _restgpr_26();
|
||||
|
||||
OSMutex _CNTCACHEMutex;
|
||||
|
||||
int _CNTCACHEUnused816997A8;
|
||||
long long _CNTCACHEUnused816997A8;
|
||||
int _CNTCACHEUnused816997A4;
|
||||
|
||||
BOOL _CNTCACHEInitialized;
|
||||
|
||||
void CNTCACHEClear();
|
||||
BOOL _CNTCACHEIsTitleRemovable(ESTitleId titleId);
|
||||
void _CNTCACHEDeleteTitle();
|
||||
void _CNTCACHEDeleteContent();
|
||||
|
||||
|
||||
void CNTCACHEInit(int unk0, int unk1) {
|
||||
if (_CNTCACHEInitialized == FALSE) {
|
||||
BOOL old;
|
||||
|
||||
OSRegisterVersion(GetVersion(CNTCACHE));
|
||||
OSRegisterVersion(__CNTCACHEVersion);
|
||||
|
||||
OSInitMutex(&_CNTCACHEMutex);
|
||||
ES_InitLib();
|
||||
@@ -41,87 +61,492 @@ void CNTCACHEInit(int unk0, int unk1) {
|
||||
CNTCACHEClear();
|
||||
|
||||
_CNTCACHEUnused816997A4 = unk0;
|
||||
_CNTCACHEUnused816997A8 = unk1;
|
||||
*((int*)&_CNTCACHEUnused816997A8) = unk1;
|
||||
}
|
||||
asm void CNTCACHEClear() {
|
||||
clrlwi r11, r1, 0x1b
|
||||
mr r12, r1
|
||||
subfic r11, r11, -0x500
|
||||
stwux r1, r1, r11
|
||||
mflr r0
|
||||
mr r11, r12
|
||||
stw r0, 4(r12)
|
||||
bl _savegpr_23
|
||||
lis r30, lbl_81693350@ha
|
||||
lis r3, _CNTCACHEMutex@ha
|
||||
addi r30, r30, lbl_81693350@l
|
||||
li r29, 0
|
||||
addi r3, r3, _CNTCACHEMutex@l
|
||||
bl OSLockMutex
|
||||
addi r3, r30, 0x50
|
||||
addi r4, r1, 0x24
|
||||
li r27, 1
|
||||
li r5, 3
|
||||
bl NANDPrivateOpen
|
||||
cmpwi r3, -0xc
|
||||
mr r28, r3
|
||||
bne L_d4
|
||||
li r28, 0
|
||||
b L_28c
|
||||
L_d4:
|
||||
cmpwi r3, 0
|
||||
beq L_e0
|
||||
b L_268
|
||||
L_e0:
|
||||
addi r3, r1, 0x24
|
||||
addi r4, r1, 0x20
|
||||
bl NANDGetLength
|
||||
cmpwi r3, 0
|
||||
mr r28, r3
|
||||
beq L_fc
|
||||
b L_268
|
||||
L_fc:
|
||||
li r26, 0
|
||||
li r31, 0
|
||||
b L_25c
|
||||
L_108:
|
||||
lwz r25, 0x20(r1)
|
||||
cmplwi r25, 0x400
|
||||
ble L_118
|
||||
li r25, 0x400
|
||||
L_118:
|
||||
addi r24, r1, 0xc0
|
||||
addi r0, r25, 0x1f
|
||||
addi r3, r1, 0x24
|
||||
mr r4, r24
|
||||
rlwinm r5, r0, 0, 0, 0x1a
|
||||
bl NANDRead
|
||||
cmpw r3, r25
|
||||
beq L_140
|
||||
li r28, -0x14b3
|
||||
b L_268
|
||||
L_140:
|
||||
mr r4, r24
|
||||
li r28, 0
|
||||
mtctr r25
|
||||
cmplwi r25, 0
|
||||
ble L_16c
|
||||
L_154:
|
||||
lbz r0, 0(r4)
|
||||
cmpwi r0, 0xa
|
||||
bne L_164
|
||||
b L_170
|
||||
L_164:
|
||||
addi r4, r4, 1
|
||||
bdnz L_154
|
||||
L_16c:
|
||||
li r4, 0
|
||||
L_170:
|
||||
cmpwi r4, 0
|
||||
bne L_224
|
||||
li r28, 0
|
||||
b L_268
|
||||
b L_224
|
||||
L_184:
|
||||
stb r31, 0(r4)
|
||||
subf r23, r24, r4
|
||||
mr r3, r24
|
||||
la r4, lbl_816985DC
|
||||
bl strtok
|
||||
cmpwi r3, 0
|
||||
mr r29, r3
|
||||
beq L_1d4
|
||||
addi r4, r30, 0xb4
|
||||
bl strcmp
|
||||
cmpwi r3, 0
|
||||
bne L_1bc
|
||||
bl _CNTCACHEDeleteTitle
|
||||
b L_1d4
|
||||
L_1bc:
|
||||
mr r3, r29
|
||||
addi r4, r30, 0xc0
|
||||
bl strcmp
|
||||
cmpwi r3, 0
|
||||
bne L_1d4
|
||||
bl _CNTCACHEDeleteContent
|
||||
L_1d4:
|
||||
lwz r0, 0x20(r1)
|
||||
addi r23, r23, 1
|
||||
add r24, r24, r23
|
||||
subf r0, r23, r0
|
||||
subf r25, r23, r25
|
||||
mr r4, r24
|
||||
stw r0, 0x20(r1)
|
||||
add r26, r26, r23
|
||||
mtctr r25
|
||||
cmplwi r25, 0
|
||||
ble L_218
|
||||
L_200:
|
||||
lbz r0, 0(r4)
|
||||
cmpwi r0, 0xa
|
||||
bne L_210
|
||||
b L_21c
|
||||
L_210:
|
||||
addi r4, r4, 1
|
||||
bdnz L_200
|
||||
L_218:
|
||||
li r4, 0
|
||||
L_21c:
|
||||
cmpwi r4, 0
|
||||
beq L_22c
|
||||
L_224:
|
||||
cmpwi r25, 0
|
||||
bgt L_184
|
||||
L_22c:
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
beq L_25c
|
||||
mr r4, r26
|
||||
addi r3, r1, 0x24
|
||||
li r5, 0
|
||||
bl NANDSeek
|
||||
cmplw r3, r26
|
||||
beq L_258
|
||||
li r28, -0x14b3
|
||||
b L_268
|
||||
L_258:
|
||||
li r28, 0
|
||||
L_25c:
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_108
|
||||
L_268:
|
||||
addi r3, r1, 0x24
|
||||
bl NANDClose
|
||||
addi r3, r30, 0x50
|
||||
li r29, 0
|
||||
bl NANDPrivateDelete
|
||||
cmpwi r3, 0
|
||||
addi r3, r30, 0x84
|
||||
bl NANDPrivateDelete
|
||||
cmpwi r3, 0
|
||||
L_28c:
|
||||
cmpwi r29, 0
|
||||
beq L_29c
|
||||
addi r3, r1, 0x24
|
||||
bl NANDClose
|
||||
L_29c:
|
||||
cmpwi r27, 0
|
||||
beq L_2b0
|
||||
lis r3, _CNTCACHEMutex@ha
|
||||
addi r3, r3, _CNTCACHEMutex@l
|
||||
bl OSUnlockMutex
|
||||
L_2b0:
|
||||
mr r3, r28
|
||||
lwz r10, 0(r1)
|
||||
mr r11, r10
|
||||
bl _restgpr_23
|
||||
lwz r0, 4(r10)
|
||||
mtlr r0
|
||||
mr r1, r10
|
||||
blr
|
||||
}
|
||||
|
||||
void _CNTCACHEDeleteTitle() {
|
||||
char* tok = strtok(NULL, " \n");
|
||||
while (tok != NULL) {
|
||||
ESTitleId titleId;
|
||||
|
||||
errno = 0;
|
||||
titleId = strtoull(tok, NULL, 16);
|
||||
|
||||
if (errno == 0 && NANDTitleIdHi(titleId) != 0x00000001) {
|
||||
BOOL result = _CNTCACHEIsTitleRemovable(titleId);
|
||||
if (result == TRUE) {
|
||||
ES_DeleteTitle(titleId);
|
||||
} else if (result == FALSE) {
|
||||
ES_DeleteTitleContent(titleId);
|
||||
}
|
||||
}
|
||||
tok = strtok(NULL, " \n");
|
||||
}
|
||||
asm void _CNTCACHEDeleteTitle() {
|
||||
stwu r1, -0x20(r1)
|
||||
mflr r0
|
||||
li r3, 0
|
||||
la r4, lbl_816985DC
|
||||
stw r0, 0x24(r1)
|
||||
stw r31, 0x1c(r1)
|
||||
stw r30, 0x18(r1)
|
||||
stw r29, 0x14(r1)
|
||||
stw r28, 0x10(r1)
|
||||
bl strtok
|
||||
li r30, 0
|
||||
li r31, -1
|
||||
b L_370
|
||||
L_304:
|
||||
stw r30, errno(r0)
|
||||
li r4, 0
|
||||
li r5, 0x10
|
||||
bl strtoull
|
||||
lwz r0, errno(r0)
|
||||
mr r28, r4
|
||||
mr r29, r3
|
||||
cmpwi r0, 0
|
||||
bne L_364
|
||||
and r0, r3, r31
|
||||
cmplwi r0, 1
|
||||
beq L_364
|
||||
bl _CNTCACHEIsTitleRemovable
|
||||
cmpwi r3, 1
|
||||
bne L_350
|
||||
mr r4, r28
|
||||
mr r3, r29
|
||||
bl ES_DeleteTitle
|
||||
b L_364
|
||||
L_350:
|
||||
cmpwi r3, 0
|
||||
bne L_364
|
||||
mr r4, r28
|
||||
mr r3, r29
|
||||
bl ES_DeleteTitleContent
|
||||
L_364:
|
||||
li r3, 0
|
||||
la r4, lbl_816985DC
|
||||
bl strtok
|
||||
L_370:
|
||||
cmpwi r3, 0
|
||||
bne L_304
|
||||
lwz r0, 0x24(r1)
|
||||
lwz r31, 0x1c(r1)
|
||||
lwz r30, 0x18(r1)
|
||||
lwz r29, 0x14(r1)
|
||||
lwz r28, 0x10(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x20
|
||||
blr
|
||||
}
|
||||
|
||||
static int GetSavePath(ESTitleId titleId) {
|
||||
char nandPath[64] ALIGN32;
|
||||
|
||||
s32 ret;
|
||||
u32 usedBlocks = 1;
|
||||
u32 usedINodes = 1;
|
||||
|
||||
snprintf(nandPath, (int)sizeof(nandPath), "/title/%08x/%08x/data", NANDTitleIdHi(titleId), NANDTitleIdLo(titleId));
|
||||
ret = NANDSecretGetUsage(nandPath, &usedBlocks, &usedINodes);
|
||||
|
||||
if (ret == NAND_RESULT_NOEXISTS) {
|
||||
ret = 2;
|
||||
} else if (ret >= NAND_RESULT_OK) {
|
||||
if (usedINodes == 1 && usedBlocks == 0) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
asm int _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
|
||||
clrlwi r11, r1, 0x1b
|
||||
mr r12, r1
|
||||
subfic r11, r11, -0x2100
|
||||
stwux r1, r1, r11
|
||||
mflr r0
|
||||
lis r5, lbl_81693420@ha
|
||||
stw r0, 4(r12)
|
||||
li r0, 1
|
||||
addi r5, r5, lbl_81693420@l
|
||||
stw r31, -4(r12)
|
||||
stw r30, -8(r12)
|
||||
mr r30, r3
|
||||
addi r3, r1, 0x40
|
||||
stw r29, -0xc(r12)
|
||||
mr r29, r4
|
||||
li r4, -1
|
||||
stw r0, 0x20(r1)
|
||||
and r6, r30, r4
|
||||
and r7, r29, r4
|
||||
li r4, 0x40
|
||||
stw r0, 0x24(r1)
|
||||
crclr 4*cr1+eq
|
||||
bl snprintf
|
||||
addi r3, r1, 0x40
|
||||
addi r4, r1, 0x20
|
||||
addi r5, r1, 0x24
|
||||
bl NANDSecretGetUsage
|
||||
cmpwi r3, -0xc
|
||||
mr r4, r3
|
||||
bne L_418
|
||||
li r4, 2
|
||||
b L_444
|
||||
L_418:
|
||||
cmpwi r3, 0
|
||||
blt L_444
|
||||
lwz r0, 0x24(r1)
|
||||
cmplwi r0, 1
|
||||
bne L_440
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_440
|
||||
li r4, 1
|
||||
b L_444
|
||||
L_440:
|
||||
li r4, 0
|
||||
L_444:
|
||||
cmpwi r4, 1
|
||||
bne L_4bc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
addi r31, r1, 0x80
|
||||
addi r6, r1, 0x28
|
||||
li r5, 0
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
beq L_470
|
||||
b L_4c0
|
||||
L_470:
|
||||
lwz r0, 0x28(r1)
|
||||
cmplwi r0, 0x2060
|
||||
ble L_484
|
||||
li r3, -0x400
|
||||
b L_4c0
|
||||
L_484:
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
mr r5, r31
|
||||
addi r6, r1, 0x28
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
beq L_4a4
|
||||
b L_4c0
|
||||
L_4a4:
|
||||
lhz r0, 0xd8(r1)
|
||||
rlwinm. r0, r0, 0x18, 0x18, 0x1f
|
||||
bne L_4b8
|
||||
li r4, 1
|
||||
b L_4bc
|
||||
L_4b8:
|
||||
li r4, 0
|
||||
L_4bc:
|
||||
mr r3, r4
|
||||
L_4c0:
|
||||
lwz r10, 0(r1)
|
||||
lwz r0, 4(r10)
|
||||
lwz r31, -4(r10)
|
||||
lwz r30, -8(r10)
|
||||
lwz r29, -0xc(r10)
|
||||
mtlr r0
|
||||
mr r1, r10
|
||||
blr
|
||||
}
|
||||
|
||||
static int GetTmdView(ESTitleId titleId, ESTmdView* tmdView) {
|
||||
s32 ret;
|
||||
u32* tmdSize = NULL;
|
||||
|
||||
ret = ES_GetTmdView(titleId, NULL, tmdSize);
|
||||
if (ret != ES_ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
if (*tmdSize > OSRoundUp32B(sizeof(ESTmdView))) {
|
||||
ret = -1024;
|
||||
goto out;
|
||||
}
|
||||
ret = ES_GetTmdView(titleId, tmdView, tmdSize);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int _CNTCACHEIsTitleRemovable(ESTitleId titleId) {
|
||||
ESTmdView tmd ALIGN32;
|
||||
s32 ret = -1;
|
||||
|
||||
ret = GetSavePath(titleId);
|
||||
if (ret == 1) {
|
||||
ret = GetTmdView(titleId, &tmd);
|
||||
if (ret != ES_ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (tmd.head.titleVersion >> 8 == 0) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
asm void _CNTCACHEDeleteContent() {
|
||||
clrlwi r11, r1, 0x1b
|
||||
mr r12, r1
|
||||
subfic r11, r11, -0x2100
|
||||
stwux r1, r1, r11
|
||||
mflr r0
|
||||
mr r11, r12
|
||||
stw r0, 4(r12)
|
||||
bl _savegpr_26
|
||||
li r3, 0
|
||||
la r4, lbl_816985DC
|
||||
bl strtok
|
||||
li r31, 0
|
||||
li r4, 0
|
||||
stw r31, errno(r0)
|
||||
li r5, 0x10
|
||||
bl strtoull
|
||||
lwz r0, errno(r0)
|
||||
mr r29, r4
|
||||
mr r30, r3
|
||||
cmpwi r0, 0
|
||||
bne L_708
|
||||
li r0, -1
|
||||
and r5, r3, r0
|
||||
addis r0, r5, -1
|
||||
cmplwi r0, 5
|
||||
bne L_708
|
||||
addi r28, r1, 0x80
|
||||
addi r6, r1, 0x28
|
||||
li r5, 0
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, -0x6a
|
||||
beq L_708
|
||||
cmpwi r3, 0
|
||||
bne L_708
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
mr r5, r28
|
||||
addi r6, r1, 0x28
|
||||
bl ES_GetTmdView
|
||||
cmpwi r3, 0
|
||||
bne L_708
|
||||
lwz r3, 0x94(r1)
|
||||
rlwinm. r0, r3, 0, 0x1c, 0x1c
|
||||
beq L_6f0
|
||||
rlwinm. r0, r3, 0, 0x1b, 0x1b
|
||||
beq L_6f0
|
||||
li r3, 0
|
||||
la r4, lbl_816985DC
|
||||
bl strtok
|
||||
li r26, 1
|
||||
lis r27, lbl_81693420@ha
|
||||
b L_6e8
|
||||
L_5b0:
|
||||
stw r31, errno(r0)
|
||||
li r4, 0
|
||||
li r5, 0xa
|
||||
bl strtoul
|
||||
lwz r0, errno(r0)
|
||||
cmpwi r0, 0
|
||||
bne L_6dc
|
||||
cmplwi r3, 0x1fe
|
||||
bgt L_6dc
|
||||
lhz r0, 0xda(r1)
|
||||
li r4, 0
|
||||
mtctr r0
|
||||
cmplwi r0, 0
|
||||
ble L_6dc
|
||||
L_5e8:
|
||||
add r5, r28, r4
|
||||
lhz r0, 0x60(r5)
|
||||
cmplw r3, r0
|
||||
bne L_6d4
|
||||
lhz r0, 0x62(r5)
|
||||
rlwinm. r0, r0, 0, 0x10, 0x10
|
||||
bne L_6dc
|
||||
lwz r5, 0x5c(r5)
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
bl ES_DeleteContent
|
||||
cmpwi r3, 0
|
||||
bne L_6dc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
addi r6, r1, 0x2c
|
||||
li r5, 0
|
||||
bl ES_ListTitleContentsOnCard
|
||||
cmpwi r3, 0
|
||||
bne L_6dc
|
||||
lwz r0, 0x2c(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_6dc
|
||||
li r0, -1
|
||||
stw r26, 0x20(r1)
|
||||
addi r3, r1, 0x40
|
||||
addi r5, r27, lbl_81693420@l
|
||||
stw r26, 0x24(r1)
|
||||
and r6, r30, r0
|
||||
and r7, r29, r0
|
||||
li r4, 0x40
|
||||
crclr 4*cr1+eq
|
||||
bl snprintf
|
||||
addi r3, r1, 0x40
|
||||
addi r4, r1, 0x20
|
||||
addi r5, r1, 0x24
|
||||
bl NANDSecretGetUsage
|
||||
cmpwi r3, -0xc
|
||||
mr r0, r3
|
||||
bne L_690
|
||||
li r0, 2
|
||||
b L_6bc
|
||||
L_690:
|
||||
cmpwi r3, 0
|
||||
blt L_6bc
|
||||
lwz r0, 0x24(r1)
|
||||
cmplwi r0, 1
|
||||
bne L_6b8
|
||||
lwz r0, 0x20(r1)
|
||||
cmpwi r0, 0
|
||||
bne L_6b8
|
||||
li r0, 1
|
||||
b L_6bc
|
||||
L_6b8:
|
||||
li r0, 0
|
||||
L_6bc:
|
||||
cmpwi r0, 1
|
||||
bne L_6dc
|
||||
mr r4, r29
|
||||
mr r3, r30
|
||||
bl ES_DeleteTitle
|
||||
b L_6dc
|
||||
L_6d4:
|
||||
addi r4, r4, 0x10
|
||||
bdnz L_5e8
|
||||
L_6dc:
|
||||
li r3, 0
|
||||
la r4, lbl_816985DC
|
||||
bl strtok
|
||||
L_6e8:
|
||||
cmpwi r3, 0
|
||||
bne L_5b0
|
||||
L_6f0:
|
||||
lwz r5, 0x28(r1)
|
||||
addi r3, r1, 0x80
|
||||
li r4, 0
|
||||
addi r0, r5, 0x1f
|
||||
rlwinm r5, r0, 0, 0, 0x1a
|
||||
bl memset
|
||||
L_708:
|
||||
lwz r10, 0(r1)
|
||||
mr r11, r10
|
||||
bl _restgpr_26
|
||||
lwz r0, 4(r10)
|
||||
mtlr r0
|
||||
mr r1, r10
|
||||
blr
|
||||
}
|
||||
|
||||
8
libs/RVL_SDK/src/fa/api/FAFclose.c
Normal file
8
libs/RVL_SDK/src/fa/api/FAFclose.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 pfstub_fclose(FAFILE* stream);
|
||||
|
||||
FAError FAFclose(FAFILE* stream) {
|
||||
s32 error = pfstub_fclose(stream);
|
||||
return (-error | error) >> 31;
|
||||
}
|
||||
8
libs/RVL_SDK/src/fa/api/FAFinfo.c
Normal file
8
libs/RVL_SDK/src/fa/api/FAFinfo.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 pfstub_finfo(FAFILE* stream, FAFileInfo* info);
|
||||
|
||||
FAError FAFinfo(FAFILE* stream, FAFileInfo* info) {
|
||||
s32 error = pfstub_finfo(stream, info);
|
||||
return (-error | error) >> 31;
|
||||
}
|
||||
7
libs/RVL_SDK/src/fa/api/FAFread.c
Normal file
7
libs/RVL_SDK/src/fa/api/FAFread.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern size_t pfstub_fread(void* buffer, size_t size, size_t count, FAFILE* stream);
|
||||
|
||||
size_t FAFread(void* buffer, size_t size, size_t count, FAFILE* stream) {
|
||||
return pfstub_fread(buffer, size, count, stream);
|
||||
}
|
||||
7
libs/RVL_SDK/src/fa/api/FAFwrite.c
Normal file
7
libs/RVL_SDK/src/fa/api/FAFwrite.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern size_t pfstub_fwrite(void* buffer, size_t size, size_t count, FAFILE* stream);
|
||||
|
||||
size_t FAFwrite(void* buffer, size_t size, size_t count, FAFILE* stream) {
|
||||
return pfstub_fwrite(buffer, size, count, stream);
|
||||
}
|
||||
2
libs/RVL_SDK/src/fa/api/FAInitDiskManager.c
Normal file
2
libs/RVL_SDK/src/fa/api/FAInitDiskManager.c
Normal file
@@ -0,0 +1,2 @@
|
||||
int FADiskInitializedPadding;
|
||||
int FADiskInitialized;
|
||||
10
libs/RVL_SDK/src/fa/pf_closedir.c
Normal file
10
libs/RVL_SDK/src/fa/pf_closedir.c
Normal file
@@ -0,0 +1,10 @@
|
||||
typedef int s32;
|
||||
|
||||
extern s32 PFDIR_closedir(void* dir);
|
||||
extern s32 PFAPI_convertReturnValue(s32 err);
|
||||
|
||||
s32 pf2_closedir(void* dir) {
|
||||
s32 err = PFDIR_closedir(dir);
|
||||
err = PFAPI_convertReturnValue(err);
|
||||
return err;
|
||||
}
|
||||
10
libs/RVL_SDK/src/fa/pf_errnum.c
Normal file
10
libs/RVL_SDK/src/fa/pf_errnum.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFVOL_errnum(void);
|
||||
extern s32 PFAPI_convertError(s32 error);
|
||||
|
||||
FAError pf2_errnum() {
|
||||
s32 error = PFVOL_errnum();
|
||||
error = PFAPI_convertError(error);
|
||||
return error;
|
||||
}
|
||||
7
libs/RVL_SDK/src/fa/pf_fatfs.c
Normal file
7
libs/RVL_SDK/src/fa/pf_fatfs.c
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <revolution/types.h>
|
||||
|
||||
extern s32 PFVOL_InitModule(u32 config, void* param);
|
||||
|
||||
s32 PFFATFS_initializeFATFS(u32 config, void* param) {
|
||||
return PFVOL_InitModule(config, param);
|
||||
}
|
||||
10
libs/RVL_SDK/src/fa/pf_fclose.c
Normal file
10
libs/RVL_SDK/src/fa/pf_fclose.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_fclose(FAFILE* stream);
|
||||
extern s32 PFAPI_convertReturnValue(s32 error);
|
||||
|
||||
FAError pf2_fclose(FAFILE* stream) {
|
||||
s32 error = PFFILE_fclose(stream);
|
||||
error = PFAPI_convertReturnValue(error);
|
||||
return error;
|
||||
}
|
||||
10
libs/RVL_SDK/src/fa/pf_feof.c
Normal file
10
libs/RVL_SDK/src/fa/pf_feof.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_feof(FAFILE* stream);
|
||||
extern s32 PFAPI_convertReturnValue4feof(s32 error);
|
||||
|
||||
FAError pf2_feof(FAFILE* stream) {
|
||||
s32 error = PFFILE_feof(stream);
|
||||
error = PFAPI_convertReturnValue4feof(error);
|
||||
return error;
|
||||
}
|
||||
10
libs/RVL_SDK/src/fa/pf_ferror.c
Normal file
10
libs/RVL_SDK/src/fa/pf_ferror.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_ferror(FAFILE* stream);
|
||||
extern s32 PFAPI_convertError(s32 error);
|
||||
|
||||
FAError pf2_ferror(FAFILE* stream) {
|
||||
s32 error = PFFILE_ferror(stream);
|
||||
error = PFAPI_convertError(error);
|
||||
return error;
|
||||
}
|
||||
12
libs/RVL_SDK/src/fa/pf_flock.c
Normal file
12
libs/RVL_SDK/src/fa/pf_flock.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_flock(FAFILE* stream, s32 mode);
|
||||
extern s32 PFAPI_convertReturnValue(s32 error);
|
||||
|
||||
FAError pf2_flock(FAFILE* stream, s32 mode) {
|
||||
s32 error;
|
||||
mode |= 8;
|
||||
error = PFFILE_flock(stream, mode);
|
||||
error = PFAPI_convertReturnValue(error);
|
||||
return error;
|
||||
}
|
||||
9
libs/RVL_SDK/src/fa/pf_fread.c
Normal file
9
libs/RVL_SDK/src/fa/pf_fread.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_fread(void* buffer, size_t size, size_t count, FAFILE* stream, size_t* countRead);
|
||||
|
||||
size_t pf2_fread(void* buffer, size_t size, size_t count, FAFILE* stream) {
|
||||
size_t countRead;
|
||||
PFFILE_fread(buffer, size, count, stream, &countRead);
|
||||
return countRead;
|
||||
}
|
||||
10
libs/RVL_SDK/src/fa/pf_fsync.c
Normal file
10
libs/RVL_SDK/src/fa/pf_fsync.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_fsync(FAFILE* stream);
|
||||
extern s32 PFAPI_convertReturnValue(s32 error);
|
||||
|
||||
FAError pf2_fsync(FAFILE* stream) {
|
||||
s32 error = PFFILE_fsync(stream);
|
||||
error = PFAPI_convertReturnValue(error);
|
||||
return error;
|
||||
}
|
||||
9
libs/RVL_SDK/src/fa/pf_fwrite.c
Normal file
9
libs/RVL_SDK/src/fa/pf_fwrite.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <revolution/fa.h>
|
||||
|
||||
extern s32 PFFILE_fwrite(void* buffer, size_t size, size_t count, FAFILE* stream, size_t* countWritten);
|
||||
|
||||
size_t pf2_fwrite(void* buffer, size_t size, size_t count, FAFILE* stream) {
|
||||
size_t countWritten;
|
||||
PFFILE_fwrite(buffer, size, count, stream, &countWritten);
|
||||
return countWritten;
|
||||
}
|
||||
@@ -66,6 +66,7 @@ void __OSEVStart();
|
||||
void __OSEVEnd();
|
||||
#define __OSEVSize ((u32)__OSEVEnd - (u32)__OSEVStart)
|
||||
void __OSEVSetNumber();
|
||||
void __OSDBJumpTarget();
|
||||
|
||||
void __DBVECTOR();
|
||||
|
||||
@@ -795,7 +796,7 @@ static asm void __OSDBJump() {
|
||||
#ifdef __MWERKS__
|
||||
nofralloc
|
||||
entry __OSDBJUMPSTART
|
||||
bla OS_ADDR_DB_INTEGRATOR_HOOK
|
||||
bla __OSDBJumpTarget
|
||||
entry __OSDBJUMPEND
|
||||
#endif // __MWERKS__
|
||||
// clang-format on
|
||||
@@ -831,6 +832,7 @@ entry __OSEVStart
|
||||
mflr r3
|
||||
stw r3, OSContext.lr(r4)
|
||||
mfctr r3
|
||||
entry __OSDBJumpTarget
|
||||
stw r3, OSContext.ctr(r4)
|
||||
mfxer r3
|
||||
stw r3, OSContext.xer(r4)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
char lbl_81687720[] = "<< RVL_SDK - WPAD \trelease build: Apr 20 2010 11:20:55 (0x4199_60831) >>";
|
||||
const char* __WPADVersion = lbl_81687720;
|
||||
|
||||
WPADCB _wpd[WPAD_MAX_CONTROLLERS];
|
||||
WPADStorage _wpd;
|
||||
WPADCB* _wpdcb[WPAD_MAX_CONTROLLERS];
|
||||
|
||||
u8 __WPADiManageHandlerStack[0x1000] ALIGN32;
|
||||
@@ -636,30 +636,30 @@ static asm void WPADiManageHandler(OSAlarm* pAlarm, OSContext* pContext) {
|
||||
beq WPADiManageHandler_8AC8
|
||||
cmpwi r3, 0x2
|
||||
bne WPADiManageHandler_91D8
|
||||
lwz r0, _initialized(r13)
|
||||
lwz r0, _initialized(r0)
|
||||
cmpwi r0, 0x0
|
||||
bne WPADiManageHandler_91D8
|
||||
li r0, 0x1
|
||||
lis r3, WPADiConnCallback@ha
|
||||
stw r0, _initialized(r13)
|
||||
stw r0, _initialized(r0)
|
||||
addi r3, r3, WPADiConnCallback@l
|
||||
bl WUDSetHidConnCallback
|
||||
lis r3, WPADiRecvCallback@ha
|
||||
addi r3, r3, WPADiRecvCallback@l
|
||||
bl WUDSetHidRecvCallback
|
||||
li r0, 0x32
|
||||
stw r0, _recCnt(r13)
|
||||
stw r0, _recCnt(r0)
|
||||
b WPADiManageHandler_91D8
|
||||
WPADiManageHandler_8AC8:
|
||||
lwz r4, _recCnt(r13)
|
||||
lwz r19, _recFlag(r13)
|
||||
lwz r4, _recCnt(r0)
|
||||
lwz r19, _recFlag(r0)
|
||||
cntlzw r3, r4
|
||||
subi r0, r4, 0x1
|
||||
extrwi r3, r3, 1, 26
|
||||
cmpwi r19, 0x0
|
||||
neg r3, r3
|
||||
andc r0, r0, r3
|
||||
stw r0, _recCnt(r13)
|
||||
stw r0, _recCnt(r0)
|
||||
blt WPADiManageHandler_8B28
|
||||
cmpwi r0, 0x0
|
||||
bne WPADiManageHandler_91D8
|
||||
@@ -1001,13 +1001,13 @@ WPADiManageHandler_8FC8:
|
||||
WPADiManageHandler_8FCC:
|
||||
stb r0, 0x0(r23)
|
||||
WPADiManageHandler_8FD0:
|
||||
lbz r0, _checkCnt(r13)
|
||||
lbz r0, _checkCnt(r0)
|
||||
cmplwi r0, 0x5
|
||||
bne WPADiManageHandler_8FE4
|
||||
mr r3, r22
|
||||
bl WPADiCheckContInputs
|
||||
WPADiManageHandler_8FE4:
|
||||
lhz r0, _senseCnt(r13)
|
||||
lhz r0, _senseCnt(r0)
|
||||
cmplwi r0, 0xa
|
||||
bne WPADiManageHandler_8FF8
|
||||
mr r3, r22
|
||||
@@ -1026,7 +1026,7 @@ WPADiManageHandler_900C:
|
||||
addi r24, r24, 0x4
|
||||
addi r23, r23, 0x1
|
||||
blt WPADiManageHandler_8B48
|
||||
lhz r0, _afhCnt(r13)
|
||||
lhz r0, _afhCnt(r0)
|
||||
cmplwi r0, 0xea60
|
||||
bne WPADiManageHandler_9090
|
||||
lis r21, 0x8000
|
||||
@@ -1036,31 +1036,31 @@ WPADiManageHandler_900C:
|
||||
addi r3, r28, 0x108
|
||||
crclr 4*cr1+eq
|
||||
bl DEBUGPrint
|
||||
lbz r3, _afhChannel(r13)
|
||||
lbz r3, _afhChannel(r0)
|
||||
lbz r0, 0x31a2(r21)
|
||||
extsb r3, r3
|
||||
cmpw r3, r0
|
||||
beq WPADiManageHandler_9090
|
||||
bl OSDisableInterrupts
|
||||
lbz r0, 0x31a2(r21)
|
||||
stb r0, _afhChannel(r13)
|
||||
stb r0, _afhChannel(r0)
|
||||
bl OSRestoreInterrupts
|
||||
lbz r4, 0x31a2(r21)
|
||||
addi r3, r28, 0x130
|
||||
crclr 4*cr1+eq
|
||||
bl DEBUGPrint
|
||||
lbz r0, _afhChannel(r13)
|
||||
lbz r0, _afhChannel(r0)
|
||||
extsb r3, r0
|
||||
bl WUDSetDisableChannel
|
||||
WPADiManageHandler_9090:
|
||||
lhz r6, _senseCnt(r13)
|
||||
lhz r6, _senseCnt(r0)
|
||||
lis r3, 0x1
|
||||
subi r0, r3, 0x15a0
|
||||
lbz r9, _checkCnt(r13)
|
||||
lbz r9, _checkCnt(r0)
|
||||
subi r4, r6, 0xa
|
||||
subfic r3, r6, 0xa
|
||||
nor r3, r4, r3
|
||||
lhz r10, _afhCnt(r13)
|
||||
lhz r10, _afhCnt(r0)
|
||||
srawi r8, r3, 31
|
||||
addi r7, r6, 0x1
|
||||
clrlwi r0, r0, 16
|
||||
@@ -1070,7 +1070,7 @@ WPADiManageHandler_9090:
|
||||
nor r5, r4, r3
|
||||
subf r4, r0, r10
|
||||
subf r3, r10, r0
|
||||
lbz r0, _scFlush(r13)
|
||||
lbz r0, _scFlush(r0)
|
||||
srawi r6, r5, 31
|
||||
addi r5, r9, 0x1
|
||||
nor r4, r4, r3
|
||||
@@ -1079,9 +1079,9 @@ WPADiManageHandler_9090:
|
||||
andc r5, r5, r6
|
||||
andc r3, r3, r4
|
||||
cmpwi r0, 0x0
|
||||
sth r7, _senseCnt(r13)
|
||||
stb r5, _checkCnt(r13)
|
||||
sth r3, _afhCnt(r13)
|
||||
sth r7, _senseCnt(r0)
|
||||
stb r5, _checkCnt(r0)
|
||||
sth r3, _afhCnt(r0)
|
||||
beq WPADiManageHandler_9138
|
||||
bl SCCheckStatus
|
||||
cmpwi r3, 0x0
|
||||
@@ -1094,9 +1094,9 @@ WPADiManageHandler_9090:
|
||||
li r3, 0x0
|
||||
bl SCFlushAsync
|
||||
li r0, 0x0
|
||||
stb r0, _scFlush(r13)
|
||||
stb r0, _scFlush(r0)
|
||||
WPADiManageHandler_9138:
|
||||
lbz r0, _scSetting(r13)
|
||||
lbz r0, _scSetting(r0)
|
||||
cmpwi r0, 0x0
|
||||
beq WPADiManageHandler_91D4
|
||||
bl SCCheckStatus
|
||||
@@ -1112,19 +1112,19 @@ WPADiManageHandler_9164:
|
||||
ble WPADiManageHandler_9170
|
||||
li r0, 0x5
|
||||
WPADiManageHandler_9170:
|
||||
stb r0, _dpdSensitivity(r13)
|
||||
stb r0, _dpdSensitivity(r0)
|
||||
bl SCGetWpadSensorBarPosition
|
||||
clrlwi r3, r3, 24
|
||||
subi r0, r3, 0x1
|
||||
cntlzw r0, r0
|
||||
extrwi r0, r0, 8, 19
|
||||
stb r0, _sensorBarPos(r13)
|
||||
stb r0, _sensorBarPos(r0)
|
||||
bl SCGetWpadMotorMode
|
||||
clrlwi r3, r3, 24
|
||||
subi r0, r3, 0x1
|
||||
cntlzw r0, r0
|
||||
srwi r0, r0, 5
|
||||
stw r0, _rumble(r13)
|
||||
stw r0, _rumble(r0)
|
||||
bl SCGetWpadSpeakerVolume
|
||||
clrlwi. r0, r3, 24
|
||||
mr r4, r3
|
||||
@@ -1137,8 +1137,8 @@ WPADiManageHandler_91B8:
|
||||
li r4, 0x7f
|
||||
WPADiManageHandler_91C8:
|
||||
li r0, 0x0
|
||||
stb r4, _speakerVolume(r13)
|
||||
stb r0, _scSetting(r13)
|
||||
stb r4, _speakerVolume(r0)
|
||||
stb r0, _scSetting(r0)
|
||||
WPADiManageHandler_91D4:
|
||||
bl BTA_HhGetAclQueueInfo
|
||||
WPADiManageHandler_91D8:
|
||||
@@ -1338,12 +1338,12 @@ void WPADiInitSub() {
|
||||
DEBUGPrint("WPADInit()\n");
|
||||
|
||||
for (chan = 0; chan < WPAD_MAX_CONTROLLERS; chan++) {
|
||||
_wpdcb[chan] = &_wpd[chan];
|
||||
_wpdcb[chan] = &_wpd.controllers[chan];
|
||||
_chan_active_state[chan] = FALSE;
|
||||
|
||||
_wpdcb[chan]->connectCB = NULL;
|
||||
__ClearControlBlock(chan);
|
||||
OSInitThreadQueue(&_wpd[chan].threadQueue);
|
||||
OSInitThreadQueue(&_wpd.controllers[chan].threadQueue);
|
||||
|
||||
_extCnt[chan] = 0;
|
||||
_rumbleCnt[chan] = 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ void CDBRecordKeyGetKeyStr(CDBRecordKey* recordKey, char* keyString);
|
||||
|
||||
void CDBRecordKeySetSerialNumber(CDBRecordKey* recordKey, int serialNum);
|
||||
|
||||
void CDBRecordKeyCopy(CDBRecordKey* recordKey, CDBRecordKey* newRecordKey);
|
||||
void CDBRecordKeyCopy(CDBRecordKey* recordKey, const CDBRecordKey* newRecordKey);
|
||||
|
||||
BOOL CDBRecordKeyCompare(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2);
|
||||
int CDBRecordKeyCompareByDate(CDBRecordKey* recordKey1, CDBRecordKey* recordKey2);
|
||||
|
||||
@@ -16,7 +16,7 @@ int STD_strnlen(const char* str, u32 len);
|
||||
|
||||
int Util_xtoi(char ch);
|
||||
|
||||
void* Mail_memcpy(void* dest, void* src, u32 len);
|
||||
void* Mail_memcpy(void* dest, const void* src, u32 len);
|
||||
void* Mail_memset(void* dest, int fill, u32 count);
|
||||
|
||||
int Mail_strlen(const char* str);
|
||||
|
||||
@@ -324,25 +324,37 @@ CDBErr CDBConvKeyToFullPath(CDBRecordKey* recordKey, char* fullPath) {
|
||||
}
|
||||
|
||||
void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation location, u64* wiiId) {
|
||||
char fileNameStr[8];
|
||||
char yearStr[8];
|
||||
char monthStr[8];
|
||||
char dayStr[8];
|
||||
char hourStr[8];
|
||||
char minStr[8];
|
||||
|
||||
char codeStr[8];
|
||||
char typeStr[8];
|
||||
char serialNumStr[8];
|
||||
char fileNameStr[8];
|
||||
|
||||
char typeStr[5];
|
||||
CDBDate epoch;
|
||||
int year;
|
||||
int month;
|
||||
int day;
|
||||
int hour;
|
||||
int min;
|
||||
char serialNumStr[4];
|
||||
char fileSerial[4];
|
||||
CDBDate fileEpoch;
|
||||
char fileEpochStr[40];
|
||||
|
||||
CDBConvKeyStrToEpochValue(keyString, &epoch);
|
||||
{
|
||||
union {
|
||||
char storage[20];
|
||||
struct {
|
||||
char prefix[8];
|
||||
char value[12];
|
||||
} epoch;
|
||||
} epochBuffer;
|
||||
strncpy(epochBuffer.epoch.value, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE);
|
||||
epochBuffer.epoch.value[CDB_KEYSTR_EPOCH_SIZE] = 0;
|
||||
sscanf(epochBuffer.epoch.value, "%ul", &epoch);
|
||||
}
|
||||
CDBConvEpochValueToDate(epoch, &year, &month, &day, &hour, &min, NULL);
|
||||
|
||||
CDBConvYearValueToYearStr(yearStr, year);
|
||||
@@ -354,7 +366,12 @@ void CDBConvKeyStrToFullPath_(char* keyString, char* fullPath, CDBLocation locat
|
||||
CDBConvKeyStrToCode(keyString, codeStr);
|
||||
CDBConvKeyStrToSerialNumber(keyString, serialNumStr);
|
||||
CDBConvKeyStrToType(keyString, typeStr);
|
||||
CDBConvKeyStrToFileName(keyString, fileNameStr);
|
||||
strncpy(fileEpochStr, CDBKeyStrEpoch(keyString), CDB_KEYSTR_EPOCH_SIZE);
|
||||
fileEpochStr[CDB_KEYSTR_EPOCH_SIZE] = 0;
|
||||
sscanf(fileEpochStr, "%ul", &fileEpoch);
|
||||
strncpy(fileSerial, CDBKeyStrSerialNumber(keyString), CDB_KEYSTR_SERIAL_NUMBER_SIZE);
|
||||
fileSerial[CDB_KEYSTR_SERIAL_NUMBER_SIZE] = 0;
|
||||
sprintf(fileNameStr, "%08X.%s", fileEpoch, fileSerial);
|
||||
|
||||
if (location == CDB_FS_LOCATION_NAND || location == CDB_FS_LOCATION_SD) {
|
||||
CDBConvFileNameStrToFullPath(fullPath, yearStr, monthStr, dayStr, hourStr, minStr, codeStr, typeStr, fileNameStr, location, wiiId);
|
||||
|
||||
3621
libs/RevoEX/src/cdb/CDBDatabase.c
Normal file
3621
libs/RevoEX/src/cdb/CDBDatabase.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -6,8 +6,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
extern const char lbl_816979E8[8] = "/\0\0\0\0\0\0\0";
|
||||
#pragma pop
|
||||
|
||||
void CDBFSConcatenatePath(char* path, const char* concatPath) {
|
||||
strcat(path, "/");
|
||||
strcat(path, lbl_816979E8);
|
||||
strcat(path, concatPath);
|
||||
}
|
||||
|
||||
@@ -106,6 +111,167 @@ BOOL CDBFSIsTypeDirName(char* dirName) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef __MWERKS__
|
||||
asm BOOL CDBFSIsCDBFileOnSD(register char* fileName) {
|
||||
nofralloc
|
||||
stwu r1, -0x10(r1)
|
||||
mflr r0
|
||||
li r4, 0xd
|
||||
stw r0, 0x14(r1)
|
||||
stw r31, 0xc(r1)
|
||||
mr r31, r3
|
||||
bl CDBSafeStrLen
|
||||
cmpwi r3, 0xc
|
||||
bne CDBFSIsCDBFileOnSD_invalid
|
||||
lis r4, _current_locale@ha
|
||||
li r0, 0x4
|
||||
addi r4, r4, _current_locale@l
|
||||
mr r3, r31
|
||||
lwz r6, 0x38(r4)
|
||||
li r7, 0
|
||||
mtctr r0
|
||||
CDBFSIsCDBFileOnSD_loop:
|
||||
lbz r5, 0(r3)
|
||||
li r0, 0
|
||||
extsb. r5, r5
|
||||
blt CDBFSIsCDBFileOnSD_digit1_invalid
|
||||
cmpwi r5, 0x100
|
||||
blt CDBFSIsCDBFileOnSD_digit1_check
|
||||
CDBFSIsCDBFileOnSD_digit1_invalid:
|
||||
li r0, 1
|
||||
CDBFSIsCDBFileOnSD_digit1_check:
|
||||
cmpwi r0, 0
|
||||
beq CDBFSIsCDBFileOnSD_digit1_map
|
||||
li r0, 0
|
||||
b CDBFSIsCDBFileOnSD_digit1_done
|
||||
CDBFSIsCDBFileOnSD_digit1_map:
|
||||
lwz r4, 8(r6)
|
||||
slwi r0, r5, 1
|
||||
lhzx r0, r4, r0
|
||||
rlwinm r0, r0, 0, 21, 21
|
||||
CDBFSIsCDBFileOnSD_digit1_done:
|
||||
cmpwi r0, 0
|
||||
bne CDBFSIsCDBFileOnSD_first_next
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_first_next:
|
||||
lbz r5, 1(r3)
|
||||
li r0, 0
|
||||
extsb. r5, r5
|
||||
blt CDBFSIsCDBFileOnSD_digit2_invalid
|
||||
cmpwi r5, 0x100
|
||||
blt CDBFSIsCDBFileOnSD_digit2_check
|
||||
CDBFSIsCDBFileOnSD_digit2_invalid:
|
||||
li r0, 1
|
||||
CDBFSIsCDBFileOnSD_digit2_check:
|
||||
cmpwi r0, 0
|
||||
beq CDBFSIsCDBFileOnSD_digit2_map
|
||||
li r0, 0
|
||||
b CDBFSIsCDBFileOnSD_digit2_done
|
||||
CDBFSIsCDBFileOnSD_digit2_map:
|
||||
lwz r4, 8(r6)
|
||||
slwi r0, r5, 1
|
||||
lhzx r0, r4, r0
|
||||
rlwinm r0, r0, 0, 21, 21
|
||||
CDBFSIsCDBFileOnSD_digit2_done:
|
||||
cmpwi r0, 0
|
||||
bne CDBFSIsCDBFileOnSD_pair_next
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_pair_next:
|
||||
addi r7, r7, 1
|
||||
addi r3, r3, 2
|
||||
bdnz CDBFSIsCDBFileOnSD_loop
|
||||
lbz r0, 8(r31)
|
||||
cmpwi r0, 0x2e
|
||||
beq CDBFSIsCDBFileOnSD_extension
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_extension:
|
||||
lbz r4, 9(r31)
|
||||
li r0, 0
|
||||
extsb. r4, r4
|
||||
blt CDBFSIsCDBFileOnSD_digit3_invalid
|
||||
cmpwi r4, 0x100
|
||||
blt CDBFSIsCDBFileOnSD_digit3_check
|
||||
CDBFSIsCDBFileOnSD_digit3_invalid:
|
||||
li r0, 1
|
||||
CDBFSIsCDBFileOnSD_digit3_check:
|
||||
cmpwi r0, 0
|
||||
beq CDBFSIsCDBFileOnSD_digit3_map
|
||||
li r0, 0
|
||||
b CDBFSIsCDBFileOnSD_digit3_done
|
||||
CDBFSIsCDBFileOnSD_digit3_map:
|
||||
lwz r3, 8(r6)
|
||||
slwi r0, r4, 1
|
||||
lhzx r0, r3, r0
|
||||
rlwinm r0, r0, 0, 21, 21
|
||||
CDBFSIsCDBFileOnSD_digit3_done:
|
||||
cmpwi r0, 0
|
||||
bne CDBFSIsCDBFileOnSD_digit4
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_digit4:
|
||||
lbz r4, 0xa(r31)
|
||||
li r0, 0
|
||||
extsb. r4, r4
|
||||
blt CDBFSIsCDBFileOnSD_digit4_invalid
|
||||
cmpwi r4, 0x100
|
||||
blt CDBFSIsCDBFileOnSD_digit4_check
|
||||
CDBFSIsCDBFileOnSD_digit4_invalid:
|
||||
li r0, 1
|
||||
CDBFSIsCDBFileOnSD_digit4_check:
|
||||
cmpwi r0, 0
|
||||
beq CDBFSIsCDBFileOnSD_digit4_map
|
||||
li r0, 0
|
||||
b CDBFSIsCDBFileOnSD_digit4_done
|
||||
CDBFSIsCDBFileOnSD_digit4_map:
|
||||
lwz r3, 8(r6)
|
||||
slwi r0, r4, 1
|
||||
lhzx r0, r3, r0
|
||||
rlwinm r0, r0, 0, 21, 21
|
||||
CDBFSIsCDBFileOnSD_digit4_done:
|
||||
cmpwi r0, 0
|
||||
bne CDBFSIsCDBFileOnSD_digit5
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_digit5:
|
||||
lbz r4, 0xb(r31)
|
||||
li r0, 0
|
||||
extsb. r4, r4
|
||||
blt CDBFSIsCDBFileOnSD_digit5_invalid
|
||||
cmpwi r4, 0x100
|
||||
blt CDBFSIsCDBFileOnSD_digit5_check
|
||||
CDBFSIsCDBFileOnSD_digit5_invalid:
|
||||
li r0, 1
|
||||
CDBFSIsCDBFileOnSD_digit5_check:
|
||||
cmpwi r0, 0
|
||||
beq CDBFSIsCDBFileOnSD_digit5_map
|
||||
li r0, 0
|
||||
b CDBFSIsCDBFileOnSD_digit5_done
|
||||
CDBFSIsCDBFileOnSD_digit5_map:
|
||||
lwz r3, 8(r6)
|
||||
slwi r0, r4, 1
|
||||
lhzx r0, r3, r0
|
||||
rlwinm r0, r0, 0, 21, 21
|
||||
CDBFSIsCDBFileOnSD_digit5_done:
|
||||
cmpwi r0, 0
|
||||
bne CDBFSIsCDBFileOnSD_valid
|
||||
li r3, 0
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_valid:
|
||||
li r3, 1
|
||||
b CDBFSIsCDBFileOnSD_return
|
||||
CDBFSIsCDBFileOnSD_invalid:
|
||||
li r3, 0
|
||||
CDBFSIsCDBFileOnSD_return:
|
||||
lwz r0, 0x14(r1)
|
||||
lwz r31, 0xc(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x10
|
||||
blr
|
||||
}
|
||||
#else
|
||||
BOOL CDBFSIsCDBFileOnSD(char* fileName) {
|
||||
if (CDBSafeStrLen(fileName, 12 + 1) == 12) {
|
||||
char* ptr = fileName;
|
||||
@@ -133,6 +299,7 @@ BOOL CDBFSIsCDBFileOnSD(char* fileName) {
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL CDBFSIsMCGCDirNameOnSD(char* dirName) {
|
||||
if (CDBSafeStrLen(dirName, 7 + 1) == 7) {
|
||||
|
||||
@@ -29,23 +29,25 @@ BOOL CDBRecordKeyIsValid(CDBRecordKey* recordKey) {
|
||||
}
|
||||
|
||||
void CDBRecordKeyInit(CDBRecordKey* recordKey, CDBDate epoch, int gameCode, u16 makerCode, int serialNumber, char* fileType, int unk) {
|
||||
char typeStr[8];
|
||||
char gcStr[8];
|
||||
char mcStr[8];
|
||||
struct {
|
||||
char mcStr[4];
|
||||
char typeStr[8];
|
||||
char gcStr[8];
|
||||
} strings;
|
||||
|
||||
u32 typeLength;
|
||||
|
||||
CDBConvMCValueToMCStr(makerCode, mcStr);
|
||||
CDBConvGCValueToGCStr(gameCode, gcStr);
|
||||
CDBConvMCValueToMCStr(makerCode, strings.mcStr);
|
||||
CDBConvGCValueToGCStr(gameCode, strings.gcStr);
|
||||
|
||||
recordKey->wiiId = CDBGetWiiId();
|
||||
recordKey->location = unk;
|
||||
|
||||
typeLength = strlen(typeStr);
|
||||
strcpy(typeStr, fileType);
|
||||
CDBToLower(typeStr, typeLength);
|
||||
typeLength = strlen(fileType);
|
||||
strcpy(strings.typeStr, fileType);
|
||||
CDBToLower(((char*)strings.typeStr), typeLength);
|
||||
|
||||
sprintf(recordKey->keyString, "%010u_%s_%s_%03d.%s", epoch, gcStr, mcStr, serialNumber, typeStr);
|
||||
sprintf(recordKey->keyString, "%010u_%s_%s_%03d.%s", epoch, strings.gcStr, strings.mcStr, serialNumber, strings.typeStr);
|
||||
}
|
||||
|
||||
void CDBRecordKeySetSerialNumber(CDBRecordKey* recordKey, int serialNum) {
|
||||
@@ -72,9 +74,8 @@ void CDBRecordKeyInitFromFileName2(CDBRecordKey* recordKey, char* keyString, cha
|
||||
recordKey->location = CDB_FS_LOCATION_SD;
|
||||
}
|
||||
|
||||
void CDBRecordKeyCopy(CDBRecordKey* recordKey, CDBRecordKey* newRecordKey) {
|
||||
void CDBRecordKeyCopy(CDBRecordKey* recordKey, const CDBRecordKey* newRecordKey) {
|
||||
strcpy(recordKey->keyString, newRecordKey->keyString);
|
||||
|
||||
recordKey->wiiId = newRecordKey->wiiId;
|
||||
recordKey->location = newRecordKey->location;
|
||||
}
|
||||
@@ -136,6 +137,156 @@ CDBRecordKey* CDBRecordKeyArrayEnd(CDBRecordKeyArray* recordArray) {
|
||||
return recordArray->records + recordArray->size;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
|
||||
int CDBRecordKeyArrayDicInsertR(CDBRecordKeyArray* recordArray, CDBRecordKey* recordKey, int first, int last) {
|
||||
int index;
|
||||
int result;
|
||||
|
||||
if (first == last || first == last - 1) {
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + first);
|
||||
if (result < 0) {
|
||||
return first;
|
||||
}
|
||||
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + last);
|
||||
if (result >= 0) {
|
||||
last++;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
index = first + (last - first) / 2;
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + index);
|
||||
if (result < 0) {
|
||||
return CDBRecordKeyArrayDicInsertR(recordArray, recordKey, first, index);
|
||||
}
|
||||
if (result > 0) {
|
||||
return CDBRecordKeyArrayDicInsertR(recordArray, recordKey, index, last);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
CDBRecordKey* CDBRecordKeyArrayDicInsert(CDBRecordKeyArray* recordArray, CDBRecordKey* recordKey) {
|
||||
int size = recordArray->size;
|
||||
int index;
|
||||
int moveCount;
|
||||
CDBRecordKey* record;
|
||||
|
||||
if (size == 0) {
|
||||
if (size < recordArray->capacity) {
|
||||
record = recordArray->records + size;
|
||||
CDBRecordKeyCopy(record, recordKey);
|
||||
recordArray->size++;
|
||||
}
|
||||
return recordKey;
|
||||
}
|
||||
|
||||
if (recordArray->capacity <= size) {
|
||||
if (recordArray->reverse == 1) {
|
||||
if (size != 0) {
|
||||
record = recordArray->records + (size - 1);
|
||||
} else {
|
||||
record = recordArray->records;
|
||||
}
|
||||
if (CDBRecordKeyCompare(record, recordKey) < 0) {
|
||||
return record;
|
||||
}
|
||||
|
||||
recordArray->size--;
|
||||
index = CDBRecordKeyArrayDicInsertR(recordArray, recordKey, 0, recordArray->size - 1);
|
||||
moveCount = (recordArray->size - index) * sizeof(CDBRecordKey);
|
||||
if (recordArray->capacity <= recordArray->size) {
|
||||
moveCount -= sizeof(CDBRecordKey);
|
||||
}
|
||||
if (moveCount > 0) {
|
||||
memmove((CDBRecordKey*)((char*)recordArray->records + (index + 1) * sizeof(CDBRecordKey)),
|
||||
(CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)),
|
||||
moveCount);
|
||||
}
|
||||
CDBRecordKeyCopy((CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)), recordKey);
|
||||
if (recordArray->size < recordArray->capacity) {
|
||||
recordArray->size++;
|
||||
}
|
||||
return (CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey));
|
||||
}
|
||||
|
||||
record = recordArray->records;
|
||||
if (CDBRecordKeyCompare(recordKey, record) < 0) {
|
||||
return record;
|
||||
}
|
||||
|
||||
recordArray->size--;
|
||||
if (recordArray->size >= 0 && recordArray->capacity - 1 >= 0) {
|
||||
memmove(recordArray->records, recordArray->records + 1, recordArray->size * sizeof(CDBRecordKey));
|
||||
}
|
||||
index = CDBRecordKeyArrayDicInsertR(recordArray, recordKey, 0, recordArray->size - 1);
|
||||
moveCount = (recordArray->size - index) * sizeof(CDBRecordKey);
|
||||
if (recordArray->capacity <= recordArray->size) {
|
||||
moveCount -= sizeof(CDBRecordKey);
|
||||
}
|
||||
if (moveCount > 0) {
|
||||
memmove((CDBRecordKey*)((char*)recordArray->records + (index + 1) * sizeof(CDBRecordKey)),
|
||||
(CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)),
|
||||
moveCount);
|
||||
}
|
||||
CDBRecordKeyCopy((CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)), recordKey);
|
||||
if (recordArray->size < recordArray->capacity) {
|
||||
recordArray->size++;
|
||||
}
|
||||
return (CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey));
|
||||
}
|
||||
|
||||
index = CDBRecordKeyArrayDicInsertR(recordArray, recordKey, 0, size - 1);
|
||||
moveCount = (recordArray->size - index) * sizeof(CDBRecordKey);
|
||||
if (recordArray->capacity <= recordArray->size) {
|
||||
moveCount -= sizeof(CDBRecordKey);
|
||||
}
|
||||
if (moveCount > 0) {
|
||||
memmove((CDBRecordKey*)((char*)recordArray->records + (index + 1) * sizeof(CDBRecordKey)),
|
||||
(CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)),
|
||||
moveCount);
|
||||
}
|
||||
CDBRecordKeyCopy((CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey)), recordKey);
|
||||
if (recordArray->size < recordArray->capacity) {
|
||||
recordArray->size++;
|
||||
}
|
||||
return (CDBRecordKey*)((char*)recordArray->records + index * sizeof(CDBRecordKey));
|
||||
}
|
||||
|
||||
int CDBRecordKeyArrayDicFindR(CDBRecordKeyArray* recordArray, CDBRecordKey* recordKey, int first, int last) {
|
||||
int index;
|
||||
int result;
|
||||
|
||||
if (first == last || first == last - 1) {
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + first);
|
||||
if (result == 0) {
|
||||
return first;
|
||||
}
|
||||
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + last);
|
||||
if (result != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return last;
|
||||
}
|
||||
|
||||
index = first + (last - first) / 2;
|
||||
result = CDBRecordKeyCompare(recordKey, recordArray->records + index);
|
||||
if (result < 0) {
|
||||
return CDBRecordKeyArrayDicFindR(recordArray, recordKey, first, index);
|
||||
}
|
||||
if (result > 0) {
|
||||
return CDBRecordKeyArrayDicFindR(recordArray, recordKey, index, last);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
|
||||
CDBRecordKey* CDBRecordKeyArrayDicFind(CDBRecordKeyArray* recordArray, CDBRecordKey* recordKey) {
|
||||
int size = recordArray->size;
|
||||
int index;
|
||||
|
||||
585
libs/RevoEX/src/ncd/ncdsystem.c
Normal file
585
libs/RevoEX/src/ncd/ncdsystem.c
Normal file
@@ -0,0 +1,585 @@
|
||||
#include <private/ipc.h>
|
||||
#include <private/ios.h>
|
||||
#include <private/nwc24/NWC24Schedule.h>
|
||||
#include <revolution/ncd.h>
|
||||
#include <revolution/os.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define NCD_IPC_HEAP_SIZE 0x1B60
|
||||
#define NCD_MAX_PROFILE 3
|
||||
|
||||
static u32 ncdInitialized;
|
||||
static NCDConfig* ncdCommonBuffer;
|
||||
|
||||
struct NCDMutex {
|
||||
OSMutex mutex;
|
||||
u8 padding[8];
|
||||
} ncdMutex;
|
||||
s32 ncdCommonResult[8] ATTRIBUTE_ALIGN(32);
|
||||
IOSIoVector ncdCommonVector[4] ATTRIBUTE_ALIGN(32);
|
||||
|
||||
const char* __NCDVersion = "<< RVL_SDK - NCD \trelease build: Dec 12 2008 03:06:03 (0x4199_60831) >>";
|
||||
const char* __NCDUnofficialVersion = "<< RVL_SDK - NCD \trelease build: Dec 12 2008 03:06:03 (0x4199_60831) UNOFFICIAL >>";
|
||||
|
||||
static void LockRight(void);
|
||||
static NCDErr ExecConfigCommand(const char* name, NCDConfig* config, u32 command);
|
||||
static NCDErr NCDiGetWirelessMacAddress(u8* macAddr);
|
||||
|
||||
NCDErr NCDReadConfig(NCDConfig* config) {
|
||||
if (config == NULL) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
return ExecConfigCommand("NCDReadConfig", config, 5);
|
||||
}
|
||||
|
||||
NCDErr NCDWriteConfig(const NCDConfig* config) {
|
||||
BOOL enabled;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 2)) {
|
||||
OSRegisterVersion(__NCDUnofficialVersion);
|
||||
ncdInitialized |= 2;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
if (config == NULL) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
return ExecConfigCommand("NCDWriteConfig", (NCDConfig*)config, 6);
|
||||
}
|
||||
|
||||
NCDErr NCDSetIfConfig(NCDIfConfig* ifConfig) {
|
||||
union {
|
||||
BOOL enabled;
|
||||
NCDConfig* config;
|
||||
} state;
|
||||
NCDErr lockErr;
|
||||
NCDProfile* profile;
|
||||
NCDErr result;
|
||||
s32 i;
|
||||
u32 count;
|
||||
|
||||
state.enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 2)) {
|
||||
OSRegisterVersion(__NCDUnofficialVersion);
|
||||
ncdInitialized |= 2;
|
||||
}
|
||||
OSRestoreInterrupts(state.enabled);
|
||||
|
||||
|
||||
if (ifConfig == NULL) {
|
||||
return -3;
|
||||
}
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
lockErr = NWC24iLockSocket();
|
||||
if (lockErr == 0) {
|
||||
result = ExecConfigCommand("NCDSetIfConfig", NULL, 3);
|
||||
if (result == 0) {
|
||||
state.config = ncdCommonBuffer;
|
||||
|
||||
if (ifConfig->selectedMedia != 1 && ifConfig->selectedMedia != 2) {
|
||||
state.config->selectedMedia = 0;
|
||||
} else {
|
||||
state.config->selectedMedia = ifConfig->selectedMedia;
|
||||
profile = state.config->profiles;
|
||||
i = 0;
|
||||
state.config->linkTimeout = ifConfig->linkTimeout;
|
||||
count = 0;
|
||||
for (; i < NCD_MAX_PROFILE; i++, profile++) {
|
||||
if (state.config->profiles[i].flags & 0x80) {
|
||||
switch (ifConfig->selectedMedia) {
|
||||
case 1:
|
||||
state.config->profiles[i].flags &= ~1;
|
||||
memcpy(&profile->netif, &ifConfig->netif, 0x15c);
|
||||
break;
|
||||
case 2:
|
||||
state.config->profiles[i].flags |= 1;
|
||||
memcpy(&profile->netif, &ifConfig->netif, 4);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
state.config->profiles[0].flags |= 0x80;
|
||||
switch (ifConfig->selectedMedia) {
|
||||
case 1:
|
||||
state.config->profiles[0].flags &= ~1;
|
||||
memcpy(&state.config->profiles[0].netif.wireless, &ifConfig->netif, 0x15c);
|
||||
break;
|
||||
case 2:
|
||||
state.config->profiles[0].flags |= 1;
|
||||
memcpy(&state.config->profiles[0].netif.wired, &ifConfig->netif, 4);
|
||||
break;
|
||||
}
|
||||
memset(&state.config->profiles[0].adjust, 0, 0xc);
|
||||
state.config->profiles[0].flags |= 6;
|
||||
memset(&state.config->profiles[0].ip, 0, 0x14);
|
||||
state.config->profiles[0].flags &= ~0x10;
|
||||
memset(&state.config->profiles[0].proxy, 0, 0x79c);
|
||||
}
|
||||
}
|
||||
result = ExecConfigCommand("NCDSetIfConfig", NULL, 4);
|
||||
}
|
||||
NWC24iUnlockSocket();
|
||||
} else if (lockErr == -0x16) {
|
||||
result = -4;
|
||||
} else if (lockErr == -0x1d) {
|
||||
result = -8;
|
||||
} else {
|
||||
result = -2;
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
NCDErr NCDSetIpConfig(NCDIpConfig* ipConfig) {
|
||||
NCDErr err;
|
||||
BOOL enabled;
|
||||
s32 i;
|
||||
u32 count;
|
||||
NCDConfig* config;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 2)) {
|
||||
OSRegisterVersion(__NCDUnofficialVersion);
|
||||
ncdInitialized |= 2;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
if (ipConfig == NULL) {
|
||||
return -3;
|
||||
}
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
err = NWC24iLockSocket();
|
||||
if (err == 0) {
|
||||
err = ExecConfigCommand("NCDSetIpConfig", NULL, 3);
|
||||
if (err == 0) {
|
||||
i = 0;
|
||||
count = 0;
|
||||
config = ncdCommonBuffer;
|
||||
for (; i < NCD_MAX_PROFILE; i++) {
|
||||
if (config->profiles[i].flags & 0x80) {
|
||||
NCDProfile* profile = &config->profiles[i];
|
||||
|
||||
memcpy(&profile->adjust, &ipConfig->adjust, 0xc);
|
||||
if (ipConfig->useDhcp == 1) {
|
||||
config->profiles[i].flags |= 6;
|
||||
memcpy(&profile->ip, &ipConfig->ip, 0x14);
|
||||
} else {
|
||||
config->profiles[i].flags &= ~6;
|
||||
memcpy(&profile->ip, &ipConfig->ip, 0x14);
|
||||
}
|
||||
if (ipConfig->useProxy == 1) {
|
||||
config->profiles[i].flags |= 0x10;
|
||||
memcpy(&profile->proxy, &ipConfig->proxy, 0x79c);
|
||||
} else {
|
||||
config->profiles[i].flags &= ~0x10;
|
||||
memset(&profile->proxy, 0, 0x79c);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
NCDProfile* profile = config->profiles;
|
||||
profile->flags |= 0x80;
|
||||
memcpy(&profile->adjust, &ipConfig->adjust, 0xc);
|
||||
if (ipConfig->useDhcp == 1) {
|
||||
profile->flags |= 6;
|
||||
memcpy(&profile->ip, &ipConfig->ip, 0x14);
|
||||
} else {
|
||||
profile->flags &= ~6;
|
||||
memcpy(&profile->ip, &ipConfig->ip, 0x14);
|
||||
}
|
||||
if (ipConfig->useProxy == 1) {
|
||||
profile->flags |= 0x10;
|
||||
memcpy(&profile->proxy, &ipConfig->proxy, 0x79c);
|
||||
} else {
|
||||
profile->flags &= ~0x10;
|
||||
memset(&profile->proxy, 0, 0x79c);
|
||||
}
|
||||
profile->flags = profile->flags & ~1;
|
||||
memset(&profile->netif, 0, 0x15c);
|
||||
}
|
||||
err = ExecConfigCommand("NCDSetIpConfig", NULL, 4);
|
||||
}
|
||||
NWC24iUnlockSocket();
|
||||
} else if (err == -0x16) {
|
||||
err = -4;
|
||||
} else if (err == -0x1d) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
NCDErr NCDGetCurrentIpConfig(NCDIpConfig* ipConfig) {
|
||||
NCDErr err = 0;
|
||||
NCDConfig* config;
|
||||
s32 idx;
|
||||
|
||||
if (ipConfig == NULL) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
err = ExecConfigCommand("NCDGetCurrentIpConfig", 0, 3);
|
||||
if (err == 0) {
|
||||
config = ncdCommonBuffer;
|
||||
idx = ncdCommonResult[1];
|
||||
|
||||
if (idx < 0 || idx >= NCD_MAX_PROFILE) {
|
||||
err = -7;
|
||||
} else {
|
||||
memcpy(&ipConfig->adjust, &config->profiles[idx].adjust, 0xc);
|
||||
|
||||
if (config->profiles[idx].flags & 0x6) {
|
||||
ipConfig->useDhcp = TRUE;
|
||||
memcpy(&ipConfig->ip, &config->profiles[idx].ip, 0x14);
|
||||
} else {
|
||||
ipConfig->useDhcp = FALSE;
|
||||
memcpy(&ipConfig->ip, &config->profiles[idx].ip, 0x14);
|
||||
}
|
||||
|
||||
if (config->profiles[idx].flags & 0x10) {
|
||||
ipConfig->useProxy = TRUE;
|
||||
memcpy(&ipConfig->proxy, &config->profiles[idx].proxy, 0x79c);
|
||||
} else {
|
||||
ipConfig->useProxy = FALSE;
|
||||
memset(&ipConfig->proxy, 0, 0x79c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
NCDErr NCDGetLinkStatus(void) {
|
||||
NCDErr err;
|
||||
s32 fd;
|
||||
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
fd = IOS_Open("/dev/net/ncd/manage", 0);
|
||||
if (fd < 0) {
|
||||
if (fd == -6) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
} else {
|
||||
ncdCommonVector[0].base = (u8*)ncdCommonResult;
|
||||
ncdCommonVector[0].length = sizeof(ncdCommonResult);
|
||||
if (IOS_Ioctlv(fd, 7, 0, 1, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
if (err == 0) {
|
||||
err = ncdCommonResult[1];
|
||||
err = err >= 0 ? err : -1;
|
||||
}
|
||||
}
|
||||
if (IOS_Close(fd) < 0) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
BOOL NCDIsInterfaceDecided(void) {
|
||||
NCDErr err = NCDGetLinkStatus();
|
||||
|
||||
switch (err) {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
NCDErr NCDGetWirelessMacAddress(u8* macAddr) {
|
||||
return NCDiGetWirelessMacAddress(macAddr);
|
||||
}
|
||||
|
||||
static NCDErr NCDiGetWirelessMacAddress(u8* macAddr) {
|
||||
NCDErr err = 0;
|
||||
s32 fd;
|
||||
|
||||
if (macAddr == NULL) {
|
||||
return -3;
|
||||
}
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
fd = IOS_Open("/dev/net/ncd/manage", 0);
|
||||
if (fd < 0) {
|
||||
if (fd == -6) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
} else {
|
||||
ncdCommonVector[0].base = (u8*)ncdCommonResult;
|
||||
ncdCommonVector[0].length = sizeof(ncdCommonResult);
|
||||
ncdCommonVector[1].base = (u8*)ncdCommonBuffer;
|
||||
ncdCommonVector[1].length = NCD_MAC_ADDRESS_LENGTH;
|
||||
if (IOS_Ioctlv(fd, 8, 0, 2, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
if (err == 0) {
|
||||
memcpy(macAddr, ncdCommonBuffer, NCD_MAC_ADDRESS_LENGTH);
|
||||
}
|
||||
}
|
||||
if (IOS_Close(fd) < 0) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
NCDErr NCDLockWirelessDriver(void) {
|
||||
NCDErr err;
|
||||
s32 fd;
|
||||
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
fd = IOS_Open("/dev/net/ncd/manage", 0);
|
||||
if (fd < 0) {
|
||||
if (fd == -6) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
} else {
|
||||
ncdCommonVector[0].base = (u8*)ncdCommonResult;
|
||||
ncdCommonVector[0].length = sizeof(ncdCommonResult);
|
||||
if (IOS_Ioctlv(fd, 1, 0, 1, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
if (err == 0) {
|
||||
err = ncdCommonResult[1];
|
||||
err = err > 0 ? err : -1;
|
||||
}
|
||||
}
|
||||
if (IOS_Close(fd) < 0) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
NCDErr NCDUnlockWirelessDriver(s32 id) {
|
||||
NCDErr err;
|
||||
s32 fd;
|
||||
|
||||
if (id <= 0) {
|
||||
return -3;
|
||||
}
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
fd = IOS_Open("/dev/net/ncd/manage", 0);
|
||||
if (fd < 0) {
|
||||
if (fd == -6) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
} else {
|
||||
ncdCommonVector[0].base = (u8*)ncdCommonBuffer;
|
||||
ncdCommonVector[0].length = 4;
|
||||
ncdCommonVector[1].base = (u8*)ncdCommonResult;
|
||||
ncdCommonVector[1].length = sizeof(ncdCommonResult);
|
||||
ncdCommonBuffer->version = id;
|
||||
if (IOS_Ioctlv(fd, 2, 1, 1, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
}
|
||||
if (IOS_Close(fd) < 0) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
s32 NCDRestoreConfig(void) {
|
||||
NCDErr err;
|
||||
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
err = NWC24iLockSocket();
|
||||
if (err == 0) {
|
||||
err = ExecConfigCommand("NCDRestoreConfig", NULL, 5);
|
||||
if (err == 0) {
|
||||
err = ExecConfigCommand("NCDRestoreConfig", NULL, 4);
|
||||
}
|
||||
NWC24iUnlockSocket();
|
||||
} else if (err == -0x16) {
|
||||
err = -4;
|
||||
} else if (err == -0x1d) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
NCDErr NCDiGetEnabledConfigList(u32* list0, u32* list1, u32* list2) {
|
||||
NCDErr err;
|
||||
u32 mask0 = 0;
|
||||
u32 mask1 = 0;
|
||||
u32 mask2 = 0;
|
||||
u8 flags;
|
||||
u32 i;
|
||||
|
||||
LockRight();
|
||||
err = ExecConfigCommand("NCDiGetEnabledConfigList", NULL, 3);
|
||||
if (err == 0) {
|
||||
for (i = 0; i < NCD_MAX_PROFILE; i++) {
|
||||
NCDProfile* profile = &ncdCommonBuffer->profiles[i];
|
||||
|
||||
flags = profile->flags;
|
||||
|
||||
if (flags & 0x80) {
|
||||
if (flags & 1) {
|
||||
mask0 |= 1 << i;
|
||||
} else {
|
||||
if (profile->netif.wireless.configMethod != 1) {
|
||||
mask1 |= 1 << i;
|
||||
}
|
||||
if (ncdCommonBuffer->profiles[i].netif.wireless.configMethod == 1) {
|
||||
mask2 |= 1 << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
|
||||
if (list0 != NULL) {
|
||||
*list0 = mask0;
|
||||
}
|
||||
if (list1 != NULL) {
|
||||
*list1 = mask1;
|
||||
}
|
||||
if (list2 != NULL) {
|
||||
*list2 = mask2;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static NCDErr ExecConfigCommand(const char* name, NCDConfig* config, u32 command) {
|
||||
NCDErr err = 0;
|
||||
s32 fd;
|
||||
|
||||
if (!OSGetCurrentThread()) {
|
||||
return -5;
|
||||
}
|
||||
|
||||
LockRight();
|
||||
fd = IOS_Open("/dev/net/ncd/manage", 0);
|
||||
if (fd < 0) {
|
||||
if (fd == -6) {
|
||||
err = -8;
|
||||
} else {
|
||||
err = -2;
|
||||
}
|
||||
} else {
|
||||
ncdCommonVector[0].base = (u8*)ncdCommonBuffer;
|
||||
ncdCommonVector[0].length = sizeof(NCDConfig);
|
||||
ncdCommonVector[1].base = (u8*)ncdCommonResult;
|
||||
ncdCommonVector[1].length = sizeof(ncdCommonResult);
|
||||
|
||||
switch (command) {
|
||||
case 3:
|
||||
case 5:
|
||||
if (IOS_Ioctlv(fd, command, 0, 2, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
if (err == 0 && config != NULL) {
|
||||
memcpy(config, ncdCommonBuffer, sizeof(NCDConfig));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 6:
|
||||
if (config != NULL) {
|
||||
memcpy(ncdCommonBuffer, config, sizeof(NCDConfig));
|
||||
}
|
||||
if (IOS_Ioctlv(fd, command, 1, 1, ncdCommonVector) < 0) {
|
||||
err = -2;
|
||||
} else {
|
||||
err = ncdCommonResult[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (IOS_Close(fd) < 0) {
|
||||
err = -1;
|
||||
}
|
||||
}
|
||||
OSUnlockMutex((OSMutex*)&ncdMutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void LockRight(void) {
|
||||
BOOL enabled;
|
||||
void* lo;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!(ncdInitialized & 1)) {
|
||||
OSRegisterVersion(__NCDVersion);
|
||||
OSInitMutex((OSMutex*)&ncdMutex);
|
||||
lo = (void*)OSRoundUp32B(IPCGetBufferLo());
|
||||
if ((u32)IPCGetBufferHi() - (u32)lo < NCD_IPC_HEAP_SIZE) {
|
||||
OSPanic("ncdsystem.c", 0x5B1, "Could not reserve heap for NCD library from IPC arena");
|
||||
}
|
||||
IPCSetBufferLo((u8*)lo + NCD_IPC_HEAP_SIZE);
|
||||
ncdCommonBuffer = (NCDConfig*)lo;
|
||||
memset(ncdCommonBuffer, 0, NCD_IPC_HEAP_SIZE);
|
||||
memset(ncdCommonResult, 0, sizeof(ncdCommonResult));
|
||||
memset(ncdCommonVector, 0, sizeof(ncdCommonVector));
|
||||
ncdInitialized |= 1;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
OSLockMutex((OSMutex*)&ncdMutex);
|
||||
}
|
||||
@@ -18,10 +18,16 @@ enum {
|
||||
#define FRIEND_LIST_MAGIC 'WcFl'
|
||||
#define FRIEND_LIST_VERSION 2
|
||||
|
||||
static const char* FLFilePath = "/shared2/wc24/nwc24fl.bin";
|
||||
const char lbl_8166E160[26] __attribute__((section(".data"), aligned(8))) = "/shared2/wc24/nwc24fl.bin";
|
||||
void* const lbl_8166E160_pad __attribute__((section(".data"))) = (void*)0;
|
||||
static const char* FLFilePath = lbl_8166E160;
|
||||
const u32 FLFilePath_pad __attribute__((section(".sdata"), aligned(1))) = 0;
|
||||
|
||||
const char g_SpecialsChars[16] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' };
|
||||
|
||||
static NWC24Err GetCachedFLHeader(NWC24FLHeader** header);
|
||||
static ChkHostNameError CheckHostName(const char* hostName, u32 hostNameLength);
|
||||
static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo);
|
||||
|
||||
static u32 GetUnkFlag(u32 index) {
|
||||
NWC24Err result;
|
||||
@@ -127,7 +133,7 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return NWC24_ERR_ALIGNMENT;
|
||||
}
|
||||
|
||||
result = NWC24CheckFriendInfo(friendInfo);
|
||||
result = CheckFriendInfo(friendInfo);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -219,63 +225,6 @@ NWC24Err NWC24WriteFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24DeleteFriendInfo(u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultWrite;
|
||||
|
||||
NWC24FLHeader* header;
|
||||
NWC24FriendInfo* tmpFriendInfo;
|
||||
|
||||
NWC24File file;
|
||||
u32 fileOffset;
|
||||
|
||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
|
||||
return NWC24_ERR_LIB_NOT_OPENED;
|
||||
}
|
||||
|
||||
result = GetCachedFLHeader(&header);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (index >= header->infoCount) {
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (header->friendIds[index] == 0) {
|
||||
return NWC24_ERR_NULL;
|
||||
}
|
||||
|
||||
tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork;
|
||||
Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo));
|
||||
|
||||
result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader);
|
||||
NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG);
|
||||
|
||||
resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file);
|
||||
if (resultWrite == NWC24_OK) {
|
||||
header->friendIds[index] = 0;
|
||||
header->registeredCount--;
|
||||
result = SetUnkFlag(index, 0);
|
||||
if (result == NWC24_OK) {
|
||||
NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
|
||||
resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file);
|
||||
}
|
||||
}
|
||||
|
||||
result = NWC24FClose(&file);
|
||||
if (resultWrite != NWC24_OK) {
|
||||
result = resultWrite;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultFile;
|
||||
@@ -296,7 +245,7 @@ NWC24Err NWC24UpdateFriendInfo(const NWC24FriendInfo* friendInfo, u32 index) {
|
||||
return NWC24_ERR_ALIGNMENT;
|
||||
}
|
||||
|
||||
result = NWC24CheckFriendInfo(friendInfo);
|
||||
result = CheckFriendInfo(friendInfo);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -358,6 +307,63 @@ out:
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24DeleteFriendInfo(u32 index) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultWrite;
|
||||
|
||||
NWC24FLHeader* header;
|
||||
NWC24FriendInfo* tmpFriendInfo;
|
||||
|
||||
NWC24File file;
|
||||
u32 fileOffset;
|
||||
|
||||
if (!NWC24IsMsgLibOpened() && !NWC24IsMsgLibOpenedByTool()) {
|
||||
return NWC24_ERR_LIB_NOT_OPENED;
|
||||
}
|
||||
|
||||
result = GetCachedFLHeader(&header);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (index >= header->infoCount) {
|
||||
return NWC24_ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
if (header->friendIds[index] == 0) {
|
||||
return NWC24_ERR_NULL;
|
||||
}
|
||||
|
||||
tmpFriendInfo = (NWC24FriendInfo*)nwc24Work->mainWork;
|
||||
Mail_memset(tmpFriendInfo, 0, sizeof(NWC24FriendInfo));
|
||||
|
||||
result = NWC24FOpen(&file, FLFilePath, NWC24_OPEN_RW);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
fileOffset = (index * sizeof(NWC24FriendInfo)) + sizeof(NWC24FLHeader);
|
||||
NWC24FSeek(&file, fileOffset, NWC24_SEEK_BEG);
|
||||
|
||||
resultWrite = NWC24FWrite(tmpFriendInfo, sizeof(NWC24FriendInfo), &file);
|
||||
if (resultWrite == NWC24_OK) {
|
||||
header->friendIds[index] = 0;
|
||||
header->registeredCount--;
|
||||
result = SetUnkFlag(index, 0);
|
||||
if (result == NWC24_OK) {
|
||||
NWC24FSeek(&file, 0, NWC24_SEEK_BEG);
|
||||
resultWrite = NWC24FWrite(header, sizeof(NWC24FLHeader), &file);
|
||||
}
|
||||
}
|
||||
|
||||
result = NWC24FClose(&file);
|
||||
if (resultWrite != NWC24_OK) {
|
||||
result = resultWrite;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NWC24Err NWC24SwapFriendInfos(u32 index1, u32 index2) {
|
||||
NWC24Err result;
|
||||
NWC24Err resultFile;
|
||||
@@ -476,8 +482,8 @@ NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index) {
|
||||
NWC24Err result;
|
||||
|
||||
NWC24FLHeader* header;
|
||||
NWC24FriendAddr* tmpFriendAddr;
|
||||
NWC24FriendInfo* tmpFriendInfo;
|
||||
|
||||
int cmpResult;
|
||||
|
||||
u32 i;
|
||||
@@ -498,10 +504,12 @@ NWC24Err NWC24SearchFriendInfoByAddr(const NWC24FriendAddr* addr, u32* index) {
|
||||
}
|
||||
|
||||
tmpFriendInfo = (NWC24FriendInfo*)&nwc24Work->mainWork;
|
||||
tmpFriendAddr = (NWC24FriendAddr*)&tmpFriendInfo->addr.mailAddr[sizeof(NWC24UserId)];
|
||||
|
||||
for (i = 0; i < header->infoCount; i++) {
|
||||
if (friendValue == header->friendIds[i]) {
|
||||
result = NWC24ReadFriendInfo(tmpFriendInfo, i);
|
||||
result = NWC24ReadFriendInfo(
|
||||
(NWC24FriendInfo*)((u8*)tmpFriendAddr - sizeof(NWC24FriendAttr) - sizeof(NWC24UserId)), i);
|
||||
if (result != NWC24_OK) {
|
||||
return result;
|
||||
}
|
||||
@@ -748,7 +756,7 @@ static NWC24Err GetCachedFLHeader(NWC24FLHeader** header) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24CheckFriendInfo(const NWC24FriendInfo* friendInfo) {
|
||||
static inline NWC24Err CheckFriendInfo(const NWC24FriendInfo* friendInfo) {
|
||||
NWC24Err result;
|
||||
|
||||
if (friendInfo == NULL) {
|
||||
@@ -773,8 +781,6 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) {
|
||||
int len;
|
||||
BOOL readingDomain;
|
||||
|
||||
static const char specials[] = { '(', ')', '<', '>', '[', ']', ':', ';', '\\', ',', '"' };
|
||||
|
||||
// Check parameters
|
||||
if (addr == NULL) {
|
||||
return NWC24_ERR_NULL;
|
||||
@@ -810,8 +816,8 @@ NWC24Err NWC24CheckPublicMailAddr(const char* addr) {
|
||||
}
|
||||
|
||||
// If the character is special, invalid!
|
||||
for (j = 0; j < sizeof(specials); j++) {
|
||||
if (ch == specials[j]) {
|
||||
for (j = 0; j < 11; j++) {
|
||||
if (ch == g_SpecialsChars[j]) {
|
||||
return NWC24_ERR_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,28 +382,6 @@ NWC24Err NWC24GetMsgType(const NWC24MsgObj* msg, NWC24MsgType* type) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*appId = msgObj->appId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*groupId = msgObj->groupId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u8 numAttached = msgObj->numAttached;
|
||||
*numAttach = numAttached;
|
||||
if (numAttached > NWC24_MSG_ATTACHMENT_MAX) {
|
||||
return NWC24_ERR_BROKEN;
|
||||
}
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgSubjectSize(const NWC24MsgObj* msg, u32* subjectSize) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u32 size = msgObj->subject.size;
|
||||
@@ -431,6 +409,16 @@ NWC24Err NWC24GetMsgTextSize(const NWC24MsgObj* msg, u32* textSize) {
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgNumAttached(const NWC24MsgObj* msg, u32* numAttach) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
u8 numAttached = msgObj->numAttached;
|
||||
*numAttach = numAttached;
|
||||
if (numAttached > NWC24_MSG_ATTACHMENT_MAX) {
|
||||
return NWC24_ERR_BROKEN;
|
||||
}
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAttachedSize(const NWC24MsgObj* msg, u32 attachIndex, u32* attachSize) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
|
||||
@@ -463,6 +451,18 @@ NWC24Err NWC24GetMsgAttachedType(const NWC24MsgObj* msg, u32 attachIndex, NWC24M
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgAppId(const NWC24MsgObj* msg, u32* appId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*appId = msgObj->appId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgGroupId(const NWC24MsgObj* msg, u16* groupId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
*groupId = msgObj->groupId;
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
NWC24Err NWC24GetMsgFromId(const NWC24MsgObj* msg, NWC24UserId* fromId) {
|
||||
const NWC24MsgObjPrivate* msgObj = (const NWC24MsgObjPrivate*)msg;
|
||||
|
||||
|
||||
@@ -3,48 +3,91 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
char* Mail_strcpy(char* dest, const char* src) {
|
||||
char* pDest;
|
||||
char cSrc;
|
||||
|
||||
for (pDest = dest; *src != 0; pDest++) {
|
||||
cSrc = *src++;
|
||||
*pDest = cSrc;
|
||||
char* Mail_strcpy(char* pDst, const char* pSrc) {
|
||||
char* pOrigin = pDst;
|
||||
|
||||
while (*pSrc != '\0') {
|
||||
*pDst++ = *pSrc++;
|
||||
}
|
||||
*pDest = 0;
|
||||
return dest;
|
||||
|
||||
*pDst = '\0';
|
||||
return pOrigin;
|
||||
}
|
||||
|
||||
int Mail_strlen(const char* str) {
|
||||
int i;
|
||||
for (i = 0; *str != 0; i++, str++) {
|
||||
int Mail_strlen(const char* pStr) {
|
||||
int len = 0;
|
||||
|
||||
while (pStr[len] != '\0') {
|
||||
len++;
|
||||
}
|
||||
return i;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
char* Mail_strcat(char* dest, const char* src) {
|
||||
int i;
|
||||
char* pDest;
|
||||
int STD_strnlen(const char* pStr, size_t maxlen) {
|
||||
size_t len = 0;
|
||||
|
||||
pDest = dest;
|
||||
for (i = 0; *pDest != 0; pDest++, i++) {
|
||||
}
|
||||
pDest = dest + i;
|
||||
while (*src != 0) {
|
||||
*pDest++ = *src++;
|
||||
}
|
||||
*pDest = 0;
|
||||
return dest;
|
||||
}
|
||||
|
||||
int STD_strnlen(const char* str, u32 len) {
|
||||
int i;
|
||||
for (i = 0; i < len; i++, str++) {
|
||||
if (*str == 0) {
|
||||
for (; len < maxlen; len++) {
|
||||
if (pStr[len] == '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void* Mail_memcpy(void* pDst, const void* pSrc, u32 n) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
((u8*)pDst)[i] = ((u8*)pSrc)[i];
|
||||
}
|
||||
|
||||
return pDst;
|
||||
}
|
||||
|
||||
void* Mail_memset(void* pDst, int ch, u32 n) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
((u8*)pDst)[i] = ch;
|
||||
}
|
||||
|
||||
return pDst;
|
||||
}
|
||||
|
||||
char* Mail_strncpy(char* dest, const char* src, u32 len) {
|
||||
u32 i;
|
||||
|
||||
i = 0;
|
||||
for (; i < len; i++) {
|
||||
dest[i] = src[i];
|
||||
if (src[i] == 0) {
|
||||
while (++i < len) {
|
||||
dest[i] = 0;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* Mail_strcat(char* pDst, const char* pSrc) {
|
||||
Mail_strcpy(pDst + Mail_strlen(pDst), pSrc);
|
||||
return pDst;
|
||||
}
|
||||
|
||||
char* Mail_strncat(char* pDst, const char* pSrc, u32 maxlen) {
|
||||
int len = Mail_strlen(pDst);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < maxlen && pSrc[i] != '\0'; i++) {
|
||||
pDst[len + i] = pSrc[i];
|
||||
}
|
||||
|
||||
pDst[len + i] = '\0';
|
||||
return pDst;
|
||||
}
|
||||
|
||||
int Mail_strncmp(const char* str1, const char* str2, u32 len) {
|
||||
@@ -98,3 +141,271 @@ int Mail_tolower(int ch) {
|
||||
}
|
||||
return ch;
|
||||
}
|
||||
|
||||
static void set_to_head(char* pStr, char ch) {
|
||||
int i;
|
||||
|
||||
for (i = Mail_strlen(pStr); i >= 0; i--) {
|
||||
pStr[i + 1] = pStr[i];
|
||||
}
|
||||
|
||||
*pStr = ch;
|
||||
}
|
||||
|
||||
static void set_to_tail(char* pStr, char ch) {
|
||||
int i = Mail_strlen(pStr);
|
||||
|
||||
pStr[i++] = ch;
|
||||
pStr[i] = '\0';
|
||||
}
|
||||
|
||||
static s32 convNum(char* pDst, u32 number, s32 numberBase, char charBase,
|
||||
BOOL isSigned, s32 width, char specifierChar,
|
||||
char justifyChar) {
|
||||
|
||||
s32 charsWritten;
|
||||
s32 digitsWritten;
|
||||
char remainder;
|
||||
|
||||
if (isSigned && (number & 0x80000000)) {
|
||||
isSigned = TRUE;
|
||||
number = -number;
|
||||
} else {
|
||||
isSigned = FALSE;
|
||||
number = number;
|
||||
}
|
||||
|
||||
charsWritten = digitsWritten = 0;
|
||||
|
||||
while (number != 0) {
|
||||
remainder = number % numberBase;
|
||||
number /= numberBase;
|
||||
|
||||
set_to_head(pDst, remainder + (char)(remainder > 9 ? charBase : '0'));
|
||||
digitsWritten++;
|
||||
charsWritten++;
|
||||
}
|
||||
|
||||
if (*pDst == '\0') {
|
||||
set_to_head(pDst, '0');
|
||||
digitsWritten++;
|
||||
charsWritten++;
|
||||
}
|
||||
|
||||
if (specifierChar != '0') {
|
||||
specifierChar = ' ';
|
||||
}
|
||||
|
||||
digitsWritten += isSigned;
|
||||
|
||||
while (digitsWritten < width) {
|
||||
if (justifyChar == 'L') {
|
||||
set_to_tail(pDst, ' ');
|
||||
charsWritten++;
|
||||
} else {
|
||||
set_to_head(pDst, specifierChar);
|
||||
charsWritten++;
|
||||
}
|
||||
|
||||
digitsWritten++;
|
||||
}
|
||||
|
||||
if (isSigned) {
|
||||
set_to_head(pDst, '-');
|
||||
}
|
||||
|
||||
return charsWritten;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Mail_sprintf(char* pDst, char* pFmt, ...) {
|
||||
va_list argv;
|
||||
int ret;
|
||||
|
||||
va_start(argv, pFmt);
|
||||
ret = Mail_vsprintf(pDst, pFmt, &argv);
|
||||
va_end(argv);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Mail_vsprintf(char* pDst, char* pFmt, va_list* argv) {
|
||||
int charsWritten;
|
||||
BOOL isNumberFormat;
|
||||
BOOL isSigned;
|
||||
s32 stringLength;
|
||||
s32 numberBase;
|
||||
s32 width;
|
||||
char formatChar;
|
||||
char justifyChar;
|
||||
char specifierChar;
|
||||
char charBase;
|
||||
char* pStrArg;
|
||||
char longFlag;
|
||||
u32 number;
|
||||
|
||||
*pDst = 0;
|
||||
charsWritten = 0;
|
||||
|
||||
while ((formatChar = *pFmt++) != '\0') {
|
||||
while (*pDst != '\0') {
|
||||
pDst++;
|
||||
}
|
||||
|
||||
if (formatChar == '%') {
|
||||
formatChar = *pFmt++;
|
||||
|
||||
if (formatChar == '%') {
|
||||
set_to_tail(pDst++, formatChar);
|
||||
charsWritten++;
|
||||
} else {
|
||||
justifyChar = formatChar;
|
||||
if (formatChar == '-') {
|
||||
formatChar = *pFmt++;
|
||||
}
|
||||
|
||||
specifierChar = formatChar;
|
||||
isSigned = FALSE;
|
||||
numberBase = 10;
|
||||
charBase = '0';
|
||||
isNumberFormat = FALSE;
|
||||
|
||||
if (formatChar == '*') {
|
||||
width = va_arg(*argv, s32);
|
||||
formatChar = *pFmt++;
|
||||
} else {
|
||||
width = 0;
|
||||
|
||||
while (formatChar >= '0' && formatChar <= '9') {
|
||||
width = width * 10 + formatChar - '0';
|
||||
formatChar = *pFmt++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((longFlag = formatChar & (u8)~0x20) == 'L') {
|
||||
formatChar = *pFmt++;
|
||||
}
|
||||
|
||||
switch (formatChar) {
|
||||
case 'd': {
|
||||
isNumberFormat = TRUE;
|
||||
isSigned = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'o': {
|
||||
isNumberFormat = TRUE;
|
||||
numberBase = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'u': {
|
||||
isNumberFormat = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'x': {
|
||||
isNumberFormat = TRUE;
|
||||
numberBase = 16;
|
||||
charBase = 'a' - 10;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'X': {
|
||||
isNumberFormat = TRUE;
|
||||
numberBase = 16;
|
||||
charBase = 'A' - 10;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c': {
|
||||
formatChar = va_arg(*argv, s32);
|
||||
set_to_tail(pDst++, formatChar);
|
||||
charsWritten++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 's': {
|
||||
pStrArg = va_arg(*argv, char*);
|
||||
|
||||
if (pStrArg) {
|
||||
stringLength = Mail_strlen(pStrArg);
|
||||
Mail_strcat(pDst, pStrArg);
|
||||
} else {
|
||||
stringLength = 0;
|
||||
}
|
||||
|
||||
charsWritten += stringLength;
|
||||
|
||||
while (stringLength < width) {
|
||||
charsWritten++;
|
||||
|
||||
if (justifyChar == '-') {
|
||||
set_to_tail(pDst, ' ');
|
||||
} else {
|
||||
set_to_head(pDst, ' ');
|
||||
}
|
||||
|
||||
stringLength++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isNumberFormat) {
|
||||
if (longFlag == 'L') {
|
||||
number = va_arg(*argv, u32);
|
||||
} else if (isSigned) {
|
||||
number = va_arg(*argv, s32);
|
||||
} else {
|
||||
number = va_arg(*argv, u32);
|
||||
}
|
||||
|
||||
charsWritten +=
|
||||
convNum(pDst, number, numberBase, charBase, isSigned,
|
||||
width, specifierChar, justifyChar);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
set_to_tail(pDst++, formatChar);
|
||||
charsWritten++;
|
||||
}
|
||||
}
|
||||
|
||||
return charsWritten;
|
||||
}
|
||||
|
||||
int Mail_strnicmp(const char* str1, const char* str2, int len) {
|
||||
int i;
|
||||
int c2;
|
||||
int c1;
|
||||
int result;
|
||||
|
||||
result = 0;
|
||||
for (i = 0; i < len; i++) {
|
||||
c1 = *str1;
|
||||
c2 = *str2;
|
||||
if (c1 >= 'A') {
|
||||
if (c1 <= 'Z') {
|
||||
c1 += 0x20;
|
||||
}
|
||||
}
|
||||
if (c2 >= 'A') {
|
||||
if (c2 <= 'Z') {
|
||||
c2 += 0x20;
|
||||
}
|
||||
}
|
||||
result = c1 - c2;
|
||||
if (result != 0) {
|
||||
break;
|
||||
}
|
||||
if (c2 == 0) {
|
||||
break;
|
||||
}
|
||||
str2++;
|
||||
str1++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,79 @@
|
||||
#include <private/nwc24.h>
|
||||
#include <revolution/nwc24.h>
|
||||
|
||||
const u8 TtableInv[] = {13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4};
|
||||
const u8 ExcTable[] = {1, 5, 0, 4, 2, 3, 6, 7};
|
||||
static const u8 TtableInv[] = {13, 5, 9, 7, 0, 15, 10, 2, 12, 3, 14, 1, 8, 6, 11, 4};
|
||||
extern void _savegpr_27(void);
|
||||
extern void _restgpr_27(void);
|
||||
extern void __shr2u(void);
|
||||
extern void __shl2i(void);
|
||||
|
||||
static u8 getbyte(NWC24UserId value, u8 index);
|
||||
static NWC24UserId setbyte(NWC24UserId value, u8 index, u8 set);
|
||||
|
||||
NWC24UserId getUnScrambleId(NWC24UserId id);
|
||||
static int checkCRC(NWC24UserId id);
|
||||
|
||||
static u8 getbyte(NWC24UserId value, u8 index) {
|
||||
return (value >> (index * 8)) & 0xFF;
|
||||
}
|
||||
|
||||
static NWC24UserId setbyte(NWC24UserId value, u8 index, u8 set) {
|
||||
return (value & ~(((u64)0xFF << (index * 8)))) | (((u64)set << (index * 8)));
|
||||
static NWC24UserId getUnScrambleId(NWC24UserId id);
|
||||
asm NWC24Err NWC24CheckUserId(register NWC24UserId id) {
|
||||
stwu r1,-0x30(r1)
|
||||
mfspr r0,LR
|
||||
stw r0,0x34(r1)
|
||||
addi r11,r1,0x30
|
||||
bl _savegpr_27
|
||||
or r28,r3,r3
|
||||
or r27,r4,r4
|
||||
addi r3,r1,0x8
|
||||
bl NWC24GetMyUserId
|
||||
lwz r3,0x8(r1)
|
||||
lwz r4,0xc(r1)
|
||||
xor r0,r3,r28
|
||||
xor r5,r4,r27
|
||||
or. r0,r5,r0
|
||||
bne NWC24CheckUserId_not_same
|
||||
li r3,-0x23
|
||||
b NWC24CheckUserId_return
|
||||
NWC24CheckUserId_not_same:
|
||||
bl getUnScrambleId
|
||||
or r4,r27,r27
|
||||
rlwinm r27,r3,0x11,0x1d,0x1f
|
||||
or r3,r28,r28
|
||||
bl getUnScrambleId
|
||||
or r30,r4,r4
|
||||
or r31,r3,r3
|
||||
rlwinm r28,r3,0x11,0x1d,0x1f
|
||||
li r29,0
|
||||
NWC24CheckUserId_crc_loop:
|
||||
addi r0,r29,1
|
||||
or r3,r31,r31
|
||||
or r4,r30,r30
|
||||
subfic r5,r0,0x35
|
||||
bl __shr2u
|
||||
rlwinm. r0,r4,0,0x1f,0x1f
|
||||
beq NWC24CheckUserId_crc_next
|
||||
subfic r5,r29,0x2a
|
||||
li r4,0x635
|
||||
li r3,0
|
||||
bl __shl2i
|
||||
xor r30,r30,r4
|
||||
xor r31,r31,r3
|
||||
NWC24CheckUserId_crc_next:
|
||||
addi r29,r29,1
|
||||
cmpwi r29,0x2b
|
||||
blt NWC24CheckUserId_crc_loop
|
||||
or. r0,r30,r31
|
||||
beq NWC24CheckUserId_crc_ok
|
||||
li r3,-0x25
|
||||
b NWC24CheckUserId_return
|
||||
NWC24CheckUserId_crc_ok:
|
||||
cmpwi r27,0
|
||||
bne NWC24CheckUserId_return_ok
|
||||
cmpwi r28,0
|
||||
beq NWC24CheckUserId_return_ok
|
||||
li r3,-0x7
|
||||
b NWC24CheckUserId_return
|
||||
NWC24CheckUserId_return_ok:
|
||||
li r3,0
|
||||
NWC24CheckUserId_return:
|
||||
addi r11,r1,0x30
|
||||
bl _restgpr_27
|
||||
lwz r0,0x34(r1)
|
||||
mtspr LR,r0
|
||||
addi r1,r1,0x30
|
||||
blr
|
||||
}
|
||||
|
||||
NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id) {
|
||||
@@ -33,3 +91,167 @@ NWC24Err NWC24iCheckUserIdCRC(NWC24UserId id) {
|
||||
}
|
||||
return NWC24_OK;
|
||||
}
|
||||
|
||||
static asm NWC24UserId getUnScrambleId(register NWC24UserId id) {
|
||||
li r9,-1
|
||||
lis r7,0x20
|
||||
lis r6,0x5e5e
|
||||
stwu r1,-0x20(r1)
|
||||
subi r7,r7,1
|
||||
and r8,r4,r9
|
||||
addi r0,r6,0x5e5e
|
||||
stw r31,0x1c(r1)
|
||||
and r3,r3,r7
|
||||
lis r5,-1
|
||||
xor r8,r8,r0
|
||||
stw r30,0x18(r1)
|
||||
and r8,r8,r9
|
||||
xori r3,r3,0x5e5e
|
||||
rlwinm r0,r8,0x15,0xa,0xa
|
||||
li r6,-0x100
|
||||
and r3,r3,r7
|
||||
rlwinm r8,r8,0x1f,0,0x1f
|
||||
or r3,r3,r0
|
||||
stw r29,0x14(r1)
|
||||
rlwimi r8,r3,0x1f,0,0
|
||||
lis r4,-0xff
|
||||
rlwinm r7,r3,0x1f,1,0x1f
|
||||
addi r5,r5,0xff
|
||||
rlwinm r30,r8,0x18,0,0x1f
|
||||
rlwinm r29,r3,0x17,0x18,0x1f
|
||||
and r12,r7,r9
|
||||
li r0,0
|
||||
rlwimi r30,r3,0x17,0,7
|
||||
and r31,r8,r6
|
||||
rlwimi r31,r30,0,0x18,0x1f
|
||||
rlwinm r11,r3,0x1f,0x10,0x17
|
||||
and r30,r31,r5
|
||||
and r12,r12,r9
|
||||
rlwimi r0,r29,8,0x18,0x1f
|
||||
subi r4,r4,1
|
||||
or r12,r12,r0
|
||||
or r11,r30,r11
|
||||
and r30,r11,r4
|
||||
rlwinm r31,r8,0,0x18,0x1f
|
||||
li r0,0
|
||||
rlwinm r11,r8,0x10,8,0xf
|
||||
lis r10,0x100
|
||||
and r12,r12,r9
|
||||
rlwimi r0,r31,0x10,0x10,0x1f
|
||||
or r30,r30,r11
|
||||
or r29,r12,r0
|
||||
rlwinm r12,r3,0x1f,0x18,0x1f
|
||||
subi r0,r10,1
|
||||
li r10,0
|
||||
rlwimi r10,r12,0x18,8,0x1f
|
||||
and r11,r29,r9
|
||||
and r12,r30,r0
|
||||
rlwinm r3,r3,0x17,0,7
|
||||
or r3,r12,r3
|
||||
or r12,r11,r10
|
||||
and r10,r3,r9
|
||||
lis r3,TtableInv@ha
|
||||
and r31,r10,r9
|
||||
rlwinm r30,r8,0x10,0,0x1f
|
||||
rlwinm r11,r31,0x1c,0x1c,0x1f
|
||||
addi r3,r3,TtableInv@l
|
||||
rlwimi r30,r7,0x10,0,0xf
|
||||
rlwinm r10,r31,0,0x1c,0x1f
|
||||
and r29,r12,r6
|
||||
rlwinm r12,r8,8,0,0x1f
|
||||
lbzx r11,r3,r11
|
||||
rlwimi r12,r7,8,0,0x17
|
||||
lbzx r7,r3,r10
|
||||
rlwimi r29,r30,0,0x18,0x1f
|
||||
rlwinm r8,r11,4,0,0x1b
|
||||
rlwinm r10,r12,8,0x10,0x17
|
||||
and r11,r29,r5
|
||||
or r10,r11,r10
|
||||
or r7,r8,r7
|
||||
and r11,r31,r6
|
||||
li r8,0
|
||||
rlwimi r11,r7,0,0x18,0x1f
|
||||
and r12,r10,r9
|
||||
rlwinm r10,r11,0x18,0,0x1f
|
||||
li r7,0
|
||||
rlwimi r10,r12,0x18,0,7
|
||||
and r31,r11,r5
|
||||
rlwinm r11,r10,0x1c,0x1c,0x1f
|
||||
and r12,r12,r9
|
||||
rlwinm r10,r10,0,0x1c,0x1f
|
||||
lbzx r11,r3,r11
|
||||
lbzx r10,r3,r10
|
||||
rlwinm r11,r11,4,0,0x1b
|
||||
or r10,r11,r10
|
||||
rlwinm r11,r10,0,0x18,0x1f
|
||||
rlwinm r10,r10,8,0x10,0x17
|
||||
rlwimi r8,r11,8,0x18,0x1f
|
||||
or r10,r31,r10
|
||||
or r8,r12,r8
|
||||
rlwinm r12,r10,0x10,0,0x1f
|
||||
and r11,r10,r4
|
||||
rlwimi r12,r8,0x10,0,0xf
|
||||
and r10,r8,r9
|
||||
rlwinm r8,r12,0x1c,0x1c,0x1f
|
||||
rlwinm r4,r12,0,0x1c,0x1f
|
||||
lbzx r8,r3,r8
|
||||
lbzx r4,r3,r4
|
||||
rlwinm r8,r8,4,0,0x1b
|
||||
or r4,r8,r4
|
||||
rlwinm r8,r4,0,0x18,0x1f
|
||||
rlwinm r4,r4,0x10,8,0xf
|
||||
or r29,r11,r4
|
||||
rlwimi r7,r8,0x10,0x10,0x1f
|
||||
or r11,r10,r7
|
||||
lis r4,1
|
||||
rlwinm r8,r29,8,0,0x1f
|
||||
and r31,r29,r0
|
||||
rlwimi r8,r11,8,0,0x17
|
||||
and r12,r11,r9
|
||||
rlwinm r10,r8,0x1c,0x1c,0x1f
|
||||
subi r0,r4,0x4c4d
|
||||
lbzx r11,r3,r10
|
||||
rlwinm r8,r8,0,0x1c,0x1f
|
||||
lbzx r10,r3,r8
|
||||
li r8,0
|
||||
rlwinm r11,r11,4,0,0x1b
|
||||
lis r7,-0x4c4c
|
||||
or r11,r11,r10
|
||||
rlwinm r10,r11,0,0x18,0x1f
|
||||
subi r7,r7,0x4c4d
|
||||
rlwimi r8,r10,0x18,8,0x1f
|
||||
rlwinm r4,r11,0x18,0,7
|
||||
or r10,r12,r8
|
||||
rlwinm r8,r10,0x1c,0x1c,0x1f
|
||||
or r12,r31,r4
|
||||
rlwinm r4,r10,0,0x1c,0x1f
|
||||
lbzx r8,r3,r8
|
||||
and r11,r10,r6
|
||||
lbzx r4,r3,r4
|
||||
rlwinm r6,r8,4,0,0x1b
|
||||
and r8,r12,r9
|
||||
or r4,r6,r4
|
||||
rlwimi r11,r4,0,0x18,0x1f
|
||||
and r10,r8,r9
|
||||
rlwinm r6,r11,0x14,0x1c,0x1f
|
||||
rlwinm r4,r11,0x18,0x1c,0x1f
|
||||
lbzx r6,r3,r6
|
||||
lbzx r3,r3,r4
|
||||
and r8,r11,r5
|
||||
rlwinm r5,r6,4,0,0x1b
|
||||
and r4,r10,r9
|
||||
or r3,r5,r3
|
||||
rlwinm r3,r3,8,0x10,0x17
|
||||
or r3,r8,r3
|
||||
rlwinm r5,r3,0xa,0xb,0x15
|
||||
rlwinm r3,r3,0x15,0x16,0x1f
|
||||
rlwimi r5,r4,0xa,0x16,0x1f
|
||||
rlwimi r3,r4,0xa,0,0x15
|
||||
xor r4,r3,r7
|
||||
xor r3,r5,r0
|
||||
lwz r31,0x1c(r1)
|
||||
lwz r30,0x18(r1)
|
||||
lwz r29,0x14(r1)
|
||||
addi r1,r1,0x20
|
||||
blr
|
||||
}
|
||||
|
||||
713
libs/RevoEX/src/so/SOCommon.c
Normal file
713
libs/RevoEX/src/so/SOCommon.c
Normal file
@@ -0,0 +1,713 @@
|
||||
#include <revolution/ncd.h>
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/soex.h>
|
||||
|
||||
#include <private/ios.h>
|
||||
#include <private/nwc24/NWC24Schedule.h>
|
||||
#include <private/os/OSTime.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef struct SOSysWork {
|
||||
SOAlloc allocFunc;
|
||||
SOFree freeFunc;
|
||||
s32 rmState;
|
||||
s32 rmFd;
|
||||
u32 unk10;
|
||||
s32 allocCount;
|
||||
} SOSysWork;
|
||||
|
||||
enum {
|
||||
SO_INTERNAL_STATE_TERMINATED = 0,
|
||||
SO_INTERNAL_STATE_READY = 1,
|
||||
SO_INTERNAL_STATE_ACTIVE = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
SO_INTERNAL_RM_STATE_OPENED = 0,
|
||||
SO_INTERNAL_RM_STATE_WORKING = -1,
|
||||
SO_INTERNAL_RM_STATE_CLOSED = -2,
|
||||
};
|
||||
|
||||
enum {
|
||||
SO_SUCCESS = 0,
|
||||
SO_EFATAL = (s32)0x80000000,
|
||||
SO_EAGAIN = -6,
|
||||
SO_EALREADY = -7,
|
||||
SO_EBUSY = -10,
|
||||
SO_EINPROGRESS = -26,
|
||||
SO_EINVAL = -28,
|
||||
SO_ENETRESET = -39,
|
||||
SO_ENOENT = -45,
|
||||
SO_ENOLINK = -48,
|
||||
SO_ENOMEM = -49,
|
||||
SO_ETIMEDOUT = -76,
|
||||
};
|
||||
|
||||
enum {
|
||||
SO_ERR_LINK_UP_TIMEOUT = -121,
|
||||
};
|
||||
|
||||
enum {
|
||||
NCD_LINKSTATUS_WORKING = 1,
|
||||
NCD_LINKSTATUS_NONE = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
NET_SO_SOCKET = 0xF,
|
||||
};
|
||||
|
||||
typedef struct NETSoSocket {
|
||||
int af;
|
||||
int type;
|
||||
int protocol;
|
||||
} NETSoSocket;
|
||||
|
||||
static s32 soRegistered;
|
||||
static s32 soError;
|
||||
static u8 soState;
|
||||
static SOSysWork soWork;
|
||||
|
||||
const char* __SOVersion =
|
||||
"<< RVL_SDK - SO \trelease build: Dec 12 2008 03:06:16 (0x4199_60831) >>";
|
||||
static int soBufAddrCheck = 1;
|
||||
static char NET_RM_SOCK[] = "/dev/net/ip/top";
|
||||
|
||||
extern OSTime __OSGetSystemTime(void);
|
||||
|
||||
static int SOStartupErr(s32 errNwc24, s32 exErr);
|
||||
void* SOiAlloc(u32 name, s32 size);
|
||||
void SOiFree(u32 name, void* ptr, s32 size);
|
||||
int SOiPrepare(const char* funcName, s32* pRmId);
|
||||
int SOiConclude(const char* funcName, int result);
|
||||
int SOiWaitForDHCPEx(int timeout);
|
||||
int SOCleanup(void);
|
||||
int SOiConcludeTempRm(const char* funcName, int result, int isTempRm);
|
||||
|
||||
int SOInit(SOLibraryConfig* config) {
|
||||
int result = 0;
|
||||
int enabled;
|
||||
void* ptr;
|
||||
OSThread* cur;
|
||||
SOSysWork* work;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
if (!soRegistered) {
|
||||
OSRegisterVersion(__SOVersion);
|
||||
soRegistered = 1;
|
||||
}
|
||||
if (!((int)soState == 0 || (int)soState < 0 || (int)soState >= 3)) {
|
||||
result = -7;
|
||||
goto finish;
|
||||
}
|
||||
if (config == NULL || config->alloc == NULL || config->free == NULL) {
|
||||
result = -28;
|
||||
} else {
|
||||
memset(&soWork, 0, sizeof(soWork));
|
||||
soWork.allocFunc = config->alloc;
|
||||
work = &soWork;
|
||||
work->freeFunc = config->free;
|
||||
work->allocCount = 0;
|
||||
work->rmState = -2;
|
||||
work->rmFd = -1;
|
||||
ptr = SOiAlloc(0xB, 0x460);
|
||||
soWork.unk10 = (u32)ptr;
|
||||
if (ptr == NULL) {
|
||||
result = -49;
|
||||
} else {
|
||||
soState = 1;
|
||||
}
|
||||
}
|
||||
finish:
|
||||
cur = OSGetCurrentThread();
|
||||
if (cur != NULL)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOFinish(void) {
|
||||
int result = 0;
|
||||
int enabled = OSDisableInterrupts();
|
||||
OSThread* cur;
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
result = SO_EALREADY;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
if (soWork.rmState > SO_INTERNAL_RM_STATE_CLOSED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (soWork.allocCount > 1) {
|
||||
result = SO_EAGAIN;
|
||||
break;
|
||||
}
|
||||
soState = SO_INTERNAL_STATE_TERMINATED;
|
||||
if (soWork.unk10 != 0 && soWork.freeFunc) {
|
||||
soWork.allocCount--;
|
||||
soWork.freeFunc(0x0b, (void*)soWork.unk10, 0x460);
|
||||
}
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
result = SO_EINPROGRESS;
|
||||
break;
|
||||
}
|
||||
cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOStartup(void) { return SOStartupEx(0x927c0); }
|
||||
|
||||
static int SOStartupErr(s32 errNwc24, s32 exErr) {
|
||||
s32 result = -0x1c;
|
||||
switch (errNwc24) {
|
||||
case 0:
|
||||
result = 0;
|
||||
break;
|
||||
case -0x16:
|
||||
case -0xd:
|
||||
result = -0x30;
|
||||
break;
|
||||
case -0x21:
|
||||
case -2:
|
||||
result = exErr;
|
||||
break;
|
||||
case -1:
|
||||
result = -0x80000000;
|
||||
break;
|
||||
case -0x1d:
|
||||
result = -0x1a;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOStartupEx(int timeout) {
|
||||
int result;
|
||||
int enabled;
|
||||
s32 exErr;
|
||||
s64 limitTime;
|
||||
s32 linkupRetryCount;
|
||||
|
||||
limitTime = 0;
|
||||
if (timeout != 0)
|
||||
limitTime = __OSGetSystemTime() + ((timeout) * ((__OSBusClock / 4) / 1000));
|
||||
|
||||
linkupRetryCount = 4;
|
||||
|
||||
begin_startup:
|
||||
result = SO_SUCCESS;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
default:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
result = SO_EALREADY;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
if (soWork.rmState > SO_INTERNAL_RM_STATE_CLOSED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
} else {
|
||||
int resultNCD;
|
||||
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_WORKING;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
while (1) {
|
||||
resultNCD = NCDGetLinkStatus();
|
||||
if (resultNCD != NCD_RESULT_INPROGRESS &&
|
||||
resultNCD != NCD_LINKSTATUS_WORKING)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
if (resultNCD == NCD_LINKSTATUS_WORKING)
|
||||
result = SO_ERR_LINK_UP_TIMEOUT;
|
||||
else
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
}
|
||||
}
|
||||
if (resultNCD < NCD_RESULT_SUCCESS) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else if (resultNCD == NCD_LINKSTATUS_NONE) {
|
||||
result = SO_ENOENT;
|
||||
goto change_state;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
soWork.rmFd = IOS_Open(NET_RM_SOCK, 0);
|
||||
if (soWork.rmFd != -6)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
}
|
||||
};
|
||||
|
||||
if (soWork.rmFd < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else {
|
||||
s32 errNwc24;
|
||||
|
||||
result = SO_SUCCESS;
|
||||
exErr = SO_SUCCESS;
|
||||
|
||||
while (1) {
|
||||
errNwc24 = NWC24iStartupSocket(&exErr);
|
||||
if (errNwc24 != NWC24_ERR_INPROGRESS)
|
||||
break;
|
||||
OSSleepTicks((((s64)100) * ((__OSBusClock / 4) / 1000)));
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result == SO_SUCCESS)
|
||||
result = SOStartupErr(errNwc24, exErr);
|
||||
if (result != SO_SUCCESS) {
|
||||
if (IOS_Close(soWork.rmFd) < 0) {
|
||||
result = SO_EFATAL;
|
||||
goto change_state;
|
||||
} else {
|
||||
soWork.rmFd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
change_state:
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result == SO_SUCCESS) {
|
||||
soState = SO_INTERNAL_STATE_ACTIVE;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_OPENED;
|
||||
} else {
|
||||
soState = 1;
|
||||
if (result != SO_EFATAL)
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
if (result == 0) {
|
||||
s64 dhcpTimeOutTicks;
|
||||
|
||||
if (limitTime != 0) {
|
||||
dhcpTimeOutTicks = limitTime - __OSGetSystemTime();
|
||||
} else {
|
||||
dhcpTimeOutTicks = 0;
|
||||
}
|
||||
if (limitTime != 0 && dhcpTimeOutTicks <= 0) {
|
||||
result = -76;
|
||||
} else {
|
||||
result = SOiWaitForDHCPEx(
|
||||
(int)((dhcpTimeOutTicks) / ((__OSBusClock / 4) / 1000)));
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
(void)SOCleanup();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
if (result == -112) {
|
||||
linkupRetryCount--;
|
||||
if (linkupRetryCount >= 0) {
|
||||
goto begin_startup;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOCleanup(void) {
|
||||
int result = SO_SUCCESS;
|
||||
int enabled = OSDisableInterrupts();
|
||||
s32 exErr = SO_SUCCESS;
|
||||
int errNwc24;
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
default:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
result = SO_EALREADY;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
if (soWork.rmState < SO_INTERNAL_RM_STATE_OPENED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
} else {
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_WORKING;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
|
||||
errNwc24 = NWC24iCleanupSocket(&exErr);
|
||||
result = SOStartupErr(errNwc24, exErr);
|
||||
if (result != SO_SUCCESS) {
|
||||
} else {
|
||||
if (IOS_Close(soWork.rmFd) < 0)
|
||||
result = SO_EFATAL;
|
||||
else
|
||||
soWork.rmFd = -1;
|
||||
}
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result == SO_SUCCESS) {
|
||||
soState = SO_INTERNAL_STATE_READY;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
} else {
|
||||
if (result != SO_EFATAL) {
|
||||
soState = SO_INTERNAL_STATE_ACTIVE;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_OPENED;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
SOSysWork* SOiGetSysWork(void) { return &soWork; }
|
||||
|
||||
int SOiIsBufferAddrCheck(void) { return soBufAddrCheck; }
|
||||
|
||||
int SOiIsInitialized(void) {
|
||||
int result = 0;
|
||||
int enabled = OSDisableInterrupts();
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
void* SOiAlloc(u32 name, s32 size) {
|
||||
if (size > 0 && soWork.allocFunc) {
|
||||
void* ptr = soWork.allocFunc(name, size);
|
||||
if (ptr) {
|
||||
soWork.allocCount++;
|
||||
if (SOiIsBufferAddrCheck() && !(((u32)ptr & 0x1fffffff) >= 0x10000000 &&
|
||||
((u32)ptr & 0x1fffffff) < 0x18000000)) {
|
||||
if (ptr != NULL && soWork.freeFunc != NULL) {
|
||||
soWork.allocCount--;
|
||||
soWork.freeFunc(name, ptr, size);
|
||||
}
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SOiFree(u32 name, void* ptr, s32 size) {
|
||||
if ((ptr != NULL) && (soWork.freeFunc != NULL)) {
|
||||
soWork.allocCount--;
|
||||
soWork.freeFunc(name, ptr, size);
|
||||
}
|
||||
}
|
||||
|
||||
int SOiPrepare(const char*, s32* pRmId) {
|
||||
int result = SO_SUCCESS;
|
||||
int enabled = OSDisableInterrupts();
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
default:
|
||||
result = SO_EINVAL;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
if (soWork.rmState < SO_INTERNAL_RM_STATE_OPENED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
*pRmId = soWork.rmFd;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result != SO_SUCCESS) {
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOiConclude(const char*, int result) {
|
||||
int enabled = OSDisableInterrupts();
|
||||
OSThread* cur;
|
||||
|
||||
cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOiPrepareTempRm(const char* funcName, s32* pRmId, int* pIsTempRm) {
|
||||
int result = SO_SUCCESS;
|
||||
int enabled = OSDisableInterrupts();
|
||||
int errNwc24;
|
||||
|
||||
switch (soState) {
|
||||
case SO_INTERNAL_STATE_TERMINATED:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case SO_INTERNAL_STATE_READY:
|
||||
default:
|
||||
if (soWork.rmState > SO_INTERNAL_RM_STATE_CLOSED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_WORKING;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
soWork.rmFd = IOS_Open(NET_RM_SOCK, 0);
|
||||
if (soWork.rmFd < 0) {
|
||||
enabled = OSDisableInterrupts();
|
||||
if (soWork.rmFd == -6) {
|
||||
result = SO_EINPROGRESS;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
} else {
|
||||
result = SO_EFATAL;
|
||||
}
|
||||
} else {
|
||||
*pRmId = soWork.rmFd;
|
||||
if ((errNwc24 = NWC24iLockSocket()) == NWC24_OK) {
|
||||
s32 errNcd = NCDGetLinkStatus();
|
||||
switch (errNcd) {
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
result = (int)IOS_Ioctl(soWork.rmFd, 0x1f, NULL, 0, NULL, 0);
|
||||
if (result == SO_SUCCESS) {
|
||||
*pIsTempRm = 1;
|
||||
} else {
|
||||
result = SOiConcludeTempRm(funcName, result, 1);
|
||||
}
|
||||
break;
|
||||
case -8:
|
||||
result = SOiConcludeTempRm(funcName, SO_EINPROGRESS, 1);
|
||||
break;
|
||||
case -1:
|
||||
case -2:
|
||||
result = SOiConcludeTempRm(funcName, SO_EFATAL, 1);
|
||||
break;
|
||||
default:
|
||||
result = SOiConcludeTempRm(funcName, SO_ENOLINK, 1);
|
||||
}
|
||||
enabled = OSDisableInterrupts();
|
||||
} else {
|
||||
switch (errNwc24) {
|
||||
case NWC24_ERR_INPROGRESS:
|
||||
result = SO_EINPROGRESS;
|
||||
break;
|
||||
case NWC24_ERR_FAILED:
|
||||
result = SO_ENETRESET;
|
||||
break;
|
||||
case NWC24_ERR_DONE:
|
||||
result = SO_ENOLINK;
|
||||
break;
|
||||
case NWC24_ERR_MUTEX:
|
||||
case NWC24_ERR_FATAL:
|
||||
default:
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
if (IOS_Close(soWork.rmFd) < 0) {
|
||||
result = SO_EFATAL;
|
||||
}
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result != SO_EFATAL) {
|
||||
soWork.rmFd = -1;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SO_INTERNAL_STATE_ACTIVE:
|
||||
if (soWork.rmState < SO_INTERNAL_RM_STATE_OPENED) {
|
||||
result = SO_EBUSY;
|
||||
break;
|
||||
} else if (!OSGetCurrentThread()) {
|
||||
result = SO_EFATAL;
|
||||
break;
|
||||
}
|
||||
*pIsTempRm = 0;
|
||||
*pRmId = soWork.rmFd;
|
||||
break;
|
||||
}
|
||||
|
||||
if (result != SO_SUCCESS) {
|
||||
OSThread* cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
}
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOiConcludeTempRm(const char*, int result, int isTempRm) {
|
||||
int enabled;
|
||||
OSThread* cur;
|
||||
|
||||
if (isTempRm == 1) {
|
||||
switch (NWC24iUnlockSocket()) {
|
||||
case NWC24_OK:
|
||||
break;
|
||||
case NWC24_ERR_INPROGRESS:
|
||||
result = SO_EINPROGRESS;
|
||||
break;
|
||||
case NWC24_ERR_FATAL:
|
||||
default:
|
||||
result = SO_EFATAL;
|
||||
}
|
||||
if (IOS_Close(soWork.rmFd) < 0) {
|
||||
result = SO_EFATAL;
|
||||
}
|
||||
enabled = OSDisableInterrupts();
|
||||
if (result != SO_EFATAL) {
|
||||
soWork.rmFd = -1;
|
||||
soWork.rmState = SO_INTERNAL_RM_STATE_CLOSED;
|
||||
}
|
||||
} else {
|
||||
enabled = OSDisableInterrupts();
|
||||
}
|
||||
cur = OSGetCurrentThread();
|
||||
if (cur)
|
||||
cur->error = result;
|
||||
else
|
||||
soError = result;
|
||||
(void)OSRestoreInterrupts(enabled);
|
||||
return result;
|
||||
}
|
||||
|
||||
int SOiWaitForDHCPEx(int timeout) {
|
||||
int result = SO_SUCCESS;
|
||||
int gioResult;
|
||||
int ifError;
|
||||
int ifErrorSize;
|
||||
s64 limitTime;
|
||||
|
||||
limitTime = 0;
|
||||
if (timeout != 0)
|
||||
limitTime = __OSGetSystemTime() + ((timeout) * ((__OSBusClock / 4) / 1000));
|
||||
|
||||
while (1) {
|
||||
OSSleepTicks((((s64)10) * ((__OSBusClock / 4) / 1000)));
|
||||
|
||||
ifErrorSize = sizeof(ifError);
|
||||
gioResult = SOGetInterfaceOpt(NULL, 0xfffe, 0x1003, &ifError, &ifErrorSize);
|
||||
if (gioResult != SO_SUCCESS) {
|
||||
result = gioResult;
|
||||
break;
|
||||
}
|
||||
if (gioResult == SO_SUCCESS && ifError != SO_SUCCESS) {
|
||||
result = ifError;
|
||||
break;
|
||||
}
|
||||
if (SOGetHostID() != 0)
|
||||
break;
|
||||
if (limitTime != 0 && limitTime < __OSGetSystemTime()) {
|
||||
result = SO_ETIMEDOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma dont_inline on
|
||||
int __SOCreateSocket(int pf, int type, int protocol) {
|
||||
int result;
|
||||
s32 rmId;
|
||||
NETSoSocket* soc;
|
||||
|
||||
if ((result = SOiPrepare(0, &rmId)) == SO_SUCCESS) {
|
||||
if (pf == 0x17) {
|
||||
result = -5;
|
||||
} else {
|
||||
soc = (NETSoSocket*)SOiAlloc(0xC, 0x20);
|
||||
if (soc == NULL) {
|
||||
result = SO_ENOMEM;
|
||||
} else {
|
||||
soc->af = pf;
|
||||
soc->type = type;
|
||||
soc->protocol = protocol;
|
||||
result = IOS_Ioctl(rmId, NET_SO_SOCKET, soc, 0xC, NULL, 0);
|
||||
SOiFree(0xC, soc, 0x20);
|
||||
}
|
||||
}
|
||||
result = SOiConclude(0, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#pragma dont_inline reset
|
||||
@@ -25,7 +25,7 @@ enum {
|
||||
|
||||
#define MAX_IOS_VECS 4
|
||||
|
||||
SDKDefineVersionEx(SSL, "Jun 21 2007", "13:10:10", 60726);
|
||||
const char* __SSLVersion = "<< RVL_SDK - SSL \trelease build: Jun 21 2007 13:10:10 (0x4199_60726) >>";
|
||||
|
||||
static BOOL sslRegistered = FALSE;
|
||||
static s32 l_initialized = 0;
|
||||
@@ -547,3 +547,10 @@ static u32 SSL_strnlen(const char* s, u32 n) {
|
||||
}
|
||||
return t - s;
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section data_type ".data"
|
||||
#pragma pop
|
||||
#pragma push
|
||||
#pragma section data_type ".sdata"
|
||||
#pragma pop
|
||||
|
||||
@@ -385,7 +385,7 @@ VFErr VFSysSetSyncMode(s32 i_handle_idx, u32 i_mode) {
|
||||
return VF_ERR_SYSTEM;
|
||||
}
|
||||
|
||||
u32 VFSysGetSyncMode(s32 i_handle_idx) {
|
||||
static u32 VFSysGetSyncMode(s32 i_handle_idx) {
|
||||
VFSys_handle* handle_p = VFSysGetHandleP(i_handle_idx);
|
||||
|
||||
if (handle_p == NULL || handle_p->drive.pf_disk_p == NULL || handle_p->device_p == NULL) {
|
||||
@@ -541,7 +541,7 @@ s32 VFSysHandleP2Idx(VFSys_handle* i_handle_p) {
|
||||
return VF_ERR_SYSTEM;
|
||||
}
|
||||
|
||||
VFSys_handle* VFSysVol2HandleP(PF_VOLUME* i_vol_p) {
|
||||
static VFSys_handle* VFSysVol2HandleP(PF_VOLUME* i_vol_p) {
|
||||
if (i_vol_p != NULL) {
|
||||
VFSys_handle* handle_p = VFSysGetHandleP(0);
|
||||
VFSys_handle* handle_end_p = &handle_p[l_vfsys_vol_max];
|
||||
@@ -728,7 +728,7 @@ static void VFiSysClearDeviceSDDirect(VFSys_deviceSD* o_sd_p) {
|
||||
o_sd_p->slotNo = -1;
|
||||
}
|
||||
|
||||
VFSys_device* VFSysGetDeviceP(s32 i_idx) {
|
||||
static VFSys_device* VFSysGetDeviceP(s32 i_idx) {
|
||||
VFSys_handle* handle_p = VFSysGetHandleP(i_idx);
|
||||
if (handle_p != NULL) {
|
||||
return handle_p->device_p;
|
||||
@@ -1170,7 +1170,7 @@ static VFErr VFiSysGetLastDeviceError_common(VFSys_handle* i_handle_p) {
|
||||
return VF_ERR_SYSTEM;
|
||||
}
|
||||
|
||||
void VFSysSetDevErrInfo(s32 i_handle_idx, VFErr i_err) {
|
||||
static void VFSysSetDevErrInfo(s32 i_handle_idx, VFErr i_err) {
|
||||
VFSys_handle* handle_p = VFSysGetHandleP(i_handle_idx);
|
||||
if (handle_p != NULL) {
|
||||
VFiSysSetDeviceErrInfo(handle_p, i_err);
|
||||
|
||||
@@ -134,7 +134,7 @@ static u32 _EventFlagAddressToHandleIdx(u32* event /* r3 */) {
|
||||
int i; // r31
|
||||
|
||||
for (i = 0; i < 0x1A; i++) {
|
||||
if ((u32*)((u8*)l_event + (i << 5)) == event) {
|
||||
if (&l_event[i].flag == event) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -157,12 +157,12 @@ SDDevIntrCallback _EventCallBack(u32 status /* r25 */, u32* data /* r27 */) {
|
||||
handle_p = VFSysGetHandleP(handleIdx);
|
||||
if ((u32)(status & 2) == 2) {
|
||||
*data = 1;
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r26
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r29
|
||||
VFipdm_disk_notify_media_eject(pf_disk_p);
|
||||
if ((device_p != NULL) && ((device_p->eventCallback) != NULL)) {
|
||||
if (((u32)device_p != 0) && ((u32)device_p->eventCallback != 0)) {
|
||||
device_p->eventCallback(2);
|
||||
}
|
||||
}
|
||||
@@ -170,23 +170,23 @@ SDDevIntrCallback _EventCallBack(u32 status /* r25 */, u32* data /* r27 */) {
|
||||
}
|
||||
if ((u32)(status & 1) == 1) {
|
||||
*data = 2;
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r31+0x14
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r28
|
||||
if ((device_p != NULL) && ((device_p->eventCallback) != NULL)) {
|
||||
if (((u32)device_p != 0) && ((u32)device_p->eventCallback != 0)) {
|
||||
device_p->eventCallback(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (handle_p != NULL) {
|
||||
if ((u32)handle_p != 0) {
|
||||
PDM_DISK* pf_disk_p = handle_p->drive.pf_disk_p; // r31+0x10
|
||||
if (pf_disk_p != NULL) {
|
||||
if ((u32)pf_disk_p != 0) {
|
||||
VFSys_deviceSD* device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(pf_disk_p); // r31+0xC
|
||||
if (device_p != NULL) {
|
||||
if ((u32)device_p != 0) {
|
||||
SDDev* dev_handle_p = (&device_p->drive); // r31+0x8
|
||||
if (dev_handle_p != NULL) {
|
||||
if ((u32)dev_handle_p != 0) {
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, data);
|
||||
if (IOSErr != 0) {
|
||||
u32 stub = 0;
|
||||
@@ -273,12 +273,12 @@ static s32 sddrv_init(PDM_DISK* p_disk /* r28 */) {
|
||||
drive_p = NULL;
|
||||
device_p = NULL;
|
||||
dev_handle_p = NULL;
|
||||
if (p_disk == NULL) {
|
||||
if ((u32)p_disk == 0) {
|
||||
return -0x14;
|
||||
}
|
||||
drive_p = VFSysPDMDisk2DriveP(p_disk);
|
||||
device_p = (VFSys_deviceSD*)VFSysPDMDisk2DeviceP(p_disk);
|
||||
if ((drive_p == NULL) || (device_p == NULL)) {
|
||||
if (((u32)drive_p == 0) || ((u32)device_p == 0)) {
|
||||
return -0x14;
|
||||
}
|
||||
dev_handle_p = &device_p->drive;
|
||||
@@ -316,8 +316,8 @@ static s32 sddrv_init(PDM_DISK* p_disk /* r28 */) {
|
||||
ISD_UnmountCard(dev_handle_p);
|
||||
return IOSErr;
|
||||
}
|
||||
*(u32*)((u8*)l_event + (handleIdx << 5)) = 2;
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, (u32*)((u8*)l_event + (handleIdx << 5)));
|
||||
l_event[handleIdx].flag = 2;
|
||||
IOSErr = ISD_RegisterDeviceIntrHandler(dev_handle_p, (SDDevIntrCallback)_EventCallBack, &l_event[handleIdx].flag);
|
||||
if (IOSErr != 0) {
|
||||
VFi_PrintInternalError(IOSErr, 0x1ED);
|
||||
dCommon_setLastDeviceErrorToDisk(p_disk, IOSErr);
|
||||
|
||||
@@ -8,6 +8,41 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
const u8 lbl_81695060 = 0;
|
||||
const u8 lbl_81695061 = 0x0F;
|
||||
const u8 lbl_81695062 = 0xAC;
|
||||
const u8 lbl_81695063 = 0;
|
||||
const u8 lbl_81695064 = 0;
|
||||
const u8 lbl_81695065 = 0x50;
|
||||
const u8 lbl_81695066 = 0xF2;
|
||||
const u8 lbl_81695067 = 0;
|
||||
#pragma pop
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata"
|
||||
const u8 lbl_81697D70 = 0;
|
||||
const u8 lbl_81697D71 = 0x50;
|
||||
const u8 lbl_81697D72 = 0xF2;
|
||||
const u8 lbl_81697D73 = 0;
|
||||
const u8 lbl_81697D74 = 0;
|
||||
const u8 lbl_81697D75 = 0;
|
||||
const u8 lbl_81697D76 = 0;
|
||||
const u8 lbl_81697D77 = 0;
|
||||
#pragma pop
|
||||
|
||||
#define lbl_81695060 (*((volatile const u8*)&lbl_81695060))
|
||||
#define lbl_81695061 (*((volatile const u8*)&lbl_81695061))
|
||||
#define lbl_81695062 (*((volatile const u8*)&lbl_81695062))
|
||||
#define lbl_81695064 (*((volatile const u8*)&lbl_81695064))
|
||||
#define lbl_81695065 (*((volatile const u8*)&lbl_81695065))
|
||||
#define lbl_81695066 (*((volatile const u8*)&lbl_81695066))
|
||||
#define lbl_81697D70 (*((volatile const u8*)&lbl_81697D70))
|
||||
#define lbl_81697D71 (*((volatile const u8*)&lbl_81697D71))
|
||||
#define lbl_81697D72 (*((volatile const u8*)&lbl_81697D72))
|
||||
extern void _savegpr_21();
|
||||
extern void _restgpr_21();
|
||||
|
||||
#define WAIT_FOR_OPERATION(...) \
|
||||
do { \
|
||||
while ((__VA_ARGS__)) { \
|
||||
@@ -134,56 +169,104 @@ s32 WDScanOnce(u8* scanBuffer, u32 scanBufferLen, WDScanParam* param) {
|
||||
s32 WDGetPrivacyMode(WDBssDesc* bssDesc) {
|
||||
WDVendorInfoElement* ieData;
|
||||
u32 ieLength = 0;
|
||||
WDVendorInfoElement readIE;
|
||||
u8 readIE[8];
|
||||
s32 result;
|
||||
|
||||
if (WDFindInformationElement((WDInfoElement**)&ieData, &ieLength, bssDesc, 0x30)) {
|
||||
u8 data[WD_VENDOR_LENGTH] = {0, 0x0F, 0xAC};
|
||||
u8 data[WD_VENDOR_LENGTH];
|
||||
|
||||
memcpy(&readIE, ieData, sizeof(WDVendorInfoElement) + 2 /*?*/);
|
||||
if (memcmp(readIE.data, data, WD_VENDOR_LENGTH) == 0) {
|
||||
switch (readIE.mode) {
|
||||
case 1: {
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
}
|
||||
case 5: {
|
||||
return WD_PRIVACY_MODE_2;
|
||||
}
|
||||
case 2: {
|
||||
return WD_PRIVACY_MODE_7;
|
||||
}
|
||||
case 3:
|
||||
default: {
|
||||
return WD_PRIVACY_MODE_5;
|
||||
}
|
||||
data[0] = lbl_81695060;
|
||||
data[1] = lbl_81695061;
|
||||
data[2] = lbl_81695062;
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement) + 2);
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) == 0) {
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_second;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_rsn_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_rsn_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_rsn_mode7;
|
||||
}
|
||||
goto privacy_second;
|
||||
privacy_rsn_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_rsn_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_second;
|
||||
}
|
||||
goto privacy_rsn_mode5;
|
||||
}
|
||||
} else {
|
||||
u8 findData[WD_VENDOR_LENGTH] = {0x00, 0x50, 0xF2};
|
||||
if (WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
u8 data[WD_VENDOR_LENGTH] = {0x00, 0x50, 0xF2};
|
||||
}
|
||||
goto privacy_second;
|
||||
|
||||
memcpy(&readIE, ieData, sizeof(WDVendorInfoElement));
|
||||
if (memcmp(readIE.data, data, WD_VENDOR_LENGTH) == 0) {
|
||||
switch (readIE.mode) {
|
||||
case 1: {
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
}
|
||||
case 5: {
|
||||
return WD_PRIVACY_MODE_2;
|
||||
}
|
||||
case 2: {
|
||||
return WD_PRIVACY_MODE_4;
|
||||
}
|
||||
case 3:
|
||||
default: {
|
||||
return WD_PRIVACY_MODE_6;
|
||||
}
|
||||
}
|
||||
privacy_rsn_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_rsn_mode7:
|
||||
return WD_PRIVACY_MODE_7;
|
||||
privacy_rsn_mode5:
|
||||
return WD_PRIVACY_MODE_5;
|
||||
privacy_rsn_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_second: {
|
||||
u8 data[WD_VENDOR_LENGTH];
|
||||
u8 findData[WD_VENDOR_LENGTH];
|
||||
|
||||
findData[0] = lbl_81697D70;
|
||||
findData[1] = lbl_81697D71;
|
||||
findData[2] = lbl_81697D72;
|
||||
if (!WDiFindVendorSpecificIE(&ieData, &ieLength, bssDesc, 0xDD, findData, 1)) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
data[0] = lbl_81695064;
|
||||
data[1] = lbl_81695065;
|
||||
data[2] = lbl_81695066;
|
||||
|
||||
{
|
||||
memcpy(readIE, ieData, sizeof(WDVendorInfoElement));
|
||||
if (memcmp(&readIE[2], data, WD_VENDOR_LENGTH) != 0) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
if ((s32)readIE[5] == 3) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
if ((s32)readIE[5] >= 3) {
|
||||
goto privacy_wpa_high;
|
||||
}
|
||||
if ((s32)readIE[5] == 1) {
|
||||
goto privacy_wpa_mode1;
|
||||
}
|
||||
if ((s32)readIE[5] >= 1) {
|
||||
goto privacy_wpa_mode4;
|
||||
}
|
||||
goto privacy_fallback;
|
||||
privacy_wpa_high:
|
||||
if ((s32)readIE[5] == 5) {
|
||||
goto privacy_wpa_mode2;
|
||||
}
|
||||
if ((s32)readIE[5] >= 5) {
|
||||
goto privacy_fallback;
|
||||
}
|
||||
goto privacy_wpa_mode6;
|
||||
}
|
||||
}
|
||||
|
||||
privacy_wpa_mode1:
|
||||
return WD_PRIVACY_MODE_DS_COMMUNICATION;
|
||||
privacy_wpa_mode4:
|
||||
return WD_PRIVACY_MODE_4;
|
||||
privacy_wpa_mode6:
|
||||
return WD_PRIVACY_MODE_6;
|
||||
privacy_wpa_mode2:
|
||||
return WD_PRIVACY_MODE_2;
|
||||
|
||||
privacy_fallback:
|
||||
if (bssDesc != NULL && (bssDesc->capabilities & 0x10) == 0x10) {
|
||||
result = WD_PRIVACY_MODE_8;
|
||||
} else {
|
||||
@@ -227,39 +310,80 @@ BOOL WDFindInformationElement(WDInfoElement** outIE, u32* outIELength, WDBssDesc
|
||||
return found;
|
||||
}
|
||||
|
||||
BOOL WDiFindVendorSpecificIE(WDVendorInfoElement** outIE, u32* outIELength, WDBssDesc* bssDesc, int id, u8* data, u8 mode) {
|
||||
BOOL found = FALSE;
|
||||
|
||||
if (bssDesc != NULL) {
|
||||
u8* ptr = (u8*)(bssDesc + 1);
|
||||
WDVendorInfoElement* infoElement = (WDVendorInfoElement*)ptr;
|
||||
int offset;
|
||||
|
||||
for (offset = 0; offset < bssDesc->ieLength; offset = (infoElement->length + offset) + sizeof(WDInfoElement)) {
|
||||
u8 gotMode;
|
||||
infoElement = (WDVendorInfoElement*)((u8*)ptr + offset);
|
||||
if (infoElement->id != (u32)id || (gotMode = infoElement->mode, memcmp(infoElement->data, data, WD_VENDOR_LENGTH)) || gotMode != mode) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (offset < bssDesc->ieLength) {
|
||||
if (outIE != NULL) {
|
||||
*outIE = infoElement + 1;
|
||||
}
|
||||
if (outIELength != NULL) {
|
||||
*outIELength = infoElement->length - (sizeof(WDVendorInfoElement) - sizeof(WDInfoElement));
|
||||
}
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (outIE != NULL) {
|
||||
*outIE = NULL;
|
||||
}
|
||||
if (outIELength != NULL) {
|
||||
*outIELength = 0;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
asm BOOL WDiFindVendorSpecificIE(WDVendorInfoElement** outIE, u32* outIELength, WDBssDesc* bssDesc, int id, u8* data, u8 mode) {
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
mflr r0
|
||||
stw r0, 0x44(r1)
|
||||
addi r11, r1, 0x40
|
||||
bl _savegpr_21
|
||||
cmpwi r5, 0
|
||||
mr r30, r3
|
||||
mr r31, r4
|
||||
mr r21, r6
|
||||
mr r22, r7
|
||||
mr r23, r8
|
||||
li r28, 0
|
||||
beq WDiFindVendorSpecificIE_done
|
||||
addi r26, r5, 0x3e
|
||||
lhz r29, 0x3c(r5)
|
||||
mr r25, r26
|
||||
li r27, 0
|
||||
b WDiFindVendorSpecificIE_loop_check
|
||||
WDiFindVendorSpecificIE_loop:
|
||||
lbzx r0, r26, r27
|
||||
add r25, r26, r27
|
||||
cmplw r0, r21
|
||||
bne WDiFindVendorSpecificIE_next
|
||||
lbz r24, 5(r25)
|
||||
mr r4, r22
|
||||
addi r3, r25, 2
|
||||
li r5, 3
|
||||
bl memcmp
|
||||
cmpwi r3, 0
|
||||
bne WDiFindVendorSpecificIE_next
|
||||
cmplw r24, r23
|
||||
beq WDiFindVendorSpecificIE_found
|
||||
WDiFindVendorSpecificIE_next:
|
||||
lbz r0, 1(r25)
|
||||
add r3, r0, r27
|
||||
addi r27, r3, 2
|
||||
WDiFindVendorSpecificIE_loop_check:
|
||||
cmpw r27, r29
|
||||
blt WDiFindVendorSpecificIE_loop
|
||||
WDiFindVendorSpecificIE_found:
|
||||
cmpw r27, r29
|
||||
bge WDiFindVendorSpecificIE_done
|
||||
cmpwi r30, 0
|
||||
beq WDiFindVendorSpecificIE_no_out
|
||||
addi r0, r25, 6
|
||||
stw r0, 0(r30)
|
||||
WDiFindVendorSpecificIE_no_out:
|
||||
cmpwi r31, 0
|
||||
beq WDiFindVendorSpecificIE_set_found
|
||||
lbz r3, 1(r25)
|
||||
addi r0, r3, -4
|
||||
stw r0, 0(r31)
|
||||
WDiFindVendorSpecificIE_set_found:
|
||||
li r28, 1
|
||||
WDiFindVendorSpecificIE_done:
|
||||
cmpwi r28, 0
|
||||
bne WDiFindVendorSpecificIE_return
|
||||
cmpwi r30, 0
|
||||
beq WDiFindVendorSpecificIE_no_out_null
|
||||
li r0, 0
|
||||
stw r0, 0(r30)
|
||||
WDiFindVendorSpecificIE_no_out_null:
|
||||
cmpwi r31, 0
|
||||
beq WDiFindVendorSpecificIE_return
|
||||
li r0, 0
|
||||
stw r0, 0(r31)
|
||||
WDiFindVendorSpecificIE_return:
|
||||
addi r11, r1, 0x40
|
||||
mr r3, r28
|
||||
bl _restgpr_21
|
||||
lwz r0, 0x44(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x40
|
||||
blr
|
||||
}
|
||||
|
||||
@@ -80,6 +80,10 @@ SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_P
|
||||
mThreadRunning = false;
|
||||
}
|
||||
|
||||
WaveFileAiff::~WaveFileAiff() {}
|
||||
|
||||
WaveFileWav::~WaveFileWav() {}
|
||||
|
||||
SimpleWavePlayer::~SimpleWavePlayer() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
#include <revolution/gx/GXStruct.h>
|
||||
#include <revolution/os/OSError.h>
|
||||
|
||||
extern "C" const char lbl_8166A6E3[];
|
||||
extern "C" const u8 lbl_81697844;
|
||||
extern "C" const u8 lbl_81697845;
|
||||
extern "C" const u8 lbl_81697846;
|
||||
extern "C" const u8 lbl_81697847;
|
||||
|
||||
#define NW4R_DB_ASSERT_H
|
||||
#define NW4R_ASSERT(x) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
GXColor front = {lbl_81697844, lbl_81697845, lbl_81697846, lbl_81697847}; \
|
||||
GXColor back = {0, 0, 0, 0}; \
|
||||
OSFatal((GXColor)front, (GXColor)back, lbl_8166A6E3); \
|
||||
} \
|
||||
}
|
||||
|
||||
#include "channelScript/iplCSLibrary.h"
|
||||
|
||||
#include "iplSystem.h"
|
||||
@@ -10,7 +29,9 @@
|
||||
|
||||
#include "math/iplMathTypes.h"
|
||||
|
||||
extern f32 lbl_81694FC0;
|
||||
extern "C" const f32 lbl_81694FC0 = 0.0f;
|
||||
|
||||
extern "C" nw4r::ut::Color GetTextColor__Q34nw4r3lyt7TextBoxCFUl(const nw4r::lyt::TextBox*, u32);
|
||||
|
||||
namespace ipl {
|
||||
namespace cs {
|
||||
@@ -393,7 +414,7 @@ namespace ipl {
|
||||
CHANSVmObjHdr* arg = CHANSVmGetArgInteger(VmInst, 0);
|
||||
if (box != NULL && argc == 1 && arg != NULL) {
|
||||
if (arg->value.int_v < 4ULL) {
|
||||
result = color::_ctor(VmInst, VmReturnObj, (nw4r::ut::Color) static_cast<u32>(box->GetTextColor(arg->value.int_v))) == TRUE;
|
||||
result = color::_ctor(VmInst, VmReturnObj, (nw4r::ut::Color) static_cast<u32>(GetTextColor__Q34nw4r3lyt7TextBoxCFUl(box, arg->value.int_v))) == TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,3 +616,22 @@ namespace ipl {
|
||||
} // namespace pane
|
||||
} // namespace cs
|
||||
} // namespace ipl
|
||||
|
||||
namespace ipl {
|
||||
namespace cs {
|
||||
namespace pane {
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char lbl_8166A6E3[] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
#pragma pop
|
||||
|
||||
#pragma push
|
||||
#pragma section data_type ".sdata"
|
||||
extern "C" __declspec(section ".sdata") const u8 lbl_81697844 = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 lbl_81697845 = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 lbl_81697846 = 0xff;
|
||||
extern "C" __declspec(section ".sdata") const u8 lbl_81697847 = 0;
|
||||
#pragma pop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ static MEMAllocator sAllocator;
|
||||
static MEMAllocator* spAllocator = &sAllocator;
|
||||
|
||||
void* HBMAllocMem(u32 size) {
|
||||
return MEMAllocFromAllocator(spAllocator, size);
|
||||
void* addr = MEMAllocFromAllocator(spAllocator, size);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void HBMFreeMem(void* pBlock) {
|
||||
@@ -124,17 +126,6 @@ BOOL HBMIsReassignedControllers() {
|
||||
|
||||
/* THE LOGIC */
|
||||
|
||||
extern const f32 lbl_816946D8;
|
||||
extern const f32 lbl_81694748;
|
||||
extern const f32 lbl_81694744;
|
||||
extern const f32 lbl_816946DC;
|
||||
extern const f32 lbl_81694754;
|
||||
extern volatile const f32 lbl_8169474C;
|
||||
extern volatile const f32 lbl_81694750;
|
||||
|
||||
extern const f32 lbl_81694714;
|
||||
extern const f32 lbl_81694710;
|
||||
|
||||
namespace homebutton {
|
||||
static void SimpleSyncCallback(s32 result, s32 num);
|
||||
|
||||
@@ -156,16 +147,6 @@ namespace homebutton {
|
||||
|
||||
HomeButton* HomeButton::spHomeButtonObj = NULL;
|
||||
|
||||
const int HomeButton::scReConnectTime = 3600;
|
||||
const int HomeButton::scReConnectTime2 = 3570;
|
||||
const int HomeButton::scPadDrawWaitTime = 5;
|
||||
const int HomeButton::scGetPadInfoTime = 100;
|
||||
const int HomeButton::scForcusSEWaitTime = 2;
|
||||
const f32 HomeButton::scOnPaneVibTime = 3.0f;
|
||||
const f32 HomeButton::scOnPaneVibWaitTime = 9.0f;
|
||||
const int HomeButton::scWaitStopMotorTime = 30;
|
||||
const int HomeButton::scWaitDisConnectTime = 180;
|
||||
|
||||
const char* HomeButton::scCursorLytName[res::eCursorLyt_Max] = {
|
||||
"P1_Def.brlyt",
|
||||
"P2_Def.brlyt",
|
||||
@@ -616,8 +597,8 @@ namespace homebutton {
|
||||
mpController[i]->initCallback();
|
||||
mpController[i]->initSound();
|
||||
|
||||
mOnPaneVibFrame[i] = ::lbl_816946D8;
|
||||
mOnPaneVibWaitFrame[i] = ::lbl_816946D8;
|
||||
mOnPaneVibFrame[i] = 0.0f;
|
||||
mOnPaneVibWaitFrame[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -638,7 +619,7 @@ namespace homebutton {
|
||||
|
||||
if (mpSoundArchivePlayer != NULL) {
|
||||
for (i = 0; i < mpSoundArchivePlayer->GetSoundPlayerCount(); i++) {
|
||||
mpSoundArchivePlayer->GetSoundPlayer(i).SetVolume(::lbl_816946DC);
|
||||
mpSoundArchivePlayer->GetSoundPlayer(i).SetVolume(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,7 +779,7 @@ namespace homebutton {
|
||||
if (mOnPaneVibFrame[i] <= 0.0f || mState == 17) {
|
||||
getController(i)->stopMotor();
|
||||
mOnPaneVibFrame[i] = 0.0f;
|
||||
mOnPaneVibWaitFrame[i] = scOnPaneVibWaitTime;
|
||||
mOnPaneVibWaitFrame[i] = 9.0f;
|
||||
}
|
||||
}
|
||||
} else if (mOnPaneVibWaitFrame[i] > 0.0f) {
|
||||
@@ -1271,20 +1252,6 @@ namespace homebutton {
|
||||
}
|
||||
}
|
||||
|
||||
void HomeButton::calc_letter() {
|
||||
if (mLetterFlag && !mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->isPlaying()) {
|
||||
mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(true);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->setAnmType(ANIM_TYPE_LOOP);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->play();
|
||||
} else if (!mLetterFlag) {
|
||||
mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(false);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void HomeButton::calc_battery(int chan) {
|
||||
for (int i = 0; i < res::eBatteryPane_Max; i++) {
|
||||
if (i < mWpadInfo[chan].battery) {
|
||||
@@ -1311,6 +1278,20 @@ namespace homebutton {
|
||||
getController(chan)->clrBatteryFlag();
|
||||
}
|
||||
|
||||
void HomeButton::calc_letter() {
|
||||
if (mLetterFlag && !mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->isPlaying()) {
|
||||
mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(true);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->setAnmType(ANIM_TYPE_LOOP);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->play();
|
||||
} else if (!mLetterFlag) {
|
||||
mpLayout->GetRootPane()->FindPaneByName(scFuncPaneName[res::eFuncPane_let_icn_00], true)->SetVisible(false);
|
||||
|
||||
mpPairGroupAnmController[res::ePairAnm_ltrIcn_on]->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void HomeButton::draw() {
|
||||
mpLayout->Draw(mDrawInfo);
|
||||
|
||||
@@ -1475,13 +1456,12 @@ namespace homebutton {
|
||||
nw4r::math::VEC3 vec;
|
||||
|
||||
if (pController->wiiCon[i].use_devtype == WPAD_DEV_CLASSIC && pController->wiiCon[i].kpad->dev_type == WPAD_DEV_CLASSIC) {
|
||||
vec = nw4r::math::VEC3(lbl_816946D8, lbl_816946D8,
|
||||
*((volatile const f32*)&lbl_81694710));
|
||||
vec = nw4r::math::VEC3(0.0f, 0.0f, 15.0f);
|
||||
} else {
|
||||
Vec2 v = pController->wiiCon[i].kpad->horizon;
|
||||
f32 rad = nw4r::math::Atan2FIdx(-v.y, v.x) * lbl_81694714;
|
||||
f32 rad = nw4r::math::Atan2FIdx(-v.y, v.x) * 1.40625f;
|
||||
|
||||
vec = nw4r::math::VEC3(lbl_816946D8, lbl_816946D8, rad);
|
||||
vec = nw4r::math::VEC3(0.0f, 0.0f, rad);
|
||||
}
|
||||
|
||||
if (!mpHBInfo->cursor) {
|
||||
@@ -1933,8 +1913,8 @@ namespace homebutton {
|
||||
}
|
||||
|
||||
if (onFlag && pController != NULL) {
|
||||
if (!getController(pController->chan)->isRumbling() && mOnPaneVibWaitFrame[pController->chan] <= ::lbl_816946D8) {
|
||||
mOnPaneVibFrame[pController->chan] = ::lbl_81694744;
|
||||
if (!getController(pController->chan)->isRumbling() && mOnPaneVibWaitFrame[pController->chan] <= 0.0f) {
|
||||
mOnPaneVibFrame[pController->chan] = 3.0f;
|
||||
getController(pController->chan)->startMotor();
|
||||
}
|
||||
}
|
||||
@@ -2388,10 +2368,10 @@ namespace homebutton {
|
||||
void HomeButton::reset_guiManager(int num) {
|
||||
if (num < 0) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mpPaneManager->update(i, ::lbl_81694748, ::lbl_81694748, 0, 0, 0, NULL);
|
||||
mpPaneManager->update(i, -10000.0f, -10000.0f, 0, 0, 0, NULL);
|
||||
}
|
||||
} else {
|
||||
mpPaneManager->update(num, ::lbl_81694748, ::lbl_81694748, 0, 0, 0, NULL);
|
||||
mpPaneManager->update(num, -10000.0f, -10000.0f, 0, 0, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2500,7 +2480,7 @@ namespace homebutton {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scale = nw4r::math::VEC2(::lbl_816946DC, ::lbl_816946DC);
|
||||
scale = nw4r::math::VEC2(1.0f, 1.0f);
|
||||
mpLayout->GetRootPane()->SetScale(scale);
|
||||
|
||||
if (!mpHBInfo->cursor) {
|
||||
@@ -2645,14 +2625,9 @@ namespace homebutton {
|
||||
|
||||
initgx();
|
||||
GXColor clr = {red_, green_, blue_, alpha};
|
||||
drawBlackPlate(::lbl_8169474C, ::lbl_8169474C, ::lbl_81694750, ::lbl_81694750, clr);
|
||||
drawBlackPlate(-1000.0f, -1000.0f, 1000.0f, 1000.0f, clr);
|
||||
}
|
||||
|
||||
const int HomeButton::scSoundHeapSize_but2 = 0x60000;
|
||||
const int HomeButton::scSoundHeapSize_but3 = 0x6f800;
|
||||
const int HomeButton::scSoundThreadPrio = 4;
|
||||
const int HomeButton::scDvdThreadPrio = 3;
|
||||
|
||||
void HomeButton::update_sound() {
|
||||
if (mpSoundArchivePlayer != NULL) {
|
||||
mpSoundArchivePlayer->Update();
|
||||
@@ -2684,7 +2659,7 @@ namespace homebutton {
|
||||
}
|
||||
|
||||
if (mEndInitSoundFlag) {
|
||||
AXSetAuxAReturnVolume(lbl_81694754 * gain);
|
||||
AXSetAuxAReturnVolume(32768.0f * gain);
|
||||
}
|
||||
|
||||
if (mpSoundArchivePlayer != NULL) {
|
||||
|
||||
@@ -595,5 +595,23 @@ namespace ext_ead {
|
||||
}
|
||||
}
|
||||
|
||||
BrowserThread::CmdPacket& BrowserThread::CmdPacket::operator=(const BrowserThread::CmdPacket& other) {
|
||||
type = other.type;
|
||||
data = other.data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ImeData& ImeData::operator=(const ImeData& other) {
|
||||
unk_0x00 = other.unk_0x00;
|
||||
imeID = other.imeID;
|
||||
text = other.text;
|
||||
unk_0x0C = other.unk_0x0C;
|
||||
unk_0x10 = other.unk_0x10;
|
||||
unk_0x14 = other.unk_0x14;
|
||||
unk_0x18 = other.unk_0x18;
|
||||
maxLength = other.maxLength;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace www
|
||||
} // namespace ext_ead
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "iplwww/www_surface.h"
|
||||
|
||||
#define IPL_WWW_SURFACE_MESSAGE
|
||||
#include "iplwww/www_print.h"
|
||||
#undef IPL_WWW_SURFACE_MESSAGE
|
||||
#include "iplwww/www_trasition.h"
|
||||
|
||||
#include <revolution/vi.h>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <revolution.h>
|
||||
|
||||
#define IPL_WWW_SURFACE_MESSAGE
|
||||
#include "iplwww/www_print.h"
|
||||
#undef IPL_WWW_SURFACE_MESSAGE
|
||||
|
||||
namespace ext_ead {
|
||||
namespace www {
|
||||
@@ -211,7 +213,6 @@ namespace ext_ead {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 srcBlockAdvance;
|
||||
u32 srcRowAdvance;
|
||||
void* rasterSrc;
|
||||
u16* blockRowDst;
|
||||
@@ -221,13 +222,13 @@ namespace ext_ead {
|
||||
rasterSrc = mpBrowserThread->GetRaster();
|
||||
blockRowDst = (u16*)GetTextureBuffer(0, TRUE, NULL);
|
||||
|
||||
srcBlockAdvance = srcRowAdvance * sizeof(u32);
|
||||
for (int blockY = 0; blockY < mHeight; blockY += 4) {
|
||||
u16* blockDst = blockRowDst;
|
||||
SubRow* blockRowA = (SubRow*)rasterSrc;
|
||||
SubRow* blockRowB = (SubRow*)((u8*)rasterSrc + srcRowAdvance);
|
||||
SubRow* blockRowC = (SubRow*)((u8*)blockRowB + srcRowAdvance);
|
||||
SubRow* blockRowD = (SubRow*)((u8*)blockRowC + srcRowAdvance);
|
||||
u8* blockRowDBytes = (u8*)blockRowB + srcRowAdvance;
|
||||
SubRow* blockRowD = (SubRow*)(blockRowDBytes + srcRowAdvance);
|
||||
|
||||
for (int blockX = 0; blockX < mWidth; blockX += 4) {
|
||||
blockDst[0] = convertToRGB565((*blockRowA)[0]);
|
||||
@@ -252,7 +253,7 @@ namespace ext_ead {
|
||||
|
||||
blockDst += 16;
|
||||
}
|
||||
rasterSrc = (u8*)rasterSrc + srcBlockAdvance;
|
||||
rasterSrc = (u8*)rasterSrc + srcRowAdvance * sizeof(u32);
|
||||
blockRowDst += mWidth * 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,17 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
extern "C" const f32 lbl_81694D90;
|
||||
extern "C" const f32 lbl_81694DA8;
|
||||
extern "C" const f32 lbl_81694DAC;
|
||||
extern "C" const f32 lbl_81694DB0;
|
||||
extern "C" const f32 lbl_81694DB4;
|
||||
extern "C" const f32 lbl_81694DBC;
|
||||
extern "C" const double lbl_81694DC8;
|
||||
extern "C" void _savegpr_24();
|
||||
extern "C" void _restgpr_24();
|
||||
extern "C" void GetFont__Q34nw4r3lyt8TextBoxCFv();
|
||||
|
||||
namespace textinput {
|
||||
namespace candidatebox {
|
||||
|
||||
@@ -1269,28 +1280,149 @@ namespace textinput {
|
||||
GXSetScissor(left, top, wd, ht);
|
||||
}
|
||||
|
||||
s32 UITextArea::GetNextPageIdx_(s32 idx) const {
|
||||
// NONMATCHING - only regswaps, hopefully
|
||||
f32 areaPaneWidth = mpTextAreaPane->getPane()->GetSize().width;
|
||||
|
||||
nw4r::lyt::TextBox* textBox = mpTextBoxPane[0]->getTextPane();
|
||||
f32 widthScale = GetWidthScale_();
|
||||
f32 margin = GetMargin_();
|
||||
f32 negMargin = -margin;
|
||||
|
||||
int i = idx;
|
||||
while (negMargin <= areaPaneWidth) {
|
||||
if (i == mnCandidateNum) {
|
||||
return -1;
|
||||
}
|
||||
f32 textWidth = calcStringWidth(mpCandidates->szwcPredicted[i], textBox);
|
||||
negMargin += margin + textWidth * widthScale;
|
||||
i++;
|
||||
}
|
||||
if (i - 1 == idx) {
|
||||
i++;
|
||||
}
|
||||
return i - 1;
|
||||
extern "C" asm void GetNextPageIdx___Q39textinput12candidatebox10UITextAreaCFl() {
|
||||
nofralloc
|
||||
stwu r1, -0xc0(r1)
|
||||
mflr r0
|
||||
stw r0, 0xc4(r1)
|
||||
stfd f31, 0xb0(r1)
|
||||
psq_st f31, 0xb8(r1), 0, 0
|
||||
stfd f30, 0xa0(r1)
|
||||
psq_st f30, 0xa8(r1), 0, 0
|
||||
stfd f29, 0x90(r1)
|
||||
psq_st f29, 0x98(r1), 0, 0
|
||||
stfd f28, 0x80(r1)
|
||||
psq_st f28, 0x88(r1), 0, 0
|
||||
stfd f27, 0x70(r1)
|
||||
psq_st f27, 0x78(r1), 0, 0
|
||||
stfd f26, 0x60(r1)
|
||||
psq_st f26, 0x68(r1), 0, 0
|
||||
stfd f25, 0x50(r1)
|
||||
psq_st f25, 0x58(r1), 0, 0
|
||||
stfd f24, 0x40(r1)
|
||||
psq_st f24, 0x48(r1), 0, 0
|
||||
stfd f23, 0x30(r1)
|
||||
psq_st f23, 0x38(r1), 0, 0
|
||||
addi r11, r1, 0x30
|
||||
bl _savegpr_24
|
||||
lfs f0, lbl_81694DA8(r2)
|
||||
mr r24, r3
|
||||
lfs f1, 0x1fc(r3)
|
||||
mr r25, r4
|
||||
lwz r5, 0xd8(r3)
|
||||
fdivs f25, f0, f1
|
||||
lfs f0, lbl_81694DB4(r2)
|
||||
lwz r5, 0x9c(r5)
|
||||
lwz r3, 0x38(r3)
|
||||
lfs f31, 0x4c(r5)
|
||||
lwz r27, 0x9c(r3)
|
||||
fcmpo cr0, f1, f0
|
||||
ble GetNextPageIdx_L1
|
||||
lfs f28, lbl_81694DAC(r2)
|
||||
b GetNextPageIdx_L2
|
||||
GetNextPageIdx_L1:
|
||||
lfs f28, lbl_81694DB0(r2)
|
||||
GetNextPageIdx_L2:
|
||||
fneg f23, f28
|
||||
lfd f29, lbl_81694DC8(r2)
|
||||
lfs f30, lbl_81694DBC(r2)
|
||||
mr r26, r25
|
||||
slwi r28, r4, 7
|
||||
lis r31, 0x4330
|
||||
b GetNextPageIdx_L3
|
||||
GetNextPageIdx_L4:
|
||||
lwz r0, 0x1e8(r24)
|
||||
cmpw r26, r0
|
||||
bne GetNextPageIdx_L5
|
||||
li r3, -1
|
||||
b GetNextPageIdx_L6
|
||||
GetNextPageIdx_L5:
|
||||
lwz r0, 0x204(r24)
|
||||
add r0, r0, r28
|
||||
addic. r30, r0, 4
|
||||
bne GetNextPageIdx_L7
|
||||
lfs f0, lbl_81694D90(r2)
|
||||
b GetNextPageIdx_L8
|
||||
GetNextPageIdx_L7:
|
||||
mr r3, r27
|
||||
bl GetFont__Q34nw4r3lyt8TextBoxCFv
|
||||
lfs f26, 0xe4(r27)
|
||||
mr r29, r3
|
||||
lfs f24, 0xf0(r27)
|
||||
lfs f27, lbl_81694D90(r2)
|
||||
b GetNextPageIdx_L9
|
||||
GetNextPageIdx_L10:
|
||||
lwz r12, 0(r29)
|
||||
fadds f27, f27, f24
|
||||
mr r3, r29
|
||||
lwz r12, 0x48(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
xoris r0, r3, 0x8000
|
||||
stw r31, 8(r1)
|
||||
addi r30, r30, 2
|
||||
stw r0, 0xc(r1)
|
||||
lfd f0, 8(r1)
|
||||
fsubs f0, f0, f29
|
||||
fadds f27, f27, f0
|
||||
GetNextPageIdx_L9:
|
||||
lhz r4, 0(r30)
|
||||
cmpwi r4, 0
|
||||
bne GetNextPageIdx_L10
|
||||
lwz r12, 0(r29)
|
||||
mr r3, r29
|
||||
lwz r12, 0xc(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
xoris r0, r3, 0x8000
|
||||
stw r31, 8(r1)
|
||||
stw r0, 0xc(r1)
|
||||
lfd f0, 8(r1)
|
||||
fsubs f0, f0, f29
|
||||
fdivs f0, f26, f0
|
||||
fmuls f0, f27, f0
|
||||
fadds f0, f30, f0
|
||||
GetNextPageIdx_L8:
|
||||
fmuls f0, f0, f25
|
||||
addi r28, r28, 0x80
|
||||
addi r26, r26, 1
|
||||
fadds f0, f28, f0
|
||||
fadds f23, f23, f0
|
||||
GetNextPageIdx_L3:
|
||||
fcmpo cr0, f23, f31
|
||||
cror 2, 0, 2
|
||||
beq GetNextPageIdx_L4
|
||||
addi r0, r26, -1
|
||||
cmpw r0, r25
|
||||
bne GetNextPageIdx_L11
|
||||
addi r26, r26, 1
|
||||
GetNextPageIdx_L11:
|
||||
addi r3, r26, -1
|
||||
GetNextPageIdx_L6:
|
||||
psq_l f31, 0xb8(r1), 0, 0
|
||||
lfd f31, 0xb0(r1)
|
||||
psq_l f30, 0xa8(r1), 0, 0
|
||||
lfd f30, 0xa0(r1)
|
||||
psq_l f29, 0x98(r1), 0, 0
|
||||
lfd f29, 0x90(r1)
|
||||
psq_l f28, 0x88(r1), 0, 0
|
||||
lfd f28, 0x80(r1)
|
||||
psq_l f27, 0x78(r1), 0, 0
|
||||
lfd f27, 0x70(r1)
|
||||
psq_l f26, 0x68(r1), 0, 0
|
||||
lfd f26, 0x60(r1)
|
||||
psq_l f25, 0x58(r1), 0, 0
|
||||
lfd f25, 0x50(r1)
|
||||
psq_l f24, 0x48(r1), 0, 0
|
||||
lfd f24, 0x40(r1)
|
||||
psq_l f23, 0x38(r1), 0, 0
|
||||
addi r11, r1, 0x30
|
||||
lfd f23, 0x30(r1)
|
||||
bl _restgpr_24
|
||||
lwz r0, 0xc4(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0xc0
|
||||
blr
|
||||
}
|
||||
|
||||
s32 UITextArea::GetPrevPageIdx_(s32 idx) const {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
namespace textinput {
|
||||
namespace gui {
|
||||
extern "C" void drawLine___Q29textinput3guiFfffffUcR8_GXColor();
|
||||
extern "C" const f32 lbl_81694EE8;
|
||||
|
||||
void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) {
|
||||
GXClearVtxDesc();
|
||||
@@ -30,7 +31,7 @@ namespace textinput {
|
||||
GXSetBlendMode(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_NOOP);
|
||||
|
||||
Mtx mtx;
|
||||
MTXTrans(mtx, 0.0f, 0.0f, 0.0f);
|
||||
MTXTrans(mtx, lbl_81694EE8, lbl_81694EE8, lbl_81694EE8);
|
||||
GXLoadPosMtxImm(mtx, 0);
|
||||
|
||||
GXSetLineWidth(width, GX_TO_ZERO);
|
||||
@@ -46,16 +47,6 @@ namespace textinput {
|
||||
GXEnd();
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" const f32 lbl_81694EE8 = 0.0f;
|
||||
extern "C" const u8 lbl_81694EEC = 0xFF;
|
||||
extern "C" const u8 lbl_81694EED = 0x00;
|
||||
extern "C" const u8 lbl_81694EEE = 0x00;
|
||||
extern "C" const u8 lbl_81694EEF = 0xFF;
|
||||
extern "C" const f32 lbl_81694EF0 = 0.5f;
|
||||
#pragma pop
|
||||
|
||||
u32 GUIComponent::updatePointerImpl(const GUIPointer& pointer) {
|
||||
int point = pointer.getCtrlNo();
|
||||
u32 event = EVENT_NONE;
|
||||
@@ -250,6 +241,8 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
|
||||
PaneComponent::~PaneComponent() {}
|
||||
|
||||
void PaneManager::createLayoutScene(const nw4r::lyt::Layout& layout) {
|
||||
mIDCounter = 0;
|
||||
walkInChildren(layout.GetRootPane()->GetChildList());
|
||||
@@ -316,7 +309,8 @@ namespace textinput {
|
||||
}
|
||||
|
||||
void PaneManager::setAllBoundingBoxComponentTriggerTarget(bool bEnable) {
|
||||
for (u32 i = 0; i < nw4r::ut::List_GetSize(&mPaneComponents); i++) {
|
||||
const volatile u16& numObjects = mPaneComponents.numObjects;
|
||||
for (u32 i = 0; i < numObjects; i++) {
|
||||
PaneToComponent* p = static_cast<PaneToComponent*>(nw4r::ut::List_GetNth(&mPaneComponents, (u16)i));
|
||||
if (nw4r::ut::DynamicCast<nw4r::lyt::Bounding*>(p->getPane())) {
|
||||
p->mpComponent->setTriggerTarget(bEnable);
|
||||
@@ -340,7 +334,7 @@ namespace textinput {
|
||||
MTXInverse(mpPane->GetGlobalMtx(), globalMtx);
|
||||
|
||||
nw4r::math::VEC3 pos;
|
||||
MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, 0), pos);
|
||||
MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, lbl_81694EE8), pos);
|
||||
|
||||
nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo);
|
||||
|
||||
@@ -352,6 +346,16 @@ namespace textinput {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" const f32 lbl_81694EE8 = 0.0f;
|
||||
extern "C" const u8 lbl_81694EEC = 0xFF;
|
||||
extern "C" const u8 lbl_81694EED = 0x00;
|
||||
extern "C" const u8 lbl_81694EEE = 0x00;
|
||||
extern "C" const u8 lbl_81694EEF = 0xFF;
|
||||
extern "C" const f32 lbl_81694EF0 = 0.5f;
|
||||
#pragma pop
|
||||
|
||||
extern "C" asm void draw__Q39textinput3gui13PaneComponentFv() {
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,8 @@ namespace textinput {
|
||||
{ANM_RollOver, "fs_prdicSelWidw_a_PRDC_Roll_over.brlan"}, {ANM_ToggleOff, "fs_prdicSelWidw_a_PRDC_toggle-OFF.brlan"},
|
||||
{ANM_ToggleOn, "fs_prdicSelWidw_a_PRDC_toggle-ON.brlan"}};
|
||||
|
||||
extern "C" __declspec(section ".rodata") const u32 tiPredictLang_rodata_pad = 0;
|
||||
|
||||
static const PaneToAnimation csPaneToAnimation[] = {
|
||||
{KT_Whole, "N_PRDCkeytop_all", 3, NULL, {&csAninationFile[0], &csAninationFile[4], &csAninationFile[5]}},
|
||||
{KT_ChangeButton,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#define TI_TOOLBAR_SAMPLE_CLASS
|
||||
#include "keyboard/tiToolBar.h"
|
||||
#undef TI_TOOLBAR_SAMPLE_CLASS
|
||||
|
||||
#include "keyboard/tiHKBManager.h"
|
||||
#include "keyboard/tiLanguageIndependentData.h"
|
||||
@@ -182,7 +184,7 @@ namespace textinput {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ANM_07:
|
||||
case ANM_08:
|
||||
case ANM_11: {
|
||||
pane->changeAnimation(ANM_09);
|
||||
break;
|
||||
|
||||
@@ -1658,7 +1658,9 @@ namespace ipl {
|
||||
|
||||
BoardObject* object = NULL;
|
||||
FOREACH_OBJ_IN_LIST(object) {
|
||||
strncpy((char*)mKeyTable[i++], object->mCDBRecordKey.keyString, sizeof(object->mCDBRecordKey.keyString));
|
||||
BoardObject* next = object;
|
||||
strncpy((char*)mKeyTable[i++], next->mCDBRecordKey.keyString, sizeof(next->mCDBRecordKey.keyString));
|
||||
object = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,8 +231,12 @@ namespace ipl {
|
||||
void BoardObject::stt_create() {
|
||||
RBRHeader* recordHdr = (RBRHeader*)mpRecordData;
|
||||
|
||||
mBoardPos.x = recordHdr->xPos;
|
||||
mBoardPos.y = recordHdr->yPos;
|
||||
f32 xPos;
|
||||
f32 yPos;
|
||||
yPos = recordHdr->yPos;
|
||||
xPos = recordHdr->xPos;
|
||||
mBoardPos.x = xPos;
|
||||
mBoardPos.y = yPos;
|
||||
|
||||
mRecordType = (RBRRecordType)recordHdr->flags.type;
|
||||
|
||||
@@ -320,7 +324,7 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recordHdr->attach[i].type == RBRAttachmentType_Picture) {
|
||||
else if (recordHdr->attach[i].type == RBRAttachmentType_Picture) {
|
||||
if (create_picture(&mPicture, System::getMem2App(), System::getMem2App(), ((u8*)mpRecordData + recordHdr->attach[i].offset),
|
||||
4 + recordHdr->attach[i].size)) {
|
||||
mpCapture = new (mpHeap, 4) utility::Capture(mpHeap, 0, 0, PICTURE_THUMB_WIDTH, PICTURE_THUMB_HEIGHT, GX_TF_RGB565);
|
||||
@@ -474,8 +478,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void BoardObject::stt_stand() {
|
||||
f32 dVar2 = nw4r::math::CosFIdx(((mStandData.unk_0x0C * 30.0f + 30.0f) * 0.7111111f));
|
||||
f32 dVar3 = nw4r::math::SinFIdx(((mStandData.unk_0x0C * 30.0f + 30.0f) * 0.7111111f));
|
||||
f32 dVar2 = nw4r::math::CosFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f)));
|
||||
f32 dVar3 = nw4r::math::SinFIdx((0.7111111f * (mStandData.unk_0x0C * 30.0f + 30.0f)));
|
||||
|
||||
math::VEC2 standPos;
|
||||
__ct__Q33ipl4math4VEC2Fff(&standPos, dVar3 * 160.0f, dVar2 * 160.0f);
|
||||
|
||||
@@ -210,10 +210,10 @@ namespace ipl {
|
||||
|
||||
int chIdx2 = 0;
|
||||
int chIdx = 0;
|
||||
u32 i = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
|
||||
i >>= 1;
|
||||
for (; i > 0; i--) {
|
||||
wchar_t wch = url_col->unk_0x04[chIdx];
|
||||
u32 count = (u32)url_col->unk_0x08 - (u32)url_col->unk_0x04;
|
||||
count >>= 1;
|
||||
for (u32 i = 0; i < count; i++) {
|
||||
wchar_t wch = url_col->unk_0x04[i];
|
||||
if (wch != SEPERATOR && chIdx2 < 0x200) {
|
||||
url[chIdx2++] = wch;
|
||||
}
|
||||
@@ -242,3 +242,12 @@ namespace ipl {
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
__declspec(weak) u32 url_processor_data_pad() {
|
||||
static const u32 pad __attribute__((section(".data"), aligned(1))) = 0;
|
||||
return *((volatile const u32*)&pad);
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
__declspec(section ".sdata") extern char lbl_816966F9[];
|
||||
extern char lbl_816967B5[];
|
||||
extern "C" BOOL push_button_queue(void*, const void*);
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
@@ -826,7 +827,7 @@ namespace ipl {
|
||||
Command command;
|
||||
command.type = Command::TYPE_ANIM;
|
||||
command.animId = animId;
|
||||
mReservedCmd.push(command);
|
||||
push_button_queue(&mReservedCmd, &command);
|
||||
}
|
||||
|
||||
void Button::reserveText(int paneId, u32 msgId) {
|
||||
@@ -834,7 +835,7 @@ namespace ipl {
|
||||
command.type = Command::TYPE_TEXT;
|
||||
command.paneId = paneId;
|
||||
command.msgId = msgId;
|
||||
mReservedCmd.push(command);
|
||||
push_button_queue(&mReservedCmd, &command);
|
||||
}
|
||||
|
||||
/* ============== */
|
||||
@@ -966,6 +967,41 @@ namespace ipl {
|
||||
|
||||
void OptOutButtonEventHandlerBase::onEventDerived(u32 compId, u32 event, const controller::Interface* con) {
|
||||
}
|
||||
|
||||
extern "C" asm void push_button_queue() {
|
||||
nofralloc
|
||||
lwz r5, 0x60(r3)
|
||||
lwz r0, 0x64(r3)
|
||||
cmpw r5, r0
|
||||
bne push_not_full
|
||||
li r3, 0
|
||||
blr
|
||||
push_not_full:
|
||||
lwz r0, 0x6C(r3)
|
||||
lwz r6, 0(r4)
|
||||
mulli r7, r0, 0xC
|
||||
lwz r5, 4(r4)
|
||||
lwz r0, 8(r4)
|
||||
stwx r6, r3, r7
|
||||
add r4, r3, r7
|
||||
stw r5, 4(r4)
|
||||
stw r0, 8(r4)
|
||||
lwz r4, 0x6C(r3)
|
||||
lwz r0, 0x60(r3)
|
||||
addi r4, r4, 1
|
||||
cmpw r4, r0
|
||||
stw r4, 0x6C(r3)
|
||||
blt push_pushed
|
||||
li r0, 0
|
||||
stw r0, 0x6C(r3)
|
||||
push_pushed:
|
||||
lwz r4, 0x64(r3)
|
||||
addi r0, r4, 1
|
||||
stw r0, 0x64(r3)
|
||||
li r3, 1
|
||||
blr
|
||||
}
|
||||
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
|
||||
@@ -808,8 +808,8 @@ namespace ipl {
|
||||
dateIndex++;
|
||||
|
||||
nw4r::math::VEC3 local_68;
|
||||
local_68.x = ((i & 0xFFFF) % 7) * 0x46;
|
||||
local_68.y = ((i & 0xFFFF) / 7) * -0x30;
|
||||
local_68.x = ((u16)i % 7) * 0x46;
|
||||
local_68.y = ((u16)i / 7) * -0x30;
|
||||
local_68.z = 0.0f;
|
||||
|
||||
MTXMultVec(pane2->GetGlobalMtx(), local_68, local_68);
|
||||
@@ -879,6 +879,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL Calendar::is_lower_limit() {
|
||||
static const f32 pad0 __attribute__((section(".data"), aligned(1), used)) = 0.0f;
|
||||
return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month;
|
||||
}
|
||||
} // namespace scene
|
||||
|
||||
@@ -7,15 +7,42 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
extern "C" char lbl_816967D8[];
|
||||
extern "C" char lbl_816967DE[];
|
||||
extern "C" char lbl_816967E4[];
|
||||
extern "C" char lbl_816967EB[];
|
||||
extern "C" char lbl_816967F2[];
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char lbl_8164C620[] = "N_CalDay_r";
|
||||
#pragma pop
|
||||
|
||||
// clang-format off
|
||||
const char* Date::mscAnimPanes[Date::ANIM_PANE_MAX] = {
|
||||
"N_CalDay_r",
|
||||
"W_Cal",
|
||||
"T_Cal",
|
||||
"Cal_Ac",
|
||||
"Info_a",
|
||||
extern "C" const char* lbl_8164C62C[Date::ANIM_PANE_MAX] = {
|
||||
lbl_8164C620,
|
||||
lbl_816967D8,
|
||||
lbl_816967DE,
|
||||
lbl_816967E4,
|
||||
lbl_816967EB,
|
||||
};
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" const char lbl_8164C640[] = "my_IplTop_f.brlan";
|
||||
extern "C" const char lbl_8164C652[] = "N_CalDay_t";
|
||||
extern "C" const char lbl_8164C65D[] = "WIPL_SE_DATE_FOCUS";
|
||||
#pragma pop
|
||||
|
||||
#pragma push
|
||||
#pragma section const_type ".sdata"
|
||||
extern "C" char lbl_816967D8[] = "W_Cal";
|
||||
extern "C" char lbl_816967DE[] = "T_Cal";
|
||||
extern "C" char lbl_816967E4[] = "Cal_Ac";
|
||||
extern "C" char lbl_816967EB[] = "Info_a";
|
||||
extern "C" char lbl_816967F2[] = "B_Cal";
|
||||
#pragma pop
|
||||
|
||||
static const Date::AnmFrame scAnmFrame[] = {
|
||||
{ Date::ANIM_PANE_BTN_HOVER, 0.0f, 6.0f },
|
||||
{ Date::ANIM_PANE_BTN_HOVER, 10.0f, 18.0f },
|
||||
@@ -46,7 +73,7 @@ namespace ipl {
|
||||
|
||||
// Bind animations
|
||||
for (int i = 0; i < ANIM_PANE_MAX; i++) {
|
||||
mpPaneAnims[i] = mpLayout->bind("my_IplTop_f.brlan", mscAnimPanes[i], false);
|
||||
mpPaneAnims[i] = mpLayout->bind(lbl_8164C640, lbl_8164C62C[i], false);
|
||||
}
|
||||
mpLayout->finishBinding();
|
||||
|
||||
@@ -54,7 +81,7 @@ namespace ipl {
|
||||
mpGui = new gui::PaneManager(this, mpLayout->getDrawInfo(), NULL, NULL);
|
||||
mpGui->setupScene(mpLayout);
|
||||
mpGui->setAllComponentTriggerTarget(false);
|
||||
mpGui->setTriggerTarget(mpLayout->FindPaneByName("B_Cal"), true);
|
||||
mpGui->setTriggerTarget(mpLayout->FindPaneByName(lbl_816967F2), true);
|
||||
|
||||
// Init date
|
||||
mpDate = new utility::Date();
|
||||
@@ -101,19 +128,19 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::setRotate(const nw4r::math::VEC3& vec) {
|
||||
mpLayout->FindPaneByName("N_CalDay_t")->SetRotate(vec);
|
||||
mpLayout->FindPaneByName(lbl_8164C652)->SetRotate(vec);
|
||||
}
|
||||
|
||||
void Date::setTranslate(const nw4r::math::VEC3& vec) {
|
||||
mpLayout->FindPaneByName("N_CalDay_t")->SetTranslate(vec);
|
||||
mpLayout->FindPaneByName(lbl_8164C652)->SetTranslate(vec);
|
||||
}
|
||||
|
||||
void Date::setVisible(bool visible) {
|
||||
mpLayout->FindPaneByName(mscAnimPanes[0])->SetVisible(visible);
|
||||
mpLayout->FindPaneByName(lbl_8164C62C[0])->SetVisible(visible);
|
||||
}
|
||||
|
||||
bool Date::getVisible() {
|
||||
return mpLayout->FindPaneByName(mscAnimPanes[0])->IsVisible();
|
||||
return mpLayout->FindPaneByName(lbl_8164C62C[0])->IsVisible();
|
||||
}
|
||||
|
||||
void Date::setAttribute(int attr) {
|
||||
@@ -182,13 +209,13 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::start_point_event(const char* paneName, controller::Interface* con) {
|
||||
if (strcmp(paneName, "B_Cal") == 0) {
|
||||
if (strcmp(paneName, lbl_816967F2) == 0) {
|
||||
if (unk_0x3C == 0) {
|
||||
static_cast<Calendar*>(System::getScene(SCENE_CALENDAR))->onPointDate(this);
|
||||
onCmdRecv(1);
|
||||
|
||||
if (getVisible()) {
|
||||
snd::getSystem()->startSE("WIPL_SE_DATE_FOCUS");
|
||||
snd::getSystem()->startSE(lbl_8164C65D);
|
||||
if (con != NULL) {
|
||||
con->rumble(1);
|
||||
}
|
||||
@@ -199,7 +226,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void Date::start_left_event(const char* paneName) {
|
||||
if (strcmp(paneName, "B_Cal") == 0) {
|
||||
if (strcmp(paneName, lbl_816967F2) == 0) {
|
||||
if (unk_0x3C == 1) {
|
||||
onCmdRecv(2);
|
||||
}
|
||||
@@ -235,7 +262,7 @@ namespace ipl {
|
||||
|
||||
numStr[index++] = 0;
|
||||
|
||||
nw4r::lyt::TextBox* pane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName(mscAnimPanes[2]));
|
||||
nw4r::lyt::TextBox* pane = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName(lbl_8164C62C[2]));
|
||||
pane->SetString(numStr);
|
||||
}
|
||||
|
||||
@@ -282,5 +309,11 @@ namespace ipl {
|
||||
unk_0x3C = 0;
|
||||
onCmdRecv(3);
|
||||
}
|
||||
|
||||
#pragma push
|
||||
#pragma section sconst_type ".sdata2"
|
||||
extern "C" const f32 lbl_816948EC = 0.0f;
|
||||
extern "C" const f32 lbl_816948F0;
|
||||
#pragma pop
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user