Skip to content

Conversation

mikusp
Copy link
Contributor

@mikusp mikusp commented Jul 11, 2025

Some games, like Battlefield 1, really don't like getting an unexpected error here. Simply returning no event allows them to go further.

Copy link
Collaborator

@StevenMiller123 StevenMiller123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinging @Fire-Cube for their opinion on this, since their code is what's bugged in the first place.

sceCompanionUtilContext* ctx = nullptr;
u32 ret = getEvent(ctx, outEvent, 1);
u32 ret = ORBIS_COMPANION_UTIL_NO_EVENT;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the actual issue is that getEvent will always return ORBIS_COMPANION_UTIL_INVALID_POINTER since ctx is initialized as a nullptr.
I think it would be preferable to fix that bug instead of getting rid of the getEvent code entirely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check whether the game calls sceCompanionUtilInitialize, because my test game, Star Wars: Battlefront, doesn’t.
That’s why I built the full check logic for but without Initialize, it just returns an error.
I think we simply need to handle the initialization properly in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change and epolls SW:B seems to reach menus #3476 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed before, the core issue with libSceCompanionUtil comes from initializing that ctx variable to a nullptr.
This triggers an error return in getEvent which causes the issues seen in games.

This PR hasn't seen any updates since my review here, but I'd still rather see this bug properly fixed over adding in a hack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The game does not seem to call any other CompanionUtil functions, so where should it be initialized?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't decompiled this library, so I don't know.
All I know is that, if games are unhappy with this current behavior, then it probably needs fixing.

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.

3 participants