diff --git a/ps2emuKOF2000/PS20220WD20050620.crack b/ps2emuKOF2000/PS20220WD20050620.crack
new file mode 100644
index 0000000..668ff93
Binary files /dev/null and b/ps2emuKOF2000/PS20220WD20050620.crack differ
diff --git a/ps2emuKOF2000/config-emu-ps4.txt b/ps2emuKOF2000/config-emu-ps4.txt
new file mode 100644
index 0000000..92b4bdb
--- /dev/null
+++ b/ps2emuKOF2000/config-emu-ps4.txt
@@ -0,0 +1,13 @@
+--path-vmc="/tmp/vmc"
+--path-emulog="/tmp/recordings"
+--path-patches="/app0/patches"
+--path-trophydata="/app0/trophy_data"
+--path-featuredata="/app0/feature_data"
+--host-osd=0
+--host-audio=1
+--host-display-mode=full
+--ps2-title-id=SLES-00000
+--ps2-lang=system
+--gs-uprender=2x2
+--gs-upscale=EdgeSmooth
+--rom="PS20220WD20050620.crack"
\ No newline at end of file
diff --git a/ps2emuKOF2000/docs/revision.h b/ps2emuKOF2000/docs/revision.h
new file mode 100644
index 0000000..394f9e9
--- /dev/null
+++ b/ps2emuKOF2000/docs/revision.h
@@ -0,0 +1,12 @@
+/* This file is autogenerated. DO NOT EDIT. */
+#define PACKAGE_NAME "Packaging/PackageBuild-BuildBinary-1062"
+#define PACKAGE_BUILT_BY ""
+#define PACKAGE_BUILT_ON "20160615"
+#define PACKAGE_DATE_STRING "22 Jul 16"
+#define JENKINS_JOB_NAME "Packaging/PackageBuild-BuildBinary"
+#define JENKINS_JOB_NUMBER "1062"
+#define REV_BINARY_SHA "7ed72025a2efd1f91c7f14fe7eb5ce40995a96107d4d8d6f7a496aeb930982e9"
+#define GIT_BRANCH "titles/KOF2000"
+#define GIT_REV_DATE "20160615-1"
+#define GIT_HASH_BINARY "8d591ac76b726f33d6ec74c2b26d989d9a6ade7b"
+
diff --git a/ps2emuKOF2000/eboot.bin b/ps2emuKOF2000/eboot.bin
new file mode 100644
index 0000000..20f2e96
Binary files /dev/null and b/ps2emuKOF2000/eboot.bin differ
diff --git a/ps2emuKOF2000/formatted.card b/ps2emuKOF2000/formatted.card
new file mode 100644
index 0000000..1ecafd6
Binary files /dev/null and b/ps2emuKOF2000/formatted.card differ
diff --git a/ps2emuKOF2000/lua_include/ee-cpr0-alias.lua b/ps2emuKOF2000/lua_include/ee-cpr0-alias.lua
new file mode 100644
index 0000000..42af8b6
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/ee-cpr0-alias.lua
@@ -0,0 +1,26 @@
+cpr = {}
+
+cpr.index = 0
+cpr.random = 1
+cpr.entrylo0 = 2
+cpr.entrylo1 = 3
+cpr.context = 4
+cpr.pagemask = 5
+cpr.wired = 6
+cpr.badvaddr = 8
+cpr.count = 9
+cpr.entryhi = 10
+cpr.compare = 11
+cpr.status = 12
+cpr.cause = 13
+cpr.epc = 14
+cpr.prid = 15
+cpr.config = 16
+cpr.badpaddr = 23
+cpr.hwbk = 24
+cpr.pccr = 25
+cpr.taglo = 28
+cpr.taghi = 29
+cpr.errorepc = 30
+
+return cpr
\ No newline at end of file
diff --git a/ps2emuKOF2000/lua_include/ee-gpr-alias.lua b/ps2emuKOF2000/lua_include/ee-gpr-alias.lua
new file mode 100644
index 0000000..e491810
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/ee-gpr-alias.lua
@@ -0,0 +1,43 @@
+
+-- Recommended method to import this module:
+-- local gpr = require("ee-gpr-alias")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+gpr = {}
+
+gpr.zero = 0
+gpr.at = 1
+gpr.v0 = 2
+gpr.v1 = 3
+gpr.a0 = 4
+gpr.a1 = 5
+gpr.a2 = 6
+gpr.a3 = 7
+gpr.t0 = 8
+gpr.t1 = 9
+gpr.t2 = 10
+gpr.t3 = 11
+gpr.t4 = 12
+gpr.t5 = 13
+gpr.t6 = 14
+gpr.t7 = 15
+gpr.s0 = 16
+gpr.s1 = 17
+gpr.s2 = 18
+gpr.s3 = 19
+gpr.s4 = 20
+gpr.s5 = 21
+gpr.s6 = 22
+gpr.s7 = 23
+gpr.t8 = 24
+gpr.t9 = 25
+gpr.k0 = 26
+gpr.k1 = 27
+gpr.gp = 28
+gpr.sp = 29
+gpr.fp = 30
+gpr.ra = 31
+
+return gpr
diff --git a/ps2emuKOF2000/lua_include/ee-hwaddr.lua b/ps2emuKOF2000/lua_include/ee-hwaddr.lua
new file mode 100644
index 0000000..6197c6e
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/ee-hwaddr.lua
@@ -0,0 +1,29 @@
+gif_hw = {}
+vif0_hw = {}
+vif1_hw = {}
+
+gif_hw.CHCR = 0x1000A000
+gif_hw.MADR = 0x1000A010
+gif_hw.QWC = 0x1000A020
+gif_hw.TADR = 0x1000A030
+gif_hw.ASR0 = 0x1000A040
+gif_hw.ASR1 = 0x1000A050
+gif_hw.SADR = 0x1000A080
+
+vif0_hw.CHCR = 0x10008000
+vif0_hw.MADR = 0x10008010
+vif0_hw.QWC = 0x10008020
+vif0_hw.TADR = 0x10008030
+vif0_hw.ASR0 = 0x10008040
+vif0_hw.ASR1 = 0x10008050
+vif0_hw.SADR = 0x10008080
+
+vif1_hw.CHCR = 0x10009000
+vif1_hw.MADR = 0x10009010
+vif1_hw.QWC = 0x10009020
+vif1_hw.TADR = 0x10009030
+vif1_hw.ASR0 = 0x10009040
+vif1_hw.ASR1 = 0x10009050
+vif1_hw.SADR = 0x10009080
+
+return gif_hw, vif0_hw, vif1_hw, nil
\ No newline at end of file
diff --git a/ps2emuKOF2000/lua_include/language.lua b/ps2emuKOF2000/lua_include/language.lua
new file mode 100644
index 0000000..5365327
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/language.lua
@@ -0,0 +1,34 @@
+
+-- Recommended method to import this module:
+-- local lang = require("language")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+lang = {}
+
+lang.japanese = 0
+lang.english = 1
+lang.french = 2
+lang.spanish = 3
+lang.german = 4
+lang.italian = 5
+lang.dutch = 6
+lang.portuguese = 7
+lang.russian = 8
+lang.korean = 9
+lang.chinese_traditional = 10
+lang.chinese_simplified = 11
+lang.finnish = 12
+lang.swedish = 13
+lang.danish = 14
+lang.norwegian = 15
+lang.polish = 16
+lang.portuguese_brazil = 17
+lang.english_gb = 18
+lang.turkish = 19
+lang.spanish_la = 20
+lang.arabic = 21
+lang.french_canada = 22
+
+return lang
\ No newline at end of file
diff --git a/ps2emuKOF2000/lua_include/pad-and-key.lua b/ps2emuKOF2000/lua_include/pad-and-key.lua
new file mode 100644
index 0000000..6e6c616
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/pad-and-key.lua
@@ -0,0 +1,58 @@
+
+pad = {}
+
+-- Left Side
+pad.LU = 0x0010 -- Up
+pad.LD = 0x0040 -- Down
+pad.LL = 0x0080 -- Left
+pad.LR = 0x0020 -- Right
+
+-- Right Side
+pad.RU = 0x1000 -- Up (Triangle)
+pad.RD = 0x4000 -- Down (Cross)
+pad.RL = 0x8000 -- Left (Square)
+pad.RR = 0x2000 -- Right (Circle)
+
+-- aliases
+pad.UP = 0x0010 -- LU
+pad.DOWN = 0x0040 -- LD
+pad.LEFT = 0x0080 -- LL
+pad.RIGHT = 0x0020 -- LR
+pad.TRIANGLE= 0x1000
+pad.CROSS = 0x4000
+pad.SQUARE = 0x8000
+pad.CIRCLE = 0x2000
+
+pad.L1 = 0x0400
+pad.L2 = 0x0100
+pad.L3 = 0x0002
+
+pad.R1 = 0x0800
+pad.R2 = 0x0200
+pad.R3 = 0x0004
+
+pad.SELECT = 0x0001
+pad.START = 0x0008
+
+keyboard = {}
+
+keyboard.ESCAPE = 0x1000
+keyboard.SLASH = 0x1001
+keyboard.SEPARATOR = 0x1002 -- backslash or pipe (\|)
+keyboard.BACKQUOTE = 0x1003
+keyboard.PAGEDOWN = 0x1004
+keyboard.PAGEUP = 0x1005
+keyboard.F1 = 0x1006
+keyboard.F2 = 0x1007
+keyboard.F3 = 0x1008
+keyboard.F4 = 0x1009
+keyboard.F5 = 0x100a
+keyboard.F6 = 0x100b
+keyboard.F7 = 0x100c
+keyboard.F8 = 0x100d
+keyboard.F9 = 0x100e
+keyboard.F10 = 0x100f
+keyboard.F11 = 0x1010
+keyboard.F12 = 0x1011
+
+return pad, keyboard
\ No newline at end of file
diff --git a/ps2emuKOF2000/lua_include/pad-connect-type.lua b/ps2emuKOF2000/lua_include/pad-connect-type.lua
new file mode 100644
index 0000000..6075410
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/pad-connect-type.lua
@@ -0,0 +1,9 @@
+
+local PadConnectType = {}
+
+PadConnectType.DS4 = 0
+PadConnectType.HID = 1 -- any 3rd party USB controller (fight stick, turbo controller, etc), always local.
+PadConnectType.REMOTE_DS4 = 2 -- remote DS4 should behave just like regular DS4
+PadConnectType.REMOTE_VITA = 3 -- remote VITA lacks analog L2/R2
+
+return PadConnectType
\ No newline at end of file
diff --git a/ps2emuKOF2000/lua_include/ps2.lua b/ps2emuKOF2000/lua_include/ps2.lua
new file mode 100644
index 0000000..112b85c
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/ps2.lua
@@ -0,0 +1,212 @@
+
+require("ee-gpr-alias")
+require("utils")
+
+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.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
+
+MipsInsn.GetRt = function(insn) return (insn >> 16) & 0x1f end
+MipsInsn.GetRs = function(insn) return (insn >> 21) & 0x1f end
+MipsInsn.GetSimm = function(insn) return ((insn << 48) >> 48) end
+MipsInsn.GetOff = function(insn) return MipsInsn.GetSimm(insn) end
+MipsInsn.GetTarget = function(insn) return insn & 0x3ffffff end
+
+local dbgPrintf = function(s,...)
+ -- Uncomment to enable debug trace logging of MipsStackTrace.
+ -- print (string.format(...))
+end
+
+-- return FIFO queue of stack trace
+-- the queue item is { caller-addr, return-from }
+--
+-- example:
+-- print("=== stack trace ===")
+-- local stack_trace = MipsStackTrace(eeObj, eeObj.GetPc()+4, eeObj.GetGpr(gpr.ra), eeObj.GetGpr(gpr.sp))
+-- while not stack_trace:isEmpty() do
+-- local caller = stack_trace:dequeue()
+-- local symName,symPc = debugObj.GetSymbol(caller[1])
+-- print( string.format(" 0x%08x %-48s [will return from : %x]", caller[1], synName, caller[2]) )
+-- end
+--
+-- NOTE: you must +4 against GetPc() if you in a EE/IOP hook.
+-- Because EE/IOP jit executed the instruction at the address already and it might affect $sp or $ra.
+--
+-- obj : eeObj or iopObj
+-- pc : current pc (from GetPC or readout from thread context)
+-- ra : current ra (from GetGpr or readout from thread context)
+-- sp : current sp (from GetGpr or readout from thread context)
+MipsStackTrace = function (obj, pc, ra, sp, depth)
+ local max_depth = depth or 10 -- max trace depth
+ local n_j = 1
+ local jmax = {}
+ local depth = 0
+ local bdl_count = 0
+ local new_pc = 0
+ local icount = 0
+
+ local result = Queue.new()
+ local pushed_ra = Queue.new()
+ while depth < max_depth and icount < 2048 do
+ -- TODO: error checks
+ if (pc & 3) ~= 0 then
+ return result
+ end
+ pc = pc & 0x01ffffff
+ sp = sp & 0x01ffffff
+ local insn = obj.ReadMem32(pc)
+ dbgPrintf(string.format("trace .. pc=%x insn=%x", pc, insn))
+ -- result:enqueue( { pc, insn } )
+
+ if MipsInsn.IsJr(insn) and MipsInsn.GetRs(insn) == gpr.ra then
+ bdl_count = 1
+ depth = depth + 1
+ new_pc = ra
+ dbgPrintf(string.format("jr ra : ra=%x", ra))
+ icount = 0
+ dbgPrintf(string.format("enqueue caller pc=%x ret addr=%x", new_pc-8, pc))
+ result:enqueue( {new_pc-8, pc} ) -- {return-addr, where-from}
+ elseif MipsInsn.IsAddiu(insn) and MipsInsn.GetRt(insn) == gpr.sp and MipsInsn.GetRs(insn) == gpr.sp then
+ sp = sp + MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ dbgPrintf(string.format("addiu sp,sp,** : new sp = %x", sp))
+ elseif MipsInsn.IsLq(insn) or MipsInsn.IsLd(insn) or MipsInsn.IsLw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ -- the code might push $ra on the stack after start pc.
+ -- in such case, we must not retrieve $ra value from the memory.
+ if pushed_ra:isEmpty() then
+ local imm = MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ dbgPrintf(string.format("retrieve ra from stack(%x) : sp=%x imm=%x", sp+imm, sp, imm))
+ ra = obj.ReadMem32(sp + imm)
+ dbgPrintf(string.format("load ra,%x(sp) : sp = %x+%x, ra = %x", imm, sp, imm, ra))
+ else
+ dbgPrintf(string.format("retrieve ra from pushed one"))
+ pushed_ra:dequeue()
+ end
+ end
+ elseif MipsInsn.IsSq(insn) or MipsInsn.IsSd(insn) or MipsInsn.IsSw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ pushed_ra:enqueue(pc);
+ end
+ elseif MipsInsn.IsJ(insn) then -- j **
+ local imm = MipsInsn.GetTarget(insn)
+ imm = imm << 2
+ if pc == imm then
+ -- jump to self? maybe we can ignore it.
+ else
+ new_pc = imm
+ dbgPrintf(string.format("j ** : new_pc = %x", new_pc))
+ bdl_count = 1
+ for t=1, n_j do
+ if jmax[t] == new_pc then
+ return result -- closed loop
+ end
+ end
+ if n_j > 1024 then
+ return result -- jump buffer overflow
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsBeq(insn) and MipsInsn.GetRs(insn) == gpr.zero then -- beq zero,**
+ local offset = MipsInsn.GetOff(insn) -- ((insn<<48) >> 48)
+ offset = offset << 2
+ new_pc = pc + 4 + offset
+
+ if pc == new_pc then
+ -- jump to self? maybe we can ignore it
+ else
+ dbgPrintf(string.format("beq zero,** : new_pc=%x", new_pc))
+ bdl_count = 1
+ for t = 1, n_j do
+ if jmax[t] == new_pc then
+ return result
+ end
+ end
+ if n_j > 1024 then
+ return result
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsEnd(insn) then -- end
+ dbgPrintf(string.format("end"))
+ -- Ignore 'end/break'
+ -- Most use cases of end/break are 'unreachable' debug code in titles.
+ -- If ignoring this is a problem on some specific title, then perhaps analysis of
+ -- end/break should be instead controllable via parameter. --jstine
+ -- return result
+ elseif MipsInsn.IsJal(insn) then -- jal **
+ local imm = insn & 0x03ffffff
+ imm = imm << 2
+ dbgPrintf(string.format("jal ** : addr = %x", imm))
+ -- call
+ end
+
+ icount = icount + 1
+ pc = pc + 4
+
+ -- dbgPrintf(string.format("bdl_count=%d", bdl_count))
+ if bdl_count > 0 then
+ if bdl_count == 2 then
+ pc = new_pc
+ bdl_count = 0
+ else
+ bdl_count = bdl_count + 1
+ end
+ end
+ end
+ return result
+end
+
+PS2 = {}
+PS2.GetCurrentThread = function(eeObj) return eeObj.ReadMem32(0x12fac) end
+PS2.GetThreads = function(eeObj)
+ local EE_THREAD_BASE = 0x18000
+ local EE_NUM_THREADS = 0x100
+ local th = EE_THREAD_BASE
+ local result = Queue.new()
+ for t = 0, EE_NUM_THREADS-1 do
+ -- 0 : node_prev
+ -- 4 : node_next
+ -- 8 : status
+ -- 12: pc
+ -- 16: sp
+ -- 20: gp
+ -- 24: init_pri
+ -- 26: curr_pri
+ -- 28: wstat
+ -- 32: waitId
+ -- 36: wakeupCount
+ -- 40: attr
+ -- 44: option
+ -- 48: func
+ -- 52: argc
+ -- 56: args
+ -- 60: stack
+ -- 64: size
+ -- 68: root
+ -- 72: endOfHeap
+ local status = eeObj.ReadMem32(th + 8)
+ if status ~= 0 then
+ local id = t
+ local pri = eeObj.ReadMem16(th + 26)
+ local gp = eeObj.ReadMem32(th + 20)
+ local pc = eeObj.ReadMem32(th + 12)
+ local sp = eeObj.ReadMem32(th + 16)
+ result:enqueue( {id=id, status=status, pri=pri, gp=gp, pc=pc, sp=sp} )
+ end
+ th = th + 76
+ end
+ return result
+end
diff --git a/ps2emuKOF2000/lua_include/sprite.lua b/ps2emuKOF2000/lua_include/sprite.lua
new file mode 100644
index 0000000..49c10bd
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/sprite.lua
@@ -0,0 +1,57 @@
+
+local kFilterMode = {}
+kFilterMode.Point = 0x00000000 -- < Sample the one texel nearest to the sample point.
+kFilterMode.Bilinear = 0x00000001 -- < Sample the four texels nearest the sample point, and blend linearly.
+
+local kWrapMode = {}
+kWrapMode.Wrap = 0x00000000 -- < The integer portion of the input coordinate is discarded, and the fractional portion is used instead. U=U-floorf(U);
+kWrapMode.Mirror = 0x00000001 -- < The input coordinate is "reflected" across the texture boundary. This reflection may occur multiple times until the coordinate falls within the [0..1] range. U=isOdd(floorf(U)) ? 1-fracf(U) : fracf(U)
+kWrapMode.ClampLastTexel = 0x00000002 -- < The input coordinate is clamped to the range [0..1]. U=max(0,min(1,U));
+kWrapMode.MirrorOnceLastTexel = 0x00000003 -- < The input coordinate is reflected at most one time and then clamped to the range [0..1]. U=abs(max(-1,min(1,U));
+kWrapMode.ClampHalfBorder = 0x00000004 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.MirrorOnceHalfBorder = 0x00000005 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.ClampBorder = 0x00000006 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+kWrapMode.MirrorOnceBorder = 0x00000007 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+
+local kBlendMultiplier = {}
+kBlendMultiplier.Zero = 0x00000000 -- < Multiply the associated input by zero.
+kBlendMultiplier.One = 0x00000001 -- < Multiply the associated input by one.
+kBlendMultiplier.SrcColor = 0x00000002 -- < Multiply the associated input by the fragment color.
+kBlendMultiplier.OneMinusSrcColor = 0x00000003 -- < Multiply the associated input by one minus the fragment color.
+kBlendMultiplier.SrcAlpha = 0x00000004 -- < Multiply the associated input by the fragment alpha.
+kBlendMultiplier.OneMinusSrcAlpha = 0x00000005 -- < Multiply the associated input by one minus the fragment alpha.
+kBlendMultiplier.DestAlpha = 0x00000006 -- < Multiply the associated input by the render target alpha.
+kBlendMultiplier.OneMinusDestAlpha = 0x00000007 -- < Multiply the associated input by one minus the render target alpha.
+kBlendMultiplier.DestColor = 0x00000008 -- < Multiply the associated input by the render target color.
+kBlendMultiplier.OneMinusDestColor = 0x00000009 -- < Multiply the associated input by one minus the render target color.
+kBlendMultiplier.SrcAlphaSaturate = 0x0000000a -- < Multiply the associated input by the minimum of 1 or fragment alpha.
+kBlendMultiplier.ConstantColor = 0x0000000d -- < Multiply the associated input by the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantColor = 0x0000000e -- < Multiply the associated input by one minus the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.Src1Color = 0x0000000f -- < Multiply the associated input by a secondary fragment color.
+kBlendMultiplier.InverseSrc1Color = 0x00000010 -- < Multiply the associated input by one minus a secondary fragment color.
+kBlendMultiplier.Src1Alpha = 0x00000011 -- < Multiply the associated input by a secondary fragment alpha.
+kBlendMultiplier.InverseSrc1Alpha = 0x00000012 -- < Multiply the associated input by one minus a secondary fragment alpha.
+kBlendMultiplier.ConstantAlpha = 0x00000013 -- < Multiply the associated input by the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantAlpha = 0x00000014 -- < Multiply the associated input by one minus the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+
+local kBlendFunc = {}
+kBlendFunc.Add = 0x00000000 -- < The source value is added to the destination value.
+kBlendFunc.Subtract = 0x00000001 -- < The destination value is subtracted from the source value.
+kBlendFunc.Min = 0x00000002 -- < The minimum of the source and destination values is selected.
+kBlendFunc.Max = 0x00000003 -- < The maximum of the source and destination values is selected.
+kBlendFunc.ReverseSubtract = 0x00000004 -- < The source value is subtracted from the destination value.
+
+-- Default blending mode, ideal for typical alpha channel embedded into a PNG image.
+blendDefaultEquation = {
+ kBlendMultiplier.SrcAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusSrcAlpha, -- dest multiplier
+}
+
+blendConstFadeEquation = {
+ kBlendMultiplier.ConstantAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusConstantAlpha, -- dest multiplier
+}
+
+return kFilterMode, kWrapMode, kBlendMultiplier, kBlendFunc
diff --git a/ps2emuKOF2000/lua_include/utils.lua b/ps2emuKOF2000/lua_include/utils.lua
new file mode 100644
index 0000000..3849bd8
--- /dev/null
+++ b/ps2emuKOF2000/lua_include/utils.lua
@@ -0,0 +1,60 @@
+-- utility classes/functions
+
+-- Stack
+-- ex:
+-- my_stack = Stack.new()
+-- my_stack:push( val )
+-- print( my_stack:pop( val ) )
+Stack = {}
+
+function Stack.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Stack})
+end
+
+function Stack:push(x)
+ table.insert(self.buff, x)
+end
+
+function Stack:pop()
+ return table.remove(self.buff)
+end
+
+function Stack:top()
+ return self.buff[#self.buff]
+end
+
+function Stack:isEmpty()
+ return #self.buff == 0
+end
+
+
+-- Queue
+-- ex:
+-- my_queue = Queue.new()
+-- my_queue:enqueue( val )
+-- print( my_queue:dequeue(val) )
+Queue = {}
+
+function Queue.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Queue})
+end
+
+function Queue:enqueue(x)
+ table.insert(self.buff, x)
+end
+
+function Queue:dequeue()
+ return table.remove(self.buff, 1)
+end
+
+function Queue:top()
+ if #self.buff > 0 then
+ return self.buff[1]
+ end
+end
+
+function Queue:isEmpty()
+ return #self.buff == 0
+end
diff --git a/ps2emuKOF2000/ps2-emu-compiler.self b/ps2emuKOF2000/ps2-emu-compiler.self
new file mode 100644
index 0000000..6051069
Binary files /dev/null and b/ps2emuKOF2000/ps2-emu-compiler.self differ
diff --git a/ps2emuKOF2000/sce_discmap.plt b/ps2emuKOF2000/sce_discmap.plt
new file mode 100644
index 0000000..973c7e6
Binary files /dev/null and b/ps2emuKOF2000/sce_discmap.plt differ
diff --git a/ps2emuKOF2000/sce_module/libSceFios2.prx b/ps2emuKOF2000/sce_module/libSceFios2.prx
new file mode 100644
index 0000000..c147b34
Binary files /dev/null and b/ps2emuKOF2000/sce_module/libSceFios2.prx differ
diff --git a/ps2emuKOF2000/sce_module/libc.prx b/ps2emuKOF2000/sce_module/libc.prx
new file mode 100644
index 0000000..8997363
Binary files /dev/null and b/ps2emuKOF2000/sce_module/libc.prx differ
diff --git a/ps2emuKOF2000/sce_sys/param.sfo b/ps2emuKOF2000/sce_sys/param.sfo
new file mode 100644
index 0000000..d31774c
Binary files /dev/null and b/ps2emuKOF2000/sce_sys/param.sfo differ
diff --git a/ps2emuKOF2000/sce_sys/shareparam.json b/ps2emuKOF2000/sce_sys/shareparam.json
new file mode 100644
index 0000000..8f4038b
--- /dev/null
+++ b/ps2emuKOF2000/sce_sys/shareparam.json
@@ -0,0 +1 @@
+{"ps4_share_param_version":"01.10","game_version":"01.00","client_id":"460621181150-9g1m23knq95uld74tnjap752q87pug9v.apps.googleusercontent.com","overlay_position":{"x":0,"y":0}}
\ No newline at end of file
diff --git a/ps2emuMANHUNT/PS20220WD20050620.crack b/ps2emuMANHUNT/PS20220WD20050620.crack
new file mode 100644
index 0000000..668ff93
Binary files /dev/null and b/ps2emuMANHUNT/PS20220WD20050620.crack differ
diff --git a/ps2emuMANHUNT/config-emu-ps4.txt b/ps2emuMANHUNT/config-emu-ps4.txt
new file mode 100644
index 0000000..92b4bdb
--- /dev/null
+++ b/ps2emuMANHUNT/config-emu-ps4.txt
@@ -0,0 +1,13 @@
+--path-vmc="/tmp/vmc"
+--path-emulog="/tmp/recordings"
+--path-patches="/app0/patches"
+--path-trophydata="/app0/trophy_data"
+--path-featuredata="/app0/feature_data"
+--host-osd=0
+--host-audio=1
+--host-display-mode=full
+--ps2-title-id=SLES-00000
+--ps2-lang=system
+--gs-uprender=2x2
+--gs-upscale=EdgeSmooth
+--rom="PS20220WD20050620.crack"
\ No newline at end of file
diff --git a/ps2emuMANHUNT/docs/revision.h b/ps2emuMANHUNT/docs/revision.h
new file mode 100644
index 0000000..8c55804
--- /dev/null
+++ b/ps2emuMANHUNT/docs/revision.h
@@ -0,0 +1,12 @@
+/* This file is autogenerated. DO NOT EDIT. */
+#define PACKAGE_NAME "Packaging/PackageBuild-BuildBinary-1261"
+#define PACKAGE_BUILT_BY ""
+#define PACKAGE_BUILT_ON "20161024"
+#define PACKAGE_DATE_STRING "26 Oct 16"
+#define JENKINS_JOB_NAME "Packaging/PackageBuild-BuildBinary"
+#define JENKINS_JOB_NUMBER "1261"
+#define REV_BINARY_SHA "8fe47565919986577ebf8a5ed037bd704e4081da7dd054df03c5d64f56152e91"
+#define GIT_BRANCH "titles/Manhunt"
+#define GIT_REV_DATE "20161024-1"
+#define GIT_HASH_BINARY "9229bf21a56f422fb9335e7dd079bbefb6aa9e81"
+
diff --git a/ps2emuMANHUNT/eboot.bin b/ps2emuMANHUNT/eboot.bin
new file mode 100644
index 0000000..8675377
Binary files /dev/null and b/ps2emuMANHUNT/eboot.bin differ
diff --git a/ps2emuMANHUNT/formatted.card b/ps2emuMANHUNT/formatted.card
new file mode 100644
index 0000000..1ecafd6
Binary files /dev/null and b/ps2emuMANHUNT/formatted.card differ
diff --git a/ps2emuMANHUNT/lua_include/ee-cpr0-alias.lua b/ps2emuMANHUNT/lua_include/ee-cpr0-alias.lua
new file mode 100644
index 0000000..42af8b6
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/ee-cpr0-alias.lua
@@ -0,0 +1,26 @@
+cpr = {}
+
+cpr.index = 0
+cpr.random = 1
+cpr.entrylo0 = 2
+cpr.entrylo1 = 3
+cpr.context = 4
+cpr.pagemask = 5
+cpr.wired = 6
+cpr.badvaddr = 8
+cpr.count = 9
+cpr.entryhi = 10
+cpr.compare = 11
+cpr.status = 12
+cpr.cause = 13
+cpr.epc = 14
+cpr.prid = 15
+cpr.config = 16
+cpr.badpaddr = 23
+cpr.hwbk = 24
+cpr.pccr = 25
+cpr.taglo = 28
+cpr.taghi = 29
+cpr.errorepc = 30
+
+return cpr
\ No newline at end of file
diff --git a/ps2emuMANHUNT/lua_include/ee-gpr-alias.lua b/ps2emuMANHUNT/lua_include/ee-gpr-alias.lua
new file mode 100644
index 0000000..e491810
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/ee-gpr-alias.lua
@@ -0,0 +1,43 @@
+
+-- Recommended method to import this module:
+-- local gpr = require("ee-gpr-alias")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+gpr = {}
+
+gpr.zero = 0
+gpr.at = 1
+gpr.v0 = 2
+gpr.v1 = 3
+gpr.a0 = 4
+gpr.a1 = 5
+gpr.a2 = 6
+gpr.a3 = 7
+gpr.t0 = 8
+gpr.t1 = 9
+gpr.t2 = 10
+gpr.t3 = 11
+gpr.t4 = 12
+gpr.t5 = 13
+gpr.t6 = 14
+gpr.t7 = 15
+gpr.s0 = 16
+gpr.s1 = 17
+gpr.s2 = 18
+gpr.s3 = 19
+gpr.s4 = 20
+gpr.s5 = 21
+gpr.s6 = 22
+gpr.s7 = 23
+gpr.t8 = 24
+gpr.t9 = 25
+gpr.k0 = 26
+gpr.k1 = 27
+gpr.gp = 28
+gpr.sp = 29
+gpr.fp = 30
+gpr.ra = 31
+
+return gpr
diff --git a/ps2emuMANHUNT/lua_include/ee-hwaddr.lua b/ps2emuMANHUNT/lua_include/ee-hwaddr.lua
new file mode 100644
index 0000000..6197c6e
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/ee-hwaddr.lua
@@ -0,0 +1,29 @@
+gif_hw = {}
+vif0_hw = {}
+vif1_hw = {}
+
+gif_hw.CHCR = 0x1000A000
+gif_hw.MADR = 0x1000A010
+gif_hw.QWC = 0x1000A020
+gif_hw.TADR = 0x1000A030
+gif_hw.ASR0 = 0x1000A040
+gif_hw.ASR1 = 0x1000A050
+gif_hw.SADR = 0x1000A080
+
+vif0_hw.CHCR = 0x10008000
+vif0_hw.MADR = 0x10008010
+vif0_hw.QWC = 0x10008020
+vif0_hw.TADR = 0x10008030
+vif0_hw.ASR0 = 0x10008040
+vif0_hw.ASR1 = 0x10008050
+vif0_hw.SADR = 0x10008080
+
+vif1_hw.CHCR = 0x10009000
+vif1_hw.MADR = 0x10009010
+vif1_hw.QWC = 0x10009020
+vif1_hw.TADR = 0x10009030
+vif1_hw.ASR0 = 0x10009040
+vif1_hw.ASR1 = 0x10009050
+vif1_hw.SADR = 0x10009080
+
+return gif_hw, vif0_hw, vif1_hw, nil
\ No newline at end of file
diff --git a/ps2emuMANHUNT/lua_include/language.lua b/ps2emuMANHUNT/lua_include/language.lua
new file mode 100644
index 0000000..5365327
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/language.lua
@@ -0,0 +1,34 @@
+
+-- Recommended method to import this module:
+-- local lang = require("language")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+lang = {}
+
+lang.japanese = 0
+lang.english = 1
+lang.french = 2
+lang.spanish = 3
+lang.german = 4
+lang.italian = 5
+lang.dutch = 6
+lang.portuguese = 7
+lang.russian = 8
+lang.korean = 9
+lang.chinese_traditional = 10
+lang.chinese_simplified = 11
+lang.finnish = 12
+lang.swedish = 13
+lang.danish = 14
+lang.norwegian = 15
+lang.polish = 16
+lang.portuguese_brazil = 17
+lang.english_gb = 18
+lang.turkish = 19
+lang.spanish_la = 20
+lang.arabic = 21
+lang.french_canada = 22
+
+return lang
\ No newline at end of file
diff --git a/ps2emuMANHUNT/lua_include/pad-and-key.lua b/ps2emuMANHUNT/lua_include/pad-and-key.lua
new file mode 100644
index 0000000..eb1c91b
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/pad-and-key.lua
@@ -0,0 +1,57 @@
+
+pad = {}
+
+-- Left Side
+pad.LU = 0x0010 -- Up
+pad.LD = 0x0040 -- Down
+pad.LL = 0x0080 -- Left
+pad.LR = 0x0020 -- Right
+
+-- Right Side
+pad.RU = 0x1000 -- Up (Triangle)
+pad.RD = 0x4000 -- Down (Cross)
+pad.RL = 0x8000 -- Left (Square)
+pad.RR = 0x2000 -- Right (Circle)
+
+-- aliases
+pad.UP = 0x0010 -- LU
+pad.DOWN = 0x0040 -- LD
+pad.LEFT = 0x0080 -- LL
+pad.RIGHT = 0x0020 -- LR
+pad.TRIANGLE= 0x1000
+pad.CROSS = 0x4000
+pad.SQUARE = 0x8000
+pad.CIRCLE = 0x2000
+
+pad.L1 = 0x0400
+pad.L2 = 0x0100
+pad.L3 = 0x0002
+
+pad.R1 = 0x0800
+pad.R2 = 0x0200
+pad.R3 = 0x0004
+
+pad.SELECT = 0x0001
+pad.START = 0x0008
+
+keyboard = {}
+
+keyboard.ESCAPE = 0x1000
+keyboard.SLASH = 0x1001
+keyboard.SEPARATOR = 0x1002 -- backslash or pipe (\|)
+keyboard.BACKQUOTE = 0x1003
+keyboard.PAGEDOWN = 0x1004
+keyboard.PAGEUP = 0x1005
+keyboard.F1 = 0x1006
+keyboard.F2 = 0x1007
+keyboard.F3 = 0x1008
+keyboard.F4 = 0x1009
+keyboard.F5 = 0x100a
+keyboard.F6 = 0x100b
+keyboard.F7 = 0x100c
+keyboard.F8 = 0x100d
+keyboard.F9 = 0x100e
+keyboard.F10 = 0x100f
+keyboard.F11 = 0x1010
+keyboard.F12 = 0x1011
+
diff --git a/ps2emuMANHUNT/lua_include/ps2.lua b/ps2emuMANHUNT/lua_include/ps2.lua
new file mode 100644
index 0000000..32686e7
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/ps2.lua
@@ -0,0 +1,202 @@
+
+require("ee-gpr-alias")
+require("utils")
+
+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.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
+
+MipsInsn.GetRt = function(insn) return (insn >> 16) & 0x1f end
+MipsInsn.GetRs = function(insn) return (insn >> 21) & 0x1f end
+MipsInsn.GetSimm = function(insn) return ((insn << 48) >> 48) end
+MipsInsn.GetOff = function(insn) return MipsInsn.GetSimm(insn) end
+MipsInsn.GetTarget = function(insn) return insn & 0x3ffffff end
+
+-- return FIFO queue of stack trace
+-- the queue item is { caller-addr, return-from }
+--
+-- example:
+-- print("=== stack trace ===")
+-- local stack_trace = MipsStackTrace(eeObj, eeObj.GetPc()+4, eeObj.GetGpr(gpr.ra), eeObj.GetGpr(gpr.sp))
+-- while not stack_trace:isEmpty() do
+-- local caller = stack_trace:dequeue()
+-- print( string.format(" 0x%08x [will return from : %x]", caller[1], caller[2]) )
+-- end
+--
+-- NOTE: you must +4 against GetPc() if you in a EE/IOP hook.
+-- Because EE/IOP jit executed the instruction at the address already and it might affect $sp or $ra.
+--
+-- obj : eeObj or iopObj
+-- pc : current pc (from GetPC or readout from thread context)
+-- ra : current ra (from GetGpr or readout from thread context)
+-- sp : current sp (from GetGpr or readout from thread context)
+MipsStackTrace = function (obj, pc, ra, sp, depth)
+ local max_depth = depth or 10 -- max trace depth
+ local n_j = 1
+ local jmax = {}
+ local depth = 0
+ local bdl_count = 0
+ local new_pc = 0
+ local icount = 0
+
+ local result = Queue.new()
+ local pushed_ra = Queue.new()
+ while depth < max_depth and icount < 2048 do
+ -- TODO: error checks
+ if (pc & 3) ~= 0 then
+ return result
+ end
+ pc = pc & 0x01ffffff
+ sp = sp & 0x01ffffff
+ local insn = obj.ReadMem32(pc)
+ -- print(string.format("trace .. pc=%x insn=%x", pc, insn))
+ -- result:enqueue( { pc, insn } )
+
+ if MipsInsn.IsJr(insn) and MipsInsn.GetRs(insn) == gpr.ra then
+ bdl_count = 1
+ depth = depth + 1
+ new_pc = ra
+ -- print(string.format("jr ra : ra=%x", ra))
+ icount = 0
+ -- print(string.format("enqueue caller pc=%x ret addr=%x", new_pc-8, pc))
+ result:enqueue( {new_pc-8, pc} ) -- {return-addr, where-from}
+ elseif MipsInsn.IsAddiu(insn) and MipsInsn.GetRt(insn) == gpr.sp and MipsInsn.GetRs(insn) == gpr.sp then
+ sp = sp + MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ -- print(string.format("addiu sp,sp,** : new sp = %x", sp))
+ elseif MipsInsn.IsLq(insn) or MipsInsn.IsLd(insn) or MipsInsn.IsLw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ -- the code might push $ra on the stack after start pc.
+ -- in such case, we must not retrieve $ra value from the memory.
+ if pushed_ra:isEmpty() then
+ local imm = MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ -- print(string.format("retrieve ra from stack(%x) : sp=%x imm=%x", sp+imm, sp, imm))
+ ra = obj.ReadMem32(sp + imm)
+ -- print(string.format("load ra,%x(sp) : sp = %x+%x, ra = %x", imm, sp, imm, ra))
+ else
+ -- print(string.format("retrieve ra from pushed one"))
+ pushed_ra:dequeue()
+ end
+ end
+ elseif MipsInsn.IsSq(insn) or MipsInsn.IsSd(insn) or MipsInsn.IsSw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ pushed_ra:enqueue(pc);
+ end
+ elseif MipsInsn.IsJ(insn) then -- j **
+ local imm = MipsInsn.GetTarget(insn)
+ imm = imm << 2
+ if pc == imm then
+ -- jump to self? maybe we can ignore it.
+ else
+ new_pc = imm
+ -- print(string.format("j ** : new_pc = %x", new_pc))
+ bdl_count = 1
+ for t=1, n_j do
+ if jmax[t] == new_pc then
+ return result -- closed loop
+ end
+ end
+ if n_j > 1024 then
+ return result -- jump buffer overflow
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsBeq(insn) and MipsInsn.GetRs(insn) == gpr.zero then -- beq zero,**
+ local offset = MipsInsn.GetOff(insn) -- ((insn<<48) >> 48)
+ offset = offset << 2
+ new_pc = pc + 4 + offset
+
+ if pc == new_pc then
+ -- jump to self? maybe we can ignore it
+ else
+ -- print(string.format("beq zero,** : new_pc=%x", new_pc))
+ bdl_count = 1
+ for t = 1, n_j do
+ if jmax[t] == new_pc then
+ return result
+ end
+ end
+ if n_j > 1024 then
+ return result
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsEnd(insn) then -- end
+ -- print(string.format("end"))
+ return result
+ elseif MipsInsn.IsJal(insn) then -- jal **
+ local imm = insn & 0x03ffffff
+ imm = imm << 2
+ -- print(string.format("jal ** : addr = %x", imm))
+ -- call
+ end
+
+ icount = icount + 1
+ pc = pc + 4
+
+ -- -- print(string.format("bdl_count=%d", bdl_count))
+ if bdl_count > 0 then
+ if bdl_count == 2 then
+ pc = new_pc
+ bdl_count = 0
+ else
+ bdl_count = bdl_count + 1
+ end
+ end
+ end
+ return result
+end
+
+PS2 = {}
+PS2.GetCurrentThread = function(eeObj) return eeObj.ReadMem32(0x12fac) end
+PS2.GetThreads = function(eeObj)
+ local EE_THREAD_BASE = 0x18000
+ local EE_NUM_THREADS = 0x100
+ local th = EE_THREAD_BASE
+ local result = Queue.new()
+ for t = 0, EE_NUM_THREADS-1 do
+ -- 0 : node_prev
+ -- 4 : node_next
+ -- 8 : status
+ -- 12: pc
+ -- 16: sp
+ -- 20: gp
+ -- 24: init_pri
+ -- 26: curr_pri
+ -- 28: wstat
+ -- 32: waitId
+ -- 36: wakeupCount
+ -- 40: attr
+ -- 44: option
+ -- 48: func
+ -- 52: argc
+ -- 56: args
+ -- 60: stack
+ -- 64: size
+ -- 68: root
+ -- 72: endOfHeap
+ local status = eeObj.ReadMem32(th + 8)
+ if status ~= 0 then
+ local id = t
+ local pri = eeObj.ReadMem16(th + 26)
+ local gp = eeObj.ReadMem32(th + 20)
+ local pc = eeObj.ReadMem32(th + 12)
+ local sp = eeObj.ReadMem32(th + 16)
+ result:enqueue( {id=id, status=status, pri=pri, gp=gp, pc=pc, sp=sp} )
+ end
+ th = th + 76
+ end
+ return result
+end
diff --git a/ps2emuMANHUNT/lua_include/utils.lua b/ps2emuMANHUNT/lua_include/utils.lua
new file mode 100644
index 0000000..3849bd8
--- /dev/null
+++ b/ps2emuMANHUNT/lua_include/utils.lua
@@ -0,0 +1,60 @@
+-- utility classes/functions
+
+-- Stack
+-- ex:
+-- my_stack = Stack.new()
+-- my_stack:push( val )
+-- print( my_stack:pop( val ) )
+Stack = {}
+
+function Stack.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Stack})
+end
+
+function Stack:push(x)
+ table.insert(self.buff, x)
+end
+
+function Stack:pop()
+ return table.remove(self.buff)
+end
+
+function Stack:top()
+ return self.buff[#self.buff]
+end
+
+function Stack:isEmpty()
+ return #self.buff == 0
+end
+
+
+-- Queue
+-- ex:
+-- my_queue = Queue.new()
+-- my_queue:enqueue( val )
+-- print( my_queue:dequeue(val) )
+Queue = {}
+
+function Queue.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Queue})
+end
+
+function Queue:enqueue(x)
+ table.insert(self.buff, x)
+end
+
+function Queue:dequeue()
+ return table.remove(self.buff, 1)
+end
+
+function Queue:top()
+ if #self.buff > 0 then
+ return self.buff[1]
+ end
+end
+
+function Queue:isEmpty()
+ return #self.buff == 0
+end
diff --git a/ps2emuMANHUNT/ps2-emu-compiler.self b/ps2emuMANHUNT/ps2-emu-compiler.self
new file mode 100644
index 0000000..54bc4a5
Binary files /dev/null and b/ps2emuMANHUNT/ps2-emu-compiler.self differ
diff --git a/ps2emuMANHUNT/sce_discmap.plt b/ps2emuMANHUNT/sce_discmap.plt
new file mode 100644
index 0000000..54dc4e1
Binary files /dev/null and b/ps2emuMANHUNT/sce_discmap.plt differ
diff --git a/ps2emuMANHUNT/sce_module/libSceFios2.prx b/ps2emuMANHUNT/sce_module/libSceFios2.prx
new file mode 100644
index 0000000..238191c
Binary files /dev/null and b/ps2emuMANHUNT/sce_module/libSceFios2.prx differ
diff --git a/ps2emuMANHUNT/sce_module/libc.prx b/ps2emuMANHUNT/sce_module/libc.prx
new file mode 100644
index 0000000..dc8776d
Binary files /dev/null and b/ps2emuMANHUNT/sce_module/libc.prx differ
diff --git a/ps2emuMANHUNT/sce_sys/param.sfo b/ps2emuMANHUNT/sce_sys/param.sfo
new file mode 100644
index 0000000..d31774c
Binary files /dev/null and b/ps2emuMANHUNT/sce_sys/param.sfo differ
diff --git a/ps2emuMANHUNT/sce_sys/shareparam.json b/ps2emuMANHUNT/sce_sys/shareparam.json
new file mode 100644
index 0000000..8f4038b
--- /dev/null
+++ b/ps2emuMANHUNT/sce_sys/shareparam.json
@@ -0,0 +1 @@
+{"ps4_share_param_version":"01.10","game_version":"01.00","client_id":"460621181150-9g1m23knq95uld74tnjap752q87pug9v.apps.googleusercontent.com","overlay_position":{"x":0,"y":0}}
\ No newline at end of file
diff --git a/ps2emuMAXPAYNE/PS20220WD20050620.crack b/ps2emuMAXPAYNE/PS20220WD20050620.crack
new file mode 100644
index 0000000..668ff93
Binary files /dev/null and b/ps2emuMAXPAYNE/PS20220WD20050620.crack differ
diff --git a/ps2emuMAXPAYNE/config-emu-ps4.txt b/ps2emuMAXPAYNE/config-emu-ps4.txt
new file mode 100644
index 0000000..92b4bdb
--- /dev/null
+++ b/ps2emuMAXPAYNE/config-emu-ps4.txt
@@ -0,0 +1,13 @@
+--path-vmc="/tmp/vmc"
+--path-emulog="/tmp/recordings"
+--path-patches="/app0/patches"
+--path-trophydata="/app0/trophy_data"
+--path-featuredata="/app0/feature_data"
+--host-osd=0
+--host-audio=1
+--host-display-mode=full
+--ps2-title-id=SLES-00000
+--ps2-lang=system
+--gs-uprender=2x2
+--gs-upscale=EdgeSmooth
+--rom="PS20220WD20050620.crack"
\ No newline at end of file
diff --git a/ps2emuMAXPAYNE/docs/revision.h b/ps2emuMAXPAYNE/docs/revision.h
new file mode 100644
index 0000000..55342fb
--- /dev/null
+++ b/ps2emuMAXPAYNE/docs/revision.h
@@ -0,0 +1,12 @@
+/* This file is autogenerated. DO NOT EDIT. */
+#define PACKAGE_NAME "Packaging/PackageBuild-BuildBinary-905"
+#define PACKAGE_BUILT_BY ""
+#define PACKAGE_BUILT_ON "20160318"
+#define PACKAGE_DATE_STRING "30 Mar 16"
+#define JENKINS_JOB_NAME "Packaging/PackageBuild-BuildBinary"
+#define JENKINS_JOB_NUMBER "905"
+#define REV_BINARY_SHA "7fe4f4af3df8aaf864435459539f9f2f45ae8d78e3b7c067e9635cdcce24e8f8"
+#define GIT_BRANCH "titles/MaxPayne1"
+#define GIT_REV_DATE "20160318-2"
+#define GIT_HASH_BINARY "52abb5d0b8c47f1ad03ea9196f7a387e285d0e76"
+
diff --git a/ps2emuMAXPAYNE/eboot.bin b/ps2emuMAXPAYNE/eboot.bin
new file mode 100644
index 0000000..1b8bc4a
Binary files /dev/null and b/ps2emuMAXPAYNE/eboot.bin differ
diff --git a/ps2emuMAXPAYNE/formatted.card b/ps2emuMAXPAYNE/formatted.card
new file mode 100644
index 0000000..1ecafd6
Binary files /dev/null and b/ps2emuMAXPAYNE/formatted.card differ
diff --git a/ps2emuMAXPAYNE/lua_include/ee-cpr0-alias.lua b/ps2emuMAXPAYNE/lua_include/ee-cpr0-alias.lua
new file mode 100644
index 0000000..42af8b6
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/ee-cpr0-alias.lua
@@ -0,0 +1,26 @@
+cpr = {}
+
+cpr.index = 0
+cpr.random = 1
+cpr.entrylo0 = 2
+cpr.entrylo1 = 3
+cpr.context = 4
+cpr.pagemask = 5
+cpr.wired = 6
+cpr.badvaddr = 8
+cpr.count = 9
+cpr.entryhi = 10
+cpr.compare = 11
+cpr.status = 12
+cpr.cause = 13
+cpr.epc = 14
+cpr.prid = 15
+cpr.config = 16
+cpr.badpaddr = 23
+cpr.hwbk = 24
+cpr.pccr = 25
+cpr.taglo = 28
+cpr.taghi = 29
+cpr.errorepc = 30
+
+return cpr
\ No newline at end of file
diff --git a/ps2emuMAXPAYNE/lua_include/ee-gpr-alias.lua b/ps2emuMAXPAYNE/lua_include/ee-gpr-alias.lua
new file mode 100644
index 0000000..e270d57
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/ee-gpr-alias.lua
@@ -0,0 +1,47 @@
+
+-- Recommended method to import this module:
+-- local gpr = require("ee-gpr-alias")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+gpr = {}
+
+gpr.zero = 0
+gpr.at = 1
+gpr.v0 = 2
+gpr.v1 = 3
+gpr.a0 = 4
+gpr.a1 = 5
+gpr.a2 = 6
+gpr.a3 = 7
+gpr.t0 = 8
+gpr.t1 = 9
+gpr.t2 = 10
+gpr.t3 = 11
+gpr.t4 = 12
+gpr.t5 = 13
+gpr.t6 = 14
+gpr.t7 = 15
+gpr.s0 = 16
+gpr.s1 = 17
+gpr.s2 = 18
+gpr.s3 = 19
+gpr.s4 = 20
+gpr.s5 = 21
+gpr.s6 = 22
+gpr.s7 = 23
+gpr.t8 = 24
+gpr.t9 = 25
+gpr.k0 = 26
+gpr.k1 = 27
+gpr.gp = 28
+gpr.sp = 29
+gpr.fp = 30
+gpr.ra = 31
+
+gpr.lo = 32
+gpr.hi = 33
+gpr.sa = 34
+
+return gpr
diff --git a/ps2emuMAXPAYNE/lua_include/ee-hwaddr.lua b/ps2emuMAXPAYNE/lua_include/ee-hwaddr.lua
new file mode 100644
index 0000000..6197c6e
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/ee-hwaddr.lua
@@ -0,0 +1,29 @@
+gif_hw = {}
+vif0_hw = {}
+vif1_hw = {}
+
+gif_hw.CHCR = 0x1000A000
+gif_hw.MADR = 0x1000A010
+gif_hw.QWC = 0x1000A020
+gif_hw.TADR = 0x1000A030
+gif_hw.ASR0 = 0x1000A040
+gif_hw.ASR1 = 0x1000A050
+gif_hw.SADR = 0x1000A080
+
+vif0_hw.CHCR = 0x10008000
+vif0_hw.MADR = 0x10008010
+vif0_hw.QWC = 0x10008020
+vif0_hw.TADR = 0x10008030
+vif0_hw.ASR0 = 0x10008040
+vif0_hw.ASR1 = 0x10008050
+vif0_hw.SADR = 0x10008080
+
+vif1_hw.CHCR = 0x10009000
+vif1_hw.MADR = 0x10009010
+vif1_hw.QWC = 0x10009020
+vif1_hw.TADR = 0x10009030
+vif1_hw.ASR0 = 0x10009040
+vif1_hw.ASR1 = 0x10009050
+vif1_hw.SADR = 0x10009080
+
+return gif_hw, vif0_hw, vif1_hw, nil
\ No newline at end of file
diff --git a/ps2emuMAXPAYNE/lua_include/language.lua b/ps2emuMAXPAYNE/lua_include/language.lua
new file mode 100644
index 0000000..5365327
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/language.lua
@@ -0,0 +1,34 @@
+
+-- Recommended method to import this module:
+-- local lang = require("language")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+lang = {}
+
+lang.japanese = 0
+lang.english = 1
+lang.french = 2
+lang.spanish = 3
+lang.german = 4
+lang.italian = 5
+lang.dutch = 6
+lang.portuguese = 7
+lang.russian = 8
+lang.korean = 9
+lang.chinese_traditional = 10
+lang.chinese_simplified = 11
+lang.finnish = 12
+lang.swedish = 13
+lang.danish = 14
+lang.norwegian = 15
+lang.polish = 16
+lang.portuguese_brazil = 17
+lang.english_gb = 18
+lang.turkish = 19
+lang.spanish_la = 20
+lang.arabic = 21
+lang.french_canada = 22
+
+return lang
\ No newline at end of file
diff --git a/ps2emuMAXPAYNE/lua_include/pad-and-key.lua b/ps2emuMAXPAYNE/lua_include/pad-and-key.lua
new file mode 100644
index 0000000..eb1c91b
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/pad-and-key.lua
@@ -0,0 +1,57 @@
+
+pad = {}
+
+-- Left Side
+pad.LU = 0x0010 -- Up
+pad.LD = 0x0040 -- Down
+pad.LL = 0x0080 -- Left
+pad.LR = 0x0020 -- Right
+
+-- Right Side
+pad.RU = 0x1000 -- Up (Triangle)
+pad.RD = 0x4000 -- Down (Cross)
+pad.RL = 0x8000 -- Left (Square)
+pad.RR = 0x2000 -- Right (Circle)
+
+-- aliases
+pad.UP = 0x0010 -- LU
+pad.DOWN = 0x0040 -- LD
+pad.LEFT = 0x0080 -- LL
+pad.RIGHT = 0x0020 -- LR
+pad.TRIANGLE= 0x1000
+pad.CROSS = 0x4000
+pad.SQUARE = 0x8000
+pad.CIRCLE = 0x2000
+
+pad.L1 = 0x0400
+pad.L2 = 0x0100
+pad.L3 = 0x0002
+
+pad.R1 = 0x0800
+pad.R2 = 0x0200
+pad.R3 = 0x0004
+
+pad.SELECT = 0x0001
+pad.START = 0x0008
+
+keyboard = {}
+
+keyboard.ESCAPE = 0x1000
+keyboard.SLASH = 0x1001
+keyboard.SEPARATOR = 0x1002 -- backslash or pipe (\|)
+keyboard.BACKQUOTE = 0x1003
+keyboard.PAGEDOWN = 0x1004
+keyboard.PAGEUP = 0x1005
+keyboard.F1 = 0x1006
+keyboard.F2 = 0x1007
+keyboard.F3 = 0x1008
+keyboard.F4 = 0x1009
+keyboard.F5 = 0x100a
+keyboard.F6 = 0x100b
+keyboard.F7 = 0x100c
+keyboard.F8 = 0x100d
+keyboard.F9 = 0x100e
+keyboard.F10 = 0x100f
+keyboard.F11 = 0x1010
+keyboard.F12 = 0x1011
+
diff --git a/ps2emuMAXPAYNE/lua_include/ps2.lua b/ps2emuMAXPAYNE/lua_include/ps2.lua
new file mode 100644
index 0000000..32686e7
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/ps2.lua
@@ -0,0 +1,202 @@
+
+require("ee-gpr-alias")
+require("utils")
+
+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.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
+
+MipsInsn.GetRt = function(insn) return (insn >> 16) & 0x1f end
+MipsInsn.GetRs = function(insn) return (insn >> 21) & 0x1f end
+MipsInsn.GetSimm = function(insn) return ((insn << 48) >> 48) end
+MipsInsn.GetOff = function(insn) return MipsInsn.GetSimm(insn) end
+MipsInsn.GetTarget = function(insn) return insn & 0x3ffffff end
+
+-- return FIFO queue of stack trace
+-- the queue item is { caller-addr, return-from }
+--
+-- example:
+-- print("=== stack trace ===")
+-- local stack_trace = MipsStackTrace(eeObj, eeObj.GetPc()+4, eeObj.GetGpr(gpr.ra), eeObj.GetGpr(gpr.sp))
+-- while not stack_trace:isEmpty() do
+-- local caller = stack_trace:dequeue()
+-- print( string.format(" 0x%08x [will return from : %x]", caller[1], caller[2]) )
+-- end
+--
+-- NOTE: you must +4 against GetPc() if you in a EE/IOP hook.
+-- Because EE/IOP jit executed the instruction at the address already and it might affect $sp or $ra.
+--
+-- obj : eeObj or iopObj
+-- pc : current pc (from GetPC or readout from thread context)
+-- ra : current ra (from GetGpr or readout from thread context)
+-- sp : current sp (from GetGpr or readout from thread context)
+MipsStackTrace = function (obj, pc, ra, sp, depth)
+ local max_depth = depth or 10 -- max trace depth
+ local n_j = 1
+ local jmax = {}
+ local depth = 0
+ local bdl_count = 0
+ local new_pc = 0
+ local icount = 0
+
+ local result = Queue.new()
+ local pushed_ra = Queue.new()
+ while depth < max_depth and icount < 2048 do
+ -- TODO: error checks
+ if (pc & 3) ~= 0 then
+ return result
+ end
+ pc = pc & 0x01ffffff
+ sp = sp & 0x01ffffff
+ local insn = obj.ReadMem32(pc)
+ -- print(string.format("trace .. pc=%x insn=%x", pc, insn))
+ -- result:enqueue( { pc, insn } )
+
+ if MipsInsn.IsJr(insn) and MipsInsn.GetRs(insn) == gpr.ra then
+ bdl_count = 1
+ depth = depth + 1
+ new_pc = ra
+ -- print(string.format("jr ra : ra=%x", ra))
+ icount = 0
+ -- print(string.format("enqueue caller pc=%x ret addr=%x", new_pc-8, pc))
+ result:enqueue( {new_pc-8, pc} ) -- {return-addr, where-from}
+ elseif MipsInsn.IsAddiu(insn) and MipsInsn.GetRt(insn) == gpr.sp and MipsInsn.GetRs(insn) == gpr.sp then
+ sp = sp + MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ -- print(string.format("addiu sp,sp,** : new sp = %x", sp))
+ elseif MipsInsn.IsLq(insn) or MipsInsn.IsLd(insn) or MipsInsn.IsLw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ -- the code might push $ra on the stack after start pc.
+ -- in such case, we must not retrieve $ra value from the memory.
+ if pushed_ra:isEmpty() then
+ local imm = MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ -- print(string.format("retrieve ra from stack(%x) : sp=%x imm=%x", sp+imm, sp, imm))
+ ra = obj.ReadMem32(sp + imm)
+ -- print(string.format("load ra,%x(sp) : sp = %x+%x, ra = %x", imm, sp, imm, ra))
+ else
+ -- print(string.format("retrieve ra from pushed one"))
+ pushed_ra:dequeue()
+ end
+ end
+ elseif MipsInsn.IsSq(insn) or MipsInsn.IsSd(insn) or MipsInsn.IsSw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ pushed_ra:enqueue(pc);
+ end
+ elseif MipsInsn.IsJ(insn) then -- j **
+ local imm = MipsInsn.GetTarget(insn)
+ imm = imm << 2
+ if pc == imm then
+ -- jump to self? maybe we can ignore it.
+ else
+ new_pc = imm
+ -- print(string.format("j ** : new_pc = %x", new_pc))
+ bdl_count = 1
+ for t=1, n_j do
+ if jmax[t] == new_pc then
+ return result -- closed loop
+ end
+ end
+ if n_j > 1024 then
+ return result -- jump buffer overflow
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsBeq(insn) and MipsInsn.GetRs(insn) == gpr.zero then -- beq zero,**
+ local offset = MipsInsn.GetOff(insn) -- ((insn<<48) >> 48)
+ offset = offset << 2
+ new_pc = pc + 4 + offset
+
+ if pc == new_pc then
+ -- jump to self? maybe we can ignore it
+ else
+ -- print(string.format("beq zero,** : new_pc=%x", new_pc))
+ bdl_count = 1
+ for t = 1, n_j do
+ if jmax[t] == new_pc then
+ return result
+ end
+ end
+ if n_j > 1024 then
+ return result
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsEnd(insn) then -- end
+ -- print(string.format("end"))
+ return result
+ elseif MipsInsn.IsJal(insn) then -- jal **
+ local imm = insn & 0x03ffffff
+ imm = imm << 2
+ -- print(string.format("jal ** : addr = %x", imm))
+ -- call
+ end
+
+ icount = icount + 1
+ pc = pc + 4
+
+ -- -- print(string.format("bdl_count=%d", bdl_count))
+ if bdl_count > 0 then
+ if bdl_count == 2 then
+ pc = new_pc
+ bdl_count = 0
+ else
+ bdl_count = bdl_count + 1
+ end
+ end
+ end
+ return result
+end
+
+PS2 = {}
+PS2.GetCurrentThread = function(eeObj) return eeObj.ReadMem32(0x12fac) end
+PS2.GetThreads = function(eeObj)
+ local EE_THREAD_BASE = 0x18000
+ local EE_NUM_THREADS = 0x100
+ local th = EE_THREAD_BASE
+ local result = Queue.new()
+ for t = 0, EE_NUM_THREADS-1 do
+ -- 0 : node_prev
+ -- 4 : node_next
+ -- 8 : status
+ -- 12: pc
+ -- 16: sp
+ -- 20: gp
+ -- 24: init_pri
+ -- 26: curr_pri
+ -- 28: wstat
+ -- 32: waitId
+ -- 36: wakeupCount
+ -- 40: attr
+ -- 44: option
+ -- 48: func
+ -- 52: argc
+ -- 56: args
+ -- 60: stack
+ -- 64: size
+ -- 68: root
+ -- 72: endOfHeap
+ local status = eeObj.ReadMem32(th + 8)
+ if status ~= 0 then
+ local id = t
+ local pri = eeObj.ReadMem16(th + 26)
+ local gp = eeObj.ReadMem32(th + 20)
+ local pc = eeObj.ReadMem32(th + 12)
+ local sp = eeObj.ReadMem32(th + 16)
+ result:enqueue( {id=id, status=status, pri=pri, gp=gp, pc=pc, sp=sp} )
+ end
+ th = th + 76
+ end
+ return result
+end
diff --git a/ps2emuMAXPAYNE/lua_include/sprite.lua b/ps2emuMAXPAYNE/lua_include/sprite.lua
new file mode 100644
index 0000000..49c10bd
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/sprite.lua
@@ -0,0 +1,57 @@
+
+local kFilterMode = {}
+kFilterMode.Point = 0x00000000 -- < Sample the one texel nearest to the sample point.
+kFilterMode.Bilinear = 0x00000001 -- < Sample the four texels nearest the sample point, and blend linearly.
+
+local kWrapMode = {}
+kWrapMode.Wrap = 0x00000000 -- < The integer portion of the input coordinate is discarded, and the fractional portion is used instead. U=U-floorf(U);
+kWrapMode.Mirror = 0x00000001 -- < The input coordinate is "reflected" across the texture boundary. This reflection may occur multiple times until the coordinate falls within the [0..1] range. U=isOdd(floorf(U)) ? 1-fracf(U) : fracf(U)
+kWrapMode.ClampLastTexel = 0x00000002 -- < The input coordinate is clamped to the range [0..1]. U=max(0,min(1,U));
+kWrapMode.MirrorOnceLastTexel = 0x00000003 -- < The input coordinate is reflected at most one time and then clamped to the range [0..1]. U=abs(max(-1,min(1,U));
+kWrapMode.ClampHalfBorder = 0x00000004 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.MirrorOnceHalfBorder = 0x00000005 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.ClampBorder = 0x00000006 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+kWrapMode.MirrorOnceBorder = 0x00000007 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+
+local kBlendMultiplier = {}
+kBlendMultiplier.Zero = 0x00000000 -- < Multiply the associated input by zero.
+kBlendMultiplier.One = 0x00000001 -- < Multiply the associated input by one.
+kBlendMultiplier.SrcColor = 0x00000002 -- < Multiply the associated input by the fragment color.
+kBlendMultiplier.OneMinusSrcColor = 0x00000003 -- < Multiply the associated input by one minus the fragment color.
+kBlendMultiplier.SrcAlpha = 0x00000004 -- < Multiply the associated input by the fragment alpha.
+kBlendMultiplier.OneMinusSrcAlpha = 0x00000005 -- < Multiply the associated input by one minus the fragment alpha.
+kBlendMultiplier.DestAlpha = 0x00000006 -- < Multiply the associated input by the render target alpha.
+kBlendMultiplier.OneMinusDestAlpha = 0x00000007 -- < Multiply the associated input by one minus the render target alpha.
+kBlendMultiplier.DestColor = 0x00000008 -- < Multiply the associated input by the render target color.
+kBlendMultiplier.OneMinusDestColor = 0x00000009 -- < Multiply the associated input by one minus the render target color.
+kBlendMultiplier.SrcAlphaSaturate = 0x0000000a -- < Multiply the associated input by the minimum of 1 or fragment alpha.
+kBlendMultiplier.ConstantColor = 0x0000000d -- < Multiply the associated input by the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantColor = 0x0000000e -- < Multiply the associated input by one minus the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.Src1Color = 0x0000000f -- < Multiply the associated input by a secondary fragment color.
+kBlendMultiplier.InverseSrc1Color = 0x00000010 -- < Multiply the associated input by one minus a secondary fragment color.
+kBlendMultiplier.Src1Alpha = 0x00000011 -- < Multiply the associated input by a secondary fragment alpha.
+kBlendMultiplier.InverseSrc1Alpha = 0x00000012 -- < Multiply the associated input by one minus a secondary fragment alpha.
+kBlendMultiplier.ConstantAlpha = 0x00000013 -- < Multiply the associated input by the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantAlpha = 0x00000014 -- < Multiply the associated input by one minus the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+
+local kBlendFunc = {}
+kBlendFunc.Add = 0x00000000 -- < The source value is added to the destination value.
+kBlendFunc.Subtract = 0x00000001 -- < The destination value is subtracted from the source value.
+kBlendFunc.Min = 0x00000002 -- < The minimum of the source and destination values is selected.
+kBlendFunc.Max = 0x00000003 -- < The maximum of the source and destination values is selected.
+kBlendFunc.ReverseSubtract = 0x00000004 -- < The source value is subtracted from the destination value.
+
+-- Default blending mode, ideal for typical alpha channel embedded into a PNG image.
+blendDefaultEquation = {
+ kBlendMultiplier.SrcAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusSrcAlpha, -- dest multiplier
+}
+
+blendConstFadeEquation = {
+ kBlendMultiplier.ConstantAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusConstantAlpha, -- dest multiplier
+}
+
+return kFilterMode, kWrapMode, kBlendMultiplier, kBlendFunc
diff --git a/ps2emuMAXPAYNE/lua_include/utils.lua b/ps2emuMAXPAYNE/lua_include/utils.lua
new file mode 100644
index 0000000..3849bd8
--- /dev/null
+++ b/ps2emuMAXPAYNE/lua_include/utils.lua
@@ -0,0 +1,60 @@
+-- utility classes/functions
+
+-- Stack
+-- ex:
+-- my_stack = Stack.new()
+-- my_stack:push( val )
+-- print( my_stack:pop( val ) )
+Stack = {}
+
+function Stack.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Stack})
+end
+
+function Stack:push(x)
+ table.insert(self.buff, x)
+end
+
+function Stack:pop()
+ return table.remove(self.buff)
+end
+
+function Stack:top()
+ return self.buff[#self.buff]
+end
+
+function Stack:isEmpty()
+ return #self.buff == 0
+end
+
+
+-- Queue
+-- ex:
+-- my_queue = Queue.new()
+-- my_queue:enqueue( val )
+-- print( my_queue:dequeue(val) )
+Queue = {}
+
+function Queue.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Queue})
+end
+
+function Queue:enqueue(x)
+ table.insert(self.buff, x)
+end
+
+function Queue:dequeue()
+ return table.remove(self.buff, 1)
+end
+
+function Queue:top()
+ if #self.buff > 0 then
+ return self.buff[1]
+ end
+end
+
+function Queue:isEmpty()
+ return #self.buff == 0
+end
diff --git a/ps2emuMAXPAYNE/ps2-emu-compiler.self b/ps2emuMAXPAYNE/ps2-emu-compiler.self
new file mode 100644
index 0000000..848d3e5
Binary files /dev/null and b/ps2emuMAXPAYNE/ps2-emu-compiler.self differ
diff --git a/ps2emuMAXPAYNE/sce_discmap.plt b/ps2emuMAXPAYNE/sce_discmap.plt
new file mode 100644
index 0000000..8b89e7a
Binary files /dev/null and b/ps2emuMAXPAYNE/sce_discmap.plt differ
diff --git a/ps2emuMAXPAYNE/sce_module/libSceFios2.prx b/ps2emuMAXPAYNE/sce_module/libSceFios2.prx
new file mode 100644
index 0000000..99f5dee
Binary files /dev/null and b/ps2emuMAXPAYNE/sce_module/libSceFios2.prx differ
diff --git a/ps2emuMAXPAYNE/sce_module/libc.prx b/ps2emuMAXPAYNE/sce_module/libc.prx
new file mode 100644
index 0000000..73f02b5
Binary files /dev/null and b/ps2emuMAXPAYNE/sce_module/libc.prx differ
diff --git a/ps2emuMAXPAYNE/sce_sys/param.sfo b/ps2emuMAXPAYNE/sce_sys/param.sfo
new file mode 100644
index 0000000..d31774c
Binary files /dev/null and b/ps2emuMAXPAYNE/sce_sys/param.sfo differ
diff --git a/ps2emuMAXPAYNE/sce_sys/shareparam.json b/ps2emuMAXPAYNE/sce_sys/shareparam.json
new file mode 100644
index 0000000..8f4038b
--- /dev/null
+++ b/ps2emuMAXPAYNE/sce_sys/shareparam.json
@@ -0,0 +1 @@
+{"ps4_share_param_version":"01.10","game_version":"01.00","client_id":"460621181150-9g1m23knq95uld74tnjap752q87pug9v.apps.googleusercontent.com","overlay_position":{"x":0,"y":0}}
\ No newline at end of file
diff --git a/ps2emuMSLUG/PS20220WD20050620.crack b/ps2emuMSLUG/PS20220WD20050620.crack
new file mode 100644
index 0000000..668ff93
Binary files /dev/null and b/ps2emuMSLUG/PS20220WD20050620.crack differ
diff --git a/ps2emuMSLUG/config-emu-ps4.txt b/ps2emuMSLUG/config-emu-ps4.txt
new file mode 100644
index 0000000..92b4bdb
--- /dev/null
+++ b/ps2emuMSLUG/config-emu-ps4.txt
@@ -0,0 +1,13 @@
+--path-vmc="/tmp/vmc"
+--path-emulog="/tmp/recordings"
+--path-patches="/app0/patches"
+--path-trophydata="/app0/trophy_data"
+--path-featuredata="/app0/feature_data"
+--host-osd=0
+--host-audio=1
+--host-display-mode=full
+--ps2-title-id=SLES-00000
+--ps2-lang=system
+--gs-uprender=2x2
+--gs-upscale=EdgeSmooth
+--rom="PS20220WD20050620.crack"
\ No newline at end of file
diff --git a/ps2emuMSLUG/docs/revision.h b/ps2emuMSLUG/docs/revision.h
new file mode 100644
index 0000000..10db54d
--- /dev/null
+++ b/ps2emuMSLUG/docs/revision.h
@@ -0,0 +1,12 @@
+/* This file is autogenerated. DO NOT EDIT. */
+#define PACKAGE_NAME "Packaging/PackageBuild-BuildBinary-1035"
+#define PACKAGE_BUILT_BY ""
+#define PACKAGE_BUILT_ON "20160615"
+#define PACKAGE_DATE_STRING "21 Jun 16"
+#define JENKINS_JOB_NAME "Packaging/PackageBuild-BuildBinary"
+#define JENKINS_JOB_NUMBER "1035"
+#define REV_BINARY_SHA "3c2020ecde7c793ccf72bed055014c4b4ae86cb2f84b88f72404f20d69d7eeca"
+#define GIT_BRANCH "titles/MetalSlugAnthology"
+#define GIT_REV_DATE "20160615-1"
+#define GIT_HASH_BINARY "045d6547f733ee0e269faf31c9818fa4d7dd625b"
+
diff --git a/ps2emuMSLUG/eboot.bin b/ps2emuMSLUG/eboot.bin
new file mode 100644
index 0000000..6f5ea05
Binary files /dev/null and b/ps2emuMSLUG/eboot.bin differ
diff --git a/ps2emuMSLUG/formatted.card b/ps2emuMSLUG/formatted.card
new file mode 100644
index 0000000..1ecafd6
Binary files /dev/null and b/ps2emuMSLUG/formatted.card differ
diff --git a/ps2emuMSLUG/lua_include/ee-cpr0-alias.lua b/ps2emuMSLUG/lua_include/ee-cpr0-alias.lua
new file mode 100644
index 0000000..42af8b6
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/ee-cpr0-alias.lua
@@ -0,0 +1,26 @@
+cpr = {}
+
+cpr.index = 0
+cpr.random = 1
+cpr.entrylo0 = 2
+cpr.entrylo1 = 3
+cpr.context = 4
+cpr.pagemask = 5
+cpr.wired = 6
+cpr.badvaddr = 8
+cpr.count = 9
+cpr.entryhi = 10
+cpr.compare = 11
+cpr.status = 12
+cpr.cause = 13
+cpr.epc = 14
+cpr.prid = 15
+cpr.config = 16
+cpr.badpaddr = 23
+cpr.hwbk = 24
+cpr.pccr = 25
+cpr.taglo = 28
+cpr.taghi = 29
+cpr.errorepc = 30
+
+return cpr
\ No newline at end of file
diff --git a/ps2emuMSLUG/lua_include/ee-gpr-alias.lua b/ps2emuMSLUG/lua_include/ee-gpr-alias.lua
new file mode 100644
index 0000000..e491810
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/ee-gpr-alias.lua
@@ -0,0 +1,43 @@
+
+-- Recommended method to import this module:
+-- local gpr = require("ee-gpr-alias")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+gpr = {}
+
+gpr.zero = 0
+gpr.at = 1
+gpr.v0 = 2
+gpr.v1 = 3
+gpr.a0 = 4
+gpr.a1 = 5
+gpr.a2 = 6
+gpr.a3 = 7
+gpr.t0 = 8
+gpr.t1 = 9
+gpr.t2 = 10
+gpr.t3 = 11
+gpr.t4 = 12
+gpr.t5 = 13
+gpr.t6 = 14
+gpr.t7 = 15
+gpr.s0 = 16
+gpr.s1 = 17
+gpr.s2 = 18
+gpr.s3 = 19
+gpr.s4 = 20
+gpr.s5 = 21
+gpr.s6 = 22
+gpr.s7 = 23
+gpr.t8 = 24
+gpr.t9 = 25
+gpr.k0 = 26
+gpr.k1 = 27
+gpr.gp = 28
+gpr.sp = 29
+gpr.fp = 30
+gpr.ra = 31
+
+return gpr
diff --git a/ps2emuMSLUG/lua_include/ee-hwaddr.lua b/ps2emuMSLUG/lua_include/ee-hwaddr.lua
new file mode 100644
index 0000000..6197c6e
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/ee-hwaddr.lua
@@ -0,0 +1,29 @@
+gif_hw = {}
+vif0_hw = {}
+vif1_hw = {}
+
+gif_hw.CHCR = 0x1000A000
+gif_hw.MADR = 0x1000A010
+gif_hw.QWC = 0x1000A020
+gif_hw.TADR = 0x1000A030
+gif_hw.ASR0 = 0x1000A040
+gif_hw.ASR1 = 0x1000A050
+gif_hw.SADR = 0x1000A080
+
+vif0_hw.CHCR = 0x10008000
+vif0_hw.MADR = 0x10008010
+vif0_hw.QWC = 0x10008020
+vif0_hw.TADR = 0x10008030
+vif0_hw.ASR0 = 0x10008040
+vif0_hw.ASR1 = 0x10008050
+vif0_hw.SADR = 0x10008080
+
+vif1_hw.CHCR = 0x10009000
+vif1_hw.MADR = 0x10009010
+vif1_hw.QWC = 0x10009020
+vif1_hw.TADR = 0x10009030
+vif1_hw.ASR0 = 0x10009040
+vif1_hw.ASR1 = 0x10009050
+vif1_hw.SADR = 0x10009080
+
+return gif_hw, vif0_hw, vif1_hw, nil
\ No newline at end of file
diff --git a/ps2emuMSLUG/lua_include/language.lua b/ps2emuMSLUG/lua_include/language.lua
new file mode 100644
index 0000000..5365327
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/language.lua
@@ -0,0 +1,34 @@
+
+-- Recommended method to import this module:
+-- local lang = require("language")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+lang = {}
+
+lang.japanese = 0
+lang.english = 1
+lang.french = 2
+lang.spanish = 3
+lang.german = 4
+lang.italian = 5
+lang.dutch = 6
+lang.portuguese = 7
+lang.russian = 8
+lang.korean = 9
+lang.chinese_traditional = 10
+lang.chinese_simplified = 11
+lang.finnish = 12
+lang.swedish = 13
+lang.danish = 14
+lang.norwegian = 15
+lang.polish = 16
+lang.portuguese_brazil = 17
+lang.english_gb = 18
+lang.turkish = 19
+lang.spanish_la = 20
+lang.arabic = 21
+lang.french_canada = 22
+
+return lang
\ No newline at end of file
diff --git a/ps2emuMSLUG/lua_include/pad-and-key.lua b/ps2emuMSLUG/lua_include/pad-and-key.lua
new file mode 100644
index 0000000..6e6c616
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/pad-and-key.lua
@@ -0,0 +1,58 @@
+
+pad = {}
+
+-- Left Side
+pad.LU = 0x0010 -- Up
+pad.LD = 0x0040 -- Down
+pad.LL = 0x0080 -- Left
+pad.LR = 0x0020 -- Right
+
+-- Right Side
+pad.RU = 0x1000 -- Up (Triangle)
+pad.RD = 0x4000 -- Down (Cross)
+pad.RL = 0x8000 -- Left (Square)
+pad.RR = 0x2000 -- Right (Circle)
+
+-- aliases
+pad.UP = 0x0010 -- LU
+pad.DOWN = 0x0040 -- LD
+pad.LEFT = 0x0080 -- LL
+pad.RIGHT = 0x0020 -- LR
+pad.TRIANGLE= 0x1000
+pad.CROSS = 0x4000
+pad.SQUARE = 0x8000
+pad.CIRCLE = 0x2000
+
+pad.L1 = 0x0400
+pad.L2 = 0x0100
+pad.L3 = 0x0002
+
+pad.R1 = 0x0800
+pad.R2 = 0x0200
+pad.R3 = 0x0004
+
+pad.SELECT = 0x0001
+pad.START = 0x0008
+
+keyboard = {}
+
+keyboard.ESCAPE = 0x1000
+keyboard.SLASH = 0x1001
+keyboard.SEPARATOR = 0x1002 -- backslash or pipe (\|)
+keyboard.BACKQUOTE = 0x1003
+keyboard.PAGEDOWN = 0x1004
+keyboard.PAGEUP = 0x1005
+keyboard.F1 = 0x1006
+keyboard.F2 = 0x1007
+keyboard.F3 = 0x1008
+keyboard.F4 = 0x1009
+keyboard.F5 = 0x100a
+keyboard.F6 = 0x100b
+keyboard.F7 = 0x100c
+keyboard.F8 = 0x100d
+keyboard.F9 = 0x100e
+keyboard.F10 = 0x100f
+keyboard.F11 = 0x1010
+keyboard.F12 = 0x1011
+
+return pad, keyboard
\ No newline at end of file
diff --git a/ps2emuMSLUG/lua_include/pad-connect-type.lua b/ps2emuMSLUG/lua_include/pad-connect-type.lua
new file mode 100644
index 0000000..6075410
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/pad-connect-type.lua
@@ -0,0 +1,9 @@
+
+local PadConnectType = {}
+
+PadConnectType.DS4 = 0
+PadConnectType.HID = 1 -- any 3rd party USB controller (fight stick, turbo controller, etc), always local.
+PadConnectType.REMOTE_DS4 = 2 -- remote DS4 should behave just like regular DS4
+PadConnectType.REMOTE_VITA = 3 -- remote VITA lacks analog L2/R2
+
+return PadConnectType
\ No newline at end of file
diff --git a/ps2emuMSLUG/lua_include/ps2.lua b/ps2emuMSLUG/lua_include/ps2.lua
new file mode 100644
index 0000000..27a8202
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/ps2.lua
@@ -0,0 +1,231 @@
+
+require("ee-gpr-alias")
+require("utils")
+
+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
+
+local dbgPrintf = function(s,...)
+ -- Uncomment to enable debug trace logging of MipsStackTrace.
+ -- print (string.format(...))
+end
+
+-- return FIFO queue of stack trace
+-- the queue item is { caller-addr, return-from }
+--
+-- example:
+-- print("=== stack trace ===")
+-- local stack_trace = MipsStackTrace(eeObj, eeObj.GetPc()+4, eeObj.GetGpr(gpr.ra), eeObj.GetGpr(gpr.sp))
+-- while not stack_trace:isEmpty() do
+-- local caller = stack_trace:dequeue()
+-- local symName,symPc = debugObj.GetSymbol(caller[1])
+-- print( string.format(" 0x%08x %-48s [will return from : %x]", caller[1], synName, caller[2]) )
+-- end
+--
+-- NOTE: you must +4 against GetPc() if you in a EE/IOP hook.
+-- Because EE/IOP jit executed the instruction at the address already and it might affect $sp or $ra.
+--
+-- obj : eeObj or iopObj
+-- pc : current pc (from GetPC or readout from thread context)
+-- ra : current ra (from GetGpr or readout from thread context)
+-- sp : current sp (from GetGpr or readout from thread context)
+MipsStackTrace = function (obj, pc, ra, sp, depth)
+ local max_depth = depth or 10 -- max trace depth
+ local n_j = 1
+ local jmax = {}
+ local depth = 0
+ local bdl_count = 0
+ local new_pc = 0
+ local icount = 0
+
+ local result = Queue.new()
+ local pushed_ra = Queue.new()
+ while depth < max_depth and icount < 2048 do
+ -- TODO: error checks
+ if (pc & 3) ~= 0 then
+ return result
+ end
+ pc = pc & 0x01ffffff
+ sp = sp & 0x01ffffff
+ local insn = obj.ReadMem32(pc)
+ dbgPrintf(string.format("trace .. pc=%x insn=%x", pc, insn))
+ -- result:enqueue( { pc, insn } )
+
+ if MipsInsn.IsJr(insn) and MipsInsn.GetRs(insn) == gpr.ra then
+ bdl_count = 1
+ depth = depth + 1
+ new_pc = ra
+ dbgPrintf(string.format("jr ra : ra=%x", ra))
+ icount = 0
+ dbgPrintf(string.format("enqueue caller pc=%x ret addr=%x", new_pc-8, pc))
+ result:enqueue( {new_pc-8, pc} ) -- {return-addr, where-from}
+ elseif MipsInsn.IsAddiu(insn) and MipsInsn.GetRt(insn) == gpr.sp and MipsInsn.GetRs(insn) == gpr.sp then
+ sp = sp + MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ dbgPrintf(string.format("addiu sp,sp,** : new sp = %x", sp))
+ elseif (MipsInsn.IsAddu(insn) or MipsInsn.IsDaddu(insn)) and MipsInsn.GetRd(insn) == gpr.sp then
+ dbgPrintf(string.format("addiu sp,**,** ... we can't get new sp value..."))
+ return result
+ elseif MipsInsn.IsLq(insn) or MipsInsn.IsLd(insn) or MipsInsn.IsLw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ -- the code might push $ra on the stack after start pc.
+ -- in such case, we must not retrieve $ra value from the memory.
+ if pushed_ra:isEmpty() then
+ local imm = MipsInsn.GetSimm(insn) -- ((insn<<48) >>48)
+ dbgPrintf(string.format("retrieve ra from stack(%x) : sp=%x imm=%x", sp+imm, sp, imm))
+ ra = obj.ReadMem32(sp + imm)
+ dbgPrintf(string.format("load ra,%x(sp) : sp = %x+%x, ra = %x", imm, sp, imm, ra))
+ else
+ dbgPrintf(string.format("retrieve ra from pushed one"))
+ pushed_ra:dequeue()
+ end
+ end
+ elseif MipsInsn.IsSq(insn) or MipsInsn.IsSd(insn) or MipsInsn.IsSw(insn) then
+ if MipsInsn.GetRt(insn) == gpr.ra and MipsInsn.GetRs(insn) == gpr.sp then
+ pushed_ra:enqueue(pc);
+ end
+ elseif MipsInsn.IsJ(insn) then -- j **
+ local imm = MipsInsn.GetTarget(insn)
+ imm = imm << 2
+ if pc == imm then
+ -- jump to self? maybe we can ignore it.
+ else
+ new_pc = imm
+ dbgPrintf(string.format("j ** : new_pc = %x", new_pc))
+ bdl_count = 1
+ for t=1, n_j do
+ if jmax[t] == new_pc then
+ return result -- closed loop
+ end
+ end
+ if n_j > 1024 then
+ return result -- jump buffer overflow
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ elseif MipsInsn.IsBeq(insn) and MipsInsn.GetRs(insn) == gpr.zero then -- beq zero,**
+ local offset = MipsInsn.GetOff(insn) -- ((insn<<48) >> 48)
+ offset = offset << 2
+ new_pc = pc + 4 + offset
+ dbgPrintf(string.format("beq zero,** : new_pc=%x", new_pc))
+ if offset < 0 then
+ -- it's ... back loop. ignore
+ else
+ if pc == new_pc then
+ -- jump to self? maybe we can ignore it
+ else
+ -- print(string.format("beq zero,** : new_pc=%x", new_pc))
+ bdl_count = 1
+ for t = 1, n_j do
+ if jmax[t] == new_pc then
+ return result
+ end
+ end
+ if n_j > 1024 then
+ return result
+ end
+ jmax[n_j] = new_pc
+ n_j = n_j + 1
+ end
+ end
+ elseif MipsInsn.IsEnd(insn) then -- end
+ dbgPrintf(string.format("end"))
+ -- Ignore 'end/break'
+ -- Most use cases of end/break are 'unreachable' debug code in titles.
+ -- If ignoring this is a problem on some specific title, then perhaps analysis of
+ -- end/break should be instead controllable via parameter. --jstine
+ -- return result
+ elseif MipsInsn.IsJal(insn) then -- jal **
+ local imm = insn & 0x03ffffff
+ imm = imm << 2
+ dbgPrintf(string.format("jal ** : addr = %x", imm))
+ -- call
+ end
+
+ icount = icount + 1
+ pc = pc + 4
+
+ -- dbgPrintf(string.format("bdl_count=%d", bdl_count))
+ if bdl_count > 0 then
+ if bdl_count == 2 then
+ pc = new_pc
+ bdl_count = 0
+ else
+ bdl_count = bdl_count + 1
+ end
+ end
+ end
+ return result
+end
+
+PS2 = {}
+PS2.GetCurrentThread = function(eeObj) return eeObj.ReadMem32(0x12fac) end
+PS2.GetThreads = function(eeObj)
+ local EE_THREAD_BASE = 0x18000
+ local EE_NUM_THREADS = 0x100
+ local th = EE_THREAD_BASE
+ local result = Queue.new()
+ for t = 0, EE_NUM_THREADS-1 do
+ -- 0 : node_prev
+ -- 4 : node_next
+ -- 8 : status
+ -- 12: pc
+ -- 16: sp
+ -- 20: gp
+ -- 24: init_pri
+ -- 26: curr_pri
+ -- 28: wstat
+ -- 32: waitId
+ -- 36: wakeupCount
+ -- 40: attr
+ -- 44: option
+ -- 48: func
+ -- 52: argc
+ -- 56: args
+ -- 60: stack
+ -- 64: size
+ -- 68: root
+ -- 72: endOfHeap
+ local status = eeObj.ReadMem32(th + 8)
+ if status ~= 0 then
+ local id = t
+ local pri = eeObj.ReadMem16(th + 26)
+ local gp = eeObj.ReadMem32(th + 20)
+ local pc = eeObj.ReadMem32(th + 12)
+ local sp = eeObj.ReadMem32(th + 16)
+ result:enqueue( {id=id, status=status, pri=pri, gp=gp, pc=pc, sp=sp} )
+ end
+ th = th + 76
+ end
+ return result
+end
diff --git a/ps2emuMSLUG/lua_include/sprite.lua b/ps2emuMSLUG/lua_include/sprite.lua
new file mode 100644
index 0000000..49c10bd
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/sprite.lua
@@ -0,0 +1,57 @@
+
+local kFilterMode = {}
+kFilterMode.Point = 0x00000000 -- < Sample the one texel nearest to the sample point.
+kFilterMode.Bilinear = 0x00000001 -- < Sample the four texels nearest the sample point, and blend linearly.
+
+local kWrapMode = {}
+kWrapMode.Wrap = 0x00000000 -- < The integer portion of the input coordinate is discarded, and the fractional portion is used instead. U=U-floorf(U);
+kWrapMode.Mirror = 0x00000001 -- < The input coordinate is "reflected" across the texture boundary. This reflection may occur multiple times until the coordinate falls within the [0..1] range. U=isOdd(floorf(U)) ? 1-fracf(U) : fracf(U)
+kWrapMode.ClampLastTexel = 0x00000002 -- < The input coordinate is clamped to the range [0..1]. U=max(0,min(1,U));
+kWrapMode.MirrorOnceLastTexel = 0x00000003 -- < The input coordinate is reflected at most one time and then clamped to the range [0..1]. U=abs(max(-1,min(1,U));
+kWrapMode.ClampHalfBorder = 0x00000004 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.MirrorOnceHalfBorder = 0x00000005 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.ClampBorder = 0x00000006 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+kWrapMode.MirrorOnceBorder = 0x00000007 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+
+local kBlendMultiplier = {}
+kBlendMultiplier.Zero = 0x00000000 -- < Multiply the associated input by zero.
+kBlendMultiplier.One = 0x00000001 -- < Multiply the associated input by one.
+kBlendMultiplier.SrcColor = 0x00000002 -- < Multiply the associated input by the fragment color.
+kBlendMultiplier.OneMinusSrcColor = 0x00000003 -- < Multiply the associated input by one minus the fragment color.
+kBlendMultiplier.SrcAlpha = 0x00000004 -- < Multiply the associated input by the fragment alpha.
+kBlendMultiplier.OneMinusSrcAlpha = 0x00000005 -- < Multiply the associated input by one minus the fragment alpha.
+kBlendMultiplier.DestAlpha = 0x00000006 -- < Multiply the associated input by the render target alpha.
+kBlendMultiplier.OneMinusDestAlpha = 0x00000007 -- < Multiply the associated input by one minus the render target alpha.
+kBlendMultiplier.DestColor = 0x00000008 -- < Multiply the associated input by the render target color.
+kBlendMultiplier.OneMinusDestColor = 0x00000009 -- < Multiply the associated input by one minus the render target color.
+kBlendMultiplier.SrcAlphaSaturate = 0x0000000a -- < Multiply the associated input by the minimum of 1 or fragment alpha.
+kBlendMultiplier.ConstantColor = 0x0000000d -- < Multiply the associated input by the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantColor = 0x0000000e -- < Multiply the associated input by one minus the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.Src1Color = 0x0000000f -- < Multiply the associated input by a secondary fragment color.
+kBlendMultiplier.InverseSrc1Color = 0x00000010 -- < Multiply the associated input by one minus a secondary fragment color.
+kBlendMultiplier.Src1Alpha = 0x00000011 -- < Multiply the associated input by a secondary fragment alpha.
+kBlendMultiplier.InverseSrc1Alpha = 0x00000012 -- < Multiply the associated input by one minus a secondary fragment alpha.
+kBlendMultiplier.ConstantAlpha = 0x00000013 -- < Multiply the associated input by the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantAlpha = 0x00000014 -- < Multiply the associated input by one minus the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+
+local kBlendFunc = {}
+kBlendFunc.Add = 0x00000000 -- < The source value is added to the destination value.
+kBlendFunc.Subtract = 0x00000001 -- < The destination value is subtracted from the source value.
+kBlendFunc.Min = 0x00000002 -- < The minimum of the source and destination values is selected.
+kBlendFunc.Max = 0x00000003 -- < The maximum of the source and destination values is selected.
+kBlendFunc.ReverseSubtract = 0x00000004 -- < The source value is subtracted from the destination value.
+
+-- Default blending mode, ideal for typical alpha channel embedded into a PNG image.
+blendDefaultEquation = {
+ kBlendMultiplier.SrcAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusSrcAlpha, -- dest multiplier
+}
+
+blendConstFadeEquation = {
+ kBlendMultiplier.ConstantAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusConstantAlpha, -- dest multiplier
+}
+
+return kFilterMode, kWrapMode, kBlendMultiplier, kBlendFunc
diff --git a/ps2emuMSLUG/lua_include/utils.lua b/ps2emuMSLUG/lua_include/utils.lua
new file mode 100644
index 0000000..3849bd8
--- /dev/null
+++ b/ps2emuMSLUG/lua_include/utils.lua
@@ -0,0 +1,60 @@
+-- utility classes/functions
+
+-- Stack
+-- ex:
+-- my_stack = Stack.new()
+-- my_stack:push( val )
+-- print( my_stack:pop( val ) )
+Stack = {}
+
+function Stack.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Stack})
+end
+
+function Stack:push(x)
+ table.insert(self.buff, x)
+end
+
+function Stack:pop()
+ return table.remove(self.buff)
+end
+
+function Stack:top()
+ return self.buff[#self.buff]
+end
+
+function Stack:isEmpty()
+ return #self.buff == 0
+end
+
+
+-- Queue
+-- ex:
+-- my_queue = Queue.new()
+-- my_queue:enqueue( val )
+-- print( my_queue:dequeue(val) )
+Queue = {}
+
+function Queue.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Queue})
+end
+
+function Queue:enqueue(x)
+ table.insert(self.buff, x)
+end
+
+function Queue:dequeue()
+ return table.remove(self.buff, 1)
+end
+
+function Queue:top()
+ if #self.buff > 0 then
+ return self.buff[1]
+ end
+end
+
+function Queue:isEmpty()
+ return #self.buff == 0
+end
diff --git a/ps2emuMSLUG/ps2-emu-compiler.self b/ps2emuMSLUG/ps2-emu-compiler.self
new file mode 100644
index 0000000..6b55c4e
Binary files /dev/null and b/ps2emuMSLUG/ps2-emu-compiler.self differ
diff --git a/ps2emuMSLUG/sce_discmap.plt b/ps2emuMSLUG/sce_discmap.plt
new file mode 100644
index 0000000..cb90d1f
Binary files /dev/null and b/ps2emuMSLUG/sce_discmap.plt differ
diff --git a/ps2emuMSLUG/sce_module/libSceFios2.prx b/ps2emuMSLUG/sce_module/libSceFios2.prx
new file mode 100644
index 0000000..238191c
Binary files /dev/null and b/ps2emuMSLUG/sce_module/libSceFios2.prx differ
diff --git a/ps2emuMSLUG/sce_module/libc.prx b/ps2emuMSLUG/sce_module/libc.prx
new file mode 100644
index 0000000..dc8776d
Binary files /dev/null and b/ps2emuMSLUG/sce_module/libc.prx differ
diff --git a/ps2emuMSLUG/sce_sys/param.sfo b/ps2emuMSLUG/sce_sys/param.sfo
new file mode 100644
index 0000000..d31774c
Binary files /dev/null and b/ps2emuMSLUG/sce_sys/param.sfo differ
diff --git a/ps2emuMSLUG/sce_sys/shareparam.json b/ps2emuMSLUG/sce_sys/shareparam.json
new file mode 100644
index 0000000..8f4038b
--- /dev/null
+++ b/ps2emuMSLUG/sce_sys/shareparam.json
@@ -0,0 +1 @@
+{"ps4_share_param_version":"01.10","game_version":"01.00","client_id":"460621181150-9g1m23knq95uld74tnjap752q87pug9v.apps.googleusercontent.com","overlay_position":{"x":0,"y":0}}
\ No newline at end of file
diff --git a/ps2emuNEOGEO/PS20220WD20050620.crack b/ps2emuNEOGEO/PS20220WD20050620.crack
new file mode 100644
index 0000000..668ff93
Binary files /dev/null and b/ps2emuNEOGEO/PS20220WD20050620.crack differ
diff --git a/ps2emuNEOGEO/config-emu-ps4.txt b/ps2emuNEOGEO/config-emu-ps4.txt
new file mode 100644
index 0000000..92b4bdb
--- /dev/null
+++ b/ps2emuNEOGEO/config-emu-ps4.txt
@@ -0,0 +1,13 @@
+--path-vmc="/tmp/vmc"
+--path-emulog="/tmp/recordings"
+--path-patches="/app0/patches"
+--path-trophydata="/app0/trophy_data"
+--path-featuredata="/app0/feature_data"
+--host-osd=0
+--host-audio=1
+--host-display-mode=full
+--ps2-title-id=SLES-00000
+--ps2-lang=system
+--gs-uprender=2x2
+--gs-upscale=EdgeSmooth
+--rom="PS20220WD20050620.crack"
\ No newline at end of file
diff --git a/ps2emuNEOGEO/docs/revision.h b/ps2emuNEOGEO/docs/revision.h
new file mode 100644
index 0000000..741c462
--- /dev/null
+++ b/ps2emuNEOGEO/docs/revision.h
@@ -0,0 +1,12 @@
+/* This file is autogenerated. DO NOT EDIT. */
+#define PACKAGE_NAME "Packaging/PackageBuild-BuildBinary-1325"
+#define PACKAGE_BUILT_BY ""
+#define PACKAGE_BUILT_ON "20161101"
+#define PACKAGE_DATE_STRING "28 Nov 16"
+#define JENKINS_JOB_NAME "Packaging/PackageBuild-BuildBinary"
+#define JENKINS_JOB_NUMBER "1325"
+#define REV_BINARY_SHA "cca96ed0142cc5a621a5fc66d7688bc3668c8f05b1ae64ff83b5d9d88e499289"
+#define GIT_BRANCH "titles/FuuunSuperCombo"
+#define GIT_REV_DATE "20161101-1"
+#define GIT_HASH_BINARY "6b434ef3a5352f4b20349d8495a3e3e214461151"
+
diff --git a/ps2emuNEOGEO/eboot.bin b/ps2emuNEOGEO/eboot.bin
new file mode 100644
index 0000000..9088b63
Binary files /dev/null and b/ps2emuNEOGEO/eboot.bin differ
diff --git a/ps2emuNEOGEO/formatted.card b/ps2emuNEOGEO/formatted.card
new file mode 100644
index 0000000..1ecafd6
Binary files /dev/null and b/ps2emuNEOGEO/formatted.card differ
diff --git a/ps2emuNEOGEO/lua_include/MipsInsn.lua b/ps2emuNEOGEO/lua_include/MipsInsn.lua
new file mode 100644
index 0000000..66e9a3c
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/MipsInsn.lua
@@ -0,0 +1,35 @@
+
+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
diff --git a/ps2emuNEOGEO/lua_include/PadStick.lua b/ps2emuNEOGEO/lua_include/PadStick.lua
new file mode 100644
index 0000000..d2efb75
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/PadStick.lua
@@ -0,0 +1,15 @@
+
+PadStick = {}
+
+PadStick.None = 0
+PadStick.AxisLX_Pos = 1
+PadStick.AxisLX_Neg = 2
+PadStick.AxisLY_Pos = 3
+PadStick.AxisLY_Neg = 4
+
+PadStick.AxisRX_Pos = 9 -- set to 9 to make bits for XY and Pos/Neg line up
+PadStick.AxisRX_Neg = 10
+PadStick.AxisRY_Pos = 11
+PadStick.AxisRY_Neg = 12
+
+return PadStick;
diff --git a/ps2emuNEOGEO/lua_include/ee-cpr0-alias.lua b/ps2emuNEOGEO/lua_include/ee-cpr0-alias.lua
new file mode 100644
index 0000000..42af8b6
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/ee-cpr0-alias.lua
@@ -0,0 +1,26 @@
+cpr = {}
+
+cpr.index = 0
+cpr.random = 1
+cpr.entrylo0 = 2
+cpr.entrylo1 = 3
+cpr.context = 4
+cpr.pagemask = 5
+cpr.wired = 6
+cpr.badvaddr = 8
+cpr.count = 9
+cpr.entryhi = 10
+cpr.compare = 11
+cpr.status = 12
+cpr.cause = 13
+cpr.epc = 14
+cpr.prid = 15
+cpr.config = 16
+cpr.badpaddr = 23
+cpr.hwbk = 24
+cpr.pccr = 25
+cpr.taglo = 28
+cpr.taghi = 29
+cpr.errorepc = 30
+
+return cpr
\ No newline at end of file
diff --git a/ps2emuNEOGEO/lua_include/ee-gpr-alias.lua b/ps2emuNEOGEO/lua_include/ee-gpr-alias.lua
new file mode 100644
index 0000000..e270d57
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/ee-gpr-alias.lua
@@ -0,0 +1,47 @@
+
+-- Recommended method to import this module:
+-- local gpr = require("ee-gpr-alias")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+gpr = {}
+
+gpr.zero = 0
+gpr.at = 1
+gpr.v0 = 2
+gpr.v1 = 3
+gpr.a0 = 4
+gpr.a1 = 5
+gpr.a2 = 6
+gpr.a3 = 7
+gpr.t0 = 8
+gpr.t1 = 9
+gpr.t2 = 10
+gpr.t3 = 11
+gpr.t4 = 12
+gpr.t5 = 13
+gpr.t6 = 14
+gpr.t7 = 15
+gpr.s0 = 16
+gpr.s1 = 17
+gpr.s2 = 18
+gpr.s3 = 19
+gpr.s4 = 20
+gpr.s5 = 21
+gpr.s6 = 22
+gpr.s7 = 23
+gpr.t8 = 24
+gpr.t9 = 25
+gpr.k0 = 26
+gpr.k1 = 27
+gpr.gp = 28
+gpr.sp = 29
+gpr.fp = 30
+gpr.ra = 31
+
+gpr.lo = 32
+gpr.hi = 33
+gpr.sa = 34
+
+return gpr
diff --git a/ps2emuNEOGEO/lua_include/ee-hwaddr.lua b/ps2emuNEOGEO/lua_include/ee-hwaddr.lua
new file mode 100644
index 0000000..6197c6e
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/ee-hwaddr.lua
@@ -0,0 +1,29 @@
+gif_hw = {}
+vif0_hw = {}
+vif1_hw = {}
+
+gif_hw.CHCR = 0x1000A000
+gif_hw.MADR = 0x1000A010
+gif_hw.QWC = 0x1000A020
+gif_hw.TADR = 0x1000A030
+gif_hw.ASR0 = 0x1000A040
+gif_hw.ASR1 = 0x1000A050
+gif_hw.SADR = 0x1000A080
+
+vif0_hw.CHCR = 0x10008000
+vif0_hw.MADR = 0x10008010
+vif0_hw.QWC = 0x10008020
+vif0_hw.TADR = 0x10008030
+vif0_hw.ASR0 = 0x10008040
+vif0_hw.ASR1 = 0x10008050
+vif0_hw.SADR = 0x10008080
+
+vif1_hw.CHCR = 0x10009000
+vif1_hw.MADR = 0x10009010
+vif1_hw.QWC = 0x10009020
+vif1_hw.TADR = 0x10009030
+vif1_hw.ASR0 = 0x10009040
+vif1_hw.ASR1 = 0x10009050
+vif1_hw.SADR = 0x10009080
+
+return gif_hw, vif0_hw, vif1_hw, nil
\ No newline at end of file
diff --git a/ps2emuNEOGEO/lua_include/language.lua b/ps2emuNEOGEO/lua_include/language.lua
new file mode 100644
index 0000000..5365327
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/language.lua
@@ -0,0 +1,34 @@
+
+-- Recommended method to import this module:
+-- local lang = require("language")
+--
+-- Using the global 'lang' variable is depreciated. This will change to a local-scope variable after
+-- the depreciation period has expired in April 2016.
+
+lang = {}
+
+lang.japanese = 0
+lang.english = 1
+lang.french = 2
+lang.spanish = 3
+lang.german = 4
+lang.italian = 5
+lang.dutch = 6
+lang.portuguese = 7
+lang.russian = 8
+lang.korean = 9
+lang.chinese_traditional = 10
+lang.chinese_simplified = 11
+lang.finnish = 12
+lang.swedish = 13
+lang.danish = 14
+lang.norwegian = 15
+lang.polish = 16
+lang.portuguese_brazil = 17
+lang.english_gb = 18
+lang.turkish = 19
+lang.spanish_la = 20
+lang.arabic = 21
+lang.french_canada = 22
+
+return lang
\ No newline at end of file
diff --git a/ps2emuNEOGEO/lua_include/pad-and-key.lua b/ps2emuNEOGEO/lua_include/pad-and-key.lua
new file mode 100644
index 0000000..6e6c616
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/pad-and-key.lua
@@ -0,0 +1,58 @@
+
+pad = {}
+
+-- Left Side
+pad.LU = 0x0010 -- Up
+pad.LD = 0x0040 -- Down
+pad.LL = 0x0080 -- Left
+pad.LR = 0x0020 -- Right
+
+-- Right Side
+pad.RU = 0x1000 -- Up (Triangle)
+pad.RD = 0x4000 -- Down (Cross)
+pad.RL = 0x8000 -- Left (Square)
+pad.RR = 0x2000 -- Right (Circle)
+
+-- aliases
+pad.UP = 0x0010 -- LU
+pad.DOWN = 0x0040 -- LD
+pad.LEFT = 0x0080 -- LL
+pad.RIGHT = 0x0020 -- LR
+pad.TRIANGLE= 0x1000
+pad.CROSS = 0x4000
+pad.SQUARE = 0x8000
+pad.CIRCLE = 0x2000
+
+pad.L1 = 0x0400
+pad.L2 = 0x0100
+pad.L3 = 0x0002
+
+pad.R1 = 0x0800
+pad.R2 = 0x0200
+pad.R3 = 0x0004
+
+pad.SELECT = 0x0001
+pad.START = 0x0008
+
+keyboard = {}
+
+keyboard.ESCAPE = 0x1000
+keyboard.SLASH = 0x1001
+keyboard.SEPARATOR = 0x1002 -- backslash or pipe (\|)
+keyboard.BACKQUOTE = 0x1003
+keyboard.PAGEDOWN = 0x1004
+keyboard.PAGEUP = 0x1005
+keyboard.F1 = 0x1006
+keyboard.F2 = 0x1007
+keyboard.F3 = 0x1008
+keyboard.F4 = 0x1009
+keyboard.F5 = 0x100a
+keyboard.F6 = 0x100b
+keyboard.F7 = 0x100c
+keyboard.F8 = 0x100d
+keyboard.F9 = 0x100e
+keyboard.F10 = 0x100f
+keyboard.F11 = 0x1010
+keyboard.F12 = 0x1011
+
+return pad, keyboard
\ No newline at end of file
diff --git a/ps2emuNEOGEO/lua_include/pad-connect-type.lua b/ps2emuNEOGEO/lua_include/pad-connect-type.lua
new file mode 100644
index 0000000..6075410
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/pad-connect-type.lua
@@ -0,0 +1,9 @@
+
+local PadConnectType = {}
+
+PadConnectType.DS4 = 0
+PadConnectType.HID = 1 -- any 3rd party USB controller (fight stick, turbo controller, etc), always local.
+PadConnectType.REMOTE_DS4 = 2 -- remote DS4 should behave just like regular DS4
+PadConnectType.REMOTE_VITA = 3 -- remote VITA lacks analog L2/R2
+
+return PadConnectType
\ No newline at end of file
diff --git a/ps2emuNEOGEO/lua_include/sprite.lua b/ps2emuNEOGEO/lua_include/sprite.lua
new file mode 100644
index 0000000..49c10bd
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/sprite.lua
@@ -0,0 +1,57 @@
+
+local kFilterMode = {}
+kFilterMode.Point = 0x00000000 -- < Sample the one texel nearest to the sample point.
+kFilterMode.Bilinear = 0x00000001 -- < Sample the four texels nearest the sample point, and blend linearly.
+
+local kWrapMode = {}
+kWrapMode.Wrap = 0x00000000 -- < The integer portion of the input coordinate is discarded, and the fractional portion is used instead. U=U-floorf(U);
+kWrapMode.Mirror = 0x00000001 -- < The input coordinate is "reflected" across the texture boundary. This reflection may occur multiple times until the coordinate falls within the [0..1] range. U=isOdd(floorf(U)) ? 1-fracf(U) : fracf(U)
+kWrapMode.ClampLastTexel = 0x00000002 -- < The input coordinate is clamped to the range [0..1]. U=max(0,min(1,U));
+kWrapMode.MirrorOnceLastTexel = 0x00000003 -- < The input coordinate is reflected at most one time and then clamped to the range [0..1]. U=abs(max(-1,min(1,U));
+kWrapMode.ClampHalfBorder = 0x00000004 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.MirrorOnceHalfBorder = 0x00000005 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are not within half a pixel of the border are considered clamped.
+kWrapMode.ClampBorder = 0x00000006 -- < Similar to kWrapModeClampLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+kWrapMode.MirrorOnceBorder = 0x00000007 -- < Similar to kWrapModeMirrorOnceLastTexel, but if clamping is necessary, the output color will be the border color specified by the Sampler. For this mode, coordinates that are outside the range [0..1] are considered clamped.
+
+local kBlendMultiplier = {}
+kBlendMultiplier.Zero = 0x00000000 -- < Multiply the associated input by zero.
+kBlendMultiplier.One = 0x00000001 -- < Multiply the associated input by one.
+kBlendMultiplier.SrcColor = 0x00000002 -- < Multiply the associated input by the fragment color.
+kBlendMultiplier.OneMinusSrcColor = 0x00000003 -- < Multiply the associated input by one minus the fragment color.
+kBlendMultiplier.SrcAlpha = 0x00000004 -- < Multiply the associated input by the fragment alpha.
+kBlendMultiplier.OneMinusSrcAlpha = 0x00000005 -- < Multiply the associated input by one minus the fragment alpha.
+kBlendMultiplier.DestAlpha = 0x00000006 -- < Multiply the associated input by the render target alpha.
+kBlendMultiplier.OneMinusDestAlpha = 0x00000007 -- < Multiply the associated input by one minus the render target alpha.
+kBlendMultiplier.DestColor = 0x00000008 -- < Multiply the associated input by the render target color.
+kBlendMultiplier.OneMinusDestColor = 0x00000009 -- < Multiply the associated input by one minus the render target color.
+kBlendMultiplier.SrcAlphaSaturate = 0x0000000a -- < Multiply the associated input by the minimum of 1 or fragment alpha.
+kBlendMultiplier.ConstantColor = 0x0000000d -- < Multiply the associated input by the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantColor = 0x0000000e -- < Multiply the associated input by one minus the constant color. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.Src1Color = 0x0000000f -- < Multiply the associated input by a secondary fragment color.
+kBlendMultiplier.InverseSrc1Color = 0x00000010 -- < Multiply the associated input by one minus a secondary fragment color.
+kBlendMultiplier.Src1Alpha = 0x00000011 -- < Multiply the associated input by a secondary fragment alpha.
+kBlendMultiplier.InverseSrc1Alpha = 0x00000012 -- < Multiply the associated input by one minus a secondary fragment alpha.
+kBlendMultiplier.ConstantAlpha = 0x00000013 -- < Multiply the associated input by the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+kBlendMultiplier.OneMinusConstantAlpha = 0x00000014 -- < Multiply the associated input by one minus the constant color alpha. @see DrawCommandBuffer::setBlendColor()
+
+local kBlendFunc = {}
+kBlendFunc.Add = 0x00000000 -- < The source value is added to the destination value.
+kBlendFunc.Subtract = 0x00000001 -- < The destination value is subtracted from the source value.
+kBlendFunc.Min = 0x00000002 -- < The minimum of the source and destination values is selected.
+kBlendFunc.Max = 0x00000003 -- < The maximum of the source and destination values is selected.
+kBlendFunc.ReverseSubtract = 0x00000004 -- < The source value is subtracted from the destination value.
+
+-- Default blending mode, ideal for typical alpha channel embedded into a PNG image.
+blendDefaultEquation = {
+ kBlendMultiplier.SrcAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusSrcAlpha, -- dest multiplier
+}
+
+blendConstFadeEquation = {
+ kBlendMultiplier.ConstantAlpha, -- src multiplier
+ kBlendFunc.Add, -- blend function
+ kBlendMultiplier.OneMinusConstantAlpha, -- dest multiplier
+}
+
+return kFilterMode, kWrapMode, kBlendMultiplier, kBlendFunc
diff --git a/ps2emuNEOGEO/lua_include/utils.lua b/ps2emuNEOGEO/lua_include/utils.lua
new file mode 100644
index 0000000..b5e7bd9
--- /dev/null
+++ b/ps2emuNEOGEO/lua_include/utils.lua
@@ -0,0 +1,60 @@
+-- utility classes/functions
+
+-- Stack
+-- ex:
+-- my_stack = Stack.new()
+-- my_stack:push( val )
+-- print( my_stack:pop( val ) )
+Stack = {}
+
+function Stack.new()
+ local obj = { buff = {} }
+ return setmetatable(obj, {__index = Stack})
+end
+
+function Stack:push(x)
+ table.insert(self.buff, x)
+end
+
+function Stack:pop()
+ return table.remove(self.buff)
+end
+
+function Stack:top()
+ return self.buff[#self.buff]
+end
+
+function Stack:isEmpty()
+ return #self.buff == 0
+end
+
+
+-- Queue
+-- ex:
+-- my_queue = Queue.new()
+-- my_queue:enqueue( val )
+-- print( my_queue:dequeue(val) )
+Queue = {}
+
+function Queue.new(x)
+ local obj = { buff = x == nil and {} or x }
+ return setmetatable(obj, {__index = Queue})
+end
+
+function Queue:enqueue(x)
+ table.insert(self.buff, x)
+end
+
+function Queue:dequeue()
+ return table.remove(self.buff, 1)
+end
+
+function Queue:top()
+ if #self.buff > 0 then
+ return self.buff[1]
+ end
+end
+
+function Queue:isEmpty()
+ return #self.buff == 0
+end
diff --git a/ps2emuNEOGEO/ps2-emu-compiler.self b/ps2emuNEOGEO/ps2-emu-compiler.self
new file mode 100644
index 0000000..798d289
Binary files /dev/null and b/ps2emuNEOGEO/ps2-emu-compiler.self differ
diff --git a/ps2emuNEOGEO/sce_discmap.plt b/ps2emuNEOGEO/sce_discmap.plt
new file mode 100644
index 0000000..bb1c442
Binary files /dev/null and b/ps2emuNEOGEO/sce_discmap.plt differ
diff --git a/ps2emuNEOGEO/sce_module/libSceFios2.prx b/ps2emuNEOGEO/sce_module/libSceFios2.prx
new file mode 100644
index 0000000..c147b34
Binary files /dev/null and b/ps2emuNEOGEO/sce_module/libSceFios2.prx differ
diff --git a/ps2emuNEOGEO/sce_module/libc.prx b/ps2emuNEOGEO/sce_module/libc.prx
new file mode 100644
index 0000000..8997363
Binary files /dev/null and b/ps2emuNEOGEO/sce_module/libc.prx differ
diff --git a/ps2emuNEOGEO/sce_sys/param.sfo b/ps2emuNEOGEO/sce_sys/param.sfo
new file mode 100644
index 0000000..d31774c
Binary files /dev/null and b/ps2emuNEOGEO/sce_sys/param.sfo differ
diff --git a/ps2emuNEOGEO/sce_sys/shareparam.json b/ps2emuNEOGEO/sce_sys/shareparam.json
new file mode 100644
index 0000000..8f4038b
--- /dev/null
+++ b/ps2emuNEOGEO/sce_sys/shareparam.json
@@ -0,0 +1 @@
+{"ps4_share_param_version":"01.10","game_version":"01.00","client_id":"460621181150-9g1m23knq95uld74tnjap752q87pug9v.apps.googleusercontent.com","overlay_position":{"x":0,"y":0}}
\ No newline at end of file