Match and link GameAudioCommon.cpp

This commit is contained in:
SwareJonge 2023-12-30 01:32:18 +01:00
parent 3dadd5ef52
commit 90c551ff03
14 changed files with 262 additions and 27 deletions

View File

@ -919,6 +919,13 @@ src/Bando/EngineSound.cpp:
.text: [0x80118cac, 0x80118d1c]
.data: [0x80393760, 0x803937b8]
src/Inagaki/GameAudioCommon.cpp:
.text: [0x8011af3c, 0x8011b264]
.ctors: [0x80316190, 0x80316194]
.bss: [0x803c9368, 0x803c93a8]
.sbss: [0x80416210, 0x80416218]
.sdata2: [0x80418940, 0x80418960]
src/Inagaki/GameAudioHostIO.cpp:
.text: [0x8011b264, 0x8011b478]
.ctors: [0x80316194, 0x80316198]

View File

@ -896,6 +896,13 @@ src/Bando/EngineSound.cpp:
.text: [0x8011226c, 0x801122dc]
.data: [0x80353590, 0x803535e8]
src/Inagaki/GameAudioCommon.cpp:
.text: [0x80113900, 0x80113c28]
.ctors: [0x802d8594, 0x802d8598]
.bss: [0x80388ea8, 0x80388ee8]
.sbss: [0x803d5490, 0x803d5498]
.sdata2: [0x803d7638, 0x803d7658]
src/Inagaki/GameAudioHostIO.cpp:
.text: [0x80113c28, 0x80113ddc]
.ctors: [0x802d8598, 0x802d859c]

View File

@ -1089,6 +1089,9 @@ global:
0x803d4c81: __init__memPool___26JASPoolAllocObject<5JAISe>
# JAISeq.cpp
0x8008c978: __dt__27JASMemPool<13JAISoundChild>Fv
# JAIStreamDataMgr.cpp
0x8034b6a8: __vt__16JAIStreamAramMgr
0x8034b6bc: __vt__16JAIStreamDataMgr
# JASReport.cpp
0x80091270: JASReport__FPCce
# JASTaskThread.cpp
@ -1136,6 +1139,8 @@ global:
0x800a318c: __ct__Q29JGeometry8TVec3<f>Fv
# JAUSectionHeap.cpp
0x800a7578: newCopy__10JAUSectionFPCvUll
# JAUSoundInfo.cpp
0x8034f280: __vt__12JAUSoundInfo
# Dolphin
# these have been ported by hand, there might be some errors in here
# all local symbols are filtered out.
@ -2378,7 +2383,12 @@ global:
# Inagaki
# GameAudioCommon.cpp
0x80113900: panDeform__Q29GameAudio6CommonFff
0x80113944: setMultiPlayModePan__Q29GameAudio6CommonFUc
0x80113970: changeRandomId__Q29GameAudio6CommonFUlUl
0x80113a08: setSeed__Q29GameAudio6RandomFUl
0x80113a14: getRandomU32__Q29GameAudio6RandomFv
0x80113a70: getSignalEngineRandomU32__Q29GameAudio6RandomFv
# GameAudioHostIO.cpp
0x803d7658: GA_MULTI_CAMERA_VOL_DOWN_DISTANCE__9GameAudio
0x803d765c: GA_MULTI_CAMERA_VOL_DOWN_RATE__9GameAudio
@ -2401,6 +2411,27 @@ global:
# GameAudioParam.cpp
0x80119294: setDemoMode__Q29GameAudio10ParametersFUc
0x801195c0: getDemoMode__Q29GameAudio10ParametersFv
# GameSoundTable.cpp
0x8011fb74: getBgmSeqResourceID__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fbf0: getSoundType__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fc38: getCategory__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fc8c: getAudibleSw__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fd08: getPTrack__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fd80: getSwBit__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fe0c: getLevelFlag__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011fe90: getPriority__Q29GameAudio16CustomSoundTableCF10JAISoundID
0x8011ff3c: getSeInfo__Q29GameAudio16CustomSoundTableCF10JAISoundIDP5JAISe
0x8011ff74: getSeqInfo__Q29GameAudio16CustomSoundTableCF10JAISoundIDP6JAISeq
0x8011ffa0: getStreamInfo__Q29GameAudio16CustomSoundTableCF10JAISoundIDP9JAIStream
0x801200a4: getSoundInfo___Q29GameAudio16CustomSoundTableCF10JAISoundIDP8JAISound
0x801201c8: getStreamFileEntry__Q29GameAudio16CustomSoundTableF10JAISoundID
0x801201fc: initAudibleSw__Q29GameAudio16CustomSoundTableFv
0x80120318: __dt__Q29GameAudio16CustomSoundTableFv
#0x80120578: @4@getBgmSeqResourceID__Q29GameAudio16CustomSoundTableCF10JAISoundID
#0x80120580: @4@getAudibleSw__Q29GameAudio16CustomSoundTableCF10JAISoundID
#0x80120588: @8@__dt__Q29GameAudio16CustomSoundTableFv
#0x80120590: @8@getStreamFileEntry__Q29GameAudio16CustomSoundTableF10JAISoundID
0x80353c00: __vt__Q29GameAudio16CustomSoundTable
# GameAudioFxConfig.cpp
0x80122d7c: __ct__Q29GameAudio12FxLineConfigFP7JKRHeap
0x80122e5c: set__Q29GameAudio12FxLineConfigFUc

View File

@ -0,0 +1,31 @@
#ifndef GAMEAUDIOCOMMON_H
#define GAMEAUDIOCOMMON_H
#include <JSystem/JMath/JMath.h>
namespace GameAudio
{
class Common
{
public:
static f32 panDeform(f32, f32);
static f32 setMultiPlayModePan(u8); // this is a getter, not a setter
static u32 changeRandomId(u32, u32);
};
class Random
{
public:
static void setSeed(u32 seed);
static u32 getRandomU32();
static u32 getSignalEngineRandomU32();
static void *getMgr(); // Unused, however i assume it returned sRandom?
private:
static JMath::TRandom_<JMath::TRandom_fast_> sRandom;
static JMath::TRandom_<JMath::TRandom_fast_> sSignalEngineRandom;
};
}
#endif

View File

@ -5,6 +5,7 @@
#include <JSystem/JAudio/JAUSectionHeap.h>
#include "Inagaki/GameAudioFxConfig.h"
#include "Inagaki/GameSoundTable.h"
#include "types.h"
namespace GameAudio
@ -45,6 +46,7 @@ namespace GameAudio
f32 getTHPOptionVolume() { return getMasterVolumeValue() / 2; };
JAUSectionHeap *getSectionHeap() { return mSectionHeap; }
CustomSoundTable *getSoundTable() { return mTable; }
static Main *getAudio() { return msBasic; };
@ -52,7 +54,9 @@ namespace GameAudio
private:
CustomMgr *mMgr; // 00
u8 _04[0x14 - 0x4]; //
u8 _04[0xC - 0x4]; //
CustomSoundTable *mTable; // 0C
u8 _10[4]; //
JAUSectionHeap *mSectionHeap; // 14
u8 _18[0x44 - 0x18]; //
FxLineConfig *mConfig; // 44

View File

@ -0,0 +1,31 @@
#ifndef GAMESOUNDTABLE_H
#define GAMESOUNDTABLE_H
#include <JSystem/JAudio/Interface/JAISoundInfo.h>
#include <JSystem/JAudio/Interface/JAIStreamDataMgr.h>
#include <JSystem/JAudio/JAUSoundInfo.h>
namespace GameAudio
{
class CustomSoundTable : public JAISoundInfo, public JAUSoundInfo, public JAIStreamDataMgr, public JASGlobalInstance<CustomSoundTable>
{
public:
virtual u32 getSoundType(JAISoundID) const;
virtual int getCategory(JAISoundID) const;
virtual u32 getPriority(JAISoundID) const;
virtual void getSeInfo(JAISoundID, JAISe *) const;
virtual void getSeqInfo(JAISoundID, JAISeq *) const ;
virtual void getStreamInfo(JAISoundID, JAIStream *) const;
virtual ~CustomSoundTable();
virtual void getAudibleSw(JAISoundID) const;
virtual u16 getBgmSeqResourceID(JAISoundID) const;
virtual u8 getPTrack(JAISoundID) const;
virtual u32 getSwBit(JAISoundID) const;
virtual u8 getLevelFlag(JAISoundID) const;
virtual s32 getStreamFileEntry(JAISoundID);
};
}
#endif

View File

@ -6,6 +6,8 @@
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JMath/JMath.h"
#include "Inagaki/GameAudioCommon.h" // Temporary(so permanent) fix for that one file that actually uses this
namespace GameAudio
{
template <typename T>
@ -17,18 +19,6 @@ namespace GameAudio
virtual void setSe(u32 id);
virtual void loop(u32);
};
namespace Random
{
void setSeed(u32);
u32 getRandomU32();
u32 getSignalEngineRandomU32();
extern JMath::TRandom_fast_ sRandom;
extern JMath::TRandom_fast_ sSignalEngineRandom;
}
}
#endif

View File

@ -40,24 +40,35 @@ private:
class JAISoundID
{
public:
operator u32() const { return this->mId.mFullId; }
void operator=(JAISoundID const &other) { mId.mFullId = other.mId.mFullId; };
JAISoundID(u32 pId) { mId.mFullId = pId; };
JAISoundID(JAISoundID const &other) { mId = other.mId; };
JAISoundID() {}
JAISoundID(u32 id)
{
mID = id;
}
void setAnonymous()
{
mID = 0xffffffff;
}
bool isAnonymous() { return mId.mFullId == 0xffffffff; }
void setAnonymous() { mId.mFullId = -1; }
bool isAnonymous() const
union
{
return mID != 0xffffffff;
}
private:
u32 mID;
u32 mFullId;
struct
{
u8 b0;
u8 b1;
u8 b2;
u8 b3;
} mBytes;
struct
{
u16 mSoundType;
u16 mShortId;
} mAdvancedId; // Debug doesn't have an inline for referencing the short ID so I assume
// it's similar to this
} mId;
};
struct JAISoundStatus_ {

View File

@ -0,0 +1,19 @@
#ifndef JAUDIO_JAISOUNDINFO_H
#define JAUDIO_JAISOUNDINFO_H
#include "JSystem/JAudio/Interface/JAISound.h"
#include "JSystem/JAudio/System/JASGadget.h"
struct JAISoundInfo : public JASGlobalInstance<JAISoundInfo>
{
JAISoundInfo(bool);
virtual u32 getSoundType(JAISoundID) const = 0;
virtual int getCategory(JAISoundID) const = 0;
virtual u32 getPriority(JAISoundID) const = 0;
virtual void getSeInfo(JAISoundID, JAISe *) const = 0;
virtual void getSeqInfo(JAISoundID, JAISeq *) const = 0;
virtual void getStreamInfo(JAISoundID, JAIStream *) const = 0;
virtual ~JAISoundInfo();
};
#endif /* JAUDIO_JAISOUNDINFO_H */

View File

@ -0,0 +1,19 @@
#ifndef JAUDIO_JAISTREAMDATAMGR_H
#define JAUDIO_JAISTREAMDATAMGR_H
#include "JSystem/JAudio/Interface/JAISound.h"
struct JAIStreamDataMgr
{
virtual s32 getStreamFileEntry(JAISoundID) = 0;
virtual ~JAIStreamDataMgr();
};
struct JAIStreamAramMgr
{
virtual void *newStreamAram(u32 *) = 0;
virtual void deleteStreamAram(u32) = 0;
virtual ~JAIStreamAramMgr();
};
#endif /* JAUDIO_JAISTREAMDATAMGR_H */

View File

@ -0,0 +1,16 @@
#ifndef JAUDIO_JASFAKEMATCH4_H
#define JAUDIO_JASFAKEMATCH4_H
#ifdef MATCHING
#include "JSystem/JAudio/System/JASMemPool.h"
#include "JSystem/JAudio/System/JASTrack.h"
class JAISe;
class JAISeq;
#include "JSystem/JAudio/JASFakeMatch.h"
JASMemPool<JAISeq> JASPoolAllocObject<JAISeq>::memPool_;
JASMemPool<JAISe> JASPoolAllocObject<JAISe>::memPool_;
#endif
#endif

View File

@ -0,0 +1,15 @@
#ifndef JAUDIO_JAUSOUNDINFO_H
#define JAUDIO_JAUSOUNDINFO_H
#include "JSystem/JAudio/Interface/JAISound.h"
#include "JSystem/JAudio/System/JASGadget.h"
class JAUSoundInfo : public JASGlobalInstance<JAUSoundInfo>
{
public:
JAUSoundInfo(bool param_0) : JASGlobalInstance<JAUSoundInfo>(param_0) {}
virtual void getAudibleSw(JAISoundID) const = 0;
virtual u16 getBgmSeqResourceID(JAISoundID) const = 0;
};
#endif /* JAUDIO_JAUSOUNDINFO_H */

View File

@ -0,0 +1,54 @@
#include "Inagaki/GameAudioCommon.h"
#include "Inagaki/GameAudioMain.h"
namespace GameAudio
{
JMath::TRandom_<JMath::TRandom_fast_> Random::sRandom(0);
JMath::TRandom_<JMath::TRandom_fast_> Random::sSignalEngineRandom(0);
f32 Common::panDeform(f32 x, f32 y)
{
if(x > 0.5f) {
f32 ret = 0.5f + (x - 0.5f) * y;
if(ret > 1.0f)
ret = 1.0f;
return ret;
}
else {
f32 ret = 0.5f - (0.5f - x) * y;
if (ret < 0.0f)
ret = 0.0f;
return ret;
}
}
f32 Common::setMultiPlayModePan(u8 p1) { return (p1 & 1); }
u32 Common::changeRandomId(u32 id1, u32 id2)
{
u32 swBit = GetGameAudioMain()->getSoundTable()->getSwBit(id1);
if (swBit & 0x70000000) {
swBit = ((swBit & 0x70000000) >> 0x1c) + 1;
u32 rnd = Random::getRandomU32();
u32 randId = id1 + ((rnd >> 0xc) % swBit);
if (randId == id2 && (++randId == id1 + swBit))
{
randId = id1;
}
return randId;
}
return id1;
}
void Random::setSeed(u32 seed)
{
sRandom.setSeed(seed);
sSignalEngineRandom.setSeed(seed);
}
u32 Random::getRandomU32() { return 4294967295.0f * sRandom.get_ufloat_1(); }
u32 Random::getSignalEngineRandomU32() { return 4294967295.0f * sSignalEngineRandom.get_ufloat_1(); }
}
#include <JSystem/JAudio/JASFakeMatch4.h>