去年 5 月底買的 PANASONIC DVD 錄放影機 DMR ES15,5200。
結果保固一年一過就壞了,而且是壞在最貴的雷射頭。修理1900。 超過原價的 1/3 。
這樣的設計功力應該才是最厲害的...剛好過保固就壞。
L 提供的: http://se.sunfar.com.tw/promo/9908/05.htm 順發延長保固 -- 就像 apple care, IBM, Dell 一樣,可以加買保固。
8.23.2010
8.12.2010
Modify DDCAPS for CE 6.0
DDCAPS 是 platform builder 提供,偵測 platform 支援 directdraw 的程度。
但是 CE 6.0 後,DirectDraw interface 大幅改變,所以這個 code 就不能用了。要修改後才行。
修改後的 code:
source 所在位置是 C:\WINCE600\PUBLIC\DIRECTX\SDK\SAMPLES\DXMISC\DDCAPS
build ddcaps 的 command 是:
因為 ddcaps 是在 public 下的 directx 目錄,所以 -p 後面要寫 directx ,意思是(path = directx)。
project name 就是 ddcaps.
但是 CE 6.0 後,DirectDraw interface 大幅改變,所以這個 code 就不能用了。要修改後才行。
修改後的 code:
Index: ddcaps.c
===================================================================
--- ddcaps.c (revision 23142)
+++ ddcaps.c (working copy)
@@ -74,7 +74,7 @@
LPDWORD caps;
LPCAPSDEFSTYPE defs;
-} gCaps[10];
+} gCaps[12];
struct
{
@@ -102,131 +102,83 @@
LPDIRECTDRAW lpDD; // DirectDraw object
// Map caps bits to readable strings
-CAPSDEFSTYPE ddCapsDefs[MAX_BOXES] =
-{
- {TEXT("3D"), DDCAPS_3D},
- {TEXT("ALIGNBOUNDARYDEST"), DDCAPS_ALIGNBOUNDARYDEST},
- {TEXT("ALIGNSIZEDEST"), DDCAPS_ALIGNSIZEDEST},
- {TEXT("ALIGNBOUNDARYSRC"), DDCAPS_ALIGNBOUNDARYSRC},
- {TEXT("ALIGNSIZESRC"), DDCAPS_ALIGNSIZESRC},
- {TEXT("ALIGNSTRIDE"), DDCAPS_ALIGNSTRIDE},
- {TEXT("BLT"), DDCAPS_BLT},
- {TEXT("BLTQUEUE"), DDCAPS_BLTQUEUE},
- {TEXT("BLTFOURCC"), DDCAPS_BLTFOURCC},
- {TEXT("BLTSTRETCH"), DDCAPS_BLTSTRETCH},
- {TEXT("GDI"), DDCAPS_GDI},
- {TEXT("OVERLAY"), DDCAPS_OVERLAY},
- {TEXT("OVERLAYCANTCLIP"), DDCAPS_OVERLAYCANTCLIP},
- {TEXT("OVERLAYFOURCC"), DDCAPS_OVERLAYFOURCC},
- {TEXT("OVERLAYSTRETCH"), DDCAPS_OVERLAYSTRETCH},
- {TEXT("PALETTE"), DDCAPS_PALETTE},
- {TEXT("PALETTEVSYNC"), DDCAPS_PALETTEVSYNC},
- {TEXT("READSCANLINE"), DDCAPS_READSCANLINE},
- {TEXT("STEREOVIEW"), DDCAPS_STEREOVIEW},
- {TEXT("VBI"), DDCAPS_VBI},
- {TEXT("ZBLTS"), DDCAPS_ZBLTS},
- {TEXT("ZOVERLAYS"), DDCAPS_ZOVERLAYS},
- {TEXT("COLORKEY"), DDCAPS_COLORKEY},
- {TEXT("ALPHA"), DDCAPS_ALPHA},
- {TEXT("CKEYHWASSIST"), DDCAPS_COLORKEYHWASSIST},
- {TEXT("NOHARDWARE"), DDCAPS_NOHARDWARE},
- {TEXT("BLTCOLORFILL"), DDCAPS_BLTCOLORFILL},
- {TEXT("BANKSWITCHED"), DDCAPS_BANKSWITCHED},
- {TEXT("BLTDEPTHFILL"), DDCAPS_BLTDEPTHFILL},
- {TEXT("CANCLIP"), DDCAPS_CANCLIP},
- {TEXT("CANCLIPSTRETCHED"), DDCAPS_CANCLIPSTRETCHED},
-};
+
CAPSDEFSTYPE CKeyCapsDefs[MAX_BOXES] =
{
- {TEXT("DESTBLT"), DDCKEYCAPS_DESTBLT},
- {TEXT("DESTBLTCLRSPACE"), DDCKEYCAPS_DESTBLTCLRSPACE},
+ {TEXT("BOTHBLT"), DDCKEYCAPS_BOTHBLT},
+ {TEXT("DESTBLT"), DDCKEYCAPS_DESTBLT },
+ {TEXT("DESTBLTCLRSPACE"), DDCKEYCAPS_DESTBLTCLRSPACE },
{TEXT("DESTBLTCLRSPACEYUV"), DDCKEYCAPS_DESTBLTCLRSPACEYUV},
- {TEXT("DESTBLTYUV"), DDCKEYCAPS_DESTBLTYUV},
- {TEXT("DESTOVERLAY"), DDCKEYCAPS_DESTOVERLAY},
- {TEXT("DESTOVERLAYCLRSPACE"), DDCKEYCAPS_DESTOVERLAYCLRSPACE},
- {TEXT("DESTOVERLAYCLRSPACEYUV"), DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV},
- {TEXT("DESTOVERLAYONEACTIVE"), DDCKEYCAPS_DESTOVERLAYONEACTIVE},
- {TEXT("DESTOVERLAYYUV"), DDCKEYCAPS_DESTOVERLAYYUV},
- {TEXT("SRCBLT"), DDCKEYCAPS_SRCBLT},
+ {TEXT("SRCBLT"), DDCKEYCAPS_SRCBLT },
{TEXT("SRCBLTCLRSPACE"), DDCKEYCAPS_SRCBLTCLRSPACE},
- {TEXT("SRCBLTCLRSPACEYUV"), DDCKEYCAPS_SRCBLTCLRSPACEYUV},
- {TEXT("SRCBLTYUV"), DDCKEYCAPS_SRCBLTYUV},
- {TEXT("SRCOVERLAY"), DDCKEYCAPS_SRCOVERLAY},
- {TEXT("SRCOVERLAYCLRSPACE"), DDCKEYCAPS_SRCOVERLAYCLRSPACE},
- {TEXT("SRCOVERLAYCLRSPACEYUV"), DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV},
- {TEXT("SRCOVERLAYONEACTIVE"), DDCKEYCAPS_SRCOVERLAYONEACTIVE},
- {TEXT("SRCOVERLAYYUV"), DDCKEYCAPS_SRCOVERLAYYUV}
+ {TEXT("SRCBLTCLRSPACEYUV"), DDCKEYCAPS_SRCBLTCLRSPACEYUV },
};
-CAPSDEFSTYPE FXCapsDefs[MAX_BOXES] =
-{
- { TEXT("BLTARITHSTRETCHY"), DDFXCAPS_BLTARITHSTRETCHY },
- { TEXT("BLTARITHSTRETCHYN"), DDFXCAPS_BLTARITHSTRETCHYN },
- { TEXT("BLTMIRRORLEFTRIGHT"), DDFXCAPS_BLTMIRRORLEFTRIGHT },
- { TEXT("BLTMIRRORUPDOWN"), DDFXCAPS_BLTMIRRORUPDOWN },
- { TEXT("BLTROTATION"), DDFXCAPS_BLTROTATION },
- { TEXT("BLTROTATION90"), DDFXCAPS_BLTROTATION90 },
- { TEXT("BLTSHRINKX"), DDFXCAPS_BLTSHRINKX },
- { TEXT("BLTSHRINKXN"), DDFXCAPS_BLTSHRINKXN },
- { TEXT("BLTSHRINKY"), DDFXCAPS_BLTSHRINKY },
- { TEXT("BLTSHRINKYN"), DDFXCAPS_BLTSHRINKYN },
- { TEXT("BLTSTRETCHX"), DDFXCAPS_BLTSTRETCHX },
- { TEXT("BLTSTRETCHXN"), DDFXCAPS_BLTSTRETCHXN },
- { TEXT("BLTSTRETCHY"), DDFXCAPS_BLTSTRETCHY },
- { TEXT("BLTSTRETCHYN"), DDFXCAPS_BLTSTRETCHYN },
- { TEXT("OVERLAYARITHSTRETCHY"), DDFXCAPS_OVERLAYARITHSTRETCHY },
- { TEXT("OVERLAYARITHSTRETCHYN"), DDFXCAPS_OVERLAYARITHSTRETCHYN },
- { TEXT("OVERLAYSHRINKX"), DDFXCAPS_OVERLAYSHRINKX },
- { TEXT("OVERLAYSHRINKXN"), DDFXCAPS_OVERLAYSHRINKXN },
- { TEXT("OVERLAYSHRINKY"), DDFXCAPS_OVERLAYSHRINKY },
- { TEXT("OVERLAYSHRINKYN"), DDFXCAPS_OVERLAYSHRINKYN },
- { TEXT("OVERLAYSTRETCHX"), DDFXCAPS_OVERLAYSTRETCHX },
- { TEXT("OVERLAYSTRETCHXN"), DDFXCAPS_OVERLAYSTRETCHXN },
- { TEXT("OVERLAYSTRETCHY"), DDFXCAPS_OVERLAYSTRETCHY },
- { TEXT("OVERLAYSTRETCHYN"), DDFXCAPS_OVERLAYSTRETCHYN },
- { TEXT("OVERLAYMIRRORLEFTRIGHT"), DDFXCAPS_OVERLAYMIRRORLEFTRIGHT },
- { TEXT("OVERLAYMIRRORUPDOWN"), DDFXCAPS_OVERLAYMIRRORUPDOWN },
-};
-
CAPSDEFSTYPE PalCapsDefs[MAX_BOXES] =
{
- {TEXT("1BIT"), DDPCAPS_1BIT},
- {TEXT("2BIT"), DDPCAPS_2BIT},
- {TEXT("4BIT"), DDPCAPS_4BIT},
- {TEXT("8BITENTRIES"), DDPCAPS_8BITENTRIES},
- {TEXT("8BIT"), DDPCAPS_8BIT},
- {TEXT("ALLOW256"), DDPCAPS_ALLOW256},
- {TEXT("INITIALIZE"), DDPCAPS_INITIALIZE},
+ {TEXT("ALPHA"), DDPCAPS_ALPHA},
{TEXT("PRIMARYSURFACE"), DDPCAPS_PRIMARYSURFACE},
- {TEXT("PRIMARYSURFACELEFT"), DDPCAPS_PRIMARYSURFACELEFT},
- {TEXT("VSYNC"), DDPCAPS_VSYNC}
-};
+ };
-CAPSDEFSTYPE SurfCapsDefs[MAX_BOXES] =
+CAPSDEFSTYPE BltCapsDefs[MAX_BOXES] =
{
- {TEXT("3DDEVICE"), DDSCAPS_3DDEVICE},
- {TEXT("ALPHA"), DDSCAPS_ALPHA},
- {TEXT("BACKBUFFER"), DDSCAPS_BACKBUFFER},
- {TEXT("COMPLEX"), DDSCAPS_COMPLEX},
- {TEXT("FLIP"), DDSCAPS_FLIP},
- {TEXT("FRONTBUFFER"), DDSCAPS_FRONTBUFFER},
- {TEXT("MIPMAP"), DDSCAPS_MIPMAP},
- {TEXT("OFFSCREENPLAIN"), DDSCAPS_OFFSCREENPLAIN},
- {TEXT("OVERLAY"), DDSCAPS_OVERLAY},
- {TEXT("PALETTE"), DDSCAPS_PALETTE},
- {TEXT("PRIMARYSURFACE"), DDSCAPS_PRIMARYSURFACE},
- {TEXT("PRIMARYSURFACELEFT"), DDSCAPS_PRIMARYSURFACELEFT},
- {TEXT("SYSTEMMEMORY"), DDSCAPS_SYSTEMMEMORY},
- {TEXT("TEXTURE"), DDSCAPS_TEXTURE},
- {TEXT("VIDEOMEMORY"), DDSCAPS_VIDEOMEMORY},
- {TEXT("VISIBLE"), DDSCAPS_VISIBLE},
- {TEXT("WRITEONLY"), DDSCAPS_WRITEONLY},
- {TEXT("ZBUFFER"), DDSCAPS_ZBUFFER}
-};
+ { TEXT("READSYSMEM"), DDBLTCAPS_READSYSMEM },
+ { TEXT("WRITESYSMEM"), DDBLTCAPS_WRITESYSMEM },
+ { TEXT("FOURCCTORGB"), DDBLTCAPS_FOURCCTORGB },
+ { TEXT("COPYFOURCC"), DDBLTCAPS_COPYFOURCC },
+ { TEXT("FILLFOURCC"), DDBLTCAPS_FILLFOURCC },
+ };
+CAPSDEFSTYPE AlphaCapsDefs[MAX_BOXES] =
+{
+ { TEXT("ALPHAPIXELS"), DDALPHACAPS_ALPHAPIXELS },
+ { TEXT("PREMULT"), DDALPHACAPS_PREMULT },
+ { TEXT("NONPREMULT"), DDALPHACAPS_NONPREMULT },
+ { TEXT("ALPHAFILL"), DDALPHACAPS_ALPHAFILL },
+ { TEXT("ALPHANEG"), DDALPHACAPS_ALPHANEG },
+ };
+CAPSDEFSTYPE OverlayCapsDefs[MAX_BOXES] =
+{
+ {TEXT("FLIP"), DDOVERLAYCAPS_FLIP},
+ {TEXT("FOURCC"), DDOVERLAYCAPS_FOURCC},
+ {TEXT("ZORDER"), DDOVERLAYCAPS_ZORDER},
+ {TEXT("MIRRORLEFTRIGHT"), DDOVERLAYCAPS_MIRRORLEFTRIGHT},
+ {TEXT("MIRRORUPDOWN"), DDOVERLAYCAPS_MIRRORUPDOWN},
+ {TEXT("CKEYSRC"), DDOVERLAYCAPS_CKEYSRC},
+ {TEXT("CKEYSRCCLRSPACE"), DDOVERLAYCAPS_CKEYSRCCLRSPACE},
+ {TEXT("CKEYSRCCLRSPACEYUV"), DDOVERLAYCAPS_CKEYSRCCLRSPACEYUV},
+ {TEXT("CKEYDEST"), DDOVERLAYCAPS_CKEYDEST},
+ {TEXT("CKEYDESTCLRSPACE"), DDOVERLAYCAPS_CKEYDESTCLRSPACE},
+ {TEXT("CKEYDESTCLRSPACEYUV"), DDOVERLAYCAPS_CKEYDESTCLRSPACEYUV},
+ {TEXT("CKEYBOTH"), DDOVERLAYCAPS_CKEYBOTH},
+ {TEXT("ALPHADEST"), DDOVERLAYCAPS_ALPHADEST},
+ {TEXT("ALPHASRC"), DDOVERLAYCAPS_ALPHASRC},
+ {TEXT("ALPHADESTNEG"), DDOVERLAYCAPS_ALPHADESTNEG},
+ {TEXT("ALPHASRCNEG"), DDOVERLAYCAPS_ALPHASRCNEG},
+ {TEXT("ALPHACONSTANT"), DDOVERLAYCAPS_ALPHACONSTANT},
+ {TEXT("ALPHAPREMULT"), DDOVERLAYCAPS_ALPHAPREMULT},
+ {TEXT("ALPHANONPREMULT"), DDOVERLAYCAPS_ALPHANONPREMULT},
+ {TEXT("ALPHAANDKEYDEST"), DDOVERLAYCAPS_ALPHAANDKEYDEST},
+ {TEXT("OVERLAYSUPPORT"), DDOVERLAYCAPS_OVERLAYSUPPORT},
+ };
+ CAPSDEFSTYPE MiscCapsDefs[MAX_BOXES] =
+{
+ {TEXT("READSCANLINE"), DDMISCCAPS_READSCANLINE},
+ {TEXT("READMONITORFREQ"), DDMISCCAPS_READMONITORFREQ},
+ {TEXT("READVBLANKSTATUS"), DDMISCCAPS_READVBLANKSTATUS},
+ {TEXT("FLIPINTERVAL"), DDMISCCAPS_FLIPINTERVAL},
+ {TEXT("FLIPODDEVEN"), DDMISCCAPS_FLIPODDEVEN},
+ {TEXT("FLIPVSYNCWITHVBI"), DDMISCCAPS_FLIPVSYNCWITHVBI},
+ {TEXT("COLORCONTROLOVERLAY"), DDMISCCAPS_COLORCONTROLOVERLAY},
+ {TEXT("COLORCONTROLPRIMARY"), DDMISCCAPS_COLORCONTROLPRIMARY},
+ {TEXT("GAMMACONTROLOVERLAY"), DDMISCCAPS_GAMMACONTROLOVERLAY},
+ {TEXT("GAMMACONTROLPRIMARY"), DDMISCCAPS_GAMMACONTROLPRIMARY}
+ };
+
+
//*------------------------------------------------------------------------
//| Dlg_OnCommand
//*------------------------------------------------------------------------
@@ -254,14 +206,16 @@
int i;
TCHAR szTitle[256];
static TCHAR *rgszCaps[] = {
- TEXT("Direct Draw Caps Bits"),
TEXT("Direct Draw Color Key Caps Bits"),
- TEXT("Direct Draw FX Caps Bits"),
TEXT("Direct Draw Palette Caps Bits"),
- TEXT("Direct Draw Surface Caps Bits")};
+ TEXT("Direct Draw Blt Caps Bits"),
+ TEXT("Direct Draw Alpha Caps Bits"),
+ TEXT("Direct Draw Overlay Caps Bits"),
+ TEXT("Direct Draw Misc Caps Bits")
+ };
- wsprintf(szTitle, TEXT("%s (%s)"), rgszCaps[Which%5],
- (Which < 5) ? TEXT("HAL") : TEXT("HEL"));
+ wsprintf(szTitle, TEXT("%s (%s)"), rgszCaps[Which%6],
+ (Which < 6) ? TEXT("HAL") : TEXT("HEL"));
SetWindowText(hwnd, szTitle);
ShowWindow(GetDlgItem(hwnd, IDC_RESTORE), SW_HIDE);
@@ -285,11 +239,8 @@
return TRUE;
}
-//*------------------------------------------------------------------------
-//| ddCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-ddCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+CKeyCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
@@ -306,11 +257,8 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| CKeyCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-CKeyCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+PalCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
@@ -327,15 +275,12 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| SurfCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-SurfCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+BltCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 4;
+ Which = 2;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -348,15 +293,12 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| FXCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-FXCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+AlphaCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 2;
+ Which = 3;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -370,15 +312,12 @@
}
-//*------------------------------------------------------------------------
-//| PalCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-PalCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+OverlayCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 3;
+ Which = 4;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -391,12 +330,8 @@
return (fProcessed);
}
-
-//*------------------------------------------------------------------------
-//| HELddCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-HELddCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+MiscCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
@@ -413,9 +348,7 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| HELCKeyCapsDlg_Proc
-//*------------------------------------------------------------------------
+
BOOL CALLBACK
HELCKeyCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -434,15 +367,12 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| HELSurfCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-HELSurfCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+HELPalCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 9;
+ Which = 7;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -455,15 +385,12 @@
return (fProcessed);
}
-//*------------------------------------------------------------------------
-//| HELFXCapsDlg_Proc
-//*------------------------------------------------------------------------
BOOL CALLBACK
-HELFXCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+HELBltCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 7;
+ Which = 8;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -476,16 +403,31 @@
return (fProcessed);
}
+BOOL CALLBACK
+HELAlphaCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ BOOL fProcessed = TRUE;
-//*------------------------------------------------------------------------
-//| HELPalCapsDlg_Proc
-//*------------------------------------------------------------------------
+ Which = 9;
+ switch (uMsg)
+ {
+ HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
+ HANDLE_MSG(hDlg, WM_COMMAND, Dlg_OnCommand);
+
+ default:
+ fProcessed = FALSE;
+ break;
+ }
+ return (fProcessed);
+}
+
+
BOOL CALLBACK
-HELPalCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+HELOverlayCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL fProcessed = TRUE;
- Which = 8;
+ Which = 10;
switch (uMsg)
{
HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
@@ -498,7 +440,24 @@
return (fProcessed);
}
+BOOL CALLBACK
+HELMiscCapsDlg_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ BOOL fProcessed = TRUE;
+ Which = 11;
+ switch (uMsg)
+ {
+ HANDLE_MSG(hDlg, WM_INITDIALOG, Dlg_OnInitDialog);
+ HANDLE_MSG(hDlg, WM_COMMAND, Dlg_OnCommand);
+
+ default:
+ fProcessed = FALSE;
+ break;
+ }
+ return (fProcessed);
+}
+
//*------------------------------------------------------------------------
//| DDEnumCallback
//*------------------------------------------------------------------------
@@ -539,7 +498,7 @@
//*------------------------------------------------------------------------
static int gCurMode = 0;
-DWORD DDAPI
+DWORD CALLBACK
EnumModesCallback(LPDDSURFACEDESC pddsd, LPVOID context)
{
Modes[ModeCnt].dwWidth = pddsd->dwWidth;
@@ -568,6 +527,8 @@
//| nCmdShow - Integer value specifying how to start app.,
//| (Iconic [7] or Normal [1,5])
//*------------------------------------------------------------------------
+typedef HRESULT (WINAPI * LPDIRECTDRAWENUMERATEEX)(LPDDENUMCALLBACKEX lpCallback, LPVOID lpContext, DWORD dwFlags);
+
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@@ -586,22 +547,22 @@
// You need to do a GetModuleHandle and GetProcAddress in order to get the
// DirectDrawEnumerateEx
- hDDrawDLL = GetModuleHandle(TEXT("DDRAW"));
+ hDDrawDLL = LoadLibrary(TEXT("DDRAW.dll"));
if (!hDDrawDLL)
{
OutputDebugString(TEXT("LoadLibrary() failed - ddcaps: Can't list display modes"));
return (-1);
}
pDirectDrawEnumerateEx = (LPDIRECTDRAWENUMERATEEX )
- GetProcAddress(hDDrawDLL,TEXT("DirectDrawEnumerateExW"));
+ GetProcAddress(hDDrawDLL,TEXT("DirectDrawEnumerateEx"));
if (pDirectDrawEnumerateEx)
pDirectDrawEnumerateEx( DDEnumCallbackEx, (LPVOID) NULL,
DDENUM_ATTACHEDSECONDARYDEVICES |
- DDENUM_DETACHEDSECONDARYDEVICES |
- DDENUM_NONDISPLAYDEVICES);
+ DDENUM_DETACHEDSECONDARYDEVICES
+ );
else // Old DirectDraw, so do it the old way
- DirectDrawEnumerate(DDEnumCallback, NULL);
+ MessageBox(NULL,TEXT("EnumerateEx Call Fail"),TEXT("Error"),MB_OK);
ddrval = DirectDrawCreate(gpSelectedDriverGUID, &lpDD, NULL);
if (ddrval != DD_OK)
@@ -635,35 +596,41 @@
lpDD->lpVtbl->GetCaps(lpDD, &ddcapsHAL, &ddcapsHEL);
- gCaps[0].caps = &(ddcapsHAL.dwCaps);
- gCaps[0].defs = ddCapsDefs;
+ gCaps[0].caps = &(ddcapsHAL.dwCKeyCaps);
+ gCaps[0].defs = CKeyCapsDefs;
- gCaps[1].caps = &(ddcapsHAL.dwCKeyCaps);
- gCaps[1].defs = CKeyCapsDefs;
+ gCaps[1].caps = &(ddcapsHAL.dwPalCaps);
+ gCaps[1].defs = PalCapsDefs;
- gCaps[2].caps = &(ddcapsHAL.dwFXCaps);
- gCaps[2].defs = FXCapsDefs;
+ gCaps[2].caps = &(ddcapsHAL.dwBltCaps);
+ gCaps[2].defs = BltCapsDefs;
- gCaps[3].caps = &(ddcapsHAL.dwPalCaps);
- gCaps[3].defs = PalCapsDefs;
+ gCaps[3].caps = &(ddcapsHAL.dwAlphaCaps);
+ gCaps[3].defs = AlphaCapsDefs;
- gCaps[4].caps = &(ddcapsHAL.ddsCaps.dwCaps);
- gCaps[4].defs = SurfCapsDefs;
+ gCaps[4].caps = &(ddcapsHAL.dwOverlayCaps);
+ gCaps[4].defs = OverlayCapsDefs;
- gCaps[5].caps = &(ddcapsHEL.dwCaps);
- gCaps[5].defs = ddCapsDefs;
+ gCaps[5].caps = &(ddcapsHAL.dwMiscCaps);
+ gCaps[5].defs = MiscCapsDefs;
gCaps[6].caps = &(ddcapsHEL.dwCKeyCaps);
gCaps[6].defs = CKeyCapsDefs;
- gCaps[7].caps = &(ddcapsHEL.dwFXCaps);
- gCaps[7].defs = FXCapsDefs;
+ gCaps[7].caps = &(ddcapsHEL.dwPalCaps);
+ gCaps[7].defs = PalCapsDefs;
- gCaps[8].caps = &(ddcapsHEL.dwPalCaps);
- gCaps[8].defs = PalCapsDefs;
+ gCaps[8].caps = &(ddcapsHEL.dwBltCaps);
+ gCaps[8].defs = BltCapsDefs;
- gCaps[9].caps = &(ddcapsHEL.ddsCaps.dwCaps);
- gCaps[9].defs = SurfCapsDefs;
+ gCaps[9].caps = &(ddcapsHEL.dwAlphaCaps);
+ gCaps[9].defs = AlphaCapsDefs;
+
+ gCaps[10].caps = &(ddcapsHEL.dwOverlayCaps);
+ gCaps[10].defs = OverlayCapsDefs;
+
+ gCaps[11].caps = &(ddcapsHEL.dwMiscCaps);
+ gCaps[11].defs = MiscCapsDefs;
}
@@ -794,56 +761,63 @@
DialogBox(ghInstance, TEXT("About"), hWnd, (DLGPROC)AboutDlgProc);
break;
- case ID_VIEW_DRIVERCAPS:
- CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, ddCapsDlg_Proc);
- break;
-
+
case ID_VIEW_DRIVERCOLORKEYCAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
NULL, CKeyCapsDlg_Proc);
break;
- case ID_VIEW_DRIVERFXCAPS:
+ case ID_VIEW_DRIVERPALETTECAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, FXCapsDlg_Proc);
+ NULL, PalCapsDlg_Proc);
break;
- case ID_VIEW_DRIVERPALETTECAPS:
+ case ID_VIEW_DRIVERBLTCAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, PalCapsDlg_Proc);
+ NULL, BltCapsDlg_Proc);
break;
- case ID_VIEW_DRIVERSURFACECAPS:
+ case ID_VIEW_DRIVERALPHACAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, SurfCapsDlg_Proc);
+ NULL, AlphaCapsDlg_Proc);
break;
- case ID_VIEW_HELCAPS:
+ case ID_VIEW_DRIVEROVERLAYCAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, HELddCapsDlg_Proc);
+ NULL, OverlayCapsDlg_Proc);
break;
+
+ case ID_VIEW_DRIVERMISCCAPS:
+ CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
+ NULL, OverlayCapsDlg_Proc);
+ break;
+//----------------
case ID_VIEW_HELCOLORKEYCAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
NULL, HELCKeyCapsDlg_Proc);
break;
- case ID_VIEW_HELFXCAPS:
- CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, HELFXCapsDlg_Proc);
- break;
-
case ID_VIEW_HELPALETTECAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
NULL, HELPalCapsDlg_Proc);
break;
-
- case ID_VIEW_HELSURFACECAPS:
+ case ID_VIEW_HELBLTCAPS:
CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
- NULL, HELSurfCapsDlg_Proc);
+ NULL, HELBltCapsDlg_Proc);
break;
-
+ case ID_VIEW_HELALPHACAPS:
+ CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
+ NULL, HELAlphaCapsDlg_Proc);
+ break;
+ case ID_VIEW_HELOVERLAYCAPS:
+ CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
+ NULL, HELOverlayCapsDlg_Proc);
+ break;
+ case ID_VIEW_HELMISCCAPS:
+ CreateDialog(ghInstance, MAKEINTRESOURCE(IDD_DIALOG1),
+ NULL, HELMiscCapsDlg_Proc);
+ break;
case ID_PRINTF_LISTBOX:
if (HIWORD(wParam) == LBN_DBLCLK)
{
@@ -852,18 +826,18 @@
if (sel < (UINT)ModeCnt)
{
ddrval = lpDD->lpVtbl->SetCooperativeLevel(lpDD,
- hWnd,
- DDSCL_EXCLUSIVE |
- DDSCL_NOWINDOWCHANGES |
+ hWnd,
+ DDSCL_NORMAL |
DDSCL_FULLSCREEN);
if (ddrval == DD_OK)
{
ddrval = lpDD->lpVtbl->SetDisplayMode(lpDD,
- Modes[sel].dwWidth,
- Modes[sel].dwHeight,
- Modes[sel].dwBPP);
+ Modes[sel].dwWidth,
+ Modes[sel].dwHeight,
+ Modes[sel].dwBPP,0,0);
ddrval = lpDD->lpVtbl->SetCooperativeLevel(lpDD,
- hWnd, DDSCL_NORMAL);
+ hWnd,
+ DDSCL_NORMAL);
}
}
}
Index: ddcaps.rc
===================================================================
--- ddcaps.rc (revision 23142)
+++ ddcaps.rc (working copy)
@@ -66,19 +66,21 @@
END
POPUP "&Driver"
BEGIN
- MENUITEM "Driver &Caps", ID_VIEW_DRIVERCAPS
MENUITEM "Driver C&olor Key Caps", ID_VIEW_DRIVERCOLORKEYCAPS
- MENUITEM "Driver &FX Caps", ID_VIEW_DRIVERFXCAPS
MENUITEM "Driver &Palette Caps", ID_VIEW_DRIVERPALETTECAPS
- MENUITEM "Driver &Surface Caps", ID_VIEW_DRIVERSURFACECAPS
+ MENUITEM "Driver &Blt Caps", ID_VIEW_DRIVERBLTCAPS
+ MENUITEM "Driver &Alpha Caps", ID_VIEW_DRIVERALPHACAPS
+ MENUITEM "Driver &Overlay Caps", ID_VIEW_DRIVEROVERLAYCAPS
+ MENUITEM "Driver &Misc Caps", ID_VIEW_DRIVERMISCCAPS
END
POPUP "&HEL"
BEGIN
- MENUITEM "HEL &Caps", ID_VIEW_HELCAPS
MENUITEM "HEL C&olor Key Caps", ID_VIEW_HELCOLORKEYCAPS
- MENUITEM "HEL &FX Caps", ID_VIEW_HELFXCAPS
MENUITEM "HEL &Palette Caps", ID_VIEW_HELPALETTECAPS
- MENUITEM "HEL &Surface Caps", ID_VIEW_HELSURFACECAPS
+ MENUITEM "HEL &Blt Caps", ID_VIEW_HELBLTCAPS
+ MENUITEM "HEL &Alpha Caps", ID_VIEW_HELALPHACAPS
+ MENUITEM "HEL &Overlay Caps", ID_VIEW_HELOVERLAYCAPS
+ MENUITEM "HEL &Misc Caps", ID_VIEW_HELMISCCAPS
END
END
@@ -228,7 +230,7 @@
BEGIN
DEFPUSHBUTTON "&OK",IDOK,132,58,50,14
LTEXT "DirectDraw Caps Viewer for Windows CE",-1,15,14,165,8
- LTEXT "Copyright ?1995-2003 Microsoft Corporation",-1,15,28,
+ LTEXT "Copyright ?1995-2003 Microsoft Corporation",-1,15,28,
165,8
LTEXT "Version",-1,15,42,24,8
LTEXT "1.0",-1,40,42,66,8
Index: lbprintf.c
===================================================================
--- lbprintf.c (revision 23142)
+++ lbprintf.c (working copy)
@@ -49,102 +49,8 @@
//
// Error string table
//
-static ERRLIST elErrors[] =
-{
- { DD_OK ,TEXT("DD_OK") },
- { DDERR_ALREADYINITIALIZED ,TEXT("DDERR_ALREADYINITIALIZED")},
- { DDERR_CANNOTATTACHSURFACE ,TEXT("DDERR_CANNOTATTACHSURFACE")},
- { DDERR_CANNOTDETACHSURFACE ,TEXT("DDERR_CANNOTDETACHSURFACE")},
- { DDERR_CURRENTLYNOTAVAIL ,TEXT("DDERR_CURRENTLYNOTAVAIL")},
- { DDERR_EXCEPTION ,TEXT("DDERR_EXCEPTION")},
- { DDERR_GENERIC ,TEXT("DDERR_GENERIC")},
- { DDERR_HEIGHTALIGN ,TEXT("DDERR_HEIGHTALIGN")},
- { DDERR_INCOMPATIBLEPRIMARY ,TEXT("DDERR_INCOMPATIBLEPRIMARY")},
- { DDERR_INVALIDCAPS ,TEXT("DDERR_INVALIDCAPS")},
- { DDERR_INVALIDCLIPLIST ,TEXT("DDERR_INVALIDCLIPLIST")},
- { DDERR_INVALIDMODE ,TEXT("DDERR_INVALIDMODE")},
- { DDERR_INVALIDOBJECT ,TEXT("DDERR_INVALIDOBJECT")},
- { DDERR_INVALIDPARAMS ,TEXT("DDERR_INVALIDPARAMS")},
- { DDERR_INVALIDPIXELFORMAT ,TEXT("DDERR_INVALIDPIXELFORMAT")},
- { DDERR_INVALIDRECT ,TEXT("DDERR_INVALIDRECT")},
- { DDERR_LOCKEDSURFACES ,TEXT("DDERR_LOCKEDSURFACES")},
- { DDERR_NO3D ,TEXT("DDERR_NO3D")},
- { DDERR_NOALPHAHW ,TEXT("DDERR_NOALPHAHW")},
- { DDERR_NOCLIPLIST ,TEXT("DDERR_NOCLIPLIST")},
- { DDERR_NOCOLORCONVHW ,TEXT("DDERR_NOCOLORCONVHW")},
- { DDERR_NOCOOPERATIVELEVELSET ,TEXT("DDERR_NOCOOPERATIVELEVELSET")},
- { DDERR_NOCOLORKEY ,TEXT("DDERR_NOCOLORKEY")},
- { DDERR_NOCOLORKEYHW ,TEXT("DDERR_NOCOLORKEYHW")},
- { DDERR_NOEXCLUSIVEMODE ,TEXT("DDERR_NOEXCLUSIVEMODE")},
- { DDERR_NOFLIPHW ,TEXT("DDERR_NOFLIPHW")},
- { DDERR_NOGDI ,TEXT("DDERR_NOGDI")},
- { DDERR_NOMIRRORHW ,TEXT("DDERR_NOMIRRORHW")},
- { DDERR_NOTFOUND ,TEXT("DDERR_NOTFOUND")},
- { DDERR_NOOVERLAYHW ,TEXT("DDERR_NOOVERLAYHW")},
- { DDERR_NORASTEROPHW ,TEXT("DDERR_NORASTEROPHW")},
- { DDERR_NOROTATIONHW ,TEXT("DDERR_NOROTATIONHW")},
- { DDERR_NOSTRETCHHW ,TEXT("DDERR_NOSTRETCHHW")},
- { DDERR_NOT4BITCOLOR ,TEXT("DDERR_NOT4BITCOLOR")},
- { DDERR_NOT4BITCOLORINDEX ,TEXT("DDERR_NOT4BITCOLORINDEX")},
- { DDERR_NOT8BITCOLOR ,TEXT("DDERR_NOT8BITCOLOR")},
- { DDERR_NOTEXTUREHW ,TEXT("DDERR_NOTEXTUREHW")},
- { DDERR_NOVSYNCHW ,TEXT("DDERR_NOVSYNCHW")},
- { DDERR_NOZBUFFERHW ,TEXT("DDERR_NOZBUFFERHW")},
- { DDERR_NOZOVERLAYHW ,TEXT("DDERR_NOZOVERLAYHW")},
- { DDERR_OUTOFCAPS ,TEXT("DDERR_OUTOFCAPS")},
- { DDERR_OUTOFMEMORY ,TEXT("DDERR_OUTOFMEMORY")},
- { DDERR_OUTOFVIDEOMEMORY ,TEXT("DDERR_OUTOFVIDEOMEMORY")},
- { DDERR_OVERLAYCANTCLIP ,TEXT("DDERR_OVERLAYCANTCLIP")},
- { DDERR_OVERLAYCOLORKEYONLYONEACTIVE,TEXT("DDERR_OVERLAYCOLORKEYONLYONEACTIVE")},
- { DDERR_PALETTEBUSY ,TEXT("DDERR_PALETTEBUSY")},
- { DDERR_COLORKEYNOTSET ,TEXT("DDERR_COLORKEYNOTSET")},
- { DDERR_SURFACEALREADYATTACHED ,TEXT("DDERR_SURFACEALREADYATTACHED")},
- { DDERR_SURFACEALREADYDEPENDENT ,TEXT("DDERR_SURFACEALREADYDEPENDENT")},
- { DDERR_SURFACEBUSY ,TEXT("DDERR_SURFACEBUSY")},
- { DDERR_SURFACEISOBSCURED ,TEXT("DDERR_SURFACEISOBSCURED")},
- { DDERR_SURFACELOST ,TEXT("DDERR_SURFACELOST")},
- { DDERR_SURFACENOTATTACHED ,TEXT("DDERR_SURFACENOTATTACHED")},
- { DDERR_TOOBIGHEIGHT ,TEXT("DDERR_TOOBIGHEIGHT")},
- { DDERR_TOOBIGSIZE ,TEXT("DDERR_TOOBIGSIZE")},
- { DDERR_TOOBIGWIDTH ,TEXT("DDERR_TOOBIGWIDTH")},
- { DDERR_UNSUPPORTED ,TEXT("DDERR_UNSUPPORTED")},
- { DDERR_UNSUPPORTEDFORMAT ,TEXT("DDERR_UNSUPPORTEDFORMAT")},
- { DDERR_UNSUPPORTEDMASK ,TEXT("DDERR_UNSUPPORTEDMASK")},
- { DDERR_VERTICALBLANKINPROGRESS ,TEXT("DDERR_VERTICALBLANKINPROGRESS")},
- { DDERR_WASSTILLDRAWING ,TEXT("DDERR_WASSTILLDRAWING")},
- { DDERR_XALIGN ,TEXT("DDERR_XALIGN")},
- { DDERR_INVALIDDIRECTDRAWGUID ,TEXT("DDERR_INVALIDDIRECTDRAWGUID")},
- { DDERR_DIRECTDRAWALREADYCREATED ,TEXT("DDERR_DIRECTDRAWALREADYCREATED")},
- { DDERR_NODIRECTDRAWHW ,TEXT("DDERR_NODIRECTDRAWHW")},
- { DDERR_PRIMARYSURFACEALREADYEXISTS ,TEXT("DDERR_PRIMARYSURFACEALREADYEXISTS")},
- { DDERR_NOEMULATION ,TEXT("DDERR_NOEMULATION")},
- { DDERR_REGIONTOOSMALL ,TEXT("DDERR_REGIONTOOSMALL")},
- { DDERR_CLIPPERISUSINGHWND ,TEXT("DDERR_CLIPERISUSINGHWND")},
- { DDERR_NOCLIPPERATTACHED ,TEXT("DDERR_NOCLIPPERATTACHED")},
- { DDERR_NOHWND ,TEXT("DDERR_NOHWND")},
- { DDERR_HWNDSUBCLASSED ,TEXT("DDERR_HWNDSUBCLASSED")},
- { DDERR_HWNDALREADYSET ,TEXT("DDERR_HWNDALREADYSET")},
- { DDERR_NOPALETTEATTACHED ,TEXT("DDERR_NOPALETTEATTACHED")},
- { DDERR_NOPALETTEHW ,TEXT("DDERR_NOPALETTEHW")},
- { DDERR_BLTFASTCANTCLIP ,TEXT("DDERR_BLTFASTCANTCLIP")},
- { DDERR_NOBLTHW ,TEXT("DDERR_NOBLTHW")},
- { DDERR_NODDROPSHW ,TEXT("DDERR_NODDROPSHW")},
- { DDERR_OVERLAYNOTVISIBLE ,TEXT("DDERR_OVERLAYNOTVISIBLE")},
- { DDERR_NOOVERLAYDEST ,TEXT("DDERR_NOOVERLAYDEST")},
- { DDERR_INVALIDPOSITION ,TEXT("DDERR_INVALIDPOSITION")},
- { DDERR_NOTAOVERLAYSURFACE ,TEXT("DDERR_NOTAOVERLAYSURFACE")},
- { DDERR_EXCLUSIVEMODEALREADYSET ,TEXT("DDERR_EXCLUSIVEMODEALREADYSET")},
- { DDERR_NOTFLIPPABLE ,TEXT("DDERR_NOTFLIPPABLE")},
- { DDERR_CANTDUPLICATE ,TEXT("DDERR_CANTDUPLICATE")},
- { DDERR_NOTLOCKED ,TEXT("DDERR_NOTLOCKED")},
- { DDERR_CANTCREATEDC ,TEXT("DDERR_CANTCREATEDC")},
- { DDERR_NODC ,TEXT("DDERR_NODC")},
- { DDERR_WRONGMODE ,TEXT("DDERR_WRONGMODE")},
- { DDERR_IMPLICITLYCREATED ,TEXT("DDERR_IMPLICITLYCREATED")},
-};
-
HWND LBCreate( HWND hWnd, HINSTANCE hInst, DWORD pos, BOOL debug )
{
hWndListBox = CreateWindow(
@@ -198,28 +104,3 @@
}
-static LPTSTR getErrorString( HRESULT ddrval )
-{
- int i;
-
- for( i=0;i<sizeof( elErrors )/sizeof( elErrors[0] );i++ )
- {
- if( ddrval == elErrors[i].rval )
- {
- return elErrors[i].str;
- }
- }
-
- return TEXT("Unknown Error Code");
-}
-
-
-void __cdecl LBPrintfRC( HRESULT ddrval, LPTSTR fmt, ... )
-{
- TCHAR buff[512];
-
- wvsprintf( buff, fmt, (LPVOID)(&fmt+1) );
-
- LBPrintf( TEXT("%s, rc=%ld (0x%08lx:%s)"), buff, LOWORD( ddrval ),
- ddrval, getErrorString( ddrval ) );
-}
Index: resource.h
===================================================================
--- resource.h (revision 23142)
+++ resource.h (working copy)
@@ -70,16 +70,19 @@
#define IDC_COMBO_DRIVERS 1035
#define ID_FILE_RESTORE 40001
#define ID_FILE_EXIT 40002
-#define ID_VIEW_DRIVERCAPS 40003
-#define ID_VIEW_DRIVERCOLORKEYCAPS 40004
-#define ID_VIEW_DRIVERFXCAPS 40005
-#define ID_VIEW_DRIVERPALETTECAPS 40006
-#define ID_VIEW_DRIVERSURFACECAPS 40007
-#define ID_VIEW_HELCAPS 40008
+#define ID_VIEW_DRIVERCOLORKEYCAPS 40003
+#define ID_VIEW_DRIVERPALETTECAPS 40004
+#define ID_VIEW_DRIVERBLTCAPS 40005
+#define ID_VIEW_DRIVERALPHACAPS 40006
+#define ID_VIEW_DRIVEROVERLAYCAPS 40007
+#define ID_VIEW_DRIVERMISCCAPS 40008
#define ID_VIEW_HELCOLORKEYCAPS 40009
-#define ID_VIEW_HELFXCAPS 40010
-#define ID_VIEW_HELPALETTECAPS 40011
-#define ID_VIEW_HELSURFACECAPS 40012
+#define ID_VIEW_HELPALETTECAPS 40010
+#define ID_VIEW_HELBLTCAPS 40011
+#define ID_VIEW_HELALPHACAPS 40012
+#define ID_VIEW_HELOVERLAYCAPS 40013
+#define ID_VIEW_HELMISCCAPS 40014
+
#define IDC_STATIC -1
// Next default values for new objects
source 所在位置是 C:\WINCE600\PUBLIC\DIRECTX\SDK\SAMPLES\DXMISC\DDCAPS
build ddcaps 的 command 是:
sysgen -p directx ddcaps
因為 ddcaps 是在 public 下的 directx 目錄,所以 -p 後面要寫 directx ,意思是(path = directx)。
project name 就是 ddcaps.
DirectDraw Capability in CE 6.0
要知道系統哪些 DirectDraw Function 是 hardware support,哪些是用 software emulate,
可以用 IDirectDraw::GetCaps 來取得 ddraw capability 列表:
傳進去的兩個 argument 都是用來取出 capability 的 structure pointer,結構完全一樣,一個是 hardware support list,一個是 software emulation list
每個 DWORD的每個 bit 都代表一個 function,宣告在 ddraw.h (C:\WINCE600\PUBLIC\COMMON\SDK\INC\ddraw.h)
platform builder public folder 附有一個 DDCAPS 的 sample program,可以列出 platform ddraw hardware/software support .
很悲慘的是,ddcaps structure 在 CE 6.0 大幅修改,所以DDCAPS sample code 在 6.0 不能 build 了!!
看這一篇: DirectDraw Migration.
我做了修改: Modify DDCAPS for CE 6.0
可以用 IDirectDraw::GetCaps 來取得 ddraw capability 列表:
HRESULT GetCaps(
LPDDCAPS lpDDDriverCaps,
LPDDCAPS lpDDEmulCaps
);
傳進去的兩個 argument 都是用來取出 capability 的 structure pointer,結構完全一樣,一個是 hardware support list,一個是 software emulation list
- lpDDDriverCaps : hardware
- lpDDEmulCaps : software
typedef struct _DDCAPS {
DWORD dwSize;
DWORD dwCKeyCaps;
DWORD dwPalCaps;
DWORD dwBltCaps;
DWORD dwAlphaCaps;
DWORD dwOverlayCaps;
DWORD dwVidMemTotal;
DWORD dwVidMemFree;
DWORD dwVidMemStride;
DWORD dwMaxVisibleOverlays;
DWORD dwCurrVisibleOverlays;
DWORD dwNumFourCCCodes;
DWORD dwAlignBoundarySrc;
DWORD dwAlignSizeSrc;
DWORD dwAlignBoundaryDest;
DWORD dwAlignSizeDest;
DWORD dwRops[DD_ROP_SPACE];
DWORD dwMinOverlayStretch;
DWORD dwMaxOverlayStretch;
DWORD dwMiscCaps;
} DDCAPS,FAR *LPDDCAPS;
每個 DWORD的每個 bit 都代表一個 function,宣告在 ddraw.h (C:\WINCE600\PUBLIC\COMMON\SDK\INC\ddraw.h)
platform builder public folder 附有一個 DDCAPS 的 sample program,可以列出 platform ddraw hardware/software support .
很悲慘的是,ddcaps structure 在 CE 6.0 大幅修改,所以DDCAPS sample code 在 6.0 不能 build 了!!
看這一篇: DirectDraw Migration.
我做了修改: Modify DDCAPS for CE 6.0
8.11.2010
CListBox : ListBox control in WTL
WTL 也包裝了一些 common control,例如 ListBox,名稱叫 CListBox, 在 atlctrls.h.
像 前面的 example : http://realchecko.blogspot.com/2010/05/win32-listbox-control.html
改用 WTL 來寫,就是:
可以看到,大概是用 Attach( GetDlgItem(IDC_LIST1)) 把 WTL class: CListBox 和 ListBox control 建立關係。
相關的說明: http://www.cchsu.com/arthur/prg_bg5/wtl3.htm
像 前面的 example : http://realchecko.blogspot.com/2010/05/win32-listbox-control.html
改用 WTL 來寫,就是:
#pragma once
#define WINVER 0x0600
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlctrls.h>
#include "resource.h"
class CMainDialog : public CDialogImpl<CMainDialog>
{
public:
enum {IDD = IDD_DIALOG1 };
int addi;
CListBox list;
BEGIN_MSG_MAP(CMainDialog)
MESSAGE_HANDLER(WM_INITDIALOG,OnInitDialog)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
COMMAND_ID_HANDLER(IDC_BTNADD,OnBtnAdd)
END_MSG_MAP()
LRESULT OnInitDialog(UINT,WPARAM,LPARAM,BOOL&)
{
addi=0;
RETAILMSG(1,(TEXT("OnInitDialog\r\n")));
list.Attach(GetDlgItem(IDC_LIST1));
return TRUE;
}
LRESULT OnCancel(WORD,WORD wID,HWND,BOOL&)
{
::PostQuitMessage(wID);
return 0;
}
LRESULT OnBtnAdd(WORD,WORD wID,HWND,BOOL& hHandled)
{
TCHAR outmsg[10];
swprintf(outmsg,_T("%d"),addi++);
list.AddString(outmsg);
int cnt = list.GetCount();
if(cnt>30)
list.DeleteString(0);
cnt = list.GetCount();
if(cnt>=14)
list.SetTopIndex(cnt-14);
RETAILMSG(1,(TEXT("Button Add\r\n")));
return TRUE;
}
};
CAppModule _Module;
int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE,LPTSTR lpstrCmdLine,int nCmdShow)
{
HRESULT hRes = ::CoInitializeEx(NULL,COINIT_MULTITHREADED);
::DefWindowProc(NULL,0,0,0L);
AtlInitCommonControls(NULL);
hRes = _Module.Init(NULL,hInstance);
CMainDialog dlgMain;
hRes = dlgMain.DoModal();
::CoUninitialize();
return hRes;
}
可以看到,大概是用 Attach( GetDlgItem(IDC_LIST1)) 把 WTL class: CListBox 和 ListBox control 建立關係。
相關的說明: http://www.cchsu.com/arthur/prg_bg5/wtl3.htm
8.10.2010
Build Assembly code in VS2005
這是參考 tcpmp 的 project 檔。
大概也跟 eVC 一樣,就是為 assembly.asm 加上 custom build command.
大概也跟 eVC 一樣,就是為 assembly.asm 加上 custom build command.
- 先把 assembly code 的 source file 寫好
- 開啟 VS2005,把 assembly file 加到 source folder 中
- 在 assembly file 按右鍵,選 properties
- Custom Build Step -- General --Command Line,, 寫
armasm.exe -cpu xscale "$(InputPath)" "$(IntDir)/$(InputName).obj"
- Output 寫
$(IntDir)/$(InputName).obj
8.09.2010
CpuId - 紀錄一下
因為 CE 6.0 沒有辦法 SetKMode,所以只好... 寫一個 driver,然後 load 進去..,
這就是 copy 自 tcpmp getcpuid 的 code 後,run 起來:
4117B362:ref(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html)
所以是 ARM1136, rev2
410FB764: ref (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html)
所以是 ARM1176 , rev 4
第二個,cache type register
ref : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211k/I67616.html
1D152152 : 16K, 4 way, len=32 bytes.
1D992992: 32K, 4 way, len=32 bytes.
driver code
GETID.C:
arm.s
ref (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html) CpuID 取的是 opcode2 = 0 和 1 : cpu id 跟 cache type.
GETID.DEF
sources
load driver 的程式就是以前哪個 activedriverex( ). 改一下 dll name 就可以
ref http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211k/I67616.html
用
c0, Core feature ID registers
好像可以得到更多 cpu feature
這就是 copy 自 tcpmp getcpuid 的 code 後,run 起來:
- 我們的: 4117B362,1D152152,0,0
- 測試的: 410FB764,1D992992,0,0
4117B362:ref(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html)
所以是 ARM1136, rev2
410FB764: ref (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html)
所以是 ARM1176 , rev 4
第二個,cache type register
ref : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211k/I67616.html
- [31:29] : always 0
- [28:25] : ctype - cache type b1110 means "write back","register 7 operation","format C"
- [24] : separate D and I cache
- [23:12] : D cache size
- [11:0] : I cache size
- [11] : P
- [10:9] : always 0
- [8:6] : size
- [5:3] : association (way)
- [2] : M
- [1:0] Length
1D152152 : 16K, 4 way, len=32 bytes.
1D992992: 32K, 4 way, len=32 bytes.
driver code
GETID.C:
#include <windows.h>
#include <drvlib.h>
//----- Code Control -----
#define GID_DEBUG
#ifdef DEBUG
DBGPARAM dpCurSettings = { TEXT("Getid"), {
TEXT("Verbose"), TEXT(""), TEXT(""), TEXT(""),
TEXT(""), TEXT(""), TEXT(""), TEXT(""),
TEXT(""), TEXT(""), TEXT(""), TEXT(""),
TEXT(""), TEXT(""), TEXT(""), TEXT("")},
0x00000000
};
#endif
extern void GetCpuId(int,DWORD*);
void SafeGetCpuId(int Id, DWORD* p)
{
memset(p,0,4*sizeof(DWORD));
GetCpuId(Id,p);
}
//--- GID_Init
DWORD GID_Init(DWORD dwContext)
{
DWORD CpuId[4];
DWORD dwErr;
TCHAR outmsg[60];
RETAILMSG(1, (TEXT("[GID] GID_Init+\r\n")));
SafeGetCpuId(0,CpuId);
RETAILMSG(1,(TEXT("%X,%X,%X,%X\r\n"),CpuId[0],CpuId[1],CpuId[2],CpuId[3]));
swprintf(outmsg,TEXT("%X,%X,%X,%X"),CpuId[0],CpuId[1],CpuId[2],CpuId[3]);
MessageBox(NULL,outmsg,TEXT("GID"),MB_OK);
RETAILMSG(1, (TEXT("[GID] GID_Init OK \r\n")));
return TRUE;
}
//--- GID_Deinit
BOOL GID_Deinit(DWORD dwContext)
{
RETAILMSG(1, (TEXT("[GID] GID_Deinit+\r\n")));
return TRUE;
}
//--- GID_Open
DWORD GID_Open(DWORD dwData, DWORD dwAccess, DWORD dwShareMode)
{
RETAILMSG(1, (TEXT("[GID] GID_Open+\r\n")));
return dwData;
}
//--- GID_Close
BOOL GID_Close(DWORD Handle)
{
RETAILMSG(1, (TEXT("[GID] GID_Close+\r\n")));
return TRUE;
}
//--- GID_Read
DWORD GID_Read(DWORD Handle, LPVOID pBuffer, DWORD dwNumBytes)
{
RETAILMSG(1, (TEXT("[GID] GID_Read+\r\n")));
return 0;
}
//--- GID_Write
DWORD GID_Write(DWORD Handle, LPCVOID pBuffer, DWORD dwNumBytes)
{
RETAILMSG(1, (TEXT("[GID] GID_Write+\r\n")));
return 0;
}
//--- GID_Seek
DWORD GID_Seek(DWORD Handle, long lDistance, DWORD dwMoveMethod)
{
RETAILMSG(1, (TEXT("[GID] GID_Seek+\r\n")));
return (DWORD) -1;
}
//--- GID_IOControl
BOOL GID_IOControl(
DWORD Handle,
DWORD dwCode,
PBYTE pBufIn,
DWORD dwLenIn,
PBYTE pBufOut,
DWORD dwLenOut,
PDWORD pdwActualOut
)
{
RETAILMSG(1, (TEXT("[GID] GID_IOControl+\r\n")));
return (FALSE);
}
BOOL
GID_DllEntry(
HINSTANCE hinstDll, /*@parm Instance pointer. */
DWORD dwReason, /*@parm Reason routine is called. */
LPVOID lpReserved /*@parm system parameter. */
)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls((HMODULE) hinstDll);
}
return (TRUE);
}
arm.s
INCLUDE kxarm.h
EXPORT GetCpuId
TEXTAREA
LEAF_ENTRY GetCpuId
export GetCpuId
mrs r0,cpsr
and r0,r0,#15
cmp r0,#15
bne UserMode
mrc p15,0,r0,c0,c0,0
nop
nop
mrc p15,0,r2,c0,c0,1
nop
nop
str r0,[r1,#0]
str r2,[r1,#4]
UserMode
mov pc,lr
ref (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CACEDHJG.html) CpuID 取的是 opcode2 = 0 和 1 : cpu id 跟 cache type.
GETID.DEF
LIBRARY getid
EXPORTS
GID_Init
GID_Deinit
GID_Open
GID_Close
GID_Read
GID_Write
GID_IOControl
sources
TARGETNAME=getid
TARGETTYPE=DYNLINK
RELEASETYPE=PLATFORM
DLLENTRY=GID_DllEntry
DEFFILE=$(_TARGETPLATROOT)\SRC\DRIVERS\getid\getid.def
PREPROCESSDEFFILE=1
SYNCHRONIZE_DRAIN=1
WINCEREL=1
TARGETLIBS= \
$(_COMMONSDKROOT)\LIB\$(_CPUINDPATH)\coredll.lib \
SOURCELIBS= \
SOURCES= \
getid.c \
arm.s
load driver 的程式就是以前哪個 activedriverex( ). 改一下 dll name 就可以
ref http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211k/I67616.html
用
c0, Core feature ID registers
好像可以得到更多 cpu feature
8.07.2010
to replace t3
t3
- 500萬 1/2.4" CCD
- 3x optical zoom
- 38 - 114 mm
- F3.5 - F4.4
- 640 x 480, 30 fps m jpg
- 2.5" lcd
- 1,220 萬 1/2.33 英寸 CCD
- 4倍變焦 28-112mm
- F2.7-5.8
- 640 x 480@30fps mjpeg
- 2.7" lcd
- VR 光學防震
- 1400 萬像素
- 4X 26 mm 至 105 mm
- 2.6 (wide) – 5.9 (tele)
- 640 x 480 @ 30/15 fps mjpeg
- 2.7" lcd
- 1,200萬
- 38mm~114mm
- F3.5(W)~F5.0(T)
- 640 x 480 @ 30/15 fps mjpeg
- 2.7" lcd
- CCD移動式手震校正
8.05.2010
pipeline bubble
利用 assembly 來optimize speed 時,要注意,並不是 instruction line 短就夠了。
還要注意 pipline 的特性。
pipeline 將指令分成幾個 stage:
這樣,就白白浪費 2 個 clock 了。
為了避免這樣的情況,寫 assembly 的時候,就可以在中間插入下面要作的 assembly code,不要白白浪費這兩個clock
在 (很久)前面的文章:yuv - rgb color space convert 的 assembly code 可以看到。最後一個作者的assembly code 就有做到這個(所以整個 code 的 flow 變得不好trace)。實測的結果,也是最快的。
在 Wiki 里也有說明:
還要注意 pipline 的特性。
pipeline 將指令分成幾個 stage:
- fetch,
- decode/register read,
- alu,
- memory write,
- register update.
ldr r0,#1
add r3,r0,r1
第二行指令在 decode/register read 時,r0 還沒update,因為上一行才執行到alu operation。所以在pipeline中的第二行指令就要停下來,等兩個clock,等上一行指令執行到register update後,才可以繼續。這樣,就白白浪費 2 個 clock 了。
為了避免這樣的情況,寫 assembly 的時候,就可以在中間插入下面要作的 assembly code,不要白白浪費這兩個clock
在 (很久)前面的文章:yuv - rgb color space convert 的 assembly code 可以看到。最後一個作者的assembly code 就有做到這個(所以整個 code 的 flow 變得不好trace)。實測的結果,也是最快的。
在 Wiki 里也有說明:
- instruction scheduling
- Instruction scheduling is an important optimization for modern pipelined processors, which avoids stalls or bubbles in the pipeline by clustering instructions with no dependencies together, while being careful to preserve the original semantics.
8.04.2010
OEM 自訂 cache mode --- CE 6.0
這一篇 ( http://support.microsoft.com/kb/977855/ ) 超新的... An update that enables the Windows Embedded CE 6.0 kernel to support different cache mode bits is available
是 Microsoft as Windows Embedded CE 6.0 Platform Builder Monthly Update (June 2010). 才支援。
就是在 5.0 以前都有 support 的 OEMARMCacheMode( ) 回報 .
是 Microsoft as Windows Embedded CE 6.0 Platform Builder Monthly Update (June 2010). 才支援。
就是在 5.0 以前都有 support 的 OEMARMCacheMode( ) 回報 .
cache
cache 是一小塊和cpu時脈一樣的記憶體,作為 cpu 與 主記憶體間的 buffer。
當 cpu 要讀取 memory 時, cache 先把 memory 的資料讀進 cache 中,然後再讓 cpu 讀取。
cpu 每次讀取的單位是 int (32bit),但是 cache 為求效能,會一次讀入比 int 還多的資料。
cache 每次讀入的資料大小叫 line size,每次讀入的資料放入 一個 line。
cache 就是利用這樣預先讀取的能力,讓cpu 下次需要讀取記憶體時,可以直接由 cache 拿,不需要再向 主記憶體 讀取。
由於 cache 只有小小一塊,所以必須要有一個機制知道 cpu 需要存取記憶體時,那個 address的內容是不是已經在cache 里,如果在,是在 cache 的那一條 line ...
最直覺的方法就是去找每一個 cache line 的 address,看看那一個 line 所以 cache 的 記憶體位址是不是 cpu 現在要的。
這樣個 cache 叫 associative cache.
但是這樣作很耗空間(電路),因為每一個 line 都要作一個 address比較電路。
所以就有比較便宜的作法.. 把 把 address 分成兩部份:
tag, index
以 32 bit 的 address line 為例,可以分成:
後來又有折衷的辦法,就是...每個 index 可以有兩個 tag欄位和lines,這樣,每20 條位址線,就可以共用兩條 cache line。 -- 這就叫 2 way cache.
=>這樣就是:拿 index 找到對應的 2 個 tag ,比較和 address bit 31-20 一步一樣。
一此類推,可以有 4 way cache。
這一篇 (http://www.mirabilisdesign.com/Pages/Demonstrations/systemarchitecture/Cache_System/Functional_Cache_Model_Overview.html)雖然是 sim software 的說明,但是可以看到 ARM11 cache 的 impelement 圖例
cache line size 是 16 words (address 0~3), index size 是 4096 (address 4~15), tag filed 是 address 16~31,
所以 cache index size x byte size x way = cache size
當 cpu 要讀取 memory 時, cache 先把 memory 的資料讀進 cache 中,然後再讓 cpu 讀取。
cpu 每次讀取的單位是 int (32bit),但是 cache 為求效能,會一次讀入比 int 還多的資料。
cache 每次讀入的資料大小叫 line size,每次讀入的資料放入 一個 line。
cache 就是利用這樣預先讀取的能力,讓cpu 下次需要讀取記憶體時,可以直接由 cache 拿,不需要再向 主記憶體 讀取。
由於 cache 只有小小一塊,所以必須要有一個機制知道 cpu 需要存取記憶體時,那個 address的內容是不是已經在cache 里,如果在,是在 cache 的那一條 line ...
最直覺的方法就是去找每一個 cache line 的 address,看看那一個 line 所以 cache 的 記憶體位址是不是 cpu 現在要的。
這樣個 cache 叫 associative cache.
但是這樣作很耗空間(電路),因為每一個 line 都要作一個 address比較電路。
所以就有比較便宜的作法.. 把 把 address 分成兩部份:
tag, index
以 32 bit 的 address line 為例,可以分成:
- tag : 31~20
- index : 19~0
後來又有折衷的辦法,就是...每個 index 可以有兩個 tag欄位和lines,這樣,每20 條位址線,就可以共用兩條 cache line。 -- 這就叫 2 way cache.
=>這樣就是:拿 index 找到對應的 2 個 tag ,比較和 address bit 31-20 一步一樣。
一此類推,可以有 4 way cache。
這一篇 (http://www.mirabilisdesign.com/Pages/Demonstrations/systemarchitecture/Cache_System/Functional_Cache_Model_Overview.html)雖然是 sim software 的說明,但是可以看到 ARM11 cache 的 impelement 圖例
cache line size 是 16 words (address 0~3), index size 是 4096 (address 4~15), tag filed 是 address 16~31,
所以 cache index size x byte size x way = cache size
訂閱:
文章 (Atom)