📄 halcaps.cpp
字号:
0,
2, // Number of autoflippable surfaces
8, // Byte restriction of placement within surface
1, // Byte restriction of width after prescaling
1, // Byte restriction of left cropping
1, // Byte restriction of cropping width
16, // shrink in steps of original width
32, // shrink in steps of original height
0,
0,
0
};
const DDKERNELCAPS KernelCaps =
{
sizeof(DDKERNELCAPS),
// DDKERNELCAPS_SKIPFIELDS |
// DDKERNELCAPS_AUTOFLIP |
// DDKERNELCAPS_SETSTATE |
// DDKERNELCAPS_LOCK |
// DDKERNELCAPS_FLIPVIDEOPORT |
// DDKERNELCAPS_FLIPOVERLAY |
// DDKERNELCAPS_FIELDPOLARITY |
0,
// DDIRQ_DISPLAY_VSYNC |
// DDIRQ_VPORT0_VSYNC |
0
};
// For the moment we have only one mode for the primary surface (win32e frame buffer)
DDHALMODEINFO modeInfo[] =
{
// Bits/ Uses -----------MASKS-------------
// width height pitch Pixel Palette Freq Red Green Blue Alpha
{ 640, 480, 1024, 8, 1, 60, 0, 0, 0, 0 },
#ifdef FB16BPP
{ 640, 480, 2048, 16, 0, 60, 0xF800, 0x07E0, 0x001F, 0 }
#endif
};
#define SCREEN_WIDTH (g_pGPE->ScreenWidth())
#define SCREEN_HEIGHT (g_pGPE->ScreenHeight())
// set up by HalInit
// This global pointer is to be recorded in the DirectDraw structure
DDGPE* g_pGPE = (DDGPE*)NULL;
DDGPESurf* g_pDDrawPrimarySurface = NULL;
// InitDDHALInfo must set up this information
unsigned long g_nVideoMemorySize = 0L;
unsigned char * g_pVideoMemory = NULL; // virtual address of video memory from client's side
EXTERN_C void buildDDHALInfo( LPDDHALINFO lpddhi, DWORD modeidx ) {
/* nav: begin */
//IGSInitVideo();
/* nav: end */
memset( lpddhi, 0, sizeof(DDHALINFO) ); // Clear the DDHALINFO structure
if( !g_pVideoMemory ) // in case this is called more than once...
{
// g_pGPE and g_pDDrawPrimarySurface were already set up by HalInit
unsigned long physicalVideoMemoryStart;
g_pGPE->GetPhysicalVideoMemory( &physicalVideoMemoryStart, &g_nVideoMemorySize );
DEBUGMSG( 1,(TEXT("GetPhysicalVideoMemory returned phys=0x%08x size=%d\r\n"),
physicalVideoMemoryStart, g_nVideoMemorySize));
// Allocate some virtual memory space for video memory
// this has already been done in ATI HAP so we don't need virtual alloc/copy
g_pVideoMemory = (BYTE*)physicalVideoMemoryStart;
DEBUGMSG( 1,(TEXT("g_pVideoMemory=%08x\r\n"), g_pVideoMemory ));
}
// Populate the rest of the DDHALINFO structure:
lpddhi->dwSize = sizeof(DDHALINFO);
lpddhi->lpDDCallbacks = &cbDDCallbacks;
lpddhi->lpDDSurfaceCallbacks = &cbDDSurfaceCallbacks;
lpddhi->lpDDPaletteCallbacks = &cbDDPaletteCallbacks;
lpddhi->lpDDExeBufCallbacks = &cbDDExeBufCallbacks;
lpddhi->GetDriverInfo = HalGetDriverInfo;
lpddhi->vmiData.fpPrimary = (unsigned long)(g_pVideoMemory) + g_pDDrawPrimarySurface->OffsetInVideoMemory(); // pointer to primary surface
DEBUGMSG( 1,(TEXT("lpddhi->vmiData.fpPrimary =%08x\r\n"), lpddhi->vmiData.fpPrimary ));
lpddhi->vmiData.dwFlags = 0; // flags
lpddhi->vmiData.dwDisplayWidth = SCREEN_WIDTH;
// current display width
lpddhi->vmiData.dwDisplayHeight = SCREEN_HEIGHT;
// current display height
lpddhi->vmiData.lDisplayPitch = g_pDDrawPrimarySurface->Stride(); //ScreenBpp * ScreenWidth / 8
DEBUGMSG( 1,(TEXT("stride: %d\r\n"), lpddhi->vmiData.lDisplayPitch ));
RETAILMSG( 1,(TEXT("stride: %d\r\n"), lpddhi->vmiData.lDisplayPitch ));
// current display pitch
lpddhi->vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT);
// ... = 8bit/pixel palettized
lpddhi->vmiData.ddpfDisplay.dwFourCC = 0; // (FOURCC code)
lpddhi->vmiData.ddpfDisplay.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
lpddhi->vmiData.ddpfDisplay.dwRGBBitCount = 8;
#ifdef FB16BPP
lpddhi->vmiData.ddpfDisplay.dwFlags = DDPF_RGB;
lpddhi->vmiData.ddpfDisplay.dwRBitMask = 0xF800; // 5
lpddhi->vmiData.ddpfDisplay.dwGBitMask = 0x07E0; // 6
lpddhi->vmiData.ddpfDisplay.dwBBitMask = 0x001F; // 5
lpddhi->vmiData.ddpfDisplay.dwRGBBitCount = 16;
//#else
#endif
// how many bits per pixel (BD_4,8,16,24,32)
lpddhi->vmiData.dwOffscreenAlign = 4; //8; //ullas - 4; // byte alignment for offscreen surfaces
lpddhi->vmiData.dwOverlayAlign = 16; //8; //ullas - 4; // byte alignment for overlays
lpddhi->vmiData.dwTextureAlign = 4; //8; //ullas - 0; // byte alignment for textures
lpddhi->vmiData.dwZBufferAlign = 4; //8; //ullas - 0; // byte alignment for z buffers
lpddhi->vmiData.dwAlphaAlign = 4; //8; //ullas - 4; // byte alignment for alpha
lpddhi->vmiData.dwNumHeaps = 0; // number of memory heaps in vmList
lpddhi->vmiData.pvmList = (LPVIDMEM)NULL; // array of heaps
// hw specific caps:
lpddhi->ddCaps.dwSize = sizeof(DDCAPS); // size of the DDDRIVERCAPS structure
lpddhi->ddCaps.dwCaps = // driver specific capabilities
// DDCAPS_3D | // Display hardware has 3D acceleration
DDCAPS_BLT | // Display hardware is capable of blt operations
DDCAPS_BLTQUEUE | // Display hardware is capable of asynchronous blt operations
// DDCAPS_BLTFOURCC | // Display hardware is capable of color space conversions during the blt operation
// DDCAPS_BLTSTRETCH | // Display hardware is capable of stretching during blt operations
DDCAPS_GDI | //ullas - Display hardware is shared with GDI
DDCAPS_OVERLAY | // Display hardware can overlay
// DDCAPS_OVERLAYCANTCLIP | // Set if display hardware supports overlays but can not clip them
DDCAPS_OVERLAYFOURCC | // overlay hardware is capable of color space conversions
DDCAPS_OVERLAYSTRETCH | // Indicates that stretching can be done by the overlay hardware
// DDCAPS_PALETTE | // unique DirectDrawPalettes can be created for DirectDrawSurfaces
// DDCAPS_PALETTEVSYNC | // palette changes can be syncd with the vertical
DDCAPS_READSCANLINE | // Display hardware can return the current scan line
// DDCAPS_STEREOVIEW | // Display hardware has stereo vision capabilities
//ullas - DDCAPS_VBI | // Display hardware is capable of generating a vertical blank interrupt
// DDCAPS_ZBLTS | // Supports the use of z buffers with blt operations
// DDCAPS_ZOVERLAYS | // Supports Z Ordering of overlays
DDCAPS_COLORKEY | // Supports color key
// DDCAPS_ALPHA | // Supports alpha surfaces
DDCAPS_COLORKEYHWASSIST | //ullas - colorkey is hardware assisted
// DDCAPS_NOHARDWARE | // no hardware support at all
DDCAPS_BLTCOLORFILL | // Display hardware is capable of color fill with bltter
// DDCAPS_BANKSWITCHED | // Display hardware is bank switched
// DDCAPS_BLTDEPTHFILL | // Display hardware is capable of depth filling Z-buffers with bltter
// DDCAPS_CANCLIP | // Display hardware is capable of clipping while bltting
// DDCAPS_CANCLIPSTRETCHED | // Display hardware is capable of clipping while stretch bltting
// DDCAPS_CANBLTSYSMEM | // Display hardware is capable of bltting to or from system memory
0;
lpddhi->ddCaps.dwCaps2 = // more driver specific capabilities
// DDCAPS2_CERTIFIED // Display hardware is certified
DDCAPS2_NO2DDURING3DSCENE | // Driver cannot interleave 2D & 3D operations
// DDCAPS2_VIDEOPORT | //ullas - Display hardware contains a video port
DDCAPS2_AUTOFLIPOVERLAY | //ullas - automatic doubled buffered display of video port
DDCAPS2_CANBOBINTERLEAVED | //ullas - Overlay can display each field of interlaced data
DDCAPS2_CANBOBNONINTERLEAVED | //ullas - As above but for non-interleaved data
// DDCAPS2_COLORCONTROLOVERLAY | // The overlay surface contains color controls
// DDCAPS2_COLORCONTROLPRIMARY | // The primary surface contains color controls
// DDCAPS2_CANDROPZ16BIT | // RGBZ -> RGB supported for 16:16 RGB:Z
// DDCAPS2_NONLOCALVIDMEM | // Driver supports non-local video memory
// DDCAPS2_NONLOCALVIDMEMCAPS | // Dirver supports non-local video memory but has different capabilities
// DDCAPS2_NOPAGELOCKREQUIRED | // Driver neither requires nor prefers surfaces to be pagelocked
// DDCAPS2_WIDESURFACES | // Driver can create surfaces which are wider than the primary surface
// DDCAPS2_CANFLIPODDEVEN | // Driver supports bob without using a video port
// DDCAPS2_CANBOBHARDWARE | // Driver supports bob using hardware
// DDCAPS2_COPYFOURCC | // Driver supports bltting any FOURCC surface to another surface of the same FOURCC
0 ;
lpddhi->ddCaps.dwCKeyCaps = // color key capabilities of the surface
DDCKEYCAPS_DESTOVERLAY |
DDCKEYCAPS_DESTOVERLAYYUV | //ull
DDCKEYCAPS_DESTOVERLAYONEACTIVE |
DDCKEYCAPS_NOCOSTOVERLAY | //ullas
DDCKEYCAPS_SRCBLT | // Hardware can use colorkey (cf source only)
// ..for transparent blts
DDCKEYCAPS_SRCOVERLAY | //ull
DDCKEYCAPS_SRCOVERLAYCLRSPACE | //ull
DDCKEYCAPS_SRCOVERLAYYUV | //ull
DDCKEYCAPS_SRCOVERLAYONEACTIVE | //ull
DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV| //ull
0;
lpddhi->ddCaps.dwFXCaps= // driver specific stretching and effects capabilites
DDFXCAPS_BLTMIRRORUPDOWN | // Supports vertical inversion Blts
//DDFXCAPS_BLTSTRETCHY | // Supports stretch blts in the Y-direction
//DDFXCAPS_BLTSHRINKY | // Supports shrink blts in the Y-direction
//DDFXCAPS_BLTSTRETCHX | // Supports stretch blts in the X-direction
//DDFXCAPS_BLTSHRINKX | // Supports shrink blts in the X-direction
DDFXCAPS_OVERLAYSTRETCHX |
DDFXCAPS_OVERLAYSTRETCHXN |
DDFXCAPS_OVERLAYSTRETCHY |
DDFXCAPS_OVERLAYSTRETCHYN |
DDFXCAPS_OVERLAYARITHSTRETCHY |
DDFXCAPS_OVERLAYARITHSTRETCHYN |
0;
lpddhi->ddCaps.dwPalCaps= // palette capabilities
// DDPCAPS_1BIT | // Simple 1-bit palette
// DDPCAPS_2BIT | // Simple 2-bit palette
// DDPCAPS_4BIT | // Simple 4-bit palette
// DDPCAPS_8BITENTRIES | // Palette indexes into 8 bit target
DDPCAPS_8BIT | // Simple 8-bit palette
DDPCAPS_INITIALIZE | // DDraw should initalize palette
// ..from lpDDColorArray
DDPCAPS_PRIMARYSURFACE | // Palette is attached to primary surface
// DDPCAPS_PRIMARYSURFACELEFT | // Palette is attached to left-eye primary surface
DDPCAPS_ALLOW256 | // All 256 entries may be set
0;
lpddhi->ddCaps.dwSVCaps=0; // Stereo vision capabilities (none)
lpddhi->ddCaps.dwAlphaBltConstBitDepths = 0;// No Alpha Blt's
lpddhi->ddCaps.dwAlphaBltPixelBitDepths = 0;
lpddhi->ddCaps.dwAlphaBltSurfaceBitDepths = 0;
lpddhi->ddCaps.dwZBufferBitDepths=0; // No z buffer
lpddhi->ddCaps.dwVidMemTotal = g_nVideoMemorySize; // total amount of video memory
RETAILMSG( 1,(TEXT("lpddhi->ddCaps.dwVidMemTotal = %X\r\n"), lpddhi->ddCaps.dwVidMemTotal ));
lpddhi->ddCaps.dwVidMemFree = g_nVideoMemorySize; // amount of free video memory
RETAILMSG( 1,(TEXT("lpddhi->ddCaps.dwVidMemFree = %X\r\n"), lpddhi->ddCaps.dwVidMemFree ));
// maximum number of visible overlays
lpddhi->ddCaps.dwMaxVisibleOverlays = 1; //ullas - iOvlMax;
lpddhi->ddCaps.dwCurrVisibleOverlays = 0; // current number of visible overlays
lpddhi->ddCaps.dwMinOverlayStretch=1000;
lpddhi->ddCaps.dwMaxOverlayStretch=8000; //ullas - 9999;
lpddhi->ddCaps.dwNumFourCCCodes = 4; //ullas - 1; // number of four cc codes
lpddhi->ddCaps.dwAlignBoundarySrc = 4; //8; //ullas - 4; // source rectangle alignment
lpddhi->ddCaps.dwAlignSizeSrc = 64; //8; // source rectangle byte size
lpddhi->ddCaps.dwAlignStrideAlign = 8; // stride alignment
lpddhi->ddCaps.ddsCaps.dwCaps= // DDSCAPS structure has all the general capabilities
// DDSCAPS_ALPHA | // Can create alpha-only surfaces
DDSCAPS_BACKBUFFER | // Can create backbuffer surfaces
DDSCAPS_COMPLEX | // Can create complex surfaces
DDSCAPS_FLIP | // Can flip between surfaces
DDSCAPS_FRONTBUFFER | // Can create front-buffer surfaces
DDSCAPS_OFFSCREENPLAIN | // Can create off-screen bitmaps
DDSCAPS_OVERLAY | // Can create overlay surfaces
DDSCAPS_PALETTE | // Has one palette ???
DDSCAPS_PRIMARYSURFACE | // Has a primary surface
// DDSCAPS_PRIMARYSURFACELEFT | // Has a left-eye primary surface
// DDSCAPS_TEXTURE | // Supports texture surrfaces
// DDSCAPS_SYSTEMMEMORY | // Surfaces are in system memory
DDSCAPS_VIDEOMEMORY | // Surfaces are in video memory
DDSCAPS_VISIBLE | // Changes are instant ???
// DDSCAPS_ZBUFFER | // Can create (pseudo) Z buffer
// DDSCAPS_EXECUTEBUFFER | // Can create execute buffer
// DDSCAPS_3DDEVICE | // Surfaces can be 3d targets
// DDSCAPS_WRITEONLY | // Can create write-only surfaces
// DDSCAPS_ALLOCONLOAD | // Can create alloconload surfaces
// DDSCAPS_MIPMAP | // Can create mipmap
0;
// SETROPBIT(lpddhi->ddCaps.dwRops,SRCCOPY); // Set bits for ROPS supported
//ullas - SETROPBIT(lpddhi->ddCaps.dwRops,PATCOPY);
// SETROPBIT(lpddhi->ddCaps.dwRops,BLACKNESS);
// SETROPBIT(lpddhi->ddCaps.dwRops,WHITENESS);
SETROPBIT(lpddhi->ddCaps.dwRops, SRCCOPY); // Set bits for ROPS supported
SETROPBIT(lpddhi->ddCaps.dwRops, SRCPAINT);
SETROPBIT(lpddhi->ddCaps.dwRops, SRCAND);
SETROPBIT(lpddhi->ddCaps.dwRops, SRCINVERT);
SETROPBIT(lpddhi->ddCaps.dwRops, PATCOPY);
SETROPBIT(lpddhi->ddCaps.dwRops, PATINVERT);
SETROPBIT(lpddhi->ddCaps.dwRops, DSTINVERT);
SETROPBIT(lpddhi->ddCaps.dwRops, BLACKNESS);
SETROPBIT(lpddhi->ddCaps.dwRops, WHITENESS);
lpddhi->dwMonitorFrequency = 60;//modeInfo[modeidx].wRefreshRate; // monitor frequency in current mode (60 field/sec)
lpddhi->dwModeIndex = 0; // current mode: index into array
lpddhi->lpdwFourCC = fourCC; // fourcc codes supported
lpddhi->dwNumModes = sizeof(modeInfo)/sizeof(DDHALMODEINFO);
// number of modes supported
lpddhi->lpModeInfo = modeInfo; // mode information
lpddhi->dwFlags =
DDHALINFO_MODEXILLEGAL | // create flags
DDHALINFO_GETDRIVERINFOSET |
0;
lpddhi->lpPDevice = (LPVOID)0; // physical device ptr
lpddhi->hInstance = (DWORD)0; // instance handle of driver
lpddhi->ddCaps.dwCaps2 |= DDCAPS2_VIDEOPORT;
lpddhi->ddCaps.ddsCaps.dwCaps |= DDSCAPS_VIDEOPORT;
lpddhi->ddCaps.dwMaxVideoPorts = 1;
lpddhi->ddCaps.dwCurrVideoPorts= 0;
}
#endif //DD_SUPPORT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -