sync to r2522

This commit is contained in:
dborth 2012-06-26 23:14:39 +00:00
parent d01ecbf601
commit 47badafe67
23 changed files with 337 additions and 190 deletions

View File

@ -15,8 +15,8 @@ int Assemble(unsigned char *output, int addr, char *str) {
//unsigned char opcode[3] = { 0,0,0 };
output[0] = output[1] = output[2] = 0;
char astr[128],ins[4];
if ((!strlen(str)) || (strlen(str) > 0x127)) return 1;
int len = strlen(str);
if ((!len) || (len > 0x127)) return 1;
strcpy(astr,str);
str_ucase(astr);
@ -211,7 +211,7 @@ int Assemble(unsigned char *output, int addr, char *str) {
output[2] = (tmpint >> 8);
}
else { //Zero Page
if ((output[0] != 0x86) || (output[0] != 0xA2)) return 1; //only STX and LDX Absolute,Y!
if ((output[0] != 0x86) && (output[0] != 0xA2)) return 1; //only STX and LDX Absolute,Y!
output[0] |= 0x10;
output[1] = (tmpint & 0xFF);
}

View File

@ -145,6 +145,9 @@ void Mapper164_Init(CartInfo *info)
info->Power=Power;
GameStateRestore=StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
AddExState(WRAM, 8192, 0, "WRAM");
info->SaveGame[0]=WRAM;
info->SaveGameLen[0]=8192;
}
void Mapper163_Init(CartInfo *info)

View File

@ -2,6 +2,7 @@
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
* Copyright (C) 2012 FCEUX team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,44 +21,107 @@
#include "mapinc.h"
static uint8 prg, chr;
extern uint32 ROM_size;
static uint8 prg[4], chr, sbw, we_sram;
static uint8 *WRAM=NULL;
static uint32 WRAMSIZE;
static SFORMAT StateRegs[]=
{
{&prg, 1, "PRG"},
{prg, 4, "PRG"},
{&chr, 1, "CHR"},
{&sbw, 1, "SBW"},
{0}
};
static void Sync(void)
{
setprg8r(0x10,0x6000,0);
setprg32(0x8000,prg>>1);
setprg8(0x8000,prg[0]);
setprg8(0xA000,prg[1]);
setprg8(0xC000,prg[2]);
setprg8(0xE000,prg[3]);
setchr8(chr);
}
static DECLFW(M176Write1)
static DECLFW(M176Write_5001)
{
prg = V;
if(sbw)
{
prg[0] = V*4;
prg[1] = V*4+1;
prg[2] = V*4+2;
prg[3] = V*4+3;
}
Sync();
}
static DECLFW(M176Write2)
static DECLFW(M176Write_5010)
{
if(V == 0x24) sbw = 1;
Sync();
}
static DECLFW(M176Write_5011)
{
V >>= 1;
if(sbw)
{
prg[0] = V*4;
prg[1] = V*4+1;
prg[2] = V*4+2;
prg[3] = V*4+3;
}
Sync();
}
static DECLFW(M176Write_5FF1)
{
V >>= 1;
prg[0] = V*4;
prg[1] = V*4+1;
prg[2] = V*4+2;
prg[3] = V*4+3;
Sync();
}
static DECLFW(M176Write_5FF2)
{
chr = V;
Sync();
}
static DECLFW(M176Write_A001)
{
we_sram = V & 0x03;
}
static DECLFW(M176Write_WriteSRAM)
{
// if(we_sram)
CartBW(A,V);
}
static void M176Power(void)
{
prg = ~0;
SetReadHandler(0x6000,0x7fff,CartBR);
SetWriteHandler(0x6000,0x7fff,CartBW);
SetWriteHandler(0x6000,0x7fff,M176Write_WriteSRAM);
SetReadHandler(0x8000,0xFFFF,CartBR);
SetWriteHandler(0x5ff1,0x5ff1,M176Write1);
SetWriteHandler(0x5ff2,0x5ff2,M176Write2);
SetWriteHandler(0xA001,0xA001,M176Write_A001);
SetWriteHandler(0x5001,0x5001,M176Write_5001);
SetWriteHandler(0x5010,0x5010,M176Write_5010);
SetWriteHandler(0x5011,0x5011,M176Write_5011);
SetWriteHandler(0x5ff1,0x5ff1,M176Write_5FF1);
SetWriteHandler(0x5ff2,0x5ff2,M176Write_5FF2);
we_sram = 0;
sbw = 0;
prg[0] = 0;
prg[1] = 1;
prg[2] = (ROM_size-2)&63;
prg[3] = (ROM_size-1)&63;
Sync();
}

View File

@ -40,6 +40,12 @@ static void BMCFK23CCW(uint32 A, uint8 V)
}
}
//some games are wired differently, and this will need to be changed.
//for instance, WAIXING176 needs prg_bonus=1, and cah4e3's 4-in-1's need prg_bonus=0
static int prg_bonus = 0;
static int prg_mask = 0x7F>>(prg_bonus);
//PRG wrapper
static void BMCFK23CPW(uint32 A, uint8 V)
{
if((EXPREGS[0]&7)==4)
@ -52,9 +58,17 @@ static void BMCFK23CPW(uint32 A, uint8 V)
else
{
if(EXPREGS[0]&3)
setprg8(A,(V&(0x3F>>(EXPREGS[0]&3)))|(EXPREGS[1]<<1));
else
{
uint32 blocksize = (6+prg_bonus)-(EXPREGS[0]&3);
uint32 mask = (1<<blocksize)-1;
V &= mask;
V &= 63;
V |= (EXPREGS[1]<<1);
setprg8(A,V);
}
else
setprg8(A,V & prg_mask);
if(EXPREGS[3]&2)
{
setprg8(0xC000,EXPREGS[4]);
@ -63,6 +77,7 @@ static void BMCFK23CPW(uint32 A, uint8 V)
}
}
//PRG handler ($8000-$FFFF)
static DECLFW(BMCFK23CHiWrite)
{
if(EXPREGS[0]&0x40)
@ -91,8 +106,10 @@ static DECLFW(BMCFK23CHiWrite)
}
}
//EXP handler ($5000-$5FFF)
static DECLFW(BMCFK23CWrite)
{
printf("%04X = $%02X\n",A,V);
if(A&(1<<(dipswitch+4)))
{
EXPREGS[A&3]=V;
@ -103,8 +120,10 @@ static DECLFW(BMCFK23CWrite)
static void BMCFK23CReset(void)
{
//this little hack makes sure that we try all the dip switch settings eventually, if we reset enough
dipswitch++;
dipswitch&=7;
EXPREGS[0]=EXPREGS[1]=EXPREGS[2]=EXPREGS[3]=0;
EXPREGS[4]=EXPREGS[5]=EXPREGS[6]=EXPREGS[7]=0xFF;
MMC3RegReset();

View File

@ -398,6 +398,8 @@ void Mapper12_Init(CartInfo *info)
{
GenMMC3_Init(info, 512, 256, 8, info->battery);
cwrap=M12CW;
isRevB=0;
info->Power=M12Power;
AddExState(EXPREGS, 2, 0, "EXPR");
}
@ -806,10 +808,10 @@ void Mapper114_Init(CartInfo *info)
static void M115PW(uint32 A, uint8 V)
{
if(EXPREGS[0]&0x80)
setprg32(0x8000,(EXPREGS[0]&7)>>1);
else
setprg8(A,V);
//zero 09-apr-2012 - #3515357 - changed to support Bao Qing Tian (mapper 248) which was missing BG gfx. 115 game(s?) seem still to work OK.
GENPWRAP(A,V);
if(A==0x8000 && EXPREGS[0]&0x80)
setprg16(0x8000,(EXPREGS[0]&0xF));
}
static void M115CW(uint32 A, uint8 V)

View File

@ -606,7 +606,7 @@ int FCEUI_SetCheat(uint32 which, const char *name, int32 a, int32 v, int compare
{
char *t;
if((t=(char *)realloc(next->name,strlen(name+1))))
if((t=(char *)realloc(next->name,strlen(name)+1)))
{
next->name=t;
strcpy(next->name,name);

View File

@ -228,7 +228,7 @@ int getBank(int offs)
}
int GetNesFileAddress(int A){
unsigned int result;
int result;
if((A < 0x8000) || (A > 0xFFFF))return -1;
result = &Page[A>>11][A]-PRGptr[0];
if((result > PRGsize[0]) || (result < 0))return -1;

View File

@ -336,7 +336,7 @@ enum EFCEUI
FCEUI_STOPMOVIE, FCEUI_RECORDMOVIE, FCEUI_PLAYMOVIE,
FCEUI_OPENGAME, FCEUI_CLOSEGAME,
FCEUI_TASEDITOR,
FCEUI_RESET, FCEUI_POWER,FCEUI_PLAYFROMBEGINNING
FCEUI_RESET, FCEUI_POWER, FCEUI_PLAYFROMBEGINNING, FCEUI_EJECT_DISK, FCEUI_SWITCH_DISK
};
//checks whether an EFCEUI is valid right now

View File

@ -250,6 +250,12 @@ public:
virtual void fflush() {}
void set_len(s32 length)
{
len = length;
if(pos > length)
pos = length;
}
void trim()
{
vec->resize(len);

View File

@ -53,8 +53,7 @@
#ifdef WIN32
#include "drivers/win/pref.h"
#include "drivers/win/taseditor/greenzone.h"
extern GREENZONE greenzone;
extern bool TaseditorIsRecording();
#endif
#include <fstream>
@ -94,7 +93,7 @@ FCEUGI::FCEUGI()
: filename(0)
, archiveFilename(0)
{
printf("%08x",opsize);
//printf("%08x",opsize); // WTF?!
}
FCEUGI::~FCEUGI()
@ -182,7 +181,7 @@ static void FCEU_CloseGame(void)
CloseGenie();
delete GameInfo;
GameInfo = 0;
GameInfo = NULL;
currFrameCounter = 0;
@ -201,7 +200,7 @@ static void FCEU_CloseGame(void)
uint64 timestampbase;
FCEUGI *GameInfo = 0;
FCEUGI *GameInfo = NULL;
void (*GameInterface)(GI h);
void (*GameStateRestore)(int version);
@ -722,11 +721,6 @@ void FCEUI_Emulate(uint8 **pXBuf, int32 **SoundBuf, int32 *SoundBufSize, int ski
if (movieSubtitles)
ProcessSubtitles();
#ifdef WIN32
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
greenzone.TryDumpIncremental(lagFlag != 0);
#endif
}
void FCEUI_CloseGame(void)
@ -749,6 +743,8 @@ void ResetNES(void)
// clear back baffer
extern uint8 *XBackBuf;
memset(XBackBuf,0,256*256);
FCEU_DispMessage("Reset", 0);
}
void FCEU_MemoryRand(uint8 *ptr, uint32 size)
@ -768,14 +764,15 @@ void hand(X6502 *X, int type, unsigned int A)
}
int suppressAddPowerCommand=0; // hack... yeah, I know...
//int suppressAddPowerCommand=0; // hack... yeah, I know...
void PowerNES(void)
{
//void MapperInit();
//MapperInit();
if(!suppressAddPowerCommand)
//if(!suppressAddPowerCommand)
FCEUMOV_AddCommand(FCEUNPCMD_POWER);
if(!GameInfo) return;
FCEU_CheatResetRAM();
@ -822,6 +819,7 @@ void PowerNES(void)
#ifdef WIN32
Update_RAM_Search(); // Update_RAM_Watch() is also called.
#endif
FCEU_DispMessage("Power on", 0);
}
void FCEU_ResetVidSys(void)
@ -1044,25 +1042,28 @@ bool FCEU_IsValidUI(EFCEUI ui)
break;
case FCEUI_STOPMOVIE:
case FCEUI_PLAYFROMBEGINNING:
return (FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD|MOVIEMODE_FINISHED));
case FCEUI_PLAYFROMBEGINNING:
return (FCEUMOV_Mode(MOVIEMODE_PLAY|MOVIEMODE_RECORD|MOVIEMODE_TASEDITOR|MOVIEMODE_FINISHED));
case FCEUI_STOPAVI:
return FCEUI_AviIsRecording();
case FCEUI_TASEDITOR:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) return false;
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) return false; // can't run two TAS Editors
break;
case FCEUI_RESET:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_FINISHED|MOVIEMODE_TASEDITOR|MOVIEMODE_PLAY)) return false;
break;
case FCEUI_POWER:
case FCEUI_EJECT_DISK:
case FCEUI_SWITCH_DISK:
if(!GameInfo) return false;
if(FCEUMOV_Mode(MOVIEMODE_RECORD)) return true;
#ifdef WIN32
if(FCEUMOV_Mode(MOVIEMODE_TASEDITOR) && TaseditorIsRecording()) return true;
#endif
if(!FCEUMOV_Mode(MOVIEMODE_INACTIVE)) return false;
break;

View File

@ -85,7 +85,7 @@ static uint8 *diskdata[8]={0,0,0,0,0,0,0,0};
static int TotalSides; //mbg merge 7/17/06 - unsignedectomy
static uint8 DiskWritten=0; /* Set to 1 if disk was written to. */
static uint8 writeskip;
static uint32 DiskPtr;
static int32 DiskPtr;
static int32 DiskSeekIRQ;
static uint8 SelectDisk,InDisk;

View File

@ -314,7 +314,7 @@ FCEUFILE * FCEU_fopen(const char *path, const char *ipsfn, char *mode, char *ext
if(magic==0x088b1f) {
// maybe gzip...
void* gzfile = gzopen(fileToOpen.c_str(),"rb");
gzFile gzfile = gzopen(fileToOpen.c_str(),"rb");
if(gzfile) {
delete fp;
@ -535,6 +535,9 @@ std::string FCEU_GetPath(int type)
return ""; //adelikat - 03/02/09 - if no override, should return null and allow the last directory to be used intead
//return BaseDirectory + PSS + "tools";
break;
case FCEUMKF_TASEDITOR:
return BaseDirectory + PSS + "tools";
}
return ret;

View File

@ -162,4 +162,5 @@ void FCEU_SplitArchiveFilename(std::string src, std::string& archive, std::strin
#define FCEUMKF_INPUT 19
#define FCEUMKF_LUA 20
#define FCEUMKF_AVI 21
#define FCEUMKF_TASEDITOR 22
#endif

View File

@ -243,10 +243,15 @@
{0x4e7729ff,114,-1}, /* Super Donkey Kong */
{0x02c41438,176,-1}, /* Xing He Zhan Shi (C) */
{0xfb2b6b10,241,-1}, /* Fan Kong Jing Ying (Ch) */
{0xb5e83c9a,241,-1}, /* Xing Ji Zheng Ba (Ch) */
{0x081caaff,163,-1}, /* Commandos (Ch) */
{0x0da5e32e,101,-1}, /* new Uruusey Yatsura */
{0x4f2f1846,-1,1}, /* Famista '89 - Kaimaku Han!! (J) */
{0x6c71feae,45,-1}, /* Kunio 8-in-1 */
// {0xbdbe3c96,238,-1}, /* Contra Fighter iNES version */
{0xd97c31b0,4,1}, //Rasaaru Ishii no Childs Quest (J)
{0,-1,-1}

View File

@ -415,6 +415,7 @@ void Mapper171_Init(CartInfo *);
void Mapper172_Init(CartInfo *);
void Mapper173_Init(CartInfo *);
void Mapper175_Init(CartInfo *);
void Mapper176_Init(CartInfo *);
void Mapper177_Init(CartInfo *);
void Mapper178_Init(CartInfo *);
void Mapper180_Init(CartInfo *);

View File

@ -54,11 +54,14 @@
#include "./drivers/win/taseditor/taseditor_window.h"
#include "./drivers/win/taseditor/markers.h"
#include "./drivers/win/taseditor/inputsnapshot.h"
#include "./drivers/win/taseditor/selection.h"
#include "./drivers/win/taseditor/snapshot.h"
#include "./drivers/win/taseditor/bookmarks.h"
#include "./drivers/win/taseditor/playback.h"
extern bool Taseditor_rewind_now;
extern BOOKMARKS bookmarks;
extern TASEDITOR_WINDOW taseditor_window;
extern PLAYBACK playback;
#endif // WIN32
//it is easier to declare these input drivers extern here than include a bunch of files
@ -558,23 +561,31 @@ void FCEU_QSimpleCommand(int cmd)
FCEUNET_SendCommand(cmd, 0);
else
{
FCEU_DoSimpleCommand(cmd);
if(FCEUMOV_Mode(MOVIEMODE_RECORD))
if(!FCEUMOV_Mode(MOVIEMODE_TASEDITOR)) // TAS Editor will do the command himself
FCEU_DoSimpleCommand(cmd);
if(FCEUMOV_Mode(MOVIEMODE_RECORD|MOVIEMODE_TASEDITOR))
FCEUMOV_AddCommand(cmd);
}
}
void FCEUI_FDSSelect(void)
{
if(!FCEU_IsValidUI(FCEUI_SWITCH_DISK))
return;
FCEU_DispMessage("Command: Switch disk side", 0);
FCEU_QSimpleCommand(FCEUNPCMD_FDSSELECT);
}
void FCEUI_FDSInsert(void)
{
if(!FCEU_IsValidUI(FCEUI_EJECT_DISK))
return;
FCEU_DispMessage("Command: Insert/Eject disk", 0);
FCEU_QSimpleCommand(FCEUNPCMD_FDSINSERT);
}
void FCEUI_VSUniToggleDIP(int w)
{
FCEU_QSimpleCommand(FCEUNPCMD_VSUNIDIP0 + w);
@ -598,9 +609,10 @@ void FCEUI_ResetNES(void)
{
if(!FCEU_IsValidUI(FCEUI_RESET))
return;
FCEU_DispMessage("Command: Soft reset", 0);
FCEU_QSimpleCommand(FCEUNPCMD_RESET);
ResetFrameCounter();
FCEU_DispMessage("Soft reset", 0);
}
//Powers off the NES
@ -608,9 +620,10 @@ void FCEUI_PowerNES(void)
{
if(!FCEU_IsValidUI(FCEUI_POWER))
return;
FCEU_DispMessage("Command: Power switch", 0);
FCEU_QSimpleCommand(FCEUNPCMD_POWER);
ResetFrameCounter();
FCEU_DispMessage("Power switch", 0);
}
const char* FCEUI_CommandTypeNames[]=
@ -664,16 +677,18 @@ static void FCEUI_DoExit(void);
static void ToggleFullscreen(void);
static void TaseditorRewindOn(void);
static void TaseditorRewindOff(void);
static void TaseditorRestorePlayback(void);
static void TaseditorCancelSeeking(void);
struct EMUCMDTABLE FCEUI_CommandTable[]=
{
{ EMUCMD_POWER, EMUCMDTYPE_MISC, FCEUI_PowerNES, 0, 0, "Power", 0 },
{ EMUCMD_RESET, EMUCMDTYPE_MISC, FCEUI_ResetNES, 0, 0, "Reset", 0 },
{ EMUCMD_POWER, EMUCMDTYPE_MISC, FCEUI_PowerNES, 0, 0, "Power", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_RESET, EMUCMDTYPE_MISC, FCEUI_ResetNES, 0, 0, "Reset", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_PAUSE, EMUCMDTYPE_MISC, FCEUI_ToggleEmulationPause, 0, 0, "Pause", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_FRAME_ADVANCE, EMUCMDTYPE_MISC, FCEUI_FrameAdvance, FCEUI_FrameAdvanceEnd, 0, "Frame Advance", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SCREENSHOT, EMUCMDTYPE_MISC, FCEUI_SaveSnapshot, 0, 0, "Screenshot", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_HIDE_MENU_TOGGLE, EMUCMDTYPE_MISC, FCEUD_HideMenuToggle, 0, 0, "Hide Menu Toggle", 0 },
{ EMUCMD_EXIT, EMUCMDTYPE_MISC, FCEUI_DoExit, 0, 0, "Exit", 0},
{ EMUCMD_EXIT, EMUCMDTYPE_MISC, FCEUI_DoExit, 0, 0, "Exit", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_SLOWEST, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Slowest Speed", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_SLOWER, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Speed Down", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SPEED_NORMAL, EMUCMDTYPE_SPEED, CommandEmulationSpeed, 0, 0, "Normal Speed", EMUCMDFLAG_TASEDITOR },
@ -694,7 +709,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_SAVE_SLOT_9, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Savestate Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_SLOT_NEXT, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Next Savestate Slot", 0 },
{ EMUCMD_SAVE_SLOT_PREV, EMUCMDTYPE_STATE, CommandSelectSaveSlot, 0, 0, "Previous Savestate Slot", 0 },
{ EMUCMD_SAVE_STATE, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State", 0 },
{ EMUCMD_SAVE_STATE, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_AS, EMUCMDTYPE_STATE, FCEUD_SaveStateAs, 0, 0, "Save State As...", 0 },
{ EMUCMD_SAVE_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 0", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 1", EMUCMDFLAG_TASEDITOR },
@ -706,7 +721,7 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_SAVE_STATE_SLOT_7, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 7", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_8, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 8", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SAVE_STATE_SLOT_9, EMUCMDTYPE_STATE, CommandStateSave, 0, 0, "Save State to Slot 9", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State", 0 },
{ EMUCMD_LOAD_STATE, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_FROM, EMUCMDTYPE_STATE, FCEUD_LoadStateFrom, 0, 0, "Load State From...", 0 },
{ EMUCMD_LOAD_STATE_SLOT_0, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 0", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_LOAD_STATE_SLOT_1, EMUCMDTYPE_STATE, CommandStateLoad, 0, 0, "Load State from Slot 1", EMUCMDFLAG_TASEDITOR },
@ -730,19 +745,19 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUD_ToggleStatusIcon, 0, 0, "Toggle Status Icon", EMUCMDFLAG_TASEDITOR },
#ifdef _S9XLUA_H
{ EMUCMD_SCRIPT_RELOAD, EMUCMDTYPE_MISC, FCEU_ReloadLuaCode, 0, 0, "Reload current Lua script", 0 },
{ EMUCMD_SCRIPT_RELOAD, EMUCMDTYPE_MISC, FCEU_ReloadLuaCode, 0, 0, "Reload current Lua script", EMUCMDFLAG_TASEDITOR },
#endif
{ EMUCMD_SOUND_TOGGLE, EMUCMDTYPE_SOUND, FCEUD_SoundToggle, 0, 0, "Sound Mute Toggle", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SOUND_VOLUME_UP, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Up", 0 },
{ EMUCMD_SOUND_VOLUME_DOWN, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Down", 0 },
{ EMUCMD_SOUND_VOLUME_NORMAL, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Normal", 0 },
{ EMUCMD_SOUND_VOLUME_UP, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Up", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SOUND_VOLUME_DOWN, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Down", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_SOUND_VOLUME_NORMAL, EMUCMDTYPE_SOUND, CommandSoundAdjust, 0, 0, "Sound Volume Normal", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_AVI_RECORD_AS, EMUCMDTYPE_AVI, FCEUD_AviRecordTo, 0, 0, "Record AVI As...", 0 },
{ EMUCMD_AVI_STOP, EMUCMDTYPE_AVI, FCEUD_AviStop, 0, 0, "Stop AVI", 0 },
{ EMUCMD_AVI_RECORD_AS, EMUCMDTYPE_AVI, FCEUD_AviRecordTo, 0, 0, "Record AVI As...", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_AVI_STOP, EMUCMDTYPE_AVI, FCEUD_AviStop, 0, 0, "Stop AVI", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_FDS_EJECT_INSERT, EMUCMDTYPE_FDS, FCEUI_FDSInsert, 0, 0, "Eject or Insert FDS Disk", 0 },
{ EMUCMD_FDS_SIDE_SELECT, EMUCMDTYPE_FDS, FCEUI_FDSSelect, 0, 0, "Switch FDS Disk Side", 0 },
{ EMUCMD_FDS_EJECT_INSERT, EMUCMDTYPE_FDS, FCEUI_FDSInsert, 0, 0, "Eject or Insert FDS Disk", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_FDS_SIDE_SELECT, EMUCMDTYPE_FDS, FCEUI_FDSSelect, 0, 0, "Switch FDS Disk Side", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_VSUNI_COIN, EMUCMDTYPE_VSUNI, FCEUI_VSUniCoin, 0, 0, "Insert Coin", 0 },
{ EMUCMD_VSUNI_TOGGLE_DIP_0, EMUCMDTYPE_VSUNI, CommandToggleDip, 0, 0, "Toggle Dipswitch 0", 0 },
@ -760,35 +775,37 @@ struct EMUCMDTABLE FCEUI_CommandTable[]=
{ EMUCMD_MISC_USE_INPUT_PRESET_1, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 1", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_USE_INPUT_PRESET_2, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 2", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_USE_INPUT_PRESET_3, EMUCMDTYPE_MISC, CommandUsePreset, 0, 0, "Use Input Preset 3", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background Display", 0 },
{ EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMDTYPE_MISC, ObjectDisplayToggle, 0, 0, "Toggle Object Display", 0 },
{ EMUCMD_MISC_DISPLAY_BG_TOGGLE, EMUCMDTYPE_MISC, BackgroundDisplayToggle, 0, 0, "Toggle Background Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_OBJ_TOGGLE, EMUCMDTYPE_MISC, ObjectDisplayToggle, 0, 0, "Toggle Object Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE,EMUCMDTYPE_MISC, LagCounterToggle, 0, 0, "Lag Counter Toggle", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_OPENTASEDITOR, EMUCMDTYPE_TOOL, LaunchTasEditor, 0, 0, "Open TAS Editor", 0},
{ EMUCMD_MISC_OPENTASEDITOR, EMUCMDTYPE_TOOL, LaunchTasEditor, 0, 0, "Open TAS Editor", 0},
{ EMUCMD_TOOL_OPENMEMORYWATCH, EMUCMDTYPE_TOOL, LaunchMemoryWatch,0, 0, "Open Memory Watch", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENCHEATS, EMUCMDTYPE_TOOL, LaunchCheats, 0, 0, "Open Cheats", 0},
{ EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", 0},
{ EMUCMD_TOOL_OPENHEX, EMUCMDTYPE_TOOL, LaunchHex, 0, 0, "Open Hex Editor", 0},
{ EMUCMD_TOOL_OPENPPU, EMUCMDTYPE_TOOL, LaunchPPU, 0, 0, "Open PPU Viewer", 0},
{ EMUCMD_TOOL_OPENNTVIEW, EMUCMDTYPE_TOOL, LaunchNTView, 0, 0, "Open Name Table Viewer", 0},
{ EMUCMD_TOOL_OPENTRACELOGGER, EMUCMDTYPE_TOOL, LaunchTraceLogger, 0, 0, "Open Trace Logger", 0},
{ EMUCMD_TOOL_OPENCDLOGGER, EMUCMDTYPE_TOOL, LaunchCodeDataLogger, 0, 0, "Open Code/Data Logger", 0},
{ EMUCMD_FRAMEADV_SKIPLAG, EMUCMDTYPE_MISC, FA_SkipLag, 0, 0, "Frame Adv.-Skip Lag", 0},
{ EMUCMD_TOOL_OPENCHEATS, EMUCMDTYPE_TOOL, LaunchCheats, 0, 0, "Open Cheats", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENDEBUGGER, EMUCMDTYPE_TOOL, LaunchDebugger, 0, 0, "Open Debugger", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENHEX, EMUCMDTYPE_TOOL, LaunchHex, 0, 0, "Open Hex Editor", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENPPU, EMUCMDTYPE_TOOL, LaunchPPU, 0, 0, "Open PPU Viewer", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENNTVIEW, EMUCMDTYPE_TOOL, LaunchNTView, 0, 0, "Open Name Table Viewer", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENTRACELOGGER, EMUCMDTYPE_TOOL, LaunchTraceLogger, 0, 0, "Open Trace Logger", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENCDLOGGER, EMUCMDTYPE_TOOL, LaunchCodeDataLogger, 0, 0, "Open Code/Data Logger", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_FRAMEADV_SKIPLAG, EMUCMDTYPE_MISC, FA_SkipLag, 0, 0, "Frame Adv.-Skip Lag", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_OPENROM, EMUCMDTYPE_TOOL, OpenRom, 0, 0, "Open ROM", 0},
{ EMUCMD_CLOSEROM, EMUCMDTYPE_TOOL, CloseRom, 0, 0, "Close ROM", 0},
{ EMUCMD_RELOAD, EMUCMDTYPE_TOOL, ReloadRom, 0, 0, "Reload ROM or TAS Editor Project", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_DISPLAY_MOVIESUBTITLES, EMUCMDTYPE_MISC, MovieSubtitleToggle,0,0,"Toggle Movie Subtitles", 0},
{ EMUCMD_MISC_DISPLAY_MOVIESUBTITLES, EMUCMDTYPE_MISC, MovieSubtitleToggle,0,0,"Toggle Movie Subtitles", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_MISC_UNDOREDOSAVESTATE, EMUCMDTYPE_MISC, UndoRedoSavestate, 0,0,"Undo/Redo Savestate", 0},
{ EMUCMD_MISC_TOGGLEFULLSCREEN, EMUCMDTYPE_MISC, ToggleFullscreen, 0, 0, "Toggle Fullscreen", 0},
{ EMUCMD_TOOL_OPENRAMWATCH, EMUCMDTYPE_TOOL, LaunchRamWatch, 0, 0, "Open Ram Watch", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_OPENRAMSEARCH, EMUCMDTYPE_TOOL, LaunchRamSearch, 0, 0, "Open Ram Search", 0},
{ EMUCMD_TOOL_OPENRAMSEARCH, EMUCMDTYPE_TOOL, LaunchRamSearch, 0, 0, "Open Ram Search", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TOOL_RAMSEARCHLT, EMUCMDTYPE_TOOL, RamSearchOpLT, 0, 0, "Ram Search - Less Than", 0},
{ EMUCMD_TOOL_RAMSEARCHGT, EMUCMDTYPE_TOOL, RamSearchOpGT, 0, 0, "Ram Search - Greater Than", 0},
{ EMUCMD_TOOL_RAMSEARCHLTE, EMUCMDTYPE_TOOL, RamSearchOpLTE, 0, 0, "Ram Search - Less Than or Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHGTE, EMUCMDTYPE_TOOL, RamSearchOpGTE, 0, 0, "Ram Search - Greater Than or Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHEQ, EMUCMDTYPE_TOOL, RamSearchOpEQ, 0, 0, "Ram Search - Equal", 0},
{ EMUCMD_TOOL_RAMSEARCHNE, EMUCMDTYPE_TOOL, RamSearchOpNE, 0, 0, "Ram Search - Not Equal", 0},
{ EMUCMD_TASEDITOR_REWIND, EMUCMDTYPE_MISC, TaseditorRewindOn, TaseditorRewindOff, 0, "Rewind Frame (TAS Editor only)", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TASEDITOR_REWIND, EMUCMDTYPE_MISC, TaseditorRewindOn, TaseditorRewindOff, 0, "Rewind Frame (TAS Editor)", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_RERECORD_DISPLAY_TOGGLE, EMUCMDTYPE_MISC, FCEUI_MovieToggleRerecordDisplay, 0, 0, "Toggle Rerecord Display", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TASEDITOR_RESTORE_PLAYBACK, EMUCMDTYPE_MISC, TaseditorRestorePlayback, 0, 0, "Restore Playback (TAS Editor)", EMUCMDFLAG_TASEDITOR },
{ EMUCMD_TASEDITOR_CANCEL_SEEKING, EMUCMDTYPE_MISC, TaseditorCancelSeeking, 0, 0, "Cancel Seeking (TAS Editor)", EMUCMDFLAG_TASEDITOR },
};
#define NUM_EMU_CMDS (sizeof(FCEUI_CommandTable)/sizeof(FCEUI_CommandTable[0]))
@ -804,7 +821,7 @@ void FCEUI_HandleEmuCommands(TestCommandState* testfn)
int old_state = FCEUI_CommandTable[i].state;
execcmd = FCEUI_CommandTable[i].cmd;
new_state = (*testfn)(execcmd);
// in TAS Editor mode forbid commands without the taseditor flag
// in TAS Editor mode forbid commands without EMUCMDFLAG_TASEDITOR flag
bool allow = true;
if(taseditor && !(FCEUI_CommandTable[i].flags & EMUCMDFLAG_TASEDITOR))
allow = false;
@ -848,7 +865,7 @@ static void CommandSelectSaveSlot(void)
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.jump(execcmd - EMUCMD_SAVE_SLOT_0);
bookmarks.command(COMMAND_JUMP, execcmd - EMUCMD_SAVE_SLOT_0);
#endif
} else
{
@ -866,7 +883,10 @@ static void CommandStateSave(void)
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.set(execcmd - EMUCMD_SAVE_STATE_SLOT_0);
if (execcmd == EMUCMD_SAVE_STATE)
bookmarks.command(COMMAND_SET);
else if(execcmd >= EMUCMD_SAVE_STATE_SLOT_0 && execcmd <= EMUCMD_SAVE_STATE_SLOT_9)
bookmarks.command(COMMAND_SET, execcmd - EMUCMD_SAVE_STATE_SLOT_0);
#endif
} else
{
@ -887,7 +907,10 @@ static void CommandStateLoad(void)
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
{
#ifdef WIN32
bookmarks.unleash(execcmd - EMUCMD_LOAD_STATE_SLOT_0);
if (execcmd == EMUCMD_LOAD_STATE)
bookmarks.command(COMMAND_DEPLOY);
else if(execcmd >= EMUCMD_LOAD_STATE_SLOT_0 && execcmd <= EMUCMD_LOAD_STATE_SLOT_9)
bookmarks.command(COMMAND_DEPLOY, execcmd - EMUCMD_LOAD_STATE_SLOT_0);
#endif
} else
{
@ -1185,4 +1208,18 @@ static void TaseditorRewindOff(void)
#endif
}
static void TaseditorRestorePlayback(void)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
playback.RestorePosition();
#endif
}
static void TaseditorCancelSeeking(void)
{
#ifdef WIN32
if (FCEUMOV_Mode(MOVIEMODE_TASEDITOR))
playback.CancelSeeking();
#endif
}

View File

@ -232,9 +232,11 @@ enum EMUCMD
EMUCMD_TOOL_RAMSEARCHNE,
EMUCMD_TOOL_OPENNTVIEW,
EMUCMD_TASEDITOR_REWIND,
EMUCMD_RERECORD_DISPLAY_TOGGLE,
EMUCMD_TASEDITOR_RESTORE_PLAYBACK,
//-----------------------------
//keep adding these in order of newness or else the hotkey binding configs will get messed up...
EMUCMD_RERECORD_DISPLAY_TOGGLE,
EMUCMD_TASEDITOR_CANCEL_SEEKING,
EMUCMD_MAX
};

View File

@ -20,48 +20,63 @@
#include "mapinc.h"
//zero 14-apr-2012 - redid this entirely to match bizhawk
#define rg mapbyte1
static void DoSync(uint32 A)
{
int32 p=((A>>3)&0xF) | ((A>>4)&0x10);
int S = A & 1;
int M_horz = (A>>1)&1;
int p = (A >> 2) & 0x1F;
p += (A&0x100) ? 0x20 : 0;
bool o = (A>>7)&1;
bool L = (A>>9)&1;
if (o && !S )
{
ROM_BANK16(0x8000,p);
ROM_BANK16(0xC000,p);
}
if (o && S )
{
ROM_BANK16(0x8000,p);
ROM_BANK16(0xC000,p+1);
}
if (!o && !S && !L )
{
ROM_BANK16(0x8000,p);
ROM_BANK16(0xC000,p&0x38);
}
if (!o && S && !L )
{
ROM_BANK16(0x8000,p&0x3E);
ROM_BANK16(0xC000,p&0x38);
}
if (!o && !S && L)
{
ROM_BANK16(0x8000,p);
ROM_BANK16(0xC000,p|7);
}
if (!o && S && L )
{
ROM_BANK16(0x8000,p&0x3E);
ROM_BANK16(0xC000,p|7);
}
rg[0]=A;
rg[1]=A>>8;
MIRROR_SET((A>>1)&1);
if(A&1) //32 KB
{
ROM_BANK32(p);
}
else //16 KB
{
ROM_BANK16(0x8000,(p<<1)|((A&4)>>2));
ROM_BANK16(0xc000,(p<<1)|((A&4)>>2));
}
if(A&0x80)
{
PPUCHRRAM=0;
}
else
{
PPUCHRRAM=0xFF;
if(A&0x200)
ROM_BANK16(0xC000,(p<<1)|7);
else
ROM_BANK16(0xC000,(p<<1)&(~7));
}
}
static DECLFW(Mapper227_write)
{
rg[A&1]=V;
DoSync(A);
}
static void M227Reset(void)
{
rg[0]=rg[1]=0;
DoSync(0);
}
@ -72,7 +87,7 @@ static void M227Restore(int version)
void Mapper227_init(void)
{
SetWriteHandler(0x6000,0xffff,Mapper227_write);
SetWriteHandler(0x8000,0xffff,Mapper227_write);
MapperReset=M227Reset;
GameStateRestore=M227Restore;
M227Reset();

View File

@ -24,12 +24,10 @@
DECLFW(Mapper242_write)
{
ROM_BANK32((A>>3)&0xF);
switch(V&3)
switch((A>>1)&1)
{
case 0:MIRROR_SET(0);break;
case 1:MIRROR_SET(1);break;
case 2:onemir(0);break;
case 3:onemir(1);break;
}
}

View File

@ -44,6 +44,8 @@ extern void AddRecentMovieFile(const char *filename);
#include "./drivers/win/taseditor/recorder.h"
extern PLAYBACK playback;
extern RECORDER recorder;
extern bool emulator_must_run_taseditor;
extern bool TaseditorIsRecording();
#endif
using namespace std;
@ -61,6 +63,8 @@ bool autoMovieBackup = false; //Toggle that determines if movies should be backe
bool freshMovie = false; //True when a movie loads, false when movie is altered. Used to determine if a movie has been altered since opening
bool movieFromPoweron = true;
static int _currCommand = 0;
// Function declarations------------------------
@ -661,14 +665,18 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
// Non-TASEditor projects consume until EOF
movieData.loadFrameCount = -1;
//first, look for an fcm signature
char fcmbuf[3];
std::ios::pos_type curr = fp->ftell();
fp->fread(fcmbuf,3);
fp->fseek(curr,SEEK_SET);
if(!strncmp(fcmbuf,"FCM",3)) {
FCEU_PrintError("FCM File format is no longer supported. Please use Tools > Convert FCM");
return false;
if (!stopAfterHeader)
{
// first, look for an fcm signature
char fcmbuf[3];
fp->fread(fcmbuf,3);
fp->fseek(curr,SEEK_SET);
if(!strncmp(fcmbuf,"FCM",3)) {
FCEU_PrintError("FCM File format is no longer supported. Please use Tools > Convert FCM");
return false;
}
}
//movie must start with "version 3"
@ -685,10 +693,10 @@ bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader)
NEWLINE, KEY, SEPARATOR, VALUE, RECORD, COMMENT, SUBTITLE
} state = NEWLINE;
bool bail = false;
bool iswhitespace, isrecchar, isnewline;
int c;
for(;;)
{
bool iswhitespace, isrecchar, isnewline;
int c;
if(size--<=0) goto bail;
c = fp->fgetc();
if(c == -1)
@ -850,7 +858,7 @@ void poweron(bool shouldDisableBatteryLoading)
disableBatteryLoading = 0;
}
void CreateCleanMovie()
void FCEUMOV_CreateCleanMovie()
{
currMovieData = MovieData();
currMovieData.palFlag = FCEUI_GetCurrentVidSystem(0,0)!=0;
@ -859,15 +867,16 @@ void CreateCleanMovie()
currMovieData.guid.newGuid();
currMovieData.fourscore = FCEUI_GetInputFourscore();
currMovieData.microphone = FCEUI_GetInputMicrophone();
//currMovieData.ports[0] = InputType[0];
//currMovieData.ports[1] = InputType[1];
//currMovieData.ports[2] = InputType[2];
currMovieData.ports[0] = joyports[0].type;
currMovieData.ports[1] = joyports[1].type;
currMovieData.ports[2] = portFC.type;
currMovieData.fds = isFDS;
currMovieData.PPUflag = (newppu != 0);
}
void FCEUMOV_ClearCommands()
{
_currCommand = 0;
}
bool FCEUMOV_FromPoweron()
{
@ -1007,10 +1016,9 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
currFrameCounter = 0;
LagCounterReset();
CreateCleanMovie();
FCEUMOV_CreateCleanMovie();
if(author != L"") currMovieData.comments.push_back(L"author " + author);
if(flags & MOVIE_FLAG_FROM_POWERON)
{
movieFromPoweron = true;
@ -1022,6 +1030,8 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
MovieData::dumpSavestateTo(&currMovieData.savestate,Z_BEST_COMPRESSION);
}
FCEUMOV_ClearCommands();
//we are going to go ahead and dump the header. from now on we will only be appending frames
currMovieData.dump(osRecordingMovie, false);
@ -1032,7 +1042,6 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
FCEU_DispMessage("Movie recording started.",0);
}
static int _currCommand = 0;
//the main interaction point between the emulator and the movie system.
//either dumps the current joystick state or loads one state from the movie
@ -1041,29 +1050,32 @@ void FCEUMOV_AddInputState()
#ifdef _WIN32
if(movieMode == MOVIEMODE_TASEDITOR)
{
// if movie length is less than currFrame, pad it with empty frames
if((int)currMovieData.records.size() <= currFrameCounter)
currMovieData.insertEmpty(-1, 1 + currFrameCounter - (int)currMovieData.records.size());
// if movie length is less or equal to currFrame, pad it with empty frames
if((int)currMovieData.records.size()-1 <= currFrameCounter)
currMovieData.insertEmpty(-1, 2 + currFrameCounter - (int)currMovieData.records.size());
MovieRecord* mr = &currMovieData.records[currFrameCounter];
if(movie_readonly || turbo || playback.pause_frame > currFrameCounter)
if(TaseditorIsRecording())
{
// replay buttons
if(mr->command_reset())
ResetNES();
if(mr->command_fds_insert())
FCEU_FDSInsert();
if(mr->command_fds_select())
FCEU_FDSSelect();
joyports[0].load(mr);
joyports[1].load(mr);
} else
{
// record buttons
// record commands and buttons
mr->commands |= _currCommand;
joyports[0].log(mr);
joyports[1].log(mr);
recorder.InputChanged();
// replay buttons even when Recording - return data from movie to joyports in case Recorder changed it (for example, by applying Superimpose)
}
// replay buttons
joyports[0].load(mr);
joyports[1].load(mr);
// replay commands
if(mr->command_power())
PowerNES();
if(mr->command_reset())
ResetNES();
if(mr->command_fds_insert())
FCEU_FDSInsert();
if(mr->command_fds_select())
FCEU_FDSSelect();
_currCommand = 0;
} else
#endif
@ -1081,13 +1093,10 @@ void FCEUMOV_AddInputState()
//reset and power cycle if necessary
if(mr->command_power())
PowerNES();
if(mr->command_reset())
ResetNES();
if(mr->command_fds_insert())
FCEU_FDSInsert();
if(mr->command_fds_select())
FCEU_FDSSelect();
@ -1142,7 +1151,7 @@ void FCEUMOV_AddInputState()
void FCEUMOV_AddCommand(int cmd)
{
// do nothing if not recording a movie
if(movieMode != MOVIEMODE_RECORD)
if(movieMode != MOVIEMODE_RECORD && movieMode != MOVIEMODE_TASEDITOR)
return;
//NOTE: EMOVIECMD matches FCEUNPCMD_RESET and FCEUNPCMD_POWER
@ -1251,20 +1260,13 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
{
if (currMovieData.loadFrameCount >= 0)
{
#ifdef WIN32
#ifdef WIN32
int result = MessageBox(hAppWnd, "This movie is a TAS Editor project file.\nIt can be modified in TAS Editor only.\n\nOpen it in TAS Editor now?", "Movie Replay", MB_YESNO);
if (result == IDYES)
{
extern bool EnterTasEditor();
extern bool LoadProject(char* fullname);
char fullname[512];
strcpy(fullname, curMovieFilename);
if (EnterTasEditor())
LoadProject(fullname);
}
#else
emulator_must_run_taseditor = true;
#else
FCEUI_printf("This movie is a TAS Editor project file! It can be modified in TAS Editor only.\nMovie is now Read-Only.\n");
#endif
#endif
movie_readonly = true;
}
if (FCEU_isFileInArchive(curMovieFilename))

View File

@ -1,8 +1,6 @@
#ifndef __MOVIE_H_
#define __MOVIE_H_
#define PROGRESSBAR_UPDATE_RATE 2000 // in frames of greenzone
#include <vector>
#include <map>
#include <string>
@ -92,7 +90,8 @@ bool FCEUMOV_PostLoad();
bool FCEUMOV_FromPoweron();
void CreateCleanMovie();
void FCEUMOV_CreateCleanMovie();
void FCEUMOV_ClearCommands();
class MovieData;
class MovieRecord

View File

@ -98,10 +98,10 @@ int writele(T *Bufo, EMUFILE*os)
{
CTASSERT(sizeof(T)==1||sizeof(T)==2||sizeof(T)==4||sizeof(T)==8);
switch(sizeof(T)) {
case 1: return write8le((uint8*)Bufo,os);
case 2: return write16le((uint16*)Bufo,os);
case 4: return write32le((uint32*)Bufo,os);
case 8: return write64le((uint64*)Bufo,os);
case 1: return write8le(*(uint8*)Bufo,os);
case 2: return write16le(*(uint16*)Bufo,os);
case 4: return write32le(*(uint32*)Bufo,os);
case 8: return write64le(*(uint64*)Bufo,os);
default:
return 0;
}

View File

@ -62,24 +62,20 @@ int str_ltrim(char *str, int flags) {
unsigned int i=0; //mbg merge 7/17/06 changed to unsigned int
while (str[0]) {
if ((str[0] != ' ') || (str[0] != '\t') || (str[0] != '\r') || (str[0] != '\n')) break;
if ((flags & STRIP_SP) && (str[0] == ' ')) {
i++;
strcpy(str,str+1);
}
if ((flags & STRIP_TAB) && (str[0] == '\t')) {
} else if ((flags & STRIP_TAB) && (str[0] == '\t')) {
i++;
strcpy(str,str+1);
}
if ((flags & STRIP_CR) && (str[0] == '\r')) {
} else if ((flags & STRIP_CR) && (str[0] == '\r')) {
i++;
strcpy(str,str+1);
}
if ((flags & STRIP_LF) && (str[0] == '\n')) {
} else if ((flags & STRIP_LF) && (str[0] == '\n')) {
i++;
strcpy(str,str+1);
}
} else
break;
}
return i;
}
@ -90,30 +86,23 @@ int str_ltrim(char *str, int flags) {
///Removes whitespace from right side of string, depending on the flags set (See STRIP_x definitions in xstring.h)
///Returns number of characters removed
int str_rtrim(char *str, int flags) {
unsigned int i=0; //mbg merge 7/17/06 changed to unsigned int
while (strlen(str)) {
if ((str[strlen(str)-1] != ' ') ||
(str[strlen(str)-1] != '\t') ||
(str[strlen(str)-1] != '\r') ||
(str[strlen(str)-1] != '\n')) break;
unsigned int i=0, strl; //mbg merge 7/17/06 changed to unsigned int
while (strl = strlen(str)) {
if ((flags & STRIP_SP) && (str[0] == ' ')) {
i++;
str[strlen(str)-1] = 0;
}
if ((flags & STRIP_TAB) && (str[0] == '\t')) {
str[strl] = 0;
} else if ((flags & STRIP_TAB) && (str[0] == '\t')) {
i++;
str[strlen(str)-1] = 0;
}
if ((flags & STRIP_CR) && (str[0] == '\r')) {
str[strl] = 0;
} else if ((flags & STRIP_CR) && (str[0] == '\r')) {
i++;
str[strlen(str)-1] = 0;
}
if ((flags & STRIP_LF) && (str[0] == '\n')) {
str[strl] = 0;
} else if ((flags & STRIP_LF) && (str[0] == '\n')) {
i++;
str[strlen(str)-1] = 0;
}
str[strl] = 0;
} else
break;
}
return i;
}
@ -441,7 +430,7 @@ void splitpath(const char* path, char* drv, char* dir, char* name, char* ext)
*name = '\0';
} else
for(s=p; s<end; )
*s++;
s++;
if (dir) {
for(s=path; s<p; )