PS4 [Research]PS2 emulator configuration on PS4

Btw
That game looks better, clamping options fix Graphical bugs a little bit, but i think still need no interlacing code!
@Stayhye or anyone else know no interlacing code as lua format for ps4 emu?

is that right?
-- Disable internal field shift compensation, part of post-process removal feature.
gsObj.SetDeinterlaceShift(0)

Is the frog supposed to be floating like that? try:
CLI
Code:
--vu1-no-clamping=0
--vu0-const-prop=0
--vu1-const-prop=0
--vu1-jr-cache-policy=newprog

"gsObj.SetDeinterlaceShift(0) " is default. change (0) to (1) . Command is only available in later emus(jaks, etc)
 
I found that myself about Onimusha 3. A black screen appears after the Capcom logo. The Invalidation texture should be set to fast. How should it all look like?

 
Is the frog supposed to be floating like that? try:
CLI
Code:
--vu1-no-clamping=0
--vu0-const-prop=0
--vu1-const-prop=0
--vu1-jr-cache-policy=newprog

"gsObj.SetDeinterlaceShift(0) " is default. change (0) to (1) . Command is only available in later emus(jaks, etc)
will try later! Also
-- Disable internal field shift compensation, part of post-process removal feature.
gsObj.SetDeinterlaceShift(1) - correct for jak v.2 right?
 
will try later! Also
-- Disable internal field shift compensation, part of post-process removal feature.
gsObj.SetDeinterlaceShift(1) - correct for jak v.2 right?

after what @Agrippa said about interlacing, that command may not do much. Yes it should work with jak v2, if not jakx for sure
 
after what @Agrippa said about interlacing, that command may not do much. Yes it should work with jak v2, if not jakx for sure

Maybe this command does work only with games that are using the sceGsSetHalfOffset official SDK function? Snowblind Engine games, Valkyrie Profile 2, CMR3 use custom routine for the interlacing compensation.
 
My compatibility list:
Game TitleRegionSerialNotes
Ace Combat Zero: The Belkan WarJAPSLPS-25629
Ace LightningJAPSLES-51503
Driv3rJAP???Ingame skips very heavily. Please use an USA ISO.
Driver 4 - Parallel LinesJAP???Nothing, just gives an unhandled pagefault.
 
King of Fighters 2002 Unlimited Match, The(SLPS-25915)

TXT
Code:
--gs-use-clut-merge=1
--gs-kernel-cl="clutmerge"
--gs-kernel-cl-up="clutmerge2x2"
--force-frame-blend=1
--gs-use-deferred-l2h=0

LUA
Code:
apiRequest(2.0)

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

-- Fix bug 10414 - large stretched polygons block view of player characters

local FixPointTable = function()
     
        local s6 = eeObj.GetGpr(gpr.s6)                    -- obj in question
        local p5Tbl = eeObj.ReadMem32(s6+0x10)            -- ptr to object's data
        local numPts = eeObj.ReadMem32(p5Tbl+0x110)        -- num points in list
        local pTbl = 0x1F0F150                            -- bg_point_buff (we need to scan this)
        for i = 1, numPts do
            local stat = eeObj.ReadMem32(pTbl + 0xc)    -- check 4th word, should be 0
            if (stat ~= 0) then                            -- if not, we need to fix  
                if (i > 1) then                            -- if this is any but the first entry
                    stat = eeObj.ReadMem64(pTbl-0x10)    -- fix by replacing the x, y with
                    eeObj.WriteMem64(pTbl, stat)        -- the previous entry's x and y.
                    stat = 0x0000000080000000            -- replace the z with 0x80000000
                    eeObj.WriteMem64(pTbl+8, stat)        -- replace the 4th word with 0
                else
                    stat = eeObj.ReadMem32(pTbl + 0x1c)    -- if this is the first entry
                    if (stat == 0) then                    -- make sure the second entry is kosher
                        stat = eeObj.ReadMem64(pTbl+0x10)
                        eeObj.WriteMem64(pTbl, stat)    -- if it is, use the x, y from that entry.
                        stat = 0x0000000080000000        -- replace the z with 0x80000000
                        eeObj.WriteMem64(pTbl+8, stat)    -- replace the 4th word with 0        
                    else
                        eeObj.WriteMem64(pTbl, 0)                        -- if the 2nd entry is not kosher
                        eeObj.WriteMem64(pTbl+8, 0x0000000080000000)    -- write 0, 0, 0x80000000, 0
                    end
                end
            else                                        -- check if Z value is between 0 and 0x8000
                stat = eeObj.ReadMem32(pTbl + 8)        -- if so, overwrite Z with 0x80000000
                if (stat <= 0x8000) then
                    eeObj.WriteMem32(pTbl+8, 0x80000000)
                end
            end
            pTbl = pTbl + 0x10
        end
end

eeObj.AddHook(0x4E78D4, 0x8e150180, FixPointTable)

A friend's request, maybe they like the uncorrected version.:D

Jakv2 emu
 
Code:
apiRequest(1.0)

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

local patcher = function()

eeObj.WriteMem32(0x1D77C8,0x100000B4) --speed fix

eeObj.WriteMem32(0x1D7ED4,0x2C420001) --60FPS

--Disable eAttachTargetMoveSprites
eeObj.WriteMem32(0x1D3930,0x03e00008)
eeObj.WriteMem32(0x1D3934,0x0)

--Disable DepthIntoAlpha
eeObj.WriteMem32(0x56FFA4,0x0)

--Disable DepthOfField
eeObj.WriteMem32(0x570268,0x0)

--Disable Fog
eeObj.WriteMem32(0x57004C,0x0)

--Disable Smear (require depthIntoAlpha to work anyway)
eeObj.WriteMem32(0x570098,0x0)

--Rain modifier (hacked from RainInTheHeadlights)
-- 3e000000 for full screen, 40000000 for light rain only
eeObj.WriteMem32(0x574158,0x40000000)

--Better Car Brightness (orig. 437F)
eeObj.WriteMem32(0x1C2704,0x3C01439F)

--Lower World Lights Flare
eeObj.WriteMem32(0x1C3EE0,0x3C013F40)

--Lower Road/Traffic Yellow/Orange Lights Flare
eeObj.WriteMem32(0x1C3260,0x3C013F50)
end

emuObj.AddVsyncHook(patcher)

A game finally works. Great. :flustered:
Found here from @Nifengyuexie. (Need for Speed Underground 2 SLUS 21065)
 
Last edited:
WIP experimental fix for Marc Ecko's Getting Up - Contents Under Pressure™ NTSC

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!

Looks like it work with Pal version too! Good performance in opening scene!
 
Scarface boots with:-

Ape Escape 2
Psychonauts
Star Ocean 3
arc the lad
plus a few others.....

tried almost all of them. Only changing emu is not the solution this time. I think if we could figure out how to boot this with the Jak emus(esp X v2) that could help a bit.(maybe)

Scarface boots fine here using Jak X v2. But of course the disappearing textures are still present.
 

Similar threads

Back
Top