--- np2/win9x/scrnmng.cpp 2005/02/07 14:46:14 1.19 +++ np2/win9x/scrnmng.cpp 2006/12/24 00:52:29 1.22 @@ -9,13 +9,15 @@ #include "mousemng.h" #include "scrnmng.h" #include "sysmng.h" -#include "dclock.h" #include "menu.h" #include "np2class.h" #include "pccore.h" #include "scrndraw.h" #include "palettes.h" +#if defined(SUPPORT_DCLOCK) +#include "dclock.h" +#endif extern WINLOCEX np2_winlocexallwin(HWND base); @@ -25,7 +27,9 @@ typedef struct { LPDIRECTDRAW2 ddraw2; LPDIRECTDRAWSURFACE primsurf; LPDIRECTDRAWSURFACE backsurf; +#if defined(SUPPORT_DCLOCK) LPDIRECTDRAWSURFACE clocksurf; +#endif LPDIRECTDRAWCLIPPER clipper; LPDIRECTDRAWPALETTE palette; UINT scrnmode; @@ -256,7 +260,9 @@ static void clearoutfullscreen(void) { base.right = ddraw.width; // (+ ddraw.extend) base.bottom = ddraw.height; clearoutofrect(&ddraw.scrn, &base); +#if defined(SUPPORT_DCLOCK) dclock_redraw(); +#endif } static void paletteinit(void) { @@ -267,12 +273,14 @@ static void paletteinit(void) { hdc = GetDC(hWndMain); GetSystemPaletteEntries(hdc, 0, 256, ddraw.pal); ReleaseDC(hWndMain, hdc); +#if defined(SUPPORT_DCLOCK) for (i=0; i<4; i++) { ddraw.pal[i+START_PALORG].peBlue = dclockpal.pal32[i].p.b; ddraw.pal[i+START_PALORG].peRed = dclockpal.pal32[i].p.r; ddraw.pal[i+START_PALORG].peGreen = dclockpal.pal32[i].p.g; ddraw.pal[i+START_PALORG].peFlags = PC_RESERVED | PC_NOCOLLAPSE; } +#endif for (i=0; iSetCooperativeLevel(hWndMain, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); height = (np2oscfg.force400)?400:480; + bitcolor = np2oscfg.fscrnbpp; + if (bitcolor == 0) { #if !defined(SUPPORT_PC9821) - bitcolor = (scrnmode & SCRNMODE_HIGHCOLOR)?16:8; + bitcolor = (scrnmode & SCRNMODE_HIGHCOLOR)?16:8; #else - bitcolor = 16; + bitcolor = 16; #endif + } if (ddraw2->SetDisplayMode(640, height, bitcolor, 0, 0) != DD_OK) { goto scre_err; } @@ -428,21 +441,28 @@ BOOL scrnmng_create(UINT8 scrnmode) { } if (bitcolor == 8) { paletteinit(); - dclock_init8(); } - else { + else if (bitcolor == 16) { make16mask(ddpf.dwBBitMask, ddpf.dwRBitMask, ddpf.dwGBitMask); - dclock_init16(); } - + else if (bitcolor == 24) { + } + else if (bitcolor == 32) { + } + else { + goto scre_err; + } +#if defined(SUPPORT_DCLOCK) + dclock_palset(bitcolor); ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = DCLOCK_X; - ddsd.dwHeight = DCLOCK_Y; + ddsd.dwWidth = DCLOCK_WIDTH; + ddsd.dwHeight = DCLOCK_HEIGHT; ddraw2->CreateSurface(&ddsd, &ddraw.clocksurf, NULL); dclock_reset(); +#endif } else { ddraw2->SetCooperativeLevel(hWndMain, DDSCL_NORMAL); @@ -484,11 +504,7 @@ BOOL scrnmng_create(UINT8 scrnmode) { } bitcolor = ddpf.dwRGBBitCount; if (bitcolor == 8) { -#if !defined(SUPPORT_PC9821) paletteinit(); -#else - goto scre_err; -#endif } else if (bitcolor == 16) { make16mask(ddpf.dwBBitMask, ddpf.dwRBitMask, ddpf.dwGBitMask); @@ -522,10 +538,12 @@ void scrnmng_destroy(void) { if (scrnmng.flag & SCRNFLAG_FULLSCREEN) { np2class_enablemenu(hWndMain, (!np2oscfg.wintype)); } +#if defined(SUPPORT_DCLOCK) if (ddraw.clocksurf) { ddraw.clocksurf->Release(); ddraw.clocksurf = NULL; } +#endif if (ddraw.backsurf) { ddraw.backsurf->Release(); ddraw.backsurf = NULL; @@ -752,14 +770,18 @@ void scrnmng_setmultiple(int multiple) { } } -static const RECT rectclk = {0, 0, DCLOCK_X, DCLOCK_Y}; + +// ---- + +#if defined(SUPPORT_DCLOCK) +static const RECT rectclk = {0, 0, DCLOCK_WIDTH, DCLOCK_HEIGHT}; void scrnmng_dispclock(void) { DDSURFACEDESC dest; // ver0.26 if ((ddraw.clocksurf) && - (ddraw.scrn.top >= DCLOCK_Y) && (dclock_disp())) { + (ddraw.scrn.top >= DCLOCK_HEIGHT) && (dclock_disp())) { dclock_make(); ZeroMemory(&dest, sizeof(dest)); dest.dwSize = sizeof(dest); @@ -767,13 +789,19 @@ void scrnmng_dispclock(void) { if (scrnmng.bpp == 8) { dclock_out8(dest.lpSurface, dest.lPitch); } - else { + else if (scrnmng.bpp == 16) { dclock_out16(dest.lpSurface, dest.lPitch); } + else if (scrnmng.bpp == 24) { + dclock_out24(dest.lpSurface, dest.lPitch); + } + else if (scrnmng.bpp == 32) { + dclock_out32(dest.lpSurface, dest.lPitch); + } ddraw.clocksurf->Unlock(NULL); } - if (ddraw.primsurf->BltFast(640 - DCLOCK_X - 4, - ddraw.height - DCLOCK_Y, + if (ddraw.primsurf->BltFast(640 - DCLOCK_WIDTH - 4, + ddraw.height - DCLOCK_HEIGHT, ddraw.clocksurf, (RECT *)&rectclk, DDBLTFAST_WAIT) == DDERR_SURFACELOST) { ddraw.primsurf->Restore(); @@ -782,6 +810,7 @@ void scrnmng_dispclock(void) { dclock_cntdown(np2oscfg.DRAW_SKIP); } } +#endif // ----