mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-05 21:38:17 +01:00
save state screenshots, fix video
This commit is contained in:
parent
5efb6e6a69
commit
734a557da5
@ -17,6 +17,8 @@
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <fat.h>
|
||||
#include "pngu/pngu.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "state.h"
|
||||
#include "x6502.h"
|
||||
@ -26,6 +28,7 @@
|
||||
#include "filebrowser.h"
|
||||
#include "memcardop.h"
|
||||
#include "fileop.h"
|
||||
#include "gcvideo.h"
|
||||
|
||||
extern "C" {
|
||||
/*** External functions ***/
|
||||
@ -296,6 +299,7 @@ bool SaveState (char * filepath, int method, bool silent)
|
||||
bool retval = false;
|
||||
int datasize;
|
||||
int offset = 0;
|
||||
int imgSize = 0; // image screenshot bytes written
|
||||
|
||||
if(method == METHOD_AUTO)
|
||||
method = autoSaveMethod(silent);
|
||||
@ -320,15 +324,39 @@ bool SaveState (char * filepath, int method, bool silent)
|
||||
}
|
||||
|
||||
offset = SaveFile(filepath, datasize, method, silent);
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
if ( !silent )
|
||||
InfoPrompt("Save successful");
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
FreeSaveBuffer ();
|
||||
|
||||
// save screenshot - I would prefer to do this from gameScreenTex
|
||||
if(gameScreenTex2 != NULL && method != METHOD_MC_SLOTA && method != METHOD_MC_SLOTB)
|
||||
{
|
||||
AllocSaveBuffer ();
|
||||
|
||||
IMGCTX pngContext = PNGU_SelectImageFromBuffer(savebuffer);
|
||||
|
||||
if (pngContext != NULL)
|
||||
{
|
||||
imgSize = PNGU_EncodeFromGXTexture(pngContext, 640, 480, gameScreenTex2, 0);
|
||||
PNGU_ReleaseImageContext(pngContext);
|
||||
}
|
||||
|
||||
if(imgSize > 0)
|
||||
{
|
||||
char screenpath[1024];
|
||||
filepath[strlen(filepath)-4] = 0;
|
||||
sprintf(screenpath, "%s.png", filepath);
|
||||
SaveFile(screenpath, imgSize, method, silent);
|
||||
}
|
||||
|
||||
FreeSaveBuffer ();
|
||||
}
|
||||
|
||||
if (offset > 0)
|
||||
{
|
||||
if (!silent)
|
||||
InfoPrompt("Save successful");
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -242,10 +242,8 @@ vbgetback (void *arg)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
/*if(GCSettings.timing != vmode_60hz)
|
||||
VIDEO_WaitVSync();
|
||||
else*/
|
||||
SyncSpeed();
|
||||
VIDEO_WaitVSync();
|
||||
SyncSpeed();
|
||||
LWP_SuspendThread (vbthread);
|
||||
}
|
||||
|
||||
@ -265,7 +263,7 @@ InitVideoThread ()
|
||||
LWP_InitQueue (&videoblankqueue);
|
||||
|
||||
/*** Create the thread on this queue ***/
|
||||
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 77);
|
||||
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 100);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -744,13 +742,12 @@ void RenderFrame(unsigned char *XBuf)
|
||||
// load texture into GX
|
||||
DCFlushRange(texturemem, TEX_WIDTH * TEX_HEIGHT * 2);
|
||||
GX_LoadTexObj (&texobj, GX_TEXMAP0);
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
// render textured quad
|
||||
draw_square(view);
|
||||
GX_DrawDone();
|
||||
|
||||
// EFB is ready to be coied into XFB
|
||||
// EFB is ready to be copied into XFB
|
||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||
VIDEO_Flush();
|
||||
copynow = GX_TRUE;
|
||||
|
@ -258,7 +258,7 @@ decodePrefsData (int method)
|
||||
verMinor >= 0 && verMinor <= 9 &&
|
||||
verPoint >= 0 && verPoint <= 9))
|
||||
result = false;
|
||||
else if(verMajor == 2 && verPoint < 7) // less than version 2.0.7
|
||||
else if(verMajor <= 3) // less than version 3.0.0
|
||||
result = false; // reset settings
|
||||
else if(verMajor > curMajor || verMinor > curMinor || verPoint > curPoint) // some future version
|
||||
result = false; // reset settings
|
||||
|
Loading…
Reference in New Issue
Block a user