* fix: restore MSL extab flags and force-active stripped symbols * fix: limit ChannelTitle novtable header changes to IPL_CHANNEL_TITLE_NOVTABLE PR #182 made gui::EventHandler novtable and rewrote HermiteIntp for every unit, which dropped __vt__Q23gui12EventHandler from linked scene units and moved EventHandler::onEvent. Restore the pre-#182 definitions unless the macro is defined. * fix: restore u16 addrType in cdb::Manager::createNewRecord The original symbol takes u16 (mangled UsUs); the enum parameter made createNewRecord 4 bytes longer. Match the caller in iplNwc24Manager with a u16 local assigned through if/else. * fix: emit TVRC loop handlers after TVRCSendStartAsync The original object places both alarm handlers at the end of .text. * fix: construct scene::Date::mscMaxDate with utility::Date The MaxDate wrapper emitted a weak MaxDate ctor that the original does not have, shifting .text by 0x10 after iplDate. Go back to a plain utility::Date followed by the 0x10-byte padding array. * fix: define textinput PaneComponent dtor after PaneManager dtor Matches the original object's function order, which also pulls the weak GUIComponent dtor into place. * fix: define EGG audio Arg and SoundHeapMgr ctors out of line Emits IAudioMgr::Arg::Arg first and SoundHeapMgr's weak dtor ahead of its ctor, matching the original eggAudioMgr function order. * fix: define WaveFile dtors in AudioWavePlayer after the ctor The original emits WavePacket's weak dtor first, then the WaveFileAiff and WaveFileWav dtors. Declaring the dtors after getBit keeps the vtables in AudioWaveUtility. * fix: restore fork-point iplCSMtx string pooling Moving "MTX34" into a static const array put it in .sdata2 and left the pooled .sdata copy to be dead-stripped, shifting both sections. * fix: share tiGUIManager's named 0.0f constant drawLine_ and PaneComponent::contain now load lbl_81694EE8, as in the original, instead of emitting their own 0.0f ahead of it in .sdata2. * fix: force-active unreferenced iplDate and WDScan data MWLD dead-strips scene::padding (the 0x10 bytes after Date::mscMaxDate) and the unreferenced WDScan .sdata2 bytes lbl_81695063/lbl_81695067, which shifted .bss and .sdata2. * fix: unlink eggAudioExpMgr MWCC emits the @52 calc thunk ahead of the @52 dtor thunk, but the original has them the other way round, which swaps two vtable entries. Link the original object until the order is matched. * fix: shrink Calendar .data padding now that EventHandler has a vtable With gui::EventHandler no longer novtable, its 0x18-byte vtable fills most of the gap after __vt__Q33ipl5scene8Calendar; keep one 4-byte pad.
193 lines
7.3 KiB
C++
193 lines
7.3 KiB
C++
#ifndef IPL_MATH_INTERPORATION_H
|
|
#define IPL_MATH_INTERPORATION_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <nw4r/math.h>
|
|
|
|
#include "utility/iplFrameController.h"
|
|
|
|
namespace ipl {
|
|
namespace math {
|
|
template <typename T>
|
|
class Interporation : public utility::FrameController {
|
|
public:
|
|
void init(int playback, f32 maxFrame, f32 minFrame, const T& start, const T& end, f32 speed = 1.0f) {
|
|
mStart = start;
|
|
mEnd = end;
|
|
utility::FrameController::init(playback, maxFrame, minFrame, speed);
|
|
}
|
|
|
|
const T& getStart() { return mStart; }
|
|
const T& getEnd() { return mEnd; }
|
|
|
|
void playBackwards() {
|
|
mAnmType = ANIM_TYPE_BACKWARD;
|
|
mState = ANIM_STATE_PLAY;
|
|
}
|
|
|
|
protected:
|
|
T mStart;
|
|
T mEnd;
|
|
};
|
|
|
|
template <typename T>
|
|
class LinearIntp : public Interporation<T> {
|
|
public:
|
|
T get() const {
|
|
T r = mEnd * getCurrentFrame();
|
|
T b = mStart * (mMaxFrame - mFrame);
|
|
b += r;
|
|
return b * (f64)(1.0f / getMaxFrame());
|
|
}
|
|
|
|
T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); }
|
|
};
|
|
|
|
#ifdef IPL_CHANNEL_TITLE_NOVTABLE
|
|
template <typename T>
|
|
class __declspec(novtable) HermiteIntp : public utility::FrameController {
|
|
public:
|
|
HermiteIntp() {}
|
|
virtual ~HermiteIntp();
|
|
|
|
void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f);
|
|
|
|
T get() const {
|
|
f32 var_f27 = mFrame;
|
|
f32 var_f28 = 1.0f / mMaxFrame;
|
|
T r =
|
|
(mStart *
|
|
(1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) -
|
|
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
|
r +=
|
|
(unkVal0 *
|
|
(var_f27 +
|
|
((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
|
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
|
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
|
(var_f28 * (var_f27 * var_f27))));
|
|
|
|
return r;
|
|
|
|
/*f32 var_f27 = mMaxFrame;
|
|
f32 var_f28 = 1.0f / mMaxFrame;
|
|
T sp28 = mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))));
|
|
T sp1C = mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
|
T r = sp1C - sp28;
|
|
|
|
f32 temp_f4 = var_f27 * var_f27;
|
|
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
|
f32 temp_f3 =
|
|
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
|
r = r + temp_f3;
|
|
return r;*/
|
|
}
|
|
|
|
protected:
|
|
T mStart;
|
|
T mEnd;
|
|
f32 unkVal0;
|
|
f32 unkVal1;
|
|
};
|
|
|
|
template <>
|
|
class HermiteIntp<f32> : public utility::FrameController {
|
|
public:
|
|
HermiteIntp() {}
|
|
virtual ~HermiteIntp();
|
|
|
|
void init(const f32& start, const f32& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD,
|
|
f32 speed = 1.0f);
|
|
|
|
f32 get() const {
|
|
f32 var_f27 = mFrame;
|
|
f32 var_f28 = 1.0f / mMaxFrame;
|
|
f32 r =
|
|
(mStart *
|
|
(1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))))) -
|
|
(mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
|
r +=
|
|
(unkVal0 *
|
|
(var_f27 + ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
|
(var_f28 * (2.0f * var_f27 * var_f27))))) +
|
|
(unkVal1 * ((var_f28 * (var_f28 * (var_f27 * (var_f27 * var_f27)))) -
|
|
(var_f28 * (var_f27 * var_f27))));
|
|
|
|
return r;
|
|
}
|
|
|
|
protected:
|
|
f32 mStart;
|
|
f32 mEnd;
|
|
f32 unkVal0;
|
|
f32 unkVal1;
|
|
};
|
|
|
|
#pragma dont_instantiate HermiteIntp<float>
|
|
#else
|
|
template <typename T>
|
|
class HermiteIntp : public Interporation<T> {
|
|
public:
|
|
HermiteIntp() {}
|
|
|
|
void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) {
|
|
mStart = start;
|
|
mEnd = end;
|
|
utility::FrameController::init(playback, maxFrame, 0.0f, speed);
|
|
unkVal0 = param_5;
|
|
unkVal1 = param_6;
|
|
}
|
|
|
|
T get() const {
|
|
f32 var_f27 = mFrame;
|
|
f32 var_f28 = 1.0f / mMaxFrame;
|
|
f32 t1t2 =
|
|
(var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)));
|
|
|
|
T r = (mStart * (1.0f + t1t2)) - (mEnd * t1t2);
|
|
|
|
f32 temp_f4 = var_f27 * var_f27;
|
|
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
|
f32 temp_f3 =
|
|
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
|
|
|
r = r + temp_f3;
|
|
|
|
return r;
|
|
|
|
/*f32 var_f27 = mMaxFrame;
|
|
f32 var_f28 = 1.0f / mMaxFrame;
|
|
T sp28 = mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))));
|
|
T sp1C = mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) -
|
|
(var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))));
|
|
T r = sp1C - sp28;
|
|
|
|
f32 temp_f4 = var_f27 * var_f27;
|
|
f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4));
|
|
f32 temp_f3 =
|
|
(unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4)));
|
|
r = r + temp_f3;
|
|
return r;*/
|
|
}
|
|
|
|
protected:
|
|
f32 unkVal0;
|
|
f32 unkVal1;
|
|
};
|
|
#endif
|
|
|
|
} // namespace math
|
|
} // namespace ipl
|
|
|
|
#endif // __cplusplus
|
|
|
|
#endif // IPL_MATH_INTERPORATION_H
|