-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
8 changed files
with
4,241 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 |
---|---|---|
@@ -0,0 +1,131 @@ | ||
/* | ||
* ps3mca-tool - PlayStation 3 Memory Card Adaptor Software | ||
* Copyright (C) 2011 - jimmikaelkael <jimmikaelkael@wanadoo.fr> | ||
* Copyright (C) 2011 - "someone who wants to stay anonymous" | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __MCIO_H__ | ||
#define __MCIO_H__ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <inttypes.h> | ||
|
||
struct sceMcStDateTime { | ||
uint8_t Resv2; | ||
uint8_t Sec; | ||
uint8_t Min; | ||
uint8_t Hour; | ||
uint8_t Day; | ||
uint8_t Month; | ||
uint16_t Year; | ||
} __attribute__((packed)); | ||
|
||
struct MCFsEntry { /* size = 512 */ | ||
uint16_t mode; | ||
uint16_t unused; | ||
uint32_t length; | ||
struct sceMcStDateTime created; | ||
uint32_t cluster; | ||
uint32_t dir_entry; | ||
struct sceMcStDateTime modified; | ||
uint32_t attr; | ||
uint32_t unused2[7]; | ||
char name[32]; | ||
uint8_t unused3[416]; | ||
} __attribute__((packed)); | ||
|
||
struct io_stat { | ||
uint32_t mode; | ||
uint32_t attr; | ||
uint32_t size; | ||
struct sceMcStDateTime ctime; | ||
struct sceMcStDateTime mtime; | ||
} __attribute__((packed)); | ||
|
||
struct io_dirent { | ||
struct io_stat stat; | ||
char name[256]; | ||
uint32_t unknown; | ||
} __attribute__((packed)); | ||
|
||
int mcio_vmcInit(const char* vmc); | ||
int mcio_vmcExportImage(const char *dst, int ecc); | ||
int mcio_vmcImportImage(const char *src); | ||
void mcio_vmcFinish(void); | ||
int mcio_mcDetect(void); | ||
int mcio_mcGetInfo(int *pagesize, int *blocksize, int *cardsize, int *cardflags); | ||
int mcio_mcGetAvailableSpace(int *cardfree); | ||
int mcio_mcOpen(const char *filename, int flag); | ||
int mcio_mcClose(int fd); | ||
int mcio_mcRead(int fd, void *buf, int length); | ||
int mcio_mcWrite(int fd, void *buf, int length); | ||
int mcio_mcSeek(int fd, int offset, int origin); | ||
int mcio_mcCreateCrossLinkedFile(const char *real_filename, const char *dummy_filename); | ||
int mcio_mcDopen(const char *dirname); | ||
int mcio_mcDclose(int fd); | ||
int mcio_mcDread(int fd, struct io_dirent *dirent); | ||
int mcio_mcMkDir(const char *dirname); | ||
int mcio_mcReadPage(int pagenum, void *buf, void *ecc); | ||
int mcio_mcUnformat(void); | ||
int mcio_mcFormat(void); | ||
int mcio_mcRemove(const char *filename); | ||
int mcio_mcRmDir(const char *dirname); | ||
int mcio_mcStat(const char *filename, struct io_dirent *dirent); | ||
int mcio_mcSetStat(const char *filename, const struct io_dirent *dirent); | ||
|
||
/* MC error codes */ | ||
#define sceMcResSucceed 0 | ||
#define sceMcResChangedCard -1 | ||
#define sceMcResNoFormat -2 | ||
#define sceMcResFullDevice -3 | ||
#define sceMcResNoEntry -4 | ||
#define sceMcResDeniedPermit -5 | ||
#define sceMcResNotEmpty -6 | ||
#define sceMcResUpLimitHandle -7 | ||
#define sceMcResFailReplace -8 | ||
#define sceMcResFailResetAuth -11 | ||
#define sceMcResFailDetect -12 | ||
#define sceMcResFailDetect2 -13 | ||
#define sceMcResFailReadCluster -21 | ||
#define sceMcResFailCheckBackupBlocks -47 | ||
#define sceMcResFailIO -48 | ||
#define sceMcResFailSetDeviceSpecs -49 | ||
#define sceMcResDeniedPS1Permit -51 | ||
#define sceMcResFailAuth -90 | ||
#define sceMcResNotDir -100 | ||
#define sceMcResNotFile -101 | ||
|
||
/* file attributes */ | ||
#ifndef sceMcFileAttrReadable | ||
#define sceMcFileAttrReadable 0x0001 | ||
#define sceMcFileAttrWriteable 0x0002 | ||
#define sceMcFileAttrExecutable 0x0004 | ||
#define sceMcFileAttrDupProhibit 0x0008 | ||
#define sceMcFileAttrFile 0x0010 | ||
#define sceMcFileAttrSubdir 0x0020 | ||
#define sceMcFileCreateDir 0x0040 | ||
#define sceMcFileAttrClosed 0x0080 | ||
#define sceMcFileCreateFile 0x0200 | ||
#define sceMcFile0400 0x0400 | ||
#define sceMcFileAttrPDAExec 0x0800 | ||
#define sceMcFileAttrPS1 0x1000 | ||
#define sceMcFileAttrHidden 0x2000 | ||
#define sceMcFileAttrExists 0x8000 | ||
#endif | ||
|
||
#endif | ||
|
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* | ||
* Copyright (c) 2008 Andreas Weis (http://www.ghulbus-inc.de/) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a | ||
* copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
//================================================================================================ | ||
// Typedefs and Defines | ||
//================================================================================================ | ||
|
||
/** File header | ||
*/ | ||
typedef struct Icon_Header_t { | ||
unsigned int file_id; ///< reserved; should be: 0x010000 (but does not have to ;) ) | ||
unsigned int animation_shapes; ///< number of animation shapes per vertex | ||
unsigned int texture_type; ///< texture type - 0x07: uncompressed, 0x06: uncompresses, 0x0f: RLE compression | ||
unsigned int reserved; ///< reserved; should be: 0x3F800000 (but does not have to ;) ) | ||
unsigned int n_vertices; ///< number of vertices; must be a multiple of 3 | ||
} Icon_Header; | ||
/** Set of vertex coordinates | ||
* @note The f16_* fields indicate float16 data; divide by 4096.0f to convert to float32; | ||
*/ | ||
typedef struct Vertex_Coord_t { | ||
short f16_x; ///< vertex x coordinate in float16 | ||
short f16_y; ///< vertex y coordinate in float16 | ||
short f16_z; ///< vertex z coordinate in float16 | ||
short f16_unknown; ///< unknown; seems to influence lightning? | ||
} Vertex_Coord; | ||
/** Set of texture coordinates | ||
* @note The f16_* fields indicate float16 data; divide by 4096.0f to convert to float32; | ||
*/ | ||
typedef struct Texture_Data_t { | ||
short f16_u; ///< vertex u texture coordinate in float16 | ||
short f16_v; ///< vertex v texture coordinate in float16 | ||
unsigned int color; ///< vertex color (32 bit RGBA) | ||
} Texture_Data; | ||
/** Animation header | ||
*/ | ||
typedef struct Animation_Header_t { | ||
unsigned int id_tag; ///< ??? | ||
unsigned int frame_length; ///< ??? | ||
float anim_speed; ///< ??? | ||
unsigned int play_offset; ///< ??? | ||
unsigned int n_frames; ///< number of frames in the animation | ||
} Animation_Header; | ||
/** Per-frame animation data | ||
*/ | ||
typedef struct Frame_Data_t { | ||
unsigned int shape_id; ///< shape used for this frame | ||
unsigned int n_keys; ///< number of keys corresponding to this frame | ||
} Frame_Data; | ||
/** Per-key animation data | ||
*/ | ||
typedef struct Frame_Key_t { | ||
float time; ///< ??? | ||
float value; ///< ??? | ||
} Frame_Key; |
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 |
---|---|---|
@@ -0,0 +1,169 @@ | ||
/* | ||
* PSV file format information from: | ||
* - https://github.com/PMStanley/PSV-Exporter | ||
* | ||
* PSU, MAX, CBS file format information from: | ||
* - https://github.com/root670/CheatDevicePS2 | ||
*/ | ||
|
||
#include <inttypes.h> | ||
|
||
#define PSV_MAGIC "\x00VSP" | ||
#define PSV_SALT "www.bucanero.com.ar" | ||
|
||
typedef struct _sceMcStDateTime | ||
{ | ||
uint8_t Resv2; | ||
uint8_t Sec; | ||
uint8_t Min; | ||
uint8_t Hour; | ||
uint8_t Day; | ||
uint8_t Month; | ||
uint16_t Year; | ||
} sceMcStDateTime; | ||
|
||
typedef struct // size = 512 | ||
{ | ||
uint16_t mode; // 0 | ||
uint16_t unused; // 2 | ||
uint32_t length; // 4 | ||
sceMcStDateTime created; // 8 | ||
uint32_t cluster; // 16 | ||
uint32_t dir_entry; // 20 | ||
sceMcStDateTime modified; // 24 | ||
uint32_t attr; // 32 | ||
uint32_t unused2[7]; // 36 | ||
char name[32]; // 64 | ||
uint8_t unused3[416]; // 96 | ||
} McFsEntry; | ||
|
||
typedef struct | ||
{ | ||
char magic[4]; | ||
uint32_t padding1; //always 0x00000000 | ||
uint8_t salt[20]; | ||
uint8_t signature[20]; //digital sig | ||
uint32_t padding2; //always 0x00000000 | ||
uint32_t padding3; //always 0x00000000 | ||
uint32_t headerSize; //always 0x0000002C in PS2, 0x00000014 in PS1. | ||
uint32_t saveType; //0x00000002 PS2, 0x00000001 PS1 | ||
} psv_header_t; | ||
|
||
typedef struct | ||
{ | ||
uint32_t displaySize; //PS3 will just round this up to the neaest 1024 boundary so just make it as good as possible | ||
uint32_t sysPos; //location in file of icon.sys | ||
uint32_t sysSize; //icon.sys size | ||
uint32_t icon1Pos; //position of 1st icon | ||
uint32_t icon1Size; //size of 1st icon | ||
uint32_t icon2Pos; //position of 2nd icon | ||
uint32_t icon2Size; //size of 2nd icon | ||
uint32_t icon3Pos; //position of 3rd icon | ||
uint32_t icon3Size; //size of 3rd icon | ||
uint32_t numberOfFiles; | ||
} ps2_header_t; | ||
|
||
typedef struct | ||
{ | ||
sceMcStDateTime created; | ||
sceMcStDateTime modified; | ||
uint32_t numberOfFilesInDir; // this is likely to be number of files in dir + 2 ("." and "..") | ||
uint32_t attribute; // (0x00008427 dir) | ||
char filename[32]; | ||
} ps2_MainDirInfo_t; | ||
|
||
typedef struct | ||
{ | ||
sceMcStDateTime created; | ||
sceMcStDateTime modified; | ||
uint32_t filesize; | ||
uint32_t attribute; // (0x00008497 file) | ||
char filename[32]; // 'Real' PSV files have junk in this after text. | ||
uint32_t positionInFile; | ||
} ps2_FileInfo_t; | ||
|
||
typedef struct | ||
{ | ||
char magic[4]; | ||
uint16_t padding1; // 0000 | ||
uint16_t secondLineOffset; | ||
uint32_t padding2; // 00000000 | ||
uint32_t transparencyVal; // 0x00 (clear) to 0x80 (opaque) | ||
uint8_t bgColourUpperLeft[16]; | ||
uint8_t bgColourUpperRight[16]; | ||
uint8_t bgColourLowerLeft[16]; | ||
uint8_t bgColourLowerRight[16]; | ||
uint8_t light1Direction[16]; | ||
uint8_t light2Direction[16]; | ||
uint8_t light3Direction[16]; | ||
uint8_t light1RGB[16]; | ||
uint8_t light2RGB[16]; | ||
uint8_t light3RGB[16]; | ||
uint8_t ambientLightRGB[16]; | ||
char title[68]; // null terminated, S-JIS | ||
char IconName[64]; // null terminated | ||
char copyIconName[64]; // null terminated | ||
char deleteIconName[64]; // null terminated | ||
uint8_t padding3[512]; | ||
} ps2_IconSys_t; | ||
|
||
typedef struct maxHeader | ||
{ | ||
char magic[12]; | ||
uint32_t crc; | ||
char dirName[32]; | ||
char iconSysName[32]; | ||
uint32_t compressedSize; | ||
uint32_t numFiles; | ||
uint32_t decompressedSize; // This is actually the start of the LZARI stream, but we need it to allocate the buffer. | ||
} maxHeader_t; | ||
|
||
typedef struct maxEntry | ||
{ | ||
uint32_t length; | ||
char name[32]; | ||
} maxEntry_t; | ||
|
||
typedef struct cbsHeader | ||
{ | ||
char magic[4]; | ||
uint32_t unk1; | ||
uint32_t dataOffset; | ||
uint32_t decompressedSize; | ||
uint32_t compressedSize; | ||
char name[32]; | ||
sceMcStDateTime created; | ||
sceMcStDateTime modified; | ||
uint32_t unk2; | ||
uint32_t mode; | ||
char unk3[16]; | ||
char title[72]; | ||
char description[132]; | ||
} cbsHeader_t; | ||
|
||
typedef struct cbsEntry | ||
{ | ||
sceMcStDateTime created; | ||
sceMcStDateTime modified; | ||
uint32_t length; | ||
uint32_t mode; | ||
char unk1[8]; | ||
char name[32]; | ||
} cbsEntry_t; | ||
|
||
typedef struct __attribute__((__packed__)) xpsEntry | ||
{ | ||
uint16_t entry_sz; | ||
char name[64]; | ||
uint32_t length; | ||
uint32_t start; | ||
uint32_t end; | ||
uint32_t mode; | ||
sceMcStDateTime created; | ||
sceMcStDateTime modified; | ||
char unk1[4]; | ||
char padding[12]; | ||
char title_ascii[64]; | ||
char title_sjis[64]; | ||
char unk2[8]; | ||
} xpsEntry_t; |
Oops, something went wrong.