cellSpurs additions and internal struct refactoring

Also updated the README.
This commit is contained in:
Raul Tambre 2015-07-26 12:15:15 +03:00 committed by Nekotekina
parent 14897b23b7
commit a239eaf630
26 changed files with 798 additions and 339 deletions

View File

@ -32,7 +32,7 @@ __Mac OSX__
### Building
To initialize the repository don't forget to execute `git submodule update --init` to pull the wxWidgets source.
* __Windows__: Install *Visual Studio 2015*, *Cmake*, *Python* and select *Add in the PATH variable* for both. Then open the *.SLN* file, and press *Build* > *Rebuild Solution*.
* __Windows__: Install *Visual Studio 2015*, *Cmake 3.1.0+*, *Python* and select *Add in the PATH variable* for both. Then open the *.SLN* file, and press *Build* > *Rebuild Solution*.
* __Linux & Mac OSX__:
`cd rpcs3 && cmake CMakeLists.txt && make && cd ../` Then run with `cd bin && ./rpcs3`

View File

@ -343,10 +343,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
case_range(16, NV4097_SET_TEX_COORD_CONTROL, 4);
{
LOG_WARNING(RSX, "TODO: NV4097_SET_TEX_COORD_CONTROL");
const u32 a0 = ARGS(0);
u8 texMask2D = a0 & 1;
u8 texMaskCentroid = (a0 >> 4) & 1;
LOG_WARNING(RSX, "TODO: NV4097_SET_TEX_COORD_CONTROL(texMask2D=%d, texMaskCentroid=%d)", texMask2D, texMaskCentroid);
break;
}

View File

@ -8,14 +8,14 @@
extern Module cellFont;
CellFontInternal* s_fontInternalInstance = nullptr;
std::unique_ptr<CellFontInternal> g_font;
// Functions
s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> config)
{
cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=*0x%x)", revisionFlags, config);
if (s_fontInternalInstance->m_bInitialized)
if (g_font->m_bInitialized)
{
return CELL_FONT_ERROR_ALREADY_INITIALIZED;
}
@ -30,11 +30,11 @@ s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr<CellFontConfig> co
cellFont.Error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags);
}
s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr;
s_fontInternalInstance->m_buffer_size = config->FileCache.size;
s_fontInternalInstance->m_userFontEntrys_addr = config->userFontEntrys_addr;
s_fontInternalInstance->m_userFontEntryMax = config->userFontEntryMax;
s_fontInternalInstance->m_bInitialized = true;
g_font->m_buffer_addr = config->FileCache.buffer_addr;
g_font->m_buffer_size = config->FileCache.size;
g_font->m_userFontEntrys_addr = config->userFontEntrys_addr;
g_font->m_userFontEntryMax = config->userFontEntryMax;
g_font->m_bInitialized = true;
return CELL_OK;
}
@ -59,12 +59,12 @@ s32 cellFontEnd()
{
cellFont.Warning("cellFontEnd()");
if (!s_fontInternalInstance->m_bInitialized)
if (!g_font->m_bInitialized)
{
return CELL_FONT_ERROR_UNINITIALIZED;
}
s_fontInternalInstance->m_bInitialized = false;
g_font->m_bInitialized = false;
return CELL_OK;
}
@ -79,7 +79,7 @@ s32 cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
{
cellFont.Warning("cellFontOpenFontMemory(library=*0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font=*0x%x)", library, fontAddr, fontSize, subNum, uniqueId, font);
if (!s_fontInternalInstance->m_bInitialized)
if (!g_font->m_bInitialized)
{
return CELL_FONT_ERROR_UNINITIALIZED;
}
@ -119,7 +119,7 @@ s32 cellFontOpenFontset(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::pt
{
cellFont.Warning("cellFontOpenFontset(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font);
if (!s_fontInternalInstance->m_bInitialized)
if (!g_font->m_bInitialized)
{
return CELL_FONT_ERROR_UNINITIALIZED;
}
@ -227,7 +227,7 @@ s32 cellFontCreateRenderer(vm::ptr<CellFontLibrary> library, vm::ptr<CellFontRen
{
cellFont.Todo("cellFontCreateRenderer(library=*0x%x, config=*0x%x, Renderer=*0x%x)", library, config, Renderer);
if (!s_fontInternalInstance->m_bInitialized)
if (!g_font->m_bInitialized)
{
return CELL_FONT_ERROR_UNINITIALIZED;
}
@ -475,16 +475,16 @@ s32 cellFontGraphicsSetFontRGBA()
s32 cellFontOpenFontsetOnMemory(PPUThread& CPU, vm::ptr<CellFontLibrary> library, vm::ptr<CellFontType> fontType, vm::ptr<CellFont> font)
{
cellFont.Todo("cellFontOpenFontsetOnMemory()");
cellFont.Todo("cellFontOpenFontsetOnMemory(library=*0x%x, fontType=*0x%x, font=*0x%x)", library, fontType, font);
if (!s_fontInternalInstance->m_bInitialized)
if (!g_font->m_bInitialized)
{
return CELL_FONT_ERROR_UNINITIALIZED;
}
if (fontType->map != CELL_FONT_MAP_UNICODE)
{
cellFont.Warning("cellFontOpenFontset: Only Unicode is supported");
cellFont.Warning("cellFontOpenFontsetOnMemory: Only Unicode is supported");
}
return CELL_OK;
@ -632,14 +632,7 @@ s32 cellFontGetCharGlyphMetricsVertical()
Module cellFont("cellFont", []()
{
s_fontInternalInstance = new CellFontInternal();
cellFont.on_stop = []()
{
// s_fontInternalInstance->m_bInitialized = false;
// s_fontInternalInstance->m_bFontGcmInitialized = false;
delete s_fontInternalInstance;
};
g_font = std::make_unique<CellFontInternal>();
REG_FUNC(cellFont, cellFontInit);
REG_FUNC(cellFont, cellFontSetFontsetOpenMode);

View File

@ -28,26 +28,18 @@
extern Module cellNetCtl;
struct cellNetCtlInternal
{
bool m_bInitialized;
cellNetCtlInternal()
: m_bInitialized(false)
{
}
};
cellNetCtlInternal cellNetCtlInstance;
std::unique_ptr<CellNetCtlInternal> g_netCtl;
s32 cellNetCtlInit()
{
cellNetCtl.Log("cellNetCtlInit()");
if (cellNetCtlInstance.m_bInitialized)
if (g_netCtl->m_bInitialized)
{
return CELL_NET_CTL_ERROR_NOT_TERMINATED;
}
cellNetCtlInstance.m_bInitialized = true;
g_netCtl->m_bInitialized = true;
return CELL_OK;
}
@ -56,10 +48,12 @@ s32 cellNetCtlTerm()
{
cellNetCtl.Log("cellNetCtlTerm()");
if (!cellNetCtlInstance.m_bInitialized)
if (!g_netCtl->m_bInitialized)
{
return CELL_NET_CTL_ERROR_NOT_INITIALIZED;
}
cellNetCtlInstance.m_bInitialized = false;
g_netCtl->m_bInitialized = false;
return CELL_OK;
}
@ -276,7 +270,7 @@ s32 cellNetCtlGetNatInfo(vm::ptr<CellNetCtlNatInfo> natInfo)
Module cellNetCtl("cellNetCtl", []()
{
cellNetCtlInstance.m_bInitialized = false;
g_netCtl = std::make_unique<CellNetCtlInternal>();
REG_FUNC(cellNetCtl, cellNetCtlInit);
REG_FUNC(cellNetCtl, cellNetCtlTerm);

View File

@ -196,6 +196,18 @@ enum
CELL_NET_CTL_NATINFO_NAT_TYPE_3 = 3,
};
struct CellNetCtlInternal
{
bool m_bInitialized;
CellNetCtlInternal()
: m_bInitialized(false)
{
}
};
extern std::unique_ptr<CellNetCtlInternal> g_netCtl;
struct CellNetCtlEtherAddr
{
u8 data[6];
@ -263,32 +275,32 @@ typedef void(cellNetCtlHandler)(s32 prev_state, s32 new_state, s32 event, s32 er
inline static const char* InfoCodeToName(s32 code)
{
static const char* const names[] =
switch (code)
{
"INFO_DEVICE",
"INFO_ETHER_ADDR",
"INFO_MTU",
"INFO_LINK",
"INFO_LINK_TYPE",
"INFO_BSSID",
"INFO_SSID",
"INFO_WLAN_SECURITY",
"INFO_8021X_TYPE",
"INFO_8021X_AUTH_NAME",
"INFO_RSSI",
"INFO_CHANNEL",
"INFO_IP_CONFIG",
"INFO_DHCP_HOSTNAME",
"INFO_PPPOE_AUTH_NAME",
"INFO_IP_ADDRESS",
"INFO_DEFAULT_ROUTE",
"INFO_PRIMARY_DNS",
"INFO_SECONDARY_DNS",
"INFO_HTTP_PROXY_CONFIG",
"INFO_HTTP_PROXY_SERVER",
"INFO_HTTP_PROXY_PORT",
"INFO_UPNP_CONFIG",
};
return names[code - 1];
}
case CELL_NET_CTL_INFO_DEVICE: return "INFO_DEVICE";
case CELL_NET_CTL_INFO_ETHER_ADDR: return "INFO_ETHER_ADDR";
case CELL_NET_CTL_INFO_MTU: return "INFO_MTU";
case CELL_NET_CTL_INFO_LINK: return "INFO_LINK";
case CELL_NET_CTL_INFO_LINK_TYPE: return "INFO_LINK_TYPE";
case CELL_NET_CTL_INFO_BSSID: return "INFO_BSSID";
case CELL_NET_CTL_INFO_SSID: return "INFO_SSID";
case CELL_NET_CTL_INFO_WLAN_SECURITY: return "INFO_WLAN_SECURITY";
case CELL_NET_CTL_INFO_8021X_TYPE: return "INFO_8021X_TYPE";
case CELL_NET_CTL_INFO_8021X_AUTH_NAME: return "INFO_8021X_AUTH_NAME";
case CELL_NET_CTL_INFO_RSSI: return "INFO_RSSI";
case CELL_NET_CTL_INFO_CHANNEL: return "INFO_CHANNEL";
case CELL_NET_CTL_INFO_IP_CONFIG: return "INFO_IP_CONFIG";
case CELL_NET_CTL_INFO_DHCP_HOSTNAME: return "INFO_DHCP_HOSTNAME";
case CELL_NET_CTL_INFO_PPPOE_AUTH_NAME: return "INFO_PPPOE_AUTH_NAME";
case CELL_NET_CTL_INFO_IP_ADDRESS: return "INFO_IP_ADDRESS";
case CELL_NET_CTL_INFO_NETMASK: return "INFO_NETMASK";
case CELL_NET_CTL_INFO_DEFAULT_ROUTE: return "INFO_DEFAULT_ROUTE";
case CELL_NET_CTL_INFO_PRIMARY_DNS: return "INFO_PRIMARY_DNS";
case CELL_NET_CTL_INFO_SECONDARY_DNS: return "INFO_SECONDARY_DNS";
case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: return "INFO_HTTP_PROXY_CONFIG";
case CELL_NET_CTL_INFO_HTTP_PROXY_SERVER: return "INFO_HTTP_PROXY_SERVER";
case CELL_NET_CTL_INFO_HTTP_PROXY_PORT: return "INFO_HTTP_PROXY_PORT";
case CELL_NET_CTL_INFO_UPNP_CONFIG: return "INFO_UPNP_CONFIG";
default: return "???";
}
}

View File

@ -193,8 +193,8 @@ s32 cellSpursEventFlagGetTasksetAddress(vm::ptr<CellSpursEventFlag> eventFlag, v
//
s32 _cellSpursLFQueueInitialize(vm::ptr<void> pTasksetOrSpurs, vm::ptr<CellSpursLFQueue> pQueue, vm::cptr<void> buffer, u32 size, u32 depth, u32 direction);
s32 _cellSpursLFQueuePushBody();
s32 cellSpursLFQueueDetachLv2EventQueue();
s32 cellSpursLFQueueAttachLv2EventQueue();
s32 cellSpursLFQueueAttachLv2EventQueue(vm::ptr<CellSyncLFQueue> queue);
s32 cellSpursLFQueueDetachLv2EventQueue(vm::ptr<CellSyncLFQueue> queue);
s32 _cellSpursLFQueuePopBody();
s32 cellSpursLFQueueGetTasksetAddress();
@ -3276,7 +3276,7 @@ s32 _cellSpursLFQueueInitialize(vm::ptr<void> pTasksetOrSpurs, vm::ptr<CellSpurs
{
cellSpurs.Todo("_cellSpursLFQueueInitialize(pTasksetOrSpurs=*0x%x, pQueue=*0x%x, buffer=*0x%x, size=0x%x, depth=0x%x, direction=%d)", pTasksetOrSpurs, pQueue, buffer, size, depth, direction);
return CELL_OK;
return SyncErrorToSpursError(cellSyncLFQueueInitialize(pQueue, buffer, size, depth, direction, pTasksetOrSpurs));
}
s32 _cellSpursLFQueuePushBody()
@ -3285,13 +3285,13 @@ s32 _cellSpursLFQueuePushBody()
return CELL_OK;
}
s32 cellSpursLFQueueDetachLv2EventQueue()
s32 cellSpursLFQueueAttachLv2EventQueue(vm::ptr<CellSyncLFQueue> queue)
{
UNIMPLEMENTED_FUNC(cellSpurs);
return CELL_OK;
}
s32 cellSpursLFQueueAttachLv2EventQueue()
s32 cellSpursLFQueueDetachLv2EventQueue(vm::ptr<CellSyncLFQueue> queue)
{
UNIMPLEMENTED_FUNC(cellSpurs);
return CELL_OK;

View File

@ -914,3 +914,8 @@ CHECK_SIZE(SpursTasksetContext, 0x900);
class SpursModuleExit
{
};
inline static s32 SyncErrorToSpursError(s32 res)
{
return res < 0 ? 0x80410900 | (res & 0xff) : res;
}

View File

@ -653,7 +653,7 @@ s32 cellSyncQueueClear(PPUThread& ppu, vm::ptr<CellSyncQueue> queue)
// LFQueue functions
void syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal)
void syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::cptr<void> buffer, u32 size, u32 depth, u32 direction, vm::ptr<void> eaSignal)
{
queue->m_size = size;
queue->m_depth = depth;
@ -693,7 +693,7 @@ void syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u
queue->m_eq_id = 0;
}
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal)
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::cptr<void> buffer, u32 size, u32 depth, u32 direction, vm::ptr<void> eaSignal)
{
cellSync.Warning("cellSyncLFQueueInitialize(queue=*0x%x, buffer=*0x%x, size=0x%x, depth=0x%x, direction=%d, eaSignal=*0x%x)", queue, buffer, size, depth, direction, eaSignal);

View File

@ -331,7 +331,7 @@ struct set_alignment(128) CellSyncLFQueue
be_t<u32> m_size; // 0x10
be_t<u32> m_depth; // 0x14
vm::bptr<u8, u64> m_buffer; // 0x18
vm::bcptr<void, u64> m_buffer; // 0x18
u8 m_bs[4]; // 0x20
be_t<u32> m_direction; // 0x24 CellSyncQueueDirection
be_t<u32> m_v1; // 0x28
@ -363,3 +363,6 @@ struct set_alignment(128) CellSyncLFQueue
};
CHECK_SIZE_ALIGN(CellSyncLFQueue, 128, 128);
// Prototypes
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::cptr<void> buffer, u32 size, u32 depth, u32 direction, vm::ptr<void> eaSignal);

View File

@ -12,13 +12,13 @@
extern Module sceNp;
sceNpInternal sceNpInstance;
std::unique_ptr<SceNpInternal> g_sceNp;
s32 sceNpInit(u32 poolsize, vm::ptr<u32> poolptr)
{
sceNp.Warning("sceNpInit(poolsize=%d, poolptr=0x%x)", poolsize, poolptr);
if (sceNpInstance.m_bSceNpInitialized)
if (g_sceNp->m_bSceNpInitialized)
{
sceNp.Error("sceNpInit(): sceNp has been already initialized.");
return SCE_NP_ERROR_ALREADY_INITIALIZED;
@ -41,7 +41,7 @@ s32 sceNpInit(u32 poolsize, vm::ptr<u32> poolptr)
return SCE_NP_ERROR_INVALID_ARGUMENT;
}
sceNpInstance.m_bSceNpInitialized = true;
g_sceNp->m_bSceNpInitialized = true;
return CELL_OK;
}
@ -50,13 +50,13 @@ s32 sceNpTerm()
{
sceNp.Warning("sceNpTerm()");
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
sceNp.Error("sceNpTerm(): sceNp has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
sceNpInstance.m_bSceNpInitialized = false;
g_sceNp->m_bSceNpInitialized = false;
return CELL_OK;
}
@ -282,8 +282,10 @@ s32 sceNpBasicGetFriendListEntryCount(vm::ptr<u32> count)
{
sceNp.Warning("sceNpBasicGetFriendListEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
// TODO: Check if there are any friends
*count = 0;
@ -337,8 +339,10 @@ s32 sceNpBasicGetPlayersHistoryEntryCount(u32 options, vm::ptr<u32> count)
{
sceNp.Todo("sceNpBasicGetPlayersHistoryEntryCount(options=%d, count_addr=0x%x)", options, count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -359,8 +363,10 @@ s32 sceNpBasicGetBlockListEntryCount(u32 count)
{
sceNp.Todo("sceNpBasicGetBlockListEntryCount(count=%d)", count);
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -375,8 +381,10 @@ s32 sceNpBasicGetMessageAttachmentEntryCount(vm::ptr<u32> count)
{
sceNp.Todo("sceNpBasicGetMessageAttachmentEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -385,8 +393,10 @@ s32 sceNpBasicGetMessageAttachmentEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{
sceNp.Todo("sceNpBasicGetMessageAttachmentEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -407,8 +417,10 @@ s32 sceNpBasicGetMatchingInvitationEntryCount(vm::ptr<u32> count)
{
sceNp.Todo("sceNpBasicGetMatchingInvitationEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -417,8 +429,10 @@ s32 sceNpBasicGetMatchingInvitationEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{
sceNp.Todo("sceNpBasicGetMatchingInvitationEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -427,8 +441,10 @@ s32 sceNpBasicGetClanMessageEntryCount(vm::ptr<u32> count)
{
sceNp.Todo("sceNpBasicGetClanMessageEntryCount(count_addr=0x%x)", count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -437,8 +453,10 @@ s32 sceNpBasicGetClanMessageEntry(u32 index, vm::ptr<SceNpUserInfo> from)
{
sceNp.Todo("sceNpBasicGetClanMessageEntry(index=%d, from_addr=0x%x)", index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -447,8 +465,10 @@ s32 sceNpBasicGetMessageEntryCount(u32 type, vm::ptr<u32> count)
{
sceNp.Warning("sceNpBasicGetMessageEntryCount(type=%d, count_addr=0x%x)", type, count.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
// TODO: Check if there are messages
*count = 0;
@ -460,8 +480,10 @@ s32 sceNpBasicGetMessageEntry(u32 type, u32 index, vm::ptr<SceNpUserInfo> from)
{
sceNp.Todo("sceNpBasicGetMessageEntry(type=%d, index=%d, from_addr=0x%x)", type, index, from.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -470,8 +492,10 @@ s32 sceNpBasicGetEvent(vm::ptr<s32> event, vm::ptr<SceNpUserInfo> from, vm::ptr<
{
sceNp.Warning("sceNpBasicGetEvent(event_addr=0x%x, from_addr=0x%x, data_addr=0x%x, size_addr=0x%x)", event.addr(), from.addr(), data.addr(), size.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_BASIC_ERROR_NOT_INITIALIZED;
}
// TODO: Check for other error and pass other events
*event = SCE_NP_BASIC_EVENT_OFFLINE;
@ -737,10 +761,12 @@ s32 sceNpLookupInit()
// TODO: Make sure the error code returned is right,
// since there are no error codes for Lookup utility.
if (sceNpInstance.m_bLookupInitialized)
if (g_sceNp->m_bLookupInitialized)
{
return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
}
sceNpInstance.m_bLookupInitialized = true;
g_sceNp->m_bLookupInitialized = true;
return CELL_OK;
}
@ -749,10 +775,12 @@ s32 sceNpLookupTerm()
{
sceNp.Warning("sceNpLookupTerm()");
if (!sceNpInstance.m_bLookupInitialized)
if (!g_sceNp->m_bLookupInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
sceNpInstance.m_bLookupInitialized = false;
g_sceNp->m_bLookupInitialized = false;
return CELL_OK;
}
@ -892,10 +920,12 @@ s32 sceNpManagerUnregisterCallback()
s32 sceNpManagerGetStatus(vm::ptr<u32> status)
{
sceNp.Log("sceNpManagerGetStatus(status_addr=0x%x)", status.addr());
sceNp.Warning("sceNpManagerGetStatus(status_addr=0x%x)", status.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_ERROR_NOT_INITIALIZED;
}
// TODO: Support different statuses
*status = SCE_NP_MANAGER_STATUS_OFFLINE;
@ -955,8 +985,10 @@ s32 sceNpManagerGetContentRatingFlag(vm::ptr<u32> isRestricted, vm::ptr<u32> age
{
sceNp.Warning("sceNpManagerGetContentRatingFlag(isRestricted_addr=0x%x, age_addr=0x%x)", isRestricted.addr(), age.addr());
if (!sceNpInstance.m_bSceNpInitialized)
if (!g_sceNp->m_bSceNpInitialized)
{
return SCE_NP_ERROR_NOT_INITIALIZED;
}
// TODO: read user's parental control information
*isRestricted = 0;
@ -1185,10 +1217,12 @@ s32 sceNpScoreInit()
{
sceNp.Warning("sceNpScoreInit()");
if (sceNpInstance.m_bScoreInitialized)
if (g_sceNp->m_bScoreInitialized)
{
return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
}
sceNpInstance.m_bScoreInitialized = true;
g_sceNp->m_bScoreInitialized = true;
return CELL_OK;
}
@ -1197,10 +1231,12 @@ s32 sceNpScoreTerm()
{
sceNp.Warning("sceNpScoreTerm()");
if (!sceNpInstance.m_bScoreInitialized)
if (!g_sceNp->m_bScoreInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
sceNpInstance.m_bScoreInitialized = false;
g_sceNp->m_bScoreInitialized = false;
return CELL_OK;
}
@ -1549,9 +1585,7 @@ s32 _sceNpSysutilClientFree()
Module sceNp("sceNp", []()
{
sceNpInstance.m_bSceNpInitialized = false;
sceNpInstance.m_bScoreInitialized = false;
sceNpInstance.m_bLookupInitialized = false;
g_sceNp = std::make_unique<SceNpInternal>();
REG_FUNC(sceNp, sceNpInit);
REG_FUNC(sceNp, sceNpTerm);

View File

@ -219,22 +219,6 @@ enum
using SceNpBasicEventHandler = func_def<s32(s32 event, s32 retCode, u32 reqId, vm::ptr<void> arg)>;
struct sceNpInternal
{
bool m_bSceNpInitialized;
bool m_bScoreInitialized;
bool m_bLookupInitialized;
sceNpInternal()
: m_bSceNpInitialized(false),
m_bScoreInitialized(false),
m_bLookupInitialized(false)
{
}
};
extern sceNpInternal sceNpInstance;
// NP Manager Utility statuses
enum
{
@ -823,6 +807,37 @@ enum
SCE_NP_SIGNALING_CTX_MAX = 8,
};
struct SceNpInternal
{
bool m_bSceNpInitialized;
bool m_bScoreInitialized;
bool m_bLookupInitialized;
SceNpInternal()
: m_bSceNpInitialized(false),
m_bScoreInitialized(false),
m_bLookupInitialized(false)
{
}
};
struct SceNp2Internal
{
bool m_bSceNp2Initialized;
bool m_bSceNp2Matching2Initialized;
bool m_bSceNp2Matching2Initialized2;
SceNp2Internal()
: m_bSceNp2Initialized(false),
m_bSceNp2Matching2Initialized(false),
m_bSceNp2Matching2Initialized2(false)
{
}
};
extern std::unique_ptr<SceNpInternal> g_sceNp;
extern std::unique_ptr<SceNp2Internal> g_sceNp2;
// NP communication ID structure
struct SceNpCommunicationId
{

View File

@ -6,27 +6,13 @@
extern Module sceNp2;
struct sceNp2Internal
{
bool m_bSceNp2Initialized;
bool m_bSceNp2Matching2Initialized;
bool m_bSceNp2Matching2Initialized2;
sceNp2Internal()
: m_bSceNp2Initialized(false),
m_bSceNp2Matching2Initialized(false),
m_bSceNp2Matching2Initialized2(false)
{
}
};
sceNp2Internal sceNp2Instance;
std::unique_ptr<SceNp2Internal> g_sceNp2;
s32 sceNp2Init(u32 poolsize, vm::ptr<u32> poolptr)
{
sceNp2.Warning("sceNp2Init(poolsize=%d, poolptr=0x%x)", poolsize, poolptr);
if (sceNp2Instance.m_bSceNp2Initialized)
if (g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNp2Init(): sceNp2 has been already initialized.");
return SCE_NP_ERROR_ALREADY_INITIALIZED;
@ -49,8 +35,8 @@ s32 sceNp2Init(u32 poolsize, vm::ptr<u32> poolptr)
return SCE_NP_ERROR_INVALID_ARGUMENT;
}
sceNpInstance.m_bSceNpInitialized = true;
sceNp2Instance.m_bSceNp2Initialized = true;
g_sceNp->m_bSceNpInitialized = true;
g_sceNp2->m_bSceNp2Initialized = true;
return CELL_OK;
}
@ -59,19 +45,19 @@ s32 sceNpMatching2Init(u32 poolsize, s32 priority)
{
sceNp2.Todo("sceNpMatching2Init(poolsize=%d, priority=%d)", poolsize, priority);
if (!sceNp2Instance.m_bSceNp2Initialized)
if (!g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNpMatching2Init(): sceNp2 has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
if (sceNp2Instance.m_bSceNp2Matching2Initialized)
if (g_sceNp2->m_bSceNp2Matching2Initialized)
{
sceNp2.Error("sceNpMatching2Init(): sceNpMatching2 has already been intialized.");
return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED;
}
sceNp2Instance.m_bSceNp2Matching2Initialized = true;
g_sceNp2->m_bSceNp2Matching2Initialized = true;
return CELL_OK;
}
@ -80,19 +66,19 @@ s32 sceNpMatching2Init2(u32 poolsize, s32 priority, vm::ptr<SceNpMatching2Utilit
{
sceNp2.Todo("sceNpMatching2Init2(poolsize=%d, priority=%d, param_addr=0x%x)", poolsize, priority, param.addr());
if (!sceNp2Instance.m_bSceNp2Initialized)
if (!g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNpMatching2Init2(): sceNp2 has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
if (sceNp2Instance.m_bSceNp2Matching2Initialized2)
if (g_sceNp2->m_bSceNp2Matching2Initialized2)
{
sceNp2.Error("sceNpMatching2Init2(): new sceNpMatching2 has already been intialized.");
return SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED;
}
sceNp2Instance.m_bSceNp2Matching2Initialized2 = true;
g_sceNp2->m_bSceNp2Matching2Initialized2 = true;
// TODO:
// 1. Create an internal thread
@ -106,13 +92,13 @@ s32 sceNp2Term()
{
sceNp2.Warning("sceNp2Term()");
if (!sceNp2Instance.m_bSceNp2Initialized)
if (!g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNp2Term(): sceNp2 has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
sceNp2Instance.m_bSceNp2Initialized = false;
g_sceNp2->m_bSceNp2Initialized = false;
return CELL_OK;
}
@ -121,19 +107,19 @@ s32 sceNpMatching2Term(PPUThread& ppu)
{
sceNp2.Warning("sceNpMatching2Term()");
if (!sceNp2Instance.m_bSceNp2Initialized)
if (!g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNpMatching2Term(): sceNp2 has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
if (!sceNp2Instance.m_bSceNp2Matching2Initialized)
if (!g_sceNp2->m_bSceNp2Matching2Initialized)
{
sceNp2.Error("sceNpMatching2Term(): sceNpMatching2 has not been intialized.");
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
}
sceNp2Instance.m_bSceNp2Matching2Initialized = false;
g_sceNp2->m_bSceNp2Matching2Initialized = false;
return CELL_OK;
}
@ -142,28 +128,26 @@ s32 sceNpMatching2Term2()
{
sceNp2.Warning("sceNpMatching2Term2()");
if (!sceNp2Instance.m_bSceNp2Initialized)
if (!g_sceNp2->m_bSceNp2Initialized)
{
sceNp2.Error("sceNpMatching2Term2(): sceNp2 has not been intialized.");
return SCE_NP_ERROR_NOT_INITIALIZED;
}
if (!sceNp2Instance.m_bSceNp2Matching2Initialized2)
if (!g_sceNp2->m_bSceNp2Matching2Initialized2)
{
sceNp2.Error("sceNpMatching2Term(): new sceNpMatching2 has not been intialized.");
return SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED;
}
sceNp2Instance.m_bSceNp2Matching2Initialized2 = false;
g_sceNp2->m_bSceNp2Matching2Initialized2 = false;
return CELL_OK;
}
Module sceNp2("sceNp2", []()
{
sceNp2Instance.m_bSceNp2Initialized = false;
sceNp2Instance.m_bSceNp2Matching2Initialized = false;
sceNp2Instance.m_bSceNp2Matching2Initialized2 = false;
g_sceNp2 = std::make_unique<SceNp2Internal>();
REG_FUNC(sceNp2, sceNp2Init);
REG_FUNC(sceNp2, sceNpMatching2Init);

View File

@ -8,29 +8,23 @@
extern Module sceNpClans;
struct sceNpClansInternal
{
bool m_bSceNpClansInitialized;
sceNpClansInternal()
: m_bSceNpClansInitialized(false)
{
}
};
sceNpClansInternal sceNpClansInstance;
std::unique_ptr<SceNpClansInternal> g_sceNpClans;
s32 sceNpClansInit(vm::ptr<SceNpCommunicationId> commId, vm::ptr<SceNpCommunicationPassphrase> passphrase, vm::ptr<void> pool, vm::ptr<u32> poolSize, u32 flags)
{
sceNpClans.Warning("sceNpClansInit(commId=*0x%x, passphrase=*0x%x, pool=*0x%x, poolSize=*0x%x, flags=0x%x)", commId, passphrase, pool, poolSize, flags);
if (sceNpClansInstance.m_bSceNpClansInitialized)
if (g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_ALREADY_INITIALIZED;
}
if (flags != 0)
{
return SCE_NP_CLANS_ERROR_NOT_SUPPORTED;
}
sceNpClansInstance.m_bSceNpClansInitialized = true;
g_sceNpClans->m_bSceNpClansInitialized = true;
return CELL_OK;
}
@ -39,10 +33,12 @@ s32 sceNpClansTerm()
{
sceNpClans.Warning("sceNpClansTerm()");
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
sceNpClansInstance.m_bSceNpClansInitialized = false;
g_sceNpClans->m_bSceNpClansInitialized = false;
return CELL_OK;
}
@ -51,11 +47,15 @@ s32 sceNpClansCreateRequest(vm::ptr<SceNpClansRequestHandle> handle, u64 flags)
{
sceNpClans.Todo("sceNpClansCreateRequest(handle=*0x%x, flags=0x%llx)", handle, flags);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
if (flags != 0)
{
return SCE_NP_CLANS_ERROR_NOT_SUPPORTED;
}
return CELL_OK;
}
@ -64,8 +64,10 @@ s32 sceNpClansDestroyRequest(vm::ptr<SceNpClansRequestHandle> handle)
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -74,8 +76,10 @@ s32 sceNpClansAbortRequest(vm::ptr<SceNpClansRequestHandle> handle)
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -84,8 +88,10 @@ s32 sceNpClansCreateClan(vm::ptr<SceNpClansRequestHandle> handle, vm::cptr<char>
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -94,8 +100,10 @@ s32 sceNpClansDisbandClan(vm::ptr<SceNpClansRequestHandle> handle, u32 clanId)
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -104,8 +112,10 @@ s32 sceNpClansGetClanList(vm::ptr<SceNpClansRequestHandle> handle, vm::cptr<SceN
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -114,8 +124,10 @@ s32 sceNpClansGetClanListByNpId()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -124,8 +136,10 @@ s32 sceNpClansSearchByProfile()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -134,8 +148,10 @@ s32 sceNpClansSearchByName()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -144,8 +160,10 @@ s32 sceNpClansGetClanInfo()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -154,8 +172,10 @@ s32 sceNpClansUpdateClanInfo()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -164,8 +184,10 @@ s32 sceNpClansGetMemberList()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -174,8 +196,10 @@ s32 sceNpClansGetMemberInfo()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -184,8 +208,10 @@ s32 sceNpClansUpdateMemberInfo()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -194,8 +220,10 @@ s32 sceNpClansChangeMemberRole()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -204,8 +232,10 @@ s32 sceNpClansGetAutoAcceptStatus()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -214,8 +244,10 @@ s32 sceNpClansUpdateAutoAcceptStatus()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -224,8 +256,10 @@ s32 sceNpClansJoinClan()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -234,8 +268,10 @@ s32 sceNpClansLeaveClan()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -244,8 +280,10 @@ s32 sceNpClansKickMember(vm::ptr<SceNpClansRequestHandle> handle, u32 clanId, vm
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -254,8 +292,10 @@ s32 sceNpClansSendInvitation(vm::ptr<SceNpClansRequestHandle> handle, u32 clanId
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -264,8 +304,10 @@ s32 sceNpClansCancelInvitation()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -274,8 +316,10 @@ s32 sceNpClansSendInvitationResponse(vm::ptr<SceNpClansRequestHandle> handle, u3
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -284,8 +328,10 @@ s32 sceNpClansSendMembershipRequest(vm::ptr<SceNpClansRequestHandle> handle, u32
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -294,8 +340,10 @@ s32 sceNpClansCancelMembershipRequest()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -304,8 +352,10 @@ s32 sceNpClansSendMembershipResponse()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -314,8 +364,10 @@ s32 sceNpClansGetBlacklist()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -324,8 +376,10 @@ s32 sceNpClansAddBlacklistEntry()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -334,8 +388,10 @@ s32 sceNpClansRemoveBlacklistEntry()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -344,8 +400,10 @@ s32 sceNpClansRetrieveAnnouncements()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -354,8 +412,10 @@ s32 sceNpClansPostAnnouncement()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -364,8 +424,10 @@ s32 sceNpClansRemoveAnnouncement()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -374,13 +436,15 @@ s32 sceNpClansPostChallenge(vm::ptr<SceNpClansRequestHandle> handle, u32 clanId,
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
if (data)
{
return SCE_NP_CLANS_ERROR_NOT_SUPPORTED;
//todo
}
return CELL_OK;
}
@ -389,10 +453,10 @@ s32 sceNpClansRetrievePostedChallenges()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
//todo
}
return CELL_OK;
}
@ -401,8 +465,10 @@ s32 sceNpClansRemovePostedChallenge()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -411,8 +477,10 @@ s32 sceNpClansRetrieveChallenges()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -421,15 +489,17 @@ s32 sceNpClansRemoveChallenge()
{
UNIMPLEMENTED_FUNC(sceNpClans);
if (!sceNpClansInstance.m_bSceNpClansInitialized)
if (!g_sceNpClans->m_bSceNpClansInitialized)
{
return SCE_NP_CLANS_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
Module sceNpClans("sceNpClans", []()
{
sceNpClansInstance.m_bSceNpClansInitialized = false;
g_sceNpClans = std::make_unique<SceNpClansInternal>();
REG_FUNC(sceNpClans, sceNpClansInit);
REG_FUNC(sceNpClans, sceNpClansTerm);

View File

@ -60,6 +60,18 @@ enum
SCE_NP_CLANS_SERVER_ERROR_FAILED_TO_SEND_NP_MESSAGE = 0x8002284c,
};
struct SceNpClansInternal
{
bool m_bSceNpClansInitialized;
SceNpClansInternal()
: m_bSceNpClansInitialized(false)
{
}
};
extern SceNpClansInternal* sceNpClansInstance;
// Clan roles
enum
{
@ -133,7 +145,7 @@ struct SceNpClansClanBasicInfo
be_t<u32> numMembers;
s8 name[SCE_NP_CLANS_CLAN_NAME_MAX_LENGTH + 1];
s8 tag[SCE_NP_CLANS_CLAN_TAG_MAX_LENGTH + 1];
//u8 reserved[2];
u8 reserved[2];
};
// Clan entry structure
@ -143,7 +155,7 @@ struct SceNpClansEntry
be_t<u32> role;
be_t<s32> status;
bool allowMsg;
//u8 reserved[3];
u8 reserved[3];
};
// Clan search attribute structure
@ -154,7 +166,7 @@ struct SceNpClansSearchableAttr
be_t<u32> intAttr2;
be_t<u32> intAttr3;
u8 binAttr1[SCE_NP_CLANS_CLAN_BINARY_ATTRIBUTE1_MAX_SIZE];
//u8 reserved[2];
u8 reserved[2];
};
// Clan search profile structure
@ -170,7 +182,7 @@ struct SceNpClansSearchableProfile
be_t<s32> intAttr3SearchOp;
be_t<s32> binAttr1SearchOp;
s8 tag[SCE_NP_CLANS_CLAN_TAG_MAX_LENGTH + 1];
//u8 reserved[3];
u8 reserved[3];
};
// Clan search name structure
@ -178,7 +190,7 @@ struct SceNpClansSearchableName
{
be_t<s32> nameSearchOp;
s8 name[SCE_NP_CLANS_CLAN_NAME_MAX_LENGTH + 1];
//u8 reserved[3];
u8 reserved[3];
};
// Updatable clan information structure
@ -208,7 +220,7 @@ struct SceNpClansUpdatableMemberInfo
u8 binAttr1[SCE_NP_CLANS_CLAN_BINARY_ATTRIBUTE1_MAX_SIZE + 1];
s8 description[SCE_NP_CLANS_MEMBER_DESCRIPTION_MAX_LENGTH + 1];
bool allowMsg;
//u8 reserved[3];
u8 reserved[3];
};
// Member entry structure

View File

@ -6,17 +6,7 @@
extern Module sceNpCommerce2;
struct sceNpCommerce2Internal
{
bool m_bSceNpCommerce2Initialized;
sceNpCommerce2Internal()
: m_bSceNpCommerce2Initialized(false)
{
}
};
sceNpCommerce2Internal sceNpCommerce2Instance;
std::unique_ptr<SceNpCommerce2Internal> g_sceNpCommerce2;
s32 sceNpCommerce2ExecuteStoreBrowse()
{
@ -34,10 +24,12 @@ s32 sceNpCommerce2Init()
{
sceNpCommerce2.Warning("sceNpCommerce2Init()");
if (sceNpCommerce2Instance.m_bSceNpCommerce2Initialized)
if (g_sceNpCommerce2->m_bSceNpCommerce2Initialized)
{
return SCE_NP_COMMERCE2_ERROR_ALREADY_INITIALIZED;
}
sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = true;
g_sceNpCommerce2->m_bSceNpCommerce2Initialized = true;
return CELL_OK;
}
@ -46,10 +38,12 @@ s32 sceNpCommerce2Term()
{
sceNpCommerce2.Warning("sceNpCommerce2Term()");
if (!sceNpCommerce2Instance.m_bSceNpCommerce2Initialized)
if (!g_sceNpCommerce2->m_bSceNpCommerce2Initialized)
{
return SCE_NP_COMMERCE2_ERROR_NOT_INITIALIZED;
}
sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false;
g_sceNpCommerce2->m_bSceNpCommerce2Initialized = false;
return CELL_OK;
}
@ -314,7 +308,7 @@ s32 sceNpCommerce2DestroyReq()
Module sceNpCommerce2("sceNpCommerce2", []()
{
sceNpCommerce2Instance.m_bSceNpCommerce2Initialized = false;
g_sceNpCommerce2 = std::make_unique<SceNpCommerce2Internal>();
REG_FUNC(sceNpCommerce2, sceNpCommerce2ExecuteStoreBrowse);
REG_FUNC(sceNpCommerce2, sceNpCommerce2GetStoreBrowseUserdata);

View File

@ -132,6 +132,18 @@ enum
SCE_NP_COMMERCE2_DO_PRODUCT_CODE_MEMORY_CONTAINER_SIZE = 16777216,
};
struct SceNpCommerce2Internal
{
bool m_bSceNpCommerce2Initialized;
SceNpCommerce2Internal()
: m_bSceNpCommerce2Initialized(false)
{
}
};
extern std::unique_ptr<SceNpCommerce2Internal> g_sceNpCommerce2;
// Common structure used when receiving data
struct SceNpCommerce2CommonData
{
@ -141,7 +153,7 @@ struct SceNpCommerce2CommonData
be_t<u32> data;
be_t<u32> data_size;
be_t<u32> data2;
//be_t<u32> reserved[4];
be_t<u32> reserved[4];
};
// Structure indicating the range of results obtained
@ -164,7 +176,7 @@ struct SceNpCommerce2SessionInfo
s8 thousandSeparator[SCE_NP_COMMERCE2_THOUSAND_SEPARATOR_LEN + 1];
s8 decimalLetter[SCE_NP_COMMERCE2_DECIMAL_LETTER_LEN + 1];
u8 padding2[1];
//be_t<u32> reserved[4];
be_t<u32> reserved[4];
};
// Structure for category information
@ -254,7 +266,7 @@ struct SceNpCommerce2GameSkuInfo
s8 productId;
s8 contentLinkUrl;
be_t<u32> countOfRewardInfo;
//be_t<u32> reserved[8];
be_t<u32> reserved[8];
};
// Structure of parameters for in-game product browsing
@ -269,11 +281,11 @@ struct SceNpCommerce2ProductCodeParam
be_t<u32> size;
be_t<u32> inputMode; // Unsigned ints go into be_t<u32>, right?
s8 code1[SCE_NP_COMMERCE2_PRODUCT_CODE_BLOCK_LEN + 1];
//s8 padding1[3];
s8 padding1[3];
s8 code2[SCE_NP_COMMERCE2_PRODUCT_CODE_BLOCK_LEN + 1];
//s8 padding2[3];
s8 padding2[3];
s8 code3[SCE_NP_COMMERCE2_PRODUCT_CODE_BLOCK_LEN + 1];
//s8 padding3[3];
s8 padding3[3];
};
typedef void(*SceNpCommerce2Handler)(u32 ctx_id, u32 subject_id, s32 event, s32 error_code, u32 arg);
typedef void(*SceNpCommerce2Handler)(u32 ctx_id, u32 subject_id, s32 event, s32 error_code, u32 arg);

View File

@ -1,10 +1,98 @@
#include "stdafx.h"
#include "Emu/SysCalls/Modules.h"
#include "sceNpSns.h"
extern Module sceNpSns;
std::unique_ptr<SceNpSnsInternal> g_sceNpSns;
s32 sceNpSnsFbInit(/*const SceNpSnsFbInitParams params*/)
{
sceNpSns.Todo("sceNpSnsFbInit(params=???)"/*, params*/);
if (g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_ALREADY_INITIALIZED;
}
g_sceNpSns->m_bSceNpSnsInitialized = true;
// TODO: Use the initialization parameters somewhere
return CELL_OK;
}
s32 sceNpSnsFbTerm()
{
sceNpSns.Warning("sceNpSnsFbTerm()");
if (!g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
}
g_sceNpSns->m_bSceNpSnsInitialized = false;
return CELL_OK;
}
s32 sceNpSnsFbCreateHandle()
{
UNIMPLEMENTED_FUNC(sceNpSns);
if (!g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
s32 sceNpSnsFbDestroyHandle()
{
UNIMPLEMENTED_FUNC(sceNpSns);
if (!g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
s32 sceNpSnsFbAbortHandle()
{
UNIMPLEMENTED_FUNC(sceNpSns);
if (!g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
s32 sceNpSnsFbGetAccessToken()
{
UNIMPLEMENTED_FUNC(sceNpSns);
if (!g_sceNpSns->m_bSceNpSnsInitialized)
{
return SCE_NP_SNS_FB_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
Module sceNpSns("sceNpSns", []()
{
// TODO: Register SNS module functions here
g_sceNpSns = std::make_unique<SceNpSnsInternal>();
REG_FUNC(sceNpSns, sceNpSnsFbInit);
REG_FUNC(sceNpSns, sceNpSnsFbTerm);
REG_FUNC(sceNpSns, sceNpSnsFbCreateHandle);
REG_FUNC(sceNpSns, sceNpSnsFbDestroyHandle);
REG_FUNC(sceNpSns, sceNpSnsFbAbortHandle);
REG_FUNC(sceNpSns, sceNpSnsFbGetAccessToken);
});

View File

@ -25,6 +25,18 @@ enum
SCE_NP_SNS_FB_ERROR_ACCESS_NOT_ALLOWED = 0x8002451c,
};
struct SceNpSnsInternal
{
bool m_bSceNpSnsInitialized;
SceNpSnsInternal()
: m_bSceNpSnsInitialized(false)
{
}
};
extern std::unique_ptr<SceNpSnsInternal> g_sceNpSns;
// Constants for SNS functions
enum
{
@ -37,4 +49,4 @@ struct SceNpSnsFbInitParams
{
be_t<u32> pool;
be_t<u32> poolSize;
};
};

View File

@ -16,7 +16,6 @@
extern Module sceNpTrophy;
// Internal Structs
struct trophy_context_t
{
const u32 id;
@ -41,11 +40,20 @@ struct trophy_handle_t
}
};
std::unique_ptr<SceNpTrophyInternal> g_sceNpTrophy;
// Functions
s32 sceNpTrophyInit(vm::ptr<void> pool, u32 poolSize, u32 containerId, u64 options)
{
sceNpTrophy.Warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options);
if (g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED;
}
g_sceNpTrophy->m_bInitialized = true;
return CELL_OK;
}
@ -53,6 +61,13 @@ s32 sceNpTrophyTerm()
{
sceNpTrophy.Warning("sceNpTrophyTerm()");
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
g_sceNpTrophy->m_bInitialized = false;
return CELL_OK;
}
@ -60,6 +75,11 @@ s32 sceNpTrophyCreateHandle(vm::ptr<u32> handle)
{
sceNpTrophy.Warning("sceNpTrophyCreateHandle(handle=*0x%x)", handle);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
if (!handle)
{
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
@ -74,6 +94,11 @@ s32 sceNpTrophyDestroyHandle(u32 handle)
{
sceNpTrophy.Warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
if (!hndl)
@ -90,6 +115,11 @@ s32 sceNpTrophyAbortHandle(u32 handle)
{
sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=0x%x)", handle);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
if (!hndl)
@ -104,6 +134,11 @@ s32 sceNpTrophyCreateContext(vm::ptr<u32> context, vm::cptr<SceNpCommunicationId
{
sceNpTrophy.Warning("sceNpTrophyCreateContext(context=*0x%x, commId=*0x%x, commSign=*0x%x, options=0x%llx)", context, commId, commSign, options);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
// rough checks for further fmt::format call
if (commId->term || commId->num > 99)
{
@ -137,6 +172,11 @@ s32 sceNpTrophyDestroyContext(u32 context)
{
sceNpTrophy.Warning("sceNpTrophyDestroyContext(context=0x%x)", context);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -153,6 +193,11 @@ s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
{
sceNpTrophy.Error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -233,6 +278,11 @@ s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspa
{
sceNpTrophy.Todo("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace*=0x%x, options=0x%llx)", context, handle, reqspace, options);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -257,6 +307,11 @@ s32 sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 options)
{
sceNpTrophy.Todo("sceNpTrophySetSoundLevel(context=0x%x, handle=0x%x, level=%d, options=0x%llx)", context, handle, level, options);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -264,6 +319,11 @@ s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetai
{
sceNpTrophy.Error("sceNpTrophyGetGameInfo(context=0x%x, handle=0x%x, details=*0x%x, data=*0x%x)", context, handle, details, data);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -285,7 +345,8 @@ s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetai
std::string titleName;
std::string titleDetail;
for (std::shared_ptr<rXmlNode> n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) {
for (std::shared_ptr<rXmlNode> n = doc.GetRoot()->GetChildren(); n; n = n->GetNext())
{
if (n->GetName() == "title-name")
titleName = n->GetNodeContent();
if (n->GetName() == "title-detail")
@ -324,6 +385,11 @@ s32 sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32>
{
sceNpTrophy.Error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -355,6 +421,11 @@ s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophy
{
sceNpTrophy.Error("sceNpTrophyGetTrophyUnlockState(context=0x%x, handle=0x%x, flags=*0x%x, count=*0x%x)", context, handle, flags, count);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -390,6 +461,11 @@ s32 sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceN
{
sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=0x%x, handle=0x%x, trophyId=%d, details=*0x%x, data=*0x%x)", context, handle, trophyId, details, data);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
if (!ctxt)
@ -447,6 +523,11 @@ s32 sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr<s32> percentage)
{
sceNpTrophy.Todo("sceNpTrophyGetGameProgress(context=0x%x, handle=0x%x, percentage=*0x%x)", context, handle, percentage);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -454,6 +535,11 @@ s32 sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr<void> buffer, vm::pt
{
sceNpTrophy.Todo("sceNpTrophyGetGameIcon(context=0x%x, handle=0x%x, buffer=*0x%x, size=*0x%x)", context, handle, buffer, size);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -461,12 +547,19 @@ s32 sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::ptr<void
{
sceNpTrophy.Todo("sceNpTrophyGetTrophyIcon(context=0x%x, handle=0x%x, trophyId=%d, buffer=*0x%x, size=*0x%x)", context, handle, trophyId, buffer, size);
if (!g_sceNpTrophy->m_bInitialized)
{
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
Module sceNpTrophy("sceNpTrophy", []()
{
g_sceNpTrophy = std::make_unique<SceNpTrophyInternal>();
REG_FUNC(sceNpTrophy, sceNpTrophyGetGameProgress);
REG_FUNC(sceNpTrophy, sceNpTrophyRegisterContext);
REG_FUNC(sceNpTrophy, sceNpTrophyCreateHandle);

View File

@ -75,6 +75,18 @@ enum SceNpTrophyGrade
SCE_NP_TROPHY_GRADE_BRONZE = 4,
};
struct SceNpTrophyInternal
{
bool m_bInitialized;
SceNpTrophyInternal()
: m_bInitialized(false)
{
}
};
extern std::unique_ptr<SceNpTrophyInternal> g_sceNpTrophy;
struct SceNpTrophyGameDetails
{
be_t<u32> numTrophies;

View File

@ -7,26 +7,18 @@
extern Module sceNpTus;
struct sceNpTusInternal
{
bool m_bSceNpTusInitialized;
sceNpTusInternal()
: m_bSceNpTusInitialized(false)
{
}
};
sceNpTusInternal sceNpTusInstance;
std::unique_ptr<SceNpTusInternal> g_sceNpTus;
s32 sceNpTusInit()
{
sceNpTus.Warning("sceNpTusInit()");
if (sceNpTusInstance.m_bSceNpTusInitialized)
if (g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED;
}
sceNpTusInstance.m_bSceNpTusInitialized = true;
g_sceNpTus->m_bSceNpTusInitialized = true;
return CELL_OK;
}
@ -35,10 +27,12 @@ s32 sceNpTusTerm()
{
sceNpTus.Warning("sceNpTusTerm()");
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
sceNpTusInstance.m_bSceNpTusInitialized = false;
g_sceNpTus->m_bSceNpTusInitialized = false;
return CELL_OK;
}
@ -47,8 +41,10 @@ s32 sceNpTusCreateTitleCtx()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -57,8 +53,10 @@ s32 sceNpTusDestroyTitleCtx()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -67,8 +65,10 @@ s32 sceNpTusCreateTransactionCtx()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -77,8 +77,10 @@ s32 sceNpTusDestroyTransactionCtx()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -87,8 +89,10 @@ s32 sceNpTusSetTimeout()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -97,8 +101,10 @@ s32 sceNpTusAbortTransaction()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -107,8 +113,10 @@ s32 sceNpTusWaitAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -117,8 +125,10 @@ s32 sceNpTusPollAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -127,8 +137,10 @@ s32 sceNpTusSetMultiSlotVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -137,8 +149,10 @@ s32 sceNpTusSetMultiSlotVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -147,8 +161,10 @@ s32 sceNpTusSetMultiSlotVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -157,8 +173,10 @@ s32 sceNpTusSetMultiSlotVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -167,8 +185,10 @@ s32 sceNpTusGetMultiSlotVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -177,8 +197,10 @@ s32 sceNpTusGetMultiSlotVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -187,8 +209,10 @@ s32 sceNpTusGetMultiSlotVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -197,8 +221,10 @@ s32 sceNpTusGetMultiSlotVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -207,8 +233,10 @@ s32 sceNpTusGetMultiUserVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -217,8 +245,10 @@ s32 sceNpTusGetMultiUserVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -227,8 +257,10 @@ s32 sceNpTusGetMultiUserVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -237,8 +269,10 @@ s32 sceNpTusGetMultiUserVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -247,8 +281,10 @@ s32 sceNpTusAddAndGetVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -257,8 +293,10 @@ s32 sceNpTusAddAndGetVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -267,8 +305,10 @@ s32 sceNpTusAddAndGetVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -277,8 +317,10 @@ s32 sceNpTusAddAndGetVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -287,8 +329,10 @@ s32 sceNpTusTryAndSetVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -297,8 +341,10 @@ s32 sceNpTusTryAndSetVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -307,8 +353,10 @@ s32 sceNpTusTryAndSetVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -317,8 +365,10 @@ s32 sceNpTusTryAndSetVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -327,8 +377,10 @@ s32 sceNpTusDeleteMultiSlotVariable()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -337,8 +389,10 @@ s32 sceNpTusDeleteMultiSlotVariableVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -347,8 +401,10 @@ s32 sceNpTusDeleteMultiSlotVariableAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -357,8 +413,10 @@ s32 sceNpTusDeleteMultiSlotVariableVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -367,8 +425,10 @@ s32 sceNpTusSetData()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -377,8 +437,10 @@ s32 sceNpTusSetDataVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -387,8 +449,10 @@ s32 sceNpTusSetDataAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -397,8 +461,10 @@ s32 sceNpTusSetDataVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -407,8 +473,10 @@ s32 sceNpTusGetData()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -417,8 +485,10 @@ s32 sceNpTusGetDataVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -427,8 +497,10 @@ s32 sceNpTusGetDataAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -437,8 +509,10 @@ s32 sceNpTusGetDataVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -447,8 +521,10 @@ s32 sceNpTusGetMultiSlotDataStatus()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -457,8 +533,10 @@ s32 sceNpTusGetMultiSlotDataStatusVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -467,8 +545,10 @@ s32 sceNpTusGetMultiSlotDataStatusAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -477,8 +557,10 @@ s32 sceNpTusGetMultiSlotDataStatusVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -487,8 +569,10 @@ s32 sceNpTusGetMultiUserDataStatus()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -497,8 +581,10 @@ s32 sceNpTusGetMultiUserDataStatusVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -507,8 +593,10 @@ s32 sceNpTusGetMultiUserDataStatusAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -517,8 +605,10 @@ s32 sceNpTusGetMultiUserDataStatusVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -527,8 +617,10 @@ s32 sceNpTusDeleteMultiSlotData()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -537,8 +629,10 @@ s32 sceNpTusDeleteMultiSlotDataVUser()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -547,8 +641,10 @@ s32 sceNpTusDeleteMultiSlotDataAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -557,15 +653,17 @@ s32 sceNpTusDeleteMultiSlotDataVUserAsync()
{
UNIMPLEMENTED_FUNC(sceNpTus);
if (!sceNpTusInstance.m_bSceNpTusInitialized)
if (!g_sceNpTus->m_bSceNpTusInitialized)
{
return SCE_NP_COMMUNITY_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
Module sceNpTus("sceNpTus", []()
{
sceNpTusInstance.m_bSceNpTusInitialized = false;
g_sceNpTus = std::make_unique<SceNpTusInternal>();
REG_FUNC(sceNpTus, sceNpTusInit);
REG_FUNC(sceNpTus, sceNpTusTerm);

View File

@ -13,6 +13,18 @@ enum
SCE_NP_TUS_MAX_USER_NUM_PER_TRANS = 101,
};
struct SceNpTusInternal
{
bool m_bSceNpTusInitialized;
SceNpTusInternal()
: m_bSceNpTusInitialized(false)
{
}
};
extern std::unique_ptr<SceNpTusInternal> g_sceNpTus;
SceNpOnlineId SceNpTusVirtualUserId;
// Structure for representing a TUS variable
@ -20,19 +32,19 @@ struct SceNpTusVariable
{
SceNpId ownerId;
be_t<s32> hasData;
//u8 pad[4];
u8 pad[4];
CellRtcTick lastChangedDate;
SceNpId lastChangedAuthorId;
be_t<s64> variable;
be_t<s64> oldVariable;
//u8 reserved[16];
u8 reserved[16];
};
// Structure for representing the accessory information of a TUS data
struct SceNpTusDataInfo
{
be_t<u32> infoSize;
//u8 pad[4];
u8 pad[4];
u8 data[SCE_NP_TUS_DATA_INFO_MAX_SIZE];
};
@ -45,6 +57,6 @@ struct SceNpTusDataStatus
SceNpId lastChangedAuthorId;
be_t<u32> data;
be_t<u32> dataSize;
//u8 pad[4];
u8 pad[4];
SceNpTusDataInfo info;
};

View File

@ -3,20 +3,11 @@
#include "Emu/SysCalls/Modules.h"
#include "sceNp.h"
#include "sceNpUtil.h"
extern Module sceNpUtil;
struct sceNpUtilInternal
{
bool m_bSceNpUtilBandwidthTestInitialized;
sceNpUtilInternal()
: m_bSceNpUtilBandwidthTestInitialized(false)
{
}
};
sceNpUtilInternal sceNpUtilInstance;
std::unique_ptr<SceNpUtilInternal> g_sceNpUtil;
s32 sceNpUtilCmpNpId()
{
@ -34,10 +25,12 @@ s32 sceNpUtilBandwidthTestInitStart(u32 prio, size_t stack)
{
UNIMPLEMENTED_FUNC(sceNpUtil);
if (sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized)
if (g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized)
{
return SCE_NP_ERROR_ALREADY_INITIALIZED;
}
sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized = true;
g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized = true;
return CELL_OK;
}
@ -46,8 +39,10 @@ s32 sceNpUtilBandwidthTestGetStatus()
{
UNIMPLEMENTED_FUNC(sceNpUtil);
if (!sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized)
if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized)
{
return SCE_NP_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
@ -56,10 +51,12 @@ s32 sceNpUtilBandwidthTestShutdown()
{
UNIMPLEMENTED_FUNC(sceNpUtil);
if (!sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized)
if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized)
{
return SCE_NP_ERROR_NOT_INITIALIZED;
}
sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized = false;
g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized = false;
return CELL_OK;
}
@ -68,15 +65,17 @@ s32 sceNpUtilBandwidthTestAbort()
{
UNIMPLEMENTED_FUNC(sceNpUtil);
if (!sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized)
if (!g_sceNpUtil->m_bSceNpUtilBandwidthTestInitialized)
{
return SCE_NP_ERROR_NOT_INITIALIZED;
}
return CELL_OK;
}
Module sceNpUtil("sceNpUtil", []()
{
sceNpUtilInstance.m_bSceNpUtilBandwidthTestInitialized = false;
g_sceNpUtil = std::make_unique<SceNpUtilInternal>();
REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestInitStart);
REG_FUNC(sceNpUtil, sceNpUtilBandwidthTestShutdown);

View File

@ -0,0 +1,13 @@
#pragma once
struct SceNpUtilInternal
{
bool m_bSceNpUtilBandwidthTestInitialized;
SceNpUtilInternal()
: m_bSceNpUtilBandwidthTestInitialized(false)
{
}
};
extern std::unique_ptr<SceNpUtilInternal> g_sceNpUtil;

View File

@ -574,6 +574,7 @@
<ClInclude Include="Emu\SysCalls\Modules\sceNpTus.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellKb.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellMouse.h" />
<ClInclude Include="Emu\SysCalls\Modules\sceNpUtil.h" />
<ClInclude Include="Emu\SysCalls\Modules\sysPrxForUser.h" />
<ClInclude Include="Emu\SysCalls\Modules\sys_lv2dbg.h" />
<ClInclude Include="Emu\SysCalls\Modules\sys_net.h" />

View File

@ -1735,5 +1735,8 @@
<ClInclude Include="Emu\SysCalls\Modules\sys_lv2dbg.h">
<Filter>Emu\SysCalls\Modules</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\Modules\sceNpUtil.h">
<Filter>Emu\SysCalls\Modules</Filter>
</ClInclude>
</ItemGroup>
</Project>