implemented/enabled Lua functions: savestate.create/save/load, stylus.set, gui.box/line/text/pixel/getpixel/opacity/transparency/gdscreenshot/gdoverlay

This commit is contained in:
nitsuja 2009-08-28 09:06:48 +00:00
parent 41a10c95f5
commit 50665860b3
5 changed files with 968 additions and 542 deletions

File diff suppressed because it is too large Load Diff

View File

@ -169,7 +169,7 @@ MovieData::MovieData()
: version(MOVIE_VERSION)
, emuVersion(DESMUME_VERSION_NUMERIC)
, romChecksum(0)
, rerecordCount(1)
, rerecordCount(0)
, binaryFlag(false)
{
}

View File

@ -898,7 +898,7 @@ static void savestate_WriteChunk(EMUFILE* os, int type, void (*saveproc)(EMUFILE
static void writechunks(EMUFILE* os);
static bool savestate_save(EMUFILE* outstream, int compressionLevel)
bool savestate_save(EMUFILE* outstream, int compressionLevel)
{
#ifndef HAVE_LIBZ
compressionLevel = Z_NO_COMPRESSION;
@ -1070,7 +1070,7 @@ static void loadstate()
SetupMMU(nds.debugConsole);
}
static bool savestate_load(EMUFILE* is)
bool savestate_load(EMUFILE* is)
{
SAV_silent_fail_flag = false;
char header[16];
@ -1104,7 +1104,7 @@ static bool savestate_load(EMUFILE* is)
return false;
#endif
} else {
is->fread((char*)&buf[0],len);
is->fread((char*)&buf[0],len-32);
}
//GO!! READ THE SAVESTATE

View File

@ -66,6 +66,9 @@ bool savestate_save (const char *file_name);
void savestate_slot(int num);
void loadstate_slot(int num);
bool savestate_load(class EMUFILE* is);
bool savestate_save(class EMUFILE* outstream, int compressionLevel);
void dorewind();
void rewindsave();

View File

@ -186,6 +186,8 @@ LPDIRECTDRAWCLIPPER lpDDClipBack=NULL;
#define WM_CUSTKEYDOWN (WM_USER+50)
#define WM_CUSTKEYUP (WM_USER+51)
#define WM_CUSTINVOKE (WM_USER+52)
inline bool IsDlgCheckboxChecked(HWND hDlg, int id)
{
@ -916,6 +918,7 @@ HANDLE display_invoke_done_event = INVALID_HANDLE_VALUE;
DWORD display_invoke_timeout = 500;
CRITICAL_SECTION display_invoke_handler_cs;
static void InvokeOnMainThread(void (*function)(DWORD), DWORD argument);
static void DoDisplay_DrawHud()
{
@ -957,11 +960,8 @@ static void DoDisplay(bool firstTime)
{
if(g_thread_self() == display_thread)
{
ResetEvent(display_invoke_ready_event);
display_invoke_argument = LUACALL_AFTEREMULATIONGUI;
display_invoke_function = (void(*)(DWORD))CallRegisteredLuaFunctions;
SignalObjectAndWait(display_invoke_ready_event, display_invoke_done_event, display_invoke_timeout, FALSE);
display_invoke_function = NULL;
InvokeOnMainThread((void(*)(DWORD))
CallRegisteredLuaFunctions, LUACALL_AFTEREMULATIONGUI);
}
else
{
@ -977,7 +977,7 @@ static void DoDisplay(bool firstTime)
//draw and composite the OSD (but not if we are drawing osd straight to screen)
DoDisplay_DrawHud();
T_AGG_RGBA target((u8*)video.finalBuffer(), video.width,video.height,video.width*4);
target.transformImage(aggDraw.hud->image<T_AGG_PF_RGBA>(), 0,0,video.width-1,video.height-1);
target.transformImage(aggDraw.hud->image<T_AGG_PF_RGBA>(), 0,0,video.width,video.height);
aggDraw.hud->clear();
}
@ -1089,6 +1089,15 @@ void CheckMessages()
}
}
static void InvokeOnMainThread(void (*function)(DWORD), DWORD argument)
{
ResetEvent(display_invoke_ready_event);
display_invoke_argument = argument;
display_invoke_function = function;
PostMessage(MainWindow->getHWnd(), WM_CUSTINVOKE, 0, 0); // in case a modal dialog or menu is open
SignalObjectAndWait(display_invoke_ready_event, display_invoke_done_event, display_invoke_timeout, FALSE);
display_invoke_function = NULL;
}
static void _ServiceDisplayThreadInvocation()
{
Lock lock (display_invoke_handler_cs);
@ -3260,6 +3269,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EndPaint(hwnd, &ps);
}
return 0;
case WM_CUSTINVOKE:
ServiceDisplayThreadInvocations();
return 0;
case WM_DROPFILES:
{
char filename[MAX_PATH] = "";