diff --git a/LEGO1/mxdirectx/mxdirectdraw.cpp b/LEGO1/mxdirectx/mxdirectdraw.cpp index 104b6836..bedf4d2e 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.cpp +++ b/LEGO1/mxdirectx/mxdirectdraw.cpp @@ -32,8 +32,6 @@ MxDirectDraw::MxDirectDraw() m_pPalette = NULL; m_pDirectDraw = NULL; m_bIsOnPrimaryDevice = TRUE; - m_pText1Surface = NULL; - m_pText2Surface = NULL; m_hWndMain = NULL; m_bIgnoreWMSIZE = FALSE; m_bPrimaryPalettized = FALSE; @@ -236,8 +234,6 @@ void MxDirectDraw::DestroyButNotDirectDraw() RELEASE(m_pPalette); RELEASE(m_pClipper); - RELEASE(m_pText1Surface); - RELEASE(m_pText2Surface); RELEASE(m_pZBuffer); RELEASE(m_pBackBuffer); RELEASE(m_pFrontBuffer); @@ -409,13 +405,6 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp) } } - // create debug text only in windowed mode? - if (!m_bFullScreen) { - if (!CreateTextSurfaces()) { - return FALSE; - } - } - return TRUE; } @@ -565,133 +554,6 @@ void MxDirectDraw::ClearBackBuffers() } } -// FUNCTION: LEGO1 0x1009e110 -// FUNCTION: BETA10 0x101219de -BOOL MxDirectDraw::TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface) -{ - HRESULT result; - HDC hdc; - RECT rc; - size_t textLength; - - if (!pSurface) { - return FALSE; - } - - result = pSurface->GetDC(&hdc); - if (result != DD_OK) { - Error("GetDC for text surface failed", result); - return FALSE; - } - - textLength = strlen(text); - - SelectObject(hdc, m_hFont); - SetTextColor(hdc, RGB(255, 255, 0)); - SetBkColor(hdc, RGB(0, 0, 0)); - SetBkMode(hdc, OPAQUE); - GetTextExtentPoint32(hdc, text, textLength, &textSizeOnSurface); - SetRect(&rc, 0, 0, textSizeOnSurface.cx, textSizeOnSurface.cy); - ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rc, text, textLength, NULL); - pSurface->ReleaseDC(hdc); - - return TRUE; -} - -// FUNCTION: LEGO1 0x1009e210 -// FUNCTION: BETA10 0x10121aea -BOOL MxDirectDraw::TextToTextSurface1(const char* text) -{ - return TextToTextSurface(text, m_pText1Surface, m_text1SizeOnSurface); -} - -// FUNCTION: LEGO1 0x1009e230 -// FUNCTION: BETA10 0x10121b1e -BOOL MxDirectDraw::TextToTextSurface2(const char* text) -{ - return TextToTextSurface(text, m_pText2Surface, m_text2SizeOnSurface); -} - -// FUNCTION: LEGO1 0x1009e250 -// FUNCTION: BETA10 0x10121b52 -BOOL MxDirectDraw::CreateTextSurfaces() -{ - HRESULT result; - DDCOLORKEY ddck; - DDSURFACEDESC ddsd; - HDC hdc; - char dummyinfo[] = "000x000x00 (RAMP) 0000"; - char dummyfps[] = "000.00 fps (000.00 fps (000.00 fps) 00000 tps)"; - - if (m_hFont != NULL) { - DeleteObject(m_hFont); - } - m_hFont = CreateFont( - m_currentMode.width <= 600 ? 12 : 24, - 0, - 0, - 0, - FW_NORMAL, - FALSE, - FALSE, - FALSE, - ANSI_CHARSET, - OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, - VARIABLE_PITCH, - "Arial" - ); - - hdc = GetDC(NULL); - SelectObject(hdc, m_hFont); - GetTextExtentPoint(hdc, dummyfps, strlen(dummyfps), &m_text1SizeOnSurface); - GetTextExtentPoint(hdc, dummyinfo, strlen(dummyinfo), &m_text2SizeOnSurface); - ReleaseDC(NULL, hdc); - - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - if (m_bOnlySystemMemory) { - ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - } - ddsd.dwHeight = m_text1SizeOnSurface.cy; - ddsd.dwWidth = m_text1SizeOnSurface.cx; - result = CreateDDSurface(&ddsd, &m_pText1Surface, NULL); - if (result != DD_OK) { - Error("CreateSurface for text surface 1 failed", result); - return FALSE; - } - memset(&ddck, 0, sizeof(ddck)); - m_pText1Surface->SetColorKey(DDCKEY_SRCBLT, &ddck); - if (!TextToTextSurface1(dummyfps)) { - return FALSE; - } - - memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - if (m_bOnlySystemMemory) { - ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; - } - ddsd.dwHeight = m_text2SizeOnSurface.cy; - ddsd.dwWidth = m_text2SizeOnSurface.cx; - result = CreateDDSurface(&ddsd, &m_pText2Surface, NULL); - if (result != DD_OK) { - Error("CreateSurface for text surface 2 failed", result); - return FALSE; - } - memset(&ddck, 0, sizeof(ddck)); - m_pText2Surface->SetColorKey(DDCKEY_SRCBLT, &ddck); - if (!TextToTextSurface2(dummyinfo)) { - return FALSE; - } - - return TRUE; -} - // FUNCTION: LEGO1 0x1009e4d0 // FUNCTION: BETA10 0x10121e87 BOOL MxDirectDraw::RestoreSurfaces() @@ -728,26 +590,6 @@ BOOL MxDirectDraw::RestoreSurfaces() } } - if (m_pText1Surface != NULL) { - if (m_pText1Surface->IsLost() == DDERR_SURFACELOST) { - result = m_pText1Surface->Restore(); - if (result != DD_OK) { - Error("Restore of text surface 1 failed", result); - return FALSE; - } - } - } - - if (m_pText2Surface != NULL) { - if (m_pText2Surface->IsLost() == DDERR_SURFACELOST) { - result = m_pText2Surface->Restore(); - if (result != DD_OK) { - Error("Restore of text surface 2 failed", result); - return FALSE; - } - } - } - return TRUE; } diff --git a/LEGO1/mxdirectx/mxdirectdraw.h b/LEGO1/mxdirectx/mxdirectdraw.h index 574f8e54..554de189 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.h +++ b/LEGO1/mxdirectx/mxdirectdraw.h @@ -58,9 +58,6 @@ public: int Pause(BOOL); BOOL RestoreSurfaces(); - BOOL TextToTextSurface1(const char* text); - BOOL TextToTextSurface2(const char* lpString); - virtual const char* ErrorToString(HRESULT p_error); // vtable+0x10 int FlipToGDISurface(); @@ -77,9 +74,6 @@ protected: BOOL GetDDSurfaceDesc(LPDDSURFACEDESC lpDDSurfDesc, LPDIRECTDRAWSURFACE lpDDSurf); BOOL CreateZBuffer(DDSCapsFlags memorytype, DWORD depth); - BOOL CreateTextSurfaces(); - BOOL TextToTextSurface(const char* text, IDirectDrawSurface* pSurface, SIZE& textSizeOnSurface); - void Error(const char* p_message, int p_error); BOOL RecreateDirectDraw(GUID** a2); @@ -97,8 +91,6 @@ protected: IDirectDrawSurface* m_pFrontBuffer; // 0x10 IDirectDrawSurface* m_pBackBuffer; // 0x14 IDirectDrawSurface* m_pZBuffer; // 0x18 - IDirectDrawSurface* m_pText1Surface; // 0x1c - IDirectDrawSurface* m_pText2Surface; // 0x20 IDirectDrawClipper* m_pClipper; // 0x24 IDirectDrawPalette* m_pPalette; // 0x28 PALETTEENTRY m_paletteEntries[256]; // 0x2c diff --git a/miniwin/include/miniwin/windows.h b/miniwin/include/miniwin/windows.h index 83726998..46bfd43c 100644 --- a/miniwin/include/miniwin/windows.h +++ b/miniwin/include/miniwin/windows.h @@ -169,37 +169,6 @@ int WINAPI GetDeviceCaps(HDC hdc, int index); BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned int flags); -int SetBkColor(void*, int); - -int SetBkMode(void*, int); - -int SetTextColor(HDC hdc, int color); - -BOOL GetTextExtentPoint(HDC hdc, LPCSTR lpString, int c, SIZE* psizl); - -int ExtTextOut(HDC, int, int, unsigned int, const RECT*, LPCSTR, unsigned int, void*); - -HFONT CreateFont( - int, - int, - int, - int, - int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - LPCSTR -); - -void* SelectObject(HDC, HFONT); - -int GetTextExtentPoint32(HDC hdc, LPCSTR str, int len, SIZE* out); - HMENU GetMenu(HWND hWnd); int DrawMenuBar(void* hWnd); diff --git a/miniwin/src/d3drm/d3drmdevice.cpp b/miniwin/src/d3drm/d3drmdevice.cpp index 822f412e..40dd1137 100644 --- a/miniwin/src/d3drm/d3drmdevice.cpp +++ b/miniwin/src/d3drm/d3drmdevice.cpp @@ -116,7 +116,6 @@ D3DRMRENDERMODE Direct3DRMDevice2Impl::GetRenderMode() HRESULT Direct3DRMDevice2Impl::Update() { - MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } diff --git a/miniwin/src/windows/windows.cpp b/miniwin/src/windows/windows.cpp index 5e174b8a..0e8b53ed 100644 --- a/miniwin/src/windows/windows.cpp +++ b/miniwin/src/windows/windows.cpp @@ -83,72 +83,6 @@ BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned return 1; } -int SetBkColor(void*, int) -{ - MINIWIN_NOT_IMPLEMENTED(); - return 0; -} - -int SetBkMode(void*, int) -{ - MINIWIN_NOT_IMPLEMENTED(); - return 0; -} - -int SetTextColor(HDC hdc, int color) -{ - MINIWIN_NOT_IMPLEMENTED(); - return color; -} - -BOOL GetTextExtentPoint(HDC hdc, LPCSTR lpString, int c, SIZE* psizl) -{ - MINIWIN_NOT_IMPLEMENTED(); - if (psizl) { - psizl->cx = 8 * c; - psizl->cy = 16; - } - return TRUE; -} - -int ExtTextOut(HDC, int, int, unsigned int, const RECT*, LPCSTR, unsigned int, void*) -{ - MINIWIN_NOT_IMPLEMENTED(); - return 1; -} - -HFONT CreateFont( - int, - int, - int, - int, - int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - unsigned int, - LPCSTR -) -{ - MINIWIN_NOT_IMPLEMENTED(); - return nullptr; -} - -void* SelectObject(HDC, HFONT) -{ - MINIWIN_NOT_IMPLEMENTED(); - return nullptr; -} - -int GetTextExtentPoint32(HDC hdc, LPCSTR str, int len, SIZE* out) -{ - return GetTextExtentPoint(hdc, str, len, out); -} - HMENU GetMenu(HWND hWnd) { return NULL;