mirror of
https://github.com/izzy2lost/Torch.git
synced 2026-07-06 00:18:35 -07:00
Added full bank extraction
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
const fs = require('fs');
|
||||
const data = require('../assets.json');
|
||||
|
||||
const header = [
|
||||
'#pragma once',
|
||||
'#include "align_asset_macro.h"',
|
||||
'',
|
||||
]
|
||||
const banks = []
|
||||
|
||||
async function main(){
|
||||
const files = Object.keys(data).filter(f => f.endsWith(".bnk") && data[f]['us'] != undefined).map(m => {
|
||||
return {
|
||||
file: m,
|
||||
offset: data[m]['us'][0]
|
||||
}
|
||||
})
|
||||
|
||||
files.sort((a, b) => a.offset - b.offset);
|
||||
|
||||
for(const entry of files){
|
||||
const sampleId = entry.offset.toString(16).padStart(2, '0').toUpperCase();
|
||||
banks.push(`gBank${sampleId}`);
|
||||
header.push(`#define dgBank${sampleId} "__OTR__${entry.file.replace('.bnk', '')}"`);
|
||||
header.push(`static const ALIGN_ASSET(2) char gBank${sampleId}[] = dgBank${sampleId};\n`);
|
||||
}
|
||||
|
||||
header.push('static const char* gBankTable[] = {');
|
||||
for (const bank of banks) {
|
||||
header.push(` ${bank},`);
|
||||
}
|
||||
header.push('};\n');
|
||||
|
||||
fs.writeFileSync('./banks_table.h', header.join('\n'));
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,37 @@
|
||||
const fs = require('fs');
|
||||
const data = require('../assets.json');
|
||||
|
||||
const header = [
|
||||
'#pragma once',
|
||||
'#include "align_asset_macro.h"',
|
||||
'',
|
||||
]
|
||||
const samples = []
|
||||
|
||||
async function main(){
|
||||
const files = Object.keys(data).filter(f => f.endsWith(".aiff") && data[f][1]['us'] != undefined).map(m => {
|
||||
return {
|
||||
file: m,
|
||||
offset: data[m][1]['us'][1]
|
||||
}
|
||||
})
|
||||
|
||||
files.sort((a, b) => a.offset - b.offset);
|
||||
|
||||
for(const entry of files){
|
||||
const sampleId = entry.offset.toString(16).padStart(2, '0').toUpperCase();
|
||||
samples.push(`gSample${sampleId}`);
|
||||
header.push(`#define dgSample${sampleId} "__OTR__${entry.file.replace('.aiff', '')}"`);
|
||||
header.push(`static const ALIGN_ASSET(2) char gSample${sampleId}[] = dgSample${sampleId};\n`);
|
||||
}
|
||||
|
||||
header.push('static const char* gSampleTable[] = {');
|
||||
for (const sample of samples) {
|
||||
header.push(` ${sample},`);
|
||||
}
|
||||
header.push('};\n');
|
||||
|
||||
fs.writeFileSync('./samples_table.h', header.join('\n'));
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user