added command line argurments for exiting on button pushes and
autoloading/autosaving various other small changes around the source, but the big changes to the program are the command line arguments --abstartselectexit (0 or 1) --autoload (0-9 or greater than 9 for no autoload) --autosave (0-9 or greater than 9 for no autosave) autosaving only occurs when sdl.cpp:CloseGame() is called, which doesn't appear to happen when the window is "X'd out"
This commit is contained in:
parent
f645cc891e
commit
0ad7a6ed08
|
@ -1,13 +1,12 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <csignal>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <strings.h>
|
#include <cerrno>
|
||||||
#include <errno.h>
|
#include <cstdio>
|
||||||
#include <stdio.h>
|
#include <cstdlib>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "throttle.h"
|
#include "throttle.h"
|
||||||
|
@ -26,6 +25,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a custom pallete from a file and load it into the core.
|
* Read a custom pallete from a file and load it into the core.
|
||||||
*/
|
*/
|
||||||
|
@ -236,6 +236,8 @@ InitConfig()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
config->addOption("autoloadstate", "SDL.AutoLoadState", INVALID_STATE);
|
||||||
|
config->addOption("autosavestate", "SDL.AutoSaveState", INVALID_STATE);
|
||||||
|
|
||||||
#ifdef _GTK
|
#ifdef _GTK
|
||||||
char* home_dir = getenv("HOME");
|
char* home_dir = getenv("HOME");
|
||||||
|
@ -256,6 +258,8 @@ InitConfig()
|
||||||
// enable new PPU core
|
// enable new PPU core
|
||||||
config->addOption("newppu", "SDL.NewPPU", 0);
|
config->addOption("newppu", "SDL.NewPPU", 0);
|
||||||
|
|
||||||
|
// quit when a+b+select+start is pressed
|
||||||
|
config->addOption("abstartselectexit", "SDL.ABStartSelectExit", 0);
|
||||||
|
|
||||||
// GamePad 0 - 3
|
// GamePad 0 - 3
|
||||||
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++) {
|
for(unsigned int i = 0; i < GAMEPAD_NUM_DEVICES; i++) {
|
||||||
|
|
|
@ -9,18 +9,20 @@ int LoadCPalette(const std::string &file);
|
||||||
|
|
||||||
// hotkey definitions
|
// hotkey definitions
|
||||||
// TODO: encapsulate this in an improved data structure
|
// TODO: encapsulate this in an improved data structure
|
||||||
enum HOTKEY { HK_CHEAT_MENU, HK_BIND_STATE, HK_LOAD_LUA, HK_TOGGLE_BG,
|
enum HOTKEY { HK_CHEAT_MENU=0, HK_BIND_STATE, HK_LOAD_LUA, HK_TOGGLE_BG,
|
||||||
HK_SAVE_STATE, HK_FDS_SELECT, HK_LOAD_STATE, HK_FDS_EJECT ,
|
HK_SAVE_STATE, HK_FDS_SELECT, HK_LOAD_STATE, HK_FDS_EJECT ,
|
||||||
HK_VS_INSERT_COIN, HK_VS_TOGGLE_DIPSWITCH,
|
HK_VS_INSERT_COIN, HK_VS_TOGGLE_DIPSWITCH,
|
||||||
HK_TOGGLE_FRAME_DISPLAY, HK_TOGGLE_SUBTITLE, HK_RESET, HK_SCREENSHOT,
|
HK_TOGGLE_FRAME_DISPLAY, HK_TOGGLE_SUBTITLE, HK_RESET, HK_SCREENSHOT,
|
||||||
HK_PAUSE, HK_DECREASE_SPEED, HK_INCREASE_SPEED, HK_FRAME_ADVANCE, HK_TURBO,
|
HK_PAUSE, HK_DECREASE_SPEED, HK_INCREASE_SPEED, HK_FRAME_ADVANCE, HK_TURBO,
|
||||||
HK_TOGGLE_INPUT_DISPLAY, HK_MOVIE_TOGGLE_RW, HK_MUTE_CAPTURE, HK_QUIT, HK_FA_LAG_SKIP, HK_LAG_COUNTER_DISPLAY,
|
HK_TOGGLE_INPUT_DISPLAY, HK_MOVIE_TOGGLE_RW, HK_MUTE_CAPTURE, HK_QUIT,
|
||||||
|
HK_FA_LAG_SKIP, HK_LAG_COUNTER_DISPLAY,
|
||||||
HK_SELECT_STATE_0, HK_SELECT_STATE_1, HK_SELECT_STATE_2, HK_SELECT_STATE_3,
|
HK_SELECT_STATE_0, HK_SELECT_STATE_1, HK_SELECT_STATE_2, HK_SELECT_STATE_3,
|
||||||
HK_SELECT_STATE_4, HK_SELECT_STATE_5, HK_SELECT_STATE_6, HK_SELECT_STATE_7,
|
HK_SELECT_STATE_4, HK_SELECT_STATE_5, HK_SELECT_STATE_6, HK_SELECT_STATE_7,
|
||||||
HK_SELECT_STATE_8, HK_SELECT_STATE_9,
|
HK_SELECT_STATE_8, HK_SELECT_STATE_9,
|
||||||
HK_SELECT_STATE_NEXT, HK_SELECT_STATE_PREV};
|
HK_SELECT_STATE_NEXT, HK_SELECT_STATE_PREV, HK_MAX};
|
||||||
|
|
||||||
|
const int INVALID_STATE = 99;
|
||||||
|
|
||||||
const int HK_MAX = 37;
|
|
||||||
|
|
||||||
static const char* HotkeyStrings[HK_MAX] = {
|
static const char* HotkeyStrings[HK_MAX] = {
|
||||||
"CheatMenu",
|
"CheatMenu",
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
extern CFGSTRUCT DriverConfig[];
|
extern CFGSTRUCT DriverConfig[];
|
||||||
extern ARGPSTRUCT DriverArgs[];
|
extern ARGPSTRUCT DriverArgs[];
|
||||||
extern char *DriverUsage;
|
|
||||||
|
|
||||||
void DoDriverArgs(void);
|
void DoDriverArgs(void);
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "dface.h"
|
#include "dface.h"
|
||||||
|
@ -320,9 +320,12 @@ std::string GetFilename (const char *title, bool save, const char *filter)
|
||||||
std::string GetUserText (const char *title)
|
std::string GetUserText (const char *title)
|
||||||
{
|
{
|
||||||
#ifdef _GTK
|
#ifdef _GTK
|
||||||
/* prg318 - 10/13/11 - this is broken in recent build and causes segfaults/very weird behavior
|
/* prg318 - 10/13/11 - this is broken in recent build and causes
|
||||||
i'd rather remove it for now than it cause accidental segfaults
|
* segfaults/very weird behavior i'd rather remove it for now than it cause
|
||||||
TODO fix it
|
* accidental segfaults
|
||||||
|
* TODO fix it
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
|
||||||
GtkWidget* d;
|
GtkWidget* d;
|
||||||
GtkWidget* entry;
|
GtkWidget* entry;
|
||||||
|
@ -370,7 +373,7 @@ std::string GetUserText (const char *title)
|
||||||
break;
|
break;
|
||||||
input += c;
|
input += c;
|
||||||
}
|
}
|
||||||
pclose(fpipe);*//*
|
pclose(fpipe);
|
||||||
gtk_widget_destroy(d);
|
gtk_widget_destroy(d);
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,7 +382,7 @@ std::string GetUserText (const char *title)
|
||||||
|
|
||||||
FCEUI_ToggleEmulationPause(); // unpause emulation
|
FCEUI_ToggleEmulationPause(); // unpause emulation
|
||||||
return input;
|
return input;
|
||||||
*/
|
#endif // #if 0
|
||||||
#endif
|
#endif
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -495,8 +498,10 @@ static void KeyboardCommands ()
|
||||||
{
|
{
|
||||||
is_alt = 1;
|
is_alt = 1;
|
||||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
// workaround for GDK->SDL in GTK problems where ALT release is never getting sent
|
// workaround for GDK->SDL in GTK problems where ALT release is never
|
||||||
// i know this is sort of an ugly hack to fix this, but the bug is rather annoying
|
// getting sent
|
||||||
|
// I know this is sort of an ugly hack to fix this, but the bug is
|
||||||
|
// rather annoying
|
||||||
// prg318 10/23/11
|
// prg318 10/23/11
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
g_config->getOption ("SDL.Fullscreen", &fullscreen);
|
g_config->getOption ("SDL.Fullscreen", &fullscreen);
|
||||||
|
@ -627,7 +632,7 @@ static void KeyboardCommands ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FCEUI_LoadState (NULL);
|
FCEUI_LoadState(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1119,7 +1124,7 @@ ButtConfig GamePadConfig[4][10] = {
|
||||||
* Update the status of the gamepad input devices.
|
* Update the status of the gamepad input devices.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
UpdateGamepad (void)
|
UpdateGamepad(void)
|
||||||
{
|
{
|
||||||
// don't update during movie playback
|
// don't update during movie playback
|
||||||
if (FCEUMOV_Mode (MOVIEMODE_PLAY))
|
if (FCEUMOV_Mode (MOVIEMODE_PLAY))
|
||||||
|
@ -1150,19 +1155,33 @@ UpdateGamepad (void)
|
||||||
if(opposite_dirs == 0)
|
if(opposite_dirs == 0)
|
||||||
{
|
{
|
||||||
// test for left+right and up+down
|
// test for left+right and up+down
|
||||||
if(x == 4)
|
if(x == 4){
|
||||||
up = true;
|
up = true;
|
||||||
if((x == 5) && (up == true))
|
}
|
||||||
|
if((x == 5) && (up == true)){
|
||||||
continue;
|
continue;
|
||||||
if(x == 6)
|
}
|
||||||
|
if(x == 6){
|
||||||
left = true;
|
left = true;
|
||||||
if((x == 7) && (left == true))
|
}
|
||||||
|
if((x == 7) && (left == true)){
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
JS |= (1 << x) << (wg << 3);
|
JS |= (1 << x) << (wg << 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int four_button_exit;
|
||||||
|
g_config->getOption("SDL.ABStartSelectExit", &four_button_exit);
|
||||||
|
// if a+b+start+select is pressed, exit
|
||||||
|
if (four_button_exit && JS == 15) {
|
||||||
|
FCEUI_printf("all buttons pressed, exiting\n");
|
||||||
|
CloseGame();
|
||||||
|
FCEUI_Kill();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
// rapid-fire a, rapid-fire b
|
// rapid-fire a, rapid-fire b
|
||||||
if (rapid)
|
if (rapid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief Handles the graphical game display for the SDL implementation.
|
/// \brief Handles the graphical game display for the SDL implementation.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "sdl.h"
|
#include "sdl.h"
|
||||||
#include "sdl-opengl.h"
|
#include "sdl-opengl.h"
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <csignal>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include <strings.h>
|
#include <cerrno>
|
||||||
#include <errno.h>
|
#include <cstdio>
|
||||||
#include <stdio.h>
|
#include <cstdlib>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
#ifdef _GTK
|
#ifdef _GTK
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
@ -72,53 +71,64 @@ int mutecapture;
|
||||||
static int noconfig;
|
static int noconfig;
|
||||||
|
|
||||||
// -Video Modes Tag- : See --special
|
// -Video Modes Tag- : See --special
|
||||||
char *DriverUsage="\
|
static const char *DriverUsage=
|
||||||
Option Value Description\n\
|
"Option Value Description\n"
|
||||||
--pal {0|1} Use PAL timing.\n\
|
"--pal {0|1} Use PAL timing.\n"
|
||||||
--newppu {0|1} Enable the new PPU core. (WARNING: May break savestates)\n\
|
"--newppu {0|1} Enable the new PPU core. (WARNING: May break savestates)\n"
|
||||||
--inputcfg d Configures input device d on startup.\n\
|
"--inputcfg d Configures input device d on startup.\n"
|
||||||
--input(1,2) d Set which input device to emulate for input 1 or 2.\n\
|
"--input(1,2) d Set which input device to emulate for input 1 or 2.\n"
|
||||||
Devices: gamepad zapper powerpad.0 powerpad.1 arkanoid\n\
|
" Devices: gamepad zapper powerpad.0 powerpad.1\n"
|
||||||
--input(3,4) d Set the famicom expansion device to emulate for input(3, 4)\n\
|
" arkanoid\n"
|
||||||
Devices: quizking hypershot mahjong toprider ftrainer\n\
|
"--input(3,4) d Set the famicom expansion device to emulate for\n"
|
||||||
familykeyboard oekakids arkanoid shadow bworld 4player\n\
|
" input(3, 4)\n"
|
||||||
--gamegenie {0|1} Enable emulated Game Genie.\n\
|
" Devices: quizking hypershot mahjong toprider ftrainer\n"
|
||||||
--frameskip x Set # of frames to skip per emulated frame.\n\
|
" familykeyboard oekakids arkanoid shadow bworld\n"
|
||||||
--xres x Set horizontal resolution for full screen mode.\n\
|
" 4player\n"
|
||||||
--yres x Set vertical resolution for full screen mode.\n\
|
"--gamegenie {0|1} Enable emulated Game Genie.\n"
|
||||||
--autoscale {0|1} Enable autoscaling in fullscreen. \n\
|
"--frameskip x Set # of frames to skip per emulated frame.\n"
|
||||||
--keepratio {0|1} Keep native NES aspect ratio when autoscaling. \n\
|
"--xres x Set horizontal resolution for full screen mode.\n"
|
||||||
--(x/y)scale x Multiply width/height by x. \n\
|
"--yres x Set vertical resolution for full screen mode.\n"
|
||||||
(Real numbers >0 with OpenGL, otherwise integers >0).\n\
|
"--autoscale {0|1} Enable autoscaling in fullscreen. \n"
|
||||||
--(x/y)stretch {0|1} Stretch to fill surface on x/y axis (OpenGL only).\n\
|
"--keepratio {0|1} Keep native NES aspect ratio when autoscaling. \n"
|
||||||
--bpp {8|16|32} Set bits per pixel.\n\
|
"--(x/y)scale x Multiply width/height by x. \n"
|
||||||
--opengl {0|1} Enable OpenGL support.\n\
|
" (Real numbers >0 with OpenGL, otherwise integers >0).\n"
|
||||||
--fullscreen {0|1} Enable full screen mode.\n\
|
"--(x/y)stretch {0|1} Stretch to fill surface on x/y axis (OpenGL only).\n"
|
||||||
--noframe {0|1} Hide title bar and window decorations.\n\
|
"--bpp {8|16|32} Set bits per pixel.\n"
|
||||||
--special {1-4} Use special video scaling filters\n\
|
"--opengl {0|1} Enable OpenGL support.\n"
|
||||||
(1 = hq2x 2 = Scale2x 3 = NTSC 2x 4 = hq3x 5 = Scale3x)\n\
|
"--fullscreen {0|1} Enable full screen mode.\n"
|
||||||
--palette f Load custom global palette from file f.\n\
|
"--noframe {0|1} Hide title bar and window decorations.\n"
|
||||||
--sound {0|1} Enable sound.\n\
|
"--special {1-4} Use special video scaling filters\n"
|
||||||
--soundrate x Set sound playback rate to x Hz.\n\
|
" (1 = hq2x 2 = Scale2x 3 = NTSC 2x 4 = hq3x\n"
|
||||||
--soundq {0|1|2} Set sound quality. (0 = Low 1 = High 2 = Very High)\n\
|
" 5 = Scale3x)\n"
|
||||||
--soundbufsize x Set sound buffer size to x ms.\n\
|
"--palette f Load custom global palette from file f.\n"
|
||||||
--volume {0-256} Set volume to x.\n\
|
"--sound {0|1} Enable sound.\n"
|
||||||
--soundrecord f Record sound to file f.\n\
|
"--soundrate x Set sound playback rate to x Hz.\n"
|
||||||
--playmov f Play back a recorded FCM/FM2/FM3 movie from filename f.\n\
|
"--soundq {0|1|2} Set sound quality. (0 = Low 1 = High 2 = Very High)\n"
|
||||||
--pauseframe x Pause movie playback at frame x.\n\
|
"--soundbufsize x Set sound buffer size to x ms.\n"
|
||||||
--fcmconvert f Convert fcm movie file f to fm2.\n\
|
"--volume {0-256} Set volume to x.\n"
|
||||||
--ripsubs f Convert movie's subtitles to srt\n\
|
"--soundrecord f Record sound to file f.\n"
|
||||||
--subtitles {0,1} Enable subtitle display\n\
|
"--playmov f Play back a recorded FCM/FM2/FM3 movie from filename f.\n"
|
||||||
--fourscore {0,1} Enable fourscore emulation\n\
|
"--pauseframe x Pause movie playback at frame x.\n"
|
||||||
--no-config {0,1} Use default config file and do not save\n\
|
"--fcmconvert f Convert fcm movie file f to fm2.\n"
|
||||||
--net s Connect to server 's' for TCP/IP network play.\n\
|
"--ripsubs f Convert movie's subtitles to srt\n"
|
||||||
--port x Use TCP/IP port x for network play.\n\
|
"--subtitles {0|1} Enable subtitle display\n"
|
||||||
--user x Set the nickname to use in network play.\n\
|
"--fourscore {0|1} Enable fourscore emulation\n"
|
||||||
--pass x Set password to use for connecting to the server.\n\
|
"--no-config {0|1} Use default config file and do not save\n"
|
||||||
--netkey s Use string 's' to create a unique session for the game loaded.\n\
|
"--net s Connect to server 's' for TCP/IP network play.\n"
|
||||||
--players x Set the number of local players in a network play session.\n\
|
"--port x Use TCP/IP port x for network play.\n"
|
||||||
--rp2mic {0,1} Replace Port 2 Start with microphone (Famicom).\n\
|
"--user x Set the nickname to use in network play.\n"
|
||||||
--nogui Don't load the GTK GUI";
|
"--pass x Set password to use for connecting to the server.\n"
|
||||||
|
"--netkey s Use string 's' to create a unique session for the\n"
|
||||||
|
" game loaded.\n"
|
||||||
|
"--players x Set the number of local players in a network play\n"
|
||||||
|
" session.\n"
|
||||||
|
"--rp2mic {0|1} Replace Port 2 Start with microphone (Famicom).\n"
|
||||||
|
"--nogui Don't load the GTK GUI\n"
|
||||||
|
"--abstartselectexit {0|1} exit the emulator when A+B+Select+Start is pressed\n"
|
||||||
|
"--autosavestate {0-9|>9} load from the given state when the game is loaded\n"
|
||||||
|
"--autoloadstate {0-9|>9} save to the given state when the game is closed\n"
|
||||||
|
" to not save/load automatically provide a number\n"
|
||||||
|
" greater than 9\n";
|
||||||
|
|
||||||
|
|
||||||
// these should be moved to the man file
|
// these should be moved to the man file
|
||||||
|
@ -175,10 +185,20 @@ static void ShowUsage(char *prog)
|
||||||
*/
|
*/
|
||||||
int LoadGame(const char *path)
|
int LoadGame(const char *path)
|
||||||
{
|
{
|
||||||
CloseGame();
|
if (isloaded){
|
||||||
|
CloseGame();
|
||||||
|
}
|
||||||
if(!FCEUI_LoadGame(path, 1)) {
|
if(!FCEUI_LoadGame(path, 1)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int state_to_load;
|
||||||
|
g_config->getOption("SDL.AutoLoadState", &state_to_load);
|
||||||
|
if (state_to_load != INVALID_STATE){
|
||||||
|
FCEUI_SelectState(state_to_load, 0);
|
||||||
|
FCEUI_LoadState(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ParseGIInput(GameInfo);
|
ParseGIInput(GameInfo);
|
||||||
RefreshThrottleFPS();
|
RefreshThrottleFPS();
|
||||||
|
|
||||||
|
@ -218,7 +238,15 @@ CloseGame()
|
||||||
if(!isloaded) {
|
if(!isloaded) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int state_to_save;
|
||||||
|
g_config->getOption("SDL.AutoSaveState", &state_to_save);
|
||||||
|
if (state_to_save != INVALID_STATE){
|
||||||
|
FCEUI_SelectState(state_to_save, 0);
|
||||||
|
FCEUI_SaveState(NULL);
|
||||||
|
}
|
||||||
FCEUI_CloseGame();
|
FCEUI_CloseGame();
|
||||||
|
|
||||||
DriverKill();
|
DriverKill();
|
||||||
isloaded = 0;
|
isloaded = 0;
|
||||||
GameInfo = 0;
|
GameInfo = 0;
|
||||||
|
@ -499,7 +527,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if(!strcmp(argv[1], "--help") || !strcmp(argv[1],"-h"))
|
if(!strcmp(argv[1], "--help") || !strcmp(argv[1],"-h"))
|
||||||
{
|
{
|
||||||
ShowUsage(argv[0]);
|
ShowUsage(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -943,7 +971,8 @@ void FCEUD_PrintError(const char *errormsg)
|
||||||
if(gtkIsStarted == true && noGui == 0)
|
if(gtkIsStarted == true && noGui == 0)
|
||||||
{
|
{
|
||||||
GtkWidget* d;
|
GtkWidget* d;
|
||||||
d = gtk_message_dialog_new(GTK_WINDOW(MainWindow), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, errormsg);
|
d = gtk_message_dialog_new(GTK_WINDOW(MainWindow), GTK_DIALOG_MODAL,
|
||||||
|
GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, errormsg);
|
||||||
gtk_dialog_run(GTK_DIALOG(d));
|
gtk_dialog_run(GTK_DIALOG(d));
|
||||||
gtk_widget_destroy(d);
|
gtk_widget_destroy(d);
|
||||||
}
|
}
|
||||||
|
@ -955,7 +984,11 @@ void FCEUD_PrintError(const char *errormsg)
|
||||||
|
|
||||||
// dummy functions
|
// dummy functions
|
||||||
|
|
||||||
#define DUMMY(__f) void __f(void) {printf("%s\n", #__f); FCEU_DispMessage("Not implemented.",0);}
|
#define DUMMY(__f) \
|
||||||
|
void __f(void) {\
|
||||||
|
printf("%s\n", #__f);\
|
||||||
|
FCEU_DispMessage("Not implemented.",0);\
|
||||||
|
}
|
||||||
DUMMY(FCEUD_HideMenuToggle)
|
DUMMY(FCEUD_HideMenuToggle)
|
||||||
DUMMY(FCEUD_MovieReplayFrom)
|
DUMMY(FCEUD_MovieReplayFrom)
|
||||||
DUMMY(FCEUD_ToggleStatusIcon)
|
DUMMY(FCEUD_ToggleStatusIcon)
|
||||||
|
|
|
@ -162,7 +162,7 @@ static void FCEU_CloseGame(void)
|
||||||
|
|
||||||
if (GameInfo->name) {
|
if (GameInfo->name) {
|
||||||
free(GameInfo->name);
|
free(GameInfo->name);
|
||||||
GameInfo->name = 0;
|
GameInfo->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameInfo->type != GIT_NSF) {
|
if (GameInfo->type != GIT_NSF) {
|
||||||
|
@ -263,8 +263,8 @@ void FlushGenieRW(void) {
|
||||||
}
|
}
|
||||||
free(AReadG);
|
free(AReadG);
|
||||||
free(BWriteG);
|
free(BWriteG);
|
||||||
AReadG = 0;
|
AReadG = NULL;
|
||||||
BWriteG = 0;
|
BWriteG = NULL;
|
||||||
RWWrap = 0;
|
RWWrap = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,6 +330,7 @@ static void AllocBuffers() {
|
||||||
|
|
||||||
static void FreeBuffers() {
|
static void FreeBuffers() {
|
||||||
FCEU_free(RAM);
|
FCEU_free(RAM);
|
||||||
|
RAM = NULL;
|
||||||
}
|
}
|
||||||
//------
|
//------
|
||||||
|
|
||||||
|
@ -964,6 +965,7 @@ void UpdateAutosave(void) {
|
||||||
FCEUSS_Save(f);
|
FCEUSS_Save(f);
|
||||||
AutoSS = true; //Flag that an auto-savestate was made
|
AutoSS = true; //Flag that an auto-savestate was made
|
||||||
free(f);
|
free(f);
|
||||||
|
f = NULL;
|
||||||
AutosaveStatus[AutosaveIndex] = 1;
|
AutosaveStatus[AutosaveIndex] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -977,6 +979,7 @@ void FCEUI_Autosave(void) {
|
||||||
f = strdup(FCEU_MakeFName(FCEUMKF_AUTOSTATE, AutosaveIndex, 0).c_str());
|
f = strdup(FCEU_MakeFName(FCEUMKF_AUTOSTATE, AutosaveIndex, 0).c_str());
|
||||||
FCEUSS_Load(f);
|
FCEUSS_Load(f);
|
||||||
free(f);
|
free(f);
|
||||||
|
f = NULL;
|
||||||
|
|
||||||
//Set pointer to previous available slot
|
//Set pointer to previous available slot
|
||||||
if (AutosaveStatus[(AutosaveIndex + AutosaveQty - 1) % AutosaveQty] == 1) {
|
if (AutosaveStatus[(AutosaveIndex + AutosaveQty - 1) % AutosaveQty] == 1) {
|
||||||
|
|
|
@ -299,7 +299,7 @@ static void StrobeGP(int w)
|
||||||
joy_readbit[w]=0;
|
joy_readbit[w]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
|
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
||||||
static INPUTC GPC={ReadGP,0,StrobeGP,UpdateGP,0,0,LogGP,LoadGP};
|
static INPUTC GPC={ReadGP,0,StrobeGP,UpdateGP,0,0,LogGP,LoadGP};
|
||||||
|
@ -319,8 +319,9 @@ void FCEU_UpdateInput(void)
|
||||||
//tell all drivers to poll input and set up their logical states
|
//tell all drivers to poll input and set up their logical states
|
||||||
if(!FCEUMOV_Mode(MOVIEMODE_PLAY))
|
if(!FCEUMOV_Mode(MOVIEMODE_PLAY))
|
||||||
{
|
{
|
||||||
for(int port=0;port<2;port++)
|
for(int port=0;port<2;port++){
|
||||||
joyports[port].driver->Update(port,joyports[port].ptr,joyports[port].attrib);
|
joyports[port].driver->Update(port,joyports[port].ptr,joyports[port].attrib);
|
||||||
|
}
|
||||||
portFC.driver->Update(portFC.ptr,portFC.attrib);
|
portFC.driver->Update(portFC.ptr,portFC.attrib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,8 +334,9 @@ void FCEU_UpdateInput(void)
|
||||||
FCEUMOV_AddInputState();
|
FCEUMOV_AddInputState();
|
||||||
|
|
||||||
//TODO - should this apply to the movie data? should this be displayed in the input hud?
|
//TODO - should this apply to the movie data? should this be displayed in the input hud?
|
||||||
if(GameInfo->type==GIT_VSUNI)
|
if(GameInfo->type==GIT_VSUNI){
|
||||||
FCEU_VSUniSwap(&joy[0],&joy[1]);
|
FCEU_VSUniSwap(&joy[0],&joy[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLFR(VSUNIRead0)
|
static DECLFR(VSUNIRead0)
|
||||||
|
@ -371,16 +373,18 @@ void InputScanlineHook(uint8 *bg, uint8 *spr, uint32 linets, int final)
|
||||||
portFC.driver->SLHook(bg,spr,linets,final);
|
portFC.driver->SLHook(bg,spr,linets,final);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
//binds JPorts[pad] to the driver specified in JPType[pad]
|
//binds JPorts[pad] to the driver specified in JPType[pad]
|
||||||
static void SetInputStuff(int port)
|
static void SetInputStuff(int port)
|
||||||
{
|
{
|
||||||
switch(joyports[port].type)
|
switch(joyports[port].type)
|
||||||
{
|
{
|
||||||
case SI_GAMEPAD:
|
case SI_GAMEPAD:
|
||||||
if(GameInfo->type==GIT_VSUNI)
|
if(GameInfo->type==GIT_VSUNI){
|
||||||
joyports[port].driver = &GPCVS;
|
joyports[port].driver = &GPCVS;
|
||||||
else
|
} else {
|
||||||
joyports[port].driver= &GPC;
|
joyports[port].driver= &GPC;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SI_ARKANOID:
|
case SI_ARKANOID:
|
||||||
joyports[port].driver=FCEU_InitArkanoid(port);
|
joyports[port].driver=FCEU_InitArkanoid(port);
|
||||||
|
|
|
@ -959,7 +959,8 @@ void FCEUI_LoadState(const char *fname)
|
||||||
if(FCEUSS_Load(fname))
|
if(FCEUSS_Load(fname))
|
||||||
{
|
{
|
||||||
//mbg todo netplay
|
//mbg todo netplay
|
||||||
/*if(FCEUnetplay)
|
#if 0
|
||||||
|
if(FCEUnetplay)
|
||||||
{
|
{
|
||||||
char *fn = strdup(FCEU_MakeFName(FCEUMKF_NPTEMP, 0, 0).c_str());
|
char *fn = strdup(FCEU_MakeFName(FCEUMKF_NPTEMP, 0, 0).c_str());
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -980,7 +981,8 @@ void FCEUI_LoadState(const char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(fn);
|
free(fn);
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
freshMovie = false; //The movie has been altered so it is no longer fresh
|
freshMovie = false; //The movie has been altered so it is no longer fresh
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue