Update of /cvsroot/arcem/arcem/win In directory vz-cvs-4.sog:/tmp/cvs-serv17456/arcem/win
Modified Files: ControlPane.c DispKbd.c filecalls.c filecalls_internal.h win.c Log Message: Merge arcem-fast to trunk Index: ControlPane.c =================================================================== RCS file: /cvsroot/arcem/arcem/win/ControlPane.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ControlPane.c 9 May 2003 10:54:56 -0000 1.2 +++ ControlPane.c 12 May 2012 17:34:51 -0000 1.3 @@ -5,7 +5,6 @@ #include "../armdefs.h" #include "archio.h" #include "armarc.h" -#include "DispKbd.h" #include "ControlPane.h" void ControlPane_Init(ARMul_State *state) Index: DispKbd.c =================================================================== RCS file: /cvsroot/arcem/arcem/win/DispKbd.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- DispKbd.c 10 Mar 2006 18:27:56 -0000 1.16 +++ DispKbd.c 12 May 2012 17:34:51 -0000 1.17 @@ -5,23 +5,14 @@ #include "../armdefs.h" #include "armarc.h" #include "../arch/keyboard.h" -#include "DispKbd.h" +#include "displaydev.h" #include "win.h" #include "KeyTable.h" +#include "../armemu.h" -#define HD HOSTDISPLAY -#define DC DISPLAYCONTROL - - - -#define KEYREENABLEDELAY 1000 -#define AUTOREFRESHPOLL 2500 - -#define MonitorWidth 800 -#define MonitorHeight 600 - - +#define MonitorWidth 1600 +#define MonitorHeight 1200 extern unsigned short *dibbmp; extern unsigned short *curbmp; @@ -40,14 +31,78 @@ static void ProcessButton(ARMul_State *state); +/* Standard display device */ -static unsigned long get_pixelval(unsigned int red, unsigned int green, unsigned int blue) { - return (((red >> (16 - HD.red_prec)) << HD.red_shift) + - ((green >> (16 - HD.green_prec)) << HD.green_shift) + - ((blue >> (16 - HD.blue_prec)) << HD.blue_shift)); -} /* get_pixval */ +typedef unsigned short SDD_HostColour; +#define SDD_Name(x) sdd_##x +static const int SDD_RowsAtOnce = 1; +typedef SDD_HostColour *SDD_Row; + + +static SDD_HostColour SDD_Name(Host_GetColour)(ARMul_State *state,unsigned int col) +{ + /* Convert to 5-bit component values */ + int r = (col & 0x00f) << 1; + int g = (col & 0x0f0) >> 3; + int b = (col & 0xf00) >> 7; + /* May want to tweak this a bit at some point? */ + r |= r>>4; + g |= g>>4; + b |= b>>4; + return (r<<10) | (g<<5) | (b); +} + +static void SDD_Name(Host_ChangeMode)(ARMul_State *state,int width,int height,int hz); +static inline SDD_Row SDD_Name(Host_BeginRow)(ARMul_State *state,int row,int offset) +{ + return &dibbmp[(MonitorHeight-(row+1))*MonitorWidth+offset]; +} + +static inline void SDD_Name(Host_EndRow)(ARMul_State *state,SDD_Row *row) { /* nothing */ }; + +static inline void SDD_Name(Host_BeginUpdate)(ARMul_State *state,SDD_Row *row,unsigned int count) { /* nothing */ }; + +static inline void SDD_Name(Host_EndUpdate)(ARMul_State *state,SDD_Row *row) { /* nothing */ }; + +static inline void SDD_Name(Host_SkipPixels)(ARMul_State *state,SDD_Row *row,unsigned int count) { (*row) += count; } + +static inline void SDD_Name(Host_WritePixel)(ARMul_State *state,SDD_Row *row,SDD_HostColour pix) { *(*row)++ = pix; } + +static inline void SDD_Name(Host_WritePixels)(ARMul_State *state,SDD_Row *row,SDD_HostColour pix,unsigned int count) { while(count--) *(*row)++ = pix; } + +void SDD_Name(Host_PollDisplay)(ARMul_State *state); + +#include "../arch/stddisplaydev.c" + +static void SDD_Name(Host_ChangeMode)(ARMul_State *state,int width,int height,int hz) +{ + if((width > MonitorWidth) || (height > MonitorHeight)) + { + fprintf(stderr,"Mode %dx%d too big\n",width,height); + exit(EXIT_FAILURE); + } + HD.Width = width; + HD.Height = height; + HD.XScale = 1; + HD.YScale = 1; + /* Try and detect rectangular pixel modes */ + if((width >= height*2) && (height*2 <= MonitorHeight)) + { + HD.YScale = 2; + HD.Height *= 2; + } + else if((height >= width) && (width*2 <= MonitorWidth)) + { + HD.XScale = 2; + HD.Width *= 2; + } + resizeWindow(HD.Width,HD.Height); + /* Screen is expected to be cleared */ + memset(dibbmp,0,sizeof(SDD_HostColour)*MonitorWidth*MonitorHeight); +} +/*-----------------------------------------------------------------------------*/ static void MouseMoved(ARMul_State *state) { int xdiff, ydiff; @@ -82,363 +137,61 @@ #endif }; /* MouseMoved */ - - -int -DisplayKbd_PollHost(ARMul_State *state) -{ - if (keyF) { - ProcessKey(state); - } - if (buttF) { - ProcessButton(state); - } - if (mouseMF) { - MouseMoved(state); - } - return 0; -} - - - -/*-----------------------------------------------------------------------------*/ - - - - - - -/*-----------------------------------------------------------------------------*/ -/* Configure the TrueColor pixelmap for the standard 1,2,4 bpp modes */ -static void DoPixelMap_Standard(ARMul_State *state) -{ - char tmpstr[16]; - XColor tmp; - int c; - - if (!(DC.MustRedraw || DC.MustResetPalette)) { - return; - } - - for(c=0;c<16;c++) { - tmp.red = (VIDC.Palette[c] & 15) << 12; - tmp.green = ((VIDC.Palette[c] >> 4) & 15) << 12; - tmp.blue = ((VIDC.Palette[c] >> 8) & 15) << 12; - sprintf(tmpstr, "#%4x%4x%4x", tmp.red, tmp.green, tmp.blue); -// tmp.pixel=c; -//printf("color %d = %s\n", c, tmpstr); - /* I suppose I should do something with the supremacy bit....*/ - HD.pixelMap[c] = get_pixelval(tmp.red, tmp.green, tmp.blue); - } -//getchar(); - /* Now do the ones for the cursor */ - for(c = 0; c < 3; c++) { - tmp.red = (VIDC.CursorPalette[c] &15) << 12; - tmp.green = ((VIDC.CursorPalette[c] >> 4) & 15) << 12; - tmp.blue = ((VIDC.CursorPalette[c] >> 8) & 15) << 12; - - /* Entry 0 is transparent */ - HD.cursorPixelMap[c + 1] = get_pixelval(tmp.red,tmp.green,tmp.blue); - } - - DC.MustResetPalette = 0; -} /* DoPixelMap_Standard */ - -/*-----------------------------------------------------------------------------*/ -/* Configure the true colour pixel map for the 8bpp modes */ -static void DoPixelMap_256(ARMul_State *state) -{ - XColor tmp; - int c; - - if (!(DC.MustRedraw || DC.MustResetPalette)) { - return; - } - - for(c=0; c<256; c++) { - int palentry = c & 15; - int L4 = (c >> 4) & 1; - int L65 = (c >> 5) & 3; - int L7 = (c >> 7) & 1; - - tmp.red = ((VIDC.Palette[palentry] & 7) | (L4 << 3)) << 12; - tmp.green = (((VIDC.Palette[palentry] >> 4) & 3) | (L65 << 2)) << 12; - tmp.blue = (((VIDC.Palette[palentry] >> 8) & 7) | (L7 << 3)) << 12; - /* I suppose I should do something with the supremacy bit....*/ - HD.pixelMap[c] = get_pixelval(tmp.red, tmp.green, tmp.blue); - } - - /* Now do the ones for the cursor */ - for(c=0; c<3; c++) { -// tmp.flags=DoRed|DoGreen|DoBlue; -// tmp.pixel=c+CURSORCOLBASE; - tmp.red = (VIDC.CursorPalette[c] &15) << 12; - tmp.green = ((VIDC.CursorPalette[c] >> 4) &15) << 12; - tmp.blue = ((VIDC.CursorPalette[c] >> 8) &15) << 12; - - HD.cursorPixelMap[c + 1] = get_pixelval(tmp.red, tmp.green, tmp.blue); - } - - DC.MustResetPalette = 0; -} /* DoPixelMap_256 */ - -/*-----------------------------------------------------------------------------*/ -static void RefreshDisplay_TrueColor_1bpp(ARMul_State *state, int DisplayWidth, int DisplayHeight) -{ - int x,y,memoffset; - int VisibleDisplayWidth; - char Buffer[MonitorWidth / 8]; - char *ImgPtr = HD.ImageData; - - /* First configure the colourmap */ - DoPixelMap_Standard(state); - - /* Cope with screwy display widths/height */ - if (DisplayHeight>MonitorHeight) { - DisplayHeight=MonitorHeight; - } - if (DisplayWidth>MonitorWidth) - VisibleDisplayWidth=MonitorWidth; - else - VisibleDisplayWidth=DisplayWidth; - - for(y=0,memoffset=0;y<DisplayHeight; - y++,memoffset+=DisplayWidth/8,ImgPtr+=MonitorWidth) { - if ((DC.MustRedraw) || (QueryRamChange(state,memoffset,VisibleDisplayWidth/8))) { - int yp = (MonitorHeight-y)*MonitorWidth; - if (y<DC.miny) DC.miny=y; - if (y>DC.maxy) DC.maxy=y; - CopyScreenRAM(state,memoffset,VisibleDisplayWidth/8, Buffer); - - - for(x=0;x<VisibleDisplayWidth;x+=8) { - int xl = x+yp; - int pixel = Buffer[x>>3]; - dibbmp[xl] = (unsigned short)HD.pixelMap[pixel &1]; - dibbmp[xl+1] = (unsigned short)HD.pixelMap[(pixel>>1) &1]; - dibbmp[xl+2] = (unsigned short)HD.pixelMap[(pixel>>2) &1]; - dibbmp[xl+3] = (unsigned short)HD.pixelMap[(pixel>>3) &1]; - dibbmp[xl+4] = (unsigned short)HD.pixelMap[(pixel>>4) &1]; - dibbmp[xl+5] = (unsigned short)HD.pixelMap[(pixel>>5) &1]; - dibbmp[xl+6] = (unsigned short)HD.pixelMap[(pixel>>6) &1]; - dibbmp[xl+7] = (unsigned short)HD.pixelMap[(pixel>>7) &1]; - }; /* x */ - }; /* Refresh test */ - }; /* y */ - DC.MustRedraw=0; - - MarkAsUpdated(state,memoffset); -}; /* RefreshDisplay_TrueColor_1bpp */ - - -/*-----------------------------------------------------------------------------*/ -static void RefreshDisplay_TrueColor_2bpp(ARMul_State *state, int DisplayWidth, int DisplayHeight) { - int x,y,memoffset; - int VisibleDisplayWidth; - char Buffer[MonitorWidth/4]; - char *ImgPtr=HD.ImageData; - - /* First configure the colourmap */ - DoPixelMap_Standard(state); - - /* Cope with screwy display widths/height */ - if (DisplayHeight>MonitorHeight) DisplayHeight=MonitorHeight; - if (DisplayWidth>MonitorWidth) - VisibleDisplayWidth=MonitorWidth; - else - VisibleDisplayWidth=DisplayWidth; - - for(y=0,memoffset=0;y<DisplayHeight; - y++,memoffset+=DisplayWidth/4,ImgPtr+=MonitorWidth) { - if ((DC.MustRedraw) || (QueryRamChange(state,memoffset,VisibleDisplayWidth/4))) { - int yp = (MonitorHeight-y)*MonitorWidth; - if (y<DC.miny) DC.miny=y; - if (y>DC.maxy) DC.maxy=y; - CopyScreenRAM(state,memoffset,VisibleDisplayWidth/4, Buffer); - - - for(x=0;x<VisibleDisplayWidth;x+=4) { - int pixs = yp + x; - int pixel = Buffer[x>>2]; - - dibbmp[pixs ] = (unsigned short)HD.pixelMap[pixel &3]; - dibbmp[pixs+1] = (unsigned short)HD.pixelMap[(pixel>>2) &3]; - dibbmp[pixs+2] = (unsigned short)HD.pixelMap[(pixel>>4) &3]; - dibbmp[pixs+3] = (unsigned short)HD.pixelMap[(pixel>>6) &3]; - - }; /* x */ - }; /* Update test */ - }; /* y */ - DC.MustRedraw=0; - MarkAsUpdated(state,memoffset); - -}; /* RefreshDisplay_TrueColor_2bpp */ - - - -/*-----------------------------------------------------------------------------*/ - -static void RefreshDisplay_TrueColor_4bpp(ARMul_State *state, int DisplayWidth, int DisplayHeight) { - int x,y,memoffset; - int VisibleDisplayWidth; - char Buffer[MonitorWidth/2]; - char *ImgPtr=HD.ImageData; - - /* First configure the colourmap */ - DoPixelMap_Standard(state); - - /*fprintf(stderr,"RefreshDisplay_TrueColor_4bpp: DisplayWidth=%d DisplayHeight=%d\n", - DisplayWidth,DisplayHeight); */ - /* Cope with screwy display widths/height */ - if (DisplayHeight>MonitorHeight) DisplayHeight=MonitorHeight; - if (DisplayWidth>MonitorWidth) - VisibleDisplayWidth=MonitorWidth; - else - VisibleDisplayWidth=DisplayWidth; - - for(y=0,memoffset=0;y<DisplayHeight; - y++,memoffset+=(DisplayWidth/2),ImgPtr+=MonitorWidth) { - if ((DC.MustRedraw) || (QueryRamChange(state,memoffset,VisibleDisplayWidth/2))) { - int yp = (MonitorHeight-y)*MonitorWidth; - if (y<DC.miny) DC.miny=y; - if (y>DC.maxy) DC.maxy=y; - CopyScreenRAM(state,memoffset,VisibleDisplayWidth/2, Buffer); - - - for(x=0;x<VisibleDisplayWidth;x+=2) { - int pixs = x + yp; - int pixel = Buffer[x>>1]; - - dibbmp[pixs] = (unsigned short)HD.pixelMap[pixel &15]; - dibbmp[pixs + 1] = (unsigned short)HD.pixelMap[(pixel>>4) &15]; - }; /* x */ - }; /* Refresh test */ - }; /* y */ - DC.MustRedraw=0; - MarkAsUpdated(state,memoffset); -}; /* RefreshDisplay_TrueColor_4bpp */ - -/*-----------------------------------------------------------------------------*/ -static void RefreshDisplay_TrueColor_8bpp(ARMul_State *state, int DisplayWidth, int DisplayHeight) { - int x,y,memoffset; - int VisibleDisplayWidth; - unsigned char Buffer[MonitorWidth]; - char *ImgPtr=HD.ImageData; - - /* First configure the colourmap */ - DoPixelMap_256(state); - - /* Cope with screwy display widths/height */ - if (DisplayHeight>MonitorHeight) DisplayHeight=MonitorHeight; - if (DisplayWidth>MonitorWidth) - VisibleDisplayWidth=MonitorWidth; - else - VisibleDisplayWidth=DisplayWidth; - - for(y=0,memoffset=0;y<DisplayHeight; - y++,memoffset+=DisplayWidth,ImgPtr+=MonitorWidth) { - if ((DC.MustRedraw) || (QueryRamChange(state,memoffset,VisibleDisplayWidth))) { - int yp = (MonitorHeight-y)*MonitorWidth; - if (y<DC.miny) DC.miny=y; - if (y>DC.maxy) DC.maxy=y; - CopyScreenRAM(state,memoffset,VisibleDisplayWidth, Buffer); - - - for(x=0;x<VisibleDisplayWidth;x++) { - - dibbmp[x+yp] = (unsigned short)HD.pixelMap[Buffer[x]]; - }; /* X loop */ - }; /* Refresh test */ - }; /* y */ - DC.MustRedraw=0; - MarkAsUpdated(state,memoffset); -} /* RefreshDisplay_TrueColor_8bpp */ - - /*-----------------------------------------------------------------------------*/ /* Refresh the mouse's image */ static void RefreshMouse(ARMul_State *state) { - int x,y,height,offset, pix; + int x,y,offset, pix, repeat; int memptr; - unsigned short *ImgPtr; - int HorizPos = (int)VIDC.Horiz_CursorStart - (int)VIDC.Horiz_DisplayStart*2; - int Height = (int)VIDC.Vert_CursorEnd - (int)VIDC.Vert_CursorStart; //+1; + int HorizPos; + int Height = ((int)VIDC.Vert_CursorEnd - (int)VIDC.Vert_CursorStart)*HD.YScale; int VertPos; int diboffs; - VertPos = (int)VIDC.Vert_CursorStart; - VertPos -= (signed int)VIDC.Vert_DisplayStart; + DisplayDev_GetCursorPos(state,&HorizPos,&VertPos); + HorizPos = HorizPos*HD.XScale+HD.XOffset; + VertPos = VertPos*HD.YScale+HD.YOffset; - if (Height < 1) Height = 1; + if (Height < 0) Height = 0; if (VertPos < 0) VertPos = 0; rMouseX = HorizPos; rMouseY = VertPos; rMouseHeight = Height; + /* Cursor palette */ + SDD_HostColour cursorPal[4]; + cursorPal[0] = 0; + for(x=0; x<3; x++) { + cursorPal[x+1] = SDD_Name(Host_GetColour)(state,VIDC.CursorPalette[x]); + } + offset=0; memptr=MEMC.Cinit*16; - height=(VIDC.Vert_CursorEnd-VIDC.Vert_CursorStart)+1; - ImgPtr=(unsigned short *) HD.CursorImageData; - for(y=0;y<height;y++,memptr+=8,offset+=8) { + repeat=0; + for(y=0;y<Height;y++) { if (offset<512*1024) { ARMword tmp[2]; tmp[0]=MEMC.PhysRam[memptr/4]; tmp[1]=MEMC.PhysRam[memptr/4+1]; - for(x=0;x<32;x++,ImgPtr++) { + for(x=0;x<32;x++) { pix = ((tmp[x/16]>>((x & 15)*2)) & 3); - diboffs = rMouseX + x + (MonitorHeight - rMouseY - y) * MonitorWidth; + diboffs = rMouseX + x + (MonitorHeight - rMouseY - y - 1) * MonitorWidth; - curbmp[x + (MonitorHeight - y) * 32] = + curbmp[x + (MonitorHeight - y - 1) * 32] = (pix || diboffs < 0) ? - (unsigned short)HD.cursorPixelMap[pix] : dibbmp[diboffs]; + cursorPal[pix] : dibbmp[diboffs]; }; /* x */ } else return; + if(++repeat == HD.YScale) { + memptr+=8; + offset+=8; + repeat = 0; + } }; /* y */ - updateDisplay(); }; /* RefreshMouse */ -void -RefreshDisplay(ARMul_State *state) -{ - int DisplayHeight = VIDC.Vert_DisplayEnd - VIDC.Vert_DisplayStart; - int DisplayWidth = (VIDC.Horiz_DisplayEnd - VIDC.Horiz_DisplayStart) * 2; - - DC.AutoRefresh=AUTOREFRESHPOLL; - ioc.IRQStatus|=8; /* VSync */ - ioc.IRQStatus |= 0x20; /* Sound - just an experiment */ - IO_UpdateNirq(); - - DC.miny=MonitorHeight-1; - DC.maxy=0; - - if (DisplayHeight > 0 && DisplayWidth > 0) { - /* First figure out number of BPP */ - switch ((VIDC.ControlReg & 0xc)>>2) { - case 0: /* 1bpp */ - RefreshDisplay_TrueColor_1bpp(state, DisplayWidth, DisplayHeight); - break; - case 1: /* 2bpp */ - RefreshDisplay_TrueColor_2bpp(state, DisplayWidth, DisplayHeight); - break; - case 2: /* 4bpp */ - RefreshDisplay_TrueColor_4bpp(state, DisplayWidth, DisplayHeight); - break; - case 3: /* 8bpp */ - RefreshDisplay_TrueColor_8bpp(state, DisplayWidth, DisplayHeight); - break; - } - } - - /* Only tell X to redisplay those bits which we've replotted into the image */ - if (DC.miny < DC.maxy) { - updateDisplay(); - } - -} /* RefreshDisplay */ - /*-----------------------------------------------------------------------------*/ static void ProcessKey(ARMul_State *state) { @@ -513,232 +266,36 @@ buttF = 0; } /* ProcessButton */ -void -DisplayKbd_InitHost(ARMul_State *state) +/*-----------------------------------------------------------------------------*/ +int +DisplayDev_Init(ARMul_State *state) { /* Setup display and cursor bitmaps */ createWindow(MonitorWidth, MonitorHeight); - - HD.red_prec = 5; - HD.green_prec = 5; - HD.blue_prec = 5; - HD.red_shift = 10; - HD.green_shift = 5; - HD.blue_shift = 0; + return DisplayDev_Set(state,&SDD_DisplayDev); } -void VIDC_PutVal(ARMul_State *state,ARMword address, ARMword data,int bNw) +/*-----------------------------------------------------------------------------*/ +void +SDD_Name(Host_PollDisplay)(ARMul_State *state) { - unsigned int addr, val; - - addr=(data>>24) & 255; - val=data & 0xffffff; - - if (!(addr & 0xc0)) { - int Log, Sup,Red,Green,Blue; - - /* This lot presumes its not 8bpp mode! */ - Log=(addr>>2) & 15; - Sup=(val >> 12) & 1; - Blue=(val >> 8) & 15; - Green=(val >> 4) & 15; - Red=val & 15; -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Palette write: Logical=%d Physical=(%d,%d,%d,%d)\n", - Log,Sup,Red,Green,Blue); -#endif - VideoRelUpdateAndForce(DC.MustResetPalette,VIDC.Palette[Log],(val & 0x1fff)); - return; - }; - - addr&=~3; - switch (addr) { - case 0x40: /* Border col */ -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC border colour write val=0x%x\n",val); -#endif - VideoRelUpdateAndForce(DC.MustResetPalette,VIDC.BorderCol,(val & 0x1fff)); - break; - - case 0x44: /* Cursor palette log col 1 */ -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC cursor log col 1 write val=0x%x\n",val); -#endif - VideoRelUpdateAndForce(DC.MustResetPalette,VIDC.CursorPalette[0],(val & 0x1fff)); - break; - - case 0x48: /* Cursor palette log col 2 */ -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC cursor log col 2 write val=0x%x\n",val); -#endif - VideoRelUpdateAndForce(DC.MustResetPalette,VIDC.CursorPalette[1],(val & 0x1fff)); - break; - - case 0x4c: /* Cursor palette log col 3 */ -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC cursor log col 3 write val=0x%x\n",val); -#endif - VideoRelUpdateAndForce(DC.MustResetPalette,VIDC.CursorPalette[2],(val & 0x1fff)); - break; - - case 0x60: /* Stereo image reg 7 */ - case 0x64: /* Stereo image reg 0 */ - case 0x68: /* Stereo image reg 1 */ - case 0x6c: /* Stereo image reg 2 */ - case 0x70: /* Stereo image reg 3 */ - case 0x74: /* Stereo image reg 4 */ - case 0x78: /* Stereo image reg 5 */ - case 0x7c: /* Stereo image reg 6 */ -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC stereo image reg write val=0x%x\n",val); -#endif - VIDC.StereoImageReg[(addr==0x60)?7:((addr-0x64)/4)]=val & 7; - break; - - case 0x80: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Horiz cycle register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_Cycle,(val>>14) & 0x3ff); - break; - - case 0x84: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Horiz sync width register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_SyncWidth,(val>>14) & 0x3ff); - break; - - case 0x88: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Horiz border start register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_BorderStart,(val>>14) & 0x3ff); - break; - - case 0x8c: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Horiz display start register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_DisplayStart,(val>>14) & 0x3ff); - resizeWindow((VIDC.Horiz_DisplayEnd-VIDC.Horiz_DisplayStart)*2, - VIDC.Vert_DisplayEnd-VIDC.Vert_DisplayStart); - break; - - case 0x90: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Horiz display end register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_DisplayEnd,(val>>14) & 0x3ff); - resizeWindow((VIDC.Horiz_DisplayEnd-VIDC.Horiz_DisplayStart)*2, - VIDC.Vert_DisplayEnd-VIDC.Vert_DisplayStart); - break; - - case 0x94: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC horizontal border end register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_BorderEnd,(val>>14) & 0x3ff); - break; - - case 0x98: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC horiz cursor start register val=%d\n",val>>13); -#endif - VIDC.Horiz_CursorStart=(val>>13) & 0x7ff; -// DC.MustRedraw = 1; -///sash - break; - - case 0x9c: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC horiz interlace register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Horiz_Interlace,(val>>14) & 0x3ff); - break; - - case 0xa0: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert cycle register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_Cycle,(val>>14) & 0x3ff); - break; - - case 0xa4: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert sync width register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_SyncWidth,(val>>14) & 0x3ff); - break; - - case 0xa8: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert border start register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_BorderStart,(val>>14) & 0x3ff); - break; - - case 0xac: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert disp start register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_DisplayStart,((val>>14) & 0x3ff)); - resizeWindow((VIDC.Horiz_DisplayEnd-VIDC.Horiz_DisplayStart)*2, - VIDC.Vert_DisplayEnd-VIDC.Vert_DisplayStart); - break; - - case 0xb0: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert disp end register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_DisplayEnd,(val>>14) & 0x3ff); - resizeWindow((VIDC.Horiz_DisplayEnd-VIDC.Horiz_DisplayStart)*2, - VIDC.Vert_DisplayEnd-VIDC.Vert_DisplayStart); - break; - - case 0xb4: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert Border end register val=%d\n",val>>14); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.Vert_BorderEnd,(val>>14) & 0x3ff); - break; - - case 0xb8: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert cursor start register val=%d\n",val>>14); -#endif - VIDC.Vert_CursorStart=(val>>14) & 0x3ff; - RefreshMouse(state); -//sash - break; - - case 0xbc: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Vert cursor end register val=%d\n",val>>14); -#endif - VIDC.Vert_CursorEnd=(val>>14) & 0x3ff; - RefreshMouse(state); -//sash - break; - - case 0xc0: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Sound freq register val=%d\n",val); -#endif - VIDC.SoundFreq=val & 0xff; - break; - - case 0xe0: -#ifdef DEBUG_VIDCREGS - fprintf(stderr,"VIDC Control register val=0x%x\n",val); -#endif - VideoRelUpdateAndForce(DC.MustRedraw,VIDC.ControlReg,val & 0xffff); - break; - - default: - fprintf(stderr,"Write to unknown VIDC register reg=0x%x val=0x%x\n",addr,val); - break; + RefreshMouse(state); + updateDisplay(); +} - }; /* Register switch */ +/*-----------------------------------------------------------------------------*/ +int +Kbd_PollHostKbd(ARMul_State *state) +{ + if (keyF) { + ProcessKey(state); + } + if (buttF) { + ProcessButton(state); + } + if (mouseMF) { + MouseMoved(state); + } + return 0; } Index: filecalls_internal.h =================================================================== RCS file: /cvsroot/arcem/arcem/win/filecalls_internal.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- filecalls_internal.h 30 Jan 2005 15:05:39 -0000 1.1 +++ filecalls_internal.h 12 May 2012 17:34:51 -0000 1.2 @@ -11,9 +11,9 @@ char *sPath; WIN32_FIND_DATA w32fd; HANDLE hFile; - unsigned char bFirstEntry; + bool bFirstEntry; }; #define ARCEM_PATH_MAX MAX_PATH -#endif /* __FILECALLS_H */ \ No newline at end of file +#endif /* __FILECALLS_H */ Index: win.c =================================================================== RCS file: /cvsroot/arcem/arcem/win/win.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- win.c 9 Apr 2006 20:01:21 -0000 1.8 +++ win.c 12 May 2012 17:34:51 -0000 1.9 @@ -5,9 +5,6 @@ #include "armdefs.h" #include "arch/keyboard.h" -#define MonitorWidth 800 -#define MonitorHeight 600 - #define NR_THREADS (0x1000) HBITMAP hbmp = NULL; @@ -184,10 +181,12 @@ BitBlt(hdc, 0, 0, xSize, ySize, hsrc, 0, 0, SRCCOPY); DeleteDC(hsrc); - hsrc1=CreateCompatibleDC(hdc); - SelectObject(hsrc1, cbmp); - BitBlt(hdc, rMouseX, rMouseY, 32, rMouseHeight, hsrc1, 0, 0, SRCCOPY); - DeleteDC(hsrc1); + if(rMouseHeight > 0) { + hsrc1=CreateCompatibleDC(hdc); + SelectObject(hsrc1, cbmp); + BitBlt(hdc, rMouseX, rMouseY, 32, rMouseHeight, hsrc1, 0, 0, SRCCOPY); + DeleteDC(hsrc1); + } EndPaint(hWnd, &ps); } @@ -295,6 +294,7 @@ // You can tell whether it's up or down by checking it's // positive or negative, to work out the extent you use // HIWORD(wParam), but we don't need that. + ARMul_State *state = &statestr; if(iMouseWheelValue > 0) { // Fire our fake button_4 wheelup event, this'll get picked up Index: filecalls.c =================================================================== RCS file: /cvsroot/arcem/arcem/win/filecalls.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- filecalls.c 30 Jan 2005 15:05:39 -0000 1.1 +++ filecalls.c 12 May 2012 17:34:51 -0000 1.2 @@ -28,27 +28,27 @@ * * @param sPath Location of directory to scan * @param hDir Pointer to a Directory struct to fill in - * @returns 1 on success 0 on failure + * @returns true on success false on failure */ -unsigned Directory_Open(const char *sPath, Directory *hDir) +bool Directory_Open(const char *sPath, Directory *hDir) { - unsigned char bNeedsEndSlash = 0; + bool bNeedsEndSlash = 0; WIN32_FIND_DATA w32fd = {0}; assert(sPath); assert(*sPath); if(sPath[strlen(sPath)] != '/') { - bNeedsEndSlash = 1; + bNeedsEndSlash = true; } - hDir->bFirstEntry = 1; + hDir->bFirstEntry = true; hDir->hFile = NULL; hDir->sPath = calloc(strlen(sPath) + (bNeedsEndSlash ? 1 : 0 ) + 3 + 1, 1); /* Path + Endslash (if needed) + *.* + terminator */ if(NULL == hDir->sPath) { fprintf(stderr, "Failed to allocate memory for directory handle path\n"); - return 0; + return false; } strcpy(hDir->sPath, sPath); @@ -57,7 +57,7 @@ } strcat(hDir->sPath, "*.*"); - return 1; + return true; } /** @@ -87,7 +87,7 @@ if(hDirectory->bFirstEntry) { hDirectory->hFile = FindFirstFile(hDirectory->sPath, &hDirectory->w32fd); - hDirectory->bFirstEntry = 0; + hDirectory->bFirstEntry = false; if(INVALID_HANDLE_VALUE == hDirectory->hFile) { return NULL; @@ -111,9 +111,9 @@ * * @param sPath Path to file to check * @param phFileInfo pointer to FileInfo struct to fill in - * @returns 0 on failure 1 on success + * @returns false on failure true on success */ -unsigned char File_GetInfo(const char *sPath, FileInfo *phFileInfo) +bool File_GetInfo(const char *sPath, FileInfo *phFileInfo) { WIN32_FILE_ATTRIBUTE_DATA w32fad = {0}; @@ -122,27 +122,27 @@ assert(phFileInfo); /* Initialise contents */ - phFileInfo->bIsDirectory = 0; - phFileInfo->bIsRegularFile = 0; + phFileInfo->bIsDirectory = false; + phFileInfo->bIsRegularFile = false; /* Read the details */ if (!GetFileAttributesEx(sPath, GetFileExInfoStandard, &w32fad)) { fprintf(stderr, "Failed to stat '%s'\n", sPath); - return 0; + return false; } /* Fill in entries */ phFileInfo->ulFilesize = w32fad.nFileSizeLow; if (w32fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - phFileInfo->bIsDirectory = 1; + phFileInfo->bIsDirectory = true; } else { /* IMPROVE guess, if not a directory then we are a regular file */ - phFileInfo->bIsRegularFile = 1; + phFileInfo->bIsRegularFile = true; } /* Success! */ - return 1; + return true; } ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -- arcem-cvs mailing list arcem-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/arcem-cvs