PS3Xploit / PS3xploit-resigner

A Tool To Resign PS2/PS3/PSX/PSP Content For Use With PS3 etHANol 4.82/4.84
GNU General Public License v3.0
186 stars 73 forks source link

Compile in linux #4

Closed th3d3c1d3r closed 6 years ago

th3d3c1d3r commented 6 years ago

Can you create a make file that lets you compile a linux binary too? When I am trying to compile it by using "make" it fails with: main.cpp:5:21: fatal error: windows.h: No such file or directory

include

                 ^

compilation terminated. Failed to compile main.cpp! Makefile:36: recipe for target 'main.o' failed make: *** [main.o] Error 1

PS3Xploit commented 6 years ago

hi change that line to #include and try to compile

th3d3c1d3r commented 6 years ago

Hi, thanks for your reply. Now I get when running "make": main.cpp: In function ‘int parse_psp_pkg(uint8_t, uint32_t, uint8_t, uint32_t, int, uint64_t)’: main.cpp:1219:55: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("header[i].file_off=%x\n", header[i].file_off); ^ main.cpp:1220:57: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("header[i].file_size=%x\n", header[i].file_size); ^ main.cpp: In function ‘int parse_ps3_psp_pkg(uint8_t, uint32_t, uint8_t)’: main.cpp:1323:55: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("header[i].file_off=%x\n", header[i].file_off); ^ main.cpp:1324:57: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("header[i].file_size=%x\n", header[i].file_size); ^ main.cpp: In function ‘int main(int, char)’: main.cpp:1465:26: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("size:%x\n", len); ^ main.cpp:1487:32: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘uint64_t {aka long unsigned int}’ [-Werror=format=] printf("bkp:%016llx\n", bkp); ^ main.cpp:1534:28: error: format ‘%s’ expects argument of type ‘char’, but argument 2 has type ‘char ()[32]’ [-Werror=format=] scanf("%s", &user_input); //popular tools resign as type PS3 DEBUG even if minis/psx ^ main.cpp: In function ‘int read_act_dat_and_make_rif(char)’: main.cpp:736:26: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(idps, 0x10, 1, fp); ^ main.cpp:752:28: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(&account_id, 8,1,fp);//skip aa account need ^ main.cpp:754:31: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(act_dat_key, 0x10,1,fp); //copy first key in primary table of act.dat ^ main.cpp:763:23: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(rap, 0x10,1,fp); ^ main.cpp: In function ‘int read_rif_key(char, uint8_t)’: main.cpp:835:26: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(idps, 0x10, 1, fp); ^ main.cpp:849:31: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(act_dat_key, 0x10,1,fp); //copy first key in primary table of act.dat ^ main.cpp:860:23: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(rap, 0x10,1,fp); ^ main.cpp: In function ‘int sign_act_dat()’: main.cpp:877:33: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(act_dat_buf, 0x1038,1,fp); ^ main.cpp: In function ‘int sign_enc(FILE)’: main.cpp:1013:24: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(buf, 0x100,1,fp); ^ main.cpp: In function ‘int parse_psp_pkg(uint8_t, uint32_t, uint8_t, uint32_t, int, uint64_t)’: main.cpp:1244:38: error: ignoring return value of ‘ssize_t write(int, const void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(file_out, name, len_dec_name); ^ main.cpp:1254:55: error: ignoring return value of ‘ssize_t read(int, void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] read(file_out, tmp_buf, header[i].file_size-loop); ^ main.cpp:1257:56: error: ignoring return value of ‘ssize_t write(int, const void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(file_out, tmp_buf, header[i].file_size-loop); ^ main.cpp:1262:44: error: ignoring return value of ‘ssize_t read(int, void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] read(file_out, tmp_buf, 10010241024); ^ main.cpp:1265:45: error: ignoring return value of ‘ssize_t write(int, const void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(file_out, tmp_buf, 1001024*1024); ^ main.cpp: In function ‘int main(int, char)’: main.cpp:1393:37: error: ignoring return value of ‘size_t fread(void, size_t, size_t, FILE)’, declared with attribute warn_unused_result [-Werror=unused-result] fread(content_id_edat, 0x34, 1,fp); ^ main.cpp:1482:37: error: ignoring return value of ‘ssize_t write(int, const void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(fd_out, buf2+bkp, len-bkp); ^ main.cpp:1489:43: error: ignoring return value of ‘ssize_t write(int, const void, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result] write(fd_out, buf2+bkp, 10010241024); ^ main.cpp:1534:29: error: ignoring return value of ‘int scanf(const char, ...)’, declared with attribute warn_unused_result [-Werror=unused-result] scanf("%s", &user_input); //popular tools resign as type PS3 DEBUG even if minis/psx ^ In file included from /usr/include/fcntl.h:289:0, from main.cpp:6: In function ‘int open(const char, int, ...)’, inlined from ‘int main(int, char)’ at main.cpp:1474:43: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:26: error: call to ‘open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments open_missing_mode (); ^ cc1plus: all warnings being treated as errors Failed to compile main.cpp! Makefile:36: recipe for target 'main.o' failed make: * [main.o] Error 1

PS3Xploit commented 6 years ago

in makefile: CFLAGS=-pipe -fvisibility=hidden -Werror -D_GNU_SOURCE -O3 -static to:

CFLAGS=-pipe -fvisibility=hidden -D_GNU_SOURCE -O3 -static

try now :)

ghost commented 6 years ago

After the two previous modifications, I have gotten this as the fatal error: `In function ‘int open(const char*, int, ...)’, inlined from ‘int main(int, char**)’ at main.cpp:1474:43: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:24: error: call to ‘open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments open_missing_mode ();


Failed to compile main.cpp!
Makefile:36: recipe for target 'main.o' failed
make: *** [main.o] Error 1`
Do you know what this could be? Also, thank you for helping for Linux support.
PS3Xploit commented 6 years ago

Np

Change this line int fd_out=open(out_path, O_RDWR|O_CREAT); To int fd_out=open(out_path, O_RDWR|O_CREAT, 0600);

Report back if it worked :)

th3d3c1d3r commented 6 years ago

It compiles now. :) Can the warning messages be safely ignored? Is there an alternative to drag & drop (as you suggest under windows)? Like running: ps3xploit_rifgen_edatresign file_to_be_resigned.pgk ? Btw: If you want to include the linux binary in your git just tell me and I can send it you.

PS3Xploit commented 6 years ago

Yes you can use command line like you suggested

pkg rap enc CONFIG edats are supported

I can definitely include Linux binary if you send them to me :)

th3d3c1d3r commented 6 years ago

Here it is :) https://ufile.io/i6093