sanctuary / sym

Parse Playstation 1 symbol files (*.SYM).
The Unlicense
7 stars 0 forks source link

Legacy of Kain: Soul Reaver (KAIN2.SYM) Unsupported #5

Open Gh0stBlade opened 1 year ago

Gh0stBlade commented 1 year ago

Log:

sym_dump -ida KAIN2.SYM
2022/12/25 12:07:57 open KAIN2.SYM: The system cannot find the file specified.
github.com/sanctuary/sym.ParseFile
        Documents/GitHub/sym/file.go:92
main.main
        Documents/GitHub/sym/cmd/sym_dump/main.go:64
runtime.main
        C:/Program Files/Go/src/runtime/proc.go:250
runtime.goexit
        C:/Program Files/Go/src/runtime/asm_amd64.s:1594

Documents\GitHub\sym>sym_dump -ida KAIN2.SYM
panic: unable to locate struct "MultiSignal"

goroutine 1 [running]:
github.com/sanctuary/sym/csym.(*Parser).parseBase(0xc001676000, 0x8, {0xc0002132d0?, 0x0?})
        Documents/GitHub/sym/csym/parse_types.go:354 +0x317
github.com/sanctuary/sym/csym.(*Parser).parseType(0xb729c0?, 0x18, {0x0, 0x0, 0xb4810c?}, {0xc0002132d0?, 0xc003271c70?})
        Documents/GitHub/sym/csym/parse_types.go:331 +0x45
github.com/sanctuary/sym/csym.(*Parser).parseStructTag(0xc001676000?, 0xc000209f00, {0xc0029881b0, 0x48147, 0x0?})
        Documents/GitHub/sym/csym/parse_types.go:143 +0x139
github.com/sanctuary/sym/csym.(*Parser).ParseTypes(0xc0000180e0?, {0xc002980000, 0x4917d, 0x54000})
        Documents/GitHub/sym/csym/parse_types.go:21 +0x1c5
main.main()
        Documents/GitHub/sym/cmd/sym_dump/main.go:75 +0x732
mewmew commented 1 year ago

Hi @Gh0stBlade,

Thanks for reporting the issue. It was a long time ago since we were developing the sym tools. We only do it when we get the inspiration to, as open source coding should be passion driver :P

That being said, if you are familiar with Go development then the code should be quite explanatory. Adding support for new types should be rather easy. Just look at the existing examples of how to parse types them in sym/csym/parse_types.go.

In this case, it seems that the struct type MultiSignal cannot be located prior to use. To get around this issue, you may modify parseBase to add a "stub" struct for unknown structs, as follows:

    case sym.BaseStruct:
        t, ok := p.Structs[tag]
        if !ok {
            stubStructType := &c.StructType{
                Tag: tag,
            }
            p.Structs[tag] = stubStructType
            t = stubStructType
        }
        return t

No idea if this will actually work, or just get stuck at some other error, but feel free to try.

Also, if you so wish. Upload an attachment of the KAIN2.SYM file, so it can be used for reproducing the issue.

Wish you a happy end of the calendar year and happy coding : )

Cheers, Robin