Skip to content

Commit

Permalink
Merge pull request #1543 from bnnm/ktsr-cleanup
Browse files Browse the repository at this point in the history
- Add .ktsl2asbin with KTAC [Blue Reflection 2 (PS4)]
- cleanup
  • Loading branch information
bnnm committed Jun 10, 2024
2 parents fa68185 + 9b90a7a commit cc73ebd
Show file tree
Hide file tree
Showing 58 changed files with 598 additions and 607 deletions.
20 changes: 14 additions & 6 deletions doc/FORMATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ different internally (encrypted, different versions, etc) and not always can be
- TOSE .IDSP header [*IDSP_TOSE*]
- Kuju London .KWA header [*DSP_KWA*]
- Koei Tecmo APEX header [*DSP_APEX*]
- *ngc_dsp_std*: `.dsp .adp .(extensionless)`
- Rebellion DSP header [*DSP_ASURA*]
- *ngc_dsp_std*: `.dsp .adp .(extensionless) .wav .lwav .dat .ldat`
- *ngc_dsp_std_le*: `.adpcm`
- *ngc_mdsp_std*: `.dsp .mdsp`
- *ngc_dsp_stm*: `.stm .lstm .dsp`
Expand All @@ -113,7 +114,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *idsp_tt*: `.gcm .idsp .wua`
- *idsp_nl*: `.idsp`
- *wii_wsd*: `.wsd`
- *dsp_ddsp*: `.adp .ddsp .wav .lwav`
- *dsp_ddsp*: `.adp .ddsp .wav .lwav .(extensionless)`
- *wii_was*: `.was .dsp .isws`
- *dsp_str_ig*: `.str`
- *dsp_xiii*: `.dsp`
Expand All @@ -128,7 +129,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *dsp_itl_ch*: `.itl`
- *dsp_adpy*: `.adpcmx`
- *dsp_adpx*: `.adpcmx`
- *dsp_ds2*: `.ds2 .dsp`
- *dsp_lucasarts_ds2*: `.ds2 .dsp`
- *dsp_itl*: `.itl .dsp`
- *dsp_sqex*: `.wav .lwav`
- *dsp_wiivoice*: `.dsp`
Expand All @@ -137,6 +138,9 @@ different internally (encrypted, different versions, etc) and not always can be
- *idsp_tose*: `.idsp`
- *dsp_kwa*: `.kwa`
- *dsp_apex*: `.dsp`
- *dsp_asura*: `.dsp .wav .lwav`
- *dsp_asura_ds2*: `.ds2`
- *dsp_asura_ttss*: `.adpcm .wav .lwav`
- Codecs: NGC_DSP NGC_DSP_subint
- **csmp.c**
- Retro Studios CSMP header [*CSMP*]
Expand Down Expand Up @@ -186,7 +190,7 @@ different internally (encrypted, different versions, etc) and not always can be
- Sony VAG header [*VAG*]
- Acclaim Austin AAAp header [*AAAP*]
- Sony VAG footer [*VAG_footer*]
- *vag*: `.vag .swag .str .vig .l .r .vas .xa2 .snd .svg .(extensionless)`
- *vag*: `.vag .swag .str .vig .l .r .vas .xa2 .snd .svg .(extensionless) .wav .lwav`
- *vag_aaap*: `.vag`
- *vag_footer*: `.(extensionless) .vag`
- Codecs: PSX HEVAG
Expand Down Expand Up @@ -1616,7 +1620,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *ktsr*: `.ktsl2asbin .asbin`
- *asrs*: `.srsa`
- *ktsr_internal*
- Subfiles: *riff ogg_vorbis ktss*
- Subfiles: *riff ogg_vorbis ktss ktac*
- Codecs: MSADPCM_int NGC_DSP ATRAC9
- **mups.c**
- (container)
Expand Down Expand Up @@ -1787,7 +1791,7 @@ different internally (encrypted, different versions, etc) and not always can be
- *ego_dic*: `.dic + .(external)`
- Codecs: PCM16LE ULAW XBOX_IMA OGG_VORBIS
- **awd.c**
- RenderWare Audio Wave Dictionary header [*AWD*]
- RenderWare AWD header [*AWD*]
- *awd*: `.awd .hwd .lwd`
- Codecs: PSX PCM16LE NGC_DSP XBOX_IMA
- **rws_809.c**
Expand Down Expand Up @@ -1825,6 +1829,10 @@ different internally (encrypted, different versions, etc) and not always can be
- **ea_sbk.c**
- Electronic Arts SBK header [*EA_SBK*]
- *ea_sbk*: `.sbk`
- **ngc_dsp_asura.c**
- Rebellion DSP header [*DSP_ASURA*]
- *dsp_asura_sfx*: `.sfx`
- Codecs: NGC_DSP
- **agsc.c**
- Retro Studios AGSC header [*AGSC*]
- *agsc*: `.agsc`
Expand Down
14 changes: 7 additions & 7 deletions src/base/decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ int decode_get_samples_per_frame(VGMSTREAM* vgmstream) {
return 2;
case coding_XBOX_IMA:
case coding_XBOX_IMA_mch:
case coding_XBOX_IMA_int:
case coding_XBOX_IMA_mono:
case coding_FSB_IMA:
case coding_WWISE_IMA:
case coding_CD_IMA: /* (0x24 - 0x04) * 2 */
Expand Down Expand Up @@ -467,7 +467,7 @@ int decode_get_samples_per_frame(VGMSTREAM* vgmstream) {

case coding_MSADPCM:
return (vgmstream->frame_size - 0x07*vgmstream->channels)*2 / vgmstream->channels + 2;
case coding_MSADPCM_int:
case coding_MSADPCM_mono:
case coding_MSADPCM_ck:
return (vgmstream->frame_size - 0x07)*2 + 2;
case coding_WS: /* only works if output sample size is 8 bit, which always is for WS ADPCM */
Expand Down Expand Up @@ -653,7 +653,7 @@ int decode_get_frame_size(VGMSTREAM* vgmstream) {
case coding_XBOX_IMA:
//todo should be 0x48 when stereo, but blocked/interleave layout don't understand stereo codecs
return 0x24; //vgmstream->channels==1 ? 0x24 : 0x48;
case coding_XBOX_IMA_int:
case coding_XBOX_IMA_mono:
case coding_WWISE_IMA:
case coding_CD_IMA:
return 0x24;
Expand Down Expand Up @@ -693,7 +693,7 @@ int decode_get_frame_size(VGMSTREAM* vgmstream) {
return 0x4c*vgmstream->channels;

case coding_MSADPCM:
case coding_MSADPCM_int:
case coding_MSADPCM_mono:
case coding_MSADPCM_ck:
return vgmstream->frame_size;
case coding_WS:
Expand Down Expand Up @@ -934,7 +934,7 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
}
break;
case coding_XBOX_IMA:
case coding_XBOX_IMA_int: {
case coding_XBOX_IMA_mono: {
int is_stereo = (vgmstream->channels > 1 && vgmstream->coding_type == coding_XBOX_IMA);
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_xbox_ima(&vgmstream->ch[ch], buffer+ch,
Expand Down Expand Up @@ -1334,8 +1334,8 @@ void decode_vgmstream(VGMSTREAM* vgmstream, int samples_written, int samples_to_
decode_nwa(vgmstream->codec_data, buffer, samples_to_do);
break;
case coding_MSADPCM:
case coding_MSADPCM_int:
if (vgmstream->channels == 1 || vgmstream->coding_type == coding_MSADPCM_int) {
case coding_MSADPCM_mono:
if (vgmstream->channels == 1 || vgmstream->coding_type == coding_MSADPCM_mono) {
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_msadpcm_mono(vgmstream,buffer+ch,
vgmstream->channels,vgmstream->samples_into_block, samples_to_do, ch,
Expand Down
6 changes: 4 additions & 2 deletions src/base/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ void describe_vgmstream(VGMSTREAM* vgmstream, char* desc, int length) {
int32_t frame_size = vgmstream->frame_size > 0 ? vgmstream->frame_size : vgmstream->interleave_block_size;
switch (vgmstream->coding_type) {
case coding_MSADPCM:
case coding_MSADPCM_int:
case coding_MSADPCM_mono:
case coding_MSADPCM_ck:
case coding_MS_IMA:
case coding_MS_IMA_mono:
case coding_MC3:
case coding_WWISE_IMA:
case coding_REF_IMA:
Expand Down Expand Up @@ -232,9 +233,10 @@ void describe_vgmstream_info(VGMSTREAM* vgmstream, vgmstream_info* info) {
int32_t frame_size = vgmstream->frame_size > 0 ? vgmstream->frame_size : vgmstream->interleave_block_size;
switch (vgmstream->coding_type) {
case coding_MSADPCM:
case coding_MSADPCM_int:
case coding_MSADPCM_mono:
case coding_MSADPCM_ck:
case coding_MS_IMA:
case coding_MS_IMA_mono:
case coding_MC3:
case coding_WWISE_IMA:
case coding_REF_IMA:
Expand Down
2 changes: 1 addition & 1 deletion src/coding/acm_decoder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "coding.h"
#include "acm_decoder_libacm.h"
#include "libs/libacm.h"
#include <stdio.h>

/* libacm 1.2 (despite what libacm.h says) from: https://github.com/markokr/libacm */
Expand Down
2 changes: 1 addition & 1 deletion src/coding/circus_decoder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "coding.h"
#include "circus_decoder_lib.h"
#include "libs/circus_vq_lib.h"



Expand Down
2 changes: 1 addition & 1 deletion src/coding/coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "../util/reader_sf.h"
#include "../util/reader_get_nibbles.h"
//todo remove
#include "hca_decoder_clhca.h"
#include "libs/clhca.h"

/* adx_decoder */
void decode_adx(VGMSTREAMCHANNEL* stream, sample_t* outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int32_t frame_bytes, coding_t coding_type, uint32_t codec_config);
Expand Down
2 changes: 1 addition & 1 deletion src/coding/compresswave_decoder.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "coding.h"
#include "coding_utils_samples.h"
#include "compresswave_decoder_lib.h"
#include "libs/compresswave_lib.h"


#define COMPRESSWAVE_MAX_FRAME_SAMPLES 0x1000 /* arbitrary but should be multiple of 2 for 22050 mode */
Expand Down
2 changes: 1 addition & 1 deletion src/coding/g7221_decoder.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "coding.h"

#ifdef VGM_USE_G7221
#include "g7221_decoder_lib.h"
#include "libs/g7221_lib.h"

#define G7221_MAX_FRAME_SIZE 0x78 /* 960/8 */
#define G7221_MAX_FRAME_SAMPLES 640 /* 32000/50 */
Expand Down
2 changes: 1 addition & 1 deletion src/coding/hca_decoder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "coding.h"
#include "hca_decoder_clhca.h"
#include "libs/clhca.h"


struct hca_codec_data {
Expand Down
2 changes: 1 addition & 1 deletion src/coding/ice_decoder.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "coding.h"
#include "ice_decoder_icelib.h"
#include "libs/icelib.h"


typedef struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _CIRCUS_DECODER_LIB_DATA_H_
#define _CIRCUS_DECODER_LIB_DATA_H_
#ifndef _CIRCUS_VQ_DATA_H_
#define _CIRCUS_VQ_DATA_H_

#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* https://bitbucket.org/losnoco/foo_adpcm/src/master/foo_oki/source/libpcm/libpcm.cpp
*/

#include "circus_decoder_lib.h"
#include "circus_decoder_lib_data.h"
#include "circus_vq_lib.h"
#include "circus_vq_data.h"

#include "circus_decoder_lzxpcm.h"
#include "circus_vq_lzxpcm.h"

/* use miniz (API-compatible) to avoid adding external zlib just for this codec
* - https://github.com/richgel999/miniz */
#include "../util/miniz.h"
#include "../../util/miniz.h"
//#include "zlib.h"


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _CIRCUS_DECODER_LIB_H_
#define _CIRCUS_DECODER_LIB_H_
#ifndef _CIRCUS_VQ_LIB_H_
#define _CIRCUS_VQ_LIB_H_

#include "../streamfile.h"
#include "../../streamfile.h"

typedef struct circus_handle_t circus_handle_t;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef _CIRCUS_VQ_LZXPCM_H_
#define _CIRCUS_VQ_LZXPCM_H_

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
Expand Down Expand Up @@ -295,3 +298,5 @@ static int lzxpcm_decompress_full(uint8_t* dst, size_t dst_size, const uint8_t*
return 0;
}
#endif

#endif
2 changes: 1 addition & 1 deletion src/coding/hca_decoder_clhca.c → src/coding/libs/clhca.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//--------------------------------------------------
// Includes
//--------------------------------------------------
#include "hca_decoder_clhca.h"
#include "clhca.h"
#include <stddef.h>
#include <stdlib.h>
#include <memory.h>
Expand Down
12 changes: 2 additions & 10 deletions src/coding/hca_decoder_clhca.h → src/coding/libs/clhca.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#ifndef _clHCA_H
#define _clHCA_H

#ifdef __cplusplus
extern "C" {
#endif
#ifndef _CLHCA_H_
#define _CLHCA_H_


/* Must pass at least 8 bytes of data to this function.
Expand Down Expand Up @@ -86,8 +82,4 @@ int clHCA_TestBlock(clHCA *hca, void *data, unsigned int size);
* Without it there are minor differences, mainly useful when testing a new key. */
void clHCA_DecodeReset(clHCA * hca);

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "compresswave_decoder_lib.h"
#include "compresswave_lib.h"
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _COMPRESSWAVE_DECODER_LIB_H
#define _COMPRESSWAVE_DECODER_LIB_H
#include "../streamfile.h"
#ifndef _COMPRESSWAVE_LIB_H
#define _COMPRESSWAVE_LIB_H
#include "../../streamfile.h"

typedef struct TCompressWaveData TCompressWaveData;

Expand All @@ -24,4 +24,4 @@ float TCompressWaveData_GetFade(TCompressWaveData* this);
float TCompressWaveData_GetPlayTime(TCompressWaveData* this);
float TCompressWaveData_GetTotalTime(TCompressWaveData* this);

#endif /*_COMPRESSWAVE_DECODER_LIB_H */
#endif /*_COMPRESSWAVE_LIB_H */
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdlib.h>
#include "g7221_decoder_aes.h"
#include "g7221_aes.h"

/* Namco's NUS AES is just standard AES-192 in ECB mode, so this can be swapped with another lib,
* if more code needs AES. Most implementations out there either use pre-calculated look-up tables,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _DATA_H_
#define _DATA_H_
#ifndef _G7221_DATA_H_
#define _G7221_DATA_H_

#include <stdint.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <stdlib.h>
#include <string.h>

#include "g7221_decoder_lib.h"
#include "g7221_decoder_aes.h"

#include "g7221_lib.h"
#include "g7221_aes.h"
#include "g7221_data.h"

/* Decodes Siren14 from Namco's BNSF, a mono MLT/DCT-based codec for speech/sound (low bandwidth).
* Reverse engineered for various exes with info from Polycom's reference int decoder.
Expand Down Expand Up @@ -46,8 +46,6 @@
* access indexes with (idx & max) and clamp buffer reads
*/

#include "g7221_decoder_lib_data.h"

/*****************************************************************************
* IMLT
*****************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
Interface to Namco G.722.1 decoder
*/
#ifndef _G7221_DECODER_LIB_H
#define _G7221_DECODER_LIB_H
#ifndef _G7221_LIB_H
#define _G7221_LIB_H

#include <stdint.h>

Expand Down
4 changes: 2 additions & 2 deletions src/coding/ice_decoder_icelib.c → src/coding/libs/icelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include <string.h>
#include <stdlib.h>

#include "ice_decoder_icelib.h"
#include "icelib.h"

/* use miniz (API-compatible) to avoid adding external zlib just for this codec
* - https://github.com/richgel999/miniz */
#include "../util/miniz.h"
#include "../../util/miniz.h"
//#include "zlib.h"

#define ICESND_MAX_CHANNELS 2
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>

#include "acm_decoder_libacm.h" //"libacm.h"//vgmstream mod
#include "libacm.h"

#define ACM_BUFLEN (64*1024)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdio.h>
#include <string.h>

#include "acm_decoder_libacm.h" //"libacm.h"//vgmstream mod
#include "libacm.h"

#define WAVC_HEADER_LEN 28
#define ACM_HEADER_LEN 14
Expand Down
Loading

0 comments on commit cc73ebd

Please sign in to comment.