User talk:Kozarovv: Difference between revisions

From PS4 Developer wiki
Jump to navigation Jump to search
 
(37 intermediate revisions by 4 users not shown)
Line 3: Line 3:
==psfour2pstwo==
==psfour2pstwo==


====gs====
====vu0====
For JAK emu. Todo: Exec from VIF0 seems to always run program for 0x7FFFFFFF cycles...
void __fastcall Vu0MicroExec()
{
  run_vu0(vu0_functions_ptr, 256LL, 0LL);
                                                // run vu for 256 cycles.
                                                // This kill whole sync idea. We have 256 cycles run already on first run.
                                                // Games like SST/ARR/TM:HEAD-ON are alredy broken before we even started.
  if (is_vu0_running())                        // if still running (no ebit, no mbit)
  {
    v0 = ee_sched_stru;
    v1 = 0LL;
    v2 = *(ee_core_regs_base + 0x378) - *(ee_core_regs_base + 0x370) + 512LL;
                                                // passed cycles + 512
                                                // terrible idea, we are falling behind ee here.
                                                // There is usually no point to run behind ee if we failed to do this at start.
                                                // This break games like Ratchet/Rayman.
    sched_Vu0MicroExec.delta = v2;
    if ( ee_sched_stru )
    {
      while ( 1 )
      {
        v3 = v0;
        if ( v0[2] >= v2 )                      // if delta from scheduler higher than from v0
          break;
        v0 = *v0;
        v1 = v3;
        if ( !*v3 )                            // schedule next run...


* --gs-kernel-cl="DarkCloud2"
====todo====
* --gs-kernel-cl="fantavision"


Special case kernel plugins?
seems to be like internal threads, not real threads. Emu print with that.
<pre>_____________________________________________________________________________
| Emotion Engine:      | Input Output Processor (iop)  | x Extra?         |
|-----------------------|-------------------------------|-------------------|
| e-dbg                | i-fw                          | x-stdlib          |
| e-r59                | i-debug                      | x-emu            |
| e-mem                | i-cdvd                        | x-lpnr            |
| e-dmac                | i-dmac                        | x-cdvd            |
| e-timer              | i-gmif                        | x-isofs          |
| e-sio                | i-intc                        | x-log            |
| e-dramc              | i-mem                        | x-mcd            |
| e-intc                | i-memcard                    | x-replay          |
| e-sif                | i-mtap                        | x-rtc            |
| e-gif                | i-pad                        | x-save            |
| e-vif0                | i-pif                        | x-osd            |
| e-vif1                | i-sched                      | x-snap            |
| e-ipu                | i-sif                        | x-host            |
| e-jit                | i-sio2                        | x-trphy          |
| e-hook                | i-timer                      | x-audio          |
| e-Lua                | i-usb                        | x-pad            |
| e-gs                  | i-spu2                        | x-srvc            |
| e-sched              | i-EndSlice                    | x-dialog          |
|                      | i-r30                        | x-dlc            |
|                      | i-jit                        | x-stream          |
|                      | i-Lua                        | x-mem            |
|                      | i-thread                      | x-core            |
|-----------------------|-------------------------------|-------------------|</pre>


====possible speed/comp hacks====
==Shaders==


* --detect-idle-vif
===SB header===
* --detect-idle-ee
{| border="1" cellspacing="0" cellpadding="5" border="#999" class="wikitable" style="border:1px solid #999; border-collapse: collapse;"
* --detect-idle-iop
|- bgcolor="#cccccc"
* --detect-idle-intc
! Offset !! Size !! Description !! Example
* --detect-idle-chcr
|-
| 0x00 || 2 bytes || SB Version || 00 04 (00.04)
|-
| 0x02 || 2 bytes || Compiler Version || F9 F1 (63985)
|-
| 0x04 || 8 bytes || Association Hash || B2 09 E0 A5 00 00 00 00
|-
| 0x0C || 1 byte || Shader Type || 02
|-
| 0x0D || 1 byte || Code Type || 01
|-
| 0x0E || 1 byte || UseShaderResourceTable || 00/01 (true/false)
|-
| 0x0F || 1 byte || Compiler Type || 03
|-
| 0x10 || 4 bytes || Code Size || E8 00 00 00 (232)
|-
| 0x14 || 4 bytes || ? || 00 00 00 00
|-
| 0x18 || 12 bytes? || System Attribute Info - Num Threads || 40 00 01 00  01 00 00 00  00 00 00 00
|-
|}
<pre>
'''Shader Type'''


====Sound - SPU2 behavior====
*(unknown)            0
*kShaderTypeVsShader  1
*kShaderTypeFsShader  2
*kShaderTypeCsShader  3
*kShaderTypeGsShader  4
*kShaderTypeHsShader  5
*kShaderTypeDsShader  6


* --spu2-update-deferral
* --spu2-reverb
* --spu2-c0-memin-to-bgm
* --spu2-c1-memin-to-bgm
* --spu2Trace


'''Code type'''


==PSPHD==
*kCodeTypeIl  0
*kCodeTypeIsa  1
*kCodeTypeScu  2


===LUA===


====basic====
'''UseShaderResourceTable'''


*axInsnReplace (mem, org opcode, new opcode) - Replace allegrex memory
*false  0
*axFuncReplace - Replace allegrex function
*true  1




====hooks/registers====
'''Compiler Type'''


Allegrex (usage - remove AX_):
*kCompilerTypeUnspecified 0
*kCompilerTypeOrbisPsslc  1
*kCompilerTypeOrbisEsslc  2
*kCompilerTypeOrbisWave  3
*kCompilerTypeOrbisCuAs  4</pre>


*AX_GetPC
===GNM Header===
*AX_SetPC
*AX_GetHi
*AX_SetHi
*AX_GetLo
*AX_SetLo
*AX_GetReg
*AX_SetReg
*AX_GetFpr
*AX_SetFpr
*AX_ReadMem8
*AX_ReadMem16
*AX_ReadMem32
*AX_ReadMemFloat
*AX_ReadMemString
*AX_WriteMem8
*AX_WriteMem16
*AX_WriteMem32
*AX_WriteMemFloat
*AX_WriteMemString
*AX_WriteMemStringZ
*AX_AddHook
*AX_RemoveHook
*AX_Overlay
*AX_InsnReplace
*AX_FuncReplace


Media Engine usage - remove EM_:
{| border="1" cellspacing="0" cellpadding="5" border="#999" class="wikitable" style="border:1px solid #999; border-collapse: collapse;"
 
|- bgcolor="#cccccc"
*EM_SetTextureHashMode
! Offset !! Size !! Description !! Example
*EM_SetTextureScaleOffset
|-
*EM_SetTextureSaveSubdir
| 0x00 || 4 bytes || Magic || 72 64 68 53 Shdr
*EM_SetSampleTitle
|-
*EM_SetDrawEDRam
| 0x04 || 4 bytes || Version || 00 07 00 02 (0007.0002)
*EM_ToggleTextures
|-
*EM_PadRead
| 0x08 || 1 byte || Shader type || 04 (Compute)
*EM_PadReadPitch
|-
*EM_PadReadRoll
| 0x09 || 1 byte || Shader header size in DW || 0D (13)  
*EM_PadVibrate
|-
*EM_PadRegisterSamples
| 0x0A || 1 byte || Has shader aux data || 00/01 ? 
*EM_PadSetButtonsMode
|-
*EM_AddVsyncHook
| 0x0B || 1 byte || Target GPU types || 03 (Base|NEO)
*EM_RemoveVsyncHook
|-
*EM_ThrottleMax
| 0x0C || 4 bytes || padding || 00 00 00 00
*EM_ThrottleNormal
|-
*EM_Log
|}
*EM_GetLanguage
*EM_GetNativeLanguage
*EM_DisplayManual
*EM_LoadConfig
*EM_SaveConfig
*EM_LoadMIDI
*EM_GetMIDINotesAtTick
*EM_LoadSlideshow
*EM_StartSlideshow
*EM_LoadState
*EM_SaveState
 
===config psp===
 
Desc: https://pastebin.com/CXRpVLdd
 
*--boot [disc0:/PSP_GAME/SYSDIR/BOOT.BIN - path (no loaders support like on PS3? vide ct2, psc)]
*--notrophies
*--texsave
*--texmissingsave
*--samplesave
*--texreplace
*--samplereplace
*--replacementalpha [true]
*--parappaalphahack
*--locorocomeshsmooth
*--replacementfilter
*--gputhread
*--antialias [MSAA4x, SSAA4x]
*--texcachemode [drawbounds, drawboundsloco]
*--texclutmode [filter, full]
*--texloadmode [launch, ondemand_lz4]
*--parappajapanesefonthack
*--parappareplacecolor [%08x (rgb?)]
*--volume [  ? (Adjusting volume level to %d%%)]
*--image [umd0 ,disc0]
*--addon
*--host [host0, flash0]
 
====Standard: ====
 
*patches/
*_patches.lua
*feature_data/
*_features.lua
*tooling/
*_tooling.lua
*trophy_data/
*_trophies.lua
 
====other====
 
*_config.txt
*--vms
*
*videos/
*.mp4
*videos/%08x.mp4
*audio/%08x.ogg
*--texswitch [original, replacement]
 
Paths:
 
*/app0/
*/download0/
*/savedata
*/host/
*/hostapp/
*/data/

Latest revision as of 17:30, 11 April 2023

Rough draft[edit source]

psfour2pstwo[edit source]

vu0[edit source]

For JAK emu. Todo: Exec from VIF0 seems to always run program for 0x7FFFFFFF cycles...

void __fastcall Vu0MicroExec()
{
  run_vu0(vu0_functions_ptr, 256LL, 0LL);
                                                // run vu for 256 cycles.
                                                // This kill whole sync idea. We have 256 cycles run already on first run.
                                                // Games like SST/ARR/TM:HEAD-ON are alredy broken before we even started. 

  if (is_vu0_running())                         // if still running (no ebit, no mbit)
  {
    v0 = ee_sched_stru;
    v1 = 0LL;
    v2 = *(ee_core_regs_base + 0x378) - *(ee_core_regs_base + 0x370) + 512LL;
                                                // passed cycles + 512
                                                // terrible idea, we are falling behind ee here.
                                                // There is usually no point to run behind ee if we failed to do this at start.
                                                // This break games like Ratchet/Rayman.
    sched_Vu0MicroExec.delta = v2;
    if ( ee_sched_stru )
    {
      while ( 1 )
      {
        v3 = v0;
        if ( v0[2] >= v2 )                      // if delta from scheduler higher than from v0
          break;
        v0 = *v0;
        v1 = v3;
        if ( !*v3 )                             // schedule next run...

todo[edit source]

seems to be like internal threads, not real threads. Emu print with that.

_____________________________________________________________________________
| Emotion Engine:       | Input Output Processor (iop)  | x Extra?          |
|-----------------------|-------------------------------|-------------------|
| e-dbg                 | i-fw                          | x-stdlib          |
| e-r59                 | i-debug                       | x-emu             |
| e-mem                 | i-cdvd                        | x-lpnr            |
| e-dmac                | i-dmac                        | x-cdvd            |
| e-timer               | i-gmif                        | x-isofs           |
| e-sio                 | i-intc                        | x-log             |
| e-dramc               | i-mem                         | x-mcd             |
| e-intc                | i-memcard                     | x-replay          |
| e-sif                 | i-mtap                        | x-rtc             |
| e-gif                 | i-pad                         | x-save            |
| e-vif0                | i-pif                         | x-osd             |
| e-vif1                | i-sched                       | x-snap            |
| e-ipu                 | i-sif                         | x-host            |
| e-jit                 | i-sio2                        | x-trphy           |
| e-hook                | i-timer                       | x-audio           |
| e-Lua                 | i-usb                         | x-pad             |
| e-gs                  | i-spu2                        | x-srvc            |
| e-sched               | i-EndSlice                    | x-dialog          |
|                       | i-r30                         | x-dlc             |
|                       | i-jit                         | x-stream          |
|                       | i-Lua                         | x-mem             |
|                       | i-thread                      | x-core            |
|-----------------------|-------------------------------|-------------------|

Shaders[edit source]

SB header[edit source]

Offset Size Description Example
0x00 2 bytes SB Version 00 04 (00.04)
0x02 2 bytes Compiler Version F9 F1 (63985)
0x04 8 bytes Association Hash B2 09 E0 A5 00 00 00 00
0x0C 1 byte Shader Type 02
0x0D 1 byte Code Type 01
0x0E 1 byte UseShaderResourceTable 00/01 (true/false)
0x0F 1 byte Compiler Type 03
0x10 4 bytes Code Size E8 00 00 00 (232)
0x14 4 bytes ? 00 00 00 00
0x18 12 bytes? System Attribute Info - Num Threads 40 00 01 00 01 00 00 00 00 00 00 00
'''Shader Type'''

*(unknown)             0
*kShaderTypeVsShader   1
*kShaderTypeFsShader   2
*kShaderTypeCsShader   3
*kShaderTypeGsShader   4
*kShaderTypeHsShader   5
*kShaderTypeDsShader   6


'''Code type'''

*kCodeTypeIl   0
*kCodeTypeIsa  1
*kCodeTypeScu  2


'''UseShaderResourceTable'''

*false  0
*true   1


'''Compiler Type'''

 
*kCompilerTypeUnspecified 0
*kCompilerTypeOrbisPsslc  1
*kCompilerTypeOrbisEsslc  2
*kCompilerTypeOrbisWave   3
*kCompilerTypeOrbisCuAs   4

GNM Header[edit source]

Offset Size Description Example
0x00 4 bytes Magic 72 64 68 53 Shdr
0x04 4 bytes Version 00 07 00 02 (0007.0002)
0x08 1 byte Shader type 04 (Compute)
0x09 1 byte Shader header size in DW 0D (13)
0x0A 1 byte Has shader aux data 00/01 ?
0x0B 1 byte Target GPU types NEO)
0x0C 4 bytes padding 00 00 00 00