diff --git a/Makefile b/Makefile index fe8b3709..1dc0abd2 100644 --- a/Makefile +++ b/Makefile @@ -1093,8 +1093,6 @@ ifeq ($(PLATFORM),emscripten) $(error "No files in '$(BASEGAME)' directory for emscripten to preload.") endif CLIENT_LDFLAGS+=--preload-file $(BASEGAME) - else - CLIENT_EXTRA_FILES+=code/web/client-config.json endif OPTIMIZEVM = -O3 @@ -1230,6 +1228,9 @@ ifeq ($(PLATFORM),emscripten) ifneq ($(BUILD_CLIENT),0) TARGETS += $(B)/$(CLIENTBIN).html + ifneq ($(EMSCRIPTEN_PRELOAD_FILE),1) + TARGETS += $(B)/$(CLIENTBIN)-config.json + endif ifneq ($(USE_RENDERER_DLOPEN),0) GENERATEDTARGETS += $(B)/$(CLIENTBIN).$(ARCH).wasm @@ -3094,6 +3095,10 @@ $(B)/$(CLIENTBIN).html: $(WEBDIR)/client.html $(echo_cmd) "SED $@" $(Q)sed 's/__CLIENTBIN__/$(CLIENTBIN)/g;s/__BASEGAME__/$(BASEGAME)/g;s/__EMSCRIPTEN_PRELOAD_FILE__/$(EMSCRIPTEN_PRELOAD_FILE)/g' < $< > $@ +$(B)/$(CLIENTBIN)-config.json: $(WEBDIR)/client-config.json + $(echo_cmd) "CP $@" + $(Q)cp $< $@ + ############################################################################# # MISC diff --git a/code/web/client.html b/code/web/client.html index a1cf00fa..3a23ab92 100644 --- a/code/web/client.html +++ b/code/web/client.html @@ -20,13 +20,14 @@ let enginePath = './'; // Path or URL containing fs_game directories. let dataPath = './'; // Path or URL for config file that specifies the files to load for each fs_game. -let configFilename = './client-config.json'; +let configFilename = `./${CLIENTBIN}-config.json`; // If displaying the unmodified HTML file, fallback to defaults. if (clientHtmlFallback) { CLIENTBIN='ioquake3'; BASEGAME='baseq3'; EMSCRIPTEN_PRELOAD_FILE=0; + configFilename='./client-config.json'; } if (window.location.protocol === 'file:') throw new Error(`Unfortunately browser security restrictions prevent loading wasm from a file: URL. This file must be loaded from a web server. The easiest way to do this is probably to use Python\'s built-in web server by running \`python3 -m http.server\` in the top level source directory and then navigate to http://localhost:8000/build/debug-emscripten-wasm32/${CLIENTBIN}.html`); @@ -68,7 +69,6 @@ if (clientHtmlFallback) { enginePath = buildPaths[buildIndex]; dataPath = buildPaths[buildIndex]; - configFilename = dataPath + 'client-config.json'; } const dataURL = new URL(dataPath, location.origin + location.pathname);