Esempio n. 1
0
static int MemCardGetSize()
{
	BurnAcb = MemCardDoGetSize;
	BurnAreaScan(ACB_MEMCARD, &nMinVersion);

	return 0;
}
Esempio n. 2
0
// Compress a state using deflate
int StateCompress(unsigned char **pDef,int *pnDefLen,int bAll)
{
	int nRet=0;
	void *NewMem=NULL;
	memset(&Zstr,0,sizeof(Zstr));

	Comp=NULL;
	nCompLen=0;
	nCompFill=0; // Begin with a zero-length buffer
	nRet=CompEnlarge(8*1024);
	if (nRet!=0)
	{
		return 1;
	}

	nRet=deflateInit(&Zstr,Z_DEFAULT_COMPRESSION);
	BurnAcb=StateCompressAcb; // callback our function with each area
	BurnAreaScan(8|1,NULL);  // scan nvram,        read (from driver -> compress)
	if (bAll)
	{
		BurnAreaScan(4|1,NULL);    // scan volatile ram, read (from driver -> compress)
	}

	// Finish off
	CompGo(1);

	nRet=deflateEnd(&Zstr);

	// Size down
	NewMem=realloc(Comp,nCompFill);
	if (NewMem!=NULL)
	{
		Comp=(unsigned char *)NewMem;
		nCompLen=nCompFill;
	}

	// Return the buffer
	if (pDef    !=NULL)
	{
		*pDef    =Comp;
	}
	if (pnDefLen!=NULL)
	{
		*pnDefLen=nCompFill;
	}
	return 0;
}
Esempio n. 3
0
int	MemCardInsert()
{
	if ((nMemoryCardStatus & 1) && (nMemoryCardStatus & 2) == 0) {
		BurnAcb = MemCardDoInsert;
		BurnAreaScan(ACB_WRITE | ACB_MEMCARD, &nMinVersion);
	}

	return 0;
}
Esempio n. 4
0
int	MemCardEject()
{
	if ((nMemoryCardStatus & 1) && (nMemoryCardStatus & 2)) {
		BurnAcb = MemCardDoEject;
		nMinVersion = 0;
		BurnAreaScan(ACB_READ | ACB_MEMCARD, &nMinVersion);
	}

	return 0;
}
Esempio n. 5
0
int BurnStateDecompress(unsigned char* Def, int nDefLen, int bAll)
{
	memset(&Zstr, 0, sizeof(Zstr));
	inflateInit(&Zstr);

	// Set all of the buffer as available input
	Zstr.next_in = (unsigned char*)Def;
	Zstr.avail_in = nDefLen;

	BurnAcb = StateDecompressAcb;								// callback our function with each area

	if (bAll) BurnAreaScan(ACB_FULLSCAN | ACB_WRITE, NULL);		// scan all ram, write (to driver <- decompress)
	else      BurnAreaScan(ACB_NVRAM    | ACB_WRITE, NULL);		// scan nvram,   write (to driver <- decompress)

	inflateEnd(&Zstr);
	memset(&Zstr, 0, sizeof(Zstr));

	return 0;
}
Esempio n. 6
0
// Compress a state using deflate
int BurnStateCompress(unsigned char** pDef, int* pnDefLen, int bAll)
{
	void* NewMem = NULL;

	memset(&Zstr, 0, sizeof(Zstr));

	Comp = NULL; nCompLen = 0; nCompFill = 0;					// Begin with a zero-length buffer
	if (CompEnlarge(8 * 1024)) {
		return 1;
	}

	deflateInit(&Zstr, Z_DEFAULT_COMPRESSION);

	BurnAcb = StateCompressAcb;									// callback our function with each area

	if (bAll) BurnAreaScan(ACB_FULLSCAN | ACB_READ, NULL);		// scan all ram, read (from driver <- decompress)
	else      BurnAreaScan(ACB_NVRAM    | ACB_READ, NULL);		// scan nvram,   read (from driver <- decompress)

	// Finish off
	CompGo(1);

	deflateEnd(&Zstr);

	// Size down
	NewMem = realloc(Comp, nCompFill);
	if (NewMem) {
		Comp = (unsigned char*)NewMem;
		nCompLen = nCompFill;
	}

	// Return the buffer
	if (pDef) {
		*pDef = Comp;
	}
	if (pnDefLen) {
		*pnDefLen = nCompFill;
	}

	return 0;
}
Esempio n. 7
0
// Decompress a state using inflate
int StateDecompress(unsigned char *Def,int nDefLen,int bAll)
{
	int nRet=0;
	memset(&Zstr,0,sizeof(Zstr));
	nRet=inflateInit(&Zstr);

	// Set all of the buffer as available input
	Zstr.next_in=(unsigned char *)Def;
	Zstr.avail_in=nDefLen;

	BurnAcb=StateDecompressAcb; // callback our function with each area
	BurnAreaScan(8|2,NULL);  // scan nvram,        write (to driver <- decompress)
	if (bAll)
	{
		BurnAreaScan(4|2,NULL);    // scan volatile ram, write (to driver <- decompress)
	}

	nRet=inflateEnd(&Zstr);
	memset(&Zstr,0,sizeof(Zstr));

	return 0;
}
Esempio n. 8
0
static int StateInfo(int* pnLen, int* pnMinVer, int bAll)
{
	int nMin = 0;
	nTotalLen = 0;
	BurnAcb = StateLenAcb;

	BurnAreaScan(ACB_NVRAM, &nMin);						// Scan nvram
	if (bAll) {
		int m;
		BurnAreaScan(ACB_MEMCARD, &m);					// Scan memory card
		if (m > nMin) {									// Up the minimum, if needed
			nMin = m;
		}
		BurnAreaScan(ACB_VOLATILE, &m);					// Scan volatile ram
		if (m > nMin) {									// Up the minimum, if needed
			nMin = m;
		}
	}
	*pnLen = nTotalLen;
	*pnMinVer = nMin;

	return 0;
}
Esempio n. 9
0
static int GetMemoryAreas()
{
	nDbgMemoryAreaCount = 1;
	DbgMemoryAreaInfo = (BurnArea*)malloc(256 * sizeof(BurnArea));
	if (DbgMemoryAreaInfo == NULL) {
		return 1;
	}

	SendDlgItemMessage(hDbgDlg, IDC_DBG_MAINWN1_DRP1, CB_ADDSTRING, 0, (LPARAM)_T("Main CPU memory map"));
	SendDlgItemMessage(hDbgDlg, IDC_DBG_MAINWN2_DRP1, CB_ADDSTRING, 0, (LPARAM)_T("Main CPU memory map"));

	BurnAcb = GetMemoryAcb;
	BurnAreaScan(ACB_MEMORY_ROM | ACB_NVRAM | ACB_MEMCARD | ACB_MEMORY_RAM | ACB_READ, NULL);

	return 0;
}