Add toggle for (un)named semaphores and prevent linux header inclusion on non-linux paltforms #986

Merged
AGraber merged 2 commits from nx-upstream into master 4 years ago
AGraber commented 4 years ago (Migrated from github.com)

This adds a compile-time define that decides whether unnamed or named semaphores are used, since some platforms may not support one or the other.

Also prevents a Linux header from being included if we're not building for Linux.

This originally was a PR for the Nintendo Switch port but it's going to take a while, so let's just merge the 2 commits that are ready for now.

Original PR contents (for archival purposes):


This PR will bring Nintendo Switch fork loosely based on the old fork I did a couple months ago.

  • CMake files to use devkitPro's Switch toolchain
  • Fix OpenAL variable clash when linking (#837)
  • Toggle (un)named semaphore usage on CdStreamPosix through macro function (named semaphore returns ENOSYS which means not implemented on the Switch)
  • Check that the CdStreamPosix.cpp threads exit gracefully because you can't kill threads on the switch.
  • Check wav support implementation (since it's using cmake, libsndfile should be easier to compile now and might be used instead of dr_wav on the old fork)
  • Check audio extensions code (some EAX stuff triggers a crash on the openal switch port)
  • Check DIGITALRATE macro for the Switch (on the old fork any value other than 48000 seems to crash)
  • Check/swap X and circle/A and B controller mappings (since A on the switch is where Circle would be, but A is used for confirming rather than cancelling/going back)
  • Check some custom config defines for the switch
  • Check realpath which is apparently missing from the Switch's toolchain (?)
  • Check casepath and path related functions to support switch mounted devices (paths that start with "[something]:/" like "sd:/switch/re3/models/GTA3.IMG")
  • Ignore useless glfw input devices (touchscreen input implemented as "mouse" on glfw, some controller buttons getting passed as "keyboard" at the same time, etc.)
  • Check screen resolution stuff (always has to be either 720p when docked, 1080p when docked)
  • Switch stuff on main glfw seems to handle this for us so no need to do that like on the old fork

Optional but nice-to-haves:

  • Switch button prompts (nxbtns.txd on old fork's release)
  • CPU Boost on loading screens (The switch has a feature which throttles the GPU but boosts the CPU clock up to 1,7GHz, meant for faster loading, actually saves around 3-4 seconds) examples: 1-1 1-2 2-1 2-2
  • GPU throttle on pause menu (same as before but without the CPU boost, good for power saving)
This adds a compile-time define that decides whether unnamed or named semaphores are used, since some platforms may not support one or the other. Also prevents a Linux header from being included if we're not building for Linux. This originally was a PR for the Nintendo Switch port but it's going to take a while, so let's just merge the 2 commits that are ready for now. Original PR contents (for archival purposes): ---- This PR will bring Nintendo Switch fork loosely based on the old fork I did a couple months ago. - [ ] CMake files to use devkitPro's Switch toolchain - [x] Fix OpenAL variable clash when linking (#837) - [x] Toggle (un)named semaphore usage on CdStreamPosix through ~~macro~~ function (named semaphore returns ENOSYS which means not implemented on the Switch) - [ ] Check that the CdStreamPosix.cpp threads exit gracefully because you can't kill threads on the switch. - [ ] Check wav support implementation (since it's using cmake, libsndfile should be easier to compile now and might be used instead of dr_wav on the old fork) - [ ] Check audio extensions code (some EAX stuff triggers a crash on the openal switch port) - [ ] Check `DIGITALRATE` macro for the Switch (on the old fork any value other than 48000 seems to crash) - [ ] Check/swap X and circle/A and B controller mappings (since A on the switch is where Circle would be, but A is used for confirming rather than cancelling/going back) - [ ] Check some custom config defines for the switch - [ ] Check `realpath` which is apparently missing from the Switch's toolchain (?) - [ ] Check casepath and path related functions to support switch mounted devices (paths that start with "[something]:/" like "sd:/switch/re3/models/GTA3.IMG") - [ ] Ignore useless glfw input devices (touchscreen input implemented as "mouse" on glfw, some controller buttons getting passed as "keyboard" at the same time, etc.) - [ ] Check screen resolution stuff (always has to be either 720p when docked, 1080p when docked) - [x] ~~Switch stuff on main~~ glfw seems to handle this for us so no need to do that like on the old fork Optional but nice-to-haves: - [ ] Switch button prompts (nxbtns.txd on old fork's release) - [ ] CPU Boost on loading screens (The switch has a feature which throttles the GPU but boosts the CPU clock up to 1,7GHz, meant for faster loading, actually saves around 3-4 seconds) examples: [1-1](https://github.com/AGraber/re3-nx/blob/e3a17f7fe35a6170eb561a58dc05631d27eb4af0/src/skel/glfw/glfw.cpp#L1556) [1-2](https://github.com/AGraber/re3-nx/blob/e3a17f7fe35a6170eb561a58dc05631d27eb4af0/src/skel/glfw/glfw.cpp#L1888) [2-1](https://github.com/AGraber/re3-nx/blob/e3a17f7fe35a6170eb561a58dc05631d27eb4af0/src/core/Game.cpp#L401) [2-2](https://github.com/AGraber/re3-nx/blob/e3a17f7fe35a6170eb561a58dc05631d27eb4af0/src/core/Game.cpp#L665) - [ ] GPU throttle on pause menu (same as before but without the CPU boost, good for power saving)
AGraber commented 4 years ago (Migrated from github.com)

Regarding pthread_kill usage: I think we should be able to replace it with pthread_cancel without issues, that way we can also get rid of #include <sys/syscall.h>. Thoughts?

Regarding `pthread_kill` usage: I think we should be able to replace it with `pthread_cancel` without issues, that way we can also get rid of `#include <sys/syscall.h>`. Thoughts?
AGraber commented 4 years ago (Migrated from github.com)

syscall.h header was actually used for some stuff under a #ifdef __linux__, so I'll do the same for the inclusion

syscall.h header was actually used for some stuff under a `#ifdef __linux__`, so I'll do the same for the inclusion
AGraber commented 4 years ago (Migrated from github.com)

Undid pthread_kill -> pthread_cancel replacement for now, after some investigation I found out the Switch can't even kill threads, this will be checked later.

Undid pthread_kill -> pthread_cancel replacement for now, after some investigation I found out the Switch can't even kill threads, this will be checked later.
GaryOderNichts commented 4 years ago (Migrated from github.com)

Check audio extensions code (some EAX stuff triggers a crash on the openal switch port)

I also had that issue on the Wii U port.
Loading the function pointers using alGetProcAddress instead of linking against them fixes it.
Since commit 5a1ea7bcf5 they also don't collide anymore.

> Check audio extensions code (some EAX stuff triggers a crash on the openal switch port) I also had that issue on the Wii U port. Loading the function pointers using `alGetProcAddress` instead of linking against them fixes it. Since commit https://github.com/GTAmodding/re3/commit/5a1ea7bcf579b616e349ed651c67e0f988592cbd they also don't collide anymore.
This repo is archived. You cannot comment on pull requests.
Loading…
There is no content yet.