mirror of https://github.com/sm64pc/sm64pc.git
new Dockerfile, new build arguments for default screen dimensions
This commit is contained in:
parent
951389ca84
commit
70fd996383
34
Dockerfile
34
Dockerfile
|
@ -7,7 +7,9 @@ RUN apt-get update && \
|
||||||
git \
|
git \
|
||||||
libglew-dev \
|
libglew-dev \
|
||||||
libsdl2-dev \
|
libsdl2-dev \
|
||||||
python3
|
python3 \
|
||||||
|
python-is-python3
|
||||||
|
|
||||||
|
|
||||||
RUN mkdir /sm64ex
|
RUN mkdir /sm64ex
|
||||||
WORKDIR /sm64ex
|
WORKDIR /sm64ex
|
||||||
|
@ -15,3 +17,33 @@ ENV PATH="/sm64ex/tools:${PATH}"
|
||||||
|
|
||||||
CMD echo 'Usage: docker run --rm -v ${PWD}:/sm64ex sm64ex make BETTERCAMERA=1 EXTERNAL_DATA=1 -j4\n' \
|
CMD echo 'Usage: docker run --rm -v ${PWD}:/sm64ex sm64ex make BETTERCAMERA=1 EXTERNAL_DATA=1 -j4\n' \
|
||||||
'See https://github.com/sm64pc/sm64ex/wiki/Compiling-on-Docker for more information'
|
'See https://github.com/sm64pc/sm64ex/wiki/Compiling-on-Docker for more information'
|
||||||
|
|
||||||
|
FROM build AS web
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
RUN git clone https://github.com/emscripten-core/emsdk.git
|
||||||
|
|
||||||
|
RUN /emsdk/emsdk install 1.39.5
|
||||||
|
RUN /emsdk/emsdk activate 1.39.5
|
||||||
|
|
||||||
|
# normally you'd run 'source $EMSDK/emsdk_env.sh' to load the emsdk environment
|
||||||
|
# both Dockerfile and Makefile run each process in a separate subshell so I don't think something like
|
||||||
|
# RUN . /emsdk/emsdk_env.sh
|
||||||
|
# will work, nor would doing the same within the Makefile
|
||||||
|
# wouldn't be an issue on a bare metal build as the user would have already sourced the file per emsdk docs
|
||||||
|
# also, the env script only works in bash, not sh, and I'm not sure about changing shells in Docker
|
||||||
|
# versions are pinned, so we can live with it, I guess. node version will change if emsdk is updated
|
||||||
|
# run
|
||||||
|
# docker run --rm sm64ex bash -c '. /emsdk/emsdk_env.sh'
|
||||||
|
# to print the emsdk environment after a version change
|
||||||
|
ENV EMSDK="/emsdk"
|
||||||
|
ENV EM_CACHE="/emsdk/upstream/emscripten/cache"
|
||||||
|
ENV EM_CONFIG="/emsdk/.emscripten"
|
||||||
|
ENV EMSDK_NODE="/emsdk/node/16.20.0_64bit/bin/node"
|
||||||
|
ENV PATH="${EMSDK}:${EMSDK_NODE}:${EMSDK}/upstream/emscripten:${PATH}"
|
||||||
|
|
||||||
|
WORKDIR /sm64ex
|
||||||
|
|
||||||
|
CMD echo 'Usage: docker run --rm -v ${PWD}:/sm64ex sm64ex make BETTERCAMERA=1 EXTERNAL_DATA=1 -j4\n' \
|
||||||
|
'See https://github.com/sm64pc/sm64ex/wiki/Compiling-on-Docker for more information'
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -77,6 +77,10 @@ BASEPACK ?= base.zip
|
||||||
|
|
||||||
WINDOWS_BUILD ?= 0
|
WINDOWS_BUILD ?= 0
|
||||||
|
|
||||||
|
# default screen size
|
||||||
|
WINDOW_WIDTH ?= 640
|
||||||
|
WINDOW_HEIGHT ?= 480
|
||||||
|
|
||||||
# Attempt to detect OS
|
# Attempt to detect OS
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
|
@ -227,6 +231,8 @@ COMPARE := 0
|
||||||
|
|
||||||
ifeq ($(TARGET_WEB),1)
|
ifeq ($(TARGET_WEB),1)
|
||||||
VERSION_CFLAGS := $(VERSION_CFLAGS) -DTARGET_WEB -DUSE_GLES
|
VERSION_CFLAGS := $(VERSION_CFLAGS) -DTARGET_WEB -DUSE_GLES
|
||||||
|
VERSION_CFLAGS += -DWINDOW_WIDTH=$(WINDOW_WIDTH)
|
||||||
|
VERSION_CFLAGS += -DWINDOW_HEIGHT=$(WINDOW_HEIGHT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Check backends
|
# Check backends
|
||||||
|
|
34
README.md
34
README.md
|
@ -1,3 +1,37 @@
|
||||||
|
# sm64ex-web
|
||||||
|
|
||||||
|
Modifications to original project Dockerfile to build the emscripten web version of sm64ex
|
||||||
|
|
||||||
|
You can probably do this on bare metal by installing emsdk version 1.39.5 along with all normal sm64ex dependencies, but easier to use docker
|
||||||
|
|
||||||
|
Instructions:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/queenkjuul/sm64ex-web.git
|
||||||
|
cd sm64ex-web
|
||||||
|
cp /path/to/your/baserom.us.z64 .
|
||||||
|
docker build . -t sm64ex --target web
|
||||||
|
docker run --rm -v $(pwd):/sm64ex sm64ex make TARGET_WEB=1 -j$(nproc)
|
||||||
|
docker run --rm -v $(pwd):/sm64ex sm64ex make TARGET_WEB=1 -j$(nproc)
|
||||||
|
```
|
||||||
|
|
||||||
|
Yes, that one command is run twice. No idea why that is necessary, but it is.
|
||||||
|
|
||||||
|
After successful build, you can easily test if you have Node installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd build/us_web
|
||||||
|
npx http-server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional features
|
||||||
|
|
||||||
|
I can't get fullscreen working, or real time canvas resizing, but I did add build flags that let you specify the width and height:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run --rm -v $(pwd):/sm64ex sm64ex make TARGET_WEB=1 WINDOW_WIDTH=1280 WINDOW_HEIGHT=720 -j$(nproc)
|
||||||
|
```
|
||||||
|
|
||||||
# sm64ex
|
# sm64ex
|
||||||
Fork of [sm64-port/sm64-port](https://github.com/sm64-port/sm64-port) with additional features.
|
Fork of [sm64-port/sm64-port](https://github.com/sm64-port/sm64-port) with additional features.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
#ifndef GFX_SCREEN_CONFIG_H
|
#ifndef GFX_SCREEN_CONFIG_H
|
||||||
#define GFX_SCREEN_CONFIG_H
|
#define GFX_SCREEN_CONFIG_H
|
||||||
|
|
||||||
|
#ifdef WINDOW_WIDTH
|
||||||
|
#define DESIRED_SCREEN_WIDTH WINDOW_WIDTH
|
||||||
|
#else
|
||||||
#define DESIRED_SCREEN_WIDTH 640
|
#define DESIRED_SCREEN_WIDTH 640
|
||||||
#define DESIRED_SCREEN_HEIGHT 480
|
#endif
|
||||||
|
|
||||||
|
#ifdef WINDOW_HEIGHT
|
||||||
|
#define DESIRED_SCREEN_HEIGHT WINDOW_HEIGHT
|
||||||
|
#else
|
||||||
|
#define DESIRED_SCREEN_HEIGHT 480
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue