Order it now! Amazon prioritizes orders on a first come, first served basis.


View Full Version : GTKSudoku Application Release


Adam B.
11-06-2008, 06:14 PM
I've ported a Sudoku application for the DR1000.

This is definitely a cool application if you do Sudoku. You can generate new puzzles, or use some that have already been created. It has buttons to check if you have any errors, and also to solve the puzzle for you.

I can create regular 9x9 puzzles, and also the crazy large 16x16. It does take a little while to generate the 16x16 board and puzzle, so have patience the first time you select that.

To install: Unzip Sudoku.zip to the root of your SD card. For example, if your SD card shows up as the E:\ drive on your computer, you should have an E:\Programs folder after you unzip it.

After installing, you'll be able to select the Sudoku icon from the Documents/Programs folder on your device. From there you can press new for a new puzzle, or open to open an existing.

Note: the keyboard is off in the screenshot because it's running in the emulator. On the DR, the full keyboard is visible.

I did modify the sources a bit from the original program (http://sourceforge.net/projects/gtk-sudoku/), so I've attached those as well.

allovertheglobe
11-06-2008, 06:28 PM
Works, no problem. Not much good at Sudoku myself :p. Is it normal for the shortcut icon to be the same as FBReader's? (I moved the shortcut to the desktop, though)

Adam B.
11-06-2008, 06:57 PM
Works, no problem. Not much good at Sudoku myself :p. Is it normal for the shortcut icon to be the same as FBReader's? (I moved the shortcut to the desktop, though)

Yeah it is. I still haven't found a way to setup custom icons. I suspect that's a feature iRex will have to add.

allovertheglobe
11-06-2008, 08:27 PM
Yeah it is. I still haven't found a way to setup custom icons. I suspect that's a feature iRex will have to add.
(Slightly O.T.) Probably. As I found out a while ago (http://www.mobileread.com/forums/showthread.php?t=31107) they are stored in the metadata.db of a given folder where the file/shortcut is located, rather than in the file/shortcut itself, which makes moving them around pretty much impossible.

On the upshot, it may be possible to decode that part of the metadata.db (as the scribble part already has) and write a (python) script to generate a metadata.db as a starting point.

Isamu
11-06-2008, 09:04 PM
I'm still waiting for my DR to be shipped, but I was hoping that some kind soul would port this! THANK YOU SO MUCH!

Matthijs
11-07-2008, 03:47 AM
On the upshot, it may be possible to decode that part of the metadata.db (as the scribble part already has) and write a (python) script to generate a metadata.db as a starting point.

We use the following script, should run on the device as well:

add_icons_to_database.sh

#!/bin/sh

set -e # exit on error

die()
{
echo "--- $*"
exit 1
}

if [ $# -le 1 ]
then
die "Must specify database as first parameter."
fi
database="$1"
shift

if [ $# -le 1 ]
then
die "Must specify sort_priority as second parameter."
fi
sort_prio="$1"
shift

for file in $*
do
filename="$file"
file_type="${file##*.}"
file_size=`stat -c '%s' $filename`
file_time=`stat -c '%Y' $filename`
sqlite3 "$database" "insert into file_metadata (filename, file_type, file_size, file_last_modified, sort_priority, is_directory) values ('$file', '$file_type', $file_size, $file_time, $sort_prio, 0);"
sort_prio=`expr $sort_prio - 1`

file_id=`sqlite3 "$database" "select file_id from file_metadata where filename='$filename';"`
sqlite3 "$database" "insert into thumbnails (file_id) values ($file_id);"

for size in mini small medium large
do
bitmap_file=`basename "$filename" ".$file_type"`
bitmap_file="icon-${bitmap_file}-${size}.png"
if [ -f "$bitmap_file" ]
then
column="thumb_data_$size"
hexdump=`hexdump -v -e '/1 "%02x"' "$bitmap_file"`
# hexdump=`od --output-duplicates --format=x1 --width=4 "$bitmap_file" | awk '{ printf("%s%s%s%s", $2, $3, $4, $5) }'`
sqlite3 "$database" "update thumbnails set $column = x'$hexdump' where file_id = $file_id;"
fi
done
done




On topic: nice app, now move the top icons into the Popup Menu and we can ship it in the standard software ;)

Mambo
11-07-2008, 04:08 AM
Is it full-screen? :)

patatan
11-07-2008, 04:58 AM
Thanks:)

Adam B.
11-07-2008, 07:06 AM
On topic: nice app, now move the top icons into the Popup Menu and we can ship it in the standard software ;)

Thanks for the script, I'll have to add it in the next release.

I need to do more testing with hello_world. I still haven't got the menu to work in there.

Gertjan
11-07-2008, 01:06 PM
I need to do more testing with hello_world. I still haven't got the menu to work in there.
The application uses the package name (hello-world) for its ipc service but a hyphen is not allowed in the dbus namespace. Try to change the package name or DBUS_APPL_NAME define in ipc.c. Now the popup menu should be filled with items.

Adam B.
11-07-2008, 01:15 PM
The application uses the package name (hello-world) for its ipc service but a hyphen is not allowed in the dbus namespace. Try to change the package name or DBUS_APPL_NAME define in ipc.c. Now the popup menu should be filled with items.

Yes! :iloveyou: :thumbsup: :2thumbsup :thanks:

That did it! Now it looks like I have some work to do. ;)

Thanks!

ProDigit
11-07-2008, 02:43 PM
WOW!
I would LOVE to have that on my Sony PRS-505 :(...

Still wonderful that a game like this is available for the Iliad!

DaleDe
11-08-2008, 06:08 PM
WOW!
I would LOVE to have that on my Sony PRS-505 :(...

Still wonderful that a game like this is available for the Iliad!

I believe you can have it on your Sony. It was done there first as I recall. Check the developers forum in the Sony group.

Dale

obelix
11-09-2008, 01:21 AM
WOW!
I would LOVE to have that on my Sony PRS-505 :(...

Still wonderful that a game like this is available for the Iliad!

For PRS 500 and 505:

http://www.msh-tools.com/ebook/sudoku.html

ProDigit
11-09-2008, 10:49 AM
Thanks for the link!
I'll test it out one of these days!

Mackx
02-12-2009, 04:31 PM
I tried to make the Sudoku app ported by Adam more 'Native' by adding a menu in the popupmenu and to get an icon in the 'task-list' so I would be able to get back to a sudoku after reading some time.

It should mainly be used as an example, since the code is a merge between the original sudoku source (as Adam provided) and the hello-world code from iRex. It contains lots of unused code that I did not yet clean up.

The zip-file contains the original program (Sudoku) and the 'enhanced' version (Sudoku2). The source code contains only the minimal files, you should be able to compile it with the Ajunta-IDE (make sure to enable the Poky-plugin before AutoConfiguring).
The app is 'Deployed' into /usr/bin, so copy it to Programs or run it from there in the emulator.

Hope someone finds the example code usefull for porting his program.

Adam B.
02-12-2009, 04:55 PM
I tried to make the Sudoku app ported by Adam more 'Native' by adding a menu in the popupmenu and to get an icon in the 'task-list' so I would be able to get back to a sudoku after reading some time.

It should mainly be used as an example, since the code is a merge between the original sudoku source (as Adam provided) and the hello-world code from iRex. It contains lots of unused code that I did not yet clean up.

The zip-file contains the original program (Sudoku) and the 'enhanced' version (Sudoku2). The source code contains only the minimal files, you should be able to compile it with the Ajunta-IDE (make sure to enable the Poky-plugin before AutoConfiguring).
The app is 'Deployed' into /usr/bin, so copy it to Programs or run it from there in the emulator.

Hope someone finds the example code usefull for porting his program.

Brilliant! I attempted to do this, but never got it working quite right. I'll have to dig through this when I have a chance.

:thanks:

ProDigit
02-13-2009, 12:21 AM
I tried the sudoku game a while ago, but forgot to give feedback here.
Is this the sudoku for SD cards?
The only hard thing I found for the Sony PRS-505 that there was no way to exit the sudoku game, apart from removing the card.
or,at least, I couldn't read books and pop in the SD card,without having the Sudoku screen pop up.
Like,sometimes I just want to read a book stored on the card...

allovertheglobe
02-13-2009, 01:55 AM
I tried the sudoku game a while ago, but forgot to give feedback here.
Is this the sudoku for SD cards?
The only hard thing I found for the Sony PRS-505 that there was no way to exit the sudoku game, apart from removing the card.
or,at least, I couldn't read books and pop in the SD card,without having the Sudoku screen pop up.
Like,sometimes I just want to read a book stored on the card...
It's on the SD card like all current add-ons, but things work quite differently on the DR1000 compared to the Sony PRS505. No application starts automatically unless it is designed that way, and this hasn't happened so far. This Sudoku version certainly doesn't based on my experience.

Keep in mind that the development of these apps is done using the official SDK with the blessing of iRex who released almost all the sources. Unlike Sony who doesn't support any development and all current modifications are "hacks" (as well as they may work), at least the last time I checked. Personally, I only use my PRS505 only for reading and have given up on 3rd party stuff a long time ago.

allovertheglobe
02-13-2009, 01:58 AM
Played around with the version 2, nice! A big step towards better integration with the DR1000 interface.

I noticed that it has its own empty toolbar, and you can drag the icons over, but they do not appear (the slot remains black).

However when you click on them, they actually work as intended... one little bug to sort out. It's kinda hard to remember which slot does what when they are all black :D

Mackx
02-13-2009, 02:44 AM
I noticed that it has its own empty toolbar, and you can drag the icons over, but they do not appear (the slot remains black).

However when you click on them, they actually work as intended... one little bug to sort out. It's kinda hard to remember which slot does what when they are all black :D

I also noticed that the icons did not appear, but didn't notice that they still worked. I will try to figure out how this works. Thanks.

Mackx
02-13-2009, 03:00 AM
Brilliant! I attempted to do this, but never got it working quite right. I'll have to dig through this when I have a chance.


Thanks,
Its not that difficult, the hello-world example is self explaining. Your VMWare development environment also helped to get this done quickly, thanks for that!

Mackx
02-13-2009, 03:30 AM
I also noticed that the icons did not appear, but didn't notice that they still worked. I will try to figure out how this works. Thanks.

Mmmm, I notice in the popupmenu/src/toolstore.c that the code puts "toolbar_" in front of the path to the icon. Since I use a full-path, this will not work....

I saw Adam made a patch to the ctb somewhere so I should be able to figure out how to update 'system-components', if I find some time I could make a patch.

Or anyone else?

ProDigit
02-14-2009, 12:08 PM
No application starts automatically unless it is designed that way, and this hasn't happened so far.

Then I must be mistaken.
I played a sudoku that auto-booted upon inserting the SD card.

allovertheglobe
02-14-2009, 03:30 PM
Then I must be mistaken.
I played a sudoku that auto-booted upon inserting the SD card.
On the iRex DR1000S?

ProDigit
02-16-2009, 02:24 PM
PRS-505