Merge remote-tracking branch 'gs/master'
This commit is contained in:
commit
b3d8d55997
2 changed files with 108 additions and 0 deletions
32
gs.lua
Normal file
32
gs.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
package.path = package.path..";./?/init.lua"
|
||||
local lips = require "lips"
|
||||
|
||||
function make_gameshark_writer()
|
||||
local buff = {}
|
||||
local max = -1
|
||||
return function(pos, b)
|
||||
if pos then
|
||||
pos = pos % 0x80000000
|
||||
buff[pos] = b
|
||||
if pos > max then
|
||||
max = pos
|
||||
end
|
||||
elseif max >= 0 then
|
||||
for i=0, max, 2 do
|
||||
local a = buff[i+0]
|
||||
local b = buff[i+1]
|
||||
if a and b then
|
||||
print(('81%06X %s'):format(i, a..b))
|
||||
elseif a then
|
||||
print(('80%06X 00%s'):format(i, a))
|
||||
elseif b then
|
||||
print(('80%06X 00%s'):format(i + 1, b))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local gs = make_gameshark_writer()
|
||||
lips('test.asm', gs, {unsafe=true, offset=0x80000000})
|
||||
gs()
|
76
test.asm
Normal file
76
test.asm
Normal file
|
@ -0,0 +1,76 @@
|
|||
;Free Inventory Movement
|
||||
;This will make it so that you can place the cursor on empty
|
||||
|
||||
;Cursor Movement:
|
||||
|
||||
;LEFT
|
||||
.org 0x803D8B88
|
||||
NOP
|
||||
|
||||
;RIGHT
|
||||
.org 0x803D8C68
|
||||
NOP
|
||||
|
||||
;FROM L
|
||||
.org 0x803D8DD0
|
||||
.skip 8 0 ;NOP the next 2 commands
|
||||
;FROM R
|
||||
.org 0x803D8EA8
|
||||
.skip 8 0 ;NOP the next 2 commands
|
||||
|
||||
;UP
|
||||
.org 0x803D8FAC
|
||||
NOP
|
||||
|
||||
;DOWN
|
||||
.org 0x803D9004
|
||||
NOP
|
||||
|
||||
;Hide Item 0xFF name (on select)
|
||||
.org 0x803E2168
|
||||
lhu a1, 0x023C(v0) ;
|
||||
lhu v1, 0x002A(sp) ;Already there
|
||||
slti at, a1, 0x00FF ;
|
||||
beql at, zero, 0x803E2338
|
||||
|
||||
;Hide Item 0xFF name (loop)
|
||||
.org 0x803E1370
|
||||
slti at, t7, 0x00FF ;Set at to 1 if you don't have item 0xFF or a blank slot selected
|
||||
.org 0x803E1378
|
||||
beql at, zero, 0x803E17E8 ;Branch if you have item 0xFF or a blank slot selected
|
||||
|
||||
;Set Cursor to Default on 0xFF
|
||||
.org 0x803D9058
|
||||
slti t5, a0, 0x00FF ;t5 = 1 if you have selected an item
|
||||
sll t5, t5, 0x0002 ;t5 = t5<<0x2
|
||||
NOP ;
|
||||
|
||||
;Make Item 0xFF unequippable (2.0)
|
||||
.org 0x803D9140
|
||||
addiu at, zero, 0x00FF ;at = 0xFF (Blank)
|
||||
lw t6, 0x0048(sp) ;t6 = Item ID
|
||||
beq at, t6, 0x803D92FC ;Branch past error sound if item is 0xFF (Blank)
|
||||
addiu at, zero, 0x0009 ;at = 0x0009 (Usable by both)
|
||||
beq v0, at, + ;Branch if usable by child and adult
|
||||
lw t5, 0x0004(s4) ;t5 = Age
|
||||
bne v0, t5, 0x803D92D0 ;Branch to error sound if wrong age
|
||||
|
||||
+:
|
||||
NOP ;Remove command
|
||||
|
||||
;Hide text when on empty slot
|
||||
.org 0x803E1B80
|
||||
lhu v0, 0x023E(t0) ;v0 = Selected Item ID
|
||||
slti v0, v0, 0x00FF ;v0 = 1 if Selected Item ID is less than 0xFF
|
||||
beq v0, zero, 0x803E1D0C ;Branch if item ID is 0xFF or higher
|
||||
;Optimized code below
|
||||
lbu t6, 0x1409(t2)
|
||||
lui t7, 0x8016
|
||||
lw t9, 0xFA90(t7)
|
||||
sll t8, t6, 0x1
|
||||
addu v0, t9, t8
|
||||
lw t9, 0x0154(t0)
|
||||
lh v0, 0x0DF6(v0)
|
||||
sh v0, 0x0120(t9)
|
||||
lui a1, 0x803F ;This command need a offset relocation fix. 0x1470 must be added. 0x0000F7FC
|
||||
addiu t3, a1, 0x9968
|
Loading…
Reference in a new issue