Initial commit

This commit is contained in:
liushuyu 2022-08-16 00:47:21 -06:00
commit 5d6ec78868
No known key found for this signature in database
GPG key ID: 23D1CE4534419437
6 changed files with 225 additions and 0 deletions

33
.ci/build.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash -ex
TOPDIR="$(dirname "$0")"
git config user.name "github-actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
git am "$TOPDIR"/../patches/*.patch
CFLAGS="-ftree-vectorize -flto"
if [[ "$(uname -m)" == "aarch64" ]]; then
CFLAGS="$CFLAGS -march=armv8-a+crc+crypto"
elif [[ "$(uname -m)" == "x86_64" ]]; then
# those three of you still using Prescott should just compile this yourselves
CFLAGS="$CFLAGS -march=core2 -mtune=intel"
fi
if [[ "$USE_CCACHE" != '0' ]]; then
echo '[+] Enabled ccache'
ccache -s
export CC='/usr/lib/ccache/gcc'
export CXX='/usr/lib/ccache/g++'
fi
export CFLAGS
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-flto -fuse-linker-plugin -fuse-ld=gold"
# build and install dependencies
"$TOPDIR"/deps.sh
mkdir -p build && cd build
cmake .. -GNinja -DYUZU_TESTS=OFF -DLIBUSB_FOUND=TRUE -DCMAKE_BUILD_TYPE=Release -DENABLE_SDL2=OFF -DENABLE_QT=OFF -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF -DUSE_DISCORD_PRESENCE=OFF
ninja yuzu-room
strip ./bin/yuzu-room

68
.ci/deps.sh Executable file
View file

@ -0,0 +1,68 @@
#!/bin/bash -e
FMT_VERSION="8.1.1"
JSON_VERSION="3.11.2"
ZLIB_VERSION="1.2.12"
ZSTD_VERSION="1.5.2"
LZ4_VERSION="1.9.4"
BOOST_VERSION="1.80.0"
cmake_install() {
cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON "$@"
ninja install
}
# $1: url $2: dir name $3: sha256sum
download_extract() {
local filename
filename="$(basename "$1")"
wget "$1" -O "$filename"
echo "$3 $filename" > "$filename".sha256sum
sha256sum -c "$filename".sha256sum
bsdtar xf "$filename"
pushd "$2"
}
info() {
echo -e "\e[1m--> Downloading and building $1...\e[0m"
}
info "fmt ${FMT_VERSION}"
download_extract "https://github.com/fmtlib/fmt/releases/download/${FMT_VERSION}/fmt-${FMT_VERSION}.zip" "fmt-${FMT_VERSION}" 23778bad8edba12d76e4075da06db591f3b0e3c6c04928ced4a7282ca3400e5d
cmake_install -DFMT_DOC=OFF -DFMT_TEST=OFF
popd
info "nlohmann_json ${JSON_VERSION}"
download_extract "https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/json.tar.xz" json 8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f
cmake_install -DJSON_BuildTests=OFF
popd
info "zlib ${ZLIB_VERSION}"
download_extract "https://github.com/madler/zlib/archive/refs/tags/v${ZLIB_VERSION}.tar.gz" "zlib-${ZLIB_VERSION}" d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932
cmake_install -DCMAKE_POLICY_DEFAULT_CMP0069=NEW
# delete shared libraies as we can't use them in the final image
rm -v /usr/local/lib/libz.so*
popd
info "zstd ${ZSTD_VERSION}"
download_extract "https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz" "zstd-${ZSTD_VERSION}"/build/cmake 7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0
cmake_install -DZSTD_BUILD_PROGRAMS=OFF -DBUILD_TESTING=OFF -GNinja -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF
popd
info "lz4 ${LZ4_VERSION}"
download_extract "https://github.com/lz4/lz4/archive/refs/tags/v${LZ4_VERSION}.tar.gz" "lz4-${LZ4_VERSION}/build/cmake" 0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b
cmake_install -DLZ4_BUILD_CLI=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF
# we need to adjust the exported name of the static library
cat << EOF >> /usr/local/lib/cmake/lz4/lz4Targets.cmake
# Injected commands by yuzu-room builder script
add_library(lz4::lz4 ALIAS LZ4::lz4_static)
EOF
popd
info "boost ${BOOST_VERSION}"
download_extract "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.gz" "boost_${BOOST_VERSION//\./_}" 4b2136f98bdd1f5857f1c3dea9ac2018effe65286cf251534b6ae20cc45e1847
# Boost use its own ad-hoc build system
# we only enable what yuzu needs
./bootstrap.sh --with-libraries=context,container,system,headers
./b2 -j "$(nproc)" install --prefix=/usr/local
popd

20
Dockerfile Normal file
View file

@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1.3
FROM debian:bullseye AS build
ENV DEBIAN_FRONTEND=noninteractive
ARG USE_CCACHE
RUN apt-get update && apt-get -y full-upgrade && \
apt-get install -y build-essential wget git ccache cmake ninja-build libssl-dev pkg-config libarchive-tools
COPY . /root/build-files
RUN --mount=type=cache,id=ccache,target=/root/.ccache \
git clone --depth 1000 --recursive https://github.com/yuzu-emu/yuzu-mainline.git /root/yuzu-mainline && \
cd /root/yuzu-mainline && /root/build-files/.ci/build.sh
FROM gcr.io/distroless/cc-debian11 AS final
LABEL maintainer="yuzuemu"
# Create app directory
WORKDIR /usr/src/app
COPY --from=build /root/yuzu-mainline/build/bin/yuzu-room /usr/src/app
ENTRYPOINT [ "/usr/src/app/yuzu-room" ]

43
README.md Normal file
View file

@ -0,0 +1,43 @@
# yuzu Multiplayer Dedicated Lobby
Quickly stand up new dedicated multiplayer lobbies that will be broadcasted on yuzu.
## Usage
```
sudo docker run -d \
--publish 5000:5000/udp \
yuzuemu/yuzu-multiplayer-dedicated \
--room-name "(COUNTRY) (REGION) - GAME TITLE" \
--preferred-game "GAME TITLE" \
--preferred-game-id "TITLE ID" \
--port 5000 \
--max_members 4 \
--token "YUZU ACCOUNT TOKEN" \
--enable-yuzu-mods \
--web-api-url https://api.yuzu-emu.org/
```
**Please note, the token format has changed as of 11/1/2019.**
**You can retrieve your token from https://profile.yuzu-emu.org/**
Room name should follow the below format.
If multiple servers are stood up, `Server 1`, `Server 2` format should be used.
```
USA East - Super Smash Bros. Ultimate - Server 1
USA East - Super Smash Bros. Ultimate - Server 2
USA East - Mario Kart 8 Deluxe - Server 1
USA East - Mario Kart 8 Deluxe - Server 2
USA East - Splatoon 2 - Server 1
USA East - Splatoon 2 - Server 2
USA East - Pokémon Sword and Shield - Server 1
USA East - Pokémon Sword and Shield - Server 2
USA East - Animal Crossing: New Horizons - Server 1
USA East - Animal Crossing: New Horizons - Server 2
USA East - Pokémon Legends: Arceus
USA East - Pokémon: Lets Go
USA East - Puyo Puyo Tetris
USA East - Super Mario 3D World + Bowser's Fury
USA East - Super Mario Party
USA East - MONSTER HUNTER RISE
```

0
patches/.gitkeep Normal file
View file

View file

@ -0,0 +1,61 @@
From 369a6f8678864a768af9e6a9026a37db0f17d9d4 Mon Sep 17 00:00:00 2001
From: liushuyu <liushuyu011@gmail.com>
Date: Mon, 15 Aug 2022 23:32:31 -0600
Subject: [PATCH] build: bypass extra dependency checks
---
externals/CMakeLists.txt | 2 +-
src/video_core/CMakeLists.txt | 6 +++---
src/video_core/host_shaders/CMakeLists.txt | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 6d04ace1d..85a7bfa54 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -133,7 +133,7 @@ endif()
# FFMpeg
if (YUZU_USE_BUNDLED_FFMPEG)
- add_subdirectory(ffmpeg)
+ #add_subdirectory(ffmpeg)
set(FFmpeg_PATH "${FFmpeg_PATH}" PARENT_SCOPE)
set(FFmpeg_LDFLAGS "${FFmpeg_LDFLAGS}" PARENT_SCOPE)
set(FFmpeg_LIBRARIES "${FFmpeg_LIBRARIES}" PARENT_SCOPE)
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 5b3808351..a58b30298 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -233,9 +233,9 @@ create_target_directory_groups(video_core)
target_link_libraries(video_core PUBLIC common core)
target_link_libraries(video_core PUBLIC glad shader_recompiler xbyak)
-if (YUZU_USE_BUNDLED_FFMPEG AND NOT WIN32)
- add_dependencies(video_core ffmpeg-build)
-endif()
+#if (YUZU_USE_BUNDLED_FFMPEG AND NOT WIN32)
+# add_dependencies(video_core ffmpeg-build)
+#endif()
target_include_directories(video_core PRIVATE ${FFmpeg_INCLUDE_DIR})
target_link_libraries(video_core PRIVATE ${FFmpeg_LIBRARIES})
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index 2149ab93e..96889f00b 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -44,9 +44,9 @@ set(SHADER_FILES
)
find_program(GLSLANGVALIDATOR "glslangValidator")
-if ("${GLSLANGVALIDATOR}" STREQUAL "GLSLANGVALIDATOR-NOTFOUND")
- message(FATAL_ERROR "Required program `glslangValidator` not found.")
-endif()
+#if ("${GLSLANGVALIDATOR}" STREQUAL "GLSLANGVALIDATOR-NOTFOUND")
+# message(FATAL_ERROR "Required program `glslangValidator` not found.")
+#endif()
set(GLSL_FLAGS "")
set(QUIET_FLAG "--quiet")
--
2.37.2