PS4 [Research]PS2 emulator configuration on PS4

Tales Of Destiny - Director's Cut. SLPS25842 (English Patched)

Game runs great now with --fpu-accurate-mul-fast=1.

Rogue v1 emu, patch v0.0.234
Notes: Save Often, Sound Mode on title screen crashes the game, there may be moments where the game seems to hang for 1-2 secs randomly.

Code:
--host-vsync=60
--fpu-accurate-range=0x1C7B50,0x1C7C00
--gs-use-clut-merge=1
--gs-kernel-cl="clutmerge"
--gs-kernel-cl-up="clutmerge2x2"
--fpu-accurate-mul-fast=1 #speedhacks
--ee-cycle-scalar=1.74 #helps with slowdown on worldmap like the desert

Apologies for the slight echoing in the sound, crappy setup for video capture. (base ps4)
 
Last edited:
BMX Games PS2toPS4 Test

FiX for Dave Mirra Freestyle BMX 2 (SLUS20159)
Code:
--gs-use-mipmap=1
--gs-kernel-cl="mipmap"
--gs-kernel-cl-up="mipmap2x2"

in txt.

Code:
-- Dave Mirra Freestyle BMX 2
-- emu used=parappa v1

local gpr = require("ee-gpr-alias")

apiRequest(0.1)

local eeObj = getEEObject()
local emuObj = getEmuObject()

-- 16:9
eeInsnReplace(0x00100c58,0x3c013f80,0x3c013f40) -- 3c013f80 hor fov
eeInsnReplace(0x000fffd4,0x00000000,0x3c093f40) -- 00000000 renderfix
eeInsnReplace(0x001010f0,0x46000843,0x0803fff5) -- 46000843
eeInsnReplace(0x001010f4,0xe6240448,0x00000000) -- e6240448
eeInsnReplace(0x000fffdc,0x00000000,0x4489f000) -- 00000000
eeInsnReplace(0x000fffe0,0x00000000,0x461e0843) -- 00000000
eeInsnReplace(0x000fffe4,0x00000000,0x46000843) -- 00000000
eeInsnReplace(0x000fffe8,0x00000000,0xe6200448) -- 00000000
eeInsnReplace(0x000fffec,0x00000000,0x0804043d) -- 00000000

local patcher = function()

--Airport Garage helicopter rotor glitch fix
eeObj.WriteMem32(0x00100c04,0x3c013f40) -- 00000000
eeObj.WriteMem32(0x000fffd8,0x3c093f40) -- 00000000

end

emuObj.AddVsyncHook(patcher)

in lua.

FiX for BMX XXX (SLUS20415)
Code:
--gs-use-mipmap=1
--gs-kernel-cl="mipmap"
--gs-kernel-cl-up="mipmap2x2"

in txt.

Code:
-- BMX XXX
-- emu used=parappa v1

local gpr = require("ee-gpr-alias")

apiRequest(0.1)

local eeObj = getEEObject()
local emuObj = getEmuObject()

-- 16:9
eeInsnReplace(0x00101074,0x3c013f80,0x3c013f40) -- 3c013f80 hor fov
eeInsnReplace(0x00299544,0x00000000,0x3c093f40) -- 00000000 renderfix
eeInsnReplace(0x001014a4,0x46000843,0x080a6551) -- 46000843
eeInsnReplace(0x001014a8,0xe62404e8,0x00000000) -- e62404e8
eeInsnReplace(0x0029954c,0x00000000,0x4489f000) -- 00000000
eeInsnReplace(0x00299550,0x00000000,0x461e0843) -- 00000000
eeInsnReplace(0x00299554,0x00000000,0x46000843) -- 00000000
eeInsnReplace(0x00299558,0x00000000,0xe62004e8) -- 00000000
eeInsnReplace(0x0029955c,0x00000000,0x0804052a) -- 00000000

local patcher = function()

end

emuObj.AddVsyncHook(patcher)

in lua.

Freeze on loading issue and Graphical Bugs - FiXed!! (for both games). Small issue in Dave Mirra Freestyle BMX 2 - If after first intro u see black screen, just reboot game and all will be fine and game boot!
 
Config for The Simpsons - Skateboarding (SLES-51362)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=edgesmooth

--host-display-mode=16:9

--cdvd-sector-read-cycles=4550

#emu used=jakx v2
LUA
Code:
-- The Simpsons - Skateboarding (PAL-G) (SLES-51362)
-- Widescreen hack by ElHecht
-- ported to PS4
-- emu used=jakx v2

apiRequest(2.0)

local eeObj = getEEObject()
local emuObj = getEmuObject()

-- 16:9
eeInsnReplace(0x0022a6ac, 0x46070202, 0x08121331) 
eeInsnReplace(0x0022a6b0, 0x24430050, 0x00000000)  
eeInsnReplace(0x00484cc4, 0x00000000, 0x3c013f40) 
eeInsnReplace(0x00484cc8, 0x00000000, 0x4481f000) 
eeInsnReplace(0x00484ccc, 0x00000000, 0x46070202) 
eeInsnReplace(0x00484cd0, 0x00000000, 0x24430050) 
eeInsnReplace(0x00484cd4, 0x00000000, 0x461e4202) 
eeInsnReplace(0x00484cd8, 0x00000000, 0x0808a9ac) 

local patcher = function()


emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

Works great.
 
Config for The Punisher NTSC

CLI
Code:
--gs-uprender=2x2
--gs-upscale=EdgeSmooth
--gs-progressive=1
--host-display-mode=16:9

#emu used=rogue v1
LUA
Code:
-- The Punisher NTSC
--emu used=rogue v1


local gpr = require("ee-gpr-alias")

apiRequest(0.1)

local eeObj = getEEObject()
local emuObj = getEmuObject()

local patcher = function()

-- 16:9
eeObj.WriteMem32(0x0042d2d0,0x3fdba5e3) -- 3fa4bc6a ver fov
eeObj.WriteMem32(0x00192404,0x3c023f20) -- 3c023f00 zoom
eeObj.WriteMem32(0x0019240c,0x34426666) -- 00000000 zoom

-- force progressive scan
eeObj.WriteMem32(0x001a0204,0x3c050000)
eeObj.WriteMem32(0x001a0208,0x3c060050)
eeObj.WriteMem32(0x001a020c,0x3c070001)
eeObj.WriteMem32(0x001a0210,0x3c090010)

--Totally Uncensored Executions
eeObj.WriteMem32(0x004344F0,0x00000000)
eeObj.WriteMem32(0x0020B7E0,0x00000070)
eeObj.WriteMem32(0x202C88D0,0x03E00008)
eeObj.WriteMem32(0x202C88D4,0x00000000)

end

emuObj.AddVsyncHook(patcher)
 
Fix+Cheats for Teen Titans NTSC-U (SLUS-21183)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=EdgeSmooth

--host-display-mode=16:9

--vu1-di-bits=0

#emu used=star ocean 3 v3
LUA
Code:
-- Teen Titans NTSC-U(SLUS-21183)
-- Widescreen hack by ElHecht
-- 60fps by Asasega @PCSX2 forums
-- cheats found @gamehacking.org
-- emu used=star ocean 3 v3

local gpr = require("ee-gpr-alias")

apiRequest(1.0)

local eeObj = getEEObject()
local emuObj = getEmuObject()

-- 16:9
eeInsnReplace(0x00205784, 0x4600ab06, 0x080f1e0c) --  jump to 003c7830
eeInsnReplace(0x00205788, 0x0c072734, 0x00000000) --
eeInsnReplace(0x003c7830, 0x00000000, 0x3c013f40) --  hor fov gameplay
eeInsnReplace(0x003c7834, 0x00000000, 0x4481f000) --
eeInsnReplace(0x003c7838, 0x00000000, 0x461ead43) --
eeInsnReplace(0x003c783c, 0x00000000, 0x4600ab06) --
eeInsnReplace(0x003c7840, 0x00000000, 0x0c072734) --
eeInsnReplace(0x003c7844, 0x00000000, 0x00000000) --
eeInsnReplace(0x003c7848, 0x00000000, 0x080815e2) --  jump back to 00205788

eeInsnReplace(0x001c9d78, 0x3c024000, 0x3c023fc0) --  zoom cut-scenes
eeInsnReplace(0x001c9da8, 0x00000000, 0x3c013f40) --  ver fov cut-scenes
eeInsnReplace(0x001c9dac, 0x00000000, 0x4481f000) --
eeInsnReplace(0x001c9db4, 0x00000000, 0x461e0342) --

local patcher = function()
--60 fps
eeObj.WriteMem32(0x2015FF94,0x2C620000)
--Infinite Continues (Alternate) by Code Master
local code_check1 = eeObj.ReadMem16(0xF610E0)
if code_check1 == 0xF809 then
eeObj.WriteMem32(0x00F61104,0x00000000)
end
eeObj.Vu1MpgCycles(math.floor(1000))
emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

Feedback welcome.
 
Enhancement for Bloody Roar 3 (SLUS-20212)

LUA
Code:
-- Bloody Roar 3 SLUS-20212
-- Widescreen Hack
-- blood effects by bloodraynare @ pcsx2 forums
-- ported to PS4 Lua
-- emu used=aofa

apiRequest(1.0)

local eeObj = getEEObject()
local emuObj = getEmuObject()
local patcher = function()

eeObj.WriteMem32(0x001f4454,0x3F400000) -- Widescreen
eeObj.WriteMem32(0x001CF8DC,0x00000000) -- No Interlace
eeObj.WriteMem32(0x0012d638,0x24040080) -- Restore the blood effects intensity (Just like the Japanese version)
eeObj.WriteMem32(0x001bb2cc,0x24020080) -- see above

end

emuObj.AddVsyncHook(patcher)
 
Config+Cheats for Midnight Club - Street Racing (SLUS-20063)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=EdgeSmooth
--fpu-rsqrt-fast-estimate=1 
--cdvd-sector-read-cycles=7000
--framelimiter=1
--framelimit-fps=60.0
--framelimit-scalar=1
--ee-cycle-scalar=1.65
--vu1-mpg-cycles=500

#emu used=red dead
LUA
Code:
-- Midnight Club - Street Racing (NTSC-U) (SLUS-20063)
-- Widescreen hack by Evildan
-- emu used=red dead

apiRequest(0.1)

local gpr       = require("ee-gpr-alias")

local emuObj      = getEmuObject()
local eeObj       = getEEObject()

local thresholdArea = 600

emuObj.SetDisplayAspectWide()

local patcher = function()
--widescreen
eeObj.WriteMem32(0x20426180,0x3FAA3D71)
eeObj.WriteMem32(0x204784c0,0x3F400000)
--60 fps
eeObj.WriteMem32(0x20302934,0x00000001)
--All Vehicles: Arcade by InterAct
eeObj.WriteMem32(0x202C2270,0xFFFFFFFF)
eeObj.WriteMem32(0x202C2274,0xFFFFFFFF)
--All Vehicles: Career by InterAct
eeObj.WriteMem32(0x202C3C88,0xFFFFFFFF)
--Have All New York Head To Head Races by Code Master
eeObj.WriteMem32(0x202C227C,0xFFFFFFFF)
--Have All London Head To Head Races by Code Master
eeObj.WriteMem32(0x202C2280,0xFFFFFFFF)

eeObj.WaitVu1(100) -- ?? 
eeObj.Vu1MpgCycles(math.floor(600)) -- remove stutter due to 60fps code
emuObj.ThrottleMax() -- no negative side effects
end

emuObj.AddVsyncHook(patcher)

Works great so far. 60fps added. Widescreen added. Everything unlocked.
 
Config+Cheats for Midnight Club II (SLUS-20209)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=EdgeSmooth
--gs-kernel-cl="h2lpool"
--gs-kernel-cl-up="h2lpool2x2"
--cdvd-sector-read-cycles=4000
--framelimiter=1
--framelimit-fps=60.0
--framelimit-scalar=1
--ee-cycle-scalar=2.0
--iop-cycle-scalar=1.1
--vu1-di-bits=0
--vu0-di-bits=0

#emu used=red dead
LUA
Code:
-- Midnight Club II (U)(SLUS-20209)
-- Widescreen hack by Arapapa
-- 60fps by Asasega 
-- emu used=red dead

apiRequest(0.1)

local gpr       = require("ee-gpr-alias")

local emuObj      = getEmuObject()
local eeObj       = getEEObject()

local thresholdArea = 600

emuObj.SetDisplayAspectWide()

local patcher = function()
--Widescreen hack 16:9
eeObj.WriteMem32(0x0036c884,0x3c013fe3) --3c013faa
eeObj.WriteMem32(0x0036c888,0x34218e38) --3421aaa8
--60 fps
eeObj.WriteMem32(0x2042FAB8,0x00000001) --fps
eeObj.WriteMem32(0x20432164,0x3C888889) --speed 
--Unlock Everything by InterAct
eeObj.WriteMem32(0x0042CCE8,0x00000001)
eeObj.WriteMem32(0x0042CCE9,0x00000001)
eeObj.WriteMem32(0x0042CCEA,0x00000001)
eeObj.WriteMem32(0x0042CCEB,0x00000001)
eeObj.WriteMem32(0x0042CCEC,0x00000001)
eeObj.WriteMem32(0x0042CCED,0x00000001)

--eeObj.WaitVu1(100) -- ?? 
eeObj.Vu1MpgCycles(math.floor(925)) -- remove stutter due to 60fps code
emuObj.ThrottleMax() -- no negative side effects
end

emuObj.AddVsyncHook(patcher)

Works great. Tested a little..
 
--fpu-accurate-range=0x162800,0x162900 Found it!

Proper fix for Need for Speed Carbon

cli
Code:
--host-audio-latency=2.77

--verbose-cdvd-reads=700

--gs-uprender=2x2
--gs-upscale=edgesmooth
--gs-optimize-30fps=1

--fpu-accurate-range=0x162800,0x162900

--ee-cycle-scalar=1.35

--vu1-mpg-cycles=1170

--vu0-opt-flags=1
--vu1-opt-flags=1
--cop2-opt-flags=1
--vu0-const-prop=0
--vu1-const-prop=0
--vu1-jr-cache-policy=newprog
--vu1-jalr-cache-policy=newprog
--vu0-jr-cache-policy=newprog
--vu0-jalr-cache-policy=newprog

2x2 for those that need it.

Hey I have no clue how to get kinetica emu config. Which app do I use? I can't fund anything online.
 
anyone know how I can port this fix over from PCSX2?
Code:
u32 FPU_MUL_HACK(u32 s, u32 t)
{
   if ((s == 0x3e800000) && (t == 0x40490fdb))
     return 0x3f490fda; // needed for Tales of Destiny Remake (only in a very specific room late-game)
   else
     return 0;
}
 
Fix for Disney's Tarzan - Untamed (SLUS-20076)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=point
--gs-kernel-cl-up="up2x2simple"
--gs-optimize-30fps=1
--ee-cycle-scalar=1.4
--iop-cycle-scalar=1.5
--vu-custom-min-max=0
--vu1-di-bits=0
--vu0-di-bits=0
--vu1-opt-vf00=2
--vu1-injection=1
--vu1-const-prop=0
--vu1-jr-cache-policy=newprog
--vu1-jalr-cache-policy=newprog
--vu0-jalr-cache-policy=newprog
--cdvd-sector-read-cycles=8000

#emu used=aofa
LUA
Code:
-- Disney's Tarzan - Untamed (U)(SLUS-20076)
-- Widescreen Hack by Arapapa
-- ported to PS4 lua
-- emu used=aofa

apiRequest(2.0)

local gpr       = require("ee-gpr-alias")

local emuObj      = getEmuObject()
local eeObj       = getEEObject()
local gsObj       = getGsObject()


local thresholdArea = 600

emuObj.PadSetLightBar(0, 45, 70, 200)
emuObj.SetDisplayAspectWide()

--emuObj.SetDeinterlace(true)

local patcher = function()
--Widescreen hack 16:9
eeObj.WriteMem32(0x0036ca88,0x3c023f21) --3c023f00
eeObj.WriteMem32(0x0036cac8,0x08030000)

eeObj.WriteMem32(0x000c0000,0x4614a843)
eeObj.WriteMem32(0x000c0004,0x3c013f40)
eeObj.WriteMem32(0x000c0008,0x4481f000)
eeObj.WriteMem32(0x000c000c,0x461e0842)
eeObj.WriteMem32(0x000c0010,0x080db2b3)

emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

emuObj.SetGsTitleFix( "forceSimpleFetch", "reserved", { texMode=1  } )

Slight stutter in areas, tested a little.
 
Confirm, work with RedFaction1 emu with no freeze, test freeride mode with boost on ps4 pro

Hello here :)

For beginning, thanks a lot at all for your works ! :D

I have a request, i search with desperate at do work the Tony Hawk games (THUG, THUG2, THAW) but after many try (fix solutions find here: with Redfaction emu, txt modifed and new lua), i have always the freeze during the loading, any changes, nothing.

My versions of this games is a SLES for the language 'cause i'm french. It's the problem ?
THUG = SLES-51851
THUG2 = SLES-52622
THAW = SLES-53535

Thanks with advance if you try to help me ! :)
 
Hello here :)

For beginning, thanks a lot at all for your works ! :D

I have a request, i search with desperate at do work the Tony Hawk games (THUG, THUG2, THAW) but after many try (fix solutions find here: with Redfaction emu, txt modifed and new lua), i have always the freeze during the loading, any changes, nothing.

My versions of this games is a SLES for the language 'cause i'm french. It's the problem ?
THUG = SLES-51851
THUG2 = SLES-52622
THAW = SLES-53535

Thanks with advance if you try to help me ! :)
lol for now we all have psx\psp wave of games for ps4, maybe later i will check it again, but not now!
 
lol for now we all have psx\psp wave of games for ps4, maybe later i will check it again, but not now!

Yes ok, thanks for your reply. I'll wait your future checks.

I have something new, i have test again with your recommandations (redfaction, txt modified and lua) but i have all unchecked in "Emulator Settings" -probably a problem with the fix graphics- and THUG load entirely, memory card too but arrives to the main menu, it freeze quickly and crash with a error : (CE-34878-0)

A suggestion to try ?
 
Config for LEGO Batman - The Videogame (SLUS-21785)

CLI
Code:
--gs-uprender=2x2
--gs-upscale=edgesmooth

--cdvd-sector-read-cycles=4400
--host-display-mode=16:9

--ee-cycle-scalar=1.5
--vu1-mpg-cycles=800

#emu used=aofa
LUA
Code:
-- LEGO Batman - The Videogame (U)(SLUS-21785)
-- Widescreen hack by Arapapa
-- emu used=aofa

local gpr = require("ee-gpr-alias")

apiRequest(0.1)

local eeObj = getEEObject()
local emuObj = getEmuObject()

local patcher = function()
--16:9
eeObj.WriteMem32(0x2033DE44,0x00000a01) --00000a00
eeObj.WriteMem32(0x20615710,0x00000a01) --00000a00
eeObj.WriteMem32(0x0033dd6c,0x3c013f40)

emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

I tried this and I'm getting some crazy graphical glitches, character models stretch to full screen and can't see anything, anyone had any luck? Thanks
 
Last edited:
WIP fix for Mercenaries 2 - World in Flames NTSC
CLI

Code:
--gs-uprender=2x2
--gs-upscale=edgesmooth
--gs-kernel-cl="h2lpool"
--gs-kernel-cl-up="h2lpool2x2"
--gs-h2l-list-opt=1
--gs-h2l-accurate-hash=1

--mfifo-manual-drain=25.5  #[frame_multiplier/float]
--mfifo-chunk-drain-cycles=550  #[cycles/int]

--ee-block-validation=none        
--ee-regalloc-scalar=RW      

--ee-const-folding=all
--ee-cycle-scalar=2.1

--iop-cycle-scalar=0.95

--host-display-mode=16:9

#emu used=jakx v2
LUA
Code:
-- Mercenaries 2 - World in Flames (U)(SLUS-21650)
-- Widescreen Hack by ElHecht, Arapapa
-- ported to PS4
-- emu used=jakx v2

apiRequest(2.0)

local eeObj = getEEObject()
local emuObj = getEmuObject()

local patcher = function()
-- 16:9
eeObj.WriteMem32(0x0037ce68,0x3c013f40) -- 00000000 hor fov
eeObj.WriteMem32(0x0037ce70,0x4481f000) -- 00000000 fov
eeObj.WriteMem32(0x0037ceb0,0x4600f306) -- 44816000 fov
--Render fix(objects) by Arapapa
--003f013c 00088144 1000b07f (2nd)
eeObj.WriteMem32(0x003811b4,0x3c013f2b) -- 3c013f00
--00608144 2d20a003 80bf013c
eeObj.WriteMem32(0x003896e8,0x4600f306) -- 44816000 renderfix 2 smoke and fire
--42080346 02000346 40080446
eeObj.WriteMem32(0x0037b748,0x081287e8) -- 46030842 hud-identification fix
eeObj.WriteMem32(0x0037b74c,0x00000000) -- 46030002 hud-identification fix
eeObj.WriteMem32(0x004a1fa0,0x46030842) -- 00000000 hud-identification fix
eeObj.WriteMem32(0x004a1fa4,0x46030002) -- 00000000 hud-identification fix
eeObj.WriteMem32(0x004a1fa8,0x461e0002) -- 00000000 hud-identification fix
eeObj.WriteMem32(0x004a1fac,0x080dedd3) -- 00000000 hud-identification fix

--eeObj.WriteMem32(0x203FD4F8,0x2C420001) -- 60FPS
eeObj.Vu1MpgCycles(math.floor(2250))
emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

emuObj.SetGsTitleFix( "forceSimpleFetch", "reserved", { texMode=1  } )

local frameskip = {}

frameskip.DeterministicMode = 0     -- set 0 for native (non-deterministic) behavior, see function frameskip.GetFramesInQueue()

-- constants:
local CLOCK_EE          = 294912000.0
local CLOCK_EE_60hz      = 294912000.0 / 60
local AdvanceCycleChunkSize = 2500
local ChunksPerFrame      = (CLOCK_EE_60hz / AdvanceCycleChunkSize)
local TaperHoldBaseline     = ChunksPerFrame / 20         -- frames to hold even the smallest taper values
local TaperRatePerFrame     = ChunksPerFrame / 140         -- frames to taper away 1.0 worth of dog-ratio
local TaperHoldPerChunk     = 10.0 / ChunksPerFrame         -- hold for 15 frames per one frame of delay
local EnableTapering     = true

local MaxChunkCounter      = math.floor(ChunksPerFrame * 2.25) --

-- globals:
local isFrameDone        = false
local m_counter        = 0
local m_prev_framecount    = 0
local m_taper_peak     = 0
local m_taper_hold       = 0

-- Vars For diagnostic:
local d_truelog        = false
local d_numframes        = 0

frameskip.GetFramesInQueue = function()
   if frameskip.DeterministicMode == 0 then
     return gsObj.GetFramesInQueue()

   elseif frameskip.DeterministicMode == 1 then
     -- five regular frames, four slow frames
     local modulo = (eeObj.GetClock() // CLOCK_EE_60hz) % 9
     if modulo < 5 then
       return 0
     else
       return 3
     end

   elseif frameskip.DeterministicMode == 2 then
     -- nice slow cyclic test!
     local modulo = (eeObj.GetClock() // CLOCK_EE_60hz) % 240
     if modulo < 200 then
       return 0
     else
       return 3
     end

   elseif frameskip.DeterministicMode == 3 then
     -- slow cycle from 0 to 3 and back to 0, across about 10 seconds...
     local modulo = (eeObj.GetClock() // CLOCK_EE_60hz) % 600
     if modulo < 100 then
       return 0
     elseif modulo < 200 then
       return 1
     elseif modulo < 300 then
       return 2
     elseif modulo < 300 then
       return 3
     elseif modulo < 400 then
       return 2
     elseif modulo < 500 then
       return 1
     else
       return 0
     end
   end

   return gsObj.GetFramesInQueue()
end

frameskip.onFrameFinishedHook = function()
   emuObj.CountFrameOnPS2()   -- updates FRAPS/Actual FPS reading in olympus

   -- local cyl_data, cyl_mpg = eeObj.GetVif1Cycles()
   -- print (string.format("data=%6d  mpg=%6d", cyl_data, cyl_mpg))
  
   local frameCount     = frameskip.GetFramesInQueue()
  
   m_counter  = 0
   if frameCount ~= 0 or m_prev_framecount ~= 0 then
     -- Keep in mind here that the incurred cycle delay will be appended after the standard
     -- VIF/VU cycle delays.  Standard delays can be read using eeObj.GetVif1Cycles() as shown
     -- in a print snippet above.
    
     local fcnew  = frameCount
     local fcold  = m_prev_framecount

     -- first frame being a bit slow is often a red herring, because of how the deferred
     -- EE/GS pipeline works.  So weight it very lightly here (if either fcold or fcnew is
     -- 0 then it'll go negative and help offset remaining 1.0)

     if fcnew < 1.2 then fcnew = fcnew - 0.6 end

     -- Delta from prev to new frame is used to indicate vectoring toward poor perf.
     --  eg. if prev was 1 and new is 3 then ramp up frameskip in a hurry (+2)

     local fcdelta = fcnew - fcold
     fcdelta = (fcdelta >= 0) and (fcdelta / 2.0) or 0

     m_counter      = m_counter + (ChunksPerFrame /  7.5) * (fcnew + fcold + fcdelta)     -- baseline

     -- fcold and fcnew are squared and so to scale back the curve a bit we subtract some
     -- amount from them here:

     fcnew = fcnew - 0.25
     fcold = fcold - 0.40

     m_counter      = m_counter + (ChunksPerFrame / 15.0) * (fcold * fcold)           -- weighted prev slowness
     m_counter      = m_counter + (ChunksPerFrame /  9.0) * (fcnew * (fcnew+fcdelta))     -- weighted current slowness
    
     -- Boundscheck the counter.  Keep in mind that a counter delay of 2 frames will run at ~20fps.
     m_counter  = math.floor(m_counter)
     if m_counter > MaxChunkCounter then m_counter = MaxChunkCounter end
    
     if EnableTapering and m_taper_peak < m_counter then
       m_taper_hold = TaperHoldBaseline + (m_counter * TaperHoldPerChunk)
       m_taper_peak = m_counter
     end
   end

   -- Tapering kind of helps reduce the game's built-in jutter problem... but not really to the
   -- extent that I would like. -- jstine

   local m_origc = m_counter
   if m_counter < m_taper_peak then
     m_counter = math.floor(m_taper_peak)
   end
  
   --print (string.format("onFrameFinished! numFrames=%d,%d counter=%3d taper_hold=%5.1f taper_peak=%5.1f delayInFrames=%5.3f",
   --   m_prev_framecount, frameCount, m_origc, m_taper_hold, m_taper_peak, m_counter / ChunksPerFrame
   --));    

   if m_taper_peak > 0 then
     if m_taper_hold > 0 then
       m_taper_hold = m_taper_hold - 1
     elseif m_origc <= 25 then
       -- TODO make these constants?
       m_taper_peak = m_taper_peak - (m_taper_peak > 112 and TaperRatePerFrame or 0.75)
     end

     -- when taper is a large value, slide it back quickly regardless of hold state
     if m_taper_peak > 450 and m_taper_peak > m_origc then
       m_taper_peak = m_taper_peak * 0.90
     end
   end

   m_prev_framecount = frameCount
   isFrameDone = true     -- enables SpinWaitDelayHook
end

frameskip.SpinWaitDelayHook = function(hookpc, gprv, writeon)
   if not isFrameDone then
     return
   end

   local numFrames = frameskip.GetFramesInQueue()
   local isSkipping = false
  
   --local numFrames = frameskip.GetFramesInQueue()
   --print (string.format("HOOKED @ 0x%02x - counter=%d numFrames=%d", hookpc, m_counter, numFrames))
  
   if m_counter > 0 then
     --if not d_truelog then
     --   print ( string.format("HOOKED! - numFrames=%d", numFrames))
     --   d_numframes = numFrames
     --end
     --d_truelog = true

     -- SetFrameSkipping call removed because it causes severe frame loss, due to internal scanout
     -- not aligning to when this hook is invoked.  The call was only implemented in order to solve
     -- interlace jitter problems on Jak TPL anyway, and isn't needed here... --jstine
     --gsObj.SetFrameSkipping(true)

     isSkipping = true
   end
  
   if isSkipping then
     --local v0 = eeObj.GetGpr(gprv)
     eeObj.SetGpr(gprv, writeon)
     eeObj.AdvanceClock(AdvanceCycleChunkSize)
     m_counter = m_counter - 1
     -- print ( string.format("SKIPP! - numFrames=%d", numFrames))
   else
     isFrameDone = false
     --gsObj.SetFrameSkipping(false)
     m_counter = 0

     --if d_truelog then
     --   print "BUSY ENDED, RESUMIMG..."
     --end
     --d_truelog = false
   end

   --if d_numframes ~= numFrames then
   --   print ( string.format("Frame Queue Changed - numFrames=%d", numFrames))
   --   d_numframes = numFrames
   --end
end

return frameskip

Need some help on this one....


any progress on this?
 
No sir. I kinda gave up on that one.

Fair enough, I'll have a look into it, if its possible at all. By the way I found your config for lego batman and lego star wars but when I applied them I had some weird graphical glitches casuing the characters to stretch full screen and I can't see anything, do you know whats causing this? Thanks
 
Last edited:

Similar threads

Back
Top