(cross)Compiling for Nokia 770 / N800 Tablets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pupnik
    Rookie
    • Oct 2007
    • 5

    (cross)Compiling for Nokia 770 / N800 Tablets

    Hello...

    Buildling 3.0.9 (and for testing, svn) in various modes in scratchbox/maemo for Nokia 770 (and Dawnmist on N800 -- ~waves~)

    Ncurses: builds with ncurses 5.4 using the "bool hack" in
    src/autoconf.h.in

    /* Define to 1 if stdbool.h conforms to C99. */
    /* #undef HAVE_STDBOOL_H */

    SDL:

    [sbox-SB_Arm2: ~/Angband/angband-3.0.9] > ./configure --with-setgid=29999 --disable-x11 --enable-sdl --enable-sdl-mixer && make
    main-sdl.c:3389: error: structure has no member named `current_w'
    main-sdl.c:3390: error: structure has no member named `current_h'


    (edit) just hacked main-sdl.c to device's native resolution

    full_w = 800;
    full_h = 480;
    //full_w = VideoInfo->current_w;
    //full_h = VideoInfo->current_h;



    GTK:

    [sbox-SB_Arm2: ~/Angband/angband-3.0.9] > ./configure --with-noinstall --disable-x11 --disable-sdl --disable-sdl-mixer --enable-gtk && make
    ...
    main-gtk.c:47: error: syntax error before "cairo_t"
    main-gtk.c:47: warning: no semicolon at end of struct or union
    main-gtk.c:65: error: syntax error before '}' token
    main-gtk.c: In function `set_foreground_color':
    main-gtk.c:116: error: dermain-gtk.c:120: error: dereferencing pointer to incomplete type
    main-gtk.c:121: warning: implicit declaration of function `cairo_set_source_rgb'
    main-gtk.c:121: error: dereferencing pointer to incomplete type
    main-gtk.c: At top level:
    main-gtk.c:146: error: syntax error before '*' token
    main-gtk.c: In function `c_rect':
    main-gtk.c:148: warning: implicit declaration of function `cairo_rectangle'
    main-gtk.c:148: error: `cr' undeclared (first use in this function)
    main-gtk.c:148: error: (Each undeclared identifier is reported only once
    main-gtk.c:148: error: for each function it appears in.)
    main-gtk.c:148: error: `r' undeclared (first use in this function)
    main-gtk.c: In function `Term_clear_gtk':
    main-gtk.c:161: error: dereferencing pointer to incomplete type

    // further incomplete type errors baleeted //

    main-gtk.c:166: warning: implicit declaration of function `cairo_save
    main-gtk.c:173: warning: implicit declaration of function `cairo_restore'
    main-gtk.c: In function `Term_text_gtk':
    main-gtk.c:237: warning: implicit declaration of function `cairo_move_to'
    main-gtk.c:238: warning: implicit declaration of function `pango_cairo_show_layout'1: warning: implicit declaration of function `cairo_close_path'
    ...main-gtk.c: In function `init_gtk':
    main-gtk.c:1214: error: invalid use of undefined type `struct term_data'
    main-gtk.c:1227: error: invalid use of undefined type `struct term_data'
    main-gtk.c: At top level:
    main-gtk.c:71: error: storage size of `data' isn't known
    make[2]: *** [main-gtk.o] Error


    the x11 build makes no sense for the nokia, as it's a gtk/hildon based device - but SDL is a reasonable option if an alternate input method is built (onscreen buttons).

    Will look into this cairo problem - thought the core devs should know about the sdl issue, as that appears to be internal to angband.

    Cheers!
    Last edited by pupnik; October 1, 2007, 09:50. Reason: added a /
  • Dawnmist
    Rookie
    • Oct 2007
    • 23

    #2
    Testing 3.0.9 on N800:
    1. Sound works in both ncurses and sdl - turn it on with "=" menu option 1-a
    2. Mouse movement works in sdl - turn it on with "=" menu option 1-k
    3. Full menu options are available using the square button in the middle of the DPad. Pointer taps work in the menus to select items, a second tap will select/toggle an option.
    4. ESC key works in sdl.
    5. ncurses *can* work with the on-screen keyboard if the terminal is in full-screen mode. Use the enhanced osso-xterm and font settings of Sans-bold-10 pt font.
    6. SDL can be put into full-screen mode. Image will only scale up if you select a larger font in the menu across the top.
    7. Dpad works for horizontal/vertical movement in sdl.
    8. All graphics tile options work in the sdl version.

    Things not working:
    1. SDL mode opens angband, but doesn't add it to the menu of running apps - so if you tab away, you cannot get back to it.
    2. The sizing of the window is strange - if you enlarge the font to maximise the display of the map, the status bar is off-screen even though there's plenty of space to have it on-screen. The gap between the bottom of the map and the status bar is too large.
    3. In ncurses, the on-screen keyboard's keypad is upside-down (123 at top instead of at bottom). This makes key movement strange (keep trying to move 'up', and move 'down' instead).
    4. Escape key doesn't work in ncurses mode - use ` instead.
    5. Menu options that require an input value (such as the hitpoint warning &#37 are not possible to input in the sdl version - you can select them, but since there's no keyboard at that point in time you can't enter the value. An external keyboard is a work-around, as is manually modifying your pref file *outside* the game.
    6. You can't run past a shop with the pointer without it taking you into the shop? Seems to pull you in all the time rather than running past it.
    7. SDL menus for things like "Wear/wield item" bring up the normal prompt for selection - with no ability to select '*' or type, you can't actually select anything. Like the numerical options, these need to display a list of things that are pointer-selectable by default.

    Things that would be nice to get working:
    1. A modifier key to switch the dpad into diagonal movement?
    2. All 'prompt to select' items to provide a chooser menu by default in SDL mode.
    3. Ability to turn off the mouse icon displayed when the user taps the screen with the pointer.


    Testing an svn build:
    1. Currently won't compile - there's files #include'ing wizard.h, and wizard.h doesn't exist (yet?).
    Last edited by Dawnmist; October 1, 2007, 11:29.

    Comment

    • takkaria
      Veteran
      • Apr 2007
      • 1951

      #3
      Originally posted by pupnik
      Will look into this cairo problem - thought the core devs should know about the sdl issue, as that appears to be internal to angband.
      The SDL problem is because you're not using a recent enough version of the SDL library. 1.2.10 is the version which added those members.
      takkaria whispers something about options. -more-

      Comment

      • Dawnmist
        Rookie
        • Oct 2007
        • 23

        #4
        Latest version of sdl available for maemo (Nokia N770/N800) is 1.2.8 - so short of compiling our own sdl libraries, we won't have the 1.2.10 library to work with.

        At least good to know why that was missing though.

        Is there anything else specific that is likely to trip us up in working with the older library? At this stage, things seem to work ok provided we replace those calls with the actual resolution of the screens we're working with (which are always a known, fixed-size).

        Comment

        • pupnik
          Rookie
          • Oct 2007
          • 5

          #5
          for adding a sdl virtual keyboard i was thinking, either

          1) hack-in the keyboard on a per-game basis

          add code near the start of sdl_HandleMouseEvent(SDL_Event *event) to detect if leftmouse button pressed within the keyboard area rectangle, then jump to subroutine and calculate key pressed...

          if ( abs(event.button.x-A_BTN_X) <= BTN_WID &&
          abs(event.button.y-A_BTN_Y) <= BTN_HGT)
          {
          event->type = SDL_KEYDOWN;
          event->key.type = SDL_KEYDOWN;
          event->key.keysym.unicode = 0;
          event->key.keysym.scancode = 0;
          event->key.keysym.sym = SDLK_i; // the 'a' key
          event->key.keysym.mod = KMOD_NONE;
          }
          // handling mouseup properly is a bit trickier

          2) eventually write code that could be linked-in to any sdl game with a resizable display - that overrode SDL_ProcessEvent, checking first to see if mousebuttondowns are hitting an 'on top' (non-minimized) onscreen virtual keyboard, then passing it on to the regular ProcessEvent.

          Mind muddy...

          Comment

          • Dawnmist
            Rookie
            • Oct 2007
            • 23

            #6
            Working on getting a deb file together for a system-wide install on the N770/N800.

            Progress so far:
            1. Deb is building
            2. Workaround for font files being opened in write-only mode when testing for existance (code's already changed in svn) for sdl version
            3. Workaround for graphics tileset files being opened in write-only mode when testing for existance
            4. Deb installs and creates menu item
            5. angband can be run from a terminal window
            6. angband not yet working when run from menu item
            7. sdl mode permit the user to select a tileset to use, but shows only ascii still
            8. angband still not being listed in the 'running programs' menus (so if you tab away, you can't get back)


            Current state of the deb prep is at http://www.dawnmist.net/angband/angb...o-devel.tar.gz

            Comment

            • pupnik
              Rookie
              • Oct 2007
              • 5

              #7
              ONScreen keyboard, 20x20 tiles, sdl fixups

              Haven't had time to get into the sdl main much lately - sorry - working on xu4 right now (easier main loop!)

              Would you want the onscreen keyboard to popup above the display, or resize the game window?

              Edit - oh yeah i need to run a script to generate an overlay png for the tileset so i can verify monster/item names. If any angband illuminatus could point me to how to calculate tile offsets for each object, i'd appreciate it.

              Comment

              • Dawnmist
                Rookie
                • Oct 2007
                • 23

                #8
                Would depend on how we're planning to implement it (and what's easiest to get going to start with).

                If it's only to come on-screen when the game is requesting input (e.g. "how many", "which item", etc), then a pop-up over the top is fine.

                If we're planning on being able to use it as well as the stylus for normal play, then it'd need to sit across the bottom of the screen and have the main part of the screen resized to fit. Or we could add a 'show/hide keyboard' button/menu/whatever that toggles this across the bottom of the screen.

                svn angband is compiling again - there's been changes in that to support more flexible interface implementation - don't know if those would help us here?

                Although I tried compiling and using the svn version late last night - it compiled, but the ncurses version (didn't try sdl) gets to the part where it's creating a savefile, says it has to overwrite an existing savefile (there wasn't any!) and then seems to hang. Didn't have time to try to track that one any further then.

                Edit: It's definitely hanging - and does so on my main machine as well as the N800. I get to the last step in character creation - pick a name, then it tries to create the save file. It then warns that it will have to overwrite the "existing" savefile (which doesn't exist), and after you say 'y'es overwrite, it hangs on "Please wait".

                So I think svn is still broken - but in another way now *grins*
                Last edited by Dawnmist; October 4, 2007, 12:11.

                Comment

                • takkaria
                  Veteran
                  • Apr 2007
                  • 1951

                  #9
                  Originally posted by Dawnmist
                  svn angband is compiling again - there's been changes in that to support more flexible interface implementation - don't know if those would help us here?
                  Those changes aren't far enough ahead yet to be of any use to you -- but they were made with exactly this kind of flexibility in mind.

                  It's definitely hanging - and does so on my main machine as well as the N800. I get to the last step in character creation - pick a name, then it tries to create the save file. It then warns that it will have to overwrite the "existing" savefile (which doesn't exist), and after you say 'y'es overwrite, it hangs on "Please wait".
                  I reproduce the prompt OK, but no hang here. Please checkout a clean version of the game and recompile, see if it still happens. If so, please give details of your OS and toolset used to compile. Ta.
                  takkaria whispers something about options. -more-

                  Comment

                  • Dawnmist
                    Rookie
                    • Oct 2007
                    • 23

                    #10
                    Please checkout a clean version of the game and recompile, see if it still happens. If so, please give details of your OS and toolset used to compile. Ta.
                    Target OS is Internet Tablet OS 2007 ('maemo' linux, 'bora' release), which is on an embedded ARM processor. The toolchain is a scratchbox install for maemo 3.2/Nokia N800 - set up according to the instructions in the maemo development howto and compiling with the ARMEL target (scratchbox hosted inside an Ubuntu Feisty machine).

                    I'll update the svn source this evening and give it another go tonight

                    Edit: just verified the source against svn - I was using revision 610 (latest revision), and the only changes were to set the screen size & the ncurses bool:
                    Index: src/main-sdl.c
                    ================================================== =================
                    --- src/main-sdl.c (revision 610)
                    +++ src/main-sdl.c (working copy)
                    @@ -3400,8 +3400,10 @@
                    /* Require at least 256 colors */
                    if (VideoInfo->vfmt->BitsPerPixel < 8) quit(format("This %s port requires lots of colors.", VERSION_NAME));

                    - full_w = VideoInfo->current_w;
                    - full_h = VideoInfo->current_h;
                    + full_w = 800;
                    + full_h = 480;
                    + //full_w = VideoInfo->current_w;
                    + //full_h = VideoInfo->current_h;

                    /* Use a software surface - A tad inefficient, but stable... */
                    vflags |= SDL_SWSURFACE;
                    And the commenting-out of
                    #undef HAVE_STDBOOL_H
                    in src/autoconf.h.in

                    So that is with the current version/etc, and as clean as possible with the SDL version limitations we're working with. It hangs in both the SDL and console modes at that point.

                    It seems strange that it thinks it needs to overwrite an existing savefile when there is NO existing file...it also won't respond to Ctrl-C, you need to manually 'kill' it in a terminal window (and if you were running from a terminal, it leaves it in an unusable state - no character echoes to screen, black background still there, etc).

                    Edit #2: I added some debugging messages to dungeon.c to try to work out where the problem is occurring.

                    Index: dungeon.c
                    ================================================== =================
                    --- dungeon.c (revision 610)
                    +++ dungeon.c (working copy)
                    @@ -1926,31 +1926,52 @@
                    /* Flush the message */
                    Term_fresh();

                    + /* Flash a message */
                    + prt("Term_fresh() done...", 0, 0);

                    +
                    /* Flavor the objects */
                    flavor_init();

                    + /* Flash a message */
                    + prt("flavor_init() done...", 0, 0);
                    +
                    /* Reset visuals */
                    reset_visuals(TRUE);

                    + /* Flash a message */
                    + prt("reset_visuals(TRUE) done...", 0, 0);

                    +
                    /* Redraw stuff */
                    p_ptr->redraw |= (PR_INVEN | PR_EQUIP | PR_MONSTER | PR_MESSAGE);
                    redraw_stuff();

                    + /* Flash a message */
                    + prt("redraw_stuff() done...", 0, 0);

                    +
                    /* Process some user pref files */
                    process_some_user_pref_files();


                    + /* Flash a message */
                    + prt("process_some_user_pref_files() done...", 0, 0);
                    +
                    /* React to changes */
                    Term_xtra(TERM_XTRA_REACT, 0);


                    + /* Flash a message */
                    + prt("Term_xtra(TERM_XTRA_REACT, 0) done...", 0, 0);
                    +
                    /* Generate a dungeon level if needed */
                    if (!character_dungeon) generate_cave();

                    + /* Flash a message */
                    + prt("generate_cave() done...", 0, 0);

                    +
                    /* Character is now "complete" */
                    character_generated = TRUE;
                    Unless I've used the wrong function to try to flash a message in the top line, the problem is somewhere in Term_fresh() - the message immediately before this one is shown ("Please wait..."), but the "Term_fresh() done..." message never comes up and angband hangs.
                    Last edited by Dawnmist; October 8, 2007, 08:31.

                    Comment

                    • takkaria
                      Veteran
                      • Apr 2007
                      • 1951

                      #11
                      Originally posted by Dawnmist
                      Target OS is Internet Tablet OS 2007 ('maemo' linux, 'bora' release), which is on an embedded ARM processor. The toolchain is a scratchbox install for maemo 3.2/Nokia N800 - set up according to the instructions in the maemo development howto and compiling with the ARMEL target (scratchbox hosted inside an Ubuntu Feisty machine).
                      Did you say that this was reproducable on desktop linux too? (e.g. your Ubuntu install)

                      It seems strange that it thinks it needs to overwrite an existing savefile when there is NO existing file..[/quote]

                      That's just screwy logic -- I thought I'd fixed it a while ago, but I haven't quite got round to fixing the fix. A ticket was recently filed about this.

                      Unless I've used the wrong function to try to flash a message in the top line, the problem is somewhere in Term_fresh() - the message immediately before this one is shown ("Please wait..."), but the "Term_fresh() done..." message never comes up and angband hangs.
                      Try printf instead. It may be more reliable here.
                      takkaria whispers something about options. -more-

                      Comment

                      • Dawnmist
                        Rookie
                        • Oct 2007
                        • 23

                        #12
                        Did you say that this was reproducable on desktop linux too? (e.g. your Ubuntu install)
                        I'd better clarify - when running it in the scratchbox environment on the desktop machine, yes - but not tried it for a native Ubuntu linux x86 binary.

                        Scratchbox sets up a virtual machine environment so I can cross-compile and test ARM binaries on linux x86.

                        Angband 3.0.9 runs fine in this virtual machine, and on the N800 handheld. Svn trunk hangs on both.

                        Tried printf, again nothing changes after the 'Please wait...' prompt. So from the code:
                        /* Stop the player being quite so dead */
                        p_ptr->is_dead = FALSE;

                        /* Flash a message */
                        prt("Please wait...", 0, 0);

                        /* Flush the message */
                        Term_fresh();

                        /* Flash a message */
                        printf("Term_fresh() done...");
                        the 'Term_fresh() done...' string never gets printed.

                        Comment

                        • pupnik
                          Rookie
                          • Oct 2007
                          • 5

                          #13
                          new ncurses port

                          I have a new ncurses build up at



                          I've hosted dawnmist's latest shared build. Haven't gotten around to addressing the oddness that occurs with the sdl build.

                          A good excuse to go 'purist' eh?

                          Oh dawnmist as you may know, the current xkbd virtual keyboard isn't working well with OS2008, so that's not a good option for sdl angband.

                          Hope you're doing ok - we can use all the help we can get with these games.

                          Comment

                          • Nick
                            Vanilla maintainer
                            • Apr 2007
                            • 9634

                            #14
                            I'd be interested to see if you could build FAangband - it has an SDL port, and can be operated purely by the touchscreen.
                            One for the Dark Lord on his dark throne
                            In the Land of Mordor where the Shadows lie.

                            Comment

                            Working...
                            😀
                            😂
                            🥰
                            😘
                            🤢
                            😎
                            😞
                            😡
                            👍
                            👎