mirror of https://github.com/zeldaret/botw.git
Add NXArgs
This commit is contained in:
parent
1d7ce82908
commit
729a6291b6
|
@ -54193,12 +54193,12 @@ Address,Quality,Size,Name
|
||||||
0x0000007100901a90,U,000068,
|
0x0000007100901a90,U,000068,
|
||||||
0x0000007100901ad4,U,000100,
|
0x0000007100901ad4,U,000100,
|
||||||
0x0000007100901b38,U,000108,
|
0x0000007100901b38,U,000108,
|
||||||
0x0000007100901ba4,U,000164,nxargs::createInstance
|
0x0000007100901ba4,O,000164,_ZN4ksys6nxargs14createInstanceEPN4sead4HeapE
|
||||||
0x0000007100901c48,U,000152,nxargs::dtor
|
0x0000007100901c48,U,000152,nxargs::dtor
|
||||||
0x0000007100901ce0,U,000148,nxargs::dtorDelete
|
0x0000007100901ce0,U,000148,nxargs::dtorDelete
|
||||||
0x0000007100901d74,U,000804,nxargs::init
|
0x0000007100901d74,O,000804,_ZN4ksys6nxargs4initEPN4sead4HeapE
|
||||||
0x0000007100902098,U,000632,nxargs::allocEntries
|
0x0000007100902098,O,000632,_ZN4ksys6nxargs12allocEntriesEPN4sead4HeapEPKh
|
||||||
0x0000007100902310,U,003168,nxargs::handleArgs
|
0x0000007100902310,W,003168,_ZN4ksys6nxargs10handleArgsEv
|
||||||
0x0000007100902f70,U,000004,j__ZdlPv_410
|
0x0000007100902f70,U,000004,j__ZdlPv_410
|
||||||
0x0000007100902f74,U,000240,_ZN4sead15FixedSafeStringILi37EEaSERKNS_14SafeStringBaseIcEE
|
0x0000007100902f74,U,000240,_ZN4sead15FixedSafeStringILi37EEaSERKNS_14SafeStringBaseIcEE
|
||||||
0x0000007100903064,U,000004,j__ZdlPv_411
|
0x0000007100903064,U,000004,j__ZdlPv_411
|
||||||
|
|
Can't render this file because it is too large.
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3077c49affa2770c5336764ca062ed50e7444b5b
|
Subproject commit 00bb399f3c0169d77044f857f39ba9e04a896fde
|
|
@ -23,6 +23,8 @@ target_sources(uking PRIVATE
|
||||||
MemoryProfiler.h
|
MemoryProfiler.h
|
||||||
MessageCapture.cpp
|
MessageCapture.cpp
|
||||||
MessageCapture.h
|
MessageCapture.h
|
||||||
|
NXArgs.cpp
|
||||||
|
NXArgs.h
|
||||||
OcclusionQueryCylinder.cpp
|
OcclusionQueryCylinder.cpp
|
||||||
OcclusionQueryCylinder.h
|
OcclusionQueryCylinder.h
|
||||||
OverlayArena.cpp
|
OverlayArena.cpp
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
#include "KingSystem/System/NXArgs.h"
|
||||||
|
|
||||||
|
namespace ksys {
|
||||||
|
|
||||||
|
SEAD_SINGLETON_DISPOSER_IMPL(nxargs)
|
||||||
|
|
||||||
|
void nxargs::init(sead::Heap* heap) {
|
||||||
|
sead::Heap* nxargsheap = sead::ExpHeap::create(
|
||||||
|
0x13E8, "nxargsHeap", heap, 8, sead::ExpHeap::HeapDirection::cHeapDirection_Reverse, false);
|
||||||
|
auto* data = new (nxargsheap) u8[0x1000];
|
||||||
|
size_t unknown;
|
||||||
|
|
||||||
|
while (nn::oe::TryPopLaunchParameter(&unknown, data, 0x1000)) {
|
||||||
|
{
|
||||||
|
sead::FixedSafeString<5> inputmagic("");
|
||||||
|
inputmagic.format("%s", reinterpret_cast<char*>(data));
|
||||||
|
if (inputmagic != "BotW")
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
using sead::BitUtil::bitCastPtr;
|
||||||
|
mResField4 = bitCastPtr<u16>(data, 4);
|
||||||
|
mResField6 = bitCastPtr<u8>(data, 6);
|
||||||
|
mType = bitCastPtr<ArgsType>(data, 7);
|
||||||
|
if (mType == ArgsType::CreateActors) {
|
||||||
|
mNumEntries = bitCastPtr<u8>(data, 0xC);
|
||||||
|
nxargs::allocEntries(heap, data);
|
||||||
|
} else {
|
||||||
|
mType = ArgsType::None;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nxargsheap->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void nxargs::allocEntries(sead::Heap* heap, const u8* data) {
|
||||||
|
const s32 size = mNumEntries;
|
||||||
|
|
||||||
|
if (mNumEntries == 0)
|
||||||
|
return;
|
||||||
|
mEntries.allocBufferAssert(size, heap);
|
||||||
|
|
||||||
|
using sead::BitUtil::bitCastPtr;
|
||||||
|
u32 offset = 0x10;
|
||||||
|
for (u8 i = 0; i < mNumEntries; i++) {
|
||||||
|
LaunchParamEntry* currEntry = &mEntries[i];
|
||||||
|
currEntry->actorNameHash = bitCastPtr<u32>(data, offset + 0);
|
||||||
|
currEntry->dropActorNameHash = bitCastPtr<u32>(data, offset + 4);
|
||||||
|
currEntry->positionOffset.x = bitCastPtr<f32>(data, offset + 8);
|
||||||
|
currEntry->positionOffset.y = bitCastPtr<f32>(data, offset + 0xc);
|
||||||
|
currEntry->positionOffset.z = bitCastPtr<f32>(data, offset + 0x10);
|
||||||
|
currEntry->rotation.x = bitCastPtr<f32>(data, offset + 0x14);
|
||||||
|
currEntry->rotation.y = bitCastPtr<f32>(data, offset + 0x18);
|
||||||
|
currEntry->rotation.z = bitCastPtr<f32>(data, offset + 0x1c);
|
||||||
|
currEntry->velocity.x = bitCastPtr<f32>(data, offset + 0x20);
|
||||||
|
currEntry->velocity.y = bitCastPtr<f32>(data, offset + 0x24);
|
||||||
|
currEntry->velocity.z = bitCastPtr<f32>(data, offset + 0x28);
|
||||||
|
currEntry->flags = bitCastPtr<LaunchParamFlag>(data, offset + 0x2c);
|
||||||
|
s64 numConditions = bitCastPtr<u8>(data, offset + 0x2d);
|
||||||
|
currEntry->numConditions = numConditions;
|
||||||
|
offset += 0x30;
|
||||||
|
|
||||||
|
if (numConditions > 0) {
|
||||||
|
currEntry->conditions.allocBufferAssert(numConditions, heap);
|
||||||
|
for (u8 j = 0; j < currEntry->numConditions; j++) {
|
||||||
|
LaunchParamEntryCondition* currCondition = &currEntry->conditions[j];
|
||||||
|
currCondition->flagNameHash = bitCastPtr<u32>(data, offset);
|
||||||
|
currCondition->flagDataType =
|
||||||
|
bitCastPtr<LaunchParamEntryConditionDataType>(data, offset + 4);
|
||||||
|
currCondition->operation =
|
||||||
|
bitCastPtr<ActorEntryConditionOperation>(data, offset + 5);
|
||||||
|
currCondition->rhsValue = bitCastPtr<f32>(data, offset + 8);
|
||||||
|
offset += 0xc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ksys
|
|
@ -0,0 +1,99 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <basis/seadNew.h>
|
||||||
|
#include <container/seadBuffer.h>
|
||||||
|
#include <heap/seadDisposer.h>
|
||||||
|
#include <heap/seadExpHeap.h>
|
||||||
|
#include <math/seadVector.h>
|
||||||
|
#include <nn/oe.h>
|
||||||
|
#include <prim/seadSafeString.h>
|
||||||
|
#include "KingSystem/Utils/Types.h"
|
||||||
|
|
||||||
|
namespace ksys {
|
||||||
|
|
||||||
|
class nxargs {
|
||||||
|
SEAD_SINGLETON_DISPOSER(nxargs)
|
||||||
|
nxargs() : mResField4{0}, mResField6{0}, mType{ArgsType::None}, mNumEntries{0} {}
|
||||||
|
virtual ~nxargs();
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum class LaunchParamFlag : u8 {
|
||||||
|
None = 0,
|
||||||
|
HasDropActor = 1,
|
||||||
|
_2 = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LaunchParamEntrySpawnCondition {
|
||||||
|
u32 resfield0;
|
||||||
|
u32 resfield8;
|
||||||
|
u8 resfield4;
|
||||||
|
u8 resfield5;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class LaunchParamEntryConditionDataType : u8 {
|
||||||
|
None = 0,
|
||||||
|
Bool = 1,
|
||||||
|
S32 = 2,
|
||||||
|
F32 = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class ActorEntryConditionOperation : u8 {
|
||||||
|
None = 0,
|
||||||
|
Eq = 1,
|
||||||
|
NotEq = 2,
|
||||||
|
Gt = 3,
|
||||||
|
Gte = 4,
|
||||||
|
Lt = 5,
|
||||||
|
Lte = 6,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LaunchParamEntryCondition {
|
||||||
|
s32 flagNameHash;
|
||||||
|
f32 rhsValue;
|
||||||
|
LaunchParamEntryConditionDataType flagDataType;
|
||||||
|
ActorEntryConditionOperation operation;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LaunchParamEntry {
|
||||||
|
u32 actorNameHash;
|
||||||
|
u32 dropActorNameHash;
|
||||||
|
sead::Vector3f positionOffset;
|
||||||
|
sead::Vector3f rotation;
|
||||||
|
sead::Vector3f velocity;
|
||||||
|
LaunchParamFlag flags{};
|
||||||
|
u8 numConditions;
|
||||||
|
sead::Buffer<LaunchParamEntryCondition> conditions;
|
||||||
|
};
|
||||||
|
|
||||||
|
KSYS_CHECK_SIZE_NX150(LaunchParamEntry, 0x40);
|
||||||
|
|
||||||
|
enum class ArgsType : u8 {
|
||||||
|
None = 0,
|
||||||
|
CreateActors = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ResLaunchParamDataHeader {
|
||||||
|
char magic[4];
|
||||||
|
u16 _4;
|
||||||
|
u8 _6;
|
||||||
|
ArgsType type;
|
||||||
|
u32 padding;
|
||||||
|
u8 numEntries;
|
||||||
|
u8 padding2[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
void init(sead::Heap* heap);
|
||||||
|
void allocEntries(sead::Heap* heap, const u8* data);
|
||||||
|
void handleArgs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
u16 mResField4;
|
||||||
|
u8 mResField6;
|
||||||
|
ArgsType mType;
|
||||||
|
u8 mNumEntries;
|
||||||
|
sead::Buffer<LaunchParamEntry> mEntries;
|
||||||
|
bool mHasHandledArgs = false;
|
||||||
|
};
|
||||||
|
KSYS_CHECK_SIZE_NX150(nxargs, 0x48);
|
||||||
|
|
||||||
|
} // namespace ksys
|
Loading…
Reference in New Issue