andwn / marsdev

Cross platform Mega Drive / 32X toolchain
MIT License
167 stars 18 forks source link

SGDK game freezes with umapped write on BlastEm depending on resources #32

Open lucaspcamargo opened 1 year ago

lucaspcamargo commented 1 year ago

I am writing a game using SGDK and marsdev. The issue is, when I compile with marsdev, if I uncomment all of my resources, the game crashes at launch or when loading the first level. The exact error varies, but it can be an illegal instruction, or unmapped access error. The same does not happen when using the Windows toolchain provided by SGDK, everything works fine. Same code, same resource files, same SGDK version, everything.

I have seen cases like this, in which it looks like the resource got corrupted somehow: (then it crashes) Screenshot_20221124_183958

In that specific instance, if the sfx_fuse resource is commented out, the game loads as normal: Screenshot_20221124_183837

In all cases, the ROM never gets larger than 1MB.

andwn commented 1 year ago

Not entirely sure what is going on here. Maybe an optimization flag in my makelib messed something up because it works in a debug build but not release.

lucaspcamargo commented 1 year ago

Oh, didn't think of doing a debug build of the lib. For now debug mode is ok, as I want to continue using marsdev, at least for development. If there is anything specific I can do to help debug this issue, I'll be glad to help.

HTV04 commented 1 year ago

Hey, just though I'd bump this issue, because I appear to be running into the same issue regardless of my optimization settings. I have no idea how to work around this. Could it be an issue with rescomp?

andwn commented 1 year ago

There is a work in progress new version of Marsdev in the 'opt' branch that wraps SGDK rather than re-implementing it in a custom way. It may resolve the issue if it is not reproducible using vanilla SGDK, but it still needs a proper migration guide.

HTV04 commented 1 year ago

That fixed it, thanks!