NativeFunction / RASM

RAGE Assembler & Disassembler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RASM

RASM is an assembler and disassembler targeted towards the RAGE scripting format.

Supported Targets

  • Grand Theft Auto 4
    • SCO format
  • Red Dead Redemption
    • SCO format
    • XSC format
    • CSC format
  • Grand Theft Auto 5
    • XSC format
    • CSC format
    • YSC format
  • Red Dead Redemption 2
    • XSC format
    • CSC format
    • YSC format
USAGE: rasm.exe <Required Platform Options> <Operation>

Required Platform Options:

        -target = {GTAIV | RDR | RDR_SCO | GTAV | RDR2}
        -platform = {XBOX | PSX | PC}
Operations:

        -dec = Decompile {Script Input Path} {Source Output Path} {Optional Decompile Flags}
        -decd = Decompile Directory {Script Folder Input Path} {Script Folder Output Path} {Optional Decompile Flags}
        -com = Compile {Source Input Path} {Script Output Path} {Optional Compile Flags}
Decompile Flags:

        -v = Show Verbose Information
        -ow = Automatically Overwrite Source Output Path
        -dcs = Only Decompile Strings
        -dcn = Decompile Nops
        -nv = Specify Version for Natives {%d}
        -ov = Specify Version for Opcodes {%d}
Compile Flags:

        -ssn = Set Script Name {Script Name}
        -spb = Set Page Base {uint32 Pagebase}
        -in = Ignore Nops
        -norsc = Don't Write The RSC Header
        -ow = Automatically Overwrite Script Output Path

Opcodes

Opcode Description Example
SetStaticsCount Loads a value from the code buffer, then sets it as the max statics available for the script (Custom Opcode) setstaticscount
SetDefaultStatic Loads the static index and a value from the code buffer, then defines the value at the index (Custom Opcode) setdefaultstatic
SetStaticName Loads the static index and a string from the code buffer, then defines the string as the index (Custom Opcode)
SetLocalName Loads the local index and a string from the code buffer, then defines the string as the index (Custom Opcode) setlocalname
SetGlobalName Loads the global index and a string from the code buffer, then defines the string as the index (Custom Opcode) setglobalname
SetEnum Loads the string and a value from the code buffer, then defines the string as the value (Custom Opcode) setenum
Nop No Operation / Padding nop
Add Adds the top two integers on the stack add
Sub Subtracts the top two integers on the stack sub
Mult Multiplies the top two integers on the stack mult
Div Divides the top two integers on the stack (Checks if the divisor is 0) div
Mod Performs a modulus on the top two integers on the stack mod
Not Performs a logical not on the top integer on the stack not
Neg Performs a negate on the top integer on the stack neg
CmpEq Checks if the top two integers on the stack are equal cmpeq
CmpNe Checks if the top two integers on the stack are not equal cmpne
CmpGt Checks if the first pushed integer is greater than the second pushed integer cmpgt
CmpGe Checks if the first pushed integer is greater than or equal to the second pushed integer cmpge
CmpLt Checks if the first pushed integer is less than the second pushed integer cmplt
CmpLe Checks if the first pushed integer is less than or equal to the second pushed integer cmple
fAdd Adds the top two floats on the stack fadd
fSub Subtracts the top two floats on the stack fsub
fMult Multiplies the top two floats on the stack fmult
fDiv Divides the top two floats on the stack (Checks if the divisor is 0) fdiv
fMod Performs a modulus on the top two floats on the stack fmod
fNeg Performs a negate on the top float on the stack fneg
fCmpEq Checks if the top two floats on the stack are equal fcmpeq
fCmpNe Checks if the top two floats on the stack are not equal fcmpne
fCmpGt Checks if the first pushed float is greater than the second pushed float fcmpgt
fCmpGe Checks if the first pushed float is greater than or equal to the second pushed float fcmpge
fCmpLt Checks if the first pushed float is less than the second pushed float fcmplt
fCmpLe Checks if the first pushed float is less than or equal to the second pushed float fcmple
vAdd Adds the top two vectors on the stack vadd
vSub Subtracts the top two vectors on the stack vsub
vMult Multiplies the top two vectors on the stack vmult
vDiv Divides the top two vectors on the stack vdiv
vNeg Performs a negate on the top vector on the stack vneg
And Performs a bitwise and on the top two integers on the stack and
Or Performs a bitwise or on the top two integers on the stack or
Xor Performs a bitwise xor operation on the top two integers on the stack xor
ItoF Converts the top integer on the stack to a float itof
FtoI Converts the top float on the stack to an integer ftoi
FtoV Loads a float from the stack, then returns a vector of that float ftov
PushB2 Pushes two unsigned 1 byte integers onto the stack pushb2
PushB3 Pushes three unsigned 1 byte integers onto the stack pushb3
Push Pushes an integer onto the stack push
PushF Pushes a float into the stack pushf
Dup Duplicates the top item on the stack dup
Drop Pops an item off the stack drop
CallNative Loads param count and the return count from the code buffer, params if any off the stack, then calls the native function callnative
Function Loads the parameter count and the total var count from the code buffer function
Return Loads the parameter count and the return variable count from the code buffer return
pGet Loads a pointer from the stack, then returns the value of the pointer pget
pSet Loads a value and a pointer from the stack and stores the value at the pointer pset
pPeekSet Loads a pointer and a value from the stack, sets the value at the pointer, then keeps the value on the stack ppeekset
ToStack Loads the number of items and a pointer from the stack, then returns the items at the pointer tostack
FromStack Loads the number of items and a pointer from the stack, then loads the items on the stack at the pointer fromstack
GetArrayP Loads the array index and the array pointer from the stack, loads the element size from the code buffer, then returns the pointer to the item getarrayp
GetArray Loads the array index and the array pointer from the stack and loads the element size from the code buffer, then returns the value getarray
SetArray Loads the value, array index and array pointer from the stack, and loads the element size from the code buffer, then sets the value at the pointer setarray
GetLocalP Loads the variable index of an internal function from the code buffer, then returns the pointer to the index getlocalp
GetLocal Loads the variable index of an internal function from the code buffer, then returns the value getlocal
SetLocal Loads a value off the stack and the variable index of an internal function from the code buffer, then sets the value at the index setlocal
GetStaticP Loads the index of a static from the code buffer, then returns the pointer to the index getstaticp
GetStatic Loads the index of a static from the code buffer, then returns the value getstatic
SetStatic Loads a value off the stack and the index of a static from the code buffer, then sets the value at the index setstatic
AddImm Loads a value from the code buffer and adds it to the value on the stack addimm
MultImm Loads a value from the code buffer and multiplies it to the value on the stack multimm
GetImmPs Loads the pointer and the immediate index from stack, then returns the pointer at the index getimmps
GetImmP Loads a pointer from stack and the immediate index from the code buffer, then returns the pointer at the index getimmp
GetImm Loads a pointer from stack and the immediate index from the code buffer, then returns the value at the index getimm
SetImm Loads a value and a pointer from the stack, and the immediate index from the code buffer, then sets the value at the index setimm
GetGlobalP Loads the index of a global from the code buffer, then returns the pointer to the index getglobalp
GetGlobal Loads the index of a global from the code buffer, then returns the value getglobal
SetGlobal Loads a value off the stack and the index of a global from the code buffer, then sets the value at the index setglobal
Jump Loads the jump position from the code buffer and performs an unconditional relative jump jump
JumpFalse Loads the jump position from the code buffer and jumps to relative position if top of stack is 0 jumpfalse
JumpTrue Loads the jump position from the code buffer and jumps to relative position if top of stack is 1 jumptrue
JumpNE Loads the jump position from the code buffer and jumps to relative position if the top two items on the stack are not equal jumpne
JumpEQ Loads the jump position from the code buffer and jumps to relative position if the top two items on the stack are equal jumpeq
JumpLE Loads the jump position from the code buffer and jumps to relative position if the first item on the stack is less than or equal to the second jumple
JumpLT Loads the jump position from the code buffer and jumps to relative position if the first item on the stack is less than the second jumplt
JumpGE Loads the jump position from the code buffer and jumps to relative position if the first item on the stack is greater than or equal to the second jumpge
JumpGT Loads the jump position from the code buffer and jumps to relative position if the first item on the stack is greater than the second jumpgt
Call Loads params if any off the stack, then calls to a function in the script call
Switch Loads the index off the stack, case numbers and jump positions from the code buffer, then jumps to the position at case equal to the index switch
PushString Pushes a string pointer to the stack pushstring
GetHash Loads a value off the stack, then returns a Jenkins hash of the value gethash
StrCopy Loads the source string pointer and the dynamic destination string pointer off the stack, and the length from the code buffer, then copies the source into the destination strcopy
ItoS Loads a value and a dynamic destination string pointer off the stack, the destination string length off the code buffer, then converts the value into string and places it at the pointer itos
StrAdd Loads a source string pointer and the dynamic destination string pointer off the stack, and the length from the code buffer, then adds the source onto the destination stradd
StrAddi Loads an integer and the destination string pointer off the stack, and the length from the code buffer, then adds the string representation of the integer onto the destination straddi
MemCopy Loads the struct item count, struct size in bytes and the destination pointer the stack, then pops the struct off the stack and sets it into the destination memcopy
Catch Sets up a safe area that has the ability to catch errors (Deprecated)
Throw Indicates an area that handles a script error relative to the catch opcode (Deprecated)
pCall Loads a pointer from the stack and calls to the pointer as a function pcall

About

RAGE Assembler & Disassembler


Languages

Language:C++ 71.9%Language:C 28.0%Language:Batchfile 0.0%