Opened 7 years ago

Closed 16 months ago

Last modified 4 months ago

#6087 closed defect (worksforme)

PS2: scummvm.ini gets corrupted

Reported by: SF/damumbl Owned by: csnover
Priority: normal Component: Port: PS2
Keywords: Cc:
Game:

Description

The ini file gets written correctly, as it seems, but the file size is not updated, if the new file is smaller than the old one. This results in an ini file, that contains some of the old content at the end. I'll attach 2 files, to make this clear.

Steps to reproduce:
1) Set up BASS to override the global volume settings. Hit Ok → File gets written. File has x (=550 for me) Bytes and is correct.
2) Edit the game and disable "Override global volume settings". Hit Ok → File gets written. File still has x Bytes. It now contains the new content, which is shorter than the old and some of the old content that "fills" the x Bytes.
3) ScummVM will not start anymore with the corrupt ini file.

I tested with 1.4.1 and the daily build as of today, 2012-07-07. Both versions have the bug.

Ticket imported from: #3541114. Ticket imported from: bugs/6087.

Attachments (2)

SCUMMVM.INI (550 bytes) - added by SF/damumbl 7 years ago.
Correct ini
SCUMMVM-corrupted.INI (550 bytes) - added by SF/damumbl 7 years ago.
Corrupt ini

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by SF/damumbl

Attachment: SCUMMVM.INI added

Correct ini

Changed 7 years ago by SF/damumbl

Attachment: SCUMMVM-corrupted.INI added

Corrupt ini

comment:1 Changed 7 years ago by digitall

Assigning to the PS2 porter for visibility.

comment:2 Changed 7 years ago by digitall

Owner: set to sunmax

comment:3 Changed 7 years ago by digitall

damumbl: Thank you for reporting this bug.

Please can you test with the earlier versions i.e. v1.4.0, v1.3.1, v1.3.0, v1.2.1 etc. to see if this is a regression or if the PS2 port has always had this latent bug? Going as far back as the first PS2 release i.e. v0.8.0 could be useful:
http://wiki.scummvm.org/index.php/PlayStation_2

comment:4 Changed 7 years ago by sunmax

Hi there Damumbi,

thanks for reporting this!

Now, after we enabled file caching on PS2 in the past (which boosted loading times & gaming experience with titles like COMI) we hit this regression once already.

Back then it affected all write operations to ScummVM.ini.

I thought we fixed it, and it probably was for the cases we tested back then (which was saving the same ScummVM.ini or saving a bigger one, like when you add a new game). To be 100% honest with you, we didn't test the scenario where it gets shorter... so it's possible the regression for this particular case had been around since then.

As David suggested, please if you have a chance run a regression on previous versions, I'd expect this bug to enter the scene with 1.2.0 (IIRC the one where we started caching).

I'm not 100% sure the issue is in PS2 ScummVM code or the underlying file libraries, but we definitely want to find a complete solution to this bug.

I'm currently in travel far from my beloved PS2, but will try to check the code to see if I spot something we missed before.

Thanks!
-max

comment:5 Changed 7 years ago by SF/damumbl

Ok, here's what I found out:

scummvm-0.8.1-ps2: Unable to load module cd...\IOMANX.IRX;1, Error -203a…

scummvm-0.11.1-ps2: Ok, but only reads ini from mc0
scummvm-0.12.0-ps2: Only reads ini from mc0; Doesn't write changes at all (I think)
scummvm-0.13.1-ps2: Reads ini from mass; Corrupt, but differnt I think
scummvm-1.0.0rc1-ps2: Reads ini from mass → Bug
scummvm-1.0.0-ps2: Reads ini from mass → Bug

scummvm-1.4.1-ps2: Reads ini from mass → Bug; Works, if ini on mc!

I now see that there is a fact, I forgot to mention originally: I use a scummvm.ini inside the directory where the elf is on a USB stick. When I saw that the versions that only read the ini from the memory card work perfectly fine, I tested this again without an ini on the USB. It then writes the file to mc0:/ScummVM/ScummVM.ini and it works perfectly fine.

So my conclusion would be, that the bug exists only if you write the ini to USB. Could this be a problem with the file system? I am not too familiar with C/C++ nor the PS2, but I wrote a simple text editor for BeOS once and had the same problem there. I had to either set the file size explicitly after writing or set it to 0 beforehand.

Hope this helps.

comment:6 Changed 5 years ago by digitall

Max: What is the status of this issue?

comment:7 Changed 5 years ago by sunmax

I can't reproduce on my side. I store all my ScummVM.ini and save games on mass and they look fine. Might be the USB device, PS2 is very picky. Or I might be missing something when trying to reproduce the OP configuration.

I would suggest OP tests with 1.5.0 / 1.6.0 as soon as I'm ok'd to upload them. They are ready, just waiting for Sev or Lordhoto to confirm it's ok to scp those release to our download section.

They contain some stack corruption fixes (double free, etc.) which might be the root of some corruption.

Thanks.

comment:8 Changed 16 months ago by csnover

Component: Ports

comment:9 Changed 16 months ago by csnover

Owner: changed from sunmax to csnover
Resolution: worksforme
Status: newclosed

Closing since the previous comment indicates this issue was not reproducible the last time someone tried.

comment:10 Changed 4 months ago by digitall

Component: PortsPort: PS2
Note: See TracTickets for help on using tickets.