Jump to content

Problem of loading savestate in CPS2 games


ffman1985
 Share

Recommended Posts

There seems to be an unstability with the recent gcc (12.2) in windows only and in 64 bits only, and only for the cps2 driver afaik ! so as long as there is no update on their side I don't think I will be able to do much on mine.

The alternatives are indeed : switch to 32 bits, to linux, or revert to an old version. If you are happy with an old version then excellent !

I am not 100% certain it's gcc fault, there might be a buffer overflow somewhere, but if there is one, it's extremely hard to find : it happens only when the build is optimized, so no debug build allowed, and only in windows 64 bits, so far I wasn't able to find anything, but I miss a good tool to track buffers overflows like the good old electric fence which doesn't work on our modern systems...

I'll try to look again later, but no promise here... !

Edited by Tux
  • Like 1
Link to comment
Share on other sites

Ok, finally fixed everything. The trick with this kind of problem is that even if debug info is not allowed, if it crashes, you can track it with a debuger and with enough patience you finally find the cause. There were actually 2 problems here :

1) a very very old bug, there is an array for layers and layers priorities in cps1/cps2, so I reserved 3 members for these 2 arrays since there are 3 layers. Except that sprites are seen also as a layer in this driver ! So I needed 4 spaces ! And why did it crash just now ? Apparently because gcc decided to change the way variables were allocated in this version for win64, before it was harmless, I don't know where it landed but it was unnoticeable, and with this change from them, it became the end of the world !

2) a very optimistic speed hack module, that's why save games were crashing sometimes. It was storing the data it needed in the save by assuming variables were allocated in memory as they appeared in the source. It's clearly not the case anymore in the latest gcc, and anyway it's a bad assumption. So I moved everything to a struct and now this bug is gone too ! (I don't guarantee old savegames using this module will be compatible, it's used at least by cps1/cps2, but not only).

So finally gcc was not guilty, it just allowed me to find some old bugs...

Now I am a little tired so I don't promise a release just now, but it should be good for tomorrow or maybe a little later... !

Edited by Tux
  • Like 1
Link to comment
Share on other sites

Great work Tux! 😀

I'm happy that the CPS1 and 2 save state function is finally operational again in Raine64.

Thanks to ffman1985 for spotting and reporting this bug. 👍

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...