*/
-#define CALC_DEBUG 1
+#define CALC_DEBUG 0
#if CALC_DEBUG
#define calc_log(x) do { write_log x; } while(0)
double val;
};
-static double docalcx (TCHAR op, double v1, double v2)
+static double docalcx(TCHAR op, double v1, double v2)
{
switch (op)
{
}
}
-static double docalc2 (TCHAR op, struct calcstack *sv1, struct calcstack *sv2)
+static double docalc2(TCHAR op, struct calcstack *sv1, struct calcstack *sv2)
{
double v1, v2;
v2 = stacktoval(sv2);
return docalcx (op, v1, v2);
}
-static double docalc1 (TCHAR op, struct calcstack *sv1, double v2)
+static double docalc1(TCHAR op, struct calcstack *sv1, double v2)
{
double v1;
return docalcx (op, v1, v2);
}
-static TCHAR *stacktostr (struct calcstack *st)
+static TCHAR *stacktostr(struct calcstack *st)
{
static TCHAR out[256];
if (st->s)
return out;
}
-static TCHAR *chartostack (TCHAR c)
+static TCHAR *chartostack(TCHAR c)
{
TCHAR *s = xmalloc (TCHAR, 2);
s[0] = c;
TCHAR *in = inbuf;
TCHAR *p = out;
op = 0;
+ if (in[0] == '-' || in[0] == '+') {
+ *p++ = '0';
+ }
while (*in) {
TCHAR *instart = in;
if (_istdigit (*in)) {
return stored_chipset_refresh != get_chipset_refresh ();
}
-static void compute_framesync (void)
+void compute_framesync (void)
{
int islace = interlace_seen ? 1 : 0;
int isntsc = (beamcon0 & 0x20) ? 0 : 1;
}
+ if (gfxvidinfo.drawbuffer.inwidth > gfxvidinfo.drawbuffer.width_allocated)
+ gfxvidinfo.drawbuffer.inwidth = gfxvidinfo.drawbuffer.width_allocated;
+ if (gfxvidinfo.drawbuffer.inwidth2 > gfxvidinfo.drawbuffer.width_allocated)
+ gfxvidinfo.drawbuffer.inwidth2 = gfxvidinfo.drawbuffer.width_allocated;
- if (gfxvidinfo.drawbuffer.inwidth > gfxvidinfo.drawbuffer.width)
- gfxvidinfo.drawbuffer.inwidth = gfxvidinfo.drawbuffer.width;
- if (gfxvidinfo.drawbuffer.inwidth2 > gfxvidinfo.drawbuffer.width)
- gfxvidinfo.drawbuffer.inwidth2 = gfxvidinfo.drawbuffer.width;
+ if (gfxvidinfo.drawbuffer.inheight > gfxvidinfo.drawbuffer.height_allocated)
+ gfxvidinfo.drawbuffer.inheight = gfxvidinfo.drawbuffer.height_allocated;
+ if (gfxvidinfo.drawbuffer.inheight2 > gfxvidinfo.drawbuffer.height_allocated)
+ gfxvidinfo.drawbuffer.inheight2 = gfxvidinfo.drawbuffer.height_allocated;
- if (gfxvidinfo.drawbuffer.inheight > gfxvidinfo.drawbuffer.height)
- gfxvidinfo.drawbuffer.inheight = gfxvidinfo.drawbuffer.height;
- if (gfxvidinfo.drawbuffer.inheight2 > gfxvidinfo.drawbuffer.height)
- gfxvidinfo.drawbuffer.inheight2 = gfxvidinfo.drawbuffer.height;
+ gfxvidinfo.drawbuffer.outwidth = gfxvidinfo.drawbuffer.inwidth;
+ gfxvidinfo.drawbuffer.outheight = gfxvidinfo.drawbuffer.inheight;
+
+ if (gfxvidinfo.drawbuffer.outwidth > gfxvidinfo.drawbuffer.width_allocated)
+ gfxvidinfo.drawbuffer.outwidth = gfxvidinfo.drawbuffer.width_allocated;
+
+ if (gfxvidinfo.drawbuffer.outheight > gfxvidinfo.drawbuffer.height_allocated)
+ gfxvidinfo.drawbuffer.outheight = gfxvidinfo.drawbuffer.height_allocated;
+
+ if (target_graphics_buffer_update ()) {
+ reset_drawing ();
+ }
compute_vsynctime ();
void init_row_map (void)
{
int i, j;
- if (gfxvidinfo.drawbuffer.height > MAX_VIDHEIGHT) {
+ if (gfxvidinfo.drawbuffer.height_allocated > MAX_VIDHEIGHT) {
write_log (_T("Resolution too high, aborting\n"));
abort ();
}
j = 0;
- for (i = gfxvidinfo.drawbuffer.height; i < MAX_VIDHEIGHT + 1; i++)
+ for (i = gfxvidinfo.drawbuffer.height_allocated; i < MAX_VIDHEIGHT + 1; i++)
row_map[i] = row_tmp;
- for (i = 0; i < gfxvidinfo.drawbuffer.height; i++, j += gfxvidinfo.drawbuffer.rowbytes)
+ for (i = 0; i < gfxvidinfo.drawbuffer.height_allocated; i++, j += gfxvidinfo.drawbuffer.rowbytes)
row_map[i] = gfxvidinfo.drawbuffer.bufmem + j;
}
-static void init_aspect_maps (void)
+void init_aspect_maps (void)
{
- int i, maxl;
+ int i, maxl, h;
- if (gfxvidinfo.drawbuffer.height == 0)
+ h = gfxvidinfo.drawbuffer.height_allocated;
+
+ if (h == 0)
/* Do nothing if the gfx driver hasn't initialized the screen yet */
return;
/* At least for this array the +1 is necessary. */
amiga2aspect_line_map = xmalloc (int, (MAXVPOS + 1) * 2 + 1);
- native2amiga_line_map = xmalloc (int, gfxvidinfo.drawbuffer.height);
+ native2amiga_line_map = xmalloc (int, h);
maxl = (MAXVPOS + 1) << linedbld;
min_ypos_for_screen = minfirstline << linedbl;
max_drawn_amiga_line = -1;
for (i = 0; i < maxl; i++) {
int v = i - min_ypos_for_screen;
- if (v >= gfxvidinfo.drawbuffer.height && max_drawn_amiga_line < 0)
+ if (v >= h && max_drawn_amiga_line < 0)
max_drawn_amiga_line = i - min_ypos_for_screen;
- if (i < min_ypos_for_screen || v >= gfxvidinfo.drawbuffer.height)
+ if (i < min_ypos_for_screen || v >= h)
v = -1;
amiga2aspect_line_map[i] = v;
}
if (currprefs.gfx_ycenter && !currprefs.gfx_filter_autoscale) {
/* @@@ verify maxvpos vs. MAXVPOS */
- extra_y_adjust = (gfxvidinfo.drawbuffer.height - (maxvpos_nom << linedbl)) >> 1;
+ extra_y_adjust = (h - (maxvpos_nom << linedbl)) >> 1;
if (extra_y_adjust < 0)
extra_y_adjust = 0;
}
- for (i = 0; i < gfxvidinfo.drawbuffer.height; i++)
+ for (i = 0; i < h; i++)
native2amiga_line_map[i] = -1;
for (i = maxl - 1; i >= min_ypos_for_screen; i--) {
int j;
if (amiga2aspect_line_map[i] == -1)
continue;
- for (j = amiga2aspect_line_map[i]; j < gfxvidinfo.drawbuffer.height && native2amiga_line_map[j] == -1; j++)
+ for (j = amiga2aspect_line_map[i]; j < h && native2amiga_line_map[j] == -1; j++)
native2amiga_line_map[j] = i >> linedbl;
}
p = lightpen_cursor + y * LIGHTPEN_WIDTH;
for (i = 0; i < LIGHTPEN_WIDTH; i++) {
int xx = x + i - LIGHTPEN_WIDTH / 2;
- if (*p != '-' && xx >= 0 && xx < gfxvidinfo.drawbuffer.width)
+ if (*p != '-' && xx >= 0 && xx < gfxvidinfo.drawbuffer.outwidth)
putpixel (xlinebuffer, gfxvidinfo.drawbuffer.pixbytes, xx, *p == 'x' ? xcolors[color1] : xcolors[color2], 1);
p++;
}
lightpen_update (vb);
if (currprefs.monitoremu && gfxvidinfo.tempbuffer.bufmem_allocated) {
+ static bool specialon;
if (emulate_specialmonitors (vb, &gfxvidinfo.tempbuffer)) {
vb = gfxvidinfo.outbuffer = &gfxvidinfo.tempbuffer;
if (vb->nativepositioning) {
vb->outwidth = gfxvidinfo.drawbuffer.outwidth;
vb->outheight = gfxvidinfo.drawbuffer.outheight;
}
+ gfxvidinfo.drawbuffer.tempbufferinuse = true;
+ if (!specialon)
+ compute_framesync ();
+ specialon = true;
do_flush_screen (vb, 0, vb->outheight);
didflush = true;
+ } else {
+ gfxvidinfo.drawbuffer.tempbufferinuse = false;
+ if (specialon)
+ compute_framesync ();
+ specialon = false;
}
}
if (!dst->bufmem_allocated)
return;
uae_u8 *p = dst->bufmem_allocated;
- for (int y = 0; y < dst->height; y++) {
- memset (p, 0, dst->width * dst->pixbytes);
+ for (int y = 0; y < dst->height_allocated; y++) {
+ memset (p, 0, dst->width_allocated * dst->pixbytes);
p += dst->rowbytes;
}
}
extern void alloc_cycle_ext (int, int);
extern bool ispal (void);
extern int current_maxvpos (void);
-struct chipset_refresh *get_chipset_refresh (void);
+extern struct chipset_refresh *get_chipset_refresh (void);
+extern void compute_framesync (void);
\ No newline at end of file
extern int lockscr (struct vidbuffer*, bool);
extern void unlockscr (struct vidbuffer*);
+extern bool target_graphics_buffer_update (void);
extern int debuggable (void);
extern void LED (int);
int rowbytes; /* Bytes per row in the memory pointed at by bufmem. */
int pixbytes; /* Bytes per pixel. */
/* size of this buffer */
- int width;
- int height;
+ int width_allocated;
+ int height_allocated;
/* size of max visible image */
int outwidth;
int outheight;
int inheight2;
/* use drawbuffer instead */
bool nativepositioning;
+ /* tempbuffer in use */
+ bool tempbufferinuse;
/* extra width, chipset hpos extra in right border */
int extrawidth;
int joy;
bool isaks = false;
- if (nr <= 0)
+ if (nr <= 0 || nr == INPUTEVENT_SPC_CUSTOM_EVENT)
return 0;
ie = &events[nr];
if (isqual (nr))
int idx, slotoffset, flags, custompos;
TCHAR *custom;
+ queue_input_event (-1, NULL, -1, 0, 0, 1);
+ if (!id)
+ return;
+
slotoffset = 0;
if (!checkqualifiers (id->eventid[offset][slotoffset], id->flags[offset][slotoffset], qualmask)) {
slotoffset = 4;
custom = id->custom[offset][idx - 2 + slotoffset];
}
- handle_custom_event (custom);
-
if (autofire)
queue_input_event (-1, custom, 1, 1, currprefs.input_autofire_linecnt, 1);
- if (!state)
- queue_input_event (-1, NULL, -1, 0, 0, 1);
-
-
- id->flags[offset][slotoffset] &= ~ID_FLAG_CUSTOMEVENT_TOGGLED;
- id->flags[offset][slotoffset] |= custompos ? ID_FLAG_CUSTOMEVENT_TOGGLED : 0;
+ if (state) {
+ handle_custom_event (custom);
+ id->flags[offset][slotoffset] &= ~ID_FLAG_CUSTOMEVENT_TOGGLED;
+ id->flags[offset][slotoffset] |= custompos ? ID_FLAG_CUSTOMEVENT_TOGGLED : 0;
+ }
}
static void setbuttonstateall (struct uae_input_device *id, struct uae_input_device2 *id2, int button, int state)
int toggle = (flags & ID_FLAG_TOGGLE) ? 1 : 0;
int inverttoggle = (flags & ID_FLAG_INVERTTOGGLE) ? 1 : 0;
+ if (!state) {
+ if (i == 0)
+ process_custom_event (id, ID_BUTTON_OFFSET + button, state, qualmask, autofire);
+ }
+
setqualifiers (flags, state > 0);
if (qualonly)
continue;
process_custom_event (id, ID_BUTTON_OFFSET + button, toggled, qualmask, autofire);
} else {
if (!checkqualifiers (evt, flags, qualmask)) {
- if (!state && !(flags & ID_FLAG_CANRELEASE))
+ if (!state && !(flags & ID_FLAG_CANRELEASE)) {
continue;
- else if (state)
+ } else if (state) {
continue;
+ }
}
if (!state)
*flagsp &= ~ID_FLAG_CANRELEASE;
int inputdevice_get_compatibility_input (struct uae_prefs *prefs, int index, int *typelist, int **inputlist, int **at)
{
- //write_log (L"index=%d joymodes=%d\n", index, joymodes[index]);
if (index >= MAX_JPORTS || joymodes[index] < 0)
return 0;
*typelist = joymodes[index];
if (!keyboards || scancode < 0)
return handled;
+ if (!state)
+ process_custom_event (NULL, 0, 0, 0, 0);
+
j = 0;
while (j < MAX_INPUT_DEVICE_EVENTS && na->extra[j] >= 0) {
if (na->extra[j] == scancode) {
return t;
}
-static int createtexture (int iw, int ih, int ow, int oh, int win_w, int win_h)
+static int worktex_width, worktex_height;
+
+static int createamigatexture (int w, int h)
{
HRESULT hr;
- texture = createtext (iw, ih, tformat);
+ if (texture)
+ texture->Release ();
+ texture = NULL;
+ if (lpWorkTexture1)
+ lpWorkTexture1->Release ();
+ lpWorkTexture1 = NULL;
+ if (lpWorkTexture2)
+ lpWorkTexture2->Release ();
+ lpWorkTexture2 = NULL;
+
+ texture = createtext (w, h, tformat);
if (!texture)
return 0;
- write_log (_T("%s: %d*%d texture allocated, bits per pixel %d\n"), D3DHEAD, iw, ih, t_depth);
+ write_log (_T("%s: %d*%d texture allocated, bits per pixel %d\n"), D3DHEAD, w, h, t_depth);
+ if (psActive) {
+ D3DLOCKED_BOX lockedBox;
+ if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
+ write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
+ return 0;
+ }
+ if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
+ write_log (_T("%s: Failed to create working texture2: %s\n"), D3DHEAD, D3D_ErrorString (hr));
+ return 0;
+ }
+ if (FAILED (hr = lpHq2xLookupTexture->LockBox (0, &lockedBox, NULL, 0))) {
+ write_log (_T("%s: Failed to lock box of volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
+ return 0;
+ }
+ BuildHq2xLookupTexture (worktex_width, worktex_height, w, h, (unsigned char*)lockedBox.pBits);
+ lpHq2xLookupTexture->UnlockBox (0);
+ }
+ return 1;
+}
+
+static int createtexture (int ow, int oh, int win_w, int win_h)
+{
+ HRESULT hr;
+
int w, h;
if (ow > win_w * multx && oh > win_h * multx) {
w = ow;
w = win_w * multx;
h = win_h * multx;
}
+ worktex_width = w;
+ worktex_height = h;
if (FAILED (hr = d3ddev->CreateTexture (w, h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpTempTexture, NULL))) {
write_log (_T("%s: Failed to create working texture1: %s\n"), D3DHEAD, D3D_ErrorString (hr));
return 0;
texelsize.x = 1.0f / w; texelsize.y = 1.0f / h; texelsize.z = 1; texelsize.w = 1;
if (psActive) {
- D3DLOCKED_BOX lockedBox;
- if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture1, NULL))) {
- write_log (_T("%s: Failed to create temp texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
- return 0;
- }
- if (FAILED (hr = d3ddev->CreateTexture (iw, ih, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpWorkTexture2, NULL))) {
- write_log (_T("%s: Failed to create working texture2: %s\n"), D3DHEAD, D3D_ErrorString (hr));
- return 0;
- }
if (FAILED (hr = d3ddev->CreateVolumeTexture (256, 16, 256, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &lpHq2xLookupTexture, NULL))) {
write_log (_T("%s: Failed to create volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
return 0;
}
- if (FAILED (hr = lpHq2xLookupTexture->LockBox (0, &lockedBox, NULL, 0))) {
- write_log (_T("%s: Failed to lock box of volume texture: %s\n"), D3DHEAD, D3D_ErrorString (hr));
- return 0;
- }
- BuildHq2xLookupTexture (w, h, iw, ih, (unsigned char*)lockedBox.pBits);
- lpHq2xLookupTexture->UnlockBox (0);
}
return 1;
RECT sr, dr, zr;
float w, h;
float dw, dh;
- int resmult, vresmult;
static RECT sr2, dr2, zr2;
//write_log (_T("%dx%d %dx%d %dx%d\n"), tin_w, tin_h, tin_w, tin_h, window_w, window_h);
- resmult = 1 << (gfxvidinfo.gfx_resolution_reserved - currprefs.gfx_resolution);
- vresmult = 1 << (gfxvidinfo.gfx_vresolution_reserved - currprefs.gfx_vresolution);
-
- getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / (mult * resmult), tin_h / (mult * vresmult), mult, tin_w / resmult, tin_h / vresmult);
+ getfilterrect2 (&dr, &sr, &zr, window_w, window_h, tin_w / mult, tin_h / mult, mult, tin_w, tin_h);
if (memcmp (&sr, &sr2, sizeof RECT) || memcmp (&dr, &dr2, sizeof RECT) || memcmp (&zr, &zr2, sizeof RECT)) {
write_log (_T("POS (%d %d %d %d) - (%d %d %d %d)[%d,%d] (%d %d)\n"),
createmask2texture (currprefs.gfx_filteroverlay);
- if (!createtexture (tin_w, tin_h, tout_w, tout_h, window_w, window_h))
+ if (!createtexture (tout_w, tout_h, window_w, window_h))
return 0;
createledtexture ();
hr = d3ddev->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE);
hr = d3ddev->SetRenderState (D3DRS_LIGHTING, FALSE);
- setupscenecoords ();
settransform ();
return 1;
return D3DADAPTER_DEFAULT;
}
-const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth, int mmult)
+const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int depth, int mmult)
{
HRESULT ret, hr;
static TCHAR errmsg[100] = { 0 };
write_log (_T("%s\n"), errmsg);
write_log (_T("%s: Retrying fullscreen with DirectDraw\n"), D3DHEAD);
if (ddraw_fs_hack_init ()) {
- const TCHAR *err2 = D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult);
+ const TCHAR *err2 = D3D_init (ahwnd, w_w, w_h, depth, mmult);
if (err2)
ddraw_fs_hack_free ();
return err2;
if (d3d_ex && D3DEX) {
write_log (_T("%s\n"), errmsg);
D3DEX = 0;
- return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult);
+ return D3D_init (ahwnd, w_w, w_h, depth, mmult);
}
D3D_free ();
return errmsg;
if ((d3dCaps.PixelShaderVersion < D3DPS_VERSION(2,0) || !psEnabled || max_texture_w < 2048 || max_texture_h < 2048 || !shaderon) && d3d_ex) {
D3DEX = 0;
write_log (_T("Disabling D3D9Ex\n"));
- return D3D_init (ahwnd, w_w, w_h, t_w, t_h, depth, mult);
+ return D3D_init (ahwnd, w_w, w_h, depth, mmult);
}
if (!shaderon)
write_log (_T("Using non-shader version\n"));
- window_w = w_w;
- window_h = w_h;
multx = mmult;
mult = S2X_getmult ();
- tin_w = t_w * mult;
- tin_h = t_h * mult;
- tout_w = tin_w * multx;
- tout_h = tin_h * multx;
+
+ window_w = w_w;
+ window_h = w_h;
if (max_texture_w < w_w || max_texture_h < w_h) {
_stprintf (errmsg, _T("%s: %d * %d or bigger texture support required\nYour card's maximum texture size is only %d * %d"),
- D3DHEAD, t_w, t_h, max_texture_w, max_texture_h);
+ D3DHEAD, w_w, w_h, max_texture_w, max_texture_h);
return errmsg;
}
while (multx > 1 && (w_w * multx > max_texture_w || w_h * multx > max_texture_h))
return 0;
}
+bool D3D_alloctexture (int w, int h)
+{
+ tin_w = w * mult;
+ tin_h = h * mult;
+
+ tout_w = tin_w * multx;
+ tout_h = tin_h * multx;
+
+ if (!createamigatexture (tin_w, tin_h))
+ return false;
+ return true;
+}
+
static HRESULT reset (void)
{
if (d3dex)
{
HRESULT hr;
- if (!isd3d ())
+ if (!isd3d () || !texture)
return;
if (currprefs.leds_on_screen & (STATUSLINE_CHIPSET | STATUSLINE_RTG))
updateleds ();
void D3D_flushtexture (int miny, int maxy)
{
- if (fulllocked)
+ if (fulllocked || !texture)
return;
if (miny >= 0 && maxy >= 0) {
RECT r;
if (D3D_needreset () > 0)
return NULL;
- if (!isd3d ())
+ if (!isd3d () || !texture)
return NULL;
lock.pBits = NULL;
{
static int vsync2_cnt;
- if (!isd3d ())
+ if (!isd3d () || !texture)
return false;
if (filenotificationhandle != NULL) {
extern void D3D_resize (int width, int height);
extern void D3D_free (void);
-extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, int depth, int mult);
+extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int h_h, int depth, int mmult);
+extern bool D3D_alloctexture (int, int);
extern void D3D_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a);
extern void D3D_refresh (void);
extern bool D3D_renderframe (void);
#define LANG_DLL 1
//#define WINUAEBETA _T("")
-#define WINUAEBETA _T("Beta 1")
-#define WINUAEDATE MAKEBD(2012, 3, 31)
+#define WINUAEBETA _T("Beta 2")
+#define WINUAEDATE MAKEBD(2012, 4, 1)
#define WINUAEEXTRA _T("")
//#define WINUAEEXTRA _T("AmiKit Preview")
#define WINUAEREV _T("")
dr->left = (temp_width - aws) / 2;
dr->top = (temp_height - ahs) / 2;
- dr->left -= (dst_width - gfxvidinfo.outbuffer->inwidth2) / 2;
- dr->top -= (dst_height - gfxvidinfo.outbuffer->inheight2) / 2;
+ dr->left -= (dst_width - aws) / 2;
+ dr->top -= (dst_height - ahs) / 2;
dr->right = dr->left + dst_width;
dr->bottom = dr->top + dst_height;
cy = 0;
cv = 1;
if (scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_INTEGER) {
- cw -= 40 << currprefs.gfx_resolution;
+ cw -= 50 << currprefs.gfx_resolution;
ch -= 25 << currprefs.gfx_vresolution;
- cx = 28 << currprefs.gfx_resolution;
+ cx = 18 << currprefs.gfx_resolution;
cy = 10 << currprefs.gfx_vresolution;
}
}
OffsetRect (dr, mrsx, mrsy);
}
-
-
fpux_restore (&fpuv);
}
*depth = amiga_depth;
if (usedfilter == NULL)
return NULL;
- *widthp = vb->width;
- *heightp = vb->height;
+ *widthp = vb->outwidth;
+ *heightp = vb->outheight;
if (pitch)
*pitch = vb->rowbytes;
*depth = vb->pixbytes * 8;
dst_width2 = dw;
dst_height2 = dh;
dst_depth2 = dd;
- amiga_width2 = vb->width;
- amiga_height2 = vb->height;
+ amiga_width2 = vb->outwidth;
+ amiga_height2 = vb->outheight;
amiga_depth2 = vb->pixbytes * 8;
dst_width = dw;
dst_height = dh;
dst_depth = dd;
- amiga_width = vb->width;
- amiga_height = vb->height;
+ amiga_width = vb->outwidth;
+ amiga_height = vb->outheight;
amiga_depth = vb->pixbytes * 8;
if (d3d) {
{
if (lockscr (vb, true)) {
int y;
- for (y = 0; y < vb->height; y++) {
- memset (vb->bufmem + y * vb->rowbytes, 0, vb->width * vb->pixbytes);
+ for (y = 0; y < vb->height_allocated; y++) {
+ memset (vb->bufmem + y * vb->rowbytes, 0, vb->width_allocated * vb->pixbytes);
}
unlockscr (vb);
flush_screen (vb, 0, 0);
return 1;
}
-static void allocsoftbuffer (struct vidbuffer *buf, int flags, int width, int height, int depth)
+static void allocsoftbuffer (const TCHAR *name, struct vidbuffer *buf, int flags, int width, int height, int depth)
{
buf->pixbytes = (depth + 7) / 8;
- buf->width = (width + 7) & ~7;
- buf->height = height;
+ buf->width_allocated = (width + 7) & ~7;
+ buf->height_allocated = height;
if (!(flags & DM_SWSCALE)) {
} else if (flags & DM_SWSCALE) {
- int w = buf->width * 2;
- int h = buf->height * 2;
+ int w = buf->width_allocated * 2;
+ int h = buf->height_allocated * 2;
int size = (w * 2) * (h * 3) * buf->pixbytes;
buf->realbufmem = xcalloc (uae_u8, size);
buf->bufmem_allocated = buf->bufmem = buf->realbufmem + (w + (w * 2) * h) * buf->pixbytes;
buf->bufmemend = buf->realbufmem + size - buf->rowbytes;
buf->bufmem_lockable = true;
+ write_log (_T("Allocated %s temp buffer (%d*%d*%d)\n"), name, width, height, depth);
}
}
if (!create_windows_2 ())
return 0;
-
-
return set_ddraw ();
}
if (currprefs.gfx_resolution > gfxvidinfo.gfx_resolution_reserved)
gfxvidinfo.gfx_resolution_reserved = currprefs.gfx_resolution;
if (currprefs.gfx_vresolution > gfxvidinfo.gfx_vresolution_reserved)
- gfxvidinfo.gfx_vresolution_reserved = currprefs.gfx_resolution;
+ gfxvidinfo.gfx_vresolution_reserved = currprefs.gfx_vresolution;
//gfxvidinfo.drawbuffer.gfx_resolution_reserved = RES_SUPERHIRES;
}
if (gfxvidinfo.gfx_resolution_reserved == RES_SUPERHIRES)
currentmode->amiga_height *= 2;
- if (currentmode->amiga_height > 1024)
- currentmode->amiga_height = 1024;
+ if (currentmode->amiga_height > 1280)
+ currentmode->amiga_height = 1280;
gfxvidinfo.drawbuffer.inwidth = gfxvidinfo.drawbuffer.outwidth = currentmode->amiga_width;
gfxvidinfo.drawbuffer.inheight = gfxvidinfo.drawbuffer.outheight = currentmode->amiga_height;
- if (currprefs.monitoremu) {
- if (currentmode->amiga_width < 1024)
- currentmode->amiga_width = 1024;
- if (currentmode->amiga_height < 1024)
- currentmode->amiga_height = 1024;
- }
+
if (usedfilter) {
if ((usedfilter->flags & (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) == (UAE_FILTER_MODE_16 | UAE_FILTER_MODE_32)) {
currentmode->current_depth = currentmode->native_depth;
if (!screen_is_picasso) {
- allocsoftbuffer (&gfxvidinfo.drawbuffer, currentmode->flags,
- currentmode->current_width > currentmode->amiga_width ? currentmode->current_width : currentmode->amiga_width,
- currentmode->current_height > currentmode->amiga_height ? currentmode->current_height : currentmode->amiga_height,
- currentmode->current_depth);
- if (currprefs.monitoremu)
- allocsoftbuffer (&gfxvidinfo.tempbuffer, currentmode->flags,
+ allocsoftbuffer (_T("draw"), &gfxvidinfo.drawbuffer, currentmode->flags,
+ 1600, 1280, currentmode->current_depth);
+ if (currprefs.monitoremu) {
+ allocsoftbuffer (_T("monemu"), &gfxvidinfo.tempbuffer, currentmode->flags,
currentmode->amiga_width > 1024 ? currentmode->amiga_width : 1024,
currentmode->amiga_height > 1024 ? currentmode->amiga_height : 1024,
currentmode->current_depth);
-
- if (currentmode->current_width > gfxvidinfo.drawbuffer.outwidth)
- gfxvidinfo.drawbuffer.outwidth = currentmode->current_width;
- if (gfxvidinfo.drawbuffer.outwidth > gfxvidinfo.drawbuffer.width)
- gfxvidinfo.drawbuffer.outwidth = gfxvidinfo.drawbuffer.width;
-
- if (currentmode->current_height > gfxvidinfo.drawbuffer.outheight)
- gfxvidinfo.drawbuffer.outheight = currentmode->current_height;
- if (gfxvidinfo.drawbuffer.outheight > gfxvidinfo.drawbuffer.height)
- gfxvidinfo.drawbuffer.outheight = gfxvidinfo.drawbuffer.height;
+ }
init_row_map ();
}
init_colors ();
-
-#if defined (GFXFILTER)
S2X_free ();
-#ifdef D3D
if (currentmode->flags & DM_D3D) {
- const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height,
- screen_is_picasso ? picasso_vidinfo.width : gfxvidinfo.outbuffer->width,
- screen_is_picasso ? picasso_vidinfo.height : gfxvidinfo.outbuffer->height,
- currentmode->current_depth, screen_is_picasso ? 1 : currprefs.gfx_filter_filtermode + 1);
+ const TCHAR *err = D3D_init (hAmigaWnd, currentmode->native_width, currentmode->native_height, currentmode->current_depth, screen_is_picasso ? 1 : currprefs.gfx_filter_filtermode + 1);
if (err) {
D3D_free ();
gui_message (err);
goto oops;
}
}
-#endif
- if (currentmode->flags & DM_SWSCALE) {
- S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth);
- }
-#endif
+
screen_is_initialized = 1;
picasso_refresh ();
return ret;
}
+bool target_graphics_buffer_update (void)
+{
+ int w, h;
+
+ if (screen_is_picasso) {
+ w = picasso_vidinfo.width;
+ h = picasso_vidinfo.height;
+ } else {
+ struct vidbuffer *vb = gfxvidinfo.drawbuffer.tempbufferinuse ? &gfxvidinfo.tempbuffer : &gfxvidinfo.drawbuffer;
+ gfxvidinfo.outbuffer = vb;
+ w = vb->outwidth;
+ h = vb->outheight;
+ }
+
+ write_log (_T("Buffer size (%d*%d)\n"), w, h);
+
+ if (currentmode->flags & DM_D3D) {
+ D3D_alloctexture (w, h);
+ }
+ S2X_free ();
+ if (currentmode->flags & DM_SWSCALE) {
+ S2X_init (currentmode->native_width, currentmode->native_height, currentmode->native_depth);
+ }
+ return true;
+}
+
void WIN32GFX_WindowMove (void)
{
}
}
item = SendDlgItemMessage (hDlg, IDC_INPUTAMIGA, CB_GETCURSEL, 0, 0L);
if(item != CB_ERR) {
- if (item == 1) {
- if (item != input_selected_event)
+ if (item != input_selected_event) {
+ input_selected_event = (int)item;
+ doselect = 1;
+ if (item == 1) {
doinputcustom (hDlg, 1);
+ }
}
- input_selected_event = (int)item;
- doselect = 1;
}
if (inputchange && doselect && input_selected_device >= 0 && input_selected_event >= 0) {
int flags;
+ bool iscustom = false;
TCHAR custom[MAX_DPATH];
- custom[0] = 0;
+
+ if (!_tcscmp (inputdevice_get_eventinfo (INPUTEVENT_SPC_CUSTOM_EVENT)->name, eventnames[input_selected_event])) {
+ doinputcustom (hDlg, 1);
+ iscustom = true;
+ }
inputdevice_get_mapping (input_selected_device, input_selected_widget,
&flags, NULL, 0, custom, input_selected_sub_num);
- if (input_selected_event != 1)
+ if (input_selected_event != 1 && !iscustom)
custom[0] = 0;
inputdevice_set_mapping (input_selected_device, input_selected_widget,
eventnames[input_selected_event], _tcslen (custom) == 0 ? NULL : custom,
- restore only single input target to default.
- hdd from command line
+Beta 2:
+
+- Filter system partial rewrite again. Do not use static display buffer. Always dynamically reallocate internal buffer if
+ display mode changes (double scan modes, A2024 etc..). Fixes slowdown introduced in 2.4, also fixes shader filters
+ that expect texture size = output size. Very tall (>1024 line) programmed modes are also now fully visible.
+ Most likely some more updates needed..
+- Always cancel custom event autofire if any release event arrives.
+
Beta 1:
- Input custom event autofire support.
static void clearmonitor(struct vidbuffer *dst)
{
uae_u8 *p = dst->bufmem;
- for (int y = 0; y < dst->height; y++) {
- memset(p, 0, dst->width * dst->pixbytes);
+ for (int y = 0; y < dst->height_allocated; y++) {
+ memset(p, 0, dst->width_allocated * dst->pixbytes);
p += dst->rowbytes;
}
}