mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Some checks are pending
CI / clang-format (push) Waiting to run
CI / ${{ matrix.name }} (false, --toolchain /usr/local/vitasdk/share/vita.toolchain.cmake, false, false, Ninja, Vita, ubuntu-latest, true, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0, false, false, Visual Studio 17 2022, true, Xbox One, windows-latest, amd64, false, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake, false, devkitpro/devkitarm:latest, false, Ninja, true, Nintendo 3DS, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake, false, devkitpro/devkita64:latest, false, Ninja, Nintendo Switch, true, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, emcmake, false, false, true, Ninja, Emscripten, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, false, Ninja, true, MSVC (arm64), windows-latest, amd64_arm64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, false, true, Ninja, true, MSVC (x86), windows-latest, amd64_x86, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, false, Ninja, true, MSVC (x64), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (false, true, true, false, Ninja, true, MSVC (x64 Debug), windows-latest, amd64, false) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, -DCMAKE_SYSTEM_NAME=iOS, false, false, Xcode, true, iOS, macos-15, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, Ninja, true, mingw-w64-i686, mingw32, msys2 mingw32, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, false, false, Ninja, Android, ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, false, true, false, Ninja, macOS, macos-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, false, Ninja, true, mingw-w64-x86_64, mingw64, msys2 mingw64, windows-latest, msys2 {0}, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux (Debug), ubuntu-latest, true) (push) Waiting to run
CI / ${{ matrix.name }} (true, true, true, false, Ninja, true, Linux, ubuntu-latest, true) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (aarch64, ubuntu-22.04-arm) (push) Waiting to run
CI / Flatpak (${{ matrix.arch }}) (x86_64, ubuntu-latest) (push) Waiting to run
CI / C++ (push) Waiting to run
CI / Release (push) Blocked by required conditions
Docker / Publish web port (push) Waiting to run
235 lines
3.9 KiB
C++
235 lines
3.9 KiB
C++
#include "miniwin.h"
|
|
#include "miniwin/ddraw.h"
|
|
|
|
#include <SDL3/SDL.h>
|
|
#include <cassert>
|
|
#include <vector>
|
|
|
|
ULONG IUnknown::AddRef()
|
|
{
|
|
assert(m_refCount > 0);
|
|
m_refCount += 1;
|
|
return m_refCount;
|
|
}
|
|
|
|
ULONG IUnknown::Release()
|
|
{
|
|
assert(m_refCount > 0);
|
|
m_refCount -= 1;
|
|
if (m_refCount == 0) {
|
|
delete this;
|
|
return 0;
|
|
}
|
|
return m_refCount;
|
|
}
|
|
|
|
HRESULT IUnknown::QueryInterface(const GUID& riid, void** ppvObject)
|
|
{
|
|
MINIWIN_NOT_IMPLEMENTED();
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
HRESULT IDirectDrawClipper::SetHWnd(DWORD unnamedParam1, HWND hWnd)
|
|
{
|
|
return DD_OK;
|
|
}
|
|
|
|
BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
|
{
|
|
if (!hWnd) {
|
|
return FALSE;
|
|
}
|
|
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
|
|
|
if (!(uFlags & SWP_NOACTIVATE)) {
|
|
SDL_RaiseWindow(sdlWindow);
|
|
}
|
|
|
|
if (!(uFlags & SWP_NOSIZE)) {
|
|
SDL_SetWindowSize(sdlWindow, cx, cy);
|
|
}
|
|
|
|
if (!(uFlags & SWP_NOMOVE)) {
|
|
SDL_SetWindowPosition(sdlWindow, X, Y);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
HMENU GetMenu(HWND hWnd)
|
|
{
|
|
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)
|
|
{
|
|
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
|
if (nIndex == GWL_STYLE) {
|
|
Uint32 flags = SDL_GetWindowFlags(sdlWindow);
|
|
LONG style = WS_POPUP;
|
|
if ((flags & SDL_WINDOW_BORDERLESS) == 0) {
|
|
style = WS_OVERLAPPED | WS_CAPTION;
|
|
if (flags & SDL_WINDOW_RESIZABLE) {
|
|
style |= WS_THICKFRAME;
|
|
}
|
|
}
|
|
return style;
|
|
}
|
|
else if (nIndex == GWL_EXSTYLE) {
|
|
return 0;
|
|
}
|
|
|
|
MINIWIN_NOT_IMPLEMENTED();
|
|
return 0;
|
|
}
|
|
|
|
LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong)
|
|
{
|
|
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
|
if (nIndex == GWL_STYLE) {
|
|
SDL_SetWindowBordered(sdlWindow, (dwNewLong & WS_CAPTION) != 0);
|
|
SDL_SetWindowResizable(sdlWindow, (dwNewLong & WS_THICKFRAME) != 0);
|
|
|
|
return dwNewLong;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int DeleteObject(void*)
|
|
{
|
|
MINIWIN_NOT_IMPLEMENTED();
|
|
return 1;
|
|
}
|
|
|
|
BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
|
|
{
|
|
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)
|
|
{
|
|
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;
|
|
}
|
|
|
|
UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries)
|
|
{
|
|
MINIWIN_NOT_IMPLEMENTED();
|
|
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;
|
|
}
|