mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Decompiled CONFIG.EXE executable (#533)
* mxdirectdraw: no need to explicitly add a terminating '\0' in C * mxstopwatch must include LIMITS.H for ULONG_MAX * Add Config app * 88.78% * style fixes * Test more CONFIG things * Add a few assertions on MFC classes * reformat * actionSSSSSSSSSSSSSSS * actions again * decomplint needed a shebang * Fix annotations of Message Map entries * ci: We're building CONFIG.EXE, not CONFIG.DLL * remove ninja.exe * Fix CAboutDialog::GetMessageMap annotation * format reloaded * Fix global CConfigApp object annotation * trigger worflows * ci: request at least python 3 * oops :) * curl CONFIGPROGRESS-OLD.TXT will fail * Forget about actions/setup-python (for now) * Annotation fixes * Config tweaks and MxDirect3d annotations * It's important to compare against the correct file * Introduce common CDialog parent for CAboutDialog and CMainDialog * format * Remove CSerializer --------- Co-authored-by: disinvite <disinvite@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
917485247b
commit
ccb6223d70
19
CONFIG/AboutDlg.cpp
Normal file
19
CONFIG/AboutDlg.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "AboutDlg.h"
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(CDialog, 0x60)
|
||||
DECOMP_SIZE_ASSERT(CAboutDialog, 0x60)
|
||||
|
||||
// FUNCTION: CONFIG 0x00403c20
|
||||
CAboutDialog::CAboutDialog() : CCommonDialog(IDD)
|
||||
{
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403d20
|
||||
void CAboutDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDialog, CDialog)
|
||||
END_MESSAGE_MAP()
|
49
CONFIG/AboutDlg.h
Normal file
49
CONFIG/AboutDlg.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#if !defined(AFX_ABOUTDLG_H)
|
||||
#define AFX_ABOUTDLG_H
|
||||
|
||||
#include "afxwin.h"
|
||||
#include "common.h"
|
||||
#include "compat.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
// VTABLE: CONFIG 0x00406308
|
||||
// SIZE 0x60
|
||||
class CAboutDialog : public CCommonDialog {
|
||||
public:
|
||||
CAboutDialog();
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMainDialog)
|
||||
enum {
|
||||
IDD = IDD_ABOUT
|
||||
};
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainDialog)
|
||||
|
||||
protected:
|
||||
void DoDataExchange(CDataExchange* pDX) override;
|
||||
//}}AFX_VIRTUAL
|
||||
// void UpdateInterface();
|
||||
// void SwitchToAdvanced(BOOL p_advanced);
|
||||
// Implementation
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(CMainDialog)
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403cb0
|
||||
// CAboutDialog::`scalar deleting destructor'
|
||||
|
||||
// FUNCTION: CONFIG 0x00403d40
|
||||
// CAboutDialog::GetMessageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x00406100
|
||||
// CAboutDialog::messageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x00406108
|
||||
// CAboutDialog::_messageEntries
|
||||
|
||||
#endif // !defined(AFX_ABOUTDLG_H)
|
22
CONFIG/ConfigCommandLineInfo.cpp
Normal file
22
CONFIG/ConfigCommandLineInfo.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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 (lstrcmpiA(pszParam, "config") == 0) {
|
||||
currentConfigApp->m_run_config_dialog = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
22
CONFIG/ConfigCommandLineInfo.h
Normal file
22
CONFIG/ConfigCommandLineInfo.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#if !defined(AFX_CONFIGCOMMANDLINEINFO_H)
|
||||
#define AFX_CONFIGCOMMANDLINEINFO_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#include "decomp.h"
|
||||
|
||||
#include <afxwin.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)
|
344
CONFIG/MainDlg.cpp
Normal file
344
CONFIG/MainDlg.cpp
Normal file
@@ -0,0 +1,344 @@
|
||||
#include "MainDlg.h"
|
||||
|
||||
#include "AboutDlg.h"
|
||||
#include "config.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
#include <mxdirectx/mxdirect3d.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(CDialog, 0x60)
|
||||
DECOMP_SIZE_ASSERT(CMainDialog, 0x70)
|
||||
|
||||
// FUNCTION: CONFIG 0x00403d50
|
||||
CMainDialog::CMainDialog(CWnd* pParent) : CCommonDialog(IDD, pParent)
|
||||
{
|
||||
afxCurrentWinApp;
|
||||
m_icon = LoadIconA(AfxFindResourceHandle(MAKEINTRESOURCE(IDI_CONFIG), RT_GROUP_ICON), MAKEINTRESOURCE(IDI_CONFIG));
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
SwitchToAdvanced(FALSE);
|
||||
CMenu* system_menu = CMenu::FromHandle(::GetSystemMenu(m_hWnd, FALSE));
|
||||
CString about_text;
|
||||
about_text.LoadString(IDS_ABOUT);
|
||||
if (system_menu) {
|
||||
AppendMenuA(system_menu->m_hMenu, MF_SEPARATOR, 0, NULL);
|
||||
AppendMenuA(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);
|
||||
MxDeviceEnumerate* 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;
|
||||
char device_name[256];
|
||||
const list<MxDriver>& driver_list = enumerator->GetDriverList();
|
||||
for (list<MxDriver>::const_iterator it_driver = driver_list.begin(); it_driver != driver_list.end(); it_driver++) {
|
||||
const MxDriver& driver = *it_driver;
|
||||
for (list<MxDevice>::const_iterator it_device = driver.m_devices.begin(); it_device != driver.m_devices.end();
|
||||
it_device++) {
|
||||
const MxDevice& device = *it_device;
|
||||
if (&device == currentConfigApp->m_device) {
|
||||
selected = device_i;
|
||||
}
|
||||
device_i += 1;
|
||||
sprintf(
|
||||
device_name,
|
||||
driver_i == 0 ? "%s ( Primary Device )" : "%s ( Secondary Device )",
|
||||
device.m_deviceName
|
||||
);
|
||||
::SendMessage(list_3d_devices->m_hWnd, LB_ADDSTRING, 0, (LPARAM) device_name);
|
||||
}
|
||||
driver_i += 1;
|
||||
}
|
||||
::SendMessage(list_3d_devices->m_hWnd, LB_SETCURSEL, selected, 0);
|
||||
UpdateInterface();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404080
|
||||
void CMainDialog::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
{
|
||||
if ((nID & 0xfff0) == 0x10) {
|
||||
CAboutDialog about_dialog;
|
||||
about_dialog.DoModal();
|
||||
}
|
||||
else {
|
||||
Default();
|
||||
}
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
MxDeviceEnumerate* 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()) {
|
||||
GetDlgItem(IDC_CHK_DRAW_CURSOR)->EnableWindow(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_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()
|
||||
{
|
||||
if (m_modified) {
|
||||
currentConfigApp->WriteRegisterSettings();
|
||||
}
|
||||
OnCancel();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404360
|
||||
void CMainDialog::UpdateInterface()
|
||||
{
|
||||
currentConfigApp->ValidateSettings();
|
||||
GetDlgItem(IDC_CHK_3D_VIDEO_MEMORY)
|
||||
->EnableWindow(!currentConfigApp->m_flip_surfaces && !currentConfigApp->GetHardwareDeviceColorModel());
|
||||
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;
|
||||
currentConfigApp->FUN_00403810();
|
||||
if (currentConfigApp->GetHardwareDeviceColorModel()) {
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, TRUE);
|
||||
}
|
||||
else {
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, FALSE);
|
||||
currentConfigApp->m_draw_cursor = FALSE;
|
||||
GetDlgItem(IDC_CHK_DRAW_CURSOR)->EnableWindow(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
|
||||
);
|
||||
}
|
||||
else {
|
||||
CheckDlgButton(IDC_RAD_PALETTE_256, 0);
|
||||
CheckDlgButton(IDC_RAD_PALETTE_16BIT, 0);
|
||||
currentConfigApp->m_display_bit_depth = 0;
|
||||
}
|
||||
GetDlgItem(IDC_RAD_PALETTE_256)->EnableWindow(full_screen && currentConfigApp->FUN_004037a0());
|
||||
GetDlgItem(IDC_RAD_PALETTE_16BIT)->EnableWindow(full_screen && currentConfigApp->FUN_004037e0());
|
||||
CheckDlgButton(IDC_CHK_3DSOUND, currentConfigApp->m_3d_sound);
|
||||
CheckDlgButton(IDC_CHK_DRAW_CURSOR, 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);
|
||||
break;
|
||||
case 2:
|
||||
CheckRadioButton(IDC_RAD_MODEL_QUALITY_LOW, IDC_RAD_MODEL_QUALITY_HIGH, IDC_RAD_MODEL_QUALITY_HIGH);
|
||||
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);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004045e0
|
||||
void CMainDialog::OnCheckbox3DSound()
|
||||
{
|
||||
currentConfigApp->m_3d_sound = IsDlgButtonChecked(IDC_CHK_3DSOUND);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404610
|
||||
void CMainDialog::OnCheckbox3DVideoMemory()
|
||||
{
|
||||
currentConfigApp->m_3d_video_ram = IsDlgButtonChecked(IDC_CHK_3D_VIDEO_MEMORY);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404640
|
||||
void CMainDialog::OnRadiobuttonPalette16bit()
|
||||
{
|
||||
currentConfigApp->m_display_bit_depth = 16;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404670
|
||||
void CMainDialog::OnRadiobuttonPalette256()
|
||||
{
|
||||
currentConfigApp->m_display_bit_depth = 8;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004046a0
|
||||
void CMainDialog::OnCheckboxFlipVideoMemPages()
|
||||
{
|
||||
currentConfigApp->m_flip_surfaces = IsDlgButtonChecked(IDC_CHK_FLIP_VIDEO_MEM_PAGES);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004046d0
|
||||
void CMainDialog::OnRadiobuttonModelLowQuality()
|
||||
{
|
||||
currentConfigApp->m_model_quality = 1;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404700
|
||||
void CMainDialog::OnRadiobuttonModelHighQuality()
|
||||
{
|
||||
currentConfigApp->m_model_quality = 2;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404730
|
||||
void CMainDialog::OnRadiobuttonTextureLowQuality()
|
||||
{
|
||||
currentConfigApp->m_texture_quality = 0;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404760
|
||||
void CMainDialog::OnRadiobuttonTextureHighQuality()
|
||||
{
|
||||
currentConfigApp->m_texture_quality = 1;
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404790
|
||||
void CMainDialog::OnCheckboxJoystick()
|
||||
{
|
||||
currentConfigApp->m_use_joystick = IsDlgButtonChecked(IDC_CHK_JOYSTICK);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004047c0
|
||||
void CMainDialog::OnButtonAdvanced()
|
||||
{
|
||||
SwitchToAdvanced(!m_advanced);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004047d0
|
||||
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_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()
|
||||
{
|
||||
currentConfigApp->m_draw_cursor = IsDlgButtonChecked(IDC_CHK_DRAW_CURSOR);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004048c0
|
||||
void CMainDialog::OnCheckboxMusic()
|
||||
{
|
||||
currentConfigApp->m_music = IsDlgButtonChecked(IDC_CHK_MUSIC);
|
||||
m_modified = TRUE;
|
||||
UpdateInterface();
|
||||
}
|
76
CONFIG/MainDlg.h
Normal file
76
CONFIG/MainDlg.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#if !defined(AFX_MAINDLG_H)
|
||||
#define AFX_MAINDLG_H
|
||||
|
||||
#include "afxwin.h"
|
||||
#include "common.h"
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
#include "res/resource.h"
|
||||
|
||||
// VTABLE: CONFIG 0x004063e0
|
||||
// SIZE 0x70
|
||||
class CMainDialog : public CCommonDialog {
|
||||
public:
|
||||
CMainDialog(CWnd* pParent);
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CMainDialog)
|
||||
enum {
|
||||
IDD = IDD_MAIN
|
||||
};
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainDialog)
|
||||
|
||||
protected:
|
||||
void DoDataExchange(CDataExchange* pDX) override;
|
||||
//}}AFX_VIRTUAL
|
||||
void UpdateInterface();
|
||||
void SwitchToAdvanced(BOOL p_advanced);
|
||||
|
||||
undefined m_unk0x60[4]; // 0x60
|
||||
HCURSOR m_icon; // 0x64
|
||||
BOOL m_modified; // 0x68
|
||||
BOOL m_advanced; // 0x6c
|
||||
// Implementation
|
||||
|
||||
protected:
|
||||
//{{AFX_MSG(CMainDialog)
|
||||
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 OnButtonAdvanced();
|
||||
void OnCheckboxDrawCursor();
|
||||
void OnCheckboxMusic();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00403de0
|
||||
// CMainDialog::`scalar deleting destructor'
|
||||
|
||||
// FUNCTION: CONFIG 0x00403e70
|
||||
// CMainDialog::GetMessageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x00406120
|
||||
// CMainDialog::messageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x00406128
|
||||
// CMainDialog::_messageEntries
|
||||
|
||||
#endif // !defined(AFX_MAINDLG_H)
|
13
CONFIG/common.cpp
Normal file
13
CONFIG/common.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "common.h"
|
||||
|
||||
// FUNCTION: CONFIG 0x00403c90
|
||||
void CCommonDialog::BeginModalState()
|
||||
{
|
||||
::EnableWindow(m_hWnd, FALSE);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403ca0
|
||||
void CCommonDialog::EndModalState()
|
||||
{
|
||||
::EnableWindow(m_hWnd, TRUE);
|
||||
}
|
16
CONFIG/common.h
Normal file
16
CONFIG/common.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef AFX_COMMON_H
|
||||
#define AFX_COMMON_H
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include <afxwin.h>
|
||||
|
||||
class CCommonDialog : public CDialog {
|
||||
public:
|
||||
CCommonDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL) : CDialog(nIDTemplate, pParentWnd) {}
|
||||
|
||||
void BeginModalState() override;
|
||||
void EndModalState() override;
|
||||
};
|
||||
|
||||
#endif
|
434
CONFIG/config.cpp
Normal file
434
CONFIG/config.cpp
Normal file
@@ -0,0 +1,434 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "ConfigCommandLineInfo.h"
|
||||
#include "MainDlg.h"
|
||||
#include "detectdx5.h"
|
||||
|
||||
#include <direct.h> // _chdir
|
||||
#include <mxdirectx/mxdirect3d.h>
|
||||
#include <process.h> // _spawnl
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
||||
#define MiB (1024 * 1024)
|
||||
|
||||
// FUNCTION: CONFIG 0x00402dc0
|
||||
BOOL CConfigApp::InitInstance()
|
||||
{
|
||||
if (!IsLegoNotRunning()) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!DetectDirectX5()) {
|
||||
AfxMessageBox(
|
||||
"\"LEGO\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;
|
||||
}
|
||||
m_device_enumerator = new MxDeviceEnumerate;
|
||||
if (m_device_enumerator->DoEnumerate()) {
|
||||
return FALSE;
|
||||
}
|
||||
m_driver = NULL;
|
||||
m_device = NULL;
|
||||
m_full_screen = TRUE;
|
||||
m_wide_view_angle = TRUE;
|
||||
m_use_joystick = FALSE;
|
||||
m_music = TRUE;
|
||||
m_flip_surfaces = FALSE;
|
||||
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) {
|
||||
m_3d_sound = FALSE;
|
||||
m_model_quality = 0;
|
||||
m_texture_quality = 1;
|
||||
}
|
||||
else if (memory_status.dwTotalPhys < 20 * MiB) {
|
||||
m_3d_sound = FALSE;
|
||||
m_model_quality = 1;
|
||||
m_texture_quality = 1;
|
||||
}
|
||||
else {
|
||||
m_model_quality = 2;
|
||||
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 = FindWindowA("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 (RegCreateKeyExA(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
"SOFTWARE\\Mindscape\\LEGO Island",
|
||||
0,
|
||||
"string",
|
||||
0,
|
||||
KEY_READ | KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
&pos
|
||||
) == ERROR_SUCCESS) {
|
||||
if (RegSetValueExA(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 (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
|
||||
if (RegQueryValueExA(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;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004033d0
|
||||
BOOL CConfigApp::FUN_004033d0() const
|
||||
{
|
||||
/*
|
||||
* BUG: should be:
|
||||
* return !GetHardwareDeviceColorModel() && (m_device->m_HELDesc.dcmColorModel & D3DCOLOR_RGB);
|
||||
*/
|
||||
return !GetHardwareDeviceColorModel() && m_device->m_HELDesc.dcmColorModel == D3DCOLOR_RGB;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403400
|
||||
D3DCOLORMODEL CConfigApp::GetHardwareDeviceColorModel() const
|
||||
{
|
||||
return m_device->m_HWDesc.dcmColorModel;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403410
|
||||
BOOL CConfigApp::IsPrimaryDriver() const
|
||||
{
|
||||
return m_driver == &m_device_enumerator->GetDriverList().front();
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403430
|
||||
BOOL CConfigApp::ReadRegisterSettings()
|
||||
{
|
||||
char buffer[256];
|
||||
BOOL is_modified = FALSE;
|
||||
int tmp = -1;
|
||||
|
||||
if (ReadReg("3D Device ID", buffer, sizeof(buffer))) {
|
||||
tmp = m_device_enumerator->ParseDeviceName(buffer);
|
||||
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->FUN_1009d0d0();
|
||||
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;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403630
|
||||
BOOL CConfigApp::ValidateSettings()
|
||||
{
|
||||
BOOL is_modified = FALSE;
|
||||
|
||||
if (!IsPrimaryDriver() && !m_full_screen) {
|
||||
m_full_screen = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (FUN_004033d0()) {
|
||||
if (m_3d_video_ram) {
|
||||
m_3d_video_ram = FALSE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (m_flip_surfaces) {
|
||||
m_flip_surfaces = FALSE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (m_display_bit_depth != 16) {
|
||||
m_display_bit_depth = 16;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
}
|
||||
if (!GetHardwareDeviceColorModel()) {
|
||||
m_draw_cursor = FALSE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
else {
|
||||
if (!m_3d_video_ram) {
|
||||
m_3d_video_ram = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (m_full_screen && !m_flip_surfaces) {
|
||||
m_flip_surfaces = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
}
|
||||
if (m_flip_surfaces) {
|
||||
if (!m_3d_video_ram) {
|
||||
m_3d_video_ram = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (!m_full_screen) {
|
||||
m_full_screen = TRUE;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
}
|
||||
if ((m_display_bit_depth != 8 && m_display_bit_depth != 16) && (m_display_bit_depth != 0 || m_full_screen)) {
|
||||
m_display_bit_depth = 8;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (m_model_quality < 0 || m_model_quality > 2) {
|
||||
m_model_quality = 1;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
if (m_texture_quality < 0 || m_texture_quality > 1) {
|
||||
m_texture_quality = 0;
|
||||
is_modified = TRUE;
|
||||
}
|
||||
return is_modified;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004037a0
|
||||
DWORD CConfigApp::FUN_004037a0() const
|
||||
{
|
||||
if (FUN_004033d0()) {
|
||||
return 0;
|
||||
}
|
||||
if (GetHardwareDeviceColorModel()) {
|
||||
return 0;
|
||||
}
|
||||
return m_device->m_HELDesc.dwDeviceRenderBitDepth & 0x800;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x004037e0
|
||||
DWORD CConfigApp::FUN_004037e0() const
|
||||
{
|
||||
if (GetHardwareDeviceColorModel()) {
|
||||
return m_device->m_HWDesc.dwDeviceRenderBitDepth & 0x400;
|
||||
}
|
||||
else {
|
||||
return m_device->m_HELDesc.dwDeviceRenderBitDepth & 0x400;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403810
|
||||
BOOL CConfigApp::FUN_00403810()
|
||||
{
|
||||
if (m_display_bit_depth == 8) {
|
||||
if (FUN_004037a0()) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (m_display_bit_depth == 16) {
|
||||
if (FUN_004037e0()) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (FUN_004037a0()) {
|
||||
m_display_bit_depth = 8;
|
||||
return TRUE;
|
||||
}
|
||||
if (FUN_004037e0()) {
|
||||
m_display_bit_depth = 16;
|
||||
return TRUE;
|
||||
}
|
||||
m_display_bit_depth = 8;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 00403890
|
||||
void CConfigApp::WriteRegisterSettings() const
|
||||
|
||||
{
|
||||
char buffer[128];
|
||||
|
||||
#define WriteRegBool(NAME, VALUE) WriteReg(NAME, VALUE ? "YES" : "NO")
|
||||
#define WriteRegInt(NAME, VALUE) \
|
||||
do { \
|
||||
sprintf(buffer, "%d", VALUE); \
|
||||
WriteReg(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
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00403a90
|
||||
int CConfigApp::ExitInstance()
|
||||
{
|
||||
if (m_device_enumerator) {
|
||||
delete m_device_enumerator;
|
||||
m_device_enumerator = NULL;
|
||||
}
|
||||
return CWinApp::ExitInstance();
|
||||
}
|
||||
|
||||
// GLOBAL: CONFIG 0x00408e50
|
||||
CConfigApp g_theApp;
|
88
CONFIG/config.h
Normal file
88
CONFIG/config.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#if !defined(AFX_CONFIG_H)
|
||||
#define AFX_CONFIG_H
|
||||
|
||||
#include "compat.h"
|
||||
#include "decomp.h"
|
||||
|
||||
#include <afxwin.h>
|
||||
#include <d3d.h>
|
||||
|
||||
class MxDeviceEnumerate;
|
||||
struct MxDevice;
|
||||
struct MxDriver;
|
||||
|
||||
#define currentConfigApp ((CConfigApp*) afxCurrentWinApp)
|
||||
|
||||
// VTABLE: CONFIG 0x00406040
|
||||
// SIZE 0x108
|
||||
class CConfigApp : public CWinApp {
|
||||
public:
|
||||
CConfigApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CConfigApp)
|
||||
|
||||
public:
|
||||
BOOL InitInstance() override;
|
||||
int ExitInstance() override;
|
||||
//}}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 FUN_004033d0() const;
|
||||
D3DCOLORMODEL GetHardwareDeviceColorModel() const;
|
||||
BOOL IsPrimaryDriver() const;
|
||||
BOOL ReadRegisterSettings();
|
||||
BOOL ValidateSettings();
|
||||
DWORD FUN_004037a0() const;
|
||||
DWORD FUN_004037e0() const;
|
||||
BOOL FUN_00403810();
|
||||
void CConfigApp::WriteRegisterSettings() 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();
|
||||
|
||||
public:
|
||||
MxDeviceEnumerate* m_device_enumerator; // 0x0c4
|
||||
MxDriver* m_driver; // 0x0c8
|
||||
MxDevice* 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
|
||||
};
|
||||
|
||||
// SYNTHETIC: CONFIG 0x00402cd0
|
||||
// CConfigApp::`scalar deleting destructor'
|
||||
|
||||
// FUNCTION: CONFIG 0x402c30
|
||||
// CConfigApp::GetMessageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x406008
|
||||
// CConfigApp::messageMap
|
||||
|
||||
// GLOBAL: CONFIG 0x406010
|
||||
// CConfigApp::_messageEntries
|
||||
|
||||
#endif // !defined(AFX_CONFIG_H)
|
142
CONFIG/detectdx5.cpp
Normal file
142
CONFIG/detectdx5.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
#include "detectdx5.h"
|
||||
|
||||
#include <ddraw.h>
|
||||
#include <dinput.h>
|
||||
|
||||
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()
|
||||
{
|
||||
unsigned int version;
|
||||
BOOL found;
|
||||
DetectDirectX(&version, &found);
|
||||
return version >= 0x500;
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00404920
|
||||
void DetectDirectX(unsigned int* p_version, BOOL* p_found)
|
||||
{
|
||||
OSVERSIONINFOA os_version;
|
||||
|
||||
os_version.dwOSVersionInfoSize = sizeof(os_version);
|
||||
if (!GetVersionExA(&os_version)) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
return;
|
||||
}
|
||||
if (os_version.dwPlatformId == 2) {
|
||||
*p_found = 2;
|
||||
if (os_version.dwMajorVersion < 4) {
|
||||
*p_found = 0;
|
||||
return;
|
||||
}
|
||||
if (os_version.dwMajorVersion != 4) {
|
||||
*p_version = 0x501;
|
||||
return;
|
||||
}
|
||||
*p_version = 0x200;
|
||||
HMODULE dinput_module = LoadLibraryA("DINPUT.DLL");
|
||||
if (!dinput_module) {
|
||||
OutputDebugStringA("Couldn't LoadLibrary DInput\r\n");
|
||||
return;
|
||||
}
|
||||
DirectInputCreateA_fn* func_DirectInputCreateA =
|
||||
(DirectInputCreateA_fn*) GetProcAddress(dinput_module, "DirectInputCreateA");
|
||||
FreeLibrary(dinput_module);
|
||||
if (!func_DirectInputCreateA) {
|
||||
OutputDebugStringA("Couldn't GetProcAddress DInputCreate\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x300;
|
||||
return;
|
||||
}
|
||||
*p_found = 1;
|
||||
if (LOWORD(os_version.dwBuildNumber) >= 0x550) {
|
||||
*p_version = 0x501;
|
||||
return;
|
||||
}
|
||||
HMODULE ddraw_module = LoadLibraryA("DDRAW.DLL");
|
||||
if (!ddraw_module) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
FreeLibrary(ddraw_module);
|
||||
return;
|
||||
}
|
||||
DirectDrawCreate_fn* func_DirectDrawCreate =
|
||||
(DirectDrawCreate_fn*) GetProcAddress(ddraw_module, "DirectDrawCreate");
|
||||
if (!func_DirectDrawCreate) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
FreeLibrary(ddraw_module);
|
||||
OutputDebugStringA("Couldn't LoadLibrary DDraw\r\n");
|
||||
return;
|
||||
}
|
||||
LPDIRECTDRAW ddraw;
|
||||
if (FAILED(func_DirectDrawCreate(NULL, &ddraw, NULL))) {
|
||||
*p_version = 0;
|
||||
*p_found = 0;
|
||||
FreeLibrary(ddraw_module);
|
||||
OutputDebugStringA("Couldn't create DDraw\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x100;
|
||||
LPDIRECTDRAW2 ddraw2;
|
||||
if (FAILED(ddraw->QueryInterface(IID_IDirectDraw2, (LPVOID*) &ddraw2))) {
|
||||
ddraw->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
OutputDebugStringA("Couldn't QI DDraw2\r\n");
|
||||
return;
|
||||
}
|
||||
ddraw->Release();
|
||||
*p_version = 0x200;
|
||||
HMODULE dinput_module = LoadLibraryA("DINPUT.DLL");
|
||||
if (!dinput_module) {
|
||||
OutputDebugStringA("Couldn't LoadLibrary DInput\r\n");
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
return;
|
||||
}
|
||||
DirectInputCreateA_fn* func_DirectInputCreateA =
|
||||
(DirectInputCreateA_fn*) GetProcAddress(dinput_module, "DirectInputCreateA");
|
||||
FreeLibrary(dinput_module);
|
||||
if (!func_DirectInputCreateA) {
|
||||
FreeLibrary(ddraw_module);
|
||||
ddraw2->Release();
|
||||
OutputDebugStringA("Couldn't GetProcAddress DInputCreate\r\n");
|
||||
return;
|
||||
}
|
||||
*p_version = 0x300;
|
||||
DDSURFACEDESC surface_desc;
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_CAPS;
|
||||
surface_desc.ddsCaps.dwCaps = DDCAPS2_NONLOCALVIDMEM;
|
||||
if (FAILED(ddraw2->SetCooperativeLevel(NULL, DISCL_BACKGROUND))) {
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
*p_version = 0;
|
||||
OutputDebugStringA("Couldn't Set coop level\r\n");
|
||||
return;
|
||||
}
|
||||
LPDIRECTDRAWSURFACE surface;
|
||||
if (FAILED(ddraw2->CreateSurface(&surface_desc, &surface, NULL))) {
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
*p_version = 0;
|
||||
OutputDebugStringA("Couldn't CreateSurface\r\n");
|
||||
return;
|
||||
}
|
||||
LPDIRECTDRAWSURFACE3 surface3;
|
||||
if (FAILED(surface->QueryInterface(IID_IDirectDrawSurface3, (LPVOID*) &surface3))) {
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
return;
|
||||
}
|
||||
*p_version = 0x500;
|
||||
surface3->Release();
|
||||
ddraw2->Release();
|
||||
FreeLibrary(ddraw_module);
|
||||
}
|
10
CONFIG/detectdx5.h
Normal file
10
CONFIG/detectdx5.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#if !defined(AFX_DETECTDX5_H)
|
||||
#define AFX_DETECTDX5_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
extern BOOL DetectDirectX5();
|
||||
|
||||
extern void DetectDirectX(unsigned int* p_version, BOOL* p_found);
|
||||
|
||||
#endif // !defined(AFX_DETECTDX5_H)
|
12
CONFIG/library_mfc.h
Normal file
12
CONFIG/library_mfc.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifdef 0
|
||||
|
||||
// FUNCTION: CONFIG 0x402ca0
|
||||
// CObject::Serialize
|
||||
|
||||
// FUNCTION: CONFIG 0x402cb0
|
||||
// CObject::AssertValid
|
||||
|
||||
// FUNCTION: CONFIG 0x402cc0
|
||||
// CObject::Dump
|
||||
|
||||
#endif
|
82
CONFIG/res/config.rc
Normal file
82
CONFIG/res/config.rc
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "resource.h"
|
||||
#include "afxres.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 VERSIONINFO
|
||||
FILEVERSION 1,1,0,0
|
||||
PRODUCTVERSION 1,1,0,0
|
||||
FILEOS 0x4
|
||||
FILETYPE 0x1
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Mindscape, Inc."
|
||||
VALUE "FileDescription", "LEGOIsland & Configuration application"
|
||||
VALUE "FileVersion", "1, 1, 0, 0"
|
||||
VALUE "InternalName", "LEGOISLE.EXE"
|
||||
VALUE "LegalCopyright", "Copyright \xA9 1997"
|
||||
VALUE "OriginalFilename", "CONFIG.EXE"
|
||||
VALUE "ProductName", "LEGO Island"
|
||||
VALUE "ProductVersion", "1, 1, 0, 0"
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0x04B0 // U.S. English, Unicode
|
||||
END
|
||||
END
|
BIN
CONFIG/res/lego.ico
Normal file
BIN
CONFIG/res/lego.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
25
CONFIG/res/resource.h
Normal file
25
CONFIG/res/resource.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#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
|
BIN
CONFIG/res/shark.bmp
Normal file
BIN
CONFIG/res/shark.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
Reference in New Issue
Block a user