mkst / maspsx

MIT License
5 stars 4 forks source link

Legacy of Kain: Soul Reaver function doesn't match with MASPSX #93

Closed FedericoMilesi closed 3 months ago

FedericoMilesi commented 3 months ago

Hi,

Here's a function that has got two memcpy() calls:

https://decomp.me/scratch/cKvGg

Currently it is a 100% match using gcc 2.8.1 + aspsx 2.79 (CCPSX), but changing to the current Legacy of Kain: Soul Reaver preset which uses maspsx causes it to match 99.78% instead, due to a diff between memcpy() on the left and bcopy() on the right. Using the -fno-builtin flag doesn't quite solve this issue like in most cases for a reason I currently don't know, since the first memcpy() call in the function produces very mismatching results that way.

mkst commented 3 months ago

This is not an maspsx issue, gcc is emitting the bcopy.

    lw  $4,4($18)
    lw  $6,0($18)
    .set    noreorder
    .set    nomacro
    jal bcopy
    addu    $5,$16,40

Created https://github.com/decompals/old-gcc/issues/23 and closing this.

mkst commented 3 months ago

https://decomp.me/scratch/OBK59

FedericoMilesi commented 3 months ago

Glad it works, could the game preset be updated to use gcc 2.8.1-psx + maspsx? That and -G65536 needs to be changed to -G4096 which is what I'm using in the Soul Reaverse project, currently.

mkst commented 3 months ago

Done. Per api:

{
    "id": 17,
    "name": "Legacy of Kain: Soul Reaver",
    "platform": "ps1",
    "compiler": "gcc2.8.1-psx",
    "assembler_flags": "",
    "compiler_flags": "-O2 -G4096 -fpeephole -ffunction-cse -fkeep-static-consts -fpcc-struct-return -fcommon -fgnu-linker -msplit-addresses -mgas -mgpOPT -mgpopt -msoft-float -gcoff -Wa,--aspsx-version=2.81",
    "diff_flags": [],
    "decompiler_flags": "",
    "libraries": [],
    "num_scratches": 2883,
    "owner": null
}