diff --git a/src/SaveFileFormats.hh b/src/SaveFileFormats.hh index 0833edac..d57ef315 100644 --- a/src/SaveFileFormats.hh +++ b/src/SaveFileFormats.hh @@ -228,6 +228,7 @@ struct PSOGCCharacterFile { // 00000001: Character was not saved after disconnecting (and the message // about items being deleted is shown in the select menu) // 00000002: Used for something, but it's not known what it does + // 00000010: Used on DCv2, but not clear what it does /* 041C:0000 */ be_uint32_t flags = 0; /* 0420:0004 */ be_uint32_t creation_timestamp = 0; // The signature field holds the value 0xA205B064, which is 2718281828 in diff --git a/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OEF.patch.s b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OEF.patch.s new file mode 100644 index 00000000..66c2c792 --- /dev/null +++ b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OEF.patch.s @@ -0,0 +1,60 @@ +.meta name="No item loss" +.meta description="Don't lose items if\nyou don't log off\nnormally" + +entry_ptr: +reloc0: + .offsetof start +start: + .include WriteCodeBlocksDC + + .align 4 + .data 0x8C16BDFE + .data 2 + sett + + .align 4 + .data 0x8C17F1DE + .data 2 + nop + + .align 4 + .data 0x8C180DB0 + .data 2 + nop + + .align 4 + .data 0x8C181C92 + .data 2 + nop + + .align 4 + .data 0x8C1834D2 + .data 2 + nop + + .align 4 + .data 0x8C182BC8 + .data 2 + nop + + .align 4 + .data 0x8C180D0C + .data 2 + nop + + .align 4 + .data 0x8C181BC6 + .data 2 + nop + + .align 4 + .data 0x8C0280AA + .data 6 + .binary 090014A00900 + # nop + # bs +0x2C # 8C0280D8 + # nop + + .align 4 + .data 0x00000000 + .data 0x00000000 diff --git a/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJ5.patch.s b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJ5.patch.s new file mode 100644 index 00000000..0b963b89 --- /dev/null +++ b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJ5.patch.s @@ -0,0 +1,60 @@ +.meta name="No item loss" +.meta description="Don't lose items if\nyou don't log off\nnormally" + +entry_ptr: +reloc0: + .offsetof start +start: + .include WriteCodeBlocksDC + + .align 4 + .data 0x8C16BDFE + .data 2 + sett + + .align 4 + .data 0x8C17F1DE + .data 2 + nop + + .align 4 + .data 0x8C180DB0 + .data 2 + nop + + .align 4 + .data 0x8C181C92 + .data 2 + nop + + .align 4 + .data 0x8C1834D2 + .data 2 + nop + + .align 4 + .data 0x8C182BC8 + .data 2 + nop + + .align 4 + .data 0x8C180D0C + .data 2 + nop + + .align 4 + .data 0x8C181BC6 + .data 2 + nop + + .align 4 + .data 0x8C0280AA + .data 6 + .binary 090014A00900 + # nop + # bs +0x2C + # nop + + .align 4 + .data 0x00000000 + .data 0x00000000 diff --git a/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJF.patch.s b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJF.patch.s new file mode 100644 index 00000000..b7dfc3dc --- /dev/null +++ b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OJF.patch.s @@ -0,0 +1,60 @@ +.meta name="No item loss" +.meta description="Don't lose items if\nyou don't log off\nnormally" + +entry_ptr: +reloc0: + .offsetof start +start: + .include WriteCodeBlocksDC + + .align 4 + .data 0x8C16B50A + .data 2 + sett + + .align 4 + .data 0x8C17E73A + .data 2 + nop + + .align 4 + .data 0x8C180100 + .data 2 + nop + + .align 4 + .data 0x8C180F96 + .data 2 + nop + + .align 4 + .data 0x8C1825F2 + .data 2 + nop + + .align 4 + .data 0x8C181DC0 + .data 2 + nop + + .align 4 + .data 0x8C18005C + .data 2 + nop + + .align 4 + .data 0x8C180ECA + .data 2 + nop + + .align 4 + .data 0x8C028276 + .data 6 + .binary 090014A00900 + # nop + # bs +0x2C + # nop + + .align 4 + .data 0x00000000 + .data 0x00000000 diff --git a/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OPF.patch.s b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OPF.patch.s new file mode 100644 index 00000000..8b80e89e --- /dev/null +++ b/system/client-functions/ItemLossPrevention/ItemLossPrevention.2OPF.patch.s @@ -0,0 +1,60 @@ +.meta name="No item loss" +.meta description="Don't lose items if\nyou don't log off\nnormally" + +entry_ptr: +reloc0: + .offsetof start +start: + .include WriteCodeBlocksDC + + .align 4 + .data 0x8C16BA22 + .data 2 + sett + + .align 4 + .data 0x8C17EC76 + .data 2 + nop + + .align 4 + .data 0x8C180848 + .data 2 + nop + + .align 4 + .data 0x8C18172A + .data 2 + nop + + .align 4 + .data 0x8C182F6A + .data 2 + nop + + .align 4 + .data 0x8C182660 + .data 2 + nop + + .align 4 + .data 0x8C1807A4 + .data 2 + nop + + .align 4 + .data 0x8C18165E + .data 2 + nop + + .align 4 + .data 0x8C0280AA + .data 6 + .binary 090014A00900 + # nop + # bs +0x2C # 8C0280D8 + # nop + + .align 4 + .data 0x00000000 + .data 0x00000000 diff --git a/system/client-functions/System/WriteCodeBlocksDC.sh4.inc.s b/system/client-functions/System/WriteCodeBlocksDC.sh4.inc.s index 8c9ecafe..b0ac2dea 100644 --- a/system/client-functions/System/WriteCodeBlocksDC.sh4.inc.s +++ b/system/client-functions/System/WriteCodeBlocksDC.sh4.inc.s @@ -1,21 +1,23 @@ mova r0, [first_patch_header] - mov r7, r0 # r7 = read ptr + mov r7, r0 # r7 = read ptr xor r3, r3 dec r3 - shl r3, 2 # r3 = 0xFFFFFFFC (mask for aligning r7) + shl r3, 2 # r3 = 0xFFFFFFFC (mask for aligning r7) apply_patch: add r7, 3 - and r7, r3 # r7 = (r7 + 3) & (~3) (align to 4-byte boundary) - mov.l r4, [r7]+ # r4 = dest addr + and r7, r3 # r7 = (r7 + 3) & (~3) (align to 4-byte boundary) + mov.l r4, [r7]+ # r4 = dest addr mov.l r5, [r7]+ - add r5, r4 # r5 = dest end ptr (dest addr + size) + add r5, r4 # r5 = dest end ptr (dest addr + size) + cmpeq r4, r5 # if (size == 0) return + bt done again: cmpeq r4, r5 - bt done # if (r4 == r5) break + bt apply_patch # if (r4 == r5) done with the patch; go to next header mov.b r0, [r7]+ - mov.b [r4], r0 # *(r4) = *(r7++); - bs again # r4++; continue + mov.b [r4], r0 # *(r4) = *(r7++); + bs again # r4++; continue add r4, 1 done: diff --git a/system/config.example.json b/system/config.example.json index 5dc6c885..a09cc7ad 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -13,7 +13,7 @@ // 192.168.x.x). In PSO's network configuration, set the DNS server address to // the same address you entered in LocalAddress in this file. - // If you also want people to be able to conenct to your newserv instance from + // If you also want people to be able to connect to your newserv instance from // the Internet, you'll need to set ExternalAddress to your public-facing IPv4 // address (you can find this by visiting e.g. whatismyip.com). You'll also // need to set up port forwarding on your router for all the TCP ports listed