rickomax / psxprev

PSXPREV - Playstation (PSX) Files Previewer/Extractor
BSD 2-Clause "Simplified" License
193 stars 10 forks source link

Increase support for HMD models #49

Closed trigger-segfault closed 1 year ago

trigger-segfault commented 1 year ago

Short explanation

Support for HMD has been majorly revamped. A ton of bugs were fixed that either resulted in incorrect positions, or invalid data and exceptions.

All LEGO Rock Raiders (PSX) HMD models (that I've been given) are now supported (thus fixing issue #47). Some models seem to have issues with tiling (refinery.hmd) but these may be issues with the models themselves vs. with the reader, as they are unused models. Some models (rockmons.hmd and rockwhal.hmd) have image data that's pointed to past the bounds of the file data, but the model data itself is still valid.

Preview: A rock monster HMD model with limb attachments ![image](https://github.com/rickomax/psxprev/assets/9752430/e5d69a2a-09d1-459b-94ac-df3aa0d110e8)

Changes and additions

What hasn't been fixed


Detailed explanation

HMDParser

ParseHMD

ReadCoord

ReadMatrix

// size: 0x20
struct MATRIX {
    // offset: 0000 (18 bytes)
    short m[3][3];
    // offset: 0014 (12 bytes)
    long t[3];
};

ProccessPrimitive

ProcessImageData

ProcessNonSharedGeometryData

ProcessSharedGeometryData

TMDHelper

CreateHMDPacketStructure

ParsePrimitiveData

AddTrianglesToGroup


ModelEntity

Triangle

TIMParser

rickomax commented 1 year ago

Man, you are awesome! Thank you for the efforts! Merging it now!