-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbnk_pc.h
103 lines (87 loc) · 3.48 KB
/
bnk_pc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* bnk_pc.h - common things shared across the extractor and packer.
*
* Copyright (c) 2011 Michael Lelli
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _BNK_PC_H
#define _BNK_PC_H
#define VERSION "1.4"
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
#define BNK_PC_HEADER 0x2020435042535756ULL
#define DMAV_HEADER 0x56414D44UL
#pragma pack(push,1)
// all values are little-endian
// k#: Value is predictable or can be computed, but use may not be known
// u#: Value use is unknown and cannot be predicted or computed
typedef struct
{
u64 magic; // "VWSBPC "
u32 k1; // usually 0x00000000
u32 k2; // usually 0x00010002
u32 id; // ID, referenced in audio_banks.xtbl
u32 k3; // pointer to the (count + 2)th entry?
// essentially sizeof(header) + ((count + 1) * 16)
u32 count; // number of entry items
} header;
typedef struct
{
u32 id; // technically unknown, but most likely an ID
u32 offset; // offset of data in the file, including 28-byte header.
// each file is padded with null bytes to the next offset
// that's a multiple of 0x800, including padding after the
// last file
u32 dmav; // size of DMAV before before file, 0 if no DMAV
u32 length; // size of file
} entry;
typedef struct
{
u32 magic; // "DMAV"
u32 version; // 1
u32 persona_id; // <Persona_id> in character's voice table, voc_sb_line_sit.xtbl, and voice_dynamic_dialog_events.xtbl, <wwise_id> in audio_personas.xtbl
u32 voiceline_id; // <Voiceline_id> in voice_control.xtbl, <wwise_id> in audio_line_tags.xtbl
u32 offset1; // offset to subtitle data (from end of dmav header), same as offset2
u32 u1; // usually 0
u32 sub_length; // length of subtitle data, including "2" value before start of subtitle headers
u32 offset2; // offset to subtitle data (from end of dmav header), same as offset1
u32 len; // length of soundclip in milliseconds
} dmav_header;
typedef struct
{
u32 size; // length of subtitle entry
u32 offset; // offset from end of subtitle entry metadatas
} dmav_subtitle_header;
#pragma pack(pop)
#define is_wav(a) ((a)[0] == 'R' && (a)[1] == 'I' && (a)[2] == 'F' && (a)[3] == 'F')
#endif