#include "platform.h"
#include "snes9x.h"
+#include "cpuexec.h"
#include "gfx.h"
+#include "ppu.h"
#include "display.h"
#include "memmap.h"
#include "soundux.h"
}
}
+#if CONF_HGW
/** Wraps HgwPollEvents, taking care of kPollHgwEveryNFrames */
static inline void pollHgwEvents() {
static int frames = 0;
frames = 0;
}
}
+#endif
int main(int argc, const char ** argv) {
// Initialise SDL
DIE("SDL_Init: %s", SDL_GetError());
// Configure snes9x
+#if CONF_HGW
HgwInit(); // Hildon-games-wrapper initialization.
+#endif
S9xLoadConfig(argc, argv); // Load config files and parse cmd line.
+#if CONF_HGW
HgwConfig(); // Apply specific hildon-games config.
+#endif
// S9x initialization
S9xInitDisplay(argc, argv);
// Late initialization
sprintf(String, "DrNokSnes - %s", Memory.ROMName);
S9xSetTitle(String);
- S9xHacksLoadFile(Config.hacksFile[0] ? Config.hacksFile : 0);
+ S9xHacksLoadFile(Config.hacksFile);
if (!S9xGraphicsInit())
DIE("S9xGraphicsInit failed");
S9xAudioOutputEnable(true);
frameSync(); // May block, or set frameskip to true.
S9xMainLoop(); // Does CPU things, renders if needed.
pollEvents();
+#if CONF_HGW
pollHgwEvents();
+#endif
} while (!Config.quitting);
// Deinitialization
S9xAudioOutputEnable(false);
+ S9xDeinitInputDevices();
S9xDeinitAudioOutput();
S9xDeinitDisplay();
S9xGraphicsDeinit();
Memory.Deinit();
S9xUnloadConfig();
+#if CONF_HGW
HgwDeinit();
+#endif
SDL_Quit();
if (action & kActionQuit)
Config.quitting = true;
- if (action & kActionToggleFullscreen)
+ if (action & kActionToggleFullscreen) {
S9xVideoToggleFullscreen();
+ }
+
+ if (action & kActionQuickLoad1) {
+ const char * file = S9xGetQuickSaveFilename(1);
+ int result = S9xUnfreezeGame(file);
+ S9xSetInfoString("Load slot %u: %s", 1,
+ (result ? "done" : "failed"));
+ }
+
+ if (action & kActionQuickSave1) {
+ const char * file = S9xGetQuickSaveFilename(1);
+ int result = S9xFreezeGame(file);
+ S9xSetInfoString("Save slot %u: %s", 1,
+ (result ? "done" : "failed"));
+ }
+
+ if (action & kActionQuickLoad2) {
+ const char * file = S9xGetQuickSaveFilename(2);
+ int result = S9xUnfreezeGame(file);
+ S9xSetInfoString("Load slot %u: %s", 2,
+ (result ? "done" : "failed"));
+ }
+
+ if (action & kActionQuickSave2) {
+ const char * file = S9xGetQuickSaveFilename(2);
+ int result = S9xFreezeGame(file);
+ S9xSetInfoString("Save slot %u: %s", 2,
+ (result ? "done" : "failed"));
+ }
}