mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: swap sequence headers
This commit is contained in:
1 parent
e1b892e8b4
commit
32c05e6a3d
3 files changed
+20
-4
No files matched your search
@@ -10,6 +10,7 @@ void preprocessMpConfigs(u8 *data, u32 size);
|
||||
void preprocessFont(u8 *data, u32 size);
|
||||
void preprocessJpnFont(u8 *data, u32 size);
|
||||
void preprocessALBankFile(u8 *data, u32 size);
|
||||
void preprocessALCMidiHdr(u8 *data, u32 size);
|
||||
void preprocessSequences(u8 *data, u32 size);
|
||||
void preprocessFiringRange(u8 *data, u32 size);
|
||||
void preprocessTexturesList(u8 *data, u32 size);
|
||||
|
||||
+13
-4
@@ -48,7 +48,7 @@ static inline u32 swapUnk(u32 x) { assert(0 && "unknown type"); return x; }
|
||||
|
||||
static inline void preprocessALWaveTable(ALWaveTable *tbl, u8 *bankBase)
|
||||
{
|
||||
if ((uintptr_t)tbl->base < 0x02000000) {
|
||||
if ((uintptr_t)tbl->base < 0x02000000 && tbl->len >= 0) {
|
||||
// already swapped (maybe come up with a better check)
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ static inline void preprocessALWaveTable(ALWaveTable *tbl, u8 *bankBase)
|
||||
|
||||
static inline void preprocessALSound(ALSound *snd, u8 *bankBase)
|
||||
{
|
||||
if ((uintptr_t)snd->wavetable < 0x02000000) {
|
||||
if ((uintptr_t)snd->wavetable < 0x02000000 && (uintptr_t)snd->envelope < 0x02000000 && (uintptr_t)snd->keyMap < 0x02000000) {
|
||||
// already swapped (maybe come up with a better check)
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ static inline void preprocessALSound(ALSound *snd, u8 *bankBase)
|
||||
|
||||
static inline void preprocessALInstrument(ALInstrument *inst, u8 *bankBase)
|
||||
{
|
||||
if ((uintptr_t)inst->soundArray[0] < 0x02000000) {
|
||||
if ((uintptr_t)inst->soundArray[0] < 0x0500000 && inst->bendRange >= 0) {
|
||||
// already swapped (maybe come up with a better check)
|
||||
return;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ static inline void preprocessALInstrument(ALInstrument *inst, u8 *bankBase)
|
||||
|
||||
static inline void preprocessALBank(ALBank *bank, u8 *bankBase)
|
||||
{
|
||||
if ((uintptr_t)bank->instArray[0] < 0x02000000) {
|
||||
if ((uintptr_t)bank->sampleRate <= 48000) {
|
||||
// already swapped (maybe come up with a better check)
|
||||
return;
|
||||
}
|
||||
@@ -915,6 +915,15 @@ void preprocessALBankFile(u8 *data, u32 size)
|
||||
}
|
||||
}
|
||||
|
||||
void preprocessALCMidiHdr(u8 *data, u32 size)
|
||||
{
|
||||
ALCMidiHdr *hdr = (ALCMidiHdr *)data;
|
||||
PD_SWAP_VAL(hdr->division);
|
||||
for (s32 i = 0; i < ARRAYCOUNT(hdr->trackOffset); ++i) {
|
||||
PD_SWAP_VAL(hdr->trackOffset[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void preprocessSequences(u8 *data, u32 size)
|
||||
{
|
||||
struct seqtable *seq = (struct seqtable *)data;
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "lib/speaker.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
#ifndef PLATFORM_N64
|
||||
#include "preprocess.h"
|
||||
#endif
|
||||
|
||||
struct curmp3 {
|
||||
union soundnumhack sfxref;
|
||||
@@ -1628,6 +1631,9 @@ bool seqPlay(struct seqinstance *seq, s32 tracknum)
|
||||
dmaExec(zipstart, g_SeqTable->entries[seq->tracknum].romaddr, ziplen);
|
||||
|
||||
ziplen = rzipInflate(zipstart, binstart, scratch);
|
||||
#ifndef PLATFORM_N64
|
||||
preprocessALCMidiHdr(binstart, ziplen);
|
||||
#endif
|
||||
|
||||
#if VERSION < VERSION_NTSC_1_0
|
||||
if (ziplen == 0) {
|
||||
|
||||
Reference in new issue
Block a user