diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f0ec89..88c519d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ include("${VITASDK}/share/vita.cmake" REQUIRED) set(VITA_APP_NAME "PUP-Extractor") set(VITA_TITLEID "PSP2PUP00") -set(VITA_VERSION "01.00") +set(VITA_VERSION "01.30") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") @@ -25,6 +25,7 @@ set(VITA_MKSFOEX_FLAGS "${VITA_MKSFOEX_FLAGS} -d PARENTAL_LEVEL=1") add_executable(${PROJECT_NAME} src/main.c + src/ctrl.c src/graphics.c src/font.c src/file_io.c @@ -34,19 +35,16 @@ add_executable(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} + SceCtrl_stub SceDisplay_stub SceGxm_stub - SceCtrl_stub SceSysmodule_stub - SceCtrl_stub ) vita_create_self(eboot.bin ${PROJECT_NAME} UNSAFE) - - vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} eboot.bin VERSION ${VITA_VERSION} NAME ${VITA_APP_NAME} diff --git a/src/ctrl.c b/src/ctrl.c new file mode 100644 index 0000000..2d626d1 --- /dev/null +++ b/src/ctrl.c @@ -0,0 +1,54 @@ +#include "main.h" + +int get_key(int type) { + + + SceCtrlData pad; + + if(type == 0){ + + while (1) { + sceCtrlPeekBufferPositive(0, &pad, 1); + + if (pad.buttons != 0) + return pad.buttons; + } + + }else{ + + while (1) { + sceCtrlPeekBufferPositive(0, &pad, 1); + if(pad.buttons == 0){ + break; + } + } + + } + + return 0; + +} + + +void press_next(void) { + + printf("Press any key to next this application.\n\n"); + + get_key(1); + get_key(0); + get_key(1); + +} + + +void press_exit(void) { + + printf("Press any key to exit this application.\n\n"); + + get_key(1); + get_key(0); + get_key(1); + + sceKernelExitProcess(0); + +} \ No newline at end of file diff --git a/src/file_io.c b/src/file_io.c index 9bd3d56..f5d7855 100644 --- a/src/file_io.c +++ b/src/file_io.c @@ -1,111 +1,91 @@ -#include -#include -#include - -#include -#include -#include - - #include "main.h" +char pup_buffer[0x20000]; +int scePlayStartionUpdatePackageExtractFiles(char *pup_dec_dir, SceUID file_check, int i, SceUInt32 file_count, void *header){ -int SfcExtractPupFiles(pup_dec_dir, file_check, i, file_count, header_buffer){ - - const uint32_t *header_buffer_u32t; - - header_buffer_u32t = header_buffer; + char write_file_name[0x100]; + char write_file_path[0x200]; + uint32_t base_addr1 = 0x80 + (0x20 * i); + uint32_t base_addr2 = (0x80 + (0x20 * file_count)) + (0x40 * i); - int base_addr1 = 0x80 + (0x20 * i); - int base_addr2 = (0x80 + (0x20 * file_count)) + (0x40 * i); + ScePlayStartionUpdatePackageHeader2 header2; + ScePlayStartionUpdatePackageHeader3 header3; + sceIoPread(file_check, &header2, sizeof(ScePlayStartionUpdatePackageHeader2), base_addr1); + sceIoPread(file_check, &header3, sizeof(ScePlayStartionUpdatePackageHeader3), base_addr2); printf("File Count : %d / %d\n\n", (i+1), file_count); - int file_entry_id = header_buffer_u32t[base_addr1 / 4]; - int entry_file_name = GetFileEntryID(file_entry_id); - printf("FileEntry%02d : %s\n\n",i, entry_file_name); + sceGetPlayStartionUpdatePackageFileEntryId(write_file_name, header2.entry_id); + printf("FileEntry%02d : %s\n\n", i, write_file_name); + printf("Data Offset : 0x%X\n\n", header2.data_offset); - int data_offset = header_buffer_u32t[(base_addr1 + 0x8) / 4]; - printf("Data Offset : 0x%X\n\n",data_offset); + printf("Data Length : 0x%X / %dByte\n\n", header2.data_length, header2.data_length); + printf("File Index : %d\n\n", header3.index); - int data_length = header_buffer_u32t[(base_addr1 + 0x10) / 4]; - printf("Data Length : 0x%X / %dByte\n\n",data_length,data_length); + printf("File Hash :"); + for(int shi=0;shi= 0){ + if(fd < 0){ - printf(" Success.(%s)\n\n",write_file_name); - - printf("Read File Offset ... "); - - int sipr = sceIoPread(file_check, pup_buffer, data_length, data_offset); + printf("Failed."); - if(sipr >= 0){ + return 0; - printf("Success.\n\n"); + } - printf("File Write ... "); + printf(" Success.(%s)\n\n", write_file_path); - int siw = sceIoWrite(fd, pup_buffer, data_length); - if(siw == data_length){ + printf("File Write ... "); - printf(" Success.\n\n"); - printf("File Close ... "); - int sic = sceIoClose(fd); + uint32_t plus_address = 0x0, read_size = sizeof(pup_buffer); - if(sic >= 0){ + do { - printf(" Success."); + if((plus_address + sizeof(pup_buffer)) > header2.data_length){ - }else{ + read_size = (plus_address + sizeof(pup_buffer)) - header2.data_length; - printf("Failed."); + read_size = sizeof(pup_buffer) - read_size; - } + } - }else{ + int sipr = sceIoPread(file_check, pup_buffer, read_size, header2.data_offset + plus_address); - printf("Failed."); + sceIoWrite(fd, pup_buffer, sipr); - } + plus_address += sizeof(pup_buffer); - }else{ + } while (plus_address < header2.data_length); - printf("Failed."); + printf(" Success.\n\n"); - } - }else{ - printf("Failed."); + sceIoClose(fd); - } - free(pup_buffer); + return 0; } diff --git a/src/get_process.c b/src/get_process.c index cb04064..2febd4b 100644 --- a/src/get_process.c +++ b/src/get_process.c @@ -1,55 +1,41 @@ -#include -#include -#include - #include "main.h" +int sceGetPlayStartionUpdatePackageType(int pup_type){ -int SfcGetPupInfo(header_buffer_){ - - const uint8_t *header_buffer; - const uint32_t *header_buffer_u32t; - - header_buffer = header_buffer_; - header_buffer_u32t = header_buffer_; - - - printf("Package Version : %d\n\n",header_buffer_u32t[0x8 / 4]); - - - //FW - image_version = header_buffer_u32t[0x10 / 4]; - printf("Image Version : %X\n\n",image_version); + memset(pup_type_buf, 0, sizeof(pup_type_buf)); + switch (pup_type){ - file_count = header_buffer[0x18]; - printf("File Count : %d\n\n",file_count); + case 4:sprintf(pup_type_buf, "TestKit");break; + //case 3:sprintf(pup_type_buf, "???\n");break; + case 2:sprintf(pup_type_buf, "Retail");break; + case 1:sprintf(pup_type_buf, "DevKit");break; + default:sprintf(pup_type_buf, "unknown");break; - header_length = header_buffer_u32t[0x20 / 4]; - printf("Header Length : 0x%X\n\n",header_length); + } + return 0; - package_length = header_buffer_u32t[0x28 / 4]; - printf("Package Length : %dByte\n\n",package_length); +} +int sceGetPlayStartionUpdatePackageInfo(ScePlayStartionUpdatePackageHeader1 *header){ + sceGetPlayStartionUpdatePackageType(header->pup_type); - switch (header_buffer[0x3C]){ - case 4:pup_type = "TestKit";break; - //case 3:pup_type = "???";break; - case 2:pup_type = "Retail";break; - case 1:pup_type = "DevKit";break; + printf("Package Version : %d\n\n", header->package_version); - default:pup_type = "unknown";break; + printf("Image Version : 0x%08X\n\n", header->image_version); - } + printf("File Count : %d\n\n", header->file_count); + printf("Header Length : 0x%X\n\n", header->header_length); + printf("Package Length : %dByte\n\n", header->package_length); - printf("PUP Type : %s\n\n\n",pup_type); + printf("PUP Type : %s\n\n\n", pup_type_buf); return 0; @@ -59,92 +45,85 @@ int SfcGetPupInfo(header_buffer_){ -int GetFileEntryID(e1){ - - const char* Entry_File; - - switch (e1) { - - - case 0x100:Entry_File = "version.txt";break; - case 0x101:Entry_File = "license.xml";break; - case 0x200:Entry_File = "psp2swu.self";break; - case 0x204:Entry_File = "cui_setupper.self";break; - - case 0x221:Entry_File = "psv_package_data01.pkg";break; - case 0x231:Entry_File = "psv_package_data02.pkg";break; - - case 0x301:Entry_File = "package_data01.pkg";break; - case 0x302:Entry_File = "package_data02.pkg";break; - case 0x303:Entry_File = "package_data03.pkg";break; - case 0x304:Entry_File = "package_data04.pkg";break; - case 0x305:Entry_File = "package_data05.pkg";break; - case 0x306:Entry_File = "package_data06.pkg";break; - case 0x307:Entry_File = "package_data07.pkg";break; - case 0x308:Entry_File = "package_data08.pkg";break; - case 0x309:Entry_File = "package_data09.pkg";break; - case 0x30A:Entry_File = "package_data10.pkg";break; - case 0x30B:Entry_File = "package_data11.pkg";break; - case 0x30C:Entry_File = "package_data12.pkg";break; - case 0x30D:Entry_File = "package_data13.pkg";break; - case 0x30E:Entry_File = "package_data14.pkg";break; - case 0x30F:Entry_File = "package_data15.pkg";break; - case 0x310:Entry_File = "package_data16.pkg";break; - case 0x311:Entry_File = "package_data17.pkg";break; - case 0x312:Entry_File = "package_data18.pkg";break; - case 0x313:Entry_File = "package_data19.pkg";break; - case 0x314:Entry_File = "package_data20.pkg";break; - case 0x315:Entry_File = "package_data21.pkg";break; - case 0x316:Entry_File = "package_data22.pkg";break; - case 0x317:Entry_File = "package_data23.pkg";break; - case 0x318:Entry_File = "package_data24.pkg";break; - case 0x319:Entry_File = "package_data25.pkg";break; - case 0x31A:Entry_File = "package_data26.pkg";break; - - case 0x31B:Entry_File = "unknown_0x31B";break; - case 0x31C:Entry_File = "unknown_0x31C";break; - case 0x31D:Entry_File = "unknown_0x31D";break; - case 0x31E:Entry_File = "unknown_0x31E";break; - case 0x31F:Entry_File = "unknown_0x31F";break; - case 0x320:Entry_File = "unknown_0x320";break; - case 0x321:Entry_File = "unknown_0x321";break; - case 0x322:Entry_File = "unknown_0x322";break; - case 0x323:Entry_File = "unknown_0x323";break; - case 0x324:Entry_File = "unknown_0x324";break; - case 0x325:Entry_File = "unknown_0x325";break; - - case 0x326:Entry_File = "debug_data00.pkg";break; - case 0x327:Entry_File = "debug_data01.pkg";break; - case 0x328:Entry_File = "debug_data02.pkg";break; - case 0x329:Entry_File = "debug_data03.pkg";break; - case 0x32A:Entry_File = "debug_data04.pkg";break; - case 0x32B:Entry_File = "debug_data05.pkg";break; - case 0x32C:Entry_File = "debug_data06.pkg";break; - - case 0x32D:Entry_File = "unknown_0x32D";break; - case 0x32E:Entry_File = "unknown_0x32E";break; - case 0x32F:Entry_File = "unknown_0x32F";break; - case 0x330:Entry_File = "unknown_0x330";break; - case 0x331:Entry_File = "unknown_0x331";break; - case 0x332:Entry_File = "unknown_0x332";break; - case 0x333:Entry_File = "unknown_0x333";break; - case 0x334:Entry_File = "unknown_0x334";break; - case 0x335:Entry_File = "unknown_0x335";break; - case 0x336:Entry_File = "unknown_0x336";break; - case 0x337:Entry_File = "unknown_0x337";break; - case 0x338:Entry_File = "unknown_0x338";break; - - case 0x400:Entry_File = "package_scewm.wm";break; - case 0x401:Entry_File = "package_sceas.as";break; +void sceGetPlayStartionUpdatePackageFileEntryId(void *buff, int entry_id){ + + switch (entry_id) { + + case 0x100:sprintf(buff, "version.txt");break; + case 0x101:sprintf(buff, "license.xml");break; + case 0x200:sprintf(buff, "psp2swu.self");break; + case 0x204:sprintf(buff, "cui_setupper.self");break; + + case 0x221:sprintf(buff, "psv_package_data01.pkg");break; + case 0x231:sprintf(buff, "psv_package_data02.pkg");break; + + case 0x301:sprintf(buff, "package_data01.pkg");break; + case 0x302:sprintf(buff, "package_data02.pkg");break; + case 0x303:sprintf(buff, "package_data03.pkg");break; + case 0x304:sprintf(buff, "package_data04.pkg");break; + case 0x305:sprintf(buff, "package_data05.pkg");break; + case 0x306:sprintf(buff, "package_data06.pkg");break; + case 0x307:sprintf(buff, "package_data07.pkg");break; + case 0x308:sprintf(buff, "package_data08.pkg");break; + case 0x309:sprintf(buff, "package_data09.pkg");break; + case 0x30A:sprintf(buff, "package_data10.pkg");break; + case 0x30B:sprintf(buff, "package_data11.pkg");break; + case 0x30C:sprintf(buff, "package_data12.pkg");break; + case 0x30D:sprintf(buff, "package_data13.pkg");break; + case 0x30E:sprintf(buff, "package_data14.pkg");break; + case 0x30F:sprintf(buff, "package_data15.pkg");break; + case 0x310:sprintf(buff, "package_data16.pkg");break; + case 0x311:sprintf(buff, "package_data17.pkg");break; + case 0x312:sprintf(buff, "package_data18.pkg");break; + case 0x313:sprintf(buff, "package_data19.pkg");break; + case 0x314:sprintf(buff, "package_data20.pkg");break; + case 0x315:sprintf(buff, "package_data21.pkg");break; + case 0x316:sprintf(buff, "package_data22.pkg");break; + case 0x317:sprintf(buff, "package_data23.pkg");break; + case 0x318:sprintf(buff, "package_data24.pkg");break; + case 0x319:sprintf(buff, "package_data25.pkg");break; + case 0x31A:sprintf(buff, "package_data26.pkg");break; + + case 0x31B:sprintf(buff, "unknown_0x31B");break; + case 0x31C:sprintf(buff, "unknown_0x31C");break; + case 0x31D:sprintf(buff, "unknown_0x31D");break; + case 0x31E:sprintf(buff, "unknown_0x31E");break; + case 0x31F:sprintf(buff, "unknown_0x31F");break; + case 0x320:sprintf(buff, "unknown_0x320");break; + case 0x321:sprintf(buff, "unknown_0x321");break; + case 0x322:sprintf(buff, "unknown_0x322");break; + case 0x323:sprintf(buff, "unknown_0x323");break; + case 0x324:sprintf(buff, "unknown_0x324");break; + case 0x325:sprintf(buff, "unknown_0x325");break; + + case 0x326:sprintf(buff, "debug_data00.pkg");break; + case 0x327:sprintf(buff, "debug_data01.pkg");break; + case 0x328:sprintf(buff, "debug_data02.pkg");break; + case 0x329:sprintf(buff, "debug_data03.pkg");break; + case 0x32A:sprintf(buff, "debug_data04.pkg");break; + case 0x32B:sprintf(buff, "debug_data05.pkg");break; + case 0x32C:sprintf(buff, "debug_data06.pkg");break; + + case 0x32D:sprintf(buff, "unknown_0x32D");break; + case 0x32E:sprintf(buff, "unknown_0x32E");break; + case 0x32F:sprintf(buff, "unknown_0x32F");break; + case 0x330:sprintf(buff, "unknown_0x330");break; + case 0x331:sprintf(buff, "unknown_0x331");break; + case 0x332:sprintf(buff, "unknown_0x332");break; + case 0x333:sprintf(buff, "unknown_0x333");break; + case 0x334:sprintf(buff, "unknown_0x334");break; + case 0x335:sprintf(buff, "unknown_0x335");break; + case 0x336:sprintf(buff, "unknown_0x336");break; + case 0x337:sprintf(buff, "unknown_0x337");break; + case 0x338:sprintf(buff, "unknown_0x338");break; + + case 0x400:sprintf(buff, "package_scewm.wm");break; + case 0x401:sprintf(buff, "package_sceas.as");break; default:{ - char entry_id[128]; - sprintf(entry_id, "unk_0x%X", e1); - - - Entry_File = entry_id;break; + sprintf(buff, "unknown_0x%X", entry_id); } @@ -153,6 +132,5 @@ int GetFileEntryID(e1){ - return Entry_File; } \ No newline at end of file diff --git a/src/main.c b/src/main.c index b8d3b38..ddc47d9 100644 --- a/src/main.c +++ b/src/main.c @@ -1,28 +1,11 @@ -#include -#include -#include - -#include - -#include - -#include -#include -#include #include "main.h" -#include "graphics.h" - - - -int SfcPupExtractor(pup_path) { +int scePlayStartionUpdatePackageExtractStage1(char *ext_pup_path) { - - - printf("PUP Path : %s\n\n\n",pup_path); + printf("PUP Path : %s\n\n\n", ext_pup_path); printf("Start Extractor"); @@ -35,91 +18,70 @@ int SfcPupExtractor(pup_path) { printf("\n\n\n"); - SceUID file_check = sceIoOpen(pup_path, SCE_O_RDONLY, 0); - if(file_check >= 0){ - - - char header_buffer[0x2000];//8KB - - const uint32_t *header_buffer_u32t; - const uint16_t *header_buffer_u16t; - - - int rd = sceIoRead(file_check, header_buffer, 0x2000); - - header_buffer_u32t = header_buffer; - - - printf("header_buffer = 0x%X\n\n",rd); + SceUID file_check = sceIoOpen(ext_pup_path, SCE_O_RDONLY, 0); + if(file_check < 0){ + printf("File Open Error.\n\n"); + printf("res : 0x%08X\n\n", file_check); + return file_check; + } - printf("PUP magic check ... "); + //char _header[0x2000]; + ScePlayStartionUpdatePackageHeader1 header; - if(header_buffer[0] == 0x53 && - header_buffer[1] == 0x43 && - header_buffer[2] == 0x45 && - header_buffer[3] == 0x55 && - header_buffer[4] == 0x46 && - header_buffer[5] == 0x0 && - header_buffer[6] == 0x0 && - header_buffer[7] == 0x1){ + sceIoPread(file_check, &header, sizeof(ScePlayStartionUpdatePackageHeader1), 0); + sceIoPread(file_check, temp_buff, sizeof(temp_buff), 0); - printf("ok, SONY PSV PUP file.\n\n"); + printf("PUP magic check ... "); - SfcGetPupInfo(header_buffer); + if(BYTE_SWAP_64(header.magic) != 0x5343455546000001){ + printf("Failed, Not PUP file.\n\n"); + printf("0x%llX\n\n", BYTE_SWAP_64(header.magic)); - printf("Please wait 3 seconds.\n\n\n"); - sceKernelDelayThread(3*1000*1000); + return -1; + } + printf("ok, SONY PSV PUP file.\n\n"); - char pup_dec_dir[0x100]; - sprintf(pup_dec_dir, "%s%s_%07X/", pup_dec_base_dir, pup_type, image_version); + sceGetPlayStartionUpdatePackageInfo(&header); - NotExistMkdir(pup_dec_dir); + press_next(); - SceCtrlData buf; + printf("\n\n"); - for(int i=0;i= 0){ sceIoDclose(dfd); }else{ - sceIoMkdir(a1, 0777); + sceIoMkdir(path, 0777); } + return 0; + } @@ -149,12 +113,9 @@ int main(int argc, char *argv[]) { psvDebugScreenInit(); - printf("*** Pup Extractor ***\n\n\n"); - - NotExistMkdir(pup_dec_base_dir); - - NotExistMkdir(read_pup_dir); + NotExistMkdir(file_read_dir); + NotExistMkdir(file_output_dir); SceUID gc_update_check = sceIoOpen("gro0:psp2/update/psp2updat.pup", SCE_O_RDONLY, 0); @@ -164,33 +125,40 @@ int main(int argc, char *argv[]) { printf("Game Card mode\n\n"); - SfcPupExtractor("gro0:psp2/update/psp2updat.pup"); + scePlayStartionUpdatePackageExtractStage1("gro0:psp2/update/psp2updat.pup"); }else{ - SceUID dfd2 = sceIoDopen(read_pup_dir); + SceUID dfd2 = sceIoDopen(file_read_dir); int res = 0; do { + + + SceIoDirent dir; memset(&dir, 0, sizeof(SceIoDirent)); res = sceIoDread(dfd2, &dir); - if (res > 0) { + if (res > 0 && (!SCE_S_ISDIR(dir.d_stat.st_mode))) { - char read_pup_dir_path[0x100]; - sprintf(read_pup_dir_path, "%s%s", read_pup_dir, dir.d_name); + psvDebugScreenInit(); + printf("Memory Card mode\n\n"); + char read_pup_dir_path[0x100]; + sprintf(read_pup_dir_path, "%s%s", file_read_dir, dir.d_name); - printf("Memory Card mode\n\n"); + scePlayStartionUpdatePackageExtractStage1(read_pup_dir_path); - SfcPupExtractor(read_pup_dir_path); + printf("output dir - %s\n\n", pup_dec_dir); + press_next(); } + } while (res > 0); sceIoDclose(dfd2); @@ -199,9 +167,8 @@ int main(int argc, char *argv[]) { printf("*** ALL DONE ***\n\n"); - printf("This app will close in 3 seconds!\n"); - - sceKernelDelayThread(3*1000*1000); + + press_exit(); sceKernelExitProcess(0); return 0; diff --git a/src/main.h b/src/main.h index 62040ea..aae2444 100644 --- a/src/main.h +++ b/src/main.h @@ -1,37 +1,104 @@ +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include "graphics.h" #define printf psvDebugScreenPrintf #define base_partition "ux0:" -#define read_pup_dir base_partition "PSP2UPDAT/" -#define pup_dec_base_dir base_partition "PSP2UPDAT_Dec/" +#define file_read_dir base_partition "PSP2UPDAT/" +#define file_output_dir file_read_dir "dec/" -#define _BYTE1(x) ( x & 0xFF ) -#define _BYTE2(x) ( (x >> 8) & 0xFF ) -#define _BYTE3(x) ( (x >> 16) & 0xFF ) -#define _BYTE4(x) ( (x >> 24) & 0xFF ) - +#define _BYTE1(x) ( (x >> 0x00) & 0xFF ) +#define _BYTE2(x) ( (x >> 0x08) & 0xFF ) +#define _BYTE3(x) ( (x >> 0x10) & 0xFF ) +#define _BYTE4(x) ( (x >> 0x18) & 0xFF ) +#define _BYTE5(x) ( (x >> 0x20) & 0xFF ) +#define _BYTE6(x) ( (x >> 0x28) & 0xFF ) +#define _BYTE7(x) ( (x >> 0x30) & 0xFF ) +#define _BYTE8(x) ( (x >> 0x38) & 0xFF ) + #define BYTE_SWAP_16(x) ((uint16_t)( _BYTE1(x)<<8 | _BYTE2(x) )) -#define BYTE_SWAP_32(x) ((uint32_t)( _BYTE1(x)<<24 | _BYTE2(x)<<16 | _BYTE3(x)<<8 | _BYTE4(x) )) +#define BYTE_SWAP_32(x) ((uint32_t)( _BYTE1(x)<<0x18 | _BYTE2(x)<<0x10 | _BYTE3(x)<<8 | _BYTE4(x) )) +#define BYTE_SWAP_64(x) ((SceUInt64)( _BYTE1(x)<<0x38 | _BYTE2(x)<<0x30 | _BYTE3(x)<<0x28 | _BYTE4(x)<<0x20 | _BYTE5(x)<<0x18 | _BYTE6(x)<<0x10 | _BYTE7(x)<<0x8 | _BYTE8(x)<<0x0 )) + +typedef struct { + SceUInt64 magic; + SceUInt32 package_version; //0x00000008 + SceUInt32 unknown_0x0C; + SceUInt32 image_version; //0x00000010 + SceUInt32 unknown_0x14; + SceUInt32 file_count; //0x00000018 + SceUInt32 unknown_0x1C; + SceUInt32 header_length; //0x00000020 + SceUInt32 unknown_0x24; + SceUInt32 package_length; //0x00000028 + SceUInt32 unknown_0x2C; + SceUInt32 unknown_0x30; + SceUInt32 unknown_0x34; + SceUInt32 unknown_0x38; + SceUInt32 pup_type; //0x0000003C + SceUInt32 unknown_0x40; + SceUInt32 unknown_0x44; + SceUInt32 unknown_0x48; + SceUInt32 unknown_0x4C; + SceUInt32 unknown_0x50; + SceUInt32 unknown_0x54; + SceUInt32 unknown_0x58; + SceUInt32 unknown_0x5C; + SceUInt32 unknown_0x60; + SceUInt32 unknown_0x74; + SceUInt32 unknown_0x78; + SceUInt32 unknown_0x7C; +} __attribute__((packed)) ScePlayStartionUpdatePackageHeader1; +typedef struct { + SceUInt32 entry_id; + SceUInt32 unknown_0x04; + SceUInt32 data_offset; //0x00000008 + SceUInt32 unknown_0x0C; + SceUInt32 data_length; //0x00000010 + SceUInt32 unknown_0x14; + SceUInt32 unknown_0x18; // 2? + SceUInt32 unknown_0x1C; +} __attribute__((packed)) ScePlayStartionUpdatePackageHeader2; +typedef struct { + SceUInt32 index; + SceUInt32 unknown_0x04; + char hash[0x20]; //HMAC-sha256? + SceUInt32 unknown_0x28; + SceUInt32 unknown_0x2C; + SceUInt32 unknown_0x30; + SceUInt32 unknown_0x34; + SceUInt32 unknown_0x38; + SceUInt32 unknown_0x3C; +} __attribute__((packed)) ScePlayStartionUpdatePackageHeader3; +char pup_type_buf[0x20]; char pup_dec_dir[0x100]; +char temp_buff[0x2000]; + -int pup_type; +int get_key(int type); -int file_count; -int image_version; -int pup_type; -int file_count; -int header_length; -int package_length; +void press_next(void); +void press_exit(void); -int SfcGetPupInfo(header_buffer); -int SfcExtractPupFiles(pup_dec_dir, file_check, i, file_count, header_buffer); +int scePlayStartionUpdatePackageExtractFiles(char *pup_dec_dir, SceUID file_check, int i, SceUInt32 file_count, void *header); -int GetFileEntryID(a1); +void sceGetPlayStartionUpdatePackageFileEntryId(void *buff, int entry_id); -int SfcGetPupType(a1); \ No newline at end of file +int sceGetPlayStartionUpdatePackageInfo(ScePlayStartionUpdatePackageHeader1 *header); \ No newline at end of file