#define DEBUG_COPPER 0
#define SPRITE_DEBUG 0
#define SPRITE_DEBUG_MINY 0
-#define SPRITE_DEBUG_MAXY 41
+#define SPRITE_DEBUG_MAXY 100
//#define SPRITE_MASK 0
#define SPRITE_MASK (1|2|4|8|16|32|64|128)
#define SPR0_HPOS 0x15
int plffirstline, plflastline;
int plfstrt, plfstop;
-static int last_diw_pix_hpos, last_ddf_pix_hpos, last_decide_line_hpos;
+static int last_diw_pix_hpos, last_ddf_pix_hpos;
+static int last_decide_line_hpos, last_sprite_decide_line_hpos;
static int last_fetch_hpos, last_sprite_hpos;
int diwfirstword, diwlastword;
static enum diw_states diwstate, hdiwstate, ddfstate;
}
#ifndef CUSTOM_SIMPLE
- if (last_decide_line_hpos < SPR0_HPOS + 4 * MAX_SPRITES)
+ if (last_sprite_decide_line_hpos < SPR0_HPOS + 4 * MAX_SPRITES)
do_sprites (hpos);
#endif
+ last_sprite_decide_line_hpos = hpos;
+
last_decide_line_hpos = hpos;
}
decide_diw (hpos);
decide_line (hpos);
-#if 0
- /* This tries to detect whether the line is border, but that doesn't work, it's too early. */
- if (thisline_decision.plfleft == -1)
- return;
-#endif
count = 0;
for (i = 0; i < MAX_SPRITES; i++) {
int sprxp = spr[i].xpos;
dp = line_decisions + next_lineno;
changed = thisline_changed;
- if (thisline_decision.plfleft != -1) {
+ if (thisline_decision.plfleft != -1)
record_diw_line (thisline_decision.plfleft, diwfirstword, diwlastword);
+ if (thisline_decision.plfleft != -1 || (bplcon3 & 2))
decide_sprites (hpos);
- }
dip->last_sprite_entry = next_sprite_entry;
dip->last_color_change = next_color_change;
memset (outword, 0, sizeof outword);
last_decide_line_hpos = -1;
+ last_sprite_decide_line_hpos = -1;
last_diw_pix_hpos = -1;
last_ddf_pix_hpos = -1;
last_sprite_hpos = -1;
diwfirstword = coord_diw_to_window_x (hstrt);
diwlastword = coord_diw_to_window_x (hstop);
+ if (diwfirstword >= diwlastword) {
+ diwfirstword = 0;
+ diwlastword = max_diwlastword;
+ }
if (diwfirstword < 0)
diwfirstword = 0;
#endif
xlinebuffer -= linetoscr_x_adjust_bytes;
-
if (border == 0) {
+
pfield_expand_dp_bplcon ();
if (bplres == RES_LORES && ! currprefs.gfx_lores)
}
if (currprefs.gfx_lores == 2)
currprefs.gfx_lores = 0;
+
} else if (border == 1) {
+
adjust_drawing_colors (dp_for_drawing->ctable, 0);
if (dip_for_drawing->nr_color_changes == 0) {
fill_line ();
do_flush_line (gfx_ypos);
-#if 0
- if (dh == dh_emerg)
- abort ();
-#endif
+
if (do_double) {
if (dh == dh_buf) {
xlinebuffer = row_map[follow_ypos] - linetoscr_x_adjust_bytes;
* from linemem. */
do_flush_line (follow_ypos);
}
+
} else {
+
xcolnr tmp = colors_for_drawing.acolors[0];
colors_for_drawing.acolors[0] = getxcolor (0);
fill_line ();
do_flush_line (gfx_ypos);
colors_for_drawing.acolors[0] = tmp;
+
}
}
UnitInfo *uip;
int i;
- if (savestate_state == STATE_RESTORE)
- init_filesys_diagentry ();
free_mountinfo (¤t_mountinfo);
dup_mountinfo (&options_mountinfo, ¤t_mountinfo);
uip = current_mountinfo.ui;
restore_u32 ();
crc32 = restore_u32 ();
for (i = 0; i < romlist_cnt; i++) {
- if (rl[i].rd->crc32 == crc32) {
+ if (rl[i].rd->crc32 == crc32 && crc32) {
strncpy (changed_prefs.romfile, rl[i].path, 255);
break;
}
static int setcoop (LPDIRECTINPUTDEVICE8 lpdi, DWORD mode, char *txt)
{
HRESULT hr = DI_OK;
- if (lpdi) {
+ if (lpdi && hMainWnd) {
hr = IDirectInputDevice8_SetCooperativeLevel (lpdi, hMainWnd, mode);
if (hr != DI_OK && hr != E_NOTIMPL)
write_log ("setcooperativelevel %s failed, %s\n", txt, DXError (hr));
#include "autoconf.h"
#include "win32.h"
-static struct shmid_ds shmids[ MAX_SHMID ];
+static struct shmid_ds shmids[MAX_SHMID];
static uae_u32 gfxoffs;
uae_u32 natmem_offset = 0;
{
int i;
LPVOID blah = NULL;
-#if 0
- LPBYTE address = NULL; // Let the system decide where to put the memory...
-#else
LPBYTE address = (LPBYTE)0x10000000; // Letting the system decide doesn't seem to work on some systems
-#endif
int size = 0x19000000;
int add = 0x1000000;
canbang = 0;
gfxoffs = 0;
shm_start = 0;
- for( i = 0; i < MAX_SHMID; i++ )
- {
+ for (i = 0; i < MAX_SHMID; i++) {
shmids[i].attached = 0;
shmids[i].key = -1;
shmids[i].size = 0;
shmids[i].addr = NULL;
shmids[i].name[0] = 0;
}
- while (address < (LPBYTE)0xa0000000)
- {
- blah = VirtualAlloc( address, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE );
- if (blah == NULL)
- {
- address += add;
- }
- else
- {
- natmem_offset = (uae_u32)blah;
- write_log ("NATMEM: Our special area: 0x%x-0x%x\n", natmem_offset, natmem_offset + size);
- VirtualFree (blah, 0, MEM_RELEASE);
- while (address < (LPBYTE)0xa0000000) {
+ if (os_winnt) {
+ natmem_offset = VirtualAlloc(NULL, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ } else {
+ while (address < (LPBYTE)0xa0000000) {
+ blah = VirtualAlloc(address, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ if (blah == NULL) {
+ address += add;
+ } else {
+ VirtualFree (blah, 0, MEM_RELEASE);
address += add * 32;
- if (!os_winnt) /* Windows 9x/ME sucks */
- break;
- blah = VirtualAlloc (address, size, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
- if (blah == NULL) {
- address -= add * 32;
- break;
- }
- VirtualFree (blah, 0, MEM_RELEASE);
+ natmem_offset = (uae_u8*)address;
+ break;
}
- natmem_offset = (uae_u8*)natmem_offset + ((uae_u8*)address - (uae_u8*)natmem_offset) / 2;
- write_log ("NATMEM: after adjustment: 0x%x-0x%x\n", natmem_offset, natmem_offset + size);
- canbang = 1;
- break;
}
}
if (!natmem_offset) {
- write_log( "NATMEM: No special area could be allocated!\n" );
+ write_log("NATMEM: No special area could be allocated!\n");
+ } else {
+ write_log("NATMEM: Our special area: 0x%p-0x%p\n",
+ natmem_offset, (uae_u8*)natmem_offset + size);
+ canbang = 1;
}
}
else
{
//free( x->native_address );
- VirtualFree((LPVOID)mem, 0, MEM_DECOMMIT |MEM_RELEASE );
+ VirtualFree((LPVOID)mem, 0, os_winnt ? MEM_RESET : (MEM_DECOMMIT | MEM_RELEASE));
}
}
x = x->next;
{
shmaddr=natmem_offset;
got = TRUE;
- if(!currprefs.fastmem_size)
- size+=32;
+// if(!currprefs.fastmem_size)
+// size+=32;
}
if(!strcmp(shmids[shmid].name,"kick"))
{
}
#endif
- if( ( shmids[shmid].key == shmid ) && shmids[shmid].size )
- {
+ if( ( shmids[shmid].key == shmid ) && shmids[shmid].size ) {
got = FALSE;
if (got == FALSE) {
- if (shmaddr)
- {
- result=(void*)VirtualFree(shmaddr,0,MEM_RELEASE);
+ if (shmaddr) {
+ result = (void*)VirtualFree(shmaddr, 0, os_winnt ? MEM_RESET : MEM_RELEASE);
}
- result = VirtualAlloc(shmaddr,size,MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
- if( result == NULL )
- {
+ result = VirtualAlloc(shmaddr, size, os_winnt ? MEM_COMMIT : (MEM_RESERVE | MEM_COMMIT),
+ PAGE_EXECUTE_READWRITE);
+ if( result == NULL ) {
result = (void *)-1;
- write_log ("VirtualAlloc %x %x failed %d\n", shmaddr, size, GetLastError ());
- }
- else
- {
+ write_log ("VirtualAlloc %p %x failed %d\n", shmaddr, size, GetLastError ());
+ } else {
shmids[shmid].attached=result;
}
} else {
int have_done_picasso; /* For the JIT compiler */
int picasso_is_special = PIC_WRITE; /* ditto */
int picasso_is_special_read = PIC_READ; /* ditto */
-static int p96syncrate;
+static int vsyncgfxwrite = 0;
+static int p96syncrate,vsyncgfxcount;
int p96hsync_counter;
#define SWAPSPEEDUP
#ifdef PICASSO96
width *= Bpp;
while (height-- > 0)
{
- memcpy (dstp, srcp, width);
+ memcpy (dstp, srcp, width);
srcp += ri->BytesPerRow;
dstp += picasso_vidinfo.rowbytes;
+
}
}
else
DX_SetPalette (0,256);
palette_changed = 0;
}
+
+ if (vsyncgfxwrite==1) {
+ static long blitcount;
+ vsyncgfxcount++;
+ if (vsyncgfxcount>1) {
+ if (picasso_on) {
+ if (picasso96_state.RGBFormat == picasso_vidinfo.rgbformat
+ || picasso96_state.RGBFormat == RGBFB_CHUNKY) {
+ static frame_time_t cycles;
+ blitcount++;
+ cycles = read_processor_time();
+ picasso_refresh(1);
+ vsyncgfxcount = 0;
+ write_log("%d Blitnum %.3fms\n", blitcount,
+ (read_processor_time() - cycles) * 1000 / (double)syncbase);
+ }
+ }
+ }
+ }
}
static int set_panning_called = 0;
{
struct RenderInfo ri;
static int beamcon0_before, p96refresh_was;
-
- if (! picasso_on)
- return;
+
+ if (! picasso_on)return;
{ //for higher P96 mousedraw rate
/* HACK */
extern uae_u16 vtotal;
for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow)
do_xor8 (uae_mem, width_in_bytes, xorval);
- if (renderinfo_is_current_screen (&ri)) {
+ if (vsyncgfxwrite==0) if (renderinfo_is_current_screen (&ri)) {
if (mask == 0xFF)
do_invertrect( &ri, Bpp, X, Y, Width, Height );
else
if( Y+Height > picasso96_state.Height)
Height = picasso96_state.Height - Y;
- do_fillrect( src, X, Y, Width, Height, Pen, Bpp, RGBFormat );
+ if (vsyncgfxwrite==0)do_fillrect( src, X, Y, Width, Height, Pen, Bpp, RGBFormat );
}
}
result = 1;
}
}
}
- if (renderinfo_is_current_screen (&ri))
+ if (vsyncgfxwrite==0) if (renderinfo_is_current_screen (&ri))
do_blit( &ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0);
result = 1;
}
/* Do our virtual frame-buffer memory first */
do_blitrect_frame_buffer( ri, dstri, srcx, srcy, dstx, dsty, width, height, mask, opcode );
/* Now we do the on-screen display, if renderinfo points to it */
- if (renderinfo_is_current_screen (dstri))
+ if (vsyncgfxwrite==1)return 1;
+ if (renderinfo_is_current_screen (dstri))
{
if (mask == 0xFF || Bpp > 1) {
if( can_do_visible_blit )
/* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */
if ( picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri))
- do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0);
+ if (vsyncgfxwrite==0)do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0);
result = 1;
}
/* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */
if( picasso_vidinfo.extra_mem && renderinfo_is_current_screen( &ri ) )
- do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0 );
+ if (vsyncgfxwrite==0)do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0 );
result = 1;
}
void picasso_handle_hsync (void)
{
static int p96hsync;
-
+
if (currprefs.gfxmem_size == 0)
return;
if (WIN32GFX_IsPicassoScreen () && currprefs.gfx_pfullscreen && currprefs.gfx_vsync) {
PlanarToChunky (&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, mask);
if (renderinfo_is_current_screen (&local_ri))
{
- do_blit( &local_ri, GetBytesPerPixel( local_ri.RGBFormat ), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0);
+ if (!vsyncgfxwrite)do_blit( &local_ri, GetBytesPerPixel( local_ri.RGBFormat ), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0);
}
result = 1;
}
srcx, srcy, dstx, dsty, width, height, minterm, Mask, local_bm.Depth));
PlanarToDirect (&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, Mask, &local_cim);
if (renderinfo_is_current_screen (&local_ri))
- do_blit( &local_ri, GetBytesPerPixel( local_ri.RGBFormat ), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0);
+ if (!vsyncgfxwrite)do_blit( &local_ri, GetBytesPerPixel( local_ri.RGBFormat ), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0);
result = 1;
}
#ifdef LOCK_UNLOCK_MADNESS
do_put_mem_long(m, l);
#endif
/* write the long-word to our displayable memory */
- write_gfx_long(addr, l);
+ if (vsyncgfxwrite==0)write_gfx_long(addr, l);
}
static void REGPARAM2 gfxmem_wput (uaecptr addr, uae_u32 w)
do_put_mem_word(m, (uae_u16)w);
/* write the word to our displayable memory */
- write_gfx_word(addr, (uae_u16)w);
+ if (vsyncgfxwrite==0)write_gfx_word(addr, (uae_u16)w);
}
static void REGPARAM2 gfxmem_bput (uaecptr addr, uae_u32 b)
gfxmemory[addr] = b;
/* write the byte to our displayable memory */
- write_gfx_byte(addr, (uae_u8)b);
+ if (vsyncgfxwrite==0)write_gfx_byte(addr, (uae_u8)b);
}
static int REGPARAM2 gfxmem_check (uaecptr addr, uae_u32 size)
extern FILE *debugfile;
extern int console_logging;
static OSVERSIONINFO osVersion;
+static SYSTEM_INFO SystemInfo;
int useqpc = 0; /* Set to TRUE to use the QueryPerformanceCounter() function instead of rdtsc() */
int cpu_mmx = 0;
write_log (" (%s %d.%d %s%s)", os_winnt ? "NT" : "W9X/ME",
osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion,
os_winnt_admin ? " Admin" : "");
+ write_log (" %s %X.%X %d",
+ SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL ? "32-bit x86" :
+ SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64 ? "IA64" :
+ SystemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ? "AMD64" : "Unknown",
+ SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision,
+ SystemInfo.dwNumberOfProcessors);
write_log ("\n(c) 1995-2001 Bernd Schmidt - Core UAE concept and implementation."
"\n(c) 1998-2005 Toni Wilen - Win32 port, core code updates."
"\n(c) 1996-2001 Brian King - Win32 port, Picasso96 RTG, and GUI."
return isadmin;
}
+typedef void (CALLBACK* PGETNATIVESYSTEMINFO)(LPSYSTEM_INFO);
+static PGETNATIVESYSTEMINFO pGetNativeSystemInfo;
+
static int osdetect (void)
{
os_winnt = 0;
os_winnt_admin = 0;
- osVersion.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
- if( GetVersionEx( &osVersion ) )
- {
- if( ( osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT ) &&
- ( osVersion.dwMajorVersion <= 4 ) )
+ pGetNativeSystemInfo = (PGETNATIVESYSTEMINFO)GetProcAddress(
+ GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo");
+ GetNativeSystemInfo(&SystemInfo);
+ if (pGetNativeSystemInfo)
+ pGetNativeSystemInfo(&SystemInfo);
+ osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ if (GetVersionEx(&osVersion)) {
+ if ((osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
+ (osVersion.dwMajorVersion <= 4))
{
/* WinUAE not supported on this version of Windows... */
char szWrongOSVersion[ MAX_DPATH ];
int i;
int multi_display = 1;
+#if 1
#ifdef __GNUC__
__asm__ ("leal -2300*1024(%%esp),%0" : "=r" (win32_stackbase) :);
#else
mov win32_stackbase,eax
}
#endif
+#endif
#ifdef _DEBUG
{
extern int mouseactive, focus;
extern int ignore_messages_all;
#define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 4"
+#define WINUAEBETASTR " Beta 5"
extern void my_kbd_handler (int, int, int);
extern void clearallkeys(void);
uae_u32 flags;
long len2;
+ *totallen = 0;
/* chunk name */
zfile_fread (name, 1, 4, f);
name[4] = 0;
if (!strcmp (name, prevchunk))
break;
strcpy (prevchunk, name);
- write_log ("Chunk '%s' size %d\n", name, len);
+ write_log ("Chunk '%s' size %d (%d)\n", name, len, totallen);
if (!strcmp (name, "END "))
break;
if (!strcmp (name, "CRAM")) {