• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Games
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 2
  • Private
Attached to Project: Rockbox
Opened by stripwax - 2007-05-26
Last edited by nicolas_p - 2008-01-26

FS#7218 - Bitmap version of sliding puzzle

Hi, some patches to sliding_puzzle.c to make it more exciting on color screen devices.
1. Use current albumart bmp as the bitmap for the sliding puzzle
2. Fall back on provided (hard!) Rockbox logo puzzle
3. Resize bitmap to fill LCD screen (assumes square)

Now, the way I’ve done this it’s dependent on BOTH the albumart and bmpresize patches, because this is what I wanted when I wrote this patch. But there’s no reason why this couldn’t be reworked further to work on more vanilla builds. Some future ideas
a) A random bmp file could be located on the harddrive (different each time)
b) The bmpresize logic could be reimplemented as part of the plugin api or even coded directly inside sliding_puzzle
c) sliding_puzzle could be merged into the jpeg viewer. Etc.

Closed by  nicolas_p
2008-01-26 00:19
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407


well, because its reliant on AA then its very likely this will sit here for months without being touched, which is a shame because there has been lots of requests to update this plugin.

Can you remove the requirement for AA and bmpresize and possibly do the 3 future ideas instead? btw, if the only requirement on AA is to get the curent AA file, then it shhuold be fairly easy to reimplement that in the plugin anyway, the api has access to the current tracks id3 info and filename.

Updated. 1. No longer depends on AA patch (reimplements the whole albumart locating code) 2. Extended picture toggle to switch between default bmp (.rockbox/backdrops/sliding_puzzle.bmp), albumart bmp, random bmp, numerals. (Random bmp not yet implemented).
Patch still depends on bmpresize patch.
sliding_puzzle still works with only .bmp files. Perhaps it should be a viewer rather than a plugin?

makeing it a viewer plugin would be dead simple, just do a check on the paramater in the entrypoint, if its NULL it was startd manually, if its not then its a filename.

if you really cant get around the bmp resizing, then you will need to put it in the pluginlib…

last suggestion, the default shuold maybe be /.rockbox/rocks/sliding_puzzle.bmp instead of backdrops…?

1. Bmp resizing code moved (well copied) from bmpresize patch to plugins/lib/ . I’ve renamed where necessary to prevent conflicts with the actual bmpresize patch, for those people who still rely on the bmpresize patch.
2. Works as a viewer
3. Default moved to /.rockbox/rocks/sliding_puzzle.bmp
4. Aspect ratio now ignored when resizing (so sliding puzzle is ALWAYS square)
5. Minor bugfixes, so that no playing track doesn’t crash search for albumart

Future ideas:
a) Work with jpegs
b) Easy/Medium/Hard/Very Hard settings to define the number of puzzle blocks (e.g. 3×3, 4×4 ,5×4, 5×5) rather than hardcoded 5×4 currently used.

The attached zip contains the sliding puzzle patch AND the move of the resize code to the pluginlib. I don’t see any point in separating these two patches (why would one be accepted but not the other)

Fixed build error for target.

Fix a few more build errors.

1. Uses the albumart implementation now in SVN (so I’ve ripped out the old albumart patch pieces from sliding_puzzle)
2. Exposes the previously static albumart “search_files” function as a more public “albumart_search_files” function (declared in recorder/albumart.h)
3. Moves default sliding_puzzle bitmap to the .rockbox/rocks/games directory
4. When launched as a viewer, no longer displays help/title splash, just launches straight into the bitmap viewer / shuffled puzzle

Crap, I uploaded the old (from May07) version of the patch rather than the new one. Try again..

Just a note on how best to use this in conjunction with albumart (probably).
Whereas album art knows in advance what size image you need (100×100 or 50×50, etc), sliding_puzzle doesn’t.
sliding_puzzle will find the matching blah.bmp files and will ignore blah.100×100.bmp files, for simplicity (arguably it could try and find any/all bmps with the correct name ignoring for dimension information in the filename, and selecting the most appropriate resolution from those found, but this would be a future extension)
sliding_puzzle will resize any image it finds to a scale appropriate for the full screen, however (unlike the wps albumart bmp, which is not resized in svn code).

If you have all your 100×100 images saved as e.g. cover.bmp then both wps albumart and sliding_puzzle albumart will load them just fine, although the image will be scaled up to full screen when playing the sliding_puzzle, which might look gash.

For best effects then, you probably want to save
cover.100×100.bmp - 100×100 pixels optimised for albumart in wps
cover.bmp - full size image at original resolution (or at most min(lcd_width, lcd_height)^2)

Update - put the plugin api addition at the end

You still need the default .bmp (in the zip above)

More updates
1. Makes the ‘blank’ tile prominent on 2bpp targets (e.g. h120)
2. Sliding pieces scroll smoothly on all targets
3. ‘Help’ text includes controls for all targets (or at least many more devices show key controls now compared to the svn revision – maybe not all still)
4. Targets that don’t “HAVE_ALBUMART” still run bitmap sliding_puzzle, just don’t have the option to view albumart bitmap - only default puzzle bitmap or numerals (or bitmap supplied when run as viewer)

Hm. Sync’d because the svn committed additions to plugin api have different names to the ones in my patch..

Bumper update.
Moved default image to native bitmap in native resolution (unzip into apps/plugins/bitmaps/native ).
1bpp bitmap lcd targets now also catered for (sliding_puzzle works as a bitmap viewer for those targets too now).
Changed puzzle grid from 5×4 to 4×4 for other targets, for simplicity.
Now using simple resizing that is now available in plugin lib - all resizing code removed from this plugin and replaced with regular api calls.

Hm, something is causing aborts on target (ipod video) although sim is ok. For now this cannot be committed.

Fixed. Creating the temporary buffer for bitmap resizing on stack was blowing up. Random crashing due to too much stack usage? Bad. Use same bitmaps zip as previous revision.


Available keyboard shortcuts


Task Details

Task Editing