mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-02 14:47:58 +03:00
fix regression in LoadSamples
This commit is contained in:
parent
e80e71d272
commit
fd59c4a727
4 changed files with 13 additions and 8 deletions
|
@ -870,7 +870,7 @@ S_SoundStopSample 0x00438CD0 0x0000001B -
|
|||
sub_438CF0 0x00438CF0 0x00000044 -
|
||||
S_CDPlay 0x00438D40 0x000000FD +
|
||||
S_CDStop 0x00438E40 0x00000043 *
|
||||
SampleLoader 0x00438E90 0x00000005 *
|
||||
SampleLoader 0x00438E90 0x00000005 +
|
||||
LoadSamples 0x00438EA0 0x00000189 +
|
||||
S_StartSyncedAudio 0x00439030 0x000000FC +
|
||||
|
||||
|
|
|
@ -1951,6 +1951,5 @@ typedef struct SAMPLE_INFO {
|
|||
typedef void (*ControlRoutine)(ITEM_INFO *, COLL_INFO *);
|
||||
typedef void (*CollisionRoutine)(ITEM_INFO *, COLL_INFO *);
|
||||
typedef void (*EffectRoutine)(ITEM_INFO *item);
|
||||
typedef int32_t (*SampleLoaderRoutine)(int32_t sample_num);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -102,7 +102,6 @@
|
|||
|
||||
#define SoundIsActive VAR_I_(0x00456688, int32_t, 1)
|
||||
#define SoundsLoaded VAR_U_(0x0045A214, int32_t)
|
||||
#define SampleLoader VAR_U_(0x00438E90, SampleLoaderRoutine)
|
||||
#define SampleLUT ARRAY_(0x0045EB60, int16_t, [MAX_SAMPLES])
|
||||
#define SampleInfos VAR_U_(0x0045ED60, SAMPLE_INFO*)
|
||||
#define NumSampleInfos VAR_U_(0x0045A210, int32_t)
|
||||
|
|
|
@ -551,6 +551,11 @@ static int32_t LoadDemo(MYFILE *fp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static const char *SampleLoader(const char *sample_data)
|
||||
{
|
||||
return sample_data;
|
||||
}
|
||||
|
||||
static int32_t LoadSamples(MYFILE *fp)
|
||||
{
|
||||
if (!SoundIsActive) {
|
||||
|
@ -565,24 +570,26 @@ static int32_t LoadSamples(MYFILE *fp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SampleInfos = game_malloc(8 * NumSampleInfos, GBUF_SAMPLE_INFOS);
|
||||
SampleInfos =
|
||||
game_malloc(sizeof(SAMPLE_INFO) * NumSampleInfos, GBUF_SAMPLE_INFOS);
|
||||
FileRead(SampleInfos, sizeof(SAMPLE_INFO), NumSampleInfos, fp);
|
||||
|
||||
int32_t sample_data_size;
|
||||
TRACE("%d sample data size", sample_data_size);
|
||||
FileRead(&sample_data_size, sizeof(int32_t), 1, fp);
|
||||
TRACE("%d sample data size", sample_data_size);
|
||||
if (!sample_data_size) {
|
||||
S_ExitSystem("No Sample Data");
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *sample_data = game_malloc(sample_data_size, GBUF_SAMPLES);
|
||||
FileRead(
|
||||
sample_data, sizeof(int16_t), sample_data_size / sizeof(int16_t), fp);
|
||||
FileRead(sample_data, sizeof(char), sample_data_size, fp);
|
||||
|
||||
FileRead(&NumSamples, sizeof(int32_t), 1u, fp);
|
||||
FileRead(&NumSamples, sizeof(int32_t), 1, fp);
|
||||
TRACE("%d samples", NumSamples);
|
||||
if (!NumSamples) {
|
||||
S_ExitSystem("No Samples");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t *sample_offsets =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue