02-15-2022, 01:25 AM
In recent news, ripping delta morphs, and ripping/editing DMAs are now possible with Psycrow's Blender plugin here: https://github.com/Psycrow101/Blender-3D-SH-Dma-plugin
There's one issue though: Custom morphs aren't possible yet, likely due to handling normals
DeadlyFugu's notes on Deltas:
```````````
struct DeltaMorphPLG {
// NOTE: for some absurd reason this struct is NOT aligned after each string, meaning most of the data is misaligned
u32 targetCount;
struct {
u32 nameLength;
char name[nameLength]; // null terminated, name length includes null character
u32 flags = {2, 12}; // 0x10: has morphNormals
u32 unknown = {2, 6};
u32 mappingLength;
u32 morphVertexCount;
// mapping is a series of bytes each representing a run of vertices
// lowest 7 bits is length
// if highest bit is 1 then vertices start..length are included
// in morphVertices, else they are excluded
// 'start' is the end of the run
// e.g. 830281 means:
// 3 vertices 0,1,2 included (0x83)
// 2 vertices 3,4 excluded (0x02)
// 1 vertex 5 included (0x81)
// vertex 5 would have it's position delta stored in morphVertices[3]
u8 mapping[mappingLength];
// values added to each vertex
// mapping from morphVertex index to real vertex index given
// by above mapping array
struct {
float x, y, z;
} morphVertices[morphVertexCount];
if (flags & 0x10) {
struct {
float x, y, z;
} morphNormals[morphVertexCount];
}
// bounding sphere?
float x, y, z;
float radius;
} target[targetCount];
}
`````````````
There's one issue though: Custom morphs aren't possible yet, likely due to handling normals
DeadlyFugu's notes on Deltas:
```````````
struct DeltaMorphPLG {
// NOTE: for some absurd reason this struct is NOT aligned after each string, meaning most of the data is misaligned
u32 targetCount;
struct {
u32 nameLength;
char name[nameLength]; // null terminated, name length includes null character
u32 flags = {2, 12}; // 0x10: has morphNormals
u32 unknown = {2, 6};
u32 mappingLength;
u32 morphVertexCount;
// mapping is a series of bytes each representing a run of vertices
// lowest 7 bits is length
// if highest bit is 1 then vertices start..length are included
// in morphVertices, else they are excluded
// 'start' is the end of the run
// e.g. 830281 means:
// 3 vertices 0,1,2 included (0x83)
// 2 vertices 3,4 excluded (0x02)
// 1 vertex 5 included (0x81)
// vertex 5 would have it's position delta stored in morphVertices[3]
u8 mapping[mappingLength];
// values added to each vertex
// mapping from morphVertex index to real vertex index given
// by above mapping array
struct {
float x, y, z;
} morphVertices[morphVertexCount];
if (flags & 0x10) {
struct {
float x, y, z;
} morphNormals[morphVertexCount];
}
// bounding sphere?
float x, y, z;
float radius;
} target[targetCount];
}
`````````````