Compare commits
4 Commits
fdf2cffd02
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f4911b448 | |||
| ea006568e2 | |||
| 7d447a558d | |||
| 61eadc821e |
+55
-58
@@ -5,7 +5,17 @@ ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US.UTF-8
|
||||
ENV WINEARCH win64
|
||||
ENV DISPLAY :0
|
||||
ENV WINEPREFIX /root/prefix32
|
||||
ENV AOTDIR "$WINEPREFIX/drive_c/Program Files (x86)/AgeOfTime"
|
||||
ENV RESOLUTION "1024x768x24"
|
||||
ENV AOT_CPU_LIMIT="0"
|
||||
ENV AOT_MINIMIZED="false"
|
||||
ENV AOT_AUTO_RES="true"
|
||||
WORKDIR /root/
|
||||
|
||||
COPY webaudio.js /root/
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && apt-get -y install python2 python-is-python2 xvfb x11vnc xdotool wget tar supervisor net-tools fluxbox gnupg2 && \
|
||||
wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - && \
|
||||
@@ -13,73 +23,60 @@ RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && apt-get -y install \
|
||||
wmctrl \
|
||||
winehq-stable \
|
||||
libgl1:i386 bzip2 \
|
||||
gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-pulseaudio \
|
||||
gstreamer1.0-tools \
|
||||
libglu1-mesa \
|
||||
libgtk2.0-0 \
|
||||
libncursesw5 \
|
||||
libopenal1 \
|
||||
libsdl-image1.2 \
|
||||
libsdl-ttf2.0-0 \
|
||||
libsdl1.2debian \
|
||||
libsndfile1 \
|
||||
# libgl1:i386 bzip2 \
|
||||
# gstreamer1.0-plugins-good \
|
||||
# gstreamer1.0-pulseaudio \
|
||||
# gstreamer1.0-tools \
|
||||
# libglu1-mesa \
|
||||
# libgtk2.0-0 \
|
||||
# libncursesw5 \
|
||||
# libopenal1 \
|
||||
# libsdl-image1.2 \
|
||||
# libsdl-ttf2.0-0 \
|
||||
# libsdl1.2debian \
|
||||
# libsndfile1 \
|
||||
pulseaudio \
|
||||
ucspi-tcp \
|
||||
cpulimit && \
|
||||
mkdir /opt/wine-stable/share/wine/mono && wget -O - https://dl.winehq.org/wine/wine-mono/9.0.0/wine-mono-9.0.0-x86.tar.xz | tar -xJv -C /opt/wine-stable/share/wine/mono && \
|
||||
apt-get -y full-upgrade && apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# the following can be used to skip download and use local file
|
||||
# COPY AgeOfTime-29.exe /root/AgeOfTime-29.exe
|
||||
|
||||
ENV WINEPREFIX /root/prefix32
|
||||
ENV WINEARCH win64
|
||||
ENV DISPLAY :0
|
||||
ENV AOTDIR "$WINEPREFIX/drive_c/Program Files/AgeOfTime"
|
||||
|
||||
RUN wget -P /mono https://dl.winehq.org/wine/wine-mono/9.0.0/wine-mono-9.0.0-x86.msi && \
|
||||
wineboot -f -u && sleep 10 && xvfb-run msiexec /i /mono/wine-mono-9.0.0-x86.msi /quiet
|
||||
# wineboot -u && msiexec /i /opt/wine-stable/share/wine/gecko/wine-gecko-2.47.1-x86.msi && \
|
||||
# rm -rf /mono/wine-mono-4.9.4.msi
|
||||
|
||||
# download and install AgeOfTime
|
||||
RUN cd /root && \
|
||||
# nohup /usr/bin/Xvfb :0 -screen 0 1024x768x24 && sleep 5 && \
|
||||
apt-get -y full-upgrade && apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
||||
# install mono for wine
|
||||
wget -P /mono https://dl.winehq.org/wine/wine-mono/9.0.0/wine-mono-9.0.0-x86.msi && \
|
||||
wineboot -i -f -u && \
|
||||
sleep 10 && \
|
||||
xvfb-run msiexec /i /mono/wine-mono-9.0.0-x86.msi /quiet && \
|
||||
rm -rf /mono/wine-mono-9.0.0-x86.msi && \
|
||||
# done with wine stuff
|
||||
# download and install AgeOfTime
|
||||
cd /root && \
|
||||
wget https://ageoftime.com/files/AgeOfTime-29.exe && \
|
||||
# mkdir -p "$WINEPREFIX/drive_c/Program Files/" && \
|
||||
cd "$WINEPREFIX/drive_c/" && \
|
||||
chmod +x /root/AgeOfTime-29.exe && \
|
||||
xvfb-run wine /root/AgeOfTime-29.exe -s && \
|
||||
rm -f /root/AgeOfTime-29.exe
|
||||
# mv "$WINEPREFIX/drive_c/Program Files/AgeOfTime" "$WINEPREFIX/drive_c/AgeOfTime"
|
||||
|
||||
WORKDIR /root/
|
||||
RUN wget -O - https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -xzv -C /root/ && mv /root/noVNC-1.1.0 /root/novnc && ln -s /root/novnc/vnc_lite.html /root/novnc/index.html && \
|
||||
wget -O - https://github.com/novnc/websockify/archive/v0.9.0.tar.gz | tar -xzv -C /root/ && mv /root/websockify-0.9.0 /root/novnc/utils/websockify
|
||||
|
||||
# lets copy age of time files instead of install
|
||||
# COPY ["AgeOfTime", "$WINEPREFIX/drive_c/Program Files/AgeOfTime"]
|
||||
|
||||
# Force vnc_lite.html to be used for novnc, to avoid having the directory listing page.
|
||||
# Additionally, turn off the control bar. Finally, add a hook to start audio.
|
||||
COPY webaudio.js /root/novnc/core/
|
||||
RUN rm -f /root/novnc/index.html && ln -s /root/novnc/vnc_lite.html /root/novnc/index.html \
|
||||
&& sed -i 's/display:flex/display:none/' /root/novnc/app/styles/base.css \
|
||||
&& sed -i "/import RFB/a \
|
||||
import WebAudio from './core/webaudio.js'" \
|
||||
/root/novnc/vnc_lite.html \
|
||||
&& sed -i "/function connected(e)/a \
|
||||
var wa = new WebAudio('ws://localhost:8081/websockify'); \
|
||||
document.getElementsByTagName('canvas')[0].addEventListener('keydown', e => { wa.start(); });" \
|
||||
/root/novnc/vnc_lite.html
|
||||
rm -f /root/AgeOfTime-29.exe && \
|
||||
# install noVNC \
|
||||
wget -O - https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -xzv -C /root/ && mv /root/noVNC-1.1.0 /root/novnc && ln -s /root/novnc/vnc_lite.html /root/novnc/index.html && \
|
||||
wget -O - https://github.com/novnc/websockify/archive/v0.9.0.tar.gz | tar -xzv -C /root/ && mv /root/websockify-0.9.0 /root/novnc/utils/websockify && \
|
||||
# install noVNC audio patch
|
||||
# Force vnc_lite.html to be used for novnc, to avoid having the directory listing page.
|
||||
# Additionally, turn off the control bar. Finally, add a hook to start audio.
|
||||
mv /root/webaudio.js /root/novnc/core/webaudio.js && \
|
||||
rm -f /root/novnc/index.html && ln -s /root/novnc/vnc_lite.html /root/novnc/index.html && \
|
||||
sed -i 's/display:flex/display:none/' /root/novnc/app/styles/base.css && \
|
||||
sed -i "/import RFB/a \
|
||||
import WebAudio from './core/webaudio.js'" \
|
||||
/root/novnc/vnc_lite.html && \
|
||||
sed -i "/function connected(e)/a \
|
||||
var wa = new WebAudio('ws://localhost:8081/websockify'); \
|
||||
document.getElementsByTagName('canvas')[0].addEventListener('keydown', e => { wa.start(); });" \
|
||||
/root/novnc/vnc_lite.html
|
||||
|
||||
COPY aot-monitor.sh /root/aot-monitor.sh
|
||||
COPY start-aot.sh /root/start-aot.sh
|
||||
COPY start.sh /root/start.sh
|
||||
RUN chmod +x /root/*.sh && \
|
||||
ln -s "$AOTDIR" /root/AgeOfTime
|
||||
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
ADD restart-aot-crash.sh /root/restart-aot-crash.sh
|
||||
ADD start-aot.sh /root/start-aot.sh
|
||||
RUN chmod +x /root/restart-aot-crash.sh && chmod +x /root/start-aot.sh
|
||||
EXPOSE 8080
|
||||
|
||||
USER root
|
||||
CMD ["/usr/bin/supervisord"]
|
||||
CMD ["/root/start.sh"]
|
||||
|
||||
@@ -1,32 +1,64 @@
|
||||
## aot-wine-x11-novnc-docker
|
||||
## aot-wine-x11-novnc-docker Overview
|
||||
|
||||

|
||||

|
||||
|
||||
This docker image will run AgeOfTime game client under wine in an Ubuntu container with a novnc server for you to view the application. Uses supervisor to automatically restart failed processes.
|
||||
This Docker image facilitates running the AgeOfTime game client within an Ubuntu container, utilizing Wine for application compatibility. It includes a noVNC server for browser-based application access, and employs Supervisor for process management to ensure failed processes are automatically restarted.
|
||||
|
||||
Runs a small script in the background that will automatically kill the process if a wine "Program Error" dialog is displayed (since it starts winedbg instead of just quitting).
|
||||
This script also runs cpulimit against the PID of the AgeOfTime.exe process to limit how much CPU it can consume (only if `AOT_CPU_LIMIT` env variable is defined and not zero).
|
||||
**Key Features:**
|
||||
|
||||
This container runs:
|
||||
- **Automated Process Management:** Implements a script designed to automatically terminate the game process upon detection of a Wine "Program Error" dialog. This ensures that in the event of a crash, where Age Of Time might not exit cleanly and thus remain unresponsive, the system intervenes to stop the process, enabling Supervisor to recognize the failure and restart the application as needed.
|
||||
- **CPU Usage Control:** Employs `cpulimit` on the AgeOfTime.exe process based on the `AOT_CPU_LIMIT` environment variable (when defined and non-zero), ensuring efficient CPU resource utilization.
|
||||
|
||||
* Xvfb - X11 in a virtual framebuffer
|
||||
* x11vnc - A VNC server that scrapes the above X11 server
|
||||
* [noNVC](https://kanaka.github.io/noVNC/) - A HTML5 canvas vnc viewer
|
||||
* pulseaudio - Audio server (AOT crashes without proper audio)
|
||||
* audiostream & websockify_audio - these are supposed to pass audio to the VNC web session but currently doesn't work
|
||||
* Fluxbox - a small window manager
|
||||
* AgeOfTime.exe - The game executable
|
||||
**Components:**
|
||||
|
||||
This is a [trusted build](https://registry.hub.docker.com/u/skylord123/aot-wine-x11-novnc-docker/)
|
||||
on the Docker Hub.
|
||||
- **Xvfb:** Provides an X11 server within a virtual framebuffer.
|
||||
- **x11vnc:** A VNC server capturing the X11 server output for remote access.
|
||||
- **[noVNC](https://kanaka.github.io/noVNC/):** A web-based VNC viewer utilizing HTML5 canvas for display.
|
||||
- **PulseAudio:** An audio server to handle game audio requirements. Note: AgeOfTime experiences crashes without proper audio support.
|
||||
- **Audio Streaming (Under Development):** Components like audiostream and websockify_audio aim to forward audio to the VNC web session, though currently non-functional.
|
||||
- **Fluxbox:** A lightweight window manager to manage application windows.
|
||||
- **AgeOfTime.exe:** The game's executable file.
|
||||
- **aot-monitor.sh:** A background script ensuring the game process is terminated upon detecting "Program Error" dialogs. This script also manages the application of `cpulimit` based on the `AOT_CPU_LIMIT` environment variable.
|
||||
|
||||
This Docker image is available as a [trusted build on Docker Hub](https://registry.hub.docker.com/u/skylord123/aot-wine-x11-novnc-docker/), ensuring easy deployment and reliability.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
The container supports several environment variables that you can set to customize its behavior:
|
||||
|
||||
- **`AOT_CPU_LIMIT`**: Specifies the percentage of CPU allowed for the container's use, mimicking the `-l` option of `cpulimit`. Acceptable values are from 1 upwards, typically ranging from 1 to 100, though values can exceed 100 on multi-core CPUs. The default setting is `0`, indicating no specific limit. However, it's recommended to manage CPU access by limiting the number of available CPUs to the container via `docker-compose.yaml` (e.g., to one or two cores) rather than solely relying on this variable. If a value is set, it is recorded in the `AgeOfTime` directory within a file named `aot_cpu_limit`, which is utilized to dynamically control the CPU limit (updated every second).
|
||||
|
||||
- **`RESOLUTION`**: Sets the display resolution for X11 (and Age of Time if `AOT_AUTO_RES` is enabled), with a default value of `1024x768x24`. This impacts the display resolution of both the X11 environment and the Age of Time game when `AOT_AUTO_RES` is set to `true`.
|
||||
|
||||
- **`AOT_AUTO_RES`**: By default set to `true`, this variable ensures that upon container startup, the `baes/client/prefs.cs` file within Age of Time is updated with the resolution specified by the `RESOLUTION` environment variable. It also enables fullscreen mode for the Age of Time game.
|
||||
|
||||
- **`AOT_MINIMIZED`**: With a default value of `false`, setting this variable to `true` will cause the game to start in a minimized state. This action halts rendering processes, thus conserving CPU resources. It achieves this by switching focus to the `AgeOfTime.exe` console window.
|
||||
|
||||
## Run It
|
||||
|
||||
Modify your docker-compose.yml file then:
|
||||
Modify your `docker-compose.yml` file to your liking then:
|
||||
|
||||
docker compose up
|
||||
|
||||
Or using docker run
|
||||
|
||||
docker run \
|
||||
-p 8080:8080 \
|
||||
-e "AOT_CPU_LIMIT=0" \
|
||||
-e "RESOLUTION=640x480x24" \
|
||||
skylord123/aot-wine-x11-novnc-docker
|
||||
|
||||
|
||||
Run with existing AgeOfTime folder (replace `/path/on/host`):
|
||||
|
||||
docker run \
|
||||
-p 8080:8080 \
|
||||
-e "AOT_CPU_LIMIT=0" \
|
||||
-e "RESOLUTION=640x480x24" \
|
||||
--volume "/path/on/host:/root/prefix32/drive_c/Program Files (x86)/AgeOfTime" \
|
||||
skylord123/aot-wine-x11-novnc-docker
|
||||
|
||||
Go to `http://localhost:8080` in your browser and you should see AgeOfTime boot up.
|
||||
|
||||
## Issues
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
# the purpose of this script is to run in the background and check if
|
||||
# winedbg "Program Error" window popped up and if so kill AgeOfTime.exe and winedbg
|
||||
# so supervisor will restart it
|
||||
|
||||
# this file also applies cpulimit to the AgeOfTime.exe process by monitoring
|
||||
# a $CPU_LIMIT_FILE file and applying cpulimit whenever this value changes
|
||||
# if the value changes to zero then the cpulimit process is removed
|
||||
# entirely (or never started if initial value is zero)
|
||||
|
||||
export DISPLAY=":0.0"
|
||||
CPU_LIMIT_FILE="$AOTDIR/aot_cpu_limit"
|
||||
CURRENT_LIMIT=0
|
||||
|
||||
# Initialize the CPU limit file with AOT_CPU_LIMIT if it's set
|
||||
if [ ! -z "$AOT_CPU_LIMIT" ]; then
|
||||
echo "$AOT_CPU_LIMIT" > "$CPU_LIMIT_FILE"
|
||||
fi
|
||||
|
||||
# give the x server time to start
|
||||
sleep 5;
|
||||
|
||||
while true; do
|
||||
AOT_PID=$(pidof AgeOfTime.exe)
|
||||
|
||||
# if "Program Error" dialog found kill aot and winedbg
|
||||
# as supervisor thinks it's still running
|
||||
if wmctrl -l | awk '{$3=""; $2=""; $1=""; print $0}' | grep '^\s*Program Error$'; then
|
||||
kill $AOT_PID
|
||||
kill $(pidof winedbg)
|
||||
sleep 2
|
||||
continue
|
||||
fi
|
||||
|
||||
# wait AgeOfTime.exe is not running
|
||||
if [ -z "$AOT_PID" ]; then
|
||||
CURRENT_LIMIT=0
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
|
||||
# if our $CPU_LIMIT_FILE exists..
|
||||
if [ -f "$CPU_LIMIT_FILE" ]; then
|
||||
NEW_LIMIT=$(cat "$CPU_LIMIT_FILE")
|
||||
|
||||
# Check if cpulimit is not running
|
||||
CPULIMIT_PID=$(pgrep -fl "cpulimit.*\-p $(pidof AgeOfTime.exe)" | awk '{print $1}')
|
||||
if [ -z "$CPULIMIT_PID" ]; then
|
||||
CURRENT_LIMIT=0
|
||||
fi
|
||||
|
||||
# Validate NEW_LIMIT is a number greater than zero
|
||||
if [[ "$NEW_LIMIT" =~ ^[0-9]+$ ]]; then
|
||||
# Check if the limit has changed
|
||||
if [ "$NEW_LIMIT" -ne "$CURRENT_LIMIT" ]; then
|
||||
# If so, update CURRENT_LIMIT
|
||||
CURRENT_LIMIT="$NEW_LIMIT"
|
||||
# Kill existing cpulimit process if any
|
||||
if [ ! -z "$CPULIMIT_PID" ]; then
|
||||
echo "Killing cpulimit process $CPULIMIT_PID"
|
||||
kill "$CPULIMIT_PID"
|
||||
fi
|
||||
# Apply new cpulimit if >= 0
|
||||
if [ ! -z "$AOT_PID" ] && [ "$NEW_LIMIT" -gt 0 ]; then
|
||||
echo "Creating cpulimit process (limit=$NEW_LIMIT)"
|
||||
cpulimit -p "$AOT_PID" -l "$NEW_LIMIT" -b &
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
+21
-8
@@ -4,16 +4,29 @@ services:
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
#
|
||||
# limit cpu usage to 50% of a single core
|
||||
AOT_CPU_LIMIT: 0
|
||||
# sets the resolution of x11
|
||||
# good resolution options:
|
||||
# - 640x480x24
|
||||
# - 1024x768x24
|
||||
RESOLUTION: 640x480x24
|
||||
# game file base/client/prefs.cs gets updated on
|
||||
# container startup by default if you want to disable this
|
||||
# set this to false
|
||||
AOT_AUTO_RES: false
|
||||
# if set to true we will switch away from the game window
|
||||
# which causes AgeOfTime to stop a bunch of rendering steps
|
||||
# saving precious CPU cycles
|
||||
AOT_MINIMIZED: true
|
||||
# uncomment if you want to volume mount AgeOfTime
|
||||
# volumes:
|
||||
# - '/path/on/host/AgeOfTime:/root/prefix32/drive_c/Program Files (x86)/AgeOfTime'
|
||||
deploy:
|
||||
# resources:
|
||||
# limits:
|
||||
# cpus: '0.50'
|
||||
# memory: 512M
|
||||
# reservations:
|
||||
# cpus: '0.25'
|
||||
# memory: 512M
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 1G
|
||||
reservations:
|
||||
cpus: '2'
|
||||
memory: 1G
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
export DISPLAY=":0.0"
|
||||
|
||||
# this script checks for the presence of the wine "Program Error"
|
||||
# dialog and if it is present it kills AgeOfTime and winedbg
|
||||
# which causes supervisor to restart it
|
||||
|
||||
# This script also applies cpu limits if the env variable AOT_CPU_LIMIT is set
|
||||
|
||||
# Check if AOT_CPU_LIMIT is set and not zero
|
||||
if [ -z "$AOT_CPU_LIMIT" ] || [ "$AOT_CPU_LIMIT" -eq 0 ]; then
|
||||
SKIP_CPU_LIMIT=true
|
||||
else
|
||||
SKIP_CPU_LIMIT=false
|
||||
fi
|
||||
|
||||
while true; do
|
||||
if wmctrl -l|awk '{$3=""; $2=""; $1=""; print $0}' | grep '^\s*Program Error$'; then
|
||||
# echo "AOT Program Error detected"
|
||||
kill $(pidof AgeOfTime.exe)
|
||||
kill $(pidof winedbg)
|
||||
elif ! $SKIP_CPU_LIMIT && pidof AgeOfTime.exe >/dev/null; then
|
||||
# AgeOfTime.exe is running
|
||||
# Ensure cpulimit is installed and get the PID of AgeOfTime.exe
|
||||
AOT_PID=$(pidof AgeOfTime.exe)
|
||||
# Check if cpulimit is already running for AgeOfTime.exe to avoid stacking multiple limits
|
||||
if ! pgrep -f "cpulimit.*$AOT_PID" > /dev/null; then
|
||||
# Apply cpulimit to AgeOfTime.exe to limit it to 2 cores and 50% usage
|
||||
# Note: cpulimit doesn't directly support core limitation, so we adjust the overall CPU percentage assuming 2 cores
|
||||
# For more precise control, consider taskset or cgroups
|
||||
cpulimit -p $AOT_PID -l $AOT_CPU_LIMIT
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
done
|
||||
+46
-5
@@ -4,9 +4,50 @@ export DISPLAY=:0
|
||||
export WINEARCH=win64
|
||||
export HOME=/root
|
||||
export LANG=en_US.UTF-8
|
||||
#export WINEDEBUG="+alsa,+pulse,+winealsa,+winepulse,+d3d,+ddraw,+opengl,+winediag",
|
||||
cd "/root/prefix32/drive_c/Program Files (x86)/AgeOfTime"
|
||||
#sleep 5
|
||||
# have to start with wineconsole as wine will cause a crash
|
||||
# for some weird reason. wine works fine outside of supervisor though strangely
|
||||
wineconsole AgeOfTime.exe
|
||||
sleep 5 # give the x server time to start
|
||||
|
||||
# get current active window name
|
||||
# $ xdotool getactivewindow getwindowname
|
||||
|
||||
# set age of time console as active window (reduces CPU usage)
|
||||
# $ xdotool search --name "AgeOfTime.exe" windowactivate
|
||||
|
||||
# set age of time window as active window (more CPU but you can view the game)
|
||||
# $ xdotool search --name "Age Of Time" windowactivate
|
||||
|
||||
# background task to minimize Age Of Time by switching
|
||||
# to the AgeOfTime.exe console window
|
||||
if [ "$AOT_MINIMIZED" == "true" ]; then
|
||||
(
|
||||
while true; do
|
||||
# Check if a window with name "Age Of Time" exists
|
||||
# as the console window spawns first and we want to
|
||||
# switch back to it after the game window starts
|
||||
AGE_OF_TIME_WIN_ID=$(xdotool search --name "Age Of Time")
|
||||
if [ ! -z "$AGE_OF_TIME_WIN_ID" ]; then
|
||||
# Get current active window name
|
||||
ACTIVE_WIN_NAME=$(xdotool getactivewindow getwindowname)
|
||||
|
||||
# If the active window is not AgeOfTime.exe, try to set it to AgeOfTime.exe
|
||||
if [[ "$ACTIVE_WIN_NAME" != *"AgeOfTime.exe"* ]]; then
|
||||
xdotool search --name "AgeOfTime.exe" windowactivate
|
||||
else
|
||||
break # Active window is AgeOfTime.exe, exit the loop
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1 # Wait for a second before checking again
|
||||
done
|
||||
) &
|
||||
|
||||
BG_TASK_PID=$!
|
||||
fi
|
||||
|
||||
# Run AgeOfTime.exe with wineconsole
|
||||
wineconsole AgeOfTime.exe
|
||||
|
||||
# Ensure the background task is stopped when AgeOfTime.exe quits, only if it was started
|
||||
if [ ! -z "$BG_TASK_PID" ] && kill -0 $BG_TASK_PID 2>/dev/null; then
|
||||
kill $BG_TASK_PID
|
||||
fi
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$AOT_AUTO_RES" == "true" ]; then
|
||||
|
||||
# set age of time to use fullscreen
|
||||
sed -i 's/\$pref::Video::fullScreen = "0";/\$pref::Video::fullScreen = "1";/g' /root/AgeOfTime/base/client/prefs.cs
|
||||
|
||||
# Extract the width and height from RESOLUTION env variable
|
||||
WIDTH=$(echo $RESOLUTION | cut -d'x' -f1)
|
||||
HEIGHT=$(echo $RESOLUTION | cut -d'x' -f2)
|
||||
|
||||
# set the resolution to match x11
|
||||
sed -i "s/\$pref::Video::resolution = \".*\";/\$pref::Video::resolution = \"${WIDTH} ${HEIGHT} 32\";/g" /root/AgeOfTime/base/client/prefs.cs
|
||||
|
||||
echo "Updated game resolution to match x11"
|
||||
fi
|
||||
|
||||
/usr/bin/supervisord
|
||||
+36
-25
@@ -2,7 +2,7 @@
|
||||
nodaemon=true
|
||||
|
||||
[program:X11]
|
||||
command=/usr/bin/Xvfb :0 -screen 0 1024x768x24
|
||||
command=/usr/bin/Xvfb :0 -screen 0 %(ENV_RESOLUTION)s
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
@@ -28,28 +28,34 @@ priority=1
|
||||
[program:pulseaudio]
|
||||
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
|
||||
stdout_logfile=/root/pulseaudio.log
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stderr_logfile_maxbytes=1MB
|
||||
redirect_stderr=true
|
||||
priority=1
|
||||
|
||||
[program:audiostream]
|
||||
command=tcpserver localhost 5901 gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
|
||||
stdout_logfile=/root/audiostream.log
|
||||
redirect_stderr=true
|
||||
priority=1
|
||||
; [program:audiostream]
|
||||
; command=tcpserver localhost 5901 gst-launch-1.0 -q pulsesrc server=/tmp/pulseaudio.socket ! audio/x-raw, channels=2, rate=24000 ! cutter ! opusenc ! webmmux ! fdsink fd=1
|
||||
; stdout_logfile=/root/audiostream.log
|
||||
; stdout_logfile_maxbytes=1MB
|
||||
; stderr_logfile_maxbytes=1MB
|
||||
; redirect_stderr=true
|
||||
; priority=1
|
||||
|
||||
[program:websockify_audio]
|
||||
command=websockify 8081 localhost:5901
|
||||
stdout_logfile=/root/websockify-audio.log
|
||||
redirect_stderr=true
|
||||
priority=1
|
||||
; [program:websockify_audio]
|
||||
; command=websockify 8081 localhost:5901
|
||||
; stdout_logfile=/root/websockify-audio.log
|
||||
; stdout_logfile_maxbytes=1MB
|
||||
; stderr_logfile_maxbytes=1MB
|
||||
; redirect_stderr=true
|
||||
; priority=1
|
||||
|
||||
[program:explorer]
|
||||
command=/opt/wine-stable/bin/wine Explorer.exe
|
||||
autorestart=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
priority=1
|
||||
; [program:explorer]
|
||||
; command=/opt/wine-stable/bin/wine Explorer.exe
|
||||
; autorestart=true
|
||||
; stdout_logfile=/dev/fd/1
|
||||
; stdout_logfile_maxbytes=0
|
||||
; redirect_stderr=true
|
||||
; priority=1
|
||||
|
||||
[program:fluxbox]
|
||||
command=/usr/bin/fluxbox
|
||||
@@ -60,31 +66,36 @@ redirect_stderr=true
|
||||
priority=1
|
||||
|
||||
[program:restart-aot-if-crashed]
|
||||
command=/bin/bash -c "/root/restart-aot-crash.sh"
|
||||
command=/bin/bash -c "/root/aot-monitor.sh"
|
||||
umask=0022
|
||||
stderr_logfile = /var/log/supervisor/restart-aot-if-crashed-stderr.log
|
||||
stdout_logfile = /var/log/supervisor/restart-aot-if-crashed-stdout.log
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stderr_logfile_maxbytes=1MB
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
redirect_stderr=true
|
||||
environment=AOT_CPU_LIMIT=%(ENV_AOT_CPU_LIMIT)s
|
||||
environment=
|
||||
AOT_CPU_LIMIT="%(ENV_AOT_CPU_LIMIT)s",
|
||||
AOTDIR="%(ENV_AOTDIR)s"
|
||||
|
||||
[program:ageoftime]
|
||||
command=/root/start-aot.sh
|
||||
umask=0022
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
stderr_logfile = /var/log/supervisor/ageoftime-stderr.log
|
||||
stdout_logfile = /var/log/supervisor/ageoftime-stdout.log
|
||||
stdout_logfile_maxbytes=1MB
|
||||
stderr_logfile_maxbytes=1MB
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
redirect_stderr=true
|
||||
priority=200
|
||||
environment=
|
||||
AOT_MINIMIZED="%(ENV_AOT_MINIMIZED)s",
|
||||
LANGUAGE="en_US.UTF-8",
|
||||
WINEARCH="win32",
|
||||
WINEARCH="win64",
|
||||
HOME="/root",
|
||||
LANG="en_US.UTF-8",
|
||||
WINEPREFIX="/root/prefix32",
|
||||
|
||||
Reference in New Issue
Block a user