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

TLS Malloc Fixes #1073

Closed

Conversation

StevenMiller123
Copy link
Contributor

@StevenMiller123 StevenMiller123 commented Sep 25, 2024

In games like Attack on Titan 2, the current heap API implementation can cause issues specific to Linux. By disabling the heap API malloc calls, like we do on Windows, these games can progress further. If you're in the shadPS4 discord, this message will provide more context: https://discordapp.com/channels/1080089157554155590/1258386683691274361/1288493573200810005

Also fixes a minor oversight in the Windows TLS code, where no malloc calls were made if there was no heap_api provided by the game. This appears to fix inconsistent crashes when testing Uncharted 4 on Windows.

@StevenMiller123
Copy link
Contributor Author

StevenMiller123 commented Sep 25, 2024

So Mac doesn't like printing a pthread? Is there any better way to identify the thread that would work on all OSes? For now I've disabled printing the thread id. I will update the pr (and fix clang format) when I know of a better solution.

@StevenMiller123 StevenMiller123 marked this pull request as draft September 25, 2024 20:14
@StevenMiller123
Copy link
Contributor Author

Swapped to draft, as I need to revert this change for Mac specifically, as the game this issue occurs in cannot be tested on Mac yet. I will update this when I have the chance.

Disables heap malloc calls on Linux, as there are games where the heap malloc causes a crash.  Note that the assert had to be modified, as pthread_gethandle is a winpthreads specific method.

Also fixes a minor oversight that caused games not to perform TLS mallocs on Windows when there was no heap api.
@StevenMiller123 StevenMiller123 changed the title Disable heap malloc on remaining operating systems Disable heap malloc on Linux Sep 25, 2024
@StevenMiller123 StevenMiller123 marked this pull request as ready for review September 25, 2024 21:03
@StevenMiller123
Copy link
Contributor Author

Should be ready for testing now.

@StevenMiller123 StevenMiller123 changed the title Disable heap malloc on Linux TLS Malloc Fixes Sep 28, 2024
@camdrit
Copy link

camdrit commented Oct 17, 2024

Tried this on Linux with BloodBorne. No notable change in behavior either for good or bad. Still hangs in Kernel same as main branch so I'm not sure how useful of a test this is, but the output is attached. Have yet to dump other games from my system so I haven't tried other games.

shadps4-output.txt

@StevenMiller123
Copy link
Contributor Author

@camdrit Thanks for the test. This PR isn't expected to help Bloodborne, as that game needs work on pthreads to progress further on Linux. If you do end up dumping any other games, feel free to test those.

@StevenMiller123
Copy link
Contributor Author

I'm closing this PR, as #1440 better resolves the issues this PR was designed to fix.

@StevenMiller123 StevenMiller123 deleted the disable-heap-malloc branch October 23, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants