merge [2051,2071] from trunk
This commit is contained in:
parent
da6f115c20
commit
52735a0822
81
src/GPU.cpp
81
src/GPU.cpp
|
@ -3127,7 +3127,9 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
||||||
//SPP level 3-8 rotoscale room
|
//SPP level 3-8 rotoscale room
|
||||||
//NSMB raster fx backdrops
|
//NSMB raster fx backdrops
|
||||||
//bubble bobble revolution classic mode
|
//bubble bobble revolution classic mode
|
||||||
gpu->refreshAffineStartRegs();
|
//NOTE:
|
||||||
|
//I am REALLY unsatisfied with this logic now. But it seems to be working..
|
||||||
|
gpu->refreshAffineStartRegs(-1,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
|
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
|
||||||
|
@ -3212,7 +3214,7 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
|
||||||
void gpu_savestate(std::ostream* os)
|
void gpu_savestate(std::ostream* os)
|
||||||
{
|
{
|
||||||
//version
|
//version
|
||||||
write32le(0,os);
|
write32le(1,os);
|
||||||
|
|
||||||
os->write((char*)GPU_screen,sizeof(GPU_screen));
|
os->write((char*)GPU_screen,sizeof(GPU_screen));
|
||||||
|
|
||||||
|
@ -3230,21 +3232,37 @@ bool gpu_loadstate(std::istream* is, int size)
|
||||||
{
|
{
|
||||||
//read version
|
//read version
|
||||||
int version;
|
int version;
|
||||||
if(read32le(&version,is) != 1) return false;
|
|
||||||
if(version != 0) return false;
|
//sigh.. shouldve used a new version number
|
||||||
|
if(size == 256*192*2*2)
|
||||||
|
version = 0;
|
||||||
|
else if(size== 0x30024)
|
||||||
|
{
|
||||||
|
read32le(&version,is);
|
||||||
|
version = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(read32le(&version,is) != 1) return false;
|
||||||
|
|
||||||
|
|
||||||
|
if(version<0||version>1) return false;
|
||||||
|
|
||||||
is->read((char*)GPU_screen,sizeof(GPU_screen));
|
is->read((char*)GPU_screen,sizeof(GPU_screen));
|
||||||
read32le(&MainScreen.gpu->affineInfo[0].x,is);
|
|
||||||
read32le(&MainScreen.gpu->affineInfo[0].y,is);
|
|
||||||
read32le(&MainScreen.gpu->affineInfo[1].x,is);
|
|
||||||
read32le(&MainScreen.gpu->affineInfo[1].y,is);
|
|
||||||
read32le(&SubScreen.gpu->affineInfo[0].x,is);
|
|
||||||
read32le(&SubScreen.gpu->affineInfo[0].y,is);
|
|
||||||
read32le(&SubScreen.gpu->affineInfo[1].x,is);
|
|
||||||
read32le(&SubScreen.gpu->affineInfo[1].y,is);
|
|
||||||
|
|
||||||
MainScreen.gpu->refreshAffineStartRegs();
|
if(version==1)
|
||||||
SubScreen.gpu->refreshAffineStartRegs();
|
{
|
||||||
|
read32le(&MainScreen.gpu->affineInfo[0].x,is);
|
||||||
|
read32le(&MainScreen.gpu->affineInfo[0].y,is);
|
||||||
|
read32le(&MainScreen.gpu->affineInfo[1].x,is);
|
||||||
|
read32le(&MainScreen.gpu->affineInfo[1].y,is);
|
||||||
|
read32le(&SubScreen.gpu->affineInfo[0].x,is);
|
||||||
|
read32le(&SubScreen.gpu->affineInfo[0].y,is);
|
||||||
|
read32le(&SubScreen.gpu->affineInfo[1].x,is);
|
||||||
|
read32le(&SubScreen.gpu->affineInfo[1].y,is);
|
||||||
|
MainScreen.gpu->refreshAffineStartRegs(-1,-1);
|
||||||
|
SubScreen.gpu->refreshAffineStartRegs(-1,-1);
|
||||||
|
}
|
||||||
|
|
||||||
MainScreen.gpu->updateBLDALPHA();
|
MainScreen.gpu->updateBLDALPHA();
|
||||||
SubScreen.gpu->updateBLDALPHA();
|
SubScreen.gpu->updateBLDALPHA();
|
||||||
return !is->fail();
|
return !is->fail();
|
||||||
|
@ -3268,22 +3286,35 @@ void GPU::setAffineStart(int layer, int xy, u32 val)
|
||||||
{
|
{
|
||||||
if(xy==0) affineInfo[layer-2].x = val;
|
if(xy==0) affineInfo[layer-2].x = val;
|
||||||
else affineInfo[layer-2].y = val;
|
else affineInfo[layer-2].y = val;
|
||||||
refreshAffineStartRegs();
|
refreshAffineStartRegs(layer,xy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU::refreshAffineStartRegs()
|
void GPU::refreshAffineStartRegs(const int num, const int xy)
|
||||||
{
|
{
|
||||||
for(int num=2;num<=3;num++)
|
if(num==-1)
|
||||||
{
|
{
|
||||||
BGxPARMS * parms;
|
refreshAffineStartRegs(2,xy);
|
||||||
if (num==2)
|
refreshAffineStartRegs(3,xy);
|
||||||
parms = &(dispx_st)->dispx_BG2PARMS;
|
return;
|
||||||
else
|
|
||||||
parms = &(dispx_st)->dispx_BG3PARMS;
|
|
||||||
|
|
||||||
parms->BGxX = affineInfo[num-2].x;
|
|
||||||
parms->BGxY = affineInfo[num-2].y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xy==-1)
|
||||||
|
{
|
||||||
|
refreshAffineStartRegs(num,0);
|
||||||
|
refreshAffineStartRegs(num,1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BGxPARMS * parms;
|
||||||
|
if (num==2)
|
||||||
|
parms = &(dispx_st)->dispx_BG2PARMS;
|
||||||
|
else
|
||||||
|
parms = &(dispx_st)->dispx_BG3PARMS;
|
||||||
|
|
||||||
|
if(xy==0)
|
||||||
|
parms->BGxX = affineInfo[num-2].x;
|
||||||
|
else
|
||||||
|
parms->BGxY = affineInfo[num-2].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpu_UpdateRender()
|
void gpu_UpdateRender()
|
||||||
|
|
|
@ -775,7 +775,7 @@ struct GPU
|
||||||
void setAffineStart(int layer, int xy, u32 val);
|
void setAffineStart(int layer, int xy, u32 val);
|
||||||
void setAffineStartWord(int layer, int xy, u16 val, int word);
|
void setAffineStartWord(int layer, int xy, u16 val, int word);
|
||||||
u32 getAffineStart(int layer, int xy);
|
u32 getAffineStart(int layer, int xy);
|
||||||
void refreshAffineStartRegs();
|
void refreshAffineStartRegs(const int num, const int xy);
|
||||||
|
|
||||||
struct AffineInfo {
|
struct AffineInfo {
|
||||||
AffineInfo() : x(0), y(0) {}
|
AffineInfo() : x(0), y(0) {}
|
||||||
|
|
|
@ -845,7 +845,10 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovieSRAM(int bmtype, u32 bmsize) {
|
void MovieSRAM()
|
||||||
|
{
|
||||||
|
int bmtype = MMU.bupmem.type;
|
||||||
|
u32 bmsize = MMU.bupmem.size;
|
||||||
|
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
|
|
||||||
|
@ -859,7 +862,6 @@ void MovieSRAM(int bmtype, u32 bmsize) {
|
||||||
|
|
||||||
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
mc_realloc(&MMU.bupmem, bmtype, bmsize);
|
||||||
mc_load_file(&MMU.bupmem, buf);
|
mc_load_file(&MMU.bupmem, buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_FreeROM(void)
|
void NDS_FreeROM(void)
|
||||||
|
@ -882,6 +884,12 @@ void NDS_Reset( void)
|
||||||
|
|
||||||
if (!header) return ;
|
if (!header) return ;
|
||||||
|
|
||||||
|
if (MMU.bupmem.fp)
|
||||||
|
{
|
||||||
|
fclose(MMU.bupmem.fp);
|
||||||
|
MMU.bupmem.fp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
lagframecounter=0;
|
lagframecounter=0;
|
||||||
LagFrameFlag=0;
|
LagFrameFlag=0;
|
||||||
lastLag=0;
|
lastLag=0;
|
||||||
|
|
|
@ -385,6 +385,7 @@ public:
|
||||||
virtual BOOL WIFI_Host_InitSystem() { return FALSE; }
|
virtual BOOL WIFI_Host_InitSystem() { return FALSE; }
|
||||||
virtual void WIFI_Host_ShutdownSystem() {}
|
virtual void WIFI_Host_ShutdownSystem() {}
|
||||||
virtual BOOL AVI_IsRecording() { return FALSE; }
|
virtual BOOL AVI_IsRecording() { return FALSE; }
|
||||||
|
virtual void USR_InfoMessage(const char *message) { printf("%s\n", message); }
|
||||||
};
|
};
|
||||||
extern Driver* driver;
|
extern Driver* driver;
|
||||||
|
|
||||||
|
@ -392,7 +393,7 @@ extern std::string InputDisplayString;
|
||||||
extern int LagFrameFlag;
|
extern int LagFrameFlag;
|
||||||
extern int lastLag, TotalLagFrames;
|
extern int lastLag, TotalLagFrames;
|
||||||
|
|
||||||
void MovieSRAM(int bmtype, u32 bmsize);
|
void MovieSRAM();
|
||||||
|
|
||||||
void ClearAutoHold(void);
|
void ClearAutoHold(void);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#include <AudioUnit/AudioUnit.h>
|
#include <AudioUnit/AudioUnit.h>
|
||||||
#include <AudioToolbox/AudioToolBox.h>
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
|
|
||||||
//desmume includes
|
//desmume includes
|
||||||
#define OBJ_C
|
#define OBJ_C
|
||||||
|
|
|
@ -292,8 +292,15 @@ void set_mouse_coord(signed long x,signed long y)
|
||||||
/* Update NDS keypad */
|
/* Update NDS keypad */
|
||||||
void update_keypad(u16 keys)
|
void update_keypad(u16 keys)
|
||||||
{
|
{
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
ARM9Mem.ARM9_REG[0x130] = ~keys & 0xFF;
|
||||||
|
ARM9Mem.ARM9_REG[0x131] = (~keys >> 8) & 0x3;
|
||||||
|
MMU.ARM7_REG[0x130] = ~keys & 0xFF;
|
||||||
|
MMU.ARM7_REG[0x131] = (~keys >> 8) & 0x3;
|
||||||
|
#else
|
||||||
((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] = ~keys & 0x3FF;
|
((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] = ~keys & 0x3FF;
|
||||||
((u16 *)MMU.ARM7_REG)[0x130>>1] = ~keys & 0x3FF;
|
((u16 *)MMU.ARM7_REG)[0x130>>1] = ~keys & 0x3FF;
|
||||||
|
#endif
|
||||||
/* Update X and Y buttons */
|
/* Update X and Y buttons */
|
||||||
MMU.ARM7_REG[0x136] = ( ~( keys >> 10) & 0x3 ) | (MMU.ARM7_REG[0x136] & ~0x3);
|
MMU.ARM7_REG[0x136] = ( ~( keys >> 10) & 0x3 ) | (MMU.ARM7_REG[0x136] & ~0x3);
|
||||||
}
|
}
|
||||||
|
@ -304,7 +311,11 @@ u16 get_keypad( void)
|
||||||
u16 keypad;
|
u16 keypad;
|
||||||
keypad = ~MMU.ARM7_REG[0x136];
|
keypad = ~MMU.ARM7_REG[0x136];
|
||||||
keypad = (keypad & 0x3) << 10;
|
keypad = (keypad & 0x3) << 10;
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
keypad |= ~(ARM9Mem.ARM9_REG[0x130] | (ARM9Mem.ARM9_REG[0x131] << 8)) & 0x3FF;
|
||||||
|
#else
|
||||||
keypad |= ~((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] & 0x3FF;
|
keypad |= ~((u16 *)ARM9Mem.ARM9_REG)[0x130>>1] & 0x3FF;
|
||||||
|
#endif
|
||||||
return keypad;
|
return keypad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
#include "armcpu.h"
|
#include "armcpu.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "gfx3d.h"
|
#include "gfx3d.h"
|
||||||
|
@ -2364,4 +2365,4 @@ bool gfx3d_loadstate(std::istream* is, int size)
|
||||||
gfx3d.vertlist->count=0;
|
gfx3d.vertlist->count=0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,7 @@ u8 *mc_alloc(memory_chip_t *mc, u32 size)
|
||||||
{
|
{
|
||||||
u8 *buffer;
|
u8 *buffer;
|
||||||
buffer = new u8[size];
|
buffer = new u8[size];
|
||||||
|
memset(buffer,0,size);
|
||||||
|
|
||||||
mc->data = buffer;
|
mc->data = buffer;
|
||||||
if(!buffer) { return NULL; }
|
if(!buffer) { return NULL; }
|
||||||
|
@ -199,9 +200,9 @@ void mc_reset_com(memory_chip_t *mc)
|
||||||
|
|
||||||
void mc_realloc(memory_chip_t *mc, int type, u32 size)
|
void mc_realloc(memory_chip_t *mc, int type, u32 size)
|
||||||
{
|
{
|
||||||
if(mc->data) delete[] mc->data;
|
if(mc->data) delete[] mc->data;
|
||||||
mc_init(mc, type);
|
mc_init(mc, type);
|
||||||
mc_alloc(mc, size);
|
mc_alloc(mc, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mc_load_file(memory_chip_t *mc, const char* filename)
|
void mc_load_file(memory_chip_t *mc, const char* filename)
|
||||||
|
@ -213,7 +214,7 @@ void mc_load_file(memory_chip_t *mc, const char* filename)
|
||||||
|
|
||||||
if(movieMode != MOVIEMODE_INACTIVE) {
|
if(movieMode != MOVIEMODE_INACTIVE) {
|
||||||
mc->filename = strdup(filename);
|
mc->filename = strdup(filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
file = fopen(filename, "rb+");
|
file = fopen(filename, "rb+");
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "main.h"
|
|
||||||
#include "utils/guid.h"
|
#include "utils/guid.h"
|
||||||
#include "utils/xstring.h"
|
#include "utils/xstring.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
|
@ -355,7 +354,7 @@ static void closeRecordingMovie()
|
||||||
/// Stop movie playback.
|
/// Stop movie playback.
|
||||||
static void StopPlayback()
|
static void StopPlayback()
|
||||||
{
|
{
|
||||||
SetMessageToDisplay("Movie playback stopped.");
|
driver->USR_InfoMessage("Movie playback stopped.");
|
||||||
movieMode = MOVIEMODE_INACTIVE;
|
movieMode = MOVIEMODE_INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +362,7 @@ static void StopPlayback()
|
||||||
/// Stop movie recording
|
/// Stop movie recording
|
||||||
static void StopRecording()
|
static void StopRecording()
|
||||||
{
|
{
|
||||||
SetMessageToDisplay("Movie recording stopped.");
|
driver->USR_InfoMessage("Movie recording stopped.");
|
||||||
movieMode = MOVIEMODE_INACTIVE;
|
movieMode = MOVIEMODE_INACTIVE;
|
||||||
|
|
||||||
closeRecordingMovie();
|
closeRecordingMovie();
|
||||||
|
@ -436,14 +435,14 @@ void FCEUI_LoadMovie(const char *fname, bool _read_only, bool tasedit, int _paus
|
||||||
movieMode = MOVIEMODE_PLAY;
|
movieMode = MOVIEMODE_PLAY;
|
||||||
currRerecordCount = currMovieData.rerecordCount;
|
currRerecordCount = currMovieData.rerecordCount;
|
||||||
InitMovieTime();
|
InitMovieTime();
|
||||||
MovieSRAM(backupmemorytype, backupmemorysize);
|
MovieSRAM();
|
||||||
freshMovie = true;
|
freshMovie = true;
|
||||||
ClearAutoHold();
|
ClearAutoHold();
|
||||||
|
|
||||||
if(movie_readonly)
|
if(movie_readonly)
|
||||||
SetMessageToDisplay("Replay started Read-Only.");
|
driver->USR_InfoMessage("Replay started Read-Only.");
|
||||||
else
|
else
|
||||||
SetMessageToDisplay("Replay started Read+Write.");
|
driver->USR_InfoMessage("Replay started Read+Write.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void openRecordingMovie(const char* fname)
|
static void openRecordingMovie(const char* fname)
|
||||||
|
@ -492,9 +491,9 @@ static void openRecordingMovie(const char* fname)
|
||||||
movie_readonly = false;
|
movie_readonly = false;
|
||||||
currRerecordCount = 0;
|
currRerecordCount = 0;
|
||||||
InitMovieTime();
|
InitMovieTime();
|
||||||
MovieSRAM(backupmemorytype, backupmemorysize);
|
MovieSRAM();
|
||||||
|
|
||||||
SetMessageToDisplay("Movie recording started.");
|
driver->USR_InfoMessage("Movie recording started.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NDS_setTouchFromMovie(void) {
|
void NDS_setTouchFromMovie(void) {
|
||||||
|
@ -609,6 +608,9 @@ static void FCEUMOV_AddCommand(int cmd)
|
||||||
//DoEncode((cmd>>3)&0x3,cmd&0x7,1);
|
//DoEncode((cmd>>3)&0x3,cmd&0x7,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//little endian 4-byte cookies
|
||||||
|
static const int kMOVI = 0x49564F4D;
|
||||||
|
static const int kNOMO = 0x4F4D4F4E;
|
||||||
|
|
||||||
void mov_savestate(std::ostream* os)
|
void mov_savestate(std::ostream* os)
|
||||||
{
|
{
|
||||||
|
@ -618,12 +620,12 @@ void mov_savestate(std::ostream* os)
|
||||||
//else return 0;
|
//else return 0;
|
||||||
if(movieMode == MOVIEMODE_RECORD || movieMode == MOVIEMODE_PLAY)
|
if(movieMode == MOVIEMODE_RECORD || movieMode == MOVIEMODE_PLAY)
|
||||||
{
|
{
|
||||||
write32le('MOVI',os);
|
write32le(kMOVI,os);
|
||||||
currMovieData.dump(os, true);
|
currMovieData.dump(os, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write32le('NOMO',os);
|
write32le(kNOMO,os);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,9 +639,9 @@ bool mov_loadstate(std::istream* is, int size)
|
||||||
|
|
||||||
int cookie;
|
int cookie;
|
||||||
if(read32le(&cookie,is) != 1) return false;
|
if(read32le(&cookie,is) != 1) return false;
|
||||||
if(cookie == 'NOMO')
|
if(cookie == kNOMO)
|
||||||
return true;
|
return true;
|
||||||
else if(cookie != 'MOVI')
|
else if(cookie != kMOVI)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
size -= 4;
|
size -= 4;
|
||||||
|
@ -851,7 +853,7 @@ void LoadFM2_binarychunk(MovieData& movieData, std::istream* fp, int size)
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
bool CheckFileExists(const char* filename)
|
static bool CheckFileExists(const char* filename)
|
||||||
{
|
{
|
||||||
//This function simply checks to see if the given filename exists
|
//This function simply checks to see if the given filename exists
|
||||||
string checkFilename;
|
string checkFilename;
|
||||||
|
|
|
@ -1145,6 +1145,7 @@ static void SoftRastRender()
|
||||||
{
|
{
|
||||||
Fragment clearFragment;
|
Fragment clearFragment;
|
||||||
FragmentColor clearFragmentColor;
|
FragmentColor clearFragmentColor;
|
||||||
|
clearFragment.pad = 0;
|
||||||
clearFragmentColor.r = gfx3d.clearColor&0x1F;
|
clearFragmentColor.r = gfx3d.clearColor&0x1F;
|
||||||
clearFragmentColor.g = (gfx3d.clearColor>>5)&0x1F;
|
clearFragmentColor.g = (gfx3d.clearColor>>5)&0x1F;
|
||||||
clearFragmentColor.b = (gfx3d.clearColor>>10)&0x1F;
|
clearFragmentColor.b = (gfx3d.clearColor>>10)&0x1F;
|
||||||
|
|
|
@ -37,7 +37,9 @@
|
||||||
#include "readwrite.h"
|
#include "readwrite.h"
|
||||||
#include "gfx3d.h"
|
#include "gfx3d.h"
|
||||||
#include "movie.h"
|
#include "movie.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
#include "windows/main.h"
|
#include "windows/main.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//void*v is actually a void** which will be indirected before reading
|
//void*v is actually a void** which will be indirected before reading
|
||||||
|
@ -49,6 +51,9 @@ savestates_t savestates[NB_STATES];
|
||||||
#define SAVESTATE_VERSION 11
|
#define SAVESTATE_VERSION 11
|
||||||
static const char* magic = "DeSmuME SState\0";
|
static const char* magic = "DeSmuME SState\0";
|
||||||
|
|
||||||
|
//a savestate chunk loader can set this if it wants to permit a silent failure (for compatibility)
|
||||||
|
static bool SAV_silent_fail_flag;
|
||||||
|
|
||||||
#ifndef MAX_PATH
|
#ifndef MAX_PATH
|
||||||
#define MAX_PATH 256
|
#define MAX_PATH 256
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +150,9 @@ SFORMAT SF_MEM[]={
|
||||||
|
|
||||||
{ "VMEM", 1, sizeof(ARM9Mem.ARM9_VMEM), ARM9Mem.ARM9_VMEM},
|
{ "VMEM", 1, sizeof(ARM9Mem.ARM9_VMEM), ARM9Mem.ARM9_VMEM},
|
||||||
{ "OAMS", 1, sizeof(ARM9Mem.ARM9_OAM), ARM9Mem.ARM9_OAM},
|
{ "OAMS", 1, sizeof(ARM9Mem.ARM9_OAM), ARM9Mem.ARM9_OAM},
|
||||||
{ "LCDM", 1, sizeof(ARM9Mem.ARM9_LCD), ARM9Mem.ARM9_LCD},
|
|
||||||
|
//this size is specially chosen to avoid saving the blank space at the end
|
||||||
|
{ "LCDM", 1, 0xA4000, ARM9Mem.ARM9_LCD},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,7 +255,7 @@ SFORMAT SF_MOVIE[]={
|
||||||
static void mmu_savestate(std::ostream* os)
|
static void mmu_savestate(std::ostream* os)
|
||||||
{
|
{
|
||||||
//version
|
//version
|
||||||
write32le(0,os);
|
write32le(1,os);
|
||||||
|
|
||||||
write32le(MMU.bupmem.type,os);
|
write32le(MMU.bupmem.type,os);
|
||||||
write32le(MMU.bupmem.size,os);
|
write32le(MMU.bupmem.size,os);
|
||||||
|
@ -260,14 +267,27 @@ static bool mmu_loadstate(std::istream* is, int size)
|
||||||
//read version
|
//read version
|
||||||
int version;
|
int version;
|
||||||
if(read32le(&version,is) != 1) return false;
|
if(read32le(&version,is) != 1) return false;
|
||||||
if(version != 0) return false;
|
|
||||||
|
|
||||||
int bupmem_type;
|
|
||||||
u32 bupmem_size;
|
|
||||||
if(read32le(&bupmem_type,is) != 1) return false;
|
|
||||||
if(read32le(&bupmem_size,is) != 1) return false;
|
|
||||||
|
|
||||||
mc_realloc(&MMU.bupmem,bupmem_type,bupmem_size);
|
|
||||||
|
u32 bupmem_size;
|
||||||
|
|
||||||
|
if(version == 0)
|
||||||
|
{
|
||||||
|
//version 0 was buggy and didnt save the type.
|
||||||
|
//it would silently fail if there was a size mismatch
|
||||||
|
SAV_silent_fail_flag = true;
|
||||||
|
if(read32le(&bupmem_size,is) != 1) return false;
|
||||||
|
//if(bupmem_size != MMU.bupmem.size) return false; //mismatch between current initialized and saved size
|
||||||
|
mc_realloc(&MMU.bupmem,MC_TYPE_AUTODETECT,bupmem_size);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//version 1 reinitializes the save system with the type that was saved
|
||||||
|
int bupmem_type;
|
||||||
|
if(read32le(&bupmem_type,is) != 1) return false;
|
||||||
|
if(read32le(&bupmem_size,is) != 1) return false;
|
||||||
|
mc_realloc(&MMU.bupmem,bupmem_type,bupmem_size);
|
||||||
|
}
|
||||||
|
|
||||||
is->read((char*)MMU.bupmem.data,bupmem_size);
|
is->read((char*)MMU.bupmem.data,bupmem_size);
|
||||||
if(is->fail()) return false;
|
if(is->fail()) return false;
|
||||||
|
@ -593,7 +613,7 @@ static int SubWrite(std::ostream* os, SFORMAT *sf)
|
||||||
int size = sf->size;
|
int size = sf->size;
|
||||||
|
|
||||||
//add size of current node to the accumulator
|
//add size of current node to the accumulator
|
||||||
acc += sizeof(sf->desc) + sizeof(sf->size) + sizeof(sf->count);
|
acc += 4 + sizeof(sf->size) + sizeof(sf->count);
|
||||||
acc += count * size;
|
acc += count * size;
|
||||||
|
|
||||||
if(os) //Are we writing or calculating the size of this block?
|
if(os) //Are we writing or calculating the size of this block?
|
||||||
|
@ -668,16 +688,6 @@ static bool savestate_save(std::ostream* outstream, int compressionLevel)
|
||||||
writechunks(os);
|
writechunks(os);
|
||||||
ms.flush();
|
ms.flush();
|
||||||
|
|
||||||
for(int i=0x2000;i<0x1000000;i++)
|
|
||||||
if(ARM9Mem.ARM9_REG[i] != 0) {
|
|
||||||
MessageBox(0,"Debug check fail: ARM9Mem.ARM9_REG",0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i=0;i<0x20000;i++)
|
|
||||||
if(ARM9Mem.blank_memory[i] != 0) {
|
|
||||||
MessageBox(0,"Debug check fail: ARM9Mem.blank_memory",0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//save the length of the file
|
//save the length of the file
|
||||||
u32 len = ms.size();
|
u32 len = ms.size();
|
||||||
|
|
||||||
|
@ -737,8 +747,6 @@ bool savestate_save (const char *file_name)
|
||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//u8 GPU_screen[4*256*192];
|
|
||||||
|
|
||||||
static void writechunks(std::ostream* os) {
|
static void writechunks(std::ostream* os) {
|
||||||
savestate_WriteChunk(os,1,SF_ARM9);
|
savestate_WriteChunk(os,1,SF_ARM9);
|
||||||
savestate_WriteChunk(os,2,SF_ARM7);
|
savestate_WriteChunk(os,2,SF_ARM7);
|
||||||
|
@ -812,6 +820,7 @@ static void loadstate()
|
||||||
|
|
||||||
static bool savestate_load(std::istream* is)
|
static bool savestate_load(std::istream* is)
|
||||||
{
|
{
|
||||||
|
SAV_silent_fail_flag = false;
|
||||||
char header[16];
|
char header[16];
|
||||||
is->read(header,16);
|
is->read(header,16);
|
||||||
if(is->fail() || memcmp(header,magic,16))
|
if(is->fail() || memcmp(header,magic,16))
|
||||||
|
@ -867,10 +876,11 @@ static bool savestate_load(std::istream* is)
|
||||||
memorystream mstemp(&buf);
|
memorystream mstemp(&buf);
|
||||||
bool x = ReadStateChunks(&mstemp,(s32)len);
|
bool x = ReadStateChunks(&mstemp,(s32)len);
|
||||||
|
|
||||||
if(!x)
|
if(!x && !SAV_silent_fail_flag)
|
||||||
{
|
{
|
||||||
printf("Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked");
|
printf("Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked");
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
//HACK! we really need a better way to handle this kind of feedback
|
||||||
MessageBox(0,"Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked",0,0);
|
MessageBox(0,"Error loading savestate. It failed halfway through;\nSince there is no savestate backup system, your current game session is wrecked",0,0);
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1464,6 +1464,11 @@ class WinDriver : public Driver
|
||||||
{
|
{
|
||||||
return ::AVI_IsRecording();
|
return ::AVI_IsRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void USR_InfoMessage(const char *message)
|
||||||
|
{
|
||||||
|
SetMessageToDisplay(message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int WINAPI WinMain (HINSTANCE hThisInstance,
|
int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
|
|
|
@ -71,7 +71,7 @@ static BOOL s_itemIndicesInvalid = true; // if true, the link from listbox items
|
||||||
static BOOL s_prevValuesNeedUpdate = true; // if true, the "prev" values should be updated using the "cur" values on the next frame update signaled
|
static BOOL s_prevValuesNeedUpdate = true; // if true, the "prev" values should be updated using the "cur" values on the next frame update signaled
|
||||||
static unsigned int s_maxItemIndex = 0; // max currently valid item index, the listbox sometimes tries to update things past the end of the list so we need to know this to ignore those attempts
|
static unsigned int s_maxItemIndex = 0; // max currently valid item index, the listbox sometimes tries to update things past the end of the list so we need to know this to ignore those attempts
|
||||||
|
|
||||||
static const MemoryRegion s_prgRegion = { 0x02000000, 0x400000, (unsigned char*)ARM9Mem.MAIN_MEM, true};
|
static const MemoryRegion s_prgRegion = { 0x02000000, 0x400000, (unsigned char*)ARM9Mem.MAIN_MEM, false};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static const MemoryRegion s_prgRegion = { 0x020000, SEGACD_RAM_PRG_SIZE, (unsigned char*)Ram_Prg, true};
|
static const MemoryRegion s_prgRegion = { 0x020000, SEGACD_RAM_PRG_SIZE, (unsigned char*)Ram_Prg, true};
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// The following macros define the minimum required platform. The minimum required platform
|
|
||||||
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
|
|
||||||
// your application. The macros work by enabling all features available on platform versions up to and
|
|
||||||
// including the version specified.
|
|
||||||
|
|
||||||
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
|
||||||
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
|
||||||
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
|
|
||||||
#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
|
|
||||||
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
|
|
||||||
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
|
|
||||||
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue