Editing Official Configuration Files

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 9,682: Line 9,682:


emuObj.AddVsyncHook(DetectFunc)
emuObj.AddVsyncHook(DetectFunc)
</pre>
====Jak X====
'''CLI'''
<br>SCUS-97429
<pre>
--ee-jit-pagefault-threshold=30
--gs-frontend-opt-mode=1
--gs-use-mipmap=1
--gs-kernel-cl="mipmap"
--gs-kernel-cl-up="mipmap2x2"
--cop2-no-clamping=1
--vu1-mpg-cycles=250
</pre>
'''LUA'''
<br>SCUS-97429
<pre>
-- Jak X Combat Racing  [US]
apiRequest(2.2)
local gpr = require("ee-gpr-alias")
local eeObj = getEEObject()
local emuObj = getEmuObject()
local gsObj = getGsObject()
local eeOverlay = eeObj.getOverlayObject()
-- Bug 10697
emuObj.SetGsTitleFix( "ignoreSubBuffCov", "reserved", { texMode=2 , tw=6 , th=5} )
-- Fix shadow
emuObj.SetGsTitleFix( "forceSimpleFetch", "reserved", { texMode=1  } )
-- Reduce flush count
emuObj.SetGsTitleFix( "SetSelfRender", "reserved", { fbmask= 0x00FFFFFF , renderSelf=1 , zmsk=1 , alpha=0 , texMode=1  } )
-- ------------------------- OVERLAY MANAGER --------------------------
g_OnOverlayRegistered = function(filename, start, size)
-- global function provided for adding per-overlay callback handlers.
-- See code for bug#10141 below, as example of this usage.
end
-- -- this hooks at the moment of loading the relocatable code and patch it only on the target segment.
eeObj.AddHook(0x0026ff90, 0x03207825, function()
local s1 = eeObj.GetGpr    (gpr.s1)
local filename = eeObj.ReadMemStr(s1 + 17)
local segment = eeObj.ReadMem32 (s1 + 8)
local main = eeObj.ReadMem32 (segment + 4)
local mainSize = eeObj.ReadMem32 (segment + 8)
local top = eeObj.ReadMem32 (segment + 36)
local topSize = eeObj.ReadMem32 (segment + 40)
if emuObj.IsToolingVerbose() then
print(string.format("LOAD SEGMENT \"%s\" MAIN %08x size %x TOP %08x size %x",
filename, main, mainSize, top, topSize))
end
eeOverlay.Register(filename .. ".main", main, mainSize, false)
eeOverlay.Register(filename .. ".top",  top,  topSize,  true )
if (g_OnOverlayRegistered ~= nil) then
-- Make sure to execute any previously registered OnOverlay handler
g_OnOverlayRegistered(filename .. ".main", main, mainSize)
g_OnOverlayRegistered(filename .. ".top",  top,  topSize )
end
end)
-- ---------------------------------------------------------------------------------
-- This code serves as both a working patch for Jak X and as a sample for implementing
-- overlay-relative code patches in trophy or feature lua scripts.  The process described:
--
-- 1. store local copy of current global variable instance.  if g_OnOverlayRegistered is
--    nil then we have a problem.  The universal overlay hook is missing for some reason.
--
-- 2. Bind our own function to g_OnOverlayRegistered.  Since it's a global, the hook code
--    in config.lua will execute our handler when the hook is invoked.
assert(g_OnOverlayRegistered ~= nil)
local prev_OnOverlayRegistered = g_OnOverlayRegistered
g_OnOverlayRegistered = function(filename, start, size)
if (prev_OnOverlayRegistered ~= nil) then
-- Make sure to execute any previously registered OnOverlay handler
prev_OnOverlayRegistered(filename, start, size)
end
-- bug#10141  workaround
-- the problem is actually on a block 0x013090bc - 0x01309188.
-- the block is expected to loop 8 times (s4 is the loop counter),
-- the game falls into freezing state once it reaches at 0x01309170.
-- it seems it's OK just to avoid to go into this 'freeze' state, eliminated the branch.
-- this doesn't take into account relocatable code.
-- eeInsnReplace(0x01309174, 0x1000012f, 0) -- beq    $zero,$zero,0x01309634   
-- 01309c64 : (1000012f) beq    $zero,$zero,0x0130a124    => nop
if filename == "lobby-menu-manager.main" then
local adr    = start + 0x1224
assert (eeObj.ReadMem32(adr) == 0x1000012f)
eeObj.WriteMem32(adr, 0)
end
-- bug#10720 - title has a bugged RNG which does an SQRT of the current seed and xor the
-- result back into the seed.  This breaks the prime factorial pattern of the RNG and causes
-- it to fall into a repeating loop with disturbing regularity.  NOP'ing out the sqrt/xor
-- hack seems to fix the title. --jstine
if filename == "math.main" then
assert(eeObj.ReadMem32(start + 0x0005e4) == 0x4be1043d) -- vrget.wxyz  vf01,r
assert(eeObj.ReadMem32(start + 0x0005e8) == 0x4a0103bd) -- vsqrt        q,vf01x
assert(eeObj.ReadMem32(start + 0x0005ec) == 0x4b0000a0) -- vaddq.x      vf02,vf00,q
assert(eeObj.ReadMem32(start + 0x0005f0) == 0x4a00143f) -- vrxor        r,vf02x
eeObj.WriteMem32(start + 0x0005e4, 0x00000000)
eeObj.WriteMem32(start + 0x0005e8, 0x00000000)
eeObj.WriteMem32(start + 0x0005ec, 0x00000000)
eeObj.WriteMem32(start + 0x0005f0, 0x00000000)
end
-- this RNG-sqrt instance is removed more for performance than for RNG corruption.  the particle
-- launcher iterates over the sqrt quite often.  In any case, not corrupting the RNG seed with
-- bad sqrt math is always a good thing in my book --jstine
if filename == "sparticle-launcher.main" then
assert(eeObj.ReadMem32(start + 0x00630c) == 0x4be1043d) -- vrget.wxyz  vf01,r
assert(eeObj.ReadMem32(start + 0x006310) == 0x4a0103bd) -- vsqrt        q,vf01x
assert(eeObj.ReadMem32(start + 0x006318) == 0x4b0000a0) -- vaddq.x      vf02,vf00,q
assert(eeObj.ReadMem32(start + 0x006370) == 0x4a00143f) -- vrxor        r,vf02x
assert(eeObj.ReadMem32(start + 0x0063fc) == 0x4a00143f) -- vrxor        r,vf02x
assert(eeObj.ReadMem32(start + 0x006484) == 0x4a00143f) -- vrxor        r,vf02x
assert(eeObj.ReadMem32(start + 0x00651c) == 0x4a00143f) -- vrxor        r,vf02x
eeObj.WriteMem32(start + 0x00630c, 0x00000000)
eeObj.WriteMem32(start + 0x006310, 0x00000000)
eeObj.WriteMem32(start + 0x006318, 0x00000000)
eeObj.WriteMem32(start + 0x006370, 0x00000000)
eeObj.WriteMem32(start + 0x0063fc, 0x00000000)
eeObj.WriteMem32(start + 0x006484, 0x00000000)
eeObj.WriteMem32(start + 0x00651c, 0x00000000)
end
end
-- ---------------------------------------------------------------------------------
</pre>
</pre>


Please note that all contributions to PS4 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS4 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)