Index: apps/plugins/midiplay.c
===================================================================
--- apps/plugins/midiplay.c	(revision 11988)
+++ apps/plugins/midiplay.c	(working copy)
@@ -79,7 +79,7 @@
 
 #define FRACTSIZE 10
 
-#ifndef SIMULATOR
+#if !defined(SIMULATOR) || !defined(TOSHIBA_GIGABEAT_F)
 	#define SAMPLE_RATE 22050  // 44100 22050 11025
 	#define MAX_VOICES 14   // Note: 24 midi channels is the minimum general midi
                          // spec implementation
Index: apps/plugins/doom/i_video.c
===================================================================
--- apps/plugins/doom/i_video.c	(revision 11988)
+++ apps/plugins/doom/i_video.c	(working copy)
@@ -15,8 +15,8 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * $Log$
- * Revision 1.26  2006/12/13 04:44:17  kkurbjun
+ * $Log: i_video.c,v $
+ * Revision 1.26  2006-12-13 04:44:17  kkurbjun
  * Dehacked and BEX support for Doom - currently only supports a DEHACKED file in a WAD (not as a standalone file yet).
  *
  * Revision 1.25  2006-10-26 13:38:04  barrywardell
@@ -127,7 +127,7 @@
 #endif
 #endif
 
-#if defined(CPU_COLDFIRE) 
+#if defined(CPU_COLDFIRE)
 static char fastscreen[(LCD_WIDTH)*LCD_HEIGHT] IBSS_ATTR;
 #endif
 static fb_data palette[256] IBSS_ATTR;
@@ -187,6 +187,17 @@
 #define DOOMBUTTON_ESC     BUTTON_POWER
 #define DOOMBUTTON_ENTER   BUTTON_SCROLL_UP
 #define DOOMBUTTON_WEAPON  BUTTON_SCROLL_DOWN
+#elif CONFIG_KEYPAD == GIGABEAT_PAD
+#define DOOMBUTTON_UP      BUTTON_UP
+#define DOOMBUTTON_DOWN    BUTTON_DOWN
+#define DOOMBUTTON_LEFT    BUTTON_LEFT
+#define DOOMBUTTON_RIGHT   BUTTON_RIGHT
+#define DOOMBUTTON_SHOOT   BUTTON_A
+#define DOOMBUTTON_OPEN    BUTTON_MENU
+#define DOOMBUTTON_ESC     BUTTON_POWER
+#define DOOMBUTTON_ENTER   BUTTON_SELECT
+#define DOOMBUTTON_WEAPON  BUTTON_VOL_DOWN
+#define DOOMBUTTON_MAP     BUTTON_VOL_UP
 #else
 #define DOOMBUTTON_UP      BUTTON_UP
 #define DOOMBUTTON_DOWN    BUTTON_DOWN
@@ -282,13 +293,11 @@
          D_PostEvent(&event);
       }
 #endif
-#ifdef DOOMBUTTON_ENTER
       if(released & DOOMBUTTON_ENTER)
       {
          event.data1=KEY_ENTER;
          D_PostEvent(&event);
       }
-#endif
 #ifdef DOOMBUTTON_WEAPON
       if(released & DOOMBUTTON_WEAPON)
       {
@@ -296,6 +305,13 @@
          D_PostEvent(&event);
       }
 #endif
+#ifdef DOOMBUTTON_MAP
+      if(released & DOOMBUTTON_MAP)
+      {
+         event.data1 =KEY_TAB;
+         D_PostEvent(&event);
+      }
+#endif
    }
    if(pressed)
    {
@@ -353,6 +369,13 @@
          D_PostEvent(&event);
       }
 #endif
+#ifdef DOOMBUTTON_MAP
+      if(pressed & DOOMBUTTON_MAP)
+      {
+         event.data1 =KEY_TAB;
+         D_PostEvent(&event);
+      }
+#endif
    }
 }
 
@@ -481,31 +504,43 @@
    int y;
 
 #ifdef HAVE_LCD_COLOR
-
-   for (y = 0; y < LCD_HEIGHT*LCD_WIDTH; y++)
+#if 1
+    int x;
+    for (y=0; y<LCD_HEIGHT; y++)
+    {
+        for (x=0; x < LCD_WIDTH; x++)
+        {
+         paletteIndex = d_screens[0][SCREENWIDTH*(SCREENHEIGHT-1-x) + y];
+         rb->lcd_framebuffer[y*LCD_WIDTH + x] = palette[paletteIndex];
+        }
+   }
+   rb->lcd_update();
+#else
+   for (y = 0; y < SCREENWIDTH *SCREENHEIGHT; y++)
    {
          paletteIndex = d_screens[0][y];
          rb->lcd_framebuffer[y] = palette[paletteIndex];
    }
    rb->lcd_update();
+#endif
 #else /* !HAVE_LCD_COLOR */
    int x, yd = 0;
 
-   for (y = 0; y < LCD_HEIGHT; y++)
+   for (y = 0; y < SCREENHEIGHT; y++)
    {
-      for (x = 0; x < LCD_WIDTH; x++)
+      for (x = 0; x < SCREENWIDTH; x++)
       {
          paletteIndex = d_screens[0][y*SCREENWIDTH + x];
-         graybuffer[yd * LCD_WIDTH + x]=palette[paletteIndex];
+         graybuffer[yd * SCREENWIDTH + x]=palette[paletteIndex];
       }
       if (++yd == 8)
       {
-         gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, 8);
+         gray_ub_gray_bitmap(graybuffer, 0, y & ~7, SCREENWIDTH, 8);
          yd = 0;
       }
    }
    if (yd > 0)
-       gray_ub_gray_bitmap(graybuffer, 0, y & ~7, LCD_WIDTH, yd);
+       gray_ub_gray_bitmap(graybuffer, 0, y & ~7, SCREENWIDTH, yd);
 #endif /* !HAVE_LCD_COLOR */
 #endif
 }
Index: apps/plugins/doom/g_game.c
===================================================================
--- apps/plugins/doom/g_game.c	(revision 11988)
+++ apps/plugins/doom/g_game.c	(working copy)
@@ -2773,11 +2773,11 @@
       int fd=open("/games/doom/timedemo.txt",O_WRONLY | O_CREAT);
       fdprintf (fd,"Timed %d gametics in %d realtics = %d frames per second",
                (unsigned) gametic, realtics,
-               (unsigned) gametic * (double) TICRATE / realtics);
+               (unsigned) gametic * TICRATE/ realtics);
       close(fd);
       I_Error ("%d gametics in %d realtics",
                (unsigned) gametic,realtics,
-               (unsigned) gametic * (double) TICRATE / realtics);
+               (unsigned) gametic * TICRATE / realtics);
       return false;
    }
 
Index: apps/plugins/doom/doomdef.h
===================================================================
--- apps/plugins/doom/doomdef.h	(revision 11988)
+++ apps/plugins/doom/doomdef.h	(working copy)
@@ -92,10 +92,10 @@
 #define MAX_SCREENWIDTH  1600
 #define MAX_SCREENHEIGHT 1200
 
-#define SCREENWIDTH  LCD_WIDTH
-//#define SCREENWIDTH  320
-//#define SCREENHEIGHT 200
-#define SCREENHEIGHT LCD_HEIGHT
+//#define SCREENWIDTH  LCD_WIDTH
+#define SCREENWIDTH  320
+#define SCREENHEIGHT 240
+//#define SCREENHEIGHT LCD_HEIGHT
 
 // The maximum number of players, multiplayer/networking.
 #define MAXPLAYERS       4
Index: apps/plugins/doom/z_zone.c
===================================================================
--- apps/plugins/doom/z_zone.c	(revision 11988)
+++ apps/plugins/doom/z_zone.c	(working copy)
@@ -115,7 +115,8 @@
    unsigned long total_memory = free_memory + active_memory +
                                 purgable_memory + inactive_memory +
                                 virtual_memory;
-   double s = 100.0 / total_memory;
+//   double s = 100.0 / total_memory;
+   int s = 100/total_memory;
 
    doom_printf("%-5u\t%6.01f%%\tstatic\n"
                "%-5u\t%6.01f%%\tpurgable\n"
Index: apps/plugins/doom/i_system.c
===================================================================
--- apps/plugins/doom/i_system.c	(revision 11988)
+++ apps/plugins/doom/i_system.c	(working copy)
@@ -15,8 +15,8 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // GNU General Public License for more details.
 //
-// $Log$
-// Revision 1.9  2006/04/15 22:08:36  kkurbjun
+// $Log: i_system.c,v $
+// Revision 1.9  2006-04-15 22:08:36  kkurbjun
 // Slight code cleanups, fixed sound parameter - now it saves.  Old configurations will be reset.
 //
 // Revision 1.8  2006-04-14 21:07:55  kkurbjun
@@ -87,7 +87,7 @@
 
 int  I_GetTime (void)
 {
-#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR) && !defined(RB_PROFILE)
+#if defined(HAVE_LCD_COLOR) && !defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) && !defined(RB_PROFILE)
    return doomtimer;
 #else
 #if HZ==100
Index: apps/plugins/doom/Makefile
===================================================================
--- apps/plugins/doom/Makefile	(revision 11988)
+++ apps/plugins/doom/Makefile	(working copy)
@@ -2,8 +2,8 @@
 #
 # $Id$
 #
-# $Log$
-# Revision 1.13  2006/12/13 06:52:09  kkurbjun
+# $Log: Makefile,v $
+# Revision 1.13  2006-12-13 06:52:09  kkurbjun
 # Free more plugin memory
 #
 # Revision 1.12  2006-12-13 05:46:51  kkurbjun
@@ -56,7 +56,7 @@
 
 # The arm code compiles too large for the plugin buffer when set to optimize for speed
 #ifeq ($(CC), arm-elf-gcc)
-ifneq (,$(strip $(foreach tgt,SANSA_E200 IPOD_NANO IPOD_COLOR IPOD_VIDEO IPOD_MINI IPOD_3G IPOD_4G IRIVER_H10_5GB IRIVER_H10,$(findstring $(tgt),$(TARGET)))))
+ifneq (,$(strip $(foreach tgt,SANSA_E200 IPOD_NANO IPOD_COLOR IPOD_VIDEO IPOD_MINI IPOD_3G IPOD_4G IRIVER_H10_5GB IRIVER_H10 GIGABEAT_F,$(findstring $(tgt),$(TARGET)))))
     CFLAGS += -Os
 ifndef SIMVER
 ifeq ($(TARGET), IRIVER_H100)
Index: apps/plugins/doom/rockdoom.c
===================================================================
--- apps/plugins/doom/rockdoom.c	(revision 11988)
+++ apps/plugins/doom/rockdoom.c	(working copy)
@@ -108,6 +108,7 @@
    static int p_xtpt;
    char p_buf[50];
    bool ok;
+   rb->yield();
    va_list ap;
 
    va_start(ap, fmt);
@@ -293,69 +294,22 @@
 
    D_AddFile (GAMEBASE"rockdoom.wad", source_pwad);
 
-   int i=0;
+   int i=0, j;
    /* Doom Shareware */
-   if ( !fileexists (wads_builtin[0]) )
-   {
-      names[i].string=versions_builtin[0];
-      names[i].voice_id=0;
-      namemap[i]=0;
-      i++;
-   }
-
    /* Doom registered */
-   if ( !fileexists (wads_builtin[1]) )
-   {
-      names[i].string=versions_builtin[1];
-      names[i].voice_id=0;
-      namemap[i]=1;
-      i++;
-   }
-
    /* Ultimate Doom */
-   if ( !fileexists (wads_builtin[2]) )
-   {
-      names[i].string=versions_builtin[2];
-      names[i].voice_id=0;
-      namemap[i]=2;
-      i++;
-   }
-
    /* Doom2 */
-   if ( !fileexists (wads_builtin[3]) )
-   {
-      names[i].string=versions_builtin[3];
-      names[i].voice_id=0;
-      namemap[i]=3;
-      i++;
-   }
-
    /* Doom2f */
-   if ( !fileexists (wads_builtin[4]) )
-   {
-      names[i].string=versions_builtin[4];
-      names[i].voice_id=0;
-      namemap[i]=4;
-      i++;
-   }
-
    /* Plutonia */
-   if ( !fileexists (wads_builtin[5]) )
-   {
-      names[i].string=versions_builtin[5];
-      names[i].voice_id=0;
-      namemap[i]=5;
-      i++;
-   }
-
    /* TNT */
-   if ( !fileexists (wads_builtin[6]) )
-   {
-      names[i].string=versions_builtin[6];
-      names[i].voice_id=0;
-      namemap[i]=6;
-      i++;
-   }
+    for(j=0;j<7;j++)
+        if ( !fileexists (wads_builtin[j]) )
+        {
+            names[i].string=versions_builtin[j];
+            names[i].voice_id=0;
+            namemap[i]=j;
+            i++;
+        }
    // Set argvlist defaults
    argvlist.timedemo=0;
 
@@ -413,8 +367,10 @@
    return i;
 }
 
+static int translatekey(int key) __attribute__ ((noinline));
+
 // This key configuration code is not the cleanest or the most efficient, but it works
-int translatekey(int key)
+static int translatekey(int key)
 {
    if (key<31)
    {
@@ -431,16 +387,17 @@
          case 4:
             return KEY_DOWNARROW;
          case 5:
-            return KEY_RCTRL;
+            return KEY_ENTER;
          case 6:
-            return ' ';
+            return KEY_RCTRL;
          case 7:
-            return KEY_ESCAPE;
+            return ' ';
          case 8:
-            return 'w';
+            return KEY_ESCAPE;
          case 9:
-            return KEY_ENTER;
+            return 'w';
          case 10:
+            return KEY_TAB;
          default:
             return 0;
       }
@@ -459,17 +416,18 @@
             return 3;
          case KEY_DOWNARROW:
             return 4;
-         case KEY_RCTRL:
+         case KEY_ENTER:
             return 5;
-         case ' ':
+         case KEY_RCTRL:
             return 6;
-         case KEY_ESCAPE:
+         case ' ':
             return 7;
-         case 'w':
+         case KEY_ESCAPE:
             return 8;
-         case KEY_ENTER:
+         case 'w':
             return 9;
-         case KEY_F9:
+         case KEY_TAB:
+            return 10;
          default:
             return 0;
       }
@@ -484,18 +442,40 @@
    int m, result;
    int menuquit=0;
 
+
    static const struct opt_items doomkeys[] = {
       { "Unmapped", NULL },
       { "Key Right", NULL },
       { "Key Left", NULL },
       { "Key Up", NULL },
       { "Key Down", NULL },
+      { "Key Select", NULL },
+#if defined(TOSHIBA_GIGABEAT_F)
+      { "Key A", NULL },
+      { "Key Menu", NULL },
+      { "Key Power", NULL },
+      { "Key Volume Down", NULL },
+      { "Key Volume Up", NULL },
+#else
       { "Key Record", NULL },
       { "Key Mode", NULL },
       { "Key Off", NULL },
       { "Key On", NULL },
-      { "Key Select", NULL },
+#endif
    };
+   
+    void *keys[]={
+        &key_right,
+        &key_left,
+        &key_up,
+        &key_down,
+        &key_fire,
+        &key_use,
+        &key_strafe,
+        &key_weapon,
+        &key_map
+    };
+
    int numdoomkeys=sizeof(doomkeys) / sizeof(*doomkeys);
 
    static const struct menu_item items[] = {
@@ -513,69 +493,17 @@
    m = rb->menu_init(items, sizeof(items) / sizeof(*items),
                 NULL, NULL, NULL, NULL);
 
-   while(!menuquit)
-   {
-      result=rb->menu_show(m);
-      switch (result)
-      {
-         case 0:
-            key_right=translatekey(key_right);
-            rb->set_option(items[0].desc, &key_right, INT, doomkeys, numdoomkeys, NULL );
-            key_right=translatekey(key_right);
-            break;
-
-         case 1:
-            key_left=translatekey(key_left);
-            rb->set_option(items[1].desc, &key_left, INT, doomkeys, numdoomkeys, NULL );
-            key_left=translatekey(key_left);
-            break;
-
-         case 2:
-            key_up=translatekey(key_up);
-            rb->set_option(items[2].desc, &key_up, INT, doomkeys, numdoomkeys, NULL );
-            key_up=translatekey(key_up);
-            break;
-
-         case 3:
-            key_down=translatekey(key_down);
-            rb->set_option(items[3].desc, &key_down, INT, doomkeys, numdoomkeys, NULL );
-            key_down=translatekey(key_down);
-            break;
-
-         case 4:
-            key_fire=translatekey(key_fire);
-            rb->set_option(items[4].desc, &key_fire, INT, doomkeys, numdoomkeys, NULL );
-            key_fire=translatekey(key_fire);
-            break;
-
-         case 5:
-            key_use=translatekey(key_use);
-            rb->set_option(items[5].desc, &key_use, INT, doomkeys, numdoomkeys, NULL );
-            key_use=translatekey(key_use);
-            break;
-
-         case 6:
-            key_strafe=translatekey(key_strafe);
-            rb->set_option(items[6].desc, &key_strafe, INT, doomkeys, numdoomkeys, NULL );
-            key_strafe=translatekey(key_strafe);
-            break;
-
-         case 7:
-            key_weapon=translatekey(key_weapon);
-            rb->set_option(items[7].desc, &key_weapon, INT, doomkeys, numdoomkeys, NULL );
-            key_weapon=translatekey(key_weapon);
-            break;
-
-         case 8:
-            key_map=translatekey(key_map);
-            rb->set_option(items[8].desc, &key_map, INT, doomkeys, numdoomkeys, NULL );
-            key_map=translatekey(key_map);
-            break;
-
-         default:
+    while(!menuquit)
+    {
+        result=rb->menu_show(m);
+        if(result<0)
             menuquit=1;
-            break;
-      }
+        else
+        {
+            *keys[result]=translatekey(*keys[result]);
+            rb->set_option(items[result].desc, keys[result], INT, doomkeys, numdoomkeys, NULL );
+            *keys[result]=translatekey(*keys[result]);
+        }
    }
 
    rb->menu_exit(m);
@@ -596,8 +524,8 @@
    int menuquit=0;
 
    static const struct menu_item items[] = {
-      { "Sound", NULL },
       { "Set Keys", NULL },
+      { "Sound", NULL },
       { "Timedemo", NULL },
       { "Player Bobbing", NULL },
       { "Weapon Recoil", NULL },
@@ -607,66 +535,40 @@
       { "Headsup Display", NULL },
       { "Statusbar Always Red", NULL },
    };
+   
+   void *options[]={
+        &nosfxparm,
+        &argvlist.timedemo,
+        &default_player_bobbing,
+        &default_weapon_recoil,
+        &default_translucency,
+        &fake_contrast,
+        &autorun,
+        &hud_displayed,
+        &sts_always_red
+    };
 
-   m = rb->menu_init(items, sizeof(items) / sizeof(*items),
-                NULL, NULL, NULL, NULL);
+    m = rb->menu_init(items, sizeof(items) / sizeof(*items),
+        NULL, NULL, NULL, NULL);
 
-   while(!menuquit)
-   {
-      result=rb->menu_show(m);
-      switch (result)
-      {
-         case 0: /* Sound */
+    while(!menuquit)
+    {
+        result=rb->menu_show(m);
+        if(result==0) 
+            Oset_keys();
+        else if (result > 0)
+        {
             nosfxparm=!nosfxparm; // Have to invert it before setting
-            rb->set_option(items[0].desc, &nosfxparm, INT, onoff, 2, NULL );
+            rb->set_option(items[result].desc, options[result-1], INT, onoff, 2, NULL );
             nosfxparm=!nosfxparm;
-            break;
-
-         case 1: /* Keys */
-            Oset_keys();
-            break;
-
-         case 2: /* Timedemo */
-            rb->set_option(items[2].desc, &argvlist.timedemo, INT, onoff, 2, NULL );
-            break;
-
-         case 3: /* Player Bobbing */
-            rb->set_option(items[3].desc, &default_player_bobbing, INT, onoff, 2, NULL );
-            break;
-
-         case 4: /* Weapon Recoil */
-            rb->set_option(items[4].desc, &default_weapon_recoil, INT, onoff, 2, NULL );
-            break;
-
-         case 5: /* Translucency */
-            rb->set_option(items[5].desc, &default_translucency, INT, onoff, 2, NULL );
-            break;
-
-         case 6: /* Fake Contrast */
-            rb->set_option(items[6].desc, &fake_contrast, INT, onoff, 2, NULL );
-            break;
-
-         case 7: /* Always Run */
-            rb->set_option(items[7].desc, &autorun, INT, onoff, 2, NULL );
-            break;
-
-         case 8: /* Headsup Display */
-            rb->set_option(items[8].desc, &hud_displayed, INT, onoff, 2, NULL );
-            break;
-
-         case 9: /* Statusbar always red */
-            rb->set_option(items[9].desc, &sts_always_red, INT, onoff, 2, NULL );
-            break;
-
-         default:
+        }
+        else
             menuquit=1;
-            break;
-      }
-   }
+    }
 
-   rb->menu_exit(m);
+    rb->menu_exit(m);
 
-   return (1);
+    return (1);
 }
 
 int menuchoice(struct menu_item *menu, int items)
Index: apps/plugins/doom/w_wad.c
===================================================================
--- apps/plugins/doom/w_wad.c	(revision 11988)
+++ apps/plugins/doom/w_wad.c	(working copy)
@@ -485,7 +485,7 @@
 int W_LumpLength (int lump)
 {
    if (lump >= numlumps)
-      I_Error ("W_LumpLength: %i >= numlumps",lump);
+      I_Error ("W_LumpLength: %d >= numlumps",lump);
    return lumpinfo[lump].size;
 }
 
@@ -501,7 +501,7 @@
 
 #ifdef RANGECHECK
    if (lump >= numlumps)
-      I_Error ("W_ReadLump: %i >= numlumps",lump);
+      I_Error ("W_ReadLump: %d >= numlumps",lump);
 #endif
 
 #ifndef NO_PREDEFINED_LUMPS
@@ -522,7 +522,7 @@
       lseek(l->handle, l->position, SEEK_SET);
       c = read(l->handle, dest, l->size);
       if (c < l->size)
-         I_Error("W_ReadLump: only read %i of %i on lump %i", c, l->size, lump);
+         I_Error("W_ReadLump: only read %d of %d on lump %d", c, l->size, lump);
    }
 }
 
@@ -538,7 +538,7 @@
 {
 #ifdef RANGECHECK
    if ((unsigned)lump >= (unsigned)numlumps)
-      I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
+      I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
 #endif
 
    if (!lumpcache[lump])      // read the lump in
@@ -578,7 +578,7 @@
    const int locks = 1;
 #ifdef RANGECHECK
    if ((unsigned)lump >= (unsigned)numlumps)
-      I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
+      I_Error ("W_CacheLumpNum: %d >= numlumps",lump);
 #endif
 
    if (!lumpcache[lump]) {     /* read the lump in */
Index: apps/plugins/doom/d_main.c
===================================================================
--- apps/plugins/doom/d_main.c	(revision 11988)
+++ apps/plugins/doom/d_main.c	(working copy)
@@ -82,7 +82,7 @@
 boolean nomonsters;     // working -nomonsters
 boolean respawnparm;    // working -respawn
 boolean fastparm;       // working -fast
-boolean dehout=false;
+boolean dehout=true;
 
 boolean singletics = false; // debug flag to cancel adaptiveness
 
Index: apps/plugins/SUBDIRS
===================================================================
--- apps/plugins/SUBDIRS	(revision 11988)
+++ apps/plugins/SUBDIRS	(working copy)
@@ -28,8 +28,8 @@
 pacbox
 #endif
 
-/* For all the color targets apart from the Gigabeat */
-#if (defined(HAVE_LCD_COLOR) && !defined(TOSHIBA_GIGABEAT_F)) || (LCD_DEPTH == 2)
+/* For all the color targets */
+#if defined(HAVE_LCD_COLOR) || (LCD_DEPTH == 2)
 doom
 #endif
 
