diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fa96739..fbe485f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,6 +199,7 @@ add_library(minimfc STATIC EXCLUDE_FROM_ALL miniwin/minimfc/src/minimfc.cpp ) target_include_directories(minimfc PUBLIC "$") +target_include_directories(minimfc PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/miniwin/miniwin/src/include") target_compile_definitions(minimfc PUBLIC "MINIMFC") target_link_libraries(minimfc PRIVATE SDL3::SDL3 miniwin) diff --git a/miniwin/minimfc/include/minimfc.h b/miniwin/minimfc/include/minimfc.h index 5df522a3..8856ebb4 100644 --- a/miniwin/minimfc/include/minimfc.h +++ b/miniwin/minimfc/include/minimfc.h @@ -81,8 +81,8 @@ typedef struct IUnknown* LPUNKNOWN; struct CWnd { HWND m_hWnd; - void EnableWindow(bool bEnable) {} - void SetWindowText(const char* text) {} + void EnableWindow(bool bEnable); + void SetWindowText(const char* text); }; struct CDataExchange { @@ -93,22 +93,22 @@ struct CDialog { HWND m_hWnd; int m_nIDTemplate; CWnd* m_pParentWnd; - CDialog() : m_nIDTemplate(0), m_pParentWnd(nullptr) {} - CDialog(int nIDTemplate) : m_nIDTemplate(nIDTemplate), m_pParentWnd(nullptr) {} - CDialog(int nIDTemplate, CWnd* pParent) : m_nIDTemplate(nIDTemplate), m_pParentWnd(pParent) {} - virtual BOOL OnInitDialog() { return TRUE; } - void OnCancel() {} - virtual void OnOK() {} - virtual void DoModal() {} - virtual void Default() {} - virtual void EndDialog(int nResult) {} - virtual void DoDataExchange(CDataExchange* pDX) {} + CDialog(); + CDialog(int nIDTemplate); + CDialog(int nIDTemplate, CWnd* pParent); + virtual BOOL OnInitDialog(); + void OnCancel(); + virtual void OnOK(); + virtual void DoModal(); + virtual void Default(); + virtual void EndDialog(int nResult); + virtual void DoDataExchange(CDataExchange* pDX); }; struct CPaintDC { void* m_hDC; - CPaintDC(CDialog* hWnd) {} - void Draw() {} + CPaintDC(CDialog* hWnd); + void Draw(); }; struct CMenu { @@ -120,10 +120,10 @@ struct CMenu { pMenu->m_hMenu = hMenu; return pMenu; } - bool InsertMenu(UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem) { return true; } - bool RemoveMenu(UINT uPosition, UINT uFlags) { return true; } - bool SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition = false) { return true; } - int GetMenuItemCount() const { return 0; } + bool InsertMenu(UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem); + bool RemoveMenu(UINT uPosition, UINT uFlags); + bool SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition = false); + int GetMenuItemCount() const; }; struct CWinApp { @@ -251,92 +251,42 @@ inline LSTATUS RegCreateKeyEx( void OutputDebugString(const char* lpOutputString); -inline void* GetProcAddress(HMODULE module, const char* name) -{ - return 0; -} +void* GetProcAddress(HMODULE module, const char* name); int miniwin_stricmp(const char* str1, const char* str2); #define _stricmp miniwin_stricmp -inline HICON LoadIcon(HINSTANCE hInstance, LPCSTR lpIconName) -{ - return 0; -} +HICON LoadIcon(HINSTANCE hInstance, LPCSTR lpIconName); -inline int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2) -{ - return 0; -} +int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2); -inline HINSTANCE AfxFindResourceHandle(LPCTSTR lpszResourceName, int lpszResourceType) -{ - return 0; -} +HINSTANCE AfxFindResourceHandle(LPCTSTR lpszResourceName, int lpszResourceType); -inline HMODULE LoadLibrary(const char* name) -{ - return 0; -} +HMODULE LoadLibrary(const char* name); -inline int FreeLibrary(void* hModule) -{ - return 0; -} +int FreeLibrary(void* hModule); -inline HMENU GetSystemMenu(HWND hWnd, bool bRevert) -{ - assert(false && "Needs implementation"); - return reinterpret_cast(0x1234); -} +HMENU GetSystemMenu(HWND hWnd, bool bRevert); -inline HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName) -{ - return 0; -} +HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName); -inline LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam) -{ - return 0; -} +LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam); -inline LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - return 0; -} +LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam); -inline BOOL IsDlgButtonChecked(int nIDButton) -{ - return 0; -} +BOOL IsDlgButtonChecked(int nIDButton); -inline CWnd* GetDlgItem(int id) -{ - return new CWnd(); -} +CWnd* GetDlgItem(int id); -inline BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam) -{ - return TRUE; -} +BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam); -inline BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton) -{ - return TRUE; -} +BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton); -inline BOOL CheckDlgButton(int nIDButton, BOOL uCheck) -{ - return TRUE; -} +BOOL CheckDlgButton(int nIDButton, BOOL uCheck); -inline void Enable3dControls() -{ -} +void Enable3dControls(); -inline void ParseCommandLine(CCommandLineInfo& cmdInfo) -{ -} +void ParseCommandLine(CCommandLineInfo& cmdInfo); struct AFX_MODULE_STATE { CWinApp* m_pCurrentWinApp; diff --git a/miniwin/minimfc/src/minimfc.cpp b/miniwin/minimfc/src/minimfc.cpp index 967c0b68..d291c91f 100644 --- a/miniwin/minimfc/src/minimfc.cpp +++ b/miniwin/minimfc/src/minimfc.cpp @@ -1,6 +1,7 @@ #include "minimfc.h" #include "miniwin.h" +#include "miniwin_p.h" #include #include @@ -14,6 +15,100 @@ CWinApp* wndTop; SDL_Window* window; const char* title = "Configure LEGO Island"; +void CWnd::EnableWindow(bool bEnable) +{ + MINIWIN_NOT_IMPLEMENTED(); +} +void CWnd::SetWindowText(const char* text) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +CDialog::CDialog() : m_nIDTemplate(0), m_pParentWnd(nullptr) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +CDialog::CDialog(int nIDTemplate) : m_nIDTemplate(nIDTemplate), m_pParentWnd(nullptr) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +CDialog::CDialog(int nIDTemplate, CWnd* pParent) : m_nIDTemplate(nIDTemplate), m_pParentWnd(pParent) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +BOOL CDialog::OnInitDialog() +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +void CDialog::OnCancel() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void CDialog::OnOK() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void CDialog::DoModal() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void CDialog::Default() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void CDialog::EndDialog(int nResult) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void CDialog::DoDataExchange(CDataExchange* pDX) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +CPaintDC::CPaintDC(CDialog* hWnd) +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +bool CMenu::InsertMenu(UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem) +{ + MINIWIN_NOT_IMPLEMENTED(); + return true; +} + +bool CMenu::RemoveMenu(UINT uPosition, UINT uFlags) +{ + MINIWIN_NOT_IMPLEMENTED(); + return true; +} + +bool CMenu::SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition) +{ + MINIWIN_NOT_IMPLEMENTED(); + return true; +} + +int CMenu::GetMenuItemCount() const +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +void CPaintDC::Draw() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + CWinApp::CWinApp() { if (wndTop != NULL) { @@ -97,11 +192,7 @@ BOOL GetWindowRect(HWND hWnd, RECT* Rect) return FALSE; } if (hWnd == NULL) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unregistered HWND %p", hWnd); - Rect->left = 0; - Rect->top = 0; - Rect->right = 640; - Rect->bottom = 480; + MINIWIN_NOT_IMPLEMENTED(); return FALSE; } SDL_GetWindowPosition(hWnd, &x, &y); @@ -129,6 +220,12 @@ void OutputDebugString(const char* lpOutputString) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "%s", lpOutputString); } +void* GetProcAddress(HMODULE module, const char* name) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + int miniwin_stricmp(const char* str1, const char* str2) { return SDL_strcasecmp(str1, str2); @@ -139,3 +236,98 @@ void GlobalMemoryStatus(MEMORYSTATUS* memory_status) memory_status->dwLength = sizeof(*memory_status); memory_status->dwTotalPhys = 1024 * SDL_GetSystemRAM(); } + +HICON LoadIcon(HINSTANCE hInstance, LPCSTR lpIconName) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +HINSTANCE AfxFindResourceHandle(LPCTSTR lpszResourceName, int lpszResourceType) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +HMODULE LoadLibrary(const char* name) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int FreeLibrary(void* hModule) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +HMENU GetSystemMenu(HWND hWnd, bool bRevert) +{ + MINIWIN_NOT_IMPLEMENTED(); + assert(false && "Needs implementation"); + return reinterpret_cast(0x1234); +} + +HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +BOOL IsDlgButtonChecked(int nIDButton) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +CWnd* GetDlgItem(int id) +{ + MINIWIN_NOT_IMPLEMENTED(); + return new CWnd(); +} + +BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam) +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton) +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +BOOL CheckDlgButton(int nIDButton, BOOL uCheck) +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +void Enable3dControls() +{ + MINIWIN_NOT_IMPLEMENTED(); +} + +void ParseCommandLine(CCommandLineInfo& cmdInfo) +{ + MINIWIN_NOT_IMPLEMENTED(); +} diff --git a/miniwin/miniwin/include/miniwin.h b/miniwin/miniwin/include/miniwin.h index cca37450..4fa2668a 100644 --- a/miniwin/miniwin/include/miniwin.h +++ b/miniwin/miniwin/include/miniwin.h @@ -156,63 +156,25 @@ struct IUnknown { BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags); -inline HDC WINAPI GetDC(HWND hWnd) -{ - return 0; -} +HDC WINAPI GetDC(HWND hWnd); -inline int WINAPI ReleaseDC(HWND hWnd, HDC hDC) -{ - return 0; -} +int WINAPI ReleaseDC(HWND hWnd, HDC hDC); -inline int WINAPI GetDeviceCaps(HDC hdc, int index) -{ +int WINAPI GetDeviceCaps(HDC hdc, int index); - if (index == RASTERCAPS) { - return 0; - } - if (index == SIZEPALETTE) { - return 256; - } - return 0; -} +BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned int flags); -inline BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned int flags) -{ - return 1; -} +int SetBkColor(void*, int); -inline int SetBkColor(void*, int) -{ - return 0; -} +int SetBkMode(void*, int); -inline int SetBkMode(void*, int) -{ - return 0; -} +int SetTextColor(HDC hdc, int color); -inline int SetTextColor(HDC hdc, int color) -{ - return color; -} +BOOL GetTextExtentPoint(HDC hdc, LPCSTR lpString, int c, SIZE* psizl); -inline static BOOL GetTextExtentPoint(HDC hdc, LPCSTR lpString, int c, SIZE* psizl) -{ - if (psizl) { - psizl->cx = 8 * c; - psizl->cy = 16; - } - return TRUE; -} +int ExtTextOut(HDC, int, int, unsigned int, const RECT*, LPCSTR, unsigned int, void*); -inline int ExtTextOut(HDC, int, int, unsigned int, const RECT*, LPCSTR, unsigned int, void*) -{ - return 1; -} - -inline HFONT CreateFont( +HFONT CreateFont( int, int, int, @@ -227,32 +189,17 @@ inline HFONT CreateFont( unsigned int, unsigned int, LPCSTR -) -{ - return nullptr; -} +); -inline void* SelectObject(HDC, HFONT) -{ - return nullptr; -} +void* SelectObject(HDC, HFONT); -inline int GetTextExtentPoint32(HDC hdc, LPCSTR str, int len, SIZE* out) -{ - return GetTextExtentPoint(hdc, str, len, out); -} +int GetTextExtentPoint32(HDC hdc, LPCSTR str, int len, SIZE* out); -inline HMENU GetMenu(HWND hWnd) -{ - return NULL; -} +HMENU GetMenu(HWND hWnd); -inline int DrawMenuBar(void* hWnd) -{ - return 1; -} +int DrawMenuBar(void* hWnd); -inline static int StretchDIBits( +int StretchDIBits( void* hdc, int xDest, int yDest, @@ -266,43 +213,18 @@ inline static int StretchDIBits( const void* lpbmi, unsigned int iUsage, uint32_t rop -) -{ - return 0; -} +); -inline LONG GetWindowLong(HWND hWnd, int nIndex) -{ - return 0; -} +LONG GetWindowLong(HWND hWnd, int nIndex); -inline LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) -{ - return 0; -} +LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong); -inline int DeleteObject(void*) -{ - return 1; -} +int DeleteObject(void*); -inline BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle) -{ - return TRUE; -} +BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle); -inline int SetRect(RECT* rc, int left, int top, int right, int bottom) -{ - rc->left = left; - rc->top = top; - rc->right = right; - rc->bottom = bottom; - return 1; -} +int SetRect(RECT* rc, int left, int top, int right, int bottom); VOID WINAPI Sleep(DWORD dwMilliseconds); -inline BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint) -{ - return TRUE; -} +BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint); diff --git a/miniwin/miniwin/include/miniwin_ddraw.h b/miniwin/miniwin/include/miniwin_ddraw.h index a6dd97cc..4418df74 100644 --- a/miniwin/miniwin/include/miniwin_ddraw.h +++ b/miniwin/miniwin/include/miniwin_ddraw.h @@ -301,7 +301,7 @@ struct IDirectDrawPalette : virtual public IUnknown { typedef struct IDirectDrawPalette* LPDIRECTDRAWPALETTE; struct IDirectDrawClipper : virtual public IUnknown { - virtual HRESULT SetHWnd(DWORD unnamedParam1, HWND hWnd) { return DD_OK; } + virtual HRESULT SetHWnd(DWORD unnamedParam1, HWND hWnd); }; typedef IDirectDrawClipper* LPDIRECTDRAWCLIPPER; @@ -380,29 +380,10 @@ HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOute typedef BOOL (*LPDDENUMCALLBACKA)(GUID*, LPSTR, LPSTR, LPVOID); HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context); -inline UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries) -{ - for (UINT i = 0; i < cEntries; i++) { - UINT val = iStart + i; - pPalEntries[i].peRed = val; - pPalEntries[i].peGreen = val; - pPalEntries[i].peBlue = val; - pPalEntries[i].peFlags = PC_NONE; - } - return cEntries; -} +UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries); -inline HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) -{ - return nullptr; -} +HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette); -inline int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground) -{ - return 0; -} +int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground); -inline int RealizePalette(HDC hdc) -{ - return 0; -} +int RealizePalette(HDC hdc); diff --git a/miniwin/miniwin/include/miniwin_direct.h b/miniwin/miniwin/include/miniwin_direct.h index 32c3e458..8bd6eef4 100644 --- a/miniwin/miniwin/include/miniwin_direct.h +++ b/miniwin/miniwin/include/miniwin_direct.h @@ -1,7 +1,4 @@ #pragma once // --- Functions --- -int _chdir(char* path) -{ - return 0; -} +int _chdir(char* path); diff --git a/miniwin/miniwin/include/miniwin_process.h b/miniwin/miniwin/include/miniwin_process.h index e18ce275..9991c4a1 100644 --- a/miniwin/miniwin/include/miniwin_process.h +++ b/miniwin/miniwin/include/miniwin_process.h @@ -12,7 +12,4 @@ intptr_t _spawnl( const char* arg2, const char* arg3, ... -) -{ - return 0; -} +); diff --git a/miniwin/miniwin/src/miniwin.cpp b/miniwin/miniwin/src/miniwin.cpp index 20e6b4be..b489e8ad 100644 --- a/miniwin/miniwin/src/miniwin.cpp +++ b/miniwin/miniwin/src/miniwin.cpp @@ -23,7 +23,7 @@ ULONG IUnknown::Release() HRESULT IUnknown::QueryInterface(const GUID& riid, void** ppvObject) { - SDL_LogError(LOG_CATEGORY_MINIWIN, "IUnknown does not implement guid"); + MINIWIN_NOT_IMPLEMENTED(); return E_NOINTERFACE; } @@ -48,7 +48,194 @@ BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, return TRUE; } +HDC WINAPI GetDC(HWND hWnd) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int WINAPI ReleaseDC(HWND hWnd, HDC hDC) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int WINAPI GetDeviceCaps(HDC hdc, int index) +{ + + if (index == RASTERCAPS) { + return 0; + } + if (index == SIZEPALETTE) { + return 256; + } + return 0; +} + +BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned int flags) +{ + MINIWIN_NOT_IMPLEMENTED(); + 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) +{ + MINIWIN_NOT_IMPLEMENTED(); + return NULL; +} + +int DrawMenuBar(void* hWnd) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 1; +} + +int StretchDIBits( + void* hdc, + int xDest, + int yDest, + int DestWidth, + int DestHeight, + int xSrc, + int ySrc, + int SrcWidth, + int SrcHeight, + const void* lpBits, + const void* lpbmi, + unsigned int iUsage, + uint32_t rop +) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +LONG GetWindowLong(HWND hWnd, int nIndex) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int DeleteObject(void*) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 1; +} + +BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle) +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +int SetRect(RECT* rc, int left, int top, int right, int bottom) +{ + rc->left = left; + rc->top = top; + rc->right = right; + rc->bottom = bottom; + return 1; +} + VOID WINAPI Sleep(DWORD dwMilliseconds) { SDL_Delay(dwMilliseconds); } + +BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint) +{ + MINIWIN_NOT_IMPLEMENTED(); + return TRUE; +} + +int _chdir(char* path) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +intptr_t _spawnl( + int mode, + const char* cmdname, + const char* arg0, + const char* arg1, + const char* arg2, + const char* arg3, + ... +) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} diff --git a/miniwin/miniwin/src/miniwin_d3drm.cpp b/miniwin/miniwin/src/miniwin_d3drm.cpp index 3a43b23a..90fd842b 100644 --- a/miniwin/miniwin/src/miniwin_d3drm.cpp +++ b/miniwin/miniwin/src/miniwin_d3drm.cpp @@ -8,6 +8,7 @@ #include "miniwin_d3drmobject_p.h" #include "miniwin_d3drmviewport_p.h" #include "miniwin_ddsurface_p.h" +#include "miniwin_p.h" #include @@ -60,10 +61,18 @@ struct Direct3DRMPickedArrayImpl : public IDirect3DRMPickedArray { }; struct Direct3DRMWinDeviceImpl : public IDirect3DRMWinDevice { - HRESULT Activate() override { return DD_OK; } - HRESULT Paint() override { return DD_OK; } - void HandleActivate(WORD wParam) override {} - void HandlePaint(void* p_dc) override {} + HRESULT Activate() override + { + MINIWIN_NOT_IMPLEMENTED(); + return DD_OK; + } + HRESULT Paint() override + { + MINIWIN_NOT_IMPLEMENTED(); + return DD_OK; + } + void HandleActivate(WORD wParam) override { MINIWIN_NOT_IMPLEMENTED(); } + void HandlePaint(void* p_dc) override { MINIWIN_NOT_IMPLEMENTED(); } }; struct Direct3DRMTextureImpl : public Direct3DRMObjectBase { @@ -74,11 +83,16 @@ struct Direct3DRMTextureImpl : public Direct3DRMObjectBase *ppvObject = static_cast(this); return DD_OK; } - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Direct3DRMTextureImpl does not implement guid"); + MINIWIN_NOT_IMPLEMENTED(); return E_NOINTERFACE; } - HRESULT Changed(BOOL pixels, BOOL palette) override { return DD_OK; } + HRESULT Changed(BOOL pixels, BOOL palette) override + { + MINIWIN_NOT_IMPLEMENTED(); + return DD_OK; + } }; + struct Direct3DRMMaterialImpl : public Direct3DRMObjectBase {}; SDL_GPUGraphicsPipeline* InitializeGraphicsPipeline(SDL_GPUDevice* device) @@ -181,6 +195,7 @@ struct Direct3DRMImpl : virtual public IDirect3DRM2 { HRESULT CreateDeviceFromD3D(const IDirect3D2* d3d, IDirect3DDevice2* d3dDevice, IDirect3DRMDevice2** outDevice) override { + MINIWIN_NOT_IMPLEMENTED(); return CreateDevice(outDevice, 640, 480); } HRESULT CreateDeviceFromSurface( diff --git a/miniwin/miniwin/src/miniwin_d3drmdevice.cpp b/miniwin/miniwin/src/miniwin_d3drmdevice.cpp index fae03eea..bdaf7e73 100644 --- a/miniwin/miniwin/src/miniwin_d3drmdevice.cpp +++ b/miniwin/miniwin/src/miniwin_d3drmdevice.cpp @@ -85,25 +85,21 @@ HRESULT Direct3DRMDevice2Impl::GetDither() HRESULT Direct3DRMDevice2Impl::SetTextureQuality(D3DRMTEXTUREQUALITY quality) { - MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } D3DRMTEXTUREQUALITY Direct3DRMDevice2Impl::GetTextureQuality() { - MINIWIN_NOT_IMPLEMENTED(); return D3DRMTEXTUREQUALITY::LINEAR; } HRESULT Direct3DRMDevice2Impl::SetRenderMode(D3DRMRENDERMODE mode) { - MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } D3DRMRENDERMODE Direct3DRMDevice2Impl::GetRenderMode() { - MINIWIN_NOT_IMPLEMENTED(); return D3DRMRENDERMODE::BLENDEDTRANSPARENCY; } diff --git a/miniwin/miniwin/src/miniwin_d3drmframe.cpp b/miniwin/miniwin/src/miniwin_d3drmframe.cpp index 58b64cd5..b28ee162 100644 --- a/miniwin/miniwin/src/miniwin_d3drmframe.cpp +++ b/miniwin/miniwin/src/miniwin_d3drmframe.cpp @@ -33,6 +33,7 @@ HRESULT Direct3DRMFrameImpl::DeleteChild(IDirect3DRMFrame* child) HRESULT Direct3DRMFrameImpl::SetSceneBackgroundRGB(float r, float g, float b) { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -62,37 +63,31 @@ HRESULT Direct3DRMFrameImpl::GetPosition(int index, D3DVECTOR* position) HRESULT Direct3DRMFrameImpl::AddVisual(IDirect3DRMVisual* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->AddElement(visual); } HRESULT Direct3DRMFrameImpl::DeleteVisual(IDirect3DRMVisual* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->DeleteElement(visual); } HRESULT Direct3DRMFrameImpl::AddVisual(IDirect3DRMMesh* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->AddElement(visual); } HRESULT Direct3DRMFrameImpl::DeleteVisual(IDirect3DRMMesh* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->DeleteElement(visual); } HRESULT Direct3DRMFrameImpl::AddVisual(IDirect3DRMFrame* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->AddElement(visual); } HRESULT Direct3DRMFrameImpl::DeleteVisual(IDirect3DRMFrame* visual) { - MINIWIN_NOT_IMPLEMENTED(); return m_visuals->DeleteElement(visual); } diff --git a/miniwin/miniwin/src/miniwin_d3drmviewport.cpp b/miniwin/miniwin/src/miniwin_d3drmviewport.cpp index c878a3a8..61851aa3 100644 --- a/miniwin/miniwin/src/miniwin_d3drmviewport.cpp +++ b/miniwin/miniwin/src/miniwin_d3drmviewport.cpp @@ -38,6 +38,7 @@ void Direct3DRMViewportImpl::Update() m_vertexBuffer = SDL_CreateGPUBuffer(m_device, &bufferCreateInfo); + MINIWIN_NOT_IMPLEMENTED(); SDL_GPUTransferBufferCreateInfo transferCreateInfo = {}; transferCreateInfo.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD; transferCreateInfo.size = static_cast(sizeof(PositionColorVertex) * m_vertexCount); @@ -208,13 +209,11 @@ HRESULT Direct3DRMViewportImpl::GetCamera(IDirect3DRMFrame** camera) HRESULT Direct3DRMViewportImpl::SetProjection(D3DRMPROJECTIONTYPE type) { - MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } D3DRMPROJECTIONTYPE Direct3DRMViewportImpl::GetProjection() { - MINIWIN_NOT_IMPLEMENTED(); return D3DRMPROJECTIONTYPE::PERSPECTIVE; } @@ -256,13 +255,11 @@ D3DVALUE Direct3DRMViewportImpl::GetField() DWORD Direct3DRMViewportImpl::GetWidth() { - MINIWIN_NOT_IMPLEMENTED(); return m_width; } DWORD Direct3DRMViewportImpl::GetHeight() { - MINIWIN_NOT_IMPLEMENTED(); return m_height; } diff --git a/miniwin/miniwin/src/miniwin_ddraw.cpp b/miniwin/miniwin/src/miniwin_ddraw.cpp index 5fcca1f3..c9713e62 100644 --- a/miniwin/miniwin/src/miniwin_ddraw.cpp +++ b/miniwin/miniwin/src/miniwin_ddraw.cpp @@ -14,6 +14,12 @@ SDL_Window* DDWindow; SDL_Surface* DDBackBuffer; +HRESULT IDirectDrawClipper::SetHWnd(DWORD unnamedParam1, HWND hWnd) +{ + MINIWIN_NOT_IMPLEMENTED(); + return DD_OK; +} + HRESULT DirectDrawImpl::QueryInterface(const GUID& riid, void** ppvObject) { if (SDL_memcmp(&riid, &IID_IDirectDraw2, sizeof(GUID)) == 0) { @@ -26,7 +32,7 @@ HRESULT DirectDrawImpl::QueryInterface(const GUID& riid, void** ppvObject) *ppvObject = static_cast(this); return S_OK; } - SDL_LogError(LOG_CATEGORY_MINIWIN, "DirectDrawImpl does not implement guid"); + MINIWIN_NOT_IMPLEMENTED(); return E_NOINTERFACE; } @@ -87,9 +93,6 @@ HRESULT DirectDrawImpl::CreateSurface( return DD_OK; } if ((lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) == DDSCAPS_PRIMARYSURFACE) { - if ((lpDDSurfaceDesc->dwFlags & DDSD_BACKBUFFERCOUNT) == DDSD_BACKBUFFERCOUNT) { - SDL_Log("Todo: Switch to %d buffering", lpDDSurfaceDesc->dwBackBufferCount); - } SDL_Surface* windowSurface = SDL_GetWindowSurface(DDWindow); if (!windowSurface) { return DDERR_GENERIC; @@ -190,6 +193,7 @@ HRESULT DirectDrawImpl::EnumDisplayModes( HRESULT DirectDrawImpl::FlipToGDISurface() { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -304,6 +308,7 @@ HRESULT DirectDrawImpl::GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) HRESULT DirectDrawImpl::RestoreDisplayMode() { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -331,6 +336,7 @@ HRESULT DirectDrawImpl::SetCooperativeLevel(HWND hWnd, DDSCLFlags dwFlags) HRESULT DirectDrawImpl::SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -344,7 +350,7 @@ HRESULT DirectDrawImpl::CreateDevice(const GUID& guid, void* pBackBuffer, IDirec HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter) { if (lpGuid) { - MINIWIN_ERROR("Specifying a DirectDraw driver is not implemented"); + MINIWIN_NOT_IMPLEMENTED(); } *lplpDD = new DirectDrawImpl; @@ -368,3 +374,33 @@ HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context) return DD_OK; } + +UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries) +{ + for (UINT i = 0; i < cEntries; i++) { + UINT val = iStart + i; + pPalEntries[i].peRed = val; + pPalEntries[i].peGreen = val; + pPalEntries[i].peBlue = val; + pPalEntries[i].peFlags = PC_NONE; + } + return cEntries; +} + +HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) +{ + MINIWIN_NOT_IMPLEMENTED(); + return nullptr; +} + +int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} + +int RealizePalette(HDC hdc) +{ + MINIWIN_NOT_IMPLEMENTED(); + return 0; +} diff --git a/miniwin/miniwin/src/miniwin_ddsurface.cpp b/miniwin/miniwin/src/miniwin_ddsurface.cpp index 1c76f685..9edbaec5 100644 --- a/miniwin/miniwin/src/miniwin_ddsurface.cpp +++ b/miniwin/miniwin/src/miniwin_ddsurface.cpp @@ -42,7 +42,6 @@ HRESULT DirectDrawSurfaceImpl::QueryInterface(const GUID& riid, void** ppvObject // IDirectDrawSurface interface HRESULT DirectDrawSurfaceImpl::AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { - MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -152,6 +151,7 @@ HRESULT DirectDrawSurfaceImpl::GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTD HRESULT DirectDrawSurfaceImpl::GetDC(HDC* lphDC) { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -227,6 +227,7 @@ HRESULT DirectDrawSurfaceImpl::Lock( HRESULT DirectDrawSurfaceImpl::ReleaseDC(HDC hDC) { + MINIWIN_NOT_IMPLEMENTED(); return DD_OK; } @@ -246,7 +247,7 @@ HRESULT DirectDrawSurfaceImpl::SetColorKey(DDColorKeyFlags dwFlags, LPDDCOLORKEY return DDERR_INVALIDPARAMS; } if (lpDDColorKey->dwColorSpaceLowValue != lpDDColorKey->dwColorSpaceHighValue) { - return DDERR_GENERIC; // Not supported + MINIWIN_NOT_IMPLEMENTED(); } if (SDL_SetSurfaceColorKey(m_surface, true, lpDDColorKey->dwColorSpaceLowValue) != 0) { @@ -259,7 +260,7 @@ HRESULT DirectDrawSurfaceImpl::SetColorKey(DDColorKeyFlags dwFlags, LPDDCOLORKEY HRESULT DirectDrawSurfaceImpl::SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) { if (m_surface->format != SDL_PIXELFORMAT_INDEX8) { - return DDERR_GENERIC; + MINIWIN_NOT_IMPLEMENTED(); } if (m_palette) {