From 442167e569ecb1c268cc5a95dc336143a598cb05 Mon Sep 17 00:00:00 2001 From: CTurt Date: Wed, 12 Aug 2020 21:35:44 +0100 Subject: [PATCH] More 2.12 regions, WIP 2.13 --- Filesystems/{2.10 => 2.10-2.13}/BOOT.ELF | Bin .../{2.10 => 2.10-2.13}/VIDEO_TS/VIDEO_TS.IFO | Bin .../{2.10 => 2.10-2.13}/VIDEO_TS/VTS_01_0.IFO | Bin PAYLOADS/1.00-2.13/Mainrules.mk | 25 +++++++----- PAYLOADS/1.00-2.13/emulator.mk | 13 +++++- PAYLOADS/1.00-2.13/hardware.mk | 15 ++++--- PAYLOADS/1.00-2.13/ioppayload.iop.c | 11 +++-- .../{stage1.iop.S => stage1_210_212.iop.S} | 0 PAYLOADS/1.00-2.13/stage1_213.iop.S | 38 ++++++++++++++++++ ....iso => Some 2.10 models and all 2.12.iso} | Bin 7344128 -> 7344128 bytes README.md | 4 +- 11 files changed, 84 insertions(+), 22 deletions(-) rename Filesystems/{2.10 => 2.10-2.13}/BOOT.ELF (100%) rename Filesystems/{2.10 => 2.10-2.13}/VIDEO_TS/VIDEO_TS.IFO (100%) rename Filesystems/{2.10 => 2.10-2.13}/VIDEO_TS/VTS_01_0.IFO (100%) rename PAYLOADS/1.00-2.13/{stage1.iop.S => stage1_210_212.iop.S} (100%) create mode 100644 PAYLOADS/1.00-2.13/stage1_213.iop.S rename PREBUILT ISOs/{some 2.10 models and 2.12U.iso => Some 2.10 models and all 2.12.iso} (99%) diff --git a/Filesystems/2.10/BOOT.ELF b/Filesystems/2.10-2.13/BOOT.ELF similarity index 100% rename from Filesystems/2.10/BOOT.ELF rename to Filesystems/2.10-2.13/BOOT.ELF diff --git a/Filesystems/2.10/VIDEO_TS/VIDEO_TS.IFO b/Filesystems/2.10-2.13/VIDEO_TS/VIDEO_TS.IFO similarity index 100% rename from Filesystems/2.10/VIDEO_TS/VIDEO_TS.IFO rename to Filesystems/2.10-2.13/VIDEO_TS/VIDEO_TS.IFO diff --git a/Filesystems/2.10/VIDEO_TS/VTS_01_0.IFO b/Filesystems/2.10-2.13/VIDEO_TS/VTS_01_0.IFO similarity index 100% rename from Filesystems/2.10/VIDEO_TS/VTS_01_0.IFO rename to Filesystems/2.10-2.13/VIDEO_TS/VTS_01_0.IFO diff --git a/PAYLOADS/1.00-2.13/Mainrules.mk b/PAYLOADS/1.00-2.13/Mainrules.mk index 605b2d4..220cd8b 100644 --- a/PAYLOADS/1.00-2.13/Mainrules.mk +++ b/PAYLOADS/1.00-2.13/Mainrules.mk @@ -10,16 +10,18 @@ IOP_OBJCOPY = iop-objcopy IOP_OBJDUMP = iop-objdump IOP_SYMBOLS = -DREAD_SECTORS_210=$(IOP_READ_SECTORS_210) -DORIGINAL_RETURN_ADDRESS_210=$(IOP_ORIGINAL_RETURN_ADDRESS_210) -DRETURN_ADDRESS_LOCATION_210=$(IOP_RETURN_ADDRESS_LOCATION_210) \ - -DREAD_SECTORS_212=$(IOP_READ_SECTORS_212) -DORIGINAL_RETURN_ADDRESS_212=$(IOP_ORIGINAL_RETURN_ADDRESS_212) -DRETURN_ADDRESS_LOCATION_212=$(IOP_RETURN_ADDRESS_LOCATION_212) + -DREAD_SECTORS_212=$(IOP_READ_SECTORS_212) -DORIGINAL_RETURN_ADDRESS_212=$(IOP_ORIGINAL_RETURN_ADDRESS_212) -DRETURN_ADDRESS_LOCATION_212=$(IOP_RETURN_ADDRESS_LOCATION_212) \ + -DREAD_SECTORS_213=$(IOP_READ_SECTORS_213) -DORIGINAL_RETURN_ADDRESS_213=$(IOP_ORIGINAL_RETURN_ADDRESS_213) -DRETURN_ADDRESS_LOCATION_213=$(IOP_RETURN_ADDRESS_LOCATION_213) IOP_CFLAGS = -O2 -G 0 -nostartfiles -nostdlib -ffreestanding -g $(IOP_SYMBOLS) EE_CFLAGS = -O2 -G 0 -nostartfiles -nostdlib -ffreestanding -Wl,-z,max-page-size=0x1 -IOP_STAGE1_SIZE = `stat -c '%s' stage1.iop.bin` +IOP_STAGE1_SIZE_210_212 = `stat -c '%s' stage1_210_212.iop.bin` +IOP_STAGE1_SIZE_213 = `stat -c '%s' stage1_213.iop.bin` IOP_PAYLOAD_SIZE = `stat -c '%s' ioppayload.iop.bin` -dvd.iso: dvd.base.iso stage1.iop.bin ioppayload.iop.bin +dvd.iso: dvd.base.iso stage1_210_212.iop.bin stage1_213.iop.bin ioppayload.iop.bin #genisoimage -udf -o dvd.iso udf/ # @echo Insert 0x00000048 to offset 0x0818AC in dvd.iso # @echo Insert 0x00004000 to offset 0x0818B0 in dvd.iso @@ -29,13 +31,14 @@ dvd.iso: dvd.base.iso stage1.iop.bin ioppayload.iop.bin cp dvd.base.iso dvd.iso # Return address 0x00818f4 = 530676 - printf $(STAGE1_LOAD_ADDRESS_STRING) | dd of=dvd.iso bs=1 seek=530676 count=4 conv=notrunc + printf $(STAGE1_LOAD_ADDRESS_STRING_210_212) | dd of=dvd.iso bs=1 seek=530676 count=4 conv=notrunc # Old toolchains don't support this option, so just copy byte-by-byte... # bs=4096 iflag=skip_bytes,count_bytes - # 0x820f8 = 532728 - dd if=stage1.iop.bin of=dvd.iso bs=1 seek=532728 count=$(IOP_STAGE1_SIZE) conv=notrunc + dd if=stage1_210_212.iop.bin of=dvd.iso bs=1 seek=$(STAGE1_ISO_210_212) count=$(IOP_STAGE1_SIZE_210_212) conv=notrunc + dd if=stage1_213.iop.bin of=dvd.iso bs=1 seek=$(STAGE1_ISO_213) count=$(IOP_STAGE1_SIZE_213) conv=notrunc + # 0x700000 = 7340032 dd if=ioppayload.iop.bin of=dvd.iso bs=1 seek=7340032 count=$(IOP_PAYLOAD_SIZE) conv=notrunc @@ -45,11 +48,15 @@ dvd.iso: dvd.base.iso stage1.iop.bin ioppayload.iop.bin %.iop.o: %.iop.S $(IOP_AS) $< -o $@ -stage1.iop.elf: stage1.iop.S ioppayload.iop.bin +stage1_210_212.iop.elf: stage1_210_212.iop.S ioppayload.iop.bin $(IOP_OBJDUMP) -t ioppayload.iop.elf | grep " _start" - $(IOP_CC) -Ttext=$(STAGE1_LOAD_ADDRESS) $< -DENTRY=$(IOP_PAYLOAD_ENTRY) -DIOP_PAYLOAD_SIZE=$(IOP_PAYLOAD_SIZE) $(IOP_CFLAGS) -o $@ + $(IOP_CC) $< -DENTRY=$(IOP_PAYLOAD_ENTRY) -DIOP_PAYLOAD_SIZE=$(IOP_PAYLOAD_SIZE) $(IOP_CFLAGS) -o $@ -ioppayload.iop.elf: ioppayload.iop.c eepayload.ee.bin +stage1_213.iop.elf: stage1_213.iop.S ioppayload.iop.bin + $(IOP_OBJDUMP) -t ioppayload.iop.elf | grep " _start" + $(IOP_CC) $< -DENTRY=$(IOP_PAYLOAD_ENTRY) -DIOP_PAYLOAD_SIZE=$(IOP_PAYLOAD_SIZE) $(IOP_CFLAGS) -o $@ + +%.iop.elf: %.iop.c eepayload.ee.bin $(IOP_CC) -Ttext=$(IOP_PAYLOAD_ADDRESS) -DLOAD_ELF_FROM_OFFSET=$(LOAD_ELF_FROM_OFFSET) ioppayload.iop.c $(IOP_CFLAGS) -o $@ diff --git a/PAYLOADS/1.00-2.13/emulator.mk b/PAYLOADS/1.00-2.13/emulator.mk index 61b5fae..f388cd2 100644 --- a/PAYLOADS/1.00-2.13/emulator.mk +++ b/PAYLOADS/1.00-2.13/emulator.mk @@ -1,12 +1,21 @@ -STAGE1_LOAD_ADDRESS = 0xa00b7548 -STAGE1_LOAD_ADDRESS_STRING = '\x48\x75\x0b\xa0' +STAGE1_LOAD_ADDRESS_210_212 = 0xa00b7548 +STAGE1_LOAD_ADDRESS_STRING_210_212 = '\x48\x75\x0b\xa0' + +STAGE1_LOAD_ADDRESS_213 = 0xa00b6fc8 +STAGE1_LOAD_ADDRESS_STRING_213 = '\xc8\x6f\x0b\xa0' + +STAGE1_ISO_210_212 = 532728 # 0x820f8 +STAGE1_ISO_213 = 534136 # 0x82678 IOP_READ_SECTORS_210 = 0xb260c IOP_READ_SECTORS_212 = 0xb25f8 +IOP_READ_SECTORS_213 = 0xb21f8 IOP_ORIGINAL_RETURN_ADDRESS_210 = 0xb3630 IOP_ORIGINAL_RETURN_ADDRESS_212 = 0xB35D8 +IOP_ORIGINAL_RETURN_ADDRESS_213 = 0xB31EC IOP_RETURN_ADDRESS_LOCATION_210 = 0x1f62ac IOP_RETURN_ADDRESS_LOCATION_212 = 0x1f62b4 +IOP_RETURN_ADDRESS_LOCATION_213 = 0x1F62B4 #IOP_PAYLOAD_ENTRY = `$(IOP_OBJDUMP) -t ioppayload.iop.elf | grep " _start"` diff --git a/PAYLOADS/1.00-2.13/hardware.mk b/PAYLOADS/1.00-2.13/hardware.mk index c93b011..f75360e 100644 --- a/PAYLOADS/1.00-2.13/hardware.mk +++ b/PAYLOADS/1.00-2.13/hardware.mk @@ -1,16 +1,21 @@ -STAGE1_LOAD_ADDRESS = 0xa0062C48 # hardware -STAGE1_LOAD_ADDRESS_STRING = '\x48\x2c\x06\xa0' +STAGE1_LOAD_ADDRESS_210_212 = 0xa0062C48 +STAGE1_LOAD_ADDRESS_STRING_210_212 = '\x48\x2c\x06\xa0' -IOP_READ_SECTORS = 0x5DD0C # 0xb260c + 0x5c700 - 0xb1000 -IOP_ORIGINAL_RETURN_ADDRESS = 0x5ED30 # 0xb3630 + 0x5c700 - 0xb1000 -IOP_RETURN_ADDRESS_LOCATION = 0x1F30AC # 0x1f62ac + 0x1F3058 - 0x1f6258 +STAGE1_LOAD_ADDRESS_213 = 0xA00626C8 # 0xa00b6fc8 + 0x5c700 - 0xb1000 +STAGE1_LOAD_ADDRESS_STRING_213 = '\xc8\x26\x06\xa0' + +STAGE1_ISO_210_212 = 532728 # 0x820f8 +STAGE1_ISO_213 = 534136 # 0x82678 IOP_READ_SECTORS_210 = 0x5DD0C # 0xb260c + 0x5c700 - 0xb1000 IOP_READ_SECTORS_212 = 0x5DCF8 # 0xb25f8 + 0x5c700 - 0xb1000 +IOP_READ_SECTORS_213 = 0x5D8F8 # 0xb21f8 + 0x5c700 - 0xb1000 IOP_ORIGINAL_RETURN_ADDRESS_210 = 0x5ED30 # 0xb3630 + 0x5c700 - 0xb1000 IOP_ORIGINAL_RETURN_ADDRESS_212 = 0x5ECD8 # 0xB35D8 + 0x5c700 - 0xb1000 +IOP_ORIGINAL_RETURN_ADDRESS_213 = 0x5E8EC # 0xB31EC + 0x5c700 - 0xb1000 IOP_RETURN_ADDRESS_LOCATION_210 = 0x1F30AC # 0x1f62ac + 0x1F3058 - 0x1f6258 IOP_RETURN_ADDRESS_LOCATION_212 = 0x1F30B4 # 0x1f62b4 + 0x1F3058 - 0x1f6258 +IOP_RETURN_ADDRESS_LOCATION_213 = 0x1F30B4 # 0x1F62B4 + 0x1F3058 - 0x1f6258 #IOP_PAYLOAD_ENTRY = `$(IOP_OBJDUMP) -t ioppayload.iop.elf | grep " _start"` diff --git a/PAYLOADS/1.00-2.13/ioppayload.iop.c b/PAYLOADS/1.00-2.13/ioppayload.iop.c index f456a26..9c13f50 100644 --- a/PAYLOADS/1.00-2.13/ioppayload.iop.c +++ b/PAYLOADS/1.00-2.13/ioppayload.iop.c @@ -120,9 +120,10 @@ void _start(void) { sceSifSetDma = (void *)0x16fc8; sceSifDmaStat = (void *)0x17170; - if(*(unsigned int *)READ_SECTORS_210 == 0x27bdffc8) // addiu $sp, $sp, -0x38 - readSectors = (void *)READ_SECTORS_210; - else readSectors = (void *)READ_SECTORS_212; + unsigned int addiu_magic = 0x27bdffc8; // addiu $sp, $sp, -0x38 + if(*(unsigned int *)READ_SECTORS_210 == addiu_magic) readSectors = (void *)READ_SECTORS_210; + else if(*(unsigned int *)READ_SECTORS_212 == addiu_magic) readSectors = (void *)READ_SECTORS_212; + else if(*(unsigned int *)READ_SECTORS_213 == addiu_magic) readSectors = (void *)READ_SECTORS_213; transfer_to_ee(EE_CRT0_ADDRESS, ee_crt0, ee_crt0_size); @@ -132,8 +133,10 @@ void _start(void) { transfer_to_ee((void *)0x12D1C70, &return_address, sizeof(return_address)); // 2.10U transfer_to_ee((void *)0x12B8CF0, &return_address, sizeof(return_address)); // 2.12U + transfer_to_ee((void *)0x148D0F0, &return_address, sizeof(return_address)); // 2.12G + transfer_to_ee((void *)0xFE5FF0, &return_address, sizeof(return_address)); // 2.12J - + transfer_to_ee((void *)0x01477B80, &return_address, sizeof(return_address)); // 2.13E/A // Clear bit 0 of 0x208bb710 to make EE exit loop waiting for IOP, and return to our above payload //unsigned int loopValue = 0x010004; diff --git a/PAYLOADS/1.00-2.13/stage1.iop.S b/PAYLOADS/1.00-2.13/stage1_210_212.iop.S similarity index 100% rename from PAYLOADS/1.00-2.13/stage1.iop.S rename to PAYLOADS/1.00-2.13/stage1_210_212.iop.S diff --git a/PAYLOADS/1.00-2.13/stage1_213.iop.S b/PAYLOADS/1.00-2.13/stage1_213.iop.S new file mode 100644 index 0000000..5619259 --- /dev/null +++ b/PAYLOADS/1.00-2.13/stage1_213.iop.S @@ -0,0 +1,38 @@ +# ElReino & CTurt 2020 + +flushIcache = 0x00002f40 +flushDcache = 0x0003044 + +#flushDcacheWrapper = 0x0057f1c + +iop_payload_address = 0xa00fd000 + +.section .text + +.global _start +_start: + move $fp, $sp # We need to reset $fp as it gets trashed by memcpy + + la $v0, READ_SECTORS_213 + +read_iop_payload: + la $a0, (IOP_PAYLOAD_SIZE / 0x800) + 1 # count + la $a1, 0x700000 / 0x800 # sector + la $a2, iop_payload_address # destination + jal $v0 + + #jal flushIcache + #jal flushDcache + + #jal ENTRY + la $v0, ENTRY + jalr $v0 + + la $a0, RETURN_ADDRESS_LOCATION_213 + la $ra, ORIGINAL_RETURN_ADDRESS_213 + +return: + # Return gracefully back to original return address + sw $ra, 0($a0) + la $v0, 0 + jr $ra diff --git a/PREBUILT ISOs/some 2.10 models and 2.12U.iso b/PREBUILT ISOs/Some 2.10 models and all 2.12.iso similarity index 99% rename from PREBUILT ISOs/some 2.10 models and 2.12U.iso rename to PREBUILT ISOs/Some 2.10 models and all 2.12.iso index a3e0371d42ae2d93addc0e5112db2788665e9ef4..0a921295ea04b92ec19b92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#vS zSWB!UYKiqk9kGG1iH$@(v5DABY$3K1+X#o)PV68Wh@HePB0=mX_7IIk6VXhx5POMz zM3UG~93T!7hls;OD{+K4N*p7O6K%u^;v{j3XeUk+XNa@JIpRFgL39!qh%VwHaf!H0 zbQ4#ItHd?pI&p)zN!)sYo>Li_8E98!vU}i;vi<#275CRERWG}}LaAD0#%q(R{ci7! z7P%sxjYtuS86xa-h_@q=&)@A_G~`I3`BQgZ#|=k_Zz+*Y*poe7wz}=wler<=@?9$} z9g(RT4yvAs4Nr)7R`g|B`}+YBcEHU{rJv_H4?j$#a#7u}(tf|Gp;&T8n;#Kb*WM>} zXZpPBH+&aQdYvIvyvolamdK0M_>n4|jb_=JKu`VCKZexfg@La7dM=25xpv2&P7gFS zE|XrPt{P;ocTZPI|MXs0#qy2!RaebEtT9xT4_ggYUKF0u%<0_i*xx(Hhw1ejs=|M% f=Z0G6moJ98KQ6;6Cq1)34Tc6o{j&W@z6$>a9v=Nd diff --git a/README.md b/README.md index 4918735..35b08f6 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,9 @@ Boot your PlayStation 2 without any disc inserted, and press Triangle to identif **Currently only support:** -- 2.10 (certain models only?), +- 2.10 (certain models only? Working: SCPH-30001 R (ROMGEN 0160AC20010427), SCPH-30000 (ROMGEN 0160JC20010427), SCPH-30004 R (ROMGEN 0160EC20011004), Not working: SCPH-39004 - todo), -- 2.12 (region U, others to be added soon), +- 2.12 (regions U, J, and G, if any other regions exist for 2.12 let me know), - 3.04 (tested only region M in emulator so far, but guess most other regions EUMACDG, except for J will work - with English language set in settings),