FS#11031 - Brickmania: Game doesn't load well

Attached to Project: Rockbox
Opened by Tomer Shalev (tomers) - Wednesday, 17 February 2010, 05:57 GMT
Last edited by Tomer Shalev (tomers) - Wednesday, 17 February 2010, 07:00 GMT
Task Type Bugs
Category Plugins
Status Assigned
Assigned To Tomer Shalev (tomers)
Operating System Cowon D2
Severity Low
Priority Normal
Reported Version Release 3.4
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


When loading a saved Brickmania game, the game is loaded corrupted. Please see screenshot attached to see for yourself. There is one brick in the right side which is shown corrupted, and one corrupted rectangle in the left side of the screen which drops like a power object, and stays at the bottom of the screen.

This issue happens on Cowon D2 target. It doesn't happen on the D2's simulator.

Looking at the code and comparing the loading/saving function against the Bubble's game functions, I can see that the return value of file operations is not checked (I'll fix that).
In Bubbles, there's a single file operation of reading/writing the game context struct. In Brickmania there are several consequent file operation to read/write each variable. Maybe the drivers doesn't handle this well on this target. A workaround for that could possibly be to join all saved variables under one game context struct as in Bubbles, but that could mask a real bug somewhere else.
This task depends upon

Comment by amaury pouly (pamaury) - Thursday, 18 February 2010, 09:41 GMT
Does it happen only the D2 ?
Did a recent commit broke this or it just went unoticed to now ?
Comment by Tomer Shalev (tomers) - Thursday, 18 February 2010, 21:53 GMT
> Does it happen only the D2 ?
Sansa Fuze seems to successfully save and load game state.

Did a recent commit broke this or it just went unnoticed to now?
I've seen this in a while. It never worked for me, but I didn't follow brickmania from the beginning of it.
Comment by Tomer Shalev (tomers) - Friday, 19 February 2010, 00:04 GMT
The following patch is a workaround for D2.
One possibility for this bug is that consequent rb->write() calls don't work as expected. I am clueless as to the cause of this bug.