Skip to content

Commit

Permalink
chore(vgm): replace vgmplay-legacy with libvgm (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciro Scognamiglio committed Dec 24, 2024
1 parent 2229d74 commit 66f26d7
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 144 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set(SUBDIRECTORIES_BY_MODULES
plugin_libpac "src/plugins/plugin_libpac"
plugin_libsidplayfp "src/plugins/plugin_libsidplayfp"
plugin_libstsound "src/plugins/plugin_libstsound"
plugin_libvgm "src/plugins/plugin_libvgm" #check cmake TODO
plugin_libxmp "src/plugins/plugin_libxmp"
plugin_mdxmini "src/plugins/plugin_mdxmini"
plugin_organya-decoder "src/plugins/plugin_organya-decoder"
Expand All @@ -47,7 +48,6 @@ set(SUBDIRECTORIES_BY_MODULES
plugin_sunvox_lib "src/plugins/plugin_sunvox_lib" #TODO add sv_unload_dll() (see sunvox_lib README)
plugin_tunes98_plug "src/plugins/plugin_tunes98_plug" #check cmake TODO
plugin_v2m-player "src/plugins/plugin_v2m-player" #TODO seeking it is now supported (should be implemented into main.cpp). #TODO add v2mz support (see sources/v2m dir for example files)
plugin_vgmplay-legacy "src/plugins/plugin_vgmplay-legacy" #check cmake TODO
plugin_vgmstream "src/plugins/plugin_vgmstream"
plugin_vio2sf "src/plugins/plugin_vio2sf" #check cmake TODO
plugin_wothke-uade-2.13 "src/plugins/plugin_wothke-uade-2.13" #TODO unfinished
Expand Down
2 changes: 1 addition & 1 deletion src/app/fileinfoparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void FileInfoParser::updateFileInfo(QTableWidget* tableInfo, PlaylistItem* playl
tableInfo->setItem(row, 0, new QTableWidgetItem("MD5 Old"));
tableInfo->setItem(row++, 1, new QTableWidgetItem(SoundManager::getInstance().m_Info1->md5Old.c_str()));
}
else if (SoundManager::getInstance().m_Info1->plugin == PLUGIN_vgmplay_legacy)
else if (SoundManager::getInstance().m_Info1->plugin == PLUGIN_libvgm)
{
tableInfo->setItem(row, 1, new QTableWidgetItem(SoundManager::getInstance().m_Info1->title.c_str()));
tableInfo->setItem(row++, 0, new QTableWidgetItem("Title"));
Expand Down
28 changes: 14 additions & 14 deletions src/app/plugins.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -111,56 +111,56 @@
#define PLUGIN_libstsound_NAME "@PLUGIN_libstsound_NAME@"
#define PLUGIN_libstsound_VERSION "@PLUGIN_libstsound_VERSION@"

#define PLUGIN_libxmp 22
#define PLUGIN_libvgm 22
#define PLUGIN_libvgm_DLL "@PLUGIN_libvgm_DLL@"
#define PLUGIN_libvgm_NAME "@PLUGIN_libvgm_NAME@"
#define PLUGIN_libvgm_VERSION "@PLUGIN_libvgm_VERSION@"

#define PLUGIN_libxmp 23
#define PLUGIN_libxmp_DLL "@PLUGIN_libxmp_DLL@"
#define PLUGIN_libxmp_NAME "@PLUGIN_libxmp_NAME@"
#define PLUGIN_libxmp_VERSION "@PLUGIN_libxmp_VERSION@"

#define PLUGIN_mdxmini 23
#define PLUGIN_mdxmini 24
#define PLUGIN_mdxmini_DLL "@PLUGIN_mdxmini_DLL@"
#define PLUGIN_mdxmini_NAME "@PLUGIN_mdxmini_NAME@"
#define PLUGIN_mdxmini_VERSION "@PLUGIN_mdxmini_VERSION@"

#define PLUGIN_organya_decoder 24
#define PLUGIN_organya_decoder 25
#define PLUGIN_organya_decoder_DLL "@PLUGIN_organya-decoder_DLL@"
#define PLUGIN_organya_decoder_NAME "@PLUGIN_organya-decoder_NAME@"
#define PLUGIN_organya_decoder_VERSION "@PLUGIN_organya-decoder_VERSION@"

#define PLUGIN_protrekkr 25
#define PLUGIN_protrekkr 26
#define PLUGIN_protrekkr_DLL "@PLUGIN_protrekkr_DLL@"
#define PLUGIN_protrekkr_NAME "@PLUGIN_protrekkr_NAME@"
#define PLUGIN_protrekkr_VERSION "@PLUGIN_protrekkr_VERSION@"

#define PLUGIN_sc68 26
#define PLUGIN_sc68 27
#define PLUGIN_sc68_DLL "@PLUGIN_sc68_DLL@"
#define PLUGIN_sc68_NAME "@PLUGIN_sc68_NAME@"
#define PLUGIN_sc68_VERSION "@PLUGIN_sc68_VERSION@"

#define PLUGIN_sndh_player 27
#define PLUGIN_sndh_player 28
#define PLUGIN_sndh_player_DLL "@PLUGIN_sndh-player_DLL@"
#define PLUGIN_sndh_player_NAME "@PLUGIN_sndh-player_NAME@"
#define PLUGIN_sndh_player_VERSION "@PLUGIN_sndh-player_VERSION@"

#define PLUGIN_sunvox_lib 28
#define PLUGIN_sunvox_lib 29
#define PLUGIN_sunvox_lib_DLL "@PLUGIN_sunvox_lib_DLL@"
#define PLUGIN_sunvox_lib_NAME "@PLUGIN_sunvox_lib_NAME@"
#define PLUGIN_sunvox_lib_VERSION "@PLUGIN_sunvox_lib_VERSION@"

#define PLUGIN_tunes98_plug 29
#define PLUGIN_tunes98_plug 30
#define PLUGIN_tunes98_plug_DLL "@PLUGIN_tunes98_plug_DLL@"
#define PLUGIN_tunes98_plug_NAME "@PLUGIN_tunes98_plug_NAME@"
#define PLUGIN_tunes98_plug_VERSION "@PLUGIN_tunes98_plug_VERSION@"

#define PLUGIN_v2m_player 30
#define PLUGIN_v2m_player 31
#define PLUGIN_v2m_player_DLL "@PLUGIN_v2m-player_DLL@"
#define PLUGIN_v2m_player_NAME "@PLUGIN_v2m-player_NAME@"
#define PLUGIN_v2m_player_VERSION "@PLUGIN_v2m-player_VERSION@"

#define PLUGIN_vgmplay_legacy 31
#define PLUGIN_vgmplay_legacy_DLL "@PLUGIN_vgmplay-legacy_DLL@"
#define PLUGIN_vgmplay_legacy_NAME "@PLUGIN_vgmplay-legacy_NAME@"
#define PLUGIN_vgmplay_legacy_VERSION "@PLUGIN_vgmplay-legacy_VERSION@"

#define PLUGIN_vgmstream 32
#define PLUGIN_vgmstream_DLL "@PLUGIN_vgmstream_DLL@"
#define PLUGIN_vgmstream_NAME "@PLUGIN_vgmstream_NAME@"
Expand Down
6 changes: 3 additions & 3 deletions src/app/settingswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@ settingsWindow::settingsWindow(QWidget* parent) :
ui->tableWidgetPlugins->setItem(row, 1, new QTableWidgetItem(PLUGIN_v2m_player_VERSION));
ui->tableWidgetPlugins->setItem(row++, 0, new QTableWidgetItem(PLUGIN_v2m_player_NAME));
}
if (PLUGIN_vgmplay_legacy_DLL != "")
if (PLUGIN_libvgm_DLL != "")
{
ui->tableWidgetPlugins->setItem(row, 1, new QTableWidgetItem(PLUGIN_vgmplay_legacy_VERSION));
ui->tableWidgetPlugins->setItem(row++, 0, new QTableWidgetItem(PLUGIN_vgmplay_legacy_NAME));
ui->tableWidgetPlugins->setItem(row, 1, new QTableWidgetItem(PLUGIN_libvgm_VERSION));
ui->tableWidgetPlugins->setItem(row++, 0, new QTableWidgetItem(PLUGIN_libvgm_NAME));
}
if (PLUGIN_vgmstream_DLL != "")
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/soundmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ void SoundManager::Init(int device, QString outputfilename)
{
loadPlugin(PLUGIN_zxtune_DLL, 99999);
}
if (PLUGIN_vgmplay_legacy_DLL != "")
if (PLUGIN_libvgm_DLL != "")
{
loadPlugin(PLUGIN_vgmplay_legacy_DLL, 99999);
loadPlugin(PLUGIN_libvgm_DLL, 99999);
}
if (PLUGIN_game_music_emu_DLL != "")
{
Expand Down
74 changes: 74 additions & 0 deletions src/plugins/plugin_libvgm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.28)

set(NAME "libvgm")
set(VERSION "34c368cde98f33c42455fbbfbec07073ba79bf5c")
project(plugin_${NAME})
set(PLUGIN_${NAME}_DLL "${PROJECT_NAME}.dll" PARENT_SCOPE)
set(PLUGIN_${NAME}_NAME "libvgm" PARENT_SCOPE)
set(PLUGIN_${NAME}_VERSION "${VERSION}" PARENT_SCOPE)

find_package(ZLIB REQUIRED)

set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 14)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration>)
endif ()

set(LIB_NAME "${NAME}")
set(LIB_VERSION "${VERSION}")
set(LIB_NAME_VERSIONED "${LIB_NAME}-${LIB_VERSION}")
set(LIB_FILENAME "${LIB_NAME_VERSIONED}.zip")
set(LIB_FILENAME_URL "${LIB_VERSION}.zip")
set(LIB_URL "https://github.com/ValleyBell/${LIB_NAME}/archive/${LIB_FILENAME_URL}")
set(LIB_SHA_256_HASH "b9139240830e17273a7c6e74c3410a0b6956dfea8e988729dc50d5148ed900eb")
download_patch_and_add(
${LIB_NAME_VERSIONED} ${LIB_FILENAME} ${LIB_URL} ${LIB_SHA_256_HASH} false "" ""
)

#TODO be sure *.s98 & *.gym are played by libvgm instead of tunes98

#add_compile_definitions(VGM_LITTLE_ENDIAN) #TODO
#add_compile_definitions(HAVE_STDINT_H) #TODO
#add_compile_definitions(_WIN32_WINNT=0x500) #TODO

file(GLOB SOURCES
#${EXTERNAL_SOURCE_DIR}/audio/AudDrv_DSound.cpp
#${EXTERNAL_SOURCE_DIR}/audio/AudDrv_WinMM.cpp
#${EXTERNAL_SOURCE_DIR}/audio/AudDrv_WASAPI.cpp
#${EXTERNAL_SOURCE_DIR}/audio/AudioStream.c
${EXTERNAL_SOURCE_DIR}/emu/*.c
${EXTERNAL_SOURCE_DIR}/emu/cores/*.c
${EXTERNAL_SOURCE_DIR}/utils/OSMutex_Win.c

src/main.cpp
)

list(REMOVE_ITEM SOURCES
${EXTERNAL_SOURCE_DIR}/emu/cores/adlibemu_opl_inc.c
${EXTERNAL_SOURCE_DIR}/emu/cores/scsplfo.c
)

add_library(${PROJECT_NAME} SHARED ${SOURCES})

target_include_directories(${PROJECT_NAME} PRIVATE
${EXTERNAL_SOURCE_DIR}/audio #TODO
${EXTERNAL_SOURCE_DIR}/utils #TODO

${CMAKE_SOURCE_DIR}/src/app #TODO
${EXTERNAL_SOURCE_DIR_fmod}/api/core/inc
)

target_link_libraries(${PROJECT_NAME} PRIVATE
ZLIB::ZLIB
# -ldsound #TODO
)

set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "${PROJECT_NAME}"
PREFIX ""
RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR}/data/plugin
COMPILE_FLAGS "-m32"
LINK_FLAGS "-m32"
)
Binary file not shown.
File renamed without changes.
123 changes: 0 additions & 123 deletions src/plugins/plugin_vgmplay-legacy/CMakeLists.txt

This file was deleted.

Binary file not shown.

0 comments on commit 66f26d7

Please sign in to comment.