From 6b4a900af6d8e5994d835c65415022acb10ffe9e Mon Sep 17 00:00:00 2001 From: Hacksawfred3232 Date: Sun, 11 May 2025 12:45:20 +0100 Subject: [PATCH 1/2] Added SRB2Kart --- srb2kart.kvp | 86 ++++++++++++++++++++++++++++++++++++++++ srb2kart_Dockerfile | 47 ++++++++++++++++++++++ srb2kart_config.json | 1 + srb2kart_metaconfig.json | 1 + srb2kart_ports.json | 9 +++++ srb2kart_updates.json | 36 +++++++++++++++++ 6 files changed, 180 insertions(+) create mode 100644 srb2kart.kvp create mode 100644 srb2kart_Dockerfile create mode 100644 srb2kart_config.json create mode 100644 srb2kart_metaconfig.json create mode 100644 srb2kart_ports.json create mode 100644 srb2kart_updates.json diff --git a/srb2kart.kvp b/srb2kart.kvp new file mode 100644 index 000000000..9793db002 --- /dev/null +++ b/srb2kart.kvp @@ -0,0 +1,86 @@ +Meta.DisplayName=SRB2-Kart +Meta.Description=SRB2-Kart Dedicated Server (v1.6) +Meta.Arch=x86_64 +Meta.Author=Hacksawfred3232 +Meta.URL=https://github.com/STJr/Kart-Public +Meta.MinAMPVersion=2.4.6.6 +Meta.SpecificDockerImage=cubecoders/ampbase:deb12-srb2kart +Meta.DockerRequired=True +Meta.ContainerPolicy=RequiredOnLinux +Meta.ContainerPolicyReason=Sonic Team Jr/Kart Krew does not supply native Linux binaries. As such, the game needs to be compiled. +Meta.ExtraSetupStepsURI=https://github.com/Hacksawfred3232/CustAMPTemplates/issues/1 +Meta.Prerequsites=[] +Meta.EndpointURIFormat=steam://connect/{ip}:{GenericModule.App.Ports.$SteamQueryPort} +Meta.ExtraContainerPackages=[] +Meta.AppConfigId=7618c209-1fb4-4207-99bc-5af337ca3254 +App.AdminMethod=STDIO +App.HasReadableConsole=true +App.HasWritableConsole=true +App.DisplayName=SRB2 Kart +App.CommandLineArgs={{$PlatformArgs}} {{$FormattedArgs}} -dedicated -nofork -serverport {{$MainGamePort}} +App.WindowsCommandLineArgs= +App.CommandLineParameterFormat=-{0} "{1}" +App.CommandLineParameterDelimiter= +App.RapidStartup=false +App.ApplicationReadyMode=RegexMatch +App.ExitMethod=OS_CLOSE +App.ExitString=stop +App.ExitTimeout=30 +App.ExitFile=app_exit.lck +App.SupportsLiveSettingsChanges=False +App.LiveSettingChangeCommandFormat=set {0} "{1}" +App.ApplicationIPBinding=0.0.0.0 +App.AdminPortRef=RemoteAdminPort +App.UniversalSleepApplicationUDPPortRef=GamePort1 +App.PrimaryApplicationPortRef=GamePort1 +App.UniversalSleepSteamQueryPortRef=SteamQueryPort +App.MaxUsers=8 +App.UseRandomAdminPassword=True +App.RemoteAdminPassword= +App.AdminLoginTransform=None +App.RCONConnectDelaySeconds=30 +App.RCONConnectRetrySeconds=15 +App.RCONHeartbeatCommand=ping +App.RCONHeartbeatMinutes=0 +App.TelnetLoginFormat={0} +App.SteamUpdateAnonymousLogin=True +App.SteamForceLoginPrompt=False +App.SupportsUniversalSleep=False +App.WakeupMode=Any +App.TemplateMatchRegex={{(\$?[\w]+)}} +App.MonitorChildProcess=False +App.MonitorChildProcessWaitMs=1000 +App.MonitorChildProcessName= +App.Compatibility=1 +App.SteamWorkshopDownloadLocation={{$FullBaseDir}}undefined +Console.FilterMatchRegex= +Console.FilterMatchReplacement= +Console.ThrowawayMessageRegex=(WARNING|ERROR): Shader.+ +Console.UpdateAvailableRegex=^\[\d\d:\d\d:\d\d\] \[INFO\] A new server update is available! v[\d\.]+.$ +Console.SuppressLogAtStart=False +Console.ActivateLogRegex= +Console.UserActions={} +Console.SleepMode=False +Console.SleepOnStart=False +Console.SleepDelayMinutes=5 +Console.DozeDelay=2 +Console.AutoRetryCount=5 +Console.SleepStartThresholdSeconds=25 +Console.AppReadyRegex=^Entering\smain\sgame\sloop\.\.\.$ +Console.UserJoinRegex=^\*(?.+)\shas\s(?:rejoined|joined)\sthe\sgame\s\(player\s(?.+)\)$ +Console.UserLeaveRegex=^\*(?.+)\sleft\sthe\sgame$ +Console.UserChatRegex=^(?:|\[PM\])\<(?.+)\>\s(?.+)$ +Meta.OS=Linux +Meta.ConfigManifest=srb2kart_config.json +Meta.MetaConfigManifest=srb2kart_metaconfig.json +Meta.ConfigRoot=srb2kart.kvp +App.RootDir=./srb2kart/ +Meta.DisplayImageSource=url:https://cdn2.steamgriddb.com/thumb/207aec8c41040e1243e29040c22f8bf0.png +App.BaseDirectory=./srb2kart/ +App.WorkingDir= +App.ExecutableWin= +App.ExecutableLinux=srb2kartlinux.exe +App.LinuxCommandLineArgs= +App.Ports=@IncludeJson[srb2kart_ports.json] +App.UpdateSources=@IncludeJson[srb2kart_updates.json] +App.EnvironmentVariables={"LD_LIBRARY_PATH": "{{$FullBaseDir}}linux64:{{$FullRootDir}}linux64:%LD_LIBRARY_PATH%", "WINEPREFIX": "{{$FullRootDir}}.wine", "WINEARCH": "win64", "WINEDEBUG": "-all"} diff --git a/srb2kart_Dockerfile b/srb2kart_Dockerfile new file mode 100644 index 000000000..71dd1fb9b --- /dev/null +++ b/srb2kart_Dockerfile @@ -0,0 +1,47 @@ +FROM debian:bookworm-20250407 AS build + +# Running upgrade command. +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade + +# Apt-get install all required dependencies to compile this release. +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libgme0 libopenmpt-dev libupnp-dev libupnp13 libcurl4-openssl-dev nasm git wget unzip cmake patch +# Go to root +WORKDIR /root/ +RUN git clone -b "v1.6" https://github.com/STJr/Kart-Public +ENV LIBGME_CFLAGS="" +ENV LIBGME_LDFLAGS="-lgme" +# Need to get data. +RUN wget https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip -O /root/Data.zip +# Unzip and copy needed files. +RUN unzip Data.zip +RUN mkdir /root/Kart-Public/assets/installer +RUN unzip Data.zip -d /root/Kart-Public/assets/installer/ +WORKDIR /root/Kart-Public/ +# Need to apply a patch before we build. Download the patch. +RUN wget https://raw.githubusercontent.com/Hacksawfred3232/CustAMPTemplates/refs/heads/main/extrafiles/SRB2Kart_NoForkPatch.patch +# Apply. +RUN patch -p1 < SRB2Kart_NoForkPatch.patch +RUN mkdir build +WORKDIR /root/Kart-Public/build +# Compile files. +RUN cmake ../ +RUN make -j 4 +# Binary should be compiled now. +# There are still debug symbols on this file. Strip them. +RUN strip --strip-debug bin/srb2kart +# Copy the binary file. +RUN cp bin/srb2kart /root/srb2kart +# This is where the build ends here. + +FROM cubecoders/ampbase:deb12 +# Retarget the above to cubecoders/ampbase:deb12-srb2kart +# Copy from our builder the main file. updates.json will copy this to our working directory. +COPY --from=build /root/srb2kart /srb2kartlinux.exe +# Running upgrade command. +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade +# Shortened version of the list above. +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libgme0 libopenmpt-dev libupnp-dev libupnp13 libcurl4-openssl-dev wget unzip +# Running clean up. +RUN apt-get clean && rm -rf /var/lib/apt/lists/* +# Ensure that WORKDIR is / +WORKDIR / diff --git a/srb2kart_config.json b/srb2kart_config.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/srb2kart_config.json @@ -0,0 +1 @@ +[] diff --git a/srb2kart_metaconfig.json b/srb2kart_metaconfig.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/srb2kart_metaconfig.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/srb2kart_ports.json b/srb2kart_ports.json new file mode 100644 index 000000000..2f07313fa --- /dev/null +++ b/srb2kart_ports.json @@ -0,0 +1,9 @@ +[ + { + "Protocol": "UDP", + "Port": "5029", + "Name": "Main Game Port", + "Description": "Port used for main game traffic", + "Ref": "MainGamePort" + } +] \ No newline at end of file diff --git a/srb2kart_updates.json b/srb2kart_updates.json new file mode 100644 index 000000000..7c829bd1d --- /dev/null +++ b/srb2kart_updates.json @@ -0,0 +1,36 @@ +[ + { + "UpdateStageName": "Fetching Assets", + "UpdateSourcePlatform": "All", + "UpdateSource": "FetchURL", + "UpdateSourceData": "https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip", + "UpdateSourceArgs": "", + "UpdateSourceTarget": "", + "UnzipUpdateSource": true, + "OverwriteExistingFiles": true, + "DeleteAfterExtract": true, + "OneShot": true + }, + { + "UpdateStageName": "Copy linux binary", + "UpdateSourcePlatform": "Linux", + "UpdateSource": "CopyFilePath", + "UpdateSourceData": "./srb2kart/srb2kartlinux.exe", + "UpdateSourceArgs": "/srb2kartlinux.exe", + "UnzipUpdateSource": false, + "OverwriteExistingFiles": false, + "DeleteAfterExtract": true, + "OneShot": true + }, + { + "UpdateStageName": "Make game executable", + "UpdateSourcePlatform": "Linux", + "UpdateSource": "Executable", + "UpdateSourceData": "/usr/bin/chmod", + "UpdateSourceArgs": "+x srb2kart/srb2kartlinux.exe", + "UnzipUpdateSource": false, + "OverwriteExistingFiles": false, + "DeleteAfterExtract": true, + "OneShot": true + } +] From b8aa218b7644541864cf4c92e3fac9884ce9e663 Mon Sep 17 00:00:00 2001 From: Hacksawfred3232 Date: Fri, 30 May 2025 11:43:10 +0100 Subject: [PATCH 2/2] Updated SRB2Kart --- srb2kart.kvp | 2 +- srb2kart_Dockerfile | 47 --------------------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 srb2kart_Dockerfile diff --git a/srb2kart.kvp b/srb2kart.kvp index 9793db002..329c49af0 100644 --- a/srb2kart.kvp +++ b/srb2kart.kvp @@ -4,7 +4,7 @@ Meta.Arch=x86_64 Meta.Author=Hacksawfred3232 Meta.URL=https://github.com/STJr/Kart-Public Meta.MinAMPVersion=2.4.6.6 -Meta.SpecificDockerImage=cubecoders/ampbase:deb12-srb2kart +Meta.SpecificDockerImage=ghcr.io/hacksawfred3232/custampimages/ampcust:srb2kart Meta.DockerRequired=True Meta.ContainerPolicy=RequiredOnLinux Meta.ContainerPolicyReason=Sonic Team Jr/Kart Krew does not supply native Linux binaries. As such, the game needs to be compiled. diff --git a/srb2kart_Dockerfile b/srb2kart_Dockerfile deleted file mode 100644 index 71dd1fb9b..000000000 --- a/srb2kart_Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -FROM debian:bookworm-20250407 AS build - -# Running upgrade command. -RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade - -# Apt-get install all required dependencies to compile this release. -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install build-essential libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libgme0 libopenmpt-dev libupnp-dev libupnp13 libcurl4-openssl-dev nasm git wget unzip cmake patch -# Go to root -WORKDIR /root/ -RUN git clone -b "v1.6" https://github.com/STJr/Kart-Public -ENV LIBGME_CFLAGS="" -ENV LIBGME_LDFLAGS="-lgme" -# Need to get data. -RUN wget https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip -O /root/Data.zip -# Unzip and copy needed files. -RUN unzip Data.zip -RUN mkdir /root/Kart-Public/assets/installer -RUN unzip Data.zip -d /root/Kart-Public/assets/installer/ -WORKDIR /root/Kart-Public/ -# Need to apply a patch before we build. Download the patch. -RUN wget https://raw.githubusercontent.com/Hacksawfred3232/CustAMPTemplates/refs/heads/main/extrafiles/SRB2Kart_NoForkPatch.patch -# Apply. -RUN patch -p1 < SRB2Kart_NoForkPatch.patch -RUN mkdir build -WORKDIR /root/Kart-Public/build -# Compile files. -RUN cmake ../ -RUN make -j 4 -# Binary should be compiled now. -# There are still debug symbols on this file. Strip them. -RUN strip --strip-debug bin/srb2kart -# Copy the binary file. -RUN cp bin/srb2kart /root/srb2kart -# This is where the build ends here. - -FROM cubecoders/ampbase:deb12 -# Retarget the above to cubecoders/ampbase:deb12-srb2kart -# Copy from our builder the main file. updates.json will copy this to our working directory. -COPY --from=build /root/srb2kart /srb2kartlinux.exe -# Running upgrade command. -RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y upgrade -# Shortened version of the list above. -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libgme0 libopenmpt-dev libupnp-dev libupnp13 libcurl4-openssl-dev wget unzip -# Running clean up. -RUN apt-get clean && rm -rf /var/lib/apt/lists/* -# Ensure that WORKDIR is / -WORKDIR /