-- Mortal Kombat - Shaolin Monks (3 Disc)
-- Widescreen, no interlace + Cheats
-- speed fix by mrjaredbeta
-- ported to PS4 LUA
-- emu used=jakx v2
apiRequest(2.3) -- request version 1.6 API. Calling apiRequest() is mandatory.
local eeObj = getEEObject()
local emuObj = getEmuObject()
local goatman = 0
local sprite0 = getSpriteObject(0)
local sprite1 = getSpriteObject(1)
local texture1 = getTextureObject(1)
local texture2 = getTextureObject(2)
Global_InitGpuResources = function()
-- # Fragment Shader 0 is fixed as the default no-thrills as-is renderer.
emuObj.LoadFsShader(2, "./shader_SL480_p.sb") -- (2) = 480P ScanLine Sim
texture1.Load("./mksm-1920.png")
texture2.Load("./mksm3-1920.png")
end
local scanlineParams = {
240.0, -- float scanlineCount
0.7, -- float scanlineHeight;
1.5, -- float scanlineBrightScale;
0.5, -- float scanlineAlpha;
0.5 -- float vignetteStrength;
}
local scanlines_moder_1 = function()
if goatman == 0 then
sprite0.BindTexture(0)
sprite0.SetPosXY((1920-1440)/2,0)
sprite0.SetSizeXY(1440,1080)
sprite0.BindFragmentShader(2)
sprite0.SetShaderParams(scanlineParams)
sprite0.Enable()
sprite1.BindTexture(1)
sprite1.SetPosXY(0,0)
sprite1.SetSizeXY(1920,1080)
sprite1.SetPosUV(0,0)
sprite1.SetSizeUV(1920,1080)
sprite1.Enable()
goatman = 1
end
end
local scanlines_moder_2 = function()
if goatman == 0 then
sprite0.BindTexture(0)
sprite0.SetPosXY((1920-1440)/2,0)
sprite0.SetSizeXY(1440,1080)
sprite0.BindFragmentShader(2)
sprite0.SetShaderParams(scanlineParams)
sprite0.Enable()
sprite1.BindTexture(2)
sprite1.SetPosXY(0,0)
sprite1.SetSizeXY(1920,1080)
sprite1.SetPosUV(0,0)
sprite1.SetSizeUV(1920,1080)
sprite1.Enable()
goatman = 1
end
end
local Mod = function()
--Single PLayer Chars
eeObj.WriteMem32(0x205D82B4,0x00000001)
eeObj.WriteMem32(0x205D82B8,0x00000001)
eeObj.WriteMem32(0x00322f2c,0x3c013f80) -- black border fix
eeObj.WriteMem32(0x00272210,0x24030256) -- FMV's fix
eeObj.WriteMem32(0x00272498,0x240B0256) -- ||
-- no interlace A
eeObj.WriteMem32(0x20249F7C,0x00000000)
-- no interlace B
eeObj.WriteMem32(0x202744A8,0xAE600034)
-- no interlace C
local code_check1 = eeObj.ReadMem16(0x67B7C8)
if code_check1 == 0x0001 then
eeObj.WriteMem32(0x2038334C,0xDE020010)
end
local code_check2 = eeObj.ReadMem16(0x67B7C8)
if code_check2 == 0x0003 then
eeObj.WriteMem32(0x2038334C,0x34021400)
end
--Disable Bloom
eeObj.WriteMem32(0x004F4B68,0x0)
--Disable Characters Skinning
eeObj.WriteMem32(0x004F4C44,0x0)
--Disable Fog
--eeObj.WriteMem32(0x004F4C08,0x0)
--Disable Light on Characters Skills
--eeObj.WriteMem32(0x004F4C98,0x0)
--Disable Characters Shadow
--eeObj.WriteMem32(0x004F4BAC,0x0)
--eeObj.WriteMem32(0x004F5088,0x0)
----------CHEATS-----------------------
--Unlock All Characters in vs. Mode
eeObj.WriteMem32(0x205D8288,0xFFFFFFFF)
--Single PLayer Chars
eeObj.WriteMem32(0x205D82B4,0x00000001)
eeObj.WriteMem32(0x205D82B8,0x00000001)
--Boss Fix code
eeObj.WriteMem32(0x20298DA8,0x00000000)
--Unlock Mortal Kombat II by MadCatz
eeObj.WriteMem32(0x205D82B0,0x00000001)
--Replace Options With Debug Menu In Game by Combusto Dragon
eeObj.WriteMem32(0x204C6FE0,0x0000019F)
eeObj.WriteMem32(0x204C6FE4,0x001AAE80)
--View Movies To Unlock Them by Code Master
eeObj.WriteMem32(0x201C1DD4,0x00431025)
eeObj.WriteMem32(0x201C1DD8,0xAC820000)
eeObj.WriteMem32(0x201C1DE0,0x24020001)
--View Arena Art To Unlock Them by Code Master
eeObj.WriteMem32(0x201C1E2C,0x00431025)
eeObj.WriteMem32(0x201C1E30,0xAC820000)
eeObj.WriteMem32(0x201C1E38,0x24020001)
--View Concept Art To Unlock Them by Code Master
eeObj.WriteMem32(0x201C1E84,0x00431025)
eeObj.WriteMem32(0x201C1E88,0xAC820000)
eeObj.WriteMem32(0x201C1E90,0x24020001)
--View Photos To Unlock Them by Code Master
eeObj.WriteMem32(0x201C1EDC,0x00431025)
eeObj.WriteMem32(0x201C1EE0,0xAC820000)
eeObj.WriteMem32(0x201C1EE8,0x24020001)
--MK II debug Menu
eeObj.WriteMem32(0x00213968,0x00000004)
--Have All Moves (Minus Fatalities) by Code Master
eeObj.WriteMem32(0x201BB438,0x00430821)
eeObj.WriteMem32(0x201BB43C,0x24020005)
eeObj.WriteMem32(0x201BB444,0xA02200E0)
-- Character Selector
local pad_bits = emuObj.GetPad()
local UP = pad_bits & 0x0010
local DOWN = pad_bits & 0x0040
local LEFT = pad_bits & 0x0080
local RIGHT = pad_bits & 0x0020
local Triangle = pad_bits & 0x1000
local Cross = pad_bits & 0x4000
local Square = pad_bits & 0x8000
local Circle = pad_bits & 0x2000
local L1 = pad_bits & 0x0400
local L2 = pad_bits & 0x0100
local L3 = pad_bits & 0x0002
local R1 = pad_bits & 0x0800
local R2 = pad_bits & 0x0200
local R3 = pad_bits & 0x0004
local Select = pad_bits & 0x0001
local Start = pad_bits & 0x0008
if (L3 ~= 0 and L1 ~= 0) then
--johnny cage
eeObj.WriteMem32(0x20C2974C,0x0000005a)
end
if (L3 ~= 0 and L2 ~= 0) then
--Reptile
eeObj.WriteMem32(0x20C2974C,0x00000054)
end
if (L3 ~= 0 and R1 ~= 0) then
--Kitana
eeObj.WriteMem32(0x20C2974C,0x00000059)
end
if (L3 ~= 0 and R2 ~= 0) then
--Mileena
eeObj.WriteMem32(0x20C2974C,0x00000052)
end
--[[
--Player 1 codes
--Liu Kang
eeObj.WriteMem32(0x20C2974C,0x00000000)
--Kung Lao
eeObj.WriteMem32(0x20C2974C,0x00000001)
--Scorpion
eeObj.WriteMem32(0x20C2974C,0x00000052)
--Sub-Zero
eeObj.WriteMem32(0x20C2974C,0x00000058)
--Baraka
eeObj.WriteMem32(0x20C2974C,0x00000053)
--Reptile
eeObj.WriteMem32(0x20C2974C,0x00000054)
--johnny cage
eeObj.WriteMem32(0x20C2974C,0x0000005a)
--Kitana
eeObj.WriteMem32(0x20C2974C,0x00000059)
--Mileena
eeObj.WriteMem32(0x20C2974C,0x00000052)
--Jade
eeObj.WriteMem32(0x20C2974C,0x00000043)
--Black Dragon Merc
eeObj.WriteMem32(0x20C2974C,0x00000009)
--Red Dragon Merc
eeObj.WriteMem32(0x20C2974C,0x00000010)
--Elemental Knight
eeObj.WriteMem32(0x20C2974C,0x00000013)
--Brother of Shadow
eeObj.WriteMem32(0x20C2974C,0x00000011)
--Masked Guard
eeObj.WriteMem32(0x20C2974C,0x0000001A)
--Shadow Priest
eeObj.WriteMem32(0x20C2974C,0x0000001B)
--Demon Captain
eeObj.WriteMem32(0x20C2974C,0x0000000A)
--Demon General
eeObj.WriteMem32(0x20C2974C,0x0000000B)
--Demon Leader
eeObj.WriteMem32(0x20C294C,0x0000000D)
--Goro
eeObj.WriteMem32(0x20C2974C,0x0000002F)
--Kintaro
eeObj.WriteMem32(0x20C2974C,0x00000051)
--Oni
eeObj.WriteMem32(0x20C2974C,0x0000000F)
--Tarkata
eeObj.WriteMem32(0x20C2974C,0x0000000E)
--Blood Skeleton
eeObj.WriteMem32(0x20C2974C,0x00000008)
--Kabal
eeObj.WriteMem32(0x20C2974C,0x00000049)
--Sonya
eeObj.WriteMem32(0x20C2974C,0x0000004B)
--Shang Tsung
eeObj.WriteMem32(0x20C2974C,0x0000003F)
--]]
eeObj.Vu1MpgCycles(math.floor(777))
emuObj.ThrottleMax()
end
local WS = function()
-- 16:9
eeObj.WriteMem32(0x004f4b38,0x3f400000)
end
local BM = function()
-- disable bloom proto
eeObj.WriteMem32(0x004f5ca0,0x0)
eeObj.Vu1MpgCycles(1000)
emuObj.ThrottleMax()
end
local titleid = emuObj.GetDiscTitleId() -- returns string as read from iso img SYSTEM.CNF
if titleid == 'SLUS-21087' then --retail disc(disc01)
if true then
eeInsnReplace(0x23e188, 0x14440011, 0x10000011) -- speed fix
end
emuObj.AddVsyncHook(WS)
emuObj.AddVsyncHook(Mod)
emuObj.SetDisplayAspectWide()
end
if titleid == 'SLUS-91087' then --retail disc renamed elf(disc02)
if true then
eeInsnReplace(0x23e188, 0x14440011, 0x10000011) -- speed fix
end
emuObj.AddVsyncHook(Mod)
emuObj.AddVsyncHook(scanlines_moder_1)
emuObj.SetDisplayAspectNormal()
end
if titleid == 'SLUS-31087' then --prototype disc renamed elf(disc03)
if true then
eeInsnReplace(0x21fda8, 0x14440011, 0x10000011) -- speed fix
end
emuObj.AddVsyncHook(BM)
emuObj.AddVsyncHook(scanlines_moder_2)
emuObj.SetDisplayAspectNormal()
end