-- Medal of Honor Rising Sun NTSC
-- Widescreen Hack
-- ported to PS4
-- emu used=jakx v2
apiRequest(2.2)
local gpr = require("ee-gpr-alias")
local cpr = require("ee-cpr0-alias")
local hwaddr = require("ee-hwaddr")
local emuObj = getEmuObject()
local eeObj = getEEObject()
local gsObj = getGsObject()
local eeOverlay = eeObj.getOverlayObject()
local iopObj = getIOPObject()
local thresholdArea = 600
local ThrottleOn = 0
local lightDef = {255, 254, 251}
local lightThr = {255, 0, 0}
emuObj.PadSetLightBar(0, lightDef[1], lightDef[2], lightDef[3])
emuObj.SetDisplayAspectWide()
gsObj.SetDeinterlaceShift(1)
--------------------------------------------------------
local ApplyVifCycleSettings = function()
eeObj.Vu1MpgCycles(100)
eeObj.SetVifDataCycleScalar(1, 2.6)
eeObj.SchedulerDelayEvent("vif1.dma", 0x6500)
end
ApplyVifCycleSettings()
--------------------------------------------------------
local widescreen = function()
--eeObj.WriteMem32(0x2015A15C,0x2C420001) --60fps
eeObj.WriteMem32(0x003a3910,0x3f100000)
eeObj.WriteMem32(0x001b9110,0x3c013f50)
eeObj.WriteMem32(0x001b9114,0x44810800)
eeObj.WriteMem32(0x001b9118,0x46016303)
eeObj.WriteMem32(0x001b911c,0xc4810e30)
eeObj.WriteMem32(0x001b9120,0x460c0832)
eeObj.WriteMem32(0x001b9124,0x45010008)
eeObj.WriteMem32(0x001b9128,0x00000000)
eeObj.WriteMem32(0x001b912c,0x46016034)
eeObj.WriteMem32(0x001b9130,0x45000004)
eeObj.WriteMem32(0x001b9134,0xe48c0e38)
eeObj.WriteMem32(0x001b9138,0x46006807)
eeObj.WriteMem32(0x001b913c,0x03e00008)
eeObj.WriteMem32(0x001b9140,0xe4800e3c)
eeObj.WriteMem32(0x001b9144,0xe48d0e3c)
eeObj.WriteMem32(0x001b9148,0x03e00008)
eeObj.WriteMem32(0x001b914c,0x00000000)
end
---------------------------------------------------------
local CheckInputs = function()
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
local Nothing = 1
local onBtn1 = L3
local onBtn2 = Start
local onBtn3 = Nothing
local offBtn1 = R3
local offBtn2 = Select
local offBtn3 = Nothing
widescreen()
if (onBtn1 ~= 0) and (onBtn2 ~= 0) and (onBtn3 ~= 0) and (ThrottleOn == 0) then
emuObj.ThrottleMax()
emuObj.PadSetLightBar(0, lightThr[1], lightThr[2], lightThr[3])
ThrottleOn = 1
elseif (offBtn1 ~= 0) and (offBtn2 ~= 0) and (offBtn3 ~= 0) and (ThrottleOn == 1) then
emuObj.ThrottleNorm()
emuObj.PadSetLightBar(0, lightDef[1], lightDef[2], lightDef[3])
ThrottleOn = 0
end
if (ThrottleOn == 3) then
if (onBtn1 ~= 0) and (onBtn2 ~= 0) and (onBtn3 ~= 0) then
emuObj.ThrottleMax()
emuObj.PadSetLightBar(0, lightThr[1], lightThr[2], lightThr[3])
else
emuObj.ThrottleNorm()
emuObj.PadSetLightBar(0, lightDef[1], lightDef[2], lightDef[3])
end
end
end
emuObj.AddVsyncHook(CheckInputs)
----------------------------------------------------------------------------------