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

Draft: Added threading to AJM #1460

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

vladmikhalin
Copy link
Collaborator

Very dirty code, needs a LOT of work.

@georgemoralis
Copy link
Collaborator

hint: try it on your own risk

@rafael-57
Copy link

for Bloodborne both main menu OST and menu sound effects play very consistently with this, but after going ingame and transforming weapon it crashes instantly, for some reason without an assert

it can also hang randomly during ingame load, not sure if related to these changes

@GHU7924
Copy link

GHU7924 commented Oct 29, 2024

Build e7d9c5c

My run was about 2 minutes, then a crash.

shad_log.txt

Edit: I will add

2024-10-29.23-47-22.mp4

shad_log.txt

src/core/libraries/ajm/ajm.cpp Outdated Show resolved Hide resolved
src/core/libraries/ajm/ajm_instance.h Outdated Show resolved Hide resolved
src/core/libraries/ajm/ajm.cpp Outdated Show resolved Hide resolved
@vladmikhalin vladmikhalin marked this pull request as draft October 30, 2024 06:51
@vladmikhalin vladmikhalin changed the title Added threading to AJM Draft: Added threading to AJM Oct 30, 2024
@GHU7924
Copy link

GHU7924 commented Oct 30, 2024

I tried to play a few more times, but I can't pass the "ascend ladder" moment, somewhere in the middle of this ladder there is always a crash. Sometimes I manage to hear the cry of a Cleric Beast, and sometimes I don't.

And it seems that for the first time I had an error:

[Debug] ajm_at9.cpp:operator():70: Assertion Failed!

shad_log.txt

@smiRaphi
Copy link

Tried it with Persona 3 Dancing Moonlight and the dlc confermation dialog now has sound :D but it crashes at the title screen with

[Debug] <Critical> ajm_at9.cpp:operator():92: Assertion Failed!
Atrac9Decode failed ret = 0x82100007

@vladmikhalin
Copy link
Collaborator Author

Fixed one reason of crashes try again.

@squidbus
Copy link
Contributor

Not sure if it was expected to be fixed or not but the Persona 3 Dancing crash is still the same.

@GHU7924
Copy link

GHU7924 commented Oct 30, 2024

Build a548249

"Ascend ladder" moment - FIXED, done.

BB_Test.mp4

Then I activated the lamp, but I couldn't get into Hunter's Dream, there was no crash, but it was as if everything went into an endless loop, the loading of the location hung, but shad_log continued, I waited about a minute and closed the emulator.

Shad_log size 100 MB (therefore, I will not attach the file), but it seems like these lines were repeated

[Lib.Ajm] ajm.cpp:sceAjmBatchStartBuffer:432: called context = 1, batch_size = 0x50, priority = 10
[Lib.Ajm] ajm.cpp:sceAjmBatchWait:610: called context = 1, batch_id = 0, timeout = 4294967295

rafael-57
but after going ingame and transforming weapon it crashes instantly, for some reason without an assert

I couldn't test this before, but in this build, I personally don't have a crash.

2024-10-30.22-29-25.mp4

And another such moment:

BB

Other games have music here, but Bloodborne doesn't, I don't know if it should be like that.

Later, I will test this build again, if there is anything else, I will write.

@AwesomeSoftware79
Copy link

AwesomeSoftware79 commented Oct 31, 2024

Build tested: a8f0da6.
CPU: Ryzen 9 7950x, Memory: DDR5 96 GB RAM, GPU: RTX 3090

BB-Patches: Skip Intro, Disable Chromatic Ab, Disable Motion Blur, 60 FPS (with Delta time), Disable vsync

In general, I would say that when it works, it just works fine. I got a couple of crashes, specially when returning to Hunter's dream and once whilst getting ambushed, when that happens it seems like there are some thread deadlocks (console spamming i.e. sceAjmBatchWait).

Some people said that this AJM Branch does not work with the 60 FPS patch applied, but my experience has been quite good. I do not see much of a difference between both 30 FPS and 60 FPS.
I tried to switch audio languages (i.e. English => Spanish) and it just works fine, i.e. NPC audio voiceovers match their configuration.

The biggest problem was with Cleric Beast's BGM, either starts looping like a broken record at some point, or does not play at all. Reloading or repeating this fight does NOT solve this problem.
Father Gascoine's fight on the other hand does present this problem. Father Gascoine's BGM changes successfully in the fight's second phase, i.e. using the Tiny Music Box three times during the fight. Gascoine's second phase BGM sounds like this.
Blood-Starved Beast loads its BGM just fine.
Audio balance between sound effects and BGM is a bit extreme. Sounds effects are quite loud and bosses' BGM is quite soft/quiet. But it could be also a problem with my audio setup.

Apart from that, at first glance I am not missing any other regular sounds.
When a issue with sound arises (apart from Cleric Beast's BGM), either reloading the save file or restarting the emulator solves the problem.

@GHU7924
Copy link

GHU7924 commented Oct 31, 2024

Build a8f0da6

The first lighting of the lamp and the subsequent transfer to the Hunter's Dream did not work again, it loops (freezes) during the download. (There is a similar hanging moment in one of the videos below)
If you restart the emulator, you can already get into the Hunter's Dream, but what prevents you from doing it for the first time, I can't say.

In the Hunter's Dream, Herman's lines worked fine,
I also knocked on the doors (4 doors in the initial location), everything is fine there, the replicas worked fine,
but for some reason Gilbert does not work properly:

Gil3.mp4

Then there was this:

Gilbert444.mp4

The loading stopped, but the emulator continued to work.

Restarted the emulator.

2024-10-31.13-01-56.mp4

Next

2024-10-31.13-05-59.mp4

Next is a large gate, through which Huntsman's Minion breaks.
The sound of the gate is there, but his screams are not. (Maybe that's how it should be, I'm not sure)
But if you go a little further, you can hear the screams, but after that I had a sound loop.

Gate.mp4
2024-10-31.13-25-47.mp4

Then there was a moment when, right during the battle, the sound abruptly disappeared.
Unfortunately, I didn't record it down.

Next

House.mp4
House2.mp4

Perhaps something in the house affects this area, for example, an NPC, because once there was a freeze, and another time the sound disappeared.

Then I attach screenshots of the log. I don't know if they are all related to these PR or not:

Ajm
Ajm2
Ajm3
Kernel
Kernel2

In the log, it happened that the "AJM-log" simply stopped and only the "Kernel-log" continued.

I played for about an hour, I didn't visit the bosses.
That's all for now.

@GHU7924
Copy link

GHU7924 commented Oct 31, 2024

Before Cleric Beast (There is some kind of noise)

2024-10-31.17-19-05.mp4

Cleric Beast (The noise remains, the musical theme is missing)

Cleric.Beast.mp4

Father Gascoigne (Everything seems to be in order here)

Father.Gascoigne.mp4

Father Gascoigne's daughter, The Doll, Eileen the Crow, Gehrman, The First Hunter - their lines were playing normally.

I went to Gilbert's house again to take the flamesprayer from him after defeating the Cleric Beast.

Gilbert.4.mp4

Chapel Samaritan in Cathedral Ward also broken:

Chapel.Samaritan.mp4

I didn't play anymore.

@georgemoralis georgemoralis marked this pull request as ready for review November 1, 2024 12:30
@georgemoralis georgemoralis merged commit 5f5328f into shadps4-emu:ajm Nov 1, 2024
10 checks passed
vladmikhalin added a commit that referenced this pull request Nov 1, 2024
@vladmikhalin vladmikhalin deleted the ajm-threading branch November 2, 2024 10:40
@GHU7924 GHU7924 mentioned this pull request Nov 3, 2024
georgemoralis added a commit that referenced this pull request Nov 5, 2024
* ajm: Initial ajm implementation

* AJM code improvements (#1453)

* Fix sideband buffer order (#1454)

* ajm: Attempt to add gapless support

* ajm_at9: Return superframes decoded in a single job

* WIP (#1460)

* Fix gapless decode and combine split buffers

* Fixed linux build

* fix number of samples reported with gapless decoding

* fixed number of remaining samples calculation

should fix the small crackling sounds that play every now and again

* refactor half ajm

* refactored most of ajm

* refactored ajm

* clang-format, in-repo libatrac9, removed debug stuff

---------

Co-authored-by: auser1337 <[email protected]>
Co-authored-by: Vladislav Mikhalin <[email protected]>
Co-authored-by: IndecisiveTurtle <[email protected]>
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.

8 participants