Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doukutsu-rs updates #1331

Merged
merged 5 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions ports/doukutsu-rs/Doukutsu-rs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,34 @@ cd $GAMEDIR

> "$GAMEDIR/log.txt" && exec > >(tee "$GAMEDIR/log.txt") 2>&1

if [[ -e $GAMEDIR/data ]]; then
echo "Game files found"
else
echo "Game files not found, using Aeon Genesis translation"
unzip cavestoryen.zip
mv CaveStory/* .
rmdir CaveStory
fi

# remove extraneous files
rm -rf Config.dat DoConfig.exe OrgView.exe *.dll

bind_directories ~/.local/share/doukutsu-rs $GAMEDIR/conf

export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"

if [ -f "${controlfolder}/libgl_${CFW_NAME}.txt" ]; then
if [ -f "${controlfolder}/libgl_${CFW_NAME}.txt" ]; then
source "${controlfolder}/libgl_${CFW_NAME}.txt"
else
source "${controlfolder}/libgl_default.txt"
fi

if [ "$LIBGL_FB" != "" ]; then
export SDL_VIDEO_GL_DRIVER="$GAMEDIR/gl4es.aarch64/libGL.so.1"
export SDL_VIDEO_EGL_DRIVER="$GAMEDIR/gl4es.aarch64/libEGL.so.1"
if [ "${CFW_NAME}" != ROCKNIX ] && [ "$LIBGL_FB" != "" ]; then
# GL4ES is not needed on rocknix -- the binary will use OpenGL when
# available (panfrost/adreno) and fall back on GLES for libmali.
# For other platforms, GLES may not work and so GL/gl4es is used
export SDL_VIDEO_GL_DRIVER="$GAMEDIR/gl4es.aarch64/libGL.so.1"
export SDL_VIDEO_EGL_DRIVER="$GAMEDIR/gl4es.aarch64/libEGL.so.1"
fi

$GPTOKEYB "$BINARY" -c "./$BINARY.gptk" &
Expand Down
31 changes: 29 additions & 2 deletions ports/doukutsu-rs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
## Notes
## Installation details

Thanks to Studio Pixel/Nicalis for the wonderful original game and Cave Story+. Thanks to the doukutsu-rs team for the amazing reimplementation.
### Freeware version
If you don't provide any files, the bundled English translation will be installed automatically the first time you run the game.

Alternatively, any of the translations [here](https://www.cavestory.org/download/cave-story.php) should work. Some translations are pre-patched, in which case you simply need to unzip the downloaded files. Other translations require you to patch the original version using a Windows computer. Once you have the unzipped, patched files, copy them so that `data`, `Doukutsu.exe` and surrounding files are in `doukutsu-rs/`.

### Cave Story+ (purchase required)
Any version of Cave Story+ from Steam, GOG or elsewhere should work. From your download, put the `data` folder in `doukutsu-rs`. For example, if you own the game on Steam, you can download the necessary files from the [Steam console](https://steamcommunity.com/sharedfiles/filedetails/?id=873543244) using `download_depot 200900 200905 6949702094591263227`.

## Controls
| Button | Action |
| :------ | :----------------- |
| D-pad | Movement |
| A | Menu select, shoot |
| B | Menu cancel, jump |
| L1 | Previous weapon |
| R1 | Next weapon |
| X | Inventory |
| Y | Map system |
| Hold X | Skip cut-scenes |
| R2 | Strafe |

## Acknowledgements
Thanks to [Studio Pixel](https://studiopixel.jp) and [Nicalis](https://www.nicalis.com) for the wonderful original game and Cave Story+. Thanks to the [doukutsu-rs](https://github.com/doukutsu-rs/doukutsu-rs) team for the amazing reimplementation.

Thanks to ptitSeb for the [gl4es](https://github.com/ptitSeb/gl4es) library.

## Port details
The original code has been modified to use OpenGLES if OpenGL cannot be used, and the controller (rather than keyboard) has been enabled by default.

See [BUILDING.md](https://github.com/PortsMaster/PortMaster-New/blob/main/ports/doukutsu-rs/doukutsu-rs/BUILDING.md) for building instructions.
26 changes: 16 additions & 10 deletions ports/doukutsu-rs/doukutsu-rs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,50 @@ This is a 64-bit ARM build of doukutsu-rs, see:

```
# Ubuntu 20.04 focal aarch64, without the SDL package installed but with its
# dependencies:

# dependencies
# To setup docker image:
cd src
./docker-setup.txt


# In docker image:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
. "$HOME/.cargo/env"

git clone https://github.com/libsdl-org/SDL
cd SDL
git checkout release-2.26.2
./configure --prefix=/usr
make
make install
mkdir build
cd build
cmake ..
make -j8
cmake --install . --prefix /usr

cd ..
cd ../..

git clone https://github.com/libsdl-org/SDL_image.git
cd SDL_image
git checkout release-2.8.3
mkdir build
cd build
cmake ..
make
make -j8
cmake --install . --prefix /usr

cd ../..

git clone https://github.com/doukutsu-rs/doukutsu-rs
cd doukutsu-rs
wget https://raw.githubusercontent.com/PortsMaster/PortMaster-New/refs/heads/main/ports/doukutsu-rs/doukutsu-rs/src/doukutsu-rs.patch
patch -p1 < ./doukutsu-rs.patch
patch -p1 < ../doukutsu.cargo.toml.patch
patch -p1 < ../doukutsu.handheld.patch

cargo build --release

cd ..

# The binary is doukutsu-rs/target/release/doukutsu-rs
# To retrieve it to the host:

docker cp doukutsu-build:/doukutsu-rs/target/release/doukutsu-rs .
docker cp doukutsu-build:/root/doukutsu-rs/target/release/doukutsu-rs .
```
Binary file added ports/doukutsu-rs/doukutsu-rs/cavestoryen.zip
Binary file not shown.
Binary file modified ports/doukutsu-rs/doukutsu-rs/doukutsu-rs
Binary file not shown.
20 changes: 20 additions & 0 deletions ports/doukutsu-rs/doukutsu-rs/licenses/LICENSE.gl4es
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2016-2018 Sebastien Chevalier
Copyright (c) 2013-2016 Ryan Hileman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
31 changes: 14 additions & 17 deletions ports/doukutsu-rs/doukutsu-rs/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,30 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt update

RUN apt install -y --no-install-recommends \
whiptail ca-certificates apt-utils nano wget curl \
lsb-release

# Newer version of gcc
RUN apt install -y --no-install-recommends \
gcc-10 g++-10
sudo whiptail ca-certificates apt-utils nano wget curl

# Install all SDL dependencies, see:
# https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md
# It should be safe to install extra dependencies, only those available
# it should be safe to install extra dependencies, only those available
# will by dynamically loaded on target system
RUN apt install -y build-essential git make \
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev

RUN apt install -y --no-install-recommends \
build-essential git make \
pkg-config cmake ninja-build gnome-desktop-testing \
libasound2-dev libpulse-dev libaudio-dev libjack-dev \
libsndio-dev libx11-dev libxext-dev libxrandr-dev \
libxcursor-dev libxfixes-dev libxi-dev libxss-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev \
libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev \
libibus-1.0-dev libudev-dev fcitx-libs-dev
ccache zip lsb-release imagemagick

# newer version of gcc
RUN apt install -y gcc-10 g++-10

# newer version of cmake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.31.3/cmake-3.31.3-linux-`uname -m`.sh
RUN chmod a+x ./cmake-3.31.3-linux-`uname -m`.sh
RUN ./cmake-3.31.3-linux-`uname -m`.sh --prefix=/usr/local --exclude-subdir --skip-license

# rust/cargo
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y
WORKDIR "/root"

CMD ["bash"]
102 changes: 0 additions & 102 deletions ports/doukutsu-rs/doukutsu-rs/src/doukutsu-rs.patch

This file was deleted.

24 changes: 24 additions & 0 deletions ports/doukutsu-rs/doukutsu-rs/src/doukutsu.cargo.toml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/Cargo.toml b/Cargo.toml
index 250ad93..c9733ef 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -80,8 +80,8 @@ num-traits = "0.2"
open = "3.2"
paste = "1.0"
pelite = { version = ">=0.9.2", default-features = false, features = ["std"] }
-sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["unsafe_textures", "bundled", "static-link"] }
-sdl2-sys = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["bundled", "static-link"] }
+sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["unsafe_textures", "use-pkgconfig"] }
+sdl2-sys = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["use-pkgconfig"] }
rc-box = "1.2.0"
serde = { version = "1", features = ["derive"] }
serde_derive = "1"
@@ -97,7 +97,7 @@ xmltree = "0.10"

#hack to not link SDL_image on Windows(causes a linker error)
[target.'cfg(not(target_os = "windows"))'.dependencies]
-sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["image", "unsafe_textures", "bundled", "static-link"] }
+sdl2 = { git = "https://github.com/doukutsu-rs/rust-sdl2.git", rev = "f2f1e29a416bcc22f2faf411866db2c8d9536308", optional = true, features = ["image", "unsafe_textures", "use-pkgconfig"] }

[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = ["winuser"] }
Loading