No need to manually decide pending or not for mipscalls.

This commit is contained in:
shenweip committed 2020-03-16 07:46:13 +08:00
1 parent 3ffb20b66b
commit 2f088d0970
3 files changed
+10 -17

No files matched your search

+4 -11
View File
@@ -498,13 +498,11 @@ public:
}
void Done() {
bool needPending = false;
for (size_t i = 0; i < fonts_.size(); i++) {
if (isfontopen_[i] == FONT_IS_OPEN) {
CloseFont(fontMap[fonts_[i]]);
delete fontMap[fonts_[i]];
fontMap.erase(fonts_[i]);
needPending = true; // Pending all the next mipcalls.
}
}
u32 args[2] = { params_.userDataAddr, (u32)handle_ };
@@ -620,24 +618,19 @@ public:
return loadedFont;
}
void CloseFont(LoadedFont *font, bool needPending = false) {
if (charInfoBitmapAddress_ != 0)
needPending = true;
flushFont();
void CloseFont(LoadedFont *font) {
for (size_t i = 0; i < fonts_.size(); i++) {
if (fonts_[i] == font->Handle()) {
isfontopen_[i] = 0;
if (openAllocatedAddresses_[i] != 0) {
u32 args[2] = { userDataAddr(), openAllocatedAddresses_[i] };
__KernelDirectMipsCall(freeFuncAddr(), 0, args, 2, true, needPending);
__KernelDirectMipsCall(freeFuncAddr(), 0, args, 2, true);
openAllocatedAddresses_[i] = 0;
}
break;
}
}
flushFont();
font->Close();
}
@@ -763,7 +756,7 @@ void PostCharInfoFreeCallback::run(MipsCall &call) {
action->SetFontLib(fontLibID_);
u32 args[2] = { fontLib->userDataAddr(), allocSize };
__KernelDirectMipsCall(fontLib->allocFuncAddr(), action, args, 2, true, true);
__KernelDirectMipsCall(fontLib->allocFuncAddr(), action, args, 2, true);
}
inline bool LoadedFont::GetCharInfo(int charCode, PGFCharInfo *charInfo, int glyphType) const {
+5 -5
View File
@@ -3125,10 +3125,10 @@ void __KernelChangeThreadState(Thread *thread, ThreadStatus newStatus) {
static bool __CanExecuteCallbackNow(Thread *thread) {
return g_inCbCount == 0;
return currentCallbackThreadID == 0 && g_inCbCount == 0;
}
void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, const u32 args[], int numargs, bool reschedAfter, SceUID cbId, bool forcePending = false)
void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, const u32 args[], int numargs, bool reschedAfter, SceUID cbId)
{
if (!thread || thread->isStopped()) {
WARN_LOG_REPORT(SCEKERNEL, "Running mipscall on dormant thread");
@@ -3179,7 +3179,7 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, co
u32 callId = mipsCalls.add(call);
bool called = false;
if ((!thread || thread == __GetCurrentThread()) && !forcePending) {
if ((!thread || thread == __GetCurrentThread())) {
if (__CanExecuteCallbackNow(thread)) {
thread = __GetCurrentThread();
__KernelChangeThreadState(thread, THREADSTATUS_RUNNING);
@@ -3197,9 +3197,9 @@ void __KernelCallAddress(Thread *thread, u32 entryPoint, Action *afterAction, co
}
}
void __KernelDirectMipsCall(u32 entryPoint, Action *afterAction, u32 args[], int numargs, bool reschedAfter, bool forcePending)
void __KernelDirectMipsCall(u32 entryPoint, Action *afterAction, u32 args[], int numargs, bool reschedAfter)
{
__KernelCallAddress(__GetCurrentThread(), entryPoint, afterAction, args, numargs, reschedAfter, 0, forcePending);
__KernelCallAddress(__GetCurrentThread(), entryPoint, afterAction, args, numargs, reschedAfter, 0);
}
bool __KernelExecuteMipsCallOnCurrentThread(u32 callId, bool reschedAfter)
+1 -1
View File
@@ -219,7 +219,7 @@ int sceKernelReferCallbackStatus(SceUID cbId, u32 statusAddr);
class Action;
// Not an official Callback object, just calls a mips function on the current thread.
void __KernelDirectMipsCall(u32 entryPoint, Action *afterAction, u32 args[], int numargs, bool reschedAfter, bool forcePending = false);
void __KernelDirectMipsCall(u32 entryPoint, Action *afterAction, u32 args[], int numargs, bool reschedAfter);
void __KernelReturnFromMipsCall(); // Called as HLE function
bool __KernelInCallback();