Build fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@423 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2008-09-01 13:31:24 +00:00
parent 4bbfff3cac
commit 10eef7f60e
3 changed files with 37 additions and 15 deletions

View File

@ -102,7 +102,7 @@ namespace PowerPC
Interpreter::Init(); Interpreter::Init();
Jit64::Core::Init(); Jit64::Core::Init();
// ... but start as interpreter by default. // ... but start as interpreter by default.
_mode = MODE_INTERPRETER; mode = MODE_INTERPRETER;
state = CPU_STEPPING; state = CPU_STEPPING;
} }

View File

@ -92,6 +92,10 @@ void SaveStateCallback(u64 userdata, int cyclesLate)
if(bCompressed) { if(bCompressed) {
int chunks = sz / chunkSize, leftovers = sz % chunkSize; int chunks = sz / chunkSize, leftovers = sz % chunkSize;
//SANITY CHECK
if(((chunks * chunkSize) + leftovers) != sz)
PanicAlert("WTF %d != %d", ((chunks * chunkSize) + leftovers), sz);
strm.zalloc = Z_NULL; strm.zalloc = Z_NULL;
strm.zfree = Z_NULL; strm.zfree = Z_NULL;
strm.opaque = Z_NULL; strm.opaque = Z_NULL;
@ -101,21 +105,23 @@ void SaveStateCallback(u64 userdata, int cyclesLate)
strm.avail_in = chunkSize; strm.avail_in = chunkSize;
memcpy(inbuf, buffer + i * chunkSize, chunkSize); memcpy(inbuf, buffer + i * chunkSize, chunkSize);
strm.next_in = inbuf; strm.next_in = inbuf;
memcpy(outbuf, buffer + i * chunkSize, chunkSize); do {
strm.avail_out = chunkSize; strm.avail_out = chunkSize;
strm.next_out = outbuf; strm.next_out = outbuf;
deflate(&strm, Z_NO_FLUSH); deflate(&strm, Z_NO_FLUSH);
fwrite(outbuf, 1, chunkSize - strm.avail_out, f); fwrite(outbuf, 1, chunkSize - strm.avail_out, f);
} while(strm.avail_out == 0);
} }
strm.avail_in = leftovers; strm.avail_in = leftovers;
memcpy(inbuf, buffer + chunks * chunkSize, leftovers); memcpy(inbuf, buffer + chunks * chunkSize, leftovers);
strm.next_in = inbuf; strm.next_in = inbuf;
memcpy(outbuf, buffer + chunks * chunkSize, leftovers); do {
strm.avail_out = leftovers; strm.avail_out = leftovers;
strm.next_out = outbuf; strm.next_out = outbuf;
deflate(&strm, Z_NO_FLUSH); deflate(&strm, Z_NO_FLUSH);
fwrite(outbuf, 1, leftovers - strm.avail_out, f); fwrite(outbuf, 1, leftovers - strm.avail_out, f);
} while(strm.avail_out == 0);
(void)deflateEnd(&strm); (void)deflateEnd(&strm);
} else } else
@ -162,10 +168,17 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
strm.avail_in = 0; strm.avail_in = 0;
strm.next_in = Z_NULL; strm.next_in = Z_NULL;
ret = inflateInit(&strm); ret = inflateInit(&strm);
if (ret != Z_OK)
return;
int cnt = 0; int cnt = 0;
do { do {
strm.avail_in = uInt(fread(inbuf, 1, chunkSize, f)); strm.avail_in = fread(inbuf, 1, chunkSize, f);
if (ferror(f)) {
(void)inflateEnd(&strm);
return;
}
if (strm.avail_in == 0) if (strm.avail_in == 0)
break; break;
strm.next_in = inbuf; strm.next_in = inbuf;
@ -174,6 +187,14 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
strm.avail_out = chunkSize; strm.avail_out = chunkSize;
strm.next_out = outbuf; strm.next_out = outbuf;
ret = inflate(&strm, Z_NO_FLUSH); ret = inflate(&strm, Z_NO_FLUSH);
_assert_(ret != Z_STREAM_ERROR); /* state not clobbered */
switch (ret) {
case Z_NEED_DICT:
case Z_DATA_ERROR:
case Z_MEM_ERROR:
(void)inflateEnd(&strm);
return;
}
int have = chunkSize - strm.avail_out; int have = chunkSize - strm.avail_out;
@ -183,6 +204,8 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
} while (ret != Z_STREAM_END); } while (ret != Z_STREAM_END);
(void)inflateEnd(&strm); (void)inflateEnd(&strm);
PanicAlert("Got here, %d/%d", cnt, sz);
} else { } else {
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
sz = ftell(f) - sizeof(int); sz = ftell(f) - sizeof(int);
@ -197,7 +220,6 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
fclose(f); fclose(f);
u8 *ptr = buffer; u8 *ptr = buffer;
PointerWrap p(&ptr, PointerWrap::MODE_READ); PointerWrap p(&ptr, PointerWrap::MODE_READ);
DoState(p); DoState(p);

View File

@ -155,13 +155,13 @@ void Fifo_EnterLoop(const SVideoInitialize &video_initialize)
// read the data and send it to the VideoPlugin // read the data and send it to the VideoPlugin
u8 *uData = video_initialize.pGetMemoryPointer(_fifo.CPReadPointer); u8 *uData = video_initialize.pGetMemoryPointer(_fifo.CPReadPointer);
#ifdef _WIN32 #ifdef _WIN32
EnterCriticalSection(&fifo.sync); EnterCriticalSection(&_fifo.sync);
#endif #endif
_fifo.CPReadPointer += 32; _fifo.CPReadPointer += 32;
Video_SendFifoData(uData); Video_SendFifoData(uData);
#ifdef _WIN32 #ifdef _WIN32
InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32); InterlockedExchangeAdd((LONG*)&_fifo.CPReadWriteDistance, -32);
LeaveCriticalSection(&fifo.sync); LeaveCriticalSection(&_fifo.sync);
#endif #endif
// increase the ReadPtr // increase the ReadPtr
if (_fifo.CPReadPointer >= _fifo.CPEnd) if (_fifo.CPReadPointer >= _fifo.CPEnd)