mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-26 15:50:00 -06:00
Move vertex serialization into its own method
This commit is contained in:
@ -279,6 +279,19 @@ std::unique_ptr<GPU3D::Renderer3D> CurrentRenderer = {};
|
|||||||
|
|
||||||
bool AbortFrame;
|
bool AbortFrame;
|
||||||
|
|
||||||
|
void Vertex::DoSavestate(Savestate* file) noexcept
|
||||||
|
{
|
||||||
|
file->VarArray(Position, sizeof(Position));
|
||||||
|
file->VarArray(Color, sizeof(Color));
|
||||||
|
file->VarArray(TexCoords, sizeof(TexCoords));
|
||||||
|
|
||||||
|
file->Bool32(&Clipped);
|
||||||
|
|
||||||
|
file->VarArray(FinalPosition, sizeof(FinalPosition));
|
||||||
|
file->VarArray(FinalColor, sizeof(FinalColor));
|
||||||
|
file->VarArray(HiresPosition, sizeof(HiresPosition));
|
||||||
|
}
|
||||||
|
|
||||||
bool Init()
|
bool Init()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -474,18 +487,9 @@ void DoSavestate(Savestate* file)
|
|||||||
file->Var32(&VertexNumInPoly);
|
file->Var32(&VertexNumInPoly);
|
||||||
file->Var32(&NumConsecutivePolygons);
|
file->Var32(&NumConsecutivePolygons);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (Vertex& vtx : TempVertexBuffer)
|
||||||
{
|
{
|
||||||
Vertex* vtx = &TempVertexBuffer[i];
|
vtx.DoSavestate(file);
|
||||||
|
|
||||||
file->VarArray(vtx->Position, sizeof(s32)*4);
|
|
||||||
file->VarArray(vtx->Color, sizeof(s32)*3);
|
|
||||||
file->VarArray(vtx->TexCoords, sizeof(s16)*2);
|
|
||||||
|
|
||||||
file->Bool32(&vtx->Clipped);
|
|
||||||
|
|
||||||
file->VarArray(vtx->FinalPosition, sizeof(s32)*2);
|
|
||||||
file->VarArray(vtx->FinalColor, sizeof(s32)*3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->Saving)
|
if (file->Saving)
|
||||||
@ -511,18 +515,9 @@ void DoSavestate(Savestate* file)
|
|||||||
file->Var32(&FlushRequest);
|
file->Var32(&FlushRequest);
|
||||||
file->Var32(&FlushAttributes);
|
file->Var32(&FlushAttributes);
|
||||||
|
|
||||||
for (int i = 0; i < 6144*2; i++)
|
for (Vertex& vtx : VertexRAM)
|
||||||
{
|
{
|
||||||
Vertex* vtx = &VertexRAM[i];
|
vtx.DoSavestate(file);
|
||||||
|
|
||||||
file->VarArray(vtx->Position, sizeof(s32)*4);
|
|
||||||
file->VarArray(vtx->Color, sizeof(s32)*3);
|
|
||||||
file->VarArray(vtx->TexCoords, sizeof(s16)*2);
|
|
||||||
|
|
||||||
file->Bool32(&vtx->Clipped);
|
|
||||||
|
|
||||||
file->VarArray(vtx->FinalPosition, sizeof(s32)*2);
|
|
||||||
file->VarArray(vtx->FinalColor, sizeof(s32)*3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 2048*2; i++)
|
for(int i = 0; i < 2048*2; i++)
|
||||||
|
@ -46,6 +46,7 @@ struct Vertex
|
|||||||
// TODO maybe: hi-res color? (that survives clipping)
|
// TODO maybe: hi-res color? (that survives clipping)
|
||||||
s32 HiresPosition[2];
|
s32 HiresPosition[2];
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Polygon
|
struct Polygon
|
||||||
@ -77,6 +78,7 @@ struct Polygon
|
|||||||
|
|
||||||
u32 SortKey;
|
u32 SortKey;
|
||||||
|
|
||||||
|
void DoSavestate(Savestate* file) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern u32 RenderDispCnt;
|
extern u32 RenderDispCnt;
|
||||||
|
Reference in New Issue
Block a user