Begin implementing save states to video software. Kind of works, sometimes.
This commit is contained in:
parent
e5c53e371f
commit
415a2f17c9
|
@ -28,6 +28,7 @@ u8 efb[EFB_WIDTH*EFB_HEIGHT*6];
|
||||||
|
|
||||||
namespace EfbInterface
|
namespace EfbInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4];
|
u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4];
|
||||||
|
|
||||||
inline u32 GetColorOffset(u16 x, u16 y)
|
inline u32 GetColorOffset(u16 x, u16 y)
|
||||||
|
@ -40,6 +41,12 @@ namespace EfbInterface
|
||||||
return (x + y * EFB_WIDTH) * 3 + DEPTH_BUFFER_START;
|
return (x + y * EFB_WIDTH) * 3 + DEPTH_BUFFER_START;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
p.DoArray(efb, EFB_WIDTH*EFB_HEIGHT*6);
|
||||||
|
p.DoArray(efbColorTexture, EFB_WIDTH*EFB_HEIGHT*4);
|
||||||
|
}
|
||||||
|
|
||||||
void SetPixelAlphaOnly(u32 offset, u8 a)
|
void SetPixelAlphaOnly(u32 offset, u8 a)
|
||||||
{
|
{
|
||||||
switch (bpmem.zcontrol.pixel_format)
|
switch (bpmem.zcontrol.pixel_format)
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace EfbInterface
|
||||||
|
|
||||||
void UpdateColorTexture();
|
void UpdateColorTexture();
|
||||||
extern u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4]; // RGBA format
|
extern u8 efbColorTexture[EFB_WIDTH*EFB_HEIGHT*4]; // RGBA format
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,6 +46,18 @@ static bool inObjectStream;
|
||||||
static u8 lastPrimCmd;
|
static u8 lastPrimCmd;
|
||||||
|
|
||||||
|
|
||||||
|
void DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
p.Do(minCommandSize);
|
||||||
|
vertexLoader.DoState(p);
|
||||||
|
p.Do(streamSize);
|
||||||
|
p.Do(streamAddress);
|
||||||
|
p.Do(readOpcode);
|
||||||
|
p.Do(inObjectStream);
|
||||||
|
p.Do(lastPrimCmd);
|
||||||
|
//p.Do(currentFunction);
|
||||||
|
}
|
||||||
|
|
||||||
void DecodePrimitiveStream(u32 iBufferSize)
|
void DecodePrimitiveStream(u32 iBufferSize)
|
||||||
{
|
{
|
||||||
u32 vertexSize = vertexLoader.GetVertexSize();
|
u32 vertexSize = vertexLoader.GetVertexSize();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define _OPCODEDECODER_H_
|
#define _OPCODEDECODER_H_
|
||||||
|
|
||||||
#include "CommonTypes.h"
|
#include "CommonTypes.h"
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
namespace OpcodeDecoder
|
namespace OpcodeDecoder
|
||||||
{
|
{
|
||||||
|
@ -57,6 +58,8 @@ namespace OpcodeDecoder
|
||||||
bool CommandRunnable(u32 iBufferSize);
|
bool CommandRunnable(u32 iBufferSize);
|
||||||
|
|
||||||
void Run(u32 iBufferSize);
|
void Run(u32 iBufferSize);
|
||||||
|
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,6 +57,11 @@ CPReg cpreg; // shared between gfx and emulator thread
|
||||||
void DoState(PointerWrap &p)
|
void DoState(PointerWrap &p)
|
||||||
{
|
{
|
||||||
p.Do(cpreg);
|
p.Do(cpreg);
|
||||||
|
p.Do(readPos);
|
||||||
|
p.Do(writePos);
|
||||||
|
p.Do(et_UpdateInterrupts);
|
||||||
|
p.Do(interruptSet);
|
||||||
|
p.Do(interruptWaiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
// does it matter that there is no synchronization between threads during writes?
|
// does it matter that there is no synchronization between threads during writes?
|
||||||
|
|
|
@ -328,4 +328,15 @@ void SWVertexLoader::LoadTexCoord(SWVertexLoader *vertexLoader, InputVertexData
|
||||||
vertexLoader->m_texCoordLoader[index]();
|
vertexLoader->m_texCoordLoader[index]();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SWVertexLoader::DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
p.DoArray(m_AttributeLoaders, sizeof m_AttributeLoaders);
|
||||||
|
p.Do(m_VertexSize);
|
||||||
|
p.Do(m_CurrentVat);
|
||||||
|
p.Do(m_positionLoader);
|
||||||
|
p.Do(m_normalLoader);
|
||||||
|
p.DoArray(m_colorLoader, sizeof m_colorLoader);
|
||||||
|
p.Do(m_NumAttributeLoaders);
|
||||||
|
m_SetupUnit->DoState(p);
|
||||||
|
p.Do(m_TexGenSpecialCase);
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "NativeVertexFormat.h"
|
#include "NativeVertexFormat.h"
|
||||||
#include "CPMemLoader.h"
|
#include "CPMemLoader.h"
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
class SetupUnit;
|
class SetupUnit;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public:
|
||||||
u32 GetVertexSize() { return m_VertexSize; }
|
u32 GetVertexSize() { return m_VertexSize; }
|
||||||
|
|
||||||
void LoadVertex();
|
void LoadVertex();
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include "FileUtil.h"
|
#include "FileUtil.h"
|
||||||
#include "VideoBackend.h"
|
#include "VideoBackend.h"
|
||||||
#include "Core.h"
|
#include "Core.h"
|
||||||
|
#include "OpcodeDecoder.h"
|
||||||
|
#include "SWVertexLoader.h"
|
||||||
|
|
||||||
#define VSYNC_ENABLED 0
|
#define VSYNC_ENABLED 0
|
||||||
|
|
||||||
|
@ -93,9 +95,13 @@ bool VideoSoftware::Initialize(void *&window_handle)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSoftware::DoState(PointerWrap&)
|
void VideoSoftware::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
// NYI
|
// TODO: incomplete
|
||||||
|
SWCommandProcessor::DoState(p);
|
||||||
|
SWPixelEngine::DoState(p);
|
||||||
|
EfbInterface::DoState(p);
|
||||||
|
OpcodeDecoder::DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoSoftware::CheckInvalidState()
|
void VideoSoftware::CheckInvalidState()
|
||||||
|
|
|
@ -169,3 +169,10 @@ void SetupUnit::SetupLineStrip()
|
||||||
|
|
||||||
void SetupUnit::SetupPoint()
|
void SetupUnit::SetupPoint()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void SetupUnit::DoState(PointerWrap &p)
|
||||||
|
{
|
||||||
|
p.Do(m_PrimType);
|
||||||
|
p.Do(m_VertexCounter);
|
||||||
|
p.DoArray(m_Vertices, sizeof m_Vertices);
|
||||||
|
}
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "NativeVertexFormat.h"
|
#include "NativeVertexFormat.h"
|
||||||
|
#include "ChunkFile.h"
|
||||||
|
|
||||||
class SetupUnit
|
class SetupUnit
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,7 @@ public:
|
||||||
OutputVertexData* GetVertex() { return m_VertWritePointer; }
|
OutputVertexData* GetVertex() { return m_VertWritePointer; }
|
||||||
|
|
||||||
void SetupVertex();
|
void SetupVertex();
|
||||||
|
void DoState(PointerWrap &p);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue