More AudioManager

This commit is contained in:
Filip Gawin 2019-07-02 20:35:47 +02:00
parent d6957aaa57
commit e3fcb686cc
5 changed files with 1081 additions and 973 deletions

File diff suppressed because it is too large Load Diff

View File

@ -71,11 +71,13 @@ enum eAudioType : int32 {
TOTAL_AUDIO_TYPES = 14, TOTAL_AUDIO_TYPES = 14,
}; };
class CPhysical;
class tAudioEntity class tAudioEntity
{ {
public: public:
eAudioType m_nType; eAudioType m_nType;
void *m_pEntity; CPhysical *m_pEntity;
bool m_bIsUsed; bool m_bIsUsed;
char m_bStatus; char m_bStatus;
int16 m_awAudioEvent[4]; int16 m_awAudioEvent[4];
@ -159,7 +161,7 @@ public:
char field_22; char field_22;
char field_23; char field_23;
int field_24; int field_24;
char m_bIsPlayed; bool m_bIsPlayed;
char field_29; char field_29;
char field_30; char field_30;
char field_31; char field_31;
@ -185,7 +187,7 @@ public:
char field_15; char field_15;
int m_nTimer; int m_nTimer;
tActiveSample m_sQueueSample; tActiveSample m_sQueueSample;
char m_bActiveSampleQueue; uint8 m_bActiveSampleQueue;
char gap_109[3]; char gap_109[3];
tActiveSample m_asSamples[54]; tActiveSample m_asSamples[54];
char m_abSampleQueueIndexTable[54]; char m_abSampleQueueIndexTable[54];
@ -216,6 +218,72 @@ public:
char field_19195; char field_19195;
int m_nTimeOfRecentCrime; int m_nTimeOfRecentCrime;
char GetMissionScriptPoliceAudioPlayingStatus();
bool GetMissionAudioLoadingStatus();
uint8 GetNum3DProvidersAvailable();
int8 AutoDetect3DProviders();
bool IsMP3RadioChannelAvailable();
uint8 GetCDAudioDriveLetter();
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume);
void SetSpeakerConfig(int32 conf);
void ProcessJumboFlying();
bool SetupJumboEngineSound(uint8, int32); // todo
void PreInitialiseGameSpecificSetup();
void SetMissionScriptPoliceAudio(int32 sfx);
void CalculateDistance(bool *ptr, float dist);
bool UsesSiren(int32 model);
bool UsesSirenSwitching(int32 model);
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission);
uint8 Get3DProviderName(uint8 id);
void ProcessJumboTaxi();
bool SetupJumboFlySound(uint8); // todo
bool SetupJumboTaxiSound(uint8); // todo
bool SetupJumboWhineSound(uint8, int32); // todo
void PlayLoadedMissionAudio();
void SetMissionAudioLocation(float x, float y, float z);
void ResetPoliceRadio();
void InterrogateAudioEntities();
void ClearRequestedQueue();
// void AgeCrimes();
bool UsesReverseWarning(int32 model);
bool HasAirBrakes(int32 model);
int32 GetJumboTaxiFreq();
void ProcessPhysical(int32 id);
void ProcessVehicle(CPhysical *); // todo
void ProcessPed(CPhysical *); // todo
void ProcessPlane(void *); // todo
void ClearMissionAudio();
// void ProcessReverb();
bool IsMissionAudioSampleFinished();
void ProcessEntity(int32);
void InitialisePoliceRadio();
// done
int32 RandomDisplacement(uint32 seed); int32 RandomDisplacement(uint32 seed);
void ReleaseDigitalHandle(); void ReleaseDigitalHandle();
@ -224,7 +292,7 @@ public:
bool IsAudioInitialised() const; bool IsAudioInitialised() const;
int32 CreateEntity(int32 type, void *memory); int32 CreateEntity(int32 type, CPhysical *memory);
void DestroyEntity(int32 id); void DestroyEntity(int32 id);
void SetEntityStatus(int32 id, bool status); void SetEntityStatus(int32 id, bool status);

View File

@ -3,7 +3,10 @@
#include "SampleManager.h" #include "SampleManager.h"
CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0; CSampleManager &cSampleManager = *(CSampleManager *)0x7341E0;
uint32 &CSampleManager::nNumOfMp3Files = *(uint32*)0x95CC00;
uint32 &nNumOfMp3Files = *(uint32 *)0x95CC00;
uint8 &num3DProvidersAvailable = *(uint8 *)0x734237;
uint32 *asName3DProviders = (uint32 *)0x734238;
bool CSampleManager::IsMP3RadioChannelAvailable() { bool CSampleManager::IsMP3RadioChannelAvailable() {
return nNumOfMp3Files != 0; return nNumOfMp3Files != 0;
@ -21,3 +24,69 @@ CSampleManager::RequireDigitalHandle()
{ {
EAXJMP(0x5664F0); EAXJMP(0x5664F0);
} }
WRAPPER
char
CSampleManager::AutoDetect3DProviders()
{
EAXJMP(0x565990);
}
WRAPPER
uint8
CSampleManager::GetCDAudioDriveLetter()
{
EAXJMP(0x566F20);
}
WRAPPER
void
CSampleManager::SetEffectsMasterVolume(uint8 volume)
{
EAXJMP(0x567010);
}
WRAPPER
void
CSampleManager::SetMusicMasterVolume(uint8 volume)
{
EAXJMP(0x567020);
}
WRAPPER
void
CSampleManager::SetEffectsFadeVol(uint8 volume)
{
EAXJMP(0x567030);
}
WRAPPER
void
CSampleManager::SetMusicFadeVol(uint8 volume)
{
EAXJMP(0x567040);
}
WRAPPER
void
CSampleManager::SetSpeakerConfig(uint32 config)
{
EAXJMP(0x565900);
}
WRAPPER
bool
CSampleManager::GetChannelUsedFlag(int32 id)
{
EAXJMP(0x567B00);
}
WRAPPER
void
CSampleManager::StopChannel(int32 id)
{
EAXJMP(0x567BE0);
}
STARTPATCHES
InjectHook(0x566490, CSampleManager::IsMP3RadioChannelAvailable, PATCH_JUMP);
ENDPATCHES

View File

@ -1,13 +1,37 @@
#pragma once #pragma once
class CSampleManager { struct tSample {
public: int m_nOffset;
static uint32 &nNumOfMp3Files; unsigned int m_nSize;
int m_nFrequency;
int m_nLoopStart;
int m_nLoopEnd;
};
class CSampleManager
{
public: public:
void ReleaseDigitalHandle(); void ReleaseDigitalHandle();
void RequireDigitalHandle(); void RequireDigitalHandle();
char AutoDetect3DProviders();
uint8 GetCDAudioDriveLetter();
void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume);
void SetMusicFadeVol(uint8 volume);
void SetSpeakerConfig(uint32 config);
bool GetChannelUsedFlag(int32 id);
void StopChannel(int32 id);
static bool IsMP3RadioChannelAvailable(); static bool IsMP3RadioChannelAvailable();
}; };
extern uint32 &nNumOfMp3Files;
extern uint8 &num3DProvidersAvailable;
extern uint32* asName3DProviders;
extern CSampleManager &cSampleManager; extern CSampleManager &cSampleManager;

View File

@ -24,6 +24,80 @@ enum eCarLock : uint8 {
CARLOCK_SKIP_SHUT_DOORS CARLOCK_SKIP_SHUT_DOORS
}; };
enum eVehicleModel : int32
{
LANDSTAL = 0x0,
IDAHO = 0x1,
STINGER = 0x2,
LINERUN = 0x3,
PEREN = 0x4,
SENTINEL = 0x5,
PATRIOT = 0x6,
FIRETRUK = 0x7,
TRASH = 0x8,
STRETCH = 0x9,
MANANA = 0xA,
INFERNUS = 0xB,
BLISTA = 0xC,
PONY = 0xD,
MULE = 0xE,
CHEETAH = 0xF,
AMBULAN = 0x10,
FBICAR = 0x11,
MOONBEAM = 0x12,
ESPERANT = 0x13,
TAXI = 0x14,
KURUMA = 0x15,
BOBCAT = 0x16,
MRWHOOP = 0x17,
BFINJECT = 0x18,
CORPSE = 0x19,
POLICE = 0x1A,
ENFORCER = 0x1B,
SECURICA = 0x1C,
BANSHEE = 0x1D,
PREDATOR = 0x1E,
BUS = 0x1F,
RHINO = 0x20,
BARRACKS = 0x21,
TRAIN = 0x22,
CHOPPER = 0x23,
DODO = 0x24,
COACH = 0x25,
CABBIE = 0x26,
STALLION = 0x27,
RUMPO = 0x28,
RCBANDIT = 0x29,
BELLYUP = 0x2A,
MRWONGS = 0x2B,
MAFIA = 0x2C,
YARDIE = 0x2D,
YAKUZA = 0x2E,
DIABLOS = 0x2F,
COLUMB = 0x30,
HOODS = 0x31,
AIRTRAIN = 0x32,
DEADDODO = 0x33,
SPEEDER = 0x34,
REEFER = 0x35,
PANLANT = 0x36,
FLATBED = 0x37,
YANKEE = 0x38,
ESCAPE = 0x39,
BORGNINE = 0x3A,
TOYZ = 0x3B,
GHOST = 0x3C,
CAR151 = 0x3D,
CAR152 = 0x3E,
CAR153 = 0x3F,
CAR154 = 0x40,
CAR155 = 0x41,
CAR156 = 0x42,
CAR157 = 0x43,
CAR158 = 0x44,
CAR159 = 0x45,
};
class CVehicle : public CPhysical class CVehicle : public CPhysical
{ {
public: public: