Skip to content

Conversation

mikusp
Copy link
Contributor

@mikusp mikusp commented May 27, 2025

Needs more testing, I've tried with Ni no Kuni II but it makes no visible difference there.

@squidbus
Copy link
Collaborator

With regards to the CI failures, I believe you should be using std::bit_cast

@Missake212
Copy link
Contributor

Missake212 commented May 27, 2025

Noticed the main menu of God of War 3 Remastered looks a bit different.

Main:
Screenshot 2025-05-27 030617

PR:
Screenshot 2025-05-27 030507

Didn't notice any difference in Killzone Shadowfall and Until Dawn.

@Xcedf
Copy link

Xcedf commented May 27, 2025

Here's GoW3 while shader skipped main
image
and here's PR
image

@georgemoralis
Copy link
Collaborator

which shaders are skipped?

@Xcedf
Copy link

Xcedf commented May 27, 2025

A single shader 0x394ef85fcecf26dd

@mikusp
Copy link
Contributor Author

mikusp commented May 27, 2025

I've added some more logs on debug, would appreciate if you could test with at least Render.Vulkan:Debug log level and attach the log 🥇

@Missake212
Copy link
Contributor

Killzone Shadowfall:
CUSA00002.log

God of War 3 Remastered:
CUSA01715.zip

Until Dawn (main):
CUSA02636.log

Until Dawn (using PR 2991 and this one):
CUSA02636.zip

@Xcedf
Copy link

Xcedf commented May 28, 2025

Full black Kratos on latest one
image
can't tell for sure, it all seems connected, but checked per commit,and it started with StartPredication() implementation

@mikusp
Copy link
Contributor Author

mikusp commented May 28, 2025

GoW III seems to actually use the predicated packet bit 😮 I think it might've overflowed the number of occlusion queries running and get the wrong value, I've resized the buffer to 256, hope it is enough. A bit under 200 different addresses were used in that log for predication results

@Missake212
Copy link
Contributor

New tests:

Killzone Shadowfall:
CUSA00002.log

GOW 3 Remastered:
CUSA01715.zip

Until Dawn:
CUSA02636.log

Until Dawn with PR 2991:
CUSA02636.zip

@Xcedf
Copy link

Xcedf commented May 29, 2025

256 vs 16, in menu no difference, Kratos still black, but different ingame
256:
image
16:
image

ryzendew added a commit to ryzendew/shadPS4 that referenced this pull request Jun 1, 2025
georgemoralis and others added 3 commits June 3, 2025 19:39
* implemented sceNetInetNtop in RE

* some logging

* added freebsd_inet_ntop4

* freebsd_inet_ntop6

* fixups based on reviews

* review fixes
* impl

* more

* move log

* cleanup type definitions

* error code cleanup and clang

* cleanup ugly RE code

* shame

* clang

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
* New translations en_us.ts (Spanish)

* New translations en_us.ts (Spanish)

* New translations en_us.ts (Turkish)
StevenMiller123 and others added 17 commits June 3, 2025 19:39
* Only perform GPU memory mapping when GPU can access it

This better aligns with hardware observations, and should also speed up unmaps and decommits, since they don't need to be compared with the GPU max address anymore.

* Reserve fixes

ReserveVirtualRange seems to follow the 0x200000000 base address like MemoryPoolReserve does.
Both also need checks in their flags Fixed path to ensure we're mapping in-bounds. If we're not in mapping to our address space, we'll end up reserving and returning the wrong address, which could lead to weird memory issues in games.

I'll need to test on real hardware to verify if such changes are appropriate.

* Better sceKernelMmap

Handles errors where we would previously throw exceptions. Also moves the file logic to MapFile, since that way all the possible errors are in one place.
Also fixes some function parameters to align with our current standards.

* Major refactor

MapDirectMemory, MapFlexibleMemory, ReserveVirtualRange, and MemoryPoolReserve all internally use mmap to perform their mappings. Naturally, this means that all functions have similar behaviors, and a lot of duplicate code.
This add necessary conditional behavior to MapMemory so MemoryPoolReserve and ReserveVirtualRange can use it, without disrupting the behavior of MapDirectMemory or MapFlexibleMemory calls.

* Accurate phys_addr for non-direct mappings

* Properly handle GPU access rights

Since my first commit restricts GPU mappings to memory areas with GPU access permissions, we also need to be updating the GPU mappings appropriately during Protect calls too.

* Update memory.cpp

* Update memory.h

* Update memory.cpp

* Update memory.cpp

* Update memory.cpp

* Revert "Update memory.cpp"

This reverts commit 2c55d01.

* Coalesce dmem map

Aligns with hardware observations, hopefully shouldn't break anything since nothing should change hardware-wise when release dmem calls and unmap calls are performed?
Either that or Windows breaks because Windows, will need to test.

* Implement posix_mprotect

Unity calls this
Also fixes the names of sceKernelMprotect and sceKernelMtypeprotect, though that's more of a style change and can be reverted if requested.

* Fix sceKernelSetVirtualRangeName

Partially addresses a "regression" introduced when I fixed up some asserts.
As noted in the code, this implementation is still slightly inaccurate, as handling this properly could cause regressions on Windows.

* Unconditional assert in MapFile

* Remove protect warning

This is expected behavior, shouldn't need any logging.

* Respect alignment

Forgot to properly do this when updating ReserveVirtualRange and MemoryPoolReserve

* Fix Mprotect on free memory

On real hardware, this just does nothing. If something did get protected, there's no way to query that information.
Therefore, it seems pretty safe to just behave like munmap and return size here.

* Minor tidy-up

No functional difference, but looks better.
Something's wrong somewhere, and there's just too many places that somewhere could be for me to debug it right now.
* Change touchpad handling and orientation calculation

* remove unnecessary includes in pad.cpp

* remove the cmake command arguments

* remove the weird file

* try to fix formatting

* limit new gyro and touchpad logic to controller 1

* remove cout

* fix formatting and add the handle check to scePadRead

* swap y and z back
* voice lib stubs

Primarily for GTA V

* Clang
This time, perform it after the LoadSharedLibraries call, which places it after the various init memory mappings GFD engine titles perform.
* Network Play: set user signed in

* get signedIn status from config

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
* Swap do-while to while

If we use a do-while loop, we waste time if `aligned_size = 0`.  This is also still accurate to FreeBSD behavior, where it returns success if `start == end` during mprotect.
This also effectively prevents the memory assert seen in updated versions of RESIDENT EVIL 2 (CUSA09193)

* Move prot validation outside loop

The prot variable shouldn't change during a mprotect call, so we can check the flags before protecting instead.
Also cleans up the code for prot validation.
This should improve performance, and is more accurate to FreeBSD code.

* Add logging for protect calls

This will help in debugging future problems
Propablly missing because of fedora 42?
* posix_pthread_attr_getschedparam

* Fixes for scePthreadGetAffinity and scePthreadSetAffinity

Looking at FreeBSD source, and our other pthread functions, we should be using our FindThread function to get the appropriate thread if thread != g_curthread.
@mikusp
Copy link
Contributor Author

mikusp commented Jun 3, 2025

I've pushed a small change, please test with GoW III if graphics are better

@Xcedf
Copy link

Xcedf commented Jun 3, 2025

Tried mostly the same, ingame's the same
image

@georgemoralis
Copy link
Collaborator

this pr needs to be rebased manually

@mikusp
Copy link
Contributor Author

mikusp commented Jun 16, 2025

It has rot a bit and I have no ideas how to fix those issues reported so I think it can be closed for the time being

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.