mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-06 00:59:18 +00:00
Update sceNpSns (#2732)
This commit is contained in:
parent
2845617053
commit
e33c01131e
@ -1,47 +1,137 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
|
||||
#include "sceNpSns.h"
|
||||
|
||||
logs::channel sceNpSns("sceNpSns", logs::level::notice);
|
||||
|
||||
s32 sceNpSnsFbInit(vm::ptr<const SceNpSnsFbInitParams> params)
|
||||
template<>
|
||||
void fmt_class_string<sceNpSnsError>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](auto error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
STR_CASE(SCE_NP_SNS_ERROR_UNKNOWN);
|
||||
STR_CASE(SCE_NP_SNS_ERROR_NOT_SIGN_IN);
|
||||
STR_CASE(SCE_NP_SNS_ERROR_INVALID_ARGUMENT);
|
||||
STR_CASE(SCE_NP_SNS_ERROR_OUT_OF_MEMORY);
|
||||
STR_CASE(SCE_NP_SNS_ERROR_SHUTDOWN);
|
||||
STR_CASE(SCE_NP_SNS_ERROR_BUSY);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_EXCEEDS_MAX);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_ABORTED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_ALREADY_ABORTED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_CONFIG_DISABLED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_FBSERVER_ERROR_RESPONSE);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_THROTTLE_CLOSED);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_OPERATION_INTERVAL_VIOLATION);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_UNLOADED_THROTTLE);
|
||||
STR_CASE(SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED);
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
error_code sceNpSnsFbInit(vm::cptr<SceNpSnsFbInitParams> params)
|
||||
{
|
||||
sceNpSns.todo("sceNpSnsFbInit(params=*0x%x)", params);
|
||||
|
||||
if (!params)
|
||||
{
|
||||
return SCE_NP_SNS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
// TODO: Use the initialization parameters somewhere
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpSnsFbTerm()
|
||||
error_code sceNpSnsFbTerm()
|
||||
{
|
||||
sceNpSns.warning("sceNpSnsFbTerm()");
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpSnsFbCreateHandle()
|
||||
error_code sceNpSnsFbCreateHandle(vm::ptr<u32> handle)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpSns);
|
||||
sceNpSns.warning("sceNpSnsFbCreateHandle(handle=*0x%x)", handle);
|
||||
|
||||
if (!handle)
|
||||
{
|
||||
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
*handle = idm::make<sns_fb_handle_t>();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpSnsFbDestroyHandle()
|
||||
error_code sceNpSnsFbDestroyHandle(u32 handle)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpSns);
|
||||
sceNpSns.warning("sceNpSnsFbDestroyHandle(handle=%d)", handle);
|
||||
|
||||
if (handle == SCE_NP_SNS_FB_INVALID_HANDLE || handle > SCE_NP_SNS_FB_HANDLE_SLOT_MAX)
|
||||
{
|
||||
return SCE_NP_SNS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const auto sfh = idm::get<sns_fb_handle_t>(handle);
|
||||
|
||||
if (!sfh)
|
||||
{
|
||||
return SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
idm::remove<sns_fb_handle_t>(handle);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpSnsFbAbortHandle()
|
||||
error_code sceNpSnsFbAbortHandle(u32 handle)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpSns);
|
||||
sceNpSns.todo("sceNpSnsFbAbortHandle(handle=%d)", handle);
|
||||
|
||||
if (handle == SCE_NP_SNS_FB_INVALID_HANDLE || handle > SCE_NP_SNS_FB_HANDLE_SLOT_MAX)
|
||||
{
|
||||
return SCE_NP_SNS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const auto sfh = idm::get<sns_fb_handle_t>(handle);
|
||||
|
||||
if (!sfh)
|
||||
{
|
||||
return SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpSnsFbGetAccessToken()
|
||||
error_code sceNpSnsFbGetAccessToken(u32 handle, vm::cptr<SceNpSnsFbAccessTokenParam> param, vm::ptr<SceNpSnsFbAccessTokenResult> result)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpSns);
|
||||
sceNpSns.todo("sceNpSnsFbGetAccessToken(handle=%d, param=*0x%x, result=*0x%x)", handle, param, result);
|
||||
|
||||
if (handle == SCE_NP_SNS_FB_INVALID_HANDLE || handle > SCE_NP_SNS_FB_HANDLE_SLOT_MAX || !param || !result || !param->fb_app_id)
|
||||
{
|
||||
return SCE_NP_SNS_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
const auto sfh = idm::get<sns_fb_handle_t>(handle);
|
||||
|
||||
if (!sfh)
|
||||
{
|
||||
return SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
@ -3,38 +3,61 @@
|
||||
namespace vm { using namespace ps3; }
|
||||
|
||||
// Return codes
|
||||
enum
|
||||
enum sceNpSnsError : u32
|
||||
{
|
||||
SCE_NP_SNS_ERROR_UNKNOWN = 0x80024501,
|
||||
SCE_NP_SNS_ERROR_NOT_SIGN_IN = 0x80024502,
|
||||
SCE_NP_SNS_ERROR_INVALID_ARGUMENT = 0x80024503,
|
||||
SCE_NP_SNS_ERROR_OUT_OF_MEMORY = 0x80024504,
|
||||
SCE_NP_SNS_ERROR_SHUTDOWN = 0x80024505,
|
||||
SCE_NP_SNS_ERROR_BUSY = 0x80024506,
|
||||
SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED = 0x80024511,
|
||||
SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED = 0x80024512,
|
||||
SCE_NP_SNS_FB_ERROR_EXCEEDS_MAX = 0x80024513,
|
||||
SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE = 0x80024514,
|
||||
SCE_NP_SNS_FB_ERROR_ABORTED = 0x80024515,
|
||||
SCE_NP_SNS_FB_ERROR_ALREADY_ABORTED = 0x80024516,
|
||||
SCE_NP_SNS_FB_ERROR_CONFIG_DISABLED = 0x80024517,
|
||||
SCE_NP_SNS_FB_ERROR_FBSERVER_ERROR_RESPONSE = 0x80024518,
|
||||
SCE_NP_SNS_FB_ERROR_THROTTLE_CLOSED = 0x80024519,
|
||||
SCE_NP_SNS_ERROR_UNKNOWN = 0x80024501,
|
||||
SCE_NP_SNS_ERROR_NOT_SIGN_IN = 0x80024502,
|
||||
SCE_NP_SNS_ERROR_INVALID_ARGUMENT = 0x80024503,
|
||||
SCE_NP_SNS_ERROR_OUT_OF_MEMORY = 0x80024504,
|
||||
SCE_NP_SNS_ERROR_SHUTDOWN = 0x80024505,
|
||||
SCE_NP_SNS_ERROR_BUSY = 0x80024506,
|
||||
SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED = 0x80024511,
|
||||
SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED = 0x80024512,
|
||||
SCE_NP_SNS_FB_ERROR_EXCEEDS_MAX = 0x80024513,
|
||||
SCE_NP_SNS_FB_ERROR_UNKNOWN_HANDLE = 0x80024514,
|
||||
SCE_NP_SNS_FB_ERROR_ABORTED = 0x80024515,
|
||||
SCE_NP_SNS_FB_ERROR_ALREADY_ABORTED = 0x80024516,
|
||||
SCE_NP_SNS_FB_ERROR_CONFIG_DISABLED = 0x80024517,
|
||||
SCE_NP_SNS_FB_ERROR_FBSERVER_ERROR_RESPONSE = 0x80024518,
|
||||
SCE_NP_SNS_FB_ERROR_THROTTLE_CLOSED = 0x80024519,
|
||||
SCE_NP_SNS_FB_ERROR_OPERATION_INTERVAL_VIOLATION = 0x8002451a,
|
||||
SCE_NP_SNS_FB_ERROR_UNLOADED_THROTTLE = 0x8002451b,
|
||||
SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED = 0x8002451c,
|
||||
SCE_NP_SNS_FB_ERROR_UNLOADED_THROTTLE = 0x8002451b,
|
||||
SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED = 0x8002451c,
|
||||
};
|
||||
|
||||
// Constants for SNS functions
|
||||
enum
|
||||
{
|
||||
SCE_NP_SNS_FB_INVALID_HANDLE = 0,
|
||||
SCE_NP_SNS_FB_HANDLE_SLOT_MAX = 4,
|
||||
SCE_NP_SNS_FB_INVALID_HANDLE = 0,
|
||||
SCE_NP_SNS_FB_HANDLE_SLOT_MAX = 4,
|
||||
SCE_NP_SNS_FB_PERMISSIONS_LENGTH_MAX = 255,
|
||||
SCE_NP_SNS_FB_ACCESS_TOKEN_LENGTH_MAX = 255
|
||||
};
|
||||
|
||||
// Intilization parameters for functionalities coordinated with Facebook
|
||||
struct sns_fb_handle_t
|
||||
{
|
||||
static const u32 id_base = 1;
|
||||
static const u32 id_step = 1;
|
||||
static const u32 id_count = SCE_NP_SNS_FB_HANDLE_SLOT_MAX + 1;
|
||||
static const u32 invalid = SCE_NP_SNS_FB_INVALID_HANDLE;
|
||||
};
|
||||
|
||||
// Initialization parameters for functionalities coordinated with Facebook
|
||||
struct SceNpSnsFbInitParams
|
||||
{
|
||||
vm::bptr<void> pool;
|
||||
be_t<u32> poolSize;
|
||||
};
|
||||
|
||||
struct SceNpSnsFbAccessTokenParam
|
||||
{
|
||||
be_t<u64> fb_app_id;
|
||||
char permissions[SCE_NP_SNS_FB_PERMISSIONS_LENGTH_MAX + 1];
|
||||
be_t<u32> options;
|
||||
};
|
||||
|
||||
struct SceNpSnsFbAccessTokenResult
|
||||
{
|
||||
be_t<u64> expiration;
|
||||
char access_token[SCE_NP_SNS_FB_ACCESS_TOKEN_LENGTH_MAX + 1];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user