1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 20:20:02 +00:00

sampman cosmetic fix

This commit is contained in:
Fire-Head 2019-08-03 18:15:31 +03:00
parent a890a8a3b4
commit 7ed494906a
2 changed files with 47 additions and 44 deletions

View file

@ -18,7 +18,7 @@
#pragma comment( lib, "mss32.lib" ) #pragma comment( lib, "mss32.lib" )
cSampleManager &SampleManager = *(cSampleManager *)0x7341E0; cSampleManager &SampleManager = *(cSampleManager *)0x7341E0;
int32 (&BankStartOffset)[2] = *(int32 (*)[2])*(int *)0x6FAB70; int32 (&BankStartOffset)[MAX_SAMPLEBANKS] = *(int32 (*)[MAX_SAMPLEBANKS])*(int *)0x6FAB70;
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
@ -289,7 +289,7 @@ cSampleManager::SetSpeakerConfig(int32 which)
} }
uint32 uint32
cSampleManager::GetMaximumSupportedChannels(void) //[Y] cSampleManager::GetMaximumSupportedChannels(void)
{ {
if ( _maxSamples > MAXCHANNELS ) if ( _maxSamples > MAXCHANNELS )
return MAXCHANNELS; return MAXCHANNELS;
@ -857,10 +857,10 @@ cSampleManager::Initialise(void)
m_aSamples[i].nLoopEnd = -1; m_aSamples[i].nLoopEnd = -1;
} }
m_nEffectsVolume = 127; m_nEffectsVolume = MAX_VOLUME;
m_nMusicVolume = 127; m_nMusicVolume = MAX_VOLUME;
m_nEffectsFadeVolume = 127; m_nEffectsFadeVolume = MAX_VOLUME;
m_nMusicFadeVolume = 127; m_nMusicFadeVolume = MAX_VOLUME;
m_nMonoMode = 0; m_nMonoMode = 0;
} }
@ -946,14 +946,14 @@ cSampleManager::Initialise(void)
return false; return false;
} }
nSampleBankMemoryStartAddress[0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[0]); nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SAMPLEBANK_MAIN]);
if ( !nSampleBankMemoryStartAddress[0] ) if ( !nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] )
{ {
Terminate(); Terminate();
return false; return false;
} }
nSampleBankMemoryStartAddress[1] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX); nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
} }
@ -1159,7 +1159,7 @@ cSampleManager::Initialise(void)
TRACE("bank"); TRACE("bank");
LoadSampleBank(0); LoadSampleBank(SAMPLEBANK_MAIN);
// mp3 // mp3
TRACE("mp3"); TRACE("mp3");
@ -1188,7 +1188,7 @@ cSampleManager::Initialise(void)
bUseRandomTable = true; bUseRandomTable = true;
else else
{ {
bUseRandomTable = 0; bUseRandomTable = false;
localtm = localtime(&t); localtm = localtime(&t);
} }
@ -1254,16 +1254,16 @@ cSampleManager::Terminate(void)
_DeleteMP3Entries(); _DeleteMP3Entries();
if ( nSampleBankMemoryStartAddress[0] != 0 ) if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0 )
{ {
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[0]); AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN]);
nSampleBankMemoryStartAddress[0] = 0; nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = 0;
} }
if ( nSampleBankMemoryStartAddress[1] != 0 ) if ( nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0 )
{ {
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[1]); AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_PED]);
nSampleBankMemoryStartAddress[1] = 0; nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = 0;
} }
if ( DIG ) if ( DIG )
@ -1407,7 +1407,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
if ( MusicManager.IsInitialised() if ( MusicManager.IsInitialised()
&& MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE && MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& nBank != 0 ) && nBank != SAMPLEBANK_MAIN )
{ {
return false; return false;
} }
@ -1496,10 +1496,10 @@ cSampleManager::LoadPedComment(uint32 nComment)
if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 ) if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
return false; return false;
if ( fread((void *)(nSampleBankMemoryStartAddress[1] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
return false; return false;
nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[1] + PED_BLOCKSIZE*nCurrentPedSlot; nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot;
nPedSlotSfx [nCurrentPedSlot] = nComment; nPedSlotSfx [nCurrentPedSlot] = nComment;
if ( ++nCurrentPedSlot >= MAX_PEDSFX ) if ( ++nCurrentPedSlot >= MAX_PEDSFX )
@ -1706,7 +1706,7 @@ void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{ {
uint32 vol = nVolume; uint32 vol = nVolume;
if ( vol > 127 ) vol = 127; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
nChannelVolume[nChannel] = vol; nChannelVolume[nChannel] = vol;
@ -1741,7 +1741,7 @@ void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{ {
uint32 vol = nVolume; uint32 vol = nVolume;
if ( vol > 127 ) vol = 127; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
switch ( nChannel ) switch ( nChannel )
{ {
@ -2181,8 +2181,8 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
if ( m_bInitialised ) if ( m_bInitialised )
{ {
if ( vol > 127 ) vol = 127; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
if ( vol > 127 ) vol = 127; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
nStreamVolume[nStream] = vol; nStreamVolume[nStream] = vol;
nStreamPan[nStream] = nPan; nStreamPan[nStream] = nPan;
@ -2228,7 +2228,7 @@ cSampleManager::IsStreamPlaying(uint8 nStream)
bool bool
cSampleManager::InitialiseSampleBanks(void) cSampleManager::InitialiseSampleBanks(void)
{ {
int32 nBank = 0; int32 nBank = SAMPLEBANK_MAIN;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb"); fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL ) if ( fpSampleDescHandle == NULL )
@ -2261,8 +2261,8 @@ cSampleManager::InitialiseSampleBanks(void)
} }
} }
nSampleBankSize[0] = nSampleBankDiscStartOffset[1] - nSampleBankDiscStartOffset[0]; nSampleBankSize[SAMPLEBANK_MAIN] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SAMPLEBANK_MAIN];
nSampleBankSize[1] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[1]; nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED];
return true; return true;
} }

View file

@ -2,6 +2,8 @@
#include "common.h" #include "common.h"
#include "AudioSamples.h" #include "AudioSamples.h"
#define MAX_VOLUME 127
struct tSample { struct tSample {
int32 nOffset; int32 nOffset;
uint32 nSize; uint32 nSize;
@ -10,6 +12,16 @@ struct tSample {
int32 nLoopEnd; int32 nLoopEnd;
}; };
enum
{
SAMPLEBANK_MAIN,
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
#define MAXPROVIDERS 64 #define MAXPROVIDERS 64
#define MAXCHANNELS 28 #define MAXCHANNELS 28
@ -17,22 +29,13 @@ struct tSample {
#define MAX2DCHANNELS 1 #define MAX2DCHANNELS 1
#define CHANNEL2D MAXCHANNELS #define CHANNEL2D MAXCHANNELS
#define MAX_MP3STREAMS 2 #define MAX_MP3STREAMS 2
#define MAX_SAMPLEBANKS 2
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
#define MAX_DIGITAL_MIXER_CHANNELS 32
#define DIGITALRATE 32000 #define DIGITALRATE 32000
#define DIGITALBITS 16 #define DIGITALBITS 16
#define DIGITALCHANNELS 2 #define DIGITALCHANNELS 2
#define MAX_DIGITAL_MIXER_CHANNELS 32
class cSampleManager class cSampleManager
{ {