Skip to content

Commit 051dd6f

Browse files
committed
engine: embed media files
1 parent 83b3585 commit 051dd6f

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,9 @@ if (NOT NACL)
10101010
Tests ${ENGINETESTLIST}
10111011
)
10121012
endif()
1013+
1014+
# Generate media include files.
1015+
daemon_embed_files("EngineMedia" "MEDIA" "BINARY" "engine-lib")
10131016
endif()
10141017

10151018
if (BUILD_CLIENT)
@@ -1039,6 +1042,9 @@ if (BUILD_CLIENT)
10391042

10401043
# Generate GLSL include files.
10411044
daemon_embed_files("EngineShaders" "GLSL" "TEXT" "client-objects")
1045+
1046+
# Generate media include files.
1047+
daemon_embed_files("EngineMedia" "MEDIA" "BINARY" "client-objects")
10421048
endif()
10431049

10441050
if (BUILD_SERVER)

src.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ else()
8686
include (${ENGINE_DIR}/renderer/src.cmake)
8787
endif()
8888

89+
set(MEDIA_EMBED_DIR ${ENGINE_DIR}/media)
90+
set(MEDIA_EMBED_LIST
91+
gfx/2d/bigchars.png
92+
scripts/engine.shader
93+
sound/null.wav
94+
)
95+
8996
set(GLSL_EMBED_DIR "${ENGINE_DIR}/renderer/glsl_source")
9097
set(GLSL_EMBED_LIST
9198
# Common shader libraries
@@ -167,6 +174,8 @@ set(SERVERLIST
167174
)
168175

169176
set(ENGINELIST
177+
${DAEMON_EMBEDDED_DIR}/EngineMedia.cpp
178+
${DAEMON_EMBEDDED_DIR}/EngineMedia.h
170179
${ENGINE_DIR}/framework/Application.cpp
171180
${ENGINE_DIR}/framework/Application.h
172181
${ENGINE_DIR}/framework/ApplicationInternals.h
@@ -271,6 +280,8 @@ set(CLIENTBASELIST
271280
)
272281

273282
set(CLIENTLIST
283+
${DAEMON_EMBEDDED_DIR}/EngineMedia.cpp
284+
${DAEMON_EMBEDDED_DIR}/EngineMedia.h
274285
${ENGINE_DIR}/audio/ALObjects.cpp
275286
${ENGINE_DIR}/audio/ALObjects.h
276287
${ENGINE_DIR}/audio/Audio.cpp
File renamed without changes.
File renamed without changes.

src/engine/qcommon/files.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ along with Daemon Source Code. If not, see <http://www.gnu.org/licenses/>.
2727
#include "qcommon.h"
2828
#include "common/Defs.h"
2929

30+
#if defined(BUILD_GRAPHICAL_CLIENT) || defined(BUILD_TTY_CLIENT)
31+
#include "DaemonEmbeddedFiles/EngineMedia.h"
32+
#endif
33+
3034
extern Log::Logger fsLogs;
3135

3236
// There must be some limit for the APIs in this file since they use 'int' for lengths which can be overflowed by large files.
@@ -667,6 +671,10 @@ void FS_LoadBasePak()
667671
{
668672
FS::AddBuiltinPak("daemon", ENGINE_VERSION, engineBasePak);
669673

674+
#if defined(BUILD_GRAPHICAL_CLIENT) || defined(BUILD_TTY_CLIENT)
675+
FS::AddBuiltinPak("daemon-client", ENGINE_VERSION, EngineMedia::FileMap);
676+
#endif
677+
670678
Cmd::Args extrapaks(fs_extrapaks.Get());
671679
for (auto& x: extrapaks) {
672680
if (!FS_LoadPak(x)) {

0 commit comments

Comments
 (0)