From 705e88cc78c18ee24ac596a5c5f9ed1c290469e3 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Wed, 20 Nov 2024 11:17:08 -0600 Subject: [PATCH] Fixed wrong bit size definition --- src/factories/naudio/v1/SampleFactory.h | 10 ++--- src/factories/naudio/v1/SoundFontFactory.cpp | 25 ------------- test/config.yml | 36 ++++++++++++++++++ test/mk64/audio/root.yml | 8 ++++ test/sf64/jp/ast_audio.yaml | 27 ++++++++++++++ test/sf64/us/ast_bank.yaml | 9 +++++ test/sf64/us/ast_tables.yaml | 39 ++++++++++++++++++++ test/sm64/jp/root.yml | 8 ++++ test/sm64/us/root.yml | 8 ++++ test/torch.hash.yml | 14 +++++++ 10 files changed, 154 insertions(+), 30 deletions(-) create mode 100644 test/config.yml create mode 100644 test/mk64/audio/root.yml create mode 100644 test/sf64/jp/ast_audio.yaml create mode 100644 test/sf64/us/ast_bank.yaml create mode 100644 test/sf64/us/ast_tables.yaml create mode 100644 test/sm64/jp/root.yml create mode 100644 test/sm64/us/root.yml create mode 100644 test/torch.hash.yml diff --git a/src/factories/naudio/v1/SampleFactory.h b/src/factories/naudio/v1/SampleFactory.h index 3507188..d4ed44f 100644 --- a/src/factories/naudio/v1/SampleFactory.h +++ b/src/factories/naudio/v1/SampleFactory.h @@ -5,11 +5,11 @@ class NSampleData : public IParsedData { public: - uint32_t codec; - uint32_t medium; - uint32_t unk; - uint32_t isRelocated; - uint32_t size; + uint32_t codec : 4; + uint32_t medium : 2; + uint32_t unk : 1; + uint32_t isRelocated : 1; + uint32_t size : 24; uint32_t sampleAddr; uint32_t loop; uint32_t book; diff --git a/src/factories/naudio/v1/SoundFontFactory.cpp b/src/factories/naudio/v1/SoundFontFactory.cpp index 654ce56..ca84065 100644 --- a/src/factories/naudio/v1/SoundFontFactory.cpp +++ b/src/factories/naudio/v1/SoundFontFactory.cpp @@ -18,31 +18,6 @@ ExportResult SoundFontHeaderExporter::Export(std::ostream &write, std::shared_pt } ExportResult SoundFontCodeExporter::Export(std::ostream &write, std::shared_ptr raw, std::string& entryName, YAML::Node &node, std::string* replacement ) { - // auto symbol = GetSafeNode(node, "symbol", entryName); - // auto offset = GetSafeNode(node, "offset"); - // auto data = std::static_pointer_cast(raw)->mBuffer; - - // if(Companion::Instance->IsOTRMode()){ - // write << "static const ALIGN_ASSET(2) char " << symbol << "[] = \"__OTR__" << (*replacement) << "\";\n\n"; - // return std::nullopt; - // } - - // write << GetSafeNode(node, "ctype", "u8") << " " << symbol << "[] = {\n" << tab_t; - - // for (int i = 0; i < data.size(); i++) { - // if ((i % 15 == 0) && i != 0) { - // write << "\n" << tab_t; - // } - - // write << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int) data[i] << ", "; - // } - // write << "\n};\n"; - - // if (Companion::Instance->IsDebug()) { - // write << "// size: 0x" << std::hex << std::uppercase << data.size() << "\n"; - // } - - // return offset + data.size(); return std::nullopt; } diff --git a/test/config.yml b/test/config.yml new file mode 100644 index 0000000..5a3326c --- /dev/null +++ b/test/config.yml @@ -0,0 +1,36 @@ +f7475fb11e7e6830f82883412638e8390791ab87: + name: Star Fox 64 (U) (V1.1) + path: sf64/us + logging: ERROR + config: + gbi: F3DEX + sort: OFFSET + output: + code: sf64/src + +d064229a32cc05ab85e2381ce07744eb3ffaf530: + name: Star Fox 64 (JP) (V1.0) + path: sf64/jp + config: + gbi: F3DEX + sort: OFFSET + output: + code: sf64/src + +8a20a5c83d6ceb0f0506cfc9fa20d8f438cafe51: + name: Super Mario 64 [JP] + path: sm64/jp + config: + gbi: F3D + sort: OFFSET + output: + code: sm64/src + +9bef1128717f958171a4afac3ed78ee2bb4e86ce: + name: Super Mario 64 [US] + path: sm64/us + config: + gbi: F3D + sort: OFFSET + output: + code: sm64/src \ No newline at end of file diff --git a/test/mk64/audio/root.yml b/test/mk64/audio/root.yml new file mode 100644 index 0000000..24b5aa5 --- /dev/null +++ b/test/mk64/audio/root.yml @@ -0,0 +1,8 @@ +header: + type: NAUDIO:V0:AUDIO_HEADER + ctl: + offset: 0x966260 + size: 0x13840 + tbl: + offset: 0x979AA0 + size: 0x24C4C0 \ No newline at end of file diff --git a/test/sf64/jp/ast_audio.yaml b/test/sf64/jp/ast_audio.yaml new file mode 100644 index 0000000..91467a2 --- /dev/null +++ b/test/sf64/jp/ast_audio.yaml @@ -0,0 +1,27 @@ +:config: + force: true + header: + code: + - '#include "sys.h"' + - '#include "sf64audio_provisional.h"' + +audio_sample_bank_table: + { type: NAUDIO:AUDIO_TABLE, format: SAMPLE, offset: 0xC1360, symbol: gSampleBankTableInit } + +audio_seq_table: + { type: NAUDIO:AUDIO_TABLE, format: SEQUENCE, offset: 0xC13B0, symbol: gSeqTableInit } + +audio_soundfont_table: + { type: NAUDIO:AUDIO_TABLE, format: SOUNDFONT, offset: 0xC17E0, symbol: gSoundFontTableInit } + +audio_seq_font_table: + { type: ARRAY, count: 566, array_type: u8, offset: 0xC1A00, symbol: gSeqFontTableInit } + +# audio_seq: +# { type: BLOB, offset: 0xDEA20, size: 0x3ACF0, symbol: gAudioSeq } + +# audio_bank: +# { type: BLOB, offset: 0x119710, size: 0x1E020, symbol: gAudioBank } + +# audio_table: +# { type: BLOB, offset: 0x137730, size: 0x73C580, symbol: gAudioTable } \ No newline at end of file diff --git a/test/sf64/us/ast_bank.yaml b/test/sf64/us/ast_bank.yaml new file mode 100644 index 0000000..8f5f598 --- /dev/null +++ b/test/sf64/us/ast_bank.yaml @@ -0,0 +1,9 @@ +:config: + force: true + external_files: + - "sf64/us/ast_tables.yaml" + +# sf_00000: +# type: NAUDIO:V1:SOUND_FONT +# offset: 0x0 +# symbol: sf_00000 \ No newline at end of file diff --git a/test/sf64/us/ast_tables.yaml b/test/sf64/us/ast_tables.yaml new file mode 100644 index 0000000..73bf855 --- /dev/null +++ b/test/sf64/us/ast_tables.yaml @@ -0,0 +1,39 @@ +:config: + force: true + header: + code: + - '#include "sys.h"' + - '#include "sf64audio_provisional.h"' + +audio_setup: + type: NAUDIO:V1:AUDIO_SETUP + audio_seq: + size: 0x3ACF0 + offset: 0xDEA20 + audio_bank: + size: 0x1E020 + offset: 0x119710 + audio_table: + size: 0x73C580 + offset: 0x137730 + +audio_sample_bank_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SAMPLE, offset: 0xC4210, symbol: gSampleBankTableInit } + +audio_seq_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SEQUENCE, offset: 0xC4260, symbol: gSeqTableInit } + +audio_soundfont_table: + { type: NAUDIO:V1:AUDIO_TABLE, format: SOUNDFONT, offset: 0xC4690, symbol: gSoundFontTableInit } + +audio_seq_font_table: + { type: ARRAY, count: 566, array_type: u8, offset: 0xC48B0, symbol: gSeqFontTableInit } + +# audio_seq: +# { type: BLOB, offset: 0xDEA20, size: 0x3ACF0, symbol: gAudioSeq } + +# audio_bank: +# { type: BLOB, offset: 0x119710, size: 0x1E020, symbol: gAudioBank } + +# audio_table: +# { type: BLOB, offset: 0x137730, size: 0x73C580, symbol: gAudioTable } \ No newline at end of file diff --git a/test/sm64/jp/root.yml b/test/sm64/jp/root.yml new file mode 100644 index 0000000..c38e308 --- /dev/null +++ b/test/sm64/jp/root.yml @@ -0,0 +1,8 @@ +header: + type: NAUDIO:V0:AUDIO_HEADER + ctl: + offset: 5738816 + size: 94400 + tbl: + offset: 5833216 + size: 1793408 \ No newline at end of file diff --git a/test/sm64/us/root.yml b/test/sm64/us/root.yml new file mode 100644 index 0000000..f57fb85 --- /dev/null +++ b/test/sm64/us/root.yml @@ -0,0 +1,8 @@ +header: + type: NAUDIO:V0:AUDIO_HEADER + ctl: + offset: 0x57B720 + size: 0x17E40 + tbl: + offset: 0x593560 + size: 0x21D300 \ No newline at end of file diff --git a/test/torch.hash.yml b/test/torch.hash.yml new file mode 100644 index 0000000..27062c7 --- /dev/null +++ b/test/torch.hash.yml @@ -0,0 +1,14 @@ +sf64/us/ast_tables.yaml: + hash: d9bdec9158d17171b170d4e57e9d474068bfc80e + extracted: + Header: true + Code: false + Binary: false + Modding: false +sf64/us/ast_bank.yaml: + hash: f71943d7829a89ed3065630b3d5c3ca60440c238 + extracted: + Header: false + Code: false + Binary: false + Modding: false \ No newline at end of file