Final typo and error fixes and include reordering
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@372 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
531230c03d
commit
f8b4311b66
|
@ -36,8 +36,8 @@ ChunkFile::ChunkFile(const char *filename, ChunkFileMode _mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
fseek(f, 0, SEEK_END);
|
fseek(f, 0, SEEK_END);
|
||||||
size = ftell(f);
|
fsize = ftell(f);
|
||||||
eof = size;
|
eof = fsize;
|
||||||
|
|
||||||
stack_ptr = 0;
|
stack_ptr = 0;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ bool ChunkFile::Do(void *ptr, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do variable size array (probably heap-allocated)
|
// Do variable size array (probably heap-allocated)
|
||||||
bool DoArray(void *ptr, int size, int arrSize) {
|
bool ChunkFile::DoArray(void *ptr, int size, int arrSize) {
|
||||||
int sz;
|
int sz;
|
||||||
|
|
||||||
if(ptr == NULL)
|
if(ptr == NULL)
|
||||||
|
@ -102,18 +102,19 @@ bool DoArray(void *ptr, int size, int arrSize) {
|
||||||
if (sz != arrSize)
|
if (sz != arrSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(int i = 0; i < arrSize; i++) {
|
fread(ptr, arrSize * size, 1, f);
|
||||||
fread(ptr[i], size, 1, f);
|
fseek(f, (((arrSize * size) + 3) & ~3) - (arrSize * size),
|
||||||
fseek(f, ((size + 3) & ~3) - size, SEEK_CUR);
|
SEEK_CUR);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MODE_WRITE:
|
case MODE_WRITE:
|
||||||
WriteInt(size);
|
WriteInt(size);
|
||||||
WriteInt(arrSize);
|
WriteInt(arrSize);
|
||||||
for(int i = 0; i < arrSize; i++) {
|
|
||||||
fwrite(ptr[i], size, 1, f);
|
fwrite(ptr, arrSize * size, 1, f);
|
||||||
fseek(f, ((size + 3) & ~3) - size, SEEK_CUR);
|
fseek(f, (((arrSize * size) + 3) & ~3) - (arrSize * size),
|
||||||
}
|
SEEK_CUR);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MODE_VERIFY:
|
case MODE_VERIFY:
|
||||||
sz = ReadInt();
|
sz = ReadInt();
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
// Grabbed from one of my older projects and modified heavily.
|
// Grabbed from one of my older projects and modified heavily.
|
||||||
// Works more like a RIFF file than a Google Protocol Buffer, for example.
|
// Works more like a RIFF file than a Google Protocol Buffer, for example.
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
@ -57,7 +56,7 @@ private:
|
||||||
int stack_ptr;
|
int stack_ptr;
|
||||||
|
|
||||||
char *data;
|
char *data;
|
||||||
int size;
|
int fsize;
|
||||||
int eof;
|
int eof;
|
||||||
|
|
||||||
ChunkFileMode mode;
|
ChunkFileMode mode;
|
||||||
|
@ -88,7 +87,7 @@ public:
|
||||||
|
|
||||||
// Store maps to file. Very useful.
|
// Store maps to file. Very useful.
|
||||||
template<class T>
|
template<class T>
|
||||||
bool Do(std::map<u32, T> &x) {
|
bool Do(std::map<unsigned int, T> &x) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +100,8 @@ public:
|
||||||
|
|
||||||
// Disable size checks to save size for variable size array storing
|
// Disable size checks to save size for variable size array storing
|
||||||
template<class T>
|
template<class T>
|
||||||
bool DoArray(T *x, int size, int arrSize) {
|
bool DoArray(T *x, int arrSize) {
|
||||||
return DoArray((void *)x, size, arrSize);
|
return DoArray((void *)x, sizeof(T), arrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle everything else
|
// Handle everything else
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "MemoryUtil.h"
|
#include "MemoryUtil.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "OpcodeDecoding.h"
|
#include "OpcodeDecoding.h"
|
||||||
#include "pluginspecs_video.h"
|
|
||||||
|
|
||||||
#include "Fifo.h"
|
#include "Fifo.h"
|
||||||
|
|
||||||
|
@ -33,6 +32,13 @@ static u8 *videoBuffer;
|
||||||
static int size = 0;
|
static int size = 0;
|
||||||
static int readptr = 0;
|
static int readptr = 0;
|
||||||
|
|
||||||
|
void Fifo_DoState(ChunkFile &f) {
|
||||||
|
f.Do(size);
|
||||||
|
f.DoArray(videoBuffer, size);
|
||||||
|
|
||||||
|
f.Do(readptr);
|
||||||
|
}
|
||||||
|
|
||||||
void Fifo_Init()
|
void Fifo_Init()
|
||||||
{
|
{
|
||||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||||
|
|
|
@ -18,7 +18,11 @@
|
||||||
#ifndef _FIFO_H
|
#ifndef _FIFO_H
|
||||||
#define _FIFO_H
|
#define _FIFO_H
|
||||||
|
|
||||||
|
#include "pluginspecs_video.h"
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
// inline for speed!
|
// inline for speed!
|
||||||
class FifoReader
|
class FifoReader
|
||||||
{
|
{
|
||||||
|
@ -53,6 +57,7 @@ extern FifoReader fifo;
|
||||||
void Fifo_Init();
|
void Fifo_Init();
|
||||||
void Fifo_Shutdown();
|
void Fifo_Shutdown();
|
||||||
void Fifo_EnterLoop(const SVideoInitialize &video_initialize);
|
void Fifo_EnterLoop(const SVideoInitialize &video_initialize);
|
||||||
|
void Fifo_DoState(ChunkFile &f);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,12 @@
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
#include "VideoState.h"
|
#include "VideoState.h"
|
||||||
|
|
||||||
|
#include "BPMemory.h"
|
||||||
|
#include "CPMemory.h"
|
||||||
|
#include "XFMemory.h"
|
||||||
#include "TextureDecoder.h"
|
#include "TextureDecoder.h"
|
||||||
|
#include "Fifo.h"
|
||||||
|
|
||||||
static void DoState(ChunkFile &f) {
|
static void DoState(ChunkFile &f) {
|
||||||
// BP Memory
|
// BP Memory
|
||||||
|
@ -33,10 +38,7 @@ static void DoState(ChunkFile &f) {
|
||||||
f.Do(texMem);
|
f.Do(texMem);
|
||||||
|
|
||||||
// FIFO
|
// FIFO
|
||||||
f.Do(size);
|
Fifo_DoState(f);
|
||||||
f.DoArray(videoBuffer, sizeof(u8), size);
|
|
||||||
|
|
||||||
f.Do(readptr);
|
|
||||||
|
|
||||||
//TODO: Check for more pointers in the data structures and make them
|
//TODO: Check for more pointers in the data structures and make them
|
||||||
// serializable
|
// serializable
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "PluginSpecs.h"
|
#include "PluginSpecs.h"
|
||||||
|
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
#include "ExportProlog.h"
|
#include "ExportProlog.h"
|
||||||
|
|
||||||
typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge);
|
typedef void (*TSetPEToken)(const unsigned short _token, const int _bSetTokenAcknowledge);
|
||||||
|
|
Loading…
Reference in New Issue