mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-02 16:23:57 +03:00
Removed 32 bit structs
This commit is contained in:
parent
2a8ac4891e
commit
6393690103
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,4 +47,5 @@ starship.cfg.json
|
|||||||
Starship.log
|
Starship.log
|
||||||
*.sav
|
*.sav
|
||||||
*.lib
|
*.lib
|
||||||
*.pdb
|
*.pdb
|
||||||
|
dumps/
|
@ -224,12 +224,6 @@ typedef struct {
|
|||||||
/* 0x08 */ s16* book; // size 8 * order * numPredictors.
|
/* 0x08 */ s16* book; // size 8 * order * numPredictors.
|
||||||
} AdpcmBook; // size >= 8, 0x8 aligned
|
} AdpcmBook; // size >= 8, 0x8 aligned
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x00 */ s32 order;
|
|
||||||
/* 0x04 */ s32 numPredictors;
|
|
||||||
/* 0x08 */ u32 book; // size 8 * order * numPredictors.
|
|
||||||
} AdpcmBook32Bit; // size >= 8, 0x8 aligned
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u32 codec : 4; // The state of compression or decompression
|
/* 0x00 */ u32 codec : 4; // The state of compression or decompression
|
||||||
/* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
|
/* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
|
||||||
@ -244,28 +238,11 @@ typedef struct {
|
|||||||
book; // Adpcm book parameters used by the sample. Offset from the start of the sound font / pointer to ram
|
book; // Adpcm book parameters used by the sample. Offset from the start of the sound font / pointer to ram
|
||||||
} Sample; // size = 0x10
|
} Sample; // size = 0x10
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x00 */ u32 codec : 4; // The state of compression or decompression
|
|
||||||
/* 0x00 */ u32 medium : 2; // Medium where sample is currently stored
|
|
||||||
/* 0x00 */ u32 unk_bit26 : 1;
|
|
||||||
/* 0x00 */ u32 isRelocated : 1; // Has the sample header been relocated (offsets to pointers)
|
|
||||||
/* 0x01 */ u32 size : 24; // Size of the sample
|
|
||||||
/* 0x04 */ u32 sampleAddr; // Raw sample data. Offset from the start of the sample bank or absolute address to
|
|
||||||
// either rom or ram
|
|
||||||
/* 0x08 */ u32 loop; // Adpcm loop parameters used by the sample. Offset from the start of the sound font / pointer to ram
|
|
||||||
/* 0x0C */ u32 book; // Adpcm book parameters used by the sample. Offset from the start of the sound font / pointer to ram
|
|
||||||
} Sample32Bit; // size = 0x10
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ Sample* sample;
|
/* 0x00 */ Sample* sample;
|
||||||
/* 0x04 */ f32 tuning; // frequency modulation factor
|
/* 0x04 */ f32 tuning; // frequency modulation factor
|
||||||
} TunedSample;// size = 0x8
|
} TunedSample;// size = 0x8
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x00 */ u32 sample;
|
|
||||||
/* 0x04 */ f32 tuning; // frequency modulation factor
|
|
||||||
} TunedSample32Bit;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u8 isRelocated; // have the envelope and all samples been relocated (offsets to pointers)
|
/* 0x00 */ u8 isRelocated; // have the envelope and all samples been relocated (offsets to pointers)
|
||||||
/* 0x01 */ u8 normalRangeLo;
|
/* 0x01 */ u8 normalRangeLo;
|
||||||
@ -277,17 +254,6 @@ typedef struct {
|
|||||||
/* 0x18 */ TunedSample highPitchTunedSample;
|
/* 0x18 */ TunedSample highPitchTunedSample;
|
||||||
} Instrument; // size = 0x20
|
} Instrument; // size = 0x20
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x00 */ u8 isRelocated; // have the envelope and all samples been relocated (offsets to pointers)
|
|
||||||
/* 0x01 */ u8 normalRangeLo;
|
|
||||||
/* 0x02 */ u8 normalRangeHi;
|
|
||||||
/* 0x03 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
|
|
||||||
/* 0x04 */ u32 envelope;
|
|
||||||
/* 0x08 */ TunedSample32Bit lowPitchTunedSample;
|
|
||||||
/* 0x10 */ TunedSample32Bit normalPitchTunedSample;
|
|
||||||
/* 0x18 */ TunedSample32Bit highPitchTunedSample;
|
|
||||||
} Instrument32Bit; // size = 0x20
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
|
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
|
||||||
/* 0x01 */ u8 pan;
|
/* 0x01 */ u8 pan;
|
||||||
@ -296,14 +262,6 @@ typedef struct {
|
|||||||
/* 0x0C */ EnvelopePoint* envelope;
|
/* 0x0C */ EnvelopePoint* envelope;
|
||||||
} Drum; // size = 0x10
|
} Drum; // size = 0x10
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
|
|
||||||
/* 0x01 */ u8 pan;
|
|
||||||
/* 0x02 */ u8 isRelocated; // have tunedSample.sample and envelope been relocated (offsets to pointers)
|
|
||||||
/* 0x04 */ TunedSample tunedSample;
|
|
||||||
/* 0x0C */ EnvelopePoint* envelope;
|
|
||||||
} Drum32Bit; // size = 0x10
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ TunedSample tunedSample;
|
/* 0x00 */ TunedSample tunedSample;
|
||||||
} SoundEffect; // size = 0x08
|
} SoundEffect; // size = 0x08
|
||||||
|
@ -1209,41 +1209,41 @@ static const char devstr50[] = "Error: Already wavetable is touched %x.\n";
|
|||||||
static const char devstr51[] = "Touch Warning: Length zero %x\n";
|
static const char devstr51[] = "Touch Warning: Length zero %x\n";
|
||||||
|
|
||||||
void AudioLoad_RelocateSample(TunedSample* tSample, u32 fontDataAddr, SampleBankRelocInfo* relocInfo) {
|
void AudioLoad_RelocateSample(TunedSample* tSample, u32 fontDataAddr, SampleBankRelocInfo* relocInfo) {
|
||||||
Sample32Bit* baseSample = fontDataAddr + BSWAP32(tSample->sample);
|
// Sample32Bit* baseSample = fontDataAddr + BSWAP32(tSample->sample);
|
||||||
|
//
|
||||||
// "Touch Warning: Length zero %x\n";
|
// // "Touch Warning: Length zero %x\n";
|
||||||
if ((baseSample->size != 0) && (baseSample->isRelocated != 1)) {
|
// if ((baseSample->size != 0) && (baseSample->isRelocated != 1)) {
|
||||||
Sample* output = memalloc(sizeof(Sample));
|
// Sample* output = memalloc(sizeof(Sample));
|
||||||
|
//
|
||||||
output->loop = Audio_LoadLoop(fontDataAddr + BSWAP32(baseSample->loop));
|
// output->loop = Audio_LoadLoop(fontDataAddr + BSWAP32(baseSample->loop));
|
||||||
output->book = Audio_LoadBook(fontDataAddr + BSWAP32(baseSample->book));
|
// output->book = Audio_LoadBook(fontDataAddr + BSWAP32(baseSample->book));
|
||||||
output->codec = baseSample->codec;
|
// output->codec = baseSample->codec;
|
||||||
output->medium = baseSample->medium;
|
// output->medium = baseSample->medium;
|
||||||
output->unk_bit26 = baseSample->unk_bit26;
|
// output->unk_bit26 = baseSample->unk_bit26;
|
||||||
output->isRelocated = baseSample->isRelocated;
|
// output->isRelocated = baseSample->isRelocated;
|
||||||
output->size = baseSample->size;
|
// output->size = baseSample->size;
|
||||||
|
//
|
||||||
output->isRelocated = 1;
|
// output->isRelocated = 1;
|
||||||
switch (baseSample->medium) {
|
// switch (baseSample->medium) {
|
||||||
case MEDIUM_RAM:
|
// case MEDIUM_RAM:
|
||||||
// baseSample->sampleAddr = Audio_LoadCopy(relocInfo->baseAddr1 + BSWAP32(baseSample->sampleAddr), BSWAP32(baseSample->size));
|
//// baseSample->sampleAddr = Audio_LoadCopy(relocInfo->baseAddr1 + BSWAP32(baseSample->sampleAddr), BSWAP32(baseSample->size));
|
||||||
baseSample->medium = relocInfo->medium1;
|
// baseSample->medium = relocInfo->medium1;
|
||||||
break;
|
// break;
|
||||||
case MEDIUM_UNK:
|
// case MEDIUM_UNK:
|
||||||
// baseSample->sampleAddr = Audio_LoadCopy(relocInfo->baseAddr2 + BSWAP32(baseSample->sampleAddr), BSWAP32(baseSample->size));
|
//// baseSample->sampleAddr = Audio_LoadCopy(relocInfo->baseAddr2 + BSWAP32(baseSample->sampleAddr), BSWAP32(baseSample->size));
|
||||||
baseSample->medium = relocInfo->medium2;
|
// baseSample->medium = relocInfo->medium2;
|
||||||
break;
|
// break;
|
||||||
case MEDIUM_CART:
|
// case MEDIUM_CART:
|
||||||
case MEDIUM_DISK_DRIVE:
|
// case MEDIUM_DISK_DRIVE:
|
||||||
output->sampleAddr = fontDataAddr + BSWAP32(baseSample->sampleAddr);
|
// output->sampleAddr = fontDataAddr + BSWAP32(baseSample->sampleAddr);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
baseSample->isRelocated = true;
|
// baseSample->isRelocated = true;
|
||||||
if (baseSample->unk_bit26 && (baseSample->medium != 0)) {
|
// if (baseSample->unk_bit26 && (baseSample->medium != 0)) {
|
||||||
gUsedSamples[gNumUsedSamples++] = output;
|
// gUsedSamples[gNumUsedSamples++] = output;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char devstr52[] = "It's busy now!!!!! %d\n";
|
static const char devstr52[] = "It's busy now!!!!! %d\n";
|
||||||
|
@ -126,16 +126,19 @@ Sample* Audio_LoadSample(uint32_t sampleAddr, AudioTableEntry entry, uint32_t sa
|
|||||||
|
|
||||||
Sample* sample = memalloc(Sample);
|
Sample* sample = memalloc(Sample);
|
||||||
uint32_t flags = reader.ReadUInt32();
|
uint32_t flags = reader.ReadUInt32();
|
||||||
|
uint32_t addr = reader.ReadUInt32();
|
||||||
|
|
||||||
sample->codec = (flags >> 28) & 0x0F;
|
sample->codec = (flags >> 28) & 0x0F;
|
||||||
sample->medium = MEDIUM_RAM; // (flags >> 24) & 0x03;
|
sample->medium = (flags >> 24) & 0x03;
|
||||||
sample->unk_bit26 = (flags >> 22) & 0x01;
|
sample->unk_bit26 = (flags >> 22) & 0x01;
|
||||||
sample->size = flags;
|
sample->size = flags;
|
||||||
uint32_t addr = reader.ReadUInt32();
|
|
||||||
sample->loop = Audio_LoadLoop(entry.romAddr + reader.ReadUInt32());
|
sample->loop = Audio_LoadLoop(entry.romAddr + reader.ReadUInt32());
|
||||||
sample->book = Audio_LoadBook(entry.romAddr + reader.ReadUInt32());
|
sample->book = Audio_LoadBook(entry.romAddr + reader.ReadUInt32());
|
||||||
sample->isRelocated = 1;
|
|
||||||
sample->sampleAddr = (uint8_t*) Audio_LoadBlob(gAudioTable, gSampleBankTable->entries[sampleBankID].romAddr + addr);
|
sample->sampleAddr = (uint8_t*) Audio_LoadBlob(gAudioTable, gSampleBankTable->entries[sampleBankID].romAddr + addr);
|
||||||
|
|
||||||
|
sample->isRelocated = 1;
|
||||||
|
sample->medium = MEDIUM_RAM;
|
||||||
|
|
||||||
std::filesystem::path path{ "dumps/" + std::to_string(addr) + ".raw" };
|
std::filesystem::path path{ "dumps/" + std::to_string(addr) + ".raw" };
|
||||||
std::ofstream ofs(path);
|
std::ofstream ofs(path);
|
||||||
ofs.write(reinterpret_cast<const char*>(sample->sampleAddr), sample->size);
|
ofs.write(reinterpret_cast<const char*>(sample->sampleAddr), sample->size);
|
||||||
|
Loading…
Reference in New Issue
Block a user