attempting to optimize memory usage for gamecube

This commit is contained in:
dborth 2010-06-23 17:34:19 +00:00
parent 874737e2df
commit 97ba234dfd
11 changed files with 227 additions and 287 deletions

View File

@ -121,33 +121,17 @@ void ResetBrowser()
browser.numEntries = 0;
browser.selIndex = 0;
browser.pageIndex = 0;
// Clear any existing values
if(browserList != NULL)
{
free(browserList);
browserList = NULL;
}
// set aside space for 1 entry
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
memset(browserList, 0, sizeof(BROWSERENTRY));
browser.size = 1;
browser.size = 0;
}
bool AddBrowserEntry()
{
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (browser.size+1) * sizeof(BROWSERENTRY));
if(!newBrowserList) // failed to allocate required memory
if(browser.size >= MAX_BROWSER_SIZE)
{
ResetBrowser();
ErrorPrompt("Out of memory: too many files!");
return false;
}
else
{
browserList = newBrowserList;
return false; // out of space
}
memset(&(browserList[browser.size]), 0, sizeof(BROWSERENTRY)); // clear the new entry
browser.size++;
return true;

View File

@ -18,6 +18,11 @@
#include <gccore.h>
#define MAXJOLIET 255
#ifdef HW_DOL
#define MAX_BROWSER_SIZE 1000
#else
#define MAX_BROWSER_SIZE 3000
#endif
typedef struct
{

View File

@ -21,7 +21,7 @@
#include <fat.h>
#include <unistd.h>
#define SAVEBUFFERSIZE (1024 * 512)
#define SAVEBUFFERSIZE (1024 * 128)
void InitDeviceThread();
void ResumeDeviceThread();

View File

@ -11,6 +11,9 @@
* Adapted from Snes9x Win32/MacOSX ports
* Video Filter Code (hq2x)
****************************************************************************/
#ifdef HW_RVL
#include <gccore.h>
#include <stdio.h>
#include <stdlib.h>
@ -539,3 +542,4 @@ void RenderHQ2X (uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
sp += (src1line - width);
}
}
#endif

View File

@ -1440,12 +1440,7 @@ static int MenuGame()
delete gameScreenImg;
gameScreenImg = NULL;
}
if(gameScreenTex)
{
free(gameScreenTex);
gameScreenTex = NULL;
gameScreenPngSize = 0;
}
bgImg->SetVisible(true);
#ifndef NO_SOUND
bgMusic->Play(); // startup music
@ -2974,6 +2969,10 @@ static int MenuSettingsVideo()
sprintf(options.name[i++], "Video Mode");
options.length = i;
#ifdef HW_DOL
options.name[2][0] = 0; // disable hq2x on GameCube
#endif
for(i=0; i < options.length; i++)
options.value[i][0] = 0;
@ -3076,8 +3075,9 @@ static int MenuSettingsVideo()
sprintf (options.value[1], "16:9 Correction");
else
sprintf (options.value[1], "Default");
#ifdef HW_RVL
sprintf (options.value[2], "%s", GetFilterName((RenderFilter)GCSettings.FilterMethod));
#endif
sprintf (options.value[3], "%.2f%%, %.2f%%", GCSettings.zoomHor*100, GCSettings.zoomVert*100);
sprintf (options.value[4], "%d, %d", GCSettings.xshift, GCSettings.yshift);
sprintf (options.value[5], "%s", GCSettings.crosshair == 1 ? "On" : "Off");
@ -3788,7 +3788,7 @@ MainMenu (int menu)
bgImg->ColorStripe(10);
mainWindow->Append(bgImg);
if(gameScreenTex)
if(menu == MENU_GAME)
{
IMGCTX pngContext = PNGU_SelectImageFromBuffer(gameScreenPng);
@ -3796,7 +3796,7 @@ MainMenu (int menu)
{
gameScreenPngSize = PNGU_EncodeFromGXTexture(pngContext, vmode->fbWidth, vmode->efbHeight, gameScreenTex, 0);
PNGU_ReleaseImageContext(pngContext);
DCFlushRange(gameScreenPng, 512*1024);
DCFlushRange(gameScreenPng, gameScreenPngSize);
}
gameScreenImg = new GuiImage(gameScreenTex, vmode->fbWidth, vmode->efbHeight);
@ -3941,12 +3941,6 @@ MainMenu (int menu)
delete gameScreenImg;
gameScreenImg = NULL;
}
if(gameScreenTex)
{
free(gameScreenTex);
gameScreenTex = NULL;
gameScreenPngSize = 0;
}
// wait for keys to be depressed
while(MenuRequested())

View File

@ -49,19 +49,13 @@ void UpdateCheck()
// we can only check for the update if we have internet + SD
if(!updateChecked && networkInit && (isMounted[DEVICE_SD] || isMounted[DEVICE_USB]))
{
static char url[128];
int retval;
updateChecked = true;
static char url[128];
snprintf(url, 128, "http://snes9x-gx.googlecode.com/svn/trunk/update.xml");
u8 * tmpbuffer = (u8 *)memalign(32,32768);
memset(tmpbuffer, 0, 32768);
retval = http_request(url, NULL, tmpbuffer, 32768);
memset(url, 0, 128);
if (retval)
if (http_request(url, NULL, tmpbuffer, 32768, SILENT) > 0)
{
mxml_node_t *xml;
mxml_node_t *item;
@ -136,11 +130,12 @@ bool DownloadUpdate()
{
bool result = false;
if(strlen(updateURL) == 0 || strlen(appPath) == 0)
goto done;
if(!ChangeInterface(appPath, NOTSILENT))
goto done;
if(updateURL[0] == 0 || appPath[0] == 0 || !ChangeInterface(appPath, NOTSILENT))
{
ErrorPrompt("Update failed!");
updateFound = false; // updating is finished (successful or not!)
return false;
}
// stop checking if devices were removed/inserted
// since we're saving a file
@ -149,25 +144,22 @@ bool DownloadUpdate()
int device;
FindDevice(appPath, &device);
FILE * hfile;
char updateFile[50];
sprintf(updateFile, "%s%s Update.zip", pathPrefix[device], APPNAME);
hfile = fopen (updateFile, "wb");
if (hfile > 0)
FILE * hfile = fopen (updateFile, "wb");
if (hfile)
{
int retval;
retval = http_request(updateURL, hfile, NULL, (1024*1024*10));
fclose (hfile);
}
if(http_request(updateURL, hfile, NULL, (1024*1024*10), NOTSILENT) > 0)
result = unzipArchive(updateFile, (char *)pathPrefix[device]);
fclose (hfile);
remove(updateFile); // delete update file
}
// go back to checking if devices were inserted/removed
ResumeDeviceThread();
done:
if(result)
InfoPrompt("Update successful!");
else

View File

@ -55,11 +55,15 @@ int ResetRequested = 0;
int ExitRequested = 0;
char appPath[1024] = { 0 };
char loadedFile[1024] = { 0 };
static int currentMode;
extern "C" {
extern void __exception_setreload(int t);
}
extern void S9xInitSync();
extern uint32 prevRenderedFrameCount;
/****************************************************************************
* Shutdown / Reboot / Exit
***************************************************************************/
@ -206,80 +210,6 @@ void setFrameTimerMethod()
return;
}
/****************************************************************************
* Emulation loop
***************************************************************************/
extern void S9xInitSync();
extern uint32 prevRenderedFrameCount;
static int currentMode;
void
emulate ()
{
while (1) // main loop
{
// go back to checking if devices were inserted/removed
// since we're entering the menu
ResumeDeviceThread();
SwitchAudioMode(1);
if(SNESROMSize == 0)
MainMenu(MENU_GAMESELECTION);
else
MainMenu(MENU_GAME);
AllocGfxMem();
SelectFilterMethod();
ConfigRequested = 0;
ScreenshotRequested = 0;
SwitchAudioMode(0);
Settings.MultiPlayer5Master = (GCSettings.Controller == CTRL_PAD4 ? true : false);
Settings.SuperScopeMaster = (GCSettings.Controller == CTRL_SCOPE ? true : false);
Settings.MouseMaster = (GCSettings.Controller == CTRL_MOUSE ? true : false);
Settings.JustifierMaster = (GCSettings.Controller == CTRL_JUST ? true : false);
SetControllers ();
// stop checking if devices were removed/inserted
// since we're starting emulation again
HaltDeviceThread();
AudioStart ();
FrameTimer = 0;
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
CheckVideo = 2; // force video update
prevRenderedFrameCount = IPPU.RenderedFramesCount;
currentMode = GCSettings.render;
while(1) // emulation loop
{
S9xMainLoop ();
ReportButtons ();
if(ResetRequested)
{
S9xSoftReset (); // reset game
ResetRequested = 0;
}
if (ConfigRequested)
{
ConfigRequested = 0;
FreeGfxMem();
ResetVideo_Menu();
break;
}
#ifdef HW_RVL
if(ShutdownRequested)
ExitApp();
#endif
} // emulation loop
} // main loop
}
/****************************************************************************
* IOS 202
***************************************************************************/
@ -426,9 +356,7 @@ main(int argc, char *argv[])
CreateAppPath(argv[0]);
#endif
// Set defaults
DefaultSettings ();
DefaultSettings (); // Set defaults
S9xUnmapAllControls ();
SetDefaultButtonMap ();
@ -440,11 +368,8 @@ main(int argc, char *argv[])
if (!S9xInitAPU ())
ExitApp();
// Set Pixel Renderer to match 565
S9xSetRenderPixelFormat (RGB565);
// Initialise Sound System
S9xInitSound (64, 0);
S9xSetRenderPixelFormat (RGB565); // Set Pixel Renderer to match 565
S9xInitSound (64, 0); // Initialise Sound System
// Initialise Graphics
setGFX ();
@ -452,13 +377,70 @@ main(int argc, char *argv[])
ExitApp();
S9xInitSync(); // initialize frame sync
// Initialize font system
InitFreeType((u8*)font_ttf, font_ttf_size);
gameScreenPng = (u8 *)malloc(512*1024);
InitFreeType((u8*)font_ttf, font_ttf_size); // Initialize font system
gameScreenPng = (u8 *)malloc(128*1024);
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
AllocGfxMem();
InitGUIThreads();
emulate(); // main loop
while (1) // main loop
{
// go back to checking if devices were inserted/removed
// since we're entering the menu
ResumeDeviceThread();
SwitchAudioMode(1);
if(SNESROMSize == 0)
MainMenu(MENU_GAMESELECTION);
else
MainMenu(MENU_GAME);
#ifdef HW_RVL
SelectFilterMethod();
#endif
ConfigRequested = 0;
ScreenshotRequested = 0;
SwitchAudioMode(0);
Settings.MultiPlayer5Master = (GCSettings.Controller == CTRL_PAD4 ? true : false);
Settings.SuperScopeMaster = (GCSettings.Controller == CTRL_SCOPE ? true : false);
Settings.MouseMaster = (GCSettings.Controller == CTRL_MOUSE ? true : false);
Settings.JustifierMaster = (GCSettings.Controller == CTRL_JUST ? true : false);
SetControllers ();
// stop checking if devices were removed/inserted
// since we're starting emulation again
HaltDeviceThread();
AudioStart ();
FrameTimer = 0;
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
CheckVideo = 2; // force video update
prevRenderedFrameCount = IPPU.RenderedFramesCount;
currentMode = GCSettings.render;
while(1) // emulation loop
{
S9xMainLoop ();
ReportButtons ();
if(ResetRequested)
{
S9xSoftReset (); // reset game
ResetRequested = 0;
}
if (ConfigRequested)
{
ConfigRequested = 0;
ResetVideo_Menu();
break;
}
#ifdef HW_RVL
if(ShutdownRequested)
ExitApp();
#endif
} // emulation loop
} // main loop
}

View File

@ -25,29 +25,33 @@
#include "menu.h"
#include "http.h"
#define TCP_CONNECT_TIMEOUT 4000 // 4 secs to make a connection
#define TCP_SEND_SIZE (32 * 1024)
#define TCP_RECV_SIZE (32 * 1024)
#define TCP_BLOCK_RECV_TIMEOUT 4000 // 4 secs to receive
#define TCP_BLOCK_SEND_TIMEOUT 4000 // 4 secs to send
#define TCP_BLOCK_SIZE 1024
#define HTTP_TIMEOUT 10000 // 10 secs to get an http response
#define IOS_O_NONBLOCK 0x04
static s32 tcp_socket(void)
{
s32 s, res;
s = net_socket(PF_INET, SOCK_STREAM, 0);
if (s < 0)
{
return s;
}
res = net_fcntl(s, F_GETFL, 0);
if (res < 0)
{
net_close(s);
return res;
}
res = net_fcntl(s, F_SETFL, res | 4);
res = net_fcntl(s, F_SETFL, res | IOS_O_NONBLOCK);
if (res < 0)
{
net_close(s);
return res;
}
@ -59,60 +63,44 @@ static s32 tcp_connect(char *host, const u16 port)
{
struct hostent *hp;
struct sockaddr_in sa;
struct in_addr val;
fd_set myset;
struct timeval tv;
s32 s, res;
s64 t;
hp = net_gethostbyname(host);
if (!hp || !(hp->h_addrtype == PF_INET))
{
return errno;
}
s = tcp_socket();
if (s < 0)
return s;
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_family = PF_INET;
sa.sin_family= PF_INET;
sa.sin_len = sizeof(struct sockaddr_in);
sa.sin_port = htons(port);
sa.sin_port= htons(port);
if(strlen(host) < 16 && inet_aton(host, &val))
{
sa.sin_addr.s_addr = val.s_addr;
}
else
{
hp = net_gethostbyname (host);
if (!hp || !(hp->h_addrtype == PF_INET))
return errno;
memcpy((char *) &sa.sin_addr, hp->h_addr_list[0], hp->h_length);
t = gettime();
while (true)
{
if (ticks_to_millisecs(diff_ticks(t, gettime())) > TCP_CONNECT_TIMEOUT)
{
net_close(s);
return -ETIMEDOUT;
}
res = net_connect(s, (struct sockaddr *) &sa,
sizeof(struct sockaddr_in));
res = net_connect (s, (struct sockaddr *) &sa, sizeof (sa));
if (res < 0)
if (res == EINPROGRESS)
{
if (res == -EISCONN)
break;
if (res == -EINPROGRESS || res == -EALREADY)
{
usleep(20 * 1000);
continue;
tv.tv_sec = TCP_CONNECT_TIMEOUT;
tv.tv_usec = 0;
FD_ZERO(&myset);
FD_SET(s, &myset);
if (net_select(s+1, NULL, &myset, NULL, &tv) <= 0)
return -1;
}
net_close(s);
return res;
}
break;
}
return s;
}
@ -138,22 +126,17 @@ static char * tcp_readln(const s32 s, const u16 max_length, const u64 start_time
if ((res == 0) || (res == -EAGAIN))
{
usleep(20 * 1000);
continue;
}
if (res < 0)
{
break;
}
if ((c > 0) && (buf[c - 1] == '\r') && (buf[c] == '\n'))
{
if (c == 1)
{
ret = strdup("");
break;
}
@ -166,21 +149,22 @@ static char * tcp_readln(const s32 s, const u16 max_length, const u64 start_time
if (c == max_length)
break;
usleep(300);
}
free(buf);
return ret;
}
static int tcp_read(const s32 s, u8 **buffer, const u32 length)
static int tcp_read(const s32 s, u8 *buffer, const u32 length)
{
u8 *p;
u32 step, left, block, received;
char *p;
u32 left, block, received, step=0;
s64 t;
s32 res;
step = 0;
p = *buffer;
p = (char *)buffer;
left = length;
received = 0;
@ -194,45 +178,40 @@ static int tcp_read(const s32 s, u8 **buffer, const u32 length)
}
block = left;
if (block > 2048)
block = 2048;
if (block > TCP_RECV_SIZE)
block = TCP_RECV_SIZE;
res = net_read(s, p, block);
if ((res == 0) || (res == -EAGAIN))
if(res>0)
{
usleep(20 * 1000);
continue;
received += res;
left -= res;
p += res;
}
if (res < 0)
else if (res < 0 && res != -EAGAIN)
{
break;
}
received += res;
left -= res;
p += res;
usleep(1000);
if ((received / TCP_BLOCK_SIZE) > step)
{
t = gettime();
t = gettime ();
step++;
}
}
return left == 0;
return received;
}
static int tcp_write(const s32 s, const u8 *buffer, const u32 length)
{
const u8 *p;
u32 step, left, block, sent;
u32 left, block, sent, step=0;
s64 t;
s32 res;
step = 0;
p = buffer;
left = length;
sent = 0;
@ -243,13 +222,12 @@ static int tcp_write(const s32 s, const u8 *buffer, const u32 length)
if (ticks_to_millisecs(diff_ticks(t, gettime()))
> TCP_BLOCK_SEND_TIMEOUT)
{
break;
}
block = left;
if (block > 2048)
block = 2048;
if (block > TCP_SEND_SIZE)
block = TCP_SEND_SIZE;
res = net_write(s, p, block);
@ -260,18 +238,16 @@ static int tcp_write(const s32 s, const u8 *buffer, const u32 length)
}
if (res < 0)
{
break;
}
sent += res;
left -= res;
p += res;
usleep(100);
if ((sent / TCP_BLOCK_SIZE) > step)
{
t = gettime();
t = gettime ();
step++;
}
}
@ -289,7 +265,7 @@ static bool http_split_url(char **host, char **path, const char *url)
p = url + 7;
c = strchr(p, '/');
if (c[0] == 0)
if (c == NULL || c[0] == 0)
return false;
*host = strndup(p, c - p);
@ -298,12 +274,13 @@ static bool http_split_url(char **host, char **path, const char *url)
return true;
}
#define MAX_SIZE (1024*1024*15)
/****************************************************************************
* http_request
* Retrieves the specified URL, and stores it in the specified file or buffer
***************************************************************************/
bool http_request(const char *url, FILE * hfile, u8 * buffer,
const u32 max_size)
int http_request(const char *url, FILE * hfile, u8 * buffer, u32 maxsize, bool silent)
{
int res = 0;
char *http_host;
@ -312,14 +289,18 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
http_res result;
u32 http_status;
u32 content_length = 0;
u32 sizeread = 0, content_length = 0;
int linecount;
if (!http_split_url(&http_host, &http_path, url))
return false;
if (hfile == NULL && buffer == NULL)
return false;
if(maxsize > MAX_SIZE)
return 0;
if (url == NULL || (hfile == NULL && buffer == NULL))
return 0;
if (!http_split_url(&http_host, &http_path, url))
return 0;
http_port = 80;
http_status = 404;
@ -329,11 +310,12 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
if (s < 0)
{
result = HTTPR_ERR_CONNECT;
return false;
return 0;
}
char *request = (char *) malloc(1024);
char *r = request;
r += sprintf(r, "GET %s HTTP/1.1\r\n", http_path);
r += sprintf(r, "Host: %s\r\n", http_host);
r += sprintf(r, "Cache-Control: no-cache\r\n\r\n");
@ -368,24 +350,34 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
}
if (linecount == 32 || !content_length)
http_status = 404;
if (http_status != 200)
{
result = HTTPR_ERR_STATUS;
net_close(s);
return false;
return 0;
}
if (content_length > max_size)
// length unknown - just read as much as we can
if(content_length == 0)
{
content_length = maxsize;
}
else if (content_length > maxsize)
{
result = HTTPR_ERR_TOOBIG;
net_close(s);
return false;
return 0;
}
if (buffer != NULL)
{
res = tcp_read(s, &buffer, content_length);
if(!silent)
ShowAction("Downloading...");
sizeread = tcp_read(s, buffer, content_length);
if(!silent)
CancelAction();
}
else
{
@ -394,6 +386,7 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
u32 bytesLeft = content_length;
u32 readSize;
if(!silent)
ShowProgress("Downloading...", 0, content_length);
u8 * fbuffer = (u8 *) malloc(bufSize);
if(fbuffer)
@ -405,31 +398,35 @@ bool http_request(const char *url, FILE * hfile, u8 * buffer,
else
readSize = bufSize;
res = tcp_read(s, &fbuffer, readSize);
if (!res)
break;
res = fwrite(fbuffer, 1, readSize, hfile);
res = tcp_read(s, fbuffer, readSize);
if (!res)
break;
bytesLeft -= readSize;
ShowProgress("Downloading...", (content_length - bytesLeft),
content_length);
sizeread += res;
bytesLeft -= res;
res = fwrite(fbuffer, 1, res, hfile);
if (!res)
break;
if(!silent)
ShowProgress("Downloading...", (content_length - bytesLeft), content_length);
}
free(fbuffer);
}
if(!silent)
CancelAction();
}
net_close(s);
if (!res)
if (content_length < maxsize && sizeread != content_length)
{
result = HTTPR_ERR_RECEIVE;
return false;
return 0;
}
result = HTTPR_OK;
return true;
return sizeread;
}
#endif

View File

@ -11,12 +11,6 @@
#ifndef _HTTP_H_
#define _HTTP_H_
#define TCP_CONNECT_TIMEOUT 5000
#define TCP_BLOCK_SIZE (16 * 1024)
#define TCP_BLOCK_RECV_TIMEOUT 4000
#define TCP_BLOCK_SEND_TIMEOUT 4000
#define HTTP_TIMEOUT 300000
typedef enum {
HTTPR_OK,
HTTPR_ERR_CONNECT,
@ -26,6 +20,6 @@ typedef enum {
HTTPR_ERR_RECEIVE
} http_res;
bool http_request (const char *url, FILE * hfile, u8 * buffer, const u32 max_size);
int http_request (const char *url, FILE * hfile, u8 * buffer, const u32 max_size, bool silent);
#endif

View File

@ -571,9 +571,13 @@ InitGCVideo ()
xfb[0] = (u32 *) MEM_K0_TO_K1 (memalign(32, 640*574*2));
xfb[1] = (u32 *) MEM_K0_TO_K1 (memalign(32, 640*574*2));
gameScreenTex = (u8 *)memalign(32, 640*574*4);
GXRModeObj *rmode = FindVideoMode();
SetupVideoMode(rmode);
#ifdef HW_RVL
InitLUTs(); // init LUTs for hq2x
#endif
LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 68);
// Initialize GX
@ -714,7 +718,7 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height)
* Update Video
***************************************************************************/
uint32 prevRenderedFrameCount = 0;
int fscale;
int fscale = 1;
void
update_video (int width, int height)
@ -737,9 +741,9 @@ update_video (int width, int height)
if (CheckVideo) // if we get back from the menu, and have rendered at least 1 frame
{
int xscale, yscale;
#ifdef HW_RVL
fscale = GetFilterScale((RenderFilter)GCSettings.FilterMethod);
#endif
ResetVideo_Emu (); // reset video to emulator rendering settings
/** Update scaling **/
@ -793,7 +797,7 @@ update_video (int width, int height)
oldvheight = vheight;
CheckVideo = 0;
}
#ifdef HW_RVL
// convert image to texture
if (GCSettings.FilterMethod != FILTER_NONE && vheight <= 239 && vwidth <= 256) // don't do filtering on game textures > 256 x 239
{
@ -801,6 +805,7 @@ update_video (int width, int height)
MakeTexture565((char *) filtermem, (char *) texturemem, vwidth*fscale, vheight*fscale);
}
else
#endif
{
MakeTexture((char *) GFX.Screen, (char *) texturemem, vwidth, vheight);
}
@ -845,27 +850,16 @@ void AllocGfxMem()
{
snes9xgfx = (unsigned char *)memalign(32, SNES9XGFX_SIZE);
memset(snes9xgfx, 0, SNES9XGFX_SIZE);
#ifdef HW_RVL
filtermem = (unsigned char *)memalign(32, FILTERMEM_SIZE);
memset(filtermem, 0, FILTERMEM_SIZE);
#endif
GFX.Pitch = EXT_PITCH;
GFX.Screen = (uint16*)(snes9xgfx + EXT_OFFSET);
}
void FreeGfxMem()
{
if(snes9xgfx)
{
free(snes9xgfx);
snes9xgfx = NULL;
}
if(filtermem)
{
free(filtermem);
filtermem = NULL;
}
}
/****************************************************************************
* setGFX
*
@ -884,16 +878,11 @@ setGFX ()
***************************************************************************/
void TakeScreenshot()
{
int texSize = vmode->fbWidth * vmode->efbHeight * 4;
if(gameScreenTex) free(gameScreenTex);
gameScreenTex = (u8 *)memalign(32, texSize);
if(gameScreenTex == NULL) return;
GX_SetTexCopySrc(0, 0, vmode->fbWidth, vmode->efbHeight);
GX_SetTexCopyDst(vmode->fbWidth, vmode->efbHeight, GX_TF_RGBA8, GX_FALSE);
GX_CopyTex(gameScreenTex, GX_FALSE);
GX_PixModeSync();
DCFlushRange(gameScreenTex, texSize);
DCFlushRange(gameScreenTex, vmode->fbWidth * vmode->efbHeight * 4);
}
/****************************************************************************

View File

@ -18,7 +18,6 @@
#include "snes9x/snes9x.h"
void AllocGfxMem();
void FreeGfxMem();
void InitGCVideo ();
void StopGX();
void ResetVideo_Emu();