-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
audio3d: sceAudio3dPortGetAttributesSupported() - init num_capabilities variable to zero #3814
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
base: main
Are you sure you want to change the base?
Conversation
|
is that tested with specific game? |
|
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; | ||
| } |
There was a problem hiding this comment.
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 }
There was a problem hiding this comment.
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
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;
} |
|
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), |
There was a problem hiding this comment.
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
when
capabilitiesisnullptr, sceAudio3dPortGetAttributesSupported() should return count of availablecapabilitiesthis PR initialized
num_capabilitiesvariable to zero, to return emptycapabilities