write gc/xbox versions of NoRareSelling

This commit is contained in:
Martin Michelsen
2025-03-14 23:04:38 -07:00
parent f0c492abea
commit ed05bbe2e3
20 changed files with 704 additions and 461 deletions
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E114 # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010E100 # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E248 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E3BC
.data 0x00000004
.address 0x8010E3BC
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E114 # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010E100 # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E248 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E3BC
.data 0x00000004
.address 0x8010E3BC
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E00C # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010DFF8 # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E140 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E2B4
.data 0x00000004
.address 0x8010E2B4
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010DE70 # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010DE5C # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010DFA4 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E118
.data 0x00000004
.address 0x8010E118
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E070 # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010E05C # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E1A4 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E318
.data 0x00000004
.address 0x8010E318
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E1BC # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010E1A8 # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E2F0 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E464
.data 0x00000004
.address 0x8010E464
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010DFFC # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010DFE8 # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E130 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E2A4
.data 0x00000004
.address 0x8010E2A4
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,47 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# GC port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksGC
# See comments in the 59NL version of this patch for details on how it works.
.data 0x8010E1F0 # Rare weapons
.data 0x00000004
li r29, 0
.data 0x8010E1DC # Unidentified weapons
.data 0x00000004
li r29, 0
.data 0x8010E324 # Rare armors
.data 0x00000004
li r29, 0
.data 0x800041A0
.deltaof tool_check_start, tool_check_end
.address 0x800041A0
tool_check_start:
lwz r29, [r3 + 0x10] # Flags
xori r29, r29, 0x0080
andi. r29, r29, 0x0080
beq is_rare_tool
lwz r29, [r3 + 0x0C] # Cost
is_rare_tool:
blr
tool_check_end:
.data 0x8010E498
.data 0x00000004
.address 0x8010E498
bl tool_check_start
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DEA6 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DE8C # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E04E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017ECE1
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DED6 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DEBC # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E07E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017ED11
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DD36 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DD1C # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017DEDE
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017EB71
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DEB6 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DE9C # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E05E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017ECF1
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DF66 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DF4C # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E10E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017EDA1
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DEC6 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DEAC # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E06E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017ED01
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,38 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
# Xbox port by fuzziqersoftware
.meta name="No rare selling"
.meta description="Stops you from\naccidentally\nselling rares\nto vendors"
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
# See comments in the 59NL version of this patch for details on how it works.
.data 0x0017DE96 # Rare weapons and armors
.data 0x00000004
.data 0x00000000
.data 0x0017DE7C # Unidentified weapons
.data 0x00000004
.data 0x00000000
.data 0x0017E03E
.data 0x00000005
.binary E98E0C0000 # jmp tool_check_start
.data 0x0017ECD1
.deltaof tool_check_start, tool_check_end
tool_check_start:
xor edi, edi
test byte [eax + 0x10], 0x80
cmovz edi, [eax + 0x0C]
.binary E995F3FFFF # jmp tool_check_ret
tool_check_end:
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,43 @@
# Original patch by Soly, in Blue Burst Patch Project
# https://github.com/Solybum/Blue-Burst-Patch-Project
.meta name="No rare selling"
.meta description="Stops you from accidentally\nselling rares to vendors"
entry_ptr:
reloc0:
.offsetof start
start:
# This works by setting the item price to zero if it's rare, which causes
# the game to prevent you from selling the item. For armors and weapons, this
# is easy because there are easily-patchable opcodes within branches that
# return a constant price for rare items.
xor eax, eax
mov [0x005D25AF], eax # Rare armors
mov [0x005D26F1], eax # Unidentified weapons
mov [0x005D2706], eax # Rare weapons
# For tools, it's a harder to implement this, because the price comes from
# the ItemPMT tools table and there is no branch for rares. Still, we can add
# a branch to a stub to handle tools.
pop ecx
push 5
push 0x005D2528
call get_code_size
.deltaof patch_code, patch_code_end
get_code_size:
pop eax
push dword [eax]
call patch_code_end
patch_code:
# TODO: It'd be nice to have something like WriteJumpToAndFromCode, since
# this hook is supposed to return to a different place than where it was
# called, hence this mov [esp].
mov dword [esp], 0x005D2576
xor edi, edi
test byte [eax + 0x14], 0x80 # flags & 0x80 = is rare
cmovz edi, [eax + 0x10] # Use price from table if not rare
ret
patch_code_end:
push ecx
.include WriteCallToCode-59NL