Clean up a few IO wrappers with deferred HLE.
This commit is contained in:
parent
f75f2748b1
commit
a4154dbc17
2 changed files with 28 additions and 24 deletions
|
@ -370,16 +370,16 @@ u32 sceIoLseek32(int id, int offset, int whence) {
|
|||
}
|
||||
}
|
||||
|
||||
u32 sceIoOpen(const char* filename, int mode) {
|
||||
u32 sceIoOpen(const char* filename, int flags, int mode) {
|
||||
//memory stick filename
|
||||
int access = FILEACCESS_NONE;
|
||||
if (mode & O_RDONLY)
|
||||
if (flags & O_RDONLY)
|
||||
access |= FILEACCESS_READ;
|
||||
if (mode & O_WRONLY)
|
||||
if (flags & O_WRONLY)
|
||||
access |= FILEACCESS_WRITE;
|
||||
if (mode & O_APPEND)
|
||||
if (flags & O_APPEND)
|
||||
access |= FILEACCESS_APPEND;
|
||||
if (mode & O_CREAT)
|
||||
if (flags & O_CREAT)
|
||||
access |= FILEACCESS_CREATE;
|
||||
|
||||
hleReSchedule("file opened");
|
||||
|
@ -388,8 +388,8 @@ u32 sceIoOpen(const char* filename, int mode) {
|
|||
if (h == 0)
|
||||
{
|
||||
ERROR_LOG(HLE,
|
||||
"ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpen(%s, %08x) - file not found",
|
||||
filename, mode);
|
||||
"ERROR_ERRNO_FILE_NOT_FOUND=sceIoOpen(%s, %08x, %08x) - file not found",
|
||||
filename, flags, mode);
|
||||
return ERROR_ERRNO_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ u32 sceIoOpen(const char* filename, int mode) {
|
|||
f->handle = h;
|
||||
f->fullpath = filename;
|
||||
f->asyncResult = id;
|
||||
DEBUG_LOG(HLE, "%i=sceIoOpen(%s, %08x)", id, filename, mode);
|
||||
DEBUG_LOG(HLE, "%i=sceIoOpen(%s, %08x, %08x)", id, filename, flags, mode);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -675,10 +675,10 @@ u32 sceIoChdir(const char *dirname) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void sceIoChangeAsyncPriority()
|
||||
int sceIoChangeAsyncPriority(int id, int priority)
|
||||
{
|
||||
ERROR_LOG(HLE, "UNIMPL sceIoChangeAsyncPriority(%d)", PARAM(0));
|
||||
RETURN(0);
|
||||
ERROR_LOG(HLE, "UNIMPL sceIoChangeAsyncPriority(%d, %d)", id, priority);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 __IoClose(SceUID id, int param)
|
||||
|
@ -688,13 +688,12 @@ u32 __IoClose(SceUID id, int param)
|
|||
return kernelObjects.Destroy < FileNode > (id);
|
||||
}
|
||||
|
||||
//TODO Not really sure if this should be wrapped nor how
|
||||
void sceIoCloseAsync()
|
||||
int sceIoCloseAsync(SceUID id)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceIoCloseAsync(%d)", PARAM(0));
|
||||
DEBUG_LOG(HLE, "sceIoCloseAsync(%d)", id);
|
||||
//sceIoClose();
|
||||
defAction = &__IoClose;
|
||||
RETURN(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sceIoLseekAsync(int id, s64 offset, int whence)
|
||||
|
@ -731,13 +730,13 @@ u32 sceIoLseek32Async(int id, int offset, int whence)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sceIoOpenAsync(const char *filename, int mode)
|
||||
u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceIoOpenAsync() sorta implemented");
|
||||
RETURN(sceIoOpen(filename, mode));
|
||||
// __IoCompleteAsyncIO(currentMIPS->r[2]); // The return value
|
||||
// We have to return a UID here, which may have been destroyed when we reach Wait if it failed.
|
||||
// Now that we're just faking it, we just don't RETURN(0) here.
|
||||
u32 fd = sceIoOpen(filename, flags, mode);
|
||||
//__IoCompleteAsyncIO(fd); // The return value
|
||||
// We have to return an fd here, which may have been destroyed when we reach Wait if it failed.
|
||||
return fd;
|
||||
}
|
||||
|
||||
u32 sceIoReadAsync(int id, u32 data_addr, int size)
|
||||
|
@ -931,17 +930,17 @@ const HLEFunction IoFileMgrForUser[] = {
|
|||
{ 0x08bd7374, 0, "sceIoGetDevType" },
|
||||
{ 0xB2A628C1, &WrapU_CCCU<sceIoAssign>, "sceIoAssign" },
|
||||
{ 0xe8bc6571, 0, "sceIoCancel" },
|
||||
{ 0xb293727f, sceIoChangeAsyncPriority, "sceIoChangeAsyncPriority" },
|
||||
{ 0xb293727f, &WrapI_II<sceIoChangeAsyncPriority>, "sceIoChangeAsyncPriority" },
|
||||
{ 0x810C4BC3, &WrapU_I<sceIoClose>, "sceIoClose" }, //(int fd);
|
||||
{ 0xff5940b6, sceIoCloseAsync, "sceIoCloseAsync" },
|
||||
{ 0xff5940b6, &WrapI_I<sceIoCloseAsync>, "sceIoCloseAsync" },
|
||||
{ 0x54F5FB11, &WrapU_CIUIUI<sceIoDevctl>, "sceIoDevctl" }, //(const char *name int cmd, void *arg, size_t arglen, void *buf, size_t *buflen);
|
||||
{ 0xcb05f8d6, &WrapU_IUU<sceIoGetAsyncStat>, "sceIoGetAsyncStat" },
|
||||
{ 0x27EB27B8, &WrapI64_II64I<sceIoLseek>, "sceIoLseek" }, //(int fd, int offset, int whence);
|
||||
{ 0x68963324, &WrapU_III<sceIoLseek32>, "sceIoLseek32" },
|
||||
{ 0x1b385d8f, &WrapU_III<sceIoLseek32Async>, "sceIoLseek32Async" },
|
||||
{ 0x71b19e77, &WrapU_II64I<sceIoLseekAsync>, "sceIoLseekAsync" },
|
||||
{ 0x109F50BC, &WrapU_CI<sceIoOpen>, "sceIoOpen" }, //(const char* file, int mode);
|
||||
{ 0x89AA9906, &WrapV_CI<sceIoOpenAsync>, "sceIoOpenAsync" },
|
||||
{ 0x109F50BC, &WrapU_CII<sceIoOpen>, "sceIoOpen" }, //(const char* file, int mode);
|
||||
{ 0x89AA9906, &WrapU_CII<sceIoOpenAsync>, "sceIoOpenAsync" },
|
||||
{ 0x06A70004, &WrapU_CI<sceIoMkdir>, "sceIoMkdir" }, //(const char *dir, int mode);
|
||||
{ 0x3251ea56, &WrapU_IU<sceIoPollAsync>, "sceIoPollAsync" },
|
||||
{ 0x6A638D83, &WrapU_IUI<sceIoRead>, "sceIoRead" }, //(int fd, void *data, int size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue