grumpycoders / pcsx-redux

The PCSX-Redux project is a collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1. The core product itself, PCSX-Redux, is yet another fork of the Playstation emulator, PCSX.
https://pcsx-redux.consoledev.net
GNU General Public License v2.0
659 stars 108 forks source link

Accessing `psxRegisters` struct incorrectly causes crash to desktop #1252

Open alam0rt opened 1 year ago

alam0rt commented 1 year ago

While writing a lua script, I was incorrectly accessing the registers like so

    local regs = PCSX.getRegisters()
    local offsets = regs.a0

This was causing pcsx-redux to crash to desktop with no warning/error/logging

Fixing the script to use the correct fields

    local regs = PCSX.getRegisters()
    local offsets = regs.GPR.n.a0

fixed the issue, but the problem remains that the applicaton crashed from illegally accessing a struct field that didn't exist.

I'd expect that the application would handle this without crashing.

pcsx-redux-nightly-14035.20230321.9-x64

nicolasnoble commented 1 year ago

So, I just tried locally, and I got properly a Lua error saying there's no a0 field in the regs structure... I'm not sure how this is different between what you're doing and me locally.