sync with official

This commit is contained in:
dborth 2010-03-11 06:30:34 +00:00
parent f5b83a8e90
commit e2df41dab0
9 changed files with 201 additions and 176 deletions

View File

@ -20,6 +20,7 @@
#include "mapinc.h"
static uint8 bus_conflict = 0;
static uint8 latche, latcheinit;
static uint16 addrreg0, addrreg1;
static void(*WSync)(void);
@ -27,6 +28,9 @@ static void(*WSync)(void);
static DECLFW(LatchWrite)
{
// FCEU_printf("bs %04x %02x\n",A,V);
if(bus_conflict)
latche=V&CartBR(A);
else
latche=V;
WSync();
}
@ -53,6 +57,7 @@ static void Latch_Init(CartInfo *info, void (*proc)(void), uint8 init, uint16 ad
info->Power=LatchPower;
GameStateRestore=StateRestore;
AddExState(&latche, 1, 0, "LATC");
AddExState(&bus_conflict, 1, 0, "BUSC");
}
//------------------ CPROM ---------------------------
@ -98,6 +103,7 @@ static void CNROMSync(void)
void CNROM_Init(CartInfo *info)
{
bus_conflict = 1;
Latch_Init(info, CNROMSync, 0, 0x8000, 0xFFFF);
}
@ -168,17 +174,17 @@ static void MHROMSync(void)
}
void MHROM_Init(CartInfo *info)
{
{
Latch_Init(info, MHROMSync, 0, 0x8000, 0xFFFF);
}
void Mapper140_Init(CartInfo *info)
{
{
Latch_Init(info, MHROMSync, 0, 0x6000, 0x7FFF);
}
void Mapper240_Init(CartInfo *info)
{
{
Latch_Init(info, MHROMSync, 0, 0x4020, 0x5FFF);
// need SRAM.
}
@ -194,7 +200,7 @@ static void M87Sync(void)
}
void Mapper87_Init(CartInfo *info)
{
{
Latch_Init(info, M87Sync, ~0, 0x6000, 0xFFFF);
}
@ -221,12 +227,12 @@ static void M11Sync(void)
}
void Mapper11_Init(CartInfo *info)
{
{
Latch_Init(info, M11Sync, 0, 0x8000, 0xFFFF);
}
void Mapper144_Init(CartInfo *info)
{
{
Latch_Init(info, M11Sync, 0, 0x8001, 0xFFFF);
}
@ -266,6 +272,7 @@ static void UNROMSync(void)
void UNROM_Init(CartInfo *info)
{
bus_conflict = 1;
Latch_Init(info, UNROMSync, 0, 0x8000, 0xFFFF);
}
@ -342,7 +349,7 @@ void Mapper113_Init(CartInfo *info)
// actually, there is two cart in one... First have extra mirroring
// mode (one screen) and 32K bankswitching, second one have only
// 16 bankswitching mode and normal mirroring... But there is no any
// 16 bankswitching mode and normal mirroring... But there is no any
// correlations between modes and they can be used in one mapper code.
static void BMCA65ASSync(void)

View File

@ -271,6 +271,8 @@ void FCEUI_AviEnd(void);
void FCEUI_AviVideoUpdate(const unsigned char* buffer);
void FCEUI_AviSoundUpdate(void* soundData, int soundLen);
bool FCEUI_AviIsRecording();
bool FCEUI_AviDisableMovieMessages();
void FCEUI_SetAviDisableMovieMessages(bool disable);
void FCEUD_AviRecordTo(void);
void FCEUD_AviStop(void);

View File

@ -43,6 +43,8 @@
// when the virtual motor is on(mmm...virtual motor).
extern int disableBatteryLoading;
bool isFDS = false; //flag for determining if a FDS game is loaded, movie.cpp needs this
static DECLFR(FDSRead4030);
static DECLFR(FDSRead4031);
static DECLFR(FDSRead4032);
@ -806,7 +808,7 @@ int FDSLoad(const char *name, FCEUFILE *fp)
fclose(zp);
#endif
if (!disableBatteryLoading)
if (!disableBatteryLoading)
{
FCEUFILE *tp;
char *fn=strdup(FCEU_MakeFName(FCEUMKF_FDS,0,0).c_str());
@ -818,7 +820,7 @@ if (!disableBatteryLoading)
memcpy(diskdatao[x],diskdata[x],65500);
}
#ifndef GEKKO
if((tp=FCEU_fopen(fn,0,"rb",0)))
if((tp=FCEU_fopen(fn,0,"wb",0)))
{
FreeFDSMemory();
if(!SubLoad(tp))
@ -833,13 +835,13 @@ if (!disableBatteryLoading)
free(fn);
#endif
}
#ifndef GEKKO
extern char LoadedRomFName[2048];
strcpy(LoadedRomFName,name); //For the debugger list
#endif
GameInfo->type=GIT_FDS;
GameInterface=FDSGI;
isFDS = true;
SelectDisk=0;
InDisk=255;
@ -888,6 +890,7 @@ void FDSClose(void)
#endif
FILE *fp;
int x;
isFDS = false;
char *fn=strdup(FCEU_MakeFName(FCEUMKF_FDS,0,0).c_str());
if(!DiskWritten) return;

View File

@ -1,3 +1,4 @@
extern bool isFDS;
void FDSSoundReset(void);
void FCEU_FDSInsert(void);

View File

@ -532,6 +532,156 @@ static int not_power2[] =
{
228
};
typedef struct {
char* name;
int number;
void (*init)(CartInfo *);
} BMAPPING;
static BMAPPING bmap[] = {
{"NROM", 0, NROM_Init},
{"MMC1", 1, Mapper1_Init},
{"UNROM", 2, UNROM_Init},
{"CNROM", 3, CNROM_Init},
{"MMC3", 4, Mapper4_Init},
{"MMC5", 5, Mapper5_Init},
{"ANROM", 7, ANROM_Init},
{"Color Dreams", 11, Mapper11_Init},
{"", 12, Mapper12_Init},
{"CPROM", 13, CPROM_Init},
{"100-in1", 15, Mapper15_Init},
{"Bandai", 16, Mapper16_Init},
{"Namcot 106", 19, Mapper19_Init},
{"Konami VRC2 type B", 23, Mapper23_Init},
{"Wario Land 2", 35, UNLSC127_Init}, // Wario Land 2
{"TXC Policeman", 36, Mapper36_Init}, // TXC Policeman
{"", 37, Mapper37_Init},
{"Bit Corp. Crime Busters", 38, Mapper38_Init}, // Bit Corp. Crime Busters
{"", 43, Mapper43_Init},
{"", 44, Mapper44_Init},
{"", 45, Mapper45_Init},
{"", 47, Mapper47_Init},
{"", 49, Mapper49_Init},
{"", 52, Mapper52_Init},
{"", 57, Mapper57_Init},
{"", 58, BMCGK192_Init},
{"", 60, BMCD1038_Init},
{"MHROM", 66, MHROM_Init},
{"Sunsoft Mapper #4", 68, Mapper68_Init},
{"", 70, Mapper70_Init},
{"", 74, Mapper74_Init},
{"Irem 74HC161/32", 78, Mapper78_Init},
{"", 87, Mapper87_Init},
{"", 88, Mapper88_Init},
{"", 90, Mapper90_Init},
{"Sunsoft UNROM", 93, SUNSOFT_UNROM_Init},
{"", 94, Mapper94_Init},
{"", 95, Mapper95_Init},
{"", 101, Mapper101_Init},
{"", 103, Mapper103_Init},
{"", 105, Mapper105_Init},
{"", 106, Mapper106_Init},
{"", 107, Mapper107_Init},
{"", 108, Mapper108_Init},
{"", 112, Mapper112_Init},
{"", 113, Mapper113_Init},
{"", 114, Mapper114_Init},
{"", 115, Mapper115_Init},
{"", 116, Mapper116_Init},
// {116, UNLSL1632_Init},
{"", 117, Mapper117_Init},
{"TSKROM", 118, TKSROM_Init},
{"", 119, Mapper119_Init},
{"", 120, Mapper120_Init},
{"", 121, Mapper121_Init},
{"UNLH2288", 123, UNLH2288_Init},
{"UNL22211", 132, UNL22211_Init},
{"SA72008", 133, SA72008_Init},
{"", 134, Mapper134_Init},
{"TCU02", 136, TCU02_Init},
{"S8259D", 137, S8259D_Init},
{"S8259B", 138, S8259B_Init},
{"S8259C", 139, S8259C_Init},
{"", 140, Mapper140_Init},
{"S8259A", 141, S8259A_Init},
{"UNLKS7032", 142, UNLKS7032_Init},
{"TCA01", 143, TCA01_Init},
{"", 144, Mapper144_Init},
{"SA72007", 145, SA72007_Init},
{"SA0161M", 146, SA0161M_Init},
{"TCU01", 147, TCU01_Init},
{"SA0037", 148, SA0037_Init},
{"SA0036", 149, SA0036_Init},
{"S74LS374N", 150, S74LS374N_Init},
{"", 152, Mapper152_Init},
{"", 153, Mapper153_Init},
{"", 154, Mapper154_Init},
{"", 155, Mapper155_Init},
{"SA009", 160, SA009_Init},
{"", 163, Mapper163_Init},
{"", 164, Mapper164_Init},
{"", 165, Mapper165_Init},
// {169, Mapper169_Init},
{"", 171, Mapper171_Init},
{"", 172, Mapper172_Init},
{"", 173, Mapper173_Init},
{"", 175, Mapper175_Init},
{"BMCFK23C", 176, BMCFK23C_Init},
{"", 177, Mapper177_Init},
{"", 178, Mapper178_Init},
{"", 180, Mapper180_Init},
{"", 181, Mapper181_Init},
{"", 182, Mapper182_Init},
{"", 183, Mapper183_Init},
{"", 184, Mapper184_Init},
{"", 185, Mapper185_Init},
{"", 186, Mapper186_Init},
{"", 187, Mapper187_Init},
{"", 188, Mapper188_Init},
{"", 189, Mapper189_Init},
{"", 191, Mapper191_Init},
{"", 192, Mapper192_Init},
{"", 194, Mapper194_Init},
{"", 195, Mapper195_Init},
{"", 196, Mapper196_Init},
{"", 197, Mapper197_Init},
{"", 198, Mapper198_Init},
{"", 199, Mapper199_Init},
{"", 200, Mapper200_Init},
{"", 205, Mapper205_Init},
{"DEIROM", 206, DEIROM_Init},
{"", 208, Mapper208_Init},
{"", 209, Mapper209_Init},
{"", 210, Mapper210_Init},
{"", 211, Mapper211_Init},
{"", 215, Mapper215_Init},
{"", 216, Mapper216_Init},
{"", 217, Mapper217_Init},
{"UNLA9746", 219, UNLA9746_Init},
// {220, BMCFK23C_Init},
// {220, UNL3DBlock_Init},
// {220, UNLTF1201_Init},
// {220, TCU02_Init},
// {220, UNLCN22M_Init},
// {220, BMCT2271_Init},
// {220, UNLDANCE_Init},
{"UNLN625092", 221, UNLN625092_Init},
{"", 222, Mapper222_Init},
{"", 226, Mapper226_Init},
{"", 235, Mapper235_Init},
{"UNL6035052", 238, UNL6035052_Init},
{"", 240, Mapper240_Init},
{"S74LS374NA", 243, S74LS374NA_Init},
{"", 245, Mapper245_Init},
{"", 249, Mapper249_Init},
{"", 250, Mapper250_Init},
{"", 253, Mapper253_Init},
{"", 254, Mapper254_Init},
{"", 0, 0}
};
int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
{
@ -681,7 +831,8 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
FCEU_printf("%02x",iNESCart.MD5[x]);
FCEU_printf("\n");
}
FCEU_printf(" Mapper: %d\n Mirroring: %s\n", MapperNo,Mirroring==2?"None(Four-screen)":Mirroring?"Vertical":"Horizontal");
FCEU_printf(" Mapper #: %d\n Mapper name: %s\n Mirroring: %s\n",
MapperNo, bmap[MapperNo].name, Mirroring==2?"None(Four-screen)":Mirroring?"Vertical":"Horizontal");
if(head.ROM_type&2) FCEU_printf(" Battery-backed.\n");
if(head.ROM_type&4) FCEU_printf(" Trained.\n");
@ -1290,163 +1441,13 @@ static void iNESPower(void)
}
}
typedef struct {
int number;
void (*init)(CartInfo *);
} BMAPPING;
static BMAPPING bmap[] = {
{0, NROM_Init},
{1, Mapper1_Init},
{2, UNROM_Init},
{3, CNROM_Init},
{4, Mapper4_Init},
{5, Mapper5_Init},
{7, ANROM_Init},
{11, Mapper11_Init},
{12, Mapper12_Init},
{13, CPROM_Init},
{15, Mapper15_Init},
{16, Mapper16_Init},
{19, Mapper19_Init},
{23, Mapper23_Init},
{35, UNLSC127_Init}, // Wario Land 2
{36, Mapper36_Init}, // TXC Policeman
{37, Mapper37_Init},
{38, Mapper38_Init}, // Bit Corp. Crime Busters
{43, Mapper43_Init},
{44, Mapper44_Init},
{45, Mapper45_Init},
{47, Mapper47_Init},
{49, Mapper49_Init},
{52, Mapper52_Init},
{57, Mapper57_Init},
{58, BMCGK192_Init},
{60, BMCD1038_Init},
{66, MHROM_Init},
{68, Mapper68_Init},
{70, Mapper70_Init},
{74, Mapper74_Init},
{78, Mapper78_Init},
{87, Mapper87_Init},
{88, Mapper88_Init},
{90, Mapper90_Init},
{93, SUNSOFT_UNROM_Init},
{94, Mapper94_Init},
{95, Mapper95_Init},
{101, Mapper101_Init},
{103, Mapper103_Init},
{105, Mapper105_Init},
{106, Mapper106_Init},
{107, Mapper107_Init},
{108, Mapper108_Init},
{112, Mapper112_Init},
{113, Mapper113_Init},
{114, Mapper114_Init},
{115, Mapper115_Init},
{116, Mapper116_Init},
// {116, UNLSL1632_Init},
{117, Mapper117_Init},
{118, TKSROM_Init},
{119, Mapper119_Init},
{120, Mapper120_Init},
{121, Mapper121_Init},
{123, UNLH2288_Init},
{132, UNL22211_Init},
{133, SA72008_Init},
{134, Mapper134_Init},
{136, TCU02_Init},
{137, S8259D_Init},
{138, S8259B_Init},
{139, S8259C_Init},
{140, Mapper140_Init},
{141, S8259A_Init},
{142, UNLKS7032_Init},
{143, TCA01_Init},
{144, Mapper144_Init},
{145, SA72007_Init},
{146, SA0161M_Init},
{147, TCU01_Init},
{148, SA0037_Init},
{149, SA0036_Init},
{150, S74LS374N_Init},
{152, Mapper152_Init},
{153, Mapper153_Init},
{154, Mapper154_Init},
{155, Mapper155_Init},
{160, SA009_Init},
{163, Mapper163_Init},
{164, Mapper164_Init},
{165, Mapper165_Init},
// {169, Mapper169_Init},
{171, Mapper171_Init},
{172, Mapper172_Init},
{173, Mapper173_Init},
{175, Mapper175_Init},
{176, BMCFK23C_Init},
{177, Mapper177_Init},
{178, Mapper178_Init},
{180, Mapper180_Init},
{181, Mapper181_Init},
{182, Mapper182_Init},
{183, Mapper183_Init},
{184, Mapper184_Init},
{185, Mapper185_Init},
{186, Mapper186_Init},
{187, Mapper187_Init},
{188, Mapper188_Init},
{189, Mapper189_Init},
{191, Mapper191_Init},
{192, Mapper192_Init},
{194, Mapper194_Init},
{195, Mapper195_Init},
{196, Mapper196_Init},
{197, Mapper197_Init},
{198, Mapper198_Init},
{199, Mapper199_Init},
{200, Mapper200_Init},
{205, Mapper205_Init},
{206, DEIROM_Init},
{208, Mapper208_Init},
{209, Mapper209_Init},
{210, Mapper210_Init},
{211, Mapper211_Init},
{215, Mapper215_Init},
{216, Mapper216_Init},
{217, Mapper217_Init},
{219, UNLA9746_Init},
// {220, BMCFK23C_Init},
// {220, UNL3DBlock_Init},
// {220, UNLTF1201_Init},
// {220, TCU02_Init},
// {220, UNLCN22M_Init},
// {220, BMCT2271_Init},
// {220, UNLDANCE_Init},
{221, UNLN625092_Init},
{222, Mapper222_Init},
{226, Mapper226_Init},
{235, Mapper235_Init},
{238, UNL6035052_Init},
{240, Mapper240_Init},
{243, S74LS374NA_Init},
{245, Mapper245_Init},
{249, Mapper249_Init},
{250, Mapper250_Init},
{253, Mapper253_Init},
{254, Mapper254_Init},
{ 0, 0}
};
static int NewiNES_Init(int num)
{
BMAPPING *tmp=bmap;
if(GameInfo->type == GIT_VSUNI)
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
while(tmp->init)
{
if(num==tmp->number)

View File

@ -129,6 +129,12 @@ void MovieData::TryDumpIncremental()
if(movieMode == MOVIEMODE_TASEDIT)
{
//only log the savestate if we are appending to the green zone
if (turbo && pauseframe!=-1 && currFrameCounter<currMovieData.records.size())
{
if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff))
return;
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
}
if(currFrameCounter == currMovieData.greenZoneCount)
{
if(currFrameCounter == (int)currMovieData.records.size() || currMovieData.records.size()==0)
@ -140,16 +146,19 @@ void MovieData::TryDumpIncremental()
currMovieData.greenZoneCount++;
} else if (currFrameCounter < currMovieData.greenZoneCount || !movie_readonly)
{
if (turbo && pauseframe-256>currFrameCounter && ((currFrameCounter-pauseframe)&0xff))
return;
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
} else if (currFrameCounter > currMovieData.greenZoneCount && currMovieData.greenZoneCount<currMovieData.records.size())
{
/* May be required in some malformed TAS projects. */
MovieData::dumpSavestateTo(&currMovieData.records[currFrameCounter].savestate,Z_DEFAULT_COMPRESSION);
currMovieData.greenZoneCount= currFrameCounter+1;
}
}
#endif
}
void MovieRecord::clear()
{
{
#ifndef GEKKO
commands = 0;
*(uint32*)&joysticks = 0;
@ -370,7 +379,9 @@ void MovieData::installValue(std::string& key, std::string& val)
{
#ifndef GEKKO
//todo - use another config system, or drive this from a little data structure. because this is gross
if(key == "version")
if(key == "FDS")
installInt(val,fds);
else if(key == "version")
installInt(val,version);
else if(key == "emuVersion")
installInt(val,emuVersion);
@ -430,6 +441,7 @@ int MovieData::dump(std::ostream *os, bool binary)
*os << "port0 " << ports[0] << endl;
*os << "port1 " << ports[1] << endl;
*os << "port2 " << ports[2] << endl;
*os << "FDS " << isFDS << endl;
for(uint32 i=0;i<comments.size();i++)
*os << "comment " << wcstombs(comments[i]) << endl;
@ -960,11 +972,11 @@ static void openRecordingMovie(const char* fname)
#endif
}
#ifndef GEKKO
//begin recording a new movie
//TODO - BUG - the record-from-another-savestate doesnt work.
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
{
#ifndef GEKKO
if(!FCEU_IsValidUI(FCEUI_RECORDMOVIE))
return;
@ -1006,8 +1018,8 @@ void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author)
currRerecordCount = 0;
FCEU_DispMessage("Movie recording started.");
}
#endif
}
static int _currCommand = 0;
@ -1574,4 +1586,4 @@ bool CheckFileExists(const char* filename)
#else
return false;
#endif
}
}

View File

@ -42,9 +42,8 @@ typedef struct
uint32 emu_version_used; // 9813 = 0.98.13
MD5DATA md5_of_rom_used;
std::string name_of_rom_used;
#ifndef GEKKO
std::vector<std::wstring> comments;
#endif
std::vector<std::string> subtitles;
} MOVIE_INFO;
@ -162,15 +161,14 @@ public:
int version;
int emuVersion;
int fds;
//todo - somehow force mutual exclusion for poweron and reset (with an error in the parser)
bool palFlag;
MD5DATA romChecksum;
std::string romFilename;
std::vector<char> savestate;
std::vector<MovieRecord> records;
#ifndef GEKKO
std::vector<std::wstring> comments;
#endif
std::vector<std::string> subtitles;
//this is the RERECORD COUNT. please rename variable.
int rerecordCount;
@ -256,9 +254,7 @@ extern int pauseframe;
bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
void FCEUI_MakeBackupMovie(bool dispMessage);
void FCEUI_CreateMovieFile(std::string fn);
#ifndef GEKKO
void FCEUI_SaveMovie(const char *fname, EMOVIE_FLAG flags, std::wstring author);
#endif
bool FCEUI_LoadMovie(const char *fname, bool read_only, bool tasedit, int _stopframe);
void FCEUI_MoviePlayFromBeginning(void);
void FCEUI_StopMovie(void);

View File

@ -255,7 +255,7 @@ int NSFLoad(const char *name, FCEUFILE *fp)
strcpy(LoadedRomFName,name);
FCEU_printf("NSF Loaded. File information:\n\n");
FCEU_printf("\nNSF Loaded.\nFile information:\n");
FCEU_printf(" Name: %s\n Artist: %s\n Copyright: %s\n\n",NSFHeader.SongName,NSFHeader.Artist,NSFHeader.Copyright);
if(NSFHeader.SoundChip)
{

View File

@ -345,6 +345,8 @@ void FCEU_DispMessageOnMovie(char *format, ...)
guiMessage.howlong = 180;
guiMessage.isMovieMessage = true;
if (FCEUI_AviIsRecording() && FCEUI_AviDisableMovieMessages())
guiMessage.howlong = 0;
}
void FCEU_DispMessage(char *format, ...)
@ -358,6 +360,7 @@ void FCEU_DispMessage(char *format, ...)
guiMessage.howlong = 180;
guiMessage.isMovieMessage = false;
//adelikat: Pretty sure this code fails, Movie playback stopped is done with FCEU_DispMessageOnMovie()
#ifdef CREATE_AVI
if(LoggingEnabled == 2)
{