more Speaker progress

This commit is contained in:
shibbo 2022-05-16 13:43:09 -04:00
parent f079abf652
commit 6673994bb0
10 changed files with 97 additions and 19 deletions

View File

@ -25,7 +25,7 @@ __dt__18JSUList<8SpkSound>Fv,SpkSystem.o,Speaker.a,true
setResource__9SpkSystemFP10JKRArchiveUsUs,SpkSystem.o,Speaker.a,true
framework__9SpkSystemFv,SpkSystem.o,Speaker.a,true
startSound__9SpkSystemFllP14SpkSoundHandle,SpkSystem.o,Speaker.a,true
newSoundMemPool__9SpkSystemFl,SpkSystem.o,Speaker.a,false
newSoundMemPool__9SpkSystemFl,SpkSystem.o,Speaker.a,true
connect__9SpkSystemFl,SpkSystem.o,Speaker.a,true
disconnect__9SpkSystemFl,SpkSystem.o,Speaker.a,true
reconnect__9SpkSystemFl,SpkSystem.o,Speaker.a,true
@ -51,7 +51,7 @@ __ct__7SpkDataFP10JKRArchive,SpkData.o,Speaker.a,true
loadTable__7SpkDataFUs,SpkData.o,Speaker.a,true
loadWave__7SpkDataFUs,SpkData.o,Speaker.a,true
isValid__7SpkDataCFv,SpkData.o,Speaker.a,true
releaseSound__14SpkSoundHandleFv,SpkSound.o,Speaker.a,false
releaseSound__14SpkSoundHandleFv,SpkSound.o,Speaker.a,true
__ct__14SpkSoundVolumeFv,SpkSound.o,Speaker.a,true
setRelease__14SpkSoundVolumeFl,SpkSound.o,Speaker.a,true
setFadeOut__14SpkSoundVolumeFl,SpkSound.o,Speaker.a,true
@ -62,8 +62,8 @@ update__8SpkSoundFf,SpkSound.o,Speaker.a,false
stop__8SpkSoundFl,SpkSound.o,Speaker.a,true
attachHandle__8SpkSoundFP14SpkSoundHandle,SpkSound.o,Speaker.a,true
releaseHandle__8SpkSoundFv,SpkSound.o,Speaker.a,true
start__8SpkSoundFll,SpkSound.o,Speaker.a,false
unlock__8SpkSoundFv,SpkSound.o,Speaker.a,false
start__8SpkSoundFll,SpkSound.o,Speaker.a,true
unlock__8SpkSoundFv,SpkSound.o,Speaker.a,true
setWaveData__8SpkSoundFl,SpkSound.o,Speaker.a,false
__ct__14SpkSoundHolderFv,SpkSound.o,Speaker.a,true
startSound__14SpkSoundHolderFllP14SpkSoundHandle,SpkSound.o,Speaker.a,false

1 Symbol Name Object File Library Archive Matching
25 setResource__9SpkSystemFP10JKRArchiveUsUs SpkSystem.o Speaker.a true
26 framework__9SpkSystemFv SpkSystem.o Speaker.a true
27 startSound__9SpkSystemFllP14SpkSoundHandle SpkSystem.o Speaker.a true
28 newSoundMemPool__9SpkSystemFl SpkSystem.o Speaker.a false true
29 connect__9SpkSystemFl SpkSystem.o Speaker.a true
30 disconnect__9SpkSystemFl SpkSystem.o Speaker.a true
31 reconnect__9SpkSystemFl SpkSystem.o Speaker.a true
51 loadTable__7SpkDataFUs SpkData.o Speaker.a true
52 loadWave__7SpkDataFUs SpkData.o Speaker.a true
53 isValid__7SpkDataCFv SpkData.o Speaker.a true
54 releaseSound__14SpkSoundHandleFv SpkSound.o Speaker.a false true
55 __ct__14SpkSoundVolumeFv SpkSound.o Speaker.a true
56 setRelease__14SpkSoundVolumeFl SpkSound.o Speaker.a true
57 setFadeOut__14SpkSoundVolumeFl SpkSound.o Speaker.a true
62 stop__8SpkSoundFl SpkSound.o Speaker.a true
63 attachHandle__8SpkSoundFP14SpkSoundHandle SpkSound.o Speaker.a true
64 releaseHandle__8SpkSoundFv SpkSound.o Speaker.a true
65 start__8SpkSoundFll SpkSound.o Speaker.a false true
66 unlock__8SpkSoundFv SpkSound.o Speaker.a false true
67 setWaveData__8SpkSoundFl SpkSound.o Speaker.a false
68 __ct__14SpkSoundHolderFv SpkSound.o Speaker.a true
69 startSound__14SpkSoundHolderFllP14SpkSoundHandle SpkSound.o Speaker.a false

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "Speaker",
"message": "44.90608%",
"message": "47.06886%",
"color": "daa520"
}

View File

@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"label": "decompiled",
"message": "6.012184064048505%",
"message": "6.015857456890802%",
"color": "blue"
}

View File

@ -20,6 +20,6 @@
| [Ride](https://github.com/shibbo/Petari/blob/master/docs/lib/Ride.md) | 0.0% |
| [Scene](https://github.com/shibbo/Petari/blob/master/docs/lib/Scene.md) | 7.59493670886076% |
| [Screen](https://github.com/shibbo/Petari/blob/master/docs/lib/Screen.md) | 0.8324294656508502% |
| [Speaker](https://github.com/shibbo/Petari/blob/master/docs/lib/Speaker.md) | 44.906089926010246% |
| [Speaker](https://github.com/shibbo/Petari/blob/master/docs/lib/Speaker.md) | 47.06886738759249% |
| [System](https://github.com/shibbo/Petari/blob/master/docs/lib/System.md) | 7.724349605378544% |
| [Util](https://github.com/shibbo/Petari/blob/master/docs/lib/Util.md) | 6.347504282669247% |

View File

@ -2,12 +2,12 @@
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions)
| ------------- | ------------- | ------------- | ------------- |
| SpkSpeakerCtrl.o | 55.497382198952884% | 15 / 21 | 71.42857142857143% |
| SpkSystem.o | 67.70833333333334% | 10 / 14 | 71.42857142857143% |
| SpkSystem.o | 70.3125% | 11 / 14 | 78.57142857142857% |
| SpkMixingBuffer.o | 35.714285714285715% | 2 / 4 | 50.0% |
| SpkWave.o | 100.0% | 7 / 7 | 100.0% |
| SpkTable.o | 18.181818181818183% | 1 / 2 | 50.0% |
| SpkData.o | 100.0% | 4 / 4 | 100.0% |
| SpkSound.o | 22.554347826086957% | 9 / 22 | 40.909090909090914% |
| SpkSound.o | 27.03804347826087% | 12 / 22 | 54.54545454545454% |
# SpkSpeakerCtrl.o
@ -44,7 +44,7 @@
| setResource__9SpkSystemFP10JKRArchiveUsUs | :white_check_mark: |
| framework__9SpkSystemFv | :white_check_mark: |
| startSound__9SpkSystemFllP14SpkSoundHandle | :white_check_mark: |
| newSoundMemPool__9SpkSystemFl | :x: |
| newSoundMemPool__9SpkSystemFl | :white_check_mark: |
| connect__9SpkSystemFl | :white_check_mark: |
| disconnect__9SpkSystemFl | :white_check_mark: |
| reconnect__9SpkSystemFl | :white_check_mark: |
@ -95,7 +95,7 @@
# SpkSound.o
| Symbol | Decompiled? |
| ------------- | ------------- |
| releaseSound__14SpkSoundHandleFv | :x: |
| releaseSound__14SpkSoundHandleFv | :white_check_mark: |
| __ct__14SpkSoundVolumeFv | :white_check_mark: |
| setRelease__14SpkSoundVolumeFl | :white_check_mark: |
| setFadeOut__14SpkSoundVolumeFl | :white_check_mark: |
@ -106,8 +106,8 @@
| stop__8SpkSoundFl | :white_check_mark: |
| attachHandle__8SpkSoundFP14SpkSoundHandle | :white_check_mark: |
| releaseHandle__8SpkSoundFv | :white_check_mark: |
| start__8SpkSoundFll | :x: |
| unlock__8SpkSoundFv | :x: |
| start__8SpkSoundFll | :white_check_mark: |
| unlock__8SpkSoundFv | :white_check_mark: |
| setWaveData__8SpkSoundFl | :x: |
| __ct__14SpkSoundHolderFv | :white_check_mark: |
| startSound__14SpkSoundHolderFllP14SpkSoundHandle | :x: |

View File

@ -31,7 +31,7 @@ public:
f32 _1C;
};
class SpkSound {
class SpkSound : public JSUPtrLink {
public:
SpkSound();
~SpkSound();
@ -40,11 +40,10 @@ public:
void stop(s32);
void attachHandle(SpkSoundHandle *);
void releaseHandle();
void start(s32, s32);
bool start(s32, s32);
void unlock();
void setWaveData(s32);
bool setWaveData(s32);
JSUPtrLink _0;
SpkSoundHandle* mSoundHandle; // _10
s32 _14;
u32 _18;
@ -55,7 +54,7 @@ public:
u32 _2C;
s32 _30;
s32 _34;
u32 _38;
s32 _38;
s32 _3C;
SpkSoundVolume mVolume; // _40
};

View File

@ -4,6 +4,7 @@
#include "Game/Speaker/SpkMixingBuffer.h"
#include "Game/Speaker/SpkSound.h"
#include "JSystem/JAudio2/JASGlobal.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
class SpkSystem : JASGlobalInstance<SpkSystem> {
public:

View File

@ -0,0 +1,34 @@
#pragma once
#include <revolution.h>
class JASGenericMemPool {
public:
JASGenericMemPool();
~JASGenericMemPool();
void newMemPool(u32, int);
void* alloc(u32);
void free(void *, u32);
u32 _0;
u32 _4;
u32 _8;
};
template<typename T>
class JASMemPool : public JASGenericMemPool {
public:
JASMemPool() : JASGenericMemPool() {
}
~JASMemPool();
};
template <typename T>
class JASPoolAllocObject : public JASMemPool<T> {
public:
static JASPoolAllocObject<T> memPool_;
};

View File

@ -1,4 +1,14 @@
#include "Game/Speaker/SpkSound.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
void SpkSoundHandle::releaseSound() {
if (!mSound) {
return;
}
mSound->mSoundHandle = NULL;
mSound = NULL;
}
SpkSoundVolume::SpkSoundVolume() {
_0 = 1.0f;
@ -36,6 +46,18 @@ void SpkSoundVolume::setFadeOut(s32 fadeOut) {
OSRestoreInterrupts(status);
}
#ifdef NON_MATCHING
SpkSound::~SpkSound() {
releaseHandle();
if (this) {
JASPoolAllocObject<SpkSound>::memPool_.free(this, 0x60);
}
}
#endif
// SpkSound::update
void SpkSound::stop(s32 a1) {
_38 = 3;
s32 fade = (6 * a1) / 40;
@ -66,6 +88,26 @@ void SpkSound::releaseHandle() {
mSoundHandle = NULL;
}
bool SpkSound::start(s32 a1, s32 a2) {
_20 = a1;
bool res = setWaveData(a2);
if (!res) {
return false;
}
_38 = 1;
return true;
}
void SpkSound::unlock() {
if (_38 != 1) {
return;
}
_38 = 2;
}
SpkSoundHolder::SpkSoundHolder() : JASGlobalInstance(this) {
_44 = 0xA;
_40 = 1.0f;

View File

@ -30,7 +30,9 @@ void SpkSystem::startSound(s32 a1, s32 a2, SpkSoundHandle *pHandle) {
mSoundHolder->startSound(a1, a2, pHandle);
}
// SpkSystem::newSoundMemPool
void SpkSystem::newSoundMemPool(s32 a1) {
JASPoolAllocObject<SpkSystem>::memPool_.newMemPool(0x60, a1);
}
void SpkSystem::connect(s32 chan) {
SpkSpeakerCtrl::connect(chan);