Build viewer/editor #13
3 changed files with 113 additions and 0 deletions
|
@ -19,4 +19,13 @@
|
|||
constexpr char mass_name_locator[] = "Name_45_A037C5D54E53456407BDF091344529BB\0\f\0\0\0StrProperty";
|
||||
constexpr char steamid_locator[] = "Account\0\f\0\0\0StrProperty";
|
||||
|
||||
constexpr char neck_slider_locator[] = "NeckLength_6_ED6AF79849C27CD1A9D523A09E2BFE58\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char body_slider_locator[] = "BodyLength_7_C16287754CBA96C93BAE36A5C154996A\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char shoulders_slider_locator[] = "ShoulderLength_8_220EDF304F1C1226F0D8D39117FB3883\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char hips_slider_locator[] = "HipLength_14_02AEEEAC4376087B9C51F0AA7CC92818\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char uarms_slider_locator[] = "ArmUpperLength_10_249FDA3E4F3B399E7B9E5C9B7C765EAE\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char larms_slider_locator[] = "ArmLowerLength_12_ACD0F02745C28882619376926292FB36\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char ulegs_slider_locator[] = "LegUpperLength_16_A7C4C71249A3776F7A543D96819C0C61\0\x0e\0\0\0FloatProperty";
|
||||
constexpr char llegs_slider_locator[] = "LegLowerLength_18_D2DF39964EA0F2A2129D0491B08A032F\0\x0e\0\0\0FloatProperty";
|
||||
|
||||
constexpr char frame_styles_locator[] = "Styles_32_00A3B3284B37F1E7819458844A20EB48\0\x0e\0\0\0ArrayProperty\0\x14\0\0\0\0\0\0\0\f\0\0\0IntProperty\0\0\x04\0\0\0";
|
||||
|
|
|
@ -68,6 +68,7 @@ void Mass::refreshValues() {
|
|||
}
|
||||
|
||||
getFrameStyles();
|
||||
getJointSliders();
|
||||
}
|
||||
|
||||
auto Mass::filename() -> std::string const&{
|
||||
|
@ -82,6 +83,10 @@ auto Mass::state() -> State {
|
|||
return _state;
|
||||
}
|
||||
|
||||
auto Mass::jointSliders() -> Joints const& {
|
||||
return _sliders;
|
||||
}
|
||||
|
||||
auto Mass::frameStyles() -> Containers::StaticArrayView<4, Int> {
|
||||
return _frameStyles;
|
||||
}
|
||||
|
@ -180,6 +185,90 @@ void Mass::getName() {
|
|||
}
|
||||
}
|
||||
|
||||
void Mass::getJointSliders() {
|
||||
std::string path = Utility::Directory::join(_folder, _filename);
|
||||
|
||||
if(!Utility::Directory::exists(path)) {
|
||||
_lastError = path + " couldn't be found.";
|
||||
_state = State::Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
auto mmap = Utility::Directory::mapRead(path);
|
||||
|
||||
auto iter = std::search(mmap.begin(), mmap.end(), &neck_slider_locator[0], &neck_slider_locator[63]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.neck = *reinterpret_cast<const Float*>(iter + 0x49);
|
||||
}
|
||||
else {
|
||||
_sliders.neck = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &body_slider_locator[0], &body_slider_locator[63]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.body = *reinterpret_cast<const Float*>(iter + 0x49);
|
||||
}
|
||||
else {
|
||||
_sliders.body = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &shoulders_slider_locator[0], &shoulders_slider_locator[67]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.shoulders = *reinterpret_cast<const Float*>(iter + 0x4D);
|
||||
}
|
||||
else {
|
||||
_sliders.shoulders = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &hips_slider_locator[0], &hips_slider_locator[63]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.hips = *reinterpret_cast<const Float*>(iter + 0x49);
|
||||
}
|
||||
else {
|
||||
_sliders.hips = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &uarms_slider_locator[0], &uarms_slider_locator[68]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.upperArms = *reinterpret_cast<const Float*>(iter + 0x4E);
|
||||
}
|
||||
else {
|
||||
_sliders.upperArms = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &larms_slider_locator[0], &larms_slider_locator[68]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.lowerArms = *reinterpret_cast<const Float*>(iter + 0x4E);
|
||||
}
|
||||
else {
|
||||
_sliders.lowerArms = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &ulegs_slider_locator[0], &ulegs_slider_locator[68]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.upperLegs = *reinterpret_cast<const Float*>(iter + 0x4E);
|
||||
}
|
||||
else {
|
||||
_sliders.upperLegs = 0.0f;
|
||||
}
|
||||
|
||||
iter = std::search(mmap.begin(), mmap.end(), &llegs_slider_locator[0], &llegs_slider_locator[68]);
|
||||
|
||||
if(iter != mmap.end()) {
|
||||
_sliders.lowerLegs = *reinterpret_cast<const Float*>(iter + 0x4E);
|
||||
}
|
||||
else {
|
||||
_sliders.lowerLegs = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Mass::getFrameStyles() {
|
||||
std::string path = Utility::Directory::join(_folder, _filename);
|
||||
|
||||
|
|
|
@ -25,6 +25,16 @@
|
|||
using namespace Corrade;
|
||||
using namespace Magnum;
|
||||
|
||||
struct Joints {
|
||||
Float neck = 0.0f;
|
||||
Float body = 0.0f;
|
||||
Float shoulders = 0.0f;
|
||||
Float hips = 0.0f;
|
||||
Float upperArms = 0.0f;
|
||||
Float lowerArms = 0.0f;
|
||||
Float upperLegs = 0.0f;
|
||||
Float lowerLegs = 0.0f;
|
||||
};
|
||||
|
||||
class Mass {
|
||||
public:
|
||||
|
@ -52,6 +62,8 @@ class Mass {
|
|||
|
||||
auto state() -> State;
|
||||
|
||||
auto jointSliders() -> Joints const&;
|
||||
|
||||
auto frameStyles() -> Containers::StaticArrayView<4, Int>;
|
||||
auto setFrameStyle(Int index, Int style_id) -> bool;
|
||||
|
||||
|
@ -59,6 +71,7 @@ class Mass {
|
|||
|
||||
private:
|
||||
void getName();
|
||||
void getJointSliders();
|
||||
void getFrameStyles();
|
||||
|
||||
static std::string _lastError;
|
||||
|
@ -68,5 +81,7 @@ class Mass {
|
|||
std::string _name;
|
||||
State _state = State::Empty;
|
||||
|
||||
Joints _sliders;
|
||||
|
||||
Containers::StaticArray<4, Int> _frameStyles;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue