*/
/* ------------------------------------------------------------------------ */
-#if defined(NOBSTRING) && !defined(__STDC__)
+#if 0 && defined(NOBSTRING) && !defined(__STDC__)
void *
memmove(dst, src, cnt)
register char *dst, *src;
#define ctxPC (pContext->Eip)
#endif
-int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
+extern int mman_guard_exception (LPEXCEPTION_POINTERS);
+int EvalException (LPEXCEPTION_POINTERS blah, int n_except)
{
PEXCEPTION_RECORD pExceptRecord = NULL;
PCONTEXT pContext = NULL;
int dir=-1;
int len=0;
- if( n_except != STATUS_ACCESS_VIOLATION || !canbang)
+ if (n_except == STATUS_GUARD_PAGE_VIOLATION)
+ return mman_guard_exception (blah);
+ if (n_except != STATUS_ACCESS_VIOLATION || !canbang)
return EXCEPTION_CONTINUE_SEARCH;
pExceptRecord = blah->ExceptionRecord;
static void real_main2 (int argc, char **argv)
{
-#if defined (JIT) && (defined ( _WIN32 ) || defined (_WIN64)) && !defined ( NO_WIN32_EXCEPTION_HANDLER )
- extern int EvalException ( LPEXCEPTION_POINTERS blah, int n_except );
+#if defined (JIT) && (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER)
+ extern int EvalException (LPEXCEPTION_POINTERS blah, int n_except);
__try
#endif
{
id = shmget (IPC_PRIVATE, s, 0x1ff, file);
if (id == -1) {
+ static int recurse;
+ uae_u8 *p;
nocanbang();
- return mapped_malloc (s, file);
+ if (recurse)
+ return NULL;
+ recurse++;
+ p = mapped_malloc (s, file);
+ recurse--;
+ return p;
}
answer = shmat (id, 0, 0);
shmctl (id, IPC_RMID, NULL);
}
#ifdef DI_DEBUG
- write_log ("GUID=%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X:\n",
- lpddi->guidInstance.Data1, lpddi->guidInstance.Data2, lpddi->guidInstance.Data3,
- lpddi->guidInstance.Data4[0], lpddi->guidInstance.Data4[1], lpddi->guidInstance.Data4[2], lpddi->guidInstance.Data4[3],
- lpddi->guidInstance.Data4[4], lpddi->guidInstance.Data4[5], lpddi->guidInstance.Data4[6], lpddi->guidInstance.Data4[7]);
+ write_log ("I=%s ", outGUID (&lpddi->guidInstance));
+ write_log ("P=%s\n", outGUID (&lpddi->guidProduct));
write_log ("'%s' '%s' %08.8X [%s]\n", lpddi->tszProductName, lpddi->tszInstanceName, lpddi->dwDevType, typetxt);
#endif
DirectDraw_SetClipper (NULL);
releaser (dxdata.dclip, IDirectDrawClipper_Release);
}
+ releaser (dxdata.palette, IDirectDrawPalette_Release);
releaser (dxdata.flipping[1], IDirectDrawSurface7_Release);
releaser (dxdata.flipping[0], IDirectDrawSurface7_Release);
releaser (dxdata.primary, IDirectDrawSurface7_Release);
ddrval = IDirectDrawSurface7_Restore (surf);
if (FAILED (ddrval))
write_log ("IDirectDrawSurface7_Restore: %s\n", DXError (ddrval));
+ if (surf == dxdata.primary && dxdata.palette)
+ IDirectDrawSurface7_SetPalette (dxdata.primary, dxdata.palette);
return ddrval;
}
write_log ("IDirectDraw7_CreateSurface: %s\n", DXError (ddrval));
return ddrval;
}
+ ddrval = IDirectDrawSurface7_GetSurfaceDesc (dxdata.primary, &dxdata.native);
+ if (FAILED (ddrval))
+ write_log ("IDirectDrawSurface7_GetSurfaceDesc: %s\n", DXError (ddrval));
if (dxdata.fsmodeset)
clearsurface (dxdata.primary);
dxdata.backbuffers = desc.dwBackBufferCount;
clearsurface (dxdata.flipping[0]);
clearsurface (dxdata.flipping[1]);
- ddrval = IDirectDrawSurface7_GetSurfaceDesc (dxdata.primary, &dxdata.native);
- if (FAILED (ddrval))
- write_log ("IDirectDrawSurface7_GetSurfaceDesc: %s\n", DXError (ddrval));
surf = allocsurface (width, height);
if (surf) {
dxdata.secondary = surf;
}
-char *outGUID (GUID *guid)
+char *outGUID (const GUID *guid)
{
static char gb[64];
if (guid == NULL)
return RGBFB_B5G6R5PC;
if (b == 0x7C00 && g == 0x03E0 && r == 0x001F)
return RGBFB_B5G5R5PC;
- /* This happens under NT - with r == b == g == 0 !!! */
- write_log ("Unknown 16 bit format %d %d %d\n", r, g, b);
break;
case 24:
return result;
}
-static void quickblit (LPDIRECTDRAWSURFACE7 dst, LPDIRECTDRAWSURFACE7 src)
+static void DirectDraw_Blt (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSURFACE7 src, RECT *srcrect)
{
HRESULT ddrval;
- while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, NULL, src, NULL, DDBLT_WAIT, NULL))) {
+ if (dst == NULL)
+ dst = getlocksurface ();
+ while (FAILED(ddrval = IDirectDrawSurface7_Blt (dst, dstrect, src, srcrect, DDBLT_WAIT, NULL))) {
if (ddrval == DDERR_SURFACELOST) {
ddrval = restoresurface (dst);
if (FAILED (ddrval))
break;
} else if (ddrval != DDERR_SURFACEBUSY) {
- write_log ("quickblit: %s\n", DXError (ddrval));
+ write_log ("DirectDraw_Blit: %s\n", DXError (ddrval));
break;
}
}
}
+void DirectDraw_Blit (LPDIRECTDRAWSURFACE7 dst, LPDIRECTDRAWSURFACE7 src)
+{
+ DirectDraw_Blt (dst, NULL, src, NULL);
+}
+
+void DirectDraw_BlitRect (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSURFACE7 src, RECT *scrrect)
+{
+ DirectDraw_Blt (dst, dstrect, src, scrrect);
+}
+
+
extern int vblank_skip;
static void flip (void)
{
ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags | DDFLIP_INTERVAL2);
} else {
ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
- quickblit (dxdata.flipping[1], dxdata.primary);
+ DirectDraw_Blit (dxdata.flipping[1], dxdata.primary);
ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
}
}
} else {
ddrval = IDirectDrawSurface7_Flip (dxdata.primary, NULL, flags);
}
- quickblit (dxdata.flipping[1], dxdata.primary);
+ DirectDraw_Blit (dxdata.flipping[1], dxdata.primary);
} else if(dxdata.backbuffers == 1) {
ddrval = IDirectDrawSurface7_Flip(dxdata.primary, NULL, flags);
- quickblit (dxdata.flipping[0], dxdata.primary);
+ DirectDraw_Blit (dxdata.flipping[0], dxdata.primary);
}
if (ddrval == DDERR_SURFACELOST) {
static int recurse;
}
}
-
int DirectDraw_Flip (int wait)
{
if (getlocksurface () != dxdata.secondary) {
}
return 1;
}
+
+HRESULT DirectDraw_SetPaletteEntries (int start, int count, PALETTEENTRY *palette)
+{
+ HRESULT ddrval = DDERR_NOPALETTEATTACHED;
+ if (dxdata.palette)
+ ddrval = IDirectDrawPalette_SetEntries(dxdata.palette, 0, start, count, palette);
+ return ddrval;
+}
+HRESULT DirectDraw_SetPalette (int remove)
+{
+ HRESULT ddrval;
+ if (!dxdata.fsmodeset || (!dxdata.palette && !remove))
+ return DD_FALSE;
+ ddrval = IDirectDrawSurface7_SetPalette (dxdata.primary, remove ? NULL : dxdata.palette);
+ if (FAILED (ddrval))
+ write_log ("IDirectDrawSurface7_SetPalette: %s\n", DXError (ddrval));
+ return ddrval;
+}
+HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal)
+{
+ HRESULT ddrval;
+ ddrval = IDirectDraw_CreatePalette (dxdata.maindd, DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &dxdata.palette, NULL);
+ if (FAILED (ddrval))
+ write_log ("IDirectDraw_CreatePalette: %s\n", DXError (ddrval));
+ return ddrval;
+}
+
LPDIRECTDRAW7 maindd;
LPDIRECTDRAWCLIPPER dclip;
LPDIRECTDRAWSURFACE7 primary, secondary, flipping[2];
+ LPDIRECTDRAWPALETTE palette;
int fsmodeset, backbuffers;
int width, height, depth, freq;
int swidth, sheight;
} DirectDraw_Mask_e;
extern const char *DXError (HRESULT hr);
-extern char *outGUID (GUID *guid);
+extern char *outGUID (const GUID *guid);
HRESULT DirectDraw_GetDisplayMode (void);
void DirectDraw_Release(void);
HRESULT DirectDraw_FlipToGDISurface (void);
int DirectDraw_Flip (int wait);
int DirectDraw_BlitToPrimary (RECT *rect);
+void DirectDraw_Blit (LPDIRECTDRAWSURFACE7 dst, LPDIRECTDRAWSURFACE7 src);
+void DirectDraw_BlitRect (LPDIRECTDRAWSURFACE7 dst, RECT *dstrect, LPDIRECTDRAWSURFACE7 src, RECT *scrrect);
+
+HRESULT DirectDraw_SetPaletteEntries (int start, int count, PALETTEENTRY *palette);
+HRESULT DirectDraw_SetPalette (int remove);
+HRESULT DirectDraw_CreatePalette (LPPALETTEENTRY pal);
+
#endif
#define BARRIER 32
static struct shmid_ds shmids[MAX_SHMID];
-
-static int memorylocking = 0;
-
+static int memwatchok = 0;
uae_u8 *natmem_offset = NULL;
-
static uae_u8 *p96mem_offset;
+static int p96mem_size;
+static SYSTEM_INFO si;
static void *virtualallocwithlock(LPVOID addr, SIZE_T size, DWORD allocationtype, DWORD protect)
{
void *p = VirtualAlloc (addr, size, allocationtype, protect);
- if (p && memorylocking)
- VirtualLock(p, size);
return p;
}
static void virtualfreewithlock(LPVOID addr, SIZE_T size, DWORD freetype)
{
- if (memorylocking)
- VirtualUnlock(addr, size);
VirtualFree(addr, size, freetype);
}
return change;
}
-static uae_u32 max_allowed_mman;
+typedef UINT (CALLBACK* GETWRITEWATCH)
+ (DWORD,PVOID,SIZE_T,PVOID*,PULONG_PTR,PULONG);
+#define TEST_SIZE (2 * 4096)
+static int testwritewatch (void)
+{
+ GETWRITEWATCH pGetWriteWatch;
+ void *mem;
+ void *pages[16];
+ ULONG_PTR gwwcnt;
+ ULONG ps;
+ int ret = 0;
+
+ ps = si.dwPageSize;
+
+ pGetWriteWatch = (GETWRITEWATCH)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetWriteWatch");
+ if (pGetWriteWatch == NULL) {
+ write_log ("GetWriteWatch(): missing!?\n");
+ return 0;
+ }
+ mem = VirtualAlloc (NULL, TEST_SIZE, MEM_RESERVE | MEM_WRITE_WATCH, PAGE_EXECUTE_READWRITE);
+ if (mem == NULL) {
+ write_log ("GetWriteWatch(): MEM_WRITE_WATCH not supported!? err=%d\n", GetLastError());
+ return 0;
+ }
+ if (VirtualAlloc (mem, TEST_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE) == NULL) {
+ write_log ("GetWriteWatch(): test memory area MEM_COMMIT failed!? err=%d\n", GetLastError());
+ goto end;
+ }
+ ResetWriteWatch (mem, TEST_SIZE);
+ ((uae_u8*)mem)[1] = 0;
+ gwwcnt = TEST_SIZE / ps;
+ if (GetWriteWatch(WRITE_WATCH_FLAG_RESET, mem, TEST_SIZE, pages, &gwwcnt, &ps)) {
+ write_log ("GetWriteWatch(): failed!? err=%d\n", GetLastError ());
+ goto end;
+ }
+ if (ps != si.dwPageSize) {
+ write_log ("GetWriteWatch(): pagesize %d != %d!?\n", si.dwPageSize, ps);
+ goto end;
+ }
+ if (gwwcnt != 1) {
+ write_log ("GetWriteWatch(): modified pages returned %d != 1!?\n", gwwcnt);
+ goto end;
+ }
+ if (pages[0] != mem) {
+ write_log ("GetWriteWatch(): modified page was wrong!?\n");
+ goto end;
+ }
+ write_log ("GetWriteWatch() test ok\n");
+ ret = 1;
+ memwatchok = 1;
+end:
+ if (mem) {
+ VirtualFree (mem, TEST_SIZE, MEM_DECOMMIT);
+ VirtualFree (mem, TEST_SIZE, MEM_RELEASE);
+ }
+ return ret;
+}
+
+static uae_u8 *memwatchtable;
+
+int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity)
+{
+ int i, j;
+
+ if (memwatchok)
+ return GetWriteWatch (WRITE_WATCH_FLAG_RESET, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity);
+ j = 0;
+ for (i = 0; i < p96mem_size / si.dwPageSize; i++) {
+ if (j >= *lpdwCount)
+ break;
+ if (memwatchtable[i])
+ lpAddresses[j++] = p96mem_offset + i * si.dwPageSize;
+ }
+ *lpdwCount = j;
+ *lpdwGranularity = si.dwPageSize;
+ return 0;
+}
+void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize)
+{
+ if (!memwatchok) {
+ DWORD op;
+ memset (memwatchtable, 0, p96mem_size / si.dwPageSize);
+ if (!VirtualProtect (lpBaseAddress, dwRegionSize, PAGE_READWRITE | PAGE_GUARD, &op))
+ write_log ("VirtualProtect() failed, err=%d\n", GetLastError ());
+ }
+}
+
+int mman_guard_exception (LPEXCEPTION_POINTERS p)
+{
+ PEXCEPTION_RECORD record = p->ExceptionRecord;
+ PCONTEXT context = p->ContextRecord;
+ ULONG_PTR addr = record->ExceptionInformation[1];
+ int rw = record->ExceptionInformation[0];
+ ULONG_PTR p96addr = (ULONG_PTR)p96mem_offset;
+
+ if (memwatchok)
+ return EXCEPTION_CONTINUE_SEARCH;
+ if (addr < p96addr || addr >= p96addr + p96mem_size)
+ return EXCEPTION_CONTINUE_EXECUTION;
+ addr -= p96addr;
+ addr /= si.dwPageSize;
+ memwatchtable[addr] = 1;
+ return EXCEPTION_CONTINUE_EXECUTION;
+}
+
static uae_u64 size64;
- typedef BOOL (CALLBACK* GLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX);
+typedef BOOL (CALLBACK* GLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX);
void preinit_shm (void)
{
MEMORYSTATUS memstats;
GLOBALMEMORYSTATUSEX pGlobalMemoryStatusEx;
MEMORYSTATUSEX memstatsex;
+ uae_u32 max_allowed_mman;
+ GetSystemInfo (&si);
max_allowed_mman = 1536;
if (os_64bit)
max_allowed_mman = 2048;
if (max_allowed_mman * 1024 * 1024 > size64)
max_allowed_mman = size64 / (1024 * 1024);
max_z3fastmem = (max_allowed_mman - (max_allowed_mman >> 3)) * 1024 * 1024;
+ if (max_z3fastmem < 512 * 1024 * 1024)
+ max_z3fastmem = 512 * 1024 * 1024;
write_log ("Max Z3FastRAM %dM. Total physical RAM %uM\n", max_z3fastmem >> 20, totalphys64 >> 20);
+ testwritewatch ();
canbang = 1;
}
shmids[i].name[0] = 0;
}
natmemsize = size + z3size;
+ if (!currprefs.gfxmem_size) {
+ natmemsize += si.dwPageSize;
+ } else {
+ xfree (memwatchtable);
+ memwatchtable = 0;
+ if (!memwatchok) {
+ write_log ("GetWriteWatch() not supported, using guard pages, performance will be slower.\n");
+ memwatchtable = xcalloc (currprefs.gfxmem_size / si.dwPageSize + 1, 1);
+ }
+ }
for (;;) {
int change;
- blah = VirtualAlloc(NULL, natmemsize, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ blah = VirtualAlloc (NULL, natmemsize, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (blah)
break;
- write_log ("NATMEM: %dM area failed to allocate, err=%d\n", natmemsize >> 20, GetLastError());
+ write_log ("NATMEM: %dM area failed to allocate, err=%d\n", natmemsize >> 20, GetLastError ());
change = lowmem ();
totalsize -= change;
if (change == 0 || totalsize < 0x10000000) {
}
}
natmem_offset = blah;
- p96mem_offset = VirtualAlloc(natmem_offset + size + z3size, currprefs.gfxmem_size + 4096, MEM_RESERVE | MEM_WRITE_WATCH, PAGE_EXECUTE_READWRITE);
- if (!p96mem_offset) {
- currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
- write_log ("NATMEM: failed to allocate special Picasso96 GFX RAM\n");
+ if (currprefs.gfxmem_size) {
+ p96mem_size = currprefs.gfxmem_size + si.dwPageSize;
+ p96mem_offset = VirtualAlloc (natmem_offset + size + z3size, p96mem_size,
+ MEM_RESERVE | (memwatchok ? MEM_WRITE_WATCH : 0), PAGE_READWRITE);
+ if (!p96mem_offset) {
+ currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
+ write_log ("NATMEM: failed to allocate special Picasso96 GFX RAM, err=%d\n", GetLastError ());
+ }
}
if (!natmem_offset) {
- write_log ("NATMEM: No special area could be allocated! (1)\n");
+ write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", GetLastError ());
} else {
write_log ("NATMEM: Our special area: 0x%p-0x%p (%08x %dM)\n",
natmem_offset, (uae_u8*)natmem_offset + natmemsize,
void *result = (void *)-1;
BOOL got = FALSE;
int p96special = FALSE;
+ DWORD protect = PAGE_READWRITE;
#ifdef NATMEM_OFFSET
unsigned int size=shmids[shmid].size;
p96ram_start = p96mem_offset - natmem_offset;
shmaddr = natmem_offset + p96ram_start;
size += BARRIER;
+ if (!memwatchok)
+ protect |= PAGE_GUARD;
}
if(!strcmp(shmids[shmid].name,"bogo")) {
shmaddr=natmem_offset+0x00C00000;
got = FALSE;
if (got == FALSE) {
if (shmaddr)
- virtualfreewithlock(shmaddr, size, MEM_DECOMMIT);
- result = virtualallocwithlock(shmaddr, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ virtualfreewithlock (shmaddr, size, MEM_DECOMMIT);
+ result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, protect);
if (result == NULL) {
result = (void*)-1;
write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) failed %d\n",
(uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
size, size >> 10, GetLastError());
} else {
- if (memorylocking)
- VirtualLock(shmaddr, size);
shmids[shmid].attached = result;
write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok%s\n",
(uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
#include "picasso96_win.h"
#include "win32gfx.h"
+int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity);
+void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize);
+
//#define P96TRACING_ENABLED 1
int p96hack_vpos, p96hack_vpos2, p96refresh_active;
#define P96TRACING_LEVEL 1
#endif
static void flushpixels(void);
-static void flushpixels_lock(void);
#ifdef P96TRACING_ENABLED
#define P96TRACE(x) do { write_log x; } while(0)
#define P96TRACE_SPR(x) do { write_log x; } while(0)
static int set_gc_called = 0, init_picasso_screen_called = 0;
//fastscreen
static uaecptr oldscr = 0;
-void PICASSO96_Unlock(void)
-{
- if(picasso_on) {
- flushpixels_lock();
- gfx_unlock_picasso ();
- }
-}
-void PICASSO96_Lock(void)
-{
- if(picasso_on) {
- picasso96_state.HostAddress = gfx_lock_picasso ();
- }
-}
static void endianswap (uae_u32 *vp, int bpp)
{
* Fill a rectangle in the screen.
*/
STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y,
- int Width, int Height, uae_u32 Pen, int Bpp,
- RGBFTYPE RGBFormat)
+ int Width, int Height, uae_u32 Pen, int Bpp)
{
int cols;
uae_u32 *p;
uae_u8 *src, *dst;
int lines;
+ int bpr = ri->BytesPerRow / 4;
/* Do our virtual frame-buffer memory. First, we do a single line fill by hand */
dst = src = ri->Memory + X * Bpp + Y * ri->BytesPerRow;
switch (Bpp)
{
case 1:
- memset (p, Pen, Width);
+ for (lines = 0; lines < Height; lines++, p += bpr) {
+ memset (p, Pen, Width);
+ }
break;
case 2:
Pen |= Pen << 16;
- for (cols = 0; cols < Width / 2; cols++)
- *p++ = Pen;
- if (Width & 1)
- ((uae_u16*)p)[0] = Pen;
+ for (lines = 0; lines < Height; lines++, p += bpr) {
+ for (cols = 0; cols < Width / 2; cols++)
+ p[cols] = Pen;
+ if (Width & 1)
+ ((uae_u16*)(p + cols))[0] = Pen;
+ }
break;
case 3:
- for (cols = 0; cols < Width; cols++) {
- *dst++ = Pen >> 16;
- *dst++ = Pen >> 8;
- *dst++ = Pen;
+ for (lines = 0; lines < Height; lines++, p += bpr) {
+ uae_u8 *d = (uae_u8*)p;
+ for (cols = 0; cols < Width; cols++) {
+ *d++ = Pen >> 16;
+ *d++ = Pen >> 8;
+ *d++ = Pen;
+ }
}
break;
case 4:
- for (cols = 0; cols < Width; cols++)
- *p++ = Pen;
+ for (lines = 0; lines < Height; lines++, p += bpr) {
+ for (cols = 0; cols < Width; cols++)
+ p[cols] = Pen;
+ }
+ return;
break;
}
- dst = src + ri->BytesPerRow;
- /* next, we do the remaining line fills via memcpy() for > 1 BPP, otherwise some more memset() calls */
- if(Bpp > 1) {
- for (lines = 0; lines < Height - 1; lines++, dst += ri->BytesPerRow)
- memcpy (dst, src, Width * Bpp);
- } else {
- for (lines = 0; lines < Height - 1; lines++, dst += ri->BytesPerRow)
- memset (dst, Pen, Width);
- }
}
static void disablemouse (void)
return;
vsynccnt = 0;
}
-
- PICASSO96_Unlock();
+ flushpixels ();
+ gfx_unlock_picasso ();
}
static int set_panning_called = 0;
#include "p96_blit.c"
#define BLT_NAME BLIT_30_32
#define BLT_FUNC(s,d) tmp = *d ; *d = *s; *s = tmp;
+#define BLT_TEMP
#include "p96_blit.c"
#undef BLT_SIZE
#undef BLT_MULT
#include "p96_blit.c"
#define BLT_NAME BLIT_30_16
#define BLT_FUNC(s,d) tmp = *d ; *d = *s; *s = tmp;
+#define BLT_TEMP
#include "p96_blit.c"
#undef BLT_SIZE
#undef BLT_MULT
#include "p96_blit.c"
#define BLT_NAME BLIT_30_8
#define BLT_FUNC(s,d) tmp = *d ; *d = *s; *s = tmp;
+#define BLT_TEMP
#include "p96_blit.c"
#undef BLT_SIZE
#undef BLT_MULT
/*
* Functions to perform an action on the frame-buffer
*/
-STATIC_INLINE void do_blitrect_frame_buffer(struct RenderInfo *ri, struct
-RenderInfo *dstri, unsigned long srcx, unsigned long srcy,
+STATIC_INLINE void do_blitrect_frame_buffer (struct RenderInfo *ri, struct
+ RenderInfo *dstri, unsigned long srcx, unsigned long srcy,
unsigned long dstx, unsigned long dsty, unsigned long width, unsigned
-long height, uae_u8 mask, BLIT_OPCODE opcode)
+ long height, uae_u8 mask, BLIT_OPCODE opcode)
{
uae_u8 *src, *dst, *tmp, *tmp2, *tmp3;
unsigned long total_width = width * Bpp;
unsigned long linewidth = (total_width + 15) & ~15;
unsigned long lines;
- int can_do_visible_blit = 0;
src = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow;
dst = dstri->Memory + dstx * Bpp + dsty * dstri->BytesPerRow;
write_log ("WARNING - BlitRect() has mask 0x%x with Bpp %d.\n", mask, Bpp);
}
+ P96TRACE (("(%dx%d)=(%dx%d)=(%dx%d)=%d ", srcx, srcy, dstx, dsty, width, height, opcode));
if (mask == 0xFF || Bpp > 1) {
+
if(opcode == BLIT_SRC) {
/* handle normal case efficiently */
if (ri->Memory == dstri->Memory && dsty == srcy) {
switch (picasso_vidinfo.pixbytes)
{
case 1:
- cursorrgbn[0] = 0;
- cursorrgbn[i] = i;
+ cursorrgbn[0] = 16;
+ /* use custom chip sprite palette */
+ cursorrgbn[i] = i + 16;
break;
case 2:
vx = 0xff00ff;
updatesprcolors ();
P96TRACE_SPR (("SetSpriteImage(%08x,%08x,w=%d,h=%d,hires=%d,double=%d,%08x)\n",
- bi, get_long (bi + PSSO_BoardInfo_MouseImage), w, h, hiressprite - 1, doubledsprite, bi + PSSO_BoardInfo_MouseImage));
+ bi, get_long (bi + PSSO_BoardInfo_MouseImage), w, h,
+ hiressprite - 1, doubledsprite, bi + PSSO_BoardInfo_MouseImage));
bpp = picasso_vidinfo.pixbytes;
if (!w || !h || get_long (bi + PSSO_BoardInfo_MouseImage) == 0) {
write_log ("P96: uaegfx.card: no hardware sprite support\n");
put_word (AmigaBoardInfo + PSSO_BoardInfo_SoftSpriteFlags, picasso96_pixel_format);
}
+ if (!(flags & BIF_BLITTER))
+ write_log ("P96: no blitter support, bogus uaegfx.card!?\n");
+ if (flags & BIF_NOBLITTER)
+ write_log ("P96: blitter disabled in devs:monitors/uaegfx!\n");
put_long (AmigaBoardInfo + PSSO_BoardInfo_Flags, flags);
put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 0, planar.width);
sprintf (p96text, "Picasso96 %dx%dx%d (%dx%dx%d)",
picasso96_state.Width, picasso96_state.Height, picasso96_state.BytesPerPixel * 8,
picasso_vidinfo.width, picasso_vidinfo.height, picasso_vidinfo.pixbytes * 8);
- write_log ("SetSwitch() - trying to show %s screen\n", flag ? p96text : "amiga");
+ write_log ("SetSwitch() - %s\n", flag ? p96text : "amiga");
/* Put old switch-state in D0 */
picasso_refresh ();
}
init_picasso_screen_called = 1;
+ mman_ResetWatch (p96ram_start + natmem_offset, allocated_gfxmem);
}
/*
if (Mask == 0xFF) {
/* Do the fill-rect in the frame-buffer */
- do_fillrect_frame_buffer (&ri, X, Y, Width, Height, Pen, Bpp, RGBFormat);
+ do_fillrect_frame_buffer (&ri, X, Y, Width, Height, Pen, Bpp);
result = 1;
} else {
+
/* We get here only if Mask != 0xFF */
if (Bpp != 1) {
write_log ("WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n", Mask, Bpp);
uae_u8 Bpp = GetBytesPerPixel(ri->RGBFormat);
unsigned long total_width = width * Bpp;
unsigned long linewidth = (total_width + 15) & ~15;
- int can_do_visible_blit = 0;
if(opcode == BLIT_DST) {
write_log ( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
* and we need to put the results on the screen from the frame-buffer.
*/
if (dstri == NULL || dstri->Memory == ri->Memory) {
- if(mask != 0xFF && Bpp > 1)
+ if (mask != 0xFF && Bpp > 1)
mask = 0xFF;
dstri = ri;
- can_do_visible_blit = 1;
}
-
/* Do our virtual frame-buffer memory first */
do_blitrect_frame_buffer (ri, dstri, srcx, srcy, dstx, dsty, width, height, mask, opcode);
return 1;
uae_u32 result = 0;
P96TRACE(("BlitRect(%d, %d, %d, %d, %d, %d, 0x%x)\n", srcx, srcy, dstx, dsty, width, height, Mask));
- result = BlitRect(renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC);
+ result = BlitRect (renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC);
return result;
}
int bit_set = data & 0x8000;
data <<= 1;
if (bit_set) {
- uae_u32 fgpen = pattern.FgPen;
switch (Bpp)
{
case 1:
{
- uae_u8 *addr = uae_mem2 + bits;
- do_put_mem_byte (addr, (uae_u8)(do_get_mem_byte (addr) ^ 0xff));
+ uae_mem2[bits] ^= 0xff;
}
break;
case 2:
{
- uae_u16 *addr = ((uae_u16 *)uae_mem2) + bits;
- do_put_mem_word (addr, (uae_u16)(do_get_mem_word (addr) ^ fgpen));
+ uae_u16 *addr = (uae_u16 *)uae_mem2;
+ addr[bits] ^= 0xffff;
}
break;
case 3:
{
uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3);
- do_put_mem_long (addr, do_get_mem_long (addr) ^ (fgpen & 0x00FFFFFF));
+ do_put_mem_long (addr, do_get_mem_long (addr) ^ 0xffffff);
}
break;
case 4:
{
- uae_u32 *addr = ((uae_u32 *)uae_mem2) + bits;
- do_put_mem_long (addr, do_get_mem_long (addr) ^ fgpen);
+ uae_u32 *addr = (uae_u32 *)uae_mem2;
+ addr[bits] ^= 0xffffffff;
}
break;
}
if (CopyRenderInfoStructureA2U (rinf, &ri) && CopyTemplateStructureA2U (tmpl, &tmp)) {
Bpp = GetBytesPerPixel(ri.RGBFormat);
- uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset into address */
+ uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset into address */
if (tmp.DrawMode & INVERS)
inversion = 1;
if(tmp.DrawMode == COMP) {
write_log ("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask);
- flushpixels(); //only need in the windows Version
return 0;
} else {
result = 1;
} else {
result = 1;
}
-#if 1
- if (tmp.DrawMode == COMP) {
- /* workaround, let native blitter handle COMP mode */
- return 0;
- }
-#endif
+
if(result) {
uae_u32 fgpen, bgpen;
int bit_set = (byte & 0x80);
byte <<= 1;
if (bit_set) {
- fgpen = tmp.FgPen;
switch (Bpp)
{
case 1:
{
- uae_u8 *addr = uae_mem2 + bits;
- do_put_mem_byte (addr, (uae_u8)(do_get_mem_byte (addr) ^ 0xff));
+ uae_u8 *addr = uae_mem2;
+ addr[bits] ^= 0xff;
}
break;
case 2:
{
- uae_u16 *addr = ((uae_u16 *)uae_mem2) + bits;
- do_put_mem_word (addr, (uae_u16)(do_get_mem_word (addr) ^ fgpen));
+ uae_u16 *addr = (uae_u16 *)uae_mem2;
+ addr[bits] ^= 0xffff;
}
break;
case 3:
{
uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3);
- do_put_mem_long (addr, do_get_mem_long (addr) ^ (fgpen & 0x00FFFFFF));
+ do_put_mem_long (addr, do_get_mem_long (addr) ^ 0x00FFFFFF);
}
break;
case 4:
{
- uae_u32 *addr = ((uae_u32 *)uae_mem2) + bits;
- do_put_mem_long (addr, do_get_mem_long (addr) ^ fgpen);
+ uae_u32 *addr = (uae_u32 *)uae_mem2;
+ addr[bits] ^= 0xffffffff;
}
break;
}
return result;
}
-
-static void flushpixels_x (void)
+static void flushpixels (void)
{
int i;
int rowwidth_dst = picasso_vidinfo.width * picasso_vidinfo.pixbytes;
int rowwidth_src = picasso96_state.Width * picasso96_state.BytesPerPixel;
- ULONG_PTR gwwcnt;
uae_u8 *src = p96ram_start + natmem_offset;
int off = picasso96_state.XYOffset - gfxmem_start;
uae_u8 *src_start = src + (off & ~gwwpagemask);
int maxy = -1;
int miny = picasso96_state.Height - 1;
int lock = 0;
+ uae_u8 *dst = NULL;
+ ULONG_PTR gwwcnt;
if (!picasso_vidinfo.extra_mem || !gwwbuf)
return;
for (;;) {
- uae_u8 *dst;
+ gwwcnt = 0;
if (palette_changed) {
- picasso_palette ();
+ if (picasso_palette ()) {
+ reloadcursor = 1;
+ setspriteimage (cursorbi);
+ }
gwwcnt = allocated_gfxmem / gwwpagesize;
for (i = 0; i < gwwcnt; i++)
gwwbuf[i] = src + i * gwwpagesize;
} else {
ULONG ps;
gwwcnt = gwwbufsize;
- if (GetWriteWatch(WRITE_WATCH_FLAG_RESET, src, allocated_gfxmem, gwwbuf, &gwwcnt, &ps))
- break;;
+ if (mman_GetWriteWatch (src, allocated_gfxmem, gwwbuf, &gwwcnt, &ps))
+ break;
}
if (gwwcnt == 0)
break;
- if(DirectDraw_IsLocked() == FALSE) {
- if (!lock)
- dst = gfx_lock_picasso ();
- lock = 1;
- } else {
- dst = picasso96_state.HostAddress;
+ if (dst == NULL) {
+ if(DirectDraw_IsLocked() == FALSE) {
+ if (!lock)
+ dst = gfx_lock_picasso ();
+ lock = 1;
+ } else {
+ dst = picasso96_state.HostAddress;
+ }
}
- if (!dst)
+ if (dst == NULL)
break;
for (i = 0; i < gwwcnt; i++) {
dst2 = dst + y * picasso_vidinfo.rowbytes;
/* merge nearby pieces */
- while (i + 1 < gwwcnt && (uae_u8*)gwwbuf[i + 1] <= p + 2 * gwwpagesize) {
+ while (i + 1 < gwwcnt && (uae_u8*)gwwbuf[i + 1] <= p + 1 * gwwpagesize) {
pscnt += gwwpagesize;
p += gwwpagesize;
i++;
}
if(lock)
- gfx_unlock_picasso();
+ gfx_unlock_picasso ();
+ if (dst && gwwcnt)
+ mman_ResetWatch (src, allocated_gfxmem);
if (maxy >= 0)
DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny + 1);
}
-
-static void flushpixels(void)
-{
- flushpixels_x ();
-}
-static void flushpixels_lock (void)
-{
- flushpixels();
-}
-
static uae_u32 REGPARAM2 gfxmem_lgetx (uaecptr addr)
{
uae_u32 *m;
extern void picasso_handle_vsync (void);
extern void init_hz_p96 (void);
extern void picasso_handle_hsync (void);
-extern void picasso_palette (void);
+extern int picasso_palette (void);
extern uae_u8 *gfxmemory;
EDITTEXT IDC_SLOWRAM,243,25,30,12,ES_CENTER | ES_READONLY\r
RTEXT "Fast:",IDC_FASTTEXT,24,51,20,10,SS_CENTERIMAGE\r
CONTROL "Slider1",IDC_FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,47,50,20\r
+ EDITTEXT IDC_FASTRAM,105,53,30,12,ES_CENTER | ES_READONLY\r
RTEXT "Z3 Fast:",IDC_Z3TEXT,139,51,30,10,SS_CENTERIMAGE\r
CONTROL "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,47,60,20\r
EDITTEXT IDC_Z3FASTRAM,243,50,30,12,ES_CENTER | ES_READONLY\r
#define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
#define GETBDD(x) ((x) % 100)
-#define WINUAEBETA 5
+#define WINUAEBETA 6
#define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 3, 1)
+#define WINUAEDATE MAKEBD(2008, 3, 4)
#define WINUAEEXTRA ""
#define WINUAEREV ""
int dst_height2 = dst_height;
int dst_width3 = dst_width;
int dst_height3 = dst_height;
- int scale2 = scale;
-
- if (currprefs.gfx_filter_upscale) {
- dst_width2 = amiga_width;
- dst_height2 = amiga_height;
- dst_width3 = amiga_width * scale;
- dst_height3 = amiga_height * scale;
- scale2 = 1;
- }
sptr = gfxvidinfo.bufmem;
- v = (dst_width2 - amiga_width) / 2;
- aw += v;
+ v = (dst_width - amiga_width * scale) / 2;
sptr -= v * (amiga_depth / 8);
- v = (dst_height2 - amiga_height) / 2;
- ah += v;
+ v = (dst_height - amiga_height * scale) / 2;
sptr -= v * gfxvidinfo.rowbytes;
-
endsptr = gfxvidinfo.bufmemend;
v = currprefs.gfx_filter ? currprefs.gfx_filter_horiz_offset : 0;
- v += (dst_width3 / scale - amiga_width) / 8;
- sptr += (int)(-v * 4.0 / 10.0) * (amiga_depth / 8);
- aw -= (int)(-v * 4.0 / 10);
+ sptr += (int)(-v * amiga_width / 1000.0) * (amiga_depth / 8);
v = currprefs.gfx_filter ? currprefs.gfx_filter_vert_offset : 0;
- v += (dst_height3 / scale - amiga_height) / 8;
- sptr += (int)(-v * 4.0 / 10.0) * gfxvidinfo.rowbytes;
- ah -= (int)(-v * 4.0 / 10);
-
- if (aw * scale > dst_width)
- aw = dst_width / scale;
- if (ah * scale > dst_height)
- ah = dst_height / scale;
+ sptr += (int)(-v * amiga_height / 1000.0) * gfxvidinfo.rowbytes;
if (ah < 16)
return;
currprefs.gfx_filter_horiz_zoom_mult != 1000 ||
currprefs.gfx_filter_vert_zoom_mult != 1000 || currprefs.gfx_filter_upscale)) {
- int wz = dst_width3 * currprefs.gfx_filter_horiz_zoom_mult / 1000;
- int hz = dst_height3 * currprefs.gfx_filter_vert_zoom_mult / 1000;
-
- wz += currprefs.gfx_filter_horiz_zoom / 4;
- hz += currprefs.gfx_filter_vert_zoom / 4;
+ double hz = currprefs.gfx_filter_horiz_zoom / 1000.0 * currprefs.gfx_filter_horiz_zoom_mult;
+ double vz = currprefs.gfx_filter_vert_zoom / 1000.0 * currprefs.gfx_filter_vert_zoom_mult;
- sr.left = (dst_width3 - wz) / 2;
- sr.top = (dst_height3 - hz) / 2;
- sr.right = sr.left + wz;
- sr.bottom = sr.top + hz;
+ sr.left = (dst_width - amiga_width * scale) / 2;
+ sr.top = (dst_height - amiga_height * scale) / 2;
+ sr.right = amiga_width * scale + sr.left;
+ sr.bottom = amiga_height * scale + sr.top;
dr.left = dr.top = 0;
dr.right = dst_width;
dr.bottom = dst_height;
+ hz *= amiga_width / 2000.0;
+ if (hz > 0) {
+ dr.left += hz;
+ dr.right -= hz;
+ } else {
+ sr.left -= hz;
+ sr.right += hz;
+ }
+ vz *= amiga_height / 2000.0;
+ if (vz > 0) {
+ dr.top += vz;
+ dr.bottom -= vz;
+ } else {
+ sr.top -= vz;
+ sr.bottom += vz;
+ }
+
+
if (sr.left >= sr.right) {
sr.left = dst_width / 2 - 1;
sr.right = dst_width / 2 + 1;
} else if (usedfilter->type == UAE_FILTER_PAL) { /* 16/32/1X */
if (amiga_depth == 32 && dst_depth == 32) {
- PAL_1x1_32((uae_u32*)sptr, gfxvidinfo.rowbytes, (uae_u32*)dptr, pitch, aw, ah);
+ PAL_1x1_32 ((uae_u32*)sptr, gfxvidinfo.rowbytes, (uae_u32*)dptr, pitch, aw, ah);
ok = 1;
} else if (amiga_depth == 16 && dst_depth == 16) {
- PAL_1x1_16((uae_u16*)sptr, gfxvidinfo.rowbytes, (uae_u16*)dptr, pitch, aw, ah);
+ PAL_1x1_16 ((uae_u16*)sptr, gfxvidinfo.rowbytes, (uae_u16*)dptr, pitch, aw, ah);
ok = 1;
}
end:
if (temp_needed) {
IDirectDrawSurface7_Unlock (dds, NULL);
- //DirectDraw_Blt (DirectDraw_GetLockableType(), &dr, temporary_surface, &sr, 0);
+ DirectDraw_BlitRect (NULL, &dr, tempsurf, &sr);
} else {
DirectDraw_SurfaceUnlock ();
}
int current_width, current_height, current_depth;
int amiga_width, amiga_height;
int frequency;
- int mapping_is_mainscreen;
int initdone;
+ int fullfill;
LPPALETTEENTRY pal;
};
OffsetRect(dr, amigawin_rect.left, amigawin_rect.top);
if (currentmode->flags & DM_W_FULLSCREEN) {
int dx, dy;
+ if (currentmode->fullfill)
+ return;
OffsetRect (dr, (currentmode->native_width - currentmode->current_width) / 2,
(currentmode->native_height - currentmode->current_height) / 2);
dx = (dr->right - dr->left) - currentmode->current_width;
currentmode->pitch = DirectDraw_GetSurfacePitch ();
DirectDraw_SurfaceUnlock ();
}
+ if (bits == 8)
+ DirectDraw_CreatePalette (currentmode->pal);
}
write_log ("set_ddraw() called, and is %dx%d@%d-bytes\n", width, height, bits);
depth = 3;
else if (ct & RGBMASK_32BIT)
depth = 4;
- if (depth == 0 || depth == 1)
+ if (depth == 0)
return DDENUMRET_OK;
i = 0;
while (DisplayModes[i].depth >= 0) {
uae_u8 *gfx_lock_picasso (void)
{
- uae_u8 *p = ddraw_dolock ();
- picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch();
- return p;
+ if (!DirectDraw_SurfaceLock ())
+ return 0;
+ picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
+ return (uae_u8*)DirectDraw_GetSurfacePointer ();
}
/* For the DX_Invalidate() and gfx_unlock_picasso() functions */
{
DirectDraw_SurfaceUnlock();
if (p96_double_buffer_needs_flushing) {
- /* Here, our flush_block() will deal with a offscreen-plain (back-buffer) to visible-surface (front-buffer) */
- BOOL relock = FALSE;
- if (DirectDraw_IsLocked()) {
- relock = TRUE;
- unlockscr();
- }
picasso_putcursor (p96_double_buffer_firstx, p96_double_buffer_first,
p96_double_buffer_lastx - p96_double_buffer_firstx + 1, p96_double_buffer_last - p96_double_buffer_first + 1);
DX_Blit (p96_double_buffer_firstx, p96_double_buffer_first,
p96_double_buffer_lastx - p96_double_buffer_firstx + 1,
p96_double_buffer_last - p96_double_buffer_first + 1);
picasso_clearcursor ();
- if (relock) {
- lockscr();
- }
p96_double_buffer_needs_flushing = 0;
}
}
hStatusWnd = 0;
}
+static void update_gfxparams (void)
+{
+ updatewinfsmode (&currprefs);
+#ifdef PICASSO96
+ if (screen_is_picasso) {
+ currentmode->current_width = picasso96_state.Width;
+ currentmode->current_height = picasso96_state.Height;
+ currentmode->frequency = abs (currprefs.gfx_refreshrate > default_freq ? currprefs.gfx_refreshrate : default_freq);
+ } else {
+#endif
+ currentmode->current_width = currprefs.gfx_size.width;
+ currentmode->current_height = currprefs.gfx_size.height;
+ currentmode->frequency = abs (currprefs.gfx_refreshrate);
+#ifdef PICASSO96
+ }
+#endif
+ currentmode->current_depth = (currprefs.color_mode == 0 ? 8
+ : currprefs.color_mode == 1 ? 15
+ : currprefs.color_mode == 2 ? 16
+ : currprefs.color_mode == 3 ? 8
+ : currprefs.color_mode == 4 ? 8 : 32);
+ if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) {
+ int pbits = picasso96_state.BytesPerPixel * 8;
+ if (pbits >= 8)
+ currentmode->current_depth = pbits;
+ }
+ currentmode->amiga_width = currentmode->current_width;
+ currentmode->amiga_height = currentmode->current_height;
+}
+
static int open_windows (void)
{
int ret, i;
reset_sound();
in_sizemove = 0;
- updatewinfsmode (&currprefs);
+ updatewinfsmode (&currprefs);
if (!DirectDraw_Start (displayGUID))
return 0;
write_log ("DirectDraw GUID=%s\n", outGUID (displayGUID));
ret = -2;
do {
if (ret < -1) {
-#ifdef PICASSO96
- if (screen_is_picasso) {
- currentmode->current_width = picasso96_state.Width;
- currentmode->current_height = picasso96_state.Height;
- currentmode->frequency = abs (currprefs.gfx_refreshrate > default_freq ? currprefs.gfx_refreshrate : default_freq);
- } else {
-#endif
- currentmode->current_width = currprefs.gfx_size.width;
- currentmode->current_height = currprefs.gfx_size.height;
- currentmode->frequency = abs (currprefs.gfx_refreshrate);
-#ifdef PICASSO96
- }
-#endif
- currentmode->current_depth = (currprefs.color_mode == 0 ? 8
- : currprefs.color_mode == 1 ? 15
- : currprefs.color_mode == 2 ? 16
- : currprefs.color_mode == 3 ? 8
- : currprefs.color_mode == 4 ? 8 : 32);
- if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) {
- int pbits = picasso96_state.BytesPerPixel * 8;
- if (pbits >= 15)
- currentmode->current_depth = pbits;
- }
- currentmode->amiga_width = currentmode->current_width;
- currentmode->amiga_height = currentmode->current_height;
+ update_gfxparams ();
}
ret = doInit ();
} while (ret < 0);
void init_colors (void)
{
-// HRESULT ddrval;
-
if (ncols256 == 0) {
alloc_colors256 (get_color);
memcpy (xcol8, xcolors, sizeof xcol8);
{
case 1:
memcpy (xcolors, xcol8, sizeof xcolors);
- //ddrval = DirectDraw_SetPaletteEntries(0, 256, colors256);
- //if (FAILED(ddrval))
- // write_log ("DX_SetPalette() failed with %s/%d\n", DXError (ddrval), ddrval);
+ DirectDraw_SetPaletteEntries(0, 256, colors256);
break;
case 2:
{
}
-void picasso_palette (void)
+int picasso_palette (void)
{
- int i;
+ int i, changed;
+ changed = 0;
for (i = 0; i < 256; i++) {
int r = picasso96_state.CLUT[i].Red;
int g = picasso96_state.CLUT[i].Green;
int b = picasso96_state.CLUT[i].Blue;
- picasso_vidinfo.clut[i] = (doMask256 (r, red_bits, red_shift)
+ uae_u32 v = (doMask256 (r, red_bits, red_shift)
| doMask256 (g, green_bits, green_shift)
| doMask256 (b, blue_bits, blue_shift));
+ if (v != picasso_vidinfo.clut[i]) {
+ picasso_vidinfo.clut[i] = v;
+ changed = 1;
+ }
}
+ if (changed)
+ DX_SetPalette (0,256);
+ return changed;
}
void DX_SetPalette (int start, int count)
{
if (!screen_is_picasso)
return;
-
if (picasso_vidinfo.pixbytes != 1)
return;
-
- /* Set our DirectX palette here */
-#if 0
- if(currentmode->current_depth == 8) {
- HRESULT ddrval;
- if (SUCCEEDED(DirectDraw_SetPalette(0))) {
- ddrval = DirectDraw_SetPaletteEntries(start, count, (LPPALETTEENTRY)&(picasso96_state.CLUT[start]));
- if (FAILED(ddrval))
- gui_message("DX_SetPalette() failed with %s/%d\n", DXError (ddrval), ddrval);
- }
- } else {
- write_log ("ERROR - DX_SetPalette() pixbytes %d\n", currentmode->current_depth >> 3);
- }
-#endif
+ if(currentmode->current_depth > 8)
+ return;
+ if (SUCCEEDED (DirectDraw_SetPalette (0)))
+ DirectDraw_SetPaletteEntries (start, count, (LPPALETTEENTRY)&(picasso96_state.CLUT[start]));
}
void DX_Invalidate (int x, int y, int width, int height)
#ifdef PICASSO96
-static int modeswitchneeded (void)
+static int modeswitchneeded (struct winuae_currentmode *wc)
{
if (isfullscreen () > 0) {
- if (picasso96_state.Width != currentmode->current_width ||
- picasso96_state.Height != currentmode->current_height)
- return -1;
+ if (screen_is_picasso) {
+ if (picasso96_state.Width != wc->current_width ||
+ picasso96_state.Height != wc->current_height ||
+ (picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth))
+ return -1;
+ } else {
+ if (currentmode->current_width != wc->current_width ||
+ currentmode->current_height != wc->current_height ||
+ currentmode->current_depth != wc->current_depth)
+ return -1;
+ }
} else if (isfullscreen () == 0) {
- if (picasso96_state.Width != currentmode->current_width ||
- picasso96_state.Height != currentmode->current_height)
- return 1;
+ if (screen_is_picasso) {
+ if (picasso96_state.Width != wc->current_width ||
+ picasso96_state.Height != wc->current_height)
+ return 1;
+ } else {
+ if (currentmode->current_width != wc->current_width ||
+ currentmode->current_height != wc->current_height)
+ return 1;
+ }
} else {
- if (picasso96_state.Width > currentmode->native_width ||
- picasso96_state.Height > currentmode->native_height)
+ if (picasso96_state.Width > wc->native_width ||
+ picasso96_state.Height > wc->native_height)
return -1;
}
return 0;
void gfx_set_picasso_state (int on)
{
+ struct winuae_currentmode wc;
int mode;
if (screen_is_picasso == on)
return;
screen_is_picasso = on;
- mode = modeswitchneeded ();
- currentmode->current_width = picasso96_state.Width;
- currentmode->current_height = picasso96_state.Height;
- picasso_vidinfo.width = picasso96_state.Width;
- picasso_vidinfo.height = picasso96_state.Height;
+ memcpy (&wc, currentmode, sizeof (wc));
+ update_gfxparams ();
if (currprefs.gfx_afullscreen != currprefs.gfx_pfullscreen) {
mode = 1;
- } else if (!mode) {
- return;
+ } else {
+ mode = modeswitchneeded (&wc);
+ if (!mode)
+ return;
}
if (mode < 0) {
open_windows ();
} else {
- open_screen ();
+ open_screen (); // reopen everything
}
}
void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt)
{
- if (screen_is_picasso && modeswitchneeded())
+ if (screen_is_picasso && modeswitchneeded(currentmode))
open_screen ();
}
#endif
{
DWORD flags;
+ currentmode->fullfill = 0;
flags = DM_DDRAW;
if (isfullscreen () > 0)
flags |= DM_DX_FULLSCREEN;
}
#endif
currentmode->flags = flags;
+ if (flags & DM_SWSCALE)
+ currentmode->fullfill = 1;
}
static BOOL doInit (void)
#if defined (GFXFILTER)
if (currentmode->flags & DM_SWSCALE) {
- S2X_init (currentmode->current_width, currentmode->current_height,
+ S2X_init (currentmode->native_width, currentmode->native_height,
currentmode->amiga_width, currentmode->amiga_height,
mult, currentmode->current_depth, currentmode->native_depth);
}
void WIN32GFX_PaletteChange(void)
{
-#if 0
- HRESULT hr;
-
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D)) return;
+ if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
+ return;
if (currentmode->current_depth > 8)
return;
- hr = DirectDraw_SetPalette (1); /* Remove current palette */
- if (FAILED(hr))
- write_log ("SetPalette(1) failed, %s\n", DXError (hr));
- hr = DirectDraw_SetPalette (0); /* Set our real palette */
- if (FAILED(hr))
- write_log ("SetPalette(0) failed, %s\n", DXError (hr));
-#endif
+ DirectDraw_SetPalette (1); /* Remove current palette */
+ DirectDraw_SetPalette (0); /* Set our real palette */
}
int WIN32GFX_ClearPalette(void)
{
-#if 0
- HRESULT hr;
if (currentmode->current_depth > 8)
return 1;
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D)) return 1;
- hr = DirectDraw_SetPalette (1); /* Remove palette */
- if (FAILED(hr))
- write_log ("SetPalette(1) failed, %s\n", DXError (hr));
- return SUCCEEDED(hr);
-#endif
- return 0;
+ if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
+ return 1;
+ DirectDraw_SetPalette (1); /* Remove palette */
+ return 1;
}
int WIN32GFX_SetPalette(void)
{
-#if 0
- HRESULT hr;
- if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D)) return 1;
+ if (!(currentmode->flags & DM_DDRAW) || (currentmode->flags & DM_D3D))
+ return 1;
if (currentmode->current_depth > 8)
return 1;
- hr = DirectDraw_SetPalette (0); /* Set palette */
- if (FAILED(hr))
- write_log ("SetPalette(0) failed, %s\n", DXError (hr));
- return SUCCEEDED(hr);
-#endif
- return 0;
+ DirectDraw_SetPalette (0); /* Set palette */
+ return 1;
}
void WIN32GFX_WindowMove (void)
{
str = my_strdup (tmp2);
fname = my_strdup (tmp2);
}
- str = my_strdup (tmp2);
paths[idx2] = fname;
values[idx2] = str;
}
}
for (i = 0; i < idx; i++) {
xfree (values[i]);
- if (i + 1 != ret)
+ if (i != ret - 1)
xfree (paths[i]);
}
if (ret == 0)
d = 16;
break;
case 5:
- d = 32;
- break;
default:
- d = 8;
+ d = 32;
break;
}
if (workprefs.gfx_afullscreen) {
d2 = d;
- if ((index = WIN32GFX_AdjustScreenmode(&workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0) {
+ if ((index = WIN32GFX_AdjustScreenmode (&workprefs.gfx_size_fs.width, &workprefs.gfx_size_fs.height, &d2)) >= 0) {
switch (d2)
{
case 15:
d = 2;
break;
case 32:
+ default:
workprefs.color_mode = 5;
d = 4;
break;
- default:
- workprefs.color_mode = 0;
- d = 1;
- break;
}
}
} else {
cnt = 0;
gui_display_depths[0] = gui_display_depths[1] = gui_display_depths[2] = -1;
for (i = 0; DisplayModes[i].depth >= 0; i++) {
- if (DisplayModes[i].residx == DisplayModes[index].residx) {
+ if (DisplayModes[i].depth > 1 && DisplayModes[i].residx == DisplayModes[index].residx) {
char tmp[64];
sprintf (tmp, "%d", DisplayModes[i].depth * 8);
SendDlgItemMessage(hDlg, IDC_RESOLUTIONDEPTH, CB_ADDSTRING, 0, (LPARAM)tmp);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_RESETCONTENT, 0, 0);
while (DisplayModes[i].depth >= 0) {
- if (DisplayModes[i].residx != idx) {
+ if (DisplayModes[i].depth > 1 && DisplayModes[i].residx != idx) {
sprintf (tmp, "%dx%d", DisplayModes[i].res.width, DisplayModes[i].res.height);
SendDlgItemMessage(hDlg, IDC_RESOLUTION, CB_ADDSTRING, 0, (LPARAM)tmp);
idx = DisplayModes[i].residx;
#ifdef JIT
oldcache = workprefs.cachesize;
jitena = IsDlgButtonChecked (hDlg, IDC_JITENABLE) ? 1 : 0;
- workprefs.cachesize = SendMessage(GetDlgItem(hDlg, IDC_CACHE), TBM_GETPOS, 0, 0) * 1024;
+ workprefs.cachesize = SendMessage (GetDlgItem(hDlg, IDC_CACHE), TBM_GETPOS, 0, 0) * 1024;
if (!jitena) {
cachesize_prev = workprefs.cachesize;
comptrust_prev = workprefs.comptrustbyte;
char *s = favoritepopup (hDlg);
if (s) {
int num = id == IDC_DF0QQ ? 0 : 1;
- diskselect (hDlg, id, &workprefs, num, s);
+ char tmp[MAX_DPATH];
+ strcpy (tmp, s);
+ xfree (s);
+ diskselect (hDlg, id, &workprefs, num, tmp);
}
- xfree (s);
return 1;
}
return 0;
ew (hDlg, IDC_FILTERPRESETSAVE, filterpreset_builtin < 0);
ew (hDlg, IDC_FILTERPRESETLOAD, filterpreset_selected > 0);
ew (hDlg, IDC_FILTERPRESETDELETE, filterpreset_selected > 0 && filterpreset_builtin < 0);
- CheckDlgButton(hDlg, IDC_FILTERUPSCALE, workprefs.gfx_filter_upscale);
}
static void makefilter(char *s, int x, int flags)
struct uae_filter *uf;
UAEREG *fkey;
+ CheckDlgButton(hDlg, IDC_FILTERUPSCALE, workprefs.gfx_filter_upscale);
+ CheckDlgButton(hDlg, IDC_FILTERAUTORES, workprefs.gfx_autoresolution);
+
SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
SendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPAGESIZE, 0, 1);
SendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETRANGE, TRUE, MAKELONG (-999, +999));
#include "win32.h"
#include "win32gui.h"
-static int max_w, max_h, mult, pointsize;
+static int max_w = 800, max_h = 600, mult = 100, pointsize;
#include <pshpack2.h>
typedef struct {
+Beta 6:
+
+NOTE: Do not use filters, do not use vsync.
+
+- real 8-bit RTG mode work (fullscreen only)
+- buffer overflow in floppy image favorite shortcut code
+- disappeared Z2 fast ram amount box is back
+- Z3 but no RTG RAM allocation failure fixed
+- Picasso96 BltPattern and BltTemplate COMPLEMENT-mode uses now native
+ code
+- Picasso96 "new" mode is now Windows 2000 compatible. NOTE: this is
+ not 100% correct yet, graphics errors possible. W2K workaround mode
+ is also slower than Windows XP+ mode
+- Picasso96 RectFill() optimization (2x speedup here)
+- some mode switching crashes/graphics errors fixed
+- write warning to log if blitter is forced off in devs:monitors/uaegfx
+- 8-bit modes removed from display-panel GUI. Native (custom chipset)
+ display modes need at least 16-bit color depth now. RTG 8-bit still
+ supported.
+
Beta 5:
NOTE: filters are currently not supported, they may or may not work
-NOTE: filter support rewrite coming soon..
-NOTE: vsync not supported. expect flashes or other issues..
+NOTE: vsync not supported. expect flashing or other issues..
- "favorite path" editing added. Path added is always last opened
path from any file select dialog. (later..)
still work and are automatically converted to 16/32-bit
- "Match RTG color depth" option added to misc-panel. If checked
fullscreen RTG mode uses Amiga-side color depth (as previously)
- Not checked = always use Display panel depth setting.
- Windowed mode always uses desktop color depth
-
+ Not checked = always use Display panel depth setting. (if you have
+ programs that switch modes but you don't want Windows-side display
+ mode changes) Windowed mode always uses desktop color depth
+- GUI debugger updates (KB)
Beta 4:
uae_u32 *src2_32 = (uae_u32*)src;
uae_u32 *dst2_32 = (uae_u32*)dst;
unsigned int y, x, ww, xxd;
+#ifdef BLT_TEMP
#if BLT_SIZE == 4
uae_u32 tmp;
#elif BLT_SIZE == 2
uae_u16 tmp;
#else
uae_u8 tmp;
+#endif
#endif
if (w < 8 * BLT_MULT) {
}
}
#undef BLT_NAME
-#undef BLT_FUNC
\ No newline at end of file
+#undef BLT_FUNC
+#ifdef BLT_TEMP
+#undef BLT_TEMP
+#endif
\ No newline at end of file