diff --git a/Changelog.txt b/Changelog.txt index 63232272..a51a1a3a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,26 @@ +v1.39 -v1.38 +TO DO : +Add Filemanager : Click under the thumb will scroll down/up a page instead of 1 item. + +TO FINISH (STR_CONVERT_TO_PNG) +Add FileManager : Convert any supported picture to PNG. + +TO FINISH (add the ird !!) +Add : Dump eid_root_key, 3Dump.bin, disc.pic and disc.key. +Add : Dump decrypted BR. +TO MAKE IT BETTER +Add : ManaGunZ logs option. It's save loading logs at "/dev_hdd0/tmp/mgz.log". +Add : ManaGunZ debug option. It slows the messages displayed on screen during the loadings. + + +v1.38 +Add : Support CFW/HEN 486C +Add FileManager : PictureViewer : support DDS, GTF, BMP, WEBP, TIFF, TGA, GIM and mores... +Fix FileManager : The scroll bar is now visible. +Fix : ManaGunZ won't set chinese language when the PS3 system is set with german language. +Removed : SHA-1 calculation from file properties. v1.37 Add : Support the firmware 4.85C. diff --git a/MGZ/Makefile b/MGZ/Makefile index e2a39781..96f6f4db 100644 --- a/MGZ/Makefile +++ b/MGZ/Makefile @@ -17,7 +17,7 @@ include $(PSL1GHT)/ppu_rules #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build -SOURCES := source source/RCO source/RCO/7z source/cxml source/erk source/bd_keys +SOURCES := source source/RCO source/RCO/7z source/cxml source/erk source/bd DATA := data INCLUDES := include lib/libgtfconv/source lib/libapputil/source lib/ImageMagick lib/OpenSSL/include PKGFILES := $(CURDIR)/pkgfiles @@ -52,7 +52,7 @@ LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map LIBS := -lxml2 ../lib/libiconv.a ../lib/libntfs_ext.a ../lib/libcobra.a ../lib/libgtfconv.a ../lib/libapputil.a \ ../lib/libMagickWand.a ../lib/libMagickCore.a ../lib/libcrypto.a \ -ltiny3d -lsysmodule -lgcm_sys -lrsx -lsysutil -lio -lm -lfreetype -lz -lhttputil \ - -lhttp -lssl -lnet -lpng -ljpeg -lpngdec -ljpgdec -lsysfs -lzip + -lhttp -lssl -lnet -lwebp -ltiff -lpng -ljpeg -lpngdec -ljpgdec -lsysfs -lzip #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/MGZ/data/erk_dumper_421C.bin b/MGZ/data/erk_dumper_421C.bin index 5a8d6277..086136cd 100644 Binary files a/MGZ/data/erk_dumper_421C.bin and b/MGZ/data/erk_dumper_421C.bin differ diff --git a/MGZ/data/erk_dumper_421D.bin b/MGZ/data/erk_dumper_421D.bin index 75fa928c..00f63347 100644 Binary files a/MGZ/data/erk_dumper_421D.bin and b/MGZ/data/erk_dumper_421D.bin differ diff --git a/MGZ/data/erk_dumper_430C.bin b/MGZ/data/erk_dumper_430C.bin index eff3808a..1d320ab6 100644 Binary files a/MGZ/data/erk_dumper_430C.bin and b/MGZ/data/erk_dumper_430C.bin differ diff --git a/MGZ/data/erk_dumper_430D.bin b/MGZ/data/erk_dumper_430D.bin index 65c17827..73e12e2c 100644 Binary files a/MGZ/data/erk_dumper_430D.bin and b/MGZ/data/erk_dumper_430D.bin differ diff --git a/MGZ/data/erk_dumper_431C.bin b/MGZ/data/erk_dumper_431C.bin index 230aeefd..9e45b38c 100644 Binary files a/MGZ/data/erk_dumper_431C.bin and b/MGZ/data/erk_dumper_431C.bin differ diff --git a/MGZ/data/erk_dumper_440C.bin b/MGZ/data/erk_dumper_440C.bin index dbda4c8b..a369b2a5 100644 Binary files a/MGZ/data/erk_dumper_440C.bin and b/MGZ/data/erk_dumper_440C.bin differ diff --git a/MGZ/data/erk_dumper_441C.bin b/MGZ/data/erk_dumper_441C.bin index 55312769..705d7e09 100644 Binary files a/MGZ/data/erk_dumper_441C.bin and b/MGZ/data/erk_dumper_441C.bin differ diff --git a/MGZ/data/erk_dumper_441D.bin b/MGZ/data/erk_dumper_441D.bin index c2bf214f..05405bcb 100644 Binary files a/MGZ/data/erk_dumper_441D.bin and b/MGZ/data/erk_dumper_441D.bin differ diff --git a/MGZ/data/erk_dumper_446C.bin b/MGZ/data/erk_dumper_446C.bin index d0c5e967..d862a256 100644 Binary files a/MGZ/data/erk_dumper_446C.bin and b/MGZ/data/erk_dumper_446C.bin differ diff --git a/MGZ/data/erk_dumper_446D.bin b/MGZ/data/erk_dumper_446D.bin index 455be929..0e705875 100644 Binary files a/MGZ/data/erk_dumper_446D.bin and b/MGZ/data/erk_dumper_446D.bin differ diff --git a/MGZ/data/erk_dumper_450C.bin b/MGZ/data/erk_dumper_450C.bin index f1d56b3e..73fe6e61 100644 Binary files a/MGZ/data/erk_dumper_450C.bin and b/MGZ/data/erk_dumper_450C.bin differ diff --git a/MGZ/data/erk_dumper_450D.bin b/MGZ/data/erk_dumper_450D.bin index f3d23d88..0a4e69a6 100644 Binary files a/MGZ/data/erk_dumper_450D.bin and b/MGZ/data/erk_dumper_450D.bin differ diff --git a/MGZ/data/erk_dumper_453C.bin b/MGZ/data/erk_dumper_453C.bin index 641db63e..4a8868d8 100644 Binary files a/MGZ/data/erk_dumper_453C.bin and b/MGZ/data/erk_dumper_453C.bin differ diff --git a/MGZ/data/erk_dumper_453D.bin b/MGZ/data/erk_dumper_453D.bin index 2c92e29b..01c51f93 100644 Binary files a/MGZ/data/erk_dumper_453D.bin and b/MGZ/data/erk_dumper_453D.bin differ diff --git a/MGZ/data/erk_dumper_455C.bin b/MGZ/data/erk_dumper_455C.bin index 21ac96f9..13f8e775 100644 Binary files a/MGZ/data/erk_dumper_455C.bin and b/MGZ/data/erk_dumper_455C.bin differ diff --git a/MGZ/data/erk_dumper_455D.bin b/MGZ/data/erk_dumper_455D.bin index 3d391eda..d2d95e8b 100644 Binary files a/MGZ/data/erk_dumper_455D.bin and b/MGZ/data/erk_dumper_455D.bin differ diff --git a/MGZ/data/erk_dumper_460C.bin b/MGZ/data/erk_dumper_460C.bin index 57b1e996..68ff3843 100644 Binary files a/MGZ/data/erk_dumper_460C.bin and b/MGZ/data/erk_dumper_460C.bin differ diff --git a/MGZ/data/erk_dumper_465C.bin b/MGZ/data/erk_dumper_465C.bin index e0235c26..97c29231 100644 Binary files a/MGZ/data/erk_dumper_465C.bin and b/MGZ/data/erk_dumper_465C.bin differ diff --git a/MGZ/data/erk_dumper_465D.bin b/MGZ/data/erk_dumper_465D.bin index e94e4447..1d14ce80 100644 Binary files a/MGZ/data/erk_dumper_465D.bin and b/MGZ/data/erk_dumper_465D.bin differ diff --git a/MGZ/data/erk_dumper_470C.bin b/MGZ/data/erk_dumper_470C.bin index 9fbbfc7f..f1693103 100644 Binary files a/MGZ/data/erk_dumper_470C.bin and b/MGZ/data/erk_dumper_470C.bin differ diff --git a/MGZ/data/erk_dumper_470D.bin b/MGZ/data/erk_dumper_470D.bin index 63aadc31..329696d3 100644 Binary files a/MGZ/data/erk_dumper_470D.bin and b/MGZ/data/erk_dumper_470D.bin differ diff --git a/MGZ/data/erk_dumper_475C.bin b/MGZ/data/erk_dumper_475C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_475C.bin and b/MGZ/data/erk_dumper_475C.bin differ diff --git a/MGZ/data/erk_dumper_475D.bin b/MGZ/data/erk_dumper_475D.bin index 078595b2..16066e0a 100644 Binary files a/MGZ/data/erk_dumper_475D.bin and b/MGZ/data/erk_dumper_475D.bin differ diff --git a/MGZ/data/erk_dumper_476C.bin b/MGZ/data/erk_dumper_476C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_476C.bin and b/MGZ/data/erk_dumper_476C.bin differ diff --git a/MGZ/data/erk_dumper_476D.bin b/MGZ/data/erk_dumper_476D.bin index 078595b2..16066e0a 100644 Binary files a/MGZ/data/erk_dumper_476D.bin and b/MGZ/data/erk_dumper_476D.bin differ diff --git a/MGZ/data/erk_dumper_478C.bin b/MGZ/data/erk_dumper_478C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_478C.bin and b/MGZ/data/erk_dumper_478C.bin differ diff --git a/MGZ/data/erk_dumper_478D.bin b/MGZ/data/erk_dumper_478D.bin index 078595b2..16066e0a 100644 Binary files a/MGZ/data/erk_dumper_478D.bin and b/MGZ/data/erk_dumper_478D.bin differ diff --git a/MGZ/data/erk_dumper_480C.bin b/MGZ/data/erk_dumper_480C.bin index 7f925054..6c5d3feb 100644 Binary files a/MGZ/data/erk_dumper_480C.bin and b/MGZ/data/erk_dumper_480C.bin differ diff --git a/MGZ/data/erk_dumper_480D.bin b/MGZ/data/erk_dumper_480D.bin index d665d45d..25ccfbc8 100644 Binary files a/MGZ/data/erk_dumper_480D.bin and b/MGZ/data/erk_dumper_480D.bin differ diff --git a/MGZ/data/erk_dumper_481C.bin b/MGZ/data/erk_dumper_481C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_481C.bin and b/MGZ/data/erk_dumper_481C.bin differ diff --git a/MGZ/data/erk_dumper_481D.bin b/MGZ/data/erk_dumper_481D.bin index 5ae309df..e0649906 100644 Binary files a/MGZ/data/erk_dumper_481D.bin and b/MGZ/data/erk_dumper_481D.bin differ diff --git a/MGZ/data/erk_dumper_482C.bin b/MGZ/data/erk_dumper_482C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_482C.bin and b/MGZ/data/erk_dumper_482C.bin differ diff --git a/MGZ/data/erk_dumper_482D.bin b/MGZ/data/erk_dumper_482D.bin index 5ae309df..e0649906 100644 Binary files a/MGZ/data/erk_dumper_482D.bin and b/MGZ/data/erk_dumper_482D.bin differ diff --git a/MGZ/data/erk_dumper_483C.bin b/MGZ/data/erk_dumper_483C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_483C.bin and b/MGZ/data/erk_dumper_483C.bin differ diff --git a/MGZ/data/erk_dumper_484C.bin b/MGZ/data/erk_dumper_484C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_484C.bin and b/MGZ/data/erk_dumper_484C.bin differ diff --git a/MGZ/data/erk_dumper_484D.bin b/MGZ/data/erk_dumper_484D.bin index 5ae309df..e0649906 100644 Binary files a/MGZ/data/erk_dumper_484D.bin and b/MGZ/data/erk_dumper_484D.bin differ diff --git a/MGZ/data/erk_dumper_485C.bin b/MGZ/data/erk_dumper_485C.bin index 4608b98b..11245c3f 100644 Binary files a/MGZ/data/erk_dumper_485C.bin and b/MGZ/data/erk_dumper_485C.bin differ diff --git a/MGZ/data/erk_dumper_486C.bin b/MGZ/data/erk_dumper_486C.bin new file mode 100644 index 00000000..11245c3f Binary files /dev/null and b/MGZ/data/erk_dumper_486C.bin differ diff --git a/MGZ/data/mamba_486C.lz.bin b/MGZ/data/mamba_486C.lz.bin new file mode 100644 index 00000000..02218b73 Binary files /dev/null and b/MGZ/data/mamba_486C.lz.bin differ diff --git a/MGZ/data/mamba_loader_486C.bin b/MGZ/data/mamba_loader_486C.bin new file mode 100644 index 00000000..c8d64605 Binary files /dev/null and b/MGZ/data/mamba_loader_486C.bin differ diff --git a/MGZ/data/payload_sky_486C.bin b/MGZ/data/payload_sky_486C.bin new file mode 100644 index 00000000..55ea8a9c Binary files /dev/null and b/MGZ/data/payload_sky_486C.bin differ diff --git a/MGZ/data/ps2gxemu_stage1_486C.bin b/MGZ/data/ps2gxemu_stage1_486C.bin new file mode 100644 index 00000000..a758dde4 Binary files /dev/null and b/MGZ/data/ps2gxemu_stage1_486C.bin differ diff --git a/MGZ/data/ps2gxemu_stage2_486C.bin b/MGZ/data/ps2gxemu_stage2_486C.bin new file mode 100644 index 00000000..9c846d9d Binary files /dev/null and b/MGZ/data/ps2gxemu_stage2_486C.bin differ diff --git a/MGZ/data/ps2hwemu_stage1_486C.bin b/MGZ/data/ps2hwemu_stage1_486C.bin new file mode 100644 index 00000000..c41e2109 Binary files /dev/null and b/MGZ/data/ps2hwemu_stage1_486C.bin differ diff --git a/MGZ/data/ps2hwemu_stage2_486C.bin b/MGZ/data/ps2hwemu_stage2_486C.bin new file mode 100644 index 00000000..8d125544 Binary files /dev/null and b/MGZ/data/ps2hwemu_stage2_486C.bin differ diff --git a/MGZ/data/ps2netemu_stage2_486C.bin b/MGZ/data/ps2netemu_stage2_486C.bin new file mode 100644 index 00000000..839c078f Binary files /dev/null and b/MGZ/data/ps2netemu_stage2_486C.bin differ diff --git a/MGZ/data/umount_486C.bin b/MGZ/data/umount_486C.bin new file mode 100644 index 00000000..6e3f2218 Binary files /dev/null and b/MGZ/data/umount_486C.bin differ diff --git a/MGZ/lib/ImageMagick/MagickCore/magick-baseconfig.h b/MGZ/lib/ImageMagick/MagickCore/magick-baseconfig.h index 32893e82..92505e16 100644 --- a/MGZ/lib/ImageMagick/MagickCore/magick-baseconfig.h +++ b/MGZ/lib/ImageMagick/MagickCore/magick-baseconfig.h @@ -18,7 +18,9 @@ /* #undef BZLIB_DELEGATE */ /* Define if you have CAIRO library */ -/* #undef CAIRO_DELEGATE */ +#ifndef MAGICKCORE_CAIRO_DELEGATE +#define MAGICKCORE_CAIRO_DELEGATE 1 +#endif /* permit enciphering and deciphering image pixels */ #ifndef MAGICKCORE_CIPHER_SUPPORT @@ -83,7 +85,9 @@ /* #undef FPX_DELEGATE */ /* Define if you have FREETYPE library */ -/* #undef FREETYPE_DELEGATE */ +#ifndef MAGICKCORE_FREETYPE_DELEGATE +#define MAGICKCORE_FREETYPE_DELEGATE 1 +#endif /* Define if you have Ghostscript library or framework */ /* #undef GS_DELEGATE */ @@ -1135,7 +1139,7 @@ /* Number of bits in a pixel Quantum (8/16/32/64) */ #ifndef MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H -#define MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H 8 +#define MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H 16 #endif /* Define if you have RAQM library */ @@ -1348,7 +1352,7 @@ /* Location of X11 configure files */ #ifndef MAGICKCORE_X11_CONFIGURE_PATH -#define MAGICKCORE_X11_CONFIGURE_PATH "/home/Zar/managunz/MGZ/lib/ImageMagick/winpath.sh: path "=" is not mounted" +#define MAGICKCORE_X11_CONFIGURE_PATH "/home/Zar/managunz/mgz/lib/ImageMagick/winpath.sh: path "=" is not mounted" #endif /* Define if you have X11 library */ diff --git a/MGZ/lib/ImageMagick/MagickCore/version.h b/MGZ/lib/ImageMagick/MagickCore/version.h index 822f89d1..263baf7a 100644 --- a/MGZ/lib/ImageMagick/MagickCore/version.h +++ b/MGZ/lib/ImageMagick/MagickCore/version.h @@ -47,7 +47,7 @@ extern "C" { #define MagickppLibAddendum "-2" #define MagickppLibInterface 0 #define MagickppLibMinInterface 0 -#define MagickReleaseDate "2017-04-18" +#define MagickReleaseDate "2019-12-23" #define MagickAuthoritativeLicense \ "http://www.imagemagick.org/script/license.php" #define MagickAuthoritativeURL "http://www.imagemagick.org" diff --git a/MGZ/lib/configure_ImageMagick b/MGZ/lib/configure_ImageMagick index a72df29e..39ba0b83 100644 --- a/MGZ/lib/configure_ImageMagick +++ b/MGZ/lib/configure_ImageMagick @@ -9,36 +9,38 @@ sh configure --host="ppu" --enable-static --disable-shared \ --disable-hdri \ --disable-largefile \ --disable-openmp \ +--disable-docs \ --without-modules \ ---with-quantum-depth=8 \ ---without-frozenpaths \ ---without-bzlib \ ---without-autotrace \ ---without-djvu \ ---without-dps \ ---without-fftw \ ---without-flif \ ---without-fpx \ ---without-fontconfig \ ---without-freetype \ ---without-gslib \ ---without-gvc \ ---without-jbig \ ---without-lcms \ ---without-lqr \ ---without-lzma \ --without-magick-plus-plus \ ---without-openexr \ ---without-openjp2 \ ---without-pango \ --without-perl \ ---without-raqm \ ---without-rsvg \ ---without-tiff \ ---without-webp \ ---without-wmf \ ---without-x \ ---without-xml \ ---without-zlib \ +--with-frozenpaths \ +--with-bzlib \ +--with-autotrace \ +--with-x \ +--with-xml \ +--with-zlib \ +--with-quantum-depth=16 \ +--with-djvu \ +--with-dps \ +--with-fftw \ +--with-flif \ +--with-fpx \ +--with-fontconfig \ +--with-freetype \ +--with-gslib \ +--with-gvc \ +--with-jbig \ +--with-lcms \ +--with-lqr \ +--with-lzma \ +--with-openexr \ +--with-openjp2 \ +--with-pango \ +--with-png \ +--with-raqm \ +--with-rsvg \ +--with-tiff \ +--with-webp \ +--with-wmf \ || { exit 1; } -cd .. \ No newline at end of file +cd .. diff --git a/MGZ/lib/libMagickCore.a b/MGZ/lib/libMagickCore.a index 8bdbe0b3..8d339317 100644 Binary files a/MGZ/lib/libMagickCore.a and b/MGZ/lib/libMagickCore.a differ diff --git a/MGZ/lib/libMagickWand.a b/MGZ/lib/libMagickWand.a index 89a87081..c862a571 100644 Binary files a/MGZ/lib/libMagickWand.a and b/MGZ/lib/libMagickWand.a differ diff --git a/MGZ/lib/libgif.a b/MGZ/lib/libgif.a new file mode 100644 index 00000000..dd651666 Binary files /dev/null and b/MGZ/lib/libgif.a differ diff --git a/MGZ/lib/libtarga.a b/MGZ/lib/libtarga.a new file mode 100644 index 00000000..77e19cad Binary files /dev/null and b/MGZ/lib/libtarga.a differ diff --git a/MGZ/source/bd/bd.c b/MGZ/source/bd/bd.c new file mode 100644 index 00000000..3e43e338 --- /dev/null +++ b/MGZ/source/bd/bd.c @@ -0,0 +1,579 @@ +#include +#include +#include + +#include +#include +#include +#include "storage.h" +#include "ioctl.h" + +#define SG_DXFER_TO_DEV ATAPI_PIO_DATA_OUT_PROTO, ATAPI_DIR_WRITE +#define SG_DXFER_FROM_DEV ATAPI_PIO_DATA_IN_PROTO, ATAPI_DIR_READ + +#define SUCCESS 1 +#define FAILED 0 + +extern void print_load(char *format, ...); +extern void print_head(char *format, ...); +extern void hex_print_load(char *data, size_t len); +extern u8 *Load_3Dump(); + +unsigned int version=2; + +unsigned char FixedKey30[] = { 220, 8, 0x2f, 0x83, 0x7f, 20, 0x87, 0xc2, 0, 0x8b, 0x7b, 0xc9, 0x20, 0xc5, 0x5b, 0xd9 }; +unsigned char FixedKey31[] = { 0xe8, 8, 0x85, 0xf9, 110, 0xd0, 0xf3, 0x67, 0x52, 0xce, 0x52, 190, 0xc3, 0xc7, 0x4e, 0xf3 }; +unsigned char InitialSeed[] = +{ + 0x3e, 0xc2, 12, 0x17, 2, 0x19, 1, 0x97, 0x8a, 0x29, 0x71, 0x79, 0x38, 0x29, 0xd3, 8, + 4, 0x29, 250, 0x84, 0xe3, 0x3e, 0x7f, 0x73, 12, 0x1d, 0x41, 110, 0xea, 0x25, 0xca, 0xfb, + 0x3d, 0xe0, 0x2b, 0xc0, 5, 0xea, 0x49, 11, 3, 0xe9, 0x91, 0x98, 0xf8, 0x3f, 0x10, 0x1f, + 0x1b, 0xa3, 0x4b, 80, 0x58, 0x94, 40, 0xad, 210, 0xb3, 0xeb, 0x3f, 0xf4, 0xc3, 0x1a, 0x58 +}; +unsigned char IV1[] = { 0x22, 0x26, 0x92, 0x8d, 0x44, 3, 0x2f, 0x43, 0x6a, 0xfd, 0x26, 0x7e, 0x74, 0x8b, 0x23, 0x93 }; +unsigned char IV2[] = { 0xe8, 11, 0x3f, 12, 0xd6, 0x56, 0x6d, 0xd0 }; +unsigned char IV3[] = { 0x3b, 0xd6, 0x24, 2, 11, 0xd3, 0xf8, 0x65, 0xe8, 11, 0x3f, 12, 0xd6, 0x56, 0x6d, 0xd0 }; +unsigned char Key1[0x10]; +unsigned char Key2[0x10]; +unsigned char Key3[] = { 0x12, 0x6c, 0x6b, 0x59, 0x45, 0x37, 14, 0xee, 0xca, 0x68, 0x26, 0x2d, 2, 0xdd, 0x12, 210 }; +unsigned char Key4[] = { 0xd9, 0xa2, 10, 0x79, 0x66, 0x6c, 0x27, 0xd1, 0x10, 50, 0xac, 0xcf, 13, 0x7f, 0xb5, 1 }; +unsigned char Key5[] = { 0x19, 0x76, 0x6f, 0xbc, 0x77, 0xe4, 0xe7, 0x5c, 0xf4, 0x41, 0xe4, 0x8b, 0x94, 0x2c, 0x5b, 0xd9 }; +unsigned char Key6[] = { 80, 0xcb, 0xa7, 240, 0xc2, 0xa7, 0xc0, 0xf6, 0xf3, 0x3a, 0x21, 0x43, 0x26, 0xac, 0x4e, 0xf3 }; +unsigned char Key7[0x10]; +unsigned char Key8[0x10]; + +/* Handler to the BD-ROM */ +int g_fd = 0; +FILE *g_file_binlog = NULL; + +void calculate_session_keys(unsigned char* r1, unsigned char* r2); +int do_send_key(char keyFormat, unsigned char* payload, int payload_len); +int do_report_key(char keyFormat, unsigned char* payload, int payload_len); +int establish_session_keys(char keyselection, unsigned char* KA, unsigned char* KB); +void triple_des_encrypt(unsigned char* Key, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset); +int do_unknown_e0(unsigned char* header, unsigned char* payload); +int do_unknown_e1(unsigned char* header, unsigned char* payload); +void load_keys(unsigned char* EID4, unsigned char* CMAC, unsigned char* KE, unsigned char* IE); +int get_dec_key(unsigned char* d1, unsigned char* d2); +int get_data(unsigned char* data1, unsigned char* data2); + +void dec_d2(unsigned char* d2); +void dec_d1(unsigned char* d1); + +int do_cdb(unsigned char* cdb, int cdb_len, unsigned char* transfer, int transfer_len, uint32_t proto, uint32_t type) +{ + int ret; + struct lv2_atapi_cmnd_block atapi_cmnd; + + sys_storage_init_atapi_cmnd(&atapi_cmnd, transfer_len, proto, type); + memcpy(atapi_cmnd.pkt, cdb, cdb_len); + if(transfer_len == 0 || transfer == NULL) atapi_cmnd.blocks = 0; + + ret = sys_storage_send_atapi_command(g_fd, &atapi_cmnd, transfer); + + if(ret != 0) { + print_load("ioctl indicates command failed: %d", ret); + return FAILED; + } + + print_load("SUCCESS"); + return SUCCESS; +} + +int test_unit_ready() +{ + print_load("Test unit ready: "); + unsigned char cdb[]= {0, 0, 0, 0, 0, 0}; + return do_cdb(cdb, 6, NULL, 0, ATAPI_NON_DATA_PROTO, ATAPI_DIR_WRITE); +} + +int read_pic(unsigned char* ret) +{ + print_load("Read pic: "); + unsigned char cdb[]= { 0xad, 1, 0, 0, 0, 0, 0, 0, 0x10, 0x04, 0, 0 }; + return do_cdb(cdb, 12, ret, 4100, SG_DXFER_FROM_DEV); +} + +u8 *get_d1() +{ + u8* d_3dump = Load_3Dump(); + + if(d_3dump==NULL) return NULL; + + u8* eid4=d_3dump; + u8* cmac=d_3dump+0x20; + u8* ke=d_3dump+0x30; + u8* ie=d_3dump+0x50; + + load_keys(eid4, cmac, ke, ie); + + /* Start the drive communication */ + if(sys_storage_open(BD_DEVICE, &g_fd) != 0) { + print_load("Error : sys_storage_open failed..."); + free(d_3dump); + return NULL; + } + + if(test_unit_ready()!=SUCCESS) { + print_load("Error : Test unit failed, are you sure a disc is in the drive?"); + sys_storage_close(g_fd); + free(d_3dump); + return NULL; + } + + u8 d2[16]; + u8* d1=(u8*) malloc(16); + if( d1 == NULL) { + print_load("Error : malloc d1"); + sys_storage_close(g_fd); + free(d_3dump); + return NULL; + + } + + if(get_dec_key(d1, d2)==FAILED) { + print_load("Error : get_dec_key"); + sys_storage_close(g_fd); + free(d_3dump); + free(d1); + return NULL; + } + + sys_storage_close(g_fd); + free(d_3dump); + + return d1; +} + +int Dump_BD_keys() +{ + FILE* file_io; + + unsigned char d_3dump[0x60]; + unsigned char* eid4=d_3dump; + unsigned char* cmac=d_3dump+0x20; + unsigned char* ke=d_3dump+0x30; + unsigned char* ie=d_3dump+0x50; + unsigned char d1[16]; + unsigned char d2[16]; + + unsigned char* pic; + int pic_len; + unsigned char all=3; + + print_load("[MGZ] GetKey r%u", version); + + memset(d1, 0, 16); + memset(d2, 0, 16); + + /*Read 3Dump.bin*/ + if( (file_io=fopen("/dev_hdd0/tmp/3Dump.bin", "rb"))==NULL ) { + print_load("Error : opening 3Dump.bin"); + return FAILED; + } + + if( fread(d_3dump, 1, 0x60, file_io)!=0x60 ) { + print_load("Error : reading 3Dump.bin"); + return FAILED; + } + fclose(file_io); + + load_keys(eid4, cmac, ke, ie); + + /* Start the drive communication */ + if(sys_storage_open(BD_DEVICE, &g_fd) != 0) { + print_load("Error : sys_storage_open failed..."); + return FAILED; + } + + if(test_unit_ready()!=SUCCESS) + { + print_load("Error : Test unit failed, are you sure a disc is in the drive?"); + sys_storage_close(g_fd); + return FAILED; + } + + /*get PIC*/ + pic=malloc(4100); + memset(pic, 0, 4100); + read_pic(pic); + pic_len=0x83; + + while(pic[pic_len]==0 && pic_len>=0) --pic_len; + ++pic_len; + if(pic_len==0) { + print_load("Warning : Empty PIC, probably wrong. Continuing anyway to try and get key"); + all-=1; + } + + if(get_dec_key(d1, d2)==SUCCESS) { + print_load("get_dec_key succeeded!"); + print_load("writing disc.key binary header..."); + if( ( g_file_binlog = fopen("/dev_usb000/disc.key" , "wb") )==NULL ) { + print_load("Error : Failed to open disc.key for writing"); + fclose(g_file_binlog); + return FAILED; + } + + fprintf(g_file_binlog, "Encrypted 3K RIP"); + + if(fwrite(d1, 1, 16, g_file_binlog) != 16) { + print_load("Error : Failed writing binary key 1 to disk.key"); + } + + if(fwrite(d2, 1, 16, g_file_binlog) != 16) { + print_load("Error : Failed writing binary key 2 to disk.key"); + } + + if(fwrite(pic, 1, 0x73, g_file_binlog) != 0x73) { + print_load("Error : Failed writing binary pic data to disk.key"); + } + + fclose(g_file_binlog); + + dec_d1(d1); + dec_d2(d2); + } + else + { + print_load("Error : get_dec_key failed, key was not dumped"); + if(pic_len==0) { + print_load("Error : Nothing could be dumped. Your drive may be unsupported, please report it."); + sys_storage_close(g_fd); + return FAILED; + } + all-=2; + } + + if(all>1) { + print_load("disc_key"); + hex_print_load((char *)d1, 16); + print_load("disc_id: "); + if(d2[12]==0 && d2[13]==0 && d2[14]==0 && d2[15]==0) { + hex_print_load((char *)d2, 16); + } + else { + hex_print_load((char *)d2, 12); + print_load("XXXXXXXX"); + } + print_load("disc_id (d2 enc): "); + hex_print_load((char *)d2, 16); + } + if(pic_len!=0) + { + print_load("PIC:"); + hex_print_load((char *)pic, 0x84); + } + + /*dump pic in full*/ + if( (file_io=fopen("/dev_usb000/disc.pic", "wb"))==NULL ) + { + print_load("Error : Failed to open big.pic for writing"); + sys_storage_close(g_fd); + return FAILED; + } + if(fwrite(pic, 1, 4100, file_io)!=4100) + { + print_load("Error : Failed to write to big.pic"); + sys_storage_close(g_fd); + return FAILED; + } + fclose(file_io); + + free(pic); + if(all==3) + { + print_load("SUCCESS: Everything was correctly dumped."); + sys_storage_close(g_fd); + return SUCCESS; + } + else if(all==2) + { + print_load("WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING"); + print_load("Warning : Not everything was correctly dumped (PIC missing)"); + sys_storage_close(g_fd); + return FAILED; + } + else if(all==1) + { + print_load("WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING"); + print_load("Warning : Not everything was correctly dumped (d1 missing)"); + sys_storage_close(g_fd); + return FAILED; + } + + sys_storage_close(g_fd); + return SUCCESS; +} + +/*glevand*/ +void +aes_cbc_encrypt(const unsigned char *iv, const unsigned char *key, int key_length, + const unsigned char *data, int data_length, unsigned char *out) +{ + AES_KEY aes_key; + unsigned char cbc[AES_BLOCK_SIZE]; + int i; + + AES_set_encrypt_key(key, key_length, &aes_key); + + memcpy(cbc, iv, AES_BLOCK_SIZE); + + while (data_length >= AES_BLOCK_SIZE) { + for (i = 0; i < AES_BLOCK_SIZE; i++) out[i] = cbc[i] ^ data[i]; + + AES_encrypt(out, out, &aes_key); + + memcpy(cbc, out, AES_BLOCK_SIZE); + + data += AES_BLOCK_SIZE; + out += AES_BLOCK_SIZE; + data_length -= AES_BLOCK_SIZE; + } +} + +/*lazy wrapper*/ +void AESEncrypt(unsigned char* Key, unsigned int bits, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) +{ + aes_cbc_encrypt(IV, Key, bits, Source+SOffset, SLength, Destination+DOffset); +} + +/*glevand*/ +static void +aes_cbc_decrypt(const unsigned char *iv, const unsigned char *key, int key_length, + const unsigned char *data, int data_length, unsigned char *out) +{ + AES_KEY aes_key; + unsigned char cbc[AES_BLOCK_SIZE]; + unsigned char buf[AES_BLOCK_SIZE]; + int i; + + AES_set_decrypt_key(key, key_length, &aes_key); + + memcpy(cbc, iv, AES_BLOCK_SIZE); + + while (data_length >= AES_BLOCK_SIZE) { + memcpy(buf, data, AES_BLOCK_SIZE); + + AES_decrypt(data, out, &aes_key); + + for (i = 0; i < AES_BLOCK_SIZE; i++) + out[i] ^= cbc[i]; + + memcpy(cbc, buf, AES_BLOCK_SIZE); + + data += AES_BLOCK_SIZE; + out += AES_BLOCK_SIZE; + data_length -= AES_BLOCK_SIZE; + } +} + +/*lazy wrapper*/ +void AESDecrypt(unsigned char* Key, unsigned int bits, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) +{ + aes_cbc_decrypt(IV, Key, bits, Source+SOffset, SLength, Destination+DOffset); +} + +/*glevand*/ +void triple_des_encrypt(unsigned char* Key, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) +{ + DES_cblock kcb1; + DES_cblock kcb2; + DES_cblock ivcb; + DES_key_schedule ks1; + DES_key_schedule ks2; + + memcpy(kcb1, Key, DES_KEY_SZ); + memcpy(kcb2, Key + DES_KEY_SZ, DES_KEY_SZ); + memcpy(ivcb, IV, DES_KEY_SZ); + + DES_set_key_unchecked(&kcb1, &ks1); + DES_set_key_unchecked(&kcb2, &ks2); + + DES_ede2_cbc_encrypt(Source+SOffset, Destination+DOffset, SLength, &ks1, &ks2, &ivcb, DES_ENCRYPT); +} + +int get_dec_key(unsigned char* d1, unsigned char* d2) +{ + print_load("get dec key"); + if(establish_session_keys(0, Key1, Key2)!=SUCCESS) return FAILED; + if(get_data(d1, d2)!=SUCCESS) { + print_load("get data failed"); + return FAILED; + } + return SUCCESS; +} + +int establish_session_keys(char keyselection, unsigned char* KA, unsigned char* KB) +{ + unsigned char source[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + unsigned char buffer7[4]; + unsigned char* sourceArray = buffer7; + unsigned char destinationArray[20]; + unsigned char payload[0x24]; + unsigned char destination[0x10]; + unsigned char buffer6[0x10]; + + print_load("establish session keys"); + + buffer7[1] = 0x10; + memcpy(destinationArray, sourceArray, 4); + + AESEncrypt(KA, 128, IV1, source, 0, 0x10, destinationArray, 4); + + if(do_send_key(keyselection, destinationArray, 20) != SUCCESS) return FAILED; + + if(do_report_key(keyselection, payload, 0x24) != SUCCESS) return FAILED; + + AESDecrypt(KB, 128, IV1, payload, 4, 0x10, destination, 0); + AESDecrypt(KB, 128, IV1, payload, 20, 0x10, buffer6, 0); + + if(memcmp(source, destination, 0x10)!=0) + { + print_load("Error : Memory comparison failed (rnd1 mismatch?). Check your 3Dump.bin is correct."); + return FAILED; + } + calculate_session_keys(destination, buffer6); + if(keyselection == 0) + { + memcpy(destinationArray, sourceArray, 4); + AESEncrypt(KA, 128, IV1, buffer6, 0, 0x10, destinationArray, 4); + if(do_send_key(2, destinationArray, 20) != SUCCESS) return FAILED; + } + else + { + if(do_report_key(keyselection, payload, 0x24) != SUCCESS) return FAILED; + } + return SUCCESS; +} + +int do_report_key(char keyFormat, unsigned char* payload, int payload_len) +{ + unsigned char buffer2[12]; + print_load("do report key"); + memset(buffer2, 0, 12); + buffer2[0] = 0xa4; + buffer2[7] = 0xe0; + buffer2[8]=(unsigned char) (payload_len>>8); + buffer2[9]=(unsigned char) (payload_len); + buffer2[10] = keyFormat; + return do_cdb(buffer2, 12, payload, payload_len, SG_DXFER_FROM_DEV); +} + +int do_send_key(char keyFormat, unsigned char* payload, int payload_len) +{ + unsigned char buffer2[12]; + print_load("do send key"); + memset(buffer2, 0, 12); + buffer2[0] = 0xa3; + buffer2[7] = 0xe0; + buffer2[8]=(unsigned char) (payload_len>>8); + buffer2[9]=(unsigned char) (payload_len); + buffer2[10] = keyFormat; + return do_cdb(buffer2, 12, payload, payload_len, SG_DXFER_TO_DEV); +} + +void calculate_session_keys(unsigned char* r1, unsigned char* r2) +{ + unsigned char destinationArray[0x10]; + print_load("calculate session keys"); + memcpy(destinationArray, r1, 8); + memcpy(destinationArray+8, r2+8, 8); + AESEncrypt(Key3, 128, IV1, destinationArray, 0, 0x10, Key7, 0); + memcpy(destinationArray, r1+8, 8); + memcpy(destinationArray+8, r2, 8); + AESEncrypt(Key4, 128, IV1, destinationArray, 0, 0x10, Key8, 0); +} + +int get_data(unsigned char* data1, unsigned char* data2) +{ + unsigned char destination[0x30]; + unsigned char buffer7[8]; + unsigned char* source = buffer7; + unsigned char buffer3[] = { 3, 0, 0, 0, 0, 0, 0x61, 0x9b }; + unsigned char buffer4[8]; + unsigned char buffer5[0x54]; + unsigned char buffer6[] = { + 0x9b, 0xcd, 0, 0, 0x63, 0x17, 0xa8, 0xcd, 0x12, 80, 0xd7, 10, 0x19, 0x5d, 0x7e, 2, + 0xb0, 0xdb, 0x94, 0x6f, 0xcf, 0x2c, 0xcf, 0x4d, 0xef, 0x20, 0xe7, 0x4c, 0x9a, 30, 0x68, 6, + 2, 0x8a, 0, 70, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 110, 0x8a, 0x6f, 0x2d, 0xde, 7, 0x20, 0x2b, 0xf4, 0xd0, 0xbb, 0xdb, + 0x8a, 11, 0x80, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + print_load("get data"); + + memset(buffer7, 0, 8); + buffer7[6] = 10; + buffer7[7] = 0xf5; + memset(buffer5, 0, 0x54); + buffer5[0] = 0; + buffer5[1] = 80; + buffer5[2] = 0; + buffer5[3] = 0; + AESEncrypt(Key7, 128, IV3, buffer6, 0, 80, buffer5, 4); + triple_des_encrypt(Key7, IV2, source, 0, 8, buffer4, 0); + + if(do_unknown_e1(buffer4, buffer5) != SUCCESS) return FAILED; + triple_des_encrypt(Key7, IV2, buffer3, 0, 8, buffer4, 0); + if(do_unknown_e0(buffer4, buffer5) != SUCCESS) return FAILED; + + AESDecrypt(Key7, 128, IV3, buffer5, 4, 0x30, destination, 0); + AESDecrypt(Key8, 128, IV3, destination, 3, 0x10, data1, 0); + AESDecrypt(Key8, 128, IV3, destination, 0x13, 0x10, data2, 0); + return SUCCESS; +} + +int do_unknown_e1(unsigned char* header, unsigned char* payload) +{ + unsigned char buffer2[12]; + print_load("do unknown e1: "); + memset(buffer2, 0, 12); + buffer2[0]=0xe1; + buffer2[2]=0x54; + memcpy(buffer2+4, header, 8); + print_load("unknown e1 cdb: "); + hex_print_load((char *)buffer2, 12); + return do_cdb(buffer2, 12, payload, 0x54, SG_DXFER_TO_DEV);/*orig: SG_DXFER_TO_DEV*/ +} + +int do_unknown_e0(unsigned char* header, unsigned char* payload) +{ + unsigned char buffer2[12]; + print_load("do unknown e0: "); + memset(buffer2, 0, 12); + buffer2[0]=0xe0; + buffer2[2]=0x34; + memcpy(buffer2+4, header, 8); + print_load("unknown e0 cdb: "); + hex_print_load((char *)buffer2, 12); + return do_cdb(buffer2, 12, payload, 0x34, SG_DXFER_FROM_DEV); +} + +void load_keys(unsigned char* EID4, unsigned char* CMAC, unsigned char* KE, unsigned char* IE) +{ + unsigned char destinationArray[0x20]; + unsigned char buffer2[0x10]; + unsigned char destination[0x40]; + + print_load("Load keys"); + AESEncrypt(KE, 256, IE, InitialSeed, 0, 0x40, destination, 0); + memcpy(destinationArray, destination+0x20, 0x20); + memcpy(buffer2, destination+0x10, 0x10); + AESDecrypt(destinationArray, 256, buffer2, EID4, 0, 0x20, destination, 0); + memcpy(Key1, destination, 0x10); + memcpy(Key2, destination+0x10, 0x10); +} + +void dec_d2(unsigned char* d2) +{ + unsigned char key[]= { 0x7c, 0xdd, 14, 2, 7, 110, 0xfe, 0x45, 0x99, 0xb1, 0xb8, 0x2c, 0x35, 0x99, 0x19, 0xb3 }; + unsigned char iV[] = { 0x22, 0x26, 0x92, 0x8d, 0x44, 3, 0x2f, 0x43, 0x6a, 0xfd, 0x26, 0x7e, 0x74, 0x8b, 0x23, 0x93 }; + aes_cbc_decrypt(iV, key, 128, d2, 16, d2); +} +void dec_d1(unsigned char* d1) +{ + unsigned char key[]= { 0x38, 11, 0xcf, 11, 0x53, 0x45, 0x5b, 60, 120, 0x17, 0xab, 0x4f, 0xa3, 0xba, 0x90, 0xed }; + unsigned char iV[] = { 0x69, 0x47, 0x47, 0x72, 0xaf, 0x6f, 0xda, 0xb3, 0x42, 0x74, 0x3a, 0xef, 170, 0x18, 0x62, 0x87 }; + aes_cbc_encrypt(iV, key, 128, d1, 16, d1); +} diff --git a/MGZ/source/bd_keys/bd.h b/MGZ/source/bd/bd.h similarity index 86% rename from MGZ/source/bd_keys/bd.h rename to MGZ/source/bd/bd.h index 812a6884..1f482f1b 100644 --- a/MGZ/source/bd_keys/bd.h +++ b/MGZ/source/bd/bd.h @@ -2,6 +2,7 @@ #define __BD_H__ int Dump_BD_keys(); +u8 *get_d1(); #endif /* _SYS_STORAGE_H__ */ diff --git a/MGZ/source/bd_keys/io_buffer.h b/MGZ/source/bd/io_buffer.h similarity index 100% rename from MGZ/source/bd_keys/io_buffer.h rename to MGZ/source/bd/io_buffer.h diff --git a/MGZ/source/bd_keys/ioctl.c b/MGZ/source/bd/ioctl.c similarity index 100% rename from MGZ/source/bd_keys/ioctl.c rename to MGZ/source/bd/ioctl.c diff --git a/MGZ/source/bd_keys/ioctl.h b/MGZ/source/bd/ioctl.h similarity index 100% rename from MGZ/source/bd_keys/ioctl.h rename to MGZ/source/bd/ioctl.h diff --git a/MGZ/source/bd_keys/storage.h b/MGZ/source/bd/storage.h similarity index 100% rename from MGZ/source/bd_keys/storage.h rename to MGZ/source/bd/storage.h diff --git a/MGZ/source/bd_keys/bd.c b/MGZ/source/bd_keys/bd.c deleted file mode 100644 index 0065e954..00000000 --- a/MGZ/source/bd_keys/bd.c +++ /dev/null @@ -1,562 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include "storage.h" -#include "ioctl.h" - -#define SG_DXFER_TO_DEV ATAPI_PIO_DATA_OUT_PROTO, ATAPI_DIR_WRITE -#define SG_DXFER_FROM_DEV ATAPI_PIO_DATA_IN_PROTO, ATAPI_DIR_READ - -#define RET_TRUE 0 -#define RET_FALSE 1 - -unsigned int version=2; - -unsigned char FixedKey30[] = { 220, 8, 0x2f, 0x83, 0x7f, 20, 0x87, 0xc2, 0, 0x8b, 0x7b, 0xc9, 0x20, 0xc5, 0x5b, 0xd9 }; -unsigned char FixedKey31[] = { 0xe8, 8, 0x85, 0xf9, 110, 0xd0, 0xf3, 0x67, 0x52, 0xce, 0x52, 190, 0xc3, 0xc7, 0x4e, 0xf3 }; -unsigned char InitialSeed[] = { - 0x3e, 0xc2, 12, 0x17, 2, 0x19, 1, 0x97, 0x8a, 0x29, 0x71, 0x79, 0x38, 0x29, 0xd3, 8, - 4, 0x29, 250, 0x84, 0xe3, 0x3e, 0x7f, 0x73, 12, 0x1d, 0x41, 110, 0xea, 0x25, 0xca, 0xfb, - 0x3d, 0xe0, 0x2b, 0xc0, 5, 0xea, 0x49, 11, 3, 0xe9, 0x91, 0x98, 0xf8, 0x3f, 0x10, 0x1f, - 0x1b, 0xa3, 0x4b, 80, 0x58, 0x94, 40, 0xad, 210, 0xb3, 0xeb, 0x3f, 0xf4, 0xc3, 0x1a, 0x58 - }; -unsigned char IV1[] = { 0x22, 0x26, 0x92, 0x8d, 0x44, 3, 0x2f, 0x43, 0x6a, 0xfd, 0x26, 0x7e, 0x74, 0x8b, 0x23, 0x93 }; -unsigned char IV2[] = { 0xe8, 11, 0x3f, 12, 0xd6, 0x56, 0x6d, 0xd0 }; -unsigned char IV3[] = { 0x3b, 0xd6, 0x24, 2, 11, 0xd3, 0xf8, 0x65, 0xe8, 11, 0x3f, 12, 0xd6, 0x56, 0x6d, 0xd0 }; -unsigned char Key1[0x10]; -unsigned char Key2[0x10]; -unsigned char Key3[] = { 0x12, 0x6c, 0x6b, 0x59, 0x45, 0x37, 14, 0xee, 0xca, 0x68, 0x26, 0x2d, 2, 0xdd, 0x12, 210 }; -unsigned char Key4[] = { 0xd9, 0xa2, 10, 0x79, 0x66, 0x6c, 0x27, 0xd1, 0x10, 50, 0xac, 0xcf, 13, 0x7f, 0xb5, 1 }; -unsigned char Key5[] = { 0x19, 0x76, 0x6f, 0xbc, 0x77, 0xe4, 0xe7, 0x5c, 0xf4, 0x41, 0xe4, 0x8b, 0x94, 0x2c, 0x5b, 0xd9 }; -unsigned char Key6[] = { 80, 0xcb, 0xa7, 240, 0xc2, 0xa7, 0xc0, 0xf6, 0xf3, 0x3a, 0x21, 0x43, 0x26, 0xac, 0x4e, 0xf3 }; -unsigned char Key7[0x10]; -unsigned char Key8[0x10]; - -/* Handler to the BD-ROM */ -int g_fd = 0; -FILE *g_file_log = NULL; -FILE *g_file_binlog = NULL; - -void calculate_session_keys(unsigned char* r1, unsigned char* r2); -int do_send_key(char keyFormat, unsigned char* payload, int payload_len); -int do_report_key(char keyFormat, unsigned char* payload, int payload_len); -int establish_session_keys(char keyselection, unsigned char* KA, unsigned char* KB); -void triple_des_encrypt(unsigned char* Key, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset); -int do_unknown_e0(unsigned char* header, unsigned char* payload); -int do_unknown_e1(unsigned char* header, unsigned char* payload); -void load_keys(unsigned char* EID4, unsigned char* CMAC, unsigned char* KE, unsigned char* IE); -void hex_fprintf(FILE *fp, unsigned char *buf, size_t len); -int get_dec_key(unsigned char* d1, unsigned char* d2); -int get_data(unsigned char* data1, unsigned char* data2); - -void dec_d2(unsigned char* d2); -void dec_d1(unsigned char* d1); - -int do_cdb(unsigned char* cdb, int cdb_len, unsigned char* transfer, int transfer_len, uint32_t proto, uint32_t type) -{ - int ret; - struct lv2_atapi_cmnd_block atapi_cmnd; - - sys_storage_init_atapi_cmnd(&atapi_cmnd, transfer_len, proto, type); - memcpy(atapi_cmnd.pkt, cdb, cdb_len); - if (transfer_len == 0 || transfer == NULL) - atapi_cmnd.blocks = 0; - ret = sys_storage_send_atapi_command(g_fd, &atapi_cmnd, transfer); - - if(ret != 0) { - fprintf(g_file_log, "ioctl indicates command failed: %d\r\n", ret); - return RET_FALSE; - } - - fprintf(g_file_log, "return value of ioctl indicates success\r\n"); - return RET_TRUE; -} - -int test_unit_ready() -{ - fprintf(g_file_log, "Test unit ready: "); - unsigned char cdb[]= {0, 0, 0, 0, 0, 0}; - return do_cdb(cdb, 6, NULL, 0, ATAPI_NON_DATA_PROTO, ATAPI_DIR_WRITE); -} - -int read_pic(unsigned char* ret) -{ - fprintf(g_file_log, "Read pic: "); - unsigned char cdb[]= { 0xad, 1, 0, 0, 0, 0, 0, 0, 0x10, 0x04, 0, 0 }; - return do_cdb(cdb, 12, ret, 4100, SG_DXFER_FROM_DEV); -} - -int Dump_BD_keys() -{ - FILE* file_io; - - unsigned char d_3dump[0x60]; - unsigned char* eid4=d_3dump; - unsigned char* cmac=d_3dump+0x20; - unsigned char* ke=d_3dump+0x30; - unsigned char* ie=d_3dump+0x50; - unsigned char d1[16]; - unsigned char d2[16]; - - unsigned char* pic; - int pic_len; - unsigned char all=3; - - g_file_log = fopen("/dev_usb000/getkey.log" , "wb"); - fprintf(g_file_log, "\r\nGetKey r%u\r\n", version); - - memset(d1, 0, 16); - memset(d2, 0, 16); - - /*Read 3Dump.bin*/ - if( (file_io=fopen("/dev_usb000/3Dump.bin", "rb"))==NULL ) - { - fprintf(g_file_log, "Error opening 3Dump.bin\r\n"); - fclose(g_file_log); - return 1; - } - if( fread(d_3dump, 1, 0x60, file_io)!=0x60 ) - { - fprintf(g_file_log, "Error reading 3Dump.bin\r\n"); - fclose(g_file_log); - return 1; - } - fclose(file_io); - - load_keys(eid4, cmac, ke, ie); - - /* Start the drive communication */ -if(sys_storage_open(BD_DEVICE, &g_fd) != 0) { - fprintf(g_file_log, "sys_storage_open failed...\n"); - fclose(g_file_log); - return 1; -} - - if(test_unit_ready()!=RET_TRUE) - { - fprintf(g_file_log, "Test unit failed, are you sure a disc is in the drive?\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 1; - } - - /*get PIC*/ - pic=malloc(4100); - memset(pic, 0, 4100); - read_pic(pic); - pic_len=0x83; - while(pic[pic_len]==0 && pic_len>=0) - --pic_len; - ++pic_len; - if(pic_len==0) - { - fprintf(g_file_log, " Empty PIC, probably wrong. Continuing anyway to try and get key\r\n"); - all-=1; - } - - if(get_dec_key(d1, d2)==RET_TRUE) - { - fprintf(g_file_log, "get_dec_key succeeded!\r\n"); - fprintf(g_file_log, "writing disc.key binary header...\r\n"); - if( ( g_file_binlog = fopen("/dev_usb000/disc.key" , "wb") )==NULL ) - { - fprintf(g_file_log, "Failed to open disc.key for writing\r\n"); - fclose(g_file_binlog); - fclose(g_file_log); - return 1; - } - - fprintf(g_file_binlog, "Encrypted 3K RIP"); - - if (fwrite(d1, 1, 16, g_file_binlog) != 16) { - fprintf(g_file_log, "Failed writing binary key 1 to disk.key\r\n"); - } - - if (fwrite(d2, 1, 16, g_file_binlog) != 16) { - fprintf(g_file_log, "Failed writing binary key 2 to disk.key\r\n"); - } - - if (fwrite(pic, 1, 0x73, g_file_binlog) != 0x73) { - fprintf(g_file_log, "Failed writing binary pic data to disk.key\r\n"); - } - - fclose(g_file_binlog); - - dec_d1(d1); - dec_d2(d2); - - } - else - { - fprintf(g_file_log, "get_dec_key failed, key was not dumped\r\n"); - if(pic_len==0) - { - fprintf(g_file_log, "Nothing could be dumped. Your drive may be unsupported, please report it\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return RET_FALSE; - } - all-=2; - } - - if(all>1) - { - fprintf(g_file_log, "\r\n\r\ndisc_key = "); - hex_fprintf(g_file_log, d1, 16); - fprintf(g_file_log, "\r\n\r\ndisc_id = "); - if(d2[12]==0 && d2[13]==0 && d2[14]==0 && d2[15]==0) - hex_fprintf(g_file_log, d2, 16); - else - { - hex_fprintf(g_file_log, d2, 12); - fprintf(g_file_log, "XXXXXXXX"); - } - fprintf(g_file_log, "\r\n\r\ndisc_id (d2 enc) = "); - hex_fprintf(g_file_log, d2, 16); - } - if(pic_len!=0) - { - fprintf(g_file_log, "\r\nPIC:\r\n"); - hex_fprintf(g_file_log, pic, 0x84); - fprintf(g_file_log, "\r\n"); - } - - /*dump pic in full*/ - if( (file_io=fopen("/dev_usb000/disc.pic", "wb"))==NULL ) - { - fprintf(g_file_log, "Failed to open big.pic for writing\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 1; - } - if(fwrite(pic, 1, 4100, file_io)!=4100) - { - fprintf(g_file_log, "Failed to write to big.pic\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 1; - } - fclose(file_io); - - free(pic); - if(all==3) - { - fprintf(g_file_log, "\r\nSUCCESS: Everything was correctly dumped.\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 0; - } - else if(all==2) - { - fprintf(g_file_log, "\r\nWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\r\n\r\n"); - fprintf(g_file_log, "WARNING: Not everything was correctly dumped (PIC missing)\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 1; - } - else if(all==1) - { - fprintf(g_file_log, "\r\nWARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\r\n\r\n"); - fprintf(g_file_log, "WARNING: Not everything was correctly dumped (d1 missing)\r\n"); - sys_storage_close(g_fd); - fclose(g_file_log); - return 1; - } - - sys_storage_close(g_fd); - fclose(g_file_log); - return 0;/*suppress warning*/ -} - -/*glevand*/ -void -aes_cbc_encrypt(const unsigned char *iv, const unsigned char *key, int key_length, - const unsigned char *data, int data_length, unsigned char *out) -{ - AES_KEY aes_key; - unsigned char cbc[AES_BLOCK_SIZE]; - int i; - - AES_set_encrypt_key(key, key_length, &aes_key); - - memcpy(cbc, iv, AES_BLOCK_SIZE); - - while (data_length >= AES_BLOCK_SIZE) { - for (i = 0; i < AES_BLOCK_SIZE; i++) - out[i] = cbc[i] ^ data[i]; - - AES_encrypt(out, out, &aes_key); - - memcpy(cbc, out, AES_BLOCK_SIZE); - - data += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - data_length -= AES_BLOCK_SIZE; - } -} - -/*lazy wrapper*/ -void AESEncrypt(unsigned char* Key, unsigned int bits, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) -{ - aes_cbc_encrypt(IV, Key, bits, Source+SOffset, SLength, Destination+DOffset); -} - -/*glevand*/ -static void -aes_cbc_decrypt(const unsigned char *iv, const unsigned char *key, int key_length, - const unsigned char *data, int data_length, unsigned char *out) -{ - AES_KEY aes_key; - unsigned char cbc[AES_BLOCK_SIZE]; - unsigned char buf[AES_BLOCK_SIZE]; - int i; - - AES_set_decrypt_key(key, key_length, &aes_key); - - memcpy(cbc, iv, AES_BLOCK_SIZE); - - while (data_length >= AES_BLOCK_SIZE) { - memcpy(buf, data, AES_BLOCK_SIZE); - - AES_decrypt(data, out, &aes_key); - - for (i = 0; i < AES_BLOCK_SIZE; i++) - out[i] ^= cbc[i]; - - memcpy(cbc, buf, AES_BLOCK_SIZE); - - data += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - data_length -= AES_BLOCK_SIZE; - } -} - -/*lazy wrapper*/ -void AESDecrypt(unsigned char* Key, unsigned int bits, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) -{ - aes_cbc_decrypt(IV, Key, bits, Source+SOffset, SLength, Destination+DOffset); -} - -/*glevand*/ -void triple_des_encrypt(unsigned char* Key, unsigned char* IV, unsigned char* Source, int SOffset, int SLength, unsigned char* Destination, int DOffset) -{ - DES_cblock kcb1; - DES_cblock kcb2; - DES_cblock ivcb; - DES_key_schedule ks1; - DES_key_schedule ks2; - - memcpy(kcb1, Key, DES_KEY_SZ); - memcpy(kcb2, Key + DES_KEY_SZ, DES_KEY_SZ); - memcpy(ivcb, IV, DES_KEY_SZ); - - DES_set_key_unchecked(&kcb1, &ks1); - DES_set_key_unchecked(&kcb2, &ks2); - - DES_ede2_cbc_encrypt(Source+SOffset, Destination+DOffset, SLength, &ks1, &ks2, &ivcb, DES_ENCRYPT); -} - -int get_dec_key(unsigned char* d1, unsigned char* d2) -{ - fprintf(g_file_log, "get dec key\r\n"); - if(establish_session_keys(0, Key1, Key2)!=RET_TRUE) - return RET_FALSE; - if(get_data(d1, d2)!=RET_TRUE) - { - fprintf(g_file_log, " get data failed\r\n"); - return RET_FALSE; - } - return RET_TRUE; -} - -int establish_session_keys(char keyselection, unsigned char* KA, unsigned char* KB) -{ - unsigned char source[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; - unsigned char buffer7[4]; - unsigned char* sourceArray = buffer7; - unsigned char destinationArray[20]; - unsigned char payload[0x24]; - unsigned char destination[0x10]; - unsigned char buffer6[0x10]; - fprintf(g_file_log, " establish session keys:\r\n"); - buffer7[1] = 0x10; - memcpy(destinationArray, sourceArray, 4); - - AESEncrypt(KA, 128, IV1, source, 0, 0x10, destinationArray, 4); - if (do_send_key(keyselection, destinationArray, 20) != RET_TRUE) - return RET_FALSE; - if (do_report_key(keyselection, payload, 0x24) != RET_TRUE) - return RET_FALSE; - AESDecrypt(KB, 128, IV1, payload, 4, 0x10, destination, 0); - AESDecrypt(KB, 128, IV1, payload, 20, 0x10, buffer6, 0); - if(memcmp(source, destination, 0x10)!=0) - { - fprintf(g_file_log, " Memory comparison failed (rnd1 mismatch?)\r\n"); - return RET_FALSE; - } - calculate_session_keys(destination, buffer6); - if (keyselection == 0) - { - memcpy(destinationArray, sourceArray, 4); - AESEncrypt(KA, 128, IV1, buffer6, 0, 0x10, destinationArray, 4); - if (do_send_key(2, destinationArray, 20) != RET_TRUE) - return RET_FALSE; - } - else - { - if (do_report_key(keyselection, payload, 0x24) != RET_TRUE) - return RET_FALSE; - } - return RET_TRUE; -} - -void hex_fprintf(FILE *fp, unsigned char *buf, size_t len) -{ - int i=0; - - if (len <= 0) - return; - - while(i < len) - { - if(i>0&&i%16==0) - fprintf(fp, "\r\n"); - fprintf(fp, "%02x", buf[i]); - ++i; - } -} - -int do_report_key(char keyFormat, unsigned char* payload, int payload_len) -{ - unsigned char buffer2[12]; - fprintf(g_file_log, " do report key: "); - memset(buffer2, 0, 12); - buffer2[0] = 0xa4; - buffer2[7] = 0xe0; - buffer2[8]=(unsigned char) (payload_len>>8); - buffer2[9]=(unsigned char) (payload_len); - buffer2[10] = keyFormat; - return do_cdb(buffer2, 12, payload, payload_len, SG_DXFER_FROM_DEV); -} - -int do_send_key(char keyFormat, unsigned char* payload, int payload_len) -{ - unsigned char buffer2[12]; - fprintf(g_file_log, " do send key: "); - memset(buffer2, 0, 12); - buffer2[0] = 0xa3; - buffer2[7] = 0xe0; - buffer2[8]=(unsigned char) (payload_len>>8); - buffer2[9]=(unsigned char) (payload_len); - buffer2[10] = keyFormat; - return do_cdb(buffer2, 12, payload, payload_len, SG_DXFER_TO_DEV); -} - -void calculate_session_keys(unsigned char* r1, unsigned char* r2) -{ - unsigned char destinationArray[0x10]; - fprintf(g_file_log, " calculate session keys\r\n"); - memcpy(destinationArray, r1, 8); - memcpy(destinationArray+8, r2+8, 8); - AESEncrypt(Key3, 128, IV1, destinationArray, 0, 0x10, Key7, 0); - memcpy(destinationArray, r1+8, 8); - memcpy(destinationArray+8, r2, 8); - AESEncrypt(Key4, 128, IV1, destinationArray, 0, 0x10, Key8, 0); -} - -int get_data(unsigned char* data1, unsigned char* data2) -{ - unsigned char destination[0x30]; - unsigned char buffer7[8]; - unsigned char* source = buffer7; - unsigned char buffer3[] = { 3, 0, 0, 0, 0, 0, 0x61, 0x9b }; - unsigned char buffer4[8]; - unsigned char buffer5[0x54]; - unsigned char buffer6[] = { - 0x9b, 0xcd, 0, 0, 0x63, 0x17, 0xa8, 0xcd, 0x12, 80, 0xd7, 10, 0x19, 0x5d, 0x7e, 2, - 0xb0, 0xdb, 0x94, 0x6f, 0xcf, 0x2c, 0xcf, 0x4d, 0xef, 0x20, 0xe7, 0x4c, 0x9a, 30, 0x68, 6, - 2, 0x8a, 0, 70, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 110, 0x8a, 0x6f, 0x2d, 0xde, 7, 0x20, 0x2b, 0xf4, 0xd0, 0xbb, 0xdb, - 0x8a, 11, 0x80, 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - fprintf(g_file_log, " get data\r\n"); - memset(buffer7, 0, 8); - buffer7[6] = 10; - buffer7[7] = 0xf5; - memset(buffer5, 0, 0x54); - buffer5[0] = 0; - buffer5[1] = 80; - buffer5[2] = 0; - buffer5[3] = 0; - AESEncrypt(Key7, 128, IV3, buffer6, 0, 80, buffer5, 4); - triple_des_encrypt(Key7, IV2, source, 0, 8, buffer4, 0); - if (do_unknown_e1(buffer4, buffer5) != RET_TRUE)//. - return RET_FALSE; - triple_des_encrypt(Key7, IV2, buffer3, 0, 8, buffer4, 0); - if (do_unknown_e0(buffer4, buffer5) != RET_TRUE)//. - return RET_FALSE; - AESDecrypt(Key7, 128, IV3, buffer5, 4, 0x30, destination, 0); - AESDecrypt(Key8, 128, IV3, destination, 3, 0x10, data1, 0); - AESDecrypt(Key8, 128, IV3, destination, 0x13, 0x10, data2, 0); - return RET_TRUE; -} - -int do_unknown_e1(unsigned char* header, unsigned char* payload) -{ - unsigned char buffer2[12]; - fprintf(g_file_log, " do unknown e1:\r\n"); - memset(buffer2, 0, 12); - buffer2[0]=0xe1; - buffer2[2]=0x54; - memcpy(buffer2+4, header, 8); - fprintf(g_file_log, " unknown e1 cdb: "); - hex_fprintf(g_file_log, buffer2, 12); - fprintf(g_file_log, "\r\n "); - return do_cdb(buffer2, 12, payload, 0x54, SG_DXFER_TO_DEV);/*orig: SG_DXFER_TO_DEV*/ -} - -int do_unknown_e0(unsigned char* header, unsigned char* payload) -{ - unsigned char buffer2[12]; - fprintf(g_file_log, " do unknown e0:\r\n"); - memset(buffer2, 0, 12); - buffer2[0]=0xe0; - buffer2[2]=0x34; - memcpy(buffer2+4, header, 8); - fprintf(g_file_log, " unknown e0 cdb: "); - hex_fprintf(g_file_log, buffer2, 12); - fprintf(g_file_log, "\r\n "); - return do_cdb(buffer2, 12, payload, 0x34, SG_DXFER_FROM_DEV); -} - -void load_keys(unsigned char* EID4, unsigned char* CMAC, unsigned char* KE, unsigned char* IE) -{ - unsigned char destinationArray[0x20]; - unsigned char buffer2[0x10]; - unsigned char destination[0x40]; - - fprintf(g_file_log, "Load keys\r\n"); - AESEncrypt(KE, 256, IE, InitialSeed, 0, 0x40, destination, 0); - memcpy(destinationArray, destination+0x20, 0x20); - memcpy(buffer2, destination+0x10, 0x10); - AESDecrypt(destinationArray, 256, buffer2, EID4, 0, 0x20, destination, 0); - memcpy(Key1, destination, 0x10); - memcpy(Key2, destination+0x10, 0x10); -} - -void dec_d2(unsigned char* d2) -{ - unsigned char key[]= { 0x7c, 0xdd, 14, 2, 7, 110, 0xfe, 0x45, 0x99, 0xb1, 0xb8, 0x2c, 0x35, 0x99, 0x19, 0xb3 }; - unsigned char iV[] = { 0x22, 0x26, 0x92, 0x8d, 0x44, 3, 0x2f, 0x43, 0x6a, 0xfd, 0x26, 0x7e, 0x74, 0x8b, 0x23, 0x93 }; - aes_cbc_decrypt(iV, key, 128, d2, 16, d2); -} -void dec_d1(unsigned char* d1) -{ - unsigned char key[]= { 0x38, 11, 0xcf, 11, 0x53, 0x45, 0x5b, 60, 120, 0x17, 0xab, 0x4f, 0xa3, 0xba, 0x90, 0xed }; - unsigned char iV[] = { 0x69, 0x47, 0x47, 0x72, 0xaf, 0x6f, 0xda, 0xb3, 0x42, 0x74, 0x3a, 0xef, 170, 0x18, 0x62, 0x87 }; - aes_cbc_encrypt(iV, key, 128, d1, 16, d1); -} diff --git a/MGZ/source/common.h b/MGZ/source/common.h index c089f4ff..444427f9 100644 --- a/MGZ/source/common.h +++ b/MGZ/source/common.h @@ -858,4 +858,27 @@ #define OFFSET_1_IDPS_485C 0x80000000003E2E30ULL #define OFFSET_2_IDPS_485C 0x8000000000474AF4ULL +#define TOC_486C 0x800000000034FBB0ULL +#define SYSCALL_TABLE_486C 0x8000000000363BE0ULL +#define HV_START_OFFSET_486C 0x370F28 +#define HTAB_OFFSET_486C 0x2DD70C +#define MMAP_OFFSET1_486C 0x2DCF54 +#define MMAP_OFFSET2_486C 0x2DD284 +#define SPE_OFFSET_486C 0x2F9EB8 +#define OFFSET_FIX_486C 0x05658C +#define OFFSET_2_FIX_486C 0x05A6E4 +#define OFFSET_FIX_2B17_486C 0x2275F4 +#define OFFSET_FIX_LIC_486C 0x056230 +#define OFFSET_FIX_3C_486C 0x267150 +#define OPEN_HOOK_486C 0x8000000000297638ULL +#define BASE_ADDR_486C 0x80000000002D8AF0ULL +#define LV2MOUNTADDR_486C 0x8000000000479FC0ULL +#define LV2MOUNTADDR_ESIZE_486C 0x118 +#define LV2MOUNTADDR_CSIZE_486C 0x108 +#define FW_DATE_OFFSET_486C 0x80000000002FCB68ULL +#define FW_DATE_1_486C 0x323032302F30312FULL +#define FW_DATE_2_486C 0x33302031313A3330ULL +#define OFFSET_1_IDPS_486C 0x80000000003E2E30ULL +#define OFFSET_2_IDPS_486C 0x8000000000474AF4ULL + #endif /* __COMMON_H__ */ diff --git a/MGZ/source/data.h b/MGZ/source/data.h index da440675..10257052 100644 --- a/MGZ/source/data.h +++ b/MGZ/source/data.h @@ -225,5 +225,11 @@ #include "mamba_485C_lz_bin.h" #include "mamba_loader_485C_bin.h" +#include "erk_dumper_486C_bin.h" +#include "payload_sky_486C_bin.h" +#include "umount_486C_bin.h" +#include "mamba_486C_lz_bin.h" +#include "mamba_loader_486C_bin.h" + #endif /* __DATA_H__ */ diff --git a/MGZ/source/erk/common.h b/MGZ/source/erk/common.h index 0efa5d8c..a6473114 100644 --- a/MGZ/source/erk/common.h +++ b/MGZ/source/erk/common.h @@ -11,6 +11,9 @@ #include #include +#define SUCCESS 1 +#define FAILED 0 + #define COUNT_OF(x) (sizeof(x) / sizeof((x)[0])) #define KERNEL_BASE 0x8000000000000000ULL diff --git a/MGZ/source/erk/dumper.c b/MGZ/source/erk/dumper.c index 0aa695e1..693a62a8 100644 --- a/MGZ/source/erk/dumper.c +++ b/MGZ/source/erk/dumper.c @@ -6,9 +6,13 @@ #include "utils.h" #include "payload.h" -#define SYSMODULE_SYSUTIL_GAME 0x003e +#define SYSMODULE_SYSUTIL_GAME 0x003e + + extern void print_load(char *format, ...); +extern void print_head(char *format, ...); +extern void hex_print_load(char *data, size_t len); extern u8 eid_root_key[EID_ROOT_KEY_SIZE]; extern u64 HV_START_OFFSET; @@ -17,7 +21,7 @@ extern u64 MMAP_OFFSET1; extern u64 MMAP_OFFSET2; extern u64 SPE_OFFSET; -static int make_patches(void) { +void make_patches(void) { /* allow mapping of HTAB with write protection */ lv1_poke64(HTAB_OFFSET, 0x60000000E97F00A8ULL); @@ -40,78 +44,87 @@ static int make_patches(void) { /* remove page protection bits from htab entries */ patch_htab_entries(0); - - return 0; } int dump_eid_root_key(const char* file_path) { - int result; + + int ret; FILE* fp; int poke_installed; int payload_installed; - + poke_installed = 0; payload_installed = 0; - print_load("Dumping the eid_root_key"); + print_head("Dumping the eid_root_key"); print_load("* install_new_poke"); - result = install_new_poke(); - if (result != 0) { - print_load("Error : install_new_poke() failed: 0x%08X", result); + if (install_new_poke() == FAILED) { + print_load("Error : install_new_poke() failed"); + ret = FAILED; goto error; } poke_installed = 1; + print_load("* make_patches"); - result = make_patches(); - if (result != 0) { - print_load("Error : make_patches() failed: 0x%08X", result); - goto error; - } + make_patches(); + print_load("* install_payload"); - result = install_payload(); - if (result != 0) { - print_load("Error : install_payload() failed: 0x%08X", result); + if(install_payload() == FAILED) { + print_load("Error : install_payload() failed"); + ret = FAILED; goto error; } payload_installed = 1; memset(eid_root_key, 0, EID_ROOT_KEY_SIZE); + print_load("* run_payload"); - result = run_payload((uintptr_t)eid_root_key, EID_ROOT_KEY_SIZE); + int result = run_payload((uintptr_t)eid_root_key, EID_ROOT_KEY_SIZE); if (result != 0) { print_load("Error : run_payload() failed: 0x%08X", result); + ret = FAILED; + goto error; + } + + u8 empty[EID_ROOT_KEY_SIZE]; + memset(empty, 0, EID_ROOT_KEY_SIZE); + + if( !memcmp((char *) eid_root_key, (char *) empty, EID_ROOT_KEY_SIZE) ) { + print_load("Error : eid_root_key is empty, something failed..."); + ret = FAILED; goto error; + } + + print_load("* eid_root_key :"); + hex_print_load((char *) eid_root_key, EID_ROOT_KEY_SIZE); + print_load("* write eid_root_key"); fp = fopen(file_path, "wb"); if (!fp) { - result = errno; - print_load("Error : fopen() failed: 0x%08X", result); + print_load("Error : fopen() failed"); + ret = FAILED; goto error; } - fwrite(eid_root_key, 1, EID_ROOT_KEY_SIZE, fp); - fclose(fp); - result = 0; + ret = SUCCESS; error: if (payload_installed) { print_load("* remove_payload"); - result = remove_payload(); - if (result != 0) - print_load("remove_payload() failed: 0x%08X", result); + if(remove_payload() == FAILED) + print_load("Warning : remove_payload() failed"); } if (poke_installed) { print_load("* remove_new_poke"); - result = remove_new_poke(); - if (result != 0) - print_load("remove_new_poke() failed: 0x%08X", result); + if (remove_new_poke() == FAILED) + print_load("Warning : remove_new_poke() failed"); } - return result; + return ret; } diff --git a/MGZ/source/erk/payload.c b/MGZ/source/erk/payload.c index 38963219..9be380ab 100644 --- a/MGZ/source/erk/payload.c +++ b/MGZ/source/erk/payload.c @@ -14,7 +14,7 @@ extern size_t ERK_DUMPER_SIZE; int install_payload(void) { - if (ERK_DUMPER_SIZE <= 0) return -1; + if (ERK_DUMPER_SIZE <= 0) return FAILED; lv2_copy_from_user(ERK_DUMPER, ERK_PAYLOAD_OFFSET, ERK_DUMPER_SIZE); @@ -24,7 +24,7 @@ int install_payload(void) { real_opd_offset = SYSCALL_OPD_OFFSET(SYSCALL_RUN_PAYLOAD); lv2_poke64(SYSCALL_OPD_PTR_OFFSET(SYSCALL_RUN_PAYLOAD), ERK_PAYLOAD_OPD_OFFSET); - return 0; + return SUCCESS; } int remove_payload(void) { @@ -33,5 +33,5 @@ int remove_payload(void) { real_opd_offset = 0; } - return 0; + return SUCCESS; } diff --git a/MGZ/source/erk/utils.c b/MGZ/source/erk/utils.c index 4d705187..24b7b357 100644 --- a/MGZ/source/erk/utils.c +++ b/MGZ/source/erk/utils.c @@ -156,7 +156,7 @@ int triple_beep(void) { int install_new_poke(void) { poke_with_cache_original_code = (uint32_t*)malloc(poke_with_cache_code_size); if (!poke_with_cache_original_code) - return ENOMEM; + return FAILED; memset(poke_with_cache_original_code, 0, poke_with_cache_code_size); @@ -167,12 +167,12 @@ int install_new_poke(void) { poke_syscall = SYSCALL_POKE_WITH_CACHE; - return 0; + return SUCCESS; } int remove_new_poke(void) { if (!poke_with_cache_original_code) - return EFAULT; + return FAILED; poke_syscall = old_poke_syscall; old_poke_syscall = -1; @@ -182,6 +182,6 @@ int remove_new_poke(void) { free(poke_with_cache_original_code); poke_with_cache_original_code = NULL; - return 0; + return SUCCESS; } diff --git a/MGZ/source/fw.c b/MGZ/source/fw.c index 17952a75..caf0c9be 100644 --- a/MGZ/source/fw.c +++ b/MGZ/source/fw.c @@ -1447,6 +1447,44 @@ u8 init_fw() ERK_DUMPER_SIZE = erk_dumper_485C_bin_size; ERK_DUMPER = (u64 *) erk_dumper_485C_bin; + } else + if(( lv2peek(FW_DATE_OFFSET_486C )==FW_DATE_1_486C) && + ( lv2peek(FW_DATE_OFFSET_486C + 8)==FW_DATE_2_486C) ) + { + + firmware = 0x486C; + + OFFSET_2_FIX = OFFSET_2_FIX_486C; + LV2MOUNTADDR_ESIZE = LV2MOUNTADDR_ESIZE_486C; + LV2MOUNTADDR_CSIZE = LV2MOUNTADDR_CSIZE_486C; + OFFSET_FIX = OFFSET_FIX_486C; + HV_START_OFFSET = HV_START_OFFSET_486C; + OFFSET_FIX_2B17 = OFFSET_FIX_2B17_486C; + OFFSET_FIX_LIC = OFFSET_FIX_LIC_486C; + OFFSET_FIX_3C = OFFSET_FIX_3C_486C; + TOC = TOC_486C; + SYSCALL_TABLE = SYSCALL_TABLE_486C; + HTAB_OFFSET = HTAB_OFFSET_486C; + MMAP_OFFSET1 = MMAP_OFFSET1_486C; + MMAP_OFFSET2 = MMAP_OFFSET2_486C; + SPE_OFFSET = SPE_OFFSET_486C; + LV2MOUNTADDR = LV2MOUNTADDR_486C; + OPEN_HOOK = OPEN_HOOK_486C; + BASE_ADDR = BASE_ADDR_486C; + OFFSET_1_IDPS = OFFSET_1_IDPS_486C; + OFFSET_2_IDPS = OFFSET_2_IDPS_486C; + + PAYLOAD_SKY_SIZE = payload_sky_486C_bin_size; + PAYLOAD_SKY = (u64) payload_sky_486C_bin; + UMOUNT_SIZE = umount_486C_bin_size; + UMOUNT = (u64) umount_486C_bin; + MAMBA_SIZE = mamba_486C_lz_bin_size; + MAMBA = (u64) mamba_486C_lz_bin; + MAMBA_LOADER_SIZE = mamba_loader_486C_bin_size; + MAMBA_LOADER = (u64 *) mamba_loader_486C_bin; + ERK_DUMPER_SIZE = erk_dumper_486C_bin_size; + ERK_DUMPER = (u64 *) erk_dumper_486C_bin; + } else {return FAILED;} NEW_POKE_SYSCALL_ADDR = lv2peek( lv2peek(SYSCALL_TABLE + NEW_POKE_SYSCALL*8) ) + 0ULL; diff --git a/MGZ/source/gim2png.c b/MGZ/source/gim2png.c new file mode 100644 index 00000000..caa36939 --- /dev/null +++ b/MGZ/source/gim2png.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include "makepng.h" + +#define SUCCESS 1 +#define FAILED 0 + +extern s8 gimLoadFromBuffer(const void *buffer, int file_size, imgData *data); +extern char *LoadFile(char *path, int *file_size); + +int gim2png(char* gimfilename,char* pngfilename) { + + int file_size; + imgData gimData; + + u8 *gimFile = (u8 *) LoadFile(gimfilename, &file_size); + if( gimFile == NULL ) return FAILED; + + + if( gimLoadFromBuffer(gimFile, file_size, &gimData) != 0) { + free(gimFile); + return FAILED; + } + + int ret = make_png(pngfilename, gimData); + + free(gimFile); + free(gimData.bmp_out); + + return ret; +} diff --git a/MGZ/source/gim2png.cpp b/MGZ/source/gim2png.cpp deleted file mode 100644 index fe0f8a80..00000000 --- a/MGZ/source/gim2png.cpp +++ /dev/null @@ -1,179 +0,0 @@ -#include "gim.h" -#include -#include -#include - -#define SUCCESS 1 -#define FAILED 0 - -u8 oeffnen(char* datei); -char* name; // filename for later overwriting -int width; // image width -int height; // image height -u8 debug; -int korrektur; // fix distortion default=0 -FILE* gimFile; // Filehandle - -char* rgba; // 4*width*height bytearray for imagedata -char header[128]; // 128 byte headerdata -long fileSize; // full datasize (incl. header) - -extern "C" void print_load(char *format, ...); - -u8 oeffnen(char* datei) { - name=datei; - gimFile = fopen(name, "r"); - if (!gimFile) return FAILED; - if (debug) print_load((char *)"opened \"%s\" ",name); - fseek (gimFile , 0 , SEEK_END); - fileSize = ftell (gimFile); - rewind (gimFile); - rgba =(char*) malloc (sizeof(char)*fileSize-128); - if (debug) print_load((char *)"reading header..."); - fread(header, sizeof(char), 128, gimFile); - if (debug) print_load((char *)"reading data..."); - fread(rgba, sizeof(char), fileSize-128, gimFile); - return SUCCESS; -} - -u8 checkHeader() { - if (header[1]+header[2]+header[3]==221) { //0x47+0x49+0x4d - if (debug) print_load((char *)"found valid header: %s",header); - width=((unsigned char)header[73]+0x100*(unsigned char)header[72]); - height=((unsigned char)header[75]+0x100*(unsigned char)header[74]); - - - - if (debug) { - print_load((char *)"extracting dimensions:"); - print_load((char *)"width, height: %04X, %04X (hex)",width,height); - print_load((char *)"width, height: %i, %i (dec)",width,height); - } - - - int bheight=(int)(fileSize-128)/(width*4); - if (debug) print_load((char *)"calculating height:%i",(int)bheight); - height=bheight; - - return SUCCESS; - - } - return FAILED; -} - -char* getXY(int y, int x) { - char* temp = (char*) malloc(4); - int w=width+korrektur; - temp[0]=rgba[(w*y+x)*4]; - temp[1]=rgba[(w*y+x)*4+1]; - temp[2]=rgba[(w*y+x)*4+2]; - temp[3]=rgba[(w*y+x)*4+3]; - return temp; -} - -u8 makePNG(char* pngfilename) { - if (debug) print_load((char *)"opening png destinationfile: %s",pngfilename); - FILE *fp = fopen(pngfilename, "wb"); - if (!fp) return FAILED; - if (debug) print_load((char *)"creating png structure 1,"); - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!png_ptr){fclose(fp);return FAILED;} - if (debug) print_load((char *)"2,"); - png_infop info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) { - png_destroy_write_struct(&png_ptr, (png_infopp)NULL); - fclose(fp); - return FAILED; - } - if (debug) print_load((char *)"3!"); - if (setjmp(png_jmpbuf(png_ptr))) { - png_destroy_write_struct(&png_ptr, &info_ptr); - fclose(fp); - return FAILED; - } - - png_init_io(png_ptr, fp); - - png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - if (debug) print_load((char *)"writing png header!"); - png_write_info(png_ptr, info_ptr); - - //test rGBA pixel, for glitch-detection! - char* test= (char*) malloc(4); - test[0]=0;test[1]=0;test[2]=0;test[3]=0; - - png_byte *row_pointers[height]; - int h; - if (debug) print_load((char *)"filling png bytearray ..."); - - - /* - * in some gims there are two zeropixels on the left, which distort the whole picture - * therefore we have to look if the first 8 byte in the 2nd row are 00. if that's the case - * we calculate in a correction of 2 for the position. - * as there are also "normal" gims, which might have a black transparent pixel at that position - * we also check if the 3rd pixel is not 00 00 00. - * wrong corrections might be possible of course, but that's quite unlikely. - */ - - if (*getXY(1,0) == *test && *getXY(1,1) == *test && *getXY(1,2) != *test) { - if (debug) print_load((char *)"! found glitch - fixing..."); - korrektur=2; - } - - for (h=0; h -//#include #include #include #include -int gim2png(const char* gimfilename,char* pngfilename); +int gim2png(char* gimfilename,char* pngfilename); #endif diff --git a/MGZ/source/gtf.cpp b/MGZ/source/gtf.cpp index d99aef4f..1a7d3649 100644 --- a/MGZ/source/gtf.cpp +++ b/MGZ/source/gtf.cpp @@ -55,21 +55,21 @@ bool gtf2dds(const char *gtf_fname, const char *dds_fname, uint8_t index, uint32 if(!fileReadFile(gtf_fname, >f.addr, >f.size)){ // error: bad input - print_load((char *) "Error: Bad input file\n"); + print_load((char *) "Error: Bad input file"); return false; } int16_t num_gtf = gtfconv_gtf2dds_get_texture_count(>f, option); if(num_gtf == CELL_GTFCONV_ERROR || num_gtf == 0){ // error: bad format - print_load((char *) "Error: Bad format\n"); + print_load((char *) "Error: Bad format"); BUFFER_DELETE(gtf); return false; } if(sIsSpecified && num_gtf <= index){ // error: bad id - print_load((char *) "Error: Bad id\n"); + print_load((char *) "Error: Bad id"); BUFFER_DELETE(gtf); return false; } @@ -80,14 +80,14 @@ bool gtf2dds(const char *gtf_fname, const char *dds_fname, uint8_t index, uint32 int32_t dds_size = gtfconv_gtf2dds_get_size(>f, index, option); if(dds_size == CELL_GTFCONV_ERROR){ // error: bad format - print_load((char *) "Error: Bad format\n"); + print_load((char *) "Error: Bad format"); BUFFER_DELETE(gtf); return false; } if(!BUFFER_NEW(dds, dds_size)){ // error: memory error - print_load((char *) "Error: Memory access error\n"); + print_load((char *) "Error: Memory access error"); BUFFER_DELETE(gtf); return false; } @@ -97,13 +97,15 @@ bool gtf2dds(const char *gtf_fname, const char *dds_fname, uint8_t index, uint32 if(!bResult){ // error: conv failed - print_load((char *) "Error: Conversion failed\n"); + print_load((char *) "Error: Conversion failed"); } if(bResult){ + + if(!fileWriteFile(dds_fname, dds.addr, dds.size)){ // error: out file error - print_load((char *) "Error: Bad output file\n"); + print_load((char *) "Error: Bad output file"); bResult = false; } } @@ -141,4 +143,58 @@ bool gtf2dds(const char *gtf_fname, const char *dds_fname, uint8_t index, uint32 BUFFER_DELETE(gtf); return bResult; -} \ No newline at end of file +} + +extern "C" bool gtf2ddsFromBuffer(uint8_t *gtf_data_in, uint32_t gtf_size_in, uint8_t **dds_data_out, uint32_t *dds_size_out, uint8_t index, uint32_t option); +bool gtf2ddsFromBuffer(uint8_t *gtf_data_in, uint32_t gtf_size_in, uint8_t **dds_data_out, uint32_t *dds_size_out, uint8_t index, uint32_t option) +{ + if(gtf_data_in == NULL) return false; + if(gtf_size_in == 0) return false; + + GTF_BUFFER_T gtf = {(uint8_t *) gtf_data_in, (uint32_t ) gtf_size_in}; + + bool bResult = false; + + GTF_BUFFER_T dds = {0, 0}; + + print_load((char *) "gtfconv_gtf2dds_get_size"); + int32_t dds_size = gtfconv_gtf2dds_get_size(>f, index, option); + if(dds_size == CELL_GTFCONV_ERROR){ + // error: bad format + print_load((char *) "Error: Bad format"); + return false; + } + + print_load((char *) "BUFFER_NEW( dds )"); + if(!BUFFER_NEW(dds, dds_size)){ + // error: memory error + print_load((char *) "Error: Memory access error"); + return false; + } + + print_load((char *) "gtfconv_gtf2dds"); + int32_t ret = gtfconv_gtf2dds(&dds, >f, index, option); + bResult = (ret == CELL_GTFCONV_OK); + + if(!bResult){ + // error: conv failed + print_load((char *) "Error: Conversion failed"); + } + + if(bResult){ + print_load((char *) "malloc"); + *dds_data_out = (uint8_t *) malloc(dds.size); + if(*dds_data_out) { + memcpy(*dds_data_out, dds.addr, dds.size); + *dds_size_out = dds.size; + } else { + print_load((char *) "Error: malloc failed"); + bResult=false; + } + } + + BUFFER_DELETE(dds); + + return bResult; +} + diff --git a/MGZ/source/gtf.h b/MGZ/source/gtf.h index b90922ce..ac1f1e94 100644 --- a/MGZ/source/gtf.h +++ b/MGZ/source/gtf.h @@ -6,6 +6,7 @@ extern "C" { #endif bool gtf2dds(const char *gtf_fname, const char *dds_fname, uint8_t index, uint32_t option); +bool gtf2ddsFromBuffer(uint8_t *gtf_data_in, uint32_t gtf_size_in, uint8_t **dds_data_out, uint32_t *dds_size_out, uint8_t index, uint32_t option); #if defined(__cplusplus) } diff --git a/MGZ/source/iso.c b/MGZ/source/iso.c index 9a256eda..c229736f 100644 --- a/MGZ/source/iso.c +++ b/MGZ/source/iso.c @@ -55,6 +55,11 @@ extern void print_load(char *format, ...); extern void Delete(char *path); extern u8 cancel; +extern u64 task_ProgressBar1_max; +extern u64 task_ProgressBar1_val; +extern u64 task_ProgressBar2_max; +extern u64 task_ProgressBar2_val; + extern u64 prog_bar1_value; //#define ALIGNED32SECTORS 1 @@ -2110,6 +2115,8 @@ static int build_file_iso(int *fd, char *path1, char *path2, int level) u32 count = 0, percent = (u32) (s.st_size / 0x40000ULL); if(percent == 0) percent = 1; + task_ProgressBar2_max = s.st_size; + task_ProgressBar2_val = 0; if(cancel) { ps3ntfs_close(fd2); closedir(dir); return Error_ABORTED_BY_USER; @@ -2119,7 +2126,7 @@ static int build_file_iso(int *fd, char *path1, char *path2, int level) u32 fsize; u32 lsize; - prog_bar1_value = count * 100 / percent; + //prog_bar1_value = count * 100 / percent; if(cancel) { ps3ntfs_close(fd2); closedir(dir); return Error_ABORTED_BY_USER; @@ -2130,6 +2137,7 @@ static int build_file_iso(int *fd, char *path1, char *path2, int level) count++; if(fsize < 0x40000) memset(sectors, 0, 0x40000); + if(is_file_split) { int read = ps3ntfs_read(fd2, (void *) sectors, (int) fsize); if(read < 0) { @@ -2169,6 +2177,9 @@ static int build_file_iso(int *fd, char *path1, char *path2, int level) } flba += lsize / SECTOR_SIZE; s.st_size-= fsize; + + task_ProgressBar1_val+=fsize; + task_ProgressBar2_val+=fsize; } ps3ntfs_close(fd2); @@ -2470,13 +2481,15 @@ int makeps3iso(char *g_path, char *f_iso, int split) flba= (flba + 31) & ~31; #endif toc = flba; - + if((((u64)toc) * 2048ULL) > (avail - 0x100000ULL)) { print_load("Error: Insufficient Disk Space in Destination"); goto err; } + task_ProgressBar1_max = (((u64)toc) * 2048ULL); + sectors[0x3] = 1; // one range set732((void *) §ors[0x8], 0); // first unencrypted sector set732((void *) §ors[0xC], toc - 1); // last unencrypted sector @@ -2688,10 +2701,20 @@ int makeps3iso(char *g_path, char *f_iso, int split) free(directory_iso); directory_iso = NULL; free(sectors); sectors = NULL; - return SUCCESS; + task_ProgressBar1_max=0; + task_ProgressBar1_val=0; + task_ProgressBar2_max=0; + task_ProgressBar2_val=0; + + return SUCCESS; err: - + + task_ProgressBar1_max=0; + task_ProgressBar1_val=0; + task_ProgressBar2_max=0; + task_ProgressBar2_val=0; + if(directory_iso) { int n; @@ -3003,6 +3026,8 @@ int extractps3iso(char *f_iso, char *g_path, int split) goto err; } + task_ProgressBar1_max = (((u64)toc) * 2048ULL); + u32 lba0 = isonum_731(§_descriptor.type_l_path_table[0]); // lba u32 size0 = isonum_733(§_descriptor.path_table_size[0]); // size @@ -3300,11 +3325,14 @@ int extractps3iso(char *f_iso, char *g_path, int split) goto err; } + task_ProgressBar2_max = file_size; + task_ProgressBar2_val = 0; + while(file_size > 0) { u32 fsize; - prog_bar1_value = count * 100 / percent; - + //prog_bar1_value = count * 100 / percent; + if(cancel) { print_load("Error: Aborted by User"); goto err; @@ -3342,8 +3370,11 @@ int extractps3iso(char *f_iso, char *g_path, int split) } file_size-= (u64) fsize; - + file_lba += (fsize + SECTOR_FILL) / SECTOR_SIZE; + + task_ProgressBar2_val += fsize; + task_ProgressBar1_val += fsize; } ps3ntfs_close(fd2); fd2 = -1; @@ -3389,10 +3420,20 @@ int extractps3iso(char *f_iso, char *g_path, int split) free(split_file); split_file = NULL; + task_ProgressBar1_max=0; + task_ProgressBar1_val=0; + task_ProgressBar2_max=0; + task_ProgressBar2_val=0; + return SUCCESS; err: - + + task_ProgressBar1_max=0; + task_ProgressBar1_val=0; + task_ProgressBar2_max=0; + task_ProgressBar2_val=0; + if(fd) ps3ntfs_close(fd); if(fd2) ps3ntfs_close(fd2); if(split_index && fd_split) {ps3ntfs_close(fd_split); fd_split = -1;} diff --git a/MGZ/source/main.c b/MGZ/source/main.c index ff9f9645..d72bdb52 100644 --- a/MGZ/source/main.c +++ b/MGZ/source/main.c @@ -11,19 +11,25 @@ #include #include #include -#include +#include + #include +#include +#include #include +#include +#include +#include + +#include #include #include #include #include #include -#include #include #include #include -#include #include #include #include @@ -35,15 +41,31 @@ #include -#include - #include #include #include #include +#include "types.h" +#include "config.h" +#include "aes.h" +#include "util.h" +#include "keys.h" +#include "sce.h" +#include "np.h" +#include "self.h" +#include "rvk.h" +#include "frontend.h" + #include +#include +#include + +#include "tga_reader.h" +#include "dds_reader.h" +#include "makepng.h" + #include "cobra.h" #include "ntfs.h" #include "ps3mapi.h" @@ -77,7 +99,7 @@ #include "xreg.h" -#include "bd_keys/bd.h" +#include "bd/bd.h" #include "erk/dumper.h" #define NO_UID -1 @@ -96,8 +118,6 @@ #define OFF 0 #define FOUND 1 #define NOT_FOUND 0 -#define UP 1 -#define LOW 0 #define VERTICAL 0 #define HORIZONTAL 1 #define STATIC 0 @@ -115,58 +135,64 @@ #define IRIS 1 #define MM 2 -#define _EXIST 1 -#define _NOT_EXIST 0 -#define _FILE 1 -#define _DIRECTORY 2 -#define _PNG 3 -#define _JPG 4 -#define _SELF 5 -#define _ELF 6 -#define _EBOOT_BIN 7 -#define _EBOOT_ELF 8 -#define _SPRX 9 -#define _PRX 10 -#define _XML 11 -#define _PKG 12 -#define _IRD 13 -#define _P3T 14 -#define _THM 15 -#define _RIF 16 -#define _RAP 17 -#define _EDAT 18 -#define _PFD 19 -#define _MP4 20 -#define _SFO 21 -#define _TXT 22 -#define _TRP 23 -#define _RCO 24 -#define _CSO 25 -#define _ISO 26 -#define _ISO_PS3 27 -#define _ISO_PS2 28 -#define _ISO_PS1 29 -#define _ISO_PSP 30 -#define _JB_PS3 31 -#define _JB_PS2 32 -#define _JB_PS1 33 -#define _JB_PSP 34 -#define _GTF 35 -#define _DDS 36 -#define _RAF 37 -#define _JSX 38 -#define _QRC 39 -#define _VAG 40 -#define _JS 41 -#define _LOG 42 -#define _INI 43 -#define _NFO 44 -#define _MD5 45 -#define _SHA1 46 -#define _XREG 47 -#define _ZIP 48 -#define _66600 49 -#define _TTF 50 +#define _NOT_EXIST 0 +#define _EXIST 1 +#define _FILE 1 +#define _DIRECTORY 2 + +#define UNK 0 +#define JB_PS3 1 +#define JB_PS2 2 +#define JB_PS1 3 +#define JB_PSP 4 +#define ISO_PS3 5 +#define ISO_PS2 6 +#define ISO_PS1 7 +#define ISO_PSP 8 + + +#define _SDIR ".mgz_sdir" // simple directory +#define _SFILE ".mgz_sfile" // simple file (without extension) +#define _JB_PS3 ".mgz_jbps3" +#define _JB_PS2 ".mgz_jbps2" +#define _JB_PS1 ".mgz_jbps1" +#define _JB_PSP ".mgz_jbps2" +#define _ISO ".mgz_iso" +#define _ISO_PS3 ".mgz_isops3" +#define _ISO_PS2 ".mgz_isops2" +#define _ISO_PS1 ".mgz_isops1" +#define _ISO_PSP ".mgz_isopsp" + +#define _EBOOT_BIN "eboot.bin" +#define _EBOOT_ELF "eboot.elf" +#define _XREG "xRegistry.sys" + + +char *TXTViewerSupport[] = {".txt", ".xml", ".js", ".md5", ".sha1", ".log", ".ini", ".nfo"}; + +char *PictureViewerSupport[] = { + ".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", + ".png", + ".gif", + ".dds", ".gtf", ".gim", + ".bmp", ".dib", + ".webp", + ".tif", ".tiff", + "tga", + ".raw", ".arw", ".cr2", ".nrw", ".k25", + //".jp2", "jpc", ".j2k", ".jpf", ".jpx", ".jpm", ".mj2", + //".svg", ".svgz", + ".psd", + //".pspimage", ".psp" + //".ico", ".cur", + //".lbm", ".eps", + //".ttf", + //".pam", + ".rgba", ".rgb", + ".pcx", ".pgm", ".pbm", ".pnm", ".dcm", ".icon", ".ppm", ".xpm" +}; + +#define ArrayCount(x) (sizeof(x)/sizeof(x[0])) #define NONE 0 #define BDMIRROR 1 @@ -277,6 +303,39 @@ typedef struct SYS_PROCESS_PARAM(1200, 0x100000); +//************ SCETOOL **************** + +#define ARG_NULL no_argument +#define ARG_NONE no_argument +#define ARG_REQ required_argument +#define ARG_OPT optional_argument + +BOOL _verbose = FALSE; +BOOL _raw = FALSE; +static BOOL _decrypt_file = FALSE; +static BOOL _encrypt_file = FALSE; +char *_template = NULL; +char *_file_type = NULL; +char *_compress_data = NULL; +char *_skip_sections = NULL; +char *_key_rev = NULL; +char *_meta_info = NULL; +char *_keyset = NULL; +char *_auth_id = NULL; +char *_vendor_id = NULL; +char *_self_type = NULL; +char *_app_version = NULL; +char *_fw_version = NULL; +char *_add_shdrs = NULL; +char *_ctrl_flags = NULL; +char *_cap_flags = NULL; +char *_license_type = NULL; +char *_app_type = NULL; +char *_content_id = NULL; +char *_klicensee = NULL; +char *_real_fname = NULL; +char *_add_sig = NULL; + //************ FIRMWARE *************** u8 eid_root_key[EID_ROOT_KEY_SIZE]; @@ -340,7 +399,7 @@ static u8 max_mapped=0; //****** Thread Loading ************* -static u8 loading = NO; +static s8 loading = NO; static char loading_log[20][255]; static char head_title[128]; int64_t prog_bar1_value=-1; @@ -485,6 +544,7 @@ static float filter_x = 700.0; static float filter_y = 300.0; static u8 root_display = 1; static u8 LOG = NO; +static u8 DEBUG = NO; #define STYLE_CUSTOM 0 #define STYLE1 1 @@ -582,15 +642,6 @@ static u8 gui_called = NO; //************** PICTURE ****************************** -typedef struct -{ - void *bmp_out; - - u32 pitch; - u32 width; - u32 height; -} imgData; // pngData = jpgData = imgData - imgData COVER; static u32 COVER_offset; @@ -600,84 +651,87 @@ char TMP_PIC_path[255]; // *************** PICTURE *************************** -#define ALL 0 -#define UP 1 -#define LEFT 2 -#define DOWN 3 -#define RIGHT 4 -#define SELECT 5 -#define START 6 -#define SQUARE 7 -#define CROSS 8 -#define CIRCLE 9 -#define TRIANGLE 10 -#define NOT 11 -#define L1 12 -#define L2 13 -#define L3 14 -#define L 15 -#define R1 16 -#define R2 17 -#define R3 18 -#define R 19 -#define DEFAULT 20 -#define DEFAULT_ISO 21 -#define DEFAULT_JB 22 -#define TAG 23 -#define PS1_CASE 24 -#define PS2_CASE 25 -#define PS3_CASE 26 -#define PSP_CASE 27 -#define FOLDER 28 -#define FILES 29 -#define GAME 30 -#define DISC 31 -#define DISC_PS1 32 -#define DISC_PS2 33 -#define DISC_PS3 34 -#define DISC_PSP 35 -#define DISC_VIDEO 36 -#define DISC_DATA 37 -#define CF 38 -#define FLASH 39 -#define HDD 40 -#define MS 41 -#define SD 42 -#define USB 43 -#define VIRTUAL 44 -#define LOCK 45 -#define BR_LOGO 46 -#define PS_LOGO 47 -#define TOGGLE_ON 48 -#define TOGGLE_OFF 49 -#define CHECKBOX_FALSE 50 -#define CHECKBOX_TRUE 51 -#define CLOSE 52 -#define MAXIMIZE 53 -#define MINIMIZE 54 -#define FRAME 55 -#define HEADER 56 -#define COLUMN_HEADER 57 -#define CONTENT 58 -#define CURSOR 59 -#define CURSOR_D1 60 -#define CURSOR_D2 61 -#define CURSOR_H 62 -#define CURSOR_V 63 -#define APP_HOME 64 -#define HOST_ROOT 65 +enum +{ + ALL, + UP, + LEFT, + DOWN, + RIGHT, + SELECT, + START, + SQUARE, + CROSS, + CIRCLE, + TRIANGLE, + NOT, + L1, + L2, + L3, + L, + R1, + R2, + R3, + R, + DEFAULT, + DEFAULT_ISO, + DEFAULT_JB, + TAG, + PS1_CASE, + PS2_CASE, + PS3_CASE, + PSP_CASE, + FOLDER, + FILES, + GAME, + DISC, + DISC_PS1, + DISC_PS2, + DISC_PS3, + DISC_PSP, + DISC_VIDEO, + DISC_DATA, + CF, + FLASH, + HDD, + MS, + SD, + USB, + VIRTUAL, + LOCK, + BR_LOGO, + PS_LOGO, + TOGGLE_ON, + TOGGLE_OFF, + CHECKBOX_FALSE, + CHECKBOX_TRUE, + CLOSE, + MAXIMIZE, + MINIMIZE, + FRAME, + HEADER, + COLUMN_HEADER, + CONTENT, + CURSOR, + CURSOR_D1, + CURSOR_D2, + CURSOR_H, + CURSOR_V, + APP_HOME, + HOST_ROOT, // with color filter -#define NOTIF 66 -#define BOXHEAD 67 -#define BOXBODY 68 -#define SIDEBAR 69 -#define BGS 70 -#define BGF 71 - -#define PICTURE_NUMBER 72 + NOTIF, + BOXHEAD, + BOXBODY, + SIDEBAR, + BGS, + BGF, + + PICTURE_NUMBER, +}; -#define _BG_ 100 +#define _BG_ 255 char *PICTURE_NAME[PICTURE_NUMBER] = { "ALL", "UP", "LEFT", "DOWN", "RIGHT", @@ -902,7 +956,7 @@ static char **window_path=NULL; static char **window_lastpath=NULL; static char ***window_content_Name=NULL; static u64 **window_content_Size=NULL; -static u8 **window_content_Type=NULL; +static char ***window_content_Type=NULL; static u8 **window_content_Selected=NULL; static u8 *window_sort=NULL; static float *window_w_col_size=NULL; @@ -1014,22 +1068,22 @@ char *txt_viewer_path=NULL; //************************ COPY ************************ -static char copy_log[10][128]; static char copy_file[128]; static char copy_src[128]; static char copy_dst[128]; static u64 copy_current_size; -static u64 total_size; -static u64 file_copy_prog_bar; -static u8 gathering; - -static int nb_file = 0; -static int nb_directory = 0; - +static u64 copy_file_prog_bar; static u8 copy_flag=NO; static u8 copy_cancel=NO; + + +static u8 gathering=NO; +static s64 gathering_nb_file = 0; +static s64 gathering_nb_directory = 0; static u8 gathering_cancel=NO; +static u64 gathering_total_size; + //************************** PAD ************************ @@ -1056,6 +1110,7 @@ u8 filter_position=0; // ************** FILE MANAGER : Picture Viewer *************** +//char picture_viewer_info[2048]; static u8 picture_viewer_activ = NO; //***************** MENU ************************************* @@ -1231,10 +1286,8 @@ static char *STR_FILE=NULL; #define STR_FILE_DEFAULT "File" static char *STR_CANCEL=NULL; #define STR_CANCEL_DEFAULT "Cancel" -static char *STR_TURNOFF_YES=NULL; -#define STR_TURNOFF_YES_DEFAULT "Turn OFF = YES" -static char *STR_TURNOFF_NO=NULL; -#define STR_TURNOFF_NO_DEFAULT "Turn OFF = NO" +static char *STR_TURNOFF=NULL; +#define STR_TURNOFF_DEFAULT "Turn OFF" static char *STR_CANCELLED=NULL; #define STR_CANCELLED_DEFAULT "Cancelled" static char *STR_UNIT=NULL; @@ -1950,7 +2003,8 @@ void open_SFO_viewer(char *path); void Draw_FileExplorer(); void show_msg(char *str); char *LoadFileFromISO(u8 prog, char *path, char *filename, int *size); -u8 get_ext(char *file); +char *get_ext(char *file); +u8 get_platform(char *file); void read_fav(); int Draw_Progress_Bar(float x, float y, u8 size, float value, u32 color); u32 Get_PS2CRC(); @@ -1971,7 +2025,7 @@ u8 is_66600(char *file_name); u8 is_666XX(char *file_name); u8 is_usb(char *file_name); u8 is_FAT32(char *file_name); -u64 get_size(char *path, u8 upd_data); +u64 get_size(char *path); void poke_IDPS(); u8 WS_exist(); u8 Pnach_exist(); @@ -2010,7 +2064,10 @@ u8 GetBLUE(u32 rgba); u8 GetALPHA(u32 rgba); u8 is_float_window(); int move_bdemubackup_to_origin(char *device_path); - +s8 bmpLoadFromBuffer(const void *buffer, int file_size, imgData *data); +s8 MagickLoadFromBuffer(const void *buffer, int file_size, imgData *data); +u8 make_png(char *outfile, imgData data); +char *GetTimeStr(u64 secTime); void Draw_MENU(); @@ -2205,9 +2262,8 @@ void Init_Graph() (float) ((sy - sy * psy) / 2.0), (float) ((sx * psx) / X_MAX), // 2D scale (float) ((sy * psy) / Y_MAX), - (float) ((sx / X_MAX) * psx), // 3D scale - - (float) ((sy / Y_MAX) * psy)); + (float) ((sx * psx) / X_MAX), // 3D scale + (float) ((sy * psy) / Y_MAX)); } void adjust_screen() @@ -2222,8 +2278,8 @@ void adjust_screen() (float) ((sy - sy * psy) / 2.0), (float) ((sx * psx) / X_MAX), // 2D scale (float) ((sy * psy) / Y_MAX), - (float) ((sx / X_MAX) * psx), // 3D scale - (float) ((sy / Y_MAX) * psy)); + (float) ((sx * psx) / X_MAX), // 3D scale + (float) ((sy * psy) / Y_MAX)); } //******************************************************* @@ -2371,7 +2427,7 @@ void ScanFont(char *directory) if(dir->d_type & DT_DIR) { ScanFont(temp); } - if(get_ext(temp) != _TTF) continue; + if(strcasecmp(get_ext(temp), ".ttf")) continue; FontNumber++; FontName[FontNumber] = get_ttf_name(temp); @@ -2711,8 +2767,7 @@ u8 can_opendir(char *path) return YES; } - -char *GetExtention(char *path) +char *GetExtension(char *path) { int n = strlen(path); int m = n; @@ -2729,18 +2784,364 @@ char *GetExtention(char *path) return &path[n]; } -void RemoveExtention(char *path) +void RemoveExtension(char *path) { - char *extention = GetExtention(path); + char *extension = GetExtension(path); - int le = strlen(extention); + int le = strlen(extension); int lp = strlen(path); while(le>0) {path[lp-le]=0; le--;} } +s8 ddsLoadFromBuffer(const void *buffer, int file_size, imgData *data) +{ + print_load("ddsRead"); + (*data).bmp_out = ddsRead(buffer, DDS_READER_ARGB, 0); + if( (*data).bmp_out == NULL) return -1; + + print_load("ddsGetWidth"); + (*data).width = ddsGetWidth(buffer); + print_load("ddsGetHeight"); + (*data).height = ddsGetHeight(buffer); + print_load("ddsGetPitch"); + (*data).pitch = ddsGetWidth(buffer)*4; + + return 0; +} + +s8 ddsLoadFromFile(char *imgPath, imgData *data) +{ + int file_size; + + u8 *buffer = (u8 *) LoadFile(imgPath, &file_size); + if( buffer == NULL) return -1; + + int ret = ddsLoadFromBuffer((const void *) buffer, file_size, data); + + free(buffer); + + return ret; +} + +s8 tgaLoadFromBuffer(const void *buffer, int file_size, imgData *data) +{ + print_load("tgaRead"); + (*data).bmp_out = tgaRead(buffer, TGA_READER_ARGB); + if( (*data).bmp_out == NULL) return -1; + + print_load("tgaGetWidth"); + (*data).width = tgaGetWidth(buffer); + print_load("tgaGetHeight"); + (*data).height = tgaGetHeight(buffer); + print_load("tgaGetPitch"); + (*data).pitch = tgaGetWidth(buffer)*4; + + return 0; +} + + +s8 tgaLoadFromFile(char *imgPath, imgData *data) +{ + int file_size; + + u8 *buffer = (u8 *) LoadFile(imgPath, &file_size); + if( buffer == NULL) return -1; + + int ret = tgaLoadFromBuffer((const void *) buffer, file_size, data); + + free(buffer); + + return ret; +} + +s8 gtfLoadFromBuffer(const void *buffer, int file_size, imgData *data) +{ + + uint8_t *dds_buffer=NULL; + uint32_t dds_size=0; + + gtf2ddsFromBuffer((uint8_t *) buffer, (uint32_t) file_size, &dds_buffer, &dds_size, 0, 0); + + if( dds_size == 0 || dds_buffer == NULL ) return -1; + + int ret = ddsLoadFromBuffer((const void *) dds_buffer, dds_size, data); + + free(dds_buffer); + + return ret; +} + +// (https://www.psdevwiki.com/ps3/Graphic_Image_Map_(GIM)) +typedef struct +{ + u32 signature; // PS3 : ".GIM" + u32 version; + u32 format_style; + u32 unk; +} gim_file_header; + + +// block_id +#define GIM_BLOCK_ROOT 2 +#define GIM_BLOCK_PICTURE 3 +#define GIM_BLOCK_IMAGE 4 +#define GIM_BLOCK_PALETTE 5 +#define GIM_BLOCK_FILEINFO 0xFF + +typedef struct +{ + u16 id; + u16 unk; + u32 size; + u32 header_next; + u32 data_offset; +} gim_block_header; + +#define GIM_IMAGE_FORMAT_RGBA5650 0x00 //(16 bit no alpha) +#define GIM_IMAGE_FORMAT_RGBA5551 0x01 //(16 bit sharp alpha) +#define GIM_IMAGE_FORMAT_RGBA4444 0x02 //(16 bit gradient alpha) +#define GIM_IMAGE_FORMAT_RGBA8888 0x03 //(32 bit gradient alpha) +#define GIM_IMAGE_FORMAT_INDEX4 0x04 //(16 colors) +#define GIM_IMAGE_FORMAT_INDEX8 0x05 //(256 colors) +#define GIM_IMAGE_FORMAT_INDEX16 0x06 //(16 colors with alpha ?) +#define GIM_IMAGE_FORMAT_INDEX32 0x07 //(256 colors with alpha ?) +#define GIM_IMAGE_FORMAT_DXT1 0x08 //(no alpha) +#define GIM_IMAGE_FORMAT_DXT3 0x09 //(sharp alpha) +#define GIM_IMAGE_FORMAT_DXT5 0x0A //(gradient alpha) +#define GIM_IMAGE_FORMAT_DXT1EXT 0x108 +#define GIM_IMAGE_FORMAT_DXT3EXT 0x109 +#define GIM_IMAGE_FORMAT_DXT5EXT 0x10A + +#define GIM_PIXEL_ORDER_NORMAL 0x0 +#define GIM_PIXEL_ORDER_FAST 0x1 + +typedef struct +{ + u16 data_lenght; + u16 b45_unk1; + u16 image_format; + u16 pixel_order; + u16 width; + u16 height; + u16 bpp; + u16 pitch_align; + u16 height_align; + u16 b45_unk2; + u32 b45_unk3; + u32 index_start; // relative offset of block_image_index + u32 pixels_start; + u32 pixels_end; + u32 plane_mask; + u16 level_type; + u16 level_count; + u16 frame_type; + u16 frame_count; +} gim_block_image_data; + +u8 get_pad(u32 align, u32 size) +{ + return (~size + 1) & (align - 1); +} + +s8 gimLoadFromBuffer(const void *buffer, int file_size, imgData *data) +{ + u8 *buff = (u8 *) buffer; + + //print_load("gim signature"); + gim_file_header file_header; + memcpy(&file_header, buff, sizeof(gim_file_header)); + if(file_header.signature != 0x2E47494D ) { + //print_load("bad magic gimLoadFromBuffer"); + return -1; + } + + gim_block_header block; + + u32 pos = sizeof(gim_file_header); + + //print_load("Search GIM_BLOCK_IMAGE"); + + while(1) { + memcpy(&block, buff + pos, sizeof(gim_block_header)); + + //print_load("* block offset 0x%X, block.id 0x%X", pos, block.id); + if( block.id == GIM_BLOCK_IMAGE ) { + pos += block.data_offset; + break; + } + pos += block.header_next; + + if( pos > file_size) { + //print_load("GIM_BLOCK_IMAGE not found"); + return -1; + } + } + + gim_block_image_data image_data; + memcpy(&image_data, buff + pos, sizeof(gim_block_image_data)); + + if( image_data.image_format != GIM_IMAGE_FORMAT_RGBA8888) { + //print_load("Unsupported format %X", image_data.image_format); + return -1; + } + /* + if( DEBUG ) { + sprintf(picture_viewer_info, + "data_lenght 0x%02X\n" + "b45_unk1 0x%04X\n" + "image_format; 0x%04X\n" + "pixel_order; 0x%04X\n" + "width; 0x%04X\n" + "height; 0x%04X\n" + "bpp 0x%04X\n" + "pitch_align; 0x%04X\n" + "height_align; 0x%04X\n" + "b45_unk2 0x%04X\n" + "b45_unk3 0x%08X\n" + "index_start; 0x%08X\n" + "pixels_start; 0x%08X\n" + "pixels_end; 0x%08X\n" + "plane_mask; 0x%08X\n" + "level_type; 0x%04X\n" + "level_count; 0x%04X\n" + "frame_type; 0x%04X\n" + "frame_count; 0x%04X\n", + image_data.data_lenght, + image_data.b45_unk1, + image_data.image_format, + image_data.pixel_order, + image_data.width, + image_data.height, + image_data.bpp, + image_data.pitch_align, + image_data.height_align, + image_data.b45_unk2, + image_data.b45_unk3, + image_data.index_start, + image_data.pixels_start, + image_data.pixels_end, + image_data.plane_mask, + image_data.level_type, + image_data.level_count, + image_data.frame_type, + image_data.frame_count); + } + */ + + u8 *rgba = buff + pos + image_data.pixels_start; + + (*data).width=image_data.width; + (*data).height=image_data.height; + (*data).pitch=(*data).width*4; + + (*data).bmp_out = (u8 *) malloc((*data).pitch * (*data).height); + if( (*data).bmp_out == NULL) { + print_load("malloc gimLoadFromBuffer"); + return -1; + } + + u8 pad = get_pad(image_data.pitch_align, image_data.width * image_data.bpp/8); + + s64 i = 0; + s64 k = 0; + s64 j = 0; + for (i = 0; i<(*data).height ; i++) { + k=i*(*data).width; + for (j=k; j < k+(*data).width; j++) { + u8 ARGB[4]={0}; + ARGB[0] = rgba[j*4 + i*pad + 3]; + ARGB[1] = rgba[j*4 + i*pad ]; + ARGB[2] = rgba[j*4 + i*pad + 1]; + ARGB[3] = rgba[j*4 + i*pad + 2]; + memcpy((*data).bmp_out + j*4, ARGB, 4); + } + } + + return 0; +} + + +s8 webpLoadFromBuffer(const void *buffer, int file_size, imgData *data) +{ + + int height, width; + (*data).bmp_out = WebPDecodeARGB((const uint8_t*) buffer, (size_t) file_size, &width, &height); + if((*data).bmp_out==NULL) return -1; + + + (*data).width = width; + (*data).height= height; + (*data).pitch = width*4; + + + return 0; +} + +s8 tiffLoadFromFile(char *file, imgData *data) +{ + print_load("TIFFOpen"); + TIFF* tif = TIFFOpen(file, "r"); + if( tif == NULL) return -1; + + u8 *abgr=NULL; + + print_load("TIFFGetField width"); + if( TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &(*data).width) != 1) goto error; + print_load("TIFFGetField height"); + if( TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &(*data).height) != 1) goto error; + + (*data).pitch = (*data).width*4; + + print_load("malloc abgr"); + abgr = (u8 *) malloc( (*data).pitch * (*data).height); + if(!abgr) goto error; + memset(abgr, 0, (*data).pitch * (*data).height); + + print_load("TIFFReadRGBAImageOriented"); + // it's ABGR ! + if ( TIFFReadRGBAImageOriented(tif, (*data).width, (*data).height, (uint32_t *) abgr, ORIENTATION_TOPLEFT, 0) != 1) goto error; + + print_load("malloc bmp_out"); + (*data).bmp_out = (u8 *) malloc((*data).pitch * (*data).height); + if(!(*data).bmp_out) goto error; + + print_load("loop"); + s64 i = 0; + s64 k = 0; + s64 j = 0; + for (i = 0; i<(*data).height ; i++) { + k=i*(*data).width; + for (j=k; j < k+(*data).width; j++) { + u8 ARGB[4]={0}; + ARGB[0] = abgr[j*4 + 0]; + ARGB[1] = abgr[j*4 + 3]; + ARGB[2] = abgr[j*4 + 2]; + ARGB[3] = abgr[j*4 + 1]; + memcpy((*data).bmp_out + j*4, ARGB, 4); + } + } + + print_load("FREE"); + FREE(abgr); + print_load("TIFFClose"); + if(tif) TIFFClose(tif); + + return 0; + +error: + + print_load("error"); + FREE((*data).bmp_out) + FREE(abgr); + if(tif) TIFFClose(tif); + return -1; +} + u8 imgLoadFromFile(char *imgPath, imgData *out, u8 gray) { + //memset(picture_viewer_info, 0, sizeof(picture_viewer_info)); + int file_size = 0; out->bmp_out = NULL; @@ -2748,23 +3149,51 @@ u8 imgLoadFromFile(char *imgPath, imgData *out, u8 gray) char *buff = LoadFile((char *) imgPath, &file_size); if(buff==NULL) return FAILED; + int ret=-1; + imgData tp; + char *ext = get_ext(imgPath); + if( !strcasecmp(ext, ".png") ) { + ret = pngLoadFromBuffer((const void *) buff, file_size, (pngData *) &tp); + } else + if( !strcasecmp(ext, ".jpg") || !strcasecmp(ext, ".jpeg") || !strcasecmp(ext, ".jpe")) { + ret = jpgLoadFromBuffer((const void *) buff, file_size, (jpgData *) &tp); + } else + if( !strcasecmp(ext, ".dds") ) { + ret = ddsLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".tga") ) { + ret = tgaLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".bmp") ) { + ret = bmpLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".gim") ) { + ret = gimLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".webp") ) { + ret = webpLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".gtf")) { + ret = gtfLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } else + if( !strcasecmp(ext, ".tiff") || !strcasecmp(ext, ".tif") ) { + ret = tiffLoadFromFile(imgPath, (imgData *) &tp); + } + + if( ret != 0 ) { + ret = MagickLoadFromBuffer((const void *) buff, file_size, (imgData *) &tp); + } + + FREE(buff); + + if( ret != 0 ) return FAILED; + + out->height = tp.height; + out->width = tp.width; + out->pitch = tp.pitch; + out->bmp_out = (u8 *) malloc(tp.pitch*tp.height+1); + if( gray ) { - imgData tp; - - if( get_ext(imgPath) == _PNG ) { - if(pngLoadFromBuffer((const void *) buff, file_size, (pngData *) &tp) != 0) - if(jpgLoadFromBuffer((const void *) buff, file_size, (jpgData *) &tp) != 0) { - free(buff); - return FAILED; - } - } else { - if(jpgLoadFromBuffer((const void *) buff, file_size, (jpgData *) &tp) != 0) - if(pngLoadFromBuffer((const void *) buff, file_size, (pngData *) &tp) != 0) - { - free(buff); - return FAILED; - } - } u64 d; @@ -2781,11 +3210,6 @@ u8 imgLoadFromFile(char *imgPath, imgData *out, u8 gray) // memcpy(out->bmp_out + d/4, &Y, 1); // } - out->height = tp.height; - out->width = tp.width; - out->pitch = tp.pitch; - out->bmp_out = (u8 *) malloc(tp.pitch*tp.height+1); - for(d=0; d< tp.pitch*tp.height; d+=4) { u8 ARGB[4]; memcpy(&ARGB, tp.bmp_out+d, 4); @@ -2801,25 +3225,11 @@ u8 imgLoadFromFile(char *imgPath, imgData *out, u8 gray) } } else { - - if( get_ext(imgPath) == _PNG ) { - if(pngLoadFromBuffer((const void *) buff, file_size, (pngData *) out) != 0) - if(jpgLoadFromBuffer((const void *) buff, file_size, (jpgData *) out) != 0) { - free(buff); - return FAILED; - } - } else { - if(jpgLoadFromBuffer((const void *) buff, file_size, (jpgData *) out) != 0) - if(pngLoadFromBuffer((const void *) buff, file_size, (pngData *) out) != 0) - { - free(buff); - return FAILED; - } - } + memcpy(out->bmp_out, tp.bmp_out, tp.pitch*tp.height); } - - free(buff); + free(tp.bmp_out); + return SUCCESS; } @@ -2827,6 +3237,7 @@ u8 imgLoadFromFile(char *imgPath, imgData *out, u8 gray) // SCREENSHOT //****************************************************** +// https://en.wikipedia.org/wiki/BMP_file_format typedef struct /**** BMP file header structure ****/ { u32 bfSize; /* Size of file */ @@ -2874,56 +3285,122 @@ void es_bmp_info_header(bmp_info_header *w) w->biClrImportant = ENDIAN_SWAP_32(w->biClrImportant); } -// https://en.wikipedia.org/wiki/BMP_file_format -void ScreenShot() +s8 bmpLoadFromBuffer(const void *buffer, int file_size, imgData *data) { - if( ComboNewPad(BUTTON_L2, BUTTON_R2) == NO ) return; - - if(Video_currentBuffer==NO) return; + bmp_file_header bfh; + bmp_info_header bih; - u8 *mem = malloc(Video_Resolution.width*Video_Resolution.height*4 + 1); - memcpy(mem, Video_buffer[1], Video_Resolution.width*Video_Resolution.height*4); + u8 *buff = (u8 *) buffer; - //start_loading(); + print_load("Magic bmpLoadFromBuffer"); + char magic[2]; + memcpy(magic, buff, 2); + if( magic[0] != 'B' || magic[1] != 'M') { + print_load("Magic bmpLoadFromBuffer"); + return -1; + } -print_load("Get size scaled..."); - double sx = (double) Video_Resolution.width; - double sy = (double) Video_Resolution.height; - double psx = (double) (1000 + videoscale_x)/1000.0; - double psy = (double) (1000 + videoscale_y)/1000.0; + print_load("bfh memcpy bmpLoadFromBuffer"); + memcpy(&bfh, buff + 2, sizeof(bmp_file_header)); + print_load("bih memcpy bmpLoadFromBuffer"); + memcpy(&bih, buff + 2 + sizeof(bmp_file_header), sizeof(bmp_info_header)); - u32 w = (u32) (sx * psx); - u32 h = (u32) (sy * psy); - u32 x = (u32) (((u32)sx - w) / 2); - u32 y = (u32) (((u32)sy - h) / 2); + print_load("bih es_bmp_file_header bmpLoadFromBuffer"); + es_bmp_file_header(&bfh); + print_load("bih es_bmp_info_header bmpLoadFromBuffer"); + es_bmp_info_header(&bih); + + if( bih.biWidth < 0 || bih.biHeight < 0) { + print_load("bih.biHeight < 0 || bih.biWidth < 0 bmpLoadFromBuffer"); + return -1; + } - mkdir("/dev_hdd0/photo", 0777); + u32 BPP = bih.biBitCount / 8; - char ScreenShotPath[128]; - int o; - for(o=0; o<1000; o++) { - sprintf(ScreenShotPath, "/dev_hdd0/photo/ManaGunZ_%03d.bmp", o); - if(path_info(ScreenShotPath) == _NOT_EXIST) break; + if( BPP != 4 && BPP != 3 && BPP != 1) { + print_load("Error : bmpLoadFromBuffer BPP %d ", BPP); + return -1; + } + + print_load("pixels malloc bmpLoadFromBuffer"); + u8 *pixels = (u8 *) malloc(bih.biWidth * bih.biHeight * 4); + if (pixels == NULL) { + print_load("Error : pixels malloc bmpLoadFromBuffer"); + return -1; + } + + print_load("bmpLoadFromBuffer loop"); + + u8 pad = (4 - ((3*bih.biWidth) & 3)) & 3; + + s64 i = 0; + s64 k = 0; + s64 l = 0; + s64 j = 0; + for (i = bih.biHeight-1; 0<=i ; i--) + { + k=i*bih.biWidth; + for (j=k; j < k+bih.biWidth; j++) + { + pixels[l] = 0xFF; // alpha + l++; + if( BPP == 1 ) { + pixels[l] = buff[bfh.bfOffBits + j + i*pad]; + l++; + pixels[l] = buff[bfh.bfOffBits + j + i*pad]; + l++; + pixels[l] = buff[bfh.bfOffBits + j + i*pad]; + l++; + } else + if( BPP == 3 || BPP == 4) { + pixels[l] = buff[bfh.bfOffBits + j*BPP + i*pad + 2]; + l++; + pixels[l] = buff[bfh.bfOffBits + j*BPP + i*pad + 1]; + l++; + pixels[l] = buff[bfh.bfOffBits + j*BPP + i*pad ]; + l++; + } + + } } -print_load("Open file %s", ScreenShotPath); - FILE *f = fopen(ScreenShotPath, "wb"); + print_load("bmpLoadFromBuffer memcpy bmp_out"); + (*data).bmp_out = (u8 *) malloc(bih.biWidth * bih.biHeight * 4); + memcpy((*data).bmp_out, pixels, bih.biWidth * bih.biHeight * 4); + + free(pixels); + + (*data).width = bih.biWidth; + (*data).height = bih.biHeight; + (*data).pitch = (*data).width*4; + + return 0; +} + +u8 SaveBMP(char *bmp_path, u8 *pixels, u32 x, u32 y, u32 w, u32 h) +{ + + print_load("Open file %s", bmp_path); + FILE *f = fopen(bmp_path, "wb"); if (!f) { - print_load("Error : ScreenShot, failed to open file"); - return; + print_load("Error : failed to open %s", bmp_path); + return FAILED; } -print_load("Define headers"); + print_load("Define headers"); bmp_file_header bfh; bmp_info_header bih; - unsigned short bfType=0x424D; + u32 size_of_file_header = sizeof(bmp_file_header); + u32 size_of_info_header = sizeof(bmp_info_header); + + unsigned short bfType=0x424D; // magic "BM" bfh.bfReserved1 = 0; bfh.bfReserved2 = 0; - bfh.bfSize = 2+sizeof(bmp_file_header) + sizeof(bmp_info_header)+w*h*3; - bfh.bfOffBits = 0x36; + bfh.bfSize = 2 + size_of_file_header + size_of_info_header + w * h * 3; + bfh.bfOffBits = 2 + size_of_file_header + size_of_info_header; - bih.biSize = sizeof(bmp_info_header); + bih.biSize = size_of_info_header; bih.biWidth = w; bih.biHeight = h; bih.biPlanes = 1; @@ -2955,11 +3432,11 @@ print_head("Get bitmap data..."); k=i*Video_Resolution.width; prog_bar1_value = (y+h-1-i)/h; for(j=x+k; j 0) { - // mipmap - int i; - for(i=0; (width > 0) || (height > 0); i++) { - if(width <= 0) width = 1; - if(height <= 0) height = 1; - data->bmp_out = ddsRead(buffer, DDS_READER_ABGR, i); - } - } - else data->bmp_out = ddsRead(buffer, DDS_READER_ABGR, 0); - - data->width = width; - data->height = height; - data->pitch = width*4; - - free(buffer); +// save supported image format supporte by this lib +void SaveMagicList() +{ + size_t l; + ExceptionInfo exception; + char **list = GetMagickList("*", &l, &exception); + + FILE *f; + + f = fopen("/dev_hdd0/MagicList.txt", "w"); + + int i; + for(i=0; id_name); - u8 ext = get_ext(temp); + char *ext = get_ext(temp); - if( ext == _JS) { + if( !strcasecmp(ext, ".js") ) { strcpy(JS, temp); } else - if( ext == _PNG) { + if( !strcasecmp(ext, ".png") ) { FILE* fo; fo = fopen(temp, "rb"); @@ -5517,7 +6101,6 @@ char *sprintf_malloc(char *format, ...) return strcpy_malloc(str); } -// It may be faster than previous function I wrote... char *language(char *lang_mem, const char *strName, char *str_default) { if(lang_mem==NULL) return strcpy_malloc(str_default); @@ -5612,8 +6195,7 @@ void update_lang() LANG(STR_UNKNOWN, "STR_UNKNOWN", STR_UNKNOWN_DEFAULT); LANG(STR_FILE, "STR_FILE", STR_FILE_DEFAULT); LANG(STR_CANCEL, "STR_CANCEL", STR_CANCEL_DEFAULT); - LANG(STR_TURNOFF_YES, "STR_TURNOFF_YES", STR_TURNOFF_YES_DEFAULT); - LANG(STR_TURNOFF_NO, "STR_TURNOFF_NO", STR_TURNOFF_NO_DEFAULT); + LANG(STR_TURNOFF, "STR_TURNOFF", STR_TURNOFF_DEFAULT); LANG(STR_CANCELLED, "STR_CANCELLED", STR_CANCELLED_DEFAULT); LANG(STR_UNIT, "STR_UNIT", STR_UNIT_DEFAULT); LANG(STR_TOTALSIZE, "STR_TOTALSIZE", STR_TOTALSIZE_DEFAULT); @@ -6135,7 +6717,6 @@ u8 GetFromTHM(char *thm, char *file, char *dst) return SUCCESS; } -extern int gim2png(const char* gimfilename,char* pngfilename); extern int uncompressGIMBuffer(void* compressed_buffer, size_t compressed_buffer_size, void** gim_buffer); int GIM2PNG(char *in, char *out) { @@ -6352,7 +6933,7 @@ u8 GetFromP3T(char *src, char *file, char *dst) // .gim to .png char gim[128]; strcpy(gim, dst); - RemoveExtention(gim); + RemoveExtension(gim); strcat(gim, ".gim"); fp=fopen(gim, "wb"); @@ -7449,7 +8030,7 @@ char *LoadFileFromISO(u8 prog, char *path, char *filename, int *size) if(split666) sprintf(iso_path, "%s%02d", temp, i); else sprintf(iso_path, "%s%d", temp, i); - fsize = get_size(iso_path, NO); + fsize = get_size(iso_path); if(file_offset= 0) have_log=YES; + if(loading_log[0][0]!=0 || head_title[0] != 0 || prog_bar1_value >= 0) have_log=YES; if(show_scene) { Draw_scene(); @@ -8975,46 +9611,12 @@ void Draw_Loading(void *unused) FontColor(COLOR_1); SetFontZ(0); - if(show_log && have_log) { - - if(head_title[0] != 0) { - FontColor(COLOR_2); - DrawString(x, y, head_title); - FontColor(COLOR_1); - y+=20; - } - if(prog_bar1_value >= 0) { - Draw_Progress_Bar(x, y, 2, prog_bar1_value, COLOR_2); - y+=15; - if(prog_bar2_value >= 0) Draw_Progress_Bar(x, y, 2, prog_bar2_value, COLOR_2); - y+=25; - } - if(gathering){ - FontColor(COLOR_1); - DrawFormatString(x, y, STR_GATHERING); - y+=20; - DrawFormatString(x, y, "%s = %i", STR_FILES, nb_file); - y+=20; - DrawFormatString(x, y, "%s = %i", STR_DIRS, nb_directory); - y+=20; - char *size_tot = get_unit(total_size); - DrawFormatString(x, y,"%s = %s", STR_TOTALSIZE, size_tot); - y+=20; - if(size_tot) free(size_tot); - } - for(i=0; i<=20; i++){ - - if(strstr(loading_log[i], "Error")) FontColor(RED); - else if(strstr(loading_log[i], "Warning")) FontColor(ORANGE); - else FontColor(COLOR_1); - - DrawFormatString(x , y, loading_log[i]); - y+=20; - if(y>450) break; - } - } + if(!loading) break; + + if(!loading) break; if(!show_scene) { + int t; switch(bullet_move) { @@ -9028,6 +9630,8 @@ void Draw_Loading(void *unused) Draw_Box(h , v, 0, 0, 3 , 20, 0xFFFFFF50, NO); Draw_Box(h+4, v, 0, 0, 16, 20, 0xFFFFFF50, NO); + if(!loading) break; + tiny3d_SetPolygon(TINY3D_POLYGON); tiny3d_VertexColor(0xFFFFFF50); for(t=0; t<=180 ; t+=15) { @@ -9055,6 +9659,8 @@ void Draw_Loading(void *unused) Draw_Box(h+17, v, 0, 0, 3 , 20, 0xFFFFFF50, NO); Draw_Box(h , v, 0, 0, 16, 20, 0xFFFFFF50, NO); + if(!loading) break; + tiny3d_SetPolygon(TINY3D_POLYGON); tiny3d_VertexColor(0xFFFFFF50); for(t=-180; t<=0 ; t+=15) { @@ -9083,6 +9689,8 @@ void Draw_Loading(void *unused) Draw_Box(h, v+17, 0, 0, 20, 3, 0xFFFFFF50, NO); Draw_Box(h, v , 0, 0, 20, 16, 0xFFFFFF50, NO); + if(!loading) break; + tiny3d_SetPolygon(TINY3D_POLYGON); tiny3d_VertexColor(0xFFFFFF50); for(t=90; t<=270 ; t+=15) { @@ -9110,6 +9718,8 @@ void Draw_Loading(void *unused) Draw_Box(h, v , 0, 0, 20, 3 , 0xFFFFFF50, NO); Draw_Box(h, v+4, 0, 0, 20, 16, 0xFFFFFF50, NO); + if(!loading) break; + tiny3d_SetPolygon(TINY3D_POLYGON); tiny3d_VertexColor(0xFFFFFF50); for(t=-90; t<=90 ; t+=15) { @@ -9143,15 +9753,114 @@ void Draw_Loading(void *unused) if(boost<100) { color = GREEN; } + } + + if(show_log && have_log) { + + if(head_title[0] != 0) { + FontColor(COLOR_2); + DrawString(x, y, head_title); + FontColor(COLOR_1); + y+=20; + } + if( task_ProgressBar1_max != 0 && start == 0 && task_ProgressBar1_max != task_ProgressBar1_val) { + start = sTime(); + init_timer(4); + start_timer(4); + } + if( start ) { + + u64 progress_bar_w = 600; + + char speed_STR[32]; + char elapsed_STR[32]; + char remaining_STR[32]; + if( get_time(4) > 1000 ) { + + start_timer(4); + + char *copy_speed = get_unit(task_ProgressBar1_val - previous_val); + if(copy_speed) sprintf(speed_STR, "%s/s", copy_speed); + FREE(copy_speed); + previous_val = task_ProgressBar1_val; + + u64 ElapsedTime = sTime() - start; + u64 RemainingTime = ElapsedTime * task_ProgressBar1_max / task_ProgressBar1_val - ElapsedTime; + + char *ElapsedTime_STR = GetTimeStr(ElapsedTime); + if(ElapsedTime_STR) sprintf(elapsed_STR, "Elapsed time : %s", ElapsedTime_STR); + FREE(ElapsedTime_STR); + + char *RemainingTime_STR = GetTimeStr(RemainingTime); + if(RemainingTime_STR) sprintf(remaining_STR, "Remaining time : %s", RemainingTime_STR); + FREE(RemainingTime_STR); + } + + DrawFormatString(x, y, elapsed_STR); + y+=new_line(1); + + DrawFormatString(x, y, remaining_STR); + y+=new_line(1); + + char *size_current = get_unit(task_ProgressBar1_val); + if(size_current) DrawString(x, y, size_current); + FREE(size_current); + + char *size_tot = get_unit(task_ProgressBar1_max); + if(size_tot) DrawString(x+progress_bar_w-WidthFromStr(size_tot), y, size_tot); + FREE(size_tot); + + DrawStringFromCenterX(x+progress_bar_w/2, y, speed_STR); + + y+=new_line(1); + + Draw_Progress_Bar_Advanced(x, y, 0, 0, progress_bar_w, 4, 1, WHITE, BLACK, GREEN, task_ProgressBar1_max, task_ProgressBar1_val); + + y+=new_line(1); + + if( task_ProgressBar2_max != task_ProgressBar1_max) { + Draw_Progress_Bar_Advanced(x, y, 0, 0, progress_bar_w, 4, 1, WHITE, BLACK, GREEN, task_ProgressBar2_max, task_ProgressBar2_val); + y+=new_line(1); + } + + if( task_ProgressBar1_max == task_ProgressBar1_val ) { + task_ProgressBar1_max=0; + task_ProgressBar1_val=0; + task_ProgressBar2_max=0; + task_ProgressBar2_val=0; + } + if( task_ProgressBar1_max == 0) start = 0; + } else + if(prog_bar1_value >= 0) { + Draw_Progress_Bar(x, y, 2, prog_bar1_value, COLOR_2); + y+=15; + if(prog_bar2_value >= 0) Draw_Progress_Bar(x, y, 2, prog_bar2_value, COLOR_2); + y+=25; + } + + if(!loading) break; + + for(i=0; i<=20; i++){ + + if(strstr(loading_log[i], "Error")) FontColor(RED); + else if(strstr(loading_log[i], "Warning")) FontColor(ORANGE); + else FontColor(COLOR_1); + + DrawFormatString(x , y, loading_log[i]); + y+=20; + if(y>450) break; + } } + if(!loading) break; + // *** DISPLAY BUTTONS *** x=INPUT_X; y=INPUT_Y; FontSize(15); FontColor(COLOR_1); SetFontZ(0); - + if(show_scene) { if(LoadIconRot<180) { Draw_input(); @@ -9160,29 +9869,40 @@ void Draw_Loading(void *unused) } if(have_log) { - if(show_log) x=DrawButton(x, y, STR_HIDELOGS, BUTTON_SELECT); + if(show_log) x=DrawButton(x, y, STR_HIDELOGS, BUTTON_SELECT); else x=DrawButton(x, y, STR_SHOWLOGS, BUTTON_SELECT); } - + if(!show_scene) { x=Draw_Button_Square(x, y, 15); x=Draw_Progress_Bar(x+5, y+4, 1, boost, color); x=DrawFormatString( x+5, y, "%s ", STR_BOOST); } + if(!loading) break; + if(AutoM == YES) { x=DrawButton(x, y, STR_GAMEMENU, BUTTON_TRIANGLE); } - if(prog_bar1_value >= 0 || gathering) { + if(prog_bar1_value >= 0 || task_ProgressBar1_max) { x=DrawButton(x, y, STR_CANCEL, BUTTON_CIRCLE); } + //x=DrawButton(x, y, "DEBUG", BUTTON_R1); + //x=Draw_checkbox(x-3, y, 0, "", DEBUG, YES); + + if(!loading) break; + Draw_MemMonitor(); DrawLoadingIcon(); tiny3d_Flip(); //ScreenShot(); + cls(); + ps3pad_read(); + //if( NewPad(BUTTON_R1) ) DEBUG = !DEBUG; + if(NewPad(BUTTON_RIGHT)) { bullet_move = 1; } @@ -9195,17 +9915,14 @@ void Draw_Loading(void *unused) if(NewPad(BUTTON_DOWN)) { bullet_move = 4; } - if(NewPad(BUTTON_CIRCLE) && prog_bar1_value >= 0) { + if(NewPad(BUTTON_CIRCLE) && (prog_bar1_value >= 0 || task_ProgressBar1_max)) { cancel=YES; } - if(NewPad(BUTTON_CIRCLE) && gathering == YES) { - gathering_cancel=YES; - } if((NewPad(BUTTON_TRIANGLE) || OldPad(BUTTON_TRIANGLE)) && AutoM==YES) { gui_called=YES; } if(NewPad(BUTTON_SELECT)) { - if(show_log) show_log=NO; else show_log=YES; + show_log=!show_log; } if(OldPad(BUTTON_SQUARE)) { if(0 < boost && boost <= 30 && speed==9 ) { @@ -9227,10 +9944,14 @@ void Draw_Loading(void *unused) } } + cls(); + tiny3d_Flip(); + + DEBUG = old_DEBUG; + prog_bar1_value=-1; prog_bar2_value=-1; cancel=NO; - gathering=NO; strcpy(head_title, "\0"); show_scene=NO; @@ -9238,15 +9959,16 @@ void Draw_Loading(void *unused) for(i=0; i<=20; i++){ strcpy(loading_log[i], "\0"); } - + + loading=-1; + sysThreadExit(0); } +FILE *mgz_log=NULL; static char buff[4096]; void print_load(char *format, ...) -{ - if(loading==NO) return; - +{ char *str = (char *) buff; va_list opt; @@ -9268,17 +9990,31 @@ void print_load(char *format, ...) time_not=1; if(strstr(loading_log[0], "Warning ")) sleep(1); - if(strstr(loading_log[0], "Error ")) sleep(4); + if(strstr(loading_log[0], "Error ")) sleep(2); ERR = FALSE; WAR = FALSE; + + if( LOG ) { + + if( mgz_log == NULL ) { + mkdir("/dev_hdd0/tmp", 0777); + mgz_log = fopen("/dev_hdd0/tmp/mgz.log", "w"); + if( mgz_log == NULL ) return; + } + + fputs(loading_log[0], mgz_log); + fputs("\n", mgz_log); + } + + // If it freeze, it allow to display every messages before the freeze (loading screen thread is async) + if( DEBUG ) usleep(500000); + } static char buff2[4096]; void print_head(char *format2, ...) { - if(loading==NO) return; - char *str2 = (char *) buff2; va_list opt2; @@ -9287,7 +10023,40 @@ void print_head(char *format2, ...) va_end(opt2); strcpy(head_title, str2); + + if( LOG ) { + + if( mgz_log == NULL ) { + mkdir("/dev_hdd0/tmp", 0777); + mgz_log = fopen("/dev_hdd0/tmp/mgz.log", "w"); + if( mgz_log == NULL ) return; + } + + fputs(head_title, mgz_log); + fputs("\n", mgz_log); + } + + // If it freeze, it allow to display every messages before the freeze + if( DEBUG ) usleep(500000); + +} +void hex_print_load(char *data, size_t len) +{ + int i = 0; + char line[33]; + memset(line, 0, 33); + + while( i < len) { + + sprintf(&line[i%16*2], "%02X", data[i]); + if((i>0 && i%16 == 15) || i == (len-1)) { + print_load("%s", line); + memset(line, 0, 33); + } + i++; + } + } void start_loading() @@ -9303,15 +10072,194 @@ void end_loading() if(loading==YES) { u64 ret; loading=NO; + while(loading==NO) usleep(1000); sysThreadJoin(loading_id, &ret); + loading=NO; + } +} + +void reset_gathering() +{ + gathering_cancel=NO; + gathering_total_size=0; + gathering_nb_file=0; + gathering_nb_directory=0; + +} + +static sys_ppu_thread_t gathering_id; +void Draw_Gathering(void *unused) +{ + int i; + for(i=0; i<=20; i++) strcpy(loading_log[i], "\0"); + + reset_gathering(); + + while(gathering) { + + int x=50, y=40; + + Draw_BGS(); + + FontSize(20); + FontColor(COLOR_1); + SetFontZ(0); + + + FontColor(COLOR_1); + DrawFormatString(x, y, STR_GATHERING); + y+=20; + DrawFormatString(x, y, "%s = %i", STR_FILES, gathering_nb_file); + y+=20; + DrawFormatString(x, y, "%s = %i", STR_DIRS, gathering_nb_directory); + y+=20; + char *size_tot = get_unit(gathering_total_size); + DrawFormatString(x, y,"%s = %s", STR_TOTALSIZE, size_tot); + y+=20; + FREE(size_tot); + + for(i=0; i<=20; i++){ + if(strstr(loading_log[i], "Error")) FontColor(RED); + else if(strstr(loading_log[i], "Warning")) FontColor(ORANGE); + else FontColor(COLOR_1); + + DrawFormatString(x , y, loading_log[i]); + y+=20; + if(y>450) break; + } + + // *** DISPLAY BUTTONS *** + x=INPUT_X; + y=INPUT_Y; + FontSize(15); + FontColor(COLOR_1); + SetFontZ(0); + + x=DrawButton(x, y, STR_CANCEL, BUTTON_CIRCLE); + + Draw_MemMonitor(); + DrawLoadingIcon(); + tiny3d_Flip(); + //ScreenShot(); + cls(); + + ps3pad_read(); + + if(NewPad(BUTTON_CIRCLE) && gathering==YES) { + gathering_cancel=YES; + } + } + + for(i=0; i<=20; i++) strcpy(loading_log[i], "\0"); + + + gathering=-1; + + sysThreadExit(0); +} + +void start_gathering() +{ + if(gathering==NO) { + gathering=YES; + reset_gathering(); + sysThreadCreate(&gathering_id, Draw_Gathering, NULL, 999, 0x2000, THREAD_JOINABLE, "gathering"); } } +void end_gathering() +{ + if(gathering==YES) { + u64 ret; + gathering=NO; + while(gathering==NO) usleep(1000); + sysThreadJoin(gathering_id, &ret); + gathering=NO; + } +} + + float DrawStringFromCenterX(float x, float y, char *txt) { return DrawString(x-WidthFromStr(txt)/2, y, txt); } + +//******************************************************* +// Update Manager +//******************************************************* + +// https://www.psdevwiki.com/ps3/Update_Manager + +#define UM_UPDATE_PACKAGE_TOPHALF 0x6001 +#define UM_INSPECT_PACKAGE_TOPHALF 0x6002 +#define UM_GET_PACKAGE_INFO 0x6003 +#define UM_GET_FIX_INSTRUCTION 0x6004 +#define UM_EXTRACT_PACKAGE_TOPHALF 0x6005 +#define UM_GET_EXTRACT_PACKAGE 0x6006 +#define UM_IS_FLASH_INITIALIZED 0x6007 +#define UM_SET_FLASH_INITIALIZED 0x6008 +#define UM_GET_TOKEN_SEED 0x6009 +#define UM_SET_TOKEN 0x600A +#define UM_READ_EPROM 0x600B +#define UM_WRITE_EPROM 0x600C +#define UM_GET_STATUS 0x600D +#define UM_MALLOC 0x600E +#define UM_FREE 0x600F +#define UM_CHECK_INTEGRITY 0x6010 +#define UM_GET_APPLICABLE_VERSION 0x6011 +#define UM_REALLOC 0x6012 + +s32 update_manager(u32 packet_id, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6) +{ + lv2syscall7(863, packet_id, arg1, arg2, arg3, arg4, arg5, arg6); + return_to_user_prog(u32); +} + +s32 GetApplicableVersion(void * data) +{ + return update_manager(UM_GET_APPLICABLE_VERSION, 1, (u64) data, 0,0,0,0); +} + +u8 get_minver(char *minver) +{ + u16 data[0x10]; + + int result = GetApplicableVersion(data); + if( result != 0) { + print_load("Error : GetApplicableVersion failed : 0x%08X", result); + return FAILED; + } + + sprintf(minver, "%02X.%02X", data[0], data[1]); + + //SaveFile("/dev_usb000/GetApplicableVersion.bin", (char *) data, 0x20); + + return SUCCESS; +} + +char *get_date() +{ + char *date = (char *) malloc( 20 ); + if( date == NULL ) return NULL; + + time_t rawtime; + struct tm * timeinfo; + + time ( &rawtime ); + timeinfo = localtime( &rawtime ); + sprintf(date, "%04d%02d%02d_%02d%02d%02d", timeinfo->tm_year+1900, timeinfo->tm_mon+1, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); + + return date; +} + +float get_fps() +{ + // TimeVal time = FWTime::getCurrentTime(); + // float fFPS = 1.f / (float)(time - mLastTime); + // mLastTime = time; +} + //******************************************************* //lv2 syscalls //******************************************************* @@ -9505,6 +10453,17 @@ u64 lv2poke8(u64 addr, u8 value) return lv2poke(addr, (((u64) value) <<56) | (lv2peek(addr) & 0xffffffffffffffULL)); } +u64 lv1peek(u64 addr) +{ + if(cobra) { + lv2syscall1(11, (u64) addr >> 0ULL); + return_to_user_prog(u64); + } else { + lv2syscall1(8, (u64) addr >> 0ULL); + return_to_user_prog(u64); + } +} + void lv1poke( u64 addr, u64 val) { lv2syscall2(9, addr, val); @@ -10030,20 +10989,28 @@ void DumpDevicesInfo() void DumpDevicesData() { + print_head("DumpDevicesData"); + int ret=-1; u64 i, size; sys_fs_mount_info *info; + print_load("sys_fs_get_mount_info_size"); + ret = sys_fs_get_mount_info_size(&size); if (ret != 0) { print_load("Error : sys_fs_get_mount_info_size FAILED ! %X", ret); return; } + print_load("malloc"); + info = malloc(size*sizeof(sys_fs_mount_info)); memset(info, 0, size*sizeof(sys_fs_mount_info)); - + + print_load("sys_fs_get_mount_info"); + ret = sys_fs_get_mount_info(info, size, &size); if (ret != 0) { @@ -10052,14 +11019,20 @@ void DumpDevicesData() return; } + print_load("loop"); for (i = 0; i < size; i++) { + print_load("get device : %s", info[i].deviceName); + u64 device_id = get_device(info[i].deviceName); if(device_id == FAILED) { //print_load("Error : DumpDevicesData get_device %s = FAILED !", info[i].deviceName); continue; } + + print_load("sys_storage_get_device_info"); + device_info_t device_info; memset(&device_info, 0, sizeof(device_info)); ret = sys_storage_get_device_info(device_id, &device_info); @@ -10072,6 +11045,7 @@ void DumpDevicesData() u32 source; u32 read; + print_load("sys_storage_open"); ret = sys_storage_open(device_id, &source ); if( ret != 0 ) { @@ -10079,6 +11053,7 @@ void DumpDevicesData() continue; } + print_load("malloc sector"); u8 *sector = (u8 *) malloc(device_info.sector_size+1); if(sector==NULL) { @@ -10090,6 +11065,9 @@ void DumpDevicesData() if(strcmp(info[i].mount_point, "/")==0) strcpy(temp, "/dev_hdd0/tmp/rawdata_root.bin"); else sprintf(temp, "/dev_hdd0/tmp/rawdata_%s.bin", &info[i].mount_point[1]); + + print_load("fopen %s", temp); + FILE *f; f = fopen(temp, "wb"); if(f==NULL) { @@ -10108,22 +11086,279 @@ void DumpDevicesData() if(0x10 < count) count=0x10; else count=1; + print_load("count"); + if(strncmp(info[i].mount_point, "/dev_flash", 10) ==0) flag = 0x22; + print_load("loop2"); int j; for(j=0; j>24; + iv[13] = (j & 0x00FF0000)>>16; + iv[14] = (j & 0x0000FF00)>> 8; + iv[15] = (j & 0x000000FF)>> 0; +} + +u8 dump_dec_bdvd(char *output) +{ + print_load("Get decryption key d1"); + u8 *key = get_d1(); + if(key == NULL ) { + print_load("Error : get_d1 "); + return FAILED; + } + + unsigned char key_d1[] = {0x38, 11, 0xcf, 11, 0x53, 0x45, 0x5b, 60, 120, 0x17, 0xab, 0x4f, 0xa3, 0xba, 0x90, 0xed}; + unsigned char iv_d1[] = {0x69, 0x47, 0x47, 0x72, 0xaf, 0x6f, 0xda, 0xb3, 0x42, 0x74, 0x3a, 0xef, 170, 0x18, 0x62, 0x87}; + + aes_context aes_d1; + if( aes_setkey_enc(&aes_d1, key_d1, 128 )!=0 ){ + print_load(" Error : aes_setkey_enc aes_d1 "); + return FAILED; + } + if(aes_crypt_cbc(&aes_d1, AES_ENCRYPT, 16, iv_d1, key, key)!=0){ + print_load(" Error : aes_crypt_cbc aes_d1 "); + return FAILED; + } + print_load("Decryption key :"); + hex_print_load((char *) key, 16); + + u32 source; + print_load("sys_storage_open BDVD_DRIVE"); + if(sys_storage_open(BDVD_DRIVE, &source) != 0) { + print_load("Error : sys_storage_open"); + return FAILED; + } + + print_load("sys_storage_open BDVD_DRIVE"); + u8 *buff = (u8 *) malloc(BDVD_BUFFSIZE); + if(buff==NULL) { + print_load("Error : malloc BDVD_BUFFSIZE"); + sys_storage_close(source); + return FAILED; + } + + print_load("fopen %s", output); + FILE *f = fopen(output, "wb"); + if(f==NULL) { + free(buff); + sys_storage_close(source); + print_load("Error : fopen"); + return FAILED; + } + + print_load("init aes"); + aes_context aes; + if( aes_setkey_dec(&aes, key, 128 )!=0 ) { + print_load(" Error : aes_setkey_dec "); + return FAILED; + } + + print_load("malloc iv"); + u8 *iv = (u8 *) malloc(0x10); + if( iv == NULL ) { + print_load(" Error : malloc iv "); + return FAILED; + } + + print_load("malloc sec0sec1"); + u8 *sec0sec1 = (u8 *) malloc( 0x800 * 2 ); + if( sec0sec1 == NULL ) { + print_load(" Error : malloc sec0sec1 "); + return FAILED; + } + + + u32 read; + print_load("sys_storage_read sec0sec1"); + sys_storage_read(source, 0, 2, sec0sec1, &read, 0); + + u32 regions=(u8_to_u32(sec0sec1)*2)-1; + u32 total_sectors=1+u8_to_u32(sec0sec1+12+((regions-1)*4)); + + print_load("gethering data"); + strcpy( copy_src, "/dev_bdvd"); + strcpy( copy_dst, output); + gathering_nb_file = -1; + gathering_nb_directory = -1; + gathering_total_size = total_sectors * 0x800; + + + u64 current_sector=0; + u64 sector_nb; + u8 plain = YES; + + print_load("regions : 0x%X\n", regions); + print_load("total_sectors : 0x%X\n", total_sectors); + print_load("gathering_total_size : 0x%X\n", gathering_total_size); + + u32 i=0; + while(i 0 ) - { - read+=n; - prog_bar1_value=(read*100)/file_size; - md5_update( &ctx, buf, n ); - if(cancel==YES) break; + task_Init(file_size); + + md5_starts( &ctx ); + + while(read < file_size) { + if( read + MD5_BUFFER_SIZE > file_size) n = file_size-read; + else n = MD5_BUFFER_SIZE; + + fread(buf, sizeof(u8), n, f); + read += n; + + task_Update(n); + + md5_update(&ctx, buf, n); + + if(cancel) break; } - + md5_finish( &ctx, output ); memset( &ctx, 0, sizeof( md5_context ) ); + FREE(buf); fclose(f); - if(cancel==YES) { + task_End(); + + if(cancel) { memset(output, 0, sizeof(output)); return FAILED; } @@ -10546,18 +11799,6 @@ u8 md5_file(char *path, unsigned char output[16]) // Game OPTION //******************************************************* -void print_copy_log(char *str) -{ - int i=0; - for(i=9; i > 0; i--){ - strcpy(copy_log[i], copy_log[i-1]); - } - - strcpy(copy_log[0], str); - - if(strncmp(copy_log[0], "Error", 5) == 0) sleep(4); -} - void get_hash(FILE* log, int hash_type, char *path) { u8 info = path_info(path); @@ -10641,22 +11882,25 @@ void HashFolder(int hash_type, char *dir) } } -u64 get_size(char *path, u8 upd_data) +u64 get_size(char *path) { struct stat s; - if(stat(path, &s) != 0) return 0; else + if(stat(path, &s) != 0) { + print_load("Error : %s", path); + return 0; + } else if(!S_ISDIR(s.st_mode)) { //FILE - if(upd_data==YES) { - total_size+=s.st_size; - nb_file+=1; + if(gathering) { + ++gathering_nb_file; + gathering_total_size+=s.st_size; } return s.st_size; } if(gathering_cancel==YES) return 0; - if(upd_data == YES) nb_directory+=1; + if(gathering) ++gathering_nb_directory; u64 dir_size=0; DIR *d; @@ -10673,11 +11917,10 @@ u64 get_size(char *path, u8 upd_data) if(gathering_cancel==YES) return 0; - dir_size += get_size(temp, upd_data); + dir_size += get_size(temp); } closedir(d); - return dir_size; } @@ -10772,9 +12015,7 @@ int Delete_Game(char *path, int position) void Get_Game_Size(char *path) { - total_size=0; - nb_file= 0; - nb_directory=0; + reset_gathering(); u8 split666 = is_66600(path); if( is_splitted_iso(path) || split666) { @@ -10791,11 +12032,11 @@ void Get_Game_Size(char *path) for(i=0; i<100; i++) { if(split666) sprintf(temp , "%s%02d" , iso_path, i); else sprintf(temp , "%s%d" , iso_path, i); - get_size(temp, YES); + get_size(temp); } } else { - get_size(path, YES); + get_size(path); } } @@ -10839,8 +12080,18 @@ char *get_unit(u64 nb) } -u8 reading = 0; -u8 writing = 0; +char *GetTimeStr(u64 secTime) +{ + u64 loc_secTime = secTime; + + u64 hr = loc_secTime / 3600ULL; + loc_secTime = loc_secTime - 3600ULL * hr; + u64 min = loc_secTime / 60ULL; + loc_secTime = loc_secTime - 60ULL * min; + u64 sec = loc_secTime; + + return sprintf_malloc("%02d:%02d:%02d", hr, min, sec); +} static sys_ppu_thread_t Copy_id; @@ -10848,25 +12099,34 @@ void Draw_Copy_screen(void *unused) { int i; - uint8_t shutdown = NO; + u8 shutdown = NO; copy_current_size=0; - total_size=0; - nb_file=0; - nb_directory=0; - gathering_cancel=NO; copy_cancel=NO; + + u8 show_log = YES; u8 is_dir = NO; if(path_info(copy_src) == _DIRECTORY) is_dir=YES; u64 previous_size=0; + for(i=0; i<=20; i++){ + strcpy(loading_log[i], "\0"); + } + char speed_STR[32]; + char elapsed_STR[32]; + char remaining_STR[32]; + init_timer(4); start_timer(4); + u64 start_copy = sTime(); + + float bar_w = 600; + while(copy_flag) { - cls(); + cls(); Draw_BGS(); Draw_Notification(); @@ -10876,9 +12136,7 @@ void Draw_Copy_screen(void *unused) FontColor(COLOR_4); - if(gathering==YES) { - DrawString(x , y, STR_GATHERING); - } else DrawString(x , y, STR_COPYING); + DrawString(x , y, STR_COPYING); FontColor(COLOR_1); @@ -10894,103 +12152,133 @@ void Draw_Copy_screen(void *unused) y+=new_line(1); - if(gathering_cancel==YES) + if(gathering_cancel==YES) { DrawFormatString(x , y, "%s : %s", STR_FILES, STR_UNKNOWN); - else - DrawFormatString(x , y, "%s : %d", STR_FILES, nb_file); - + } else + if( 0 < gathering_nb_file ) { + DrawFormatString(x , y, "%s : %d", STR_FILES, gathering_nb_file); + } y+=new_line(1); if(is_dir) { - if(gathering_cancel==YES) + if(gathering_cancel==YES) { DrawFormatString(x , y, "%s : %s", STR_DIRS, STR_UNKNOWN); - else - DrawFormatString(x , y, "%s : %d", STR_DIRS, nb_directory); - + } else + if( 0 <= gathering_nb_directory ) { + DrawFormatString(x , y, "%s : %d", STR_DIRS, gathering_nb_directory); + } y+=new_line(1); } - char *size_current = get_unit(copy_current_size); - DrawString(x, y, size_current); - if(size_current) free(size_current); - - - if(gathering_cancel==YES) DrawString(x+400-WidthFromStr(STR_UNKNOWN), y, STR_UNKNOWN); - else { - - char *size_tot = get_unit(total_size); - DrawString(x+400-WidthFromStr(size_tot), y, size_tot); - if(size_tot) free(size_tot); - } - if( get_time(4) > 1000 ) { char *copy_speed = get_unit(copy_current_size-previous_size); - - sprintf(speed_STR, "%s/s", copy_speed); - if(copy_speed) free(copy_speed); + if(copy_speed) sprintf(speed_STR, "%s/s", copy_speed); + FREE(copy_speed); previous_size = copy_current_size; start_timer(4); + + u64 ElapsedTime = sTime() - start_copy; + u64 RemainingTime = ElapsedTime * gathering_total_size / copy_current_size - ElapsedTime; + + char *ElapsedTime_STR = GetTimeStr(ElapsedTime); + if(ElapsedTime_STR) sprintf(elapsed_STR, "Elapsed : %s", ElapsedTime_STR); + FREE(ElapsedTime_STR); + + if( gathering_total_size != 0 && gathering_cancel == NO) { + + char *RemainingTime_STR = GetTimeStr(RemainingTime); + if(RemainingTime_STR) sprintf(remaining_STR, "Remaining : %s", RemainingTime_STR); + FREE(RemainingTime_STR); + } } + DrawFormatString(x, y, elapsed_STR); + y+=new_line(1); + + if( gathering_total_size != 0 && gathering_cancel == NO) { - DrawStringFromCenterX(x+200, y, speed_STR); + DrawFormatString(x, y, remaining_STR); + y+=new_line(1); + } + + char *size_current = get_unit(copy_current_size); + if(size_current) DrawString(x, y, size_current); + FREE(size_current); - y+=new_line(1); + if(gathering_cancel==YES) DrawString(x+bar_w-WidthFromStr(STR_UNKNOWN), y, STR_UNKNOWN); + else { + char *size_tot = get_unit(gathering_total_size); + if(size_tot) DrawString(x+bar_w-WidthFromStr(size_tot), y, size_tot); + FREE(size_tot); + } - float val; - if(gathering_cancel==YES) val = 100; else - val = copy_current_size * 100 / total_size; + DrawStringFromCenterX(x+bar_w/2, y, speed_STR); - Draw_Progress_Bar(x, y, 4, val, COLOR_2); + y+=new_line(1); + + if(gathering_total_size != 0 && gathering_cancel==NO) { + Draw_Progress_Bar_Advanced(x, y, 0, 0, bar_w, 4, 1, WHITE, BLACK, GREEN, gathering_total_size, copy_current_size); + } y+=15; - Draw_Progress_Bar(x, y, 4, file_copy_prog_bar, COLOR_2); - + if(1 < gathering_nb_file) { + Draw_Progress_Bar_Advanced(x, y, 0, 0, bar_w, 4, 1, WHITE, BLACK, GREEN, 100, copy_file_prog_bar); + y+=20; + DrawFormatString(x, y, "%s : %s", STR_FILE, copy_file); + } y+=20; - DrawFormatString(x, y, "%s : %s", STR_FILE, copy_file); - - - y+=new_line(2); - FontSize(17); - for(i=0; i<10; i++) { - DrawString(x, y, copy_log[i]); - y+=new_line(1); + if( loading_log[0][0] ) { + for(i=0; i<=20; i++){ + if(strstr(loading_log[i], "Error")) FontColor(RED); + else if(strstr(loading_log[i], "Warning")) FontColor(ORANGE); + else FontColor(COLOR_1); + + DrawFormatString(x , y, loading_log[i]); + y+=20; + if(y>450) break; + } } - + x=INPUT_X; y=INPUT_Y; FontColor(COLOR_1); SetFontZ(0); - + x=DrawButton(x, y, STR_CANCEL, BUTTON_CIRCLE); - if(shutdown==YES) { - x=DrawButton(x, y, STR_TURNOFF_YES, BUTTON_SELECT); - } else { - x=DrawButton(x, y, STR_TURNOFF_NO, BUTTON_SELECT); + x=DrawButton(x, y, STR_TURNOFF, BUTTON_L1); + x=Draw_checkbox(x-3, y, 0, "", shutdown, YES); + + if( loading_log[0][0] ) { + if(show_log) x=DrawButton(x, y, STR_HIDELOGS, BUTTON_SELECT); + else x=DrawButton(x, y, STR_SHOWLOGS, BUTTON_SELECT); } tiny3d_Flip(); //ScreenShot(); ps3pad_read(); - if(NewPad(BUTTON_SELECT)) { - if(shutdown==YES) shutdown=NO; else shutdown=YES; + if(NewPad(BUTTON_L1)) { + shutdown= !shutdown; + } + if( loading_log[0][0] ) { + if(NewPad(BUTTON_SELECT)) { + show_log = !show_log; + } } if(NewPad(BUTTON_CIRCLE)) { - if(gathering==YES) { - gathering_cancel=YES; - show_msg(STR_CANCELLED); - } else copy_cancel = YES; + copy_cancel = YES; + show_msg(STR_CANCELLED); } - } + print_load("Delete_Game"); + if(copy_cancel == YES) Delete_Game(copy_dst, -1); else if(shutdown==YES) { Delete("/dev_hdd0/tmp/turnoff"); @@ -10999,32 +12287,39 @@ void Draw_Copy_screen(void *unused) memset(copy_src, 0, sizeof(copy_src)); memset(copy_dst, 0, sizeof(copy_dst)); + copy_current_size=0; - total_size=0; copy_cancel=NO; - gathering=NO; - gathering_cancel=NO; - nb_file=0; - nb_directory=0; - for(i=0; i<10; i++){ - strcpy(copy_log[i], "\0"); + reset_gathering(); + + for(i=0; i<=20; i++){ + strcpy(loading_log[i], "\0"); } + copy_flag = -1; + print_load("sysThreadExit"); + sysThreadExit(0); } void start_copy_loading() { - copy_flag=YES; - sysThreadCreate(&Copy_id, Draw_Copy_screen, NULL, 999, 0x2000, THREAD_JOINABLE, "copying"); + if( copy_flag==NO) { + copy_flag=YES; + sysThreadCreate(&Copy_id, Draw_Copy_screen, NULL, 999, 0x2000, THREAD_JOINABLE, "copying"); + } } void end_copy_loading() { - u64 ret; - copy_flag=NO; - sysThreadJoin(Copy_id, &ret); + if(copy_flag==YES) { + u64 ret; + copy_flag=NO; + while(copy_flag==NO) usleep(1000); + sysThreadJoin(Copy_id, &ret); + copy_flag=NO; + } } void initAIO() @@ -11086,11 +12381,11 @@ static void reading_callback(sysFSAio *xaio, s32 error, s32 xid, u64 size) char tmp[128]; if(error != 0) { reading_statut[i] = FAILED; - sprintf(tmp, "Error : reading error %X", (unsigned int) error); print_copy_log(tmp); + sprintf(tmp, "Error : reading error %X", (unsigned int) error); print_load(tmp); } else if(size != xaio->size) { reading_statut[i] = FAILED; - sprintf(tmp, "Error : reading size %X / %X", (unsigned int) size, (unsigned int) xaio->size); print_copy_log(tmp); + sprintf(tmp, "Error : reading size %X / %X", (unsigned int) size, (unsigned int) xaio->size); print_load(tmp); } else { buffer_statut[buffer_to_read] = DATA_FULL; buffer_to_read++; @@ -11107,11 +12402,11 @@ static void writing_callback(sysFSAio *xaio, s32 error, s32 xid, u64 size) char tmp[128]; if(error != 0) { writing_statut[i] = FAILED; - sprintf(tmp, "Error : writing error %X", (unsigned int) error); print_copy_log(tmp); + sprintf(tmp, "Error : writing error %X", (unsigned int) error); print_load(tmp); } else if(size != xaio->size) { writing_statut[i] = FAILED; - sprintf(tmp, "Error : writing size %X / %X", (unsigned int) size, (unsigned int) xaio->size); print_copy_log(tmp); + sprintf(tmp, "Error : writing size %X / %X", (unsigned int) size, (unsigned int) xaio->size); print_load(tmp); } else { buffer_statut[buffer_to_write] = DATA_EMPTY; buffer_to_write++; @@ -11144,7 +12439,7 @@ int CopyFile_async(char *src, char *dst) */ if(sysFsOpen(src, SYS_O_RDONLY, &fdr, 0,0) != 0) { //sysFsAioFinish(src); - print_copy_log("Error : failed to copy_async / sysFsOpen(src)"); + print_load("Error : failed to copy_async / sysFsOpen(src)"); return FAILED; } /* @@ -11159,13 +12454,13 @@ int CopyFile_async(char *src, char *dst) //sysFsAioFinish(src); //sysFsAioFinish(dst); sysFsClose(fdr); - print_copy_log("Error : failed to copy_async / sysFsOpen(src)"); + print_load("Error : failed to copy_async / sysFsOpen(src)"); return FAILED; } char *mem = (char *) malloc(BUFFNUMBER * BUFFSIZE); if(mem == NULL) { - print_copy_log("Error : failed to copy_async / malloc"); + print_load("Error : failed to copy_async / malloc"); return FAILED; } @@ -11206,7 +12501,7 @@ int CopyFile_async(char *src, char *dst) reading_pos+=aio_read[i].size; if(sysFsAioRead(&aio_read[i], &id_r[i], reading_callback) != 0) { - print_copy_log("Error : failed to copy_async / sysFsAioRead"); + print_load("Error : failed to copy_async / sysFsAioRead"); goto error; } } @@ -11215,7 +12510,7 @@ int CopyFile_async(char *src, char *dst) if(reading_statut[i] == FAILED) { - print_copy_log("Error : failed to copy_async / reading_statut = FAILED !"); + print_load("Error : failed to copy_async / reading_statut = FAILED !"); goto error; } @@ -11235,7 +12530,7 @@ int CopyFile_async(char *src, char *dst) writing_pos += aio_write[i].size; if(sysFsAioWrite(&aio_write[i], &id_w[i], writing_callback) != 0) { - print_copy_log("Error : failed to copy_async / sysFsAioWrite"); + print_load("Error : failed to copy_async / sysFsAioWrite"); goto error; } } @@ -11243,11 +12538,11 @@ int CopyFile_async(char *src, char *dst) } if(writing_statut[i] == FAILED) { - print_copy_log("Error : failed to copy_async / writing_statut = FAILED !"); + print_load("Error : failed to copy_async / writing_statut = FAILED !"); goto error; } - file_copy_prog_bar=writed*100/size; + copy_file_prog_bar=writed*100/size; } } @@ -11293,7 +12588,7 @@ u8 CopyFile_sysFs(char* src, char* dst) int f1; int f2; - file_copy_prog_bar=0; + copy_file_prog_bar=0; struct stat s; if(stat(src, &s) != 0) return FAILED; @@ -11330,13 +12625,13 @@ u8 CopyFile_sysFs(char* src, char* dst) pos += read; - file_copy_prog_bar=pos*100/lenght; + copy_file_prog_bar=pos*100/lenght; copy_current_size+=read; } skip: - file_copy_prog_bar=0; + copy_file_prog_bar=0; if(mem) free(mem); if(f1) sysFsClose(f1); @@ -11357,7 +12652,7 @@ u8 CopyFile_sysFsLv2(char* src, char* dst) s32 fd = -1; s32 fd2 = -1; - file_copy_prog_bar=0; + copy_file_prog_bar=0; struct stat s; if(stat(src, &s) != 0) return FAILED; @@ -11390,13 +12685,13 @@ u8 CopyFile_sysFsLv2(char* src, char* dst) pos += read; - file_copy_prog_bar=pos*100/lenght; + copy_file_prog_bar=pos*100/lenght; copy_current_size+=read; } skip: - file_copy_prog_bar=0; + copy_file_prog_bar=0; if(mem) free(mem); if(fd >=0) sysLv2FsClose(fd); @@ -11430,17 +12725,17 @@ u8 CopyFile_ps3ntfs(char* src, char* dst) strcpy(source, src); strcpy(destination, dst); if(strcmp(src, dst)==0) { - RemoveExtention(destination); + RemoveExtension(destination); char *temp_str = strcpy_malloc(destination); int o; for(o=0; o<1000; o++) { - sprintf(destination, "%s_%03d%s", temp_str, o, GetExtention(dst)); + sprintf(destination, "%s_%03d%s", temp_str, o, GetExtension(dst)); if(path_info(destination) == _NOT_EXIST) break; } free(temp_str); } - file_copy_prog_bar=0; + copy_file_prog_bar=0; struct stat s; if(stat(src, &s) != 0) return FAILED; @@ -11501,7 +12796,7 @@ u8 CopyFile_ps3ntfs(char* src, char* dst) pos += read; - file_copy_prog_bar=pos*100/lenght; + copy_file_prog_bar=pos*100/lenght; copy_current_size+=read; } @@ -11526,7 +12821,7 @@ u8 CopyFile_ps3ntfs(char* src, char* dst) skip: - file_copy_prog_bar=0; + copy_file_prog_bar=0; if(mem) FREE(mem); @@ -11556,7 +12851,7 @@ u8 CopyFile_fcntl(char* src, char* dst) int f1=-1; int f2=-1; - file_copy_prog_bar=0; + copy_file_prog_bar=0; struct stat s; if(stat(src, &s) != 0) return FAILED; @@ -11587,13 +12882,13 @@ u8 CopyFile_fcntl(char* src, char* dst) pos += rd; - file_copy_prog_bar=pos*100/lenght; + copy_file_prog_bar=pos*100/lenght; copy_current_size+=rd; } skip: - file_copy_prog_bar=0; + copy_file_prog_bar=0; if(mem) free(mem); if(f1) close(f1); @@ -11616,7 +12911,7 @@ u8 CopyFile_stdio(char* src, char* dst) FILE* f; FILE* f2; - file_copy_prog_bar=0; + copy_file_prog_bar=0; struct stat s; if(stat(src, &s) != 0) return FAILED; @@ -11653,7 +12948,7 @@ u8 CopyFile_stdio(char* src, char* dst) pos += read; - file_copy_prog_bar=pos*100/lenght; + copy_file_prog_bar=pos*100/lenght; copy_current_size+=read; @@ -11661,7 +12956,7 @@ u8 CopyFile_stdio(char* src, char* dst) skip: - file_copy_prog_bar=0; + copy_file_prog_bar=0; if(mem) free(mem); if(f) fclose(f); @@ -11804,6 +13099,8 @@ void SpeedTest() u8 Copy(char *src, char *dst) { + if(copy_cancel) return FAILED; + u8 info_file = path_info(src); if(info_file == _NOT_EXIST) return FAILED; else @@ -11904,6 +13201,8 @@ u8 CopyJoin(char *src, char *dst) u8 Move(char *src, char *dst) { + if( copy_cancel ) return FAILED; + char dev_src[30]; char dev_dst[30]; @@ -12002,12 +13301,9 @@ void sort_GAMELIST() void add_GAMELIST(char *path) { - u8 ext = get_ext(path); + u8 plat = get_platform(path); - if(ext != _ISO_PS3 && ext != _JB_PS3 - && ext != _ISO_PSP && ext != _JB_PSP - && ext != _ISO_PS2 && ext != _JB_PS2 - && ext != _ISO_PS1 && ext != _JB_PS1) return; + if(plat == UNK) return; game_number++; list_game_path = (char **) realloc(list_game_path, (game_number+1) * sizeof(char *)); @@ -12017,13 +13313,13 @@ void add_GAMELIST(char *path) list_game_havepic = (u8 *) realloc(list_game_havepic, (game_number+1) * sizeof(u8) ); list_game_path[game_number] = strcpy_malloc(path); - list_game_platform[game_number] = ext; + list_game_platform[game_number] = plat; char title[512]; strcpy(title, &strrchr(path, '/')[1]); - RemoveExtention(title); + RemoveExtension(title); - if(ext == _ISO_PS3 || ext == _JB_PS3 || ext == _ISO_PSP || ext == _JB_PSP) { + if(plat == ISO_PS3 || plat == JB_PS3 || plat == ISO_PSP || plat == JB_PSP) { GetParamSFO("TITLE", title, game_number, NULL); } list_game_title[game_number] = strcpy_malloc(title); @@ -12083,7 +13379,7 @@ void remove_GAMELIST(s64 pos) void get_GAMELIST(char *scan_path) { print_load("Scanning : %s", scan_path); - + DIR *d; struct dirent *dir; @@ -12162,9 +13458,7 @@ void Load_GAMELIST() } void Copy_Game(char *src, char *dst) -{ - start_copy_loading(); - +{ strcpy(copy_src, src); strcpy(copy_dst, dst); @@ -12173,9 +13467,12 @@ void Copy_Game(char *src, char *dst) char *tmp = strrchr(copy_src, '/'); strcat(copy_dst, tmp); - gathering=YES; + start_gathering(); Get_Game_Size(copy_src); - gathering=NO; + end_gathering(); + + + start_copy_loading(); u8 ret = FAILED; u8 split666 = is_66600(copy_src); @@ -12230,7 +13527,7 @@ void Copy_Game(char *src, char *dst) end: //if(ret==SUCCESS) - if( (total_size <= copy_current_size && copy_current_size != 0) + if( (gathering_total_size <= copy_current_size && copy_current_size != 0) || (gathering_cancel == YES && copy_cancel==NO && copy_current_size > 0) ) { add_GAMELIST(copy_dst); @@ -12253,10 +13550,10 @@ void Copy_Game(char *src, char *dst) void Draw_GameProperties() { - char *tot_size = get_unit(total_size); + char *tot_size = get_unit(gathering_total_size); char sys_vers[64]; memset(sys_vers, 0, 64); - if(list_game_platform[position] == _JB_PS3 || list_game_platform[position] == _ISO_PS3) { + if(list_game_platform[position] == JB_PS3 || list_game_platform[position] == ISO_PS3) { char tmp[10]; if(GetParamSFO("PS3_SYSTEM_VER", tmp, position, NULL)==SUCCESS) { float f; @@ -12306,16 +13603,16 @@ void Draw_GameProperties() FontColor(COLOR_3); xt=DrawFormatString(x1 , y, "%s :", STR_GAME_PLATFORM); FontColor(COLOR_1); - if(list_game_platform[position] == _JB_PS3 || list_game_platform[position] == _ISO_PS3) { + if(list_game_platform[position] == JB_PS3 || list_game_platform[position] == ISO_PS3) { DrawString(xt+10 , y, "PlayStation 3"); } else - if(list_game_platform[position] == _JB_PS2 || list_game_platform[position] == _ISO_PS2) { + if(list_game_platform[position] == JB_PS2 || list_game_platform[position] == ISO_PS2) { DrawString(xt+10 , y, "PlayStation 2"); } else - if(list_game_platform[position] == _JB_PS1 || list_game_platform[position] == _ISO_PS1) { + if(list_game_platform[position] == JB_PS1 || list_game_platform[position] == ISO_PS1) { DrawString(xt+10 , y, "PlayStation"); } else - if(list_game_platform[position] == _JB_PSP || list_game_platform[position] == _ISO_PSP) { + if(list_game_platform[position] == JB_PSP || list_game_platform[position] == ISO_PSP) { DrawString(xt+10 , y, "PlayStation Portable"); } else DrawString(xt+10 , y, STR_UNKNOWN); @@ -12341,7 +13638,7 @@ void Draw_GameProperties() FontColor(COLOR_3); xt=DrawFormatString(x1 , y, "%s :", STR_FILES); FontColor(COLOR_1); - DrawFormatString(xt+10 , y, "%d", nb_file); + DrawFormatString(xt+10 , y, "%d", gathering_nb_file); y+=new_line(1); @@ -12349,13 +13646,13 @@ void Draw_GameProperties() FontColor(COLOR_3); xt=DrawFormatString(x1 , y, "%s :", STR_DIRS); FontColor(COLOR_1); - DrawFormatString(xt+10 , y, "%d", nb_directory); + DrawFormatString(xt+10 , y, "%d", gathering_nb_directory); y+=new_line(1); } - if(list_game_platform[position] == _JB_PS3 || list_game_platform[position] == _ISO_PS3) { + if(list_game_platform[position] == JB_PS3 || list_game_platform[position] == ISO_PS3) { FontColor(COLOR_3); xt=DrawFormatString(x1 , y, "%s :", STR_SYSVERS); FontColor(COLOR_1); @@ -12371,7 +13668,7 @@ void Draw_GameProperties() y+=new_line(1); - if(list_game_platform[position] == _ISO_PS2) { + if(list_game_platform[position] == ISO_PS2) { FontColor(COLOR_3); @@ -12409,44 +13706,98 @@ void Draw_GameProperties() } } - total_size=0; - nb_file=0; - nb_directory=0; + gathering_total_size=0; + gathering_nb_file=0; + gathering_nb_directory=0; } -void dump_lv1(char *dump_path) -{ - show_msg("TODO"); -} +#define DUMPER_BUFFSIZE 0x10000 -void dump_lv2(char *dump_path) +void dump_lv1(char *path) { FILE* f=NULL; - u64 i, data; - char temp[128]; + u64 i, j; + char temp[512]; + + char *date = get_date(); + if( date == NULL) { + print_load("Error : failed to get_date"); + return; + } - int j=0; + sprintf(temp, "%s/%s_%X_LV1.BIN", path, date, firmware); - sprintf(temp, "%s_%d", dump_path, j); + FREE(date); + remove(temp); - while(path_info(temp) != _NOT_EXIST) { - j+=1; - sprintf(temp, "%s_%d", dump_path, j); + f=fopen(temp, "wb"); + if(f==NULL) { + print_load("Error : cannot fopen %s", temp); + return; + } + + prog_bar1_value = 0; + + u64 data[DUMPER_BUFFSIZE]; + + for(i=0x0ULL ; i < 0x1000000ULL; i+= 0x8 * DUMPER_BUFFSIZE ) { + memset(data, 0, DUMPER_BUFFSIZE*8); + + for( j = 0; j < DUMPER_BUFFSIZE; j++) { + data[j]=lv1peek(i+j*0x8); + } + + fwrite(&data, sizeof(u64), DUMPER_BUFFSIZE, f); + + prog_bar1_value = ((i+j)*100)/0x1000000ULL; + if(cancel==YES) break; + } + fclose(f); + + if(cancel==YES) { + Delete(temp); + cancel=NO; + } +} + + +void dump_lv2(char *path) +{ + FILE* f=NULL; + u64 i, j; + char temp[512]; + + char *date = get_date(); + if( date == NULL) { + print_load("Error : failed to get_date"); + return; } + sprintf(temp, "%s/%s_%X_LV2.BIN", path, date, firmware); + + FREE(date); + remove(temp); + f=fopen(temp, "wb"); if(f==NULL) { - print_load("Error : cannot dump %s", temp); + print_load("Error : cannot fopen %s", temp); return; - } else + } prog_bar1_value = 0; - for(i=0x8000000000000000ULL ; i < 0x8000000000800000ULL; i+=0x8) { - data=lv2peek(i); - fwrite(&data, sizeof(u64), 1, f); - prog_bar1_value = (i*100)/0x800000; + u64 data[DUMPER_BUFFSIZE]; + + for(i=0x8000000000000000ULL ; i < 0x8000000000800000ULL; i+= 0x8 * DUMPER_BUFFSIZE ) { + memset(data, 0, DUMPER_BUFFSIZE*8); + + for( j = 0; j < DUMPER_BUFFSIZE; j++) { + data[j]=lv2peek(i+j*0x8); + } + fwrite(&data, sizeof(u64), DUMPER_BUFFSIZE, f); + + prog_bar1_value = ((i+j)*100)/0x800000; if(cancel==YES) break; } fclose(f); @@ -12455,10 +13806,38 @@ void dump_lv2(char *dump_path) Delete(temp); cancel=NO; } +} +u8 FlashInfo(u64 *flash_id, u8 *mode) +{ + u32 sourceR, read; + u64 offset, sector[ 0x40 ]; + int ret = 1; + + ret = sys_storage_open( FLASH_NOR, &sourceR ); + if( ret == 0 ) { + offset = 0x178; + *flash_id = FLASH_NOR; + } else { + offset = 0x204; + sys_storage_close( sourceR ); + ret = sys_storage_open( FLASH_NAND, &sourceR ); + if( ret != 0 ) return FAILED; + *flash_id = FLASH_NAND; + } + + sys_storage_read( sourceR, offset, 0x1, sector, &read, 0x22 ); + sys_storage_close( sourceR ); + + if(0x0000000100820000 <= sector[0x0E] && sector[0x0E] < 0x0000000100830000) + *mode = 0xD; + else + *mode = 0xC; + + return SUCCESS; } -void dump_flash(char *dump_path) +void dump_flash(char *path) { FILE* f; @@ -12468,24 +13847,28 @@ void dump_flash(char *dump_path) u64 i; u64 size_dump; - char temp[255]; - int j=0; - - sprintf(temp, "%s_%d", dump_path, j); + u64 flash_id; + u8 mode; - while(path_info(temp) != _NOT_EXIST) { - j+=1; - sprintf(temp, "%s_%d", dump_path, j); + if( FlashInfo(&flash_id, &mode) == FAILED ) { + print_load("Error : FlashInfo sys_storage_open"); + return; } - ret = sys_storage_open( FLASH_NOR, &source ); + ret = sys_storage_open(flash_id, &source ); if( ret != 0 ) { - size_dump=0x77E00; - sys_storage_close(source); - sys_storage_open(FLASH_NAND, &source); - } - else { + print_load("Error : dump_flash sys_storage_open"); + return; + } + + char temp[255]; + + if( flash_id == FLASH_NOR ) { + sprintf(temp, "%s/%XEX-FLASH.NOR.BIN", path, mode); size_dump=0x8000 ; + } else { + sprintf(temp, "%s/%XEX-FLASH.NAND.BIN", path, mode); + size_dump=0x77E00; } prog_bar1_value = 0; @@ -12507,6 +13890,200 @@ void dump_flash(char *dump_path) } } +u8 *Load_from_device(u32 start_offset, u32 size, u32 device_id, u32 sector_size) +{ + u32 source; + if( sys_storage_open( device_id, &source) != 0) { + print_load("Error : Load_from_device sys_storage_open"); + return NULL; + } + + u8 *data = (u8 *) malloc(size); + if(data==NULL) { + print_load("Error : Load_from_device malloc"); + sys_storage_close(source); + return NULL; + } + + u32 read; + u32 dumped = 0; + u8 buffer[ sector_size ]; + + u32 sector_id = start_offset / sector_size; + + u32 start_sector_offset = start_offset - (sector_id * sector_size); + + u32 end_offset = start_offset + size; + + u32 end_sector_id = end_offset / sector_size ; + u32 end_sector_offset = end_offset - (end_sector_id * sector_size); + + + u32 start = start_sector_offset; + + while(sector_id <= end_sector_id ) { + + memset(buffer, 0, 0x200); + + sys_storage_read( source, sector_id, 1, buffer, &read, 0x22 ); + + u32 cpy_size = sector_size - start; + + if(sector_id == end_sector_id ) cpy_size = end_sector_offset - start; + + memcpy(data + dumped, &buffer[start], cpy_size); + + dumped += cpy_size; + + start = 0; + sector_id++; + } + + if( dumped != size ) { + print_load("Error : Load_from_device dumped != size"); + FREE(data); + sys_storage_close(source); + return NULL; + } + + sys_storage_close(source); + + return data; +} + +// https://www.psdevwiki.com/ps3/Flash + +#define FLASH_SECTOR_SIZE 0x200 + +u8 *Load_from_flash(u32 start_offset, u32 size, u32 source) +{ + u8 *data = (u8 *) malloc(size); + if(data==NULL) { + print_load("Error : load_from_flash malloc"); + return NULL; + } + + u32 read; + u32 dumped = 0; + u8 buffer[ FLASH_SECTOR_SIZE ]; + + u32 sector_id = start_offset / FLASH_SECTOR_SIZE; + + u32 start_sector_offset = start_offset - (sector_id * FLASH_SECTOR_SIZE); + + u32 end_offset = start_offset + size; + + u32 end_sector_id = end_offset / FLASH_SECTOR_SIZE ; + u32 end_sector_offset = end_offset - (end_sector_id * FLASH_SECTOR_SIZE); + + u32 start = start_sector_offset; + + while(sector_id <= end_sector_id ) { + + memset(buffer, 0, 0x200); + + sys_storage_read( source, sector_id, 1, buffer, &read, 0x22 ); + + u32 cpy_size = FLASH_SECTOR_SIZE - start; + + if(sector_id == end_sector_id ) cpy_size = end_sector_offset - start; + + memcpy(data + dumped, &buffer[start], cpy_size); + + dumped += cpy_size; + + start = 0; + sector_id++; + } + + if( dumped != size ) { + print_load("Error : load_from_flash dumped != size"); + FREE(data); + return NULL; + } + + return data; +} + +u8 *get_eid4() +{ + u32 source; + u64 offset; + + int ret = 1; + + ret = sys_storage_open( FLASH_NOR, &source ); + if( ret == 0 ) { + offset = 0x303A0; + } else { + offset = 0x81BA0; + sys_storage_close( source ); + sys_storage_open( FLASH_NAND, &source ); + } + + u8 *eid4 = Load_from_flash(offset, 0x30, source); + + sys_storage_close( source ); + + return eid4; + + +} + +u8 dump_3Dump() +{ + if( path_info( "/dev_hdd0/tmp/3Dump.bin" ) == _FILE ) { + print_load( "* 3Dump.bin found" ); + return SUCCESS; + } + + if( path_info( "/dev_hdd0/tmp/eid_root_key" ) == _FILE ) { + // todo : check it ! + } else { + if( dump_eid_root_key("/dev_hdd0/tmp/eid_root_key") == FAILED) return FAILED; + } + + int size; + char *erk = LoadFile("/dev_hdd0/tmp/eid_root_key", &size); + if( erk == NULL) { + print_load("Error : dump_3Dump, load eid_root_key"); + return FAILED; + } + + u8 *eid4 = get_eid4(); + if( eid4 == NULL) { + FREE(erk); + return FAILED; + } + + FILE *f; + + f=fopen("/dev_hdd0/tmp/3Dump.bin", "wb"); + if(f==NULL) { + print_load("Error : dump_3Dump, fopen 3Dump.bin"); + FREE(erk); + FREE(eid4); + return FAILED; + } + + fwrite(eid4, 0x30, 1, f); + fwrite(erk, 0x30, 1, f); + fclose(f); + + SetFilePerms("/dev_hdd0/tmp/3Dump.bin"); + + return SUCCESS; +} + +u8 *Load_3Dump() +{ + if( dump_3Dump() == FAILED ) return NULL; + + int size; + + return (u8 *) LoadFile("/dev_hdd0/tmp/3Dump.bin", &size); +} + u8 SetFilePerms(char *path) { if(sysLv2FsChmod(path, FS_S_IFMT | 0777)==0 && sys_fs_chown(path, NO_UID, NO_GID)==0) return SUCCESS; @@ -12587,11 +14164,12 @@ FILE* openSFO(char *path, u32 *start_offset, u32 *size) { FILE* sfo=NULL; - u8 type = get_ext(path); - if(type != _ISO_PS3 && type != _ISO_PSP && type != _JB_PS3 && type != _JB_PSP && type != _SFO) return NULL; + char *ext = get_ext(path); - if(type == _SFO) { + if( strcmp(ext, _ISO_PS3) && strcmp(ext, _ISO_PSP) && strcmp(ext, _JB_PS3) && strcmp(ext, _JB_PSP) && strcasecmp(ext, ".sfo")) return NULL; + + if(!strcasecmp(ext, ".sfo")) { sfo = fopen(path, "rb+"); if(sfo==NULL) return NULL; @@ -12603,7 +14181,7 @@ FILE* openSFO(char *path, u32 *start_offset, u32 *size) return sfo; } else - if(type == _ISO_PS3) { + if(!strcmp(ext, _ISO_PS3)) { sfo = fopen(path, "rb+"); if(sfo==NULL) return NULL; u64 file_offset=0; @@ -12619,7 +14197,7 @@ FILE* openSFO(char *path, u32 *start_offset, u32 *size) return sfo; } else - if(type == _ISO_PSP) { + if(!strcmp(ext, _ISO_PSP)) { sfo = fopen(path, "rb+"); if(sfo==NULL) return NULL; u64 file_offset=0; @@ -12635,7 +14213,7 @@ FILE* openSFO(char *path, u32 *start_offset, u32 *size) return sfo; } else - if(type== _JB_PS3) { + if(!strcmp(ext, _JB_PS3)) { char SFO_path[255]; sprintf(SFO_path, "%s/PS3_GAME/PKGDIR/PARAM.SFO", path); @@ -12653,7 +14231,7 @@ FILE* openSFO(char *path, u32 *start_offset, u32 *size) return sfo; } else - if(type == _JB_PSP) { + if(!strcmp(ext, _JB_PSP)) { char SFO_path[255]; sprintf(SFO_path, "%s/PSP_GAME/PARAM.SFO", path); @@ -12843,10 +14421,9 @@ FILE* openEBOOT(int pos, u32 *start_offset) FILE* eboot=NULL; u8 type = list_game_platform[pos]; - if(type != _ISO_PS3 && type != _ISO_PSP && type != _JB_PS3) type = get_ext(list_game_path[pos]); - if(type != _ISO_PS3 && type != _ISO_PSP && type != _JB_PS3) return FAILED; + if(type != ISO_PS3 && type != JB_PS3) return FAILED; - if(type == _ISO_PS3) { + if(type == ISO_PS3) { eboot = fopen(list_game_path[pos], "rb+"); if(eboot==NULL) return NULL; u64 file_offset=0; @@ -12860,7 +14437,7 @@ FILE* openEBOOT(int pos, u32 *start_offset) return eboot; } else - if(type == _JB_PS3) { + if(type == JB_PS3) { char EBOOT_path[255]; sprintf(EBOOT_path, "%s/PS3_GAME/USRDIR/EBOOT.BIN", list_game_path[pos]); @@ -13319,19 +14896,16 @@ void get_game_update() x=DrawButton(x, y, STR_DL_ALL, BUTTON_SQUARE); } if(nPKG!=-1) { - if(shutdown==YES) { - x=DrawButton(x, y, STR_TURNOFF_YES, BUTTON_SELECT); - } else { - x=DrawButton(x, y, STR_TURNOFF_NO, BUTTON_SELECT); - } + x=DrawButton(x, y, STR_TURNOFF, BUTTON_L1); + x=Draw_checkbox(x-3, y, 0, "", shutdown, YES); } tiny3d_Flip(); ScreenShot(); ps3pad_read(); - if(NewPad(BUTTON_SELECT) && nPKG!=-1) { - if(shutdown==YES) shutdown=NO; else shutdown=YES; + if(NewPad(BUTTON_L1) && nPKG!=-1) { + shutdown= !shutdown; } if(NewPad(BUTTON_UP)) { if(d_position>0) d_position--; @@ -13766,7 +15340,9 @@ void PlugAndPlay_thread(void *unused) // refresh several times because some devices takes times to be mounted sleep(2); if(do_Refresh==NO) do_Refresh = YES; - sleep(2); + sleep(3); + if(do_Refresh==NO) do_Refresh = YES; + sleep(4); if(do_Refresh==NO) do_Refresh = YES; } Old_NumberOfDevice = NumberOfDevice; @@ -13797,6 +15373,10 @@ void end_PlugAndPlay() void AutoRefresh_GAMELIST() { +#ifdef RPCS3 + return; +#endif + if(PlugAndPlay==NO) { start_PlugAndPlay(); return; } if(do_Refresh == NO) return; @@ -13825,7 +15405,7 @@ void AutoRefresh_GAMELIST() getDevices(); if( device_number == device_number_OLD) { print_load("Please wait even more..."); - sleep(2); + sleep(4); getDevices(); } } @@ -14002,9 +15582,9 @@ u8 CheckMD5(char *path) print_head("Checking MD5..."); - u8 platform = get_ext(path); + u8 platform = get_platform(path); - if(platform != _ISO_PS2 && platform != _ISO_PS1) { + if(platform != ISO_PS2 && platform != ISO_PS1) { print_load("Error : this platform isn't supported"); return FAILED; } @@ -14082,7 +15662,7 @@ u32 GetRenaCRC32(char *path) char link[128]; u32 renaCRC = 0; - if( Get_ID(path, _ISO_PSP, game_ID) == FAILED) return 0; + if( Get_ID(path, ISO_PSP, game_ID) == FAILED) return 0; sprintf(link, "http://renascene.com/?target=search1&srchser=1&srch=%s", game_ID); Delete("/dev_hdd0/game/MANAGUNZ0/USRDIR/temp"); @@ -14121,7 +15701,7 @@ u32 GetPSPCRC32(char *path) unsigned int CRC = 0; char CRC_DB[128]; - if( Get_ID(path, _ISO_PSP, game_ID) == FAILED) return 0; + if( Get_ID(path, ISO_PSP, game_ID) == FAILED) return 0; sprintf(CRC_DB, "/dev_hdd0/game/%s/USRDIR/sys/PSP_CRC.txt", ManaGunZ_id); @@ -14503,7 +16083,7 @@ u8 md5_filefromISO(char *path, char *filename, unsigned char output[16]) if(split666) sprintf(iso_path, "%s%02d", temp, i); else sprintf(iso_path, "%s%d", temp, i); - fsize = get_size(iso_path, NO); + fsize = get_size(iso_path); if(file_offset -#include - -#include -#include - -#include -#include - -#include "types.h" -#include "config.h" -#include "aes.h" -#include "util.h" -#include "keys.h" -#include "sce.h" -#include "np.h" -#include "self.h" -#include "rvk.h" -#include "frontend.h" - -/*! Shorter Versions of arg options. */ -#define ARG_NULL no_argument -#define ARG_NONE no_argument -#define ARG_REQ required_argument -#define ARG_OPT optional_argument - -/*! Verbose mode. */ -BOOL _verbose = FALSE; -/*! Raw mode. */ -BOOL _raw = FALSE; - -/*! List keys. */ -//static BOOL _list_keys = FALSE; -/*! Print infos on file. */ -//static BOOL _print_info = FALSE; -/*! Decrypt file. */ -static BOOL _decrypt_file = FALSE; -/*! Encrypt file. */ -static BOOL _encrypt_file = FALSE; - -/*! Parameters. */ -char *_template = NULL; -char *_file_type = NULL; -char *_compress_data = NULL; -char *_skip_sections = NULL; -char *_key_rev = NULL; -char *_meta_info = NULL; -char *_keyset = NULL; -char *_auth_id = NULL; -char *_vendor_id = NULL; -char *_self_type = NULL; -char *_app_version = NULL; -char *_fw_version = NULL; -char *_add_shdrs = NULL; -char *_ctrl_flags = NULL; -char *_cap_flags = NULL; -#ifdef CONFIG_CUSTOM_INDIV_SEED -char *_indiv_seed = NULL; -#endif -char *_license_type = NULL; -char *_app_type = NULL; -char *_content_id = NULL; -char *_klicensee = NULL; -char *_real_fname = NULL; -char *_add_sig = NULL; - int make_EBOOT_NPDRM(char *in, char *out, char *content_id) { _template = NULL; @@ -15418,7 +16932,7 @@ u8 re_sign_EBOOT(char *path) } strcpy(elf, local_path); - RemoveExtention(elf); + RemoveExtension(elf); strcat(elf, ".elf"); if(Extract(local_path, elf)==FAILED) { @@ -15470,7 +16984,7 @@ u8 re_sign_SELF(char *path) } strcpy(elf, local_path); - RemoveExtention(elf); + RemoveExtension(elf); strcat(elf, ".elf"); if(Extract(local_path, elf)==FAILED) { @@ -15522,7 +17036,7 @@ u8 re_sign_SPRX(char *path) } strcpy(prx, local_path); - RemoveExtention(prx); + RemoveExtension(prx); strcat(prx, ".prx"); if(Extract(local_path, prx)==FAILED) { @@ -16793,7 +18307,7 @@ void mount_fake_BR() } } -u8 ISOtype(char *isoPath) +char *ISOtype(char *isoPath) { FILE* f; f = fopen(isoPath, "rb"); @@ -16874,42 +18388,67 @@ u8 ISOtype(char *isoPath) } -u8 is_folder(u8 ext) +u8 is_folder(char *ext) { - if( ext == _DIRECTORY - || ext == _JB_PS3 - || ext == _JB_PS2 - || ext == _JB_PS1 - || ext == _JB_PSP + if( !strcmp(ext, _SDIR) + || !strcmp(ext, _JB_PS3) + || !strcmp(ext, _JB_PS2) + || !strcmp(ext, _JB_PS1) + || !strcmp(ext, _JB_PSP) ) return YES; return NO; } -u8 can_read(u8 ext) +u8 can_read(char *ext) { - if( ext == _TXT - || ext == _XML - || ext == _JS - || ext == _MD5 - || ext == _SHA1 - || ext == _LOG - || ext == _INI - || ext == _NFO - ) return YES; - + int i; + for( i = 0; i < ArrayCount(TXTViewerSupport); i++) { + if( !strcasecmp(ext, TXTViewerSupport[i]) ) return YES; + } return NO; } -u8 get_ext(char *file) +u8 can_view(char *ext) { - char file_name[128]; + int i; + for( i = 0; i < ArrayCount(PictureViewerSupport); i++) { + if( !strcasecmp(ext, PictureViewerSupport[i]) ) return YES; + } + return NO; +} + +u8 get_platform_from_ext(char *ext) +{ + if(!strcmp(ext, _JB_PS3)) return JB_PS3; + if(!strcmp(ext, _JB_PS2)) return JB_PS2; + if(!strcmp(ext, _JB_PS1)) return JB_PS1; + if(!strcmp(ext, _JB_PSP)) return JB_PSP; - u8 is_path=NO; + if(!strcmp(ext, _ISO_PS3)) return ISO_PS3; + if(!strcmp(ext, _ISO_PS2)) return ISO_PS2; + if(!strcmp(ext, _ISO_PS1)) return ISO_PS1; + if(!strcmp(ext, _ISO_PSP)) return ISO_PSP; + + return UNK; +} + +u8 get_platform(char *file) +{ + char *ext = get_ext(file); + + return get_platform_from_ext(ext); +} + +char *get_ext(char *file) +{ + char *file_name; - if(strstr(file, "/")) is_path=YES; + u8 is_path=NO; - if(is_path==YES) { + if(strstr(file, "/")) { + is_path=YES; + if(path_info(file) == _DIRECTORY) { char temp[255]; sprintf(temp, "%s/PS3_GAME/PARAM.SFO", file); @@ -16922,126 +18461,38 @@ u8 get_ext(char *file) f=fopen(temp, "rb"); if(f!=NULL) { fgets(temp, 128, f); - if( strstr(temp, " =") != NULL) strtok(temp, " ="); fclose(f); + + if( strstr(temp, " =") != NULL) strtok(temp, " ="); if(!strcmp(temp, "BOOT2")) return _JB_PS2; else if(!strcmp(temp, "BOOT")) return _JB_PS1; } - return _FILE; } - return _DIRECTORY; + return _SDIR; } - strcpy(file_name, &strrchr(file, '/')[1]); - } else strcpy(file_name, file); + file_name = &strrchr(file, '/')[1]; + } else { + file_name = file; + } - char *ext = GetExtention(file_name); - if(ext==NULL) return _FILE; + char *ext = GetExtension(file_name); + if(ext==NULL) return _SFILE; - if (!strcmp(file_name, "xRegistry.sys")) { + if (!strcmp(file_name, _XREG)) { return _XREG; } else - if (!strcmp(ext, ".66600")) { - return _66600; - } else - if (!strcmp(ext, ".TTF") || !strcmp(ext, ".ttf")) { - return _TTF; - } else - if (!strcmp(ext, ".JPG") || !strcmp(ext, ".jpg")) { - return _JPG; - } else - if (!strcmp(ext, ".PNG") || !strcmp(ext, ".png")) { - return _PNG; - } else - if (!strcmp(ext, ".P3T") || !strcmp(ext, ".p3t")) { - return _P3T; - } else - if (!strcmp(ext, ".THM") || !strcmp(ext, ".thm")) { - return _THM; - } else - if (!strcmp(ext, ".RAF") || !strcmp(ext, ".raf")) { - return _RAF; - } else - if (!strcmp(ext, ".JSX") || !strcmp(ext, ".jsx")) { - return _JSX; - } else - if (!strcmp(ext, ".JS") || !strcmp(ext, ".js")) { - return _JS; - } else - if (!strcmp(ext, ".MD5") || !strcmp(ext, ".md5")) { - return _MD5; - } else - if (!strcmp(ext, ".SHA1") || !strcmp(ext, ".sha1")) { - return _SHA1; - } else - if (!strcmp(ext, ".NFO") || !strcmp(ext, ".nfo")) { - return _NFO; - } else - if (!strcmp(ext, ".LOG") || !strcmp(ext, ".log")) { - return _LOG; - } else - if (!strcmp(ext, ".INI") || !strcmp(ext, ".ini")) { - return _INI; - } else - if (!strcmp(ext, ".VAG") || !strcmp(ext, ".vag")) { - return _VAG; - } else - if (!strcmp(ext, ".QRC") || !strcmp(ext, ".qrc")) { - return _QRC; - } else - if (!strcmp(file_name, "EBOOT.ELF") || !strcmp(file_name, "EBOOT.elf")) { + if (!strcasecmp(file_name, _EBOOT_ELF)) { return _EBOOT_ELF; } else - if (!strcmp(file_name, "EBOOT.BIN")) { + if (!strcasecmp(file_name, _EBOOT_BIN)) { return _EBOOT_BIN; } else - if (!strcmp(ext, ".SELF") || !strcmp(ext, ".self")) { - return _SELF; - } else - if (!strcmp(ext, ".ELF") || !strcmp(ext, ".elf")) { - return _ELF; - } else - if (!strcmp(ext, ".TXT") || !strcmp(ext, ".txt")) { - return _TXT; - } else - if (!strcmp(ext, ".XML") || !strcmp(ext, ".xml")) { - return _XML; - } else - if (!strcmp(ext, ".SPRX") || !strcmp(ext, ".sprx")) { - return _SPRX; - } else - if (!strcmp(ext, ".PRX") || !strcmp(ext, ".prx")) { - return _PRX; - } else - if (!strcmp(ext, ".PKG") || !strcmp(ext, ".pkg")) { - return _PKG; - } else - if (!strcmp(ext, ".TRP") || !strcmp(ext, ".trp")) { - return _TRP; - } else - if (!strcmp(ext, ".SFO") || !strcmp(ext, ".sfo")) { - return _SFO; - } else - if (!strcmp(ext, ".RCO") || !strcmp(ext, ".rco")) { - return _RCO; - } else - if (!strcmp(ext, ".CSO") || !strcmp(ext, ".cso")) { - return _CSO; - } else - if (is_iso(file)==YES) { + if(is_iso(file)==YES) { if(is_path == YES) return ISOtype(file); return _ISO; - } else - if (!strcmp(ext, ".GTF") || !strcmp(ext, ".gtf")) { - return _GTF; - } else - if (!strcmp(ext, ".DDS") || !strcmp(ext, ".dds")) { - return _DDS; - } else - if (!strcmp(ext, ".ZIP") || !strcmp(ext, ".zip")) { - return _ZIP; - } + } - return _FILE; + return ext; } //******************************************************* @@ -17454,14 +18905,12 @@ void add_to_map(char *path1, char *path2) { for(n=0; n=97 && ta[0]<=123) ta[0]-=32; if(tb[0]>=97 && tb[0]<=123) tb[0]-=32; if(window_sort[window_id] == ASC) { - if(strcmp(ta, tb) < 0) min = j; - } else if(strcmp(ta, tb) > 0) min = j; + if(strcasecmp(ta, tb) < 0) min = j; + } else if(strcasecmp(ta, tb) > 0) min = j; } if(min==i) continue; @@ -22136,10 +23586,13 @@ void sort(int window_id) t = list_Dir_sel[min]; list_Dir_sel[min] = list_Dir_sel[i]; list_Dir_sel[i] = t; - - t = list_Dir_type[min]; - list_Dir_type[min] = list_Dir_type[i]; - list_Dir_type[i] = t; + + FREE(ta); + ta = strcpy_malloc(list_Dir_type[min]); + FREE(list_Dir_type[min]); + list_Dir_type[min] = strcpy_malloc(list_Dir_type[i]); + FREE(list_Dir_type[i]); + list_Dir_type[i] = strcpy_malloc(ta); } for (i = 0; i=97 && ta[0]<=123) ta[0]-=32; if(tb[0]>=97 && tb[0]<=123) tb[0]-=32; if(window_sort[window_id] == ASC) { - if(strcmp(ta, tb) < 0) min = j; - } else if(strcmp(ta, tb) > 0) min = j; + if(strcasecmp(ta, tb) < 0) min = j; + } else if(strcasecmp(ta, tb) > 0) min = j; } if(min==i) continue; @@ -22171,10 +23624,13 @@ void sort(int window_id) t1 = list_Fil_siz[min]; list_Fil_siz[min] = list_Fil_siz[i]; list_Fil_siz[i] = t1; - - t = list_Fil_type[min]; - list_Fil_type[min] = list_Fil_type[i]; - list_Fil_type[i] = t; + + FREE(ta); + ta = strcpy_malloc(list_Fil_type[min]); + FREE(list_Fil_type[min]); + list_Fil_type[min] = strcpy_malloc(list_Fil_type[i]); + FREE(list_Fil_type[i]); + list_Fil_type[i] = strcpy_malloc(ta); } FREE(ta); @@ -22188,7 +23644,7 @@ void sort(int window_id) Parent=YES; window_content_Name[window_id][0] = strcpy_malloc(".."); window_content_Selected[window_id][0] = NO; - window_content_Type[window_id][0] = _DIRECTORY; + window_content_Type[window_id][0] = strcpy_malloc(_SDIR); window_content_Size[window_id][0] = 0; } @@ -22196,38 +23652,38 @@ void sort(int window_id) for(j=0; j<=Folder_N; j++) { window_content_Name[window_id][j+Parent] = strcpy_malloc(list_Dir[j]); window_content_Selected[window_id][j+Parent] = list_Dir_sel[j]; - window_content_Type[window_id][j+Parent] = list_Dir_type[j]; + window_content_Type[window_id][j+Parent] = strcpy_malloc(list_Dir_type[j]); window_content_Size[window_id][j+Parent] = 0; } for(j=0; j<=File_N; j++) { window_content_Name[window_id][j+Parent+Folder_N+1] = strcpy_malloc(list_Fil[j]); window_content_Selected[window_id][j+Parent+Folder_N+1] = list_Fil_sel[j]; - window_content_Type[window_id][j+Parent+Folder_N+1] = list_Fil_type[j]; + window_content_Type[window_id][j+Parent+Folder_N+1] = strcpy_malloc(list_Fil_type[j]); window_content_Size[window_id][j+Parent+Folder_N+1] = list_Fil_siz[j]; } } else { for(j=0; j<=File_N; j++) { window_content_Name[window_id][j+Parent] = strcpy_malloc(list_Fil[j]); window_content_Selected[window_id][j+Parent] = list_Fil_sel[j]; - window_content_Type[window_id][j+Parent] = list_Fil_type[j]; + window_content_Type[window_id][j+Parent] = strcpy_malloc(list_Fil_type[j]); window_content_Size[window_id][j+Parent] = list_Fil_siz[j]; } for(j=0; j<=Folder_N; j++) { window_content_Name[window_id][j+Parent+File_N+1] = strcpy_malloc(list_Dir[j]); window_content_Selected[window_id][j+Parent+File_N+1] = list_Dir_sel[j]; - window_content_Type[window_id][j+Parent+File_N+1] = list_Dir_type[j]; + window_content_Type[window_id][j+Parent+File_N+1] = strcpy_malloc(list_Dir_type[j]); window_content_Size[window_id][j+Parent+File_N+1] = 0; } } - free(list_Dir); - free(list_Dir_sel); - free(list_Dir_type); - free(list_Fil); - free(list_Fil_siz); - free(list_Fil_sel); - free(list_Fil_type); + FREE(list_Dir); + FREE(list_Dir_sel); + FREE(list_Dir_type); + FREE(list_Fil); + FREE(list_Fil_siz); + FREE(list_Fil_sel); + FREE(list_Fil_type); } void CloseWindow(int window_id) @@ -22241,6 +23697,7 @@ void CloseWindow(int window_id) for(i=0; id_type & DT_DIR) { - window_content_Type[window_id][window_content_N[window_id]] = _DIRECTORY; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SDIR); if(strcmp(window_path[window_id], "/") == 0) { if(strcmp(dir->d_name, "app_home") == 0 || strcmp(dir->d_name, "dev_bdvd") == 0) { sprintf(temp, "/%s", dir->d_name); - window_content_Type[window_id][window_content_N[window_id]] = get_ext(temp); + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(get_ext(temp)); } } } else if(dir->d_type & DT_REG) { if(strcmp(window_path[window_id], "/") != 0) { sprintf(temp, "%s/%s", window_path[window_id], dir->d_name); - window_content_Size[window_id][window_content_N[window_id]] = get_size(temp, NO); + window_content_Size[window_id][window_content_N[window_id]] = get_size(temp); } - window_content_Type[window_id][window_content_N[window_id]] = get_ext(dir->d_name); + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(get_ext(dir->d_name)); } else { if(strcmp(window_path[window_id], "/") == 0) { @@ -22410,18 +23872,18 @@ void RefreshWindow(window_id) if( can_opendir(temp) ) { window_content_Type[window_id][window_content_N[window_id]] = get_ext(temp); if( is_folder(window_content_Type[window_id][window_content_N[window_id]]) == NO) { - window_content_Type[window_id][window_content_N[window_id]] = _DIRECTORY; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SDIR); } } else { - window_content_Type[window_id][window_content_N[window_id]] = _FILE; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SFILE); } } else { sprintf(temp, "%s/%s", window_path[window_id], dir->d_name); if( can_opendir(temp) ) { - window_content_Type[window_id][window_content_N[window_id]] = _DIRECTORY; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SDIR); } else { - window_content_Size[window_id][window_content_N[window_id]] = get_size(temp, NO); - window_content_Type[window_id][window_content_N[window_id]] = get_ext(dir->d_name); + window_content_Size[window_id][window_content_N[window_id]] = get_size(temp); + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(get_ext(dir->d_name)); } } } @@ -22437,14 +23899,14 @@ void RefreshWindow(window_id) n = NTFS_Test_Device(temp); if(n>=0) { window_content_N[window_id]++; - window_content_Type[window_id][window_content_N[window_id]]= _DIRECTORY; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SDIR); sprintf(temp, "ntfs%c:", 48+i); window_content_Name[window_id][window_content_N[window_id]] = strcpy_malloc(temp); } } } else { window_content_N[window_id]++; - window_content_Type[window_id][window_content_N[window_id]]= _DIRECTORY; + window_content_Type[window_id][window_content_N[window_id]] = strcpy_malloc(_SDIR); window_content_Name[window_id][window_content_N[window_id]] = strcpy_malloc(".."); } @@ -22485,7 +23947,7 @@ void Window(char *directory) int n; for(n=0; n (float) PROP_W - (float) PROP_COL_W - (float) 10.0f) { - PROP_ITEM_VALUE[PROP_ITEM_NUMBER][l-1]=0; - PROP_ITEM_VALUE[PROP_ITEM_NUMBER][l-2]='.'; - PROP_ITEM_VALUE[PROP_ITEM_NUMBER][l-3]='.'; - PROP_ITEM_VALUE[PROP_ITEM_NUMBER][l-4]='.'; - l--; - } -*/ - PROP_ITEM_NUMBER++; - PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc(STR_TYPE); - if(is_dir == YES && is_fil == YES) { - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = strcpy_malloc(STR_MULT); - } else - if(is_dir == YES) { - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = strcpy_malloc(STR_DIR); - } else - if(is_fil == YES) { - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = strcpy_malloc(STR_FILE); + if( 0 < gathering_nb_directory ) { + PROP_ITEM_NUMBER++; + PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc(STR_DIR); + PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%d", gathering_nb_directory); } - - if(nb_directory!=0 && nb_file!=1) { + if(0 < gathering_nb_file) { PROP_ITEM_NUMBER++; PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc(STR_FILE); - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%d", nb_file); - - PROP_ITEM_NUMBER++; - PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc(STR_FOLDER); - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%d", nb_directory); + PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%d", gathering_nb_file); } - + PROP_ITEM_NUMBER++; PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc(STR_SIZE); - char *prop_size_str = get_unit(total_size); - if(total_size<1024) { + char *prop_size_str = get_unit(gathering_total_size); + if(gathering_total_size<1024) { PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = strcpy_malloc(prop_size_str); } else { - PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%s (%llu %s)", prop_size_str, (long long unsigned int) total_size, STR_UNIT); + PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%s (%llu %s)", prop_size_str, (long long unsigned int) gathering_total_size, STR_UNIT); } free(prop_size_str); - if(option_sel_N == 0 && is_fil == YES) { + if(option_sel_N == 0 && gathering_nb_file == 1) { u64 prop_md5[2]; if( md5_file(option_sel[0], (u8 *) prop_md5) == SUCCESS) { PROP_ITEM_NUMBER++; @@ -22719,18 +24145,15 @@ void open_properties() PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%016llX%016llX", (long long unsigned int) prop_md5[0], (long long unsigned int) prop_md5[1]); } - + /* u32 prop_sha1[5]; if( sha1_file(option_sel[0], (u8 *) prop_sha1) == SUCCESS) { PROP_ITEM_NUMBER++; PROP_ITEM[PROP_ITEM_NUMBER] = strcpy_malloc("SHA-1"); PROP_ITEM_VALUE[PROP_ITEM_NUMBER] = sprintf_malloc("%08lX%08lX%08lX%08lX%08lX ", (long unsigned int) prop_sha1[0], (long unsigned int) prop_sha1[1], (long unsigned int) prop_sha1[2], (long unsigned int) prop_sha1[3], (long unsigned int) prop_sha1[4]); - } + } + */ } - - total_size=0; - nb_file= 0; - nb_directory=0; prop_activ = YES; @@ -22748,7 +24171,7 @@ void picture_viewer_input() int flag=NO, i; for(i=0; i<=window_content_N[window_activ]; i++) { if(flag==YES) { - if(window_content_Type[window_activ][i] == _JPG || window_content_Type[window_activ][i] == _PNG) { + if( can_view( window_content_Type[window_activ][i]) ) { sprintf(TMP_PIC_path, "%s/%s", window_path[window_activ], window_content_Name[window_activ][i]); Load_FM(); break; @@ -22763,7 +24186,7 @@ void picture_viewer_input() int flag=NO, i; for(i=window_content_N[window_activ]; i>0; i--) { if(flag==YES) { - if(window_content_Type[window_activ][i] == _JPG || window_content_Type[window_activ][i] == _PNG) { + if( can_view(window_content_Type[window_activ][i]) ) { sprintf(TMP_PIC_path, "%s/%s", window_path[window_activ], window_content_Name[window_activ][i]); Load_FM(); break; @@ -22812,6 +24235,10 @@ void Draw_picture_viewer() yi = (512 - hi) / 2; Draw_Box(xi, yi, 0, 0, wi, hi, WHITE, YES); + + //DrawTXTInBox(30, 30, 0, 200, 450, picture_viewer_info, 0, WHITE); + + } Draw_Box(0, 460, 0, 0, 848, 20, BLACK, NO); @@ -23344,7 +24771,7 @@ void Option(char *item) } else { window_content_N[window_activ]++; window_content_Size[window_activ][window_content_N[window_activ]] = 0; - window_content_Type[window_activ][window_content_N[window_activ]] = _DIRECTORY; + window_content_Type[window_activ][window_content_N[window_activ]] = strcpy_malloc(_SDIR); window_content_Name[window_activ][window_content_N[window_activ]] = strcpy_malloc(&strrchr(temp, '/')[1]); sort(window_activ); } @@ -23364,16 +24791,21 @@ void Option(char *item) fclose(f); window_content_N[window_activ]++; window_content_Size[window_activ][window_content_N[window_activ]] = 0; - window_content_Type[window_activ][window_content_N[window_activ]] = _FILE; + window_content_Type[window_activ][window_content_N[window_activ]] = strcpy_malloc(_SFILE); window_content_Name[window_activ][window_content_N[window_activ]] = strcpy_malloc(&strrchr(temp, '/')[1]); sort(window_activ); } } else if(strcmp(item, "Test") == 0) { start_loading(); - // + DumpDevicesData(); end_loading(); } else + if(strcmp(item, "Test2") == 0) { + start_copy_loading(); + dump_dec_bdvd("/dev_hdd0/tmp/bdvd.iso"); + end_copy_loading(); + } else if(strcmp(item, STR_SYMLINK_SRC) == 0) { FREE(FM_OLD_PATH); FM_OLD_PATH = strcpy_malloc(option_sel[0]); @@ -23389,22 +24821,27 @@ void Option(char *item) if(mamba) show_msg(STR_DONE); } else if(strcmp(item, STR_PASTE) == 0) { - start_copy_loading(); + if(option_copy_N==0 && is_66600(option_copy[0])) { - gathering=YES; + start_gathering(); strcpy(copy_src, option_copy[0]); sprintf(copy_dst, "%s%s", window_path[window_activ], strrchr(copy_src, '/')); Get_Game_Size(option_copy[0]); - gathering=NO; + end_gathering(); + + start_copy_loading(); CopyJoin(copy_src, copy_dst); + end_copy_loading(); } else { - gathering=YES; + start_gathering(); for(i=0; i<=option_copy_N; i++){ - get_size(option_copy[i], YES); + get_size(option_copy[i]); } - gathering=NO; + end_gathering(); + + start_copy_loading(); for(i=0; i<=option_copy_N; i++) { strcpy(copy_src, option_copy[i]); sprintf(copy_dst, "%s%s", window_path[window_activ], strrchr(copy_src, '/')); @@ -23415,24 +24852,27 @@ void Option(char *item) Copy(copy_src, copy_dst); } } + end_copy_loading(); } for(i=0; i0) window_scroll_P[window_activ]--; + if(window_scroll_P[window_activ] > window_item_N[window_activ] ) window_scroll_P[window_activ]-=window_item_N[window_activ]; + else window_scroll_P[window_activ]=0; } } } @@ -26037,7 +27478,7 @@ u8 *LoadMEMfromISO(char *iso_file, u32 sector, u32 offset, u32 size) if(split666) sprintf(iso_path, "%s%02d", temp, i); else sprintf(iso_path, "%s%d", temp, i); - fsize = get_size(iso_path, NO); + fsize = get_size(iso_path); if(iso_offsetd_type & DT_DIR) GetPlugins(temp); - if(get_ext(dir->d_name) != _SPRX) continue; + if(strcasecmp(get_ext(dir->d_name), ".sprx")) continue; if(ITEMS_NUMBER==MENU_MAX_ITEMS-1) break; @@ -31948,11 +33368,15 @@ void init_SETTINGS() } } + /* add_title_MENU("System"); add_item_MENU("Logging", ITEM_TOGGLE); ITEMS_VALUE_POSITION[ITEMS_NUMBER] = LOG; + add_item_MENU("Debugging", ITEM_TOGGLE); + ITEMS_VALUE_POSITION[ITEMS_NUMBER] = DEBUG; + add_item_MENU("Dump eid_root_key", ITEM_TEXTBOX); add_item_MENU("Dump BD keys", ITEM_TEXTBOX); @@ -31964,7 +33388,7 @@ void init_SETTINGS() add_item_MENU(STR_DUMP_LV2, ITEM_TEXTBOX); add_item_MENU(STR_DUMP_FLASH, ITEM_TEXTBOX); - + */ } void update_SETTINGS() @@ -31972,6 +33396,9 @@ void update_SETTINGS() if(item_is("Logging")) { LOG = ITEMS_VALUE_POSITION[ITEMS_POSITION]; } else + if(item_is("Debugging")) { + DEBUG = ITEMS_VALUE_POSITION[ITEMS_POSITION]; + } else if(item_is(STR_FONT)) { if(strcmp(Font, FontPath[ITEMS_VALUE_POSITION[ITEMS_POSITION]]) != 0) { if(Load_GAMEPIC_busy) show_msg("Try Later"); @@ -32193,8 +33620,7 @@ void update_SETTINGS() init_SETTINGS(); } } - } - + } } u8 SETTING_R1() @@ -32225,37 +33651,45 @@ u8 SETTING_R1() return SUCCESS; } - + u8 SETTINGS_CROSS() { if(item_is(STR_DUMP_LV1)) { start_loading(); - dump_lv1("/dev_hdd0/LV1.BIN"); + dump_lv1("/dev_hdd0"); end_loading(); } else if(item_is(STR_DUMP_LV2)) { start_loading(); - dump_lv2("/dev_hdd0/LV2.BIN"); + dump_lv2("/dev_hdd0"); end_loading(); } else if(item_is(STR_DUMP_FLASH)) { start_loading(); - dump_flash("/dev_hdd0/FLASH.BIN"); + dump_flash("/dev_hdd0"); end_loading(); } else if(item_is("Dump BD keys")) { start_loading(); - Dump_BD_keys(); + u8 ret = Dump_BD_keys(); end_loading(); + if( ret == SUCCESS ) show_msg(STR_DONE); + else show_msg(STR_FAILED); } else if(item_is("Dump eid_root_key")) { start_loading(); mkdir("/dev_hdd0/tmp", 0777); - dump_eid_root_key("/dev_hdd0/tmp/eid_root_key"); + u8 ret = dump_eid_root_key("/dev_hdd0/tmp/eid_root_key"); end_loading(); + if( ret == SUCCESS ) show_msg(STR_DONE); + else show_msg(STR_FAILED); } else if(item_is("Dump 3Dump.bin")) { - show_msg("todo"); + start_loading(); + u8 ret = dump_3Dump(); + end_loading(); + if( ret == SUCCESS ) show_msg(STR_DONE); + else show_msg(STR_FAILED); } else if(item_is(STR_ADJUST)) { Draw_AdjustScreen(); @@ -32754,7 +34188,7 @@ void AutoMount() position=0; GetParamSFO("TITLE", list_game_title[0], 0, NULL); - list_game_platform[0] = get_ext(list_game_path[0]); + list_game_platform[0] = get_platform(list_game_path[0]); iso = is_iso(list_game_path[0]); usb = is_usb(list_game_path[0]); @@ -35656,7 +37090,7 @@ void Draw_FLOW_3D() if(0<=TextSlot) PICType = Get_PICType(GAMEPIC[TextSlot].width, GAMEPIC[TextSlot].height); - if( list_game_platform[i] == _ISO_PS3 || list_game_platform[i] == _JB_PS3 ) { + if( list_game_platform[i] == ISO_PS3 || list_game_platform[i] == JB_PS3 ) { // texture if(PICTURE_offset[BR_LOGO]) tiny3d_SetTexture(0, PICTURE_offset[BR_LOGO], PICTURE[BR_LOGO].width, PICTURE[BR_LOGO].height, PICTURE[BR_LOGO].pitch, TINY3D_TEX_FORMAT_A8R8G8B8, TEXTURE_LINEAR); @@ -35691,7 +37125,7 @@ void Draw_FLOW_3D() } } else - if( list_game_platform[i] == _ISO_PS2 || list_game_platform[i] == _JB_PS2 ) { + if( list_game_platform[i] == ISO_PS2 || list_game_platform[i] == JB_PS2 ) { // material tiny3d_EmissiveMaterial(0.0f, 0.0f, 0.0f, 0.0f); // r,g,b,unused tiny3d_AmbientMaterial( 0.1f, 0.1f, 0.1f, 1.0f); // r,g,b,a @@ -35722,7 +37156,7 @@ void Draw_FLOW_3D() } } } else - if( list_game_platform[i] == _ISO_PS1 || list_game_platform[i] == _JB_PS1 ) { + if( list_game_platform[i] == ISO_PS1 || list_game_platform[i] == JB_PS1 ) { // texture if(PICTURE_offset[PS_LOGO]) tiny3d_SetTexture(0, PICTURE_offset[PS_LOGO], PICTURE[PS_LOGO].width, PICTURE[PS_LOGO].height, PICTURE[PS_LOGO].pitch, TINY3D_TEX_FORMAT_A8R8G8B8, TEXTURE_LINEAR); @@ -35769,7 +37203,7 @@ void Draw_FLOW_3D() } } } else - if( list_game_platform[i] == _ISO_PSP || list_game_platform[i] == _JB_PSP ) { + if( list_game_platform[i] == ISO_PSP || list_game_platform[i] == JB_PSP ) { // material tiny3d_EmissiveMaterial(0.0f, 0.0f, 0.0f, 0.0f); // r,g,b,unused tiny3d_AmbientMaterial( 0.3f, 0.3f, 0.3f, 1.0f); // r,g,b,a @@ -35878,10 +37312,10 @@ void init_XMB() for(i = 0 ; i <= game_number ; i++) { if(XMB_H_position==XMB_COLUMN_SETTINGS) continue; - if(XMB_H_position==XMB_COLUMN_PS3 && (list_game_platform[i] !=_ISO_PS3 && list_game_platform[i] !=_JB_PS3)) continue; - if(XMB_H_position==XMB_COLUMN_PS2 && (list_game_platform[i] !=_ISO_PS2 && list_game_platform[i] !=_JB_PS2)) continue; - if(XMB_H_position==XMB_COLUMN_PS1 && (list_game_platform[i] !=_ISO_PS1 && list_game_platform[i] !=_JB_PS1)) continue; - if(XMB_H_position==XMB_COLUMN_PSP && (list_game_platform[i] !=_ISO_PSP && list_game_platform[i] !=_JB_PSP)) continue; + if(XMB_H_position==XMB_COLUMN_PS3 && (list_game_platform[i] != ISO_PS3 && list_game_platform[i] != JB_PS3)) continue; + if(XMB_H_position==XMB_COLUMN_PS2 && (list_game_platform[i] != ISO_PS2 && list_game_platform[i] != JB_PS2)) continue; + if(XMB_H_position==XMB_COLUMN_PS1 && (list_game_platform[i] != ISO_PS1 && list_game_platform[i] != JB_PS1)) continue; + if(XMB_H_position==XMB_COLUMN_PSP && (list_game_platform[i] != ISO_PSP && list_game_platform[i] != JB_PSP)) continue; if(XMB_H_position==XMB_COLUMN_FAVORITES && is_favorite(list_game_path[i]) == NO) continue; XMB_nb_line++; @@ -36557,16 +37991,16 @@ void Draw_MAIN_input() FontColor(COLOR_1); - if(list_game_platform[position] == _ISO_PS3 || list_game_platform[position] == _JB_PS3) { + if(list_game_platform[position] == ISO_PS3 || list_game_platform[position] == JB_PS3) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "PS3"); } else - if(list_game_platform[position] == _ISO_PS2 || list_game_platform[position] == _JB_PS2) { + if(list_game_platform[position] == ISO_PS2 || list_game_platform[position] == JB_PS2) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "PS2"); } else - if(list_game_platform[position] == _ISO_PS1 || list_game_platform[position] == _JB_PS1) { + if(list_game_platform[position] == ISO_PS1 || list_game_platform[position] == JB_PS1) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "PS1"); } else - if(list_game_platform[position] == _ISO_PSP || list_game_platform[position] == _JB_PSP) { + if(list_game_platform[position] == ISO_PSP || list_game_platform[position] == JB_PSP) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "PSP"); } else { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "UNK"); @@ -36574,31 +38008,21 @@ void Draw_MAIN_input() float x1 = x; - char *Ext = GetExtention(list_game_path[position]); + char *Ext = GetExtension(list_game_path[position]); - if( (Ext[1] == 'I' || Ext[1] == 'i') - && (Ext[2] == 'S' || Ext[2] == 's') - && (Ext[3] == 'O' || Ext[3] == 'o') ) { + if( !strncasecmp(Ext, ".iso", 4) ) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "ISO"); } else - if( (Ext[1] == 'B' || Ext[1] == 'b') - && (Ext[2] == 'I' || Ext[2] == 'i') - && (Ext[3] == 'N' || Ext[3] == 'n') ) { + if( !strncasecmp(Ext, ".bin", 4) ) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "BIN"); } else - if( (Ext[1] == 'M' || Ext[1] == 'm') - && (Ext[2] == 'D' || Ext[2] == 'd') - && (Ext[3] == 'F' || Ext[3] == 'f') ) { + if( !strncasecmp(Ext, ".mdf", 4) ) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "MDF"); } else - if( (Ext[1] == 'I' || Ext[1] == 'i') - && (Ext[2] == 'M' || Ext[2] == 'm') - && (Ext[3] == 'G' || Ext[3] == 'g') ) { + if( !strncasecmp(Ext, ".img", 4) ) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "IMG"); } else - if( (Ext[1] == 'C' || Ext[1] == 'c') - && (Ext[2] == 'S' || Ext[2] == 's') - && (Ext[3] == 'O' || Ext[3] == 'o') ) { + if( !strncasecmp(Ext, ".cso", 4) ) { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "CSO"); } else { x = DrawTAG(x, y, 0, tagbox_min_width, INPUT_SIZE, "JB"); @@ -36727,10 +38151,10 @@ u8 Show_it(int pos) { if(pos<0 || game_number +#include +#include +#include "makepng.h" + +u8 make_png(char *outfile, imgData data) +{ + FILE *fp = fopen(outfile, "wb"); + if(!fp) return FAILED; + + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png_ptr){ + fclose(fp); + return FAILED; + } + + png_infop info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) { + png_destroy_write_struct(&png_ptr, (png_infopp)NULL); + fclose(fp); + return FAILED; + } + + if (setjmp(png_jmpbuf(png_ptr))) { + png_destroy_write_struct(&png_ptr, &info_ptr); + fclose(fp); + return FAILED; + } + + png_init_io(png_ptr, fp); + + png_set_IHDR(png_ptr, info_ptr, data.width, data.height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + png_write_info(png_ptr, info_ptr); + + png_bytep *row_pointers = (png_bytep *) malloc( sizeof(png_bytep) * data.height); + int i,j; + for(i = 0; i < data.height; i++) { + row_pointers[i] = (png_byte*) malloc(sizeof(png_byte) * data.width * 4); + for(j = 0; j < data.width; j++) { + u8 ARGB[4] = {0}; + memcpy(&ARGB, data.bmp_out + i*data.width*4 + j*4, 4); + + row_pointers[i][0+4*j] = ARGB[1]; + row_pointers[i][1+4*j] = ARGB[2]; + row_pointers[i][2+4*j] = ARGB[3]; + row_pointers[i][3+4*j] = ARGB[0]; + } + } + + png_write_image(png_ptr, row_pointers); + + png_write_end(png_ptr, NULL); + + for (i = 0; i < data.height; i++) { + free(row_pointers[i]); + } + free(row_pointers); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + fclose(fp); + + return SUCCESS; +} \ No newline at end of file diff --git a/MGZ/source/makepng.h b/MGZ/source/makepng.h new file mode 100644 index 00000000..d097534d --- /dev/null +++ b/MGZ/source/makepng.h @@ -0,0 +1,18 @@ +#ifndef MAKEPNG_H +#define MAKEPNG_H + +#define FAILED 0 +#define SUCCESS 1 + +typedef struct +{ + void *bmp_out; + + u32 pitch; + u32 width; + u32 height; +} imgData; + +u8 make_png(char *outfile, imgData data); + +#endif diff --git a/MGZ/source/ps2crc.h b/MGZ/source/ps2crc.h index 59377f8c..63a68c3d 100644 --- a/MGZ/source/ps2crc.h +++ b/MGZ/source/ps2crc.h @@ -45,6 +45,7 @@ #define CRC32HWEMU_484C 0x163D378B #define CRC32HWEMU_484D 0x36557E04 #define CRC32HWEMU_485C 0xCB43BF29 +#define CRC32HWEMU_486C 0x9253640A #define CRC32GXEMU_421C 0xE031E18E #define CRC32GXEMU_421D 0x513B3FD1 @@ -88,6 +89,7 @@ #define CRC32GXEMU_484C 0x9C1D118B #define CRC32GXEMU_484D 0x0B47F5DA #define CRC32GXEMU_485C 0x9C1D118B +#define CRC32GXEMU_486C 0x9C1D118B #define CRC32NETEMU_421C 0x6CCC9066 #define CRC32NETEMU_421D 0x4EBC5CFC @@ -131,5 +133,6 @@ #define CRC32NETEMU_484C 0x93E0EB0B #define CRC32NETEMU_484D 0x8D7C6589 #define CRC32NETEMU_485C 0x93E0EB0B +#define CRC32NETEMU_486C 0x93E0EB0B #endif /* __PS2CRC_H__ */ diff --git a/MGZ/source/ps2data.h b/MGZ/source/ps2data.h index 6186f8ec..24cbad9d 100644 --- a/MGZ/source/ps2data.h +++ b/MGZ/source/ps2data.h @@ -255,5 +255,11 @@ #include "ps2gxemu_stage2_485C_bin.h" #include "ps2netemu_stage2_485C_bin.h" +#include "ps2hwemu_stage1_486C_bin.h" +#include "ps2hwemu_stage2_486C_bin.h" +#include "ps2gxemu_stage1_486C_bin.h" +#include "ps2gxemu_stage2_486C_bin.h" +#include "ps2netemu_stage2_486C_bin.h" + #endif /* __PS2DATA_H__ */ diff --git a/MGZ/source/ps2vers.c b/MGZ/source/ps2vers.c index e5f488b9..4d545d0c 100644 --- a/MGZ/source/ps2vers.c +++ b/MGZ/source/ps2vers.c @@ -258,6 +258,12 @@ u8 get_hwemu(u32 crc, u8 **stage1, u32 *stage1_size, u8 **stage2, u32 *stage2_si *stage1 = (uint8_t *) ps2hwemu_stage1_485C_bin; *stage2_size = (uint32_t) ps2hwemu_stage2_485C_bin_size; *stage2 = (uint8_t *) ps2hwemu_stage2_485C_bin; + } else + if(crc == CRC32HWEMU_486C) { + *stage1_size = (uint32_t) ps2hwemu_stage1_486C_bin_size; + *stage1 = (uint8_t *) ps2hwemu_stage1_486C_bin; + *stage2_size = (uint32_t) ps2hwemu_stage2_486C_bin_size; + *stage2 = (uint8_t *) ps2hwemu_stage2_486C_bin; } else return FAILED; return SUCCESS; @@ -517,6 +523,12 @@ u8 get_gxemu(u32 crc, u8 **stage1, u32 *stage1_size, u8 **stage2, u32 *stage2_si *stage1 = (uint8_t *) ps2gxemu_stage1_485C_bin; *stage2_size = (uint32_t) ps2gxemu_stage2_485C_bin_size; *stage2 = (uint8_t *) ps2gxemu_stage2_485C_bin; + } else + if(crc == CRC32GXEMU_486C) { + *stage1_size = (uint32_t) ps2gxemu_stage1_486C_bin_size; + *stage1 = (uint8_t *) ps2gxemu_stage1_486C_bin; + *stage2_size = (uint32_t) ps2gxemu_stage2_486C_bin_size; + *stage2 = (uint8_t *) ps2gxemu_stage2_486C_bin; } else return FAILED; return SUCCESS; @@ -693,6 +705,10 @@ u8 get_netemu(u32 crc, u8 **stage2, u32 *stage2_size) if(crc == CRC32NETEMU_485C) { *stage2_size = (uint32_t) ps2netemu_stage2_485C_bin_size; *stage2 = (uint8_t *) ps2netemu_stage2_485C_bin; + } else + if(crc == CRC32NETEMU_486C) { + *stage2_size = (uint32_t) ps2netemu_stage2_486C_bin_size; + *stage2 = (uint8_t *) ps2netemu_stage2_486C_bin; } else return FAILED; return SUCCESS; diff --git a/MGZ/source/svpng.inc b/MGZ/source/svpng.inc new file mode 100644 index 00000000..deaa64d9 --- /dev/null +++ b/MGZ/source/svpng.inc @@ -0,0 +1,113 @@ +/* +Copyright (C) 2017 Milo Yip. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of pngout nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/*! \file + \brief svpng() is a minimalistic C function for saving RGB/RGBA image into uncompressed PNG. + \author Milo Yip + \version 0.1.1 + \copyright MIT license + \sa http://github.com/miloyip/svpng +*/ + +#ifndef SVPNG_INC_ +#define SVPNG_INC_ + +/*! \def SVPNG_LINKAGE + \brief User customizable linkage for svpng() function. + By default this macro is empty. + User may define this macro as static for static linkage, + and/or inline in C99/C++, etc. +*/ +#ifndef SVPNG_LINKAGE +#define SVPNG_LINKAGE +#endif + +/*! \def SVPNG_OUTPUT + \brief User customizable output stream. + By default, it uses C file descriptor and fputc() to output bytes. + In C++, for example, user may use std::ostream or std::vector instead. +*/ +#ifndef SVPNG_OUTPUT +#include +#define SVPNG_OUTPUT FILE* fp +#endif + +/*! \def SVPNG_PUT + \brief Write a byte +*/ +#ifndef SVPNG_PUT +#define SVPNG_PUT(u) fputc(u, fp) +#endif + + +/*! + \brief Save a RGB/RGBA image in PNG format. + \param SVPNG_OUTPUT Output stream (by default using file descriptor). + \param w Width of the image. (<16383) + \param h Height of the image. + \param img Image pixel data in 24-bit RGB or 32-bit RGBA format. + \param alpha Whether the image contains alpha channel. +*/ +SVPNG_LINKAGE void svpng(SVPNG_OUTPUT, unsigned w, unsigned h, const unsigned char* img, int alpha) { + static const unsigned t[] = { 0, 0x1db71064, 0x3b6e20c8, 0x26d930ac, 0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c, + /* CRC32 Table */ 0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c, 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c }; + unsigned a = 1, b = 0, c, p = w * (alpha ? 4 : 3) + 1, x, y, i; /* ADLER-a, ADLER-b, CRC, pitch */ + unsigned char alp, z = 0; +#define SVPNG_U8A(ua, l) for (i = 0; i < l; i++) SVPNG_PUT((ua)[i]); +#define SVPNG_U32(u) do { SVPNG_PUT((u) >> 24); SVPNG_PUT(((u) >> 16) & 255); SVPNG_PUT(((u) >> 8) & 255); SVPNG_PUT((u) & 255); } while(0) +#define SVPNG_U8C(u) do { SVPNG_PUT(u); c ^= (u); c = (c >> 4) ^ t[c & 15]; c = (c >> 4) ^ t[c & 15]; } while(0) +#define SVPNG_U8AC(ua, l) for (i = 0; i < l; i++) SVPNG_U8C((ua)[i]) +#define SVPNG_U16LC(u) do { SVPNG_U8C((u) & 255); SVPNG_U8C(((u) >> 8) & 255); } while(0) +#define SVPNG_U32C(u) do { SVPNG_U8C((u) >> 24); SVPNG_U8C(((u) >> 16) & 255); SVPNG_U8C(((u) >> 8) & 255); SVPNG_U8C((u) & 255); } while(0) +#define SVPNG_U8ADLER(u) do { SVPNG_U8C(u); a = (a + (u)) % 65521; b = (b + a) % 65521; } while(0) +#define SVPNG_BEGIN(s, l) do { SVPNG_U32(l); c = ~0U; SVPNG_U8AC(s, 4); } while(0) +#define SVPNG_END() SVPNG_U32(~c) + SVPNG_U8A("\x89PNG\r\n\32\n", 8); /* Magic */ + SVPNG_BEGIN("IHDR", 13); /* IHDR chunk { */ + SVPNG_U32C(w); SVPNG_U32C(h); /* Width & Height (8 bytes) */ + SVPNG_U8C(8); SVPNG_U8C(alpha ? 6 : 2); /* Depth=8, Color=True color with/without alpha (2 bytes) */ + SVPNG_U8AC("\0\0\0", 3); /* Compression=Deflate, Filter=No, Interlace=No (3 bytes) */ + SVPNG_END(); /* } */ + SVPNG_BEGIN("IDAT", 2 + h * (5 + p) + 4); /* IDAT chunk { */ + SVPNG_U8AC("\x78\1", 2); /* Deflate block begin (2 bytes) */ + for (y = 0; y < h; y++) { /* Each horizontal line makes a block for simplicity */ + SVPNG_U8C(y == h - 1); /* 1 for the last block, 0 for others (1 byte) */ + SVPNG_U16LC(p); SVPNG_U16LC(~p); /* Size of block in little endian and its 1's complement (4 bytes) */ + SVPNG_U8ADLER(0); /* No filter prefix (1 byte) */ + for (x = 0; x < p - 1; x++, img++) { + if (!z) alp = *img++; + SVPNG_U8ADLER(*img); /* Image pixel data */ + if (++z == 3) { + z = 0; + if (alpha) { SVPNG_U8ADLER(alp); x++; } + } + } + } + SVPNG_U32C((b << 16) | a); /* Deflate block end with adler (4 bytes) */ + SVPNG_END(); /* } */ + SVPNG_BEGIN("IEND", 0); SVPNG_END(); /* IEND chunk {} */ +} + +#endif /* SVPNG_INC_ */ + diff --git a/MGZ/source/tga_reader.c b/MGZ/source/tga_reader.c new file mode 100644 index 00000000..c7dc4ef4 --- /dev/null +++ b/MGZ/source/tga_reader.c @@ -0,0 +1,573 @@ +/** + * tga_reader.c + * + * Copyright (c) 2014 Kenji Sasaki + * Released under the MIT license. + * https://github.com/npedotnet/TGAReader/blob/master/LICENSE + * + * English document + * https://github.com/npedotnet/TGAReader/blob/master/README.md + * + * Japanese document + * http://3dtech.jp/wiki/index.php?TGAReader + * + */ + +#include "tga_reader.h" + +static const TGA_ORDER _TGA_READER_ARGB = {16, 8, 0, 24}; +const TGA_ORDER *TGA_READER_ARGB = &_TGA_READER_ARGB; + +static const TGA_ORDER _TGA_READER_ABGR = {0, 8, 16, 24}; +const TGA_ORDER *TGA_READER_ABGR = &_TGA_READER_ABGR; + +void *tgaMalloc(size_t size) { + return malloc(size); +} + +void tgaFree(void *memory) { + free(memory); +} + +int tgaGetWidth(const unsigned char *buffer) { + return (buffer[12] & 0xFF) | (buffer[13] & 0xFF) << 8; +} + +int tgaGetHeight(const unsigned char *buffer) { + return (buffer[14] & 0xFF) | (buffer[15] & 0xFF) << 8; +} + +#define COLORMAP 1 +#define RGB 2 +#define GRAYSCALE 3 +#define COLORMAP_RLE 9 +#define RGB_RLE 10 +#define GRAYSCALE_RLE 11 +#define RIGHT_ORIGIN 0x10 +#define UPPER_ORIGIN 0x20 + +static unsigned char *decodeRLE(int width, int height, int depth, const unsigned char *buffer, int offset); + +static int *createPixelsFromColormap(int width, int height, int depth, const unsigned char *bytes, int offset, const unsigned char *palette, int colormapOrigin, int descriptor, const TGA_ORDER *order); +static int *createPixelsFromRGB(int width, int height, int depth, const unsigned char *bytes, int offset, int descriptor, const TGA_ORDER *order); +static int *createPixelsFromGrayscale(int width, int height, int depth, const unsigned char *bytes, int offset, int descriptor, const TGA_ORDER *order); + +int *tgaRead(const unsigned char *buffer, const TGA_ORDER *order) { + + // header +// int idFieldLength = buffer[0] & 0xFF; +// int colormapType = buffer[1] & 0xFF; + int type = buffer[2] & 0xFF; + int colormapOrigin = (buffer[3] & 0xFF) | (buffer[4] & 0xFF) << 8; + int colormapLength = (buffer[5] & 0xFF) | (buffer[6] & 0xFF) << 8; + int colormapDepth = buffer[7] & 0xFF; +// int originX = (buffer[8] & 0xFF) | (buffer[9] & 0xFF) << 8; // unsupported +// int originY = (buffer[10] & 0xFF) | (buffer[11] & 0xFF) << 8; // unsupported + int width = tgaGetWidth(buffer); + int height = tgaGetHeight(buffer); + int depth = buffer[16] & 0xFF; + int descriptor = buffer[17] & 0xFF; + + int *pixels = NULL; + + // data + switch(type) { + case COLORMAP: { + int imageDataOffset = 18 + (colormapDepth / 8) * colormapLength; + pixels = createPixelsFromColormap(width, height, colormapDepth, buffer, imageDataOffset, buffer, colormapOrigin, descriptor, order); + } break; + case RGB: + pixels = createPixelsFromRGB(width, height, depth, buffer, 18, descriptor, order); + break; + case GRAYSCALE: + pixels = createPixelsFromGrayscale(width, height, depth, buffer, 18, descriptor, order); + break; + case COLORMAP_RLE: { + int imageDataOffset = 18 + (colormapDepth / 8) * colormapLength; + unsigned char *decodeBuffer = decodeRLE(width, height, depth, buffer, imageDataOffset); + pixels = createPixelsFromColormap(width, height, colormapDepth, decodeBuffer, 0, buffer, colormapOrigin, descriptor, order); + tgaFree(decodeBuffer); + } break; + case RGB_RLE: { + unsigned char *decodeBuffer = decodeRLE(width, height, depth, buffer, 18); + pixels = createPixelsFromRGB(width, height, depth, decodeBuffer, 0, descriptor, order); + tgaFree(decodeBuffer); + } break; + case GRAYSCALE_RLE: { + unsigned char *decodeBuffer = decodeRLE(width, height, depth, buffer, 18); + pixels = createPixelsFromGrayscale(width, height, depth, decodeBuffer, 0, descriptor, order); + tgaFree(decodeBuffer); + } break; + default: + break; + } + + return pixels; + +} + +static unsigned char *decodeRLE(int width, int height, int depth, const unsigned char *buffer, int offset) { + int elementCount = depth/8; + unsigned char elements[4]; + int decodeBufferLength = elementCount * width * height; + unsigned char *decodeBuffer = (unsigned char *)tgaMalloc(decodeBufferLength); + int decoded = 0; + while(decoded < decodeBufferLength) { + int packet = buffer[offset++] & 0xFF; + if((packet & 0x80) != 0) { // RLE + int i, j, count; + for(i=0; iredShift; + int gs = order->greenShift; + int bs = order->blueShift; + int as = order->alphaShift; + switch(depth) { + case 24: + pixels = (int *)tgaMalloc(4*width*height); + if((descriptor & RIGHT_ORIGIN) != 0) { + if((descriptor & UPPER_ORIGIN) != 0) { + // UpperRight + int i, j; + for(i=0; i= 0) { + int index = 3*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = 0xFF; + color = (r<= 0) { + int index = 3*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = 0xFF; + color = (r<= 0) { + int index = 3*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = 0xFF; + color = (r<= 0) { + int index = 3*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = 0xFF; + color = (r<= 0) { + int index = 4*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = palette[index+3] & 0xFF; + color = (r<= 0) { + int index = 4*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = palette[index+3] & 0xFF; + color = (r<= 0) { + int index = 4*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = palette[index+3] & 0xFF; + color = (r<= 0) { + int index = 4*colormapIndex+18; + int b = palette[index+0] & 0xFF; + int g = palette[index+1] & 0xFF; + int r = palette[index+2] & 0xFF; + int a = palette[index+3] & 0xFF; + color = (r<redShift; + int gs = order->greenShift; + int bs = order->blueShift; + int as = order->alphaShift; + switch(depth) { + case 24: + pixels = (int *)tgaMalloc(4*width*height); + if((descriptor & RIGHT_ORIGIN) != 0) { + if((descriptor & UPPER_ORIGIN) != 0) { + // UpperRight + int i, j; + for(i=0; iredShift; + int gs = order->greenShift; + int bs = order->blueShift; + int as = order->alphaShift; + switch(depth) { + case 8: + pixels = (int *)tgaMalloc(4*width*height); + if((descriptor & RIGHT_ORIGIN) != 0) { + if((descriptor & UPPER_ORIGIN) != 0) { + // UpperRight + int i, j; + for(i=0; i +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _TGA_ORDER { + int redShift; + int greenShift; + int blueShift; + int alphaShift; +} TGA_ORDER; + +const TGA_ORDER *TGA_READER_ARGB; +const TGA_ORDER *TGA_READER_ABGR; + +void *tgaMalloc(size_t size); +void tgaFree(void *memory); + +int tgaGetWidth(const unsigned char *buffer); +int tgaGetHeight(const unsigned char *buffer); +int *tgaRead(const unsigned char *buffer, const TGA_ORDER *order); + +#ifdef __cplusplus +} +#endif + +#endif /* __TGA_READER_H__ */ diff --git a/Makefile b/Makefile index 8766ed98..ea7c58a3 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ PKGFILES1 := $(CURDIR)/pkgfiles PKGFILES2 := $(CURDIR)/pkgfiles2 SFOXML := sfo.xml -VERSION := 1.37 +VERSION := 1.38 ifeq ($(FILEMANAGER), 1) PKGFILES := $(PKGFILES2) diff --git a/payloads/FIRMWARES b/payloads/FIRMWARES index c88fe741..b650714e 100644 --- a/payloads/FIRMWARES +++ b/payloads/FIRMWARES @@ -1,3 +1,3 @@ -PAYLOADS :=421C 421D 430C 430D 431C 440C 441C 441D 446C 446D 450C 450D 453C 453D 455C 455D 460C 465C 465D 470C 470D 475C 475D 476C 476D 478C 478D 480C 480D 481C 481D 482C 482D 483C 484C 484D 485C +PAYLOADS :=421C 421D 430C 430D 431C 440C 441C 441D 446C 446D 450C 450D 453C 453D 455C 455D 460C 465C 465D 470C 470D 475C 475D 476C 476D 478C 478D 480C 480D 481C 481D 482C 482D 483C 484C 484D 485C 486C -PS2_PAYLOADS := 421C 421D 425C 425D 430C 430D 431C 431D 440C 440D 441C 441D 446C 446D 450C 450D 453C 453D 455C 455D 460C 460D 465C 465D 466C 470C 470D 475C 475D 476C 476D 478C 478D 480C 480D 481C 481D 482C 483C 484C 484D 485C +PS2_PAYLOADS := 421C 421D 425C 425D 430C 430D 431C 431D 440C 440D 441C 441D 446C 446D 450C 450D 453C 453D 455C 455D 460C 460D 465C 465D 466C 470C 470D 475C 475D 476C 476D 478C 478D 480C 480D 481C 481D 482C 483C 484C 484D 485C 486C diff --git a/payloads/MAMBA/lv2/include/lv2/symbols.h b/payloads/MAMBA/lv2/include/lv2/symbols.h index bf9686c0..8e59a314 100644 --- a/payloads/MAMBA/lv2/include/lv2/symbols.h +++ b/payloads/MAMBA/lv2/include/lv2/symbols.h @@ -8225,5 +8225,209 @@ #define aio_copy_root_offset 0xD658 #endif +#ifdef FIRMWARE_486C + + #define FIRMWARE_VERSION 0x486 + + #ifdef PS3M_API + #define PS3MAPI_FW_VERSION 0x486 + #define PS3MAPI_FW_TYPE "CEX MAMBA" + #define PS3MAPI_IDPS_1 0x80000000003E2E30ULL + #define PS3MAPI_IDPS_2 0x8000000000474AF4ULL + #define PS3MAPI_PSID 0x8000000000474B0CULL + #endif + + /* lv2 */ + #define TOC 0x34FBB0 + #define open_shared_kernel_object_symbol 0x12410 + #define close_kernel_object_handle_symbol 0x11A30 + #define open_kernel_object_symbol 0x12600 + #define alloc_symbol 0x64824 + #define dealloc_symbol 0x64C60 + #define copy_to_user_symbol 0xF86C + #define copy_from_user_symbol 0xFA88 + #define copy_to_process_symbol 0xF924 + #define copy_from_process_symbol 0xF734 + #define page_allocate_symbol 0x60394 + #define page_free_symbol 0x5FDF8 + #define page_export_to_proc_symbol 0x60530 + #define page_unexport_from_proc_symbol 0x5FCEC + #define kernel_ea_to_lpar_addr_symbol 0x7014C + #define map_process_memory_symbol 0x7726C + #define memcpy_symbol 0x7E92C + #define memset_symbol 0x4D66C + #define memcmp_symbol 0x4C97C + #define printf_symbol 0x2706AC + #define printfnull_symbol 0x275120 + #define sprintf_symbol 0x4EA94 + #define snprintf_symbol 0x4EA00 + #define strcpy_symbol 0x4D818 + #define strncpy_symbol 0x4D8E0 + #define strlen_symbol 0x4D840 + #define strcat_symbol 0x4D748 + #define strcmp_symbol 0x4D7C4 + #define strncmp_symbol 0x4D86C + #define strchr_symbol 0x4D780 + #define spin_lock_irqsave_ex_symbol 0x26D798 + #define spin_unlock_irqrestore_ex_symbol 0x26D76C + #define load_process_symbol 0x5004 + #define ppu_thread_create_symbol 0x13EC8 + #define ppu_thread_exit_symbol 0x13F80 + #define ppu_thread_join_symbol 0x13FD4 + #define ppu_thread_delay_symbol 0x287A4 + #define create_user_thread2_symbol 0x25080 + #define start_thread_symbol 0x23D4C + #define run_thread_symbol 0x2357C + #define register_thread_symbol 0x26794C + #define allocate_user_stack_symbol 0x268134 + #define mutex_create_symbol 0x1363C + #define mutex_destroy_symbol 0x135D4 + #define mutex_lock_symbol 0x135CC + #define mutex_unlock_symbol 0x135C4 + #define event_port_create_symbol 0x13078 + #define event_port_destroy_symbol 0x134E0 + #define event_port_connect_symbol 0x13558 + #define event_port_disconnect_symbol 0x13484 + #define event_port_send_symbol 0x13070 + #define event_queue_create_symbol 0x13380 + #define event_queue_destroy_symbol 0x13308 + #define event_queue_receive_symbol 0x1314C + #define cellFsOpen_symbol 0x297900 + #define cellFsClose_symbol 0x297768 + #define cellFsRead_symbol 0x2978A4 + #define cellFsWrite_symbol 0x297810 + #define cellFsLseek_symbol 0x296E98 + #define cellFsStat_symbol 0x29711C + #define cellFsUnlink_internal_symbol 0x19C64C + #define cellFsUtilMount_symbol 0x296C78 + #define cellFsUtilUmount_symbol 0x296C4C + #define pathdup_from_user_symbol 0x29C8E4 + #define open_path_symbol 0x297638 + #define open_fs_object_symbol 0x18A970 + #define close_fs_object_symbol 0x1898AC + #define storage_get_device_info_symbol 0x279B00 + #define storage_open_symbol 0x279510 + #define storage_close_symbol 0x279300 + #define storage_read_symbol 0x278870 + #define storage_send_device_command_symbol 0x2783FC + #define storage_map_io_memory_symbol 0x2799BC + #define storage_unmap_io_memory_symbol 0x279888 + #define storage_internal_get_device_object_symbol 0x277EB4 + #define decrypt_func_symbol 0x34970 + #define lv1_call_99_wrapper_symbol 0x4EEA8 + #define modules_verification_symbol 0x58AB8 + #define prx_load_module_symbol 0x88C04 + #define prx_start_module_symbol 0x878D0 + #define prx_stop_module_symbol 0x88CA8 + #define prx_unload_module_symbol 0x87604 + #define prx_get_module_info_symbol 0x8708C + #define prx_get_module_list_symbol 0x8710C + #define extend_kstack_symbol 0x700A4 + #define get_pseudo_random_number_symbol 0x228180 + #define syscall_table_symbol 0x363BE0 + #define syscall_call_offset 0x275C04 + #define read_bdvd0_symbol 0x1A461C + #define read_bdvd1_symbol 0x1A6248 + #define read_bdvd2_symbol 0x1B3400 + #define device_event_port_send_call 0x28206C + #define process_map_caller_call 0x4D24 + #define fsloop_open_call 0x297A98 + #define fsloop_close_call 0x297AE8 + #define fsloop_read_call 0x297B28 + #define io_rtoc_entry_1 0x25B8 + #define io_sub_rtoc_entry_1 -0x7EA0 + #define decrypt_rtoc_entry_2 -0x66A0 + #define storage_rtoc_entry_1 0x1DD8 + #define device_event_rtoc_entry_1 0x2048 + #define process_rtoc_entry_1 -0x7800 + #define patch_func2 0x59D84 + #define patch_func2_offset 0x2C + #define user_thread_prio_patch 0x203FC + #define user_thread_prio_patch2 0x20408 + #define shutdown_patch_offset 0xAAB8 + #define shutdown_copy_params_call 0xAACC + + /* hash */ + #define EXPLORE_PLUGIN_HASH 0xACF4AF2B000EC482 + #define EXPLORE_CATEGORY_GAME_HASH 0x9CB378E600056AE5 + #define GAME_EXT_PLUGIN_HASH 0xE274AF7B0001E594 + #define LIBFS_EXTERNAL_HASH 0x5BC7BCE800006477 + #define PSP_EMULATOR_HASH 0x7BE641F500023793 + #define PEMUCORELIB_HASH 0xF349A563000C0D66 + #define EMULATOR_API_HASH 0xA9F5B37A0001BB45 + #define EMULATOR_DRM_HASH 0xA324DC4A00005399 + #define EMULATOR_DRM_DATA_HASH 0x75C390860001B75F + #define LIBSYSUTIL_SAVEDATA_PSP_HASH 0x57BBC3B800003212 + + /* lv1 */ + #define vsh_pos_in_ram 0x910000 + + /* vsh */ + #define ps2tonet_patch 0xC4E34 + #define ps2tonet_size_patch 0xC4E28 + #define vmode_patch_offset 0x4431DC + #define psp_drm_patch1 0x242FC0 + #define psp_drm_patch2 0x243A60 + #define psp_drm_patch3 0x24369C + #define psp_drm_patch4 0x243EA8 + #define psp_drm_patchA 0x2430DC + #define psp_drm_patchB 0x24397C + #define psp_drm_patchC 0x242B14 + #define psp_drm_patchD 0x2430C4 + #define psp_drm_patchE 0x2430C8 + #define psp_drm_patchF 0x243A94 + #define psp_extra_drm_patch 0x245AF0 + + /* explore_plugin */ + #define ps2_nonbw_offset 0xDD9B4 + + /* explore_category_game */ + #define ps2_nonbw_offset2 0x68324 + + /* game_ext_plugin */ + #define ps2_nonbw_offset3 0x17000 + + /* psp_emulator */ + #define psp_set_psp_mode_offset 0x1C18 + + /* emulator_api */ + #define psp_read 0x102D8 + #define psp_read_header 0x1125C + #define psp_drm_patch5 0x11080 + #define psp_drm_patch6 0x110B0 + #define psp_drm_patch7 0x110C8 + #define psp_drm_patch8 0x110CC + #define psp_drm_patch9 0x1120C + #define psp_drm_patch11 0x11210 + #define psp_drm_patch12 0x11220 + #define psp_product_id_patch1 0x11320 + #define psp_product_id_patch3 0x115F8 + + /* pemucorelib */ + #define psp_eboot_dec_patch 0x5E6BC + #define psp_prx_patch 0x577D8 + #define psp_savedata_bind_patch1 0x7A4BC + #define psp_savedata_bind_patch2 0x7A514 + #define psp_savedata_bind_patch3 0x7A030 + #define psp_extra_savedata_patch 0x87540 + #define psp_prometheus_patch 0x12EA28 + #define prx_patch_call_lr 0x5892C + + /* emulator_drm */ + #define psp_drm_tag_overwrite 0x4C68 + #define psp_drm_key_overwrite (0x27600 - 0xBE80) + + /* libsysutil_savedata_psp */ + #define psp_savedata_patch1 0x46CC + #define psp_savedata_patch2 0x46A4 + #define psp_savedata_patch3 0x4504 + #define psp_savedata_patch4 0x453C + #define psp_savedata_patch5 0x4550 + #define psp_savedata_patch6 0x46B8 + + /* libfs */ + #define aio_copy_root_offset 0xD658 +#endif + #endif /* __FIRMWARE_SYMBOLS_H_S__ */ diff --git a/payloads/PS2_EMU/ps2emu/include/ps2emu/symbols.h b/payloads/PS2_EMU/ps2emu/include/ps2emu/symbols.h index 34130600..86715a8a 100644 --- a/payloads/PS2_EMU/ps2emu/include/ps2emu/symbols.h +++ b/payloads/PS2_EMU/ps2emu/include/ps2emu/symbols.h @@ -1142,6 +1142,33 @@ #define stage2_addr 0x021f0000 #endif /* FIRMWARE */ + #ifdef FIRMWARE_486C + #define TOC 0x4EB8C0 + #define DISC_SIZE_OFFSET 0x25714 + #define DISC_TYPE_OFFSET 0x25310 + #define cdvd_send_atapi_command_symbol 0x22138 + #define ufs_open_symbol 0x4E0A8 + #define ufs_close_symbol 0x4E834 + #define ufs_read_symbol 0x4DB78 + #define ufs_write_symbol 0x4DC6C + #define ufs_fstat_symbol 0x4EB38 + #define zeroalloc_symbol 0xFDFEC + #define malloc_symbol 0xFDF04 + #define free_symbol 0xFE044 + #define memcpy_symbol 0xDFAC + #define memset_symbol 0xD488 + #define strcpy_symbol 0xED04 + #define strcat_symbol 0xEED0 + #define strlen_symbol 0xECD8 + #define vuart_read_symbol 0x1E42C + #define vuart_write_symbol 0x1E37C + #define ps2_disc_auth_symbol 0x206B0 + #define ps2_disc_auth_caller_symbol 0x512F8 + #define overwritten_symbol 0x23D6C + #define stage1_addr overwritten_symbol + #define stage2_addr 0x021f0000 + #endif /* FIRMWARE */ + #endif /* PS2HWEMU */ #ifdef PS2GXEMU @@ -2284,6 +2311,33 @@ #define stage2_addr 0x2BBAB28 #endif /* FIRMWARE */ + #ifdef FIRMWARE_486C + #define TOC 0x678548 + #define cdvd_read_symbol 0x8E4AC + #define cdvd_send_atapi_command_symbol 0x8DA80 + #define cdvd_send_device_command_symbol 0x8D994 + #define ufs_open_symbol 0x24EBB0 + #define ufs_close_symbol 0x24F358 + #define ufs_read_symbol 0x24E8C0 + #define ufs_write_symbol 0x24EA38 + #define ufs_fstat_symbol 0x24E700 + #define zeroalloc_symbol 0x1E48EC + #define malloc_symbol 0x1E488C + #define free_symbol 0x1E4938 + #define memcpy_symbol 0x514BC + #define memset_symbol 0x51528 + #define strcpy_symbol 0x51600 + #define strcat_symbol 0x51634 + #define strlen_symbol 0x515C8 + #define vuart_read_symbol 0x49544 + #define vuart_write_symbol 0x494A4 + #define ps2_disc_auth_symbol 0x900FC + #define ps2_disc_auth_caller_symbol 0x24F95C + #define overwritten_symbol 0x8CAD8 + #define stage1_addr overwritten_symbol + #define stage2_addr 0x2BBAB28 + #endif /* FIRMWARE */ + #endif /* PS2GXEMU */ #ifdef PS2NETEMU @@ -2962,6 +3016,22 @@ #define decrypt_symbol cdvd_read_symbol #endif /* FIRMWARE */ + #ifdef FIRMWARE_486C + #define TOC 0x751280 + #define cdvd_read_symbol 0x1377C4 + #define ufs_open_symbol 0x1ECC5C + #define ufs_close_symbol 0x1ECB10 + #define ufs_read_symbol 0x1ED5CC + #define ufs_write_symbol 0x1ED458 + #define ufs_fstat_symbol 0x1EC760 + #define memcpy_symbol 0x118A90 + #define memset_symbol 0x118A3C + #define strcpy_symbol 0x1188DC + #define strcat_symbol 0x118914 + #define strlen_symbol 0x1188A4 + #define decrypt_symbol cdvd_read_symbol + #endif /* FIRMWARE */ + #endif /* PS2NETEMU */ diff --git a/payloads/SKY/firmware_symbols.h b/payloads/SKY/firmware_symbols.h index bb719446..88e2692f 100644 --- a/payloads/SKY/firmware_symbols.h +++ b/payloads/SKY/firmware_symbols.h @@ -265,3 +265,10 @@ #define memcpy 0x7E92C #define memset 0x4D66C #endif + +#ifdef CFW_486C +#define alloc 0x64824 +#define memory_patch_func 0x297660 +#define memcpy 0x7E92C +#define memset 0x4D66C +#endif diff --git a/payloads/erk_dumper/source/dumper.c b/payloads/erk_dumper/source/dumper.c index 698c9c7a..2d6a603e 100644 --- a/payloads/erk_dumper/source/dumper.c +++ b/payloads/erk_dumper/source/dumper.c @@ -11,7 +11,7 @@ const unsigned char dumper_payload[1544] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x45, 0x4C, 0x46, 0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x01, 0xC4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x20, 0x00, 0x01, 0x00, 0x28, @@ -28,60 +28,60 @@ const unsigned char dumper_payload[1544] = { 0x62, 0x7C, 0xB1, 0x80, 0x8A, 0xB9, 0x38, 0xE3, 0x2C, 0x8C, 0x09, 0x17, 0x08, 0x72, 0x6A, 0x57, 0x9E, 0x25, 0x86, 0xE4, 0x1B, 0x3B, 0xFA, 0xC5, 0x1E, 0xC1, 0xAA, 0x84, 0xAB, 0xCF, 0xA6, 0xA6, 0x2C, 0x7C, 0x9E, 0x73, 0x7A, 0xA1, 0xB1, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x95, 0x4E, 0x8C, 0xC5, 0xBC, 0x6A, 0x6B, 0x4C, 0x59, 0x4F, 0x47, 0x2D, 0xAA, 0x9C, 0x4D, 0xE5, - 0xDB, 0xB5, 0xF8, 0x1E, 0x62, 0x7E, 0xB4, 0x73, 0xE7, 0xB1, 0x99, 0xE7, 0x4D, 0xAB, 0xE0, 0x4B, - 0x4F, 0xE0, 0x09, 0x1F, 0xD8, 0xF2, 0x86, 0x61, 0x5F, 0x98, 0x16, 0x19, 0xBC, 0x02, 0x27, 0xE3, - 0x15, 0xBB, 0x55, 0xE7, 0x6F, 0xF7, 0x83, 0x88, 0x64, 0xFC, 0xD8, 0x36, 0xFC, 0xC1, 0x39, 0xB3, - 0x98, 0x92, 0xAD, 0xA3, 0x44, 0xF7, 0x7F, 0xEC, 0xDD, 0x90, 0xEB, 0x0A, 0x3E, 0xD5, 0x25, 0x09, - 0x67, 0x51, 0x25, 0x79, 0xA9, 0x99, 0xCB, 0xE9, 0xA6, 0x36, 0x94, 0xE3, 0x60, 0xAC, 0xFB, 0x3A, - 0xF7, 0xAC, 0x0A, 0xFE, 0x25, 0xDD, 0xC6, 0x80, 0x11, 0xAF, 0x37, 0xB8, 0xF7, 0x28, 0xD5, 0xBE, - 0x8F, 0xE1, 0xCD, 0x09, 0x40, 0x04, 0x5E, 0x7C, 0xB2, 0x7F, 0x1A, 0x53, 0xB6, 0x85, 0x30, 0x58, - 0xE5, 0x02, 0xE7, 0x55, 0x5F, 0x5E, 0x67, 0x29, 0x98, 0x22, 0xDE, 0xEF, 0x61, 0x4E, 0x93, 0xD2, - 0x57, 0x06, 0xDE, 0xD0, 0x79, 0x51, 0x4F, 0x22, 0xF3, 0x14, 0xE4, 0xF9, 0x8F, 0xF1, 0xF2, 0x04, - 0xE1, 0xE7, 0x05, 0x83, 0x3C, 0x67, 0xE1, 0x02, 0x07, 0x4D, 0xF5, 0x72, 0xFC, 0x69, 0xF8, 0xED, - 0x0B, 0x88, 0xED, 0xC3, 0xC3, 0x71, 0x30, 0xBE, 0x51, 0x68, 0xDF, 0xCD, 0xEC, 0x44, 0x69, 0x03, - 0xE5, 0x1A, 0x52, 0x9D, 0xDC, 0x9E, 0x24, 0xF4, 0x18, 0x70, 0xA2, 0xCD, 0x53, 0x9A, 0xAE, 0xED, - 0xC8, 0xA9, 0xE8, 0xCB, 0x44, 0x90, 0xA9, 0x5A, 0x5F, 0xC2, 0xF7, 0x55, 0x71, 0x2B, 0xDD, 0xEF, - 0xE4, 0x7E, 0x83, 0x40, 0xA6, 0xDA, 0x67, 0xDF, 0x23, 0x48, 0x7D, 0x22, 0xE2, 0xA3, 0x26, 0xCF, - 0x16, 0x4C, 0x8D, 0x80, 0x6A, 0x0A, 0xF6, 0xC0, 0xEB, 0xD7, 0x17, 0x62, 0x9D, 0x4C, 0x63, 0xAE, - 0x51, 0x3C, 0x36, 0xA6, 0xB0, 0x74, 0xB7, 0x7B, 0xF4, 0xA2, 0xA9, 0x22, 0x8D, 0x9B, 0xCB, 0x74, - 0x56, 0x84, 0xB9, 0x83, 0x50, 0xC5, 0x6E, 0x07, 0xBF, 0x0F, 0x88, 0x24, 0x49, 0x7A, 0xE5, 0x50, - 0x65, 0x08, 0x00, 0xA2, 0xCF, 0x4A, 0xBB, 0x65, 0xB4, 0xAD, 0x13, 0x4D, 0xAD, 0x66, 0x1B, 0xE6, - 0x3A, 0x2E, 0x70, 0x84, 0xB8, 0x57, 0xFA, 0x34, 0xE5, 0xCA, 0x5E, 0x86, 0x08, 0x3C, 0xAE, 0x03, - 0xD6, 0x7A, 0x59, 0x50, 0xE0, 0x60, 0x27, 0x0C, 0xAA, 0x95, 0xA1, 0xFE, 0xB8, 0x24, 0xA4, 0x7F, - 0x12, 0xFF, 0x41, 0xB4, 0xCC, 0x03, 0xBE, 0xF0, 0x16, 0x69, 0x8F, 0x59, 0x9A, 0x3B, 0x7D, 0xED, - 0x68, 0x6E, 0x7A, 0x29, 0x3E, 0xFA, 0xEC, 0x00, 0x0C, 0x5B, 0xAB, 0xB8, 0x6B, 0xE3, 0x60, 0x41, - 0x4D, 0x72, 0x7E, 0xA5, 0x56, 0x1C, 0x8C, 0xD3, 0x5E, 0x98, 0x71, 0x8A, 0xCC, 0x93, 0x5C, 0xC5, - 0xD5, 0xAE, 0xD9, 0x0C, 0xCF, 0xD2, 0xAA, 0xC0, 0x0F, 0xFB, 0x7F, 0x91, 0x78, 0xAB, 0xE8, 0x62, - 0x40, 0xC3, 0xD2, 0x7E, 0xF8, 0x52, 0x06, 0x6E, 0x41, 0x15, 0x34, 0x70, 0xCE, 0xDE, 0xF8, 0x66, - 0x14, 0xB2, 0x04, 0x27, 0x6A, 0xF6, 0x31, 0x9A, 0x40, 0xB6, 0x7D, 0x43, 0x2E, 0x67, 0xFA, 0xAD, - 0xC8, 0xB3, 0x7F, 0xAF, 0x69, 0xDF, 0x7E, 0x19, 0x8E, 0x22, 0xC8, 0xFA, 0xF8, 0xAD, 0xA1, 0x39, - 0xD0, 0x5E, 0xFE, 0x36, 0x00, 0x19, 0x85, 0x74, 0x97, 0x13, 0x8F, 0xFA, 0x1E, 0x4A, 0x81, 0x02, - 0xDE, 0x5C, 0xD1, 0xE0, 0xFD, 0x75, 0xF1, 0xC4, 0xA1, 0x91, 0xD9, 0xC2, 0xFA, 0xCB, 0x2D, 0x5A, - 0xB8, 0x0D, 0x55, 0xBD, 0x3A, 0xD9, 0x4F, 0x70, 0xD4, 0xB6, 0xF9, 0x31, 0x95, 0x45, 0x90, 0x90, - 0x47, 0x38, 0x75, 0x7B, 0xEE, 0x6B, 0x0D, 0x1F, 0x14, 0xA0, 0xD2, 0xD0, 0x0A, 0x89, 0xE6, 0x8E, - 0xB8, 0x39, 0x9E, 0xBD, 0x24, 0xF5, 0x5F, 0xCA, 0x36, 0x7A, 0x91, 0x6D, 0x02, 0x08, 0xDC, 0xB8, - 0x96, 0xB4, 0x95, 0xCE, 0xF4, 0xEF, 0x01, 0x46, 0xDC, 0x8A, 0xD4, 0x4E, 0x5B, 0xD2, 0xBC, 0x67, - 0x67, 0x82, 0x9C, 0x91, 0x65, 0xB6, 0xDB, 0x15, 0x47, 0xFF, 0xF2, 0xB3, 0x04, 0x24, 0x3A, 0x74, - 0x62, 0x38, 0xEF, 0x3F, 0xAB, 0x12, 0x02, 0xA3, 0x13, 0x1F, 0x56, 0xAF, 0x0C, 0xDE, 0xD2, 0x97, - 0xD2, 0x42, 0xC1, 0x21, 0x05, 0xC3, 0xA3, 0x5A, 0x46, 0x90, 0x3C, 0xAA, 0x56, 0xDE, 0xC4, 0x8E, - 0xEE, 0x2D, 0xBB, 0x25, 0x97, 0xE8, 0x3C, 0xE0, 0x70, 0xFF, 0xD0, 0xC4, 0x3E, 0x0B, 0xBC, 0x3A, - 0xF2, 0xB1, 0x42, 0x90, 0xFA, 0xCC, 0x22, 0x79, 0xB0, 0x83, 0xB2, 0x5C, 0xDD, 0xB9, 0x22, 0xB2, - 0x54, 0xC8, 0x5B, 0x59, 0xF2, 0xD6, 0xDE, 0x5F, 0xB8, 0xB2, 0x03, 0x9D, 0xA3, 0x68, 0xA2, 0xF1, - 0x47, 0xFA, 0x0B, 0x9C, 0xAC, 0x18, 0x0C, 0x68, 0x34, 0x1A, 0x3B, 0x9A, 0x37, 0xA1, 0x4A, 0x71, - 0xAD, 0xAE, 0x64, 0x49, 0x09, 0x25, 0x91, 0xEB, 0x39, 0xE0, 0x1D, 0x15, 0x60, 0x79, 0x6B, 0x9B, - 0x6A, 0xC6, 0x0C, 0xEB, 0x9D, 0xE6, 0x36, 0xF9, 0xF3, 0xE4, 0x0B, 0x7E, 0x08, 0x56, 0xEB, 0xE9, - 0x41, 0xE0, 0xAF, 0x17, 0xE7, 0x1E, 0xCC, 0xED, 0xF9, 0xC9, 0x26, 0xFC, 0x44, 0x28, 0x0F, 0xF5, - 0x7F, 0x1D, 0x3D, 0xF0, 0xB1, 0x2B, 0x46, 0x9B, 0x7C, 0x63, 0x1E, 0x27, 0x86, 0x87, 0x28, 0xE2, - 0x54, 0x62, 0xE3, 0x1E, 0x59, 0x28, 0x2B, 0xF6, 0xA8, 0x29, 0x24, 0x41, 0x74, 0x52, 0x57, 0x1A, - 0x09, 0x9C, 0x55, 0x9A, 0x10, 0xFE, 0x31, 0xE4, 0xC4, 0x6C, 0x94, 0x3E, 0xE2, 0x9D, 0x9D, 0x21, - 0x16, 0x1C, 0xD9, 0xCF, 0x18, 0x91, 0x36, 0x3B, 0x96, 0x06, 0xFE, 0xD5, 0x7C, 0x4D, 0x1F, 0x64, - 0x01, 0x14, 0xB2, 0xF6, 0xAB, 0xE7, 0xA2, 0x8F, 0x1B, 0x1A, 0x79, 0x6B, 0x97, 0x6B, 0x0F, 0x9D, - 0x87, 0x77, 0x30, 0xC8, 0x8C, 0xA9, 0x8B, 0x2A, 0x7D, 0x34, 0x0C, 0x32, 0x33, 0x40, 0x09, 0xF3, - 0x21, 0xC9, 0xB4, 0x0A, 0x95, 0x95, 0x15, 0xCF, 0x33, 0xD4, 0xF2, 0xBA, 0x3C, 0xF6, 0x23, 0xAB, - 0x7D, 0x92, 0x01, 0x6C, 0x97, 0xAC, 0xC3, 0xD4, 0x39, 0xA9, 0xA6, 0x64, 0x24, 0x7D, 0xC3, 0xDC, - 0xC0, 0x99, 0xCE, 0xFD, 0x7F, 0x93, 0x5C, 0xE5, 0xE3, 0xC7, 0xB9, 0xB2, 0x6F, 0xE6, 0x2F, 0xE0, - 0x1A, 0x7A, 0x25, 0x6D, 0xF2, 0xB5, 0x0F, 0xA2, 0x93, 0x4C, 0x67, 0x8B, 0xF6, 0x20, 0xF2, 0x37, + 0x8C, 0x43, 0x0A, 0x61, 0x29, 0xF0, 0x35, 0x4A, 0xAB, 0x9D, 0xE5, 0x84, 0x2E, 0x92, 0xA0, 0x2F, + 0x53, 0x39, 0xA0, 0xCA, 0x50, 0xB9, 0x7E, 0xE6, 0xDA, 0x1A, 0x83, 0x6F, 0xCD, 0x32, 0xE7, 0xEA, + 0x79, 0xC9, 0x81, 0xBD, 0xF4, 0xFE, 0xD7, 0xF2, 0x79, 0xB8, 0xA4, 0x08, 0xEB, 0x67, 0xA1, 0xFB, + 0x79, 0xAE, 0x52, 0x48, 0x65, 0x2F, 0xAC, 0x5F, 0x23, 0x08, 0x74, 0xFF, 0x6A, 0xED, 0x8A, 0x08, + 0x30, 0x90, 0x73, 0x86, 0x92, 0x9C, 0xF2, 0xDD, 0x6F, 0x04, 0x7B, 0xC0, 0x9C, 0x3B, 0x16, 0x78, + 0xB8, 0x8A, 0x33, 0x15, 0xAA, 0xCB, 0x65, 0x08, 0xD8, 0x07, 0xF5, 0x98, 0x66, 0x15, 0x75, 0xB0, + 0x0E, 0x9F, 0x47, 0x39, 0x8A, 0xD6, 0xB0, 0xFA, 0xE2, 0x0B, 0xCB, 0xF4, 0x7E, 0xB6, 0xD4, 0x5F, + 0x3E, 0xF1, 0x49, 0x00, 0xC8, 0x66, 0x75, 0x8D, 0x9D, 0x93, 0xA5, 0x74, 0x39, 0x2E, 0xBE, 0x5E, + 0x5B, 0x04, 0x20, 0xC7, 0xF5, 0xB5, 0x2A, 0x28, 0x18, 0x51, 0x28, 0x94, 0x91, 0xCB, 0xFA, 0xA7, + 0xF6, 0x24, 0xD7, 0x90, 0x76, 0x33, 0xBD, 0xE9, 0x45, 0xAE, 0x07, 0xE3, 0xEB, 0x51, 0xB0, 0x4E, + 0xCB, 0x6F, 0x78, 0xA4, 0xB7, 0x80, 0x49, 0xFB, 0x0D, 0x97, 0xEB, 0x80, 0x47, 0x65, 0xEF, 0xA3, + 0x38, 0x0D, 0xE1, 0xA1, 0x84, 0x37, 0x4D, 0xD2, 0x8D, 0xD9, 0xE9, 0xFF, 0xD2, 0x26, 0x8E, 0x94, + 0x4D, 0x5A, 0xF2, 0xCA, 0xEB, 0xD0, 0xD6, 0x76, 0xAC, 0xE6, 0x2D, 0x81, 0x79, 0xC6, 0x2E, 0xE9, + 0x60, 0x81, 0xA4, 0x9D, 0x4E, 0xBF, 0xC1, 0x15, 0xAA, 0xAC, 0xB9, 0x91, 0x44, 0xA9, 0x2C, 0x13, + 0x71, 0xC5, 0x57, 0x42, 0x20, 0x68, 0x74, 0x20, 0x51, 0x30, 0xEC, 0xE8, 0xA7, 0xA6, 0x7D, 0x5F, + 0xFA, 0xD7, 0xD8, 0xE2, 0x75, 0xD6, 0x4C, 0x4B, 0x87, 0xB8, 0x5D, 0xC4, 0x2D, 0x33, 0x9A, 0x1D, + 0x72, 0x04, 0x5F, 0xFF, 0x79, 0xE0, 0x9B, 0xDC, 0xD5, 0xBC, 0xAA, 0xD6, 0x91, 0xDA, 0x1F, 0xD3, + 0x9D, 0x1F, 0x5B, 0x30, 0x11, 0xAC, 0x81, 0xE9, 0xCF, 0x17, 0x3B, 0xB5, 0x7C, 0xA6, 0x1C, 0x43, + 0x4C, 0xAB, 0x90, 0xBC, 0x50, 0x67, 0xF1, 0xEB, 0x65, 0xA0, 0x1F, 0xEA, 0xAA, 0xFF, 0x17, 0x9F, + 0x6A, 0xF7, 0xF3, 0xFA, 0x48, 0x54, 0x08, 0x12, 0xFE, 0x55, 0x14, 0x87, 0xFF, 0xBA, 0xA7, 0x1D, + 0xC8, 0x6C, 0xF7, 0x62, 0xA7, 0xAF, 0x66, 0x13, 0x67, 0x8F, 0x95, 0xF8, 0x2D, 0x15, 0xAA, 0xC5, + 0x85, 0xB4, 0x17, 0xE0, 0x82, 0xC3, 0x6E, 0x54, 0x0E, 0xC3, 0xA4, 0xD9, 0x02, 0x6C, 0x82, 0x26, + 0xF6, 0x20, 0x28, 0xD2, 0xD9, 0x8A, 0x23, 0x28, 0x83, 0x86, 0x6C, 0x5B, 0x79, 0x01, 0xA4, 0x57, + 0xC8, 0x43, 0x65, 0xB3, 0x5F, 0x31, 0xC8, 0xED, 0x2E, 0x5D, 0xDF, 0xF8, 0xB1, 0xB3, 0xE4, 0x85, + 0x4B, 0x11, 0x26, 0x64, 0xDB, 0x00, 0x19, 0x02, 0x6F, 0xF6, 0xF9, 0x5E, 0x72, 0xF4, 0xC9, 0xE2, + 0xC9, 0x11, 0xD7, 0xCA, 0x10, 0x5D, 0x6A, 0xF1, 0x27, 0xA4, 0xCD, 0x2D, 0xBB, 0x57, 0xC4, 0xF0, + 0xAA, 0x89, 0xA5, 0xDC, 0xCD, 0xBE, 0x87, 0x02, 0x6E, 0xA5, 0x1B, 0x78, 0xA0, 0xF8, 0xE7, 0x32, + 0xA5, 0x5D, 0xBE, 0x33, 0x9A, 0xBB, 0xBA, 0x59, 0xC3, 0xB2, 0xBB, 0x14, 0x38, 0x6F, 0xB8, 0x05, + 0x0B, 0x19, 0x5B, 0x24, 0x28, 0xA9, 0x92, 0x45, 0x98, 0x7E, 0x10, 0x8D, 0x21, 0x6B, 0x2E, 0x82, + 0x93, 0xB2, 0xBB, 0xDC, 0xEB, 0xD9, 0x88, 0xC9, 0x24, 0xED, 0x61, 0x42, 0x6F, 0x01, 0xD7, 0xC5, + 0xA7, 0x07, 0x5A, 0xE5, 0xF9, 0xC4, 0x2E, 0x89, 0xE1, 0x41, 0x9D, 0x5E, 0x81, 0x4B, 0x44, 0x78, + 0x6D, 0x6C, 0x9E, 0x06, 0xCF, 0x11, 0xC7, 0xF3, 0x83, 0x31, 0xF5, 0x7F, 0x2B, 0x26, 0x5A, 0x85, + 0xA0, 0xDC, 0x0F, 0xF3, 0x08, 0x3D, 0xAA, 0x4A, 0x43, 0x9E, 0xC1, 0xFC, 0x40, 0x81, 0xF9, 0xDD, + 0x65, 0x78, 0xE5, 0xA4, 0xBD, 0x49, 0xE1, 0x65, 0xA3, 0x3D, 0xFA, 0x58, 0x0D, 0xD6, 0x64, 0xA6, + 0x9B, 0x77, 0xE8, 0x4F, 0x14, 0x82, 0x44, 0x19, 0x99, 0x8B, 0xB5, 0xBA, 0xB5, 0x8D, 0x96, 0xB1, + 0x1E, 0x0E, 0x1B, 0x17, 0xAA, 0x03, 0xE1, 0x85, 0xD6, 0x58, 0xBA, 0xFA, 0x24, 0x9F, 0x63, 0xD3, + 0x8F, 0x43, 0x9A, 0x8E, 0xEE, 0x42, 0x50, 0x1D, 0x5B, 0x03, 0x9C, 0x64, 0x93, 0xBA, 0xEA, 0x26, + 0x95, 0x33, 0xE2, 0xF3, 0x9E, 0xBD, 0x6D, 0xD9, 0xC2, 0x3B, 0xBA, 0x00, 0xBF, 0x19, 0xFA, 0x50, + 0x59, 0xC1, 0x41, 0x91, 0x6B, 0xB5, 0x79, 0x25, 0x12, 0x32, 0x83, 0xF7, 0x02, 0x45, 0x79, 0x10, + 0x2C, 0x3F, 0x94, 0x48, 0x18, 0x93, 0x24, 0x3F, 0x0B, 0xE8, 0x3B, 0x30, 0x7B, 0xC0, 0x13, 0xFD, + 0x3F, 0x0A, 0xEC, 0x8C, 0xB6, 0x23, 0x82, 0x0D, 0x61, 0x66, 0xBC, 0x49, 0x54, 0x84, 0x80, 0xDD, + 0x72, 0x51, 0xFF, 0x6B, 0xFD, 0x66, 0x27, 0xCA, 0x7B, 0x32, 0x14, 0x0B, 0xDD, 0xF4, 0xE4, 0x7C, + 0xAB, 0x5A, 0x73, 0x56, 0x6C, 0x96, 0xC9, 0x4F, 0x13, 0x63, 0x2F, 0xA3, 0xBA, 0x28, 0x0C, 0xF6, + 0x52, 0xBF, 0x00, 0x38, 0xCA, 0xFF, 0xD6, 0xAC, 0x5F, 0x12, 0x14, 0x4C, 0x67, 0x41, 0x53, 0xB8, + 0x49, 0x64, 0x00, 0xBA, 0xD6, 0x74, 0x82, 0x1C, 0x49, 0x95, 0xCD, 0xC5, 0xC1, 0xB4, 0x06, 0xF3, + 0xB0, 0x36, 0xD4, 0xF7, 0xEB, 0xAF, 0xFF, 0x36, 0x4B, 0xE5, 0x5F, 0x33, 0x52, 0x85, 0xB1, 0x8E, + 0xCF, 0xBF, 0x21, 0x6B, 0x17, 0xB3, 0xAB, 0x15, 0x86, 0xE9, 0x37, 0x74, 0xED, 0x01, 0xC1, 0x3E, + 0xB1, 0x09, 0x28, 0x9D, 0xCD, 0xED, 0x76, 0x09, 0x34, 0x81, 0xEF, 0x17, 0x80, 0xAA, 0x9C, 0xC2, + 0x7F, 0xF7, 0x56, 0xBB, 0xD2, 0xAA, 0xC5, 0xF2, 0x52, 0x27, 0xDD, 0x07, 0xEF, 0x3E, 0x6E, 0xE8, + 0xAD, 0xD0, 0xCA, 0x09, 0x2E, 0x96, 0x54, 0xD5, 0xAB, 0x65, 0x46, 0x16, 0xA5, 0xBB, 0xDC, 0x10, + 0xE0, 0xE7, 0x31, 0x72, 0xD7, 0x0B, 0x0B, 0x96, 0xA8, 0x36, 0x37, 0x8E, 0x7C, 0xD8, 0x13, 0x2E, + 0xA1, 0x9A, 0x1B, 0x47, 0xDF, 0x41, 0x3F, 0x4D, 0xB2, 0x80, 0xC5, 0x40, 0xEF, 0x31, 0xA9, 0x49, + 0x4F, 0xE2, 0x69, 0xAF, 0x98, 0x80, 0xE5, 0xFC, 0x15, 0x85, 0xEF, 0xB6, 0x17, 0xD4, 0x37, 0x7B, + 0x5E, 0x7B, 0x5B, 0xBC, 0x06, 0xEB, 0x37, 0xBC, 0xAC, 0xE3, 0x42, 0x49, 0x3E, 0x3C, 0x74, 0xAD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x01, diff --git a/payloads/erk_dumper/source/symbols.h b/payloads/erk_dumper/source/symbols.h index 008dbe5c..90ab4d98 100644 --- a/payloads/erk_dumper/source/symbols.h +++ b/payloads/erk_dumper/source/symbols.h @@ -373,5 +373,15 @@ #define GAMEOS_LPAR_SIZE_PTR 0x800000000037A640ULL #endif +#ifdef FIRMWARE_486C + #define KERNEL_TOC 0x34FBB0 + #define KERNEL_SYMBOL_EXTEND_KSTACK 0x0700A4 + #define KERNEL_SYMBOL_COPY_TO_USER 0x00F86C + #define KERNEL_SYMBOL_MEMSET 0x04D66C + #define KERNEL_SYMBOL_MEMCPY 0x07E92C + #define GAMEOS_LPAR_BASE_PTR 0x800000000037A638ULL + #define GAMEOS_LPAR_SIZE_PTR 0x800000000037A640ULL +#endif + #endif /* __SYMBOLS_H__ */ diff --git a/payloads/erk_dumper/spu/Makefile b/payloads/erk_dumper/spu/Makefile index 3bff68a1..a7a3426c 100644 --- a/payloads/erk_dumper/spu/Makefile +++ b/payloads/erk_dumper/spu/Makefile @@ -9,7 +9,7 @@ CFLAGS=-ffunction-sections -fdata-sections -fno-builtin -Os LDFLAGS=-Tldscript.ld -nostartfiles -nostdlib -nodefaultlibs -Wl,--gc-sections $(LIB) SCETOOLS_FLAGS = --compress-data=FALSE --sce-type=SELF --key-revision=00 --self-auth-id=1FF000000C000001 --self-vendor-id=FF000000 -SCETOOLS_FLAGS+= --self-type=LDR --self-app-version=0001000000000000 --self-fw-version=0003004000000000 +SCETOOLS_FLAGS+= --self-type=LDR --self-app-version=0004002100000000 --self-fw-version=0000000000000000 SCETOOLS_FLAGS+= --self-ctrl-flags=0000000000000000000000000000000000000000000000000000000000000000 SCETOOLS_FLAGS+= --self-cap-flags=0000000000000000000000000000000000000000000000780000000000000000 diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.71.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.71.CONFIG new file mode 100644 index 00000000..5bf4d7f5 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.71.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.72.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.72.CONFIG new file mode 100644 index 00000000..2c7f4bcd Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_507.72.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_521.50.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_521.50.CONFIG new file mode 100644 index 00000000..50d3edac Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_521.50.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_545.47.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_545.47.CONFIG new file mode 100644 index 00000000..1bfea6bb Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLES_545.47.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.10.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.10.CONFIG new file mode 100644 index 00000000..0fd89871 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.10.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.19.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.19.CONFIG new file mode 100644 index 00000000..7ce668cc Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_205.19.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_207.73.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_207.73.CONFIG new file mode 100644 index 00000000..74438400 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_207.73.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_20965.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_20965.CONFIG deleted file mode 100644 index 01d497da..00000000 Binary files a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_20965.CONFIG and /dev/null differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_212.03.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_212.03.CONFIG new file mode 100644 index 00000000..99c9166f Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_212.03.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_21208.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_21208.CONFIG deleted file mode 100644 index 01d497da..00000000 Binary files a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_21208.CONFIG and /dev/null differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_213.44.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_213.44.CONFIG new file mode 100644 index 00000000..8940e512 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_213.44.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.01.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.01.CONFIG new file mode 100644 index 00000000..e71eba38 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.01.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.55.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.55.CONFIG new file mode 100644 index 00000000..0077a337 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/CUSTOM/SLUS_215.55.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/CONFIG/NET/SLPS_256.06.CONFIG b/pkgfiles/USRDIR/sys/CONFIG/NET/SLPS_256.06.CONFIG new file mode 100644 index 00000000..c255f741 Binary files /dev/null and b/pkgfiles/USRDIR/sys/CONFIG/NET/SLPS_256.06.CONFIG differ diff --git a/pkgfiles/USRDIR/sys/data/keys b/pkgfiles/USRDIR/sys/data/keys index 617f193b..470fad34 100644 --- a/pkgfiles/USRDIR/sys/data/keys +++ b/pkgfiles/USRDIR/sys/data/keys @@ -5250,3 +5250,153 @@ pub=36C1ACE6DD5CCC0006FDF3424750FAC515FC5CFA2C93EC53C6EC2BC421708D154E91F2E7EA54 priv=0010818ED8A666051C6198662C3D6DDE2CA4901DDC ctype=09 + +[spp] +type=SPP +revision=00 +version=0004008600000000 +erk=D2961BBFFEDAEE269B061454D6ACF262CD71BC6F5320180F0A04A07583CCF7C5 +riv=6D308B59BC9054B12C833359D31BAE77 +pub=0CDD0D1541A6B0DFD12E951578536CA60C93853B88FCE17592DC8D134B08A94AF8BB08667E2D70A5 +priv=0001608EF3BACAFFB8C3A5958A24F758325B62B08C +ctype=07 + + +[metldr] +type=SELF +revision=00 +self_type=LDR +version=0004008600000000 +erk=C0CEFE84C227F75BD07A7EB846509F93B238E770DACB9FF4A388F812482BE21B +riv=47EE7454E4774CC9B8960C7B59F4C14D +pub=C2D4AAF319355019AF99D44E2B58CA29252C89123D11D6218F40B138CAB29B7101F3AEB72A975019 +priv=00C5B2BFA1A413DD16F26D31C0F2ED4720DCFB0670 +ctype=20 + + +[rvk] +type=RVK +revision=02 +version=0004008600000000 +erk=695984B7EE2EC2F77FCC3120150DCE7E4480D84480DDD8C5940AEB6F79E63D17 +riv=A8BA3E4E63B2BB06FC0CE57E3BB8FC46 +pub=7F1950C6E497E922400586EE338B41E01C906C5A6DFD75FEB5249CFA4BEC534F5CA679670A452B2A +priv=00245E673B039D656DA206BDAE4EAEFCBF2A8D5EAF +ctype=12 + + +[isoldr] +type=SELF +revision=01 +version=0004008600000000 +self_type=ISO +erk=63565DBE98C3B1A52AADC907C47130FE57A10734E84F22592670F86ED2B0A086 +riv=953F6A99891B4739358F5363A00C08B9 +pub=26BE7B02E7D65C6C21BF4063CDB8C0092FE1679D62FA1A8CCC284A1D21885473A959992537A06612 +priv=00294411363290975BA551336D3965D88AF029A17B +ctype=15 + + +[isoldr] +type=SELF +revision=0100 +version=0004008600000000 +self_type=ISO +erk=B96EA32CB96EA32DB96EA32CB96EA32CB96EA32CB96EA32DB96EA32CB96EA32C +riv=B96EA32CB96EA32DB96EA32DB96EA32C +pub=2D7066E68C6AC3373B1346FD76FE7D18A207C811500E65D85DB57BC4A27AD78F59FD53F38F50E151 +priv=00294411363290975BA551336D3965D88AF029A17B +ctype=02 + + +[lv0ldr] +type=SELF +version=0004008600000000 +self_type=LV0 +erk=CA7A24EC38BDB45B98CCD7D363EA2AF0C326E65081E0630CB9AB2D215865878A +riv=F9205F46F6021697E670F13DFA726212 +pub=A8FD6DB24532D094EFA08CB41C9A72287D905C6B27B42BE4AB925AAF4AFFF34D41EEB54DD128700D +priv=001AD976FCDE86F5B8FF3E63EF3A7F94E861975BA3 +ctype=33 + + +[lv1ldr] +type=SELF +revision=0000 +version=0004008600000000 +self_type=LV1 +erk=10CEA04973FCCC12EC19924510822D8D4C41F657FD3D7E73F415A8D687421BCD +riv=ED8699562C6AC65204FA166257E7FCF4 +pub=085D38DBF9B757329EB862107929909D32FA1DAE60641BF4AC25319D7650597EE977F8E810FEEA96 +priv=004312C65347ACBE95CC306442FEFD0AF4C2935EB3 +ctype=14 + + +[lv2ldr] +type=SELF +revision=0000 +version=0004008600000000 +self_type=LV2 +erk=0CAF212B6FA53C0DA7E2C575ADF61DBE68F34A33433B1B891ABF5C4251406A03 +riv=9B79374722AD888EB6A35A2DF25A8B3E +pub=1034A6F98AF6625CC3E3604B59B971CA617DF337538D2179EBB22F3BDC9D0C6DA56BA7DDFD205A50 +priv=009D4CBA2BFB1A8330D3E20E59D281D476D231C73A +ctype=14 + + +[appldr] +type=SELF +revision=001D +version=0004008600000000 +self_type=APP +erk=D202174EB65A62048F3674B59EF6FE72E1872962F3E1CD658DE8D7AF71DA1F3E +riv=ACB9945914EBB7B9A31ECE320AE09F2D +pub=430322887503CF52928FAAA410FD623C7321281C8825D95F5B47EF078EFCFC44454C3AB4F00BB879 +priv=0010818ED8A666051C6198662C3D6DDE2CA4901DDC +ctype=1A + + +[appldr] +type=SELF +revision=001C np +version=0004008600000000 +self_type=NPDRM +erk=8103EA9DB790578219C4CEDF0592B43064A7D98B601B6C7BC45108C4047AA80F +riv=246F4B8328BE6A2D394EDE20479247C5 +pub=503172C9551308A87621ECEE90362D14889BFED2CF32B0B3E32A4F9FE527A41464B735E1ADBC6762 +priv=009EF86907782A318D4CC3617EBACE2480E73A46F6 +ctype=30 + + +[spkg] +type=PKG +revision=00 +version=0004008600000000 +erk=F8F99006F1C007D5D0B1909E9566E0E70B569399FC3394A811809FDB5CAE92CD +riv=59D28DB4ADDFB40B7D768BC9667C67B1 +pub=5432BDDD1F97418147AFF016EAA6100834F2CAA8C498B88965689EE44DF349B066CD43CBF4F2C5D0 +priv=00542D46E7B3DAAC8AEB81E533873AABD6D74BB710 +ctype=17 + + +[pkg] +type=PKG +revision=00 +version=0004008600000000 +erk=F8F99006F1C007D5D0B1909E9566E0E70B569399FC3394A811809FDB5CAE92CD +riv=59D28DB4ADDFB40B7D768BC9667C67B1 +pub=5432BDDD1F97418147AFF016EAA6100834F2CAA8C498B88965689EE44DF349B066CD43CBF4F2C5D0 +priv=00542D46E7B3DAAC8AEB81E533873AABD6D74BB710 +ctype=17 + + +[appldr] +type=SELF +revision=001C +version=0004008600000000 +self_type=APP +erk=CFF025375BA0079226BE01F4A31F346D79F62CFB643CA910E16CF60BD9092752 +riv=FD40664E2EBBA01BF359B0DCDF543DA4 +pub=36C1ACE6DD5CCC0006FDF3424750FAC515FC5CFA2C93EC53C6EC2BC421708D154E91F2E7EA54A893 +priv=0010818ED8A666051C6198662C3D6DDE2CA4901DDC +ctype=09 \ No newline at end of file diff --git a/pkgfiles/USRDIR/sys/loc/CN.txt b/pkgfiles/USRDIR/sys/loc/CN.txt index 85fc55f1..9734481c 100644 --- a/pkgfiles/USRDIR/sys/loc/CN.txt +++ b/pkgfiles/USRDIR/sys/loc/CN.txt @@ -1,5 +1,5 @@ -STR_LANGUAGE {Chinese} -STR_LANGCODE {\0x0B} +STR_LANGUAGE {Chinese} +STR_LANGCODE {\x0B} STR_LANG {Language} STR_LANG_DESC {选择你的语言.} @@ -12,8 +12,7 @@ STR_DIRS {目录} STR_UNKNOWN {未知} STR_FILE {文件} STR_CANCEL {取消} -STR_TURNOFF_YES {旋转 OFF = YES} -STR_TURNOFF_NO {旋转 OFF = NO} +STR_TURNOFF {关闭} STR_CANCELLED {注销} STR_UNIT {字节} STR_TOTALSIZE {总 大小} diff --git a/pkgfiles/USRDIR/sys/loc/EN.txt b/pkgfiles/USRDIR/sys/loc/EN.txt index 09d89fcc..68163e67 100644 --- a/pkgfiles/USRDIR/sys/loc/EN.txt +++ b/pkgfiles/USRDIR/sys/loc/EN.txt @@ -1,5 +1,5 @@ -STR_LANGUAGE {English} -STR_LANGCODE {\x01} +STR_LANGUAGE {English} +STR_LANGCODE {\x01} STR_LANG {Language} STR_LANG_DESC {Choose your language.} @@ -12,8 +12,7 @@ STR_DIRS {Directories} STR_UNKNOWN {Unknown} STR_FILE {File} STR_CANCEL {Cancel} -STR_TURNOFF_YES {Turn OFF = YES} -STR_TURNOFF_NO {Turn OFF = NO} +STR_TURNOFF {Turn off} STR_CANCELLED {Cancelled} STR_UNIT {Bytes} STR_TOTALSIZE {Total size} diff --git a/pkgfiles/USRDIR/sys/loc/ES.txt b/pkgfiles/USRDIR/sys/loc/ES.txt index 206f6878..e7e337ba 100644 --- a/pkgfiles/USRDIR/sys/loc/ES.txt +++ b/pkgfiles/USRDIR/sys/loc/ES.txt @@ -13,8 +13,7 @@ STR_DIRS {Carpetas} STR_UNKNOWN {Desconocido} STR_FILE {Archivo} STR_CANCEL {Cancelar} -STR_TURNOFF_YES {Apagar PS3 al finalizar la transferencia de archivos = Sí} -STR_TURNOFF_NO {Apagar PS3 al finalizar la transferencia de archivos = No} +STR_TURNOFF {Apagar PS3 al finalizar la transferencia de archivos} STR_CANCELLED {Cancelado} STR_UNIT {Bytes} STR_TOTALSIZE {Tamaño total} diff --git a/pkgfiles/USRDIR/sys/loc/FR.txt b/pkgfiles/USRDIR/sys/loc/FR.txt index 39fc24fa..35a0a0f3 100644 --- a/pkgfiles/USRDIR/sys/loc/FR.txt +++ b/pkgfiles/USRDIR/sys/loc/FR.txt @@ -12,8 +12,7 @@ STR_DIRS {Dossiers} STR_UNKNOWN {Inconnue} STR_FILE {Fichier} STR_CANCEL {Annuler} -STR_TURNOFF_YES {Éteindre = OUI} -STR_TURNOFF_NO {Éteindre = NON} +STR_TURNOFF {Éteindre} STR_CANCELLED {Annulé} STR_UNIT {octets} STR_TOTALSIZE {Taille totale} diff --git a/pkgfiles/USRDIR/sys/loc/HU.txt b/pkgfiles/USRDIR/sys/loc/HU.txt index 8274bda9..f2f5fb06 100644 --- a/pkgfiles/USRDIR/sys/loc/HU.txt +++ b/pkgfiles/USRDIR/sys/loc/HU.txt @@ -12,8 +12,7 @@ STR_DIRS {Könyvtárak} STR_UNKNOWN {Ismeretlen} STR_FILE {Fájl} STR_CANCEL {Elvet} -STR_TURNOFF_YES {Kikapcsolni = Igen} -STR_TURNOFF_NO {Kikapcsolni = Nem} +STR_TURNOFF {Kikapcsolni} STR_CANCELLED {Törölve} STR_UNIT {Bytes} STR_TOTALSIZE {Teljes méret} diff --git a/pkgfiles/USRDIR/sys/loc/IT.txt b/pkgfiles/USRDIR/sys/loc/IT.txt index c00fea06..e98f1a49 100644 --- a/pkgfiles/USRDIR/sys/loc/IT.txt +++ b/pkgfiles/USRDIR/sys/loc/IT.txt @@ -12,8 +12,7 @@ STR_DIRS {Directories} STR_UNKNOWN {Sconosciuto} STR_FILE {File} STR_CANCEL {Cancella} -STR_TURNOFF_YES {Spegni = SI} -STR_TURNOFF_NO {Spegni = NO} +STR_TURNOFF {Spegni} STR_CANCELLED {Cancellato} STR_UNIT {Bytes} STR_TOTALSIZE {Dimensione totale} diff --git a/pkgfiles/USRDIR/sys/loc/NL.txt b/pkgfiles/USRDIR/sys/loc/NL.txt index be4dc755..5190bbaf 100644 --- a/pkgfiles/USRDIR/sys/loc/NL.txt +++ b/pkgfiles/USRDIR/sys/loc/NL.txt @@ -12,8 +12,7 @@ STR_DIRS {Mappen} STR_UNKNOWN {Onbekend} STR_FILE {Bestand} STR_CANCEL {Annuleer} -STR_TURNOFF_YES {ZET UIT = JA} -STR_TURNOFF_NO {ZET UIT = NEE} +STR_TURNOFF {Schakel} STR_CANCELLED {Geannuleerd} STR_UNIT {Bytes} STR_TOTALSIZE {Totale Grootte} diff --git a/pkgfiles/USRDIR/sys/loc/PL.txt b/pkgfiles/USRDIR/sys/loc/PL.txt index ffc85dfe..c74e501f 100644 --- a/pkgfiles/USRDIR/sys/loc/PL.txt +++ b/pkgfiles/USRDIR/sys/loc/PL.txt @@ -12,8 +12,7 @@ STR_DIRS {Katalogi} STR_UNKNOWN {Nieznany} STR_FILE {Plik} STR_CANCEL {Anuluj} -STR_TURNOFF_YES {WYŁĄCZ = TAK} -STR_TURNOFF_NO {WYŁĄCZ = NIE} +STR_TURNOFF {WYŁĄCZ} STR_CANCELLED {Anulowano} STR_UNIT {Bajty} STR_TOTALSIZE {Całkowity rozmiar} diff --git a/pkgfiles/USRDIR/sys/loc/RU.txt b/pkgfiles/USRDIR/sys/loc/RU.txt index ad72953a..be2ecea4 100644 --- a/pkgfiles/USRDIR/sys/loc/RU.txt +++ b/pkgfiles/USRDIR/sys/loc/RU.txt @@ -12,8 +12,7 @@ STR_DIRS {Каталоги} STR_UNKNOWN {Неизвестно} STR_FILE {Файл} STR_CANCEL {Отмена} -STR_TURNOFF_YES {Выключить = ДА} -STR_TURNOFF_NO {Выключить = НЕТ} +STR_TURNOFF {Выключить} STR_CANCELLED {Отменено} STR_UNIT {Байт} STR_TOTALSIZE {Общий размер} diff --git a/pkgfiles/USRDIR/sys/loc/SE.txt b/pkgfiles/USRDIR/sys/loc/SE.txt index d552b5b3..7b2a9f83 100644 --- a/pkgfiles/USRDIR/sys/loc/SE.txt +++ b/pkgfiles/USRDIR/sys/loc/SE.txt @@ -12,8 +12,7 @@ STR_DIRS {Kataloger} STR_UNKNOWN {Okänd} STR_FILE {Fil} STR_CANCEL {Avbryt} -STR_TURNOFF_YES {Stäng AV = JA} -STR_TURNOFF_NO {Stäng AV = NEJ} +STR_TURNOFF {Stäng AV} STR_CANCELLED {Avbrutet} STR_UNIT {Bytes} STR_TOTALSIZE {Total storlek} diff --git a/pkgfiles/USRDIR/sys/sprx_iso b/pkgfiles/USRDIR/sys/sprx_iso index 52d4d97b..f0195cb2 100644 Binary files a/pkgfiles/USRDIR/sys/sprx_iso and b/pkgfiles/USRDIR/sys/sprx_iso differ