mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-08-03 07:36:20 -04:00
Port CONFIG to Qt (#210)
Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com> Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
This commit is contained in:
parent
b169a4d637
commit
e520a47e2f
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@ -33,13 +33,13 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { name: 'Linux', os: 'ubuntu-latest', dx5: false, build-type: 'Debug', linux: true, werror: true, clang-tidy: true }
|
||||
- { name: 'MSVC (x86)', os: 'windows-latest', dx5: true, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_x86' }
|
||||
- { name: 'MSVC (x64)', os: 'windows-latest', dx5: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64' }
|
||||
- { name: 'MSVC (arm64)', os: 'windows-latest', dx5: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_arm64' }
|
||||
- { name: 'msys2 mingw32', os: 'windows-latest', dx5: false, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' }
|
||||
- { name: 'msys2 mingw64', os: 'windows-latest', dx5: false, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' }
|
||||
- { name: 'macOS', os: 'macos-latest', dx5: false, build-type: 'Debug', brew: true, werror: true, clang-tidy: false }
|
||||
- { name: 'Linux', os: 'ubuntu-latest', dx5: false, config: true, build-type: 'Debug', linux: true, werror: true, clang-tidy: true }
|
||||
- { name: 'MSVC (x86)', os: 'windows-latest', dx5: true, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_x86' }
|
||||
- { name: 'MSVC (x64)', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64' }
|
||||
- { name: 'MSVC (arm64)', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64_arm64' }
|
||||
- { name: 'msys2 mingw32', os: 'windows-latest', dx5: false, config: false, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw32', msys-env: 'mingw-w64-i686', shell: 'msys2 {0}' }
|
||||
- { name: 'msys2 mingw64', os: 'windows-latest', dx5: false, config: true, build-type: 'Debug', mingw: true, werror: true, clang-tidy: true, msystem: 'mingw64', msys-env: 'mingw-w64-x86_64', shell: 'msys2 {0}' }
|
||||
- { name: 'macOS', os: 'macos-latest', dx5: false, config: true, build-type: 'Debug', brew: true, werror: true, clang-tidy: false }
|
||||
steps:
|
||||
- name: Setup vcvars
|
||||
if: ${{ !!matrix.msvc }}
|
||||
@ -57,6 +57,7 @@ jobs:
|
||||
${{ matrix.msys-env }}-cmake
|
||||
${{ matrix.msys-env }}-ninja
|
||||
${{ matrix.msys-env }}-clang-tools-extra
|
||||
${{ (matrix.config && format('{0}-qt6-base', matrix.msys-env)) || '' }}
|
||||
|
||||
- name: Install Linux dependencies (apt-get)
|
||||
if: ${{ matrix.linux }}
|
||||
@ -64,13 +65,13 @@ jobs:
|
||||
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 libgl1-mesa-dev libglew-dev
|
||||
libxcursor-dev libwayland-dev libxkbcommon-dev wayland-protocols libgl1-mesa-dev libglew-dev qt6-base-dev
|
||||
|
||||
- name: Install macOS dependencies (brew)
|
||||
if: ${{ matrix.brew }}
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake ninja llvm
|
||||
brew install cmake ninja llvm qt6
|
||||
echo "LLVM_ROOT=$(brew --prefix llvm)/bin" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup ninja
|
||||
@ -84,6 +85,7 @@ jobs:
|
||||
cmake -S . -B build -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
|
||||
-DISLE_USE_DX5=${{ !!matrix.dx5 }} \
|
||||
-DISLE_BUILD_CONFIG=${{ matrix.config }} \
|
||||
-DENABLE_CLANG_TIDY=${{ !!matrix.clang-tidy }} \
|
||||
-DISLE_WERROR=${{ !!matrix.werror }} \
|
||||
-Werror=dev
|
||||
|
@ -27,7 +27,7 @@ option(ISLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
|
||||
option(ISLE_WERROR "Treat warnings as errors" OFF)
|
||||
option(ISLE_DEBUG "Enable imgui debug" ON)
|
||||
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
|
||||
cmake_dependent_option(ISLE_MINIWIN "Use miniwin and minimfc" ON "NOT ISLE_USE_DX5" OFF)
|
||||
cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF)
|
||||
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN" OFF)
|
||||
cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF)
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON)
|
||||
@ -491,20 +491,23 @@ if (ISLE_BUILD_APP)
|
||||
endif()
|
||||
|
||||
if (ISLE_BUILD_CONFIG)
|
||||
add_executable(config WIN32
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
|
||||
qt_standard_project_setup()
|
||||
qt_add_executable(config WIN32
|
||||
LEGO1/mxdirectx/mxdirectxinfo.cpp
|
||||
LEGO1/mxdirectx/legodxinfo.cpp
|
||||
CONFIG/config.cpp
|
||||
CONFIG/ConfigCommandLineInfo.cpp
|
||||
CONFIG/AboutDlg.cpp
|
||||
CONFIG/MainDlg.cpp
|
||||
CONFIG/detectdx5.cpp
|
||||
CONFIG/StdAfx.cpp
|
||||
CONFIG/res/config.rc
|
||||
CONFIG/res/config.qrc
|
||||
)
|
||||
if (ISLE_MINIWIN)
|
||||
target_link_libraries(config PRIVATE minimfc)
|
||||
endif()
|
||||
target_link_libraries(config PRIVATE Qt6::Core Qt6::Widgets)
|
||||
set_property(TARGET config PROPERTY AUTOMOC ON)
|
||||
set_property(TARGET config PROPERTY AUTORCC ON)
|
||||
set_property(TARGET config PROPERTY AUTOUIC ON)
|
||||
set_property(TARGET config PROPERTY AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/CONFIG/res")
|
||||
list(APPEND isle_targets config)
|
||||
target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
|
||||
target_include_directories(config PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/LEGO1")
|
||||
@ -513,7 +516,7 @@ if (ISLE_BUILD_CONFIG)
|
||||
target_link_libraries(config PRIVATE DirectX5::DirectX5)
|
||||
endif()
|
||||
target_compile_definitions(config PRIVATE DIRECT3D_VERSION=0x500)
|
||||
target_link_libraries(config PRIVATE SDL3::SDL3)
|
||||
target_link_libraries(config PRIVATE SDL3::SDL3 iniparser-static)
|
||||
if (NOT ISLE_MINIWIN)
|
||||
target_link_libraries(config PRIVATE ddraw dxguid)
|
||||
endif()
|
||||
|
@ -2,18 +2,16 @@
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#include <ui_about.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(CDialog, 0x60)
|
||||
DECOMP_SIZE_ASSERT(CAboutDialog, 0x60)
|
||||
|
||||
// FIXME: disable dialog resizing
|
||||
|
||||
// FUNCTION: CONFIG 0x00403c20
|
||||
CAboutDialog::CAboutDialog() : CDialog(IDD)
|
||||
CAboutDialog::CAboutDialog() : QDialog()
|
||||
{
|
||||
m_ui = new Ui::AboutDialog;
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403d20
|
||||
void CAboutDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
@ -1,24 +1,27 @@
|
||||
#if !defined(AFX_ABOUTDLG_H)
|
||||
#define AFX_ABOUTDLG_H
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "compat.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
// VTABLE: CONFIG 0x00406308
|
||||
// SIZE 0x60
|
||||
class CAboutDialog : public CDialog {
|
||||
class CAboutDialog : public QDialog {
|
||||
public:
|
||||
CAboutDialog();
|
||||
enum {
|
||||
IDD = IDD_ABOUT
|
||||
};
|
||||
|
||||
protected:
|
||||
void DoDataExchange(CDataExchange* pDX) override;
|
||||
/*void DoDataExchange(CDataExchange* pDX) override;*/
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
Ui::AboutDialog* m_ui;
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403cb0
|
||||
|
@ -1,22 +0,0 @@
|
||||
#include "ConfigCommandLineInfo.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(CCommandLineInfo, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CConfigCommandLineInfo, 0x24)
|
||||
|
||||
// FUNCTION: CONFIG 0x00403b10
|
||||
CConfigCommandLineInfo::CConfigCommandLineInfo()
|
||||
{
|
||||
currentConfigApp->m_run_config_dialog = FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403bf0
|
||||
void CConfigCommandLineInfo::ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast)
|
||||
{
|
||||
if (bFlag) {
|
||||
if (lstrcmpi(pszParam, "config") == 0) {
|
||||
currentConfigApp->m_run_config_dialog = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#if !defined(AFX_CONFIGCOMMANDLINEINFO_H)
|
||||
#define AFX_CONFIGCOMMANDLINEINFO_H
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#include "decomp.h"
|
||||
|
||||
// VTABLE: CONFIG 0x004060e8
|
||||
// SIZE 0x24
|
||||
class CConfigCommandLineInfo : public CCommandLineInfo {
|
||||
public:
|
||||
CConfigCommandLineInfo();
|
||||
|
||||
void ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast) override;
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403b80
|
||||
// CConfigCommandLineInfo::`scalar deleting destructor'
|
||||
|
||||
#endif // !defined(AFX_CONFIGCOMMANDLINEINFO_H)
|
@ -10,63 +10,70 @@
|
||||
#include "config.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <mxdirectx/legodxinfo.h>
|
||||
#include <ui_maindialog.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(CDialog, 0x60)
|
||||
DECOMP_SIZE_ASSERT(CMainDialog, 0x70)
|
||||
|
||||
// FIXME: disable dialog resizing
|
||||
// FIXME: advanced mode should resize dialog, ignoring advanced controls
|
||||
// FIXME: list widget should have less rows
|
||||
|
||||
// FUNCTION: CONFIG 0x00403d50
|
||||
CMainDialog::CMainDialog(CWnd* pParent) : CDialog(IDD, pParent)
|
||||
CMainDialog::CMainDialog(QWidget* pParent) : QDialog(pParent)
|
||||
{
|
||||
afxCurrentWinApp;
|
||||
m_icon = LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(IDI_CONFIG), RT_GROUP_ICON), MAKEINTRESOURCE(IDI_CONFIG));
|
||||
m_ui = new Ui::MainDialog;
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// Populate the dialog prior to connecting all signals
|
||||
OnInitDialog();
|
||||
|
||||
connect(m_ui->colorPalette16bitRadioButton, &QRadioButton::toggled, this, &CMainDialog::OnRadiobuttonPalette16bit);
|
||||
connect(m_ui->colorPalette256RadioButton, &QRadioButton::toggled, this, &CMainDialog::OnRadiobuttonPalette256);
|
||||
connect(
|
||||
m_ui->modelQualityFastRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadiobuttonModelLowQuality
|
||||
);
|
||||
connect(
|
||||
m_ui->modelQualityHighRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadiobuttonModelHighQuality
|
||||
);
|
||||
connect(
|
||||
m_ui->textureQualityFastRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadiobuttonTextureLowQuality
|
||||
);
|
||||
connect(
|
||||
m_ui->textureQualityHighRadioButton,
|
||||
&QRadioButton::toggled,
|
||||
this,
|
||||
&CMainDialog::OnRadiobuttonTextureHighQuality
|
||||
);
|
||||
connect(m_ui->devicesList, &QListWidget::currentRowChanged, this, &CMainDialog::OnList3DevicesSelectionChanged);
|
||||
connect(m_ui->musicCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxMusic);
|
||||
connect(m_ui->drawCursorCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxDrawCursor);
|
||||
connect(m_ui->videomemoryCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DVideoMemory);
|
||||
connect(m_ui->flipVideoMemoryPagesCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxFlipVideoMemPages);
|
||||
connect(m_ui->sound3DCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckbox3DSound);
|
||||
connect(m_ui->joystickCheckBox, &QCheckBox::toggled, this, &CMainDialog::OnCheckboxJoystick);
|
||||
connect(m_ui->okButton, &QPushButton::clicked, this, &CMainDialog::accept);
|
||||
connect(m_ui->cancelButton, &QPushButton::clicked, this, &CMainDialog::reject);
|
||||
connect(m_ui->advancedButton, &QPushButton::clicked, this, &CMainDialog::OnButtonAdvanced);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403e50
|
||||
void CMainDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainDialog, CDialog)
|
||||
ON_WM_SYSCOMMAND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_COMMAND(IDC_CHK_FLIP_VIDEO_MEM_PAGES, OnCheckboxFlipVideoMemPages)
|
||||
ON_LBN_SELCHANGE(IDC_LIST_3DDEVICES, OnList3DevicesSelectionChanged)
|
||||
ON_COMMAND(IDC_RAD_PALETTE_16BIT, OnRadiobuttonPalette16bit)
|
||||
ON_COMMAND(IDC_RAD_PALETTE_256, OnRadiobuttonPalette256)
|
||||
ON_COMMAND(IDC_CHK_3D_VIDEO_MEMORY, OnCheckbox3DVideoMemory)
|
||||
ON_WM_DESTROY() // FIXME: CONFIG.EXE calls Default
|
||||
ON_COMMAND(IDABORT, OnButtonCancel)
|
||||
ON_COMMAND(IDC_CHK_3DSOUND, OnCheckbox3DSound)
|
||||
ON_COMMAND(IDC_RAD_MODEL_QUALITY_LOW, OnRadiobuttonModelLowQuality)
|
||||
ON_COMMAND(IDC_RAD_MODEL_QUALITY_HIGH, OnRadiobuttonModelHighQuality)
|
||||
ON_COMMAND(IDC_RAD_TEXTURE_QUALITY_LOW, OnRadiobuttonTextureLowQuality)
|
||||
ON_COMMAND(IDC_RAD_TEXTURE_QUALITY_HIGH, OnRadiobuttonTextureHighQuality)
|
||||
ON_COMMAND(IDC_CHK_JOYSTICK, OnCheckboxJoystick)
|
||||
ON_COMMAND(IDC_BTN_ADVANCED, OnButtonAdvanced)
|
||||
ON_COMMAND(IDC_CHK_DRAW_CURSOR, OnCheckboxDrawCursor)
|
||||
ON_COMMAND(IDC_CHK_MUSIC, OnCheckboxMusic)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// FUNCTION: CONFIG 0x00403e80
|
||||
BOOL CMainDialog::OnInitDialog()
|
||||
bool CMainDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
SwitchToAdvanced(FALSE);
|
||||
CMenu* system_menu = CMenu::FromHandle(::GetSystemMenu(m_hWnd, FALSE));
|
||||
CString about_text;
|
||||
about_text.LoadString(IDS_ABOUT);
|
||||
if (system_menu) {
|
||||
AppendMenu(system_menu->m_hMenu, MF_SEPARATOR, 0, NULL);
|
||||
AppendMenu(system_menu->m_hMenu, MF_STRING, 16, (LPCTSTR) about_text);
|
||||
}
|
||||
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) m_icon);
|
||||
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) m_icon);
|
||||
SwitchToAdvanced(false);
|
||||
LegoDeviceEnumerate* enumerator = currentConfigApp->m_device_enumerator;
|
||||
enumerator->FUN_1009d210();
|
||||
m_modified = currentConfigApp->ReadRegisterSettings();
|
||||
CWnd* list_3d_devices = GetDlgItem(IDC_LIST_3DDEVICES);
|
||||
int driver_i = 0;
|
||||
int device_i = 0;
|
||||
int selected = 0;
|
||||
@ -84,227 +91,214 @@ BOOL CMainDialog::OnInitDialog()
|
||||
device_i += 1;
|
||||
sprintf(
|
||||
device_name,
|
||||
driver_i == 0 ? "%s ( Primary Device )" : "%s ( Secondary Device )",
|
||||
device.m_deviceName
|
||||
"%s [%s] ( %s )",
|
||||
device.m_deviceDesc,
|
||||
device.m_deviceName,
|
||||
driver_i == 0 ? "Primary Device" : "Secondary Device"
|
||||
);
|
||||
::SendMessage(list_3d_devices->m_hWnd, LB_ADDSTRING, 0, (LPARAM) device_name);
|
||||
m_ui->devicesList->addItem(device_name);
|
||||
}
|
||||
driver_i += 1;
|
||||
}
|
||||
::SendMessage(list_3d_devices->m_hWnd, LB_SETCURSEL, selected, 0);
|
||||
m_ui->devicesList->setCurrentRow(selected);
|
||||
UpdateInterface();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404080
|
||||
void CMainDialog::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
void CMainDialog::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
if ((nID & 0xfff0) == 0x10) {
|
||||
if (event->matches(QKeySequence::StandardKey::HelpContents)) {
|
||||
CAboutDialog about_dialog;
|
||||
about_dialog.DoModal();
|
||||
about_dialog.exec();
|
||||
}
|
||||
else {
|
||||
Default();
|
||||
QDialog::keyReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404150
|
||||
void CMainDialog::OnPaint()
|
||||
{
|
||||
if (IsIconic()) {
|
||||
CPaintDC painter(this);
|
||||
::SendMessage(m_hWnd, WM_ICONERASEBKGND, (WPARAM) painter.m_hDC, 0);
|
||||
RECT dim;
|
||||
GetClientRect(&dim);
|
||||
DrawIcon(
|
||||
painter.m_hDC,
|
||||
(dim.right - dim.left - GetSystemMetrics(SM_CXICON) + 1) / 2,
|
||||
(dim.bottom - dim.top - GetSystemMetrics(SM_CYICON) + 1) / 2,
|
||||
m_icon
|
||||
);
|
||||
}
|
||||
else {
|
||||
Default();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404230
|
||||
HCURSOR CMainDialog::OnQueryDragIcon()
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404240
|
||||
void CMainDialog::OnList3DevicesSelectionChanged()
|
||||
void CMainDialog::OnList3DevicesSelectionChanged(int selected)
|
||||
{
|
||||
LegoDeviceEnumerate* device_enumerator = currentConfigApp->m_device_enumerator;
|
||||
int selected = ::SendMessage(GetDlgItem(IDC_LIST_3DDEVICES)->m_hWnd, LB_GETCURSEL, 0, 0);
|
||||
device_enumerator->GetDevice(selected, currentConfigApp->m_driver, currentConfigApp->m_device);
|
||||
if (currentConfigApp->GetHardwareDeviceColorModel() != D3DCOLOR_NONE) {
|
||||
GetDlgItem(IDC_CHK_DRAW_CURSOR)->EnableWindow(TRUE);
|
||||
m_ui->drawCursorCheckBox->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
currentConfigApp->m_3d_video_ram = FALSE;
|
||||
currentConfigApp->m_flip_surfaces = FALSE;
|
||||
CheckDlgButton(IDC_CHK_3D_VIDEO_MEMORY, currentConfigApp->m_3d_video_ram);
|
||||
CheckDlgButton(IDC_CHK_FLIP_VIDEO_MEM_PAGES, currentConfigApp->m_flip_surfaces);
|
||||
m_ui->videomemoryCheckBox->setChecked(currentConfigApp->m_3d_video_ram);
|
||||
m_ui->flipVideoMemoryPagesCheckBox->setChecked(currentConfigApp->m_flip_surfaces);
|
||||
}
|
||||
m_modified = TRUE;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404320
|
||||
void CMainDialog::OnCancel()
|
||||
{
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404330
|
||||
void CMainDialog::OnDestroy()
|
||||
{
|
||||
CDialog::Default();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404340
|
||||
void CMainDialog::OnButtonCancel()
|
||||
void CMainDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
}
|
||||
|
||||
void CMainDialog::accept()
|
||||
{
|
||||
if (m_modified) {
|
||||
currentConfigApp->WriteRegisterSettings();
|
||||
}
|
||||
OnCancel();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404360
|
||||
void CMainDialog::UpdateInterface()
|
||||
{
|
||||
currentConfigApp->ValidateSettings();
|
||||
GetDlgItem(IDC_CHK_3D_VIDEO_MEMORY)
|
||||
->EnableWindow(
|
||||
!currentConfigApp->m_flip_surfaces && currentConfigApp->GetHardwareDeviceColorModel() == D3DCOLOR_NONE
|
||||
);
|
||||
CheckDlgButton(IDC_CHK_FLIP_VIDEO_MEM_PAGES, currentConfigApp->m_flip_surfaces);
|
||||
CheckDlgButton(IDC_CHK_3D_VIDEO_MEMORY, currentConfigApp->m_3d_video_ram);
|
||||
BOOL full_screen = currentConfigApp->m_full_screen;
|
||||
m_ui->videomemoryCheckBox->setEnabled(
|
||||
!currentConfigApp->m_flip_surfaces && currentConfigApp->GetHardwareDeviceColorModel() == D3DCOLOR_NONE
|
||||
);
|
||||
m_ui->flipVideoMemoryPagesCheckBox->setChecked(currentConfigApp->m_flip_surfaces);
|
||||
m_ui->videomemoryCheckBox->setChecked(currentConfigApp->m_3d_video_ram);
|
||||
bool full_screen = currentConfigApp->m_full_screen;
|
||||
currentConfigApp->AdjustDisplayBitDepthBasedOnRenderStatus();
|
||||
if (currentConfigApp->GetHardwareDeviceColorModel() != D3DCOLOR_NONE) {
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, TRUE);
|
||||
m_ui->drawCursorCheckBox->setChecked(true);
|
||||
}
|
||||
else {
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, FALSE);
|
||||
m_ui->drawCursorCheckBox->setChecked(false);
|
||||
currentConfigApp->m_draw_cursor = FALSE;
|
||||
GetDlgItem(IDC_CHK_DRAW_CURSOR)->EnableWindow(FALSE);
|
||||
m_ui->drawCursorCheckBox->setEnabled(false);
|
||||
}
|
||||
if (full_screen) {
|
||||
CheckRadioButton(
|
||||
IDC_RAD_PALETTE_256,
|
||||
IDC_RAD_PALETTE_16BIT,
|
||||
currentConfigApp->m_display_bit_depth == 8 ? IDC_RAD_PALETTE_256 : IDC_RAD_PALETTE_16BIT
|
||||
);
|
||||
if (currentConfigApp->m_display_bit_depth == 8) {
|
||||
m_ui->colorPalette256RadioButton->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_ui->colorPalette16bitRadioButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
CheckDlgButton(IDC_RAD_PALETTE_256, 0);
|
||||
CheckDlgButton(IDC_RAD_PALETTE_16BIT, 0);
|
||||
m_ui->colorPalette256RadioButton->setChecked(false);
|
||||
m_ui->colorPalette256RadioButton->setChecked(false);
|
||||
currentConfigApp->m_display_bit_depth = 0;
|
||||
}
|
||||
GetDlgItem(IDC_RAD_PALETTE_256)
|
||||
->EnableWindow(full_screen && currentConfigApp->GetConditionalDeviceRenderBitDepth());
|
||||
GetDlgItem(IDC_RAD_PALETTE_16BIT)->EnableWindow(full_screen && currentConfigApp->GetDeviceRenderBitStatus());
|
||||
CheckDlgButton(IDC_CHK_3DSOUND, currentConfigApp->m_3d_sound);
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, currentConfigApp->m_draw_cursor);
|
||||
m_ui->colorPalette256RadioButton->setEnabled(full_screen && currentConfigApp->GetConditionalDeviceRenderBitDepth());
|
||||
m_ui->colorPalette16bitRadioButton->setEnabled(full_screen && currentConfigApp->GetDeviceRenderBitStatus());
|
||||
m_ui->sound3DCheckBox->setChecked(currentConfigApp->m_3d_sound);
|
||||
m_ui->drawCursorCheckBox->setChecked(currentConfigApp->m_draw_cursor);
|
||||
switch (currentConfigApp->m_model_quality) {
|
||||
case 1:
|
||||
CheckRadioButton(IDC_RAD_MODEL_QUALITY_LOW, IDC_RAD_MODEL_QUALITY_HIGH, IDC_RAD_MODEL_QUALITY_LOW);
|
||||
m_ui->modelQualityFastRadioButton->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
CheckRadioButton(IDC_RAD_MODEL_QUALITY_LOW, IDC_RAD_MODEL_QUALITY_HIGH, IDC_RAD_MODEL_QUALITY_HIGH);
|
||||
m_ui->modelQualityHighRadioButton->setChecked(true);
|
||||
break;
|
||||
}
|
||||
CheckRadioButton(
|
||||
IDC_RAD_TEXTURE_QUALITY_LOW,
|
||||
IDC_RAD_TEXTURE_QUALITY_HIGH,
|
||||
currentConfigApp->m_texture_quality == 0 ? IDC_RAD_TEXTURE_QUALITY_LOW : IDC_RAD_TEXTURE_QUALITY_HIGH
|
||||
);
|
||||
CheckDlgButton(IDC_CHK_JOYSTICK, currentConfigApp->m_use_joystick);
|
||||
CheckDlgButton(IDC_CHK_MUSIC, currentConfigApp->m_music);
|
||||
if (currentConfigApp->m_texture_quality == 0) {
|
||||
m_ui->textureQualityFastRadioButton->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_ui->textureQualityHighRadioButton->setChecked(true);
|
||||
}
|
||||
m_ui->joystickCheckBox->setChecked(currentConfigApp->m_use_joystick);
|
||||
m_ui->musicCheckBox->setChecked(currentConfigApp->m_music);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004045e0
|
||||
void CMainDialog::OnCheckbox3DSound()
|
||||
void CMainDialog::OnCheckbox3DSound(bool checked)
|
||||
{
|
||||
currentConfigApp->m_3d_sound = IsDlgButtonChecked(IDC_CHK_3DSOUND);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_3d_sound = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404610
|
||||
void CMainDialog::OnCheckbox3DVideoMemory()
|
||||
void CMainDialog::OnCheckbox3DVideoMemory(bool checked)
|
||||
{
|
||||
currentConfigApp->m_3d_video_ram = IsDlgButtonChecked(IDC_CHK_3D_VIDEO_MEMORY);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_3d_video_ram = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404640
|
||||
void CMainDialog::OnRadiobuttonPalette16bit()
|
||||
void CMainDialog::OnRadiobuttonPalette16bit(bool checked)
|
||||
{
|
||||
currentConfigApp->m_display_bit_depth = 16;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
currentConfigApp->m_display_bit_depth = 16;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404670
|
||||
void CMainDialog::OnRadiobuttonPalette256()
|
||||
void CMainDialog::OnRadiobuttonPalette256(bool checked)
|
||||
{
|
||||
currentConfigApp->m_display_bit_depth = 8;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
currentConfigApp->m_display_bit_depth = 8;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004046a0
|
||||
void CMainDialog::OnCheckboxFlipVideoMemPages()
|
||||
void CMainDialog::OnCheckboxFlipVideoMemPages(bool checked)
|
||||
{
|
||||
currentConfigApp->m_flip_surfaces = IsDlgButtonChecked(IDC_CHK_FLIP_VIDEO_MEM_PAGES);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_flip_surfaces = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004046d0
|
||||
void CMainDialog::OnRadiobuttonModelLowQuality()
|
||||
void CMainDialog::OnRadiobuttonModelLowQuality(bool checked)
|
||||
{
|
||||
currentConfigApp->m_model_quality = 1;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
// FIXME: are OnRadiobuttonModelLowQuality and OnRadiobuttonModelHighQuality triggered both?
|
||||
qInfo() << "OnRadiobuttonModelLowQuality";
|
||||
currentConfigApp->m_model_quality = 1;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404700
|
||||
void CMainDialog::OnRadiobuttonModelHighQuality()
|
||||
void CMainDialog::OnRadiobuttonModelHighQuality(bool checked)
|
||||
{
|
||||
currentConfigApp->m_model_quality = 2;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
qInfo() << "OnRadiobuttonModelHighQuality";
|
||||
currentConfigApp->m_model_quality = 2;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404730
|
||||
void CMainDialog::OnRadiobuttonTextureLowQuality()
|
||||
void CMainDialog::OnRadiobuttonTextureLowQuality(bool checked)
|
||||
{
|
||||
currentConfigApp->m_texture_quality = 0;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
// FIXME: are OnRadiobuttonTextureLowQuality and OnRadiobuttonTextureHighQuality triggered both?
|
||||
qInfo() << "OnRadiobuttonTextureLowQuality";
|
||||
currentConfigApp->m_texture_quality = 0;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404760
|
||||
void CMainDialog::OnRadiobuttonTextureHighQuality()
|
||||
void CMainDialog::OnRadiobuttonTextureHighQuality(bool checked)
|
||||
{
|
||||
currentConfigApp->m_texture_quality = 1;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
if (checked) {
|
||||
// FIXME: are OnRadiobuttonTextureLowQuality and OnRadiobuttonTextureHighQuality triggered both?
|
||||
qInfo() << "OnRadiobuttonTextureHighQuality";
|
||||
currentConfigApp->m_texture_quality = 1;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404790
|
||||
void CMainDialog::OnCheckboxJoystick()
|
||||
void CMainDialog::OnCheckboxJoystick(bool checked)
|
||||
{
|
||||
currentConfigApp->m_use_joystick = IsDlgButtonChecked(IDC_CHK_JOYSTICK);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_use_joystick = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
@ -315,40 +309,25 @@ void CMainDialog::OnButtonAdvanced()
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004047d0
|
||||
void CMainDialog::SwitchToAdvanced(BOOL p_advanced)
|
||||
void CMainDialog::SwitchToAdvanced(bool p_advanced)
|
||||
{
|
||||
RECT dialog_rect;
|
||||
RECT grp_advanced_rect;
|
||||
::GetWindowRect(m_hWnd, &dialog_rect);
|
||||
::GetWindowRect(GetDlgItem(IDC_GRP_ADVANCED)->m_hWnd, &grp_advanced_rect);
|
||||
CWnd* button_advanced = GetDlgItem(IDC_BTN_ADVANCED);
|
||||
m_ui->advancedGroup->setVisible(p_advanced);
|
||||
layout()->setSizeConstraint(QLayout::SetMinAndMaxSize);
|
||||
m_advanced = p_advanced;
|
||||
int height;
|
||||
if (p_advanced) {
|
||||
height = grp_advanced_rect.bottom - dialog_rect.top + 10;
|
||||
GetDlgItem(IDC_BMP_SHARK)->EnableWindow(TRUE);
|
||||
button_advanced->SetWindowText("Basic");
|
||||
}
|
||||
else {
|
||||
height = grp_advanced_rect.top - dialog_rect.top;
|
||||
GetDlgItem(IDC_BMP_SHARK)->EnableWindow(FALSE);
|
||||
button_advanced->SetWindowText("Advanced");
|
||||
}
|
||||
SetWindowPos(&wndTop, 0, 0, dialog_rect.right - dialog_rect.left, height, SWP_NOMOVE);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404890
|
||||
void CMainDialog::OnCheckboxDrawCursor()
|
||||
void CMainDialog::OnCheckboxDrawCursor(bool checked)
|
||||
{
|
||||
currentConfigApp->m_draw_cursor = IsDlgButtonChecked(IDC_CHK_DRAW_CURSOR);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_draw_cursor = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004048c0
|
||||
void CMainDialog::OnCheckboxMusic()
|
||||
void CMainDialog::OnCheckboxMusic(bool checked)
|
||||
{
|
||||
currentConfigApp->m_music = IsDlgButtonChecked(IDC_CHK_MUSIC);
|
||||
m_modified = TRUE;
|
||||
currentConfigApp->m_music = checked;
|
||||
m_modified = true;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
@ -1,55 +1,53 @@
|
||||
#if !defined(AFX_MAINDLG_H)
|
||||
#define AFX_MAINDLG_H
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainDialog;
|
||||
}
|
||||
|
||||
// VTABLE: CONFIG 0x004063e0
|
||||
// SIZE 0x70
|
||||
class CMainDialog : public CDialog {
|
||||
class CMainDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainDialog(CWnd* pParent);
|
||||
enum {
|
||||
IDD = IDD_MAIN
|
||||
};
|
||||
CMainDialog(QWidget* pParent = nullptr);
|
||||
|
||||
protected:
|
||||
void DoDataExchange(CDataExchange* pDX) override;
|
||||
void UpdateInterface();
|
||||
void SwitchToAdvanced(BOOL p_advanced);
|
||||
void SwitchToAdvanced(bool p_advanced);
|
||||
|
||||
undefined m_unk0x60[4]; // 0x60
|
||||
HCURSOR m_icon; // 0x64
|
||||
BOOL m_modified; // 0x68
|
||||
BOOL m_advanced; // 0x6c
|
||||
// Implementation
|
||||
private:
|
||||
bool m_modified = false;
|
||||
bool m_advanced = false;
|
||||
Ui::MainDialog* m_ui = nullptr;
|
||||
|
||||
protected:
|
||||
BOOL OnInitDialog() override;
|
||||
void OnSysCommand(UINT nID, LPARAM lParam);
|
||||
void OnPaint();
|
||||
HCURSOR OnQueryDragIcon();
|
||||
void OnList3DevicesSelectionChanged();
|
||||
void OnCancel();
|
||||
void OnDestroy();
|
||||
void OnButtonCancel();
|
||||
void OnCheckbox3DSound();
|
||||
void OnCheckbox3DVideoMemory();
|
||||
void OnRadiobuttonPalette16bit();
|
||||
void OnRadiobuttonPalette256();
|
||||
void OnCheckboxFlipVideoMemPages();
|
||||
void OnRadiobuttonModelLowQuality();
|
||||
void OnRadiobuttonModelHighQuality();
|
||||
void OnRadiobuttonTextureLowQuality();
|
||||
void OnRadiobuttonTextureHighQuality();
|
||||
void OnCheckboxJoystick();
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
bool OnInitDialog();
|
||||
private slots:
|
||||
void OnList3DevicesSelectionChanged(int row);
|
||||
void OnCheckbox3DSound(bool checked);
|
||||
void OnCheckbox3DVideoMemory(bool checked);
|
||||
void OnRadiobuttonPalette16bit(bool checked);
|
||||
void OnRadiobuttonPalette256(bool checked);
|
||||
void OnCheckboxFlipVideoMemPages(bool checked);
|
||||
void OnRadiobuttonModelLowQuality(bool checked);
|
||||
void OnRadiobuttonModelHighQuality(bool checked);
|
||||
void OnRadiobuttonTextureLowQuality(bool checked);
|
||||
void OnRadiobuttonTextureHighQuality(bool checked);
|
||||
void OnCheckboxJoystick(bool chedked);
|
||||
void OnCheckboxDrawCursor(bool checked);
|
||||
void OnCheckboxMusic(bool checked);
|
||||
void OnButtonAdvanced();
|
||||
void OnCheckboxDrawCursor();
|
||||
void OnCheckboxMusic();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
void accept() override;
|
||||
void reject() override;
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403de0
|
||||
|
@ -1,7 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// simple.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#ifndef MINIMFC
|
||||
#include "StdAfx.h"
|
||||
#endif
|
@ -1,35 +0,0 @@
|
||||
#if !defined(AFX_STDAFX_H)
|
||||
#define AFX_STDAFX_H
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#ifdef MINIMFC
|
||||
#include "miniwin/mfc.h"
|
||||
#else
|
||||
#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
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
// FUNCTION: CONFIG 0x402ca0
|
||||
// CObject::Serialize
|
||||
|
||||
// FUNCTION: CONFIG 0x402cb0
|
||||
// CObject::AssertValid
|
||||
|
||||
// FUNCTION: CONFIG 0x402cc0
|
||||
// CObject::Dump
|
||||
|
||||
// FUNCTION: CONFIG 0x00403c90
|
||||
// CWnd::BeginModalState
|
||||
|
||||
// FUNCTION: CONFIG 0x00403ca0
|
||||
// CWnd::EndModalState
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H)
|
@ -1,6 +1,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "ConfigCommandLineInfo.h"
|
||||
#include "MainDlg.h"
|
||||
#include "detectdx5.h"
|
||||
|
||||
@ -14,44 +13,47 @@
|
||||
#include <process.h> // _spawnl
|
||||
#endif
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QMessageBox>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <iniparser.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(CWinApp, 0xc4)
|
||||
DECOMP_SIZE_ASSERT(CConfigApp, 0x108)
|
||||
|
||||
DECOMP_STATIC_ASSERT(offsetof(CConfigApp, m_display_bit_depth) == 0xd0)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CConfigApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// FUNCTION: CONFIG 0x00402c40
|
||||
CConfigApp::CConfigApp()
|
||||
{
|
||||
char* prefPath = SDL_GetPrefPath("isledecomp", "isle");
|
||||
char* iniConfig;
|
||||
if (prefPath) {
|
||||
m_iniPath = std::string{prefPath} + "isle.ini";
|
||||
}
|
||||
else {
|
||||
m_iniPath = "isle.ini";
|
||||
}
|
||||
SDL_free(prefPath);
|
||||
}
|
||||
|
||||
#define MiB (1024 * 1024)
|
||||
|
||||
// FUNCTION: CONFIG 0x00402dc0
|
||||
BOOL CConfigApp::InitInstance()
|
||||
bool CConfigApp::InitInstance()
|
||||
{
|
||||
if (!IsLegoNotRunning()) {
|
||||
return FALSE;
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
QString err = QString{"SDL failed to initialize ("} + SDL_GetError() + ")";
|
||||
QMessageBox::warning(nullptr, "SDL initialization error", err);
|
||||
return false;
|
||||
}
|
||||
if (!DetectDirectX5()) {
|
||||
AfxMessageBox(
|
||||
"\"LEGO\xae Island\" is not detecting DirectX 5 or later. Please quit all other applications and try "
|
||||
QMessageBox::warning(
|
||||
nullptr,
|
||||
"Missing DirectX",
|
||||
"\"LEGO\xc2\xae Island\" is not detecting DirectX 5 or later. Please quit all other applications and try "
|
||||
"again."
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls();
|
||||
#else
|
||||
Enable3dControlsStatic();
|
||||
#endif
|
||||
CConfigCommandLineInfo cmdInfo;
|
||||
ParseCommandLine(cmdInfo);
|
||||
if (_stricmp(afxCurrentAppName, "config") == 0) {
|
||||
m_run_config_dialog = TRUE;
|
||||
return false;
|
||||
}
|
||||
m_device_enumerator = new LegoDeviceEnumerate;
|
||||
if (m_device_enumerator->DoEnumerate()) {
|
||||
@ -67,15 +69,13 @@ BOOL CConfigApp::InitInstance()
|
||||
m_3d_video_ram = FALSE;
|
||||
m_joystick_index = -1;
|
||||
m_display_bit_depth = 16;
|
||||
MEMORYSTATUS memory_status;
|
||||
memory_status.dwLength = sizeof(memory_status);
|
||||
GlobalMemoryStatus(&memory_status);
|
||||
if (memory_status.dwTotalPhys < 12 * MiB) {
|
||||
int totalRamMiB = SDL_GetSystemRAM();
|
||||
if (totalRamMiB < 12) {
|
||||
m_3d_sound = FALSE;
|
||||
m_model_quality = 0;
|
||||
m_texture_quality = 1;
|
||||
}
|
||||
else if (memory_status.dwTotalPhys < 20 * MiB) {
|
||||
else if (totalRamMiB < 20) {
|
||||
m_3d_sound = FALSE;
|
||||
m_model_quality = 1;
|
||||
m_texture_quality = 1;
|
||||
@ -85,126 +85,11 @@ BOOL CConfigApp::InitInstance()
|
||||
m_3d_sound = TRUE;
|
||||
m_texture_quality = 1;
|
||||
}
|
||||
if (!m_run_config_dialog) {
|
||||
ReadRegisterSettings();
|
||||
ValidateSettings();
|
||||
WriteRegisterSettings();
|
||||
delete m_device_enumerator;
|
||||
m_device_enumerator = NULL;
|
||||
m_driver = NULL;
|
||||
m_device = NULL;
|
||||
char password[256];
|
||||
ReadReg("password", password, sizeof(password));
|
||||
const char* exe = _stricmp("ogel", password) == 0 ? "isled.exe" : "isle.exe";
|
||||
char diskpath[1024];
|
||||
if (ReadReg("diskpath", diskpath, sizeof(diskpath))) {
|
||||
_chdir(diskpath);
|
||||
}
|
||||
_spawnl(_P_NOWAIT, exe, exe, "/diskstream", "/script", "\\lego\\scripts\\isle\\isle.si", NULL);
|
||||
return FALSE;
|
||||
}
|
||||
CMainDialog main_dialog(NULL);
|
||||
main_dialog.DoModal();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403100
|
||||
BOOL CConfigApp::IsLegoNotRunning()
|
||||
{
|
||||
HWND hWnd = FindWindow("Lego Island MainNoM App", "LEGO\xae");
|
||||
if (_stricmp(afxCurrentAppName, "config") == 0 || !hWnd) {
|
||||
return TRUE;
|
||||
}
|
||||
if (SetForegroundWindow(hWnd)) {
|
||||
ShowWindow(hWnd, SW_RESTORE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004031b0
|
||||
BOOL CConfigApp::WriteReg(const char* p_key, const char* p_value) const
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD pos;
|
||||
|
||||
if (RegCreateKeyEx(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\Mindscape\\LEGO Island",
|
||||
0,
|
||||
"string",
|
||||
0,
|
||||
KEY_READ | KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&pos
|
||||
) == ERROR_SUCCESS) {
|
||||
if (RegSetValueEx(hKey, p_key, 0, REG_SZ, (LPBYTE) p_value, strlen(p_value)) == ERROR_SUCCESS) {
|
||||
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403240
|
||||
BOOL CConfigApp::ReadReg(LPCSTR p_key, LPCSTR p_value, DWORD p_size) const
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD valueType;
|
||||
|
||||
BOOL out = FALSE;
|
||||
DWORD size = p_size;
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
|
||||
if (RegQueryValueEx(hKey, p_key, NULL, &valueType, (LPBYTE) p_value, &size) == ERROR_SUCCESS) {
|
||||
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
|
||||
out = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004032b0
|
||||
BOOL CConfigApp::ReadRegBool(LPCSTR p_key, BOOL* p_bool) const
|
||||
{
|
||||
char buffer[256];
|
||||
|
||||
BOOL read = ReadReg(p_key, buffer, sizeof(buffer));
|
||||
if (read) {
|
||||
if (strcmp("YES", buffer) == 0) {
|
||||
*p_bool = TRUE;
|
||||
return read;
|
||||
}
|
||||
|
||||
if (strcmp("NO", buffer) == 0) {
|
||||
*p_bool = FALSE;
|
||||
return read;
|
||||
}
|
||||
|
||||
read = FALSE;
|
||||
}
|
||||
return read;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403380
|
||||
BOOL CConfigApp::ReadRegInt(LPCSTR p_key, int* p_value) const
|
||||
{
|
||||
char buffer[256];
|
||||
|
||||
BOOL read = ReadReg(p_key, buffer, sizeof(buffer));
|
||||
if (read) {
|
||||
*p_value = atoi(buffer);
|
||||
}
|
||||
|
||||
return read;
|
||||
return true;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004033d0
|
||||
BOOL CConfigApp::IsDeviceInBasicRGBMode() const
|
||||
bool CConfigApp::IsDeviceInBasicRGBMode() const
|
||||
{
|
||||
/*
|
||||
* BUG: should be:
|
||||
@ -220,71 +105,55 @@ D3DCOLORMODEL CConfigApp::GetHardwareDeviceColorModel() const
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403410
|
||||
BOOL CConfigApp::IsPrimaryDriver() const
|
||||
bool CConfigApp::IsPrimaryDriver() const
|
||||
{
|
||||
return m_driver == &m_device_enumerator->GetDriverList().front();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403430
|
||||
BOOL CConfigApp::ReadRegisterSettings()
|
||||
bool CConfigApp::ReadRegisterSettings()
|
||||
{
|
||||
char buffer[256];
|
||||
BOOL is_modified = FALSE;
|
||||
int tmp = -1;
|
||||
#define NOT_FOUND (-2)
|
||||
|
||||
if (ReadReg("3D Device ID", buffer, sizeof(buffer))) {
|
||||
tmp = m_device_enumerator->ParseDeviceName(buffer);
|
||||
dictionary* dict = iniparser_load(m_iniPath.c_str());
|
||||
if (!dict) {
|
||||
dict = dictionary_new(0);
|
||||
}
|
||||
|
||||
const char* device3D = iniparser_getstring(dict, "isle:3D Device ID", nullptr);
|
||||
if (device3D) {
|
||||
tmp = m_device_enumerator->ParseDeviceName(device3D);
|
||||
if (tmp >= 0) {
|
||||
tmp = m_device_enumerator->GetDevice(tmp, m_driver, m_device);
|
||||
}
|
||||
}
|
||||
if (tmp != 0) {
|
||||
is_modified = TRUE;
|
||||
m_device_enumerator->FUN_1009d210();
|
||||
tmp = m_device_enumerator->GetBestDevice();
|
||||
m_device_enumerator->GetDevice(tmp, m_driver, m_device);
|
||||
}
|
||||
if (!ReadRegInt("Display Bit Depth", &m_display_bit_depth)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Flip Surfaces", &m_flip_surfaces)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Full Screen", &m_full_screen)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Back Buffers in Video RAM", &m_3d_video_ram)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Wide View Angle", &m_wide_view_angle)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("3DSound", &m_3d_sound)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Draw Cursor", &m_draw_cursor)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegInt("Island Quality", &m_model_quality)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegInt("Island Texture", &m_texture_quality)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("UseJoystick", &m_use_joystick)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegBool("Music", &m_music)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!ReadRegInt("JoystickIndex", &m_joystick_index)) {
|
||||
is_modified = TRUE;
|
||||
}
|
||||
return is_modified;
|
||||
m_base_path = iniparser_getstring(dict, "isle:diskpath", m_base_path.c_str());
|
||||
m_cd_path = iniparser_getstring(dict, "isle:cdpath", m_cd_path.c_str());
|
||||
m_media_path = iniparser_getstring(dict, "isle:mediapath", m_media_path.c_str());
|
||||
m_save_path = iniparser_getstring(dict, "isle:savepath", m_save_path.c_str());
|
||||
m_display_bit_depth = iniparser_getint(dict, "isle:Display Bit Depth", -1);
|
||||
m_flip_surfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flip_surfaces);
|
||||
m_full_screen = iniparser_getboolean(dict, "isle:Full Screen", m_full_screen);
|
||||
m_3d_video_ram = iniparser_getboolean(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram);
|
||||
m_wide_view_angle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wide_view_angle);
|
||||
m_3d_sound = iniparser_getboolean(dict, "isle:3DSound", m_3d_sound);
|
||||
m_draw_cursor = iniparser_getboolean(dict, "isle:Draw Cursor", m_draw_cursor);
|
||||
m_model_quality = iniparser_getint(dict, "isle:Island Quality", m_model_quality);
|
||||
m_texture_quality = iniparser_getint(dict, "isle:Island Texture", m_texture_quality);
|
||||
m_use_joystick = iniparser_getboolean(dict, "isle:UseJoystick", m_use_joystick);
|
||||
m_music = iniparser_getboolean(dict, "isle:Music", m_music);
|
||||
m_joystick_index = iniparser_getint(dict, "isle:JoystickIndex", m_joystick_index);
|
||||
return true;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403630
|
||||
BOOL CConfigApp::ValidateSettings()
|
||||
bool CConfigApp::ValidateSettings()
|
||||
{
|
||||
BOOL is_modified = FALSE;
|
||||
|
||||
@ -369,7 +238,7 @@ DWORD CConfigApp::GetDeviceRenderBitStatus() const
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403810
|
||||
BOOL CConfigApp::AdjustDisplayBitDepthBasedOnRenderStatus()
|
||||
bool CConfigApp::AdjustDisplayBitDepthBasedOnRenderStatus()
|
||||
{
|
||||
if (m_display_bit_depth == 8) {
|
||||
if (GetConditionalDeviceRenderBitDepth()) {
|
||||
@ -398,32 +267,55 @@ void CConfigApp::WriteRegisterSettings() const
|
||||
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
#define WriteRegBool(NAME, VALUE) WriteReg(NAME, VALUE ? "YES" : "NO")
|
||||
#define WriteRegInt(NAME, VALUE) \
|
||||
#define SetIniBool(DICT, NAME, VALUE) iniparser_set(DICT, NAME, VALUE ? "true" : "false")
|
||||
#define SetIniInt(DICT, NAME, VALUE) \
|
||||
do { \
|
||||
sprintf(buffer, "%d", VALUE); \
|
||||
WriteReg(NAME, buffer); \
|
||||
iniparser_set(DICT, NAME, buffer); \
|
||||
} while (0)
|
||||
|
||||
m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device);
|
||||
WriteReg("3D Device ID", buffer);
|
||||
WriteReg("3D Device Name", m_device->m_deviceName);
|
||||
WriteRegInt("Display Bit Depth", m_display_bit_depth);
|
||||
WriteRegBool("Flip Surfaces", m_flip_surfaces);
|
||||
WriteRegBool("Full Screen", m_full_screen);
|
||||
WriteRegBool("Back Buffers in Video RAM", m_3d_video_ram);
|
||||
WriteRegBool("Wide View Angle", m_wide_view_angle);
|
||||
WriteRegBool("3DSound", m_3d_sound);
|
||||
WriteRegBool("Draw Cursor", m_draw_cursor);
|
||||
WriteRegInt("Island Quality", m_model_quality);
|
||||
WriteRegInt("Island Texture", m_texture_quality);
|
||||
WriteRegBool("UseJoystick", m_use_joystick);
|
||||
WriteRegBool("Music", m_music);
|
||||
WriteRegInt("JoystickIndex", m_joystick_index);
|
||||
|
||||
#undef WriteRegBool
|
||||
#undef WriteRegInt
|
||||
dictionary* dict = dictionary_new(0);
|
||||
iniparser_set(dict, "isle", NULL);
|
||||
if (m_device_enumerator->FormatDeviceName(buffer, m_driver, m_device) >= 0) {
|
||||
iniparser_set(dict, "isle:3D Device ID", buffer);
|
||||
}
|
||||
iniparser_set(dict, "isle:diskpath", m_base_path.c_str());
|
||||
iniparser_set(dict, "isle:cdpath", m_cd_path.c_str());
|
||||
iniparser_set(dict, "isle:mediapath", m_media_path.c_str());
|
||||
iniparser_set(dict, "isle:savepath", m_save_path.c_str());
|
||||
|
||||
SetIniBool(dict, "isle:Display Bit Depth", m_display_bit_depth);
|
||||
SetIniBool(dict, "isle:Flip Surfaces", m_flip_surfaces);
|
||||
SetIniBool(dict, "isle:Full Screen", m_full_screen);
|
||||
SetIniBool(dict, "isle:Wide View Angle", m_wide_view_angle);
|
||||
|
||||
SetIniBool(dict, "isle:3DSound", m_3d_sound);
|
||||
SetIniBool(dict, "isle:Music", m_music);
|
||||
|
||||
SetIniInt(dict, "isle:UseJoystick", m_use_joystick);
|
||||
SetIniBool(dict, "isle:JoystickIndex", m_joystick_index);
|
||||
SetIniBool(dict, "isle:Draw Cursor", m_draw_cursor);
|
||||
|
||||
SetIniBool(dict, "isle:Back Buffers in Video RAM", m_3d_video_ram);
|
||||
|
||||
SetIniInt(dict, "isle:Island Quality", m_model_quality);
|
||||
SetIniInt(dict, "isle:Island Texture", m_texture_quality);
|
||||
|
||||
#undef SetIniBool
|
||||
#undef SetIniInt
|
||||
|
||||
FILE* iniFP = fopen(m_iniPath.c_str(), "wb");
|
||||
if (iniFP) {
|
||||
iniparser_dump_ini(dict, iniFP);
|
||||
qInfo() << "New config written at" << QString::fromStdString(m_iniPath);
|
||||
fclose(iniFP);
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(nullptr, "Failed to save ini", "Failed to save ini");
|
||||
}
|
||||
iniparser_freedict(dict);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403a90
|
||||
@ -433,8 +325,52 @@ int CConfigApp::ExitInstance()
|
||||
delete m_device_enumerator;
|
||||
m_device_enumerator = NULL;
|
||||
}
|
||||
return CWinApp::ExitInstance();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CConfigApp::SetIniPath(const std::string& p_path)
|
||||
{
|
||||
m_iniPath = p_path;
|
||||
}
|
||||
const std::string& CConfigApp::GetIniPath() const
|
||||
{
|
||||
return m_iniPath;
|
||||
}
|
||||
|
||||
// GLOBAL: CONFIG 0x00408e50
|
||||
CConfigApp g_theApp;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationName("config");
|
||||
QCoreApplication::setApplicationVersion("1.0");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription("Configure LEGO Island");
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
QCommandLineOption iniOption(
|
||||
QStringList() << "ini",
|
||||
QCoreApplication::translate("config", "Set INI path."),
|
||||
QCoreApplication::translate("config", "path")
|
||||
);
|
||||
parser.addOption(iniOption);
|
||||
parser.process(app);
|
||||
|
||||
if (parser.isSet(iniOption)) {
|
||||
g_theApp.SetIniPath(parser.value(iniOption).toStdString());
|
||||
}
|
||||
qInfo() << "Ini path =" << QString::fromStdString(g_theApp.GetIniPath());
|
||||
|
||||
int result = 1;
|
||||
if (g_theApp.InitInstance()) {
|
||||
CMainDialog main_dialog;
|
||||
main_dialog.show();
|
||||
result = app.exec();
|
||||
}
|
||||
g_theApp.ExitInstance();
|
||||
return result;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#if !defined(AFX_CONFIG_H)
|
||||
#define AFX_CONFIG_H
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "AboutDlg.h"
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
|
||||
@ -11,15 +11,17 @@
|
||||
#include <d3d.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
class LegoDeviceEnumerate;
|
||||
struct Direct3DDeviceInfo;
|
||||
struct MxDriver;
|
||||
|
||||
#define currentConfigApp ((CConfigApp*) afxCurrentWinApp)
|
||||
#define currentConfigApp (&g_theApp)
|
||||
|
||||
// VTABLE: CONFIG 0x00406040
|
||||
// SIZE 0x108
|
||||
class CConfigApp : public CWinApp {
|
||||
class CConfigApp {
|
||||
public:
|
||||
CConfigApp();
|
||||
|
||||
@ -28,68 +30,57 @@ public:
|
||||
//{{AFX_VIRTUAL(CConfigApp)
|
||||
|
||||
public:
|
||||
BOOL InitInstance() override;
|
||||
int ExitInstance() override;
|
||||
bool InitInstance();
|
||||
int ExitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
|
||||
BOOL WriteReg(const char* p_key, const char* p_value) const;
|
||||
BOOL ReadReg(LPCSTR p_key, LPCSTR p_value, DWORD p_size) const;
|
||||
BOOL ReadRegBool(LPCSTR p_key, BOOL* p_bool) const;
|
||||
BOOL ReadRegInt(LPCSTR p_key, int* p_value) const;
|
||||
BOOL IsDeviceInBasicRGBMode() const;
|
||||
// bool WriteReg(const char* p_key, const char* p_value) const;
|
||||
// bool ReadReg(LPCSTR p_key, LPCSTR p_value, DWORD p_size) const;
|
||||
// bool ReadRegBool(LPCSTR p_key, bool* p_bool) const;
|
||||
// bool ReadRegInt(LPCSTR p_key, int* p_value) const;
|
||||
bool IsDeviceInBasicRGBMode() const;
|
||||
D3DCOLORMODEL GetHardwareDeviceColorModel() const;
|
||||
BOOL IsPrimaryDriver() const;
|
||||
BOOL ReadRegisterSettings();
|
||||
BOOL ValidateSettings();
|
||||
bool IsPrimaryDriver() const;
|
||||
bool ReadRegisterSettings();
|
||||
bool ValidateSettings();
|
||||
DWORD GetConditionalDeviceRenderBitDepth() const;
|
||||
DWORD GetDeviceRenderBitStatus() const;
|
||||
BOOL AdjustDisplayBitDepthBasedOnRenderStatus();
|
||||
bool AdjustDisplayBitDepthBasedOnRenderStatus();
|
||||
void WriteRegisterSettings() const;
|
||||
void SetIniPath(const std::string& p_path);
|
||||
const std::string& GetIniPath() const;
|
||||
|
||||
//{{AFX_MSG(CConfigApp)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
BOOL IsLegoNotRunning();
|
||||
// DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
LegoDeviceEnumerate* m_device_enumerator; // 0x0c4
|
||||
MxDriver* m_driver; // 0x0c8
|
||||
Direct3DDeviceInfo* m_device; // 0x0cc
|
||||
int m_display_bit_depth; // 0x0d0
|
||||
BOOL m_flip_surfaces; // 0x0d4
|
||||
BOOL m_full_screen; // 0x0d8
|
||||
BOOL m_3d_video_ram; // 0x0dc
|
||||
BOOL m_wide_view_angle; // 0x0e0
|
||||
BOOL m_3d_sound; // 0x0e4
|
||||
BOOL m_draw_cursor; // 0x0e8
|
||||
BOOL m_use_joystick; // 0x0ec
|
||||
int m_joystick_index; // 0x0f0
|
||||
BOOL m_run_config_dialog; // 0x0f4
|
||||
int m_model_quality; // 0x0f8
|
||||
int m_texture_quality; // 0x0fc
|
||||
undefined m_unk0x100[4]; // 0x100
|
||||
BOOL m_music; // 0x104
|
||||
LegoDeviceEnumerate* m_device_enumerator;
|
||||
MxDriver* m_driver;
|
||||
Direct3DDeviceInfo* m_device;
|
||||
int m_display_bit_depth;
|
||||
bool m_flip_surfaces;
|
||||
bool m_full_screen;
|
||||
bool m_3d_video_ram;
|
||||
bool m_wide_view_angle;
|
||||
bool m_3d_sound;
|
||||
bool m_draw_cursor;
|
||||
bool m_use_joystick;
|
||||
int m_joystick_index;
|
||||
int m_model_quality;
|
||||
int m_texture_quality;
|
||||
bool m_music;
|
||||
std::string m_iniPath;
|
||||
std::string m_base_path;
|
||||
std::string m_cd_path;
|
||||
std::string m_media_path;
|
||||
std::string m_save_path;
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00402cd0
|
||||
// CConfigApp::`scalar deleting destructor'
|
||||
|
||||
// FUNCTION: CONFIG 0x402c20
|
||||
// CConfigApp::_GetBaseMessageMap
|
||||
|
||||
// FUNCTION: CONFIG 0x402c30
|
||||
// CConfigApp::GetMessageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x406008
|
||||
// CConfigApp::messageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x406010
|
||||
// CConfigApp::_messageEntries
|
||||
extern CConfigApp g_theApp;
|
||||
|
||||
#endif // !defined(AFX_CONFIG_H)
|
||||
|
@ -3,28 +3,37 @@
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/ddraw.h"
|
||||
#include "miniwin/dinput.h"
|
||||
#include "miniwin/mfc.h"
|
||||
#include "qlibrary.h"
|
||||
#include "qoperatingsystemversion.h"
|
||||
#else
|
||||
#include <ddraw.h>
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
|
||||
typedef struct IUnknown* LPUNKNOWN;
|
||||
|
||||
typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);
|
||||
typedef HRESULT WINAPI
|
||||
DirectInputCreateA_fn(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter);
|
||||
|
||||
// FUNCTION: CONFIG 0x004048f0
|
||||
BOOL DetectDirectX5()
|
||||
bool DetectDirectX5()
|
||||
{
|
||||
unsigned int version;
|
||||
BOOL found;
|
||||
bool found;
|
||||
DetectDirectX(&version, &found);
|
||||
return version >= 0x500;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404920
|
||||
void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
void DetectDirectX(unsigned int* p_version, bool* p_found)
|
||||
{
|
||||
#ifdef MINIWIN
|
||||
QOperatingSystemVersion os_version = QOperatingSystemVersion::current();
|
||||
*p_found = true;
|
||||
*p_version = 0x500;
|
||||
#else
|
||||
|
||||
OSVERSIONINFOA os_version;
|
||||
|
||||
os_version.dwOSVersionInfoSize = sizeof(os_version);
|
||||
@ -40,7 +49,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
return;
|
||||
}
|
||||
if (os_version.dwMajorVersion != 4) {
|
||||
*p_version = 0x501;
|
||||
*p_version = MAKEWORD(5, 1);
|
||||
return;
|
||||
}
|
||||
*p_version = 0x200;
|
||||
@ -56,18 +65,18 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x300;
|
||||
*p_version = MAKEWORD(3, 0);
|
||||
return;
|
||||
}
|
||||
*p_found = 1;
|
||||
*p_found = true;
|
||||
if (LOWORD(os_version.dwBuildNumber) >= 0x550) {
|
||||
*p_version = 0x501;
|
||||
*p_version = MAKEWORD(5, 1);
|
||||
return;
|
||||
}
|
||||
HMODULE ddraw_module = LoadLibrary("DDRAW.DLL");
|
||||
if (!ddraw_module) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
*p_found = false;
|
||||
FreeLibrary(ddraw_module);
|
||||
return;
|
||||
}
|
||||
@ -75,7 +84,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
(DirectDrawCreate_fn*) GetProcAddress(ddraw_module, "DirectDrawCreate");
|
||||
if (!func_DirectDrawCreate) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
*p_found = false;
|
||||
FreeLibrary(ddraw_module);
|
||||
OutputDebugString("Couldn't LoadLibrary DDraw\r\n");
|
||||
return;
|
||||
@ -83,12 +92,12 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
LPDIRECTDRAW ddraw;
|
||||
if (FAILED(func_DirectDrawCreate(NULL, &ddraw, NULL))) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
*p_found = false;
|
||||
FreeLibrary(ddraw_module);
|
||||
OutputDebugString("Couldn't create DDraw\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x100;
|
||||
*p_version = MAKEWORD(1, 0);
|
||||
LPDIRECTDRAW2 ddraw2;
|
||||
if (FAILED(ddraw->QueryInterface(IID_IDirectDraw2, (LPVOID*) &ddraw2))) {
|
||||
ddraw->Release();
|
||||
@ -97,7 +106,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
return;
|
||||
}
|
||||
ddraw->Release();
|
||||
*p_version = 0x200;
|
||||
*p_version = MAKEWORD(2, 0);
|
||||
HMODULE dinput_module = LoadLibrary("DINPUT.DLL");
|
||||
if (!dinput_module) {
|
||||
OutputDebugString("Couldn't LoadLibrary DInput\r\n");
|
||||
@ -114,7 +123,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x300;
|
||||
*p_version = MAKEWORD(3, 0);
|
||||
DDSURFACEDESC surface_desc;
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
@ -141,8 +150,9 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
FreeLibrary(ddraw_module);
|
||||
return;
|
||||
}
|
||||
*p_version = 0x500;
|
||||
*p_version = MAKEWORD(5, 0);
|
||||
surface3->Release();
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
#endif
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
extern BOOL DetectDirectX5();
|
||||
extern bool DetectDirectX5();
|
||||
|
||||
extern void DetectDirectX(unsigned int* p_version, BOOL* p_found);
|
||||
extern void DetectDirectX(unsigned int* p_version, bool* p_found);
|
||||
|
||||
#endif // !defined(AFX_DETECTDX5_H)
|
||||
|
99
CONFIG/res/about.ui
Normal file
99
CONFIG/res/about.ui
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>387</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About Configure LEGO© Island</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="houseIcon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="config.qrc">:/lego1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="textWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="configureLabel">
|
||||
<property name="text">
|
||||
<string>Configure LEGO Island Version 1.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="copyrightLabel">
|
||||
<property name="text">
|
||||
<string>Copyright © 1997 mindscape</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="config.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
7
CONFIG/res/config.qrc
Normal file
7
CONFIG/res/config.qrc
Normal file
@ -0,0 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>shark.png</file>
|
||||
<file>lego1.png</file>
|
||||
<file>lego2.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,58 +1,6 @@
|
||||
#include "resource.h"
|
||||
#include "afxres.h"
|
||||
#include <windows.h>
|
||||
|
||||
IDI_CONFIG ICON "lego.ico"
|
||||
|
||||
IDB_SHARK BITMAP "shark.bmp"
|
||||
|
||||
IDD_ABOUT DIALOG 0, 0, 217, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About Configure LEGO\xAE Island"
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL IDI_CONFIG, -1, "STATIC", SS_ICON | WS_CHILD | WS_VISIBLE, 11, 17, 18, 20
|
||||
CONTROL "Configure LEGO Island Version 1.0", -1, "STATIC", SS_LEFT | SS_NOPREFIX | WS_CHILD | WS_VISIBLE | WS_GROUP, 40, 10, 119, 8
|
||||
CONTROL "Copyright \xA9 1997 mindscape", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 40, 25, 119, 8
|
||||
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 178, 7, 32, 14
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
BEGIN
|
||||
IDS_ABOUT, "&About Config..."
|
||||
END
|
||||
|
||||
IDD_MAIN DIALOGEX 0, 0, 289, 247
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Configure LEGO Island"
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL "OK", IDABORT, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 172, 125, 44, 14
|
||||
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 238, 125, 44, 14
|
||||
CONTROL "Fast", IDC_RAD_MODEL_QUALITY_LOW, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 124, 18, 42, 10
|
||||
CONTROL "High", IDC_RAD_MODEL_QUALITY_HIGH, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 192, 18, 69, 10
|
||||
CONTROL "Fast", IDC_RAD_TEXTURE_QUALITY_LOW, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 124, 49, 43, 10
|
||||
CONTROL "High", IDC_RAD_TEXTURE_QUALITY_HIGH, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 192, 49, 69, 10
|
||||
CONTROL "256 Color", IDC_RAD_PALETTE_256, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 124, 80, 50, 10
|
||||
CONTROL "High Color(16 bit)", IDC_RAD_PALETTE_16BIT, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 192, 80, 76, 10
|
||||
CONTROL "Use Joystick", IDC_CHK_JOYSTICK, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 192, 104, 60, 10
|
||||
CONTROL "", IDC_LIST_3DDEVICES, "LISTBOX", LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 115, 168, 161, 36 , WS_EX_TRANSPARENT
|
||||
CONTROL "Flip Video Memory Pages", IDC_CHK_FLIP_VIDEO_MEM_PAGES, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 116, 224, 96, 15
|
||||
CONTROL "Draw 3D to Video Memory", IDC_CHK_3D_VIDEO_MEMORY, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 116, 210, 99, 10
|
||||
CONTROL "Color Palette", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 107, 69, 175, 26
|
||||
CONTROL "Direct 3D Devices", -1, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE | WS_GROUP, 123, 158, 143, 10
|
||||
CONTROL "3D Sound", IDC_CHK_3DSOUND, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 220, 210, 45, 10
|
||||
CONTROL "Island Model Quality", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 107, 7, 175, 26
|
||||
CONTROL "Island Texture Quality", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 107, 38, 175, 26
|
||||
CONTROL "Advanced Settings", IDC_GRP_ADVANCED, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 107, 147, 175, 93
|
||||
CONTROL "Advanced", IDC_BTN_ADVANCED, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, 109, 124, 44, 14
|
||||
CONTROL IDB_SHARK, IDC_BMP_SHARK, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 7, 7, 83, 249
|
||||
CONTROL "Draw Cursor", IDC_CHK_DRAW_CURSOR, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE, 219, 227, 54, 10
|
||||
CONTROL "Music", IDC_CHK_MUSIC, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 124, 104, 35, 10
|
||||
END
|
||||
1 ICON "lego.ico"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,1,0,0
|
||||
|
BIN
CONFIG/res/lego1.png
Normal file
BIN
CONFIG/res/lego1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 477 B |
BIN
CONFIG/res/lego2.png
Normal file
BIN
CONFIG/res/lego2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 397 B |
357
CONFIG/res/maindialog.ui
Normal file
357
CONFIG/res/maindialog.ui
Normal file
@ -0,0 +1,357 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainDialog</class>
|
||||
<widget class="QDialog" name="MainDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>549</width>
|
||||
<height>563</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Configure LEGO Island</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="config.qrc">
|
||||
<normaloff>:/lego1.png</normaloff>:/lego1.png</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="sharkImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>143</width>
|
||||
<height>545</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="config.qrc">:/shark.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="settingsWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="normalWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>41</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="textureQualityGroup">
|
||||
<property name="title">
|
||||
<string>Island Texture Quality</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="textureQualityFastRadioButton">
|
||||
<property name="text">
|
||||
<string>Fast</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="textureQualityHighRadioButton">
|
||||
<property name="text">
|
||||
<string>High</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="modelQualityGroup">
|
||||
<property name="title">
|
||||
<string>Island Model Quality</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="modelQualityFastRadioButton">
|
||||
<property name="text">
|
||||
<string>Fast</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="modelQualityHighRadioButton">
|
||||
<property name="text">
|
||||
<string>High</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="colorPaletteGroup">
|
||||
<property name="title">
|
||||
<string>Color Palette</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="colorPalette256RadioButton">
|
||||
<property name="text">
|
||||
<string>256 Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="colorPalette16bitRadioButton">
|
||||
<property name="text">
|
||||
<string>High Color (16 bit)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="musicJoystickWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="musicCheckBox">
|
||||
<property name="text">
|
||||
<string>Music</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="joystickCheckBox">
|
||||
<property name="text">
|
||||
<string>Use Joystick</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="buttonWidgets" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="advancedButton">
|
||||
<property name="text">
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="advancedGroup">
|
||||
<property name="title">
|
||||
<string>Advanced Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="direct3DDevicesLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Direct 3D Devices</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="devicesList">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="D3DCheckboxWidget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="flipVideoMemoryPagesCheckBox">
|
||||
<property name="text">
|
||||
<string>Flip Video Memory Pages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="videomemoryCheckBox">
|
||||
<property name="text">
|
||||
<string>Draw 3D to Video Memory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="sound3DCheckBox">
|
||||
<property name="text">
|
||||
<string>3D Sound</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="drawCursorCheckBox">
|
||||
<property name="text">
|
||||
<string>Draw Cursor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="config.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,25 +0,0 @@
|
||||
#define IDI_CONFIG 128
|
||||
|
||||
#define IDD_ABOUT 100
|
||||
#define IDS_ABOUT 101
|
||||
|
||||
#define IDD_MAIN 102
|
||||
|
||||
#define IDC_LIST_3DDEVICES 1000
|
||||
#define IDC_CHK_FLIP_VIDEO_MEM_PAGES 1001
|
||||
#define IDC_CHK_3D_VIDEO_MEMORY 1003
|
||||
#define IDC_RAD_PALETTE_256 1004
|
||||
#define IDC_RAD_PALETTE_16BIT 1005
|
||||
#define IDC_CHK_3DSOUND 1006
|
||||
#define IDC_CHK_DRAW_CURSOR 1008
|
||||
#define IDC_RAD_MODEL_QUALITY_LOW 1010
|
||||
#define IDC_RAD_MODEL_QUALITY_HIGH 1011
|
||||
#define IDC_RAD_TEXTURE_QUALITY_LOW 1013
|
||||
#define IDC_RAD_TEXTURE_QUALITY_HIGH 1014
|
||||
#define IDC_CHK_JOYSTICK 1015
|
||||
#define IDC_GRP_ADVANCED 1017
|
||||
#define IDC_BTN_ADVANCED 1020
|
||||
#define IDC_BMP_SHARK 1023
|
||||
#define IDC_CHK_MUSIC 1024
|
||||
|
||||
#define IDB_SHARK 135
|
Binary file not shown.
Before Width: | Height: | Size: 55 KiB |
BIN
CONFIG/res/shark.png
Normal file
BIN
CONFIG/res/shark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -511,11 +511,11 @@ MxResult IsleApp::SetupWindow()
|
||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, WINDOW_TITLE);
|
||||
|
||||
window = SDL_CreateWindowWithProperties(props);
|
||||
#ifndef MINIWIN
|
||||
#ifdef MINIWIN
|
||||
m_windowHandle = reinterpret_cast<HWND>(window);
|
||||
#else
|
||||
m_windowHandle =
|
||||
(HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
#else
|
||||
m_windowHandle = window;
|
||||
#endif
|
||||
|
||||
SDL_DestroyProperties(props);
|
||||
|
@ -1,7 +1,6 @@
|
||||
add_library(miniwin STATIC EXCLUDE_FROM_ALL
|
||||
# Core
|
||||
src/windows/windows.cpp
|
||||
src/mfc/mfc.cpp
|
||||
|
||||
# DDraw
|
||||
src/ddraw/ddraw.cpp
|
||||
@ -148,16 +147,3 @@ if(ISLE_COMPILE_SHADERS)
|
||||
DEPENDS "${py_gencshadersource}" ${shader_headers} ${shader_jsons})
|
||||
endif()
|
||||
target_sources(miniwin PRIVATE "${index}" "${index_cpp}")
|
||||
|
||||
# Minimfc lib
|
||||
add_library(minimfc STATIC EXCLUDE_FROM_ALL
|
||||
src/mfc/mfc.cpp
|
||||
)
|
||||
|
||||
target_include_directories(minimfc
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/internal
|
||||
)
|
||||
|
||||
target_compile_definitions(minimfc PUBLIC MINIMFC)
|
||||
target_link_libraries(minimfc PRIVATE SDL3::SDL3 miniwin)
|
||||
|
@ -13,14 +13,14 @@
|
||||
#define DDERR_CANNOTDETACHSURFACE MAKE_DDHRESULT(20)
|
||||
#define DDERR_CURRENTLYNOTAVAIL MAKE_DDHRESULT(40)
|
||||
#define DDERR_EXCEPTION MAKE_DDHRESULT(55)
|
||||
#define DDERR_GENERIC 0x80004005
|
||||
#define DDERR_GENERIC ((HRESULT) 0x80004005)
|
||||
#define DDERR_HEIGHTALIGN MAKE_DDHRESULT(90)
|
||||
#define DDERR_INCOMPATIBLEPRIMARY MAKE_DDHRESULT(95)
|
||||
#define DDERR_INVALIDCAPS MAKE_DDHRESULT(100)
|
||||
#define DDERR_INVALIDCLIPLIST MAKE_DDHRESULT(110)
|
||||
#define DDERR_INVALIDMODE MAKE_DDHRESULT(120)
|
||||
#define DDERR_INVALIDOBJECT MAKE_DDHRESULT(130)
|
||||
#define DDERR_INVALIDPARAMS 0x80070057
|
||||
#define DDERR_INVALIDPARAMS ((HRESULT) 0x80070057)
|
||||
#define DDERR_INVALIDPIXELFORMAT MAKE_DDHRESULT(145)
|
||||
#define DDERR_INVALIDRECT MAKE_DDHRESULT(150)
|
||||
#define DDERR_LOCKEDSURFACES MAKE_DDHRESULT(160)
|
||||
@ -48,7 +48,7 @@
|
||||
#define DDERR_NOZBUFFERHW MAKE_DDHRESULT(340)
|
||||
#define DDERR_NOZOVERLAYHW MAKE_DDHRESULT(350)
|
||||
#define DDERR_OUTOFCAPS MAKE_DDHRESULT(360)
|
||||
#define DDERR_OUTOFMEMORY 0x8007000E
|
||||
#define DDERR_OUTOFMEMORY ((HRESULT) 0x8007000E)
|
||||
#define DDERR_OUTOFVIDEOMEMORY MAKE_DDHRESULT(380)
|
||||
#define DDERR_OVERLAYCANTCLIP MAKE_DDHRESULT(382)
|
||||
#define DDERR_OVERLAYCOLORKEYONLYONEACTIVE MAKE_DDHRESULT(384)
|
||||
@ -63,7 +63,7 @@
|
||||
#define DDERR_TOOBIGHEIGHT MAKE_DDHRESULT(470)
|
||||
#define DDERR_TOOBIGSIZE MAKE_DDHRESULT(480)
|
||||
#define DDERR_TOOBIGWIDTH MAKE_DDHRESULT(490)
|
||||
#define DDERR_UNSUPPORTED 0x80004001
|
||||
#define DDERR_UNSUPPORTED ((HRESULT) 0x80004001)
|
||||
#define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT(510)
|
||||
#define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT(520)
|
||||
#define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT(537)
|
||||
|
@ -1,304 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "miniwin/windows.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// --- Defines and Macros ---
|
||||
|
||||
// Remove WinAPI stuff
|
||||
#define BEGIN_MESSAGE_MAP(class_name, base_class_name)
|
||||
#define DECLARE_MESSAGE_MAP()
|
||||
#ifndef __cdecl
|
||||
#define __cdecl
|
||||
#endif
|
||||
#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 FAILED(hr) (((HRESULT) (hr)) < 0)
|
||||
#define InterlockedIncrement(x) __sync_add_and_fetch(x, 1)
|
||||
#define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
|
||||
#define LOWORD(l) ((WORD) (((DWORD_PTR) (l)) & 0xffff))
|
||||
#define MAKEINTRESOURCE(i) (reinterpret_cast<LPCTSTR>((ULONG_PTR) ((WORD) (i))))
|
||||
|
||||
#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 WM_ICONERASEBKGND 0x0027
|
||||
#define WM_SETICON 0x804
|
||||
|
||||
#define ERROR_SUCCESS 0
|
||||
#define GENERIC_READ 0x80000000L
|
||||
#define OPEN_EXISTING 3
|
||||
#define REG_SZ 1
|
||||
#define RT_GROUP_ICON 0x00000007
|
||||
#define SW_RESTORE 9
|
||||
|
||||
// --- Typedefs ---
|
||||
typedef char CHAR;
|
||||
typedef BYTE* LPBYTE;
|
||||
typedef char* LPTSTR;
|
||||
typedef const char* LPCTSTR;
|
||||
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 HKEY* PHKEY;
|
||||
typedef BITMAPINFO* LPBITMAPINFO;
|
||||
typedef GUID REFIID;
|
||||
|
||||
// --- Structs ---
|
||||
struct OSVERSIONINFOA {
|
||||
DWORD dwOSVersionInfoSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
};
|
||||
typedef struct IUnknown* LPUNKNOWN;
|
||||
|
||||
struct CWnd {
|
||||
HWND m_hWnd;
|
||||
void EnableWindow(bool bEnable);
|
||||
void SetWindowText(const char* text);
|
||||
};
|
||||
|
||||
struct CDataExchange {
|
||||
bool m_bSaveAndValidate;
|
||||
};
|
||||
|
||||
struct CDialog {
|
||||
HWND m_hWnd;
|
||||
int m_nIDTemplate;
|
||||
CWnd* m_pParentWnd;
|
||||
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();
|
||||
};
|
||||
|
||||
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);
|
||||
bool RemoveMenu(UINT uPosition, UINT uFlags);
|
||||
bool SetMenuItemInfo(UINT uIDItem, const void* pMenuItemInfo, bool fByPosition = false);
|
||||
int GetMenuItemCount() const;
|
||||
};
|
||||
|
||||
struct CWinApp {
|
||||
CWinApp();
|
||||
~CWinApp() = default;
|
||||
virtual BOOL InitInstance() = 0;
|
||||
virtual int ExitInstance();
|
||||
};
|
||||
|
||||
struct MEMORYSTATUS {
|
||||
DWORD dwLength;
|
||||
DWORD dwTotalPhys;
|
||||
};
|
||||
|
||||
struct CCommandLineInfo {
|
||||
virtual void ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast) {}
|
||||
};
|
||||
|
||||
// --- 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(CWinApp** hWnd, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetWindowRect(HWND hDlg, struct RECT* Rect);
|
||||
|
||||
inline BOOL GetClientRect(LPRECT lpRect)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline BOOL IsIconic()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
inline int GetSystemMetrics(int nIndex)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL GetVersionEx(OSVERSIONINFOA* version);
|
||||
|
||||
void GlobalMemoryStatus(MEMORYSTATUS* memory_status);
|
||||
|
||||
inline BOOL DrawIcon(HDC hdc, int x, int y, HICON hIcon)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline bool AppendMenu(void* menu, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpszNewItem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void OutputDebugString(const char* lpOutputString);
|
||||
|
||||
void* GetProcAddress(HMODULE module, const char* name);
|
||||
|
||||
int miniwin_stricmp(const char* str1, const char* str2);
|
||||
#define _stricmp miniwin_stricmp
|
||||
|
||||
HICON LoadIcon(HINSTANCE hInstance, LPCSTR lpIconName);
|
||||
|
||||
int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);
|
||||
|
||||
HINSTANCE AfxFindResourceHandle(LPCTSTR lpszResourceName, int lpszResourceType);
|
||||
|
||||
HMODULE LoadLibrary(const char* name);
|
||||
|
||||
int FreeLibrary(void* hModule);
|
||||
|
||||
HMENU GetSystemMenu(HWND hWnd, bool bRevert);
|
||||
|
||||
HWND WINAPI FindWindow(LPCSTR lpClassName, LPCSTR lpWindowName);
|
||||
|
||||
LRESULT SendMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
LRESULT SendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL IsDlgButtonChecked(int nIDButton);
|
||||
|
||||
CWnd* GetDlgItem(int id);
|
||||
|
||||
BOOL OnInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam);
|
||||
|
||||
BOOL CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton);
|
||||
|
||||
BOOL CheckDlgButton(int nIDButton, BOOL uCheck);
|
||||
|
||||
void Enable3dControls();
|
||||
|
||||
void ParseCommandLine(CCommandLineInfo& cmdInfo);
|
||||
|
||||
struct AFX_MODULE_STATE {
|
||||
CWinApp* m_pCurrentWinApp;
|
||||
};
|
||||
extern 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;
|
||||
}
|
||||
|
||||
void AfxMessageBox(const char* message);
|
@ -60,7 +60,8 @@
|
||||
// --- Typedefs ---
|
||||
typedef uint8_t BYTE, byte;
|
||||
typedef int32_t LONG;
|
||||
typedef uint32_t ULONG, DWORD, HRESULT;
|
||||
typedef uint32_t ULONG, DWORD;
|
||||
typedef long HRESULT;
|
||||
typedef DWORD* LPDWORD;
|
||||
typedef int BOOL, WINBOOL, INT;
|
||||
typedef unsigned int UINT;
|
||||
@ -70,10 +71,16 @@ typedef void* LPVOID;
|
||||
typedef char* LPSTR;
|
||||
typedef const char* LPCSTR;
|
||||
typedef void* HANDLE;
|
||||
typedef HANDLE HICON, HFONT;
|
||||
typedef struct HICON__* HICON;
|
||||
typedef struct HFONT__* HFONT;
|
||||
typedef struct HINSTANCE__* HINSTANCE;
|
||||
typedef SDL_Window *HMENU, *HWND;
|
||||
typedef HANDLE HMODULE, HDC, HPALETTE, HFILE, HCURSOR;
|
||||
typedef struct HMENU__* HMENU;
|
||||
typedef struct HWND__* HWND;
|
||||
typedef HINSTANCE HMODULE;
|
||||
typedef struct HDC__* HDC;
|
||||
typedef struct HPALETTE__* HPALETTE;
|
||||
typedef HICON HCURSOR;
|
||||
typedef HANDLE HFILE;
|
||||
typedef int LSTATUS, HKEY, REGSAM;
|
||||
|
||||
// --- Structs ---
|
||||
|
@ -279,7 +279,8 @@ HRESULT DirectDrawImpl::RestoreDisplayMode()
|
||||
|
||||
HRESULT DirectDrawImpl::SetCooperativeLevel(HWND hWnd, DDSCLFlags dwFlags)
|
||||
{
|
||||
if (hWnd) {
|
||||
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
||||
if (sdlWindow) {
|
||||
bool fullscreen;
|
||||
if ((dwFlags & DDSCL_NORMAL) == DDSCL_NORMAL) {
|
||||
fullscreen = false;
|
||||
@ -291,10 +292,10 @@ HRESULT DirectDrawImpl::SetCooperativeLevel(HWND hWnd, DDSCLFlags dwFlags)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (!SDL_SetWindowFullscreen(hWnd, fullscreen)) {
|
||||
if (!SDL_SetWindowFullscreen(sdlWindow, fullscreen)) {
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
DDWindow = hWnd;
|
||||
DDWindow = sdlWindow;
|
||||
}
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -1,332 +0,0 @@
|
||||
#include "miniwin/mfc.h"
|
||||
|
||||
#include "miniwin.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
|
||||
char* afxCurrentAppName;
|
||||
AFX_MODULE_STATE g_CustomModuleState;
|
||||
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) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "There can only be one CWinApp!");
|
||||
abort();
|
||||
}
|
||||
wndTop = this;
|
||||
|
||||
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)) {
|
||||
SDL_Log("SDL_Init: %s\n", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
window = SDL_CreateWindow(title, 640, 480, 0);
|
||||
}
|
||||
|
||||
int CWinApp::ExitInstance()
|
||||
{
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char* get_base_filename(const char* path)
|
||||
{
|
||||
for (;;) {
|
||||
const char* next = SDL_strpbrk(path, "/\\");
|
||||
if (next == NULL) {
|
||||
break;
|
||||
}
|
||||
path = next + 1;
|
||||
}
|
||||
const char* end = SDL_strchr(path, '.');
|
||||
size_t len;
|
||||
if (end == NULL) {
|
||||
len = SDL_strlen(path);
|
||||
}
|
||||
else {
|
||||
len = end - path;
|
||||
}
|
||||
char* filename = new char[len + 1];
|
||||
SDL_memcpy(filename, path, len);
|
||||
filename[len] = '\0';
|
||||
return filename;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
afxCurrentAppName = get_base_filename(argv[0]);
|
||||
if (wndTop == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No CWinApp created");
|
||||
abort();
|
||||
}
|
||||
wndTop->InitInstance();
|
||||
|
||||
SDL_Event event;
|
||||
bool running = true;
|
||||
while (running) {
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_EVENT_QUIT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Delay(16); // 60 FPS
|
||||
}
|
||||
|
||||
int result = wndTop->ExitInstance();
|
||||
delete[] afxCurrentAppName;
|
||||
return result;
|
||||
}
|
||||
|
||||
void AfxMessageBox(const char* message)
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, message, NULL);
|
||||
}
|
||||
|
||||
BOOL GetWindowRect(HWND hWnd, RECT* Rect)
|
||||
{
|
||||
int x, y, w, h;
|
||||
if (!Rect) {
|
||||
return FALSE;
|
||||
}
|
||||
if (hWnd == NULL) {
|
||||
MINIWIN_NOT_IMPLEMENTED();
|
||||
return FALSE;
|
||||
}
|
||||
SDL_GetWindowPosition(hWnd, &x, &y);
|
||||
SDL_GetWindowSize(hWnd, &w, &h);
|
||||
|
||||
Rect->right = x;
|
||||
Rect->top = y;
|
||||
Rect->left = w + x;
|
||||
Rect->bottom = h + y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL GetVersionEx(OSVERSIONINFOA* version)
|
||||
{
|
||||
version->dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
||||
version->dwMajorVersion = 5; // Win2k/XP
|
||||
version->dwPlatformId = 2; // NT
|
||||
version->dwBuildNumber = 0x500;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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<HMENU>(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();
|
||||
}
|
@ -36,17 +36,18 @@ BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy,
|
||||
if (!hWnd) {
|
||||
return FALSE;
|
||||
}
|
||||
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
||||
|
||||
if (!(uFlags & SWP_NOACTIVATE)) {
|
||||
SDL_RaiseWindow(hWnd);
|
||||
SDL_RaiseWindow(sdlWindow);
|
||||
}
|
||||
|
||||
if (!(uFlags & SWP_NOSIZE)) {
|
||||
SDL_SetWindowSize(hWnd, cx, cy);
|
||||
SDL_SetWindowSize(sdlWindow, cx, cy);
|
||||
}
|
||||
|
||||
if (!(uFlags & SWP_NOMOVE)) {
|
||||
SDL_SetWindowPosition(hWnd, X, Y);
|
||||
SDL_SetWindowPosition(sdlWindow, X, Y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -181,8 +182,9 @@ int StretchDIBits(
|
||||
|
||||
LONG GetWindowLong(HWND hWnd, int nIndex)
|
||||
{
|
||||
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
||||
if (nIndex == GWL_STYLE) {
|
||||
Uint32 flags = SDL_GetWindowFlags(hWnd);
|
||||
Uint32 flags = SDL_GetWindowFlags(sdlWindow);
|
||||
LONG style = WS_POPUP;
|
||||
if ((flags & SDL_WINDOW_BORDERLESS) == 0) {
|
||||
style = WS_OVERLAPPED | WS_CAPTION;
|
||||
@ -202,9 +204,10 @@ LONG GetWindowLong(HWND hWnd, int nIndex)
|
||||
|
||||
LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
{
|
||||
SDL_Window* sdlWindow = reinterpret_cast<SDL_Window*>(hWnd);
|
||||
if (nIndex == GWL_STYLE) {
|
||||
SDL_SetWindowBordered(hWnd, (dwNewLong & WS_CAPTION) != 0);
|
||||
SDL_SetWindowResizable(hWnd, (dwNewLong & WS_THICKFRAME) != 0);
|
||||
SDL_SetWindowBordered(sdlWindow, (dwNewLong & WS_CAPTION) != 0);
|
||||
SDL_SetWindowResizable(sdlWindow, (dwNewLong & WS_THICKFRAME) != 0);
|
||||
|
||||
return dwNewLong;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user