-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
#include <sifdev.h> | ||
#include "vtusr/vtutil.h" | ||
#include "okanoyo/okio.h" | ||
|
||
u128* vtFileRead(char *name) { | ||
s32 fd; | ||
s32 size; | ||
u128 *buf; | ||
char tmp; | ||
s32 status; | ||
|
||
fd = sceOpen(name, SCE_RDONLY); | ||
if (fd < 0) { | ||
printf("can't open [%s]\n", name); | ||
return NULL; | ||
} | ||
|
||
size = sceLseek(fd, 0, SEEK_END); | ||
sceLseek(fd, 0, SEEK_SET); | ||
buf = getBuff(1, size, &tmp, &status); | ||
if (sceRead(fd, buf, size) < 0) { | ||
printf("load failed [%s]\n", name); | ||
return NULL; | ||
} else { | ||
printf("load sucees %d byte\n", size); // sucees | ||
sceClose(fd); | ||
return buf; | ||
} | ||
} | ||
|
||
void* vtGetBuf64(u32 size) { | ||
// TODO | ||
char tmp; | ||
s32 status; | ||
void *buf; | ||
|
||
buf = getBuff(1, size + 0x3F, &tmp, &status); | ||
buf = (void *)(((u32)buf - 1) & ~0x3F); | ||
buf = (void *)((u8 *)buf + 0x40); | ||
return buf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
#include "common.h" | ||
|
||
extern u128* vtFileRead(char *name); | ||
extern void* vtGetBuf64(u32 size); | ||
|
||
#endif |