Planet maemo: category "feed:218abbb3f30ed17e36476558d8bce9b5"

Enrique Ocaña González

Cat’s Panic

2023-01-06 03:32 UTC  by  Enrique Ocaña González
0
0

It’s been 8 years since the last time I wrote a videogame just for personal fun. As it’s now become a tradition, I took advantage of the extra focused personal time I usually have on the Christmas season and gave a try to Processing to do my own “advent of code”. It’s a programming environment based on Java that offers a similar visual, canvas-based experience to the one I enjoyed as a child in 8 bit computers. I certainly found coding there to be a pleasant and fun experience.

So, what I coded is called Cat’s Panic, my own version of a known arcade game with a similar name. In this version, the player has to unveil the outline of a hidden cute cat on each stage.

The player uses the arrow keys to control a cursor that can freely move inside a border line. When pressing space, the cursor can start an excursion to try to cover a new area of the image to be unveiled. If any of the enemies touches the excursion path, the player loses a life. The excursion can be canceled at any time by releasing the space key. Enemies can be killed by trapping them in a released area. A stage is completed when 85% of the outline is unveiled.

Although this game is released under GPLv2, I don’t recommend anybody to look at its source code. It breaks all principles of good software design, it’s messy, ugly, and it’s only purpose was to make the developing process entertaining for me. You’ve been warned.

I’m open to contributions in the way of new cat pictures that add more stages to the already existing ones, though.

You can get the source code in the GitHub repository and a binary release for Linux here (with all the Java dependencies, which weight a lot).

Meow, enjoy!

Categories: Hacking (english)
Enrique Ocaña González

Beyond Google Bookmarks

2021-08-07 12:29 UTC  by  Enrique Ocaña González
0
0

I was a happy user of Del.icio.us for many years until the service closed. Then I moved my links to Google Bookmarks, which offered basically the same functionality (at least for my needs): link storage with title, tags and comments. I’ve carefully tagged and filed more than 2500 links since I started, and I’ve learnt to appreciate the usefulness of searching by tag to find again some precious information that was valuable to me in the past.

Click to read 1098 more words
Categories: Hacking (english)
Enrique Ocaña González

This is the last post of the series showing interesting debugging tools, I hope you have found it useful. Don’t miss the custom scripts at the bottom to process GStreamer logs, help you highlight the interesting parts and find the root cause of difficult bugs. Here are also the previous posts of the series:

Click to read 1502 more words
Categories: Gnome
Enrique Ocaña González

In this new post series, I’ll show you how both existing and ad-hoc tools can be helpful to find the root cause of some problems. Here are also the older posts of this series in case you find them useful:

Use strace to know which config/library files are used by a program

If you’re becoming crazy supposing that the program should use some config and it seems to ignore it, just use strace to check what config files, libraries or other kind of files is the program actually using. Use the grep rules you need to refine the search:

$ strace -f -e trace=%file nano 2> >(grep 'nanorc')
access("/etc/nanorc", R_OK)             = 0
access("/usr/share/nano/javascript.nanorc", R_OK) = 0
access("/usr/share/nano/gentoo.nanorc", R_OK) = 0
...

Know which process is killing another one

First, try to strace -e trace=signal -p 1234 the killed process.

If that doesn’t work (eg: because it’s being killed with the uncatchable SIGKILL signal), then you can resort to modifying the kernel source code (signal.c) to log the calls to kill():

SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
{
    struct task_struct *tsk_p;
    ...
    /* Log SIGKILL */
    if (sig & 0x1F == 9) {
        tsk_p = find_task_by_vpid(pid);

        if (tsk_p) {
            printk(KERN_DEBUG "Sig: %d from pid: %d (%s) to pid: %d (%s)\n",
                sig, current->pid, current->comm, pid, tsk_p->comm);
        } else {
            printk(KERN_DEBUG "Sig: %d from pid: %d (%s) to pid: %d\n",
                sig, current->pid, current->comm, pid);
        }
    }
    ...
}

Wrap gcc/ld/make to tweak build parameters

If you ever find yourself with little time in front of a stubborn build system and, no matter what you try, you can’t get the right flags to the compiler, think about putting something (a wrapper) between the build system and the compiler. Example for g++:

#!/bin/bash
main() {
    # Build up arg[] array with all options to be passed
    # to subcommand.
    i=0
    for opt in "$@"; do
        case "$opt" in
        -O2) ;; # Removes this option
        *)
            arg[i]="$opt" # Keeps the others
            i=$((i+1))
            ;;
        esac
    done
    EXTRA_FLAGS="-O0" # Adds extra option
    echo "g++ ${EXTRA_FLAGS} ${arg[@]}" # >> /tmp/build.log # Logs the command
    /usr/bin/ccache g++ ${EXTRA_FLAGS} "${arg[@]}" # Runs the command
}
main "$@"

Make sure that the wrappers appear earlier than the real commands in your PATH.

The make wrapper can also call remake instead. Remake is fully compatible with make but has features to help debugging compilation and makefile errors.

Analyze the structure of MP4 data

The ISOBMFF Box Structure Viewer online tool allows you to upload an MP4 file and explore its structure.

Categories: Gnome
Enrique Ocaña González

This is the last post on the instrumenting source code series. I hope you to find the tricks below as useful as the previous ones.

Click to read 1142 more words
Categories: Gnome
Enrique Ocaña González

In this post I show some more useful debugging tricks. Check also the other posts of the series:

Click to read 1322 more words
Categories: Gnome
Enrique Ocaña González

This is the continuation of the GStreamer WebKit debugging tricks post series. In the next three posts, I’ll focus on what we can get by doing some little changes to the source code for debugging purposes (known as “instrumenting”), but before, you might want to check the previous posts of the series:

Click to read 1370 more words
Categories: Gnome
Enrique Ocaña González

This post is a continuation of a series of blog posts about the most interesting debugging tricks I’ve found while working on GStreamer WebKit on embedded devices. These are the other posts of the series published so far:

Click to read 1634 more words
Categories: Gnome
Enrique Ocaña González

I’ve been developing and debugging desktop and mobile applications on embedded devices over the last decade or so. The main part of this period I’ve been focused on the multimedia side of the WebKit ports using GStreamer, an area that is a mix of C (glib, GObject and GStreamer) and C++ (WebKit).

Click to read 1078 more words
Categories: Gnome
Enrique Ocaña González

If you’re developing C/C++ on embedded devices, you might already have stumbled upon a corrupt stacktrace like this when trying to debug with gdb:

Click to read 2822 more words
Categories: Hacking (english)
Enrique Ocaña González

Shishen Sho compiled for N900

2010-02-21 02:11 UTC  by  Enrique Ocaña González
0
0

I’ve recalled about my old Shishen Sho game, originally developed for N810 (Maemo4) and I was wondering if it would compile for N900 (Maemo5). Well, after some minor corrections to make it work in a more recent version of Vala, it compiled. You can downloaded it here:

https://garage.maemo.org/frs/download.php/7573/shishensho_0.3.1-maemo5_armel.deb

Disclaimer: It’s compiled “as is”, with no adaption for sliding menus, no new hardware keys and no new fancy features. It just works and will let you have a good time while waiting for the bus.

Categories: Gnome
Enrique Ocaña González

Some simple steps to do tethering over bluetooth to connect to Yoigo Spanish carrier:

  1. Enable the Maemo Extras-devel catalog (URL: http://repository.maemo.org/extras-devel, Distribution: fremantle, Components: free non-free) and install “Bluetooth Dial-up Networking”.
  2. In your computer, edit /etc/bluetooth/rfcomm.conf to look like this, but using your own bluetooth device address (use hcitool scan from your laptop to get it):
    rfcomm1 {
            # Automatically bind the device at startup
            bind yes;                                 
    
            # Bluetooth address of the device
            device 00:11:22:33:44:55         
    
            # RFCOMM channel for the connection
            channel 2;                         
    
            # Description of the connection
            comment "N900";
    }
    

    Channels 1 and 3 are also available and can be defined as rfcomm0 and rfcomm2, but the scope of that is out of this post.

  3. Now edit the file /home/youruser/.wvdialrc in your laptop (using your own username) to look like this:
    [Dialer YoigoBT]
    init1 = AT+CGDCONT=1,"IP","internet"
    Username = ''
    Password = ''
    Modem = /dev/rfcomm1
    Phone = *99#
    

To connect to the internet, simply open a terminal and type:

sudo wvdial YoigoBT

To disconnect, just press CTRL+c and it’s done.

Thanks to this post, which was used as a reference on how to connect using Nokia devices.

Categories: Hacking (english)