* Using SDL_haa for scaling in Fremantle now.
* Reworked GUI key mapping gconf entries.
* Using GConfClient instead of HGW. Removing dependency on hgw.
+ * Moved config file from ~/apps to ~/.config
+ * Added new "saver" setting.
- -- Javier S. Pedro <maemo@javispedro.com> Mon, 1 Feb 2010 00:27:45 +0100
+ -- Javier S. Pedro <maemo@javispedro.com> Mon, 1 Feb 2010 02:26:00 +0100
drnoksnes (1.2.5) unstable; urgency=low
</locale>
</schema>
<schema>
+ <key>/schemas/apps/maemo/drnoksnes/saver</key>
+ <applyto>/apps/maemo/drnoksnes/saver</applyto>
+ <owner>drnoksnes</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Enable power saving</short>
+ <long>
+ This will save and close the emulator when it is deactivated or
+ the device enters idle state.
+ </long>
+ </locale>
+ </schema>
+ <schema>
<key>/schemas/apps/maemo/drnoksnes/sound</key>
<applyto>/apps/maemo/drnoksnes/sound</applyto>
<owner>drnoksnes</owner>
#define kGConfPath "/apps/maemo/drnoksnes"
#define kGConfRomFile kGConfPath "/" "rom"
+#define kGConfSaver kGConfPath "/" "saver"
#define kGConfSound kGConfPath "/" "sound"
#define kGConfTurboMode kGConfPath "/" "turbo"
#define kGConfFrameskip kGConfPath "/" "frameskip"
msgstr ""
"Project-Id-Version: drnoksnes\n"
"Report-Msgid-Bugs-To: maemo@javispedro.com\n"
-"POT-Creation-Date: 2010-01-26 20:44+0100\n"
+"POT-Creation-Date: 2010-01-28 01:47+0100\n"
"PO-Revision-Date: 2010-01-28 09:50+0100\n"
"Last-Translator: Philipp Zabel <philipp.zabel@gmail.com>\n"
"Language-Team: German\n"
msgid "Show while in game"
msgstr "Im Spiel anzeigen"
-#: plugin.c:295
-#: plugin.c:313
+#: plugin.c:295 plugin.c:313
msgid "Turbo mode"
msgstr "Turbomodus"
msgid "Display framerate"
msgstr "Bildwiederholrate anzeigen"
-#: plugin.c:334
-#: settings.c:224
+#: plugin.c:334 settings.c:224
msgid "Accurate graphics"
msgstr "Akkurate Grafik"
msgid "Framerate:"
msgstr "Bildwiederholrate:"
-#: plugin.c:347
-#: settings.c:249
+#: plugin.c:347 settings.c:249
msgid "No speedhacks"
msgstr "Keine Speedhacks"
-#: plugin.c:348
-#: settings.c:250
+#: plugin.c:348 settings.c:250
msgid "Safe hacks only"
msgstr "Nur sichere Hacks"
-#: plugin.c:349
-#: settings.c:251
+#: plugin.c:349 settings.c:251
msgid "All speedhacks"
msgstr "Alle Speedhacks"
msgid "Settings…"
msgstr "Einstellungen..."
-#: plugin.c:448
-#: plugin.c:457
+#: plugin.c:448 plugin.c:457
msgid "About…"
msgstr "Über..."
-#: plugin.c:456
-#: settings.c:177
+#: plugin.c:456 settings.c:177
msgid "Settings"
msgstr "Einstellungen"
msgid "Zeemote"
msgstr "Zeemote"
-#: keys.c:267
+#: keys.c:266
#, c-format
msgid "Player %d keys"
msgstr "Spieler %d Tasten"
-#: keys.c:270
+#: keys.c:269
msgid "Defaults"
msgstr "Standardeinstellungen"
-#: settings.c:52
-#: settings.c:59
-#: settings.c:61
+#: settings.c:52 settings.c:59 settings.c:61
msgid "2x zoom"
msgstr "2x Vergrößerung"
#: buttons.inc:27
msgid "Quick Save 2"
msgstr "Schnell speichern 2"
-
msgstr ""
"Project-Id-Version: drnoksnes\n"
"Report-Msgid-Bugs-To: maemo@javispedro.com\n"
-"POT-Creation-Date: 2010-01-26 20:44+0100\n"
+"POT-Creation-Date: 2010-01-28 01:47+0100\n"
"PO-Revision-Date: 2010-01-28 00:42+0100\n"
"Last-Translator: Tomasz Dominikowski <dominikowski@gmail.com>\n"
"Language-Team: Polish <dominikowski@gmail.com>\n"
msgid "Show while in game"
msgstr "Wyświetlaj podczas gry"
-#: plugin.c:295
-#: plugin.c:313
+#: plugin.c:295 plugin.c:313
msgid "Turbo mode"
msgstr "Tryb Turbo"
msgid "Display framerate"
msgstr "Wyświetlaj liczbę klatek/s"
-#: plugin.c:334
-#: settings.c:224
+#: plugin.c:334 settings.c:224
msgid "Accurate graphics"
msgstr "Dokładna grafika"
msgid "Framerate:"
msgstr "Klatek/s:"
-#: plugin.c:347
-#: settings.c:249
+#: plugin.c:347 settings.c:249
msgid "No speedhacks"
msgstr "Bez sztuczek z prędkością"
-#: plugin.c:348
-#: settings.c:250
+#: plugin.c:348 settings.c:250
msgid "Safe hacks only"
msgstr "Tylko bezpieczne sztuczki"
-#: plugin.c:349
-#: settings.c:251
+#: plugin.c:349 settings.c:251
msgid "All speedhacks"
msgstr "Wszystkie sztuczki z prędkością"
msgid "Settings…"
msgstr "Ustawienia..."
-#: plugin.c:448
-#: plugin.c:457
+#: plugin.c:448 plugin.c:457
msgid "About…"
msgstr "O programie..."
-#: plugin.c:456
-#: settings.c:177
+#: plugin.c:456 settings.c:177
msgid "Settings"
msgstr "Ustawienia"
msgid "Zeemote"
msgstr "Zeemote"
-#: keys.c:267
+#: keys.c:266
#, c-format
msgid "Player %d keys"
msgstr "Klawisze gracza %d"
-#: keys.c:270
+#: keys.c:269
msgid "Defaults"
msgstr "Domyślne"
-#: settings.c:52
-#: settings.c:59
-#: settings.c:61
+#: settings.c:52 settings.c:59 settings.c:61
msgid "2x zoom"
msgstr "2x przybliżenie"
#: buttons.inc:27
msgid "Quick Save 2"
msgstr "Szybki zapis 2"
-
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"
+"POT-Creation-Date: 2010-01-28 01:47+0100\n"
"PO-Revision-Date: 2010-01-28 05:00+0100\n"
"Last-Translator: Robert Hägerström <rofo1000@gmail.com>\n"
"Language-Team: Swedish\n"
msgid "Zeemote"
msgstr "Zeemote"
-#: keys.c:267
+#: keys.c:266
#, c-format
msgid "Player %d keys"
msgstr "Spelare %d tangenter"
-#: keys.c:270
+#: keys.c:269
msgid "Defaults"
msgstr "Standard"
basePath = 0;
Config.quitting = false;
+ Config.saver = false;
Config.enableAudio = true;
Config.fullscreen = false;
Config.scaler = 0;
return OSSO_OK;
}
+static void ossoHwCallback(osso_hw_state_t *state, gpointer data)
+{
+ if (state->shutdown_ind) {
+ // Shutting down. Try to quit gracefully.
+ S9xDoAction(kActionQuit);
+ }
+ if (Config.saver && state->system_inactivity_ind) {
+ // Screen went off, and power saving is active.
+ S9xDoAction(kActionQuit);
+ }
+}
+
/** Called from main(), initializes Glib & libosso stuff if needed. */
void OssoInit()
{
}
g_type_init();
+ g_set_prgname("drnoksnes");
+ g_set_application_name("DrNokSnes");
mainContext = g_main_context_default();
mainLoop = g_main_loop_new(mainContext, FALSE);
ossoContext = osso_initialize("com.javispedro.drnoksnes", "1", 0, 0);
osso_return_t ret;
ret = osso_rpc_set_default_cb_f(ossoContext, ossoAppCallback, 0);
- g_assert(ret == OSSO_OK);
+ g_warn_if_fail(ret == OSSO_OK);
+
+ osso_hw_state_t hwStateFlags = { FALSE };
+ hwStateFlags.shutdown_ind = TRUE;
+ hwStateFlags.system_inactivity_ind = TRUE;
+ ret = osso_hw_set_event_cb(ossoContext, &hwStateFlags, ossoHwCallback, 0);
+ g_warn_if_fail(ret == OSSO_OK);
printf("Osso: Initialized libosso\n");
}
}
// Read most of the non-player specific settings
+ Config.saver = gconf_client_get_bool(gcc, kGConfSaver, 0);
Config.enableAudio = gconf_client_get_bool(gcc, kGConfSound, 0);
Settings.TurboMode = gconf_client_get_bool(gcc, kGConfTurboMode, 0);
Settings.Transparency = gconf_client_get_bool(gcc, kGConfTransparency, 0);
g_free(romFile);
+ // Read player 1 controls
gchar key[kGConfPlayerPathBufferLen];
gchar *relKey = key + sprintf(key, kGConfPlayerPath, 1);
g_main_context_iteration(mainContext, TRUE);
}
+ // The command we received from the launcher will tell us if we have to
+ // load a snapshot file.
switch (startupCommand) {
case STARTUP_COMMAND_RUN:
case STARTUP_COMMAND_RESTART:
g_object_unref(G_OBJECT(gcc));
}
+/** This is called periodically from the main loop.
+ Iterates the GLib loop to get D-Bus events.
+ */
void OssoPollEvents()
{
if (!OssoOk()) return;
char * scaler;
/** Audio output enabled */
bool enableAudio;
+ /** Quit when the emulator window is deactivated */
+ bool saver;
/** Speedhacks file to use */
char * hacksFile;
/** Enable touchscreen controls */
/** The current scaler object */
Scaler* scaler;
+/** Use the current window size to calculate screen size.
+ Useful on "single window" platforms, like Hildon.
+ */
static void calculateScreenSize()
{
SDL_SysWMinfo wminfo;
}
}
+/** Sets the main window title */
void S9xSetTitle(const char *title)
{
+ // This is a Maemo specific hack, but works on most platforms.
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if ( SDL_GetWMInfo(&info) ) {
const unsigned gameHeight = IMAGE_HEIGHT;
#ifdef MAEMO
+ // Under Maemo we know that the window manager will automatically
+ // resize our windows to fullscreen.
+ // Thus we can use that to detect the screen size.
+ // Of course, this causes flicker, so we try to avoid it when
+ // changing between modes.
if ((Config.fullscreen && !gotScreenSize) ||
(!Config.fullscreen && !gotWindowSize)) {
- // Do a first try, in order to get window/screen size
screen = SDL_SetVideoMode(gameWidth, gameHeight, 16,
SDL_SWSURFACE | SDL_RESIZABLE |
(Config.fullscreen ? SDL_FULLSCREEN : 0));
scaler = sFactory->instantiate(screen, gameWidth, gameHeight);
- // We get pitch surface values from SDL
+ // Each scaler may have its own pitch
GFX.RealPitch = GFX.Pitch = scaler->getDrawBufferPitch();
GFX.ZPitch = GFX.Pitch / 2; // gfx & tile.cpp depend on this, unfortunately.
GFX.PixSize = screen->format->BitsPerPixel / 8;
void processVideoEvent(const SDL_Event& event)
{
+ // If we're in power save mode, and this is a defocus event, quit.
+ if (Config.saver) {
+ if (event.type == SDL_ACTIVEEVENT &&
+ (event.active.state & SDL_APPINPUTFOCUS) &&
+ !event.active.gain) {
+ S9xDoAction(kActionQuit);
+ return;
+ }
+ }
+
+ // Forward video event to the active scaler, if any.
if (scaler)
scaler->filter(event);
}
-// This is here for completeness, but palette mode is useless on N8x0
+// This is here for completeness, but palette mode is mostly useless (slow).
void S9xSetPalette ()
{
if (Settings.SixteenBit) return;
SDL_SetColors(screen, colors, 0, 256);
}
+/** Called before rendering a frame.
+ This function must ensure GFX.Screen points to something, but we did that
+ while initializing video output.
+ @return TRUE if we should render the frame.
+ */
bool8_32 S9xInitUpdate ()
{
scaler->prepare();
return TRUE;
}
+/** Called after rendering a frame. */
bool8_32 S9xDeinitUpdate (int width, int height, bool8_32 sixteenBit)
{
scaler->finish();
bool filter(const SDL_Event& event)
{
- if (event.type == SDL_ACTIVEEVENT) {
- if (scaler && (event.active.state & SDL_APPINPUTFOCUS)) {
- if (event.active.gain)
- scaler->resume();
- else
- scaler->pause();
-
- return true;
+ if (event.type == SDL_ACTIVEEVENT &&
+ (event.active.state & SDL_APPINPUTFOCUS)) {
+ if (event.active.gain) {
+ resume();
+ } else {
+ pause();
}
+
+ return true;
}
return false;