Skip to content

Commit 461dcc7

Browse files
committed
- add VGM music support
1 parent c7d34eb commit 461dcc7

32 files changed

Lines changed: 417 additions & 49 deletions

.github/workflows/deploy_linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- name: Install dependencies
3737
run: |
38-
vcpkg install physfs sfml --triplet=x64-linux
38+
vcpkg install libgme[core,vgm] physfs sfml --triplet=x64-linux
3939
4040
- name: Setup Ninja Build
4141
uses: turtlesec-no/get-ninja@main

.github/workflows/deploy_windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
2323
2424
- name: Install dependencies
25-
run: vcpkg install physfs sfml --triplet=x86-windows-static
25+
run: vcpkg install libgme[core,vgm] physfs sfml --triplet=x86-windows-static
2626

2727
- name: Install UPX
2828
uses: crazy-max/ghaction-upx@v3
@@ -69,7 +69,7 @@ jobs:
6969
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
7070
7171
- name: Install dependencies
72-
run: vcpkg install physfs sfml --triplet=x64-windows-static
72+
run: vcpkg install libgme[core,vgm] physfs sfml --triplet=x64-windows-static
7373

7474
- name: Install UPX
7575
uses: crazy-max/ghaction-upx@v3

BUILD.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ To compile in Windows, you can use CMake or open the folder with Visual Studio 2
44

55
The easiest way to get the required dependencies is to use vcpkg.
66

7-
vcpkg install physfs sfml ffmpeg --triplet=x86-windows
8-
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static
9-
vcpkg install physfs sfml ffmpeg --triplet=x64-windows
10-
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static
7+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x86-windows
8+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x86-windows-static
9+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x64-windows
10+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x64-windows-static
1111

1212
There is a custom vcpkg triplet that links ffmpeg dynamically.
1313

14-
vcpkg install physfs sfml ffmpeg --triplet=x86-windows-static --overlay-triplets=vcpkg/triplets
15-
vcpkg install physfs sfml ffmpeg --triplet=x64-windows-static --overlay-triplets=vcpkg/triplets
14+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x86-windows-static --overlay-triplets=vcpkg/triplets
15+
vcpkg install libgme[core,vgm] physfs sfml ffmpeg --triplet=x64-windows-static --overlay-triplets=vcpkg/triplets
16+
17+
Game_Music_Emu - https://github.com/libgme/game-music-emu
18+
optional for VGM music playback support
1619

1720
PhysicsFS - https://icculus.org/physfs
1821
version >= 2.1
@@ -65,3 +68,4 @@ DGENGINE_FALLBACK_TO_LOWERCASE (TRUE) Enable falling back to all lowercase name
6568
DGENGINE_STATIC_CRT (FALSE) Use static CRT library (Windows)
6669
DGENGINE_COMPRESS_BINARY (FALSE) Compress binary with UPX
6770
DGENGINE_OPTIMISE (FALSE) Optimize build with compiler flags
71+
DGENGINE_VGM_MUSIC (TRUE) Add support for VGM sound files

CMakeLists.txt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ if(CCACHE_PROGRAM)
77
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
88
endif()
99

10-
project(Columns VERSION 1.2.0)
10+
project(Columns VERSION 1.2.1)
11+
12+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake_modules")
1113

1214
if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/../DGEngine.core")
1315
add_subdirectory(${PROJECT_SOURCE_DIR}/../DGEngine.core DGEngine.core)
@@ -17,10 +19,20 @@ endif()
1719

1820
option(DGENGINE_COMPRESS_BINARY "Compress binary" FALSE)
1921
option(DGENGINE_OPTIMISE "Optimize build" FALSE)
22+
option(DGENGINE_VGM_MUSIC "Add support for VGM sound files" TRUE)
23+
24+
find_package(gme QUIET)
25+
find_package(ZLIB QUIET)
26+
27+
if(NOT ${gme_FOUND} OR NOT ${ZLIB_FOUND})
28+
SET(DGENGINE_VGM_MUSIC FALSE)
29+
endif()
2030

2131
set(SOURCE_FILES
2232
src/RegisterHooks.cpp
2333
src/RegisterHooks.h
34+
src/Game/Game2.cpp
35+
src/Game/Game2.h
2436
src/Game/Actions/ActLevel.h
2537
src/Game/Jewel/Jewel.cpp
2638
src/Game/Jewel/Jewel.h
@@ -75,6 +87,13 @@ set(SOURCE_FILES
7587
src/Parser/Level/ParseLevelScores.h
7688
)
7789

90+
if(DGENGINE_VGM_MUSIC)
91+
SET(SOURCE_FILES ${SOURCE_FILES}
92+
src/SFML/VGM.cpp
93+
src/SFML/VGM.h
94+
)
95+
endif()
96+
7897
if(DGENGINE_STATIC_CRT AND WIN32)
7998
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
8099
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
@@ -100,6 +119,11 @@ endif()
100119
target_include_directories(${PROJECT_NAME}Lib PUBLIC src)
101120
target_link_libraries(${PROJECT_NAME}Lib PUBLIC DGEngine.core)
102121

122+
if(DGENGINE_VGM_MUSIC)
123+
target_compile_definitions(${PROJECT_NAME}Lib PUBLIC DGENGINE_VGM_MUSIC=1)
124+
target_link_libraries(${PROJECT_NAME}Lib PRIVATE gme::gme ZLIB::ZLIB)
125+
endif()
126+
103127
add_executable(${PROJECT_NAME} src/Main.cpp)
104128

105129
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}Lib)

LICENSE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ endian uses the BSD license.
1313

1414
https://github.com/steinwurf/endian
1515

16+
Game_Music_Emu uses the LGPL v2.1 license.
17+
18+
https://github.com/libgme/game-music-emu
19+
1620
PhysFS uses the zlib license.
1721

1822
https://icculus.org/physfs/

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sprites for the original are included in the gamefilesc/gfx*x folders.
1010
Included upscaled graphics created using [xbrz](https://sourceforge.net/projects/xbrz/).
1111

1212
To have music, convert the VGM songs to ogg and place them in gamefilesc/bgm
13-
To get the original music, see gamefilesc/bgm/readme.txt
13+
Alternatively, install the Game_Music_Emu dependency.
1414

1515
[Getting original assets](#Getting-original-assets)
1616

@@ -53,6 +53,8 @@ See how to build in [BUILD.txt](BUILD.txt).
5353

5454
### Getting original assets
5555

56+
(no longer needed)
57+
5658
Fork this repository, go to `Actions` and manually run the `Package_gamefiles` workflow.
5759
An artifact (`gamefilesc.zip`) will be created with the original assets.
5860
Extract that archive over the `gamefilesc` folder or delete the `gamefilesc` folder (Columns will use the zip instead).

cmake_modules/Findgme.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
find_path(gme_INCLUDE_DIR NAMES gme.h gme/gme.h)
2+
mark_as_advanced(gme_INCLUDE_DIR)
3+
4+
find_library(gme_LIBRARY NAMES gme)
5+
mark_as_advanced(gme_LIBRARY)
6+
7+
include(FindPackageHandleStandardArgs)
8+
find_package_handle_standard_args(gme REQUIRED_VARS
9+
gme_INCLUDE_DIR
10+
gme_LIBRARY
11+
)
12+
13+
if(gme_FOUND)
14+
set(gme_INCLUDE_DIRS ${gme_INCLUDE_DIR})
15+
set(gme_LIBRARIES ${gme_LIBRARY})
16+
if(NOT TARGET gme::gme)
17+
add_library(gme::gme UNKNOWN IMPORTED)
18+
set_target_properties(gme::gme PROPERTIES
19+
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
20+
IMPORTED_LOCATION "${gme_LIBRARY}"
21+
INTERFACE_INCLUDE_DIRECTORIES "${gme_INCLUDE_DIR}")
22+
endif()
23+
endif()
28.4 KB
Binary file not shown.
1.31 KB
Binary file not shown.

gamefilesc/bgm/03 - Clotho.vgz

28.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)