Match and link CPASParmInfo

Former-commit-id: a04a2267f4
This commit is contained in:
Phillip Stephens 2023-01-11 18:43:43 -08:00
parent ec794eef1a
commit ec14321dcf
10 changed files with 118 additions and 59 deletions

View File

@ -98,41 +98,6 @@ lbl_802E5888:
/* 802E58A0 002E2800 38 21 00 30 */ addi r1, r1, 0x30
/* 802E58A4 002E2804 4E 80 00 20 */ blr
.global PutTo__10CPrimitiveCFR13COutputStream
PutTo__10CPrimitiveCFR13COutputStream:
/* 802E58A8 002E2808 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 802E58AC 002E280C 7C 08 02 A6 */ mflr r0
/* 802E58B0 002E2810 90 01 00 24 */ stw r0, 0x24(r1)
/* 802E58B4 002E2814 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 802E58B8 002E2818 7C 9F 23 78 */ mr r31, r4
/* 802E58BC 002E281C 93 C1 00 18 */ stw r30, 0x18(r1)
/* 802E58C0 002E2820 7C 7E 1B 78 */ mr r30, r3
/* 802E58C4 002E2824 80 03 00 00 */ lwz r0, 0(r3)
/* 802E58C8 002E2828 7F E3 FB 78 */ mr r3, r31
/* 802E58CC 002E282C 90 01 00 0C */ stw r0, 0xc(r1)
/* 802E58D0 002E2830 48 05 9B E9 */ bl FlushShiftRegister__13COutputStreamFv
/* 802E58D4 002E2834 7F E3 FB 78 */ mr r3, r31
/* 802E58D8 002E2838 38 81 00 0C */ addi r4, r1, 0xc
/* 802E58DC 002E283C 38 A0 00 04 */ li r5, 4
/* 802E58E0 002E2840 48 05 9C C9 */ bl DoPut__13COutputStreamFPCvUl
/* 802E58E4 002E2844 80 1E 00 04 */ lwz r0, 4(r30)
/* 802E58E8 002E2848 7F E3 FB 78 */ mr r3, r31
/* 802E58EC 002E284C 90 01 00 08 */ stw r0, 8(r1)
/* 802E58F0 002E2850 48 05 9B C9 */ bl FlushShiftRegister__13COutputStreamFv
/* 802E58F4 002E2854 7F E3 FB 78 */ mr r3, r31
/* 802E58F8 002E2858 38 81 00 08 */ addi r4, r1, 8
/* 802E58FC 002E285C 38 A0 00 04 */ li r5, 4
/* 802E5900 002E2860 48 05 9C A9 */ bl DoPut__13COutputStreamFPCvUl
/* 802E5904 002E2864 7F E4 FB 78 */ mr r4, r31
/* 802E5908 002E2868 38 7E 00 08 */ addi r3, r30, 8
/* 802E590C 002E286C 48 05 83 A9 */ bl "PutTo__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>CFR13COutputStream"
/* 802E5910 002E2870 80 01 00 24 */ lwz r0, 0x24(r1)
/* 802E5914 002E2874 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 802E5918 002E2878 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 802E591C 002E287C 7C 08 03 A6 */ mtlr r0
/* 802E5920 002E2880 38 21 00 20 */ addi r1, r1, 0x20
/* 802E5924 002E2884 4E 80 00 20 */ blr
.section .sdata2, "a"
.balign 8
.global lbl_805AE300
@ -140,4 +105,3 @@ lbl_805AE300:
# ROM: 0x3FABA0
.4byte 0
.4byte 0

View File

@ -2,6 +2,41 @@
.section .text, "ax"
.global PutTo__10CPrimitiveCFR13COutputStream
PutTo__10CPrimitiveCFR13COutputStream:
/* 802E58A8 002E2808 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 802E58AC 002E280C 7C 08 02 A6 */ mflr r0
/* 802E58B0 002E2810 90 01 00 24 */ stw r0, 0x24(r1)
/* 802E58B4 002E2814 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 802E58B8 002E2818 7C 9F 23 78 */ mr r31, r4
/* 802E58BC 002E281C 93 C1 00 18 */ stw r30, 0x18(r1)
/* 802E58C0 002E2820 7C 7E 1B 78 */ mr r30, r3
/* 802E58C4 002E2824 80 03 00 00 */ lwz r0, 0(r3)
/* 802E58C8 002E2828 7F E3 FB 78 */ mr r3, r31
/* 802E58CC 002E282C 90 01 00 0C */ stw r0, 0xc(r1)
/* 802E58D0 002E2830 48 05 9B E9 */ bl FlushShiftRegister__13COutputStreamFv
/* 802E58D4 002E2834 7F E3 FB 78 */ mr r3, r31
/* 802E58D8 002E2838 38 81 00 0C */ addi r4, r1, 0xc
/* 802E58DC 002E283C 38 A0 00 04 */ li r5, 4
/* 802E58E0 002E2840 48 05 9C C9 */ bl DoPut__13COutputStreamFPCvUl
/* 802E58E4 002E2844 80 1E 00 04 */ lwz r0, 4(r30)
/* 802E58E8 002E2848 7F E3 FB 78 */ mr r3, r31
/* 802E58EC 002E284C 90 01 00 08 */ stw r0, 8(r1)
/* 802E58F0 002E2850 48 05 9B C9 */ bl FlushShiftRegister__13COutputStreamFv
/* 802E58F4 002E2854 7F E3 FB 78 */ mr r3, r31
/* 802E58F8 002E2858 38 81 00 08 */ addi r4, r1, 8
/* 802E58FC 002E285C 38 A0 00 04 */ li r5, 4
/* 802E5900 002E2860 48 05 9C A9 */ bl DoPut__13COutputStreamFPCvUl
/* 802E5904 002E2864 7F E4 FB 78 */ mr r4, r31
/* 802E5908 002E2868 38 7E 00 08 */ addi r3, r30, 8
/* 802E590C 002E286C 48 05 83 A9 */ bl "PutTo__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>CFR13COutputStream"
/* 802E5910 002E2870 80 01 00 24 */ lwz r0, 0x24(r1)
/* 802E5914 002E2874 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 802E5918 002E2878 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 802E591C 002E287C 7C 08 03 A6 */ mtlr r0
/* 802E5920 002E2880 38 21 00 20 */ addi r1, r1, 0x20
/* 802E5924 002E2884 4E 80 00 20 */ blr
.global __ct__10CPrimitiveFR12CInputStream
__ct__10CPrimitiveFR12CInputStream:
/* 802E5928 002E2888 94 21 FF E0 */ stwu r1, -0x20(r1)

View File

@ -496,7 +496,7 @@ LIBS = [
["Kyoto/Animation/CPASAnimParm", True],
"Kyoto/Animation/CPASAnimState",
"Kyoto/Animation/CPASDatabase",
"Kyoto/Animation/CPASParmInfo",
["Kyoto/Animation/CPASParmInfo", True],
["Kyoto/Animation/CPrimitive", True],
"Kyoto/Animation/CSequenceHelper",
["Kyoto/Animation/CTransition", True],

View File

@ -36,6 +36,8 @@ public:
bool GetBoolValue() const;
int GetEnumValue() const;
UParmValue GetParameter() { return x0_value; }
private:
UParmValue x0_value;
EParmType x4_type;

View File

@ -3,29 +3,13 @@
#include "types.h"
#include "Kyoto/Animation/CharacterCommon.hpp"
#include "Kyoto/Animation/CPASAnimParm.hpp"
#include "Kyoto/Animation/CPASParmInfo.hpp"
#include "Kyoto/Animation/CharacterCommon.hpp"
#include "rstl/reserved_vector.hpp"
#include "rstl/vector.hpp"
class CPASParmInfo {
public:
enum EWeightFunction {
kWF_ExactMatch,
kWF_PercentError,
kWF_AngularPercent,
kWF_NoWeight,
};
private:
CPASAnimParm::EParmType x0_type;
EWeightFunction x4_weightFunction;
float x8_weight;
CPASAnimParm::UParmValue xc_min;
CPASAnimParm::UParmValue x10_max;
};
class CPASAnimInfo {
private:
uint x0_id;
@ -37,7 +21,7 @@ public:
CPASAnimParm GetAnimParmData(int, unsigned int) const;
pas::EAnimationState GetStateId() const { return x0_id; }
bool HasAnims() const { return static_cast<uint>(x14_anims.size()) != 0; }
bool HasAnims() const { return static_cast< uint >(x14_anims.size()) != 0; }
private:
pas::EAnimationState x0_id;

View File

@ -0,0 +1,26 @@
#ifndef _CPASPARMINFO
#define _CPASPARMINFO
#include "Kyoto/Animation/CPASAnimParm.hpp"
class CInputStream;
class CPASParmInfo {
public:
enum EWeightFunction {
kWF_Invalid = -1,
kWF_ExactMatch,
kWF_PercentError,
kWF_AngularPercent,
kWF_NoWeight,
};
CPASParmInfo(CInputStream& in);
private:
CPASAnimParm::EParmType x0_type;
EWeightFunction x4_weightFunction;
float x8_weight;
CPASAnimParm::UParmValue xc_min;
CPASAnimParm::UParmValue x10_max;
};
#endif // _CPASPARMINFO

View File

@ -6,9 +6,11 @@
#include "rstl/string.hpp"
class CInputStream;
class COutputStream;
class CPrimitive {
public:
CPrimitive(CInputStream& in);
void PutTo(COutputStream& out) const;
CAssetId GetAnimResId() const { return x0_animId; }
private:

View File

@ -6,6 +6,7 @@
#include "rstl/rmemory_allocator.hpp"
class CInputStream;
class COutputStream;
namespace rstl {
template < typename _CharTp >
@ -112,6 +113,7 @@ public:
bool operator<(const basic_string& other) const;
const char* data() const { return x0_ptr; }
void PutTo(COutputStream& out) const;
};
template < typename _CharTp, typename Traits, typename Alloc >

View File

@ -0,0 +1,41 @@
#include "Kyoto/Animation/CPASParmInfo.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
CPASParmInfo::CPASParmInfo(CInputStream& in)
: x0_type(CPASAnimParm::kPT_None)
, x4_weightFunction(kWF_Invalid)
, x8_weight(0.f)
, xc_min(CPASAnimParm::FromInt32(0).GetParameter())
, x10_max(CPASAnimParm::FromInt32(0).GetParameter()) {
CPASAnimParm::EParmType type = CPASAnimParm::EParmType(in.ReadInt32());
x0_type = type;
x4_weightFunction = EWeightFunction(in.ReadInt32());
x8_weight = in.ReadFloat();
switch (type) {
case CPASAnimParm::kPT_Int32:
xc_min.m_int = in.ReadInt32();
x10_max.m_int = in.ReadInt32();
break;
case CPASAnimParm::kPT_UInt32:
xc_min.m_uint = in.ReadLong();
x10_max.m_uint = in.ReadLong();
break;
case CPASAnimParm::kPT_Float:
xc_min.m_float = in.ReadFloat();
x10_max.m_float = in.ReadFloat();
break;
case CPASAnimParm::kPT_Bool:
xc_min.m_bool = in.ReadBool();
x10_max.m_bool = in.ReadBool();
break;
case CPASAnimParm::kPT_Enum:
xc_min.m_int = in.ReadInt32();
x10_max.m_int = in.ReadInt32();
break;
default:
break;
}
}

View File

@ -1,10 +1,13 @@
#include "Kyoto/Animation/CPrimitive.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/Streams/COutputStream.hpp"
CPrimitive::CPrimitive(CInputStream& in)
: x0_animId(in.Get<CAssetId>())
, x4_animIdx(in.Get<int>())
, x8_animName(in) {
: x0_animId(in.Get< CAssetId >()), x4_animIdx(in.Get< int >()), x8_animName(in) {}
void CPrimitive::PutTo(COutputStream& out) const {
out.Put(x0_animId);
out.Put(x4_animIdx);
out.Put(x8_animName);
}