mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-14 18:47:39 +01:00
Cleanup
This commit is contained in:
parent
f65c3284c7
commit
14f98fdb5a
@ -1,22 +1,22 @@
|
||||
#include "layout.h"
|
||||
|
||||
/* Dream Factory STHD blocks */
|
||||
void block_update_sthd(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
|
||||
size_t block_size, channel_size;
|
||||
off_t data_offset;
|
||||
int i;
|
||||
|
||||
block_size = 0x800;
|
||||
data_offset = read_16bitLE(block_offset + 0x04, streamFile);
|
||||
channel_size = read_16bitLE(block_offset + 0x16, streamFile);
|
||||
/* 0x06: num channels, 0x10: total blocks, 0x12: block count, 0x14(2): null, 0x18: block count + 1 */
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = channel_size;
|
||||
vgmstream->next_block_offset = block_offset + block_size;
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset + data_offset + channel_size*i;
|
||||
}
|
||||
}
|
||||
#include "layout.h"
|
||||
|
||||
/* Dream Factory STHD blocks */
|
||||
void block_update_sthd(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
||||
size_t block_size, channel_size;
|
||||
off_t data_offset;
|
||||
int i;
|
||||
|
||||
block_size = 0x800;
|
||||
data_offset = read_16bitLE(block_offset + 0x04, sf);
|
||||
channel_size = read_16bitLE(block_offset + 0x16, sf);
|
||||
/* 0x06: num channels, 0x10: total blocks, 0x12: block count, 0x14(2): null, 0x18: block count + 1 */
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_size = channel_size;
|
||||
vgmstream->next_block_offset = block_offset + block_size;
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset + data_offset + channel_size*i;
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
|
||||
/* VGS multistream frames */
|
||||
void block_update_vgs(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
STREAMFILE* streamFile = vgmstream->ch[0].streamfile;
|
||||
size_t file_size = get_streamfile_size(vgmstream->ch[0].streamfile);
|
||||
int i;
|
||||
size_t channel_size = 0x10;
|
||||
|
||||
|
||||
/* set offsets */
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset + channel_size*i;
|
||||
}
|
||||
|
||||
vgmstream->current_block_size = channel_size;
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + channel_size*vgmstream->channels;
|
||||
|
||||
/* skip unhandled tracks: flag can be 0x0n per track, of 0x8x for last frame */
|
||||
while (vgmstream->next_block_offset < file_size) {
|
||||
if ((read_8bit(vgmstream->next_block_offset + 0x01, streamFile) & 0x0F) == 0x00)
|
||||
break;
|
||||
|
||||
vgmstream->next_block_offset += channel_size;
|
||||
}
|
||||
|
||||
}
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../layout/layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
|
||||
/* VGS multistream frames */
|
||||
void block_update_vgs(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||
STREAMFILE* sf = vgmstream->ch[0].streamfile;
|
||||
size_t file_size = get_streamfile_size(vgmstream->ch[0].streamfile);
|
||||
int i;
|
||||
size_t channel_size = 0x10;
|
||||
|
||||
|
||||
/* set offsets */
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset + channel_size*i;
|
||||
}
|
||||
|
||||
vgmstream->current_block_size = channel_size;
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + channel_size*vgmstream->channels;
|
||||
|
||||
/* skip unhandled tracks: flag can be 0x0n per track, of 0x8x for last frame */
|
||||
while (vgmstream->next_block_offset < file_size) {
|
||||
if ((read_8bit(vgmstream->next_block_offset + 0x01, sf) & 0x0F) == 0x00)
|
||||
break;
|
||||
|
||||
vgmstream->next_block_offset += channel_size;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* parse a XA AIFF block (CD sector without the 0x18 subheader) */
|
||||
void block_update_xa_aiff(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
size_t block_samples;
|
||||
|
||||
block_samples = (28*8 / vgmstream->channels) * 18; /* size 0x900, 18 frames of size 0x80 with 8 subframes of 28 samples */
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_samples = block_samples;
|
||||
vgmstream->next_block_offset = block_offset + 0x914;
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset;
|
||||
}
|
||||
}
|
||||
#include "layout.h"
|
||||
#include "../coding/coding.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* parse a XA AIFF block (CD sector without the 0x18 subheader) */
|
||||
void block_update_xa_aiff(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||
int i;
|
||||
size_t block_samples;
|
||||
|
||||
block_samples = (28*8 / vgmstream->channels) * 18; /* size 0x900, 18 frames of size 0x80 with 8 subframes of 28 samples */
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->current_block_samples = block_samples;
|
||||
vgmstream->next_block_offset = block_offset + 0x914;
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset;
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* pseudo-blocks that must skip last 0x20 every 0x8000 */
|
||||
void block_update_xwav(off_t block_offset, VGMSTREAM * vgmstream) {
|
||||
int i;
|
||||
size_t block_size;
|
||||
|
||||
/* no header */
|
||||
block_size = vgmstream->channels * 0x10;
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + block_size;
|
||||
vgmstream->current_block_size = block_size / vgmstream->channels;
|
||||
|
||||
if ((vgmstream->next_block_offset - 0x800) > 0
|
||||
&& ((vgmstream->next_block_offset - 0x800 + 0x20) % 0x8000) == 0) {
|
||||
vgmstream->next_block_offset += 0x20;
|
||||
}
|
||||
|
||||
|
||||
for (i=0;i<vgmstream->channels;i++) {
|
||||
vgmstream->ch[i].offset = block_offset + 0x10*i;
|
||||
}
|
||||
}
|
||||
#include "layout.h"
|
||||
#include "../vgmstream.h"
|
||||
|
||||
/* pseudo-blocks that must skip last 0x20 every 0x8000 */
|
||||
void block_update_xwav(off_t block_offset, VGMSTREAM* vgmstream) {
|
||||
int i;
|
||||
size_t block_size;
|
||||
|
||||
/* no header */
|
||||
block_size = vgmstream->channels * 0x10;
|
||||
|
||||
vgmstream->current_block_offset = block_offset;
|
||||
vgmstream->next_block_offset = block_offset + block_size;
|
||||
vgmstream->current_block_size = block_size / vgmstream->channels;
|
||||
|
||||
if ((vgmstream->next_block_offset - 0x800) > 0
|
||||
&& ((vgmstream->next_block_offset - 0x800 + 0x20) % 0x8000) == 0) {
|
||||
vgmstream->next_block_offset += 0x20;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < vgmstream->channels; i++) {
|
||||
vgmstream->ch[i].offset = block_offset + 0x10*i;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user