Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into port-debugger

This commit is contained in:
fgsfds committed 2024-11-29 09:58:11 +01:00
commit 1b803d792f
3 files changed
+52 -16

No files matched your search

+41 -9
View File
@@ -35,9 +35,11 @@ There are minor graphics- and gameplay-related issues, and possibly occasional c
* in practice the game will have issues running faster than ~165 FPS, so use VSync or `Video.FramerateLimit` to cap it.
* emulate the Transfer Pak functionality the game has on the Nintendo 64 to unlock some cheats automatically.
Currently both 32-bit and 64-bit platforms should be supported.
The port is tested on i686 and x86_64, both on Windows and on Linux.
ARM platforms might be supported, but are mostly untested.
**The following platforms are officially supported and tested:**
* Windows 7+: i686, x86_64
* Linux: i686, x86_64
* MacOS: x86_64 (OS 10.9+), arm64 (OS 11.0+)
* Nintendo Switch: arm64
## Download
@@ -66,9 +68,11 @@ If you want to use a PAL or JPN ROM instead, put them into the `data` directory
Optionally, you can also put your Perfect Dark for GameBoy Color ROM named `pd.gbc` in the `data` directory if you want to emulate having the Nintendo 64's Transfer Pak and unlock some cheats automatically.
Optionally, you can move the data folder to `~/.local/share/perfectdark` on Linux or `~/Library/Application Support/perfectdark` on MacOS.
Additional information can be found in the [wiki](https://github.com/fgsfdsfgs/perfect_dark/wiki).
A GPU supporting OpenGL 3.0 or above is required to run the port.
A GPU supporting OpenGL 3.0/ES3.0 or above is required to run the port.
### Installing the Nintendo Switch version
@@ -134,6 +138,32 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
4. Run `cmake --build build -j4`.
5. The resulting executable will be at `build/pd.<arch>` (for example `build/pd.x86_64`).
### MacOS
1. Set up Homebrew.
2. Install dependencies:
* Execute command: `brew install cmake gcc python3 zlib git`
3. Install SDL2:
* Execute commands:
```
wget http://libsdl.org/release/SDL2-2.30.9.dmg -O SDL2.dmg
hdiutil mount SDL2.dmg
sudo cp -vr /Volumes/SDL2/SDL2.framework /Library/Frameworks
hdiutil detach /Volumes/SDL2
```
* This installs SDL2 system-wide and this is how the automatic builds are done. The game will also look for it in the executable path, so you could
download it locally instead.
4. Get the source code:
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
5. Configure:
* Execute command: `cmake -G"Unix Makefiles" -Bbuild -DCMAKE_OSX_ARCHITECTURES=x86_64 .`
* Replace `x86_64` with `arm64` if building for an ARM64 Mac.
* Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.
6. Build:
* Execute command: `cmake --build build --target pd -j4 --clean-first`
7. The resulting executable will be at `build/pd.<arch>` (for example `build/pd.x86_64`).
* You might need to execute `chmod +x build/pd.x86-64` before you can run it.
### Nintendo Switch
1. Set up the [devkitA64 environment](https://devkitpro.org/wiki/Getting_Started).
@@ -149,15 +179,17 @@ Controls can be rebound in `pd.ini`. Default control scheme is as follows:
dkp-pacman -S devkitA64 libnx switch-zlib switch-sdl2 switch-cmake dkp-toolchain-vars
```
* If in MSYS2 or `dkp-pacman` doesn't work, replace it with just `pacman`.
4. Ensure devkitA64 environment variables are set:
4. Get the source code:
`git clone --recursive https://github.com/fgsfdsfgs/perfect_dark.git && cd perfect_dark`
5. Ensure devkitA64 environment variables are set:
* Execute command: `source /opt/devkitpro/switchvars.sh`
* If your `$DEVKITPRO` path is different, substitute that instead or set the variables manually.
5. Configure:
6. Configure:
* Execute command: `aarch64-none-elf-cmake -G"Unix Makefiles" -Bbuild .`
* Add ` -DROMID=pal-final` or ` -DROMID=jpn-final` at the end of the command if you want to build a PAL or JPN executable respectively.
6. Build:
7. Build:
* Execute command: `make -C build -j4`
7. The resulting executable will be at `build/pd.arm64.nro`.
8. The resulting executable will be at `build/pd.arm64.nro`.
### Notes
@@ -165,7 +197,7 @@ Alternate compilers or toolchains can be specified by passing `-DCMAKE_TOOLCHAIN
You will need to provide a `jpn-final` or `pal-final` ROM to run executables built for those regions, named `pd.jpn-final.z64` or `pd.pal-final.z64`.
It might be possible to build and run the game on an ARM/AArch64 platform, but this has not been tested.
It might be possible to build and run the game on platforms that are not specified in the supported platforms list (e.g. Linux on armv7), but this has not been tested.
## Credits
+1 -1
View File
@@ -149,7 +149,7 @@ s32 fsInit(void)
if (portable) {
path = "$E";
} else {
#ifdef PLATFORM_LINUX
#if defined(PLATFORM_LINUX) || defined(PLATFORM_OSX)
// check if there's a config in the working directory, otherwise default to homeDir
if (fsFileSize("./" CONFIG_FNAME) >= 0) {
path = ".";
+10 -6
View File
@@ -2114,14 +2114,18 @@ bool aiIfGunUnclaimed(void)
g_Vars.aioffset += 5;
}
} else {
struct weaponobj *weapon = g_Vars.chrdata->gunprop->weapon;
struct prop *prop = g_Vars.chrdata->gunprop;
if (weapon && weapon->base.prop) {
weapon->base.flags |= OBJFLAG_FORCENOBOUNCE;
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
} else {
g_Vars.aioffset += 5;
if (prop && prop->weapon && prop->parent == NULL && prop->type == PROPTYPE_WEAPON) {
struct weaponobj *weapon = prop->weapon;
if (weapon->base.prop) {
weapon->base.flags |= OBJFLAG_FORCENOBOUNCE;
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]);
return false;
}
}
g_Vars.aioffset += 5;
}
return false;