Skip to content

HLE: fix global context for md5 and sha1#21497

Open
GermanAizek wants to merge 2 commits intohrydgard:masterfrom
GermanAizek:global-ctx-md5-sha1
Open

HLE: fix global context for md5 and sha1#21497
GermanAizek wants to merge 2 commits intohrydgard:masterfrom
GermanAizek:global-ctx-md5-sha1

Conversation

@GermanAizek
Copy link
Copy Markdown
Contributor

@hrydgard,
does this fix issue when multiple md5 and sha1 contexts are called?

@hrydgard
Copy link
Copy Markdown
Owner

This should fix such problems indeed. But I'm not aware of any game ever using multiple contexts like that.

I'll look at this in detail soon.

@GermanAizek
Copy link
Copy Markdown
Contributor Author

But I'm not aware of any game ever using multiple contexts like that.

Maybe it will help if game is a modern homebrew, some people make modern indie games on N64 as https://github.com/mwpenny/portal64-still-alive

https://www.youtube.com/watch?v=yXzoZ2AfWwg

@hrydgard
Copy link
Copy Markdown
Owner

This does seem totally fine except one issue: Are we sure that the context sizes are the same on the PSP as in our libraries? If it happens that the PSP context for one of these hashes is smaller, we could end up overwriting other data.

@GermanAizek
Copy link
Copy Markdown
Contributor Author

This does seem totally fine except one issue: Are we sure that the context sizes are the same on the PSP as in our libraries? If it happens that the PSP context for one of these hashes is smaller, we could end up overwriting other data.

Check this commit 20d393d

@hrydgard
Copy link
Copy Markdown
Owner

Seems ok, except it will break any savestates that currently are in the middle of one of these operations. That's probably extremely rare though, so I doubt it's actually an issue.

Also, on PSP init we should clear these maps.

@hrydgard
Copy link
Copy Markdown
Owner

hrydgard commented Apr 6, 2026

Actually come to think of it, it was already broken for savestates anyway.

I am gonna try to confirm if the struct has the same size, and if so we'll just go with your initial solution.

@hrydgard
Copy link
Copy Markdown
Owner

hrydgard commented Apr 6, 2026

Hm, at least the md5 context is definitely different:

https://pspdev.github.io/pspsdk/struct__SceKernelUtilsMd5Context.html

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