Skip to content

Commit 3aa0f3a

Browse files
committed
Merge branch 'sonilyan-truetype-support'
2 parents 81867ff + 2d4c1a1 commit 3aa0f3a

File tree

270 files changed

+16822
-11002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

270 files changed

+16822
-11002
lines changed

.github/workflows/ci-build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,51 @@ jobs:
7575
path: os/android/app/build/outputs/apk/debug/app-debug.apk
7676
retention-days: 7
7777

78+
ios:
79+
name: iOS
80+
81+
runs-on: macos-11
82+
83+
steps:
84+
- name: Clone
85+
uses: actions/checkout@v3
86+
87+
- name: Cache cmake build
88+
uses: actions/cache@v3
89+
with:
90+
path: build
91+
key: ios-cmake-v1
92+
93+
- name: Configure
94+
run: |
95+
cmake \
96+
-B build \
97+
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
98+
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/ios.toolchain.cmake \
99+
-D ENABLE_BITCODE=0 \
100+
-D PLATFORM=OS64 \
101+
# EOL
102+
103+
- name: Build
104+
run: |
105+
cmake \
106+
--build build \
107+
-j $(sysctl -n hw.physicalcpu) \
108+
--target package \
109+
# EOL
110+
111+
# TODO: Should be a part of packaging.
112+
- name: Prepare for uploading
113+
run: |
114+
cp build/fallout2-ce.zip build/fallout2-ce.ipa
115+
116+
- name: Upload
117+
uses: actions/upload-artifact@v3
118+
with:
119+
name: fallout2-ce.ipa
120+
path: build/fallout2-ce.ipa
121+
retention-days: 7
122+
78123
linux:
79124
name: Linux (${{ matrix.arch }})
80125

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,4 @@ FodyWeavers.xsd
391391
# CMake
392392
/out
393393
/build
394+
/build2

CMakeLists.txt

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
55
set(EXECUTABLE_NAME fallout2-ce)
66

77
if (APPLE)
8-
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "")
9-
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
8+
if(IOS)
9+
set(CMAKE_OSX_DEPLOYMENT_TARGET "11" CACHE STRING "")
10+
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "")
11+
else()
12+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "")
13+
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
14+
endif()
1015
endif()
1116

1217
project(${EXECUTABLE_NAME})
@@ -52,8 +57,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
5257
"src/combat.h"
5358
"src/config.cc"
5459
"src/config.h"
55-
"src/core.cc"
56-
"src/core.h"
5760
"src/credits.cc"
5861
"src/credits.h"
5962
"src/critter.cc"
@@ -94,6 +97,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
9497
"src/file_utils.h"
9598
"src/font_manager.cc"
9699
"src/font_manager.h"
100+
"src/freetype_manager.cc"
101+
"src/freetype_manager.h"
97102
"src/game_config.cc"
98103
"src/game_config.h"
99104
"src/game_dialog.cc"
@@ -119,6 +124,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
119124
"src/grayscale.h"
120125
"src/heap.cc"
121126
"src/heap.h"
127+
"src/input.cc"
128+
"src/input.h"
122129
"src/interface.cc"
123130
"src/interface.h"
124131
"src/interpreter_extra.cc"
@@ -131,6 +138,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
131138
"src/inventory.h"
132139
"src/item.cc"
133140
"src/item.h"
141+
"src/kb.cc"
142+
"src/kb.h"
134143
"src/light.cc"
135144
"src/light.h"
136145
"src/lips.cc"
@@ -153,6 +162,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
153162
"src/mmx.h"
154163
"src/mouse_manager.cc"
155164
"src/mouse_manager.h"
165+
"src/mouse.cc"
166+
"src/mouse.h"
156167
"src/movie_effect.cc"
157168
"src/movie_effect.h"
158169
"src/movie_lib.cc"
@@ -214,6 +225,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
214225
"src/stat.h"
215226
"src/string_parsers.cc"
216227
"src/string_parsers.h"
228+
"src/svga.cc"
229+
"src/svga.h"
217230
"src/text_font.cc"
218231
"src/text_font.h"
219232
"src/text_object.cc"
@@ -223,8 +236,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
223236
"src/trait_defs.h"
224237
"src/trait.cc"
225238
"src/trait.h"
226-
"src/trap.cc"
227-
"src/trap.h"
239+
"src/vcr.cc"
240+
"src/vcr.h"
228241
"src/version.cc"
229242
"src/version.h"
230243
"src/widget.cc"
@@ -254,10 +267,25 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
254267
"src/platform_compat.h"
255268
"src/pointer_registry.cc"
256269
"src/pointer_registry.h"
270+
"src/settings.cc"
271+
"src/settings.h"
257272
"src/sfall_config.cc"
258273
"src/sfall_config.h"
274+
"src/sfall_global_vars.cc"
275+
"src/sfall_global_vars.h"
276+
"src/sfall_lists.cc"
277+
"src/sfall_lists.h"
278+
"src/sfall_opcodes.cc"
279+
"src/sfall_opcodes.h"
259280
)
260281

282+
if(IOS)
283+
target_sources(${EXECUTABLE_NAME} PUBLIC
284+
"src/platform/ios/paths.h"
285+
"src/platform/ios/paths.mm"
286+
)
287+
endif()
288+
261289
if(WIN32)
262290
target_compile_definitions(${EXECUTABLE_NAME} PUBLIC
263291
_CRT_SECURE_NO_WARNINGS
@@ -309,7 +337,15 @@ if(APPLE)
309337
target_sources(${EXECUTABLE_NAME} PUBLIC "os/macos/fallout2-ce.icns")
310338
set_source_files_properties("os/macos/fallout2-ce.icns" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
311339

312-
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/macos/Info.plist")
340+
if(IOS)
341+
target_sources(${EXECUTABLE_NAME} PUBLIC "os/ios/LaunchScreen.storyboard")
342+
set_source_files_properties("os/ios/LaunchScreen.storyboard" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
343+
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/ios/Info.plist")
344+
set_target_properties(${EXECUTABLE_NAME} PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
345+
else()
346+
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/os/macos/Info.plist")
347+
endif()
348+
313349
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.alexbatalov.fallout2-ce")
314350
set(MACOSX_BUNDLE_BUNDLE_NAME "${EXECUTABLE_NAME}")
315351
set(MACOSX_BUNDLE_ICON_FILE "fallout2-ce.icns")
@@ -336,24 +372,45 @@ target_include_directories(${EXECUTABLE_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS})
336372
target_link_libraries(${EXECUTABLE_NAME} ${SDL2_LIBRARIES})
337373
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${SDL2_INCLUDE_DIRS})
338374

375+
add_subdirectory("third_party/freetype")
376+
target_link_libraries(${EXECUTABLE_NAME} ${FREETYPE_LIBRARIES})
377+
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${FREETYPE_INCLUDE_DIRS})
378+
379+
add_subdirectory("third_party/iconv")
380+
target_link_libraries(${EXECUTABLE_NAME} ${ICONV_LIBRARIES})
381+
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${ICONV_INCLUDE_DIRS})
382+
383+
message(status "${ZLIB_INCLUDE_DIRS}")
384+
message(status "${SDL2_INCLUDE_DIRS}")
385+
message(status "${FREETYPE_INCLUDE_DIRS}")
386+
message(status "${ICONV_INCLUDE_DIRS}")
387+
339388
if(APPLE)
340-
install(TARGETS ${EXECUTABLE_NAME} DESTINATION .)
341-
install(CODE "
342-
include(BundleUtilities)
343-
fixup_bundle(${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app \"\" \"\")
344-
"
345-
COMPONENT Runtime)
389+
if(IOS)
390+
install(TARGETS ${EXECUTABLE_NAME} DESTINATION "Payload")
346391

347-
if (CPACK_BUNDLE_APPLE_CERT_APP)
392+
set(CPACK_GENERATOR "ZIP")
393+
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
394+
set(CPACK_PACKAGE_FILE_NAME "fallout2-ce")
395+
else()
396+
install(TARGETS ${EXECUTABLE_NAME} DESTINATION .)
348397
install(CODE "
349-
execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app)
398+
include(BundleUtilities)
399+
fixup_bundle(${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app \"\" \"\")
350400
"
351401
COMPONENT Runtime)
352-
endif()
353402

354-
set(CPACK_GENERATOR "DragNDrop")
355-
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
356-
set(CPACK_PACKAGE_FILE_NAME "fallout2-ce")
403+
if (CPACK_BUNDLE_APPLE_CERT_APP)
404+
install(CODE "
405+
execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/${MACOSX_BUNDLE_BUNDLE_NAME}.app)
406+
"
407+
COMPONENT Runtime)
408+
endif()
409+
410+
set(CPACK_GENERATOR "DragNDrop")
411+
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
412+
set(CPACK_PACKAGE_FILE_NAME "fallout2-ce")
413+
endif()
357414

358415
include(CPack)
359416
endif()

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ $ sudo apt install libsdl2-2.0-0
114114

115115
- When you run the game for the first time it will immediately present file picker. Select the folder from the first step. Wait until this data is copied. A loading dialog will appear, just wait for about 30 seconds. The game will start automatically.
116116

117+
### iOS
118+
119+
> **NOTE**: See Android note on controls.
120+
121+
- Download `fallout2-ce.ipa`. Use sideloading applications ([AltStore](https://altstore.io/) or [Sideloadly](https://sideloadly.io/)) to install it to your device. Alternatively you can always build from source with your own signing certificate.
122+
123+
- Run the game once. You'll see error message saying "Couldn't find/load text fonts". This step is needed for iOS to expose the game via File Sharing feature.
124+
125+
- Use Finder (macOS Catalina and later) or iTunes (Windows and macOS Mojave or earlier) to copy `master.dat`, `critter.dat`, `patch000.dat`, and `data` folder to "Fallout 2" app ([how-to](https://support.apple.com/HT210598)).
126+
117127
## Contributing
118128

119129
Integrating Sfall goodies is the top priority. Quality of life updates are OK too. Please no large scale refactorings at this time as we need to reconcile changes from Reference Edition, which will make this process slow and error-prone. In any case open up an issue with your suggestion or to notify other people that something is being worked on.

0 commit comments

Comments
 (0)