ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/SDL/video_sdl.cpp
(Generate patch)

Comparing BasiliskII/src/SDL/video_sdl.cpp (file contents):
Revision 1.13 by gbeauche, 2004-11-28T19:31:11Z vs.
Revision 1.16 by gbeauche, 2005-03-17T00:19:39Z

# Line 1 | Line 1
1   /*
2   *  video_sdl.cpp - Video/graphics emulation, SDL specific stuff
3   *
4 < *  Basilisk II (C) 1997-2004 Christian Bauer
4 > *  Basilisk II (C) 1997-2005 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 82 | Line 82 | static int display_type = DISPLAY_WINDOW
82   #endif
83  
84   // Constants
85 + #ifdef WIN32
86 + const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
87 + #else
88   const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
89 + #endif
90  
91  
92   // Global variables
# Line 806 | Line 810 | static void keycode_init(void)
810                  SDL_VideoDriverName(video_driver, sizeof(video_driver));
811                  bool video_driver_found = false;
812                  char line[256];
813 +                int n_keys = 0;
814                  while (fgets(line, sizeof(line) - 1, f)) {
815                          // Read line
816                          int len = strlen(line);
# Line 818 | Line 823 | static void keycode_init(void)
823                                  continue;
824  
825                          if (video_driver_found) {
826 <                                // Skip aliases
826 >                                // Skip aliases as long as we have read keycodes yet
827 >                                // Otherwise, it's another mapping and we have to stop
828                                  static const char sdl_str[] = "sdl";
829 <                                if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0)
829 >                                if (strncmp(line, sdl_str, sizeof(sdl_str) - 1) == 0 && n_keys == 0)
830                                          continue;
831  
832                                  // Read keycode
833                                  int x_code, mac_code;
834                                  if (sscanf(line, "%d %d", &x_code, &mac_code) == 2)
835 <                                        keycode_table[x_code & 0xff] = mac_code;
835 >                                        keycode_table[x_code & 0xff] = mac_code, n_keys++;
836                                  else
837                                          break;
838                          } else {
# Line 851 | Line 857 | static void keycode_init(void)
857                          WarningAlert(str);
858                          return;
859                  }
860 +
861 +                D(bug("Using SDL/%s keycodes table, %d key mappings\n", video_driver, n_keys));
862          }
863   }
864  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines