-
Notifications
You must be signed in to change notification settings - Fork 2
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
Princess of Sleeping
authored
Apr 18, 2018
1 parent
44c2cf1
commit 2372449
Showing
6 changed files
with
334 additions
and
290 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,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); | ||
|
||
} |
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 |
---|---|---|
@@ -1,111 +1,91 @@ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include <psp2/io/dirent.h> | ||
#include <psp2/io/fcntl.h> | ||
#include <psp2/io/stat.h> | ||
|
||
|
||
#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<sizeof(header3.hash);shi++)printf(" %02X", header3.hash[shi]); | ||
|
||
int file_index = header_buffer_u32t[base_addr2 / 4]; | ||
printf("File Index : %d\n\n",file_index); | ||
|
||
printf("\n\n"); | ||
|
||
|
||
char write_file_name[0x100]; | ||
sprintf(write_file_name, "%s%s", pup_dec_dir, entry_file_name); | ||
sprintf(write_file_path, "%s%s", pup_dec_dir, write_file_name); | ||
|
||
printf("open write file ... "); | ||
|
||
int fd = sceIoOpen(write_file_name, SCE_O_TRUNC | SCE_O_CREAT | SCE_O_WRONLY, 0777); | ||
|
||
int pup_buffer = malloc(data_length); | ||
int fd = sceIoOpen(write_file_path, SCE_O_TRUNC | SCE_O_CREAT | SCE_O_WRONLY, 0777); | ||
|
||
|
||
if(fd >= 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; | ||
|
||
} |
Oops, something went wrong.