mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Io: Allow adjusting default async thread priority.
This commit is contained in:
parent
70ddfc7c86
commit
7e345dad11
1 changed files with 17 additions and 2 deletions
|
@ -199,6 +199,7 @@ struct IoAsyncParams {
|
|||
|
||||
static IoAsyncParams asyncParams[PSP_COUNT_FDS];
|
||||
static HLEHelperThread *asyncThreads[PSP_COUNT_FDS]{};
|
||||
static int asyncDefaultPriority = -1;
|
||||
|
||||
class FileNode : public KernelObject {
|
||||
public:
|
||||
|
@ -662,7 +663,7 @@ void __IoInit() {
|
|||
}
|
||||
|
||||
void __IoDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceIo", 1, 4);
|
||||
auto s = p.Section("sceIo", 1, 5);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
|
@ -722,6 +723,12 @@ void __IoDoState(PointerWrap &p) {
|
|||
asyncThreads[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (s >= 5) {
|
||||
p.Do(asyncDefaultPriority);
|
||||
} else {
|
||||
asyncDefaultPriority = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void __IoShutdown() {
|
||||
|
@ -739,6 +746,7 @@ void __IoShutdown() {
|
|||
delete asyncThreads[i];
|
||||
asyncThreads[i] = nullptr;
|
||||
}
|
||||
asyncDefaultPriority = -1;
|
||||
|
||||
pspFileSystem.Unmount("ms0:", memstickSystem);
|
||||
pspFileSystem.Unmount("fatms0:", memstickSystem);
|
||||
|
@ -772,7 +780,9 @@ u32 __IoGetFileHandleFromId(u32 id, u32 &outError)
|
|||
|
||||
static void IoStartAsyncThread(int id, FileNode *f) {
|
||||
IoAsyncCleanupThread(id, true);
|
||||
int priority = asyncParams[id].priority == -1 ? KernelCurThreadPriority() : asyncParams[id].priority;
|
||||
int priority = asyncParams[id].priority == -1 ? asyncDefaultPriority : asyncParams[id].priority;
|
||||
if (priority == -1)
|
||||
priority = KernelCurThreadPriority();
|
||||
asyncThreads[id] = new HLEHelperThread("SceIoAsync", "IoFileMgrForUser", "__IoAsyncFinish", priority, 0x200);
|
||||
asyncThreads[id]->Start(id, 0);
|
||||
f->pendingAsyncResult = true;
|
||||
|
@ -1963,6 +1973,11 @@ static int sceIoChangeAsyncPriority(int id, int priority) {
|
|||
return hleLogError(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "illegal priority %d", priority);
|
||||
}
|
||||
|
||||
if (id == -1) {
|
||||
asyncDefaultPriority = priority;
|
||||
return hleLogSuccessI(SCEIO, 0);
|
||||
}
|
||||
|
||||
u32 error;
|
||||
FileNode *f = __IoGetFd(id, error);
|
||||
if (!f) {
|
||||
|
|
Loading…
Add table
Reference in a new issue