⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snes9x.cpp

📁 著名SFC模拟器Snes9x的源代码。
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	    {		Settings.SixteenBit = TRUE;	    }	    else if (strcasecmp (argv [i], "-displayframerate") == 0 ||		     strcasecmp (argv [i], "-dfr") == 0)	    {		Settings.DisplayFrameRate = TRUE;	    }	    else if (strcasecmp (argv [i], "-s") == 0 ||		     strcasecmp (argv [i], "-swapjoypads") == 0 ||		     strcasecmp (argv [i], "-sw") == 0)		Settings.SwapJoypads = TRUE;	    else if (strcasecmp (argv [i], "-i") == 0 ||		     strcasecmp (argv [i], "-interleaved") == 0)		Settings.ForceInterleaved = TRUE;	    else if (strcasecmp (argv [i], "-i2") == 0 ||		     strcasecmp (argv [i], "-interleaved2") == 0)		Settings.ForceInterleaved2 = TRUE;	    else if (strcasecmp (argv [i], "-ni") == 0 ||		     strcasecmp (argv [i], "-nointerleave") == 0)		Settings.ForceNotInterleaved = TRUE;	    else if (strcasecmp (argv [i], "-noirq") == 0)		Settings.DisableIRQ = TRUE;	    else if (strcasecmp (argv [i], "-nw") == 0 ||		     strcasecmp (argv [i], "-nowindows") == 0)	    {		Settings.DisableGraphicWindows = TRUE;	    }	    else if (strcasecmp (argv [i], "-windows") == 0)	    {		Settings.DisableGraphicWindows = FALSE;	    }	    else if (strcasecmp (argv [i], "-gg") == 0 ||		     strcasecmp (argv [i], "-gamegenie") == 0)	    {		if (i + 1 < argc)		{		    uint32 address;		    uint8 byte;		    const char *error;		    if ((error = S9xGameGenieToRaw (argv [++i], address, byte)) == NULL)			S9xAddCheat (TRUE, FALSE, address, byte);		    else			S9xMessage (S9X_ERROR, S9X_GAME_GENIE_CODE_ERROR,				    error);		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-ar") == 0 ||		     strcasecmp (argv [i], "-actionreplay") == 0)	    {		if (i + 1 < argc)		{		    uint32 address;		    uint8 byte;		    const char *error;		    if ((error = S9xProActionReplayToRaw (argv [++i], address, byte)) == NULL)			S9xAddCheat (TRUE, FALSE, address, byte);		    else			S9xMessage (S9X_ERROR, S9X_ACTION_REPLY_CODE_ERROR,				    error);		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-gf") == 0 ||		     strcasecmp (argv [i], "-goldfinger") == 0)	    {		if (i + 1 < argc)		{		    uint32 address;		    uint8 bytes [3];		    bool8 sram;		    uint8 num_bytes;		    const char *error;		    if ((error = S9xGoldFingerToRaw (argv [++i], address, sram,						     num_bytes, bytes)) == NULL)		    {			for (int c = 0; c < num_bytes; c++)			    S9xAddCheat (TRUE, FALSE, address + c, bytes [c]);		    }		    else			S9xMessage (S9X_ERROR, S9X_GOLD_FINGER_CODE_ERROR,				    error);		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv[i], "-ft") == 0 ||		     strcasecmp (argv [i], "-frametime") == 0)	    {		if (i + 1 < argc)		{		    double ft;		    if (sscanf (argv [++i], "%lf", &ft) == 1)		    {#ifdef __WIN32__			Settings.FrameTimePAL = (int32) (ft * 1000);			Settings.FrameTimeNTSC = (int32) (ft * 1000);#else			Settings.FrameTimePAL = (int32) ft;			Settings.FrameTimeNTSC = (int32) ft;#endif		    }		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-e") == 0 ||		     strcasecmp (argv [i], "-echo") == 0)		Settings.DisableSoundEcho = FALSE;	    else if (strcasecmp (argv [i], "-ne") == 0 ||		     strcasecmp (argv [i], "-noecho") == 0)		Settings.DisableSoundEcho = TRUE;	    else if (strcasecmp (argv [i], "-r") == 0 ||		     strcasecmp (argv [i], "-soundquality") == 0 ||		     strcasecmp (argv [i], "-sq") == 0)	    {		if (i + 1 < argc)		    Settings.SoundPlaybackRate = atoi (argv [++i]) & 7;		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-stereo") == 0 ||		     strcasecmp (argv [i], "-st") == 0)	    {		Settings.Stereo = TRUE;		Settings.APUEnabled = TRUE;		Settings.NextAPUEnabled = TRUE;	    }	    else if (strcasecmp (argv [i], "-mono") == 0)	    {		Settings.Stereo = FALSE;		Settings.NextAPUEnabled = TRUE;	    }	    else if (strcasecmp (argv [i], "-envx") == 0 ||		     strcasecmp (argv [i], "-ex") == 0)	    {		Settings.SoundEnvelopeHeightReading = TRUE;	    }	    else if (strcasecmp (argv [i], "-nosamplecaching") == 0 ||		     strcasecmp (argv [i], "-nsc") == 0 ||		     strcasecmp (argv [i], "-nc") == 0)	    {		Settings.DisableSampleCaching = TRUE;	    }	    else if (strcasecmp (argv [i], "-nomastervolume") == 0 ||		     strcasecmp (argv [i], "-nmv") == 0)	    {		Settings.DisableMasterVolume = TRUE;	    }	    else if (strcasecmp (argv [i], "-soundsync") == 0 ||		     strcasecmp (argv [i], "-sy") == 0)	    {		Settings.SoundSync = TRUE;		Settings.SoundEnvelopeHeightReading = TRUE;		Settings.InterpolatedSound = TRUE;	    }	    else if (strcasecmp (argv [i], "-soundsync2") == 0 ||		     strcasecmp (argv [i], "-sy2") == 0)	    {		Settings.SoundSync = 2;		Settings.SoundEnvelopeHeightReading = TRUE;		Settings.InterpolatedSound = TRUE;	    }	    else if (strcasecmp (argv [i], "-interpolatedsound") == 0 ||		     strcasecmp (argv [i], "-is") == 0)	    {		Settings.InterpolatedSound = TRUE;	    }#ifdef USE_THREADS	    else if (strcasecmp (argv [i], "-threadsound") == 0 ||		     strcasecmp (argv [i], "-ts") == 0)	    {		Settings.ThreadSound = TRUE;	    }#endif	    else if (strcasecmp (argv [i], "-alt") == 0 ||		     strcasecmp (argv [i], "-altsampledecode") == 0)	    {		Settings.AltSampleDecode = TRUE;	    }	    else if (strcasecmp (argv [i], "-nosuperfx") == 0 ||		     strcasecmp (argv [i], "-nosfx") == 0)		Settings.ForceNoSuperFX = TRUE;	    else if (strcasecmp (argv [i], "-superfx") == 0 ||		     strcasecmp (argv [i], "-sfx") == 0)		Settings.ForceSuperFX = TRUE;	    else if (strcasecmp (argv [i], "-dsp1") == 0)		Settings.ForceDSP1 = TRUE;	    else if (strcasecmp (argv [i], "-nodsp1") == 0)		Settings.ForceNoDSP1 = TRUE;	    else if (strcasecmp (argv [i], "-nomultiplayer5") == 0 ||		     strcasecmp (argv [i], "-nmp") == 0)		Settings.MultiPlayer5 = FALSE;	    else if (strcasecmp (argv [i], "-multiplayer5") == 0 ||		     strcasecmp (argv [i], "-mp") == 0)	    {		Settings.MultiPlayer5 = TRUE;		Settings.ControllerOption = SNES_MULTIPLAYER5;	    }	    else if (strcasecmp (argv [i], "-mouse") == 0 ||		     strcasecmp (argv [i], "-mo") == 0)	    {		Settings.ControllerOption = SNES_MOUSE_SWAPPED;		Settings.Mouse = TRUE;	    }	    else if (strcasecmp (argv [i], "-nomouse") == 0 ||		     strcasecmp (argv [i], "-nm") == 0)	    {		Settings.Mouse = FALSE;	    }	    else if (strcasecmp (argv [i], "-superscope") == 0 ||		     strcasecmp (argv [i], "-ss") == 0)	    {		Settings.SuperScope = TRUE;		Settings.ControllerOption = SNES_SUPERSCOPE;	    }	    else if (strcasecmp (argv [i], "-nosuperscope") == 0 ||		     strcasecmp (argv [i], "-nss") == 0)	    {		Settings.SuperScope = FALSE;	    }#ifdef NETPLAY_SUPPORT	    else if (strcasecmp (argv [i], "-port") == 0 ||		     strcasecmp (argv [i], "-po") == 0)	    {		if (i + 1 < argc)		{		    Settings.NetPlay = TRUE;		    Settings.Port = -atoi (argv [++i]);		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-server") == 0 ||		     strcasecmp (argv [i], "-srv") == 0)	    {		if (i + 1 < argc)		{		    Settings.NetPlay = TRUE;		    strncpy (Settings.ServerName, argv [++i], 127);		    Settings.ServerName [127] = 0;		}		else		    S9xUsage ();	    }	    else if (strcasecmp (argv [i], "-net") == 0)	    {		Settings.NetPlay = TRUE;	    }#endif#ifdef STORM            else if (strcasecmp(argv[i],"-nosecondjoy")==0){secondjoy=0;}            else if (strcasecmp(argv[i],"-showfps")==0){dofps=1;}            else if (strcasecmp(argv[i],"-hicolor")==0){hicolor=1;}            else if (strcasecmp(argv[i],"-minimal")==0){minimal=1;printf("Keyboard with exception of ESC switched off!\n");}            else if (strcasecmp(argv[i],"-ahiunit")==0)            {             if (i+1<argc)             {              fprintf(stderr,"AHI Unit set to: Unit %i\n",atoi(argv[++i]));              unit=atoi(argv[++i]);             }            }#endif	    else		S9xParseArg (argv, i, argc);	}	else	    rom_filename = argv [i];    }    return (rom_filename);}void S9xParseCheatsFile (const char *rom_filename){    FILE *f;    char dir [_MAX_DIR];    char drive [_MAX_DRIVE];    char name [_MAX_FNAME];    char ext [_MAX_EXT];    char fname [_MAX_PATH];    char buf [80];    uint32 address;    uint8 byte;    uint8 bytes [3];    bool8 sram;    uint8 num_bytes;    const char *error;    char *p;    _splitpath (rom_filename, drive, dir, name, ext);    _makepath (fname, drive, dir, name, "pat");    if ((f = fopen(fname, "r")) != NULL)    {        while(fgets(buf, 80, f) != NULL)        {	    if ((p = strrchr (buf, '\n')) != NULL) 		*p = '\0';	    if (((error = S9xGameGenieToRaw (buf, address, byte)) == NULL) ||		((error = S9xProActionReplayToRaw (buf, address, byte)) == NULL))	    {		S9xAddCheat (TRUE, FALSE, address, byte);	    }	    else	    if ((error = S9xGoldFingerToRaw (buf, address, sram,					     num_bytes, bytes)) == NULL)	    {		for (int c = 0; c < num_bytes; c++)		    S9xAddCheat (TRUE, FALSE, address + c, bytes [c]);	    }	    else		S9xMessage (S9X_ERROR, S9X_GAME_GENIE_CODE_ERROR, error);        }        fclose(f);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -