Skip to content

Commit

Permalink
Merge pull request #500 from JeodC/descent3
Browse files Browse the repository at this point in the history
Add new port: Descent 3
  • Loading branch information
Cebion authored Jul 1, 2024
2 parents ab87a22 + ace7d5a commit d587ead
Show file tree
Hide file tree
Showing 34 changed files with 1,183 additions and 0 deletions.
68 changes: 68 additions & 0 deletions ports/descent3/Descent 3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}

if [ -d "/opt/system/Tools/PortMaster/" ]; then
controlfolder="/opt/system/Tools/PortMaster"
elif [ -d "/opt/tools/PortMaster/" ]; then
controlfolder="/opt/tools/PortMaster"
elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then
controlfolder="$XDG_DATA_HOME/PortMaster"
else
controlfolder="/roms/ports/PortMaster"
fi

source $controlfolder/control.txt
source $controlfolder/device_info.txt
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
get_controls

# Variables - Set DEBUGMODE to 1 to use the Debug build
GAMEDIR="/$directory/ports/descent3"
DEVICE_ARCH="${DEVICE_ARCH:-aarch64}"
INIFILE="$GAMEDIR/d3.ini"
REGFILE="$GAMEDIR/config/.Descent3Registry"
DEBUGMODE=0
declare -A key_mapping
declare -A key_types

cd $GAMEDIR

# Setup permissions
$ESUDO chmod 666 /dev/tty1
$ESUDO chmod 666 /dev/uinput
echo "Loading, please wait... (might take a while!)" > /dev/tty0

# Create config dir
rm -rf "$XDG_DATA_HOME/Outrage Entertainment/Descent 3"
ln -s "$GAMEDIR/config" "$XDG_DATA_HOME/Outrage Entertainment/Descent 3"

# Source to parse d3.ini and import its settings
source "$GAMEDIR/config/parseini.txt"

# Delete everything in the cache directory
rm -rf "$GAMEDIR/gamedata/custom/cache/"
mkdir "$GAMEDIR/gamedata/custom/cache/"

# Setup gl4es environment
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 LIBGL_DRIVERS_PATH="$GAMEDIR/gl4es.$DEVICE_ARCH/libGL.so.1"
ARG="-g $LIBGL_DRIVERS_PATH"
fi

export LD_LIBRARY_PATH="$GAMEDIR/libs.$DEVICE_ARCH:/usr/lib:$LD_LIBRARY_PATH"

# Run the game
$GPTOKEYB game -c "config/joy.gptk" &
SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
./game -setdir "$GAMEDIR/gamedata" -pilot Player -nooutragelogo -nomotionblur -logfile $ARG

$ESUDO kill -9 $(pidof gptokeyb)
$ESUDO systemctl restart oga_events &
printf "\033c" >> /dev/tty1
84 changes: 84 additions & 0 deletions ports/descent3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Descent 3 for PortMaster

## Notes
This fork of Descent 3 is tailored to retro handhelds via gl4es and PortMaster. Build instructions can be found at the [fork repository](https://github.com/JeodC/Descent3). The provided binary was built with debia bullseye to support older GLIBC. You can build your own binary with newer GLIBC using bookworm, if your CFW supports it, but performance gain may be minimal.

The following patches have been applied to this release:

- Revert the framebuffer object render code (deviate from upstream), which was necessary to make the game render with gl4es
- Load GL functions after context creation, which allows the custom libGL library to be loaded
- Adjust viewport and scissor to automatically scale properly among various resolutions and aspect ratios
- Add PortMaster branding to title screen to differentiate between upstream and other forked builds
- Make mouse cursor invisible in menus in Release builds (still visible and usable in Debug builds)
- Change level select menu to a listbox with pretty names for core levels
- Add pregenerated `.Descent3Registry` and `Pilot.plt` files with default controls using analog joysticks if available and gptokeyb to emulate keyboard presses for buttons
- Prefill savegame dialog with current level number if blank slot or different level than existing slot
- Reveal secret levels on campaign completion
- Put core campaign missions at the top of the mission list

## Installation
Unzip to ports folder e.g. `/roms/ports/`. Purchase the full game from GOG or Steam, or use CD game data patched to v1.4. Then, add the following files to `descent3/gamedata`:

Filelist for full versions:
├── descent3/gamedata
│ ├── missions/
│ │ └── any mission files (`.mn3`) and `d3voice1.hog` and `d3voice2.hog` if they came with your game
│ ├── movies/
│ │ └── any movie files (`.mve`) that came with your game. If you have the Linux Steam version, use steamcmd to get the windows movie files
│ └── d3.hog
│ └── extra.hog (this may be `merc.hog` depending on the platform you used to purchase the game)
│ └── extra1.hog
│ └── extra13.hog
│ └── ppics.hog

## Configuration
The included pilot file is tailored to retro handhelds with a combination of joystick and gptokeyb controls, since the port does not use `gamecontrollerdb.txt`. The launchscript selects this pilot file by default,
but you can modify the name by opening the file in a text editor.

You can modify game options in `d3.ini` or ingame using buttons--R1 to scroll options, START to confirm.

If you need to invert joystick axis, open `descent3/config/joy.gptk` and change the line `r1_hk = f8` to `r1_hk = /`. Save the file and open the game, and in the config options you can use `HOTKEY + R1` to open the invert dialog. If you don't care about the ship log, you can keep things this way, otherwise change `joy.gptk` again after you're done.

## Multiplayer
You can play multiplayer via PXO. Go to https://pxo.nottheeye.com and register an account, then validate your email. Then, on the account details page, copy your game credentials and paste into `d3.ini`. When you start Descent 3 and try to connect to PXO, your login detals will be filled automatically and you can just press `Start` to log in. Now you can host or join games!

You can also play multiplayer via Direct TCP-IP. In `d3.ini`, specify an IP address to connect to. Then, load your game, choose the Direct TCP-IP multiplayer protocol, and it will be prefilled for you.

## Default Gameplay Controls
You can use the `D-PAD` buttons in menus to select items and scroll pages.

| Button | Action |
|--|--|
|A|Primary Fire|
|B|Use Inventory Item|
|X|Secondary Fire|
|Y|Fire Flare|
|L1|Reverse|
|R1|Scroll Menu Options / Accelerate|
|L2|Scroll Primary Weapon|
|R2|Scroll Secondary Weapon|
|L3|Options Menu|
|R3|Unassigned|
|D-PAD UP|Look Up|
|D-PAD DOWN|Look Down|
|D-PAD LEFT|Turn Left|
|D-PAD RIGHT|Turn Right|
|LEFT ANALOG|Look Around|
|RIGHT ANALOG|Slide Up/Down & Bank Left/Right|
|START|Start / Accept / Enter|
|SELECT|Back / Escape|
|SELECT + Y|Previous Inventory Item|
|SELECT + A|Next Inventory Item|
|SELECT + B|Guidebot Menu|
|SELECT + X|Use Afterburner|
|SELECT + L1|Open Telcom (Briefing and Objectives)|
|SELECT + L2|Load Game|
|SELECT + R1|View Ship Log|
|SELECT + R2|Save Game|

## Thanks
fpasteau
InsanityBringer
Descent Developers Team
Testers and Devs from the PortMaster Discord
Outrage Entertainment
Binary file added ports/descent3/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d587ead

Please sign in to comment.