diff --git a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h index b04b2cbf1c..72121435a3 100644 --- a/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h +++ b/libs/JSystem/include/JSystem/JStudio/JStudio/fvb.h @@ -4,6 +4,9 @@ #include "JSystem/JGadget/linklist.h" #include "JSystem/JStudio/JStudio/fvb-data-parse.h" #include "JSystem/JStudio/JStudio/object-id.h" +#if TARGET_PC +#include +#endif namespace JStudio { namespace fvb { @@ -126,6 +129,9 @@ public: private: TFunctionValue_list fnValue; +#if TARGET_PC + std::vector mSwappedData; +#endif }; class TObject_list_parameter : public TObject { @@ -141,6 +147,9 @@ public: private: TFunctionValue_list_parameter fnValue; +#if TARGET_PC + std::vector mSwappedData; +#endif }; struct TObject_hermite : public TObject { @@ -156,6 +165,9 @@ public: private: TFunctionValue_hermite fnValue; +#if TARGET_PC + std::vector mSwappedData; +#endif }; } // namespace fvb diff --git a/libs/JSystem/src/JStudio/JStudio/fvb.cpp b/libs/JSystem/src/JStudio/JStudio/fvb.cpp index b8082211c9..38cb801cfd 100644 --- a/libs/JSystem/src/JStudio/JStudio/fvb.cpp +++ b/libs/JSystem/src/JStudio/JStudio/fvb.cpp @@ -5,15 +5,7 @@ #include #if TARGET_PC -namespace { -void endianSwapListData(const f32* data, u32 count) { - // const hack to swap endianness - f32* nonConstData = const_cast(data); - for (int i = 0; i < count; i++) { - be_swap(nonConstData[i]); - } -} -} +#include #endif namespace JStudio { @@ -281,12 +273,14 @@ void TObject_list::prepare_data_(const data::TParse_TParagraph::TData& rData, TC const ListData* pContent = static_cast(rData.pContent); ASSERT(pContent != NULL); -#if TARGET_PC - endianSwapListData(pContent->_8, pContent->_4); -#endif - fnValue.data_setInterval(pContent->_0); +#if TARGET_PC + mSwappedData.assign(pContent->_8, pContent->_8 + (u32)pContent->_4); + be_swap(mSwappedData.data(), pContent->_4); + fnValue.data_set(mSwappedData.data(), pContent->_4); +#else fnValue.data_set(pContent->_8, pContent->_4); +#endif } TObject_list_parameter::TObject_list_parameter(data::TParse_TBlock const& param_0) @@ -303,9 +297,13 @@ void TObject_list_parameter::prepare_data_(const data::TParse_TParagraph::TData& ASSERT(pContent != NULL); #if TARGET_PC - endianSwapListData(pContent->_4, pContent->_0 * 2); -#endif + u32 count = pContent->_0 * 2; + mSwappedData.assign(pContent->_4, pContent->_4 + count); + be_swap(mSwappedData.data(), count); + fnValue.data_set(mSwappedData.data(), pContent->_0); +#else fnValue.data_set(pContent->_4, pContent->_0); +#endif } TObject_hermite::TObject_hermite(data::TParse_TBlock const& param_0) : TObject(param_0, &fnValue) {} @@ -323,8 +321,10 @@ void TObject_hermite::prepare_data_(const data::TParse_TParagraph::TData& rData, #if TARGET_PC u32 u = (pContent->_0 & 0xFFFFFFF); u32 uSize = (pContent->_0 >> 0x1C); - endianSwapListData(pContent->_4, u * uSize); - fnValue.data_set(pContent->_4, u, uSize); + u32 total = u * uSize; + mSwappedData.assign(pContent->_4, pContent->_4 + total); + be_swap(mSwappedData.data(), total); + fnValue.data_set(mSwappedData.data(), u, uSize); #else fnValue.data_set(pContent->_4, pContent->_0 & 0xFFFFFFF, pContent->_0 >> 0x1C); #endif