mirror of
https://github.com/zeldaret/ss
synced 2026-05-29 08:42:57 -04:00
WIP controller stuff
This commit is contained in:
@@ -26323,9 +26323,9 @@ stopMotor__Q23EGG14CoreControllerFv = .text:0x804991B0; // type:function size:0x
|
||||
createRumbleMgr__Q23EGG14CoreControllerFUc = .text:0x804991C0; // type:function size:0x58
|
||||
startPatternRumble__Q23EGG14CoreControllerFPCcib = .text:0x80499220; // type:function size:0x14
|
||||
stopRumbleMgr__Q23EGG14CoreControllerFv = .text:0x80499240; // type:function size:0x14
|
||||
FUN_80499260 = .text:0x80499260; // type:function size:0x10
|
||||
getCoreStatus__Q23EGG14CoreControllerFi = .text:0x80499260; // type:function size:0x10
|
||||
calc_posture_matrix__Q23EGG14CoreControllerFRQ23EGG9Matrix34fb = .text:0x80499270; // type:function size:0x3E8
|
||||
beginFrame__Q23EGG14CoreControllerFP9PADStatus = .text:0x80499660; // type:function size:0x3F4
|
||||
beginFrame__Q23EGG14CoreControllerFPv = .text:0x80499660; // type:function size:0x3F4
|
||||
endFrame__Q23EGG14CoreControllerFv = .text:0x80499A60; // type:function size:0x5C
|
||||
getFreeStickX__Q23EGG14CoreControllerCFv = .text:0x80499AC0; // type:function size:0x1C
|
||||
getFreeStickY__Q23EGG14CoreControllerCFv = .text:0x80499AE0; // type:function size:0x1C
|
||||
@@ -26333,7 +26333,7 @@ __dt__Q33EGG17CoreControllerMgr11T__DisposerFv = .text:0x80499B00; // type:funct
|
||||
createInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499B80; // type:function size:0x48
|
||||
deleteInstance__Q23EGG17CoreControllerMgrFv = .text:0x80499BD0; // type:function size:0x10
|
||||
getNthController__Q23EGG17CoreControllerMgrFi = .text:0x80499BE0; // type:function size:0x74
|
||||
errRangeOver__Q23EGG32TBuffer<PQ23EGG14CoreController>CFv = .text:0x80499C60; // type:function size:0x4
|
||||
errRangeOver__Q23EGG32TBuffer<PQ23EGG14CoreController>Fv = .text:0x80499C60; // type:function size:0x4
|
||||
alloc__Q23EGG27@unnamed@eggController_cpp@FUl = .text:0x80499C70; // type:function size:0x18
|
||||
free__Q23EGG27@unnamed@eggController_cpp@FPv = .text:0x80499C90; // type:function size:0x38
|
||||
connectCallback__Q23EGG17CoreControllerMgrFll = .text:0x80499CD0; // type:function size:0x3C
|
||||
@@ -37102,7 +37102,7 @@ lbl_8056E990 = .data:0x8056E990; // type:object size:0xB data:string
|
||||
__vt__Q23EGG7ExpHeap = .data:0x8056E9A0; // type:object size:0x30
|
||||
lbl_8056E9D0 = .data:0x8056E9D0; // type:object size:0x30
|
||||
lbl_8056EA00 = .data:0x8056EA00; // type:object size:0x30
|
||||
lbl_8056EA30 = .data:0x8056EA30; // type:object size:0x10
|
||||
__vt__Q23EGG8Disposer = .data:0x8056EA30; // type:object size:0x10
|
||||
__vt__Q23EGG6Thread = .data:0x8056EA40; // type:object size:0x18
|
||||
lbl_8056EA58 = .data:0x8056EA58; // type:object size:0x70
|
||||
__vt__Q23EGG7Display = .data:0x8056EAC8; // type:object size:0x20
|
||||
@@ -37111,14 +37111,14 @@ clear_z_TX__29@unnamed@eggAsyncDisplay_cpp@ = .data:0x8056EB20; // type:object s
|
||||
__vt__Q23EGG12AsyncDisplay = .data:0x8056EB60; // type:object size:0x20
|
||||
lbl_8056EB80 = .data:0x8056EB80; // type:object size:0x10
|
||||
lbl_8056EB90 = .data:0x8056EB90; // type:object size:0x18
|
||||
lbl_8056EBA8 = .data:0x8056EBA8; // type:object size:0xC
|
||||
lbl_8056EBB4 = .data:0x8056EBB4; // type:object size:0xC
|
||||
lbl_8056EBC0 = .data:0x8056EBC0; // type:object size:0x38
|
||||
__vt__Q23EGG19ControllerRumbleMgr = .data:0x8056EBA8; // type:object size:0xC
|
||||
__vt__Q23EGG20ControllerRumbleUnit = .data:0x8056EBB4; // type:object size:0xC
|
||||
__vt__Q23EGG14NullController = .data:0x8056EBC0; // type:object size:0x38
|
||||
lbl_8056EBF8 = .data:0x8056EBF8; // type:object size:0x10
|
||||
lbl_8056EC08 = .data:0x8056EC08; // type:object size:0x1C
|
||||
lbl_8056EC24 = .data:0x8056EC24; // type:object size:0x1C
|
||||
lbl_8056EC40 = .data:0x8056EC40; // type:object size:0x10
|
||||
lbl_8056EC50 = .data:0x8056EC50; // type:object size:0x38
|
||||
__vt__Q23EGG14CoreController = .data:0x8056EC50; // type:object size:0x38
|
||||
lbl_8056EC88 = .data:0x8056EC88; // type:object size:0x78
|
||||
lbl_8056ED00 = .data:0x8056ED00; // type:object size:0x30
|
||||
lbl_8056ED30 = .data:0x8056ED30; // type:object size:0x30
|
||||
|
||||
@@ -362,6 +362,7 @@ config.libs = [
|
||||
Object(Matching, "egg/core/eggThread.cpp"),
|
||||
Object(NonMatching, "egg/core/eggUnk.cpp"),
|
||||
Object(NonMatching, "egg/core/eggSystem.cpp"),
|
||||
Object(Matching, "egg/core/eggDisposer.cpp"),
|
||||
Object(Matching, "egg/core/eggDisplay.cpp"),
|
||||
Object(Matching, "egg/core/eggColorFader.cpp"),
|
||||
Object(Matching, "egg/core/eggAsyncDisplay.cpp"),
|
||||
|
||||
@@ -19,7 +19,17 @@ enum eCoreDevType {};
|
||||
|
||||
class CoreStatus {
|
||||
public:
|
||||
/* 0x00 */ u8 field_0x00[0xF0];
|
||||
/* 0x00 */ u8 field_0x00[0x0C];
|
||||
/* 0x0C */ f32 accel[3];
|
||||
/* 0x18 */ u8 field_0x01[0x08];
|
||||
/* 0x20 */ f32 dpdRawX;
|
||||
/* 0x24 */ f32 dpdRawY;
|
||||
/* 0x28 */ u8 field_0x02[0x36];
|
||||
/* 0x58 */ s8 dpdDistance;
|
||||
/* 0x5C */ s8 unknown;
|
||||
/* 0x60 */ f32 fsStickButton;
|
||||
/* 0x60 */ f32 fsStickButton2;
|
||||
/* 0x64 */ u8 field_0x03[0x88];
|
||||
|
||||
public:
|
||||
/* 80498f90 */ void init();
|
||||
@@ -73,21 +83,25 @@ public:
|
||||
public:
|
||||
/* 80499050 */ CoreController();
|
||||
/* 804990b0 */ void sceneReset();
|
||||
/* 80499170 */ Vector2f getDpdRawPos();
|
||||
/* 80499190 */ s32 getDpdDistance();
|
||||
/* 80499170 */ Vector2f getDpdRawPos() const;
|
||||
/* 80499190 */ s32 getDpdDistance() const;
|
||||
/* 804991a0 */ void startMotor();
|
||||
/* 804991b0 */ void stopMotor();
|
||||
/* 804991c0 */ void createRumberMgr(u8);
|
||||
/* 804991c0 */ void createRumbleMgr(u8);
|
||||
/* 80499220 */ void startPatternRumble(const char *, int, bool);
|
||||
/* 80499240 */ void stopRumbleMgr();
|
||||
/* 80499260 */ CoreStatus *getCoreStatus(s32 idx);
|
||||
/* 8056ebf8 */ void calc_posture_matrix(Matrix34f &mat, bool);
|
||||
/* 80499ac0 */ f32 getFreeStickX();
|
||||
/* 80499ae0 */ f32 getFreeStickY();
|
||||
/* 80499270 */ void calc_posture_matrix(Matrix34f &mat, bool);
|
||||
/* 80499ac0 */ f32 getFreeStickX() const;
|
||||
/* 80499ae0 */ f32 getFreeStickY() const;
|
||||
};
|
||||
|
||||
class NullController : public CoreController {
|
||||
public:
|
||||
NullController() {
|
||||
// This could also be in CoreController
|
||||
unk[92] = 0xfe;
|
||||
}
|
||||
// idk this has NO effect on anything
|
||||
u8 unk[0x80674c00 - 0x80674b10];
|
||||
};
|
||||
@@ -95,14 +109,15 @@ public:
|
||||
class ControllerRumbleUnit {
|
||||
public:
|
||||
// 0x00 vtable | 8056ebb4
|
||||
inline ControllerRumbleUnit() { init(); }
|
||||
/* vt 0x08 | 8049a8e0 */ virtual ~ControllerRumbleUnit();
|
||||
|
||||
public:
|
||||
/* 0x04 */ char *mPattern;
|
||||
/* 0x08 */ char *mPatternPos;
|
||||
/* 0x04 */ const char *mPattern;
|
||||
/* 0x08 */ const char *mPatternPos;
|
||||
/* 0x0C */ s32 mTimer; // guess
|
||||
/* 0x10 */ f32 mRampUp; // guess
|
||||
/* 0x14 */ f32 mIntesity; // guess
|
||||
/* 0x14 */ f32 mIntensity; // guess
|
||||
/* 0x18 */ TBitFlag<u8> mFlag;
|
||||
/* 0x1C */ nw4r::ut::Node mNode;
|
||||
/* 0x24 */ u32 field_0x24; // could just be part of the node (List)
|
||||
@@ -134,7 +149,7 @@ class CoreControllerMgr {
|
||||
public:
|
||||
struct T__Disposer {
|
||||
Disposer mDisposer;
|
||||
/* vt 0x08 | 80499b00 */ virtual ~T__Disposer();
|
||||
/* vt 0x08 | 80499b00 */ virtual ~T__Disposer() {}
|
||||
/* 805767ac */ static T__Disposer *sStaticDisposer;
|
||||
};
|
||||
// Disposer Vtable: 8056ec40
|
||||
@@ -151,8 +166,9 @@ public:
|
||||
/* 0x10b0 */ u8 field_0x10B0[0x10e0 - 0x10b0];
|
||||
|
||||
public:
|
||||
/* 80499b80 */ static void createInstance();
|
||||
/* 80499b80 */ static CoreControllerMgr *createInstance();
|
||||
/* 80499bd0 */ static void deleteInstance();
|
||||
/* 80499be0 */ CoreController *getNthController(s32);
|
||||
/* 80499cd0 */ void connectCallback(s32, s32);
|
||||
/* 80499d10 */ CoreControllerMgr();
|
||||
|
||||
|
||||
@@ -10,9 +10,8 @@ namespace EGG {
|
||||
|
||||
class Heap;
|
||||
class Disposer : private NonCopyable {
|
||||
friend class Heap;
|
||||
|
||||
protected:
|
||||
public:
|
||||
/* vt 0x08 | 80496890 */ virtual ~Disposer();
|
||||
/* 80496830 */ Disposer();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define EGG_MATH_H
|
||||
|
||||
#include <common.h>
|
||||
#include <MSL_C/float.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
|
||||
@@ -109,7 +109,9 @@ struct Vector3f : public nw4r::math::VEC3 {
|
||||
};
|
||||
|
||||
struct Vector2f : nw4r::math::VEC2 {
|
||||
inline Vector2f() {}
|
||||
Vector2f(f32 fx, f32 fy) : VEC2(fx, fy) {}
|
||||
inline ~Vector2f() {}
|
||||
|
||||
public:
|
||||
/* 805767c0 */ static const Vector2f zero;
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
if (heap == nullptr) {
|
||||
heap = Heap::sCurrentHeap;
|
||||
}
|
||||
mBuffer = new (heap, 4) T[n];
|
||||
mBuffer = new (heap, 4) T[mSize];
|
||||
onAllocate(heap);
|
||||
}
|
||||
/* vt 0x14 */ virtual void onAllocate(Heap *) {
|
||||
|
||||
@@ -1,14 +1,354 @@
|
||||
#include "egg/core/eggController.h"
|
||||
#include "MSL_C/string.h"
|
||||
|
||||
extern EGG::CoreControllerMgr *lbl_805767A8;
|
||||
extern EGG::CoreControllerMgr *lbl_805767AC;
|
||||
|
||||
const char *str = "EGG::CoreControllerMgr"; // TODO
|
||||
|
||||
EGG::NullController null_controller;
|
||||
|
||||
namespace EGG
|
||||
{
|
||||
|
||||
|
||||
void CoreStatus::init() {
|
||||
memset(this, 0, sizeof(CoreStatus));
|
||||
}
|
||||
|
||||
u32 CoreStatus::getFSStickButton() const {
|
||||
f32 button = this->fsStickButton;
|
||||
u32 result = 0;
|
||||
// TODO what are these flags and why is this code so weird?
|
||||
|
||||
if (!(-0.25f < button) || !(button < 0.25f)) {
|
||||
if (button <= -0.5f) {
|
||||
result = 0;
|
||||
result |= 0x40000;
|
||||
} else if (button >= 0.5f) {
|
||||
result = 0;
|
||||
result |= 0x80000;
|
||||
}
|
||||
}
|
||||
|
||||
button = this->fsStickButton2;
|
||||
if (!(-0.25f < button) || !(button < 0.25f)) {
|
||||
if (button <= -0.5f) {
|
||||
result &= ~0x10000;
|
||||
result |= 0x20000;
|
||||
} else if (button >= 0.5f) {
|
||||
result &= ~0x20000;
|
||||
result |= 0x10000;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreController::CoreController(): mDpdPos(), mAccel(), mAccelFlags(nullptr) {
|
||||
this->mRumbleMgr = nullptr;
|
||||
this->mButtonHeld = 0;
|
||||
this->mButtonTriggered = 0;
|
||||
this->mButtonReleased = 0;
|
||||
this->sceneReset();
|
||||
this->mFlag.makeAllZero();
|
||||
}
|
||||
|
||||
void CoreController::sceneReset() {
|
||||
this->mAccel.set(0.0, 0.0, 0.0);
|
||||
this->mDpdPos.x = 0.0;
|
||||
this->mDpdPos.y = 0.0;
|
||||
this->field_0xf28 = 0;
|
||||
this->mPostureMatrixPrev.makeIdentity();
|
||||
this->mPostureMatrix.makeIdentity();
|
||||
this->mMaxAccelFrameTime = 10;
|
||||
this->mMaxAccelDiff = 0.13;
|
||||
this->mPrevAccel.set(0.0, 0.0, 0.0);
|
||||
this->mAccelFlags.makeAllZero();
|
||||
this->mAccelFrameTimeZ = 0;
|
||||
this->mAccelFrameTimeY = 0;
|
||||
this->mAccelFrameTimeX = 0;
|
||||
this->mMotorPattern = 0;
|
||||
this->mMotorFrameDuration = 0;
|
||||
this->mEnableMotor = false;
|
||||
this->mMotorPatternLength = 0x20;
|
||||
this->mMotorPatternPos = 0x1f;
|
||||
this->stopRumbleMgr();
|
||||
}
|
||||
|
||||
Vector2f CoreController::getDpdRawPos() const {
|
||||
return Vector2f(this->coreStatus[0].dpdRawX, this->coreStatus[0].dpdRawY);
|
||||
}
|
||||
|
||||
s32 CoreController::getDpdDistance() const {
|
||||
return this->coreStatus[0].dpdDistance;
|
||||
}
|
||||
|
||||
// TODO
|
||||
extern "C" void fn_803DB1E0(s32 channel, bool arg);
|
||||
|
||||
void CoreController::startMotor() {
|
||||
fn_803DB1E0(mChannelID, true);
|
||||
}
|
||||
|
||||
void CoreController::stopMotor() {
|
||||
fn_803DB1E0(mChannelID, false);
|
||||
}
|
||||
|
||||
void CoreController::createRumbleMgr(u8 numUnits) {
|
||||
this->mRumbleMgr = new ControllerRumbleMgr();
|
||||
this->mRumbleMgr->createUnit(numUnits, this);
|
||||
}
|
||||
|
||||
void CoreController::startPatternRumble(const char *pattern, int duration, bool bGrabActive) {
|
||||
if (this->mRumbleMgr) {
|
||||
this->mRumbleMgr->startPattern(pattern, duration, bGrabActive);
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::stopRumbleMgr() {
|
||||
if (this->mRumbleMgr) {
|
||||
this->mRumbleMgr->stop();
|
||||
}
|
||||
}
|
||||
|
||||
CoreStatus *CoreController::getCoreStatus(s32 idx) {
|
||||
return &this->coreStatus[idx];
|
||||
}
|
||||
|
||||
void CoreController::calc_posture_matrix(Matrix34f &mat, bool someBool) {
|
||||
if (!someBool || this->mAccelFlags.onBit(7)) {
|
||||
Vector3f vec = Vector3f(-mat(2, 3), -mat(2, 2), -mat(2, 1));
|
||||
Vector3f vec3 = vec;
|
||||
vec.normalise();
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
void CoreController::beginFrame(void *padStatus) {
|
||||
|
||||
}
|
||||
|
||||
void CoreController::endFrame() {
|
||||
this->mAccel(0) = this->coreStatus[0].accel[0];
|
||||
this->mAccel(1) = this->coreStatus[0].accel[1];
|
||||
this->mAccel(2) = this->coreStatus[0].accel[2];
|
||||
this->mDpdPos = this->getDpdRawPos();
|
||||
}
|
||||
|
||||
f32 CoreController::getFreeStickX() const {
|
||||
if (this->coreStatus[0].field_0x00[0x5C] == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return ((f32*)(&this->coreStatus[0].field_0x00))[0x18];
|
||||
}
|
||||
|
||||
f32 CoreController::getFreeStickY() const {
|
||||
if (this->coreStatus[0].field_0x00[0x5C] == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return ((f32*)(&this->coreStatus[0].field_0x00))[0x19];
|
||||
}
|
||||
|
||||
CoreControllerMgr *CoreControllerMgr::createInstance() {
|
||||
if (lbl_805767A8 == nullptr) {
|
||||
CoreControllerMgr *mgr = new CoreControllerMgr();
|
||||
lbl_805767A8 = mgr;
|
||||
lbl_805767AC = mgr;
|
||||
}
|
||||
return lbl_805767A8;
|
||||
}
|
||||
|
||||
void CoreControllerMgr::deleteInstance() {
|
||||
lbl_805767A8 = nullptr;
|
||||
lbl_805767AC = nullptr;
|
||||
}
|
||||
|
||||
EGG::CoreController *CoreControllerMgr::getNthController(s32 n) {
|
||||
return this->mControllers(n);
|
||||
}
|
||||
|
||||
void CoreControllerMgr::connectCallback(int a1, int a2) {
|
||||
|
||||
}
|
||||
|
||||
CoreControllerMgr::CoreControllerMgr() {
|
||||
|
||||
}
|
||||
|
||||
void CoreControllerMgr::beginFrame() {
|
||||
for (int i = 0; i < mControllers.getSize(); ++i) {
|
||||
mControllers(i)->beginFrame(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CoreControllerMgr::endFrame() {
|
||||
|
||||
}
|
||||
|
||||
void ControllerRumbleUnit::init() {
|
||||
this->mPattern = nullptr;
|
||||
this->mPatternPos = nullptr;
|
||||
this->mTimer = 0;
|
||||
this->mIntensity = 0.0;
|
||||
this->mRampUp = 0.0;
|
||||
this->mFlag.makeAllZero();
|
||||
}
|
||||
|
||||
void ControllerRumbleUnit::startPattern(const char *pattern, int duration) {
|
||||
this->mPattern = pattern;
|
||||
this->mPatternPos = pattern;
|
||||
|
||||
this->mFlag.value &= 0xef;
|
||||
this->mFlag.value &= 0xdf;
|
||||
|
||||
if (duration < 0) {
|
||||
this->mFlag.set(0x10);
|
||||
} else if (duration > 0) {
|
||||
this->mFlag.set(0x30);
|
||||
}
|
||||
|
||||
this->mTimer = duration;
|
||||
this->mFlag.value = ((this->mFlag.value | 0x01) & 0xfd) | 0x8;
|
||||
}
|
||||
|
||||
f32 ControllerRumbleUnit::calc() {
|
||||
f32 result = 0.0f;
|
||||
if (this->mFlag.onBit(3)) {
|
||||
if (this->mFlag.onBit(0)) {
|
||||
char x = *++this->mPatternPos;
|
||||
if (x == '\0') {
|
||||
if (this->mFlag.onBit(4)) {
|
||||
this->mPatternPos = this->mPattern;
|
||||
} else {
|
||||
this->mFlag.reset(~0xf7);
|
||||
}
|
||||
} else if (x == '*') {
|
||||
result = 1.0f;
|
||||
}
|
||||
|
||||
if (this->mFlag.offBit(5)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (--this->mTimer > 0) {
|
||||
return result;
|
||||
}
|
||||
this->mFlag.reset(~0xf7);
|
||||
return result;
|
||||
} else {
|
||||
f32 intensity = this->mIntensity + this->mRampUp;
|
||||
this->mIntensity = intensity;
|
||||
if (intensity >= 1.0f) {
|
||||
result = 1.0f;
|
||||
this->mIntensity = 0.0f;
|
||||
}
|
||||
|
||||
// infinite flag?
|
||||
if (this->mFlag.onBit(2)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (--this->mTimer > 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
this->mFlag.reset(~0xf7);
|
||||
return result;
|
||||
} else {
|
||||
return -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
ControllerRumbleMgr::ControllerRumbleMgr() {
|
||||
this->mController = nullptr;
|
||||
// TODO offsetof macro
|
||||
List_Init(&this->mActiveUnitList, 0x1c);
|
||||
List_Init(&this->mInactiveUnitList, 0x1c);
|
||||
}
|
||||
|
||||
void ControllerRumbleMgr::createUnit(u8 numUnits, CoreController *ctrl) {
|
||||
for (u8 created = 0; created < numUnits; created++) {
|
||||
ControllerRumbleUnit *unit = new ControllerRumbleUnit();
|
||||
List_Append(&this->mInactiveUnitList, unit);
|
||||
}
|
||||
this->mController = ctrl;
|
||||
}
|
||||
|
||||
void ControllerRumbleMgr::stop() {
|
||||
this->mController->stopMotor();
|
||||
while (List_GetSize(&this->mActiveUnitList) != 0) {
|
||||
ControllerRumbleUnit *unit = static_cast<ControllerRumbleUnit*>(List_GetNext(&this->mActiveUnitList, nullptr));
|
||||
List_Remove(&this->mActiveUnitList, unit);
|
||||
List_Append(&this->mInactiveUnitList, unit);
|
||||
}
|
||||
}
|
||||
|
||||
void ControllerRumbleMgr::calc() {
|
||||
if (List_GetSize(&this->mActiveUnitList) != 0) {
|
||||
void *object = List_GetFirst(&this->mActiveUnitList);
|
||||
f32 acc = 0.0f;
|
||||
|
||||
while (object != nullptr) {
|
||||
ControllerRumbleUnit *unit = static_cast<ControllerRumbleUnit*>(object);
|
||||
f32 x = unit->calc();
|
||||
void *nextObject = List_GetNext(&this->mActiveUnitList, object);
|
||||
if (x < 0.0f) {
|
||||
List_Remove(&this->mActiveUnitList, object);
|
||||
List_Append(&this->mInactiveUnitList, object);
|
||||
} else {
|
||||
acc += x;
|
||||
}
|
||||
object = nextObject;
|
||||
}
|
||||
|
||||
if (acc >= 1.0f) {
|
||||
this->mController->startMotor();
|
||||
} else {
|
||||
this->mController->stopMotor();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ControllerRumbleMgr::startPattern(const char *pattern, int duration, bool bGrabActive) {
|
||||
EGG::ControllerRumbleUnit *unit = getUnitFromList(bGrabActive);
|
||||
if (unit != nullptr) {
|
||||
unit->startPattern(pattern, duration);
|
||||
}
|
||||
}
|
||||
|
||||
ControllerRumbleUnit *ControllerRumbleMgr::getUnitFromList(bool bGrabActive) {
|
||||
void *first = List_GetFirst(&this->mInactiveUnitList);
|
||||
if (first != nullptr) {
|
||||
List_Remove(&this->mInactiveUnitList, first);
|
||||
List_Append(&this->mActiveUnitList, first);
|
||||
} else if (bGrabActive && (first = List_GetFirst(&this->mActiveUnitList), first != nullptr)) {
|
||||
List_Remove(&this->mActiveUnitList, first);
|
||||
List_Append(&this->mActiveUnitList, first);
|
||||
}
|
||||
|
||||
return static_cast<ControllerRumbleUnit*>(first);
|
||||
}
|
||||
|
||||
ControllerRumbleMgr::~ControllerRumbleMgr() {
|
||||
|
||||
}
|
||||
|
||||
ControllerRumbleUnit::~ControllerRumbleUnit() {
|
||||
|
||||
}
|
||||
|
||||
void CoreController::setAccParam(f32 param1, f32 param2) {
|
||||
|
||||
}
|
||||
|
||||
void CoreController::setDistParam(f32 param1, f32 param2) {
|
||||
|
||||
}
|
||||
|
||||
void CoreController::setHoriParam(f32 param1, f32 param2) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace EGG
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <egg/core/eggDisposer.h>
|
||||
#include <egg/core/eggHeap.h>
|
||||
|
||||
namespace EGG {
|
||||
|
||||
Disposer::Disposer() {
|
||||
mContainHeap = Heap::findContainHeap(this);
|
||||
if (mContainHeap) {
|
||||
mContainHeap->appendDisposer(this);
|
||||
}
|
||||
}
|
||||
|
||||
Disposer::~Disposer() {
|
||||
if (mContainHeap) {
|
||||
mContainHeap->removeDisposer(this);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace EGG
|
||||
Reference in New Issue
Block a user