- fixed savegame image generation.

There were two errors:
1. The postprocessor was not run on the generated scene so that the target framebuffer never got set.
2. The generated PNG was not finalized and failed the integrity check of the savegame menu.

Fixes #48
This commit is contained in:
Christoph Oelckers 2020-09-12 01:11:32 +02:00
parent 1f7bc6d69e
commit 222f82304d
2 changed files with 14 additions and 2 deletions

View file

@ -233,6 +233,13 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
auto picfile = WriteSavegameChunk("savepic.png");
WriteSavePic(picfile, 240, 180);
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
// put some basic info into the PNG so that this isn't lost when the image gets extracted.
M_AppendPNGText(picfile, "Software", buf);
M_AppendPNGText(picfile, "Title", name);
M_AppendPNGText(picfile, "Current Map", lev->labelName);
M_FinishPNG(picfile);
return true;
}

View file

@ -56,6 +56,7 @@ F2DDrawer twodpsp;
static int BufferLock = 0;
TArray<VSMatrix> matrixArray;
void Draw2D(F2DDrawer* drawer, FRenderState& state);
FileReader GetResource(const char* fn)
{
@ -344,8 +345,14 @@ void WriteSavePic(FileWriter* file, int width, int height)
RenderState.SetPassType(NORMAL_PASS);
RenderState.EnableDrawBuffers(1, true);
screen->SetViewportRects(&bounds);
bool didit = gi->GenerateSavePic();
float Brightness = 8.f / (r_scenebrightness + 8.f);
screen->PostProcessScene(false, 0, Brightness, []() {
Draw2D(&twodpsp, *screen->RenderState()); // draws the weapon sprites
});
xdim = oldx;
ydim = oldy;
videoSetViewableArea(oldwindowxy1.x, oldwindowxy1.y, oldwindowxy2.x, oldwindowxy2.y);
@ -476,8 +483,6 @@ int32_t r_scenebrightness = 0;
void Draw2D(F2DDrawer* drawer, FRenderState& state);
void videoShowFrame(int32_t w)
{
if (gl_ssao)