Skip to content

Commit

Permalink
added 371 support
Browse files Browse the repository at this point in the history
  • Loading branch information
hrimfaxi committed Jun 29, 2011
1 parent 3d41bd0 commit 0a3ae49
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 7 deletions.
3 changes: 3 additions & 0 deletions popsloader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions popsloader/core/replace_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions popsloader/core/resolve_nid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions popsloader/loader/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, },
Expand Down
5 changes: 5 additions & 0 deletions popsloader/popcorn/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions popsloader/popcorn/exports.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 19 additions & 4 deletions popsloader/popcorn/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -791,14 +796,24 @@ 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;
void *stub_addr, *patch_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);
Expand All @@ -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);
Expand Down
58 changes: 57 additions & 1 deletion popsloader/popcorn/popcorn_patch_offset.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <pspsdk.h>
#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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

0 comments on commit 0a3ae49

Please sign in to comment.