some work on infrastructure for recording any kind of input. but now movies are broken. once i teach the movies how to only output the three columns that are currently defined, zappers will work.

This commit is contained in:
zeromus 2008-06-08 10:22:33 +00:00
parent 7676eff5cb
commit f90336a6a5
22 changed files with 1298 additions and 1261 deletions

View File

@ -15,44 +15,41 @@ std::fstream* FCEUD_UTF8_fstream(const char *n, const char *m);
//mbg 7/23/06 //mbg 7/23/06
const char *FCEUD_GetCompilerString(); const char *FCEUD_GetCompilerString();
/* This makes me feel dirty for some reason. */ //This makes me feel dirty for some reason.
void FCEU_printf(char *format, ...); void FCEU_printf(char *format, ...);
#define FCEUI_printf FCEU_printf #define FCEUI_printf FCEU_printf
/* Video interface */ //Video interface
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b); void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b);
void FCEUD_GetPalette(uint8 i,uint8 *r, uint8 *g, uint8 *b); void FCEUD_GetPalette(uint8 i,uint8 *r, uint8 *g, uint8 *b);
/* Displays an error. Can block or not. */ //Displays an error. Can block or not.
void FCEUD_PrintError(const char *s); void FCEUD_PrintError(const char *s);
void FCEUD_Message(const char *s); void FCEUD_Message(const char *s);
/* Network interface */ //Network interface
/* Call only when a game is loaded. */ //Call only when a game is loaded.
int FCEUI_NetplayStart(int nlocal, int divisor); int FCEUI_NetplayStart(int nlocal, int divisor);
/* Call when network play needs to stop. */ // Call when network play needs to stop.
void FCEUI_NetplayStop(void); void FCEUI_NetplayStop(void);
/* Note: YOU MUST NOT CALL ANY FCEUI_* FUNCTIONS WHILE IN FCEUD_SendData() or //Note: YOU MUST NOT CALL ANY FCEUI_* FUNCTIONS WHILE IN FCEUD_SendData() or FCEUD_RecvData().
FCEUD_RecvData().
*/
/* Return 0 on failure, 1 on success. */ //Return 0 on failure, 1 on success.
int FCEUD_SendData(void *data, uint32 len); int FCEUD_SendData(void *data, uint32 len);
int FCEUD_RecvData(void *data, uint32 len); int FCEUD_RecvData(void *data, uint32 len);
/* Display text received over the network. */ //Display text received over the network.
void FCEUD_NetplayText(uint8 *text); void FCEUD_NetplayText(uint8 *text);
/* Encode and send text over the network. */ //Encode and send text over the network.
void FCEUI_NetplayText(uint8 *text); void FCEUI_NetplayText(uint8 *text);
/* Called when a fatal error occurred and network play can't continue. This function //Called when a fatal error occurred and network play can't continue. This function
should call FCEUI_NetplayStop() after it has deinitialized the network on the driver //should call FCEUI_NetplayStop() after it has deinitialized the network on the driver
side. //side.
*/
void FCEUD_NetworkClose(void); void FCEUD_NetworkClose(void);
bool FCEUI_BeginWaveRecord(const char *fn); bool FCEUI_BeginWaveRecord(const char *fn);
@ -68,82 +65,45 @@ void FCEUI_NTSCINC(void);
void FCEUI_GetNTSCTH(int *tint, int *hue); void FCEUI_GetNTSCTH(int *tint, int *hue);
void FCEUI_SetNTSCTH(int n, int tint, int hue); void FCEUI_SetNTSCTH(int n, int tint, int hue);
//input device types for the standard joystick port
enum ESI
{
SI_NONE = 0,
SI_GAMEPAD = 1,
SI_ZAPPER = 2,
SI_POWERPADA = 3,
SI_POWERPADB = 4,
SI_ARKANOID = 5,
SI_MOUSE = 6 //mbg merge 7/17/06 added
};
//input device types for the expansion port
enum ESIFC
{
SIFC_NONE = 0,
SIFC_ARKANOID = 1,
SIFC_SHADOW = 2,
SIFC_4PLAYER = 3,
SIFC_FKB = 4,
SIFC_SUBORKB = 5,
SIFC_HYPERSHOT = 6,
SIFC_MAHJONG = 7,
SIFC_QUIZKING = 8,
SIFC_FTRAINERA = 9,
SIFC_FTRAINERB = 10,
SIFC_OEKAKIDS = 11,
SIFC_BWORLD = 12,
SIFC_TOPRIDER = 13,
};
void FCEUI_SetInput(int port, ESI type, void *ptr, int attrib); void FCEUI_SetInput(int port, ESI type, void *ptr, int attrib);
void FCEUI_SetInputFC(ESIFC type, void *ptr, int attrib); void FCEUI_SetInputFC(ESIFC type, void *ptr, int attrib);
void FCEUI_DisableFourScore(bool disabled); void FCEUI_DisableFourScore(bool disabled);
void FCEUI_UseInputPreset(int preset); void FCEUI_UseInputPreset(int preset);
#define SIS_NONE 0 //New interface functions
#define SIS_DATACH 1
#define SIS_NWC 2
#define SIS_VSUNISYSTEM 3
#define SIS_NSF 4
/* New interface functions */ //0 to order screen snapshots numerically(0.png), 1 to order them file base-numerically(smb3-0.png).
/* 0 to order screen snapshots numerically(0.png), 1 to order them file base-numerically(smb3-0.png). */
void FCEUI_SetSnapName(int a); void FCEUI_SetSnapName(int a);
/* 0 to keep 8-sprites limitation, 1 to remove it */ //0 to keep 8-sprites limitation, 1 to remove it
void FCEUI_DisableSpriteLimitation(int a); void FCEUI_DisableSpriteLimitation(int a);
/* -1 = no change, 0 = show, 1 = hide, 2 = internal toggle */ //-1 = no change, 0 = show, 1 = hide, 2 = internal toggle
void FCEUI_SetRenderDisable(int sprites, int bg); void FCEUI_SetRenderDisable(int sprites, int bg);
/* name=path and file to load. returns 0 on failure, 1 on success */ //name=path and file to load. returns 0 on failure, 1 on success
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode); FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode);
/* allocates memory. 0 on failure, 1 on success. */ //general purpose emulator initialization. returns true if successful
int FCEUI_Initialize(void); bool FCEUI_Initialize();
/* Emulates a frame. */ //Emulates a frame.
void FCEUI_Emulate(uint8 **, int32 **, int32 *, int); void FCEUI_Emulate(uint8 **, int32 **, int32 *, int);
/* Closes currently loaded game */ //Closes currently loaded game
void FCEUI_CloseGame(void); void FCEUI_CloseGame(void);
/* Deallocates all allocated memory. Call after FCEUI_Emulate() returns. */ //Deallocates all allocated memory. Call after FCEUI_Emulate() returns.
void FCEUI_Kill(void); void FCEUI_Kill(void);
/* Enable/Disable game genie. a=0 disable, a=1 enable */ //Enable/Disable game genie. a=true->enabled
void FCEUI_SetGameGenie(int a); void FCEUI_SetGameGenie(bool a);
/* Set video system a=0 NTSC, a=1 PAL */ //Set video system a=0 NTSC, a=1 PAL
void FCEUI_SetVidSystem(int a); void FCEUI_SetVidSystem(int a);
/* Convenience function; returns currently emulated video system(0=NTSC, 1=PAL). */ //Convenience function; returns currently emulated video system(0=NTSC, 1=PAL).
int FCEUI_GetCurrentVidSystem(int *slstart, int *slend); int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);
#ifdef FRAMESKIP #ifdef FRAMESKIP
@ -154,23 +114,19 @@ int FCEUI_GetCurrentVidSystem(int *slstart, int *slend);
void FCEUI_FrameSkip(int x); void FCEUI_FrameSkip(int x);
#endif #endif
/* First and last scanlines to render, for ntsc and pal emulation. */ //First and last scanlines to render, for ntsc and pal emulation.
void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall); void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall);
/* Sets the base directory(save states, snapshots, etc. are saved in directories //Sets the base directory(save states, snapshots, etc. are saved in directories below this directory.
below this directory. */
void FCEUI_SetBaseDirectory(const char *dir); void FCEUI_SetBaseDirectory(const char *dir);
/* Tells FCE Ultra to copy the palette data pointed to by pal and use it. //Tells FCE Ultra to copy the palette data pointed to by pal and use it.
Data pointed to by pal needs to be 64*3 bytes in length. //Data pointed to by pal needs to be 64*3 bytes in length.
*/
void FCEUI_SetPaletteArray(uint8 *pal); void FCEUI_SetPaletteArray(uint8 *pal);
/* Sets up sound code to render sound at the specified rate, in samples //Sets up sound code to render sound at the specified rate, in samples
per second. Only sample rates of 44100, 48000, and 96000 are currently //per second. Only sample rates of 44100, 48000, and 96000 are currently supported.
supported. //If "Rate" equals 0, sound is disabled.
If "Rate" equals 0, sound is disabled.
*/
void FCEUI_Sound(int Rate); void FCEUI_Sound(int Rate);
void FCEUI_SetSoundVolume(uint32 volume); void FCEUI_SetSoundVolume(uint32 volume);
void FCEUI_SetSoundQuality(int quality); void FCEUI_SetSoundQuality(int quality);
@ -180,7 +136,7 @@ void FCEUD_SoundVolumeAdjust(int);
int FCEUI_SelectState(int, int); int FCEUI_SelectState(int, int);
/* "fname" overrides the default save state filename code if non-NULL. */ //"fname" overrides the default save state filename code if non-NULL.
void FCEUI_SaveState(char *fname); void FCEUI_SaveState(char *fname);
void FCEUI_LoadState(char *fname); void FCEUI_LoadState(char *fname);
@ -305,7 +261,7 @@ void FCEUI_FDSSelect(void);
int FCEUI_DatachSet(const uint8 *rcode); int FCEUI_DatachSet(const uint8 *rcode);
///returns a flag indicating whether emulation is paused ///returns a flag indicating whether emulation is paused
int FCEUI_EmulationPaused(void); int FCEUI_EmulationPaused();
///returns a flag indicating whether a one frame step has been requested ///returns a flag indicating whether a one frame step has been requested
int FCEUI_EmulationFrameStepped(); int FCEUI_EmulationFrameStepped();
///clears the framestepped flag. use it after youve stepped your one frame ///clears the framestepped flag. use it after youve stepped your one frame
@ -313,7 +269,10 @@ void FCEUI_ClearEmulationFrameStepped();
///sets the EmulationPaused flags ///sets the EmulationPaused flags
void FCEUI_SetEmulationPaused(int val); void FCEUI_SetEmulationPaused(int val);
///toggles the paused bit (bit0) for EmulationPaused. caused FCEUD_DebugUpdate() to fire if the emulation pauses ///toggles the paused bit (bit0) for EmulationPaused. caused FCEUD_DebugUpdate() to fire if the emulation pauses
void FCEUI_ToggleEmulationPause(void); void FCEUI_ToggleEmulationPause();
//indicates whether input aids should be drawn (such as crosshairs, etc; usually in fullscreen mode)
bool FCEUD_ShouldDrawInputAids();
///called when the emulator closes a game ///called when the emulator closes a game
void FCEUD_OnCloseGame(void); void FCEUD_OnCloseGame(void);
@ -389,4 +348,4 @@ extern "C"
#endif #endif
FILE *FCEUI_UTF8fopen_C(const char *n, const char *m); FILE *FCEUI_UTF8fopen_C(const char *n, const char *m);
#endif /* __DRIVER_H_ */ #endif //__DRIVER_H_

View File

@ -118,7 +118,7 @@ static CFGSTRUCT fceuconfig[] = {
NAC("eoptions",eoptions), NAC("eoptions",eoptions),
NACA("cpalette",cpalette), NACA("cpalette",cpalette),
NACA("InputType",UsrInputType), NACA("InputType",InputType),
NAC("vmcx",vmodes[0].x), NAC("vmcx",vmodes[0].x),
NAC("vmcy",vmodes[0].y), NAC("vmcy",vmodes[0].y),

View File

@ -1,4 +1,4 @@
void SaveConfig(const char *filename); void SaveConfig(const char *filename);
void LoadConfig(const char *filename); void LoadConfig(const char *filename);
extern int UsrInputType[3]; extern int InputType[3];

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ int GetAutoFireDesynch();
extern LPDIRECTINPUT7 lpDI; extern LPDIRECTINPUT7 lpDI;
extern int InputType[3]; extern int InputType[3];
extern int UsrInputType[3]; //extern int UsrInputType[3];
extern int cidisabled; extern int cidisabled;
#ifndef _aosdfjk02fmasf #ifndef _aosdfjk02fmasf
#define _aosdfjk02fmasf #define _aosdfjk02fmasf
@ -58,7 +58,7 @@ void ParseGIInput(FCEUGI *GameInfo);
#define FCFGD_HYPERSHOT 3 #define FCFGD_HYPERSHOT 3
#define FCFGD_QUIZKING 4 #define FCFGD_QUIZKING 4
void InitOtherInput(void); void InitInputPorts(void);
void SetEmulationSpeed(int type); void SetEmulationSpeed(int type);
int FCEUD_TestCommandState(int c); int FCEUD_TestCommandState(int c);
void FCEUD_UpdateInput(); void FCEUD_UpdateInput();

View File

@ -613,13 +613,12 @@ int main(int argc,char *argv[])
// Parse the commandline arguments // Parse the commandline arguments
t = ParseArgies(argc, argv); t = ParseArgies(argc, argv);
/* Bleh, need to find a better place for this. */ //Bleh, need to find a better place for this.
{ {
pal_emulation = !!pal_emulation; pal_emulation = !!pal_emulation;
FCEUI_SetVidSystem(pal_emulation); FCEUI_SetVidSystem(pal_emulation);
genie = !!genie; FCEUI_SetGameGenie(genie!=0);
FCEUI_SetGameGenie(genie);
fullscreen = !!fullscreen; fullscreen = !!fullscreen;
soundo = !!soundo; soundo = !!soundo;

View File

@ -26,6 +26,7 @@ extern int maxconbskip;
extern int ffbskip; extern int ffbskip;
static int fullscreen = 0; static int fullscreen = 0;
// Flag that indicates whether Game Genie is enabled or not. // Flag that indicates whether Game Genie is enabled or not.
extern int genie; extern int genie;

View File

@ -35,7 +35,7 @@ static int bpp;
static int vflags; static int vflags;
static int veflags; static int veflags;
int disvaccel = 0; /* Disable video hardware acceleration. */ int disvaccel = 0; //Disable video hardware acceleration.
int fssync=0; int fssync=0;
int winsync=0; int winsync=0;
@ -257,7 +257,7 @@ int SetVideoMode(int fs)
return 1; return 1;
} }
/* Beginning */ //Beginning
memset(&ddsd,0,sizeof(ddsd)); memset(&ddsd,0,sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS; ddsd.dwFlags = DDSD_CAPS;
@ -280,10 +280,9 @@ int SetVideoMode(int fs)
ddsdback.dwWidth=256 * specmul; ddsdback.dwWidth=256 * specmul;
ddsdback.dwHeight=FSettings.TotalScanlines() * specmul; ddsdback.dwHeight=FSettings.TotalScanlines() * specmul;
/* //If the blit hardware can't stretch, assume it's cheap(and slow)
If the blit hardware can't stretch, assume it's cheap(and slow) //and create the buffer in system memory.
and create the buffer in system memory.
*/
if(!(caps.dwCaps&DDCAPS_BLTSTRETCH)) if(!(caps.dwCaps&DDCAPS_BLTSTRETCH))
ddsdback.ddsCaps.dwCaps|=DDSCAPS_SYSTEMMEMORY; ddsdback.ddsCaps.dwCaps|=DDSCAPS_SYSTEMMEMORY;
@ -329,7 +328,7 @@ int SetVideoMode(int fs)
windowedfailed=0; windowedfailed=0;
SetMainWindowStuff(); SetMainWindowStuff();
} }
else /* Following is full-screen */ else //Following is full-screen
{ {
if(vmod == 0) if(vmod == 0)
{ {
@ -421,11 +420,16 @@ int SetVideoMode(int fs)
ShowCursorAbs(0); ShowCursorAbs(0);
} }
InputScreenChanged(fs);
fullscreen=fs; fullscreen=fs;
return 1; return 1;
} }
//draw input aids if we are fullscreen
bool FCEUD_ShouldDrawInputAids()
{
return fullscreen!=0;
}
static void BlitScreenWindow(uint8 *XBuf); static void BlitScreenWindow(uint8 *XBuf);
static void BlitScreenFull(uint8 *XBuf); static void BlitScreenFull(uint8 *XBuf);
//static uint8 *XBSave; //static uint8 *XBSave;
@ -1105,9 +1109,7 @@ void DoVideoConfigFix(void)
UpdateRendBounds(); UpdateRendBounds();
} }
/** //Shows the Video configuration dialog.
* Shows the Video configuration dialog.
**/
void ConfigVideo(void) void ConfigVideo(void)
{ {
DialogBox(fceu_hInstance, "VIDEOCONFIG", hAppWnd, VideoConCallB); DialogBox(fceu_hInstance, "VIDEOCONFIG", hAppWnd, VideoConCallB);

View File

@ -889,7 +889,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
// Game Genie menu was selected // Game Genie menu was selected
genie ^= 1; genie ^= 1;
FCEUI_SetGameGenie(genie); FCEUI_SetGameGenie(genie!=0);
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
break; break;

View File

@ -342,9 +342,9 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
GameInfo->name=0; GameInfo->name=0;
GameInfo->type=GIT_CART; GameInfo->type=GIT_CART;
GameInfo->vidsys=GIV_USER; GameInfo->vidsys=GIV_USER;
GameInfo->input[0]=GameInfo->input[1]=-1; GameInfo->input[0]=GameInfo->input[1]=SI_UNSET;
GameInfo->inputfc=-1; GameInfo->inputfc=SIFC_UNSET;
GameInfo->cspecial=0; GameInfo->cspecial=SIS_NONE;
//try to load each different format //try to load each different format
if(iNESLoad(name,fp,OverwriteVidMode)) if(iNESLoad(name,fp,OverwriteVidMode))
@ -392,16 +392,14 @@ FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode)
} }
/** //Return: Flag that indicates whether the function was succesful or not.
* Return: Flag that indicates whether the function was succesful or not. bool FCEUI_Initialize()
**/
int FCEUI_Initialize(void)
{ {
srand(time(0)); srand(time(0));
if(!FCEU_InitVirtualVideo()) if(!FCEU_InitVirtualVideo())
{ {
return 0; return false;
} }
AllocBuffers(); AllocBuffers();
@ -422,7 +420,7 @@ int FCEUI_Initialize(void)
X6502_Init(); X6502_Init();
return 1; return true;
} }
void FCEUI_Kill(void) void FCEUI_Kill(void)
@ -750,12 +748,10 @@ int FCEUI_GetCurrentVidSystem(int *slstart, int *slend)
return(PAL); return(PAL);
} }
/** //Enable or disable Game Genie option.
* Enable or disable Game Genie option. void FCEUI_SetGameGenie(bool a)
**/
void FCEUI_SetGameGenie(int a)
{ {
FSettings.GameGenie = a ? 1 : 0; FSettings.GameGenie = a;
} }
void FCEUI_SetSnapName(int a) void FCEUI_SetSnapName(int a)

View File

@ -71,7 +71,7 @@ typedef struct {
int PAL; int PAL;
int NetworkPlay; int NetworkPlay;
int SoundVolume; int SoundVolume;
int GameGenie; bool GameGenie;
//the currently selected first and last rendered scanlines. //the currently selected first and last rendered scanlines.
int FirstSLine; int FirstSLine;

View File

@ -1,31 +1,78 @@
#ifndef __FCEU_GIT #ifndef __FCEU_GIT
#define __FCEU_GIT #define __FCEU_GIT
/* Mmm...git. Almost as funny as "gimp". */
#define GIT_CART 0 /* Cart. */
#define GIT_VSUNI 1 /* VS Unisystem. */
#define GIT_FDS 2 /* Famicom Disk System. */
#define GIT_NSF 3 /* NES Sound Format. */
#define GIV_NTSC 0 /* NTSC emulation. */ enum EGIT
#define GIV_PAL 1 /* PAL emulation. */ {
#define GIV_USER 2 /* What was set by FCEUI_SetVidSys(). */ GIT_CART = 0, //Cart
GIT_VSUNI = 1, //VS Unisystem
GIT_FDS = 2, // Famicom Disk System
GIT_NSF = 3, //NES Sound Format
};
enum EGIV
{
GIV_NTSC = 0, //NTSC emulation.
GIV_PAL = 1, //PAL emulation.
GIV_USER = 2, //What was set by FCEUI_SetVidSys().
};
enum ESIS
{
SIS_NONE = 0,
SIS_DATACH = 1,
SIS_NWC = 2,
SIS_VSUNISYSTEM = 3,
SIS_NSF = 4,
};
//input device types for the standard joystick port
enum ESI
{
SI_UNSET = -1,
SI_NONE = 0,
SI_GAMEPAD = 1,
SI_ZAPPER = 2,
SI_POWERPADA = 3,
SI_POWERPADB = 4,
SI_ARKANOID = 5,
SI_MOUSE = 6 //mbg merge 7/17/06 added
};
//input device types for the expansion port
enum ESIFC
{
SIFC_UNSET = -1,
SIFC_NONE = 0,
SIFC_ARKANOID = 1,
SIFC_SHADOW = 2,
SIFC_4PLAYER = 3,
SIFC_FKB = 4,
SIFC_SUBORKB = 5,
SIFC_HYPERSHOT = 6,
SIFC_MAHJONG = 7,
SIFC_QUIZKING = 8,
SIFC_FTRAINERA = 9,
SIFC_FTRAINERB = 10,
SIFC_OEKAKIDS = 11,
SIFC_BWORLD = 12,
SIFC_TOPRIDER = 13,
};
#include "utils/md5.h" #include "utils/md5.h"
typedef struct { typedef struct {
uint8 *name; /* Game name, UTF8 encoding */ uint8 *name; //Game name, UTF8 encoding
int type; /* GIT_* */ EGIT type;
int vidsys; /* Current emulated video system; GIV_* */ EGIV vidsys; //Current emulated video system;
int input[2]; /* Desired input for emulated input ports 1 and 2; -1 ESI input[2]; //Desired input for emulated input ports 1 and 2; -1 for unknown desired input.
for unknown desired input. */ ESIFC inputfc; //Desired Famicom expansion port device. -1 for unknown desired input.
int inputfc; /* Desired Famicom expansion port device. -1 for unknown ESIS cspecial; //Special cart expansion: DIP switches, barcode reader, etc.
desired input. */
int cspecial; /* Special cart expansion: DIP switches, barcode
reader, etc.
*/
MD5DATA MD5; MD5DATA MD5;
int soundrate; /* For Ogg Vorbis expansion sound wacky support. 0 for default. */
int soundchan; /* Number of sound channels. */ //mbg 6/8/08 - ???
int soundrate; //For Ogg Vorbis expansion sound wacky support. 0 for default.
int soundchan; //Number of sound channels.
} FCEUGI; } FCEUGI;
#endif #endif

View File

@ -169,104 +169,103 @@ struct CRCMATCH {
struct INPSEL { struct INPSEL {
uint32 crc32; uint32 crc32;
int input1; ESI input1;
int input2; ESI input2;
int inputfc; ESIFC inputfc;
}; };
/* This is mostly for my personal use. So HA. */
static void SetInput(void) static void SetInput(void)
{ {
static struct INPSEL moo[]= static struct INPSEL moo[]=
{ {
{0x3a1694f9,SI_GAMEPAD,SI_GAMEPAD,SIFC_4PLAYER}, /* Nekketsu Kakutou Densetsu */ {0x3a1694f9,SI_GAMEPAD,SI_GAMEPAD,SIFC_4PLAYER}, // Nekketsu Kakutou Densetsu
{0xc3c0811d,SI_GAMEPAD,SI_GAMEPAD,SIFC_OEKAKIDS}, /* The two "Oeka Kids" games */ {0xc3c0811d,SI_GAMEPAD,SI_GAMEPAD,SIFC_OEKAKIDS}, // The two "Oeka Kids" games
{0x9d048ea4,SI_GAMEPAD,SI_GAMEPAD,SIFC_OEKAKIDS}, /* */ {0x9d048ea4,SI_GAMEPAD,SI_GAMEPAD,SIFC_OEKAKIDS}, //
{0xaf4010ea,SI_GAMEPAD,SI_POWERPADB,-1}, /* World Class Track Meet */ {0xaf4010ea,SI_GAMEPAD,SI_POWERPADB,SIFC_UNSET}, // World Class Track Meet
{0xd74b2719,SI_GAMEPAD,SI_POWERPADB,-1}, /* Super Team Games */ {0xd74b2719,SI_GAMEPAD,SI_POWERPADB,SIFC_UNSET}, // Super Team Games
{0x61d86167,SI_GAMEPAD,SI_POWERPADB,-1}, /* Street Cop */ {0x61d86167,SI_GAMEPAD,SI_POWERPADB,SIFC_UNSET}, // Street Cop
{0x6435c095,SI_GAMEPAD,SI_POWERPADB,-1}, /* Short Order/Eggsplode */ {0x6435c095,SI_GAMEPAD,SI_POWERPADB,SIFC_UNSET}, // Short Order/Eggsplode
{0x47232739,SI_GAMEPAD,SI_GAMEPAD,SIFC_TOPRIDER}, /* Top Rider */ {0x47232739,SI_GAMEPAD,SI_GAMEPAD,SIFC_TOPRIDER}, // Top Rider
{0x48ca0ee1,SI_GAMEPAD,SI_GAMEPAD,SIFC_BWORLD}, /* Barcode World */ {0x48ca0ee1,SI_GAMEPAD,SI_GAMEPAD,SIFC_BWORLD}, // Barcode World
{0x9f8f200a,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, /* Super Mogura Tataki!! - Pokkun Moguraa */ {0x9f8f200a,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, // Super Mogura Tataki!! - Pokkun Moguraa
{0x9044550e,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, /* Rairai Kyonshizu */ {0x9044550e,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, // Rairai Kyonshizu
{0x2f128512,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, /* Jogging Race */ {0x2f128512,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, // Jogging Race
{0x60ad090a,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, /* Athletic World */ {0x60ad090a,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERA}, // Athletic World
{0x8a12a7d9,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Totsugeki Fuuun Takeshi Jou */ {0x8a12a7d9,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Totsugeki Fuuun Takeshi Jou
{0xea90f3e2,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Running Stadium */ {0xea90f3e2,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Running Stadium
{0x370ceb65,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Meiro Dai Sakusen */ {0x370ceb65,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Meiro Dai Sakusen
// Bad dump? {0x69ffb014,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Fuun Takeshi Jou 2 */ // Bad dump? {0x69ffb014,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Fuun Takeshi Jou 2
{0x6cca1c1f,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Dai Undoukai */ {0x6cca1c1f,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Dai Undoukai
{0x29de87af,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Aerobics Studio */ {0x29de87af,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Aerobics Studio
{0xbba58be5,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Family Trainer: Manhattan Police */ {0xbba58be5,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Family Trainer: Manhattan Police
{0xea90f3e2,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, /* Family Trainer: Running Stadium */ {0xea90f3e2,SI_GAMEPAD,SI_GAMEPAD,SIFC_FTRAINERB}, // Family Trainer: Running Stadium
{0xd9f45be9,SI_GAMEPAD,SI_GAMEPAD,SIFC_QUIZKING}, /* Gimme a Break ... */ {0xd9f45be9,SI_GAMEPAD,SI_GAMEPAD,SIFC_QUIZKING}, // Gimme a Break ...
{0x1545bd13,SI_GAMEPAD,SI_GAMEPAD,SIFC_QUIZKING}, /* Gimme a Break ... 2 */ {0x1545bd13,SI_GAMEPAD,SI_GAMEPAD,SIFC_QUIZKING}, // Gimme a Break ... 2
{0x7b44fb2a,SI_GAMEPAD,SI_GAMEPAD,SIFC_MAHJONG}, /* Ide Yousuke Meijin no Jissen Mahjong 2 */ {0x7b44fb2a,SI_GAMEPAD,SI_GAMEPAD,SIFC_MAHJONG}, // Ide Yousuke Meijin no Jissen Mahjong 2
{0x9fae4d46,SI_GAMEPAD,SI_GAMEPAD,SIFC_MAHJONG}, /* Ide Yousuke Meijin no Jissen Mahjong */ {0x9fae4d46,SI_GAMEPAD,SI_GAMEPAD,SIFC_MAHJONG}, // Ide Yousuke Meijin no Jissen Mahjong
{0x980be936,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, /* Hyper Olympic */ {0x980be936,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, // Hyper Olympic
{0x21f85681,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, /* Hyper Olympic (Gentei Ban) */ {0x21f85681,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, // Hyper Olympic (Gentei Ban)
{0x915a53a7,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, /* Hyper Sports */ {0x915a53a7,SI_GAMEPAD,SI_GAMEPAD,SIFC_HYPERSHOT}, // Hyper Sports
{0xad9c63e2,SI_GAMEPAD,-1,SIFC_SHADOW}, /* Space Shadow */ {0xad9c63e2,SI_GAMEPAD,SI_UNSET,SIFC_SHADOW}, // Space Shadow
{0x24598791,-1,SI_ZAPPER,0}, /* Duck Hunt */ {0x24598791,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Duck Hunt
{0xff24d794,-1,SI_ZAPPER,0}, /* Hogan's Alley */ {0xff24d794,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Hogan's Alley
{0xbeb8ab01,-1,SI_ZAPPER,0}, /* Gumshoe */ {0xbeb8ab01,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Gumshoe
{0xde8fd935,-1,SI_ZAPPER,0}, /* To the Earth */ {0xde8fd935,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // To the Earth
{0xedc3662b,-1,SI_ZAPPER,0}, /* Operation Wolf */ {0xedc3662b,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Operation Wolf
{0x2a6559a1,-1,SI_ZAPPER,0}, /* Operation Wolf (J) */ {0x2a6559a1,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Operation Wolf (J)
{0x23d17f5e,SI_GAMEPAD,SI_ZAPPER,0}, /* The Lone Ranger */ {0x23d17f5e,SI_GAMEPAD,SI_ZAPPER,SIFC_NONE}, // The Lone Ranger
{0xb8b9aca3,-1,SI_ZAPPER,0}, /* Wild Gunman */ {0xb8b9aca3,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Wild Gunman
{0x5112dc21,-1,SI_ZAPPER,0}, /* Wild Gunman */ {0x5112dc21,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Wild Gunman
{0x4318a2f8,-1,SI_ZAPPER,0}, /* Barker Bill's Trick Shooting */ {0x4318a2f8,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Barker Bill's Trick Shooting
{0x5ee6008e,-1,SI_ZAPPER,0}, /* Mechanized Attack */ {0x5ee6008e,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Mechanized Attack
{0x3e58a87e,-1,SI_ZAPPER,0}, /* Freedom Force */ {0x3e58a87e,SI_UNSET,SI_ZAPPER,SIFC_NONE}, // Freedom Force
{0xe9a7fe9e,-1,SI_MOUSE,0}, /* Educational Computer 2000 */ //mbg merge 7/17/06 added -- appears to be from newer MM build {0xe9a7fe9e,SI_UNSET,SI_MOUSE,SIFC_NONE}, // Educational Computer 2000 //mbg merge 7/17/06 added -- appears to be from newer MM build
{0x851eb9be,SI_GAMEPAD,SI_ZAPPER,0}, /* Shooting Range */ {0x851eb9be,SI_GAMEPAD,SI_ZAPPER,SIFC_NONE}, // Shooting Range
{0x74bea652,SI_GAMEPAD,SI_ZAPPER,0}, /* Supergun 3-in-1 */ {0x74bea652,SI_GAMEPAD,SI_ZAPPER,SIFC_NONE}, // Supergun 3-in-1
{0x32fb0583,-1,SI_ARKANOID,0}, /* Arkanoid(NES) */ {0x32fb0583,SI_UNSET,SI_ARKANOID,SIFC_NONE}, // Arkanoid(NES)
{0xd89e5a67,-1,-1,SIFC_ARKANOID}, /* Arkanoid (J) */ {0xd89e5a67,SI_UNSET,SI_UNSET,SIFC_ARKANOID}, // Arkanoid (J)
{0x0f141525,-1,-1,SIFC_ARKANOID}, /* Arkanoid 2(J) */ {0x0f141525,SI_UNSET,SI_UNSET,SIFC_ARKANOID}, // Arkanoid 2(J)
{0x912989dc,-1,-1,SIFC_FKB}, /* Playbox BASIC */ {0x912989dc,SI_UNSET,SI_UNSET,SIFC_FKB}, // Playbox BASIC
{0xf7606810,-1,-1,SIFC_FKB}, /* Family BASIC 2.0A */ {0xf7606810,SI_UNSET,SI_UNSET,SIFC_FKB}, // Family BASIC 2.0A
{0x895037bc,-1,-1,SIFC_FKB}, /* Family BASIC 2.1a */ {0x895037bc,SI_UNSET,SI_UNSET,SIFC_FKB}, // Family BASIC 2.1a
{0xb2530afc,-1,-1,SIFC_FKB}, /* Family BASIC 3.0 */ {0xb2530afc,SI_UNSET,SI_UNSET,SIFC_FKB}, // Family BASIC 3.0
{0x82f1fb96,-1,-1,SIFC_SUBORKB}, /* Subor 1.0 Russian */ {0x82f1fb96,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // Subor 1.0 Russian
{0xabb2f974,-1,-1,SIFC_SUBORKB}, /* Study and Game 32-in-1 */ {0xabb2f974,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // Study and Game 32-in-1
{0xd5d6eac4,-1,-1,SIFC_SUBORKB}, /* Edu (As) */ {0xd5d6eac4,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // Edu (As)
{0x589b6b0d,-1,-1,SIFC_SUBORKB}, /* SuporV20 */ {0x589b6b0d,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // SuporV20
{0x5e073a1b,-1,-1,SIFC_SUBORKB}, /* Supor English (Chinese) */ {0x5e073a1b,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // Supor English (Chinese)
{0x8b265862,-1,-1,SIFC_SUBORKB}, {0x8b265862,SI_UNSET,SI_UNSET,SIFC_SUBORKB},
{0x41401c6d,-1,-1,SIFC_SUBORKB}, /* SuporV40 */ {0x41401c6d,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // SuporV40
{0x41ef9ac4,-1,-1,SIFC_SUBORKB}, {0x41ef9ac4,SI_UNSET,SI_UNSET,SIFC_SUBORKB},
{0x368c19a8,-1,-1,SIFC_SUBORKB}, /* LIKO Study Cartridge */ {0x368c19a8,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // LIKO Study Cartridge
{0x543ab532,-1,-1,SIFC_SUBORKB}, /* LIKO Color Lines */ {0x543ab532,SI_UNSET,SI_UNSET,SIFC_SUBORKB}, // LIKO Color Lines
{0,-1,-1,-1} {0,SI_UNSET,SI_UNSET,SIFC_UNSET}
}; };
int x=0; int x=0;
while(moo[x].input1>=0 || moo[x].input2>=0 || moo[x].inputfc>=0) while(moo[x].input1>=0 || moo[x].input2>=0 || moo[x].inputfc>=0)
{ {
if(moo[x].crc32==iNESGameCRC32) if(moo[x].crc32==iNESGameCRC32)
{ {
GameInfo->input[0]=moo[x].input1; GameInfo->input[0]=moo[x].input1;
GameInfo->input[1]=moo[x].input2; GameInfo->input[1]=moo[x].input2;
GameInfo->inputfc=moo[x].inputfc; GameInfo->inputfc=moo[x].inputfc;
break; break;
} }
x++; x++;
} }
} }
#define INESB_INCOMPLETE 1 #define INESB_INCOMPLETE 1

View File

@ -20,6 +20,7 @@
*/ */
#include <string> #include <string>
#include <ostream>
#include <string.h> #include <string.h>
#include "types.h" #include "types.h"
@ -65,7 +66,7 @@ extern INPUTCFC *FCEU_InitBarcodeWorld(void);
//--------------- //---------------
static uint8 joy_readbit[2]; static uint8 joy_readbit[2];
static uint8 joy[4]={0,0,0,0}; uint8 joy[4]={0,0,0,0}; //HACK - should be static but movie needs it
static uint8 LastStrobe; static uint8 LastStrobe;
static int BotMode = 0; static int BotMode = 0;
@ -83,23 +84,8 @@ extern uint8 coinon;
static bool FSDisable=false; // Set to true if NES-style four-player adapter is disabled. static bool FSDisable=false; // Set to true if NES-style four-player adapter is disabled.
static struct JOYPORT JOYPORT joyports[2] = { JOYPORT(0), JOYPORT(1) };
{ FCPORT portFC;
int attrib;
ESI type;
void* ptr;
INPUTC* driver;
} joyports[2];
static struct FCPORT
{
int attrib;
ESIFC type;
void* ptr;
INPUTCFC* driver;
} portFC;
static DECLFR(JPRead) static DECLFR(JPRead)
{ {
@ -142,9 +128,9 @@ static DECLFW(B4016)
} }
//a main joystick port driver representing the case where nothing is plugged in //a main joystick port driver representing the case where nothing is plugged in
static INPUTC DummyJPort={0,0,0,0,0}; static INPUTC DummyJPort={0,0,0,0,0,0};
//and an expansion port driver for the same ting //and an expansion port driver for the same ting
static INPUTCFC DummyPortFC={0,0,0,0,0}; static INPUTCFC DummyPortFC={0,0,0,0,0,0};
//--------4 player driver for expansion port-------- //--------4 player driver for expansion port--------
@ -200,6 +186,35 @@ static void UpdateGP(int w, void *data, int arg)
} }
} }
static void LogGP(int w, MovieRecord* mr)
{
if(w==0)
{
mr->joysticks[0] = joy[0];
mr->joysticks[2] = joy[2];
}
else
{
mr->joysticks[1] = joy[1];
mr->joysticks[3] = joy[3];
}
}
static void LoadGP(int w, MovieRecord* mr)
{
if(w==0)
{
joy[0] = mr->joysticks[0];
joy[2] = mr->joysticks[2];
}
else
{
joy[1] = mr->joysticks[1];
joy[3] = mr->joysticks[3];
}
}
//basic joystick port driver //basic joystick port driver
static uint8 ReadGP(int w) static uint8 ReadGP(int w)
{ {
@ -231,8 +246,8 @@ static void StrobeGP(int w)
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
static INPUTC GPC={ReadGP,0,StrobeGP,UpdateGP,0,0}; static INPUTC GPC={ReadGP,0,StrobeGP,UpdateGP,0,0,LogGP,LoadGP};
static INPUTC GPCVS={ReadGPVS,0,StrobeGP,UpdateGP,0,0}; static INPUTC GPCVS={ReadGPVS,0,StrobeGP,UpdateGP,0,0,LogGP,LoadGP};
int FCEU_BotMode() int FCEU_BotMode()
{ {
@ -295,14 +310,16 @@ void FCEU_UpdateBot()
#endif //_USE_SHARED_MEMORY_ #endif //_USE_SHARED_MEMORY_
} }
void FCEU_UpdateInput(void) void FCEU_UpdateInput(void)
{ {
//tell all drivers to poll input and set up their logical states
if(!FCEUMOV_Mode(MOVIEMODE_PLAY) && !BotMode) if(!FCEUMOV_Mode(MOVIEMODE_PLAY) && !BotMode)
{ {
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);
} }
if(GameInfo->type==GIT_VSUNI) if(GameInfo->type==GIT_VSUNI)
if(coinon) coinon--; if(coinon) coinon--;
@ -310,8 +327,9 @@ void FCEU_UpdateInput(void)
if(FCEUnetplay) if(FCEUnetplay)
NetplayUpdate(joy); NetplayUpdate(joy);
FCEUMOV_AddInputState(ZD, joy, BotMode); FCEUMOV_AddInputState();
//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]);
} }

View File

@ -1,8 +1,16 @@
#ifndef _INPUT_H_ #ifndef _INPUT_H_
#define _INPUT_H_ #define _INPUT_H_
#include <ostream>
#include "git.h"
class MovieRecord;
//MBG TODO - COMBINE THESE INPUTC AND INPUTCFC
//The interface for standard joystick port device drivers //The interface for standard joystick port device drivers
typedef struct struct INPUTC
{ {
//these methods call the function pointers (or not, if they are null) //these methods call the function pointers (or not, if they are null)
uint8 Read(int w) { if(_Read) return _Read(w); else return 0; } uint8 Read(int w) { if(_Read) return _Read(w); else return 0; }
@ -11,17 +19,25 @@ typedef struct
void Update(int w, void *data, int arg) { if(_Update) _Update(w,data,arg); } void Update(int w, void *data, int arg) { if(_Update) _Update(w,data,arg); }
void SLHook(int w, uint8 *bg, uint8 *spr, uint32 linets, int final) { if(_SLHook) _SLHook(w,bg,spr,linets,final); } void SLHook(int w, uint8 *bg, uint8 *spr, uint32 linets, int final) { if(_SLHook) _SLHook(w,bg,spr,linets,final); }
void Draw(int w, uint8 *buf, int arg) { if(_Draw) _Draw(w,buf,arg); } void Draw(int w, uint8 *buf, int arg) { if(_Draw) _Draw(w,buf,arg); }
void Log(int w, MovieRecord* mr) { if(_Log) _Log(w,mr); }
void Load(int w, MovieRecord* mr) { if(_Load) _Load(w,mr); }
uint8 (*_Read)(int w); uint8 (*_Read)(int w);
void (*_Write)(uint8 v); void (*_Write)(uint8 v);
void (*_Strobe)(int w); void (*_Strobe)(int w);
//update will be called if input is coming from the user. refresh your logical state from user input devices
void (*_Update)(int w, void *data, int arg); void (*_Update)(int w, void *data, int arg);
void (*_SLHook)(int w, uint8 *bg, uint8 *spr, uint32 linets, int final); void (*_SLHook)(int w, uint8 *bg, uint8 *spr, uint32 linets, int final);
void (*_Draw)(int w, uint8 *buf, int arg); void (*_Draw)(int w, uint8 *buf, int arg);
} INPUTC;
//log is called when you need to put your logical state into a movie record for recording
void (*_Log)(int w, MovieRecord* mr);
//load will be called if input is coming from a movie. refresh your logical state from a movie record
void (*_Load)(int w, MovieRecord* mr);
};
//The interface for the expansion port device drivers //The interface for the expansion port device drivers
typedef struct struct INPUTCFC
{ {
//these methods call the function pointers (or not, if they are null) //these methods call the function pointers (or not, if they are null)
uint8 Read(int w, uint8 ret) { if(_Read) return _Read(w,ret); else return ret; } uint8 Read(int w, uint8 ret) { if(_Read) return _Read(w,ret); else return ret; }
@ -30,14 +46,48 @@ typedef struct
void Update(void *data, int arg) { if(_Update) _Update(data,arg); } void Update(void *data, int arg) { if(_Update) _Update(data,arg); }
void SLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) { if(_SLHook) _SLHook(bg,spr,linets,final); } void SLHook(uint8 *bg, uint8 *spr, uint32 linets, int final) { if(_SLHook) _SLHook(bg,spr,linets,final); }
void Draw(uint8 *buf, int arg) { if(_Draw) _Draw(buf,arg); } void Draw(uint8 *buf, int arg) { if(_Draw) _Draw(buf,arg); }
void Log(MovieRecord* mr) { if(_Log) _Log(mr); }
void Load(MovieRecord* mr) { if(_Load) _Load(mr); }
uint8 (*_Read)(int w, uint8 ret); uint8 (*_Read)(int w, uint8 ret);
void (*_Write)(uint8 v); void (*_Write)(uint8 v);
void (*_Strobe)(); void (*_Strobe)();
//update will be called if input is coming from the user. refresh your logical state from user input devices
void (*_Update)(void *data, int arg); void (*_Update)(void *data, int arg);
void (*_SLHook)(uint8 *bg, uint8 *spr, uint32 linets, int final); void (*_SLHook)(uint8 *bg, uint8 *spr, uint32 linets, int final);
void (*_Draw)(uint8 *buf, int arg); void (*_Draw)(uint8 *buf, int arg);
} INPUTCFC;
//log is called when you need to put your logical state into a movie record for recording
void (*_Log)(MovieRecord* mr);
//load will be called if input is coming from a movie. refresh your logical state from a movie record
void (*_Load)(MovieRecord* mr);
};
extern struct JOYPORT
{
JOYPORT(int _w)
: w(_w)
{}
int w;
int attrib;
ESI type;
void* ptr;
INPUTC* driver;
void log(MovieRecord* mr) { driver->Log(w,mr); }
void load(MovieRecord* mr) { driver->Load(w,mr); }
} joyports[2];
extern struct FCPORT
{
int attrib;
ESIFC type;
void* ptr;
INPUTCFC* driver;
} portFC;
void FCEU_DrawInput(uint8 *buf); void FCEU_DrawInput(uint8 *buf);
void FCEU_UpdateInput(void); void FCEU_UpdateInput(void);

View File

@ -82,7 +82,7 @@ static void OK_Update(void *data, int arg)
static void DrawOeka(uint8 *buf, int arg) static void DrawOeka(uint8 *buf, int arg)
{ {
if(arg && OKY<44) if(OKY<44)
FCEU_DrawCursor(buf, OKX, OKY); FCEU_DrawCursor(buf, OKX, OKY);
} }

View File

@ -117,7 +117,6 @@ static uint8 ReadZapper(int w, uint8 ret)
static void DrawZapper(uint8 *buf, int arg) static void DrawZapper(uint8 *buf, int arg)
{ {
if(arg)
FCEU_DrawCursor(buf, ZD.mzx, ZD.mzy); FCEU_DrawCursor(buf, ZD.mzx, ZD.mzy);
} }

View File

@ -23,8 +23,9 @@
#include "share.h" #include "share.h"
#include "zapper.h" #include "zapper.h"
#include "movie.h"
ZAPPER ZD[2]; static ZAPPER ZD[2];
static void ZapperFrapper(int w, uint8 *bg, uint8 *spr, uint32 linets, int final) static void ZapperFrapper(int w, uint8 *bg, uint8 *spr, uint32 linets, int final)
{ {
@ -125,8 +126,7 @@ static uint8 ReadZapper(int w)
static void DrawZapper(int w, uint8 *buf, int arg) static void DrawZapper(int w, uint8 *buf, int arg)
{ {
if(arg) FCEU_DrawGunSight(buf, ZD[w].mzx,ZD[w].mzy);
FCEU_DrawGunSight(buf, ZD[w].mzx,ZD[w].mzy);
} }
static void UpdateZapper(int w, void *data, int arg) static void UpdateZapper(int w, void *data, int arg)
@ -144,8 +144,28 @@ static void UpdateZapper(int w, void *data, int arg)
ZD[w].mzb=ptr[2]; ZD[w].mzb=ptr[2];
} }
static INPUTC ZAPC={ReadZapper,0,0,UpdateZapper,ZapperFrapper,DrawZapper}; static void LogZapper(int w, MovieRecord* mr)
static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperFrapper,DrawZapper}; {
mr->zappers[w].x = ZD[w].mzx;
mr->zappers[w].y = ZD[w].mzy;
mr->zappers[w].b = ZD[w].mzb;
}
static void LoadZapper(int w, MovieRecord* mr)
{
if(ZD[w].bogo)
ZD[w].bogo--;
if(mr->zappers[w].b&3 && (!(ZD[w].mzb&3)))
ZD[w].bogo=5;
ZD[w].mzx = mr->zappers[w].x;
ZD[w].mzy = mr->zappers[w].y;
ZD[w].mzb = mr->zappers[w].b;
}
static INPUTC ZAPC={ReadZapper,0,0,UpdateZapper,ZapperFrapper,DrawZapper,LogZapper,LoadZapper};
static INPUTC ZAPVSC={ReadZapperVS,0,StrobeZapperVS,UpdateZapper,ZapperFrapper,DrawZapper,LogZapper,LoadZapper};
INPUTC *FCEU_InitZapper(int w) INPUTC *FCEU_InitZapper(int w)
{ {

View File

@ -608,7 +608,7 @@ void FCEUI_SaveMovie(char *fname, uint8 flags)
//the main interaction point between the emulator and the movie system. //the main interaction point between the emulator and the movie system.
//either dumps the current joystick state or loads one state from the movie //either dumps the current joystick state or loads one state from the movie
void FCEUMOV_AddInputState(ZAPPER (&zappers)[2], uint8 (&js)[4], int SkipFlush) void FCEUMOV_AddInputState()
{ {
//todo - for tasedit, either dump or load depending on whether input recording is enabled //todo - for tasedit, either dump or load depending on whether input recording is enabled
//or something like that //or something like that
@ -624,16 +624,9 @@ void FCEUMOV_AddInputState(ZAPPER (&zappers)[2], uint8 (&js)[4], int SkipFlush)
} }
else else
{ {
MovieRecord& mr = currMovieData.records[currFrameCounter]; MovieRecord* mr = &currMovieData.records[currFrameCounter];
for(int i=0;i<4;i++) joyports[0].load(mr);
js[i] = mr.joysticks[i]; joyports[1].load(mr);
for(int i=0;i<2;i++)
{
zappers[i].mzx = mr.zappers[i].x;
zappers[i].mzy = mr.zappers[i].y;
zappers[i].mzb = mr.zappers[i].b;
}
} }
//if we are on the last frame, then pause the emulator if the player requested it //if we are on the last frame, then pause the emulator if the player requested it
@ -657,28 +650,20 @@ void FCEUMOV_AddInputState(ZAPPER (&zappers)[2], uint8 (&js)[4], int SkipFlush)
{ {
MovieRecord mr; MovieRecord mr;
//for each joystick joyports[0].log(&mr);
for(int i=0;i<4;i++) joyports[1].log(&mr);
mr.joysticks[i] = js[i];
//printf("%d %d %d\n",zappers[1].mzx,zappers[1].mzy,zappers[1].mzb);
for(int i=0;i<2;i++)
{
mr.zappers[i].x = zappers[i].mzx;
mr.zappers[i].y = zappers[i].mzy;
mr.zappers[i].b = zappers[i].mzb;
}
mr.dump(osRecordingMovie,currMovieData.records.size()); mr.dump(osRecordingMovie,currMovieData.records.size());
currMovieData.records.push_back(mr); currMovieData.records.push_back(mr);
} }
currFrameCounter++; currFrameCounter++;
memcpy(&cur_input_display,js,4); extern uint8 joy[4];
memcpy(&cur_input_display,joy,4);
} }
//TODO //TODO
void FCEUMOV_AddCommand(int cmd) void FCEUMOV_AddCommand(int cmd)
{ {

View File

@ -8,7 +8,7 @@
#include "input/zapper.h" #include "input/zapper.h"
void FCEUMOV_AddInputState(ZAPPER (&zappers)[2], uint8 (&js)[4], int SkipFlush); void FCEUMOV_AddInputState();
void FCEUMOV_AddCommand(int cmd); void FCEUMOV_AddCommand(int cmd);
void FCEU_DrawMovies(uint8 *); void FCEU_DrawMovies(uint8 *);

View File

@ -223,7 +223,9 @@ void FCEU_PutImage(void)
} }
DrawMessage(false); DrawMessage(false);
FCEU_DrawInput(XBuf);
if(FCEUD_ShouldDrawInputAids())
FCEU_DrawInput(XBuf);
//Fancy input display code //Fancy input display code
if(input_display) if(input_display)

View File

@ -334,7 +334,6 @@ void FCEU_VSUniCheck(uint64 md5partial, int *MapperNo, uint8 *Mirroring)
{ {
if(vs->ppu < RCP2C03B) pale = vs->ppu; if(vs->ppu < RCP2C03B) pale = vs->ppu;
//puts(vs->name);
*MapperNo = vs->mapper; *MapperNo = vs->mapper;
*Mirroring = vs->mirroring; *Mirroring = vs->mirroring;
GameInfo->type = GIT_VSUNI; GameInfo->type = GIT_VSUNI;