Register - Login
Views: 87369671
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - JCS - Stats - Latest Posts - Color Chart - Smilies
11-20-17 08:45:17 AM

Jul - SM64 Hacking - .b64 script interpreter New poll - New thread - New reply
Next newer thread | Next older thread
shyguyhex

Level: 14


Posts: 38/45
EXP: 11361
For next: 1710

Since: 01-03-14


Since last post: 2.0 years
Last activity: 1.0 years

Posted on 10-20-14 01:43:45 AM Link | Quote
I've made a nice script interpreter utility for injecting blocks of data into ram and rom for any N64 game.
I plan for this to be a backend part of Bowser64 eventually.




Download: b64si 10-19b.zip
A simple batch frontend for Nemu ram injection and the example script from the image above are included in the download.


Command line params:
RAM injection:

b64si "script path" (ram mode - 0) (emulator process id as decimal) (emulator vc base as hex)
Ex: b64si "script.b64" 0 1234 10020000


ROM patch:

b64si "script path" (rom mode - 1) "path to rom"
Ex: b64si "script.b64" 1 "path/to/rom.z64"



Script syntax:

:(8 character ram address) // move ram pointer
!(8 character rom address) // move rom pointer


Data constructs:

hex {(hex pool)} // injects a pool of hex data
asm {(asm code)} // assembles mips asm code and injects
asc "text" // injects ascii
m64 "text" // injects sm64 encoded text
bin "file" // injects a file


(All data from the data constructs will get 32bit alignment, and will move the rom/ram pointers automatically when patching.)

Built in functions:

clr(num size) or clr(num size, num char) // clears an area with 0x00's or with a provided char

(clr does not move the ram/rom pointers automatically.)

Comments:

// line comment
# line comment
; line comment
/* block comment */


Currently supported ASM instructions:

J
JAL
BEQ
BNE
BLEZ
BGTZ
ADDI
ADDIU
SLTI
SLTIU
ANDI
ORI
LUI
LLO
LHI
TRAP
LB
LH
LW
LBU
LHU
SB
SH
SW
SLL
SRL
SRA
SLLV
SRLV
SRAV
JR
MFHI
MTHI
MFLO
MTLO
MULT
MULTU
DIV
DIVU
ADD
ADDU
SUB
SUBU
AND
OR
NOR
SLTU
SLT
ADD.S
ADD.D
SUB.S
SUB.D
LWC1
SWC1
MFC1
MTC1
BC1T
BC1F
BC1FL
BC1TL
C.EQ.S
C.EQ.D
C.LT.S
C.LT.D
MUL.S
MUL.D
DIV.S
DIV.D
NEG.S
NEG.D
LD
SD
LDC1
SDC1
XOR
XORI
BEQL
BNEL
SWR
SDL
SDR
DMULT
DMULTU
DDIV
DDIVU
DSLL32
DSRA32
DSRL32
SQRT.S
SQRT.D
MOV.S
MOV.D
CVT.D.S
CVT.D.W
CVT.S.D


Some additional info:
+ R0..R31 register naming can be used for asm
+ , and ) and ( in an asm block are seen as whitespace, so use them however you want
+ All data outputs are in byte-order ABCD (.z64) format!
+ the m64 string encoder doesn't support symbols yet, and it's a little bugged
Next newer thread | Next older thread
Jul - SM64 Hacking - .b64 script interpreter New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 2f1bc75 [2017-08-27]
©2000-2017 Acmlm, Xkeeper, Inuyasha, et al.

25 database queries.
Query execution time: 0.201653 seconds
Script execution time: 0.004102 seconds
Total render time: 0.205756 seconds