2006-07-29 05:46:15 +00:00
|
|
|
#ifndef _INPUT_H_
|
|
|
|
#define _INPUT_H_
|
|
|
|
|
2008-06-08 10:22:33 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
#include "git.h"
|
|
|
|
|
|
|
|
class MovieRecord;
|
|
|
|
|
|
|
|
//MBG TODO - COMBINE THESE INPUTC AND INPUTCFC
|
|
|
|
|
2008-06-07 08:18:04 +00:00
|
|
|
//The interface for standard joystick port device drivers
|
2008-06-08 10:22:33 +00:00
|
|
|
struct INPUTC
|
2008-06-07 08:18:04 +00:00
|
|
|
{
|
|
|
|
//these methods call the function pointers (or not, if they are null)
|
|
|
|
uint8 Read(int w) { if(_Read) return _Read(w); else return 0; }
|
|
|
|
void Write(uint8 w) { if(_Write) _Write(w); }
|
|
|
|
void Strobe(int w) { if(_Strobe) _Strobe(w); }
|
|
|
|
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 Draw(int w, uint8 *buf, int arg) { if(_Draw) _Draw(w,buf,arg); }
|
2008-06-08 10:22:33 +00:00
|
|
|
void Log(int w, MovieRecord* mr) { if(_Log) _Log(w,mr); }
|
|
|
|
void Load(int w, MovieRecord* mr) { if(_Load) _Load(w,mr); }
|
2008-06-07 08:18:04 +00:00
|
|
|
|
|
|
|
uint8 (*_Read)(int w);
|
|
|
|
void (*_Write)(uint8 v);
|
|
|
|
void (*_Strobe)(int w);
|
2008-06-08 10:22:33 +00:00
|
|
|
//update will be called if input is coming from the user. refresh your logical state from user input devices
|
2008-06-07 08:18:04 +00:00
|
|
|
void (*_Update)(int w, void *data, int arg);
|
|
|
|
void (*_SLHook)(int w, uint8 *bg, uint8 *spr, uint32 linets, int final);
|
|
|
|
void (*_Draw)(int w, uint8 *buf, int arg);
|
2008-06-08 10:22:33 +00:00
|
|
|
|
|
|
|
//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);
|
|
|
|
};
|
2006-07-29 05:46:15 +00:00
|
|
|
|
2008-06-07 08:18:04 +00:00
|
|
|
//The interface for the expansion port device drivers
|
2008-06-08 10:22:33 +00:00
|
|
|
struct INPUTCFC
|
2008-06-07 08:18:04 +00:00
|
|
|
{
|
|
|
|
//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; }
|
|
|
|
void Write(uint8 v) { if(_Write) _Write(v); }
|
|
|
|
void Strobe() { if(_Strobe) _Strobe(); }
|
|
|
|
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 Draw(uint8 *buf, int arg) { if(_Draw) _Draw(buf,arg); }
|
2008-06-08 10:22:33 +00:00
|
|
|
void Log(MovieRecord* mr) { if(_Log) _Log(mr); }
|
|
|
|
void Load(MovieRecord* mr) { if(_Load) _Load(mr); }
|
2008-06-07 08:18:04 +00:00
|
|
|
|
|
|
|
uint8 (*_Read)(int w, uint8 ret);
|
|
|
|
void (*_Write)(uint8 v);
|
|
|
|
void (*_Strobe)();
|
2008-06-08 10:22:33 +00:00
|
|
|
//update will be called if input is coming from the user. refresh your logical state from user input devices
|
2008-06-07 08:18:04 +00:00
|
|
|
void (*_Update)(void *data, int arg);
|
|
|
|
void (*_SLHook)(uint8 *bg, uint8 *spr, uint32 linets, int final);
|
|
|
|
void (*_Draw)(uint8 *buf, int arg);
|
2008-06-08 10:22:33 +00:00
|
|
|
|
|
|
|
//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;
|
|
|
|
|
2006-07-29 05:46:15 +00:00
|
|
|
|
|
|
|
void FCEU_DrawInput(uint8 *buf);
|
|
|
|
void FCEU_UpdateInput(void);
|
|
|
|
int FCEU_BotMode(void);
|
|
|
|
void FCEU_SetBotMode(int x);
|
|
|
|
void InitializeInput(void);
|
|
|
|
void FCEU_UpdateBot(void);
|
|
|
|
extern void (*PStrobe[2])(void);
|
2008-06-07 08:18:04 +00:00
|
|
|
|
|
|
|
//called from PPU on scanline events.
|
|
|
|
extern void InputScanlineHook(uint8 *bg, uint8 *spr, uint32 linets, int final);
|
2006-07-29 05:46:15 +00:00
|
|
|
|
|
|
|
void FCEU_DoSimpleCommand(int cmd);
|
|
|
|
|
|
|
|
enum EMUCMD
|
|
|
|
{
|
|
|
|
EMUCMD_POWER=0,
|
|
|
|
EMUCMD_RESET,
|
|
|
|
EMUCMD_PAUSE,
|
|
|
|
EMUCMD_FRAME_ADVANCE,
|
|
|
|
EMUCMD_SCREENSHOT,
|
|
|
|
EMUCMD_HIDE_MENU_TOGGLE,
|
|
|
|
|
|
|
|
EMUCMD_SPEED_SLOWEST,
|
|
|
|
EMUCMD_SPEED_SLOWER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
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_4,
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_5,
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_6,
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_7,
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_8,
|
|
|
|
EMUCMD_VSUNI_TOGGLE_DIP_9,
|
|
|
|
EMUCMD_MISC_REWIND,
|
|
|
|
EMUCMD_MISC_SHOWSTATES,
|
2008-05-21 15:35:37 +00:00
|
|
|
EMUCMD_MISC_USE_INPUT_PRESET_1,
|
|
|
|
EMUCMD_MISC_USE_INPUT_PRESET_2,
|
|
|
|
EMUCMD_MISC_USE_INPUT_PRESET_3,
|
2006-07-29 05:46:15 +00:00
|
|
|
|
|
|
|
EMUCMD_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EMUCMDTYPE
|
|
|
|
{
|
|
|
|
EMUCMDTYPE_MISC=0,
|
|
|
|
EMUCMDTYPE_SPEED,
|
|
|
|
EMUCMDTYPE_STATE,
|
|
|
|
EMUCMDTYPE_MOVIE,
|
|
|
|
EMUCMDTYPE_SOUND,
|
|
|
|
EMUCMDTYPE_AVI,
|
|
|
|
EMUCMDTYPE_FDS,
|
|
|
|
EMUCMDTYPE_VSUNI,
|
|
|
|
|
|
|
|
EMUCMDTYPE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const char* FCEUI_CommandTypeNames[];
|
|
|
|
|
|
|
|
typedef void EMUCMDFN(void);
|
|
|
|
|
|
|
|
struct EMUCMDTABLE
|
|
|
|
{
|
|
|
|
int cmd;
|
|
|
|
int type;
|
|
|
|
EMUCMDFN* fn_on;
|
|
|
|
EMUCMDFN* fn_off;
|
|
|
|
int state;
|
|
|
|
char* name;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct EMUCMDTABLE FCEUI_CommandTable[];
|
|
|
|
|
|
|
|
#endif //_INPUT_H_
|
|
|
|
|