mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
start porting config from mfc to qt
This commit is contained in:
parent
215c3f1480
commit
877c278ce9
@ -491,7 +491,9 @@ if (ISLE_BUILD_APP)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ISLE_BUILD_CONFIG)
|
if (ISLE_BUILD_CONFIG)
|
||||||
add_executable(config WIN32
|
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)
|
||||||
|
qt_standard_project_setup()
|
||||||
|
qt_add_executable(config
|
||||||
LEGO1/mxdirectx/mxdirectxinfo.cpp
|
LEGO1/mxdirectx/mxdirectxinfo.cpp
|
||||||
LEGO1/mxdirectx/legodxinfo.cpp
|
LEGO1/mxdirectx/legodxinfo.cpp
|
||||||
CONFIG/config.cpp
|
CONFIG/config.cpp
|
||||||
@ -503,7 +505,8 @@ if (ISLE_BUILD_CONFIG)
|
|||||||
CONFIG/res/config.rc
|
CONFIG/res/config.rc
|
||||||
)
|
)
|
||||||
if (ISLE_MINIWIN)
|
if (ISLE_MINIWIN)
|
||||||
target_link_libraries(config PRIVATE minimfc)
|
target_link_libraries(config PRIVATE minimfc)
|
||||||
|
target_link_libraries(config PRIVATE Qt6::Core Qt6::Widgets)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND isle_targets config)
|
list(APPEND isle_targets config)
|
||||||
target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
|
target_compile_definitions(config PRIVATE _AFXDLL MXDIRECTX_FOR_CONFIG)
|
||||||
|
|||||||
@ -6,14 +6,16 @@ DECOMP_SIZE_ASSERT(CDialog, 0x60)
|
|||||||
DECOMP_SIZE_ASSERT(CAboutDialog, 0x60)
|
DECOMP_SIZE_ASSERT(CAboutDialog, 0x60)
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00403c20
|
// FUNCTION: CONFIG 0x00403c20
|
||||||
CAboutDialog::CAboutDialog() : CDialog(IDD)
|
CAboutDialog::CAboutDialog() : QDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: CONFIG 0x00403d20
|
// FUNCTION: CONFIG 0x00403d20
|
||||||
|
/*
|
||||||
void CAboutDialog::DoDataExchange(CDataExchange* pDX)
|
void CAboutDialog::DoDataExchange(CDataExchange* pDX)
|
||||||
{
|
{
|
||||||
}
|
*/
|
||||||
|
//}
|
||||||
|
|
||||||
BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
|
/*BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)*/
|
||||||
END_MESSAGE_MAP()
|
/*END_MESSAGE_MAP()*/
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
// VTABLE: CONFIG 0x00406308
|
// VTABLE: CONFIG 0x00406308
|
||||||
// SIZE 0x60
|
// SIZE 0x60
|
||||||
class CAboutDialog : public CDialog {
|
class CAboutDialog : public QDialog {
|
||||||
public:
|
public:
|
||||||
CAboutDialog();
|
CAboutDialog();
|
||||||
enum {
|
enum {
|
||||||
@ -15,10 +15,10 @@ class CAboutDialog : public CDialog {
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DoDataExchange(CDataExchange* pDX) override;
|
/*void DoDataExchange(CDataExchange* pDX) override;*/
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_MESSAGE_MAP()
|
/*DECLARE_MESSAGE_MAP()*/
|
||||||
};
|
};
|
||||||
|
|
||||||
// SYNTHETIC: CONFIG 0x00403cb0
|
// SYNTHETIC: CONFIG 0x00403cb0
|
||||||
|
|||||||
@ -4,7 +4,9 @@
|
|||||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
|
||||||
#ifdef MINIMFC
|
#ifdef MINIMFC
|
||||||
#include "miniwin/mfc.h"
|
/*#include "miniwin/mfc.h"*/
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDialog>
|
||||||
#else
|
#else
|
||||||
#include <afxext.h> // MFC extensions
|
#include <afxext.h> // MFC extensions
|
||||||
#include <afxwin.h> // MFC core and standard components
|
#include <afxwin.h> // MFC core and standard components
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#if !defined(AFX_CONFIG_H)
|
#if !defined(AFX_CONFIG_H)
|
||||||
#define AFX_CONFIG_H
|
#define AFX_CONFIG_H
|
||||||
|
|
||||||
|
#include "AboutDlg.h"
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "decomp.h"
|
#include "decomp.h"
|
||||||
@ -19,7 +20,7 @@ struct MxDriver;
|
|||||||
|
|
||||||
// VTABLE: CONFIG 0x00406040
|
// VTABLE: CONFIG 0x00406040
|
||||||
// SIZE 0x108
|
// SIZE 0x108
|
||||||
class CConfigApp : public CWinApp {
|
class CConfigApp : public QApplication {
|
||||||
public:
|
public:
|
||||||
CConfigApp();
|
CConfigApp();
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,15 @@
|
|||||||
#ifdef MINIWIN
|
#ifdef MINIWIN
|
||||||
#include "miniwin/ddraw.h"
|
#include "miniwin/ddraw.h"
|
||||||
#include "miniwin/dinput.h"
|
#include "miniwin/dinput.h"
|
||||||
#include "miniwin/mfc.h"
|
#include "qoperatingsystemversion.h"
|
||||||
|
#include "qlibrary.h"
|
||||||
#else
|
#else
|
||||||
#include <ddraw.h>
|
#include <ddraw.h>
|
||||||
#include <dinput.h>
|
#include <dinput.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct IUnknown* LPUNKNOWN;
|
||||||
|
|
||||||
typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);
|
typedef HRESULT WINAPI DirectDrawCreate_fn(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter);
|
||||||
typedef HRESULT WINAPI
|
typedef HRESULT WINAPI
|
||||||
DirectInputCreateA_fn(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter);
|
DirectInputCreateA_fn(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter);
|
||||||
@ -25,93 +28,96 @@ BOOL DetectDirectX5()
|
|||||||
// FUNCTION: CONFIG 0x00404920
|
// FUNCTION: CONFIG 0x00404920
|
||||||
void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||||
{
|
{
|
||||||
OSVERSIONINFOA os_version;
|
QOperatingSystemVersion os_version = QOperatingSystemVersion::current();
|
||||||
|
|
||||||
os_version.dwOSVersionInfoSize = sizeof(os_version);
|
if (os_version.type() == QOperatingSystemVersion::Unknown) {
|
||||||
if (!GetVersionEx(&os_version)) {
|
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
*p_found = 0;
|
*p_found = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (os_version.dwPlatformId == 2) {
|
if (os_version.type() == QOperatingSystemVersion::Windows) {
|
||||||
*p_found = 2;
|
*p_found = 2;
|
||||||
if (os_version.dwMajorVersion < 4) {
|
if (os_version.majorVersion() < 4) {
|
||||||
*p_found = 0;
|
*p_found = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (os_version.dwMajorVersion != 4) {
|
if (os_version.majorVersion() != 4) {
|
||||||
*p_version = 0x501;
|
*p_version = 0x501;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_version = 0x200;
|
*p_version = 0x200;
|
||||||
HMODULE dinput_module = LoadLibrary("DINPUT.DLL");
|
QLibrary dinput_module("DINPUT.DLL");
|
||||||
if (!dinput_module) {
|
dinput_module.load();
|
||||||
OutputDebugString("Couldn't LoadLibrary DInput\r\n");
|
if (!dinput_module.isLoaded()) {
|
||||||
|
QT_DEBUG("Couldn't LoadLibrary DInput\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DirectInputCreateA_fn* func_DirectInputCreateA =
|
DirectInputCreateA_fn* func_DirectInputCreateA =
|
||||||
(DirectInputCreateA_fn*) GetProcAddress(dinput_module, "DirectInputCreateA");
|
reinterpret_cast<DirectInputCreateA_fn*>(dinput_module.resolve("DirectInputCreateA"));
|
||||||
FreeLibrary(dinput_module);
|
dinput_module.unload();
|
||||||
if (!func_DirectInputCreateA) {
|
if (!func_DirectInputCreateA) {
|
||||||
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
|
QT_DEBUG("Couldn't GetProcAddress DInputCreate\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_version = 0x300;
|
*p_version = 0x300;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_found = 1;
|
*p_found = 1;
|
||||||
if (LOWORD(os_version.dwBuildNumber) >= 0x550) {
|
if (os_version.majorVersion() >= 0x550) {
|
||||||
|
QT_DEBUG("what is this for??");
|
||||||
*p_version = 0x501;
|
*p_version = 0x501;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HMODULE ddraw_module = LoadLibrary("DDRAW.DLL");
|
QLibrary ddraw_module("DDRAW.DLL");
|
||||||
if (!ddraw_module) {
|
ddraw_module.load();
|
||||||
|
if (!ddraw_module.isLoaded()) {
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
*p_found = 0;
|
*p_found = 0;
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DirectDrawCreate_fn* func_DirectDrawCreate =
|
DirectDrawCreate_fn* func_DirectDrawCreate =
|
||||||
(DirectDrawCreate_fn*) GetProcAddress(ddraw_module, "DirectDrawCreate");
|
reinterpret_cast<DirectDrawCreate_fn*>(ddraw_module.resolve("DirectDrawCreate"));
|
||||||
if (!func_DirectDrawCreate) {
|
if (!func_DirectDrawCreate) {
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
*p_found = 0;
|
*p_found = 0;
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
OutputDebugString("Couldn't LoadLibrary DDraw\r\n");
|
QT_DEBUG("Couldn't LoadLibrary DDraw\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LPDIRECTDRAW ddraw;
|
LPDIRECTDRAW ddraw;
|
||||||
if (FAILED(func_DirectDrawCreate(NULL, &ddraw, NULL))) {
|
if (func_DirectDrawCreate(NULL, &ddraw, NULL) < 0) {
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
*p_found = 0;
|
*p_found = 0;
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
OutputDebugString("Couldn't create DDraw\r\n");
|
QT_DEBUG("Couldn't create DDraw\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_version = 0x100;
|
*p_version = 0x100;
|
||||||
LPDIRECTDRAW2 ddraw2;
|
LPDIRECTDRAW2 ddraw2;
|
||||||
if (FAILED(ddraw->QueryInterface(IID_IDirectDraw2, (LPVOID*) &ddraw2))) {
|
if (ddraw->QueryInterface(IID_IDirectDraw2, (LPVOID*) &ddraw2) < 0) {
|
||||||
ddraw->Release();
|
ddraw->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
OutputDebugString("Couldn't QI DDraw2\r\n");
|
QT_DEBUG("Couldn't QI DDraw2\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ddraw->Release();
|
ddraw->Release();
|
||||||
*p_version = 0x200;
|
*p_version = 0x200;
|
||||||
HMODULE dinput_module = LoadLibrary("DINPUT.DLL");
|
QLibrary dinput_module("DINPUT.DLL");
|
||||||
if (!dinput_module) {
|
dinput_module.load();
|
||||||
OutputDebugString("Couldn't LoadLibrary DInput\r\n");
|
if (!dinput_module.isLoaded()) {
|
||||||
|
QT_DEBUG("Couldn't LoadLibrary DInput\r\n");
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DirectInputCreateA_fn* func_DirectInputCreateA =
|
DirectInputCreateA_fn* func_DirectInputCreateA =
|
||||||
(DirectInputCreateA_fn*) GetProcAddress(dinput_module, "DirectInputCreateA");
|
reinterpret_cast<DirectInputCreateA_fn*>(dinput_module.resolve("DirectInputCreateA"));
|
||||||
FreeLibrary(dinput_module);
|
dinput_module.unload();
|
||||||
if (!func_DirectInputCreateA) {
|
if (!func_DirectInputCreateA) {
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
|
QT_DEBUG("Couldn't GetProcAddress DInputCreate\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_version = 0x300;
|
*p_version = 0x300;
|
||||||
@ -120,29 +126,29 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
|||||||
surface_desc.dwSize = sizeof(surface_desc);
|
surface_desc.dwSize = sizeof(surface_desc);
|
||||||
surface_desc.dwFlags = DDSD_CAPS;
|
surface_desc.dwFlags = DDSD_CAPS;
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
if (FAILED(ddraw2->SetCooperativeLevel(NULL, DDSCL_NORMAL))) {
|
if (ddraw2->SetCooperativeLevel(NULL, DDSCL_NORMAL) < 0) {
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
OutputDebugString("Couldn't Set coop level\r\n");
|
QT_DEBUG("Couldn't Set coop level\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LPDIRECTDRAWSURFACE surface;
|
LPDIRECTDRAWSURFACE surface;
|
||||||
if (FAILED(ddraw2->CreateSurface(&surface_desc, &surface, NULL))) {
|
if (ddraw2->CreateSurface(&surface_desc, &surface, NULL) < 0) {
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
*p_version = 0;
|
*p_version = 0;
|
||||||
OutputDebugString("Couldn't CreateSurface\r\n");
|
QT_DEBUG("Couldn't CreateSurface\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LPDIRECTDRAWSURFACE3 surface3;
|
LPDIRECTDRAWSURFACE3 surface3;
|
||||||
if (FAILED(surface->QueryInterface(IID_IDirectDrawSurface3, (LPVOID*) &surface3))) {
|
if (surface->QueryInterface(IID_IDirectDrawSurface3, reinterpret_cast<LPVOID*>(&surface3)) < 0) {
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*p_version = 0x500;
|
*p_version = 0x500;
|
||||||
surface3->Release();
|
surface3->Release();
|
||||||
ddraw2->Release();
|
ddraw2->Release();
|
||||||
FreeLibrary(ddraw_module);
|
ddraw_module.unload();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user