This commit is contained in:
Arian K. 2026-07-09 16:47:30 +00:00 committed by GitHub
commit 096254f7a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 44 additions and 15 deletions

View File

@ -1307,8 +1307,9 @@ LatteTexture::LatteTexture(Latte::E_DIM dim, MPTR physAddress, MPTR physMipAddre
}
}
}
// determine if this texture should ever be mirrored to CPU RAM
if (this->tileMode == Latte::E_HWTILEMODE::TM_LINEAR_ALIGNED)
// determine if this texture should ever be mirrored to CPU RAM.
if (this->tileMode == Latte::E_HWTILEMODE::TM_LINEAR_ALIGNED ||
this->tileMode == Latte::E_HWTILEMODE::TM_LINEAR_GENERAL)
{
this->enableReadback = true;
}

View File

@ -275,7 +275,23 @@ namespace coreinit
cemuLog_log(LogType::Force, "FSShutdown called");
}
FS_RESULT FSAddClientEx(FSClient_t* fsClient, uint32 uknR4, uint32 errHandling)
struct AttachCallbackData
{
/* +0x00 */ uint8 unk[0x1c];
/* +0x1c */ char mountName[8];
};
SysAllocator<AttachCallbackData> s_fsAttachCallbackData;
void invokeAttachCallback(FSAttachParams& attachParams)
{
*s_fsAttachCallbackData = { .mountName = "sdcard" /* expected by Mii Maker */ };
PPCCoreCallback(attachParams.userCallback,
0 /* r3 = unknown */, 1 /* r4 = non-zero means device is attached */,
s_fsAttachCallbackData.GetMPTR(), attachParams.userContext);
}
FS_RESULT FSAddClientEx(FSClient_t* fsClient, FSAttachParams* attachParams, uint32 errHandling)
{
if (!sFSInitialized || sFSShutdown || !fsClient)
{
@ -283,15 +299,13 @@ namespace coreinit
return FS_RESULT::FATAL_ERROR;
}
FSLockMutex();
if (uknR4 != 0)
if (attachParams != nullptr &&
attachParams->userCallback == nullptr)
{
uint32 uknValue = memory_readU32(uknR4 + 0x00);
if (uknValue == 0)
{
FSUnlockMutex();
__FSErrorAndBlock("FSAddClientEx - unknown error");
return FS_RESULT::FATAL_ERROR;
}
FSUnlockMutex();
// "FS: FSAddClient: attachParams->userCallback must be set.\n"
__FSErrorAndBlock("FSAddClientEx - unknown error");
return FS_RESULT::FATAL_ERROR;
}
if (__FSIsClientRegistered(__FSGetClientBody(fsClient)))
{
@ -324,12 +338,16 @@ namespace coreinit
fsClientBody->fsClientBodyNext = nullptr;
}
FSUnlockMutex();
if (attachParams != nullptr) // invoke right before returning
invokeAttachCallback(*attachParams);
return FS_RESULT::SUCCESS;
}
FS_RESULT FSAddClient(FSClient_t* fsClient, uint32 errHandling)
{
return FSAddClientEx(fsClient, 0, errHandling);
return FSAddClientEx(fsClient, nullptr, errHandling);
}
FS_RESULT FSDelClient(FSClient_t* fsClient, uint32 errHandling)
@ -570,6 +588,7 @@ namespace coreinit
case FSA_CMD_OPERATION_TYPE::MAKEDIR:
case FSA_CMD_OPERATION_TYPE::REMOVE:
case FSA_CMD_OPERATION_TYPE::RENAME:
case FSA_CMD_OPERATION_TYPE::REWINDDIR:
case FSA_CMD_OPERATION_TYPE::CLOSEDIR:
case FSA_CMD_OPERATION_TYPE::READ:
case FSA_CMD_OPERATION_TYPE::WRITE:
@ -2718,6 +2737,8 @@ namespace coreinit
cafeExportRegister("coreinit", FSReadDir, LogType::CoreinitFile);
cafeExportRegister("coreinit", FSCloseDirAsync, LogType::CoreinitFile);
cafeExportRegister("coreinit", FSCloseDir, LogType::CoreinitFile);
cafeExportRegister("coreinit", FSRewindDirAsync, LogType::CoreinitFile);
cafeExportRegister("coreinit", FSRewindDir, LogType::CoreinitFile);
// stat
cafeExportRegister("coreinit", FSGetFreeSpaceSizeAsync, LogType::CoreinitFile);

View File

@ -18,6 +18,13 @@ struct FSAsyncParams
};
static_assert(sizeof(FSAsyncParams) == 0xC);
struct FSAttachParams
{
MEMPTR<void> userCallback;
MEMPTR<void> userContext;
};
static_assert(sizeof(FSAttachParams) == 0x8);
namespace coreinit
{
struct FSCmdBlockBody;
@ -242,7 +249,7 @@ namespace coreinit
sint32 __FSQueryInfoAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, uint8* queryString, uint32 queryType, void* queryResult, uint32 errHandling, FSAsyncParams* fsAsyncParams);
// coreinit exports
FS_RESULT FSAddClientEx(FSClient_t* fsClient, uint32 uknR4, uint32 errHandling);
FS_RESULT FSAddClientEx(FSClient_t* fsClient, FSAttachParams* attachParams, uint32 errHandling);
FS_RESULT FSAddClient(FSClient_t* fsClient, uint32 errHandling);
FS_RESULT FSDelClient(FSClient_t* fsClient, uint32 errHandling);
@ -292,6 +299,8 @@ namespace coreinit
sint32 FSReadDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, FSDirEntry_t* dirEntryOut, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSCloseDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask);
sint32 FSRewindDirAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSRewindDir(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, FSDirHandle2 dirHandle, uint32 errorMask);
sint32 FSFlushQuotaAsync(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask, FSAsyncParams* fsAsyncParams);
sint32 FSFlushQuota(FSClient_t* fsClient, FSCmdBlock_t* fsCmdBlock, char* path, uint32 errorMask);

View File

@ -176,8 +176,6 @@ void gx2Export_GX2SetColorBuffer(PPCInterpreter_t* hCPU)
gx2WriteGather_submitU32AsBE(mmCB_COLOR0_SIZE - 0xA000 + hCPU->gpr[4]);
gx2WriteGather_submitU32AsBE((uint32)colorBufferBE->reg_size);
cemu_assert_debug(tileMode != Latte::E_GX2TILEMODE::TM_LINEAR_SPECIAL);
// set mmCB_COLOR*_VIEW
gx2WriteGather_submit(
pm4HeaderType3(IT_SET_CONTEXT_REG, 2),