Skip to content

Commit

Permalink
Add feature to convert iso/cso (#18)
Browse files Browse the repository at this point in the history
* add iso/cso conversion
  • Loading branch information
bucanero authored Oct 26, 2023
1 parent 4e05d05 commit e0d7da0
Show file tree
Hide file tree
Showing 6 changed files with 535 additions and 9 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ add_executable(${PROJECT_NAME}
source/psp_decrypter.c
source/vmp_resign.c
source/ahx.c
source/ciso.c
)

target_link_libraries(${PROJECT_NAME}
Expand Down
64 changes: 64 additions & 0 deletions include/ciso.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
This file is part of Ciso.
Ciso 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 2 of the License, or
(at your option) any later version.
Ciso 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 Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright 2005 BOOSTER
*/

#include <stdint.h>

#ifndef __CISO_H__
#define __CISO_H__
/*
compressed ISO(9660) header format
*/
typedef struct ciso_header
{
uint8_t magic[4]; /* +00 : 'C','I','S','O' */
uint32_t header_size; /* +04 : header size (==0x18) */
uint64_t total_bytes; /* +08 : number of original data size */
uint32_t block_size; /* +10 : number of compressed block size */
uint8_t ver; /* +14 : version 01 */
uint8_t align; /* +15 : align of index value */
uint8_t rsv_06[2]; /* +16 : reserved */
#if 0
// INDEX BLOCK
uint32_t index[0]; /* +18 : block[0] index */
uint32_t index[1]; /* +1C : block[1] index */
:
:
uint32_t index[last]; /* +?? : block[last] */
uint32_t index[last+1]; /* +?? : end of last data point */
// DATA BLOCK
uint8_t data[]; /* +?? : compressed or plain sector data */
#endif
}CISO_Hdr;

/*
note:
file_pos_sector[n] = (index[n]&0x7fffffff) << CISO_H.align
file_size_sector[n] = ( (index[n+1]&0x7fffffff) << CISO_H.align) - file_pos_sector[n]
if(index[n]&0x80000000)
// read 0x800 without compress
else
// read file_size_sector[n] bytes and decompress data
*/

#endif

15 changes: 6 additions & 9 deletions include/saves.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ enum cmd_code_enum
CMD_VIEW_RAW_PATCH,
CMD_RESIGN_VMP,
CMD_EXP_FINGERPRINT,
CMD_CONVERT_TO_PSV,
CMD_HEX_EDIT_FILE,
CMD_IMPORT_DATA_FILE,

Expand All @@ -71,14 +70,14 @@ enum cmd_code_enum
CMD_SAVE_WEBSERVER,

// Export commands
CMD_EXP_KEYSTONE,
CMD_CONV_ISO2CSO,
CMD_SETUP_PLUGIN,
CMD_EXP_VMP2MCR,
CMD_EXP_PSPKEY,
CMD_DUMP_PSPKEY,

// Import commands
CMD_IMP_KEYSTONE,
CMD_CONV_CSO2ISO,
CMD_IMP_MCR2VMP0,
CMD_IMP_MCR2VMP1,
CMD_EXTRACT_ARCHIVE,
Expand Down Expand Up @@ -107,7 +106,6 @@ enum save_type_enum
{
FILE_TYPE_NULL,
FILE_TYPE_PSV,
FILE_TYPE_TRP,
FILE_TYPE_MENU,
FILE_TYPE_PSP,

Expand All @@ -116,12 +114,12 @@ enum save_type_enum

// License Files
FILE_TYPE_PRX,
FILE_TYPE_RAP,
FILE_TYPE_NET,
FILE_TYPE_ACT,

// ISO Files
FILE_TYPE_ISO,
FILE_TYPE_NET,
FILE_TYPE_CSO,
};

enum char_flag_enum
Expand Down Expand Up @@ -225,9 +223,8 @@ void stop_loading_screen(void);

void execCodeCommand(code_entry_t* code, const char* codecmd);

int regMgr_GetUserName(int userNumber, char* outString);

int create_savegame_folder(const char* folder);
int convert_cso2iso(const char *fname_in);
int convert_iso2cso(const char *fname_in);
int get_save_details(const save_entry_t *save, char** details);

int read_psp_game_key(const char* fkey, uint8_t* key);
Expand Down
Loading

0 comments on commit e0d7da0

Please # to comment.