Merge remote-tracking branch 'upstream/master'

This commit is contained in:
olebeck 2025-07-02 17:07:54 +02:00
commit 875b52dac6
6 changed files with 1 additions and 275 deletions

View File

@ -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;
}

View File

@ -58,9 +58,6 @@ class MxDirectDraw {
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 @@ class MxDirectDraw {
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 @@ class MxDirectDraw {
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

View File

@ -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);

View File

@ -130,8 +130,7 @@ void GL11_BeginFrame(const Matrix4x4* projection)
for (int i = 0; i < 8; ++i) {
glDisable(GL_LIGHT0 + i);
}
const GLfloat zeroAmbient[4] = {0.f, 0.f, 0.f, 1.f};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, zeroAmbient);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
// Projection and view
@ -145,7 +144,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l)
{
// Setup light
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
GLenum lightId = GL_LIGHT0 + lightIdx++;
const FColor& c = l->color;
@ -188,8 +186,6 @@ void GL11_UploadLight(int lightIdx, GL11_BridgeSceneLight* l)
glLightfv(lightId, GL_POSITION, pos);
}
glEnable(lightId);
glPopMatrix();
}
void GL11_EnableTransparency()
@ -273,8 +269,6 @@ void GL11_SubmitDraw(
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(mesh.indices.size()), GL_UNSIGNED_SHORT, mesh.indices.data());
}
glPopMatrix();
}
void GL11_Resize(int width, int height)
@ -304,13 +298,11 @@ void GL11_Draw2DImage(
glDepthMask(GL_FALSE);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(left, right, bottom, top, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glDisable(GL_LIGHTING);
@ -344,9 +336,7 @@ void GL11_Draw2DImage(
// Restore state
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}
void GL11_Download(SDL_Surface* target)

View File

@ -116,7 +116,6 @@ D3DRMRENDERMODE Direct3DRMDevice2Impl::GetRenderMode()
HRESULT Direct3DRMDevice2Impl::Update()
{
MINIWIN_NOT_IMPLEMENTED();
return DD_OK;
}

View File

@ -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;