Skip to content
Permalink
Browse files

- added a /dev/iosuhax node

- added own thread for /dev/iosuhax message queue
- added several ipc ioctl commands to allow PPC access to iosuhax similar to wupclient (even more advanced)
- added udp logger for debugging (not compiled by default)
  • Loading branch information...
dimok789 committed Nov 17, 2016
1 parent c6d0cf0 commit 6053080d92c1b703a91db0b5c81cbb3e0a93fc57

Large diffs are not rendered by default.

@@ -1,44 +1,58 @@
#ifndef FSA_H
#define FSA_H

typedef struct
{
u32 unk[0x19];
char name[0x100];
}directoryEntry_s;

typedef struct
{
u32 unk1[0x4];
u32 size; // size in bytes
u32 physsize; // physical size on disk in bytes
u32 unk2[0x13];
}fileStat_s;

#define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0)
#define FSA_MOUNTFLAGS_GLOBAL (1 << 1)

int FSA_Open();

int FSA_Mount(int fd, char* device_path, char* volume_path, u32 flags, char* arg_string, int arg_string_len);
int FSA_Unmount(int fd, char* path, u32 flags);

int FSA_GetDeviceInfo(int fd, char* device_path, int type, u32* out_data);

int FSA_MakeDir(int fd, char* path, u32 flags);
int FSA_OpenDir(int fd, char* path, int* outHandle);
int FSA_ReadDir(int fd, int handle, directoryEntry_s* out_data);
int FSA_CloseDir(int fd, int handle);

int FSA_OpenFile(int fd, char* path, char* mode, int* outHandle);
int FSA_ReadFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags);
int FSA_WriteFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags);
int FSA_StatFile(int fd, int handle, fileStat_s* out_data);
int FSA_CloseFile(int fd, int fileHandle);

int FSA_RawOpen(int fd, char* device_path, int* outHandle);
int FSA_RawRead(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle);
int FSA_RawWrite(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle);
int FSA_RawClose(int fd, int device_handle);

#endif
#ifndef FSA_H
#define FSA_H

typedef struct
{
u32 flag;
u32 permission;
u32 owner_id;
u32 group_id;
u32 size; // size in bytes
u32 physsize; // physical size on disk in bytes
u32 unk[3];
u32 id;
u32 ctime;
u32 mtime;
u32 unk2[0x0D];
}fileStat_s;

typedef struct
{
fileStat_s stat;
char name[0x100];
}directoryEntry_s;

#define DIR_ENTRY_IS_DIRECTORY 0x80000000

#define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0)
#define FSA_MOUNTFLAGS_GLOBAL (1 << 1)

int FSA_Open();

int FSA_Mount(int fd, char* device_path, char* volume_path, u32 flags, char* arg_string, int arg_string_len);
int FSA_Unmount(int fd, char* path, u32 flags);

int FSA_GetDeviceInfo(int fd, char* device_path, int type, u32* out_data);

int FSA_MakeDir(int fd, char* path, u32 flags);
int FSA_OpenDir(int fd, char* path, int* outHandle);
int FSA_ReadDir(int fd, int handle, directoryEntry_s* out_data);
int FSA_RewindDir(int fd, int handle);
int FSA_CloseDir(int fd, int handle);
int FSA_ChangeDir(int fd, char* path);

int FSA_OpenFile(int fd, char* path, char* mode, int* outHandle);
int FSA_ReadFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags);
int FSA_WriteFile(int fd, void* data, u32 size, u32 cnt, int fileHandle, u32 flags);
int FSA_StatFile(int fd, int handle, fileStat_s* out_data);
int FSA_CloseFile(int fd, int fileHandle);
int FSA_SetPosFile(int fd, int fileHandle, u32 position);
int FSA_GetStat(int fd, char *path, fileStat_s* out_data);
int FSA_Remove(int fd, char *path);

int FSA_RawOpen(int fd, char* device_path, int* outHandle);
int FSA_RawRead(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle);
int FSA_RawWrite(int fd, void* data, u32 size_bytes, u32 cnt, u64 sector_offset, int device_handle);
int FSA_RawClose(int fd, int device_handle);

#endif
@@ -1,40 +1,49 @@
#include "imports.h"

void usleep(u32 time)
{
((void (*const)(u32))0x050564E4)(time);
}

void* memset(void* dst, int val, size_t size)
{
char* _dst = dst;

int i;
for(i = 0; i < size; i++) _dst[i] = val;

return dst;
}

void* (*const _memcpy)(void* dst, void* src, int size) = (void*)0x05054E54;

void* memcpy(void* dst, const void* src, size_t size)
{
return _memcpy(dst, (void*)src, size);
}

char* strncpy(char* dst, const char* src, size_t size)
{
int i;
for(i = 0; i < size; i++)
{
dst[i] = src[i];
if(src[i] == '\0') return dst;
}

return dst;
}

int vsnprintf(char * s, size_t n, const char * format, va_list arg)
{
return ((int (*const)(char*, size_t, const char *, va_list))0x05055C40)(s, n, format, arg);
}
#include "imports.h"

void usleep(u32 time)
{
((void (*const)(u32))0x050564E4)(time);
}

void* memset(void* dst, int val, size_t size)
{
char* _dst = dst;

int i;
for(i = 0; i < size; i++) _dst[i] = val;

return dst;
}

void* (*const _memcpy)(void* dst, void* src, int size) = (void*)0x05054E54;

void* memcpy(void* dst, const void* src, size_t size)
{
return _memcpy(dst, (void*)src, size);
}

int strlen(const char* str)
{
unsigned int i = 0;
while (str[i]) {
i++;
}
return i;
}

char* strncpy(char* dst, const char* src, size_t size)
{
int i;
for(i = 0; i < size; i++)
{
dst[i] = src[i];
if(src[i] == '\0') return dst;
}

return dst;
}

int vsnprintf(char * s, size_t n, const char * format, va_list arg)
{
return ((int (*const)(char*, size_t, const char *, va_list))0x05055C40)(s, n, format, arg);
}

0 comments on commit 6053080

Please sign in to comment.
You can’t perform that action at this time.