RetroArch
iosuhax.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2016
3  * by Dimok
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any
7  * damages arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any
10  * purpose, including commercial applications, and to alter it and
11  * redistribute it freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you
14  * must not claim that you wrote the original software. If you use
15  * this software in a product, an acknowledgment in the product
16  * documentation would be appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and
19  * must not be misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  ***************************************************************************/
24 #ifndef _LIB_IOSUHAX_H_
25 #define _LIB_IOSUHAX_H_
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define IOS_ERROR_UNKNOWN_VALUE 0xFFFFFFD6
34 #define IOS_ERROR_INVALID_ARG 0xFFFFFFE3
35 #define IOS_ERROR_INVALID_SIZE 0xFFFFFFE9
36 #define IOS_ERROR_UNKNOWN 0xFFFFFFF7
37 #define IOS_ERROR_NOEXISTS 0xFFFFFFFA
38 
39 typedef struct
40 {
45  uint32_t size; // size in bytes
46  uint32_t physsize; // physical size on disk in bytes
47  uint32_t unk[3];
51  uint32_t unk2[0x0D];
52 }fileStat_s;
53 
54 typedef struct
55 {
57  char name[0x100];
59 
60 #define DIR_ENTRY_IS_DIRECTORY 0x80000000
61 
62 #define FSA_MOUNTFLAGS_BINDMOUNT (1 << 0)
63 #define FSA_MOUNTFLAGS_GLOBAL (1 << 1)
64 
65 int IOSUHAX_Open(const char *dev); // if dev == NULL the default path /dev/iosuhax will be used
66 int IOSUHAX_Close(void);
67 
68 int IOSUHAX_memwrite(uint32_t address, const uint8_t * buffer, uint32_t size); // IOSU external input
69 int IOSUHAX_memread(uint32_t address, uint8_t * out_buffer, uint32_t size); // IOSU external output
70 int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size); // IOSU internal memcpy only
71 
72 int IOSUHAX_SVC(uint32_t svc_id, uint32_t * args, uint32_t arg_cnt);
73 
74 int IOSUHAX_FSA_Open();
75 int IOSUHAX_FSA_Close(int fsaFd);
76 
77 int IOSUHAX_FSA_Mount(int fsaFd, const char* device_path, const char* volume_path, uint32_t flags, const char* arg_string, int arg_string_len);
78 int IOSUHAX_FSA_Unmount(int fsaFd, const char* path, uint32_t flags);
79 int IOSUHAX_FSA_FlushVolume(int fsaFd, const char* volume_path);
80 
81 int IOSUHAX_FSA_GetDeviceInfo(int fsaFd, const char* device_path, int type, uint32_t* out_data);
82 
83 int IOSUHAX_FSA_MakeDir(int fsaFd, const char* path, uint32_t flags);
84 int IOSUHAX_FSA_OpenDir(int fsaFd, const char* path, int* outHandle);
85 int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, directoryEntry_s* out_data);
86 int IOSUHAX_FSA_RewindDir(int fsaFd, int dirHandle);
87 int IOSUHAX_FSA_CloseDir(int fsaFd, int handle);
88 int IOSUHAX_FSA_ChangeDir(int fsaFd, const char *path);
89 
90 int IOSUHAX_FSA_OpenFile(int fsaFd, const char* path, const char* mode, int* outHandle);
91 int IOSUHAX_FSA_ReadFile(int fsaFd, void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
92 int IOSUHAX_FSA_WriteFile(int fsaFd, const void* data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags);
93 int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, fileStat_s* out_data);
94 int IOSUHAX_FSA_CloseFile(int fsaFd, int fileHandle);
95 int IOSUHAX_FSA_SetFilePos(int fsaFd, int fileHandle, uint32_t position);
96 int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, fileStat_s* out_data);
97 int IOSUHAX_FSA_Remove(int fsaFd, const char *path);
98 int IOSUHAX_FSA_ChangeMode(int fsaFd, const char* path, int mode);
99 
100 int IOSUHAX_FSA_RawOpen(int fsaFd, const char* device_path, int* outHandle);
101 int IOSUHAX_FSA_RawRead(int fsaFd, void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
102 int IOSUHAX_FSA_RawWrite(int fsaFd, const void* data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle);
103 int IOSUHAX_FSA_RawClose(int fsaFd, int device_handle);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif
GLuint const GLchar * name
Definition: glext.h:6671
static Handle fileHandle
Definition: hax2.c:24
int IOSUHAX_FSA_RawRead(int fsaFd, void *data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle)
Definition: iosuhax.c:912
int IOSUHAX_FSA_GetDeviceInfo(int fsaFd, const char *device_path, int type, uint32_t *out_data)
Definition: iosuhax.c:307
int IOSUHAX_FSA_RewindDir(int fsaFd, int dirHandle)
Definition: iosuhax.c:451
uint32_t mtime
Definition: iosuhax.h:50
GLenum mode
Definition: glext.h:6857
int IOSUHAX_Close(void)
Definition: iosuhax.c:89
GLuint address
Definition: glext.h:10300
GLsizei const GLchar ** path
Definition: glext.h:7901
int IOSUHAX_Open(const char *dev)
Definition: iosuhax.c:69
GLsizeiptr size
Definition: glext.h:6559
int IOSUHAX_FSA_OpenFile(int fsaFd, const char *path, const char *mode, int *outHandle)
Definition: iosuhax.c:542
int IOSUHAX_FSA_ChangeMode(int fsaFd, const char *path, int mode)
Definition: iosuhax.c:842
int IOSUHAX_FSA_CloseDir(int fsaFd, int handle)
Definition: iosuhax.c:480
Definition: ibxm.h:9
int IOSUHAX_FSA_Mount(int fsaFd, const char *device_path, const char *volume_path, uint32_t flags, const char *arg_string, int arg_string_len)
Definition: iosuhax.c:197
int IOSUHAX_memwrite(uint32_t address, const uint8_t *buffer, uint32_t size)
Definition: iosuhax.c:99
int IOSUHAX_FSA_WriteFile(int fsaFd, const void *data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags)
Definition: iosuhax.c:627
int IOSUHAX_FSA_Close(int fsaFd)
Definition: iosuhax.c:185
uint32_t physsize
Definition: iosuhax.h:46
Definition: iosuhax.h:54
int IOSUHAX_FSA_GetStat(int fsaFd, const char *path, fileStat_s *out_data)
Definition: iosuhax.c:765
int IOSUHAX_FSA_RawClose(int fsaFd, int device_handle)
Definition: iosuhax.c:1002
int IOSUHAX_FSA_StatFile(int fsaFd, int fileHandle, fileStat_s *out_data)
Definition: iosuhax.c:663
GLenum type
Definition: glext.h:6233
uint32_t owner_id
Definition: iosuhax.h:43
int IOSUHAX_FSA_Unmount(int fsaFd, const char *path, uint32_t flags)
Definition: iosuhax.c:240
int IOSUHAX_memcpy(uint32_t dst, uint32_t src, uint32_t size)
Definition: iosuhax.c:131
int IOSUHAX_FSA_ChangeDir(int fsaFd, const char *path)
Definition: iosuhax.c:509
uint32_t id
Definition: iosuhax.h:48
GLenum src
Definition: glext.h:6980
dictionary args
Definition: test_shaders.py:20
fileStat_s stat
Definition: iosuhax.h:56
uint32_t ctime
Definition: iosuhax.h:49
int IOSUHAX_FSA_Remove(int fsaFd, const char *path)
Definition: iosuhax.c:809
int IOSUHAX_FSA_ReadFile(int fsaFd, void *data, uint32_t size, uint32_t cnt, int fileHandle, uint32_t flags)
Definition: iosuhax.c:578
int IOSUHAX_FSA_RawOpen(int fsaFd, const char *device_path, int *outHandle)
Definition: iosuhax.c:876
Definition: iosuhax.h:39
int IOSUHAX_FSA_RawWrite(int fsaFd, const void *data, uint32_t block_size, uint32_t block_cnt, uint64_t sector_offset, int device_handle)
Definition: iosuhax.c:962
uint32_t permission
Definition: iosuhax.h:42
uint32_t size
Definition: iosuhax.h:45
int IOSUHAX_SVC(uint32_t svc_id, uint32_t *args, uint32_t arg_cnt)
Definition: iosuhax.c:147
int IOSUHAX_FSA_Open()
Definition: iosuhax.c:171
int IOSUHAX_FSA_ReadDir(int fsaFd, int handle, directoryEntry_s *out_data)
Definition: iosuhax.c:409
GLenum GLenum dst
Definition: glext.h:6980
int IOSUHAX_FSA_OpenDir(int fsaFd, const char *path, int *outHandle)
Definition: iosuhax.c:375
uint32_t group_id
Definition: iosuhax.h:44
Definition: video4linux2.c:51
int IOSUHAX_FSA_CloseFile(int fsaFd, int fileHandle)
Definition: iosuhax.c:706
GLbitfield flags
Definition: glext.h:7828
int IOSUHAX_FSA_SetFilePos(int fsaFd, int fileHandle, uint32_t position)
Definition: iosuhax.c:735
int IOSUHAX_memread(uint32_t address, uint8_t *out_buffer, uint32_t size)
Definition: iosuhax.c:120
unsigned __int64 uint64_t
Definition: stdint.h:136
uint32_t flag
Definition: iosuhax.h:41
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
int IOSUHAX_FSA_FlushVolume(int fsaFd, const char *volume_path)
Definition: iosuhax.c:274
int IOSUHAX_FSA_MakeDir(int fsaFd, const char *path, uint32_t flags)
Definition: iosuhax.c:342