PS4 [Research]PS2 emulator configuration on PS4

Code:
--gs-kernel-cl-up="up2x2skipinterp"

has a cleaner effect(less jaggies) on most games that benefit from

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


Both do basically the same thing, with CLI beating LUA in my testing. The crash Bandicoot games, The Godfather,... all look cleaner and sharper with cli command instead of lua command. Maybe not all games....
 
Last edited:
Fix for MTV's Celebrity Deathmatch (SLUS-20604)

CLI
Code:
--vu1=jit-sync
--gs-kernel-cl="h2lpool"      
--gs-kernel-cl-up="h2lpool2x2"
--fpu-rsqrt-fast-estimate=1
--vu0-di-bits=0
--vu1-di-bits=0
--vu1-mpg-cycles=2960
--vu0-mpg-cycles=1960
--ee-cycle-scalar=1.59
--iop-cycle-scalar=1.8
--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
LUA
Code:
local gpr = require("ee-gpr-alias")

apiRequest(1.0)

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

--16:9
eeObj.WriteMem32(0x00211768,0x3c023f22)

end

emuObj.AddVsyncHook(patcher)

emu used=jak v2

Works great!

 
Last edited:
Code:
--gs-kernel-cl-up="up2x2skipinterp"

has a cleaner effect(less jaggies) on most games that benefit from

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


Both do basically the same thing, with CLI beating LUA in my testing. The crash Bandicoot games, The Godfather,... all look cleaner and sharper with cli command instead of lua command. Maybe not all games....
Yes I tested it, but the code in .LUA worked much better in Need for Speed
 
WIP experimental fix for Marc Ecko's Getting Up - Contents Under Pressure™ NTSC & PAL

CLI
Code:
--gs-adaptive-frameskip=1
--gs-kernel-cl="h2lpool"
--gs-kernel-cl-up="h2lpool2x2"
--gs-h2l-list-opt=1
--gs-h2l-accurate-hash=1
--gs-check-trans-rejection=1

--vu0-mpg-cycles=175
--vu0-di-bits=0
--vu1-di-bits=0

--vu1-jr-cache-policy=newprog
--vu1-jalr-cache-policy=newprog
--vu0-jr-cache-policy=newprog
--vu0-jalr-cache-policy=newprog
--vif1-instant-xfer=0
--vif-ignore-invalid-cmd=1
--vif1-ignore-cmd-ints=1
--fpu-rsqrt-fast-estimate=1
--iop-cycle-scalar=2.5
--ee-cycle-scalar=1.5
--vu1-no-clamping=0
--gs-ignore-rect-correction=1
--gs-dirty-page-policy=1

#emu used=jakx v2
LUA
Code:
--
-- ported to PS4

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 = 0

emuObj.SetDisplayAspectWide()
gsObj.SetDeinterlaceShift(1)
--------------------------------------------------------

local patcher = function()
eeObj.WriteMem32(0x0056764c,0x3c023f40)
emuObj.ThrottleMax()
end
emuObj.AddVsyncHook(patcher)

local ApplyVifCycleSettings = function()

eeObj.Vu1MpgCycles(math.floor(175))
     eeObj.SetVifDataCycleScalar(1, 2.6)
eeObj.SchedulerDelayEvent("vif1.dma", 0x6500)
end

ApplyVifCycleSettings()

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 = 16000
local ChunksPerFrame      = (CLOCK_EE_60hz / AdvanceCycleChunkSize)
local TaperHoldBaseline     = ChunksPerFrame / 30         -- frames to hold even the smallest taper values
local TaperRatePerFrame     = ChunksPerFrame / 180         -- frames to taper away 1.0 worth of dog-ratio
local TaperHoldPerChunk     = 15.0 / ChunksPerFrame         -- hold for 15 frames per one frame of delay
local EnableTapering     = true

local MaxChunkCounter      = math.floor(ChunksPerFrame * 2.50) -- warning: jaks can't frameskip past 2.0, they clamp ratio and slow down instead.

-- 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

-- Performace fix (bug #9785 )
emuObj.SetGsTitleFix( "globalSet",  "reserved", { waveThreshold = 90000} )
emuObj.SetGsTitleFix( "ignoreAreaUpdate", 0, { } )

emu used=Jakx v2

Much improved. Almost perfect. Config needs to be optimized(remove commands). LUA is combination of "adaptive-frameskip.lua" found in the Jak X emu template. Experimental!
 

Attachments

Last edited:
Fix for Galerians Ash NTSC

CLI
Code:
--gs-uprender=2x2
--gs-upscale=EdgeSmooth
--gs-adaptive-frameskip=1

--vif-ignore-invalid-cmd=0
--vif1-ignore-cmd-ints=1
--vif1-instant-xfer=0

--ee-jit-pagefault-threshold=30

--lopnor-config=1

--ee-cycle-scalar=2.0
LUA
Code:
-- Galarians Ash NTSC
-- emu used=jakx v2

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

apiRequest(2.2)

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

local patcher = function()

eeObj.WriteMem32(0x001e0100,0x3c013f40) -- 16:9
emuObj.ThrottleMax() -- Drastically reduces loading screens duration on most games

end

emuObj.AddVsyncHook(patcher)

emu used=jakx v2

MUST
get PS3 config file from here:
http://ps3.aldostools.org/ps2config.html

rename PS3 config file to "SLUS-20560_lopnor.cfgbin" and place in patches folder

Works Perfectly! More testing needed.
 
Last edited:
Fix for Zombie Hunters 2 PAL

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

--host-display-mode=16:9

--gs-use-clut-merge=1
--gs-kernel-cl="clutmerge"
--gs-kernel-cl-up="clutmerge2x2"

--vu1-no-clamping=0
--vu0-const-prop=0
--vu1-const-prop=0
--vu1-jr-cache-policy=newprog
LUA
Code:
-- Zombie Hunters 2
-- emu used=psychonauts v2

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

apiRequest(0.1)

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

local patcher = function()

-- 16:9
eeObj.WriteMem32(0x00243d64,0x3c093f40) -- 00000000 hor fov
eeObj.WriteMem32(0x00243d70,0x3c0a004a) -- 00000000
eeObj.WriteMem32(0x00243d74,0xad49eb84) -- 00000000

emuObj.ThrottleMax()  -- Loading screens speedup! does not affect gameplay!

end

emuObj.AddVsyncHook(patcher)

emu used=psychonauts v2

Works Great! More testing needed
 
@Stayhye, @mrjaredbeta, @Agrippa, @nifengyuexia or anyone who can help, the game "Beyond Good & Evil" looks pretty good, there is some stuttering in some parts but that can be fixed, the big problem is that the image in the game it seems to overlap, it seems to be an interlacing issue, but I don't understand how to fix it.
Beyond Good and Evil_20211212224530.jpg
 
Fix for Blade 2

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

--host-display-mode=16:9

--vu1-di-bits=0
--vu0-di-bits=0
--vu1-opt-vf00=2
--vu0-opt-vf00=2

--ee-regalloc-preserve-scalar=LoadStore
--ee-const-folding=all
LUA
Code:
-- Blade 2 NTSC
--emu used=ADK Damashii

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

apiRequest(0.1)

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

local patcher = function()

eeObj.WriteMem32(0x0018B6B8,0x3C033F40)
eeObj.WriteMem32(0x0017e7d4,0x3c033f40)
emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

emu used=ADK Damashii

Works Perfectly! More testing needed
 
Last edited:
Fix for Blade 2

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

--host-display-mode=16:9

--vu1-di-bits=0
--vu0-di-bits=0
--vu1-opt-vf00=2
--vu0-opt-vf00=2

--ee-regalloc-preserve-scalar=LoadStore
--ee-const-folding=all
LUA
Code:
-- Blade 2 NTSC
--emu used=ADK Damashii

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

apiRequest(0.1)

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

local patcher = function()

eeObj.WriteMem32(0x0018B6B8,0x3C033F40)
eeObj.WriteMem32(0x0017e7d4,0x3c033f40)
emuObj.ThrottleMax()
end

emuObj.AddVsyncHook(patcher)

emu used=ADK Damashii

Works Perfectly! More testing needed
I don't know what I'm doing wrong, but here the game doesn't even start, it goes to a blue screen with error CE-34878-0
 
Xenosaga Episode III - Also Sprach Zarathustra [Disc 1](SLUS-21389)
Xenosaga Episode III - Also Sprach Zarathustra [Disc 2](SLUS-21417)

TXT

Code:
--max-disc-num=2
--switch-disc-reset=1
--gs-kernel-cl="h2lpool"       --Fix the stutter on the main interface
--gs-kernel-cl-up="h2lpool2x2"

LUA
Code:
apiRequest(1.0)
local eeObj = getEEObject()
local emuObj = getEmuObject()
local patcher = function()

--Disable character shadows to fix graphics errors
eeObj.WriteMem32(0x1e7600,0x0)            ---Fix the first CG lag problem
eeObj.WriteMem32(0x290a40,0x8600009c)
end

emuObj.AddVsyncHook(patcher)


Xenosaga Episode III - Also Sprach Zarathustra [Disc 1](SLPS-25640)
Xenosaga Episode III - Also Sprach Zarathustra [Disc 2](SLPS-25641)

TXT

Code:
--max-disc-num=2
--switch-disc-reset=1
--gs-kernel-cl="h2lpool"       --Fix the stutter on the main interface
--gs-kernel-cl-up="h2lpool2x2"


LUA

Code:
apiRequest(1.0)
local eeObj = getEEObject()
local emuObj = getEmuObject()
local patcher = function()

--Disable character shadows to fix graphics errors
eeObj.WriteMem32(0x24ede0,0x0)            ---Fix the first CG lag problem
eeObj.WriteMem32(0x28f2e0,0x8600009c)
end
emuObj.AddVsyncHook(patcher)

View attachment 35433 View attachment 35434

JAK v2 emus

In CLI, " -- " for uncomment causes crash. Use # in CLI

--Fix the stutter on the main interface --> #Fix the stutter on the main interface
 
Last edited:
emuObj.ThrottleMax() cuts all my load times in 1/2....I don't know why it didn't work for you. Try moving it outside the patcher. I also used it on my previous fixes back to the Marc Ecko fix...

*edit - emuObj.ThrottleMax() requires API greater than 1.0

With this 9.00 release, I am able to re-dump ALL emus! Some of the known emus may have been updated since the last dump.....including the last 3 to be examined.

Art of fighting Anthology
Eternal Ring
War of the Monsters

Updates soon...
 

Attachments

Last edited:

Similar threads

Back
Top