Skip to content

Conversation

@mailwl
Copy link
Contributor

@mailwl mailwl commented Nov 17, 2025

when capabilities is nullptr, sceAudio3dPortGetAttributesSupported() should return count of available capabilities
this PR initialized num_capabilities variable to zero, to return empty capabilities

@georgemoralis
Copy link
Collaborator

is that tested with specific game?

@StevenMiller123
Copy link
Collaborator

I don't think we should reduce the log severity to debug when the function is still mostly stubbed out.

static_cast<void*>(num_capabilities));
if (capabilities == nullptr) {
*num_capabilities = 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

else { //move error log here }

Copy link
Contributor Author

@mailwl mailwl Nov 17, 2025

Choose a reason for hiding this comment

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

looks like returning zero make audio3d off, and no need to fill zero-size array

@mailwl
Copy link
Contributor Author

mailwl commented Nov 17, 2025

is that tested with specific game?

saw it in CyberPunk, but there is setted to 0 before calling. But if it not set, we potentially return garbage:

__int64 __fastcall sub_3F89F20(__int64 a1)
{
  unsigned int v1; // r14d
  char *v2; // rbx
  __int64 v3; // rcx
  __int64 v5; // [rsp+0h] [rbp-40h] BYREF
  unsigned int count; // [rsp+Ch] [rbp-34h] BYREF
  __int64 v7; // [rsp+10h] [rbp-30h]

  v1 = 0;
  v7 = *(_QWORD *)_stack_chk_guard;
  count = 0;
  sceAudio3dPortGetAttributesSupported(a1, 0, &count);
  v2 = (char *)&v5 - ((4LL * count + 15) & 0xFFFFFFFFFFFFFFF0LL);
  sceAudio3dPortGetAttributesSupported((unsigned int)a1, v2, &count);
  if ( count )
  {
    v3 = 0;
    while ( *(_DWORD *)&v2[4 * v3] != 3 )
    {
      if ( ++v3 >= (unsigned __int64)count )
        return 0;
    }
    LOBYTE(v1) = 1;
  }
  return v1;
}

@mailwl
Copy link
Contributor Author

mailwl commented Nov 17, 2025

looking at source, one capability in use, so i return it to caller

s32 PS4_SYSV_ABI sceAudio3dPortGetAttributesSupported(OrbisAudio3dPortId port_id,
OrbisAudio3dAttributeId* capabilities,
u32* num_capabilities) {
LOG_ERROR(Lib_Audio3d, "(STUBBED) called caps = {}, num = {}", static_cast<void*>(capabilities),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of casting you can use fmt::ptr

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.

4 participants