Added microphone button support to the Config>input dialog(replaces Port 2 Start button), the config file info, and the movie file header. Tested in 3 or 4 games, where it performed accurately.
I'll add the documentation later.
This commit is contained in:
parent
558c7930ae
commit
8c379b7bba
|
@ -77,6 +77,8 @@ void FCEUI_SetInputFC(ESIFC type, void *ptr, int attrib);
|
||||||
void FCEUI_SetInputFourscore(bool attachFourscore);
|
void FCEUI_SetInputFourscore(bool attachFourscore);
|
||||||
//tells whether a fourscore is attached
|
//tells whether a fourscore is attached
|
||||||
bool FCEUI_GetInputFourscore();
|
bool FCEUI_GetInputFourscore();
|
||||||
|
//tells whether the microphone is used
|
||||||
|
bool FCEUI_GetInputMicrophone();
|
||||||
|
|
||||||
void FCEUI_UseInputPreset(int preset);
|
void FCEUI_UseInputPreset(int preset);
|
||||||
|
|
||||||
|
@ -167,7 +169,7 @@ void FCEUD_LoadStateFrom(void);
|
||||||
|
|
||||||
//at the minimum, you should call FCEUI_SetInput, FCEUI_SetInputFC, and FCEUI_SetInputFourscore
|
//at the minimum, you should call FCEUI_SetInput, FCEUI_SetInputFC, and FCEUI_SetInputFourscore
|
||||||
//you may also need to maintain your own internal state
|
//you may also need to maintain your own internal state
|
||||||
void FCEUD_SetInput(bool fourscore, ESI port0, ESI port1, ESIFC fcexp);
|
void FCEUD_SetInput(bool fourscore, bool microphone, ESI port0, ESI port1, ESIFC fcexp);
|
||||||
|
|
||||||
|
|
||||||
void FCEUD_MovieRecordTo(void);
|
void FCEUD_MovieRecordTo(void);
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern bool rightClickEnabled;
|
||||||
extern int CurrentState;
|
extern int CurrentState;
|
||||||
extern bool pauseWhileActive; //adelikat: Cheats dialog
|
extern bool pauseWhileActive; //adelikat: Cheats dialog
|
||||||
extern bool AVIdisableMovieMessages;
|
extern bool AVIdisableMovieMessages;
|
||||||
extern bool replaceFDSStartWithMicrophone;
|
extern bool replaceP2StartWithMicrophone;
|
||||||
|
|
||||||
//window positions and sizes:
|
//window positions and sizes:
|
||||||
extern int ChtPosX,ChtPosY;
|
extern int ChtPosX,ChtPosY;
|
||||||
|
@ -308,7 +308,7 @@ static CFGSTRUCT fceuconfig[] = {
|
||||||
AC(compressSavestates),
|
AC(compressSavestates),
|
||||||
AC(pauseWhileActive),
|
AC(pauseWhileActive),
|
||||||
AC(AVIdisableMovieMessages),
|
AC(AVIdisableMovieMessages),
|
||||||
AC(replaceFDSStartWithMicrophone),
|
AC(replaceP2StartWithMicrophone),
|
||||||
|
|
||||||
ENDCFGSTRUCT
|
ENDCFGSTRUCT
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,7 @@ int tempwinsync = 0; //Temp variable used by turbo to turn of sync settings
|
||||||
int tempsoundquality = 0; //Temp variable used by turbo to turn of sound quality settings
|
int tempsoundquality = 0; //Temp variable used by turbo to turn of sound quality settings
|
||||||
extern int winsync;
|
extern int winsync;
|
||||||
extern int soundquality;
|
extern int soundquality;
|
||||||
|
extern bool replaceP2StartWithMicrophone;
|
||||||
//UsrInputType[] is user-specified. InputType[] is current
|
//UsrInputType[] is user-specified. InputType[] is current
|
||||||
// (game/savestate/movie loading can override user settings)
|
// (game/savestate/movie loading can override user settings)
|
||||||
|
|
||||||
|
@ -371,11 +372,13 @@ void FCEUD_UpdateInput()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCEUD_SetInput(bool fourscore, ESI port0, ESI port1, ESIFC fcexp)
|
void FCEUD_SetInput(bool fourscore, bool microphone, ESI port0, ESI port1, ESIFC fcexp)
|
||||||
{
|
{
|
||||||
eoptions &= ~EO_FOURSCORE;
|
eoptions &= ~EO_FOURSCORE;
|
||||||
if(fourscore) eoptions |= EO_FOURSCORE;
|
if(fourscore) eoptions |= EO_FOURSCORE;
|
||||||
|
|
||||||
|
replaceP2StartWithMicrophone = microphone;
|
||||||
|
|
||||||
InputType[0]=port0;
|
InputType[0]=port0;
|
||||||
InputType[1]=port1;
|
InputType[1]=port1;
|
||||||
InputType[2]=fcexp;
|
InputType[2]=fcexp;
|
||||||
|
@ -1086,6 +1089,9 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
//update the fourscore checkbox
|
//update the fourscore checkbox
|
||||||
CheckDlgButton(hwndDlg,CHECK_ENABLE_FOURSCORE,(eoptions & EO_FOURSCORE)?BST_CHECKED:BST_UNCHECKED);
|
CheckDlgButton(hwndDlg,CHECK_ENABLE_FOURSCORE,(eoptions & EO_FOURSCORE)?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
|
||||||
|
//update the microphone checkbox
|
||||||
|
CheckDlgButton(hwndDlg,CHECK_ENABLE_MICROPHONE,replaceP2StartWithMicrophone?BST_CHECKED:BST_UNCHECKED);
|
||||||
|
|
||||||
// Initialize the controls for the input ports
|
// Initialize the controls for the input ports
|
||||||
for(unsigned int port = 0; port < NUMBER_OF_PORTS; port++)
|
for(unsigned int port = 0; port < NUMBER_OF_PORTS; port++)
|
||||||
{
|
{
|
||||||
|
@ -1219,10 +1225,18 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == CHECK_ENABLE_FOURSCORE)
|
if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == CHECK_ENABLE_FOURSCORE)
|
||||||
{
|
{
|
||||||
eoptions ^= EO_FOURSCORE;
|
eoptions ^= EO_FOURSCORE;
|
||||||
FCEU_printf("Fourscore toggled to \n",(eoptions & EO_FOURSCORE)?"ON":"OFF");
|
FCEU_printf("Fourscore toggled to %s\n",(eoptions & EO_FOURSCORE)?"ON":"OFF");
|
||||||
UpdateFourscoreState(hwndDlg);
|
UpdateFourscoreState(hwndDlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Handle the fourscore button
|
||||||
|
if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == CHECK_ENABLE_MICROPHONE)
|
||||||
|
{
|
||||||
|
replaceP2StartWithMicrophone = !replaceP2StartWithMicrophone;
|
||||||
|
FCEU_printf("Microphone toggled to %s\n",replaceP2StartWithMicrophone?"ON":"OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(HIWORD(wParam) == CBN_SELENDOK)
|
if(HIWORD(wParam) == CBN_SELENDOK)
|
||||||
{
|
{
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
|
|
|
@ -664,6 +664,8 @@ BEGIN
|
||||||
CTEXT "3",IDC_STATIC,18,128,8,8
|
CTEXT "3",IDC_STATIC,18,128,8,8
|
||||||
CONTROL "Attach four-score (implies four gamepads)",CHECK_ENABLE_FOURSCORE,
|
CONTROL "Attach four-score (implies four gamepads)",CHECK_ENABLE_FOURSCORE,
|
||||||
"Button",BS_AUTOCHECKBOX,18,18,142,12
|
"Button",BS_AUTOCHECKBOX,18,18,142,12
|
||||||
|
CONTROL "Replace Port 2 Start With Microphone",CHECK_ENABLE_MICROPHONE,
|
||||||
|
"Button",BS_AUTOCHECKBOX,174,18,142,12
|
||||||
END
|
END
|
||||||
|
|
||||||
MAHJONGDIALOG DIALOG 65510, 106, 340, 110
|
MAHJONGDIALOG DIALOG 65510, 106, 340, 110
|
||||||
|
|
|
@ -264,6 +264,7 @@
|
||||||
#define IDC_CHEAT_CHECK_NE_BY 401
|
#define IDC_CHEAT_CHECK_NE_BY 401
|
||||||
#define IDC_WINSIZE_MUL_Y 401
|
#define IDC_WINSIZE_MUL_Y 401
|
||||||
#define CHECK_ENABLE_FOURSCORE 401
|
#define CHECK_ENABLE_FOURSCORE 401
|
||||||
|
#define CHECK_ENABLE_MICROPHONE 407
|
||||||
#define IDC_CHEAT_CHECK_GT_BY 402
|
#define IDC_CHEAT_CHECK_GT_BY 402
|
||||||
#define IDC_FORCE_INT_VIDEO_SCALARS 402
|
#define IDC_FORCE_INT_VIDEO_SCALARS 402
|
||||||
#define IDC_CHEAT_CHECK_LT_BY 403
|
#define IDC_CHEAT_CHECK_LT_BY 403
|
||||||
|
|
|
@ -85,7 +85,7 @@ static uint8 joy_readbit[2];
|
||||||
uint8 joy[4]={0,0,0,0}; //HACK - should be static but movie needs it
|
uint8 joy[4]={0,0,0,0}; //HACK - should be static but movie needs it
|
||||||
static uint8 LastStrobe;
|
static uint8 LastStrobe;
|
||||||
|
|
||||||
bool replaceFDSStartWithMicrophone = true;
|
bool replaceP2StartWithMicrophone = false;
|
||||||
|
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
static uint32 BotPointer = 0; //mbg merge 7/18/06 changed to uint32
|
static uint32 BotPointer = 0; //mbg merge 7/18/06 changed to uint32
|
||||||
|
@ -109,40 +109,39 @@ static DECLFR(JPRead)
|
||||||
{
|
{
|
||||||
lagFlag = 0;
|
lagFlag = 0;
|
||||||
uint8 ret=0;
|
uint8 ret=0;
|
||||||
bool port=false;
|
|
||||||
static bool microphone = false;
|
static bool microphone = false;
|
||||||
|
|
||||||
// Test if the controller 2 start button is being pressed.
|
|
||||||
// On a famicom, c.2 start shouldn't exist, so it replaces it.
|
|
||||||
|
|
||||||
if (replaceFDSStartWithMicrophone) {
|
|
||||||
if ((joy[1]&8) == 8) {
|
|
||||||
// Test if this is a Famicom game.
|
|
||||||
if (GameInfo->type==GIT_FDS) {
|
|
||||||
port=((A&1)==0);
|
|
||||||
joy[1]&=0xF7;
|
|
||||||
} else {
|
|
||||||
microphone = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret|=joyports[A&1].driver->Read(A&1);
|
ret|=joyports[A&1].driver->Read(A&1);
|
||||||
|
|
||||||
|
// Test if the port 2 start button is being pressed.
|
||||||
|
// On a famicom, port 2 start shouldn't exist, so this removes it.
|
||||||
|
// Games can't automatically be checked for NES/Famicom status,
|
||||||
|
// so it's an all-encompassing change in the input config menu.
|
||||||
|
if ((replaceP2StartWithMicrophone) && (A&1) && (joy_readbit[1] == 4)) {
|
||||||
|
// Nullify Port 2 Start Button
|
||||||
|
ret&=0xFE;
|
||||||
|
}
|
||||||
|
|
||||||
if(portFC.driver)
|
if(portFC.driver)
|
||||||
ret = portFC.driver->Read(A&1,ret);
|
ret = portFC.driver->Read(A&1,ret);
|
||||||
|
|
||||||
// Not verified against hardware.
|
// Not verified against hardware.
|
||||||
|
if (replaceP2StartWithMicrophone) {
|
||||||
// This line is iffy, may cause trouble. Needs more testing.
|
// This line is iffy, may cause trouble. Needs more testing.
|
||||||
if (joy_readbit[1] >= 8) {
|
if (joy_readbit[1] >= 8) {
|
||||||
if (port) {
|
if (joy[1]&8) {
|
||||||
microphone = !microphone;
|
microphone = !microphone;
|
||||||
if (microphone) {
|
if (microphone) {
|
||||||
ret|=4;
|
ret|=4;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
microphone = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret|=X.DB&0xC0;
|
ret|=X.DB&0xC0;
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,6 +499,10 @@ bool FCEUI_GetInputFourscore()
|
||||||
{
|
{
|
||||||
return FSAttached;
|
return FSAttached;
|
||||||
}
|
}
|
||||||
|
bool FCEUI_GetInputMicrophone()
|
||||||
|
{
|
||||||
|
return replaceP2StartWithMicrophone;
|
||||||
|
}
|
||||||
void FCEUI_SetInputFourscore(bool attachFourscore)
|
void FCEUI_SetInputFourscore(bool attachFourscore)
|
||||||
{
|
{
|
||||||
FSAttached = attachFourscore;
|
FSAttached = attachFourscore;
|
||||||
|
|
|
@ -97,6 +97,7 @@ SFORMAT FCEUMOV_STATEINFO[]={
|
||||||
|
|
||||||
char curMovieFilename[512] = {0};
|
char curMovieFilename[512] = {0};
|
||||||
MovieData currMovieData;
|
MovieData currMovieData;
|
||||||
|
MovieData defaultMovieData;
|
||||||
int currRerecordCount;
|
int currRerecordCount;
|
||||||
|
|
||||||
void MovieData::clearRecordRange(int start, int len)
|
void MovieData::clearRecordRange(int start, int len)
|
||||||
|
@ -347,6 +348,7 @@ MovieData::MovieData()
|
||||||
, rerecordCount(0)
|
, rerecordCount(0)
|
||||||
, binaryFlag(false)
|
, binaryFlag(false)
|
||||||
, greenZoneCount(0)
|
, greenZoneCount(0)
|
||||||
|
, microphone(false)
|
||||||
{
|
{
|
||||||
memset(&romChecksum,0,sizeof(MD5DATA));
|
memset(&romChecksum,0,sizeof(MD5DATA));
|
||||||
}
|
}
|
||||||
|
@ -377,6 +379,8 @@ void MovieData::installValue(std::string& key, std::string& val)
|
||||||
guid = FCEU_Guid::fromString(val);
|
guid = FCEU_Guid::fromString(val);
|
||||||
else if(key == "fourscore")
|
else if(key == "fourscore")
|
||||||
installBool(val,fourscore);
|
installBool(val,fourscore);
|
||||||
|
else if(key == "microphone")
|
||||||
|
installBool(val,microphone);
|
||||||
else if(key == "port0")
|
else if(key == "port0")
|
||||||
installInt(val,ports[0]);
|
installInt(val,ports[0]);
|
||||||
else if(key == "port1")
|
else if(key == "port1")
|
||||||
|
@ -416,6 +420,7 @@ int MovieData::dump(std::ostream *os, bool binary)
|
||||||
*os << "romChecksum " << BytesToString(romChecksum.data,MD5DATA::size) << endl;
|
*os << "romChecksum " << BytesToString(romChecksum.data,MD5DATA::size) << endl;
|
||||||
*os << "guid " << guid.toString() << endl;
|
*os << "guid " << guid.toString() << endl;
|
||||||
*os << "fourscore " << (fourscore?1:0) << endl;
|
*os << "fourscore " << (fourscore?1:0) << endl;
|
||||||
|
*os << "microphone " << (microphone?1:0) << endl;
|
||||||
*os << "port0 " << ports[0] << endl;
|
*os << "port0 " << ports[0] << endl;
|
||||||
*os << "port1 " << ports[1] << endl;
|
*os << "port1 " << ports[1] << endl;
|
||||||
*os << "port2 " << ports[2] << endl;
|
*os << "port2 " << ports[2] << endl;
|
||||||
|
@ -783,7 +788,7 @@ void FCEUMOV_EnterTasEdit()
|
||||||
//todo - think about this
|
//todo - think about this
|
||||||
//ResetInputTypes();
|
//ResetInputTypes();
|
||||||
//todo - maybe this instead
|
//todo - maybe this instead
|
||||||
//FCEUD_SetInput(currMovieData.fourscore,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
//FCEUD_SetInput(currMovieData.fourscore,currMovieData.microphone,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
||||||
|
|
||||||
//pause the emulator
|
//pause the emulator
|
||||||
FCEUI_SetEmulationPaused(1);
|
FCEUI_SetEmulationPaused(1);
|
||||||
|
@ -877,7 +882,7 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
|
||||||
FCEUI_SetVidSystem(0);
|
FCEUI_SetVidSystem(0);
|
||||||
|
|
||||||
//force the input configuration stored in the movie to apply
|
//force the input configuration stored in the movie to apply
|
||||||
FCEUD_SetInput(currMovieData.fourscore,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
FCEUD_SetInput(currMovieData.fourscore,currMovieData.microphone,(ESI)currMovieData.ports[0],(ESI)currMovieData.ports[1],(ESIFC)currMovieData.ports[2]);
|
||||||
|
|
||||||
//stuff that should only happen when we're ready to positively commit to the replay
|
//stuff that should only happen when we're ready to positively commit to the replay
|
||||||
if(tasedit)
|
if(tasedit)
|
||||||
|
@ -945,6 +950,7 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
|
||||||
currMovieData.romChecksum = GameInfo->MD5;
|
currMovieData.romChecksum = GameInfo->MD5;
|
||||||
currMovieData.romFilename = FileBase;
|
currMovieData.romFilename = FileBase;
|
||||||
currMovieData.fourscore = FCEUI_GetInputFourscore();
|
currMovieData.fourscore = FCEUI_GetInputFourscore();
|
||||||
|
currMovieData.microphone = FCEUI_GetInputMicrophone();
|
||||||
currMovieData.ports[0] = joyports[0].type;
|
currMovieData.ports[0] = joyports[0].type;
|
||||||
currMovieData.ports[1] = joyports[1].type;
|
currMovieData.ports[1] = joyports[1].type;
|
||||||
currMovieData.ports[2] = portFC.type;
|
currMovieData.ports[2] = portFC.type;
|
||||||
|
|
|
@ -158,7 +158,7 @@ class MovieData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MovieData();
|
MovieData();
|
||||||
|
// Default Values: MovieData::MovieData()
|
||||||
|
|
||||||
int version;
|
int version;
|
||||||
int emuVersion;
|
int emuVersion;
|
||||||
|
@ -182,6 +182,8 @@ public:
|
||||||
int ports[3];
|
int ports[3];
|
||||||
//whether fourscore is enabled
|
//whether fourscore is enabled
|
||||||
bool fourscore;
|
bool fourscore;
|
||||||
|
//whether microphone is enabled
|
||||||
|
bool microphone;
|
||||||
|
|
||||||
//----TasEdit stuff---
|
//----TasEdit stuff---
|
||||||
int greenZoneCount;
|
int greenZoneCount;
|
||||||
|
|
Loading…
Reference in New Issue