* movie recording: fixed bug when emulator allowed recording commands outside the range of FM2 specs (#615)
* movie recording: added "Insert coin" command * updated docs accordingly [[Split portion of a mixed commit.]]
This commit is contained in:
parent
a136a7813c
commit
c4eeddcf0c
Binary file not shown.
|
@ -143,20 +143,26 @@ static void FDSInit(void) {
|
|||
SelectDisk = 0;
|
||||
}
|
||||
|
||||
void FCEU_FDSInsert(void) {
|
||||
if (FCEUI_EmulationPaused()) EmulationPaused |= 2;
|
||||
void FCEU_FDSInsert(void)
|
||||
{
|
||||
if (TotalSides == 0)
|
||||
{
|
||||
FCEU_DispMessage("Not FDS; can't eject disk.", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FCEUI_EmulationPaused())
|
||||
EmulationPaused |= EMULATIONPAUSED_FA;
|
||||
|
||||
if (FCEUMOV_Mode(MOVIEMODE_RECORD))
|
||||
FCEUMOV_AddCommand(FCEUNPCMD_FDSINSERT);
|
||||
|
||||
if (TotalSides == 0) {
|
||||
FCEU_DispMessage("Not FDS; can't eject disk.", 0);
|
||||
return;
|
||||
}
|
||||
if (InDisk == 255) {
|
||||
if (InDisk == 255)
|
||||
{
|
||||
FCEU_DispMessage("Disk %d Side %s Inserted", 0, SelectDisk >> 1, (SelectDisk & 1) ? "B" : "A");
|
||||
InDisk = SelectDisk;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
FCEU_DispMessage("Disk %d Side %s Ejected", 0, SelectDisk >> 1, (SelectDisk & 1) ? "B" : "A");
|
||||
InDisk = 255;
|
||||
}
|
||||
|
@ -167,20 +173,25 @@ void FCEU_FDSEject(void)
|
|||
InDisk=255;
|
||||
}
|
||||
*/
|
||||
void FCEU_FDSSelect(void) {
|
||||
if (FCEUI_EmulationPaused()) EmulationPaused |= 2;
|
||||
void FCEU_FDSSelect(void)
|
||||
{
|
||||
if (TotalSides == 0)
|
||||
{
|
||||
FCEU_DispMessage("Not FDS; can't select disk.", 0);
|
||||
return;
|
||||
}
|
||||
if (InDisk != 255)
|
||||
{
|
||||
FCEU_DispMessage("Eject disk before selecting.", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FCEUI_EmulationPaused())
|
||||
EmulationPaused |= EMULATIONPAUSED_FA;
|
||||
|
||||
if (FCEUMOV_Mode(MOVIEMODE_RECORD))
|
||||
FCEUMOV_AddCommand(FCEUNPCMD_FDSSELECT);
|
||||
|
||||
if (TotalSides == 0) {
|
||||
FCEU_DispMessage("Not FDS; can't select disk.", 0);
|
||||
return;
|
||||
}
|
||||
if (InDisk != 255) {
|
||||
FCEU_DispMessage("Eject disk before selecting.", 0);
|
||||
return;
|
||||
}
|
||||
SelectDisk = ((SelectDisk + 1) % TotalSides) & 3;
|
||||
FCEU_DispMessage("Disk %d Side %c Selected", 0, SelectDisk >> 1, (SelectDisk & 1) ? 'B' : 'A');
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "video.h"
|
||||
#include "movie.h"
|
||||
#include "fds.h"
|
||||
#include "vsuni.h"
|
||||
#ifdef _S9XLUA_H
|
||||
#include "fceulua.h"
|
||||
#endif
|
||||
|
@ -345,10 +346,10 @@ void MovieRecord::dumpBinary(MovieData* md, EMUFILE* os, int index)
|
|||
|
||||
void MovieRecord::dump(MovieData* md, EMUFILE* os, int index)
|
||||
{
|
||||
//dump the misc commands
|
||||
// dump the commands
|
||||
//*os << '|' << setw(1) << (int)commands;
|
||||
os->fputc('|');
|
||||
putdec<uint8,1,true>(os,commands);
|
||||
putdec<uint8,3,false>(os, commands); // "variable length decimal integer"
|
||||
|
||||
//a special case: if fourscore is enabled, dump four gamepads
|
||||
if(md->fourscore)
|
||||
|
@ -1003,14 +1004,16 @@ void FCEUMOV_AddInputState()
|
|||
joyports[0].load(mr);
|
||||
joyports[1].load(mr);
|
||||
// replay commands
|
||||
if(mr->command_power())
|
||||
if (mr->command_power())
|
||||
PowerNES();
|
||||
if(mr->command_reset())
|
||||
if (mr->command_reset())
|
||||
ResetNES();
|
||||
if(mr->command_fds_insert())
|
||||
if (mr->command_fds_insert())
|
||||
FCEU_FDSInsert();
|
||||
if(mr->command_fds_select())
|
||||
if (mr->command_fds_select())
|
||||
FCEU_FDSSelect();
|
||||
if (mr->command_vs_insertcoin())
|
||||
FCEU_VSUniCoin();
|
||||
_currCommand = 0;
|
||||
} else
|
||||
#endif
|
||||
|
@ -1038,6 +1041,8 @@ void FCEUMOV_AddInputState()
|
|||
FCEU_FDSInsert();
|
||||
if(mr->command_fds_select())
|
||||
FCEU_FDSSelect();
|
||||
if (mr->command_vs_insertcoin())
|
||||
FCEU_VSUniCoin();
|
||||
|
||||
joyports[0].load(mr);
|
||||
joyports[1].load(mr);
|
||||
|
@ -1093,12 +1098,16 @@ void FCEUMOV_AddCommand(int cmd)
|
|||
if(movieMode != MOVIEMODE_RECORD && movieMode != MOVIEMODE_TASEDITOR)
|
||||
return;
|
||||
|
||||
//NOTE: EMOVIECMD matches FCEUNPCMD_RESET and FCEUNPCMD_POWER
|
||||
//we are lucky (well, I planned it that way)
|
||||
|
||||
switch(cmd) {
|
||||
// translate "FCEU NetPlay" command to "FCEU Movie" command
|
||||
switch (cmd)
|
||||
{
|
||||
case FCEUNPCMD_RESET: cmd = MOVIECMD_RESET; break;
|
||||
case FCEUNPCMD_POWER: cmd = MOVIECMD_POWER; break;
|
||||
case FCEUNPCMD_FDSINSERT: cmd = MOVIECMD_FDS_INSERT; break;
|
||||
case FCEUNPCMD_FDSSELECT: cmd = MOVIECMD_FDS_SELECT; break;
|
||||
case FCEUNPCMD_VSUNICOIN: cmd = MOVIECMD_VS_INSERTCOIN; break;
|
||||
// all other netplay commands (e.g. FCEUNPCMD_VSUNIDIP0) are not supported by movie recorder for now
|
||||
default: return;
|
||||
}
|
||||
|
||||
_currCommand |= cmd;
|
||||
|
|
|
@ -67,7 +67,8 @@ enum EMOVIECMD
|
|||
MOVIECMD_RESET = 1,
|
||||
MOVIECMD_POWER = 2,
|
||||
MOVIECMD_FDS_INSERT = 4,
|
||||
MOVIECMD_FDS_SELECT = 8
|
||||
MOVIECMD_FDS_SELECT = 8,
|
||||
MOVIECMD_VS_INSERTCOIN = 16
|
||||
};
|
||||
|
||||
EMOVIEMODE FCEUMOV_Mode();
|
||||
|
@ -112,10 +113,11 @@ public:
|
|||
//small now to save space; we might need to support more commands later.
|
||||
//the disk format will support up to 64bit if necessary
|
||||
uint8 commands;
|
||||
bool command_reset() { return (commands&MOVIECMD_RESET)!=0; }
|
||||
bool command_power() { return (commands&MOVIECMD_POWER)!=0; }
|
||||
bool command_fds_insert() { return (commands&MOVIECMD_FDS_INSERT)!=0; }
|
||||
bool command_fds_select() { return (commands&MOVIECMD_FDS_SELECT)!=0; }
|
||||
bool command_reset() { return (commands & MOVIECMD_RESET) != 0; }
|
||||
bool command_power() { return (commands & MOVIECMD_POWER) != 0; }
|
||||
bool command_fds_insert() { return (commands & MOVIECMD_FDS_INSERT) != 0; }
|
||||
bool command_fds_select() { return (commands & MOVIECMD_FDS_SELECT) != 0; }
|
||||
bool command_vs_insertcoin() { return (commands & MOVIECMD_VS_INSERTCOIN) != 0; }
|
||||
|
||||
void toggleBit(int joy, int bit)
|
||||
{
|
||||
|
|
|
@ -100,22 +100,22 @@ inline uint64 uint64DecFromIstream(EMUFILE* is) { return templateIntegerDecFromI
|
|||
template<typename T, int DIGITS, bool PAD> void putdec(EMUFILE* os, T dec)
|
||||
{
|
||||
char temp[DIGITS];
|
||||
int ctr = 0;
|
||||
for(int i=0;i<DIGITS;i++)
|
||||
int ctr = 0; // at least one char will always be outputted
|
||||
for (int i = 0; i < DIGITS; ++i)
|
||||
{
|
||||
int quot = dec/10;
|
||||
int rem = dec%10;
|
||||
temp[DIGITS-1-i] = '0' + rem;
|
||||
if(!PAD)
|
||||
int remainder = dec % 10;
|
||||
temp[(DIGITS - 1) - i] = '0' + remainder;
|
||||
if (!PAD)
|
||||
{
|
||||
if(rem != 0) ctr = i;
|
||||
if (remainder != 0)
|
||||
ctr = i;
|
||||
}
|
||||
dec = quot;
|
||||
dec /= 10;
|
||||
}
|
||||
if(!PAD)
|
||||
os->fwrite(temp+DIGITS-ctr-1,ctr+1);
|
||||
if (!PAD)
|
||||
os->fwrite(temp + (DIGITS - 1) - ctr, ctr + 1);
|
||||
else
|
||||
os->fwrite(temp,DIGITS);
|
||||
os->fwrite(temp, DIGITS);
|
||||
}
|
||||
|
||||
std::string mass_replace(const std::string &source, const std::string &victim, const std::string &replacement);
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue