mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +01:00
nn_fp: Multiple fixes
This commit is contained in:
parent
b0a7fd4e07
commit
f3c95f72e7
@ -328,6 +328,7 @@ namespace iosu
|
|||||||
static const auto FPResult_Ok = 0;
|
static const auto FPResult_Ok = 0;
|
||||||
static const auto FPResult_InvalidIPCParam = BUILD_NN_RESULT(NN_RESULT_LEVEL_LVL6, NN_RESULT_MODULE_NN_FP, 0x680);
|
static const auto FPResult_InvalidIPCParam = BUILD_NN_RESULT(NN_RESULT_LEVEL_LVL6, NN_RESULT_MODULE_NN_FP, 0x680);
|
||||||
static const auto FPResult_RequestFailed = BUILD_NN_RESULT(NN_RESULT_LEVEL_FATAL, NN_RESULT_MODULE_NN_FP, 0); // figure out proper error code
|
static const auto FPResult_RequestFailed = BUILD_NN_RESULT(NN_RESULT_LEVEL_FATAL, NN_RESULT_MODULE_NN_FP, 0); // figure out proper error code
|
||||||
|
static const auto FPResult_Aborted = BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_FP, 0x3480);
|
||||||
|
|
||||||
class FPDService : public iosu::nn::IPCSimpleService
|
class FPDService : public iosu::nn::IPCSimpleService
|
||||||
{
|
{
|
||||||
@ -586,7 +587,7 @@ namespace iosu
|
|||||||
if (!ActiveSettings::IsOnlineEnabled())
|
if (!ActiveSettings::IsOnlineEnabled())
|
||||||
{
|
{
|
||||||
// not online, fail immediately
|
// not online, fail immediately
|
||||||
return BUILD_NN_RESULT(NN_RESULT_LEVEL_FATAL, NN_RESULT_MODULE_NN_FP, 0); // todo
|
return FPResult_Ok; // Splatoon expects this to always return success otherwise it will softlock. This should be FPResult_Aborted?
|
||||||
}
|
}
|
||||||
StartFriendSession();
|
StartFriendSession();
|
||||||
fpdClient->hasLoggedIn = true;
|
fpdClient->hasLoggedIn = true;
|
||||||
|
@ -55,8 +55,8 @@ namespace nn
|
|||||||
{
|
{
|
||||||
std::unique_lock _l(m_mtx);
|
std::unique_lock _l(m_mtx);
|
||||||
void* p = g_fp.fpBufferHeap->alloc(size, 32);
|
void* p = g_fp.fpBufferHeap->alloc(size, 32);
|
||||||
uint32 heapSize, allocationSize, allocNum;
|
if (!p)
|
||||||
g_fp.fpBufferHeap->getStats(heapSize, allocationSize, allocNum);
|
cemuLog_log(LogType::Force, "nn_fp: Internal heap is full");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +153,11 @@ namespace nn
|
|||||||
totalBufferSize += m_vec[i].size;
|
totalBufferSize += m_vec[i].size;
|
||||||
totalBufferSize = (totalBufferSize+31)&~31;
|
totalBufferSize = (totalBufferSize+31)&~31;
|
||||||
}
|
}
|
||||||
|
if(totalBufferSize > 0)
|
||||||
|
{
|
||||||
m_dataBuffer = FPIpcBufferAllocator.Allocate(totalBufferSize, 32);
|
m_dataBuffer = FPIpcBufferAllocator.Allocate(totalBufferSize, 32);
|
||||||
cemu_assert_debug(m_dataBuffer);
|
cemu_assert_debug(m_dataBuffer);
|
||||||
|
}
|
||||||
// update Ioctl vector addresses
|
// update Ioctl vector addresses
|
||||||
for(uint8 i=0; i<m_numVecIn + m_numVecOut; i++)
|
for(uint8 i=0; i<m_numVecIn + m_numVecOut; i++)
|
||||||
{
|
{
|
||||||
@ -176,9 +179,7 @@ namespace nn
|
|||||||
ppcDefineParamPtr(ipcCtx, FPIpcContext, 1);
|
ppcDefineParamPtr(ipcCtx, FPIpcContext, 1);
|
||||||
ipcCtx->m_asyncResult = result; // store result in variable since FP callbacks pass a pointer to nnResult and not the value directly
|
ipcCtx->m_asyncResult = result; // store result in variable since FP callbacks pass a pointer to nnResult and not the value directly
|
||||||
ipcCtx->CopyBackOutputs();
|
ipcCtx->CopyBackOutputs();
|
||||||
cemuLog_logDebug(LogType::Force, "[DBG] AsyncHandler BeforeCallback");
|
|
||||||
PPCCoreCallback(ipcCtx->m_callbackFunc, &ipcCtx->m_asyncResult, ipcCtx->m_callbackParam);
|
PPCCoreCallback(ipcCtx->m_callbackFunc, &ipcCtx->m_asyncResult, ipcCtx->m_callbackParam);
|
||||||
cemuLog_logDebug(LogType::Force, "[DBG] AsyncHandler AfterCallback");
|
|
||||||
delete ipcCtx;
|
delete ipcCtx;
|
||||||
osLib_returnFromFunction(hCPU, 0);
|
osLib_returnFromFunction(hCPU, 0);
|
||||||
}
|
}
|
||||||
|
@ -489,6 +489,11 @@ private:
|
|||||||
|
|
||||||
bool _alloc(uint32 size, uint32 alignment, uint32& allocOffsetOut)
|
bool _alloc(uint32 size, uint32 alignment, uint32& allocOffsetOut)
|
||||||
{
|
{
|
||||||
|
if(size == 0)
|
||||||
|
{
|
||||||
|
size = 1; // zero-sized allocations are not supported
|
||||||
|
cemu_assert_suspicious();
|
||||||
|
}
|
||||||
// find smallest bucket to scan
|
// find smallest bucket to scan
|
||||||
uint32 alignmentM1 = alignment - 1;
|
uint32 alignmentM1 = alignment - 1;
|
||||||
uint32 bucketIndex = ulog2(size);
|
uint32 bucketIndex = ulog2(size);
|
||||||
@ -521,7 +526,10 @@ private:
|
|||||||
{
|
{
|
||||||
auto it = map_allocatedRange.find(addrOffset);
|
auto it = map_allocatedRange.find(addrOffset);
|
||||||
if (it == map_allocatedRange.end())
|
if (it == map_allocatedRange.end())
|
||||||
assert_dbg();
|
{
|
||||||
|
cemuLog_log(LogType::Force, "VHeap internal error");
|
||||||
|
cemu_assert(false);
|
||||||
|
}
|
||||||
allocRange_t* range = it->second;
|
allocRange_t* range = it->second;
|
||||||
map_allocatedRange.erase(it);
|
map_allocatedRange.erase(it);
|
||||||
m_statsMemAllocated -= range->size;
|
m_statsMemAllocated -= range->size;
|
||||||
|
Loading…
Reference in New Issue
Block a user