Compare commits
111 Commits
codex/butt
...
agent/refi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56789e065d | ||
|
|
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 |
73
AGENTS.md
73
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,28 @@ 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
|
||||
```
|
||||
### Worker loop
|
||||
|
||||
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.
|
||||
|
||||
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 +198,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 +219,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 +241,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
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ MEMORY {
|
||||
}
|
||||
|
||||
SECTIONS {
|
||||
IPL_WWW_SURFACE_ZERO__Q37ext_ead3www5print = 0;
|
||||
GROUP: {
|
||||
.init ALIGN(0x20): {}
|
||||
extab ALIGN(0x20): {}
|
||||
|
||||
48
configure.py
48
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,7 +655,7 @@ 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"),
|
||||
@@ -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"),
|
||||
@@ -694,10 +694,10 @@ config.libs = [
|
||||
IPLSection("iplwww", [
|
||||
Object(Equivalent, "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"),
|
||||
@@ -745,7 +745,7 @@ config.libs = [
|
||||
]
|
||||
),
|
||||
IPLSection("button", [
|
||||
Object(Equivalent, "scene/button/iplButton.cpp"),
|
||||
Object(Matching, "scene/button/iplButton.cpp"),
|
||||
Object(Matching, "scene/button/iplArrow.cpp"),
|
||||
]
|
||||
),
|
||||
@@ -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"),
|
||||
@@ -1017,7 +1017,7 @@ config.libs = [
|
||||
Object(Matching, "cdb/cdb.c"),
|
||||
Object(Equivalent, "cdb/CDBConv.c"), # hmm
|
||||
Object(NonMatching, "cdb/CDBDatabase.c"),
|
||||
Object(Equivalent, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemUtils.c"),
|
||||
Object(Matching, "cdb/CDBFileSystem.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemVF.c"),
|
||||
Object(Matching, "cdb/CDBFileSystemSD.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", [
|
||||
@@ -1072,8 +1072,8 @@ config.libs = [
|
||||
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"),
|
||||
@@ -1089,7 +1089,7 @@ config.libs = [
|
||||
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"),
|
||||
]
|
||||
),
|
||||
@@ -1940,15 +1940,15 @@ 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(Matching, "MSL_Common/arith.c"),
|
||||
Object(Matching, "MSL_Common/bsearch.c"),
|
||||
Object(Matching, "MSL_Common/buffer_io.c"),
|
||||
Object(NonMatching, "MSL_Common/direct_io.c"),
|
||||
Object(NonMatching, "MSL_Common/file_io.c"),
|
||||
Object(NonMatching, "MSL_Common/FILE_POS.c"),
|
||||
@@ -1956,9 +1956,9 @@ config.libs = [
|
||||
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"),
|
||||
@@ -1976,7 +1976,7 @@ config.libs = [
|
||||
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(Matching, "MSL_Common/math_sun.c", extra_cflags=["-Cpp_exceptions on"]),
|
||||
Object(NonMatching, "MSL_Common/extras.c"),
|
||||
|
||||
Object(Matching, "MSL_Common_Embedded/Math/e_acos.c"),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class MaxDate : public utility::Date {
|
||||
public:
|
||||
u8 padding[0x10];
|
||||
MaxDate(int year, int month, int day) : utility::Date(year, month, day) {}
|
||||
};
|
||||
|
||||
class Date : ::gui::EventHandler {
|
||||
public:
|
||||
typedef struct AnmFrame {
|
||||
@@ -82,7 +88,7 @@ namespace ipl {
|
||||
static const char* mscAnimPanes[ANIM_PANE_MAX];
|
||||
|
||||
static utility::Date mscMinDate;
|
||||
static utility::Date mscMaxDate;
|
||||
static MaxDate mscMaxDate;
|
||||
|
||||
nw4r::ut::Link mNode1; // 0x40
|
||||
nw4r::ut::Link mNode2; // 0x48
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ipl {
|
||||
void closeDatabase();
|
||||
|
||||
BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode,
|
||||
const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag,
|
||||
const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, u16 noReplyFlag,
|
||||
const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize,
|
||||
RBRAttachmentType* attachType);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
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[1] = "/";
|
||||
#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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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,18 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern volatile const u8 lbl_81695060;
|
||||
extern volatile const u8 lbl_81695061;
|
||||
extern volatile const u8 lbl_81695062;
|
||||
extern volatile const u8 lbl_81695064;
|
||||
extern volatile const u8 lbl_81695065;
|
||||
extern volatile const u8 lbl_81695066;
|
||||
extern volatile u8 lbl_81697D70;
|
||||
extern volatile u8 lbl_81697D71;
|
||||
extern volatile u8 lbl_81697D72;
|
||||
extern void _savegpr_21();
|
||||
extern void _restgpr_21();
|
||||
|
||||
#define WAIT_FOR_OPERATION(...) \
|
||||
do { \
|
||||
while ((__VA_ARGS__)) { \
|
||||
@@ -134,56 +146,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 +287,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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -211,7 +211,6 @@ namespace ext_ead {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 srcBlockAdvance;
|
||||
u32 srcRowAdvance;
|
||||
void* rasterSrc;
|
||||
u16* blockRowDst;
|
||||
@@ -221,13 +220,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 +251,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 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
@@ -881,5 +881,9 @@ namespace ipl {
|
||||
BOOL Calendar::is_lower_limit() {
|
||||
return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month;
|
||||
}
|
||||
__declspec(weak) f32 calendar_data_pad() {
|
||||
static const f32 pad __attribute__((section(".data"), aligned(1))) = 0.0f;
|
||||
return *((volatile const f32*)&pad);
|
||||
}
|
||||
} // namespace scene
|
||||
} // namespace ipl
|
||||
|
||||
@@ -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 },
|
||||
@@ -33,11 +60,9 @@ namespace ipl {
|
||||
// clang-format on
|
||||
|
||||
utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY);
|
||||
utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY);
|
||||
MaxDate Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY);
|
||||
|
||||
u8 padding[0x10];
|
||||
|
||||
DECOMP_FORCE_ACTIVE(iplDate_cpp, padding);
|
||||
DECOMP_FORCE_ACTIVE(iplDate_cpp, &Date::mscMaxDate);
|
||||
|
||||
Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName)
|
||||
: ::gui::EventHandler(), mbAppearMsg(0), unk_0x10(0), unk_0x14(0), mpLayout(NULL), mpCurrentPaneAnim(0), unk_0x3C(0) {
|
||||
@@ -46,7 +71,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 +79,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 +126,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 +207,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 +224,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 +260,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 +307,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
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace ipl {
|
||||
};
|
||||
|
||||
extern "C" char lbl_8164E6AF[] = "%s_Rso%d.brlan";
|
||||
extern "C" char lbl_8164E6C0[] = "icon_Start.brlan";
|
||||
extern "C" char lbl_816969E8[] = "arc";
|
||||
|
||||
static const u32 scLangLookup[SC_PRODUCT_AREA_MAX][16] = {
|
||||
@@ -771,31 +772,32 @@ namespace ipl {
|
||||
f32 ChannelObj::createWadThumbnail() {
|
||||
f32 frame = 0.0f;
|
||||
|
||||
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpThumbFile->getBuffer(), lbl_816969E8, lbl_8164E328.iconBrlyt);
|
||||
mpThumbLayout = layout::Object::create(mpMainHeap, 0x8000, mpThumbFile->getBuffer(), lbl_816969E8, lbl_8164E290 + 0x3F8);
|
||||
setLangPane(mpThumbLayout);
|
||||
|
||||
const char* dataBase = lbl_8164E290;
|
||||
u32 rsoIdx = System::getChannelManager()->getIconRSOIdx(mChanPage, mChanIndex);
|
||||
u32 csIdx = System::getChannelManager()->getIconCSIdx(mChanPage, mChanIndex);
|
||||
|
||||
if (rsoIdx != 0) {
|
||||
if (mpThumbLayout->searchFile("icon_Start.brlan")) {
|
||||
mpThumbAnim = mpThumbLayout->bind("icon_Start.brlan");
|
||||
if (mpThumbLayout->searchFile(dataBase + 0x42E)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(dataBase + 0x42E);
|
||||
} else {
|
||||
mpThumbAnim = NULL;
|
||||
}
|
||||
} else {
|
||||
if (csIdx != 0) {
|
||||
if (mpThumbLayout->searchFile("icon_Start.brlan")) {
|
||||
mpThumbAnim = mpThumbLayout->bind("icon_Start.brlan");
|
||||
if (mpThumbLayout->searchFile(dataBase + 0x42E)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(dataBase + 0x42E);
|
||||
} else {
|
||||
mpThumbAnim = NULL;
|
||||
}
|
||||
} else {
|
||||
if (mpThumbLayout->searchFile(lbl_8164E328.iconBrlan)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(lbl_8164E328.iconBrlan);
|
||||
if (mpThumbLayout->searchFile(dataBase + 0x403)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(dataBase + 0x403);
|
||||
} else {
|
||||
if (mpThumbLayout->searchFile(lbl_8164E328.iconWholeBrlan)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(lbl_8164E328.iconWholeBrlan);
|
||||
if (mpThumbLayout->searchFile(dataBase + 0x40E)) {
|
||||
mpThumbAnim = mpThumbLayout->bind(dataBase + 0x40E);
|
||||
} else {
|
||||
mpThumbAnim = NULL;
|
||||
}
|
||||
@@ -950,7 +952,19 @@ namespace ipl {
|
||||
case 1: {
|
||||
if (!mpCursorAnims[ANIM_CURSOR_FOCUS_ON]->isPlaying()) {
|
||||
int prev = unk_0x5C;
|
||||
unk_0x58 = 2;
|
||||
switch (unk_0x58) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
unk_0x58 = 2;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (prev == 3) {
|
||||
setCursorAnim(3);
|
||||
unk_0x5C = 0;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include <revolution/types.h>
|
||||
#define vu8 u8
|
||||
#include "system/iplChannelManager.h"
|
||||
#undef vu8
|
||||
#include "scene/channelTitle/iplChannelTitle.h"
|
||||
#include "scene/channelSelect/iplChannelSelect.h"
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
static inline wchar_t* letterWriterCaption(wchar_t* caption) {
|
||||
return caption;
|
||||
}
|
||||
|
||||
extern "C" char lbl_81650380[0x19] = "my_IplTopBalloon_a.brlyt";
|
||||
|
||||
LetterWriter::LetterWriter(EGG::Heap* heap, int type)
|
||||
@@ -143,7 +147,7 @@ namespace ipl {
|
||||
Address* address = static_cast<Address*>(System::getScene(SCENE_ADDRESS));
|
||||
memcpy(&mFriendInfo, &address->getFriendCache()->getInfo(address->getChosenFriendIndex()), sizeof(NWC24FriendInfo));
|
||||
|
||||
const wchar_t* caption = makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name);
|
||||
const wchar_t* caption = letterWriterCaption(makeHeaderCaption((const wchar_t*)mFriendInfo.attr.name));
|
||||
getLetterInputForm()->setHeaderCaption(caption);
|
||||
|
||||
mbToFriend = true;
|
||||
|
||||
@@ -1,9 +1,327 @@
|
||||
#include "scene/iplSceneManager.h"
|
||||
#define IPL_SCENE_MANAGER_H
|
||||
#define IPL_BASE_SCENE_H
|
||||
#define IPL_TREE_NODE_H
|
||||
#define IPL_QUEUE_H
|
||||
|
||||
#include <decomp.h>
|
||||
#include <revolution.h>
|
||||
#include <egg/core.h>
|
||||
|
||||
#include "scene/iplSceneCreator.h"
|
||||
|
||||
namespace ipl {
|
||||
namespace utility {
|
||||
class Tree {
|
||||
public:
|
||||
Tree();
|
||||
virtual ~Tree();
|
||||
virtual Tree* getParent();
|
||||
virtual Tree* getChild();
|
||||
virtual Tree* getNext();
|
||||
virtual Tree* getPrev();
|
||||
void attach(Tree* tree);
|
||||
void insert(Tree* tree, Tree* childTree);
|
||||
void detach();
|
||||
static Tree* empty() { return (Tree*)0; }
|
||||
|
||||
class iterator {
|
||||
typedef Tree value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
public:
|
||||
explicit inline iterator(pointer ptr) : mPtr(ptr) {}
|
||||
virtual reference operator*();
|
||||
pointer operator->() { return mPtr; }
|
||||
pointer getPtr() { return mPtr; }
|
||||
iterator& operator++();
|
||||
|
||||
protected:
|
||||
pointer mPtr;
|
||||
};
|
||||
|
||||
class reverse_iterator {
|
||||
typedef Tree value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
public:
|
||||
explicit inline reverse_iterator(pointer ptr) : mPtr(ptr) { reverse(); }
|
||||
virtual reference operator*();
|
||||
pointer operator->() { return mPtr; }
|
||||
pointer getPtr() { return mPtr; }
|
||||
void reverse();
|
||||
|
||||
protected:
|
||||
pointer mPtr;
|
||||
};
|
||||
|
||||
protected:
|
||||
Tree* mpParent;
|
||||
Tree* mpChild;
|
||||
Tree* mpNext;
|
||||
Tree* mpPrev;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
class Base;
|
||||
enum {
|
||||
COMMAND_NONE = 0,
|
||||
COMMAND_CREATE_CHILD,
|
||||
COMMAND_RESERVE_CHANGE,
|
||||
COMMAND_RESERVE_ALL_DESTRUCT,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
int newSceneID;
|
||||
int prevSceneID;
|
||||
int newRootID;
|
||||
Base* parent;
|
||||
Base* child;
|
||||
void* args;
|
||||
} CommandData;
|
||||
|
||||
typedef struct Command {
|
||||
CommandData data;
|
||||
void clear();
|
||||
Command() { clear(); }
|
||||
} Command;
|
||||
|
||||
class Base : public utility::Tree, EGG::Disposer {
|
||||
public:
|
||||
Base(EGG::Heap* heap);
|
||||
virtual ~Base();
|
||||
virtual BOOL isReady() const;
|
||||
virtual BOOL isResetAcceptable() const;
|
||||
virtual void startResetting();
|
||||
virtual BOOL isResetProcessDone();
|
||||
virtual void prepare();
|
||||
virtual void create();
|
||||
virtual void calc();
|
||||
virtual void draw();
|
||||
virtual void destroy();
|
||||
virtual Base* getParent();
|
||||
virtual Base* getChild();
|
||||
virtual Base* getNext();
|
||||
virtual Base* getPrev();
|
||||
bool isSceneCreated() const { return (mScnState & SCN_STATE_CREATED); }
|
||||
|
||||
class iterator : public utility::Tree::iterator {
|
||||
typedef Base value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
public:
|
||||
explicit inline iterator(pointer ptr) : utility::Tree::iterator(ptr) {}
|
||||
virtual reference operator*();
|
||||
pointer operator->() { return (pointer)mPtr; }
|
||||
pointer getPtr() { return (pointer)mPtr; }
|
||||
void setPtr(pointer p) { mPtr = p; }
|
||||
};
|
||||
|
||||
class reverse_iterator : public utility::Tree::reverse_iterator {
|
||||
typedef Base value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
public:
|
||||
explicit reverse_iterator(pointer ptr);
|
||||
virtual reference operator*();
|
||||
pointer operator->() { return (pointer)mPtr; }
|
||||
pointer getPtr() { return (pointer)mPtr; }
|
||||
void setPtr(pointer p) { mPtr = p; }
|
||||
};
|
||||
|
||||
private:
|
||||
enum {
|
||||
SCN_STATE_CREATED = (1 << 0),
|
||||
SCN_STATE_DESTROY_REQ = (1 << 1),
|
||||
};
|
||||
|
||||
void do_prepare();
|
||||
void do_create();
|
||||
void do_calc();
|
||||
void do_draw();
|
||||
void do_destroy();
|
||||
|
||||
EGG::Heap* mpHeap;
|
||||
u32 mParentFlags;
|
||||
u32 mScnState;
|
||||
int mSceneID;
|
||||
u32 mPrevSceneID;
|
||||
Command mCommand;
|
||||
|
||||
protected:
|
||||
enum {
|
||||
SCN_PARENTFLAG_CALC = (1 << 0),
|
||||
SCN_PARENTFLAG_DRAW = (1 << 1),
|
||||
};
|
||||
|
||||
void createChildScene(int sceneId, Base* parent, Base* child, void* args = NULL);
|
||||
void reserveSceneChange(int sceneId, void* args = NULL);
|
||||
void reserveAllSceneDestruction(int sceneId, void* args = NULL);
|
||||
void setSceneParentFlags(u32 flag) { mParentFlags = flag; }
|
||||
void requestSceneDestruction() { mScnState |= SCN_STATE_DESTROY_REQ; }
|
||||
EGG::Heap* getSceneHeap() { return mpHeap; }
|
||||
int getSceneID() const { return mSceneID; }
|
||||
u32 getPrevSceneID() const { return mPrevSceneID; }
|
||||
|
||||
friend class Manager;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace ipl {
|
||||
namespace utility {
|
||||
template <typename T, int c>
|
||||
class Queue {
|
||||
public:
|
||||
inline Queue() : count(c), current(0), popped(0), pushed(0) {}
|
||||
|
||||
BOOL push(const T& item) {
|
||||
if (count == current) {
|
||||
return FALSE;
|
||||
}
|
||||
items[pushed] = item;
|
||||
if (++pushed >= count) {
|
||||
pushed = 0;
|
||||
}
|
||||
current++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL pop() {
|
||||
BOOL result = TRUE;
|
||||
if (current == 0) {
|
||||
result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
if (++popped >= count) {
|
||||
popped = 0;
|
||||
}
|
||||
current--;
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
int get_current_index() { return current; }
|
||||
T& get_current_item() { return items[get_current_index()]; }
|
||||
int get_popped_index() { return popped; }
|
||||
T& get_popped_item() { return items[get_popped_index()]; }
|
||||
void next_popped_item() { popped++; }
|
||||
void no_popped_item() { popped = 0; }
|
||||
int get_pushed_index() { return pushed; }
|
||||
T& get_pushed_item() { return items[get_pushed_index()]; }
|
||||
|
||||
T items[c];
|
||||
int count;
|
||||
int current;
|
||||
int popped, pushed;
|
||||
};
|
||||
|
||||
template <>
|
||||
class Queue<ipl::scene::Command, 8> {
|
||||
public:
|
||||
inline Queue() : count(8), current(0), popped(0), pushed(0) {}
|
||||
|
||||
BOOL push(const ipl::scene::Command& item) {
|
||||
if (count == current) {
|
||||
return FALSE;
|
||||
}
|
||||
items[pushed] = item;
|
||||
if (++pushed >= count) {
|
||||
pushed = 0;
|
||||
}
|
||||
current++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL pop();
|
||||
int get_current_index() { return current; }
|
||||
ipl::scene::Command& get_current_item() { return items[get_current_index()]; }
|
||||
int get_popped_index() { return popped; }
|
||||
ipl::scene::Command& get_popped_item() { return items[get_popped_index()]; }
|
||||
void next_popped_item() { popped++; }
|
||||
void no_popped_item() { popped = 0; }
|
||||
int get_pushed_index() { return pushed; }
|
||||
ipl::scene::Command& get_pushed_item() { return items[get_pushed_index()]; }
|
||||
|
||||
ipl::scene::Command items[8];
|
||||
int count;
|
||||
int current;
|
||||
int popped, pushed;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
enum {
|
||||
DRAW_LAYER_1 = 0,
|
||||
DRAW_LAYER_2,
|
||||
DRAW_LAYER_DEFAULT = DRAW_LAYER_2,
|
||||
DRAW_LAYER_3,
|
||||
DRAW_LAYER_MAX,
|
||||
};
|
||||
|
||||
#define MAX_COMMANDS 8
|
||||
typedef utility::Queue<Command, MAX_COMMANDS> CommandList;
|
||||
|
||||
class Manager {
|
||||
public:
|
||||
Manager(EGG::Heap* heap);
|
||||
void init();
|
||||
void calc();
|
||||
void calc(SceneObj* scene);
|
||||
void draw();
|
||||
void draw(SceneObj* scene);
|
||||
SceneObj* createScene(int sceneId, int prevSceneId, void* args);
|
||||
SceneObj* createScene(int sceneId, void* args) { return createScene(sceneId, SCENE_NONE, args); }
|
||||
void createScene(const Command& command);
|
||||
void destroyScene(SceneObj* scene);
|
||||
void detach(SceneObj* scene);
|
||||
void startResetting();
|
||||
BOOL isResetProcessDone();
|
||||
BOOL isResetAcceptable();
|
||||
BOOL pushCommand(const Command& pCommand);
|
||||
void setDestructSync();
|
||||
void doDestructSync() { mbDestroySyncTask = true; }
|
||||
SceneObj* getScene(int sceneId);
|
||||
SceneObj* getScene(int sceneId, SceneObj* obj);
|
||||
bool onDefaultDrawLayer() { return mDrawLayer == DRAW_LAYER_2; }
|
||||
bool onDrawLayer(int layer) { return mDrawLayer == layer; }
|
||||
void attachReservedScene();
|
||||
BOOL isReady(int sceneId);
|
||||
SceneObj* getReservedScene() { return mpReservedScene; }
|
||||
int getCurrentRootSceneID() { return mRootSceneID; }
|
||||
int getPreviousRootSceneID() { return mPrevRootSceneID; }
|
||||
|
||||
private:
|
||||
void createRootScene(int sceneId, void* args);
|
||||
|
||||
EGG::UnitHeap* mpBigSceneHeap;
|
||||
EGG::UnitHeap* mpMdmSceneHeap;
|
||||
EGG::UnitHeap* mpSmlSceneHeap;
|
||||
SceneObj* mpRootScene;
|
||||
CommandList mCommands;
|
||||
int mDrawLayer;
|
||||
SceneObj* mpReservedScene;
|
||||
Command mReservedCommand;
|
||||
bool mbCreatedReserved;
|
||||
bool mbDestroySyncTask;
|
||||
int mRootSceneID;
|
||||
int mPrevRootSceneID;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#define SCENE_CLASS(x) class x : public scene::Base
|
||||
#include "scene/iplRootScene.h"
|
||||
|
||||
#include "iplSystem.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace ipl {
|
||||
@@ -97,6 +415,33 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
Base& Base::iterator::operator*() {
|
||||
return *(Base*)mPtr;
|
||||
}
|
||||
}
|
||||
|
||||
namespace utility {
|
||||
Tree::iterator& Tree::iterator::operator++() {
|
||||
if (mPtr->getChild()) {
|
||||
mPtr = mPtr->getChild();
|
||||
} else {
|
||||
if (mPtr->getNext()) {
|
||||
mPtr = mPtr->getNext();
|
||||
} else {
|
||||
while ((mPtr = mPtr->getParent())) {
|
||||
if (!mPtr->getNext()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mPtr = mPtr->getNext();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace scene {
|
||||
void Manager::draw() {
|
||||
mDrawLayer = DRAW_LAYER_1;
|
||||
while (mDrawLayer < DRAW_LAYER_MAX) {
|
||||
@@ -165,6 +510,25 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
Base::reverse_iterator::reverse_iterator(Base* ptr) : utility::Tree::reverse_iterator(ptr) {}
|
||||
}
|
||||
|
||||
namespace utility {
|
||||
void Tree::reverse_iterator::reverse() {
|
||||
while (mPtr->getChild()) {
|
||||
mPtr = mPtr->getChild();
|
||||
while (mPtr->getNext()) {
|
||||
mPtr = mPtr->getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace scene {
|
||||
Base& Base::reverse_iterator::operator*() {
|
||||
return *(Base*)mPtr;
|
||||
}
|
||||
|
||||
void Manager::createScene(const Command& command) {
|
||||
mpReservedScene = createScene(command.data.newSceneID, command.data.prevSceneID, command.data.args);
|
||||
mReservedCommand = command;
|
||||
@@ -278,4 +642,24 @@ namespace ipl {
|
||||
return found;
|
||||
}
|
||||
} // namespace scene
|
||||
|
||||
namespace utility {
|
||||
Tree& Tree::reverse_iterator::operator*() {
|
||||
return *mPtr;
|
||||
}
|
||||
|
||||
BOOL Queue<scene::Command, 8>::pop() {
|
||||
BOOL result = TRUE;
|
||||
if (current == 0) {
|
||||
result = FALSE;
|
||||
goto done;
|
||||
}
|
||||
if (++popped >= count) {
|
||||
popped = 0;
|
||||
}
|
||||
current--;
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
}
|
||||
} // namespace ipl
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
#include <revolution/gx/GXStruct.h>
|
||||
#include <revolution/os/OSError.h>
|
||||
|
||||
extern "C" const unsigned char lbl_8169622C;
|
||||
extern "C" const unsigned char lbl_8169622D;
|
||||
extern "C" const unsigned char lbl_8169622E;
|
||||
extern "C" const unsigned char lbl_8169622F;
|
||||
extern "C" const char lbl_81639230[65];
|
||||
|
||||
#define NW4R_DB_ASSERT_H
|
||||
#define NW4R_ASSERT(x) \
|
||||
{ \
|
||||
if (!(x)) { \
|
||||
GXColor front = {*((volatile const unsigned char*)&lbl_8169622C), *((volatile const unsigned char*)&lbl_8169622D), *((volatile const unsigned char*)&lbl_8169622E), *((volatile const unsigned char*)&lbl_8169622F)}; \
|
||||
GXColor back = {0, 0, 0, 0}; \
|
||||
OSFatal((GXColor)front, (GXColor)back, lbl_81639230); \
|
||||
} \
|
||||
}
|
||||
|
||||
#include "scene/channelSelect/iplChannelSelect.h"
|
||||
#include "scene/channelTitle/iplChannelTitle.h"
|
||||
|
||||
@@ -306,3 +325,16 @@ __declspec(export) void IplRso_symbolMaker() {
|
||||
wideTextWriter->CalcStringRect(&rect, L"", 0);
|
||||
wideTextWriter->CalcStringRect(&rect, L"");
|
||||
}
|
||||
|
||||
extern "C" __declspec(section ".sdata") const unsigned char lbl_8169622C = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char lbl_8169622D = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char lbl_8169622E = 255;
|
||||
extern "C" __declspec(section ".sdata") const unsigned char lbl_8169622F = 0;
|
||||
|
||||
extern "C" __declspec(section ".data") const char lbl_81639230[65] = "Error#004\nAn error has occurred.\nThe system files are corrupted.";
|
||||
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const f32 rso_data_pad_f32 = 0.0f;
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const u16 rso_data_pad_u16 = 0;
|
||||
extern "C" __declspec(section ".data") __declspec(align(1)) const u8 rso_data_pad_u8 = 0;
|
||||
|
||||
extern "C" __declspec(section ".sdata2") const f32 lbl_81694598 = 0.0f;
|
||||
|
||||
@@ -51,12 +51,20 @@ extern "C" void __div2i();
|
||||
extern "C" void __FTVRCLoop0Handler__7LibTVRCFP7OSAlarmP9OSContext();
|
||||
extern "C" void __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext();
|
||||
|
||||
#pragma push
|
||||
#pragma section data_type ".sdata"
|
||||
extern "C" char lbl_81696230[5] = {'T', 'V', 'R', '0', '\0'};
|
||||
#pragma pop
|
||||
|
||||
namespace LibTVRC {
|
||||
const char* TVRC_FILE_HEADER = "TVR0";
|
||||
const char* TVRC_FILE_HEADER = lbl_81696230;
|
||||
u32 __tienHoseiNsec = 1100;
|
||||
u32 _limitMilli = 400;
|
||||
|
||||
ARCHandle _database ALIGN32;
|
||||
struct TVRCHandle : ARCHandle {
|
||||
u8 _padding[4];
|
||||
};
|
||||
TVRCHandle _database;
|
||||
OSAlarm _alarm;
|
||||
|
||||
BOOL _isRepeatActive;
|
||||
@@ -106,7 +114,7 @@ namespace LibTVRC {
|
||||
u32 _repeatBitLength;
|
||||
u32 _repeatBitArray;
|
||||
|
||||
OSTime _tickT;
|
||||
u32 _tickT;
|
||||
OSTime _tickWait[2];
|
||||
|
||||
void __FTVRCLoop0Handler(OSAlarm *alarm, OSContext *ctx);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode,
|
||||
u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType,
|
||||
u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType,
|
||||
u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData,
|
||||
const void** attachData, u32* attachSize, RBRAttachmentType* attachType) {
|
||||
BOOL result = FALSE;
|
||||
|
||||
@@ -14,17 +14,337 @@
|
||||
#include "system/iplSystem.h"
|
||||
|
||||
const f32 lbl_8160D2C0[] = {0.2, 0.3, 0, 0};
|
||||
extern const f32 lbl_81694450;
|
||||
extern "C" void __ct__Q34nw4r2ut4RectFv();
|
||||
typedef void (*ControllerDataFunction)();
|
||||
#pragma push
|
||||
#pragma section const_type ".data"
|
||||
extern "C" unsigned int const lbl_816346A8[3] = {0, 0x14, 0};
|
||||
extern "C" unsigned int const lbl_816346B4[3] = {0, 0x18, 0};
|
||||
extern "C" unsigned int const lbl_816346C0[3] = {0, 0x1c, 0};
|
||||
extern "C" unsigned int const lbl_816346CC[3] = {0, 0x30, 0};
|
||||
extern "C" void __dt__Q33ipl10controller6MasterFv();
|
||||
extern "C" void getType__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getChannel__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void down__Q33ipl10controller6MasterCFUl();
|
||||
extern "C" void downTrg__Q33ipl10controller6MasterCFUl();
|
||||
extern "C" void upTrg__Q33ipl10controller6MasterCFUl();
|
||||
extern "C" void pinch__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void pinchTrg__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void pinchOffTrg__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void decide__Q33ipl10controller6MasterCFv();
|
||||
extern "C" void repeat__Q33ipl10controller6MasterCFUl();
|
||||
extern "C" void rumble__Q33ipl10controller9InterfaceFi();
|
||||
extern "C" void cancelRumbling__Q33ipl10controller9InterfaceFv();
|
||||
extern "C" void getHoldFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getTrigFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getReleaseFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getClassicHoldFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getClassicTrigFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getDpdPos__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getDpdProjectionPos__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getHorizon__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getDpdDistance__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getKPADStatus__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getPADStatus__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void isValidBtn__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void isValidDpd__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void setForceInvalid__Q33ipl10controller6MasterFb();
|
||||
extern "C" void setForceInvalid__Q33ipl10controller4BaseFb();
|
||||
extern "C" void getMainStickX__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getMainStickY__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getSubStickX__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void getSubStickY__Q33ipl10controller9InterfaceCFv();
|
||||
extern "C" void read__Q33ipl10controller9InterfaceFv();
|
||||
extern "C" void __dt__Q33ipl10controller7ClassicFv();
|
||||
extern "C" void getType__Q33ipl10controller4BaseCFv();
|
||||
extern "C" void getChannel__Q33ipl10controller4BaseCFv();
|
||||
extern "C" void down__Q33ipl10controller7ClassicCFUl();
|
||||
extern "C" void downTrg__Q33ipl10controller7ClassicCFUl();
|
||||
extern "C" void upTrg__Q33ipl10controller7ClassicCFUl();
|
||||
extern "C" void pinch__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void pinchTrg__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void pinchOffTrg__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void decide__Q33ipl10controller4BaseCFv();
|
||||
extern "C" void repeat__Q33ipl10controller10RevolutionCFUl();
|
||||
extern "C" void rumble__Q33ipl10controller4BaseFi();
|
||||
extern "C" void cancelRumbling__Q33ipl10controller4BaseFv();
|
||||
extern "C" void getHoldFlag__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getTrigFlag__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getReleaseFlag__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getClassicHoldFlag__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getClassicTrigFlag__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getClassicReleaseFlag__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getDpdPos__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getDpdProjectionPos__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getHorizon__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void getDpdDistance__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getKPADStatus__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void isValidBtn__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void isValidDpd__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void read__Q33ipl10controller7ClassicFv();
|
||||
extern "C" void isValidDpdClassic__Q33ipl10controller7ClassicCFv();
|
||||
extern "C" void __dt__Q33ipl10controller10RevolutionFv();
|
||||
extern "C" void down__Q33ipl10controller10RevolutionCFUl();
|
||||
extern "C" void downTrg__Q33ipl10controller10RevolutionCFUl();
|
||||
extern "C" void upTrg__Q33ipl10controller10RevolutionCFUl();
|
||||
extern "C" void getDpdPos__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getDpdProjectionPos__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getHorizon__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void isValidDpd__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void read__Q33ipl10controller10RevolutionFv();
|
||||
extern "C" void __dt__Q33ipl10controller4BaseFv();
|
||||
extern "C" void down__Q33ipl10controller9InterfaceCFUl();
|
||||
extern "C" void downTrg__Q33ipl10controller9InterfaceCFUl();
|
||||
extern "C" void upTrg__Q33ipl10controller9InterfaceCFUl();
|
||||
extern "C" void repeat__Q33ipl10controller9InterfaceCFUl();
|
||||
extern "C" void read__Q33ipl10controller4BaseFv();
|
||||
extern "C" void __dt__Q33ipl10controller9FreeStyleFv();
|
||||
extern "C" void __dt__Q33ipl10controller4CoreFv();
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller6Master[35] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller6MasterFv,
|
||||
getType__Q33ipl10controller9InterfaceCFv,
|
||||
getChannel__Q33ipl10controller9InterfaceCFv,
|
||||
down__Q33ipl10controller6MasterCFUl,
|
||||
downTrg__Q33ipl10controller6MasterCFUl,
|
||||
upTrg__Q33ipl10controller6MasterCFUl,
|
||||
pinch__Q33ipl10controller9InterfaceCFv,
|
||||
pinchTrg__Q33ipl10controller9InterfaceCFv,
|
||||
pinchOffTrg__Q33ipl10controller9InterfaceCFv,
|
||||
decide__Q33ipl10controller6MasterCFv,
|
||||
repeat__Q33ipl10controller6MasterCFUl,
|
||||
rumble__Q33ipl10controller9InterfaceFi,
|
||||
cancelRumbling__Q33ipl10controller9InterfaceFv,
|
||||
getHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdPos__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller9InterfaceCFv,
|
||||
getHorizon__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdDistance__Q33ipl10controller9InterfaceCFv,
|
||||
getKPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller9InterfaceCFv,
|
||||
isValidDpd__Q33ipl10controller9InterfaceCFv,
|
||||
setForceInvalid__Q33ipl10controller6MasterFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller9InterfaceFv,
|
||||
};
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller7Classic[36] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller7ClassicFv,
|
||||
getType__Q33ipl10controller4BaseCFv,
|
||||
getChannel__Q33ipl10controller4BaseCFv,
|
||||
down__Q33ipl10controller7ClassicCFUl,
|
||||
downTrg__Q33ipl10controller7ClassicCFUl,
|
||||
upTrg__Q33ipl10controller7ClassicCFUl,
|
||||
pinch__Q33ipl10controller10RevolutionCFv,
|
||||
pinchTrg__Q33ipl10controller10RevolutionCFv,
|
||||
pinchOffTrg__Q33ipl10controller10RevolutionCFv,
|
||||
decide__Q33ipl10controller4BaseCFv,
|
||||
repeat__Q33ipl10controller10RevolutionCFUl,
|
||||
rumble__Q33ipl10controller4BaseFi,
|
||||
cancelRumbling__Q33ipl10controller4BaseFv,
|
||||
getHoldFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getTrigFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getReleaseFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller7ClassicCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller7ClassicCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller7ClassicCFv,
|
||||
getDpdPos__Q33ipl10controller7ClassicCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller7ClassicCFv,
|
||||
getHorizon__Q33ipl10controller7ClassicCFv,
|
||||
getDpdDistance__Q33ipl10controller10RevolutionCFv,
|
||||
getKPADStatus__Q33ipl10controller10RevolutionCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller10RevolutionCFv,
|
||||
isValidDpd__Q33ipl10controller7ClassicCFv,
|
||||
setForceInvalid__Q33ipl10controller4BaseFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller7ClassicFv,
|
||||
isValidDpdClassic__Q33ipl10controller7ClassicCFv,
|
||||
};
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller10Revolution[35] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller10RevolutionFv,
|
||||
getType__Q33ipl10controller4BaseCFv,
|
||||
getChannel__Q33ipl10controller4BaseCFv,
|
||||
down__Q33ipl10controller10RevolutionCFUl,
|
||||
downTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
upTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
pinch__Q33ipl10controller10RevolutionCFv,
|
||||
pinchTrg__Q33ipl10controller10RevolutionCFv,
|
||||
pinchOffTrg__Q33ipl10controller10RevolutionCFv,
|
||||
decide__Q33ipl10controller4BaseCFv,
|
||||
repeat__Q33ipl10controller10RevolutionCFUl,
|
||||
rumble__Q33ipl10controller4BaseFi,
|
||||
cancelRumbling__Q33ipl10controller4BaseFv,
|
||||
getHoldFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getTrigFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getReleaseFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdPos__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller10RevolutionCFv,
|
||||
getHorizon__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdDistance__Q33ipl10controller10RevolutionCFv,
|
||||
getKPADStatus__Q33ipl10controller10RevolutionCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller10RevolutionCFv,
|
||||
isValidDpd__Q33ipl10controller10RevolutionCFv,
|
||||
setForceInvalid__Q33ipl10controller4BaseFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller10RevolutionFv,
|
||||
};
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller4Base[36] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller4BaseFv,
|
||||
getType__Q33ipl10controller4BaseCFv,
|
||||
getChannel__Q33ipl10controller4BaseCFv,
|
||||
down__Q33ipl10controller9InterfaceCFUl,
|
||||
downTrg__Q33ipl10controller9InterfaceCFUl,
|
||||
upTrg__Q33ipl10controller9InterfaceCFUl,
|
||||
pinch__Q33ipl10controller9InterfaceCFv,
|
||||
pinchTrg__Q33ipl10controller9InterfaceCFv,
|
||||
pinchOffTrg__Q33ipl10controller9InterfaceCFv,
|
||||
decide__Q33ipl10controller4BaseCFv,
|
||||
repeat__Q33ipl10controller9InterfaceCFUl,
|
||||
rumble__Q33ipl10controller4BaseFi,
|
||||
cancelRumbling__Q33ipl10controller4BaseFv,
|
||||
getHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdPos__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller9InterfaceCFv,
|
||||
getHorizon__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdDistance__Q33ipl10controller9InterfaceCFv,
|
||||
getKPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller9InterfaceCFv,
|
||||
isValidDpd__Q33ipl10controller9InterfaceCFv,
|
||||
setForceInvalid__Q33ipl10controller4BaseFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller4BaseFv,
|
||||
0,
|
||||
};
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller9FreeStyle[35] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller9FreeStyleFv,
|
||||
getType__Q33ipl10controller4BaseCFv,
|
||||
getChannel__Q33ipl10controller4BaseCFv,
|
||||
down__Q33ipl10controller10RevolutionCFUl,
|
||||
downTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
upTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
pinch__Q33ipl10controller10RevolutionCFv,
|
||||
pinchTrg__Q33ipl10controller10RevolutionCFv,
|
||||
pinchOffTrg__Q33ipl10controller10RevolutionCFv,
|
||||
decide__Q33ipl10controller4BaseCFv,
|
||||
repeat__Q33ipl10controller10RevolutionCFUl,
|
||||
rumble__Q33ipl10controller4BaseFi,
|
||||
cancelRumbling__Q33ipl10controller4BaseFv,
|
||||
getHoldFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getTrigFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getReleaseFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdPos__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller10RevolutionCFv,
|
||||
getHorizon__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdDistance__Q33ipl10controller10RevolutionCFv,
|
||||
getKPADStatus__Q33ipl10controller10RevolutionCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller10RevolutionCFv,
|
||||
isValidDpd__Q33ipl10controller10RevolutionCFv,
|
||||
setForceInvalid__Q33ipl10controller4BaseFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller10RevolutionFv,
|
||||
};
|
||||
extern "C" ControllerDataFunction const __vt__Q33ipl10controller4Core[35] = {
|
||||
0,
|
||||
0,
|
||||
__dt__Q33ipl10controller4CoreFv,
|
||||
getType__Q33ipl10controller4BaseCFv,
|
||||
getChannel__Q33ipl10controller4BaseCFv,
|
||||
down__Q33ipl10controller10RevolutionCFUl,
|
||||
downTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
upTrg__Q33ipl10controller10RevolutionCFUl,
|
||||
pinch__Q33ipl10controller10RevolutionCFv,
|
||||
pinchTrg__Q33ipl10controller10RevolutionCFv,
|
||||
pinchOffTrg__Q33ipl10controller10RevolutionCFv,
|
||||
decide__Q33ipl10controller4BaseCFv,
|
||||
repeat__Q33ipl10controller10RevolutionCFUl,
|
||||
rumble__Q33ipl10controller4BaseFi,
|
||||
cancelRumbling__Q33ipl10controller4BaseFv,
|
||||
getHoldFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getTrigFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getReleaseFlag__Q33ipl10controller10RevolutionCFv,
|
||||
getClassicHoldFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicTrigFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getClassicReleaseFlag__Q33ipl10controller9InterfaceCFv,
|
||||
getDpdPos__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdProjectionPos__Q33ipl10controller10RevolutionCFv,
|
||||
getHorizon__Q33ipl10controller10RevolutionCFv,
|
||||
getDpdDistance__Q33ipl10controller10RevolutionCFv,
|
||||
getKPADStatus__Q33ipl10controller10RevolutionCFv,
|
||||
getPADStatus__Q33ipl10controller9InterfaceCFv,
|
||||
isValidBtn__Q33ipl10controller10RevolutionCFv,
|
||||
isValidDpd__Q33ipl10controller10RevolutionCFv,
|
||||
setForceInvalid__Q33ipl10controller4BaseFb,
|
||||
getMainStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getMainStickY__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickX__Q33ipl10controller9InterfaceCFv,
|
||||
getSubStickY__Q33ipl10controller9InterfaceCFv,
|
||||
read__Q33ipl10controller10RevolutionFv,
|
||||
};
|
||||
#pragma pop
|
||||
extern const f32 lbl_81694440 = 1000.0f;
|
||||
extern const f32 lbl_81694444 = 0.058333333f;
|
||||
extern const f64 lbl_81694448 = 4503599627370496.0;
|
||||
extern const f32 lbl_81694450 = 1.0f / 0.0f;
|
||||
extern const f32 lbl_81694454 = 0.0f;
|
||||
extern const f32 lbl_81694458;
|
||||
extern const f32 lbl_8169445C;
|
||||
extern const f32 lbl_81694460;
|
||||
extern const f32 lbl_81694478;
|
||||
extern const f32 lbl_8169447C;
|
||||
extern const f32 lbl_81694480;
|
||||
extern const f32 lbl_81694484;
|
||||
extern const f32 lbl_81694488;
|
||||
extern const f32 lbl_8169448C;
|
||||
extern const f32 lbl_81694458 = 1.10132003f;
|
||||
extern const f32 lbl_8169445C = 1.15f;
|
||||
extern const f32 lbl_81694460 = 100.0f;
|
||||
extern const f32 lbl_81694464 = 0.01f;
|
||||
extern const f32 lbl_81694468 = 0.0036f;
|
||||
extern const f32 lbl_8169446C = 0.05f;
|
||||
extern const f32 lbl_81694470 = 1.0f;
|
||||
extern const f32 lbl_81694474 = -0.2679492f;
|
||||
extern const f32 lbl_81694478 = 0.5f;
|
||||
extern const f32 lbl_8169447C = 0.1f;
|
||||
extern const f32 lbl_81694480 = 0.2f;
|
||||
extern const f32 lbl_81694484 = -0.2f;
|
||||
extern const f32 lbl_81694488 = 0.05f;
|
||||
extern const f32 lbl_8169448C = 1.0f;
|
||||
extern "C" void* mpBuf__Q33ipl10controller7Manager = 0;
|
||||
extern "C" void* mpParentHeap__Q33ipl10controller7Manager = 0;
|
||||
extern "C" void* mpHeap__Q33ipl10controller7Manager = 0;
|
||||
@@ -42,16 +362,11 @@ extern "C" void _restgpr_28();
|
||||
extern "C" void __ptmf_scall();
|
||||
extern "C" void __ct__Q33ipl4math4VEC2Fff();
|
||||
extern "C" void set__Q33ipl4math4VEC2Fff();
|
||||
extern "C" void __vt__Q33ipl10controller4Base();
|
||||
extern "C" void __vt__Q33ipl10controller10Revolution();
|
||||
extern "C" void __dt__Q33ipl10controller10RevolutionFv();
|
||||
extern "C" void read__Q33ipl10controller4BaseFv();
|
||||
extern "C" void isValidDpd__Q33ipl10controller10RevolutionCFv();
|
||||
extern "C" void getProjectionRect__Q23ipl6SystemFPQ34nw4r2ut4Rect();
|
||||
extern "C" void __as__Q33ipl4math4VEC2FRCQ33ipl4math4VEC2();
|
||||
extern "C" void __vt__Q33ipl10controller6Master();
|
||||
extern "C" void __vt__Q33ipl10controller4Core();
|
||||
extern "C" void __vt__Q33ipl10controller9FreeStyle();
|
||||
extern "C" void __ct__Q33ipl10controller10RevolutionFiiR10KPADStatus();
|
||||
extern "C" void __ct__Q33ipl10controller7ClassicFiR10KPADStatus();
|
||||
extern "C" asm void alloc__Q33ipl10controller7ManagerFUl();
|
||||
@@ -624,8 +939,8 @@ namespace ipl {
|
||||
case 0:
|
||||
case 1: {
|
||||
u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime);
|
||||
f32 f1 = (f32)time / 1000.0f;
|
||||
if (f1 < 7.0f / 120.0f) {
|
||||
f32 f1 = (f32)time / lbl_81694440;
|
||||
if (f1 < lbl_81694444) {
|
||||
WPADControlMotor(mChan, 1);
|
||||
} else if (f1 < lbl_8160D2C0[mRumbleType]) {
|
||||
WPADControlMotor(mChan, 0);
|
||||
@@ -642,7 +957,7 @@ namespace ipl {
|
||||
}
|
||||
case 2: {
|
||||
u32 time = OSTicksToMilliseconds(OSGetTick() - mLastRumbleTime);
|
||||
f32 f1 = (f32)time / 1000.0f;
|
||||
f32 f1 = (f32)time / lbl_81694440;
|
||||
if (f1 < lbl_8160D2C0[1]) {
|
||||
WPADControlMotor(mChan, 0);
|
||||
} else if (getKPADStatus() == NULL || getKPADStatus()->wpad_err == 0) {
|
||||
@@ -1353,21 +1668,21 @@ namespace ipl {
|
||||
kpad_rect.right = nw4r_rect.right;
|
||||
kpad_rect.bottom = nw4r_rect.bottom;
|
||||
|
||||
KPADGetProjectionPos(&dest, &src, &kpad_rect, 1.10132f);
|
||||
KPADGetProjectionPos(&dest, &src, &kpad_rect, lbl_81694458);
|
||||
if (SCGetAspectRatio() == 1) {
|
||||
dest.x *= 1.15f;
|
||||
dest.y *= 1.15f;
|
||||
dest.x *= lbl_8169445C;
|
||||
dest.y *= lbl_8169445C;
|
||||
}
|
||||
|
||||
// regswap
|
||||
if (nw4r_rect.left - 100.0f > dest.x) {
|
||||
dest.x = nw4r_rect.left - 100.0f;
|
||||
} else if (nw4r_rect.right + 100.0f < dest.x) {
|
||||
dest.x = nw4r_rect.right + 100.0f;
|
||||
} else if (nw4r_rect.top - 100.0f > dest.y) {
|
||||
dest.y = nw4r_rect.top - 100.0f;
|
||||
} else if (nw4r_rect.bottom + 100.0f < dest.y) {
|
||||
dest.y = nw4r_rect.bottom + 100.0f;
|
||||
if (nw4r_rect.left - lbl_81694460 > dest.x) {
|
||||
dest.x = nw4r_rect.left - lbl_81694460;
|
||||
} else if (nw4r_rect.right + lbl_81694460 < dest.x) {
|
||||
dest.x = nw4r_rect.right + lbl_81694460;
|
||||
} else if (nw4r_rect.top - lbl_81694460 > dest.y) {
|
||||
dest.y = nw4r_rect.top - lbl_81694460;
|
||||
} else if (nw4r_rect.bottom + lbl_81694460 < dest.y) {
|
||||
dest.y = nw4r_rect.bottom + lbl_81694460;
|
||||
}
|
||||
// //
|
||||
|
||||
@@ -1377,8 +1692,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
Classic::Classic(int arg0, KPADStatus& arg1) : Revolution(arg0, arg1) {
|
||||
unk_0x24.x = 0.01f;
|
||||
unk_0x24.y = 0.01f;
|
||||
unk_0x24.x = lbl_81694464;
|
||||
unk_0x24.y = lbl_81694464;
|
||||
unk_0x2C = 0;
|
||||
}
|
||||
|
||||
@@ -1395,14 +1710,14 @@ namespace ipl {
|
||||
if (!Revolution::isValidDpd()) {
|
||||
math::VEC2 lstick(unk_0x20->ex_status.cl.lstick.x, unk_0x20->ex_status.cl.lstick.y);
|
||||
|
||||
if (lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f) {
|
||||
unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * 0.05f, 1.8f);
|
||||
unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * 0.05f, 1.2f);
|
||||
if (lstick.x * lstick.x + lstick.y * lstick.y > lbl_81694468) {
|
||||
unk_0x24.x = math::abs_clamp(unk_0x24.x + unk_0x20->ex_status.cl.lstick.x * lbl_8169446C, 1.8f);
|
||||
unk_0x24.y = math::abs_clamp(unk_0x24.y - unk_0x20->ex_status.cl.lstick.y * lbl_8169446C, 1.2f);
|
||||
}
|
||||
|
||||
math::VEC2 rstick = math::VEC2(unk_0x20->ex_status.cl.rstick.x, unk_0x20->ex_status.cl.rstick.y);
|
||||
if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > 0.0036f ||
|
||||
rstick.x * rstick.x + rstick.y * rstick.y > 0.0036f) {
|
||||
if (getClassicHoldFlag() != 0 || lstick.x * lstick.x + lstick.y * lstick.y > lbl_81694468 ||
|
||||
rstick.x * rstick.x + rstick.y * rstick.y > lbl_81694468) {
|
||||
unk_0x2C = 180;
|
||||
}
|
||||
|
||||
@@ -1410,8 +1725,8 @@ namespace ipl {
|
||||
unk_0x2C = 0;
|
||||
}
|
||||
} else {
|
||||
unk_0x24.y = 0.01f;
|
||||
unk_0x24.x = 0.01f;
|
||||
unk_0x24.y = lbl_81694464;
|
||||
unk_0x24.x = lbl_81694464;
|
||||
unk_0x2C = 0;
|
||||
}
|
||||
|
||||
@@ -1448,7 +1763,7 @@ namespace ipl {
|
||||
ret.set(unk_0x20->horizon.x, unk_0x20->horizon.y);
|
||||
} else {
|
||||
ret.x = 1.0f;
|
||||
ret.y = -0.2679492f;
|
||||
ret.y = lbl_81694474;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
#undef IPL_SOUND_RECT_OUT_OF_LINE
|
||||
|
||||
extern "C" ipl::System::Arg smArg__Q23ipl6System;
|
||||
extern "C" void __as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting();
|
||||
extern "C" void setMemoSetting__Q33ipl8savedata7ManagerFRCQ49textinput6extend8savedata11MemoSetting();
|
||||
extern "C" void flushAsync__Q33ipl8savedata7ManagerFPQ23EGG4Heap();
|
||||
|
||||
namespace ipl {
|
||||
namespace keyboard {
|
||||
// clang-format off
|
||||
@@ -626,16 +631,95 @@ namespace ipl {
|
||||
#endif // JAPANESE_BUILD
|
||||
}
|
||||
|
||||
void Manager::doSave() {
|
||||
textinput::extend::savedata::MemoSetting newSaveData = mpManager->getSaveData();
|
||||
textinput::extend::savedata::MemoSetting oldSaveData = mSaveData;
|
||||
BOOL canSave = memcmp(&newSaveData, &oldSaveData, sizeof(textinput::extend::savedata::MemoSetting)) == 0 && mpSaveFile == NULL;
|
||||
|
||||
if (canSave) {
|
||||
mSaveData = newSaveData;
|
||||
System::getSaveData()->setMemoSetting(mSaveData);
|
||||
mpSaveFile = System::getSaveData()->flushAsync(System::getMem2App());
|
||||
}
|
||||
asm void Manager::doSave() {
|
||||
nofralloc
|
||||
stwu r1, -0x30(r1)
|
||||
mflr r0
|
||||
stw r0, 0x34(r1)
|
||||
stw r31, 0x2c(r1)
|
||||
mr r31, r3
|
||||
stw r30, 0x28(r1)
|
||||
lwz r3, 4(r3)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0xd8(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
srwi r10, r4, 0x18
|
||||
srwi r9, r3, 0x18
|
||||
stb r10, 0x1c(r1)
|
||||
rlwinm r10, r4, 0x10, 0x18, 0x1f
|
||||
li r5, 8
|
||||
stb r9, 0x18(r1)
|
||||
rlwinm r9, r3, 0x10, 0x18, 0x1f
|
||||
lbz r6, 0x1c(r1)
|
||||
stb r10, 0x1d(r1)
|
||||
rlwinm r10, r4, 0x18, 0x18, 0x1f
|
||||
lbz r8, 0x18(r1)
|
||||
stb r9, 0x19(r1)
|
||||
rlwinm r9, r3, 0x18, 0x18, 0x1f
|
||||
lbz r0, 0x1d(r1)
|
||||
lbz r7, 0x19(r1)
|
||||
stb r10, 0x1e(r1)
|
||||
stb r4, 0x1f(r1)
|
||||
stb r4, 0xf(r1)
|
||||
addi r4, r1, 8
|
||||
stb r9, 0x1a(r1)
|
||||
stb r3, 0x1b(r1)
|
||||
stb r3, 0xb(r1)
|
||||
addi r3, r1, 0x10
|
||||
stb r8, 8(r1)
|
||||
stb r7, 9(r1)
|
||||
stb r9, 0xa(r1)
|
||||
stb r6, 0xc(r1)
|
||||
stb r0, 0xd(r1)
|
||||
stb r10, 0xe(r1)
|
||||
lbz r6, 0x2e(r31)
|
||||
lbz r0, 0x2f(r31)
|
||||
stb r6, 0x10(r1)
|
||||
stb r0, 0x11(r1)
|
||||
lbz r6, 0x30(r31)
|
||||
lbz r0, 0x31(r31)
|
||||
stb r6, 0x12(r1)
|
||||
stb r0, 0x13(r1)
|
||||
lbz r6, 0x32(r31)
|
||||
lbz r0, 0x33(r31)
|
||||
stb r6, 0x14(r1)
|
||||
stb r0, 0x15(r1)
|
||||
lbz r6, 0x34(r31)
|
||||
lbz r0, 0x35(r31)
|
||||
stb r6, 0x16(r1)
|
||||
stb r0, 0x17(r1)
|
||||
bl memcmp
|
||||
cntlzw r0, r3
|
||||
li r3, 0
|
||||
rlwinm. r0, r0, 0x1b, 5, 0x1f
|
||||
bne doSave_L1
|
||||
lwz r0, 0x38(r31)
|
||||
cmpwi r0, 0
|
||||
bne doSave_L1
|
||||
li r3, 1
|
||||
doSave_L1:
|
||||
cmpwi r3, 0
|
||||
beq doSave_L2
|
||||
addi r3, r31, 0x2e
|
||||
addi r4, r1, 0x18
|
||||
bl __as__Q49textinput6extend8savedata11MemoSettingFRCQ49textinput6extend8savedata11MemoSetting
|
||||
lis r30, smArg__Q23ipl6System@ha
|
||||
addi r4, r31, 0x2e
|
||||
addi r30, r30, smArg__Q23ipl6System@l
|
||||
lwz r3, 0x94(r30)
|
||||
bl setMemoSetting__Q33ipl8savedata7ManagerFRCQ49textinput6extend8savedata11MemoSetting
|
||||
lwz r3, 0x94(r30)
|
||||
lwz r4, 0x28(r30)
|
||||
bl flushAsync__Q33ipl8savedata7ManagerFPQ23EGG4Heap
|
||||
stw r3, 0x38(r31)
|
||||
doSave_L2:
|
||||
lwz r0, 0x34(r1)
|
||||
lwz r31, 0x2c(r1)
|
||||
lwz r30, 0x28(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x30
|
||||
blr
|
||||
}
|
||||
|
||||
void Manager::touchFormInDisp(int unused) {
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace ipl {
|
||||
BOOL SharedFile::openTicketFile_() {
|
||||
int code = 0;
|
||||
int errcode = 0;
|
||||
ESTitleId titleId = 0;
|
||||
ESTicketId ticketId = 0;
|
||||
int erridx = 0;
|
||||
mTicket = (ESTicketView*)System::getSharedHeap()->alloc(OSRoundUp32B(sizeof(ESTicketView)), -DEFAULT_ALIGN);
|
||||
|
||||
@@ -27,18 +29,24 @@ namespace ipl {
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
ESTicketView* tik;
|
||||
u32 tikCount;
|
||||
ESTicketView* tik;
|
||||
|
||||
if (utility::ESMisc::GetTicketViewList(System::getSharedHeap(), mTitleId, &tik, &tikCount) != ES_ERR_OK) {
|
||||
int tikIdx = utility::ESMisc::GetValidTicketIndex(System::getSharedHeap(), mTitleId, tik, tikCount);
|
||||
if (tikIdx >= 0 && tikIdx <= tikCount) {
|
||||
mTicketIdx = tikIdx;
|
||||
memcpy(mTicket, &tik[tikIdx], sizeof(ESTicketView));
|
||||
System::getSharedHeap()->free(tik);
|
||||
}
|
||||
} else {
|
||||
code = code;
|
||||
goto err;
|
||||
} else {
|
||||
int tikIdx = utility::ESMisc::GetValidTicketIndex(System::getSharedHeap(), mTitleId, tik, tikCount);
|
||||
if (tikIdx < 0) {
|
||||
goto err;
|
||||
}
|
||||
if (tikIdx >= tikCount) {
|
||||
code = code;
|
||||
goto err;
|
||||
}
|
||||
mTicketIdx = tikIdx;
|
||||
memcpy(mTicket, &tik[tikIdx], sizeof(ESTicketView));
|
||||
System::getSharedHeap()->free(tik);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +54,13 @@ namespace ipl {
|
||||
mDescriptor = ret;
|
||||
|
||||
if (ret < ES_ERR_OK) {
|
||||
errcode = ret;
|
||||
titleId = mTitleId;
|
||||
if (mTicket) {
|
||||
ticketId = mTicket->ticketId;
|
||||
}
|
||||
erridx = mContentIdx;
|
||||
code = 400;
|
||||
errcode = ret;
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -68,17 +80,19 @@ namespace ipl {
|
||||
}
|
||||
|
||||
BOOL result = ARCOpen(&mArc, msFileName, &mArcFile);
|
||||
if (result && ES_CloseContentFile(mDescriptor) >= ES_ERR_OK) {
|
||||
return result == TRUE;
|
||||
} else {
|
||||
err:
|
||||
char errString[192];
|
||||
sprintf(errString, "ES %d, %llx, %llx, %x", errcode, mTitleId, erridx);
|
||||
|
||||
IPLErrorLogAndDisplay(MESG_ERR_FILE, errString, code, 158);
|
||||
|
||||
return FALSE;
|
||||
if (!result) {
|
||||
if (ES_CloseContentFile(mDescriptor) < ES_ERR_OK) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
return result == TRUE;
|
||||
err:
|
||||
char errString[128];
|
||||
sprintf(errString, "ES %d, %llx, %llx, %x", errcode, titleId, ticketId, erridx);
|
||||
|
||||
IPLErrorLogAndDisplay(MESG_ERR_FILE, errString, code, 158);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL SharedFile::closeTicketFile_() {
|
||||
|
||||
@@ -559,7 +559,7 @@ namespace ipl {
|
||||
memset(msgFriendName, 0, sizeof(msgFriendName));
|
||||
|
||||
// Get message data
|
||||
NWC24MsgObj msgObj ALIGN32;
|
||||
NWC24MsgObj msgObj ATTRIBUTE_ALIGN(16);
|
||||
NWC24MsgType msgType;
|
||||
if (!getMsgObj(&msgObj, NWC24_MBOX_TYPE_RECV, mMsgIdsTbl[i]) || !getMsgType(&msgObj, &msgType)) {
|
||||
continue;
|
||||
@@ -569,7 +569,7 @@ namespace ipl {
|
||||
NWC24FriendAddr msgFriendAddr;
|
||||
memset(&msgFriendAddr, 0, sizeof(msgFriendAddr));
|
||||
|
||||
u16 msgFriendType;
|
||||
NWC24FriendType msgFriendType;
|
||||
|
||||
// Get friend data
|
||||
if (msgType == NWC24_MSGTYPE_PUBLIC) {
|
||||
@@ -579,7 +579,7 @@ namespace ipl {
|
||||
}
|
||||
msgFriendType = NWC24_FRIENDTYPE_EMAIL;
|
||||
if (searchFriendInfo(&msgFriendAddr, &index)) {
|
||||
NWC24FriendInfo friendInfo;
|
||||
NWC24FriendInfo friendInfo ALIGN32;
|
||||
readFriendInfo(&friendInfo, index);
|
||||
wcsncpy(msgFriendName, (wchar_t*)friendInfo.attr.name, 12);
|
||||
}
|
||||
@@ -588,7 +588,7 @@ namespace ipl {
|
||||
getMsgFromId(&msgObj, &msgFriendAddr.wiiId);
|
||||
msgFriendType = msgFriendAddr.wiiId == myUserId ? NWC24_FRIENDTYPE_NONE : NWC24_FRIENDTYPE_WII;
|
||||
if (searchFriendInfo(msgFriendAddr.wiiId, &index)) {
|
||||
NWC24FriendInfo friendInfo;
|
||||
NWC24FriendInfo friendInfo ALIGN32;
|
||||
readFriendInfo(&friendInfo, index);
|
||||
wcsncpy(msgFriendName, (wchar_t*)friendInfo.attr.name, 12);
|
||||
}
|
||||
@@ -596,6 +596,7 @@ namespace ipl {
|
||||
|
||||
// Get app and group ID
|
||||
u32 msgAppId;
|
||||
u16 msgOptOutAppId;
|
||||
u16 msgGroupId;
|
||||
getMsgAppId(&msgObj, &msgAppId);
|
||||
getMsgGroupId(&msgObj, &msgGroupId);
|
||||
@@ -613,9 +614,9 @@ namespace ipl {
|
||||
|
||||
// Get opt out flag (display "Opt Out" button)
|
||||
BOOL msgMbOptOutFlag = FALSE;
|
||||
u32 msgOptOutAppId = 0;
|
||||
bool msgBoardUpdateSW = (result & (bool)msgMbUpdateSW);
|
||||
result = readMsgMBOptOutFlag(&msgObj, &msgMbOptOutFlag, &msgOptOutAppId);
|
||||
*(u32*)&msgOptOutAppId = 0;
|
||||
result = readMsgMBOptOutFlag(&msgObj, &msgMbOptOutFlag, (u32*)&msgOptOutAppId);
|
||||
if (!FILE_ERROR_OK) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
namespace ipl {
|
||||
static const wchar_t scNumber[] = L"0123456789";
|
||||
extern const u32 scCreateRecordAttachSize0 = sizeof(EventBuffer);
|
||||
extern const u32 scCreateRecordAttachSize1 = 0;
|
||||
extern const RBRAttachmentType scCreateRecordAttachType0 = RBRAttachmentType_PlayTimeLog;
|
||||
extern const RBRAttachmentType scCreateRecordAttachType1 = RBRAttachmentType_None;
|
||||
extern const u32 sPlayTimeLogAttachSize0 = sizeof(EventBuffer);
|
||||
extern const u32 sPlayTimeLogAttachSize1 = 0;
|
||||
extern const RBRAttachmentType sPlayTimeLogAttachType0 = RBRAttachmentType_PlayTimeLog;
|
||||
extern const RBRAttachmentType sPlayTimeLogAttachType1 = RBRAttachmentType_None;
|
||||
PlayTimeLog PlayTimeLog::smArg;
|
||||
|
||||
BOOL search_cb_(void* playTime, CDBRecord* record) {
|
||||
@@ -351,11 +351,15 @@ namespace ipl {
|
||||
|
||||
const void* attachData[RBR_ATTACHMENT_MAX] = {(void*)event, NULL};
|
||||
|
||||
u32 attachSize[RBR_ATTACHMENT_MAX] = {*reinterpret_cast<const volatile u32*>(&scCreateRecordAttachSize0),
|
||||
*reinterpret_cast<const volatile u32*>(&scCreateRecordAttachSize1)};
|
||||
u32 attachSize[RBR_ATTACHMENT_MAX] = {
|
||||
*reinterpret_cast<volatile const u32*>(&sPlayTimeLogAttachSize0),
|
||||
*reinterpret_cast<volatile const u32*>(&sPlayTimeLogAttachSize1)
|
||||
};
|
||||
|
||||
RBRAttachmentType attachType[RBR_ATTACHMENT_MAX] = {
|
||||
*reinterpret_cast<const volatile RBRAttachmentType*>(&scCreateRecordAttachType0),
|
||||
*reinterpret_cast<const volatile RBRAttachmentType*>(&scCreateRecordAttachType1)};
|
||||
*reinterpret_cast<volatile const RBRAttachmentType*>(&sPlayTimeLogAttachType0),
|
||||
*reinterpret_cast<volatile const RBRAttachmentType*>(&sPlayTimeLogAttachType1)
|
||||
};
|
||||
|
||||
NWC24FriendAddr friendAddr;
|
||||
memset(&friendAddr, 0, sizeof(NWC24FriendAddr));
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace ipl {
|
||||
|
||||
u32 fileLen = sizeof(Data);
|
||||
BOOL bCreateNew = FALSE;
|
||||
BOOL bNeedFlush = FALSE;
|
||||
bool bNeedFlush = false;
|
||||
|
||||
ES_SetUid(SYSMENU_TITLE_ID);
|
||||
|
||||
@@ -330,12 +330,21 @@ namespace ipl {
|
||||
NETMD5Sum md5;
|
||||
NETCalcMD5(md5, &manager->mData, fileLen - NET_MD5_DIGEST_SIZE);
|
||||
|
||||
for (int i = 0; i < NET_MD5_DIGEST_SIZE; i++) {
|
||||
if (md5[i] != manager->mData.MD5Sum[i]) {
|
||||
u8* data = (u8*)manager;
|
||||
u32* loopFileLen = &fileLen;
|
||||
volatile NETMD5Sum& md5Ref = md5;
|
||||
u32 i = 0;
|
||||
while (i < NET_MD5_DIGEST_SIZE) {
|
||||
u8 md5Byte = md5Ref[i];
|
||||
u32 offset = i;
|
||||
offset += *loopFileLen;
|
||||
u32 fileByte = *(u8*)(offset + (u32)data + NET_MD5_DIGEST_SIZE);
|
||||
if (md5Byte != fileByte) {
|
||||
// Invalid MD5 sum, create new
|
||||
bCreateNew = TRUE;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,7 +391,8 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
if (bNeedFlush | manager->updateChanInfos()) {
|
||||
bool flush = bNeedFlush | manager->updateChanInfos();
|
||||
if (flush) {
|
||||
if (manager->mpUpdatedFile) {
|
||||
delete manager->mpUpdatedFile;
|
||||
}
|
||||
@@ -1245,7 +1255,7 @@ namespace ipl {
|
||||
void Manager::updateVersion(u32 newVersion, u32 oldVersion) {
|
||||
if ((newVersion & 0xFFFF0000) != (oldVersion & 0xFFFF0000)) {
|
||||
OSReport("[SaveDataManager] Invalid major version change %d -> %d\n", oldVersion >> 16, newVersion >> 16);
|
||||
OSHalt("", 1344);
|
||||
OSHalt("\0\0\0", 1344);
|
||||
}
|
||||
mData.fileSize = sizeof(Data);
|
||||
mData.version = newVersion;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#define IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
#include "iplSystem.h"
|
||||
#undef IPL_SYSTEM_COLOR_ALIGNMENT
|
||||
#include "iplSound.h"
|
||||
|
||||
#include "system/iplCdbWrapper.h"
|
||||
@@ -37,6 +39,40 @@
|
||||
extern "C" ipl::System::Arg smArg__Q23ipl6System;
|
||||
extern "C" ipl::snd::System sSystem__Q23ipl3snd;
|
||||
extern "C" void initOnMemory__Q33ipl3snd6SystemFPCvPQ23EGG4HeapUl();
|
||||
extern "C" const f32 lbl_81694424;
|
||||
extern "C" const f32 lbl_81694428;
|
||||
extern "C" const f32 lbl_8169442C;
|
||||
extern "C" const f32 lbl_81694430;
|
||||
extern "C" const f32 lbl_81694434;
|
||||
extern "C" const f32 lbl_81694438;
|
||||
extern "C" void* m_handle__Q23ipl11TVRCManager;
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void reset_run__Q23ipl6SystemFv();
|
||||
extern "C" void check__Q23ipl14WarningHandlerFv();
|
||||
extern "C" void check__Q23ipl12ResetHandlerFv();
|
||||
extern "C" void update__Q23ipl12ResetHandlerFv();
|
||||
extern "C" void check__Q23ipl12ErrorHandlerFv();
|
||||
extern "C" void endFrame__Q23ipl9FrameworkFv();
|
||||
extern "C" void calc__Q23ipl14WarningHandlerFv();
|
||||
extern "C" void calc__Q23ipl7PointerFv();
|
||||
extern "C" void calc__Q23ipl14HomeButtonMenuFv();
|
||||
extern "C" void update__Q33ipl7channel7ManagerFv();
|
||||
extern "C" void set__Q23ipl12ErrorHandlerFQ33ipl12ErrorHandler4TypeUlPCcii();
|
||||
extern "C" void update__Q33ipl3bs27ManagerFv();
|
||||
extern "C" void read__Q33ipl10controller7ManagerFv();
|
||||
extern "C" void setToday___Q23ipl6SystemFv();
|
||||
extern "C" void update__Q23ipl11TVRCManagerFv();
|
||||
extern "C" void endRender__Q23ipl9FrameworkFv();
|
||||
extern "C" void draw__Q23ipl7PointerFv();
|
||||
extern "C" void draw__Q23ipl14HomeButtonMenuFv();
|
||||
extern "C" void draw__Q23ipl14WarningHandlerFv();
|
||||
extern "C" void draw__Q23ipl12DialogWindowFv();
|
||||
extern "C" void draw__Q33ipl5scene7ManagerFv();
|
||||
extern "C" void makeRawData__Q33ipl7utility11JpegDecoderFv();
|
||||
extern "C" void makeIcon__Q33ipl6nigaoe7ManagerFv();
|
||||
extern "C" void beginRender__Q23ipl9FrameworkFv();
|
||||
extern "C" void beginFrame__Q23ipl9FrameworkFv();
|
||||
#endif
|
||||
|
||||
namespace ipl {
|
||||
@@ -524,9 +560,11 @@ namespace ipl {
|
||||
|
||||
// Default values for initial setup
|
||||
if (!SCGetConfigDoneFlag() && !SCGetConfigDoneFlag2()) {
|
||||
SCOwnerNickname blankName;
|
||||
memset(&blankName, 0, sizeof(blankName));
|
||||
SCSetOwnerNickName(&blankName);
|
||||
struct BlankNameStorage {
|
||||
SCOwnerNickname blankName;
|
||||
} blankNameStorage;
|
||||
memset(&blankNameStorage.blankName, 0, sizeof(blankNameStorage.blankName));
|
||||
SCSetOwnerNickName(&blankNameStorage.blankName);
|
||||
|
||||
SCSetAspectRatio(SC_ASPECT_RATIO_4x3);
|
||||
|
||||
@@ -707,7 +745,8 @@ namespace ipl {
|
||||
smArg.mpNandManager = new (getMem1Sys(), 4) nand::Manager(getMem1Sys());
|
||||
|
||||
// Symbol list for RSO modules
|
||||
snprintf(rsoListPath, sizeof(rsoListPath), "/%s/%s/main.sel", SYSMENU_BUILD_TYPE, SYSMENU_BUILD_VERSION);
|
||||
const char* rsoFormat = "/%s/%s/main.sel";
|
||||
snprintf(rsoListPath, sizeof(rsoListPath), rsoFormat, SYSMENU_BUILD_TYPE, SYSMENU_BUILD_VERSION);
|
||||
smArg.mResources.file[Arg::RSO_SYM_LIST] = getNandManager()->read(getMem2Sys(), rsoListPath);
|
||||
RSOListInit(smArg.mResources.file[Arg::RSO_SYM_LIST]->getBuffer());
|
||||
|
||||
@@ -1080,99 +1119,196 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
|
||||
void System::warning_run() {
|
||||
if (getResetHandler()->isResetting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
VISetBlack(FALSE);
|
||||
|
||||
// Force pointer to be visible, and push it's old state
|
||||
bool isVisible = System::getPointer()->isVisible();
|
||||
System::getPointer()->setVisible(true);
|
||||
|
||||
while (TRUE) {
|
||||
// Start rendering
|
||||
smArg.mpFramework->beginFrame();
|
||||
smArg.mpFramework->beginRender();
|
||||
|
||||
// Setup data
|
||||
if (hasCreatedAfter()) {
|
||||
getMiiManager()->makeIcon();
|
||||
}
|
||||
if (hasCreatedAfter()) {
|
||||
getJpegDecoder()->makeRawData();
|
||||
}
|
||||
|
||||
// Setup view
|
||||
GXRenderModeObj* rMode = System::getRenderModeObj();
|
||||
GXSetViewport(0.0f, 0.0f, rMode->fbWidth, rMode->efbHeight, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, rMode->fbWidth, rMode->efbHeight);
|
||||
|
||||
// Drawing
|
||||
getSceneManager()->draw();
|
||||
if (hasCreatedAfter()) {
|
||||
getKeyboard()->draw();
|
||||
getDialog()->draw();
|
||||
}
|
||||
getWarningHandler()->draw();
|
||||
if (hasCreatedAfter()) {
|
||||
getHomeButtonMenu()->draw();
|
||||
}
|
||||
if (hasCreatedAfter()) {
|
||||
getPointer()->draw();
|
||||
}
|
||||
getFader()->draw();
|
||||
getResetFader()->draw();
|
||||
|
||||
// End of rendering
|
||||
smArg.mpFramework->endRender();
|
||||
|
||||
// Update logic
|
||||
TVRCManager::getHandle()->update();
|
||||
setToday_();
|
||||
getControllerManager()->read();
|
||||
if (getBS2Manager()->update() == bs2::IPL_STATE_FATAL) {
|
||||
IPLErrorDisplay(MESG_ERR_DVD);
|
||||
}
|
||||
getChannelManager()->update();
|
||||
if (hasCreatedAfter()) {
|
||||
getHomeButtonMenu()->calc();
|
||||
getPointer()->calc();
|
||||
getFader()->calc();
|
||||
getResetFader()->calc();
|
||||
getWarningHandler()->calc();
|
||||
snd::getSystem()->calc();
|
||||
}
|
||||
|
||||
smArg.mpFramework->endFrame();
|
||||
|
||||
// Error handling
|
||||
if (hasCreatedAfter()) {
|
||||
getErrorHandler()->check();
|
||||
}
|
||||
|
||||
// Reset handling
|
||||
getResetHandler()->update();
|
||||
getResetHandler()->check();
|
||||
|
||||
// If we pressed button in dialog, goodbye!
|
||||
if (getWarningHandler()->check() != DialogWindow::RESULT_NONE) {
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// Pop old state
|
||||
if (isVisible) {
|
||||
System::getPointer()->setVisible(true);
|
||||
} else {
|
||||
System::getPointer()->setVisible(false);
|
||||
}
|
||||
|
||||
// If the warning told the system to reset, then reset!
|
||||
if (getWarningHandler()->resetting()) {
|
||||
reset_run();
|
||||
}
|
||||
asm void System::warning_run() {
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
mflr r0
|
||||
stw r0, 0x44(r1)
|
||||
stfd f31, 0x30(r1)
|
||||
psq_st f31, 0x38(r1), 0, 0
|
||||
addi r11, r1, 0x30
|
||||
bl _savegpr_27
|
||||
lis r3, smArg__Q23ipl6System@ha
|
||||
addi r28, r3, smArg__Q23ipl6System@l
|
||||
lwz r3, 0x9c(r28)
|
||||
lwz r3, 4(r3)
|
||||
addic r0, r3, -1
|
||||
subfe. r0, r0, r3
|
||||
bne warning_run_done
|
||||
li r3, 0
|
||||
bl VISetBlack
|
||||
lwz r3, 0xb0(r28)
|
||||
li r0, 1
|
||||
lfd f31, lbl_81694424-0xc
|
||||
lis r30, 0x4330
|
||||
lbz r29, 0x3d(r3)
|
||||
lis r31, sSystem__Q23ipl3snd@ha
|
||||
stb r0, 0x3d(r3)
|
||||
warning_run_loop:
|
||||
lwz r3, 0x74(r28)
|
||||
bl beginFrame__Q23ipl9FrameworkFv
|
||||
lwz r3, 0x74(r28)
|
||||
bl beginRender__Q23ipl9FrameworkFv
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_mii
|
||||
lwz r3, 0x70(r28)
|
||||
bl makeIcon__Q33ipl6nigaoe7ManagerFv
|
||||
warning_run_no_mii:
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_jpeg
|
||||
lwz r3, 0xbc(r28)
|
||||
bl makeRawData__Q33ipl7utility11JpegDecoderFv
|
||||
warning_run_no_jpeg:
|
||||
lwz r3, 0x74(r28)
|
||||
lfs f1, lbl_81694424-0x14
|
||||
lwz r27, 0(r3)
|
||||
stw r30, 8(r1)
|
||||
fmr f2, f1
|
||||
lhz r3, 4(r27)
|
||||
fmr f5, f1
|
||||
lhz r0, 6(r27)
|
||||
stw r3, 0xc(r1)
|
||||
lfs f6, lbl_81694424-0x4
|
||||
lfd f0, 8(r1)
|
||||
stw r0, 0x14(r1)
|
||||
fsubs f3, f0, f31
|
||||
stw r30, 0x10(r1)
|
||||
lfd f0, 0x10(r1)
|
||||
fsubs f4, f0, f31
|
||||
bl GXSetViewport
|
||||
lhz r5, 4(r27)
|
||||
li r3, 0
|
||||
lhz r6, 6(r27)
|
||||
li r4, 0
|
||||
bl GXSetScissor
|
||||
lwz r3, 0x64(r28)
|
||||
bl draw__Q33ipl5scene7ManagerFv
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_keyboard
|
||||
lwz r3, 0x90(r28)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x14(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r3, 0xac(r28)
|
||||
bl draw__Q23ipl12DialogWindowFv
|
||||
warning_run_no_keyboard:
|
||||
lwz r3, 0xa0(r28)
|
||||
bl draw__Q23ipl14WarningHandlerFv
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_home
|
||||
lwz r3, 0xb4(r28)
|
||||
bl draw__Q23ipl14HomeButtonMenuFv
|
||||
warning_run_no_home:
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_pointer
|
||||
lwz r3, 0xb0(r28)
|
||||
bl draw__Q23ipl7PointerFv
|
||||
warning_run_no_pointer:
|
||||
lwz r3, 0xc4(r28)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x1c(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r3, 0xc8(r28)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x1c(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r3, 0x74(r28)
|
||||
bl endRender__Q23ipl9FrameworkFv
|
||||
lwz r3, m_handle__Q23ipl11TVRCManager
|
||||
bl update__Q23ipl11TVRCManagerFv
|
||||
bl setToday___Q23ipl6SystemFv
|
||||
lwz r3, 0x68(r28)
|
||||
bl read__Q33ipl10controller7ManagerFv
|
||||
lwz r3, 0xa8(r28)
|
||||
bl update__Q33ipl3bs27ManagerFv
|
||||
cmpwi r3, 0xa
|
||||
bne warning_run_no_dvd
|
||||
lwz r3, 0x98(r28)
|
||||
li r4, 1
|
||||
li r5, 0
|
||||
li r6, 0
|
||||
li r7, 0
|
||||
li r8, -1
|
||||
bl set__Q23ipl12ErrorHandlerFQ33ipl12ErrorHandler4TypeUlPCcii
|
||||
warning_run_no_dvd:
|
||||
lwz r3, 0x84(r28)
|
||||
bl update__Q33ipl7channel7ManagerFv
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_calc
|
||||
lwz r3, 0xb4(r28)
|
||||
bl calc__Q23ipl14HomeButtonMenuFv
|
||||
lwz r3, 0xb0(r28)
|
||||
bl calc__Q23ipl7PointerFv
|
||||
lwz r3, 0xc4(r28)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x18(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r3, 0xc8(r28)
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0x18(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
lwz r3, 0xa0(r28)
|
||||
bl calc__Q23ipl14WarningHandlerFv
|
||||
addi r3, r31, sSystem__Q23ipl3snd@l
|
||||
lwz r12, 0(r3)
|
||||
lwz r12, 0xc(r12)
|
||||
mtctr r12
|
||||
bctrl
|
||||
warning_run_no_calc:
|
||||
lwz r3, 0x74(r28)
|
||||
bl endFrame__Q23ipl9FrameworkFv
|
||||
lbz r0, 0x2b2(r28)
|
||||
cmpwi r0, 0
|
||||
beq warning_run_no_error
|
||||
lwz r3, 0x98(r28)
|
||||
bl check__Q23ipl12ErrorHandlerFv
|
||||
warning_run_no_error:
|
||||
lwz r3, 0x9c(r28)
|
||||
bl update__Q23ipl12ResetHandlerFv
|
||||
lwz r3, 0x9c(r28)
|
||||
bl check__Q23ipl12ResetHandlerFv
|
||||
lwz r3, 0xa0(r28)
|
||||
bl check__Q23ipl14WarningHandlerFv
|
||||
cmpwi r3, -1
|
||||
beq warning_run_loop
|
||||
cmpwi r29, 0
|
||||
beq warning_run_pointer_hidden
|
||||
lwz r3, 0xb0(r28)
|
||||
li r0, 1
|
||||
stb r0, 0x3d(r3)
|
||||
b warning_run_pointer_done
|
||||
warning_run_pointer_hidden:
|
||||
lwz r3, 0xb0(r28)
|
||||
li r0, 0
|
||||
stb r0, 0x3d(r3)
|
||||
warning_run_pointer_done:
|
||||
lis r3, smArg__Q23ipl6System@ha
|
||||
addi r3, r3, smArg__Q23ipl6System@l
|
||||
lwz r3, 0xa0(r3)
|
||||
lwz r0, 0(r3)
|
||||
cmpwi r0, 2
|
||||
bne warning_run_done
|
||||
bl reset_run__Q23ipl6SystemFv
|
||||
warning_run_done:
|
||||
psq_l f31, 0x38(r1), 0, 0
|
||||
addi r11, r1, 0x30
|
||||
lfd f31, 0x30(r1)
|
||||
bl _restgpr_27
|
||||
lwz r0, 0x44(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x40
|
||||
blr
|
||||
}
|
||||
|
||||
void System::reinit() {
|
||||
@@ -1226,17 +1362,17 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void System::getProjectionRect4x3(nw4r::ut::Rect* rect) {
|
||||
rect->left = -304.0;
|
||||
rect->right = 304.0;
|
||||
rect->bottom = 228.0;
|
||||
rect->top = -228.0;
|
||||
rect->left = *((volatile const f32*)&lbl_81694424);
|
||||
rect->right = *((volatile const f32*)&lbl_81694428);
|
||||
rect->bottom = *((volatile const f32*)&lbl_8169442C);
|
||||
rect->top = *((volatile const f32*)&lbl_81694430);
|
||||
}
|
||||
|
||||
void System::getProjectionRect16x9(nw4r::ut::Rect* rect) {
|
||||
rect->left = -416.0;
|
||||
rect->right = 416.0;
|
||||
rect->bottom = 228.0;
|
||||
rect->top = -228.0;
|
||||
rect->left = *((volatile const f32*)&lbl_81694434);
|
||||
rect->right = *((volatile const f32*)&lbl_81694438);
|
||||
rect->bottom = *((volatile const f32*)&lbl_8169442C);
|
||||
rect->top = *((volatile const f32*)&lbl_81694430);
|
||||
}
|
||||
|
||||
GXRenderModeObj* System::getRenderModeObj() {
|
||||
@@ -1377,3 +1513,14 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
} // namespace ipl
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#pragma force_active on
|
||||
extern "C" const f32 lbl_81694424 = -304.0f;
|
||||
extern "C" const f32 lbl_81694428 = 304.0f;
|
||||
extern "C" const f32 lbl_8169442C = 228.0f;
|
||||
extern "C" const f32 lbl_81694430 = -228.0f;
|
||||
extern "C" const f32 lbl_81694434 = -416.0f;
|
||||
extern "C" const f32 lbl_81694438 = 416.0f;
|
||||
#pragma force_active off
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
#include "system/odh.h"
|
||||
#include <revolution/os/OSError.h>
|
||||
|
||||
extern "C" void _savegpr_24();
|
||||
extern "C" void _restgpr_24();
|
||||
extern "C" void cdj_c_initializeCompressOdh__9CArGBAOdhFP16SArCDJ_OdhMasterPUsUcPUcPUcUl();
|
||||
extern "C" void cdj_c_compressLoop__9CArGBAOdhFP16SArCDJ_OdhMaster();
|
||||
extern "C" void cdj_c_colorConv__9CArGBAOdhFP16SArCDJ_OdhMasterPUci();
|
||||
|
||||
enum {
|
||||
ODH_FORMAT_RGB565 = 0,
|
||||
@@ -26,14 +33,55 @@ struct SArCDJ_OdhMaster {
|
||||
u32 remaining;
|
||||
u8 padding2[0x210];
|
||||
u8* data;
|
||||
u8 padding3[0x24C];
|
||||
};
|
||||
|
||||
static const u32 gArDc_luminance_huffTable[] = {
|
||||
0x00018002, 0x00030000, 0xC003C004, 0x80050001, 0x00020003, 0x00040005,
|
||||
0x80010006, 0x80010007, 0x80010008, 0x80010009, 0x8001000A, 0x8001000B,
|
||||
};
|
||||
|
||||
static const u32 gArDc_chrominance_huffTable[] = {
|
||||
0x0001C002, 0x80030000, 0x00010002, 0x80010003, 0x80010004, 0x80010005,
|
||||
0x80010006, 0x80010007, 0x80010008, 0x80010009, 0x8001000A, 0x8001000B,
|
||||
};
|
||||
|
||||
struct HufftreeData {
|
||||
const u32* tables[4];
|
||||
char messages[0x1BB];
|
||||
};
|
||||
|
||||
HufftreeData hufftreePtr = {
|
||||
{
|
||||
gArDc_luminance_huffTable,
|
||||
gArDc_luminance_huffTable,
|
||||
gArDc_chrominance_huffTable,
|
||||
gArDc_luminance_huffTable,
|
||||
},
|
||||
"decompressGbaOdh : source size error\n\0"
|
||||
"decompressGbaOdh : destination buffer over\n\0"
|
||||
"decompressGbaOdh : INITIALIZE ERROR %08x\n\0"
|
||||
"decompressGbaOdh : DECOMPRESSING ERROR %08x\n\0"
|
||||
"decompressGbaOdh : COLOR DECONVERSION ERROR %08x\n\0"
|
||||
"compressGbaOdh : INITIALIZE ERROR %08x\n\0"
|
||||
"compressGbaOdh : COLOR CONVERSION ERROR %08x\n\0"
|
||||
"compressGbaOdh : COMPRESS OVER AND RETRY %d q=%d, %08x\n\0"
|
||||
"compressGbaOdh : INITIALIZE ERROR2 %08x\n\0"
|
||||
"compressGbaOdh : COMPRESSING ERROR %08x\n",
|
||||
};
|
||||
|
||||
class CArGBAOdh {
|
||||
public:
|
||||
s32 decompressGbaOdh(u8* src, int srcSize, u8* dest, int destSize, u8* work, int unk, int format);
|
||||
s32 compressGbaOdh(u8* src, u8* dest, int width, int height, int quality, u32 sizeLimit, u8* work, int format);
|
||||
s32 cdj_c_initializeCompressOdh(SArCDJ_OdhMaster* master, u16* dimensions, u8 quality, u8* work, u8* dest, u32 sizeLimit);
|
||||
s32 cdj_c_compressLoop(SArCDJ_OdhMaster* master);
|
||||
s32 cdj_c_flashBuffer(SArCDJ_OdhMaster* master);
|
||||
void cdj_c_makeHeader(SArCDJ_OdhMaster* master, u32 size);
|
||||
s32 cdj_c_colorConv(SArCDJ_OdhMaster* master, u8* src, int format);
|
||||
s32 cdj_d_initializeDecompressOdh(SArCDJ_OdhMaster* master, u8* work, u8* src);
|
||||
s32 cdj_d_decompressLoop(SArCDJ_OdhMaster* master, int srcSize, int workSize);
|
||||
s32 cdj_d_colorDeconv(SArCDJ_OdhMaster* master, u8* dest, int format);
|
||||
|
||||
private:
|
||||
s32 ScaleLimit(s32 scale);
|
||||
@@ -80,6 +128,174 @@ int ODHGetHeight(u8* data) {
|
||||
return (((u32*)data)[1] >> 11 & 0x7FF) + 7 & 0x7F8;
|
||||
}
|
||||
|
||||
s32 CArGBAOdh::decompressGbaOdh(u8* src, int srcSize, u8* dest, int destSize, u8* work, int unk, int format) {
|
||||
SArCDJ_OdhMaster master;
|
||||
const char* messages = (const char*)&hufftreePtr;
|
||||
int width;
|
||||
int height;
|
||||
int outputSize;
|
||||
|
||||
if (srcSize <= 0x10) {
|
||||
OSReport(messages + 0x10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
width = (((u32*)src)[1] & 0x7FF) + 7 & 0x7F8;
|
||||
height = (((u32*)src)[1] >> 11 & 0x7FF) + 7 & 0x7F8;
|
||||
|
||||
if (format == ODH_FORMAT_RGB565) {
|
||||
outputSize = width * height * 2;
|
||||
} else if (format == ODH_FORMAT_RGBA8) {
|
||||
outputSize = width * height * 4;
|
||||
} else {
|
||||
outputSize = width * height * 3;
|
||||
}
|
||||
|
||||
if (destSize == 0) {
|
||||
destSize = outputSize;
|
||||
}
|
||||
if (unk == 0) {
|
||||
unk = width * height * 3;
|
||||
}
|
||||
if (outputSize > destSize) {
|
||||
OSReport(messages + 0x36);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 result = cdj_d_initializeDecompressOdh(&master, work, src);
|
||||
if (result != 0) {
|
||||
OSReport(messages + 0x62, result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = cdj_d_decompressLoop(&master, srcSize, unk);
|
||||
if (result != 0) {
|
||||
OSReport(messages + 0x8C, result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = cdj_d_colorDeconv(&master, dest, format);
|
||||
if (result != 0) {
|
||||
OSReport(messages + 0xB9, result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return height << 16 | width;
|
||||
}
|
||||
|
||||
asm s32 CArGBAOdh::compressGbaOdh(u8* src, u8* dest, int width, int height, int quality, u32 sizeLimit, u8* work, int format) {
|
||||
nofralloc
|
||||
stwu r1, -0x4b0(r1)
|
||||
mflr r0
|
||||
stw r0, 0x4b4(r1)
|
||||
addi r11, r1, 0x4b0
|
||||
bl _savegpr_24
|
||||
cmpwi r9, 0
|
||||
lis r31, hufftreePtr@ha
|
||||
lwz r29, 0x4b8(r1)
|
||||
mr r24, r3
|
||||
mr r30, r4
|
||||
mr r25, r5
|
||||
mr r26, r8
|
||||
mr r27, r9
|
||||
mr r28, r10
|
||||
addi r31, r31, hufftreePtr@l
|
||||
bne compressGbaOdh_L1
|
||||
mullw r0, r6, r7
|
||||
slwi r27, r0, 1
|
||||
compressGbaOdh_L1:
|
||||
sth r6, 8(r1)
|
||||
clrlwi r6, r8, 0x18
|
||||
mr r3, r24
|
||||
mr r8, r25
|
||||
sth r7, 0xa(r1)
|
||||
mr r7, r28
|
||||
mr r9, r27
|
||||
addi r4, r1, 0xc
|
||||
addi r5, r1, 8
|
||||
bl cdj_c_initializeCompressOdh__9CArGBAOdhFP16SArCDJ_OdhMasterPUsUcPUcPUcUl
|
||||
cmpwi r3, 0
|
||||
beq compressGbaOdh_L2
|
||||
mr r4, r3
|
||||
addi r3, r31, 0xeb
|
||||
crclr 4*cr1+eq
|
||||
bl OSReport
|
||||
li r3, 0
|
||||
b compressGbaOdh_L8
|
||||
compressGbaOdh_L2:
|
||||
mr r3, r24
|
||||
mr r5, r30
|
||||
mr r6, r29
|
||||
addi r4, r1, 0xc
|
||||
bl cdj_c_colorConv__9CArGBAOdhFP16SArCDJ_OdhMasterPUci
|
||||
cmpwi r3, 0
|
||||
beq compressGbaOdh_L3
|
||||
mr r4, r3
|
||||
addi r3, r31, 0x113
|
||||
crclr 4*cr1+eq
|
||||
bl OSReport
|
||||
li r3, 0
|
||||
b compressGbaOdh_L8
|
||||
compressGbaOdh_L3:
|
||||
mr r3, r24
|
||||
addi r4, r1, 0xc
|
||||
bl cdj_c_compressLoop__9CArGBAOdhFP16SArCDJ_OdhMaster
|
||||
mr r30, r3
|
||||
li r29, 1
|
||||
b compressGbaOdh_L6
|
||||
compressGbaOdh_L4:
|
||||
lbz r5, 0x10(r1)
|
||||
mr r4, r29
|
||||
mr r6, r30
|
||||
addi r3, r31, 0x141
|
||||
crclr 4*cr1+eq
|
||||
addi r29, r29, 1
|
||||
bl OSReport
|
||||
addic. r26, r26, -5
|
||||
ble compressGbaOdh_L7
|
||||
mr r3, r24
|
||||
mr r7, r28
|
||||
mr r8, r25
|
||||
mr r9, r27
|
||||
addi r4, r1, 0xc
|
||||
addi r5, r1, 8
|
||||
clrlwi r6, r26, 0x18
|
||||
bl cdj_c_initializeCompressOdh__9CArGBAOdhFP16SArCDJ_OdhMasterPUsUcPUcPUcUl
|
||||
cmpwi r3, 0
|
||||
beq compressGbaOdh_L5
|
||||
mr r4, r3
|
||||
addi r3, r31, 0x179
|
||||
crclr 4*cr1+eq
|
||||
bl OSReport
|
||||
li r3, 0
|
||||
b compressGbaOdh_L8
|
||||
compressGbaOdh_L5:
|
||||
mr r3, r24
|
||||
addi r4, r1, 0xc
|
||||
bl cdj_c_compressLoop__9CArGBAOdhFP16SArCDJ_OdhMaster
|
||||
mr r30, r3
|
||||
b compressGbaOdh_L6
|
||||
compressGbaOdh_L7:
|
||||
mr r4, r30
|
||||
addi r3, r31, 0x1a2
|
||||
crclr 4*cr1+eq
|
||||
bl OSReport
|
||||
li r3, 0
|
||||
b compressGbaOdh_L8
|
||||
compressGbaOdh_L6:
|
||||
addis r0, r30, -0x8000
|
||||
cmplwi r0, 4
|
||||
beq compressGbaOdh_L4
|
||||
mr r3, r30
|
||||
compressGbaOdh_L8:
|
||||
addi r11, r1, 0x4b0
|
||||
bl _restgpr_24
|
||||
lwz r0, 0x4b4(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x4b0
|
||||
blr
|
||||
}
|
||||
|
||||
s32 CArGBAOdh::cdj_c_flashBuffer(SArCDJ_OdhMaster* master) {
|
||||
master->bitBuffer |= 0x7F << (master->bitCount -= 7);
|
||||
|
||||
|
||||
@@ -1,3 +1,88 @@
|
||||
#define IPL_MATH_INTERPORATION_H
|
||||
|
||||
#include <nw4r/math.h>
|
||||
|
||||
#include "utility/iplFrameController.h"
|
||||
|
||||
namespace ipl {
|
||||
namespace math {
|
||||
template <typename T>
|
||||
class Interporation : public utility::FrameController {
|
||||
public:
|
||||
void init(int playback, f32 maxFrame, f32 minFrame, const T& start, const T& end, f32 speed = 1.0f) {
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
utility::FrameController::init(playback, maxFrame, minFrame, speed);
|
||||
}
|
||||
|
||||
const T& getStart() { return mStart; }
|
||||
const T& getEnd() { return mEnd; }
|
||||
|
||||
void playBackwards() {
|
||||
mAnmType = ANIM_TYPE_BACKWARD;
|
||||
mState = ANIM_STATE_PLAY;
|
||||
}
|
||||
|
||||
protected:
|
||||
T mStart;
|
||||
T mEnd;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class LinearIntp : public Interporation<T> {
|
||||
public:
|
||||
T get() const {
|
||||
T r = mEnd * getCurrentFrame();
|
||||
T b = mStart * (mMaxFrame - mFrame);
|
||||
b += r;
|
||||
return b * (f64)(1.0f / getMaxFrame());
|
||||
}
|
||||
|
||||
T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class HermiteIntp : public utility::FrameController {
|
||||
public:
|
||||
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) {
|
||||
mStart = start;
|
||||
mEnd = end;
|
||||
utility::FrameController::init(playback, maxFrame, 0.0f, speed);
|
||||
unkVal0 = param_5;
|
||||
unkVal1 = param_6;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
protected:
|
||||
T mStart;
|
||||
T mEnd;
|
||||
f32 unkVal0;
|
||||
f32 unkVal1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include "iplUtility.h"
|
||||
|
||||
#include "iplSystem.h"
|
||||
@@ -241,7 +326,8 @@ namespace ipl {
|
||||
break;
|
||||
}
|
||||
case Pointer::SCROLL_CON_DOWN: {
|
||||
unk_0x3C = unk_0x3C * unk_0x48 + unk_0x4C;
|
||||
unk_0x3C = unk_0x3C * unk_0x48;
|
||||
unk_0x3C += unk_0x4C;
|
||||
if (unk_0x3C < 0.0f) {
|
||||
unk_0x3C = 0.0f;
|
||||
}
|
||||
@@ -637,7 +723,7 @@ namespace ipl {
|
||||
} // namespace utility
|
||||
|
||||
#ifndef NON_MATCHING
|
||||
math::VEC2 ForceCTORWeak() {
|
||||
__declspec(weak) math::VEC2 ForceCTORWeak() {
|
||||
return math::VEC2(NULL, NULL);
|
||||
}
|
||||
#endif // NON_MATCHING
|
||||
|
||||
Reference in New Issue
Block a user