2014-08-15 16:57:55 +02:00
|
|
|
#include "stdafx.h"
|
2017-05-01 20:35:49 +02:00
|
|
|
#include "Emu/IdManager.h"
|
2016-03-21 20:42:14 +01:00
|
|
|
#include "Emu/Cell/PPUModule.h"
|
2015-07-26 11:15:15 +02:00
|
|
|
|
2014-08-15 16:57:55 +02:00
|
|
|
#include "sceNpSns.h"
|
|
|
|
|
|
2017-05-13 20:30:37 +02:00
|
|
|
logs::channel sceNpSns("sceNpSns");
|
2014-08-15 16:57:55 +02:00
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
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)
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
sceNpSns.todo("sceNpSnsFbInit(params=*0x%x)", params);
|
2015-07-26 11:15:15 +02:00
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
if (!params)
|
|
|
|
|
{
|
|
|
|
|
return SCE_NP_SNS_ERROR_INVALID_ARGUMENT;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-26 11:15:15 +02:00
|
|
|
// TODO: Use the initialization parameters somewhere
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
error_code sceNpSnsFbTerm()
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
sceNpSns.warning("sceNpSnsFbTerm()");
|
2015-07-26 11:15:15 +02:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
error_code sceNpSnsFbCreateHandle(vm::ptr<u32> handle)
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2017-05-01 20:35:49 +02:00
|
|
|
sceNpSns.warning("sceNpSnsFbCreateHandle(handle=*0x%x)", handle);
|
|
|
|
|
|
|
|
|
|
if (!handle)
|
|
|
|
|
{
|
|
|
|
|
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*handle = idm::make<sns_fb_handle_t>();
|
|
|
|
|
|
2015-07-26 11:15:15 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
error_code sceNpSnsFbDestroyHandle(u32 handle)
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2017-05-01 20:35:49 +02:00
|
|
|
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);
|
|
|
|
|
|
2015-07-26 11:15:15 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
error_code sceNpSnsFbAbortHandle(u32 handle)
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2017-05-01 20:35:49 +02:00
|
|
|
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
|
|
|
|
|
|
2015-07-26 11:15:15 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-01 20:35:49 +02:00
|
|
|
error_code sceNpSnsFbGetAccessToken(u32 handle, vm::cptr<SceNpSnsFbAccessTokenParam> param, vm::ptr<SceNpSnsFbAccessTokenResult> result)
|
2015-07-26 11:15:15 +02:00
|
|
|
{
|
2017-05-01 20:35:49 +02:00
|
|
|
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
|
|
|
|
|
|
2015-07-31 23:47:29 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
2015-07-26 11:15:15 +02:00
|
|
|
|
2015-07-31 23:47:29 +02:00
|
|
|
s32 sceNpSnsFbStreamPublish()
|
|
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-31 23:47:29 +02:00
|
|
|
}
|
2015-07-26 11:15:15 +02:00
|
|
|
|
2015-07-31 23:47:29 +02:00
|
|
|
s32 sceNpSnsFbCheckThrottle()
|
|
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-26 11:15:15 +02:00
|
|
|
}
|
|
|
|
|
|
2015-07-31 23:47:29 +02:00
|
|
|
s32 sceNpSnsFbCheckConfig()
|
2014-08-15 16:57:55 +02:00
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-31 23:47:29 +02:00
|
|
|
}
|
2015-07-26 11:15:15 +02:00
|
|
|
|
2015-07-31 23:47:29 +02:00
|
|
|
s32 sceNpSnsFbLoadThrottle()
|
|
|
|
|
{
|
2016-08-08 18:01:06 +02:00
|
|
|
fmt::throw_exception("Unimplemented" HERE);
|
2015-07-31 23:47:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-03-21 20:42:14 +01:00
|
|
|
DECLARE(ppu_module_manager::sceNpSns)("sceNpSns", []()
|
2015-07-31 23:47:29 +02:00
|
|
|
{
|
2015-07-26 11:15:15 +02:00
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbInit);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbTerm);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbCreateHandle);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbDestroyHandle);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbAbortHandle);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbGetAccessToken);
|
2015-07-31 23:47:29 +02:00
|
|
|
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbStreamPublish);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbCheckThrottle);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbCheckConfig);
|
|
|
|
|
REG_FUNC(sceNpSns, sceNpSnsFbLoadThrottle);
|
2015-02-18 17:22:06 +01:00
|
|
|
});
|