int avioutput_audio, avioutput_video, avioutput_enabled, avioutput_requested;
static int videoallocated;
+static int aviout_width_out, aviout_height_out;
+static int aviout_xoffset_out, aviout_yoffset_out;
int avioutput_width, avioutput_height, avioutput_bits;
int avioutput_fps = VBLANK_HZ_PAL;
int avioutput_framelimiter = 0, avioutput_nosoundoutput = 0;
static int AVIOutput_AllocateVideo (void)
{
avioutput_width = avioutput_height = avioutput_bits = 0;
+ aviout_width_out = aviout_height_out = 0;
+ aviout_xoffset_out = aviout_yoffset_out = 0;
avioutput_fps = (int)(vblank_hz + 0.5);
if (!avioutput_fps)
} else {
freertgbuffer (getrtgbuffer (&avioutput_width, &avioutput_height, &pitch, &avioutput_bits, NULL));
}
+ aviout_width_out = avioutput_width + 15;
+ aviout_width_out &= ~15;
+ aviout_height_out = avioutput_height + 1;
+ aviout_height_out &= ~1;
}
if (avioutput_width == 0 || avioutput_height == 0 || avioutput_bits == 0) {
avioutput_height = workprefs.gfx_size.height;
avioutput_bits = WIN32GFX_GetDepth (0);
}
+ if (!aviout_height_out)
+ aviout_height_out = avioutput_height;
+ if (!aviout_width_out)
+ aviout_width_out = avioutput_width;
+
+ if (avioutput_originalsize) {
+ if (currprefs.aviout_width > 0)
+ aviout_width_out = currprefs.aviout_width;
+ if (currprefs.aviout_height > 0)
+ aviout_height_out = currprefs.aviout_height;
+ if (currprefs.aviout_xoffset >= 0)
+ aviout_xoffset_out = currprefs.aviout_xoffset;
+ if (currprefs.aviout_yoffset >= 0)
+ aviout_yoffset_out = currprefs.aviout_yoffset;
+ }
+
if (avioutput_bits == 0)
avioutput_bits = 24;
if (avioutput_bits > 24)
avioutput_bits = 24;
lpbi = (LPBITMAPINFOHEADER)xcalloc (uae_u8, lpbisize ());
lpbi->biSize = sizeof (BITMAPINFOHEADER);
- lpbi->biWidth = avioutput_width;
- lpbi->biHeight = avioutput_height;
+ lpbi->biWidth = aviout_width_out;
+ lpbi->biHeight = aviout_height_out;
lpbi->biPlanes = 1;
lpbi->biBitCount = avioutput_bits;
lpbi->biCompression = BI_RGB; // uncompressed format
int maxw, maxh;
mem = NULL;
- dpitch = ((avioutput_width * avioutput_bits + 31) & ~31) / 8;
+ dpitch = ((aviout_width_out * avioutput_bits + 31) & ~31) / 8;
if (original || WIN32GFX_IsPicassoScreen ()) {
if (!WIN32GFX_IsPicassoScreen ()) {
src = getfilterbuffer (&w, &h, &spitch, &d);
}
if (!src)
return 0;
- dst += dpitch * avioutput_height;
- for (y = 0; y < (maxh > avioutput_height ? avioutput_height : maxh); y++) {
- uae_u8 *d;
+
+ int xoffset = currprefs.aviout_xoffset < 0 ? (aviout_width_out - avioutput_width) / 2 : -currprefs.aviout_xoffset;
+ int yoffset = currprefs.aviout_yoffset < 0 ? (aviout_height_out - avioutput_height) / 2 : -currprefs.aviout_yoffset;
+
+ dst += dpitch * aviout_height_out;
+ if (yoffset > 0) {
+ if (yoffset >= aviout_height_out - avioutput_height)
+ yoffset = aviout_height_out - avioutput_height;
+ dst -= dpitch * yoffset;
+ } else if (yoffset < 0) {
+ yoffset = -yoffset;
+ if (yoffset >= avioutput_height - aviout_height_out)
+ yoffset = avioutput_height - aviout_height_out;
+ src += spitch * yoffset;
+ }
+ int xoffset2 = 0;
+ if (xoffset < 0) {
+ xoffset2 = -xoffset;
+ xoffset = 0;
+ }
+ int dbpx = avioutput_bits / 8;
+ int sbpx = avioutput_bits / 8;
+ if (sbpx == 3)
+ sbpx = 4;
+
+ for (y = 0; y < avioutput_height && y < maxh && y < aviout_height_out; y++) {
+ uae_u8 *s, *d;
dst -= dpitch;
d = dst;
- for (x = 0; x < (maxw > avioutput_width ? avioutput_width : maxw); x++) {
+ s = src;
+ if (xoffset > 0) {
+ d += xoffset * dbpx;
+ } else if (xoffset2 > 0) {
+ s += xoffset2 * sbpx;
+ }
+ for (x = 0; x < avioutput_width && x < maxw && x < aviout_width_out; x++) {
if (avioutput_bits == 8) {
- *d++ = src[x];
+ *d++ = s[x];
} else if (avioutput_bits == 16) {
- uae_u16 v = ((uae_u16*)src)[x];
+ uae_u16 v = ((uae_u16*)s)[x];
uae_u16 v2 = v;
if (rgb_type == 3) {
v2 = v & 31;
((uae_u16*)d)[0] = v2;
d += 2;
} else if (avioutput_bits == 32) {
- uae_u32 v = ((uae_u32*)src)[x];
+ uae_u32 v = ((uae_u32*)s)[x];
((uae_u32*)d)[0] = v;
d += 4;
} else if (avioutput_bits == 24) {
- uae_u32 v = ((uae_u32*)src)[x];
+ uae_u32 v = ((uae_u32*)s)[x];
*d++ = v;
*d++ = v >> 8;
*d++ = v >> 16;
WIN32GUI_LoadUIString (IDS_INPUT_CUSTOM, buf, sizeof buf / sizeof (TCHAR));
for (int i = 0; i < GAMEPORT_INPUT_SETTINGS; i++)
_stprintf (p->input_config_name[i], buf, i + 1);
+ p->aviout_xoffset = -1;
+ p->aviout_yoffset = -1;
}
if (type == 1 || type == 0 || type == 3) {
p->win32_uaescsimode = UAESCSI_CDEMU;
cfgfile_target_dwrite (f, _T("framelatency"), _T("%d"), forcedframelatency);
if (scsiromselected > 0)
cfgfile_target_write(f, _T("expansion_gui_page"), expansionroms[scsiromselected].name);
+
+ cfgfile_target_dwrite(f, _T("recording_width"), _T("%d"), p->aviout_width);
+ cfgfile_target_dwrite(f, _T("recording_height"), _T("%d"), p->aviout_height);
+ cfgfile_target_dwrite(f, _T("recording_x"), _T("%d"), p->aviout_xoffset);
+ cfgfile_target_dwrite(f, _T("recording_y"), _T("%d"), p->aviout_yoffset);
}
void target_restart (void)
int i, v;
bool tbool;
- int result = (cfgfile_yesno(option, value, _T("middle_mouse"), &p->win32_middle_mouse)
+ if (cfgfile_yesno(option, value, _T("middle_mouse"), &p->win32_middle_mouse)
|| cfgfile_yesno(option, value, _T("map_drives"), &p->win32_automount_drives)
|| cfgfile_yesno(option, value, _T("map_drives_auto"), &p->win32_automount_removable)
|| cfgfile_yesno(option, value, _T("map_cd_drives"), &p->win32_automount_cddrives)
|| cfgfile_yesno(option, value, _T("right_control_is_right_win"), &p->right_control_is_right_win_key)
|| cfgfile_intval(option, value, _T("extraframewait"), &extraframewait, 1)
|| cfgfile_intval(option, value, _T("framelatency"), &forcedframelatency, 1)
- || cfgfile_intval(option, value, _T("cpu_idle"), &p->cpu_idle, 1));
+ || cfgfile_intval(option, value, _T("cpu_idle"), &p->cpu_idle, 1))
+ return 1;
+ if (cfgfile_intval(option, value, _T("recording_width"), &p->aviout_width, 1)
+ || cfgfile_intval(option, value, _T("recording_height"), &p->aviout_height, 1)
+ || cfgfile_intval(option, value, _T("recording_x"), &p->aviout_xoffset, 1)
+ || cfgfile_intval(option, value, _T("recording_y"), &p->aviout_yoffset, 1))
+ return 1;
if (cfgfile_string(option, value, _T("expansion_gui_page"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
TCHAR *p = _tcschr(tmpbuf, ',');
i++;
}
- return result;
+ return 0;
}
static void createdir (const TCHAR *path)