Implement the infrastructure for bundling FH2M maps (#9806)

This commit is contained in:
Oleg Derevenetz
2025-05-18 21:00:51 +08:00
committed by GitHub
parent f66ce2cd93
commit bc0f28ea79
11 changed files with 49 additions and 23 deletions
+6 -3
View File
@@ -27,6 +27,7 @@ jobs:
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/linux/install_sdl2.sh
@@ -71,6 +72,7 @@ jobs:
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/linux/install_sdl2.sh
@@ -115,6 +117,7 @@ jobs:
./docs/README.txt
files/data/*.h2d
files/lang/*.mo
maps/*.fh2m
./script/demo/download_demo_version.sh
./script/homm2/extract_homm2_resources.sh
script/macos/Brewfile
@@ -253,7 +256,7 @@ jobs:
fi
- name: Create package
run: |
# Translations and H2D files are already included in fheroes2.vpk
# Translations, H2D files and FH2M maps are already bundled into fheroes2.vpk
7z a -bb1 -tzip -- fheroes2_psv.zip LICENSE changelog.txt fheroes2.vpk ./docs/README.txt ./docs/README_PSV.md
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
@@ -299,7 +302,7 @@ jobs:
make -C files/lang -j "$(nproc)"
- name: Create package
run: |
7z a -bb1 -tzip -- fheroes2_switch.zip LICENSE changelog.txt fheroes2.nro ./docs/README.txt ./docs/README_switch.md files/data/*.h2d files/lang/*.mo
7z a -bb1 -tzip -- fheroes2_switch.zip LICENSE changelog.txt fheroes2.nro ./docs/README.txt ./docs/README_switch.md files/data/*.h2d files/lang/*.mo maps/*.fh2m
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
@@ -356,7 +359,7 @@ jobs:
- name: Create package
if: ${{ contains( matrix.on, github.event_name ) }}
run: |
# Translations and H2D files are already included in fheroes2.data
# Translations, H2D files and FH2M maps are already bundled into fheroes2.data
7z a -bb1 -tzip -- ${{ matrix.package_name }} LICENSE changelog.txt fheroes2.data fheroes2.js fheroes2.wasm ./docs/README.txt ./files/emscripten/*
- uses: actions/upload-artifact@v4
if: ${{ contains( matrix.on, github.event_name ) }}
+1
View File
@@ -99,6 +99,7 @@ jobs:
files\\data\\*.h2d \
files\\lang\\*.mo \
files\\timidity\\* \
maps\\*.fh2m \
.\\script\\demo\\*.bat \
.\\script\\demo\\*.ps1 \
.\\script\\homm2\\*.bat \
+15 -1
View File
@@ -88,6 +88,14 @@ endif(NOT WIN32)
# macOS app bundle
#
if(MACOS_APP_BUNDLE)
add_custom_target(
app_bundle_fh2m_maps
ALL
COMMAND mkdir -p ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/Resources/maps
COMMAND cp *.fh2m ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/Resources/maps
DEPENDS fheroes2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/maps
)
add_custom_target(
app_bundle_h2d_files
ALL
@@ -108,7 +116,7 @@ if(MACOS_APP_BUNDLE)
run_dylibbundler
ALL
COMMAND dylibbundler -od -b -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS/${PROJECT_NAME} -d ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/libs
DEPENDS fheroes2 app_bundle_h2d_files app_bundle_translations
DEPENDS fheroes2 app_bundle_fh2m_maps app_bundle_h2d_files app_bundle_translations
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
endif(MACOS_APP_BUNDLE)
@@ -123,6 +131,12 @@ if(NOT MACOS_APP_BUNDLE)
FILES_MATCHING
PATTERN *.h2d
)
install(
DIRECTORY maps/
DESTINATION ${FHEROES2_DATA}/maps
FILES_MATCHING
PATTERN *.fh2m
)
install(
FILES docs/README.txt LICENSE changelog.txt
DESTINATION ${CMAKE_INSTALL_DOCDIR}
+7 -5
View File
@@ -39,19 +39,21 @@ all:
$(MAKE) -C src/dist
$(MAKE) -C files/lang
ifdef FHEROES2_MACOS_APP_BUNDLE
mkdir -p fheroes2.app/Contents/Resources/translations
mkdir -p fheroes2.app/Contents/Resources/h2d
mkdir -p fheroes2.app/Contents/MacOS
cp src/resources/fheroes2.icns fheroes2.app/Contents/Resources
cp files/lang/*.mo fheroes2.app/Contents/Resources/translations
mkdir -p fheroes2.app/Contents/Resources/h2d
mkdir -p fheroes2.app/Contents/Resources/maps
mkdir -p fheroes2.app/Contents/Resources/translations
cp files/data/*.h2d fheroes2.app/Contents/Resources/h2d
cp files/lang/*.mo fheroes2.app/Contents/Resources/translations
cp maps/*.fh2m fheroes2.app/Contents/Resources/maps
cp src/dist/fheroes2/fheroes2 fheroes2.app/Contents/MacOS
cp src/resources/fheroes2.icns fheroes2.app/Contents/Resources
sed -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/$(PROJECT_NAME)/" \
-e "s/\$${MACOSX_BUNDLE_BUNDLE_VERSION}/$(PROJECT_VERSION)/" \
-e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/fheroes2/" \
-e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.fheroes2.$(PROJECT_NAME)/" \
-e "s/\$${MACOSX_BUNDLE_ICON_FILE}/fheroes2.icns/" \
-e "s/\$${MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(PROJECT_VERSION)/" src/resources/Info.plist.in > fheroes2.app/Contents/Info.plist
cp src/dist/fheroes2/fheroes2 fheroes2.app/Contents/MacOS
dylibbundler -od -b -x fheroes2.app/Contents/MacOS/fheroes2 -d fheroes2.app/Contents/libs
else
cp src/dist/fheroes2/fheroes2 .
+4 -9
View File
@@ -36,19 +36,14 @@ all: fheroes2.vpk
fheroes2.vpk: eboot.bin param.sfo translations
vita-pack-vpk -s param.sfo -b eboot.bin \
--add files/images/platform/psv/sce_sys/icon0.png=sce_sys/icon0.png \
--add files/images/platform/psv/sce_sys/livearea/contents/bg.png=sce_sys/livearea/contents/bg.png \
--add files/images/platform/psv/sce_sys/livearea/contents/startup.png=sce_sys/livearea/contents/startup.png \
--add files/images/platform/psv/sce_sys/livearea/contents/template.xml=sce_sys/livearea/contents/template.xml \
--add files/data=files/data \
--add files/lang/vita_temp=files/lang \
--add files/images/platform/psv/sce_sys=sce_sys \
$(shell find files/data -name "*.h2d" -exec printf "--add %q=%q\n" {} {} \;) \
$(shell find files/lang -name "*.mo" -exec printf "--add %q=%q\n" {} {} \;) \
$(shell find maps -name "*.fh2m" -exec printf "--add %q=%q\n" {} {} \;) \
fheroes2.vpk
rm -rf files/lang/vita_temp
translations: fheroes2.elf
$(MAKE) -C files/lang
mkdir -p files/lang/vita_temp
cp files/lang/*.mo files/lang/vita_temp
eboot.bin: fheroes2.velf
vita-make-fself fheroes2.velf eboot.bin
+1 -1
View File
@@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>src\engine;src\fheroes2\gui;src\fheroes2\maps;src\fheroes2\kingdom;src\fheroes2\campaign;src\fheroes2\game;src\fheroes2\editor;src\fheroes2\dialog;src\fheroes2\system;src\fheroes2\spell;src\fheroes2\monster;src\fheroes2\castle;src\fheroes2\agg;src\fheroes2\heroes;src\fheroes2\resource;src\fheroes2\ai;src\fheroes2\army;src\fheroes2\battle;src\fheroes2\h2d;src\fheroes2\objects;src\fheroes2\world;src\fheroes2\audio;src\fheroes2\image;src\thirdparty\libsmacker;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>src\engine;src\fheroes2\agg;src\fheroes2\ai;src\fheroes2\army;src\fheroes2\audio;src\fheroes2\battle;src\fheroes2\campaign;src\fheroes2\castle;src\fheroes2\dialog;src\fheroes2\editor;src\fheroes2\game;src\fheroes2\gui;src\fheroes2\h2d;src\fheroes2\heroes;src\fheroes2\image;src\fheroes2\kingdom;src\fheroes2\maps;src\fheroes2\monster;src\fheroes2\resource;src\fheroes2\spell;src\fheroes2\system;src\fheroes2\world;src\thirdparty\libsmacker;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(FHEROES2_BUILD_NUMBER)'!=''">BUILD_VERSION=$(FHEROES2_BUILD_NUMBER);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Manifest>
+8 -1
View File
@@ -95,6 +95,13 @@ dependencies {
implementation 'com.google.android.material:material:1.12.0'
}
tasks.register('copyFH2M', Copy) {
from('../../maps') {
include '*.fh2m'
}
into 'src/main/assets/maps'
}
tasks.register('copyH2D', Copy) {
from('../../files/data') {
include '*.h2d'
@@ -118,7 +125,7 @@ tasks.register('copyTranslations', Copy) {
}
tasks.register('generateAssetsDigest') {
dependsOn copyH2D, copyTimidity, copyTranslations
dependsOn copyFH2M, copyH2D, copyTimidity, copyTranslations
doLast {
final java.nio.file.Path assetsDirPath = layout.projectDirectory.getAsFile()
@@ -48,6 +48,7 @@ public final class GameActivity extends SDLActivity
if ( isAssetsDigestChanged( "assets.digest", new File( filesDir, "assets.digest" ) ) ) {
try {
extractAssets( "files", externalFilesDir );
extractAssets( "maps", externalFilesDir );
// Digest should be updated only after successful extraction of all assets
extractAssets( "assets.digest", filesDir );
}
BIN
View File
Binary file not shown.
+1
View File
@@ -31,6 +31,7 @@ Source: "..\..\docs\README.txt"; DestDir: "{app}"
Source: "..\..\files\data\*.h2d"; DestDir: "{app}\files\data"
Source: "..\..\files\lang\*.mo"; DestDir: "{app}\files\lang"
Source: "..\..\files\timidity\*"; DestDir: "{app}\files\timidity"; Flags: recursesubdirs
Source: "..\..\maps\*.fh2m"; DestDir: "{app}\maps"
Source: "..\demo\*.bat"; DestDir: "{app}"
Source: "..\demo\*.ps1"; DestDir: "{app}"
Source: "..\homm2\*.bat"; DestDir: "{app}"
+5 -3
View File
@@ -30,9 +30,11 @@ CCFLAGS := $(CCFLAGS) \
-sSTRICT
LDFLAGS := $(LDFLAGS) \
--preload-file ../../../files/data/resurrection.h2d@/files/data/resurrection.h2d \
--preload-file ../../../files/lang/@/files/lang/ \
--preload-file ../../../files/timidity/@/files/timidity/ \
$(patsubst %, --preload-file ../%@/files/data/, $(wildcard ../../files/data/*.h2d)) \
$(patsubst %, --preload-file ../%@/files/lang/, $(wildcard ../../files/lang/*.mo)) \
--preload-file ../../../files/timidity/timidity.cfg@/files/timidity/ \
$(patsubst %, --preload-file ../%@/files/timidity/instruments/, $(wildcard ../../files/timidity/instruments/*.pat)) \
$(patsubst %, --preload-file ../%@/maps/, $(wildcard ../../maps/*.fh2m)) \
-sALLOW_MEMORY_GROWTH \
-sASYNCIFY \
-sASYNCIFY_STACK_SIZE=64kb \