From 0a3ae495e7cace7ec8e74a6a649c96cf3c2b2af6 Mon Sep 17 00:00:00 2001 From: hrimfaxi Date: Wed, 29 Jun 2011 20:18:15 +0800 Subject: [PATCH] added 371 support --- popsloader/Makefile | 3 ++ popsloader/core/replace_module.c | 2 + popsloader/core/resolve_nid.c | 4 +- popsloader/loader/ui.c | 1 + popsloader/popcorn/Makefile | 5 ++ popsloader/popcorn/exports.exp | 1 + popsloader/popcorn/main.c | 23 +++++++-- popsloader/popcorn/popcorn_patch_offset.c | 58 ++++++++++++++++++++++- 8 files changed, 90 insertions(+), 7 deletions(-) diff --git a/popsloader/Makefile b/popsloader/Makefile index 8633d14..5c40a55 100644 --- a/popsloader/Makefile +++ b/popsloader/Makefile @@ -12,6 +12,9 @@ all: @cp -f core/popscore.prx dist @cp -rf modules dist make $(EXTRA_OPTIONS) clean -C popcorn + make $(EXTRA_OPTIONS) CONFIG_371=1 -C popcorn + @cp -f popcorn/popcorn.prx dist/modules/371/ + make $(EXTRA_OPTIONS) clean -C popcorn make $(EXTRA_OPTIONS) CONFIG_373=1 -C popcorn @cp -f popcorn/popcorn.prx dist/modules/373/ make $(EXTRA_OPTIONS) clean -C popcorn diff --git a/popsloader/core/replace_module.c b/popsloader/core/replace_module.c index d771832..6b9099e 100644 --- a/popsloader/core/replace_module.c +++ b/popsloader/core/replace_module.c @@ -118,6 +118,8 @@ const char *get_module_prefix(void) sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "400"); } else if(pops_fw_version == FW_373) { sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "373"); + } else if(pops_fw_version == FW_371) { + sprintf(buf, "%s%s%s/", is_ef0() ? "ef" : "ms", MODULE_PATH, "371"); } else { printk("%s: Unknown version: 0x%08X\n", __func__, pops_fw_version); asm("break"); diff --git a/popsloader/core/resolve_nid.c b/popsloader/core/resolve_nid.c index b9e03ab..e36b3f5 100644 --- a/popsloader/core/resolve_nid.c +++ b/popsloader/core/resolve_nid.c @@ -51,7 +51,7 @@ void setup_nid_resolver(void) nid_fix = nid_fix_400_to_620; } - if(pops_fw_version == FW_373) { + if(pops_fw_version >= FW_371 && pops_fw_version <= FW_373) { nid_fix_size = nid_fix_373_to_620_size; nid_fix = nid_fix_373_to_620; } @@ -73,7 +73,7 @@ void setup_nid_resolver(void) nid_fix = nid_fix_400_to_635; } - if(pops_fw_version == FW_373) { + if(pops_fw_version >= FW_371 && pops_fw_version <= FW_373) { nid_fix_size = nid_fix_373_to_635_size; nid_fix = nid_fix_373_to_635; } diff --git a/popsloader/loader/ui.c b/popsloader/loader/ui.c index 7d0cf47..3756f25 100644 --- a/popsloader/loader/ui.c +++ b/popsloader/loader/ui.c @@ -167,6 +167,7 @@ int menu_ctrl(struct Menu *menu) } struct MenuItem main_menu_items[] = { + { "3.71 pops", FW_371, }, { "3.73 pops", FW_373, }, { "4.00 pops", FW_400, }, { "5.00 pops", FW_500, }, diff --git a/popsloader/popcorn/Makefile b/popsloader/popcorn/Makefile index 597a1eb..ad7a3e6 100644 --- a/popsloader/popcorn/Makefile +++ b/popsloader/popcorn/Makefile @@ -14,6 +14,11 @@ OBJS += $(PRO_HOME)/Common/printk.o else endif +ifeq ($(CONFIG_371), 1) +CFLAGS += -DCONFIG_371=1 +PSP_FW_VERSION = 371 +endif + ifeq ($(CONFIG_373), 1) CFLAGS += -DCONFIG_373=1 PSP_FW_VERSION = 373 diff --git a/popsloader/popcorn/exports.exp b/popsloader/popcorn/exports.exp index 8af0185..510408a 100644 --- a/popsloader/popcorn/exports.exp +++ b/popsloader/popcorn/exports.exp @@ -10,6 +10,7 @@ PSP_EXPORT_END PSP_EXPORT_START(PopcornPrivate, 0x0011, 0x4001) PSP_EXPORT_FUNC(decompress_data) +PSP_EXPORT_FUNC(decompress_data_371) PSP_EXPORT_FUNC(_sceMeAudio_67CD7972) PSP_EXPORT_FUNC(myCtrlPeekBufferPositive) PSP_EXPORT_FUNC(myCtrlPeekBufferNegative) diff --git a/popsloader/popcorn/main.c b/popsloader/popcorn/main.c index 2c79dcd..1d13507 100644 --- a/popsloader/popcorn/main.c +++ b/popsloader/popcorn/main.c @@ -781,8 +781,13 @@ int decompress_data(u32 destSize, const u8 *src, u8 *dest) ret = sceKernelDeflateDecompress(dest, destSize, src, 0); printk("%s: 0x%08X 0x%08X 0x%08X -> 0x%08X\n", __func__, (uint)destSize, (uint)src, (uint)dest, ret); - if(psp_fw_version >= FW_400 && ret == 0x9300) { - ret = 0x92FF; + if(ret >= 0) { + if(psp_fw_version >= FW_400) { + ret = 0x92FF; + } else { + ret = 0x9300; + } + printk("%s: [FAKE] -> 0x%08X\n", __func__, ret); } @@ -791,6 +796,11 @@ int decompress_data(u32 destSize, const u8 *src, u8 *dest) return ret; } +int decompress_data_371(u8 *dest, u32 destSize, const u8 *src) +{ + return decompress_data(destSize, src, dest); +} + static int patch_decompress_data(u32 text_addr) { int ret; @@ -798,7 +808,12 @@ static int patch_decompress_data(u32 text_addr) stub_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].stub_offset); patch_addr = (void*)(text_addr + g_offs->pops_patch.decomp[psp_model].patch_offset); - ret = place_syscall_stub(decompress_data, stub_addr); + + if(psp_fw_version <= FW_371) { + ret = place_syscall_stub(decompress_data_371, stub_addr); + } else { + ret = place_syscall_stub(decompress_data, stub_addr); + } if (ret != 0) { printk("%s: place_syscall_stub -> 0x%08X\n", __func__, ret); @@ -817,7 +832,7 @@ static void patch_icon0_size(u32 text_addr) patch_addr = text_addr + g_offs->pops_patch.ICON0SizeOffset[psp_model]; - if(psp_fw_version == FW_373) { + if(psp_fw_version <= FW_373) { _sw(0x24090000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); } else { _sw(0x24050000 | (sizeof(g_icon_png) & 0xFFFF), patch_addr); diff --git a/popsloader/popcorn/popcorn_patch_offset.c b/popsloader/popcorn/popcorn_patch_offset.c index 0921502..ac3a11b 100644 --- a/popsloader/popcorn/popcorn_patch_offset.c +++ b/popsloader/popcorn/popcorn_patch_offset.c @@ -18,7 +18,7 @@ #include #include "popcorn_patch_offset.h" -#if !defined(CONFIG_635) && !defined(CONFIG_620) && !defined(CONFIG_639) && !defined(CONFIG_610) && !defined(CONFIG_600) && !defined(CONFIG_551) && !defined(CONFIG_550) && !defined(CONFIG_503) && !defined(CONFIG_501) && !defined(CONFIG_500) && !defined(CONFIG_400) && !defined(CONFIG_373) +#if !defined(CONFIG_635) && !defined(CONFIG_620) && !defined(CONFIG_639) && !defined(CONFIG_610) && !defined(CONFIG_600) && !defined(CONFIG_551) && !defined(CONFIG_550) && !defined(CONFIG_503) && !defined(CONFIG_501) && !defined(CONFIG_500) && !defined(CONFIG_400) && !defined(CONFIG_373) && !defined(CONFIG_371) #error You have to define one of CONFIG_FW_VERSION #endif @@ -622,6 +622,56 @@ PatchOffset g_373_offsets = { }; #endif +#ifdef CONFIG_371 +PatchOffset g_371_offsets = { + .fw_version = FW_371, + .popsman_patch = { + .get_rif_path = 0xDEADBEEF, + .get_rif_path_call1 = 0xDEADBEEF, + .get_rif_path_call2 = 0xDEADBEEF, + .sceNpDrmGetVersionKeyCall = 0xDEADBEEF, + .scePspNpDrm_driver_9A34AC9F_Call = 0x0000059C, + .scePopsManLoadModuleCheck = 0x000000D4, + }, + .pops_patch = { + .decomp = { + { 0x0002BDA0, 0x00014100 }, // 01G + { 0x0002BDA0, 0x00014100 }, // 02G + { 0x0002BDA0, 0x00014100 }, // 03G + { 0x0002BDA0, 0x00014100 }, // 04G + { 0x0002BDA0, 0x00014100 }, // 05G + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + { 0x0002BDA0, 0x00014100 }, // unused + }, + .ICON0SizeOffset = { + 0x000253F4, // 01G + 0x000253F4, // 02G + 0x000253F4, // 03G + 0x000253F4, // 04G + 0x000253F4, // 05G + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + 0x000253F4, // unused + }, + .manualNameCheck = { + 0x0001B044, // 01G + 0x0001B044, // 02G + 0x0001B044, // 03G + 0x0001B044, // 04G + 0x0001B044, // 05G + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + 0x0001B044, // unused + }, + .sceMeAudio_67CD7972_NID = 0x902F30D8, + }, +}; +#endif + PatchOffset *g_offs = NULL; void setup_patch_offset_table(u32 fw_version) @@ -697,4 +747,10 @@ void setup_patch_offset_table(u32 fw_version) g_offs = &g_373_offsets; } #endif + +#ifdef CONFIG_371 + if(fw_version == g_371_offsets.fw_version) { + g_offs = &g_371_offsets; + } +#endif }