diff options
| author | robojumper <robojumper@gmail.com> | 2025-05-30 22:21:49 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-05-31 21:21:12 +0200 |
| commit | 83456a9cd8a15b6c27d29f09c72ad1f09bc2ed60 (patch) | |
| tree | 5cf9528a037062eb3b1555c8869d2cf37d80612f /include/egg | |
| parent | 77e17d4c1fb7439914889076b21176242301e7ef (diff) | |
start matching some d/snd things
Diffstat (limited to 'include/egg')
| -rw-r--r-- | include/egg/audio/eggAudioArcPlayerMgr.h | 31 | ||||
| -rw-r--r-- | include/egg/audio/eggAudioHeapMgr.h | 39 | ||||
| -rw-r--r-- | include/egg/audio/eggAudioUtility.h | 2 | ||||
| -rw-r--r-- | include/egg/core/eggDvdRipper.h | 24 | ||||
| -rw-r--r-- | include/egg/gfx/eggCamera.h | 19 | ||||
| -rw-r--r-- | include/egg/math/eggMatrix.h | 9 |
6 files changed, 98 insertions, 26 deletions
diff --git a/include/egg/audio/eggAudioArcPlayerMgr.h b/include/egg/audio/eggAudioArcPlayerMgr.h index 49673250..f9b982c0 100644 --- a/include/egg/audio/eggAudioArcPlayerMgr.h +++ b/include/egg/audio/eggAudioArcPlayerMgr.h @@ -26,12 +26,20 @@ public: void stopAllSound(); u32 changeNameToId(const char *name) { - return mOpenSndArchive->ConvertLabelStringToSoundId(name); + u32 id = -1; + if (mOpenSndArchive != nullptr) { + id = mOpenSndArchive->ConvertLabelStringToSoundId(name); + } + return id; } nw4r::snd::SoundArchivePlayer *getPlayer() { return mActiveSndArchivePlayer; } + nw4r::snd::SoundArchive *getArchive() { + return mOpenSndArchive; + } + void setLoadStringLabels(bool bLoad) { mLoadLabelStringData = bLoad; } @@ -65,12 +73,7 @@ public: virtual bool startSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x40 { - u32 id = -1; - if (mOpenSndArchive) { - id = changeNameToId(name); - } - - return ArcPlayer::startSound(handle, id); + return ArcPlayer::startSound(handle, changeNameToId(name)); } virtual bool prepareSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x44 @@ -85,12 +88,7 @@ public: virtual bool prepareSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x4C { - u32 id = -1; - if (mOpenSndArchive) { - id = changeNameToId(name); - } - - return ArcPlayer::prepareSound(handle, id); + return ArcPlayer::prepareSound(handle, changeNameToId(name)); } virtual bool holdSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x50 @@ -105,12 +103,7 @@ public: virtual bool holdSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x58 { - u32 id = -1; - if (mOpenSndArchive) { - id = changeNameToId(name); - } - - return ArcPlayer::holdSound(handle, id); + return ArcPlayer::holdSound(handle, changeNameToId(name)); } private: diff --git a/include/egg/audio/eggAudioHeapMgr.h b/include/egg/audio/eggAudioHeapMgr.h index fa8ef361..9fd269cc 100644 --- a/include/egg/audio/eggAudioHeapMgr.h +++ b/include/egg/audio/eggAudioHeapMgr.h @@ -21,9 +21,38 @@ public: ~SoundHeapMgr() { destroySoundHeap(); } - virtual bool loadState(s32 id) {} - virtual int getCurrentLevel() {} - virtual void stateProc() {} + int saveState() { + return mSoundHeap.SaveState(); + } + virtual bool loadState(s32 id) { + s32 level = mSoundHeap.GetCurrentLevel(); + if (id > 0 && level >= id) { + mSoundHeap.LoadState(id); + return true; + } else { + return false; + } + } + virtual int getCurrentLevel() { + return mSoundHeap.GetCurrentLevel(); + } + virtual void stateProc() { + OSMessage msg; + if (OSReceiveMessage(&mQueue1.mQueue, &msg, 0)) { + bool ok = loadState((s32)msg); + OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0); + } + + if (OSReceiveMessage(&mQueue2.mQueue, &msg, 0)) { + int ok = mSoundHeap.SaveState(); + OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0); + } + + if (OSReceiveMessage(&mQueue, &msg, 0)) { + int level = getCurrentLevel(); + OSSendMessage(&mQueue3.mQueue, (OSMessage)level, 0); + } + } void createSoundHeap(Allocator *allocator, u32 size); void destroySoundHeap(); @@ -34,7 +63,9 @@ public: private: nw4r::snd::SoundHeap mSoundHeap; - u8 unk[0x68 - 0x38]; + // I guess we're not initializing this queue? + OSMessageQueue mQueue; + OSMessage mBuffer[4]; SoundMessageQueue mQueue1; SoundMessageQueue mQueue2; SoundMessageQueue mQueue3; diff --git a/include/egg/audio/eggAudioUtility.h b/include/egg/audio/eggAudioUtility.h index 6a56ea66..7abb95b9 100644 --- a/include/egg/audio/eggAudioUtility.h +++ b/include/egg/audio/eggAudioUtility.h @@ -12,7 +12,7 @@ namespace EGG { struct MultiArcSimpleAudioMgr { u8 field_0x000[0x0FC - 0x000]; s32 field_0x0FC; - ArcPlayer players[]; + ArcPlayer players[1]; nw4r::snd::SoundArchivePlayer *getPlayer(int i) { return players[i].getPlayer(); diff --git a/include/egg/core/eggDvdRipper.h b/include/egg/core/eggDvdRipper.h index 82fd09b2..8f4b4b48 100644 --- a/include/egg/core/eggDvdRipper.h +++ b/include/egg/core/eggDvdRipper.h @@ -6,7 +6,6 @@ #include "egg/core/eggHeap.h" #include "egg/core/eggStreamDecomp.h" - namespace EGG { class DvdRipper { @@ -28,6 +27,29 @@ public: typedef void (*UnkCallback)(void *); public: + // Not sure + struct Arg { + Arg(const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize) + : path(path), + pOut(pOut), + pHeap(pHeap), + allocDir(allocDir), + offset(offset), + pRead(pRead), + fileSize(fileSize) {} + const char *path; + u8 *pOut; + Heap *pHeap; + EAllocDirection allocDir; + u32 offset; + u32 *pRead; + u32 *fileSize; + }; + + static u8 *loadToMainRAM(Arg &arg) { + return loadToMainRAM(arg.path, arg.pOut, arg.pHeap, arg.allocDir, arg.offset, arg.pRead, arg.fileSize); + } + static u8 * loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize); diff --git a/include/egg/gfx/eggCamera.h b/include/egg/gfx/eggCamera.h index c3104fb7..67c3853d 100644 --- a/include/egg/gfx/eggCamera.h +++ b/include/egg/gfx/eggCamera.h @@ -35,6 +35,15 @@ protected: class LookAtCamera : public BaseCamera { public: LookAtCamera() : mPos(0.0f, 10.0f, 0.0f), mAt(0.0f, 0.0f, 0.0f), mUp(0.0f, 1.0f, 0.0f) {} + + LookAtCamera& operator=(const LookAtCamera &other) { + mViewMtx.copyFrom(other.mViewMtx); + mOtherMtx.copyFrom(other.mOtherMtx); + mPos = other.mPos; + mAt = other.mAt; + mUp = other.mUp; + return *this; + } // Which way around? virtual Matrix34f &getViewMatrix() override { return mViewMtx; @@ -53,7 +62,15 @@ public: virtual void doDraw() override; virtual Matrix34f &getViewMatrixOld() override; -protected: + Vector3f getDirection() const { + return mAt - mPos; + } + + Vector3f getOtherDirection() const { + return mPos - mAt; + } + +public: /* 0x64 */ Vector3f mPos; /* 0x70 */ Vector3f mAt; /* 0x7C */ Vector3f mUp; diff --git a/include/egg/math/eggMatrix.h b/include/egg/math/eggMatrix.h index a99a0698..d16f2865 100644 --- a/include/egg/math/eggMatrix.h +++ b/include/egg/math/eggMatrix.h @@ -4,6 +4,7 @@ #include "common.h" #include "egg/math/eggQuat.h" #include "egg/math/eggVector.h" +#include "nw4r/math/math_types.h" namespace EGG { @@ -55,6 +56,14 @@ struct Matrix34f { void multiplyTo(const Matrix34f &m2, Matrix34f &to) const; void dump(); + operator nw4r::math::MTX34 *() { + return (nw4r::math::MTX34 *)this; + } + + operator const nw4r::math::MTX34 *() const { + return (nw4r::math::MTX34 *)this; + } + public: void concat(const Matrix34f &, Matrix34f &) const; void rotate(const Vector3f &rpy) const; |
