mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-18 23:07:07 -05:00
Merge pull request #3607 from itsbo5/feat/libSceNpCommerce-dialog-open2
feat(libSceNpCommerce): implement sceNpCommerceDialogOpen2
This commit is contained in:
5 files changed
+86
-3
No files matched your search
@@ -0,0 +1,15 @@
|
||||
add_library(libSceNpCommerce SHARED EXCLUDE_FROM_ALL Export.cpp)
|
||||
target_include_directories(libSceNpCommerce PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
configure_windows_unwind(libSceNpCommerce)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_test_executable(guest_np_commerce_dialog_tests ${LIBS_INCLUDE_DIR}/tests/GuestNpCommerceDialog.cpp)
|
||||
target_include_directories(guest_np_commerce_dialog_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_np_commerce_dialog_tests PRIVATE libSceNpCommerce libc)
|
||||
configure_windows_unwind(guest_np_commerce_dialog_tests)
|
||||
add_test(NAME guest_np_commerce_dialog COMMAND guest_np_commerce_dialog_tests)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_np_commerce_dialog PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceNpCommerce>")
|
||||
endif()
|
||||
endif()
|
||||
@@ -80,8 +80,8 @@ int APS5_VABI sceNpCommerceSetPsStoreIconLayout(int layout) {
|
||||
}
|
||||
|
||||
int APS5_VABI sceNpCommerceDialogOpen2(void) {
|
||||
NotImplemented_nid_no_patch(__func__);
|
||||
return 0;
|
||||
g_status = COMMON_DIALOG_STATUS_FINISHED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "SceTypes.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
int APS5_VABI sceNpCommerceDialogInitialize();
|
||||
int APS5_VABI sceNpCommerceDialogOpen(const void* param);
|
||||
int APS5_VABI sceNpCommerceDialogOpen2(void);
|
||||
int APS5_VABI sceNpCommerceDialogUpdateStatus(void);
|
||||
int APS5_VABI sceNpCommerceDialogGetStatus(void);
|
||||
int APS5_VABI sceNpCommerceDialogGetResult(void* result);
|
||||
int APS5_VABI sceNpCommerceDialogClose(void);
|
||||
int APS5_VABI sceNpCommerceDialogTerminate();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void Require(bool value) { if (!value) std::abort(); }
|
||||
|
||||
constexpr int statusNone = 0;
|
||||
constexpr int statusInitialized = 1;
|
||||
constexpr int statusFinished = 3;
|
||||
constexpr std::int32_t resultUserCanceled = 1;
|
||||
|
||||
void RequireCanceledResult() {
|
||||
std::uint8_t result[0x20];
|
||||
std::memset(result, 0x33, sizeof(result));
|
||||
Require(sceNpCommerceDialogGetResult(result) == 0);
|
||||
std::int32_t value = 0;
|
||||
std::memcpy(&value, result, sizeof(value));
|
||||
Require(value == resultUserCanceled);
|
||||
Require(result[4] == 0);
|
||||
Require(result[5] == 0x33);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
Require(sceNpCommerceDialogGetStatus() == statusNone);
|
||||
Require(sceNpCommerceDialogInitialize() == 0);
|
||||
Require(sceNpCommerceDialogGetStatus() == statusInitialized);
|
||||
|
||||
Require(sceNpCommerceDialogOpen2() == 0);
|
||||
Require(sceNpCommerceDialogUpdateStatus() == statusFinished);
|
||||
Require(sceNpCommerceDialogGetStatus() == statusFinished);
|
||||
RequireCanceledResult();
|
||||
|
||||
Require(sceNpCommerceDialogClose() == 0);
|
||||
Require(sceNpCommerceDialogGetStatus() == statusFinished);
|
||||
Require(sceNpCommerceDialogTerminate() == 0);
|
||||
Require(sceNpCommerceDialogGetStatus() == statusNone);
|
||||
|
||||
alignas(8) std::uint8_t param[0x40] = {};
|
||||
Require(sceNpCommerceDialogInitialize() == 0);
|
||||
Require(sceNpCommerceDialogOpen(param) == 0);
|
||||
Require(sceNpCommerceDialogOpen2() == 0);
|
||||
Require(sceNpCommerceDialogUpdateStatus() == statusFinished);
|
||||
RequireCanceledResult();
|
||||
Require(sceNpCommerceDialogTerminate() == 0);
|
||||
Require(sceNpCommerceDialogGetStatus() == statusNone);
|
||||
return 0;
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
- [sceAudioOut2ContextAdvance and sceAudioOut2ContextPush](../../../core/libs/prx/libSceAudioOut/src/AudioOut2Context.cpp) (libSceAudioOut) - with an SDL device, Advance snapshots each port's PCM and gain; Push consumes completed grains in order and a blocking Push waits for Advance when none is ready. Inferred from PPSA26358, which rewrites the same 512-frame, 12-channel float buffer on a producer thread and pushes on another thread. Console buffer ownership, snapshot timing and empty-queue errors are unverified. More than 16 completed grains awaiting Push and a nonblocking Push without a completed grain throw; the limit and errors are runtime restrictions, not console measurements. Context destruction concurrent with active calls remains unsupported. Without an SDL device the existing wall-clock path remains.
|
||||
|
||||
- [sceAudioOut2UserGetSupportedAttributes](../../../core/libs/prx/libSceAudioOut/src/AudioOut2User.cpp) (libSceAudioOut) - the user handle and two uint32 output pointers follow [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Audio/AudioOut2.cs) and [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/df5b9b92be7dfd463b47756b707d6d356a9f0550/src/libs/libAudio2.cpp), not a console measurement. The masks describe this runtime: no context attributes and port attributes PCM (bit 0) and gain (bit 1). Null outputs and unknown or destroyed user handles throw; console validation order and error values are unknown. Users are tracked for this query, but port ownership and busy-user destruction are not implemented. The other PPSA23566 imports remain declared without parameters, with unknown signatures: [sceConvertKeycodeGetCharacterFromKeyboardData](../../../core/libs/prx/libSceConvertKeycode/Export.cpp), [sce::Json::MemAllocator::notifyError](../../../core/libs/prx/libSceJson2/Export.cpp), [sceNpCommerceDialogOpen2](../../../core/libs/prx/libSceNpCommerce/Export.cpp), [sceProprietaryVoiceChatHelper{Initialize,Terminate,SetVoiceChatState,GetVoiceChatUsageState}](../../../core/libs/prx/libSceProprietaryVoiceChatHelperPrx/Export.cpp), [sceVoice{GetResourceInfo,ResetPort,EnableChat,DisableChat}](../../../core/libs/prx/libSceVoice/Export.cpp). Names from the shadPS4 aerolib NID list
|
||||
- [sceAudioOut2UserGetSupportedAttributes](../../../core/libs/prx/libSceAudioOut/src/AudioOut2User.cpp) (libSceAudioOut) - the user handle and two uint32 output pointers follow [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Audio/AudioOut2.cs) and [KytyPS5](https://github.com/KytyPS5/KytyPS5/blob/df5b9b92be7dfd463b47756b707d6d356a9f0550/src/libs/libAudio2.cpp), not a console measurement. The masks describe this runtime: no context attributes and port attributes PCM (bit 0) and gain (bit 1). Null outputs and unknown or destroyed user handles throw; console validation order and error values are unknown. Users are tracked for this query, but port ownership and busy-user destruction are not implemented. The other PPSA23566 imports remain declared without parameters, with unknown signatures: [sceConvertKeycodeGetCharacterFromKeyboardData](../../../core/libs/prx/libSceConvertKeycode/Export.cpp), [sce::Json::MemAllocator::notifyError](../../../core/libs/prx/libSceJson2/Export.cpp), [sceProprietaryVoiceChatHelper{Initialize,Terminate,SetVoiceChatState,GetVoiceChatUsageState}](../../../core/libs/prx/libSceProprietaryVoiceChatHelperPrx/Export.cpp), [sceVoice{GetResourceInfo,ResetPort,EnableChat,DisableChat}](../../../core/libs/prx/libSceVoice/Export.cpp). Names from the shadPS4 aerolib NID list
|
||||
- [sceAudioOutExOpen, sceAudioOutExConfigureOutput, sceAudioOutExClose](../../../core/libs/prx/libSceAudioOut/src/AudioOut.cpp) (libSceAudioOut) - the HDMI bitstream calls follow [PS5-Audio-Passthrough-Research](https://github.com/sainsaji/PS5-Audio-Passthrough-Research/blob/cf3c921d79bf00db4847f31b68a7bd95a8037cd7/docs/FINDINGS.md#L31-L80), which disassembles firmware 12.70's libSceAudioOut and logs the calls on a console. `sceAudioOutExOpen(user, mode)` returns `0x80260015` for a mode above 10 or outside mask `0x61F`; otherwise it opens a port of internal type 6 in S16 stereo, 256 frames at 48000 Hz for modes 0, 1, 2 and 9 and 1024 frames at 192000 Hz for modes 3, 4 and 10. `sceAudioOutExConfigureOutput(control, flags, mode, target, option)` returns `0x80268009` when `control` is not 0, takes modes 0 to 10 and 0xFF and targets 1 to 3 and 0xFF, and returned 0 on the console; `sceAudioOutExClose` returned 0. The argument registers match [Jelly5](https://github.com/02dnot/Jelly5/blob/552b866d89b2a58b27f7f7b0484dc743ce235526/app/src/jelly5_bitstream.cpp#L26-L28) and PPSA99051's [bitstream_out.cpp](https://github.com/sainsaji/PS5-Audio-Passthrough-Research/blob/cf3c921d79bf00db4847f31b68a7bd95a8037cd7/sample-app/src/platform/ps5/bitstream_out.cpp#L29-L32). Audio reaches the host through SDL as PCM and the host has no HDMI bitstream output, so an Ex port has no host device: `sceAudioOutOutput` paces it at its own rate and drops its IEC 61937 bursts, and `sceAudioOutExConfigureOutput` changes nothing. Nonzero `flags` or `option`, other modes or targets, `sceAudioOutExClose` of a handle that is not an Ex port, and `sceAudioOutGetPortState` on an Ex port throw, since the console's answers are unknown
|
||||
- [sceAudioOutExGetMonitorInfo](../../../core/libs/prx/libSceAudioOut/src/AudioOut.cpp) (libSceAudioOut) reports a sink without audio descriptors: it zeroes the buffer and returns 0, as `sceAudioOutSysGetHdmiMonitorInfo` does, since audio reaches the host through SDL as PCM and there is no EDID to describe. The arguments `(0, 0, info, size)` and the descriptor count as a 32-bit value at +0x98, with 8-byte descriptors from +0xA0, follow [Jelly5](https://github.com/02dnot/Jelly5/blob/552b866d89b2a58b27f7f7b0484dc743ce235526/app/src/jelly5_bitstream.cpp#L62-L117) (PPSA99505), which passes a 0x400-byte buffer and read that layout from one TV; with no descriptor listed it decodes the audio itself instead of opening a bitstream port. The meaning of the first two arguments and the structure's size are unknown: nonzero first or second arguments and sizes below 0xA0, which cannot hold the count, throw, and every byte of the declared size is written as 0. A null buffer returns `0x80260004` like the other AudioOut calls; the console's code is not measured
|
||||
- [sceAudioOut2Set3DLatency](../../../core/libs/prx/libSceAudioOut/src/AudioOut2System.cpp) (libSceAudioOut) - assumed to take `(user_id, latency)`: KytyPS5 reads `(user_id, output, latency_us)`, but the known calls set just edi and esi; only `(0xFF, 2)` (PPSA26344) and `(0xFF, 1)` (PPSA14632) are accepted
|
||||
|
||||
@@ -3,3 +3,7 @@
|
||||
### Silent stubs
|
||||
|
||||
- [libSceNpCommerce](../../../core/libs/prx/libSceNpCommerce/Export.cpp) - the PS Store icon show/hide calls and `sceNpCommerceSetPsStoreIconLayout` do nothing
|
||||
|
||||
### Unknown function info
|
||||
|
||||
- [sceNpCommerceDialogOpen2](../../../core/libs/prx/libSceNpCommerce/Export.cpp) (libSceNpCommerce) - declared without parameters; follows [prosper](https://github.com/mattias800/prosper/blob/73413cb445b0364bb49c4d2478e9ee1614b9f7d9/prosper/src/hle/np/np.cpp#L500-L504), which serves it with its `sceNpCommerceDialogOpen` handler: every argument is ignored, nothing is validated, it returns 0 and the dialog finishes at once, so `sceNpCommerceDialogGetResult` reports it cancelled. The parameters and the console's error results are unknown. Call of Duty: Black Ops (PPSA34501) calls it at Zombies > Online
|
||||
Reference in new issue
Block a user