Rockbox

Tasklist

FS#7218 - Bitmap version of sliding puzzle

Attached to Project: Rockbox
Opened by Dave Hooper (stripwax) - Saturday, 26 May 2007, 22:58 GMT
Last edited by Nicolas Pennequin (nicolas_p) - Saturday, 26 January 2008, 00:19 GMT
Task Type Patches
Category Games
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

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.


This task depends upon

Closed by  Nicolas Pennequin (nicolas_p)
Saturday, 26 January 2008, 00:19 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed!
Comment by Jonathan Gordon (jdgordon) - Sunday, 27 May 2007, 00:51 GMT
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.

Comment by Dave Hooper (stripwax) - Sunday, 27 May 2007, 12:13 GMT
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?
Comment by Jonathan Gordon (jdgordon) - Sunday, 27 May 2007, 12:21 GMT
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...?
Comment by Dave Hooper (stripwax) - Monday, 28 May 2007, 13:43 GMT
Done.
1. Bmp resizing code moved (well copied) from bmpresize patch to plugins/lib/bmp.ch . 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. 3x3, 4x4 ,5x4, 5x5) rather than hardcoded 5x4 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)
Comment by Dave Hooper (stripwax) - Monday, 28 May 2007, 13:53 GMT
Fixed build error for target.
Comment by Dave Hooper (stripwax) - Monday, 28 May 2007, 14:33 GMT
Fix a few more build errors.
Comment by Dave Hooper (stripwax) - Tuesday, 27 November 2007, 00:14 GMT
Updated:
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

Comment by Dave Hooper (stripwax) - Tuesday, 27 November 2007, 00:26 GMT
Crap, I uploaded the old (from May07) version of the patch rather than the new one. Try again..
Comment by Dave Hooper (stripwax) - Tuesday, 27 November 2007, 00:38 GMT
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 (100x100 or 50x50, etc), sliding_puzzle doesn't.
sliding_puzzle will find the matching blah.bmp files and will ignore blah.100x100.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 100x100 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.100x100.bmp - 100x100 pixels optimised for albumart in wps
cover.bmp - full size image at original resolution (or at most min(lcd_width, lcd_height)^2)
Comment by Dave Hooper (stripwax) - Tuesday, 27 November 2007, 00:54 GMT
Update - put the plugin api addition at the end
Comment by Dave Hooper (stripwax) - Tuesday, 27 November 2007, 00:59 GMT
You still need the default .bmp (in the zip above)
Comment by Dave Hooper (stripwax) - Wednesday, 28 November 2007, 22:27 GMT
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)

Comment by Dave Hooper (stripwax) - Monday, 10 December 2007, 00:41 GMT
Hm. Sync'd because the svn committed additions to plugin api have different names to the ones in my patch..
Comment by Dave Hooper (stripwax) - Sunday, 16 December 2007, 15:11 GMT
Bumper update.
Moved default image to native bitmap in native resolution (unzip sliding_puzzle.zip 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 5x4 to 4x4 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.
Comment by Dave Hooper (stripwax) - Sunday, 16 December 2007, 18:31 GMT
Hm, something is causing aborts on target (ipod video) although sim is ok. For now this cannot be committed.
Comment by Dave Hooper (stripwax) - Sunday, 16 December 2007, 21:35 GMT
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.

Loading...