Editing PS2 Emulation

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 943: Line 943:
| EnableImposeMenu || emuObj.EnableImposeMenu(<true/false>) || EnableImposeMenu(false)
| EnableImposeMenu || emuObj.EnableImposeMenu(<true/false>) || EnableImposeMenu(false)
|-
|-
|LoadConfig || emuObj.LoadConfig( 0 or 1 )|| emuObj.LoadConfig(0)
|LoadConfig || ||
|-
|-
|SaveConfig || emuObj.LoadConfig( 0 or 1 ) || emuObj.LoadConfig(0)
|SaveConfig || ||
|-
|-
|GetPad || emuObj.GetPad(<gamepad button by bits>)|| example usage for reading input:  
|GetPad || emuObj.GetPad(<gamepad button by bits>)|| example usage for reading input:  
Line 3,233: Line 3,233:


</pre>
</pre>
<br>'''MipsInsn.lua'''
<pre>
MipsInsn = {}
MipsInsn.IsAddi = function(insn) return (insn & 0xfc000000) == 0x20000000 end -- addi rt,rs,simm
MipsInsn.IsAddiu = function(insn) return (insn & 0xfc000000) == 0x24000000 end -- addiu rt,rs,simm
MipsInsn.IsDaddu = function(insn) return (insn & 0xfc0007ff) == 0x0000002d end -- daddu rd,rs,rt
MipsInsn.IsAddu = function(insn) return (insn & 0xfc0007ff) == 0x00000021 end -- addu rd,rs,rt
MipsInsn.IsBeq = function(insn) return (insn & 0xfc000000) == 0x10000000 end -- beq rs,rt,off
MipsInsn.IsJ = function(insn) return (insn & 0xfc000000) == 0x08000000 end -- j target
MipsInsn.IsJal = function(insn) return (insn & 0xfc000000) == 0x0c000000 end -- jal target
MipsInsn.IsJr = function(insn) return (insn & 0xfc1fffff) == 0x00000008 end -- jr rs
MipsInsn.IsLq = function(insn) return (insn & 0xfc000000) == 0x78000000 end -- lq rt,simm(rs)
MipsInsn.IsLd = function(insn) return (insn & 0xfc000000) == 0xdc000000 end -- ld rt,simm(rs)
MipsInsn.IsLw = function(insn) return (insn & 0xfc000000) == 0x8c000000 end -- lw rt,simm(rs)
MipsInsn.IsSq = function(insn) return (insn & 0xfc000000) == 0x7c000000 end -- sq rt,simm(rs)
MipsInsn.IsSd = function(insn) return (insn & 0xfc000000) == 0xfc000000 end -- sd rt,simm(rs)
MipsInsn.IsSw = function(insn) return (insn & 0xfc000000) == 0xac000000 end -- sw rt,simm(rs)
MipsInsn.IsEnd = function(insn) return (insn & 0xfc00003f) == 0x0000000d end -- break [code]
MipsInsn.GetRt = function(insn) return (insn >> 16) & 0x1f end
MipsInsn.GetRs = function(insn) return (insn >> 21) & 0x1f end
MipsInsn.GetRd = function(insn) return (insn >> 11) & 0x1f end
--MipsInsn.GetSimm = function(insn) return ((insn << 48) >> 48) end -- this can't create a negative value correctly
MipsInsn.GetSimm = function(insn)
  -- Lua5.3 shifts are all logical (WHY!?). threfore (insn<<48)>>48 cannot extend the sign.
  -- Instead of using shift, do following
  local bit = 16 -- sign bit place.
  local v = insn & 0xffff
  local m = 1 << (bit - 1)
  v = v & ((1 << bit) - 1)
  return (v ~ m) - m -- '~' is xor in Lua... how strange it is.
end
MipsInsn.GetOff = function(insn) return MipsInsn.GetSimm(insn) end
MipsInsn.GetTarget = function(insn) return insn & 0x3ffffff end
return MipsInsn
</pre>
<br>'''ee-cpr0-alias.lua'''
<br>'''ee-cpr0-alias.lua'''
<pre>
<pre>
Please note that all contributions to PS4 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS4 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)