Skip to content

Commit

Permalink
vt: Decompile vtutil.c
Browse files Browse the repository at this point in the history
  • Loading branch information
entriphy committed Jul 15, 2024
1 parent 2518118 commit faf1723
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set_target_properties(PS2_CRT0 PROPERTIES OUTPUT_NAME "crt0.o")
set(EXECUTABLES)

# C files
set(SUBDIRS abe harada hato hoshino kazuya nakano okanoyo taka take okanoyo/debug vtusr/taro okanoyo/linux)
set(SUBDIRS abe harada hato hoshino kazuya nakano okanoyo taka take okanoyo/debug vtusr vtusr/taro okanoyo/linux)
foreach (SUBDIR IN LISTS SUBDIRS)
file(GLOB files src/${SUBDIR}/*.c)
foreach (file ${files})
Expand Down
37 changes: 36 additions & 1 deletion src/vtusr/vtutil.c
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;
}
1 change: 1 addition & 0 deletions src/vtusr/vtutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "common.h"

extern u128* vtFileRead(char *name);
extern void* vtGetBuf64(u32 size);

#endif

0 comments on commit faf1723

Please sign in to comment.