uploading i18n template
authorJavier S. Pedro <maemo@javispedro.com>
Tue, 26 Jan 2010 19:47:00 +0000 (20:47 +0100)
committerJavier S. Pedro <maemo@javispedro.com>
Tue, 26 Jan 2010 19:47:00 +0000 (20:47 +0100)
gui/i18n/drnoksnes_plugin.pot [new file with mode: 0644]
platform/hgw.cpp [deleted file]
platform/hgw.h [deleted file]
platform/osso.cpp [new file with mode: 0644]
platform/osso.h [new file with mode: 0644]

diff --git a/gui/i18n/drnoksnes_plugin.pot b/gui/i18n/drnoksnes_plugin.pot
new file mode 100644 (file)
index 0000000..6ecb37a
--- /dev/null
@@ -0,0 +1,235 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: maemo@javispedro.com\n"
+"POT-Creation-Date: 2010-01-26 20:44+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: plugin.c:106
+msgid "<no rom selected>"
+msgstr ""
+
+#: plugin.c:233
+msgid "ROM"
+msgstr ""
+
+#: plugin.c:251
+msgid "Select ROM..."
+msgstr ""
+
+#: plugin.c:268
+msgid "Sound"
+msgstr ""
+
+#: plugin.c:274
+msgid "Target framerate"
+msgstr ""
+
+#: plugin.c:291
+msgid "Show while in game"
+msgstr ""
+
+#: plugin.c:295 plugin.c:313
+msgid "Turbo mode"
+msgstr ""
+
+#: plugin.c:310
+msgid "Enable sound"
+msgstr ""
+
+#: plugin.c:315
+msgid "Display framerate"
+msgstr ""
+
+#: plugin.c:334 settings.c:224
+msgid "Accurate graphics"
+msgstr ""
+
+#: plugin.c:338
+msgid "Framerate:"
+msgstr ""
+
+#: plugin.c:347 settings.c:249
+msgid "No speedhacks"
+msgstr ""
+
+#: plugin.c:348 settings.c:250
+msgid "Safe hacks only"
+msgstr ""
+
+#: plugin.c:349 settings.c:251
+msgid "All speedhacks"
+msgstr ""
+
+#: plugin.c:446
+msgid "Settings…"
+msgstr ""
+
+#: plugin.c:448 plugin.c:457
+msgid "About…"
+msgstr ""
+
+#: plugin.c:456 settings.c:177
+msgid "Settings"
+msgstr ""
+
+#: plugin.c:465
+msgid "Controls…"
+msgstr ""
+
+#: plugin.c:469
+msgid "Advanced…"
+msgstr ""
+
+#: plugin.c:531
+msgid "No ROM selected"
+msgstr ""
+
+#: plugin.c:536
+msgid "ROM file does not exist"
+msgstr ""
+
+#: controls.c:119
+msgid "Keyboard"
+msgstr ""
+
+#: controls.c:123
+msgid "Disabled"
+msgstr ""
+
+#: controls.c:131
+#, c-format
+msgid "Player %d controls"
+msgstr ""
+
+#: controls.c:154
+msgid "Keys"
+msgstr ""
+
+#: controls.c:160
+msgid "Enable keyboard"
+msgstr ""
+
+#: controls.c:167
+msgid "Configure keys..."
+msgstr ""
+
+#: controls.c:173
+msgid "Touchscreen"
+msgstr ""
+
+#: controls.c:180
+msgid "Enable touchscreen buttons"
+msgstr ""
+
+#: controls.c:187
+msgid "Show on-screen button grid"
+msgstr ""
+
+#: controls.c:191
+msgid "Accelerometer"
+msgstr ""
+
+#: controls.c:195
+msgid "Wiimote"
+msgstr ""
+
+#: controls.c:199
+msgid "Zeemote"
+msgstr ""
+
+#: keys.c:267
+#, c-format
+msgid "Player %d keys"
+msgstr ""
+
+#: keys.c:270
+msgid "Defaults"
+msgstr ""
+
+#: settings.c:52 settings.c:59 settings.c:61
+msgid "2x zoom"
+msgstr ""
+
+#: settings.c:54
+msgid "Scale to fit"
+msgstr ""
+
+#: settings.c:55
+msgid "Fill the entire screen"
+msgstr ""
+
+#: settings.c:58
+msgid "Antialiased 2x zoom"
+msgstr ""
+
+#: settings.c:64
+msgid "No zoom"
+msgstr ""
+
+#: settings.c:196
+msgid "Controls"
+msgstr ""
+
+#: settings.c:203
+msgid "Player 1"
+msgstr ""
+
+#: settings.c:212
+msgid "Player 2"
+msgstr ""
+
+#: settings.c:218
+msgid "Advanced"
+msgstr ""
+
+#: settings.c:231
+msgid "Zoom"
+msgstr ""
+
+#: settings.c:243
+msgid "Speedhacks"
+msgstr ""
+
+#: about.c:55
+msgid "About"
+msgstr ""
+
+#: cellrendererkey.c:10
+msgid "Press key or…"
+msgstr ""
+
+#: buttons.inc:22
+msgid "Return to launcher"
+msgstr ""
+
+#: buttons.inc:23
+msgid "Fullscreen"
+msgstr ""
+
+#: buttons.inc:24
+msgid "Quick Load 1"
+msgstr ""
+
+#: buttons.inc:25
+msgid "Quick Save 1"
+msgstr ""
+
+#: buttons.inc:26
+msgid "Quick Load 2"
+msgstr ""
+
+#: buttons.inc:27
+msgid "Quick Save 2"
+msgstr ""
diff --git a/platform/hgw.cpp b/platform/hgw.cpp
deleted file mode 100644 (file)
index bf19736..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-#include <stdio.h>
-#include <libgen.h>
-#include <hgw/hgw.h>
-
-#include "snes9x.h"
-
-#include <glib.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-
-#include "platform.h"
-#include "hgw.h"
-#include "../gui/gconf.h"
-
-#define DIE(format, ...) do { \
-               fprintf(stderr, "Died at %s:%d: ", __FILE__, __LINE__ ); \
-               fprintf(stderr, format "\n", ## __VA_ARGS__); \
-               abort(); \
-       } while (0);
-
-bool hgwLaunched;
-static HgwContext *hgw;
-
-static void createActionMappingsOnly();
-static void parseGConfKeyMappings(GConfClient* gcc);
-
-void HgwInit()
-{
-       // hildon-games-wrapper sets this env variable for itself.
-       char* service = getenv("HGW_EXEC_SERVICE");
-
-       if (!service) {
-               // Not launched from hildon-games-wrapper
-               hgwLaunched = false;
-               return;
-       }
-
-       g_type_init();
-       hgw = hgw_context_init();
-
-       if (!hgw) {
-               fprintf(stderr, "Error opening hgw context\n");
-               hgwLaunched = false;
-       }
-
-       hgwLaunched = true;
-       printf("Loading in HGW mode\n");
-}
-
-void HgwDeinit()
-{
-       if (!hgwLaunched) return;
-
-       hgw_context_destroy(hgw,
-               (Config.snapshotSave ? HGW_BYE_PAUSED : HGW_BYE_INACTIVE));
-
-       hgw = 0;
-}
-
-void HgwConfig()
-{
-       if (!hgwLaunched) return;
-
-       GConfClient *gcc = gconf_client_get_default();
-
-       Config.fullscreen = true;
-
-       char romFile[PATH_MAX + 1];
-       if (hgw_conf_request_string(hgw, kGConfRomFile, romFile) == HGW_ERR_NONE
-               && strlen(romFile) > 0) {
-               S9xSetRomFile(romFile);
-       } else {
-               printf("Exiting gracefully because there's no ROM in Gconf\n");
-               HgwDeinit();
-               exit(0);
-       }
-
-       char sound = FALSE;
-       if (hgw_conf_request_bool(hgw, kGConfSound, &sound) == HGW_ERR_NONE) {
-               Config.enableAudio = sound ? true : false;
-       }
-
-       char turbo = FALSE;
-       if (hgw_conf_request_bool(hgw, kGConfTurboMode, &turbo) == HGW_ERR_NONE) {
-               Settings.TurboMode = turbo ? TRUE : FALSE;
-       }
-
-       int frameskip = 0;
-       if (hgw_conf_request_int(hgw, kGConfFrameskip, &frameskip) == HGW_ERR_NONE) {
-               Settings.SkipFrames = (frameskip > 0 ? frameskip : AUTO_FRAMERATE);
-       }
-
-       char transparency = FALSE;
-       if (hgw_conf_request_bool(hgw, kGConfTransparency, &transparency) == HGW_ERR_NONE) {
-               Settings.Transparency = transparency ? TRUE : FALSE;
-       }
-
-       char scaler[NAME_MAX];
-       if (hgw_conf_request_string(hgw, kGConfScaler, scaler) == HGW_ERR_NONE
-               && strlen(scaler) > 0) {
-               free(Config.scaler);
-               Config.scaler = strdup(scaler);
-       }
-
-       char displayFramerate = FALSE;
-       if (hgw_conf_request_bool(hgw, kGConfDisplayFramerate, &displayFramerate) == HGW_ERR_NONE) {
-               Settings.DisplayFrameRate = displayFramerate ? TRUE : FALSE;
-       }
-
-#if TODO
-       char displayControls = FALSE;
-       if (hgw_conf_request_bool(hgw, kGConfDisplayControls, &displayControls) == HGW_ERR_NONE) {
-               Config.touchscreenShow = displayControls ? true : false;
-       }
-#endif
-
-       int speedhacks = 0;
-       if (hgw_conf_request_int(hgw, kGConfSpeedhacks, &speedhacks) == HGW_ERR_NONE) {
-               if (speedhacks <= 0) {
-                       Settings.HacksEnabled = FALSE;
-                       Settings.HacksFilter = FALSE;
-               } else if (speedhacks == 1) {
-                       Settings.HacksEnabled = TRUE;
-                       Settings.HacksFilter = TRUE;
-               } else {
-                       Settings.HacksEnabled = TRUE;
-                       Settings.HacksFilter = FALSE;
-               }
-       }
-       if (Settings.HacksEnabled && !Config.hacksFile) {
-               // Provide a default speedhacks file
-               if (asprintf(&Config.hacksFile, "%s/snesadvance.dat", dirname(romFile))
-                               < 0) {
-                       Config.hacksFile = 0; // malloc error.
-               }
-               // remember that dirname garbles romFile.
-       }
-
-       gchar key[kGConfPlayerPathBufferLen];
-       gchar *relKey = key + sprintf(key, kGConfPlayerPath, 1);
-
-       strcpy(relKey, kGConfPlayerKeyboardEnable);
-       if (gconf_client_get_bool(gcc, key, NULL)) {
-               parseGConfKeyMappings(gcc);
-       } else {
-               createActionMappingsOnly();
-       }
-
-       HgwStartCommand cmd = hgw_context_get_start_command(hgw);
-       switch (cmd) {
-               default:
-               case HGW_COMM_NONE:     // called from libosso
-               case HGW_COMM_CONT:
-                       Config.snapshotLoad = true;
-                       Config.snapshotSave = true;
-                       break;
-               case HGW_COMM_RESTART:
-                       Config.snapshotLoad = false;
-                       Config.snapshotSave = true;
-                       break;
-               case HGW_COMM_QUIT:
-                       // hum, what?
-                       Config.snapshotLoad = false;
-                       Config.snapshotSave = false;
-                       Config.quitting = true;
-                       break;
-       }
-
-       g_object_unref(G_OBJECT(gcc));
-}
-
-void HgwPollEvents()
-{
-       if (!hgwLaunched) return;
-       
-       HgwMessage msg;
-       HgwMessageFlags flags = HGW_MSG_FLAG_NONE;
-       
-       if ( hgw_msg_check_incoming(hgw, &msg, flags) == HGW_ERR_COMMUNICATION ) {
-               // Message Incoming, process msg
-               
-               switch (msg.type) {
-                       case HGW_MSG_TYPE_CBREQ:
-                               switch (msg.e_val) {
-                                       case HGW_CB_QUIT:
-                                       case HGW_CB_EXIT:
-                                               Config.quitting = true;
-                                               break;
-                               }
-                               break;
-                       case HGW_MSG_TYPE_DEVSTATE:
-                               switch (msg.e_val) {
-                                       case HGW_DEVICE_STATE_SHUTDOWN:
-                                               Config.quitting = true; // try to quit gracefully
-                                               break;
-                               }
-                               break;
-                       default:
-                               // do nothing
-                               break;
-               }
-               
-               hgw_msg_free_data(&msg);
-       }
-}
-
-// For now, please keep this in sync with ../gui/controls.c
-typedef struct ButtonEntry {
-       const char * gconf_key;
-       unsigned long mask;
-       bool is_action;
-} ButtonEntry;
-#define BUTTON_INITIALIZER(button, name) \
-       { kGConfKeysPath "/" name, SNES_##button##_MASK, false }
-#define ACTION_INITIALIZER(action, name) \
-       { kGConfKeysPath "/" name, kAction##action, true }
-#define BUTTON_LAST    \
-       { 0 }
-
-static const ButtonEntry buttons[] = {
-#define HELP(...)
-#define P(x) SNES_##x##_MASK
-#define A(x) kAction##x
-#define BUTTON(description, slug, actions, d, f) \
-       { G_STRINGIFY(slug), actions, false },
-#define ACTION(description, slug, actions, d, f) \
-       { G_STRINGIFY(slug), actions, true },
-#define LAST \
-       { 0 }
-#include "../gui/buttons.inc"
-#undef HELP
-#undef P
-#undef A
-#undef BUTTON
-#undef ACTION
-#undef LAST
-};
-
-static void createActionMappingsOnly()
-{
-       // Map quit to fullscreen, escape and task switch.
-       Config.action[72] = kActionQuit;
-       Config.action[9] = kActionQuit;
-       Config.action[71] = kActionQuit;
-}
-
-static void parseGConfKeyMappings(GConfClient* gcc)
-{
-       // Build player 1 keyboard gconf key relative path
-       gchar key[kGConfPlayerPathBufferLen];
-       gchar *relKey = key + sprintf(key,
-               kGConfPlayerPath kGConfPlayerKeyboardPath "/", 1);
-
-       // If the user does not map fullscreen or quit
-       bool quit_mapped = false;
-
-       printf("Hgw: Using gconf key mappings\n");
-       // Thus ignoring config file key mappings
-       ZeroMemory(Config.joypad1Mapping, sizeof(Config.joypad1Mapping));
-       ZeroMemory(Config.action, sizeof(Config.action));
-
-       int i, scancode;
-       for (i = 0; buttons[i].gconf_key; i++) {
-               strcpy(relKey, buttons[i].gconf_key);
-               scancode = gconf_client_get_int(gcc, key, NULL);
-
-               if (scancode <= 0 || scancode > 255) continue;
-
-               if (buttons[i].is_action) {
-                       Config.action[scancode] |= buttons[i].mask;
-                       if (buttons[i].mask & (kActionQuit | kActionToggleFullscreen)) {
-                               quit_mapped = true;
-                       }
-               } else {
-                       Config.joypad1Mapping[scancode] |= buttons[i].mask;
-               }
-       }
-
-#if MAEMO && !CONF_EXIT_BUTTON
-       // Safeguards
-       if (!quit_mapped) {
-               // Newbie user won't know how to quit game.
-               if (!Config.joypad1Mapping[72] && !Config.action[72]) {
-                       // Fullscreen key is not mapped, map
-                       Config.action[72] = kActionQuit;
-                       quit_mapped = true;
-               }
-               if (!quit_mapped && !Config.joypad1Mapping[9] && !Config.action[9]) {
-                       // Escape key is not mapped, map
-                       // But only if we couldn't map quit to fullscreen. Some people
-                       // actually want Quit not to be mapped.
-                       Config.action[9] = kActionQuit;
-                       quit_mapped = true;
-               }
-               if (!quit_mapped) {
-                       // Force mapping of fullscreen to Quit if can't map anywhere else.
-                       Config.joypad1Mapping[72] = 0;
-                       Config.action[72] = kActionQuit;
-               }
-       }
-
-       // If task switch key is not mapped, map it to Quit by default.
-       if (!Config.action[71] && !Config.joypad1Mapping[71]) {
-               Config.action[71] = kActionQuit;
-       }
-#endif
-}
-
diff --git a/platform/hgw.h b/platform/hgw.h
deleted file mode 100644 (file)
index 885c5a2..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _PLATFORM_HGW_H_
-#define _PLATFORM_HGW_H_
-
-#ifdef __cplusplus
-/** True if we were launched from GUI. */
-extern bool hgwLaunched;
-
-/** Called from main() before loading config; connects to DBus. */
-void HgwInit();
-/** Called from main() before closing. */
-void HgwDeinit();
-/** Called from main() after loading user config; loads GUI settings. */
-void HgwConfig();
-/** Called from main() in the event loop; polls DBus. */
-void HgwPollEvents();
-#endif
-
-#endif
-
diff --git a/platform/osso.cpp b/platform/osso.cpp
new file mode 100644 (file)
index 0000000..bf19736
--- /dev/null
@@ -0,0 +1,308 @@
+#include <stdio.h>
+#include <libgen.h>
+#include <hgw/hgw.h>
+
+#include "snes9x.h"
+
+#include <glib.h>
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
+#include "platform.h"
+#include "hgw.h"
+#include "../gui/gconf.h"
+
+#define DIE(format, ...) do { \
+               fprintf(stderr, "Died at %s:%d: ", __FILE__, __LINE__ ); \
+               fprintf(stderr, format "\n", ## __VA_ARGS__); \
+               abort(); \
+       } while (0);
+
+bool hgwLaunched;
+static HgwContext *hgw;
+
+static void createActionMappingsOnly();
+static void parseGConfKeyMappings(GConfClient* gcc);
+
+void HgwInit()
+{
+       // hildon-games-wrapper sets this env variable for itself.
+       char* service = getenv("HGW_EXEC_SERVICE");
+
+       if (!service) {
+               // Not launched from hildon-games-wrapper
+               hgwLaunched = false;
+               return;
+       }
+
+       g_type_init();
+       hgw = hgw_context_init();
+
+       if (!hgw) {
+               fprintf(stderr, "Error opening hgw context\n");
+               hgwLaunched = false;
+       }
+
+       hgwLaunched = true;
+       printf("Loading in HGW mode\n");
+}
+
+void HgwDeinit()
+{
+       if (!hgwLaunched) return;
+
+       hgw_context_destroy(hgw,
+               (Config.snapshotSave ? HGW_BYE_PAUSED : HGW_BYE_INACTIVE));
+
+       hgw = 0;
+}
+
+void HgwConfig()
+{
+       if (!hgwLaunched) return;
+
+       GConfClient *gcc = gconf_client_get_default();
+
+       Config.fullscreen = true;
+
+       char romFile[PATH_MAX + 1];
+       if (hgw_conf_request_string(hgw, kGConfRomFile, romFile) == HGW_ERR_NONE
+               && strlen(romFile) > 0) {
+               S9xSetRomFile(romFile);
+       } else {
+               printf("Exiting gracefully because there's no ROM in Gconf\n");
+               HgwDeinit();
+               exit(0);
+       }
+
+       char sound = FALSE;
+       if (hgw_conf_request_bool(hgw, kGConfSound, &sound) == HGW_ERR_NONE) {
+               Config.enableAudio = sound ? true : false;
+       }
+
+       char turbo = FALSE;
+       if (hgw_conf_request_bool(hgw, kGConfTurboMode, &turbo) == HGW_ERR_NONE) {
+               Settings.TurboMode = turbo ? TRUE : FALSE;
+       }
+
+       int frameskip = 0;
+       if (hgw_conf_request_int(hgw, kGConfFrameskip, &frameskip) == HGW_ERR_NONE) {
+               Settings.SkipFrames = (frameskip > 0 ? frameskip : AUTO_FRAMERATE);
+       }
+
+       char transparency = FALSE;
+       if (hgw_conf_request_bool(hgw, kGConfTransparency, &transparency) == HGW_ERR_NONE) {
+               Settings.Transparency = transparency ? TRUE : FALSE;
+       }
+
+       char scaler[NAME_MAX];
+       if (hgw_conf_request_string(hgw, kGConfScaler, scaler) == HGW_ERR_NONE
+               && strlen(scaler) > 0) {
+               free(Config.scaler);
+               Config.scaler = strdup(scaler);
+       }
+
+       char displayFramerate = FALSE;
+       if (hgw_conf_request_bool(hgw, kGConfDisplayFramerate, &displayFramerate) == HGW_ERR_NONE) {
+               Settings.DisplayFrameRate = displayFramerate ? TRUE : FALSE;
+       }
+
+#if TODO
+       char displayControls = FALSE;
+       if (hgw_conf_request_bool(hgw, kGConfDisplayControls, &displayControls) == HGW_ERR_NONE) {
+               Config.touchscreenShow = displayControls ? true : false;
+       }
+#endif
+
+       int speedhacks = 0;
+       if (hgw_conf_request_int(hgw, kGConfSpeedhacks, &speedhacks) == HGW_ERR_NONE) {
+               if (speedhacks <= 0) {
+                       Settings.HacksEnabled = FALSE;
+                       Settings.HacksFilter = FALSE;
+               } else if (speedhacks == 1) {
+                       Settings.HacksEnabled = TRUE;
+                       Settings.HacksFilter = TRUE;
+               } else {
+                       Settings.HacksEnabled = TRUE;
+                       Settings.HacksFilter = FALSE;
+               }
+       }
+       if (Settings.HacksEnabled && !Config.hacksFile) {
+               // Provide a default speedhacks file
+               if (asprintf(&Config.hacksFile, "%s/snesadvance.dat", dirname(romFile))
+                               < 0) {
+                       Config.hacksFile = 0; // malloc error.
+               }
+               // remember that dirname garbles romFile.
+       }
+
+       gchar key[kGConfPlayerPathBufferLen];
+       gchar *relKey = key + sprintf(key, kGConfPlayerPath, 1);
+
+       strcpy(relKey, kGConfPlayerKeyboardEnable);
+       if (gconf_client_get_bool(gcc, key, NULL)) {
+               parseGConfKeyMappings(gcc);
+       } else {
+               createActionMappingsOnly();
+       }
+
+       HgwStartCommand cmd = hgw_context_get_start_command(hgw);
+       switch (cmd) {
+               default:
+               case HGW_COMM_NONE:     // called from libosso
+               case HGW_COMM_CONT:
+                       Config.snapshotLoad = true;
+                       Config.snapshotSave = true;
+                       break;
+               case HGW_COMM_RESTART:
+                       Config.snapshotLoad = false;
+                       Config.snapshotSave = true;
+                       break;
+               case HGW_COMM_QUIT:
+                       // hum, what?
+                       Config.snapshotLoad = false;
+                       Config.snapshotSave = false;
+                       Config.quitting = true;
+                       break;
+       }
+
+       g_object_unref(G_OBJECT(gcc));
+}
+
+void HgwPollEvents()
+{
+       if (!hgwLaunched) return;
+       
+       HgwMessage msg;
+       HgwMessageFlags flags = HGW_MSG_FLAG_NONE;
+       
+       if ( hgw_msg_check_incoming(hgw, &msg, flags) == HGW_ERR_COMMUNICATION ) {
+               // Message Incoming, process msg
+               
+               switch (msg.type) {
+                       case HGW_MSG_TYPE_CBREQ:
+                               switch (msg.e_val) {
+                                       case HGW_CB_QUIT:
+                                       case HGW_CB_EXIT:
+                                               Config.quitting = true;
+                                               break;
+                               }
+                               break;
+                       case HGW_MSG_TYPE_DEVSTATE:
+                               switch (msg.e_val) {
+                                       case HGW_DEVICE_STATE_SHUTDOWN:
+                                               Config.quitting = true; // try to quit gracefully
+                                               break;
+                               }
+                               break;
+                       default:
+                               // do nothing
+                               break;
+               }
+               
+               hgw_msg_free_data(&msg);
+       }
+}
+
+// For now, please keep this in sync with ../gui/controls.c
+typedef struct ButtonEntry {
+       const char * gconf_key;
+       unsigned long mask;
+       bool is_action;
+} ButtonEntry;
+#define BUTTON_INITIALIZER(button, name) \
+       { kGConfKeysPath "/" name, SNES_##button##_MASK, false }
+#define ACTION_INITIALIZER(action, name) \
+       { kGConfKeysPath "/" name, kAction##action, true }
+#define BUTTON_LAST    \
+       { 0 }
+
+static const ButtonEntry buttons[] = {
+#define HELP(...)
+#define P(x) SNES_##x##_MASK
+#define A(x) kAction##x
+#define BUTTON(description, slug, actions, d, f) \
+       { G_STRINGIFY(slug), actions, false },
+#define ACTION(description, slug, actions, d, f) \
+       { G_STRINGIFY(slug), actions, true },
+#define LAST \
+       { 0 }
+#include "../gui/buttons.inc"
+#undef HELP
+#undef P
+#undef A
+#undef BUTTON
+#undef ACTION
+#undef LAST
+};
+
+static void createActionMappingsOnly()
+{
+       // Map quit to fullscreen, escape and task switch.
+       Config.action[72] = kActionQuit;
+       Config.action[9] = kActionQuit;
+       Config.action[71] = kActionQuit;
+}
+
+static void parseGConfKeyMappings(GConfClient* gcc)
+{
+       // Build player 1 keyboard gconf key relative path
+       gchar key[kGConfPlayerPathBufferLen];
+       gchar *relKey = key + sprintf(key,
+               kGConfPlayerPath kGConfPlayerKeyboardPath "/", 1);
+
+       // If the user does not map fullscreen or quit
+       bool quit_mapped = false;
+
+       printf("Hgw: Using gconf key mappings\n");
+       // Thus ignoring config file key mappings
+       ZeroMemory(Config.joypad1Mapping, sizeof(Config.joypad1Mapping));
+       ZeroMemory(Config.action, sizeof(Config.action));
+
+       int i, scancode;
+       for (i = 0; buttons[i].gconf_key; i++) {
+               strcpy(relKey, buttons[i].gconf_key);
+               scancode = gconf_client_get_int(gcc, key, NULL);
+
+               if (scancode <= 0 || scancode > 255) continue;
+
+               if (buttons[i].is_action) {
+                       Config.action[scancode] |= buttons[i].mask;
+                       if (buttons[i].mask & (kActionQuit | kActionToggleFullscreen)) {
+                               quit_mapped = true;
+                       }
+               } else {
+                       Config.joypad1Mapping[scancode] |= buttons[i].mask;
+               }
+       }
+
+#if MAEMO && !CONF_EXIT_BUTTON
+       // Safeguards
+       if (!quit_mapped) {
+               // Newbie user won't know how to quit game.
+               if (!Config.joypad1Mapping[72] && !Config.action[72]) {
+                       // Fullscreen key is not mapped, map
+                       Config.action[72] = kActionQuit;
+                       quit_mapped = true;
+               }
+               if (!quit_mapped && !Config.joypad1Mapping[9] && !Config.action[9]) {
+                       // Escape key is not mapped, map
+                       // But only if we couldn't map quit to fullscreen. Some people
+                       // actually want Quit not to be mapped.
+                       Config.action[9] = kActionQuit;
+                       quit_mapped = true;
+               }
+               if (!quit_mapped) {
+                       // Force mapping of fullscreen to Quit if can't map anywhere else.
+                       Config.joypad1Mapping[72] = 0;
+                       Config.action[72] = kActionQuit;
+               }
+       }
+
+       // If task switch key is not mapped, map it to Quit by default.
+       if (!Config.action[71] && !Config.joypad1Mapping[71]) {
+               Config.action[71] = kActionQuit;
+       }
+#endif
+}
+
diff --git a/platform/osso.h b/platform/osso.h
new file mode 100644 (file)
index 0000000..f4f9be5
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _PLATFORM_GUICONF_H_
+#define _PLATFORM_GUICONF_H_
+
+START_EXTERN_C
+
+/** Called from main() before loading config; connects to DBus. */
+void GuiConfInit();
+/** Called from main() before closing. */
+void HgwDeinit();
+/** Called from main() after loading user config; loads GUI settings. */
+void HgwConfig();
+/** Called from main() in the event loop; polls DBus. */
+void GuiConfigPollEvents();
+
+END_EXTERN_C
+
+#endif
+