--- old/src/gens/emulator/g_main.h 2004-04-15 16:22:49.000000000 -0400 +++ new/src/gens/emulator/g_main.h 2006-12-30 12:50:37.000000000 -0500 @@ -22,6 +22,7 @@ extern int Intro_Style; extern int SegaCD_Accurate; extern int Active; +extern int Quick_Exit; extern POINT Window_Pos; @@ -36,6 +37,8 @@ extern unsigned char Keys[]; extern unsigned char joystate[]; +static int Build_Language_String (void); + void SetWindowText(const char *text); int Set_Render(int Full, int Num, int Force); --- old/src/gens/emulator/g_main.c 2004-05-18 16:34:00.000000000 -0400 +++ new/src/gens/emulator/g_main.c 2006-12-30 13:13:00.000000000 -0500 @@ -5,6 +5,7 @@ #include #include #include +#include #include "g_main.h" #include "timer.h" #include "gens.h" @@ -54,6 +55,7 @@ int Intro_Style = 2; int SegaCD_Accurate = 0; int Kaillera_Client_Running = 0; +int Quick_Exit = 0; static int Gens_Running = 0; @@ -96,6 +98,11 @@ switch (event.key.keysym.sym) { case SDLK_ESCAPE: + if (Quick_Exit) + { + close_gens(); + } + if (Debug) { Change_Debug (0); @@ -427,21 +434,73 @@ break; case SDL_JOYAXISMOTION: - if (event.jaxis.axis < 2) + if (event.jaxis.axis < 6) + { + if (event.jaxis.value < -10000) + { + if (event.jaxis.axis == 0) + { + joystate[0x100 * event.jaxis.which + 0x3] = 1; + joystate[0x100 * event.jaxis.which + 0x4] = 0; + } + else if (event.jaxis.axis == 1) + { + joystate[0x100 * event.jaxis.which + 0x1] = 1; + joystate[0x100 * event.jaxis.which + 0x2] = 0; + } + else if (event.jaxis.axis == 2) + { + joystate[0x100 * event.jaxis.which + 0x7] = 1; + joystate[0x100 * event.jaxis.which + 0x8] = 0; + } + else if (event.jaxis.axis == 3) + { + joystate[0x100 * event.jaxis.which + 0x5] = 1; + joystate[0x100 * event.jaxis.which + 0x6] = 0; + } + else if (event.jaxis.axis == 4) + { + joystate[0x100 * event.jaxis.which + 0xB] = 1; + joystate[0x100 * event.jaxis.which + 0xC] = 0; + } + else if (event.jaxis.axis == 5) + { + joystate[0x100 * event.jaxis.which + 0x9] = 1; + joystate[0x100 * event.jaxis.which + 0xA] = 0; + } + } + else if (event.jaxis.value > 10000) + { + if (event.jaxis.axis == 0) + { + joystate[0x100 * event.jaxis.which + 0x3] = 0; + joystate[0x100 * event.jaxis.which + 0x4] = 1; + } + else if (event.jaxis.axis == 1) { - if (event.jaxis.value < -500) + joystate[0x100 * event.jaxis.which + 0x1] = 0; + joystate[0x100 * event.jaxis.which + 0x2] = 1; + } + else if (event.jaxis.axis == 2) { - joystate[0x100 * event.jaxis.which + - ((event.jaxis.axis == 0) ? 0x3 : 0x1)] = 1; - joystate[0x100 * event.jaxis.which + - ((event.jaxis.axis == 0) ? 0x4 : 0x2)] = 0; + joystate[0x100 * event.jaxis.which + 0x7] = 0; + joystate[0x100 * event.jaxis.which + 0x8] = 1; } - else if (event.jaxis.value > 500) + else if (event.jaxis.axis == 3) { - joystate[0x100 * event.jaxis.which + - ((event.jaxis.axis == 0) ? 0x4 : 0x2)] = 1; - joystate[0x100 * event.jaxis.which + - ((event.jaxis.axis == 0) ? 0x3 : 0x1)] = 0; + joystate[0x100 * event.jaxis.which + 0x5] = 0; + joystate[0x100 * event.jaxis.which + 0x6] = 1; + } + else if (event.jaxis.axis == 4) + { + joystate[0x100 * event.jaxis.which + 0xB] = 0; + joystate[0x100 * event.jaxis.which + 0xC] = 1; + } + else if (event.jaxis.axis == 5) + { + joystate[0x100 * event.jaxis.which + 0x9] = 0; + joystate[0x100 * event.jaxis.which + 0xA] = 1; + } } else { @@ -455,7 +514,26 @@ joystate[0x100 * event.jaxis.which + 0x2] = 0; joystate[0x100 * event.jaxis.which + 0x1] = 0; } - + else if (event.jaxis.axis == 2) + { + joystate[0x100 * event.jaxis.which + 0x8] = 0; + joystate[0x100 * event.jaxis.which + 0x7] = 0; + } + else if (event.jaxis.axis == 3) + { + joystate[0x100 * event.jaxis.which + 0x6] = 0; + joystate[0x100 * event.jaxis.which + 0x5] = 0; + } + else if (event.jaxis.axis == 4) + { + joystate[0x100 * event.jaxis.which + 0xC] = 0; + joystate[0x100 * event.jaxis.which + 0xB] = 0; + } + else if (event.jaxis.axis == 5) + { + joystate[0x100 * event.jaxis.which + 0xA] = 0; + joystate[0x100 * event.jaxis.which + 0x9] = 0; + } } } @@ -679,6 +757,24 @@ sync_gens_ui (); gtk_widget_show_all (gens_window); + //If a rom is passed in on the command line then open it + if (strcmp(Rom_Name, "") != 0) + { + struct stat buf; + char Rom_Path[2048]; + strcpy (Rom_Path, Rom_Dir); + strcat (Rom_Path, Rom_Name); + if (stat (Rom_Path, &buf) == 0) + { + printf("Opening %s\n", Rom_Path); + Open_Rom(Rom_Path); + } + else + { + printf("%s not found\n", Rom_Path); + } + } + while (is_gens_running ()) { update_SDL_events (); --- old/src/gens/emulator/parse.h 2004-05-19 15:12:02.000000000 -0400 +++ new/src/gens/emulator/parse.h 2006-12-30 12:40:16.000000000 -0500 @@ -4,8 +4,8 @@ #define MM "--" #define ENABLE "enable" #define DISABLE "disable" -// 1 arg option +// 1 arg option #define ROMPATH "rompath" #define SAVEPATH "savepath" #define SRAMPATH "srampath" @@ -38,6 +38,7 @@ #define FS "fs" #define WINDOW "window" +#define QUICKEXIT "quickexit" // enable and disable options #define STRETCH "stretch" --- old/src/gens/emulator/parse.c 2004-05-19 15:21:00.000000000 -0400 +++ new/src/gens/emulator/parse.c 2007-01-03 01:29:41.210902112 -0500 @@ -1,6 +1,7 @@ #include #include #include +#include #include "port.h" #include "save.h" #include "cpu_68k.h" @@ -33,67 +34,71 @@ #include "support.h" #include "parse.h" -#define print_usage(option, helpmsg) fprintf(stderr, MM option"\n" helpmsg) -#define print_usage2(option, helpmsg) fprintf(stderr, MM ENABLE "-" option ", " MM DISABLE "-" option "\n" helpmsg "\n\n") +#define print_usage(option, helpmsg) fprintf(stderr, MM option"\t" helpmsg"\n") +#define print_usage2(option, helpmsg) fprintf(stderr, MM "en/disable-" option "\t" helpmsg "\n") static void _usage() { - fprintf (stderr, "Gens for Linux v2.12-rc3\n"); + fprintf (stderr, "Gens for Linux v2.12-mythgame\n"); fprintf (stderr, "Usage : gens [options] romfile\n"); - print_usage( HELP, "print this help"); + print_usage( HELP, "\t\tprint this help"); - print_usage( ROMPATH ,"path where your roms are stored"); - print_usage( SAVEPATH ,"path where to save your states file"); - print_usage( SRAMPATH ,"path where to save your states file"); - print_usage( BRAMPATH ,"path where to save your states file"); - print_usage( DUMPPATH ,"path where to save your states file"); - print_usage( DUMPGYMPATH ,"path where to save your states file"); - print_usage( SCRSHTPATH ,"path where to save your states file"); - print_usage( PATPATH ,"path where to save your states file"); - print_usage( IPSPATH ,"path where to save your states file"); - print_usage( GCOFFPATH ,"path where to save your states file"); - print_usage( GENSMANPATH ,"path where to save your states file"); - print_usage( GENBIOS ,""); - print_usage( USABIOS ,""); - print_usage( EURBIOS ,""); - print_usage( JAPBIOS ,""); - print_usage( _32X68kBIOS ,""); - print_usage( _32XMBIOS ,""); - print_usage( _32XSBIOS ,""); - print_usage( CONTRAST ,""); - print_usage( BRIGHTNESS ,""); - print_usage( WINDOWMODE ,""); - print_usage( FSMODE ,""); - print_usage( FRAMESKIP ,""); - print_usage( SOUNDRATE ,""); - print_usage( MSH2SPEED ,""); - print_usage( SSH2SPEED ,""); - print_usage( RAMCARTSIZE,""); - - print_usage2( STRETCH,"stretch mode"); - print_usage2( SWBLIT,"software blitting"); - print_usage2( GREYSCALE,"greyscale"); - print_usage2( INVERT,""); - print_usage2( SPRITELIMIT,""); - print_usage2( SOUND,""); - print_usage2( STEREO,""); - print_usage2( Z80,""); - print_usage2( YM2612,""); - print_usage2( PSG,""); - print_usage2( DAC,""); - print_usage2( PCM,""); - print_usage2( PWM,""); - print_usage2( CDDA,""); + print_usage( ROMPATH ,"\tdirectory roms are located in"); + print_usage( SAVEPATH ,"\tpath to save states file"); + print_usage( SRAMPATH ,"\tpath to save SRAM (battery backup) files"); + print_usage( BRAMPATH ,"\tpath to save BRAM (Sega CD battery backup) files"); + print_usage( DUMPPATH ,"\tpath to save wav sound dumps"); + print_usage( DUMPGYMPATH ,"\tpath to save GYM sound dumps"); + print_usage( SCRSHTPATH ,"path to save screen shots"); + print_usage( PATPATH ,"\tpath for game genie patch files"); + print_usage( IPSPATH ,"\tpath for patch files"); + print_usage( GCOFFPATH ,"\tpath to GCOffline (offline version of Genesis Collective)"); + print_usage( GENSMANPATH ,"path to Gens manual"); + print_usage( GENBIOS ,"\tpath to the Genesis bios"); + print_usage( USABIOS ,"\tpath to the USA Sega CD bios"); + print_usage( EURBIOS ,"\tpath to the European Sega CD bios"); + print_usage( JAPBIOS ,"\tpath to the Japanese Sega CD bios"); + print_usage( _32X68kBIOS ,"\tpath to the 32X 68k bios"); + print_usage( _32XMBIOS ,"\tpath to the 32X Master bios"); + print_usage( _32XSBIOS ,"\tpath to the 32X Slave bios"); + print_usage( CONTRAST ,"\tadjust contrast up to (0-200, default 100)"); + print_usage( BRIGHTNESS ,"\tadjust brightness up to (0-200, default 100)"); + print_usage( FS ,"\t\trun the emulator full screen (0/1)"); + print_usage( FSMODE ,"\trendering mode for full screen (1-11)\n\t\t\t 0 - normal\t\t 6 - interpolated scanline\n\t\t\t 1 - double\t\t 7 - interpolated 50%% scanline\n\t\t\t 2 - interpolated\t 8 - interpolated 25%% scanline\n\t\t\t 3 - scanline\t\t 9 - 2xSAI (Kreed)\n\t\t\t 4 - 50%% scanline\t 10 - Scale2x\n\t\t\t 5 - 25%% scanline\t 11 - Hq2x"); + print_usage( WINDOW ,"\trun the emulator in a window (0/1)"); + print_usage( WINDOWMODE ,"\trendering mode for window (0-11)\n\t\t\t same options as fs-mode"); + print_usage( FRAMESKIP ,"\tskip frames at this relative rate, useful on slower cpus (0-8, -1 auto)"); + print_usage( SOUNDRATE ,"\tthe sound sampling rate (11025, 22050, 44100)"); + print_usage( MSH2SPEED ,"\tmaster SH2 speed (0-200, default 100)"); + print_usage( SSH2SPEED ,"\tslave SH2 speed (0-200, default 100)"); + print_usage( RAMCARTSIZE ,"\tSega CD SRAM size (-1 = none, 0 = 8k, 1 = 16k, 2 = 32k, 3 = 64k)"); + print_usage( QUICKEXIT ,"\tmake the ESC key exit Gens instead of pause (0/1)"); + fprintf (stderr, "\n"); + + print_usage2( STRETCH,"\tstretch mode"); + print_usage2( SWBLIT,"\tsoftware blitting"); + print_usage2( GREYSCALE,"\tdisplay in greyscale mode"); + print_usage2( INVERT,"\tdisplay colors inverted"); + print_usage2( SPRITELIMIT,"limit the number of sprites on screen"); + print_usage2( SOUND,"\tsound is to be enabled"); + print_usage2( STEREO,"stereo sound is to be enabled"); + print_usage2( Z80,"\tZ80 sound processor"); + print_usage2( YM2612,"\tYM2612 sound chip"); + print_usage2( PSG,"\tPSG 76489 sound chip"); + print_usage2( DAC,"\tpart of YM2612 chip"); + print_usage2( PCM,"\tsound chip for Sega CD"); + print_usage2( PWM,"\t10-channel PWM mixing for 32X"); + print_usage2( CDDA,"\tCDDA data access mode for Sega CD"); print_usage2( PSGIMPROVED,""); print_usage2( YMIMPROVED,""); print_usage2( DACIMPROVED,""); - print_usage2( PERFECTSYNC,""); - print_usage2( FASTBLUR,""); - print_usage2( FPS,""); - print_usage2( MSG,""); - print_usage2( LED,""); - print_usage2( FIXCHKSUM,""); - print_usage2( AUTOPAUSE,""); + print_usage2( PERFECTSYNC,"synch main and sub CPUs for Sega CD"); + print_usage2( FASTBLUR,"\tmode to simulate output to tv"); + print_usage2( FPS,"\tFPS display"); + print_usage2( MSG,"\tGens system messages"); + print_usage2( LED,"\tSega CD power and access LEDs"); + print_usage2( FIXCHKSUM,"\ttoggle that may fix red screen checksum errors"); + print_usage2( AUTOPAUSE,"\tset gens to pause when screen loses focus"); exit (0); } @@ -184,6 +189,7 @@ {AUTOPAUSE1, no_argument, 0, 0}, {AUTOPAUSE0, no_argument, 0, 0}, {RAMCARTSIZE, required_argument, 0, 0}, + {QUICKEXIT, no_argument, 0, 0}, {HELP, no_argument, 0, 0}, {0, 0, 0, 0} }; @@ -499,6 +505,10 @@ { BRAM_Ex_Size = strtol (optarg, (char **) NULL, 10); } + else if (!strcmp (long_options[option_index].name, QUICKEXIT)) + { + Quick_Exit = 1; + } else if (!strcmp (long_options[option_index].name, HELP)) { _usage(); @@ -510,6 +520,12 @@ if (optind < argc) { + //The first non ARGV element is the romfile parameter + strcpy (Rom_Name, argv[optind++]); + } + + if (optind < argc) + { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); --- old/src/gens/sdllayer/g_sdlinput.h 2004-05-18 16:45:07.000000000 -0400 +++ new/src/gens/sdllayer/g_sdlinput.h 2006-12-30 12:47:40.000000000 -0500 @@ -28,7 +28,7 @@ void open_joystick(); void close_joystick(); -extern SDL_Joystick* joy[2]; +extern SDL_Joystick* joy[6]; #define CHECK_BUTTON(player, ctrl, button) \ if (Check_Key_Pressed(Keys_Def[player].button)) \ --- old/src/gens/sdllayer/g_sdlinput.c 2004-05-18 16:46:01.000000000 -0400 +++ new/src/gens/sdllayer/g_sdlinput.c 2006-12-30 12:43:35.000000000 -0500 @@ -16,7 +16,7 @@ unsigned char Keys[1024]; unsigned char Kaillera_Keys[16]; -unsigned char joystate[0x80 + 0x100 + 0x10 * 3 + 0x4]; +unsigned char joystate[0x530]; struct K_Def Keys_Def[8] = { {SDLK_RETURN, SDLK_RSHIFT, @@ -29,7 +29,7 @@ SDLK_y, SDLK_h, SDLK_g, SDLK_j} }; -SDL_Joystick *joy[2] = { NULL, NULL }; +SDL_Joystick *joy[6] = { NULL, NULL, NULL, NULL, NULL, NULL }; void End_Input () @@ -40,28 +40,32 @@ void open_joystick () { + int Cur_Joy = 0; Nb_Joys = 0; SDL_JoystickEventState (SDL_ENABLE); - joy[0] = SDL_JoystickOpen (0); - if (joy[0]) - Nb_Joys++; - joy[1] = SDL_JoystickOpen (1); - if (joy[1]) + + while (Cur_Joy < 6) + { + joy[Cur_Joy] = SDL_JoystickOpen (Cur_Joy); + if (joy[Cur_Joy]) Nb_Joys++; + Cur_Joy++; + } } void close_joystick () { - if (SDL_JoystickOpened (0)) + int Cur_Joy = 0; + + while (Cur_Joy < 6) { - SDL_JoystickClose (joy[0]); - joy[0] = NULL; - } - if (SDL_JoystickOpened (1)) + if (SDL_JoystickOpened (Cur_Joy)) { - SDL_JoystickClose (joy[1]); - joy[1] = NULL; + SDL_JoystickClose (joy[Cur_Joy]); + joy[Cur_Joy] = NULL; + } + Cur_Joy++; } } @@ -95,7 +99,7 @@ { Num_Joy = ((key >> 8) & 0xF); - if ((Num_Joy < 2) && joy[Num_Joy]) + if ((Num_Joy < 6) && joy[Num_Joy]) { if (key & 0x80) // Test POV Joys { @@ -146,6 +150,46 @@ if (joystate[0x100 * Num_Joy + 0x4]) return 1; break; + + case 5: + if (joystate[0x100 * Num_Joy + 0x5]) + return 1; + break; + + case 6: + if (joystate[0x100 * Num_Joy + 0x6]) + return 1; + break; + + case 7: + if (joystate[0x100 * Num_Joy + 0x7]) + return 1; + break; + + case 8: + if (joystate[0x100 * Num_Joy + 0x8]) + return 1; + break; + + case 9: + if (joystate[0x100 * Num_Joy + 0x9]) + return 1; + break; + + case 10: + if (joystate[0x100 * Num_Joy + 0xA]) + return 1; + break; + + case 11: + if (joystate[0x100 * Num_Joy + 0xB]) + return 1; + break; + + case 12: + if (joystate[0x100 * Num_Joy + 0xC]) + return 1; + break; } } } @@ -437,11 +481,15 @@ { GdkEvent *event; SDL_Event sdl_event; - SDL_Joystick *js[2]; + SDL_Joystick *js[6]; SDL_JoystickEventState (SDL_ENABLE); js[0] = SDL_JoystickOpen (0); js[1] = SDL_JoystickOpen (1); + js[2] = SDL_JoystickOpen (2); + js[3] = SDL_JoystickOpen (3); + js[4] = SDL_JoystickOpen (4); + js[5] = SDL_JoystickOpen (5); while (gtk_events_pending ()) gtk_main_iteration (); @@ -453,19 +501,73 @@ switch (sdl_event.type) { case SDL_JOYAXISMOTION: - if (sdl_event.jaxis.value < -500) + if (sdl_event.jaxis.value < -10000) + { + if (sdl_event.jaxis.axis == 0) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x3)); + } + else if (sdl_event.jaxis.axis == 1) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x1)); + } + else if (sdl_event.jaxis.axis == 2) { return (0x1000 + - (0x100 * sdl_event.jaxis.which + - ((sdl_event.jaxis.axis == 0) ? 0x3 : 0x1))); + (0x100 * sdl_event.jaxis.which + 0x7)); } - else if (sdl_event.jaxis.value > 500) + else if (sdl_event.jaxis.axis == 3) { return (0x1000 + - (0x100 * sdl_event.jaxis.which + - ((sdl_event.jaxis.axis == 0) ? 0x4 : 0x2))); + (0x100 * sdl_event.jaxis.which + 0x5)); } - else if (sdl_event.jaxis.value == 0) + else if (sdl_event.jaxis.axis == 4) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0xB)); + } + else if (sdl_event.jaxis.axis == 5) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x9)); + } + } + else if (sdl_event.jaxis.value > 10000) + { + if (sdl_event.jaxis.axis == 0) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x4)); + } + else if (sdl_event.jaxis.axis == 1) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x2)); + } + else if (sdl_event.jaxis.axis == 2) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x8)); + } + else if (sdl_event.jaxis.axis == 3) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0x6)); + } + else if (sdl_event.jaxis.axis == 4) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0xC)); + } + else if (sdl_event.jaxis.axis == 5) + { + return (0x1000 + + (0x100 * sdl_event.jaxis.which + 0xA)); + } + } + else { return (Get_Key ()); } --- old/src/gens/util/rom.h 2004-03-14 09:33:06.000000000 -0500 +++ new/src/gens/util/rom.h 2006-12-30 17:30:58.000000000 -0500 @@ -52,7 +52,7 @@ int Detect_Format(char *Name); int Get_Rom(void); - +int Open_Rom(char *Name); int Pre_Load_Rom(char *Name); int Load_Rom_CC(char *Name, int Size); struct Rom *Load_Bios(char *Name); --- old/src/gens/util/rom.c 2004-05-18 16:33:59.000000000 -0400 +++ new/src/gens/util/rom.c 2007-01-05 13:23:45.596482516 -0500 @@ -99,7 +99,7 @@ void Update_Rom_Dir (char *Path) { - Get_Dir_From_Path (Path, Rom_Dir); + sprintf (Rom_Dir, "%s", Path);; } @@ -390,11 +390,10 @@ gint res; char Name[2048]; gchar *filename; - int sys; widget = create_file_chooser_dialog ("Open Rom", GTK_FILE_CHOOSER_ACTION_OPEN); -// fileselection_set_dir (fd.filesel, Rom_Dir); + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(widget), Rom_Dir); addRomsFilter (widget); res = gtk_dialog_run (GTK_DIALOG (widget)); if (res == GTK_RESPONSE_OK) @@ -407,6 +406,15 @@ g_free (filename); Free_Rom (Game); + return Open_Rom(Name); + +} + +int +Open_Rom(char *Name) +{ + int sys; + sys = Detect_Format (Name); if (sys < 1) @@ -458,6 +466,7 @@ break; } return -1; + } int --- old/src/gens/gtkui/glade/interface.c 2004-05-19 15:49:28.000000000 -0400 +++ new/src/gens/gtkui/glade/interface.c 2007-01-03 13:13:28.113596925 -0500 @@ -1825,7 +1825,7 @@ gtk_widget_show (image1); gtk_box_pack_start (GTK_BOX (hbox1), image1, TRUE, TRUE, 0); - label1 = gtk_label_new ("Gens for Linux\nversion 2.12-rc3\n\nSega Genesis / Megadrive,\nSega CD / Mega CD,\nSega 32X emulator"); + label1 = gtk_label_new ("Gens for Linux\nversion 2.12-mythgame\n\nSega Genesis / Megadrive,\nSega CD / Mega CD,\nSega 32X emulator"); gtk_widget_set_name (label1, "label1"); gtk_widget_show (label1); gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0);