parent
f4535346fb
commit
a501682e0f
|
@ -83,7 +83,7 @@
|
||||||
#endif
|
#endif
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define _MSVC_BUILD "debug"
|
#define _MSVC_BUILD "debug"
|
||||||
#else
|
#else
|
||||||
#define _MSVC_BUILD "release"
|
#define _MSVC_BUILD "release"
|
||||||
#endif
|
#endif
|
||||||
#define __COMPILER__STRING__ "msvc " _Py_STRINGIZE(_MSC_VER) " " _MSVC_ARCH " " _MSVC_BUILD
|
#define __COMPILER__STRING__ "msvc " _Py_STRINGIZE(_MSC_VER) " " _MSVC_ARCH " " _MSVC_BUILD
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define _GCC_BUILD "debug"
|
#define _GCC_BUILD "debug"
|
||||||
#else
|
#else
|
||||||
#define _GCC_BUILD "release"
|
#define _GCC_BUILD "release"
|
||||||
#endif
|
#endif
|
||||||
#define __COMPILER__STRING__ "gcc " __VERSION__ " " _GCC_BUILD
|
#define __COMPILER__STRING__ "gcc " __VERSION__ " " _GCC_BUILD
|
||||||
|
@ -361,7 +361,7 @@ int BlockingCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateRendBounds()
|
void UpdateRendBounds()
|
||||||
{
|
{
|
||||||
FCEUI_SetRenderedLines(srendlinen, erendlinen, srendlinep, erendlinep);
|
FCEUI_SetRenderedLines(srendlinen, erendlinen, srendlinep, erendlinep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,14 +370,14 @@ void UpdateRendBounds()
|
||||||
void FCEUD_PrintError(const char *errormsg)
|
void FCEUD_PrintError(const char *errormsg)
|
||||||
{
|
{
|
||||||
AddLogText(errormsg, 1);
|
AddLogText(errormsg, 1);
|
||||||
|
|
||||||
if(fullscreen)
|
if(fullscreen)
|
||||||
{
|
{
|
||||||
ShowCursorAbs(1);
|
ShowCursorAbs(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox(0, errormsg, FCEU_NAME" Error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
|
MessageBox(0, errormsg, FCEU_NAME" Error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
|
||||||
|
|
||||||
if(fullscreen)
|
if(fullscreen)
|
||||||
{
|
{
|
||||||
ShowCursorAbs(0);
|
ShowCursorAbs(0);
|
||||||
|
@ -403,7 +403,7 @@ void DoFCEUExit()
|
||||||
if(exiting) //Eh, oops. I'll need to try to fix this later.
|
if(exiting) //Eh, oops. I'll need to try to fix this later.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CloseMemoryWatch() && AskSave()) //If user was asked to save changes in the memory watch dialog or ram watch, and chose cancel, don't close FCEUX!
|
if (CloseMemoryWatch() && AskSave()) //If user was asked to save changes in the memory watch dialog or ram watch, and chose cancel, don't close FCEUX!
|
||||||
{
|
{
|
||||||
if(goptions & GOO_CONFIRMEXIT)
|
if(goptions & GOO_CONFIRMEXIT)
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,7 @@ int DriverInitialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DriverKill(void)
|
static void DriverKill(void)
|
||||||
{
|
{
|
||||||
// Save config file
|
// Save config file
|
||||||
//sprintf(TempArray, "%s/fceux.cfg", BaseDirectory.c_str());
|
//sprintf(TempArray, "%s/fceux.cfg", BaseDirectory.c_str());
|
||||||
sprintf(TempArray, "%s/%s", BaseDirectory.c_str(),cfgFile.c_str());
|
sprintf(TempArray, "%s/%s", BaseDirectory.c_str(),cfgFile.c_str());
|
||||||
|
@ -501,53 +501,52 @@ HANDLE mapRAM;
|
||||||
void win_AllocBuffers(uint8 **GameMemBlock, uint8 **RAM)
|
void win_AllocBuffers(uint8 **GameMemBlock, uint8 **RAM)
|
||||||
{
|
{
|
||||||
mapGameMemBlock = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, 131072,"fceu.GameMemBlock");
|
mapGameMemBlock = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, 131072,"fceu.GameMemBlock");
|
||||||
|
|
||||||
if(mapGameMemBlock == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
if(mapGameMemBlock == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
{
|
|
||||||
//mbg 7/28/06 - is this the proper error handling?
|
|
||||||
//do we need to indicate to user somehow that this failed in this emu instance?
|
|
||||||
CloseHandle(mapGameMemBlock);
|
|
||||||
|
|
||||||
mapGameMemBlock = NULL;
|
|
||||||
*GameMemBlock = (uint8 *) malloc(131072);
|
*GameMemBlock = (uint8 *) malloc(131072);
|
||||||
|
else
|
||||||
|
if((*GameMemBlock = (uint8 *)MapViewOfFile(mapGameMemBlock, FILE_MAP_WRITE, 0, 0, 0)) == NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(mapGameMemBlock);
|
||||||
|
mapGameMemBlock = NULL;
|
||||||
|
*GameMemBlock = (uint8 *) malloc(131072);
|
||||||
|
}
|
||||||
|
mapRAM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, 0x800,"fceu.RAM");
|
||||||
|
if(mapRAM == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
*RAM = (uint8 *) malloc(2048);
|
*RAM = (uint8 *) malloc(2048);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*GameMemBlock = (uint8 *)MapViewOfFile(mapGameMemBlock, FILE_MAP_WRITE, 0, 0, 0);
|
if((*RAM = (uint8 *)MapViewOfFile(mapRAM, FILE_MAP_WRITE, 0, 0, 0)) == NULL)
|
||||||
|
{
|
||||||
// set up shared memory mappings
|
CloseHandle(mapRAM);
|
||||||
mapRAM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, 0x800,"fceu.RAM");
|
mapRAM = NULL;
|
||||||
*RAM = (uint8 *)MapViewOfFile(mapRAM, FILE_MAP_WRITE, 0, 0, 0);
|
*RAM = (uint8 *) malloc(2048);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void win_FreeBuffers(uint8 *GameMemBlock, uint8 *RAM)
|
void win_FreeBuffers(uint8 *GameMemBlock, uint8 *RAM)
|
||||||
{
|
{
|
||||||
//clean up shared memory
|
//clean up shared memory
|
||||||
if(mapRAM)
|
if(mapRAM)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapRAM);
|
|
||||||
CloseHandle(mapRAM);
|
CloseHandle(mapRAM);
|
||||||
RAM = NULL;
|
mapRAM = NULL;
|
||||||
|
CloseHandle(RAM);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
free(RAM);
|
free(RAM);
|
||||||
RAM = NULL;
|
RAM = NULL;
|
||||||
}
|
|
||||||
if(mapGameMemBlock)
|
if(mapGameMemBlock)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapGameMemBlock);
|
|
||||||
CloseHandle(mapGameMemBlock);
|
CloseHandle(mapGameMemBlock);
|
||||||
GameMemBlock = NULL;
|
mapGameMemBlock = NULL;
|
||||||
|
CloseHandle(GameMemBlock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
free(GameMemBlock);
|
free(GameMemBlock);
|
||||||
GameMemBlock = NULL;
|
GameMemBlock = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -617,7 +616,7 @@ static BOOL CALLBACK EnumCallbackFCEUXInstantiated(HWND hWnd, LPARAM lParam)
|
||||||
PassedTest = (PassedTest & ((buf[8] >= '1') & (buf[8] <= '9')));
|
PassedTest = (PassedTest & ((buf[8] >= '1') & (buf[8] <= '9')));
|
||||||
PassedTest = (PassedTest & (buf[9] == '.'));
|
PassedTest = (PassedTest & (buf[9] == '.'));
|
||||||
PassedTest = (PassedTest & ((buf[10] >= '4') & (buf[10] <= '9')));
|
PassedTest = (PassedTest & ((buf[10] >= '4') & (buf[10] <= '9')));
|
||||||
|
|
||||||
if (PassedTest) {
|
if (PassedTest) {
|
||||||
DoInstantiatedExit=true;
|
DoInstantiatedExit=true;
|
||||||
DoInstantiatedExitWindow = hWnd;
|
DoInstantiatedExitWindow = hWnd;
|
||||||
|
@ -626,7 +625,7 @@ static BOOL CALLBACK EnumCallbackFCEUXInstantiated(HWND hWnd, LPARAM lParam)
|
||||||
|
|
||||||
//printf("[%03i] Found '%s'\n", ++WinCount, buf);
|
//printf("[%03i] Found '%s'\n", ++WinCount, buf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "x6502.h"
|
#include "x6502.h"
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
|
@ -660,10 +659,10 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
// Get the base directory
|
// Get the base directory
|
||||||
GetBaseDirectory();
|
GetBaseDirectory();
|
||||||
|
|
||||||
// Parse the commandline arguments
|
// Parse the commandline arguments
|
||||||
t = ParseArgies(argc, argv);
|
t = ParseArgies(argc, argv);
|
||||||
|
|
||||||
if (ConfigToLoad) cfgFile.assign(ConfigToLoad);
|
if (ConfigToLoad) cfgFile.assign(ConfigToLoad);
|
||||||
|
|
||||||
//initDirectories();
|
//initDirectories();
|
||||||
|
@ -698,7 +697,7 @@ int main(int argc,char *argv[])
|
||||||
FCEUI_SetNoiseVolume(soundNoisevol);
|
FCEUI_SetNoiseVolume(soundNoisevol);
|
||||||
FCEUI_SetPCMVolume(soundPCMvol);
|
FCEUI_SetPCMVolume(soundPCMvol);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Since a game doesn't have to be loaded before the GUI can be used, make
|
//Since a game doesn't have to be loaded before the GUI can be used, make
|
||||||
//sure the temporary input type variables are set.
|
//sure the temporary input type variables are set.
|
||||||
ParseGIInput(NULL);
|
ParseGIInput(NULL);
|
||||||
|
@ -706,7 +705,7 @@ int main(int argc,char *argv[])
|
||||||
// Initialize default directories
|
// Initialize default directories
|
||||||
CreateDirs();
|
CreateDirs();
|
||||||
SetDirs();
|
SetDirs();
|
||||||
|
|
||||||
DoVideoConfigFix();
|
DoVideoConfigFix();
|
||||||
DoTimingConfigFix();
|
DoTimingConfigFix();
|
||||||
|
|
||||||
|
@ -735,9 +734,9 @@ int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
COPYDATASTRUCT cData;
|
COPYDATASTRUCT cData;
|
||||||
DATA tData;
|
DATA tData;
|
||||||
|
|
||||||
sprintf(tData.strFilePath,"%s",t);
|
sprintf(tData.strFilePath,"%s",t);
|
||||||
|
|
||||||
cData.dwData = 1;
|
cData.dwData = 1;
|
||||||
cData.cbData = sizeof ( tData );
|
cData.cbData = sizeof ( tData );
|
||||||
cData.lpData = &tData;
|
cData.lpData = &tData;
|
||||||
|
@ -760,7 +759,7 @@ int main(int argc,char *argv[])
|
||||||
do_exit();
|
do_exit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitSpeedThrottle();
|
InitSpeedThrottle();
|
||||||
|
|
||||||
if(t)
|
if(t)
|
||||||
|
@ -774,7 +773,7 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
if(PaletteToLoad)
|
if(PaletteToLoad)
|
||||||
{
|
{
|
||||||
SetPalette(PaletteToLoad);
|
SetPalette(PaletteToLoad);
|
||||||
free(PaletteToLoad);
|
free(PaletteToLoad);
|
||||||
PaletteToLoad = NULL;
|
PaletteToLoad = NULL;
|
||||||
}
|
}
|
||||||
|
@ -802,7 +801,7 @@ int main(int argc,char *argv[])
|
||||||
free(LuaToLoad);
|
free(LuaToLoad);
|
||||||
LuaToLoad = NULL;
|
LuaToLoad = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initiates AVI capture mode, will set up proper settings, and close FCUEX once capturing is finished
|
//Initiates AVI capture mode, will set up proper settings, and close FCUEX once capturing is finished
|
||||||
if(AVICapture && AviToLoad) //Must be used in conjunction with AviToLoad
|
if(AVICapture && AviToLoad) //Must be used in conjunction with AviToLoad
|
||||||
{
|
{
|
||||||
|
@ -832,21 +831,21 @@ doloopy:
|
||||||
uint8 *gfx=0; ///contains framebuffer
|
uint8 *gfx=0; ///contains framebuffer
|
||||||
int32 *sound=0; ///contains sound data buffer
|
int32 *sound=0; ///contains sound data buffer
|
||||||
int32 ssize=0; ///contains sound samples count
|
int32 ssize=0; ///contains sound samples count
|
||||||
|
|
||||||
if (turbo)
|
if (turbo)
|
||||||
{
|
{
|
||||||
if (!frameSkipCounter)
|
if (!frameSkipCounter)
|
||||||
{
|
{
|
||||||
frameSkipCounter = frameSkipAmt;
|
frameSkipCounter = frameSkipAmt;
|
||||||
skippy = 0;
|
skippy = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frameSkipCounter--;
|
frameSkipCounter--;
|
||||||
if (muteTurbo) skippy = 2; //If mute turbo is on, we want to bypass sound too, so set it to 2
|
if (muteTurbo) skippy = 2; //If mute turbo is on, we want to bypass sound too, so set it to 2
|
||||||
else skippy = 1; //Else set it to 1 to just frameskip
|
else skippy = 1; //Else set it to 1 to just frameskip
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else skippy = 0;
|
else skippy = 0;
|
||||||
|
|
||||||
|
@ -873,7 +872,7 @@ doloopy:
|
||||||
FCEUI_Kill();
|
FCEUI_Kill();
|
||||||
|
|
||||||
delete debugSystem;
|
delete debugSystem;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,7 +895,7 @@ void _updateWindow()
|
||||||
|
|
||||||
void win_debuggerLoop()
|
void win_debuggerLoop()
|
||||||
{
|
{
|
||||||
//delay until something causes us to unpause.
|
//delay until something causes us to unpause.
|
||||||
//either a hotkey or a debugger command
|
//either a hotkey or a debugger command
|
||||||
while(FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
|
while(FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
|
||||||
{
|
{
|
||||||
|
@ -911,12 +910,12 @@ void win_debuggerLoop()
|
||||||
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
||||||
{
|
{
|
||||||
win_SoundSetScale(fps_scale); //If turboing and mute turbo is true, bypass this
|
win_SoundSetScale(fps_scale); //If turboing and mute turbo is true, bypass this
|
||||||
|
|
||||||
//write all the sound we generated.
|
//write all the sound we generated.
|
||||||
if(soundo && Buffer && Count && !(muteTurbo && turbo)) {
|
if(soundo && Buffer && Count && !(muteTurbo && turbo)) {
|
||||||
win_SoundWriteData(Buffer,Count); //If turboing and mute turbo is true, bypass this
|
win_SoundWriteData(Buffer,Count); //If turboing and mute turbo is true, bypass this
|
||||||
}
|
}
|
||||||
|
|
||||||
//blit the framebuffer
|
//blit the framebuffer
|
||||||
if(XBuf)
|
if(XBuf)
|
||||||
FCEUD_BlitScreen(XBuf);
|
FCEUD_BlitScreen(XBuf);
|
||||||
|
@ -934,10 +933,10 @@ void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
||||||
{
|
{
|
||||||
if(!soundo) throttle = false;
|
if(!soundo) throttle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(throttle) //if throttling is enabled..
|
if(throttle) //if throttling is enabled..
|
||||||
if(!turbo) //and turbo is disabled..
|
if(!turbo) //and turbo is disabled..
|
||||||
if(!FCEUI_EmulationPaused()
|
if(!FCEUI_EmulationPaused()
|
||||||
||JustFrameAdvanced
|
||JustFrameAdvanced
|
||||||
)
|
)
|
||||||
//then throttle
|
//then throttle
|
||||||
|
@ -970,7 +969,7 @@ void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
|
||||||
// FCEUI_Debugger().step = 1;
|
// FCEUI_Debugger().step = 1;
|
||||||
// FCEUD_DebugBreakpoint();
|
// FCEUD_DebugBreakpoint();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//make sure to update the input once per frame
|
//make sure to update the input once per frame
|
||||||
FCEUD_UpdateInput();
|
FCEUD_UpdateInput();
|
||||||
|
|
||||||
|
@ -1002,7 +1001,7 @@ static void FCEUD_MakePathDirs(const char *fname)
|
||||||
mkdir(path);
|
mkdir(path);
|
||||||
|
|
||||||
div = fptr + 1;
|
div = fptr + 1;
|
||||||
|
|
||||||
while(div[0] == '\\' || div[0] == '/')
|
while(div[0] == '\\' || div[0] == '/')
|
||||||
{
|
{
|
||||||
div++;
|
div++;
|
||||||
|
|
|
@ -231,7 +231,7 @@ static int InitBPPStuff(int fs)
|
||||||
|
|
||||||
int SetVideoMode(int fs)
|
int SetVideoMode(int fs)
|
||||||
{
|
{
|
||||||
int specmul; // Special scaler size multiplier
|
int specmul = 1; // Special scaler size multiplier
|
||||||
|
|
||||||
|
|
||||||
if(fs)
|
if(fs)
|
||||||
|
|
|
@ -342,7 +342,8 @@ static void AllocBuffers()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreeBuffers() {
|
static void FreeBuffers()
|
||||||
|
{
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
void win_FreeBuffers(uint8 *GameMemBlock, uint8 *RAM);
|
void win_FreeBuffers(uint8 *GameMemBlock, uint8 *RAM);
|
||||||
win_FreeBuffers(GameMemBlock, RAM);
|
win_FreeBuffers(GameMemBlock, RAM);
|
||||||
|
|
129
src/ines.cpp
129
src/ines.cpp
|
@ -50,13 +50,13 @@ extern SFORMAT FCEUVSUNI_STATEINFO[];
|
||||||
|
|
||||||
//mbg merge 6/29/06 - these need to be global
|
//mbg merge 6/29/06 - these need to be global
|
||||||
uint8 *trainerpoo=0;
|
uint8 *trainerpoo=0;
|
||||||
uint8 *ROM=NULL;
|
uint8 *ROM = NULL;
|
||||||
uint8 *VROM=NULL;
|
uint8 *VROM = NULL;
|
||||||
iNES_HEADER head ;
|
iNES_HEADER head ;
|
||||||
|
|
||||||
|
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
HANDLE mapROM, mapVROM;
|
HANDLE mapROM = NULL, mapVROM = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static CartInfo iNESCart;
|
static CartInfo iNESCart;
|
||||||
|
@ -127,36 +127,32 @@ void iNESGI(GI h) //bbit edited: removed static keyword
|
||||||
if(iNESCart.Close) iNESCart.Close();
|
if(iNESCart.Close) iNESCart.Close();
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
if(ROM)
|
if(ROM)
|
||||||
{
|
{
|
||||||
if(mapROM)
|
if(mapROM)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapROM);
|
|
||||||
CloseHandle(mapROM);
|
CloseHandle(mapROM);
|
||||||
ROM=0;
|
mapROM = NULL;
|
||||||
|
UnmapViewOfFile(ROM);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
free(ROM);
|
free(ROM);
|
||||||
ROM = NULL;
|
ROM = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(VROM)
|
if(VROM)
|
||||||
{
|
{
|
||||||
if(mapVROM)
|
if(mapVROM)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapVROM);
|
|
||||||
CloseHandle(mapVROM);
|
CloseHandle(mapVROM);
|
||||||
VROM=0;
|
mapVROM = NULL;
|
||||||
|
UnmapViewOfFile(VROM);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
free(VROM);
|
free(VROM);
|
||||||
VROM = NULL;
|
VROM = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if(ROM) {free(ROM);ROM=0;}
|
if(ROM) {free(ROM); ROM = NULL;}
|
||||||
if(VROM) {free(VROM);VROM=0;}
|
if(VROM) {free(VROM); VROM = NULL;}
|
||||||
#endif
|
#endif
|
||||||
if(MapClose) MapClose();
|
if(MapClose) MapClose();
|
||||||
if(trainerpoo) {FCEU_gfree(trainerpoo);trainerpoo=0;}
|
if(trainerpoo) {FCEU_gfree(trainerpoo);trainerpoo=0;}
|
||||||
|
@ -389,7 +385,7 @@ static void CheckHInfo(void)
|
||||||
0x1b084107d0878bd0LL, /* Startropics 2*/
|
0x1b084107d0878bd0LL, /* Startropics 2*/
|
||||||
|
|
||||||
0x836c0ff4f3e06e45LL, /* Zelda 2 */
|
0x836c0ff4f3e06e45LL, /* Zelda 2 */
|
||||||
|
|
||||||
0x82000965f04a71bbLL, /* Mirai Shinwa Jarvas */
|
0x82000965f04a71bbLL, /* Mirai Shinwa Jarvas */
|
||||||
|
|
||||||
0 /* Abandon all hope if the game has 0 in the lower 64-bits of its MD5 hash */
|
0 /* Abandon all hope if the game has 0 in the lower 64-bits of its MD5 hash */
|
||||||
|
@ -424,8 +420,9 @@ static void CheckHInfo(void)
|
||||||
#ifdef _USE_SHARED_MEMORY_
|
#ifdef _USE_SHARED_MEMORY_
|
||||||
if(mapVROM)
|
if(mapVROM)
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapVROM);
|
|
||||||
CloseHandle(mapVROM);
|
CloseHandle(mapVROM);
|
||||||
|
UnmapViewOfFile(VROM);
|
||||||
|
mapVROM = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -434,7 +431,7 @@ static void CheckHInfo(void)
|
||||||
#else
|
#else
|
||||||
free(VROM);
|
free(VROM);
|
||||||
#endif
|
#endif
|
||||||
VROM=0;
|
VROM = NULL;
|
||||||
tofix|=8;
|
tofix|=8;
|
||||||
}
|
}
|
||||||
if(MapperNo!=(moo[x].mapper&0xFF))
|
if(MapperNo!=(moo[x].mapper&0xFF))
|
||||||
|
@ -740,48 +737,67 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
mapROM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, ROM_size<<14,"fceu.ROM");
|
mapROM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, ROM_size<<14,"fceu.ROM");
|
||||||
if(mapROM == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
if(mapROM == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
{
|
{
|
||||||
mapROM = NULL;
|
if((ROM = (uint8 *)FCEU_malloc(ROM_size<<14)) == NULL) return 0;
|
||||||
CloseHandle(mapROM);
|
}
|
||||||
|
else
|
||||||
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
|
{
|
||||||
return 0;
|
if((ROM = (uint8 *)MapViewOfFile(mapROM, FILE_MAP_WRITE, 0, 0, 0)) == NULL)
|
||||||
|
|
||||||
if(VROM_size)
|
|
||||||
{
|
{
|
||||||
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
|
CloseHandle(mapROM);
|
||||||
|
mapROM = NULL;
|
||||||
|
if((ROM = (uint8 *)FCEU_malloc(ROM_size<<14)) == NULL) return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(VROM_size)
|
||||||
|
{
|
||||||
|
mapVROM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, VROM_size<<13,"fceu.VROM");
|
||||||
|
if(mapVROM == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
|
||||||
|
{
|
||||||
|
if((VROM=(uint8 *)FCEU_malloc(VROM_size<<13)) == NULL)
|
||||||
{
|
{
|
||||||
free(ROM);
|
if(mapROM)
|
||||||
|
{
|
||||||
|
UnmapViewOfFile(mapROM);
|
||||||
|
mapROM = NULL;
|
||||||
|
CloseHandle(ROM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
free(ROM);
|
||||||
ROM = NULL;
|
ROM = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
ROM = (uint8 *)MapViewOfFile(mapROM, FILE_MAP_WRITE, 0, 0, 0);
|
|
||||||
if( !ROM ) return 0;
|
|
||||||
|
|
||||||
if(VROM_size)
|
|
||||||
{
|
{
|
||||||
mapVROM = CreateFileMapping((HANDLE)0xFFFFFFFF,NULL,PAGE_READWRITE, 0, VROM_size<<13,"fceu.VROM");
|
if((VROM = (uint8 *)MapViewOfFile(mapVROM, FILE_MAP_WRITE, 0, 0, 0)) == NULL)
|
||||||
VROM = (uint8 *)MapViewOfFile(mapVROM, FILE_MAP_WRITE, 0, 0, 0);
|
|
||||||
if( !VROM )
|
|
||||||
{
|
{
|
||||||
UnmapViewOfFile(mapROM);
|
CloseHandle(mapVROM);
|
||||||
CloseHandle(mapROM);
|
mapVROM = NULL;
|
||||||
return 0;
|
if((VROM=(uint8 *)FCEU_malloc(VROM_size<<13)) == NULL)
|
||||||
|
{
|
||||||
|
if(mapROM)
|
||||||
|
{
|
||||||
|
UnmapViewOfFile(mapROM);
|
||||||
|
mapROM = NULL;
|
||||||
|
CloseHandle(ROM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
free(ROM);
|
||||||
|
ROM = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(!(ROM=(uint8 *)FCEU_malloc(ROM_size<<14)))
|
if((ROM = (uint8 *)FCEU_malloc(ROM_size<<14)) == NULL) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if(VROM_size)
|
if(VROM_size)
|
||||||
{
|
{
|
||||||
if(!(VROM=(uint8 *)FCEU_malloc(VROM_size<<13)))
|
if((VROM = (uint8 *)FCEU_malloc(VROM_size<<13)) == NULL)
|
||||||
{
|
{
|
||||||
free(ROM);
|
free(ROM);
|
||||||
|
ROM = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -890,7 +906,7 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode)
|
||||||
FCEU_LoadGameSave(&iNESCart);
|
FCEU_LoadGameSave(&iNESCart);
|
||||||
|
|
||||||
strcpy(LoadedRomFName,name); //bbit edited: line added
|
strcpy(LoadedRomFName,name); //bbit edited: line added
|
||||||
|
|
||||||
// Extract Filename only. Should account for Windows/Unix this way.
|
// Extract Filename only. Should account for Windows/Unix this way.
|
||||||
if (strrchr(name, '/')) {
|
if (strrchr(name, '/')) {
|
||||||
name = strrchr(name, '/') + 1;
|
name = strrchr(name, '/') + 1;
|
||||||
|
@ -1465,7 +1481,7 @@ static int NewiNES_Init(int num)
|
||||||
|
|
||||||
if(GameInfo->type == GIT_VSUNI)
|
if(GameInfo->type == GIT_VSUNI)
|
||||||
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
AddExState(FCEUVSUNI_STATEINFO, ~0, 0, 0);
|
||||||
|
|
||||||
while(tmp->init)
|
while(tmp->init)
|
||||||
{
|
{
|
||||||
if(num==tmp->number)
|
if(num==tmp->number)
|
||||||
|
@ -1488,14 +1504,19 @@ static int NewiNES_Init(int num)
|
||||||
{
|
{
|
||||||
CloseHandle(mapVROM);
|
CloseHandle(mapVROM);
|
||||||
mapVROM = NULL;
|
mapVROM = NULL;
|
||||||
VROM=(uint8 *)malloc(CHRRAMSize);
|
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VROM = (uint8 *)MapViewOfFile(mapVROM, FILE_MAP_WRITE, 0, 0, 0);
|
if((VROM = (uint8 *)MapViewOfFile(mapVROM, FILE_MAP_WRITE, 0, 0, 0)) == NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(mapVROM);
|
||||||
|
mapVROM = NULL;
|
||||||
|
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
VROM=(uint8 *)malloc(CHRRAMSize);
|
if((VROM = (uint8 *)malloc(CHRRAMSize)) == NULL) return 0;
|
||||||
#endif
|
#endif
|
||||||
UNIFchrrama=VROM;
|
UNIFchrrama=VROM;
|
||||||
SetupCartCHRMapping(0,VROM,CHRRAMSize,1);
|
SetupCartCHRMapping(0,VROM,CHRRAMSize,1);
|
||||||
|
@ -1504,9 +1525,9 @@ static int NewiNES_Init(int num)
|
||||||
if(head.ROM_type&8)
|
if(head.ROM_type&8)
|
||||||
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
|
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
|
||||||
tmp->init(&iNESCart);
|
tmp->init(&iNESCart);
|
||||||
return(1);
|
return 1;
|
||||||
}
|
}
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
return(0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ static DECLFW(Mapper25_write)
|
||||||
VROM_BANK1(0x0000,0xFC);
|
VROM_BANK1(0x0000,0xFC);
|
||||||
VROM_BANK1(0x0400,0xFD);
|
VROM_BANK1(0x0400,0xFD);
|
||||||
VROM_BANK1(0x0800,0xFF);
|
VROM_BANK1(0x0800,0xFF);
|
||||||
|
VROM_BANK1(0x0c00,0xCF);
|
||||||
}
|
}
|
||||||
|
|
||||||
A=(A&0xF003)|((A&0xC)>>2);
|
A=(A&0xF003)|((A&0xC)>>2);
|
||||||
|
|
Loading…
Reference in New Issue