Merge pull request #544 from PredatorCZ/master

Added FWSE format.
This commit is contained in:
bnnm 2020-01-11 22:50:08 +01:00 committed by GitHub
commit 3b47ced16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 180 additions and 55 deletions

View File

@ -10,7 +10,11 @@ if(MINGW)
message(FATAL_ERROR "Cannot currently build with MinGW")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(VGM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
set(VGM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
set(VGM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(VGM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH})
include(vgmstream)
# Options
@ -56,12 +60,12 @@ if(WIN32)
# Update the version
set(CMAKE_EXECUTABLE_SUFFIX .exe)
if(MSVC)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/version.h" VERSION_H_PATH)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/version.h
COMMAND "${CMAKE_SOURCE_DIR}/version.bat"
file(TO_NATIVE_PATH "${VGM_BINARY_DIR}/version.h" VERSION_H_PATH)
add_custom_command(OUTPUT ${VGM_BINARY_DIR}/version.h
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/version.bat"
ARGS ${VERSION_H_PATH} VERSION
DEPENDS ${CMAKE_SOURCE_DIR}/version.bat)
add_custom_target(version_h DEPENDS ${CMAKE_BINARY_DIR}/version.h)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.bat)
add_custom_target(version_h DEPENDS ${VGM_BINARY_DIR}/version.h)
else()
find_package(Git)
if(GIT_FOUND)
@ -171,7 +175,7 @@ if(USE_FDKAAC)
endif()
if(USE_MAIATRAC3PLUS)
if(MAIATRAC3PLUS_PATH)
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${CMAKE_BINARY_DIR}/maitrac3plus)
add_subdirectory(${MAIATRAC3PLUS_PATH}/MaiAT3PlusDecoder ${CMAKE_CURRENT_BINARY_DIR}/maitrac3plus)
else()
message(FATAL_ERROR "Path to MAIATRAC3+ must be set. (Use MAIATRAC3PLUS_PATH)")
endif()

View File

@ -17,8 +17,8 @@ if(WIN32)
# Make sure that the binary directory is included (for version.h), as well as the getopt library include directory
target_include_directories(vgmstream_cli PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/ext_libs/Getopt)
${VGM_BINARY_DIR}
${VGM_SOURCE_DIR}/ext_libs/Getopt)
# Include the version string
if(MSVC)
@ -44,7 +44,7 @@ endif()
# Install the CLI program
install(TARGETS vgmstream_cli
RUNTIME DESTINATION bin)
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
# TODO: Make it so vgmstream123 can build with Windows (this probably needs a libao.dll included with vgmstream, though)
@ -70,5 +70,5 @@ if(NOT WIN32)
# Install vgmstream123
install(TARGETS vgmstream123
RUNTIME DESTINATION bin)
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()

View File

@ -1,6 +1,6 @@
# qaac doesn't have a Visual Studio project for Windows, so this not only allows things to build for Visual Studio, but also covers other compilers and platforms
configure_file(${QAAC_PATH}/mp4v2/libplatform/config.h.in ${CMAKE_BINARY_DIR}/mp4v2/include/libplatform/config.h COPYONLY)
configure_file(${QAAC_PATH}/mp4v2/libplatform/config.h.in ${VGM_BINARY_DIR}/mp4v2/include/libplatform/config.h COPYONLY)
file(GLOB INCLUDE_HEADERS "${QAAC_PATH}/mp4v2/include/mp4v2/*.h")
file(GLOB LIBPLATFORM_HEADERS "${QAAC_PATH}/mp4v2/libplatform/*.h")
@ -103,7 +103,7 @@ target_compile_definitions(mp4v2 PRIVATE
target_include_directories(mp4v2 PRIVATE
${QAAC_PATH}/mp4v2
${QAAC_PATH}/mp4v2/include
${CMAKE_BINARY_DIR}/mp4v2/include)
${VGM_BINARY_DIR}/mp4v2/include)
# Make sure that whatever compiler we use can handle these features
target_compile_features(mp4v2 PRIVATE

View File

@ -14,7 +14,8 @@ macro(setup_target TARGET)
_WIN32_WINNT=0x501
_CRT_SECURE_NO_WARNINGS)
endif()
target_include_directories(${TARGET} PRIVATE ${CMAKE_SOURCE_DIR}/ext_includes)
target_include_directories(${TARGET} PRIVATE ${VGM_SOURCE_DIR}/src)
target_include_directories(${TARGET} PRIVATE ${VGM_SOURCE_DIR}/ext_includes)
# Set up position-independent code for all targets
set_target_properties(${TARGET} PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
@ -29,7 +30,7 @@ macro(setup_target TARGET)
VGM_USE_FDKAAC)
target_include_directories(${TARGET} PRIVATE
${QAAC_PATH}/mp4v2/include
${CMAKE_BINARY_DIR}/mp4v2/include
${VGM_BINARY_DIR}/mp4v2/include
${FDK_AAC_PATH}/libSYS/include
${FDK_AAC_PATH}/libAACdec/include)
if(LINK)
@ -44,7 +45,7 @@ macro(setup_target TARGET)
if(WIN32)
if(LINK)
add_dependencies(${TARGET} libmpg123)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libmpg123-0.lib)
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libmpg123-0.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${MPG123_INCLUDE_DIR})
@ -59,7 +60,7 @@ macro(setup_target TARGET)
if(WIN32)
if(LINK)
add_dependencies(${TARGET} libvorbis)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libvorbis.lib)
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libvorbis.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${VORBISFILE_INCLUDE_DIRS})
@ -75,9 +76,9 @@ macro(setup_target TARGET)
if(LINK)
add_dependencies(${TARGET} ffmpeg)
target_link_libraries(${TARGET}
${CMAKE_BINARY_DIR}/ext_libs/avcodec.lib
${CMAKE_BINARY_DIR}/ext_libs/avformat.lib
${CMAKE_BINARY_DIR}/ext_libs/avutil.lib)
${VGM_BINARY_DIR}/ext_libs/avcodec.lib
${VGM_BINARY_DIR}/ext_libs/avformat.lib
${VGM_BINARY_DIR}/ext_libs/avutil.lib)
endif()
else()
target_include_directories(${TARGET} PRIVATE ${FFMPEG_INCLUDE_DIRS})
@ -91,7 +92,7 @@ macro(setup_target TARGET)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_G7221)
if(LINK)
add_dependencies(${TARGET} libg7221_decode)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libg7221_decode.lib)
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libg7221_decode.lib)
endif()
endif()
@ -99,7 +100,7 @@ macro(setup_target TARGET)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_G719)
if(LINK)
add_dependencies(${TARGET} libg719_decode)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libg719_decode.lib)
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libg719_decode.lib)
endif()
endif()
@ -115,7 +116,7 @@ macro(setup_target TARGET)
target_compile_definitions(${TARGET} PRIVATE VGM_USE_ATRAC9)
if(LINK)
add_dependencies(${TARGET} libatrac9)
target_link_libraries(${TARGET} ${CMAKE_BINARY_DIR}/ext_libs/libatrac9.lib)
target_link_libraries(${TARGET} ${VGM_BINARY_DIR}/ext_libs/libatrac9.lib)
endif()
endif()
@ -124,8 +125,8 @@ macro(setup_target TARGET)
if(LINK)
add_dependencies(${TARGET} libcelt)
target_link_libraries(${TARGET}
${CMAKE_BINARY_DIR}/ext_libs/libcelt-0061.lib
${CMAKE_BINARY_DIR}/ext_libs/libcelt-0110.lib)
${VGM_BINARY_DIR}/ext_libs/libcelt-0061.lib
${VGM_BINARY_DIR}/ext_libs/libcelt-0110.lib)
endif()
endif()
endmacro()
@ -133,19 +134,19 @@ endmacro()
# Installs the DLLs to the given install prefix
macro(install_dlls INSTALL_PREFIX)
# Paths to the DLLs
set(MPEG_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libmpg123-0.dll)
set(VORBIS_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libvorbis.dll)
set(G7221_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg7221_decode.dll)
set(G719_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libg719_decode.dll)
set(MPEG_DLL ${VGM_SOURCE_DIR}/ext_libs/libmpg123-0.dll)
set(VORBIS_DLL ${VGM_SOURCE_DIR}/ext_libs/libvorbis.dll)
set(G7221_DLL ${VGM_SOURCE_DIR}/ext_libs/libg7221_decode.dll)
set(G719_DLL ${VGM_SOURCE_DIR}/ext_libs/libg719_decode.dll)
set(FFMPEG_DLL
${CMAKE_SOURCE_DIR}/ext_libs/avcodec-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avformat-vgmstream-58.dll
${CMAKE_SOURCE_DIR}/ext_libs/avutil-vgmstream-56.dll
${CMAKE_SOURCE_DIR}/ext_libs/swresample-vgmstream-3.dll)
set(ATRAC9_DLL ${CMAKE_SOURCE_DIR}/ext_libs/libatrac9.dll)
${VGM_SOURCE_DIR}/ext_libs/avcodec-vgmstream-58.dll
${VGM_SOURCE_DIR}/ext_libs/avformat-vgmstream-58.dll
${VGM_SOURCE_DIR}/ext_libs/avutil-vgmstream-56.dll
${VGM_SOURCE_DIR}/ext_libs/swresample-vgmstream-3.dll)
set(ATRAC9_DLL ${VGM_SOURCE_DIR}/ext_libs/libatrac9.dll)
set(CELT_DLL
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0061.dll
${CMAKE_SOURCE_DIR}/ext_libs/libcelt-0110.dll)
${VGM_SOURCE_DIR}/ext_libs/libcelt-0061.dll
${VGM_SOURCE_DIR}/ext_libs/libcelt-0110.dll)
# List of DLLs to check for install
set(DLLS

View File

@ -7,8 +7,8 @@ if(MSVC)
add_custom_target(libmpg123
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libmpg123-0.lib
SOURCES
${CMAKE_SOURCE_DIR}/ext_includes/fmt123.h
${CMAKE_SOURCE_DIR}/ext_includes/mpg123.h)
${VGM_SOURCE_DIR}/ext_includes/fmt123.h
${VGM_SOURCE_DIR}/ext_includes/mpg123.h)
endif()
if(USE_VORBIS)
@ -16,8 +16,8 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libvorbis.def)
file(GLOB OGG_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/ogg/*.h")
file(GLOB VORBIS_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/vorbis/*h")
file(GLOB OGG_HEADERS "${VGM_SOURCE_DIR}/ext_includes/ogg/*.h")
file(GLOB VORBIS_HEADERS "${VGM_SOURCE_DIR}/ext_includes/vorbis/*h")
add_custom_target(libvorbis
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libvorbis.lib
SOURCES
@ -34,7 +34,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg7221_decode.def)
add_custom_target(libg7221_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg7221_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g7221.h)
SOURCES ${VGM_SOURCE_DIR}/ext_includes/g7221.h)
endif()
if(USE_G719)
@ -44,7 +44,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libg719_decode.def)
add_custom_target(libg719_decode
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libg719_decode.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/g719.h)
SOURCES ${VGM_SOURCE_DIR}/ext_includes/g719.h)
endif()
if(USE_FFMPEG)
@ -64,10 +64,10 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/swresample.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/swresample-vgmstream-3.def)
file(GLOB AVCODEC_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavcodec/*.h")
file(GLOB AVFORMAT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavformat/*.h")
file(GLOB AVUTIL_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libavutil/*.h")
file(GLOB SWRESAMPLE_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/libswresample/*.h")
file(GLOB AVCODEC_HEADERS "${VGM_SOURCE_DIR}/ext_includes/libavcodec/*.h")
file(GLOB AVFORMAT_HEADERS "${VGM_SOURCE_DIR}/ext_includes/libavformat/*.h")
file(GLOB AVUTIL_HEADERS "${VGM_SOURCE_DIR}/ext_includes/libavutil/*.h")
file(GLOB SWRESAMPLE_HEADERS "${VGM_SOURCE_DIR}/ext_includes/libswresample/*.h")
add_custom_target(ffmpeg
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/avcodec.lib
@ -92,7 +92,7 @@ if(MSVC)
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libatrac9.def)
add_custom_target(libatrac9
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libatrac9.lib
SOURCES ${CMAKE_SOURCE_DIR}/ext_includes/libatrac9.h)
SOURCES ${VGM_SOURCE_DIR}/ext_includes/libatrac9.h)
endif()
if(USE_CELT)
@ -104,7 +104,7 @@ if(MSVC)
COMMAND lib
ARGS /def:${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def /machine:x86 /out:${CMAKE_CURRENT_BINARY_DIR}/libcelt-0110.lib
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libcelt-0110.def)
file(GLOB CELT_HEADERS "${CMAKE_SOURCE_DIR}/ext_includes/celt/*.h")
file(GLOB CELT_HEADERS "${VGM_SOURCE_DIR}/ext_includes/celt/*.h")
add_custom_target(libcelt
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/libcelt-0061.lib

View File

@ -5,10 +5,10 @@ file(GLOB LAYOUT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/layout/*.c")
file(GLOB META_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.h")
file(GLOB META_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/meta/*.c")
set(EXT_HEADERS
${CMAKE_SOURCE_DIR}/ext_includes/clHCA.h
${CMAKE_SOURCE_DIR}/ext_includes/pstdint.h)
${VGM_SOURCE_DIR}/ext_includes/clHCA.h
${VGM_SOURCE_DIR}/ext_includes/pstdint.h)
set(EXT_SOURCES
${CMAKE_SOURCE_DIR}/ext_libs/clHCA.c)
${VGM_SOURCE_DIR}/ext_libs/clHCA.c)
file(GLOB MAIN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
file(GLOB MAIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
@ -41,7 +41,7 @@ setup_target(libvgmstream)
# Set up the proper include directories
target_include_directories(libvgmstream PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${VGM_SOURCE_DIR}/ext_includes
coding
layout
meta)

View File

@ -20,6 +20,7 @@ void decode_wv6_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspa
void decode_alp_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ffta2_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_blitz_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_mtf_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
void decode_ms_ima(VGMSTREAM * vgmstream,VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);
void decode_ref_ima(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do,int channel);

View File

@ -263,6 +263,26 @@ static void blitz_ima_expand_nibble(VGMSTREAMCHANNEL * stream, off_t byte_offset
if (*step_index > 88) *step_index=88;
}
static const int CIMAADPCM_INDEX_TABLE[16] = {8, 6, 4, 2, -1, -1, -1, -1,
-1, -1, -1, -1, 2, 4, 6, 8};
/* Capcom's MT Framework modified IMA, reverse engineered from the exe */
static void mtf_ima_expand_nibble(VGMSTREAMCHANNEL * stream, off_t byte_offset, int nibble_shift, int32_t * hist1, int32_t * step_index) {
int sample_nibble, sample_decoded, step, delta;
sample_nibble = (read_8bit(byte_offset,stream->streamfile) >> nibble_shift) & 0xf;
sample_decoded = *hist1;
step = ADPCMTable[*step_index];
delta = step * (2 * sample_nibble - 15);
sample_decoded += delta;
*hist1 = sample_decoded;
*step_index += CIMAADPCM_INDEX_TABLE[sample_nibble];
if (*step_index < 0) *step_index=0;
if (*step_index > 88) *step_index=88;
}
/* ************************************ */
/* DVI/IMA */
/* ************************************ */
@ -298,6 +318,30 @@ void decode_standard_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int chann
stream->adpcm_step_index = step_index;
}
void decode_mtf_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i, sample_count = 0;
int32_t hist1 = stream->adpcm_history1_32;
int step_index = stream->adpcm_step_index;
/* external interleave */
/* no header (external setup), pre-clamp for wrong values */
if (step_index < 0) step_index=0;
if (step_index > 88) step_index=88;
/* decode nibbles (layout: varies) */
for (i = first_sample; i < first_sample + samples_to_do; i++, sample_count += channelspacing) {
off_t byte_offset = stream->offset + i/2;
int nibble_shift = ((i&1) ? 0:4);
mtf_ima_expand_nibble(stream, byte_offset,nibble_shift, &hist1, &step_index);
outbuf[sample_count] = clamp16(hist1 >> 4);
}
stream->adpcm_history1_32 = hist1;
stream->adpcm_step_index = step_index;
}
void decode_3ds_ima(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i, sample_count;
int32_t hist1 = stream->adpcm_history1_32;

View File

@ -172,6 +172,7 @@ static const char* extension_list[] = {
"fsb",
"fsv",
"fwav",
"fwse",
"g1l",
"gbts",
@ -692,6 +693,7 @@ static const coding_info coding_info_list[] = {
{coding_ALP_IMA, "High Voltage ALP 4-bit IMA ADPCM"},
{coding_FFTA2_IMA, "Final Fantasy Tactics A2 4-bit IMA ADPCM"},
{coding_BLITZ_IMA, "Blitz Games 4-bit IMA ADPCM"},
{coding_MTF_IMA, "MT Framework 4-bit IMA ADPCM"},
{coding_MS_IMA, "Microsoft 4-bit IMA ADPCM"},
{coding_XBOX_IMA, "XBOX 4-bit IMA ADPCM"},
@ -1254,6 +1256,7 @@ static const meta_info meta_info_list[] = {
{meta_ISB, "Creative ISACT header"},
{meta_XSSB, "Artoon XSSB header"},
{meta_XMA_UE3, "Unreal Engine XMA header"},
{meta_FWSE, "MT Framework FWSE header"},
{meta_FDA, "Relic FDA header"},
};

View File

@ -680,6 +680,10 @@
RelativePath=".\meta\fsb_encrypted.c"
>
</File>
<File
RelativePath=".\meta\fwse.c"
>
</File>
<File
RelativePath=".\meta\g1l.c"
>

View File

@ -168,6 +168,7 @@
<ClCompile Include="meta\excitebots.c" />
<ClCompile Include="meta\ezw.c" />
<ClCompile Include="meta\ffmpeg.c" />
<ClCompile Include="meta\fwse.c" />
<ClCompile Include="meta\g1l.c" />
<ClCompile Include="meta\ima.c" />
<ClCompile Include="meta\imc.c" />

View File

@ -436,6 +436,9 @@
<ClCompile Include="meta\fsb_encrypted.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\fwse.c">
<Filter>meta\Source Files</Filter>
</ClCompile>
<ClCompile Include="meta\gca.c">
<Filter>meta\Source Files</Filter>
</ClCompile>

51
src/meta/fwse.c Normal file
View File

@ -0,0 +1,51 @@
#include "meta.h"
#include "../coding/coding.h"
/* FWSE - Capcom's MT Framework V1.x sound file */
VGMSTREAM *init_vgmstream_fwse(STREAMFILE *streamFile) {
VGMSTREAM *vgmstream = NULL;
uint32_t version, file_size, buffer_offset,
channel_count, sample_count, sample_rate;
if (!check_extensions(streamFile,"fwse"))
goto fail;
if ((read_32bitLE(0x00,streamFile)) != 0x45535746)
goto fail;
version = read_32bitLE(0x04,streamFile);
if (version != 2)
goto fail;
file_size = read_32bitLE(0x08,streamFile);
buffer_offset = read_32bitLE(0x0C,streamFile);
channel_count = read_32bitLE(0x10,streamFile);
if (channel_count > 1)
goto fail;
sample_count = read_32bitLE(0x14,streamFile);
sample_rate = read_32bitLE(0x18,streamFile);
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count, 0);
if (!vgmstream) goto fail;
vgmstream->meta_type = meta_FWSE;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = sample_count;
vgmstream->coding_type = coding_MTF_IMA;
vgmstream->layout_type = channel_count == 1 ? layout_none : layout_interleave;
vgmstream->interleave_block_size = 1;
if (!vgmstream_open_stream(vgmstream,streamFile,buffer_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}

View File

@ -877,6 +877,8 @@ VGMSTREAM* init_vgmstream_xma_ue3(STREAMFILE *sf);
VGMSTREAM* init_vgmstream_csb(STREAMFILE *sf);
VGMSTREAM *init_vgmstream_fwse(STREAMFILE *streamFile);
VGMSTREAM* init_vgmstream_fda(STREAMFILE *sf);
#endif /*_META_H*/

View File

@ -486,6 +486,7 @@ VGMSTREAM * (*init_vgmstream_functions[])(STREAMFILE *streamFile) = {
init_vgmstream_xssb,
init_vgmstream_xma_ue3,
init_vgmstream_csb,
init_vgmstream_fwse,
init_vgmstream_fda,
/* lowest priority metas (should go after all metas, and TXTH should go before raw formats) */
@ -1174,6 +1175,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
case coding_UBI_IMA:
case coding_OKI16:
case coding_OKI4S:
case coding_MTF_IMA:
return 1;
case coding_PCM4:
case coding_PCM4_U:
@ -1368,6 +1370,7 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
case coding_PCFX:
case coding_OKI16:
case coding_OKI4S:
case coding_MTF_IMA:
return 0x01;
case coding_MS_IMA:
case coding_RAD_IMA:
@ -1840,6 +1843,12 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
is_stereo, is_high_first);
}
break;
case coding_MTF_IMA:
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_mtf_ima(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
vgmstream->channels,vgmstream->samples_into_block,samples_to_do);
}
break;
case coding_3DS_IMA:
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_3ds_ima(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,

View File

@ -143,6 +143,7 @@ typedef enum {
coding_AWC_IMA, /* Rockstar AWC IMA ADPCM */
coding_UBI_IMA, /* Ubisoft IMA ADPCM */
coding_H4M_IMA, /* H4M IMA ADPCM (stereo or mono, high nibble first) */
coding_MTF_IMA, /* Capcom MT Framework IMA ADPCM */
coding_MSADPCM, /* Microsoft ADPCM (stereo/mono) */
coding_MSADPCM_int, /* Microsoft ADPCM (mono) */
@ -719,6 +720,7 @@ typedef enum {
meta_ISB,
meta_XSSB,
meta_XMA_UE3,
meta_FWSE,
meta_FDA,
} meta_t;

View File

@ -29,7 +29,7 @@ target_compile_definitions(in_vgmstream PRIVATE
_UNICODE)
# Make sure that the binary directory is included (for version.h)
target_include_directories(in_vgmstream PRIVATE ${CMAKE_BINARY_DIR})
target_include_directories(in_vgmstream PRIVATE ${VGM_BINARY_DIR})
# Include the version string
if(MSVC)

View File

@ -15,7 +15,7 @@ set_target_properties(xmp-vgmstream PROPERTIES
SUFFIX ".dll")
# Make sure that the binary directory is included (for version.h)
target_include_directories(xmp-vgmstream PRIVATE ${CMAKE_BINARY_DIR})
target_include_directories(xmp-vgmstream PRIVATE ${VGM_BINARY_DIR})
# Include the version string
if(MSVC)

View File

@ -42,7 +42,7 @@ double fade_seconds = 10.0;
double fade_delay_seconds = 0.0;
double loop_count = 2.0;
int disable_subsongs = 1;
bool xmplay_doneloop = 0;
BOOL xmplay_doneloop = 0;
/* plugin state */
VGMSTREAM * vgmstream = NULL;