more cleanup

This commit is contained in:
CaH4e3 2012-12-15 21:53:01 +00:00
parent 723e01148c
commit c550c9623e
5 changed files with 412 additions and 536 deletions

View File

@ -314,19 +314,16 @@ void SetWriteHandler(int32 start, int32 end, writefunc func) {
BWrite[x] = func; BWrite[x] = func;
} }
uint8 *GameMemBlock;
uint8 *RAM; uint8 *RAM;
//--------- //---------
//windows might need to allocate these differently, so we have some special code //windows might need to allocate these differently, so we have some special code
static void AllocBuffers() { static void AllocBuffers() {
GameMemBlock = (uint8*)FCEU_gmalloc(GAME_MEM_BLOCK_SIZE);
RAM = (uint8*)FCEU_gmalloc(0x800); RAM = (uint8*)FCEU_gmalloc(0x800);
} }
static void FreeBuffers() { static void FreeBuffers() {
FCEU_free(GameMemBlock);
FCEU_free(RAM); FCEU_free(RAM);
} }
//------ //------

View File

@ -49,7 +49,6 @@ extern uint8 MMC5HackSPPage;
#define GAME_MEM_BLOCK_SIZE 131072 #define GAME_MEM_BLOCK_SIZE 131072
extern uint8 *RAM; //shared memory modifications extern uint8 *RAM; //shared memory modifications
extern uint8 *GameMemBlock; //shared memory modifications
extern int EmulationPaused; extern int EmulationPaused;
uint8 FCEU_ReadRomByte(uint32 i); uint8 FCEU_ReadRomByte(uint32 i);

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@
#include "cart.h" #include "cart.h"
#include "ppu.h" #include "ppu.h"
#define INESPRIV
#include "ines.h" #include "ines.h"
#include "unif.h" #include "unif.h"
#include "state.h" #include "state.h"
@ -49,6 +48,7 @@ extern SFORMAT FCEUVSUNI_STATEINFO[];
uint8 *trainerpoo = 0; uint8 *trainerpoo = 0;
uint8 *ROM = NULL; uint8 *ROM = NULL;
uint8 *VROM = NULL; uint8 *VROM = NULL;
uint8 *ExtraNTARAM = NULL;
iNES_HEADER head; iNES_HEADER head;
static CartInfo iNESCart; static CartInfo iNESCart;
@ -113,9 +113,13 @@ void iNESGI(GI h) { //bbit edited: removed static keyword
VROM = NULL; VROM = NULL;
} }
if (trainerpoo) { if (trainerpoo) {
FCEU_gfree(trainerpoo); free(trainerpoo);
trainerpoo = NULL; trainerpoo = NULL;
} }
if (ExtraNTARAM) {
free(ExtraNTARAM);
ExtraNTARAM = NULL;
}
} }
break; break;
} }
@ -737,7 +741,10 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
} }
} }
if (head.ROM_type & 8) Mirroring = 2; if (head.ROM_type & 8) {
Mirroring = 2;
ExtraNTARAM = (uint8*)FCEU_gmalloc(2048);
}
if ((ROM = (uint8*)FCEU_malloc(ROM_size << 14)) == NULL) if ((ROM = (uint8*)FCEU_malloc(ROM_size << 14)) == NULL)
return 0; return 0;

View File

@ -24,21 +24,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <map> #include <map>
#ifdef INESPRIV
/* This order is necessary */
#define WRAM (GameMemBlock)
#define sizeofWRAM 8192
/* for the MMC5 code to work properly. It might be fixed later... */
#define CHRRAM (GameMemBlock + sizeofWRAM)
#define sizeofCHRRAM 8192
#define ExtraNTARAM (GameMemBlock + sizeofWRAM + sizeofCHRRAM)
#define sizeofExtraNTARAM 2048
#else
#endif
struct TMasterRomInfo struct TMasterRomInfo
{ {
@ -57,6 +42,7 @@ extern uint8 *ROM;
extern uint8 *VROM; extern uint8 *VROM;
extern uint32 VROM_size; extern uint32 VROM_size;
extern uint32 ROM_size; extern uint32 ROM_size;
extern uint8 *ExtraNTARAM;
extern int iNesSave(); //bbit Edited: line added extern int iNesSave(); //bbit Edited: line added
extern int iNesSaveAs(char* name); extern int iNesSaveAs(char* name);
extern char LoadedRomFName[2048]; //bbit Edited: line added extern char LoadedRomFName[2048]; //bbit Edited: line added