mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 02:21:15 +00:00
Make things build on Linux (#69)
This commit is contained in:
parent
7aac7353ff
commit
08b2dab108
46
.github/workflows/linux.yml
vendored
Normal file
46
.github/workflows/linux.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
name: Linux
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build-type: [Release, Debug]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libx11-dev libxext-dev libxrandr-dev libxrender-dev libxfixes-dev libxi-dev libxinerama-dev libxcursor-dev libwayland-dev libxkbcommon-dev wayland-protocols
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -S . -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
|
||||
-DISLE_USE_DX5=OFF \
|
||||
-DISLE_D3DRM_FROM_WINE=OFF \
|
||||
-DENABLE_CLANG_TIDY=ON \
|
||||
-DISLE_WERROR=ON \
|
||||
-Werror=dev
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build -- -k0
|
||||
|
||||
- name: Make Artifact Archive
|
||||
run: |
|
||||
cd build
|
||||
zip "isle-portable-linux-${{ matrix.build-type }}.zip" \
|
||||
CONFIG ISLE LEGO1.so
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-artifacts-${{ matrix.build-type }}
|
||||
path: build/isle-portable-linux-${{ matrix.build-type }}.zip
|
||||
@ -1,4 +1,4 @@
|
||||
name: Build
|
||||
name: Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
@ -6,6 +6,9 @@ cmake_policy(SET CMP0091 NEW)
|
||||
# To set BUILD_* variables for iniparser below. Is there another way?
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||
|
||||
# Building on Linux
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
project(isle CXX C)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
@ -14,7 +17,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory w
|
||||
|
||||
# By configuring CMake with -DDOWNLOAD_DEPENDENCIES=ON/OFF,
|
||||
# users can choose between downloading dependencies or using system libraries
|
||||
option(DOWNLOAD_DEPENDENCIES "Download dependencies" TRUE)
|
||||
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON)
|
||||
|
||||
option(ISLE_ASAN "Enable AddressSanitizer" OFF)
|
||||
|
||||
if(DOWNLOAD_DEPENDENCIES)
|
||||
# FetchContent downloads and configures dependencies
|
||||
@ -52,7 +57,7 @@ include(CheckCXXSourceCompiles)
|
||||
include(CMakeDependentOption)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
|
||||
if (ENABLE_CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_BIN NAMES "clang-tidy")
|
||||
@ -60,6 +65,11 @@ if (ENABLE_CLANG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_BIN}")
|
||||
endif()
|
||||
|
||||
if (ISLE_ASAN)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
add_link_options(-fsanitize=address)
|
||||
endif()
|
||||
|
||||
function(add_cxx_warning WARNING)
|
||||
if(ISLE_WERROR)
|
||||
set(compiler_option "-Werror=${WARNING}")
|
||||
@ -84,9 +94,9 @@ function(add_cxx_warning WARNING)
|
||||
endfunction()
|
||||
|
||||
if(NOT MINGW)
|
||||
set(NOT_MINGW TRUE)
|
||||
set(NOT_MINGW ON)
|
||||
else()
|
||||
set(NOT_MINGW FALSE)
|
||||
set(NOT_MINGW OFF)
|
||||
endif()
|
||||
|
||||
add_subdirectory(3rdparty EXCLUDE_FROM_ALL SYSTEM)
|
||||
@ -138,10 +148,13 @@ add_lego1_static_library(tglrl
|
||||
LEGO1/tgl/d3drm/view.cpp
|
||||
)
|
||||
target_include_directories(tglrl-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util")
|
||||
if(ISLE_D3DRM_FROM_WINE)
|
||||
target_link_libraries(tglrl-interface INTERFACE d3drm-wine)
|
||||
else()
|
||||
target_link_libraries(tglrl-interface INTERFACE d3drm)
|
||||
|
||||
if(WIN32)
|
||||
if(ISLE_D3DRM_FROM_WINE)
|
||||
target_link_libraries(tglrl-interface INTERFACE d3drm-wine)
|
||||
else()
|
||||
target_link_libraries(tglrl-interface INTERFACE d3drm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_lego1_static_library(realtime
|
||||
@ -168,7 +181,9 @@ add_lego1_static_library(mxdirectx
|
||||
LEGO1/mxdirectx/legodxinfo.cpp
|
||||
)
|
||||
target_include_directories(mxdirectx-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util")
|
||||
target_link_libraries(mxdirectx-interface INTERFACE ddraw)
|
||||
if(WIN32)
|
||||
target_link_libraries(mxdirectx-interface INTERFACE ddraw)
|
||||
endif()
|
||||
|
||||
add_lego1_static_library(roi
|
||||
LEGO1/lego/sources/roi/legolod.cpp
|
||||
@ -300,7 +315,10 @@ add_lego1_static_library(omni
|
||||
LEGO1/omni/src/video/mxvideopresenter.cpp
|
||||
)
|
||||
target_include_directories(omni-interface INTERFACE "${CMAKE_SOURCE_DIR}/LEGO1/omni/include" "${CMAKE_SOURCE_DIR}/LEGO1" "${CMAKE_SOURCE_DIR}/util")
|
||||
target_link_libraries(omni-interface INTERFACE winmm libsmacker miniaudio)
|
||||
if(WIN32)
|
||||
target_link_libraries(omni-interface INTERFACE winmm)
|
||||
endif()
|
||||
target_link_libraries(omni-interface INTERFACE libsmacker miniaudio)
|
||||
|
||||
add_lego1_static_library(lego1_impl
|
||||
LEGO1/define.cpp
|
||||
@ -426,7 +444,10 @@ if(MINGW)
|
||||
endif()
|
||||
|
||||
set(lego1_objects)
|
||||
set(lego1_link_libraries dxguid d3drm_guid)
|
||||
set(lego1_link_libraries)
|
||||
if(WIN32)
|
||||
list(APPEND lego1_link_libraries dxguid d3drm_guid)
|
||||
endif()
|
||||
foreach(lego1_library IN LISTS lego1_targets)
|
||||
target_compile_definitions(${lego1_library}-objects PRIVATE LEGO1_DLL)
|
||||
list(APPEND lego1_objects $<TARGET_OBJECTS:${lego1_library}-objects>)
|
||||
@ -441,17 +462,21 @@ target_link_libraries(lego1 PUBLIC ${lego1_link_libraries})
|
||||
# Make sure filenames are ALL CAPS
|
||||
set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1)
|
||||
set_property(TARGET lego1 PROPERTY PREFIX "")
|
||||
set_property(TARGET lego1 PROPERTY SUFFIX ".DLL")
|
||||
if(WIN32)
|
||||
set_property(TARGET lego1 PROPERTY SUFFIX ".DLL")
|
||||
endif()
|
||||
|
||||
if (ISLE_BUILD_APP)
|
||||
add_executable(isle WIN32
|
||||
ISLE/res/isle.rc
|
||||
ISLE/isleapp.cpp
|
||||
)
|
||||
add_custom_command(TARGET isle POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_RUNTIME_DLLS:isle> "$<TARGET_FILE_DIR:isle>"
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
if(WIN32)
|
||||
add_custom_command(TARGET isle POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy $<TARGET_RUNTIME_DLLS:isle> "$<TARGET_FILE_DIR:isle>"
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(isle PRIVATE ISLE_APP)
|
||||
|
||||
@ -461,18 +486,24 @@ if (ISLE_BUILD_APP)
|
||||
# Link SDL and iniparser
|
||||
target_link_libraries(isle PRIVATE SDL3::SDL3 iniparser-static)
|
||||
|
||||
# Link DSOUND, WINMM, and LEGO1
|
||||
target_link_libraries(isle PRIVATE winmm lego1)
|
||||
# Link DSOUND and WINMM
|
||||
if(WIN32)
|
||||
target_link_libraries(isle PRIVATE winmm)
|
||||
endif()
|
||||
# Link LEGO1
|
||||
target_link_libraries(isle PRIVATE lego1)
|
||||
|
||||
target_include_directories(isle PRIVATE $<$<BOOL:${ISLE_D3DRM_FROM_WINE}>:$<TARGET_PROPERTY:d3drm-wine,INTERFACE_INCLUDE_DIRECTORIES>>)
|
||||
|
||||
# Make sure filenames are ALL CAPS
|
||||
set_property(TARGET isle PROPERTY OUTPUT_NAME ISLE)
|
||||
set_property(TARGET isle PROPERTY SUFFIX ".EXE")
|
||||
if(WIN32)
|
||||
set_property(TARGET isle PROPERTY SUFFIX ".EXE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ISLE_BUILD_CONFIG)
|
||||
add_executable(config WIN32
|
||||
set(config_SRC WIN32
|
||||
LEGO1/mxdirectx/mxdirectxinfo.cpp
|
||||
LEGO1/mxdirectx/legodxinfo.cpp
|
||||
CONFIG/config.cpp
|
||||
@ -483,6 +514,10 @@ if (ISLE_BUILD_CONFIG)
|
||||
CONFIG/StdAfx.cpp
|
||||
CONFIG/res/config.rc
|
||||
)
|
||||
if(NOT WIN32)
|
||||
list(APPEND config_SRC util/stdafx.cpp)
|
||||
endif()
|
||||
add_executable(config ${config_SRC})
|
||||
target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
|
||||
target_include_directories(config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/util" "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
|
||||
@ -490,9 +525,13 @@ if (ISLE_BUILD_CONFIG)
|
||||
endif()
|
||||
target_compile_definitions(config PRIVATE DIRECT3D_VERSION=0x500)
|
||||
target_link_libraries(config PRIVATE SDL3::SDL3)
|
||||
target_link_libraries(config PRIVATE ddraw dxguid)
|
||||
if(WIN32)
|
||||
target_link_libraries(config PRIVATE ddraw dxguid)
|
||||
endif()
|
||||
set_property(TARGET config PROPERTY OUTPUT_NAME "CONFIG")
|
||||
set_property(TARGET config PROPERTY SUFFIX ".EXE")
|
||||
if(WIN32)
|
||||
set_property(TARGET config PROPERTY SUFFIX ".EXE")
|
||||
endif()
|
||||
set_property(TARGET config PROPERTY MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
|
||||
endif()
|
||||
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
#include "MainDlg.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
#include "AboutDlg.h"
|
||||
#include "config.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
@ -2,4 +2,6 @@
|
||||
// simple.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "stdafx.h"
|
||||
#endif
|
||||
|
||||
@ -3,11 +3,15 @@
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
@ -4,10 +4,18 @@
|
||||
#include "MainDlg.h"
|
||||
#include "detectdx5.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h> // _chdir
|
||||
#else
|
||||
#include "miniwin_direct.h"
|
||||
#endif
|
||||
#include <mxdirectx/legodxinfo.h>
|
||||
#include <mxdirectx/mxdirect3d.h>
|
||||
#ifdef _WIN32
|
||||
#include <process.h> // _spawnl
|
||||
#else
|
||||
#include "miniwin_process.h"
|
||||
#endif
|
||||
|
||||
DECOMP_SIZE_ASSERT(CWinApp, 0xc4)
|
||||
DECOMP_SIZE_ASSERT(CConfigApp, 0x108)
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3d.h>
|
||||
#else
|
||||
#include "miniwin_d3d.h"
|
||||
#endif
|
||||
|
||||
class LegoDeviceEnumerate;
|
||||
struct Direct3DDeviceInfo;
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
#include "detectdx5.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#include <dinput.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#include "miniwin_dinput.h"
|
||||
#endif
|
||||
|
||||
typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);
|
||||
typedef HRESULT WINAPI
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
#if !defined(AFX_DETECTDX5_H)
|
||||
#define AFX_DETECTDX5_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
extern BOOL DetectDirectX5();
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
|
||||
#include <SDL3/SDL_mouse.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
// SIZE 0x8c
|
||||
class IsleApp {
|
||||
|
||||
@ -12,7 +12,11 @@
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
class LegoCameraController;
|
||||
class LegoControlManager;
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
#include "mxcore.h"
|
||||
#include "mxgeometry.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
class Lego3DView;
|
||||
class LegoEntity;
|
||||
|
||||
@ -4,8 +4,13 @@
|
||||
#include "misc/legotypes.h"
|
||||
#include "tgl/tgl.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3drmobj.h>
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_d3drm.h"
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
class LegoTexture;
|
||||
|
||||
|
||||
@ -8,7 +8,11 @@
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
#define WM_ISLE_SETCURSOR 0x5400
|
||||
|
||||
|
||||
@ -6,8 +6,13 @@
|
||||
#include "legophonemelist.h"
|
||||
#include "mxvideomanager.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3drm.h>
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_d3drm.h"
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
class Lego3DManager;
|
||||
class LegoROI;
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
#include "mxcore.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
class MxVideoPresenter;
|
||||
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
// FUNCTION: LEGO1 0x10091ee0
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
#include "mxdirectxinfo.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3d.h>
|
||||
#else
|
||||
#include "miniwin_d3d.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100db800
|
||||
// VTABLE: BETA10 0x101c1af8
|
||||
|
||||
@ -4,8 +4,13 @@
|
||||
#include "lego1_export.h"
|
||||
#include "mxdirectxinfo.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100db818
|
||||
// VTABLE: BETA10 0x101c1b10
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
#include "decomp.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3d.h>
|
||||
#else
|
||||
#include "miniwin_d3d.h"
|
||||
#endif
|
||||
|
||||
// SIZE 0x17c
|
||||
struct DeviceModesInfo {
|
||||
|
||||
@ -7,7 +7,11 @@
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <limits.h> // ULONG_MAX
|
||||
#include <math.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@ -3,7 +3,11 @@
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
enum FLI_CHUNK_TYPE {
|
||||
FLI_CHUNK_COLOR256 = 4, // 256-level color palette info
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
class MxPalette;
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
#include "mxcore.h"
|
||||
#include "mxvideoparam.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
class MxBitmap;
|
||||
class MxPalette;
|
||||
|
||||
@ -7,7 +7,11 @@
|
||||
#include "mxstring.h"
|
||||
|
||||
#include <SDL3/SDL_video.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
class MxAtomSet;
|
||||
class MxDSAction;
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
#include "mxcore.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100dc848
|
||||
// VTABLE: BETA10 0x101c2300
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
#include "mxmediamanager.h"
|
||||
#include "mxvideoparam.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3d.h>
|
||||
#else
|
||||
#include "miniwin_d3d.h"
|
||||
#endif
|
||||
|
||||
class MxDisplaySurface;
|
||||
class MxRect32;
|
||||
|
||||
@ -7,7 +7,11 @@
|
||||
#include "mxtypes.h"
|
||||
#include "mxvideoparamflags.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
class MxPalette;
|
||||
|
||||
|
||||
@ -4,7 +4,11 @@
|
||||
#include "lego1_export.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
class MxVideoParamFlags {
|
||||
public:
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
#include "mxgeometry.h"
|
||||
#include "mxmediapresenter.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ddraw.h>
|
||||
#else
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100d4be8
|
||||
// SIZE 0x64
|
||||
|
||||
@ -10,7 +10,11 @@
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <assert.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDisplaySurface, 0xac);
|
||||
|
||||
|
||||
@ -5,7 +5,11 @@
|
||||
#include "mxgeometry/mxmatrix.h"
|
||||
#include "roi.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100dbc08
|
||||
// SIZE 0xdc
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
#include "impl.h"
|
||||
|
||||
#include <assert.h>
|
||||
#ifdef _WIN32
|
||||
#include <d3drmwin.h>
|
||||
#else
|
||||
#include "miniwin_d3drm.h"
|
||||
#endif
|
||||
|
||||
using namespace TglImpl;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "decomp.h"
|
||||
#include "tgl/tgl.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3drm.h>
|
||||
|
||||
#ifndef D3DRM_WINE
|
||||
@ -10,6 +11,10 @@ typedef DWORD LPD3DRM_APPDATA;
|
||||
#else
|
||||
typedef LPVOID LPD3DRM_APPDATA;
|
||||
#endif
|
||||
#else
|
||||
#include "miniwin_d3drm.h"
|
||||
typedef void* LPD3DRM_APPDATA;
|
||||
#endif
|
||||
|
||||
// Forward declare D3D types
|
||||
struct IDirect3DRM2;
|
||||
|
||||
@ -4,9 +4,15 @@
|
||||
|
||||
#include "tglvector.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3d.h>
|
||||
#include <ddraw.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include "miniwin.h"
|
||||
#include "miniwin_d3d.h"
|
||||
#include "miniwin_ddraw.h"
|
||||
#endif
|
||||
|
||||
namespace Tgl
|
||||
{
|
||||
|
||||
@ -6,7 +6,11 @@
|
||||
#include "realtime/realtimeview.h"
|
||||
#include "viewroi.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <d3drm.h>
|
||||
#else
|
||||
#include "miniwin_d3drm.h"
|
||||
#endif
|
||||
|
||||
// VTABLE: LEGO1 0x100dbd88
|
||||
// SIZE 0x1bc
|
||||
|
||||
656
util/miniwin.h
Normal file
656
util/miniwin.h
Normal file
@ -0,0 +1,656 @@
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// --- Defines and Macros ---
|
||||
|
||||
// This is not the right way to make a GUID
|
||||
#define DEFINE_GUID(GuidName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
|
||||
const GUID GuidName = {l, w1, w2, b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8}
|
||||
|
||||
// Remove WinAPI stuff
|
||||
#define BEGIN_MESSAGE_MAP(class_name, base_class_name)
|
||||
#define DECLARE_MESSAGE_MAP()
|
||||
#define CALLBACK
|
||||
#define __cdecl
|
||||
#define FAR
|
||||
#define END_MESSAGE_MAP()
|
||||
#define ON_COMMAND(id, func)
|
||||
#define ON_LBN_SELCHANGE(id, func)
|
||||
#define ON_WM_DESTROY()
|
||||
#define ON_WM_PAINT()
|
||||
#define ON_WM_QUERYDRAGICON()
|
||||
#define ON_WM_SYSCOMMAND()
|
||||
#define WINAPI
|
||||
|
||||
#define FAILED(hr) (((HRESULT) (hr)) < 0)
|
||||
#define InterlockedIncrement(x) __sync_add_and_fetch(x, 1)
|
||||
#define INVALID_HANDLE ((HANDLE) - 1)
|
||||
#define INVALID_HANDLE_VALUE ((HANDLE) - 1)
|
||||
#define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
|
||||
#define GWL_STYLE (-16)
|
||||
#define HWND_NOTOPMOST (HWND) - 2
|
||||
#define LOWORD(l) ((WORD) (((DWORD_PTR) (l)) & 0xffff))
|
||||
#define MAKEINTRESOURCE(i) (reinterpret_cast<LPCTSTR>((ULONG_PTR) ((WORD) (i))))
|
||||
#define RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16))
|
||||
#define S_OK ((HRESULT) 0)
|
||||
#define VOID void
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define ICON_BIG 1
|
||||
#define ICON_SMALL 0
|
||||
|
||||
#define KEY_READ 0x20019
|
||||
#define KEY_WRITE 0x20006
|
||||
|
||||
#define LB_ADDSTRING 0x180
|
||||
#define LB_GETCURSEL 0x0188
|
||||
#define LB_SETCURSEL 0x185
|
||||
|
||||
#define MF_SEPARATOR 0x80000000
|
||||
#define MF_STRING 0x00000000
|
||||
|
||||
#define SM_CXICON 11
|
||||
#define SM_CYICON 12
|
||||
|
||||
#define SWP_NOACTIVATE 0x0010
|
||||
#define SWP_NOMOVE 0x0002
|
||||
#define SWP_NOSIZE 0x0004
|
||||
#define SWP_NOZORDER 0x0001
|
||||
|
||||
#define WM_CLOSE 0x0010
|
||||
#define WM_ICONERASEBKGND 0x0027
|
||||
#define WM_SETICON 0x804
|
||||
#define WM_QUIT 0x0012
|
||||
#define WM_TIMER 0x0113
|
||||
|
||||
#define WS_CAPTION 0x00C00000L
|
||||
#define WS_OVERLAPPED 0x00000000L
|
||||
#define WS_POPUP 0x80000000L
|
||||
#define WS_SYSMENU 0x00080000L
|
||||
#define WS_THICKFRAME 0x00040000L
|
||||
|
||||
#define ANSI_CHARSET 0
|
||||
#define BI_RGB 0
|
||||
#define CLIP_DEFAULT_PRECIS 0
|
||||
#define DEFAULT_QUALITY 0
|
||||
#define ERROR_SUCCESS 0
|
||||
#define ETO_OPAQUE 0x0002
|
||||
#define FF_DONTCARE 0x00000000
|
||||
#define FW_NORMAL 400
|
||||
#define GENERIC_READ 0x80000000L
|
||||
#define GWL_EXSTYLE -20
|
||||
#define OPAQUE 2
|
||||
#define OPEN_EXISTING 3
|
||||
#define OUT_DEFAULT_PRECIS 0
|
||||
#define RDW_FRAME 0x0400
|
||||
#define REG_SZ 1
|
||||
#define RT_GROUP_ICON 0x00000007
|
||||
#define SRCCOPY 0x00CC0020
|
||||
#define SW_RESTORE 9
|
||||
#define VARIABLE_PITCH 2
|
||||
|
||||
// --- Typedefs ---
|
||||
typedef char CHAR;
|
||||
typedef uint8_t BYTE, byte;
|
||||
typedef BYTE* LPBYTE;
|
||||
typedef int32_t LONG;
|
||||
typedef uint32_t ULONG, DWORD;
|
||||
typedef DWORD* LPDWORD;
|
||||
typedef int BOOL, WINBOOL, INT;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned short WORD;
|
||||
typedef long* LPLONG;
|
||||
typedef void* LPVOID;
|
||||
typedef char* LPSTR;
|
||||
typedef char* LPTSTR;
|
||||
typedef const char* LPCTSTR;
|
||||
typedef const char* LPCSTR;
|
||||
typedef intptr_t INT_PTR, *PINT_PTR;
|
||||
typedef uintptr_t UINT_PTR, *PUINT_PTR;
|
||||
typedef intptr_t LONG_PTR, *PLONG_PTR;
|
||||
typedef uintptr_t ULONG_PTR, *PULONG_PTR;
|
||||
typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
|
||||
typedef UINT_PTR WPARAM;
|
||||
typedef LONG_PTR LPARAM, LRESULT;
|
||||
typedef void* HANDLE;
|
||||
typedef HANDLE HMENU, HICON, HFONT;
|
||||
typedef HANDLE HWND, HMODULE, HDC, HINSTANCE, HPALETTE, HFILE, HCURSOR;
|
||||
typedef LONG HRESULT, LSTATUS, HKEY, REGSAM;
|
||||
typedef HKEY* PHKEY;
|
||||
|
||||
// --- Structs ---
|
||||
struct tagPOINT {
|
||||
LONG x;
|
||||
LONG y;
|
||||
};
|
||||
typedef tagPOINT* LPPOINT;
|
||||
|
||||
struct SIZE {
|
||||
LONG cx;
|
||||
LONG cy;
|
||||
};
|
||||
|
||||
struct tagRECT {
|
||||
LONG left;
|
||||
LONG top;
|
||||
LONG right;
|
||||
LONG bottom;
|
||||
};
|
||||
typedef tagRECT RECT;
|
||||
typedef tagRECT* LPRECT;
|
||||
|
||||
struct BITMAPINFOHEADER {
|
||||
DWORD biSize;
|
||||
LONG biWidth;
|
||||
LONG biHeight;
|
||||
WORD biPlanes;
|
||||
WORD biBitCount;
|
||||
DWORD biCompression;
|
||||
DWORD biSizeImage;
|
||||
};
|
||||
typedef BITMAPINFOHEADER* LPBITMAPINFOHEADER;
|
||||
|
||||
struct RGBQUAD {
|
||||
BYTE rgbBlue;
|
||||
BYTE rgbGreen;
|
||||
BYTE rgbRed;
|
||||
BYTE rgbReserved;
|
||||
};
|
||||
|
||||
struct BITMAPFILEHEADER {
|
||||
WORD bfType;
|
||||
DWORD bfSize;
|
||||
WORD bfReserved1;
|
||||
WORD bfReserved2;
|
||||
DWORD bfOffBits;
|
||||
};
|
||||
|
||||
struct BITMAPINFO {
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[1];
|
||||
};
|
||||
typedef BITMAPINFO* LPBITMAPINFO;
|
||||
|
||||
struct PALETTEENTRY {
|
||||
BYTE peRed;
|
||||
BYTE peGreen;
|
||||
BYTE peBlue;
|
||||
BYTE peFlags;
|
||||
};
|
||||
typedef PALETTEENTRY* LPPALETTEENTRY;
|
||||
|
||||
struct GUID {
|
||||
int m_data1;
|
||||
int m_data2;
|
||||
int m_data3;
|
||||
int m_data4;
|
||||
};
|
||||
typedef GUID REFIID;
|
||||
typedef GUID* LPGUID;
|
||||
|
||||
struct IUnknown {
|
||||
virtual ULONG AddRef() { return 0; }
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual HRESULT QueryInterface(const GUID& riid, void** ppvObject) { return S_OK; }
|
||||
};
|
||||
typedef struct IUnknown* LPUNKNOWN;
|
||||
|
||||
struct CWnd {
|
||||
void* m_hWnd;
|
||||
void EnableWindow(bool bEnable) {}
|
||||
void SetWindowText(const char* text) {}
|
||||
};
|
||||
|
||||
struct CPaintDC {
|
||||
void* m_hDC;
|
||||
CPaintDC(HWND hWnd) {}
|
||||
void Draw() {}
|
||||
};
|
||||
|
||||
struct CDataExchange {
|
||||
bool m_bSaveAndValidate;
|
||||
};
|
||||
|
||||
struct CDialog {
|
||||
void* 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) {}
|
||||
};
|
||||
|
||||
struct CMenu {
|
||||
void* m_hMenu;
|
||||
CMenu() : m_hMenu(nullptr) {}
|
||||
static CMenu* FromHandle(void* hMenu)
|
||||
{
|
||||
CMenu* pMenu = new 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; }
|
||||
};
|
||||
|
||||
struct CWinApp {
|
||||
virtual ~CWinApp();
|
||||
virtual BOOL InitInstance();
|
||||
virtual int ExitInstance();
|
||||
};
|
||||
|
||||
struct CCommandLineInfo {
|
||||
virtual void ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast) {}
|
||||
};
|
||||
|
||||
struct LOGPALETTE {
|
||||
WORD palVersion;
|
||||
WORD palNumEntries;
|
||||
PALETTEENTRY palPalEntry[1];
|
||||
};
|
||||
typedef LOGPALETTE* LPLOGPALETTE;
|
||||
|
||||
struct MEMORYSTATUS {
|
||||
DWORD dwLength;
|
||||
DWORD dwTotalPhys;
|
||||
};
|
||||
|
||||
struct OSVERSIONINFOA {
|
||||
DWORD dwOSVersionInfoSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
};
|
||||
|
||||
// --- Classs ---
|
||||
class CString {
|
||||
public:
|
||||
CString(const char* str = "") : m_str(str) {}
|
||||
void LoadString(int str) {}
|
||||
operator const char*() const { return m_str; }
|
||||
|
||||
private:
|
||||
const char* m_str;
|
||||
};
|
||||
|
||||
// --- Functions ---
|
||||
inline WINBOOL WINAPI SetForegroundWindow(HWND hWnd)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL ShowWindow(HWND hWnd, int nCmdShow)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL SetWindowPos(HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL GetWindowRect(HWND hDlg, struct tagRECT* Rect)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL GetClientRect(LPRECT lpRect)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL IsIconic()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
inline int GetSystemMetrics(int nIndex)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline UINT WINAPI GetSystemPaletteEntries(HDC hdc, UINT iStart, UINT cEntries, LPPALETTEENTRY pPalEntries)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline BOOL GetVersionEx(OSVERSIONINFOA* version)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline void GlobalMemoryStatus(MEMORYSTATUS* memory_status)
|
||||
{
|
||||
}
|
||||
|
||||
inline HDC WINAPI GetDC(HWND hWnd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int WINAPI ReleaseDC(HWND hWnd, HDC hDC)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int WINAPI GetDeviceCaps(HDC hdc, int index)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline BOOL RedrawWindow(void* hWnd, const void* lprcUpdate, void* hrgnUpdate, unsigned int flags)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int SetBkColor(void*, int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int SetBkMode(void*, int)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int SetTextColor(HDC hdc, int color)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hIcon)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline static BOOL GetTextExtentPoint(HDC hdc, LPCSTR lpString, int c, SIZE* psizl)
|
||||
{
|
||||
if (psizl) {
|
||||
psizl->cx = 8 * c;
|
||||
psizl->cy = 16;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline int ExtTextOut(HDC, int, int, unsigned int, const RECT*, LPCSTR, unsigned int, void*)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline HFONT CreateFont(
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
int,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
unsigned long,
|
||||
LPCSTR
|
||||
)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline void* SelectObject(HDC, HFONT)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline int GetTextExtentPoint32(HDC hdc, LPCSTR str, int len, SIZE* out)
|
||||
{
|
||||
return GetTextExtentPoint(hdc, str, len, out);
|
||||
}
|
||||
|
||||
inline bool AppendMenu(void* menu, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
inline HMENU GetMenu(HWND hWnd)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline int DrawMenuBar(void* hWnd)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline LSTATUS RegOpenKeyEx(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline LSTATUS RegQueryValueEx(
|
||||
HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
LPDWORD lpReserved,
|
||||
LPDWORD lpType,
|
||||
BYTE* lpData,
|
||||
LPDWORD lpcbData
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline LSTATUS RegCloseKey(HKEY hKey)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline LSTATUS RegSetValueEx(
|
||||
HKEY hKey,
|
||||
LPCSTR lpValueName,
|
||||
DWORD Reserved,
|
||||
DWORD dwType,
|
||||
const BYTE* lpData,
|
||||
DWORD cbData
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline LSTATUS RegCreateKeyEx(
|
||||
HKEY hKey,
|
||||
LPCSTR lpSubKey,
|
||||
DWORD Reserved,
|
||||
const char* lpClass,
|
||||
DWORD dwOptions,
|
||||
REGSAM samDesired,
|
||||
void* lpSecurityAttributes,
|
||||
PHKEY phkResult,
|
||||
LPDWORD lpdwDisposition
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
inline BOOL IsDlgButtonChecked(int nIDButton)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline CWnd* GetDlgItem(int id)
|
||||
{
|
||||
return new CWnd();
|
||||
}
|
||||
|
||||
inline BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL CheckDlgButton(int nIDButton, BOOL uCheck)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline void OutputDebugString(const char* lpOutputString)
|
||||
{
|
||||
fprintf(stderr, "%s", lpOutputString);
|
||||
}
|
||||
|
||||
inline void Enable3dControls()
|
||||
{
|
||||
}
|
||||
|
||||
inline void ParseCommandLine(CCommandLineInfo& cmdInfo)
|
||||
{
|
||||
}
|
||||
|
||||
struct AFX_MODULE_STATE {
|
||||
CWinApp* m_pCurrentWinApp;
|
||||
};
|
||||
extern const char* afxCurrentAppName;
|
||||
extern CWinApp* wndTop;
|
||||
extern AFX_MODULE_STATE g_CustomModuleState;
|
||||
#define afxCurrentWinApp AfxGetModuleState()->m_pCurrentWinApp
|
||||
inline AFX_MODULE_STATE* AfxGetModuleState()
|
||||
{
|
||||
g_CustomModuleState.m_pCurrentWinApp = wndTop;
|
||||
return &g_CustomModuleState;
|
||||
}
|
||||
|
||||
inline void AfxMessageBox(const char* message)
|
||||
{
|
||||
}
|
||||
|
||||
inline void* GetProcAddress(HMODULE module, const char* name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline static 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
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline LONG GetWindowLong(HWND hWnd, int nIndex)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int DeleteObject(void*)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int _stricmp(const char* str1, const char* str2)
|
||||
{
|
||||
return strcasecmp(str1, str2);
|
||||
}
|
||||
|
||||
inline BOOL AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline HICON LoadIcon(HINSTANCE hInstance, LPCSTR lpIconName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
inline int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline HINSTANCE AfxFindResourceHandle(LPCTSTR lpszResourceName, int lpszResourceType)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline HMODULE LoadLibrary(const char* name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int FreeLibrary(void* hModule)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline HMENU GetSystemMenu(HWND hWnd, bool bRevert)
|
||||
{
|
||||
assert(false && "Needs implementation");
|
||||
return reinterpret_cast<HMENU>(0x1234);
|
||||
}
|
||||
|
||||
inline VOID WINAPI Sleep(DWORD dwMilliseconds)
|
||||
{
|
||||
}
|
||||
|
||||
inline HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
51
util/miniwin_d3d.h
Normal file
51
util/miniwin_d3d.h
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "miniwin_ddraw.h"
|
||||
|
||||
// --- Defines and Macros ---
|
||||
#define D3DPAL_RESERVED 0x00000000
|
||||
#define D3DPAL_READONLY 0x00000001
|
||||
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001
|
||||
#define D3DDD_DEVICEZBUFFERBITDEPTH 32
|
||||
|
||||
// --- Enums ---
|
||||
enum D3DCOLORMODEL {
|
||||
D3DCOLOR_NONE,
|
||||
D3DCOLOR_RGB,
|
||||
D3DCOLOR_MONO
|
||||
};
|
||||
|
||||
// --- GUIDs ---
|
||||
DEFINE_GUID(IID_IDirect3D2, 0x6aae1ec1, 0x662a, 0x11cf, 0x9a, 0x39, 0x00, 0xaa, 0x00, 0x6e, 0xf5, 0x5a);
|
||||
|
||||
// --- Structs ---
|
||||
struct D3DVECTOR {
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
struct D3DDEVICEDESC {
|
||||
DWORD dwFlags;
|
||||
DWORD dwDeviceZBufferBitDepth;
|
||||
D3DCOLORMODEL dcmColorModel;
|
||||
DWORD dwDeviceRenderBitDepth;
|
||||
struct {
|
||||
DWORD dwShadeCaps;
|
||||
DWORD dwTextureCaps;
|
||||
DWORD dwTextureFilterCaps;
|
||||
} dpcTriCaps;
|
||||
};
|
||||
typedef D3DDEVICEDESC* LPD3DDEVICEDESC;
|
||||
|
||||
struct IDirect3DDevice2 : public IUnknown {};
|
||||
|
||||
typedef HRESULT (*LPD3DENUMDEVICESCALLBACK)(LPGUID, LPSTR, LPSTR, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
|
||||
struct IDirect3D2 {
|
||||
virtual ULONG AddRef() { return 0; }
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual HRESULT CreateDevice(const GUID& guid, void* pBackBuffer, IDirect3DDevice2** ppDirect3DDevice)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK cb, void* ctx) { return S_OK; };
|
||||
};
|
||||
typedef IDirect3D2* LPDIRECT3D2;
|
||||
378
util/miniwin_d3drm.h
Normal file
378
util/miniwin_d3drm.h
Normal file
@ -0,0 +1,378 @@
|
||||
#pragma once
|
||||
|
||||
#include "miniwin_d3d.h"
|
||||
|
||||
// --- Defines and Macros ---
|
||||
#define D3DRM_OK DD_OK
|
||||
#define MAXSHORT ((short) 0x7fff)
|
||||
#define SUCCEEDED(hr) ((hr) >= D3DRM_OK)
|
||||
#define D3DPTFILTERCAPS_LINEAR 0x00000001
|
||||
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00000100
|
||||
|
||||
// --- Typedefs ---
|
||||
typedef DWORD D3DRMMAPPING, *LPD3DRMMAPPING;
|
||||
typedef float D3DVAL;
|
||||
typedef void* LPD3DRM_APPDATA;
|
||||
typedef unsigned long D3DRMGROUPINDEX;
|
||||
typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
|
||||
typedef DWORD D3DCOLOR, *LPD3DCOLOR;
|
||||
typedef float D3DVALUE, *LPD3DVALUE;
|
||||
|
||||
// --- Enums ---
|
||||
enum D3DRMCOMBINETYPE {
|
||||
D3DRMCOMBINE_REPLACE,
|
||||
D3DRMCOMBINE_BEFORE,
|
||||
D3DRMCOMBINE_AFTER
|
||||
};
|
||||
typedef D3DRMCOMBINETYPE* LPD3DRMCOMBINETYPE;
|
||||
|
||||
enum D3DRMPALETTEFLAGS {
|
||||
D3DRMPALETTE_READONLY
|
||||
};
|
||||
typedef D3DRMPALETTEFLAGS* LPD3DRMPALETTEFLAGS;
|
||||
|
||||
enum D3DRMTEXTUREQUALITY {
|
||||
D3DRMTEXTURE_NEAREST,
|
||||
D3DRMTEXTURE_LINEAR,
|
||||
D3DRMTEXTURE_MIPNEAREST,
|
||||
D3DRMTEXTURE_MIPLINEAR,
|
||||
D3DRMTEXTURE_LINEARMIPNEAREST,
|
||||
D3DRMTEXTURE_LINEARMIPLINEAR
|
||||
};
|
||||
typedef D3DRMTEXTUREQUALITY* LPD3DRMTEXTUREQUALITY;
|
||||
|
||||
enum D3DRMRENDERMODE {
|
||||
D3DRMRENDERMODE_BLENDEDTRANSPARENCY
|
||||
};
|
||||
|
||||
enum D3DRMMappingFlag {
|
||||
D3DRMMAP_WRAPU = 1,
|
||||
D3DRMMAP_WRAPV = 2,
|
||||
D3DRMMAP_PERSPCORRECT = 4
|
||||
};
|
||||
|
||||
enum D3DRMLIGHTTYPE {
|
||||
D3DRMLIGHT_AMBIENT,
|
||||
D3DRMLIGHT_POINT,
|
||||
D3DRMLIGHT_SPOT,
|
||||
D3DRMLIGHT_DIRECTIONAL,
|
||||
D3DRMLIGHT_PARALLELPOINT
|
||||
};
|
||||
typedef D3DRMLIGHTTYPE* LPD3DRMLIGHTTYPE;
|
||||
|
||||
enum D3DRMMATERIALMODE {
|
||||
D3DRMMATERIAL_FROMPARENT,
|
||||
D3DRMMATERIAL_FROMFRAME,
|
||||
D3DRMMATERIAL_FROMMESH
|
||||
};
|
||||
|
||||
enum D3DRMRenderMode {
|
||||
D3DRMRENDER_WIREFRAME = 0,
|
||||
D3DRMRENDER_UNLITFLAT = 1,
|
||||
D3DRMRENDER_FLAT = 2,
|
||||
D3DRMRENDER_GOURAUD = 4,
|
||||
D3DRMRENDER_PHONG = 8
|
||||
};
|
||||
|
||||
enum D3DRMPROJECTIONTYPE {
|
||||
D3DRMPROJECT_PERSPECTIVE,
|
||||
D3DRMPROJECT_ORTHOGRAPHIC
|
||||
};
|
||||
typedef D3DRMPROJECTIONTYPE* LPD3DRMPROJECTIONTYPE;
|
||||
|
||||
// --- GUIDs ---
|
||||
DEFINE_GUID(IID_IDirect3DRM2, 0x4516ec41, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
|
||||
DEFINE_GUID(IID_IDirect3DRMWinDevice, 0x0eb16e60, 0xcbf4, 0x11cf, 0xa5, 0x3c, 0x00, 0x20, 0xaf, 0x70, 0x7e, 0xfd);
|
||||
DEFINE_GUID(IID_IDirect3DRMMesh, 0x4516ec78, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
|
||||
DEFINE_GUID(IID_IDirect3DRMMeshBuilder, 0x4516ec7b, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
|
||||
DEFINE_GUID(IID_IDirect3DRMTexture2, 0x120f30c0, 0x1629, 0x11d1, 0x94, 0x26, 0x00, 0x60, 0x97, 0x0c, 0xf4, 0x0d);
|
||||
|
||||
// --- Structs ---
|
||||
typedef struct D3DRMVECTOR4D {
|
||||
float x, y, z, w;
|
||||
} D3DRMVECTOR4D;
|
||||
|
||||
typedef struct D3DRMPALETTEENTRY {
|
||||
unsigned char red, green, blue, flags;
|
||||
} D3DRMPALETTEENTRY;
|
||||
|
||||
typedef struct D3DRMIMAGE {
|
||||
unsigned int width, height, depth, bytes_per_line;
|
||||
unsigned int red_mask, green_mask, blue_mask, alpha_mask;
|
||||
unsigned int palette_size;
|
||||
D3DRMPALETTEENTRY* palette;
|
||||
void* buffer1;
|
||||
void* buffer2;
|
||||
void* data;
|
||||
int rgb;
|
||||
int aspectx, aspecty;
|
||||
unsigned int format;
|
||||
} D3DRMIMAGE;
|
||||
|
||||
typedef struct D3DRMMATRIX4D {
|
||||
double* operator[](size_t i) { return 0; }
|
||||
const double* operator[](size_t i) const { return 0; }
|
||||
} D3DRMMATRIX4D;
|
||||
|
||||
struct D3DRMBOX {
|
||||
D3DVECTOR min;
|
||||
D3DVECTOR max;
|
||||
};
|
||||
|
||||
struct D3DRMVERTEX {
|
||||
D3DVECTOR position;
|
||||
D3DVECTOR normal;
|
||||
float tu, tv;
|
||||
};
|
||||
|
||||
struct IDirect3DRMVisual : public IUnknown {};
|
||||
typedef IDirect3DRMVisual* LPDIRECT3DRMVISUAL;
|
||||
|
||||
struct IDirect3DRMObject : public IUnknown {
|
||||
virtual HRESULT Clone(void** ppObject) { return DDERR_GENERIC; }
|
||||
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
|
||||
virtual HRESULT DeleteDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
|
||||
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
|
||||
virtual DWORD GetAppData() = 0;
|
||||
virtual HRESULT SetName(const char* name) { return D3DRM_OK; }
|
||||
virtual HRESULT GetName(DWORD* size, char* name) { return D3DRM_OK; }
|
||||
virtual HRESULT GetClassName(DWORD* size, char* name) { return D3DRM_OK; }
|
||||
};
|
||||
struct IDirect3DRMTexture : public IUnknown {
|
||||
virtual HRESULT AddDestroyCallback(void (*cb)(IDirect3DRMObject*, void*), void* arg) { return D3DRM_OK; }
|
||||
virtual DWORD GetAppData() { return 0; }
|
||||
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
|
||||
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) { return D3DRM_OK; }
|
||||
virtual HRESULT Changed(BOOL arg1, BOOL arg2) { return D3DRM_OK; }
|
||||
};
|
||||
typedef IDirect3DRMTexture* LPDIRECT3DRMTEXTURE;
|
||||
|
||||
struct IDirect3DRMTexture2 : public IDirect3DRMTexture {};
|
||||
typedef IDirect3DRMTexture2* LPDIRECT3DRMTEXTURE2;
|
||||
|
||||
typedef struct IDirect3DRMMaterial *LPDIRECT3DRMMATERIAL, **LPLPDIRECT3DRMMATERIAL;
|
||||
|
||||
struct IDirect3DRMMesh {
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual HRESULT Clone(int flags, GUID iid, void** object) { return DDERR_GENERIC; }
|
||||
virtual HRESULT GetBox(D3DRMBOX* box) { return D3DRM_OK; }
|
||||
virtual HRESULT AddGroup(
|
||||
int vertexCount,
|
||||
int faceCount,
|
||||
int vertexPerFace,
|
||||
void* faceBuffer,
|
||||
D3DRMGROUPINDEX* groupIndex
|
||||
)
|
||||
{
|
||||
return D3DRM_OK;
|
||||
}
|
||||
virtual HRESULT GetGroup(
|
||||
int groupIndex,
|
||||
unsigned int* vertexCount,
|
||||
unsigned int* faceCount,
|
||||
unsigned int* vertexPerFace,
|
||||
DWORD* dataSize,
|
||||
unsigned int* data
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT SetGroupColor(int groupIndex, D3DCOLOR color) { return D3DRM_OK; }
|
||||
virtual HRESULT SetGroupColorRGB(int groupIndex, float r, float g, float b) { return D3DRM_OK; }
|
||||
virtual HRESULT SetGroupTexture(int groupIndex, const IDirect3DRMTexture* texture) { return D3DRM_OK; }
|
||||
virtual HRESULT SetGroupMaterial(int groupIndex, IDirect3DRMMaterial* material) { return D3DRM_OK; }
|
||||
virtual HRESULT SetGroupMapping(int groupIndex, int mapping) { return D3DRM_OK; }
|
||||
virtual HRESULT SetGroupQuality(int groupIndex, D3DRMRENDERQUALITY quality) { return D3DRM_OK; }
|
||||
virtual HRESULT SetVertices(int groupIndex, int offset, int count, D3DRMVERTEX* vertices) { return D3DRM_OK; }
|
||||
virtual HRESULT GetGroupTexture(int groupIndex, LPDIRECT3DRMTEXTURE* texture) { return DDERR_GENERIC; }
|
||||
virtual HRESULT GetGroupMapping(int groupIndex) { return D3DRM_OK; }
|
||||
virtual HRESULT GetGroupQuality(int groupIndex) { return D3DRM_OK; }
|
||||
virtual HRESULT GetGroupColor(D3DRMGROUPINDEX index) { return D3DRM_OK; }
|
||||
virtual HRESULT GetVertices(int groupIndex, int startIndex, int count, D3DRMVERTEX* vertices) { return D3DRM_OK; }
|
||||
};
|
||||
|
||||
struct IDirect3DRMLight {
|
||||
virtual ULONG AddRef() { return 0; }
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual HRESULT SetColorRGB(float r, float g, float b) { return D3DRM_OK; }
|
||||
};
|
||||
|
||||
struct IDirect3DRMLightArray {
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual DWORD GetSize() { return 0; }
|
||||
virtual HRESULT GetElement(int index, IDirect3DRMLight** light) const { return DDERR_GENERIC; }
|
||||
};
|
||||
|
||||
struct IDirect3DRMVisualArray {
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual DWORD GetSize() { return 0; }
|
||||
virtual HRESULT GetElement(int index, IDirect3DRMVisual** visual) const { return DDERR_GENERIC; }
|
||||
};
|
||||
|
||||
typedef struct IDirect3DRMFrameArray* LPDIRECT3DRMFRAMEARRAY;
|
||||
struct IDirect3DRMFrame {
|
||||
virtual ULONG AddRef() { return 0; }
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual HRESULT SetAppData(LPD3DRM_APPDATA appData) { return D3DRM_OK; }
|
||||
virtual DWORD GetAppData() { return 0; }
|
||||
virtual HRESULT AddChild(IDirect3DRMFrame* child) { return D3DRM_OK; }
|
||||
virtual HRESULT DeleteChild(IDirect3DRMFrame* child) { return D3DRM_OK; }
|
||||
virtual HRESULT SetSceneBackgroundRGB(float r, float g, float b) { return D3DRM_OK; }
|
||||
virtual HRESULT AddLight(IDirect3DRMLight* light) { return D3DRM_OK; }
|
||||
virtual HRESULT GetLights(IDirect3DRMLightArray** lightArray) { return DDERR_GENERIC; }
|
||||
virtual HRESULT AddTransform(int combine, D3DRMMATRIX4D matrix) { return D3DRM_OK; }
|
||||
virtual HRESULT GetPosition(int index, D3DVECTOR* position) { return D3DRM_OK; }
|
||||
virtual HRESULT AddVisual(IDirect3DRMVisual* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT DeleteVisual(IDirect3DRMVisual* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT AddVisual(IDirect3DRMMesh* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT DeleteVisual(IDirect3DRMMesh* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT AddVisual(IDirect3DRMFrame* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT DeleteVisual(IDirect3DRMFrame* visual) { return D3DRM_OK; }
|
||||
virtual HRESULT GetVisuals(IDirect3DRMVisualArray** visuals) { return DDERR_GENERIC; }
|
||||
virtual HRESULT SetTexture(const IDirect3DRMTexture* texture) { return D3DRM_OK; }
|
||||
virtual HRESULT GetTexture(IDirect3DRMTexture** texture) { return DDERR_GENERIC; }
|
||||
virtual HRESULT SetColor(float r, float g, float b, float a) { return D3DRM_OK; }
|
||||
virtual HRESULT SetColor(D3DCOLOR) { return D3DRM_OK; }
|
||||
virtual HRESULT SetColorRGB(float r, float g, float b) { return D3DRM_OK; }
|
||||
virtual HRESULT SetMaterialMode(D3DRMMATERIALMODE mode) { return D3DRM_OK; }
|
||||
virtual HRESULT GetChildren(IDirect3DRMFrameArray** children) { return DDERR_GENERIC; }
|
||||
};
|
||||
typedef IDirect3DRMFrame* LPDIRECT3DRMFRAME;
|
||||
|
||||
struct IDirect3DRMFrame2 : public IDirect3DRMFrame {};
|
||||
typedef IDirect3DRMFrame2* LPDIRECT3DRMFRAME2;
|
||||
|
||||
struct IDirect3DRMFrameArray : public IUnknown {
|
||||
virtual DWORD GetSize() { return 0; }
|
||||
virtual HRESULT GetElement(DWORD index, IDirect3DRMFrame** frame) { return DDERR_GENERIC; }
|
||||
};
|
||||
|
||||
struct D3DRMPICKDESC {
|
||||
IDirect3DRMVisual* visual;
|
||||
IDirect3DRMFrame* frame;
|
||||
float dist;
|
||||
};
|
||||
|
||||
struct IDirect3DRMPickedArray {
|
||||
virtual ULONG Release() { return 0; }
|
||||
DWORD GetSize() { return 0; }
|
||||
HRESULT GetPick(DWORD index, IDirect3DRMVisual** visual, IDirect3DRMFrameArray** frameArray, D3DRMPICKDESC* desc)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
};
|
||||
typedef IDirect3DRMPickedArray* LPDIRECT3DRMPICKEDARRAY;
|
||||
|
||||
struct IDirect3DRMViewport : public IDirect3DRMObject {
|
||||
virtual HRESULT Render(IDirect3DRMFrame* group) { return D3DRM_OK; }
|
||||
virtual HRESULT ForceUpdate(int x, int y, int w, int h) { return D3DRM_OK; }
|
||||
virtual HRESULT Clear() { return D3DRM_OK; }
|
||||
virtual HRESULT SetCamera(IDirect3DRMFrame* camera) { return D3DRM_OK; }
|
||||
virtual HRESULT GetCamera(IDirect3DRMFrame** camera) { return DDERR_GENERIC; }
|
||||
virtual HRESULT SetProjection(D3DRMPROJECTIONTYPE type) { return D3DRM_OK; }
|
||||
virtual D3DRMPROJECTIONTYPE GetProjection() { return D3DRMPROJECT_PERSPECTIVE; }
|
||||
virtual HRESULT SetFront(D3DVALUE z) { return D3DRM_OK; }
|
||||
virtual D3DVALUE GetFront() { return 1.0f; }
|
||||
virtual HRESULT SetBack(D3DVALUE z) { return D3DRM_OK; }
|
||||
virtual D3DVALUE GetBack() { return 100.0f; }
|
||||
virtual HRESULT SetField(D3DVALUE field) { return D3DRM_OK; }
|
||||
virtual D3DVALUE GetField() { return 1.0f; }
|
||||
virtual int GetWidth() { return 640; }
|
||||
virtual int GetHeight() { return 480; }
|
||||
virtual HRESULT Transform(D3DRMVECTOR4D* screen, D3DVECTOR* world) { return D3DRM_OK; }
|
||||
virtual HRESULT InverseTransform(D3DVECTOR* world, D3DRMVECTOR4D* screen) { return D3DRM_OK; }
|
||||
virtual HRESULT Pick(float x, float y, LPDIRECT3DRMPICKEDARRAY* pickedArray) { return D3DRM_OK; }
|
||||
};
|
||||
|
||||
struct IDirect3DRMWinDevice : public IUnknown {
|
||||
virtual HRESULT Activate() { return D3DRM_OK; }
|
||||
virtual HRESULT Paint() { return D3DRM_OK; }
|
||||
virtual void HandleActivate(WORD wParam) {}
|
||||
virtual void HandlePaint(void* p_dc) {}
|
||||
};
|
||||
|
||||
struct IDirect3DRMViewportArray {
|
||||
virtual ULONG AddRef() { return 0; }
|
||||
virtual ULONG Release() { return 0; }
|
||||
virtual DWORD GetSize() { return 0; }
|
||||
virtual HRESULT GetElement(int index, IDirect3DRMViewport** viewport) { return DDERR_GENERIC; }
|
||||
};
|
||||
|
||||
struct IDirect3DRMDevice2 : public IUnknown {
|
||||
virtual unsigned long GetWidth() { return 640; }
|
||||
virtual unsigned long GetHeight() { return 480; }
|
||||
virtual HRESULT SetBufferCount(int count) { return D3DRM_OK; }
|
||||
virtual HRESULT GetBufferCount() { return D3DRM_OK; }
|
||||
virtual HRESULT SetShades(unsigned long shadeCount) { return D3DRM_OK; }
|
||||
virtual HRESULT GetShades() { return D3DRM_OK; }
|
||||
virtual HRESULT SetQuality(int quality) { return D3DRM_OK; }
|
||||
virtual HRESULT GetQuality() { return D3DRM_OK; }
|
||||
virtual HRESULT SetDither(int dither) { return D3DRM_OK; }
|
||||
virtual HRESULT GetDither() { return D3DRM_OK; }
|
||||
virtual HRESULT SetTextureQuality(D3DRMTEXTUREQUALITY quality) { return D3DRM_OK; }
|
||||
virtual D3DRMTEXTUREQUALITY GetTextureQuality() { return D3DRMTEXTURE_NEAREST; }
|
||||
virtual HRESULT SetRenderMode(int mode) { return D3DRM_OK; }
|
||||
virtual HRESULT GetRenderMode() { return D3DRM_OK; }
|
||||
virtual HRESULT Update() { return D3DRM_OK; }
|
||||
virtual HRESULT GetViewports(IDirect3DRMViewportArray** ppViewportArray) { return DDERR_GENERIC; }
|
||||
};
|
||||
|
||||
struct IDirect3DRM : public IUnknown {
|
||||
virtual HRESULT CreateDeviceFromD3D(
|
||||
const IDirect3D2* d3d,
|
||||
IDirect3DDevice2* d3dDevice,
|
||||
IDirect3DRMDevice2** outDevice
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreateDeviceFromSurface(
|
||||
const GUID* guid,
|
||||
IDirectDraw* dd,
|
||||
IDirectDrawSurface* surface,
|
||||
IDirect3DRMDevice2** outDevice
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreateTexture(D3DRMIMAGE* image, IDirect3DRMTexture2** outTexture) { return DDERR_GENERIC; }
|
||||
virtual HRESULT CreateTextureFromSurface(LPDIRECTDRAWSURFACE surface, IDirect3DRMTexture2** outTexture)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreateMesh(IDirect3DRMMesh** outMesh) { return DDERR_GENERIC; }
|
||||
virtual HRESULT CreateMaterial(D3DVAL power, IDirect3DRMMaterial** outMaterial) { return DDERR_GENERIC; }
|
||||
virtual HRESULT CreateLightRGB(D3DRMLIGHTTYPE type, D3DVAL r, D3DVAL g, D3DVAL b, IDirect3DRMLight** outLight)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreateFrame(IDirect3DRMFrame* parent, IDirect3DRMFrame2** outFrame) { return DDERR_GENERIC; }
|
||||
virtual HRESULT CreateViewport(
|
||||
IDirect3DRMDevice2* device,
|
||||
IDirect3DRMFrame* camera,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
IDirect3DRMViewport** outViewport
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT SetDefaultTextureShades(unsigned int count) { return D3DRM_OK; }
|
||||
virtual HRESULT SetDefaultTextureColors(unsigned int count) { return D3DRM_OK; }
|
||||
};
|
||||
typedef IDirect3DRM *LPDIRECT3DRM, **LPLPDIRECT3DRM;
|
||||
|
||||
struct IDirect3DRM2 : public IDirect3DRM {};
|
||||
|
||||
// Functions
|
||||
inline HRESULT WINAPI Direct3DRMCreate(IDirect3DRM** direct3DRM)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
|
||||
inline D3DCOLOR D3DRMCreateColorRGBA(D3DVALUE red, D3DVALUE green, D3DVALUE blue, D3DVALUE alpha)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
369
util/miniwin_ddraw.h
Normal file
369
util/miniwin_ddraw.h
Normal file
@ -0,0 +1,369 @@
|
||||
#pragma once
|
||||
|
||||
#include "miniwin.h"
|
||||
|
||||
#define _FACDD 0x876
|
||||
#define DDCKEY_SRCBLT 0x00000001
|
||||
#define DDENUMRET_OK 1
|
||||
#define DDFLIP_WAIT 0x00000004
|
||||
#define DISCL_BACKGROUND 0x00000002
|
||||
#define RASTERCAPS 0x00000000
|
||||
#define PC_NOCOLLAPSE 0x04
|
||||
#define RC_PALETTE 0x00000000
|
||||
#define SIZEPALETTE 256
|
||||
|
||||
// DirectDraw Surface Description flags
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
#define DDSD_WIDTH 0x00000004
|
||||
#define DDSD_BACKBUFFERCOUNT 0x00000010
|
||||
#define DDSD_ZBUFFERBITDEPTH 0x00000040
|
||||
#define DDSD_PIXELFORMAT 0x00001000
|
||||
|
||||
#define DDCAPS_OVERLAYCANTCLIP 0x00001000L
|
||||
#define DDCAPS_OVERLAY 0x20000000L
|
||||
|
||||
#define DDCAPS2_NONLOCALVIDMEM 0x00000004
|
||||
|
||||
#define DDSCAPS_PRIMARYSURFACE 0x00000001
|
||||
#define DDSCAPS_3DDEVICE 0x00000002
|
||||
#define DDSCAPS_BACKBUFFER 0x00000004
|
||||
#define DDSCAPS_VIDEOMEMORY 0x00000008
|
||||
#define DDSCAPS_SYSTEMMEMORY 0x00000010
|
||||
#define DDSCAPS_OFFSCREENPLAIN 0x00000020
|
||||
#define DDSCAPS_FLIP 0x00000040
|
||||
#define DDSCAPS_COMPLEX 0x00000080
|
||||
#define DDSCAPS_ZBUFFER 0x00000100
|
||||
|
||||
#define DDPCAPS_8BIT 0x00000001
|
||||
#define DDPCAPS_INITIALIZE 0x00000002
|
||||
#define DDPCAPS_ALLOW256 0x00000004
|
||||
|
||||
#define DDBLT_KEYSRC 0x00000002
|
||||
#define DDBLT_ROP 0x00000010
|
||||
|
||||
#define DDPF_PALETTEINDEXED8 0x00000020
|
||||
#define DDPF_RGB 0x00000040
|
||||
|
||||
#define DDBLTFAST_SRCCOLORKEY 0x00000001
|
||||
#define DDBLTFAST_WAIT 0x00000010
|
||||
|
||||
#define DDLOCK_WAIT 0x00000001L
|
||||
#define DDLOCK_SURFACEMEMORYPTR 0x00000002L
|
||||
|
||||
#define DDBD_8 0x00000001
|
||||
#define DDBD_16 0x00000002
|
||||
#define DDBD_24 0x00000004
|
||||
#define DDBD_32 0x00000005
|
||||
|
||||
#define DDSCL_NORMAL 0x00000000
|
||||
#define DDSCL_FULLSCREEN 0x00000001
|
||||
#define DDSCL_EXCLUSIVE 0x00000002
|
||||
#define DDSCL_ALLOWREBOOT 0x00000080
|
||||
|
||||
#define MAKE_HRESULT(sev, fac, code) \
|
||||
((HRESULT) (((uint32_t) (sev) << 31) | ((uint32_t) (fac) << 16) | ((uint32_t) (code))))
|
||||
#define MAKE_DDHRESULT(code) MAKE_HRESULT(1, _FACDD, code)
|
||||
|
||||
#define DD_OK S_OK
|
||||
#define DDERR_SURFACELOST MAKE_DDHRESULT(450)
|
||||
#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT(540)
|
||||
#define DDERR_SURFACEBUSY MAKE_DDHRESULT(430)
|
||||
#define DDERR_ALREADYINITIALIZED MAKE_DDHRESULT(5)
|
||||
#define DDERR_BLTFASTCANTCLIP MAKE_DDHRESULT(574)
|
||||
#define DDERR_CANNOTATTACHSURFACE MAKE_DDHRESULT(10)
|
||||
#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT(20)
|
||||
#define DDERR_CANTCREATEDC MAKE_DDHRESULT(585)
|
||||
#define DDERR_CANTDUPLICATE MAKE_DDHRESULT(583)
|
||||
#define DDERR_CLIPPERISUSINGHWND MAKE_DDHRESULT(567)
|
||||
#define DDERR_COLORKEYNOTSET MAKE_DDHRESULT(400)
|
||||
#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT(40)
|
||||
#define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT(562)
|
||||
#define DDERR_EXCEPTION MAKE_DDHRESULT(55)
|
||||
#define DDERR_EXCLUSIVEMODEALREADYSET MAKE_DDHRESULT(581)
|
||||
#define DDERR_GENERIC MAKE_DDHRESULT(1)
|
||||
#define DDERR_HEIGHTALIGN MAKE_DDHRESULT(90)
|
||||
#define DDERR_HWNDALREADYSET MAKE_DDHRESULT(571)
|
||||
#define DDERR_HWNDSUBCLASSED MAKE_DDHRESULT(570)
|
||||
#define DDERR_IMPLICITLYCREATED MAKE_DDHRESULT(588)
|
||||
#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT(95)
|
||||
#define DDERR_INVALIDCAPS MAKE_DDHRESULT(100)
|
||||
#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT(110)
|
||||
#define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT(561)
|
||||
#define DDERR_INVALIDMODE MAKE_DDHRESULT(120)
|
||||
#define DDERR_INVALIDOBJECT MAKE_DDHRESULT(130)
|
||||
#define DDERR_INVALIDPARAMS MAKE_DDHRESULT(140)
|
||||
#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT(145)
|
||||
#define DDERR_INVALIDPOSITION MAKE_DDHRESULT(579)
|
||||
#define DDERR_INVALIDRECT MAKE_DDHRESULT(150)
|
||||
#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT(160)
|
||||
#define DDERR_NO3D MAKE_DDHRESULT(170)
|
||||
#define DDERR_NOALPHAHW MAKE_DDHRESULT(180)
|
||||
#define DDERR_NOBLTHW MAKE_DDHRESULT(575)
|
||||
#define DDERR_NOCLIPLIST MAKE_DDHRESULT(205)
|
||||
#define DDERR_NOCLIPPERATTACHED MAKE_DDHRESULT(568)
|
||||
#define DDERR_NOCOLORCONVHW MAKE_DDHRESULT(210)
|
||||
#define DDERR_NOCOLORKEYHW MAKE_DDHRESULT(220)
|
||||
#define DDERR_NOCOLORKEY MAKE_DDHRESULT(215)
|
||||
#define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT(212)
|
||||
#define DDERR_NODC MAKE_DDHRESULT(586)
|
||||
#define DDERR_NODDROPSHW MAKE_DDHRESULT(576)
|
||||
#define DDERR_NODIRECTDRAWHW MAKE_DDHRESULT(563)
|
||||
#define DDERR_NOEMULATION MAKE_DDHRESULT(565)
|
||||
#define DDERR_NOEXCLUSIVEMODE MAKE_DDHRESULT(225)
|
||||
#define DDERR_NOFLIPHW MAKE_DDHRESULT(230)
|
||||
#define DDERR_NOGDI MAKE_DDHRESULT(240)
|
||||
#define DDERR_NOHWND MAKE_DDHRESULT(569)
|
||||
#define DDERR_NOMIRRORHW MAKE_DDHRESULT(250)
|
||||
#define DDERR_NOOVERLAYDEST MAKE_DDHRESULT(578)
|
||||
#define DDERR_NOOVERLAYHW MAKE_DDHRESULT(260)
|
||||
#define DDERR_NOPALETTEATTACHED MAKE_DDHRESULT(572)
|
||||
#define DDERR_NOPALETTEHW MAKE_DDHRESULT(573)
|
||||
#define DDERR_NORASTEROPHW MAKE_DDHRESULT(280)
|
||||
#define DDERR_NOROTATIONHW MAKE_DDHRESULT(290)
|
||||
#define DDERR_NOSTRETCHHW MAKE_DDHRESULT(310)
|
||||
#define DDERR_NOT4BITCOLORINDEX MAKE_DDHRESULT(317)
|
||||
#define DDERR_NOT4BITCOLOR MAKE_DDHRESULT(316)
|
||||
#define DDERR_NOT8BITCOLOR MAKE_DDHRESULT(320)
|
||||
#define DDERR_NOTAOVERLAYSURFACE MAKE_DDHRESULT(580)
|
||||
#define DDERR_NOTEXTUREHW MAKE_DDHRESULT(330)
|
||||
#define DDERR_NOTFLIPPABLE MAKE_DDHRESULT(582)
|
||||
#define DDERR_NOTFOUND MAKE_DDHRESULT(255)
|
||||
#define DDERR_NOTLOCKED MAKE_DDHRESULT(584)
|
||||
#define DDERR_NOTPALETTIZED MAKE_DDHRESULT(589)
|
||||
#define DDERR_NOVSYNCHW MAKE_DDHRESULT(335)
|
||||
#define DDERR_NOZBUFFERHW MAKE_DDHRESULT(340)
|
||||
#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT(350)
|
||||
#define DDERR_OUTOFCAPS MAKE_DDHRESULT(360)
|
||||
#define DDERR_OUTOFMEMORY MAKE_DDHRESULT(370)
|
||||
#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT(380)
|
||||
#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT(382)
|
||||
#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT(384)
|
||||
#define DDERR_OVERLAYNOTVISIBLE MAKE_DDHRESULT(577)
|
||||
#define DDERR_PALETTEBUSY MAKE_DDHRESULT(387)
|
||||
#define DDERR_PRIMARYSURFACEALREADYEXISTS MAKE_DDHRESULT(564)
|
||||
#define DDERR_REGIONTOOSMALL MAKE_DDHRESULT(566)
|
||||
#define DDERR_SURFACEALREADYATTACHED MAKE_DDHRESULT(410)
|
||||
#define DDERR_SURFACEALREADYDEPENDENT MAKE_DDHRESULT(420)
|
||||
#define DDERR_SURFACEBUSY MAKE_DDHRESULT(430)
|
||||
#define DDERR_SURFACEISOBSCURED MAKE_DDHRESULT(440)
|
||||
#define DDERR_SURFACELOST MAKE_DDHRESULT(450)
|
||||
#define DDERR_SURFACENOTATTACHED MAKE_DDHRESULT(460)
|
||||
#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT(470)
|
||||
#define DDERR_TOOBIGSIZE MAKE_DDHRESULT(480)
|
||||
#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT(490)
|
||||
#define DDERR_UNSUPPORTED MAKE_DDHRESULT(500)
|
||||
#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT(510)
|
||||
#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT(520)
|
||||
#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT(537)
|
||||
#define DDERR_WASSTILLDRAWING MAKE_DDHRESULT(540)
|
||||
#define DDERR_WRONGMODE MAKE_DDHRESULT(587)
|
||||
#define DDERR_XALIGN MAKE_DDHRESULT(560)
|
||||
|
||||
// --- GUIDs ---
|
||||
DEFINE_GUID(IID_IDirectDraw2, 0x6c14db80, 0x9ecf, 0x11d0, 0xa3, 0x2a, 0x0, 0xa0, 0xc9, 0x0, 0x6, 0x1f);
|
||||
DEFINE_GUID(IID_IDirectDrawSurface3, 0xDA044E0, 0x69B2, 0x11D0, 0xA1, 0xD5, 0x00, 0xAA, 0x00, 0xB8, 0xDF, 0xBB);
|
||||
|
||||
// --- Structs ---
|
||||
struct DDCAPS {
|
||||
DWORD dwSize;
|
||||
DWORD dwCaps;
|
||||
DWORD dwCaps2;
|
||||
DWORD dwSVBRops[8];
|
||||
};
|
||||
typedef DDCAPS* LPDDCAPS;
|
||||
|
||||
struct DDSCAPS {
|
||||
DWORD dwCaps;
|
||||
};
|
||||
typedef struct DDSCAPS* LPDDSCAPS;
|
||||
|
||||
struct DDBLTFX {
|
||||
DWORD dwSize;
|
||||
DWORD dwDDFX;
|
||||
DWORD dwROP;
|
||||
};
|
||||
|
||||
struct DDPIXELFORMAT {
|
||||
DWORD dwSize;
|
||||
DWORD dwFlags;
|
||||
DWORD dwRGBBitCount;
|
||||
DWORD dwRBitMask;
|
||||
DWORD dwYBitMask;
|
||||
DWORD dwGBitMask;
|
||||
DWORD dwBBitMask;
|
||||
};
|
||||
typedef struct DDPIXELFORMAT* LPDDPIXELFORMAT;
|
||||
|
||||
struct DDCOLORKEY {
|
||||
DWORD dwColorSpaceLowValue;
|
||||
DWORD dwColorSpaceHighValue;
|
||||
};
|
||||
typedef DDCOLORKEY* LPDDCOLORKEY;
|
||||
|
||||
struct DDSURFACEDESC {
|
||||
DWORD dwSize;
|
||||
DWORD dwFlags;
|
||||
DWORD dwHeight;
|
||||
DWORD dwWidth;
|
||||
LONG lPitch;
|
||||
DWORD dwBackBufferCount;
|
||||
DWORD dwZBufferBitDepth;
|
||||
LPVOID lpSurface;
|
||||
DDPIXELFORMAT ddpfPixelFormat;
|
||||
DDSCAPS ddsCaps;
|
||||
};
|
||||
typedef struct DDSURFACEDESC* LPDDSURFACEDESC;
|
||||
|
||||
typedef struct IDirectDraw* LPDIRECTDRAW;
|
||||
struct IDirectDrawPalette : public IUnknown {
|
||||
virtual HRESULT GetCaps(LPDWORD lpdwCaps) { return DD_OK; }
|
||||
virtual HRESULT GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable) { return DD_OK; }
|
||||
virtual HRESULT SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
};
|
||||
typedef struct IDirectDrawPalette* LPDIRECTDRAWPALETTE;
|
||||
|
||||
struct IDirectDrawClipper {
|
||||
void Release() {}
|
||||
HRESULT SetHWnd(DWORD unnamedParam1, HWND hWnd) { return DD_OK; }
|
||||
};
|
||||
typedef IDirectDrawClipper* LPDIRECTDRAWCLIPPER;
|
||||
|
||||
typedef void *LPDDBLTFX, *LPDDENUMSURFACESCALLBACK;
|
||||
typedef struct IDirectDrawSurface* LPDIRECTDRAWSURFACE;
|
||||
struct IDirectDrawSurface : public IUnknown {
|
||||
virtual HRESULT AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { return DD_OK; }
|
||||
virtual HRESULT Blt(
|
||||
LPRECT lpDestRect,
|
||||
LPDIRECTDRAWSURFACE lpDDSrcSurface,
|
||||
LPRECT lpSrcRect,
|
||||
DWORD dwFlags,
|
||||
LPDDBLTFX lpDDBltFx
|
||||
)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwTrans)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT DeleteAttachedSurface(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSAttachedSurface) { return DD_OK; }
|
||||
virtual HRESULT Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags) { return DD_OK; }
|
||||
virtual HRESULT GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE* lplpDDAttachedSurface)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT GetCaps(LPDDSCAPS lpDDSCaps) { return DD_OK; }
|
||||
virtual HRESULT GetDC(HDC* lphDC) { return DD_OK; }
|
||||
virtual HRESULT GetOverlayPosition(LPLONG lplX, LPLONG lplY) { return DD_OK; }
|
||||
virtual HRESULT GetPalette(LPDIRECTDRAWPALETTE* lplpDDPalette) { return DDERR_GENERIC; }
|
||||
virtual HRESULT GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat) { return DD_OK; }
|
||||
virtual HRESULT GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; }
|
||||
virtual HRESULT Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; }
|
||||
virtual HRESULT IsLost() { return DD_OK; }
|
||||
virtual HRESULT Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT ReleaseDC(HDC hDC) { return DD_OK; }
|
||||
virtual HRESULT Restore() { return DD_OK; }
|
||||
virtual HRESULT SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper) { return DD_OK; }
|
||||
virtual HRESULT SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey) { return DD_OK; }
|
||||
virtual HRESULT SetPalette(LPDIRECTDRAWPALETTE lpDDPalette) { return DD_OK; }
|
||||
virtual HRESULT Unlock(LPVOID lpSurfaceData) { return DD_OK; }
|
||||
};
|
||||
|
||||
struct IDirectDrawSurface3 : public IDirectDrawSurface {};
|
||||
typedef IDirectDrawSurface3* LPDIRECTDRAWSURFACE3;
|
||||
|
||||
typedef HRESULT (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID);
|
||||
struct IDirectDraw : public IUnknown {
|
||||
virtual HRESULT CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER* lplpDDClipper, IUnknown* pUnkOuter)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreatePalette(
|
||||
DWORD dwFlags,
|
||||
LPPALETTEENTRY lpColorTable,
|
||||
LPDIRECTDRAWPALETTE* lplpDDPalette,
|
||||
IUnknown* pUnkOuter
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT CreateSurface(
|
||||
LPDDSURFACEDESC lpDDSurfaceDesc,
|
||||
LPDIRECTDRAWSURFACE* lplpDDSurface,
|
||||
IUnknown* pUnkOuter
|
||||
)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
virtual HRESULT EnumDisplayModes(
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC lpDDSurfaceDesc,
|
||||
LPVOID lpContext,
|
||||
LPDDENUMMODESCALLBACK lpEnumModesCallback
|
||||
)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT EnumSurfaces(
|
||||
DWORD dwFlags,
|
||||
LPDDSURFACEDESC lpDDSD,
|
||||
LPVOID lpContext,
|
||||
LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback
|
||||
)
|
||||
{
|
||||
return DD_OK;
|
||||
}
|
||||
virtual HRESULT FlipToGDISurface() { return DD_OK; }
|
||||
virtual HRESULT GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps) { return DDERR_GENERIC; }
|
||||
virtual HRESULT GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc) { return DD_OK; }
|
||||
virtual HRESULT Initialize(GUID* lpGUID) { return DD_OK; }
|
||||
virtual HRESULT RestoreDisplayMode() { return DD_OK; }
|
||||
virtual HRESULT SetCooperativeLevel(HWND hWnd, DWORD dwFlags) { return DD_OK; }
|
||||
virtual HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP) { return DD_OK; }
|
||||
};
|
||||
|
||||
struct IDirectDraw2 : public IDirectDraw {};
|
||||
typedef IDirectDraw2* LPDIRECTDRAW2;
|
||||
|
||||
// --- Functions ---
|
||||
inline HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline int SelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline int RealizePalette(HDC hdc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline BOOL ClientToScreen(HWND hWnd, LPPOINT lpPoint)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline HRESULT DirectDrawCreate(LPGUID lpGuid, LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
|
||||
typedef BOOL (*LPDDENUMCALLBACKA)(GUID*, LPSTR, LPSTR, LPVOID);
|
||||
inline HRESULT DirectDrawEnumerate(LPDDENUMCALLBACKA cb, void* context)
|
||||
{
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
6
util/miniwin_dinput.h
Normal file
6
util/miniwin_dinput.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "miniwin.h"
|
||||
|
||||
// --- Typedefs ---
|
||||
typedef struct IDirectInputA* LPDIRECTINPUTA;
|
||||
7
util/miniwin_direct.h
Normal file
7
util/miniwin_direct.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// --- Functions ---
|
||||
int _chdir(char* path)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
18
util/miniwin_process.h
Normal file
18
util/miniwin_process.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
// --- Defines and Macros ---
|
||||
#define _P_NOWAIT 1
|
||||
|
||||
// --- Functions ---
|
||||
intptr_t _spawnl(
|
||||
int mode,
|
||||
const char* cmdname,
|
||||
const char* arg0,
|
||||
const char* arg1,
|
||||
const char* arg2,
|
||||
const char* arg3,
|
||||
...
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
28
util/stdafx.cpp
Normal file
28
util/stdafx.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "../CONFIG/config.h"
|
||||
#include "miniwin.h"
|
||||
|
||||
BOOL CWinApp::InitInstance()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CWinApp::ExitInstance()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
CWinApp::~CWinApp() = default;
|
||||
|
||||
const char* afxCurrentAppName = "";
|
||||
AFX_MODULE_STATE g_CustomModuleState;
|
||||
CWinApp* wndTop;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CConfigApp app;
|
||||
wndTop = &app;
|
||||
if (!app.InitInstance()) {
|
||||
return 1;
|
||||
}
|
||||
return app.ExitInstance();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user