From: Toni Wilen Date: Sat, 9 Apr 2016 14:39:23 +0000 (+0300) Subject: Continuous screenshot mode. X-Git-Tag: 3300~55 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=9070761970524d8cd780b0e5a8081318980162cc;p=francis%2Fwinuae.git Continuous screenshot mode. --- diff --git a/inputdevice.cpp b/inputdevice.cpp index 8401d904..bfb9eb5d 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -3790,9 +3790,17 @@ static bool inputdevice_handle_inputcode2 (int code, int state) break; } #endif - - if (!state) + if (!state) { + switch(code) + { + case AKS_SCREENSHOT_FILE: + // stop multiscreenshot + screenshot(4, 1); + break; + } return false; + } + switch (code) { case AKS_ENTERGUI: @@ -3800,7 +3808,11 @@ static bool inputdevice_handle_inputcode2 (int code, int state) setsystime (); break; case AKS_SCREENSHOT_FILE: - screenshot (1, 1); + if (state > 1) { + screenshot(3, 1); + } else { + screenshot(1, 1); + } break; case AKS_SCREENSHOT_CLIPBOARD: screenshot (0, 1); @@ -4082,8 +4094,6 @@ static int handle_input_event (int nr, int state, int max, int autofire, bool ca return 0; // qualifiers do nothing if (ie->unit == 0 && ie->data >= AKS_FIRST) { isaks = true; - if (!state) // release AKS_ does nothing - return 0; } if (!isaks) { @@ -5121,9 +5131,9 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev /* pressed = firebutton, not pressed = autofire */ if (state) { queue_input_event (evt, NULL, -1, 0, 0, 1); - handle_input_event (evt, 1, 1, 0, true, false); + handle_input_event (evt, 2, 1, 0, true, false); } else { - handle_input_event (evt, 1, 1, autofire, true, false); + handle_input_event (evt, 2, 1, autofire, true, false); } didcustom |= process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, autofire, i); } else if (toggle) { @@ -5134,7 +5144,7 @@ static void setbuttonstateall (struct uae_input_device *id, struct uae_input_dev if (!checkqualifiers (evt, flags, qualmask, NULL)) continue; *flagsp ^= ID_FLAG_TOGGLED; - int toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0; + int toggled = (*flagsp & ID_FLAG_TOGGLED) ? 2 : 0; handle_input_event (evt, toggled, 1, autofire, true, false); didcustom |= process_custom_event (id, ID_BUTTON_OFFSET + button, toggled, qualmask, autofire, i); } else { @@ -6979,9 +6989,9 @@ static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int keyst na->flags[j][sublevdir[state == 0 ? 1 : 0][k]] &= ~ID_FLAG_TOGGLED; if (state) { queue_input_event (evt, NULL, -1, 0, 0, 1); - handled |= handle_input_event (evt, 1, 1, 0, true, false); + handled |= handle_input_event (evt, 2, 1, 0, true, false); } else { - handled |= handle_input_event (evt, 1, 1, autofire, true, false); + handled |= handle_input_event (evt, 2, 1, autofire, true, false); } didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); } else if (toggle) { @@ -6990,7 +7000,7 @@ static int inputdevice_translatekeycode_2 (int keyboard, int scancode, int keyst if (!checkqualifiers (evt, flags, qualmask, na->eventid[j])) continue; *flagsp ^= ID_FLAG_TOGGLED; - toggled = (*flagsp & ID_FLAG_TOGGLED) ? 1 : 0; + toggled = (*flagsp & ID_FLAG_TOGGLED) ? 2 : 0; handled |= handle_input_event (evt, toggled, 1, autofire, true, false); if (k == 0) { didcustom |= process_custom_event (na, j, state, qualmask, autofire, k); @@ -8702,6 +8712,8 @@ void inputdevice_fix_prefs(struct uae_prefs *p, bool userconfig) write_log(_T("Unplugged stored, port %d '%s' (%s)\n"), i, jp->idc.name, jp->idc.configname); inputdevice_store_used_device(&jpt, i, defaultports); freejport(p, i); + inputdevice_get_previous_joy(p, i); + matched[i] = true; } } } diff --git a/od-win32/avioutput.cpp b/od-win32/avioutput.cpp index 4d7da793..76cbb80a 100644 --- a/od-win32/avioutput.cpp +++ b/od-win32/avioutput.cpp @@ -1596,6 +1596,12 @@ void AVIOutput_WriteAudio(uae_u8 *sndbuffer, int sndbufsize) void frame_drawn (void) { + if (screenshot_multi) { + screenshot(1, 1); + if (screenshot_multi > 0) + screenshot_multi--; + } + if (!avioutput_enabled) return; if (avioutput_failed) diff --git a/od-win32/avioutput.h b/od-win32/avioutput.h index 0cd13598..a5a9c9b8 100644 --- a/od-win32/avioutput.h +++ b/od-win32/avioutput.h @@ -14,6 +14,7 @@ extern int avioutput_framelimiter, avioutput_nosoundoutput; extern int avioutput_nosoundsync, avioutput_originalsize; extern int screenshot_originalsize; extern int screenshot_clipmode; +extern int screenshot_multi; extern TCHAR avioutput_filename_gui[MAX_DPATH]; extern TCHAR avioutput_filename_auto[MAX_DPATH]; diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index a6f3f46e..81f49ad4 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -19,12 +19,14 @@ #include "gfxfilter.h" #include "xwin.h" #include "drawing.h" +#include "fsdb.h" #include "png.h" int screenshotmode = PNG_SCREENSHOTS; int screenshot_originalsize = 0; int screenshot_clipmode = 0; +int screenshot_multi = 0; static void namesplit (TCHAR *s) { @@ -75,6 +77,7 @@ static BITMAPINFO *bi; // bitmap info static LPVOID lpvBits = NULL; // pointer to bitmap bits array static HBITMAP offscreen_bitmap; static int screenshot_prepared; +static int screenshot_multi_start; void screenshot_free (void) { @@ -530,6 +533,14 @@ static int savebmp (FILE *fp) return 0; } +static void screenshot_prepare_multi(void) +{ + screenshot_multi_start = true; +} + +static int filenumber = 0; +static int dirnumber = 1; + /* Captures the Amiga display (DirectDraw, D3D or OpenGL) surface and saves it to file as a 24bit bitmap. */ @@ -538,6 +549,8 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, str static int recursive; FILE *fp = NULL; int failed = 0; + int screenshot_max = 1000; // limit 999 iterations / screenshots + TCHAR *format = _T("%s%s%s%03d.%s"); HBITMAP offscreen_bitmap = NULL; // bitmap that is converted to a DIB HDC offscreen_dc = NULL; // offscreen DC that we can select offscreen bitmap into @@ -562,7 +575,6 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, str TCHAR path[MAX_DPATH]; TCHAR name[MAX_DPATH]; TCHAR underline[] = _T("_"); - int number = 0; if (spath) { fp = _tfopen (spath, _T("wb")); @@ -580,6 +592,28 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, str } fetch_path (_T("ScreenshotPath"), path, sizeof (path) / sizeof (TCHAR)); CreateDirectory (path, NULL); + if (screenshot_multi) { + TCHAR *p = path + _tcslen(path); + while(dirnumber < 1000) { + _stprintf(p, _T("%03d\\"), dirnumber); + if (!screenshot_multi_start) + break; + filenumber = 0; + if (!my_existsdir(path) && !my_existsfile(path)) + break; + dirnumber++; + } + format = _T("%s%s%s%05d.%s"); + screenshot_max = 100000; + screenshot_multi_start = 0; + if (dirnumber == 1000) { + failed = 1; + goto oops; + } + CreateDirectory(path, NULL); + } + + name[0] = 0; if (currprefs.floppyslots[0].dfxtype >= 0) _tcscpy (name, currprefs.floppyslots[0].df); @@ -589,9 +623,9 @@ int screenshotf (const TCHAR *spath, int mode, int doprepare, int imagemode, str underline[0] = 0; namesplit (name); - while(++number < 1000) // limit 999 iterations / screenshots + while(++filenumber < screenshot_max) { - _stprintf (filename, _T("%s%s%s%03d.%s"), path, name, underline, number, screenshotmode ? _T("png") : _T("bmp")); + _stprintf (filename, format, path, name, underline, filenumber, screenshotmode ? _T("png") : _T("bmp")); if ((fp = _tfopen (filename, _T("rb"))) == NULL) // does file not exist? { int nok = 0; @@ -632,6 +666,9 @@ oops: recursive--; + if (failed) + screenshot_multi = 0; + return failed == 0; } @@ -639,9 +676,20 @@ oops: void screenshot (int mode, int doprepare) { -#if 1 - screenshotf (NULL, mode, doprepare, -1, NULL); -#else + if (mode == 2) { + screenshot_multi = 10; + screenshot_prepare_multi(); + } else if (mode == 3) { + screenshot_multi = -1; + screenshot_prepare_multi(); + } else if (mode == 4) { + screenshot_multi = 0; + filenumber = 0; + } else { + screenshotf(NULL, mode, doprepare, -1, NULL); + } + +#if 0 struct vidbuffer vb; int w = gfxvidinfo.drawbuffer.inwidth; int h = gfxvidinfo.drawbuffer.inheight;