• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Games
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by midgey34 - 2006-07-15

FS#5664 - Blackjack Plugin

This is a WIP version of Blackjack that I recently looked at again in an attempt to fix as many bugs as I could. The result is less buggy, but still with some issues during splitting. I’ve decided to release this version since I am going away for a few days and thought it best to share my most current code. This version is newer than the version I posted recently in IRC and I fixed up some stupid bugs caused by debug code I had.

New Features:

  • Now supports all current Rockbox targets with bitmap screens. This includes from Recorder and Ondio to newer ports like irivers, iPods, and iAudio X5. Also included is support for Gigabeat and ifp-700.
  • Remote support for iriver h1X0 remotes. This code is untested since I don’t have a remote and may not work properly. The code may not be the proper way to implement remote support and may be stripped if the plugin is added to CVS post-3.0.
  • Now you can bet the minimum
  • The game also remembers your previous bet and defaults to that each time it asks for a new amount


  • When there are more than 3 cards in the second set of cards in a split, it freezes.
  • During a split, sometimes the dealer’s cards are drawn instead of the second split set or vice versa. This bug doesn’t affect gameplay but is certainly annoying.

I’d like bug reports, feature requests, comments, suggestions, concerns, or improvements posted here or at

More detailed information is available in comments at the top of the code. Please read before using as they provide a more in-depth overview than listed here.

Closed by  midgey34
2007-01-17 00:04
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

I committed this in rev 12030.

Jon_ commented on 2006-07-18 20:34

Great Job Mr. Ross! This is such a great plug in love it. Keep it up.

Take Care,

Anyone have any ideas to track down the two remaining bugs? I used logf to output the card values and it seems that some variables in the game_context struct are indeed being overwritten. I tried rearranging the variable order in the game_context struct each resulting in different bugs. Sometimes numbers would go negative or cards would disappear and sometimes the result was a hard lockup.

Here’s the latest version of Blackjack with a switch to external bitmaps and code cleanup. Remote support has been removed and may be added back in later. Also the last two bugs mentioned above should be fixed. Turns out I’m an idiot and forgot how to initialize arrays properly :). Enjoy!

Please could i have a proper .patch/.diff file?

I’ve made a .diff file that I believe includes everything.. so it should work. I’ve also added keymappings for the H10 in the blackjack.c file.. but I’m not sure how good they are. You will have to download the above and place the bitmaps in the correct places, but you do not need to worry about any SOURCES files… the diff file should do that for you.

Here’s the newest version. Some minor bugs were fixed and the drawing routine reworked to be faster and hopefully avoid the occasional flicker. Also included is support for iriver H10 5/6GB and 20GB along with the Sansa e200 and hopefully the Tatung Elio TPJ-1022. The H10 mappings might seem a little strange but should improve when the scrollpad is working better. Hope you all enjoy! Remember, comments are welcome :) .

PS: For anyone wondering, yes, this is a proper patch file. Also, please use posted above (you can ignore the SOURCES stuff).

Could you be persuaded to include a manual section (and screenshots) in the patch?

Also, you should use unix line endings (LF rather than CRLF) for the blackjack.c file.

Another thing, clicking the joystick on the H120 is called Navi (while the define is named BUTTON_SELECT)

All right, I’ll work on correcting those small problems and creating a manual patch. If I have some difficulty, I’ll let you know. For #3, are you referring to the messages displayed when the plugin first runs or something else?

Yes, I was talking about the welcome screen. The manual patch is not a strict requirement, but it’d be nice.

I tried in an Ondio sim and it seems to work well… so I’d like to thank first for making it available to all targets but I have two suggestions:

- The “you win/lose” message is very hard to find (literally) because the “Play again?” splash draws all attention. Maybe you can put this message inside the splash? Or another possibilty could be that only the win/lose info is presented in the splash - a button press leads to the game menu and there one would have an additional quit option.

- (Call me biased)… Would you consider using the new Solitaire graphics? This would need some code rework though as it uses one single bitmap for the entire deck but as I understand Blackjack needs the same cards and you already used the old graphics. But I think the drawing code would benefit from it in the end (should be simpler as it doesn’t have to combine different bitmap parts).

New version of Blackjack (1.5)

1.) Manual patch section and screenshots are included (
2.) Using unix line endings (I think…)
3.) Clicking is referred to as NAVI on the H1X0
4.) A simple looking screen when the hand is over for smaller targets
5.) Changed to solitaire bitmaps
6.) Slight code cleanup
7.) Scales to font size

Hope you all enjoy the changes.

Just wondering, would any dev prefer the code to changed into regular ints instead of specifying signed/unsigned?

The graphics can now scale to various sized fonts but the code is still set to SYS_FONT.

Hopefully the Ondio and Recorder should look better. Let me know your thoughts.

PS: I propose that the solitaire graphics be changed from solitaire_ to card_ since they are now being used in more than one plugin.

(Uploaded new patch without my email address…)

That seems to be CVS material now, nice job.

Blackjack 1.6

Slight change in the “win” messages for Archos; it should look nicer now.

This behaves weird on the H120 sim. No start text and no text in the game screen, just the cards.

Oops, small mistake that is fixed in this patch. Also, Sansa e200 and Gigabeat F have been added to the manual section.

blackjack1.7.patch is the patch file contains the manual graphics that go in /manual/plugins/images

umm…can someone make this into a .rock file?

There was a slight glitch in the last past the messed up the e200 manual. This patch fixes it.

Files Needed for Blackjack:
blackjack1.8.patch - latest patch - image files for building the manual


Available keyboard shortcuts


Task Details

Task Editing