diff --git a/Source/Glide64/Config.cpp b/Source/Glide64/Config.cpp index a523f0e0f..2ad43d615 100644 --- a/Source/Glide64/Config.cpp +++ b/Source/Glide64/Config.cpp @@ -51,6 +51,22 @@ #ifdef _WIN32 #include +#include "resource.h" + +#define _ATL_DISABLE_NOTHROW_NEW +#include +#pragma warning(push) +#pragma warning(disable : 4996) // warning C4996: 'GetVersionExA': was declared deprecated +#include +#pragma warning(pop) + +#include +#include +#include +#include + +extern HINSTANCE hinstDLL; + #include #include // begin wxGlade: ::extracode @@ -59,6 +75,36 @@ short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0; extern CriticalSection * g_ProcessDListCS; +class CGlide64WtlModule : + public CAppModule +{ +public: + CGlide64WtlModule(HINSTANCE hinst) + { + Init(NULL, hinst); + } + virtual ~CGlide64WtlModule(void) + { + Term(); + } +}; + +CGlide64WtlModule * WtlModule = NULL; + +void ConfigInit(HINSTANCE hinst) +{ + WtlModule = new CGlide64WtlModule(hinst); +} + +void ConfigCleanup(void) +{ + if (WtlModule) + { + delete WtlModule; + WtlModule = NULL; + } +} + ConfigNotebook::ConfigNotebook(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size, long /*style*/) : wxNotebook(parent, id, pos, size, 0) { @@ -1026,7 +1072,8 @@ void Glide64ConfigDialog::do_layout() } #ifdef TEXTURE_FILTER -uint32_t texfltr[] = { +uint32_t texfltr[] = +{ NO_FILTER, //"None" SMOOTH_FILTER_1, //"Smooth filtering 1" SMOOTH_FILTER_2, //"Smooth filtering 2" @@ -1036,7 +1083,8 @@ uint32_t texfltr[] = { SHARP_FILTER_2, //"Sharp filtering 2" }; -uint32_t texenht[] = { +uint32_t texenht[] = +{ NO_ENHANCEMENT, //"None" NO_ENHANCEMENT, //"Store" X2_ENHANCEMENT, //"X2" @@ -1048,14 +1096,16 @@ uint32_t texenht[] = { HQ4X_ENHANCEMENT, //"HQ4X" }; -uint32_t texcmpr[] = { +uint32_t texcmpr[] = +{ //NO_COMPRESSION, //"None" // NCC_COMPRESSION, //"NCC" S3TC_COMPRESSION, //"S3TC" FXT1_COMPRESSION, //"FXT1" }; -uint32_t texhirs[] = { +uint32_t texhirs[] = +{ NO_HIRESTEXTURES, //"Do not use" RICE_HIRESTEXTURES, //"Rice format" // GHQ_HIRESTEXTURES, //"GlideHQ format" @@ -1136,95 +1186,32 @@ void CloseConfig() #endif } -AboutDialog::AboutDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long /*style*/) : -wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE) +#ifdef _WIN32 +class CAboutDlg : + public CDialogImpl { - // begin wxGlade: AboutDialog::AboutDialog - button_ok = new wxButton(this, wxID_OK, wxEmptyString); +public: + enum { IDD = IDD_ABOUTBOX }; - set_properties(); - do_layout(); - // end wxGlade -} + BEGIN_MSG_MAP(CAboutDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_ID_HANDLER(IDOK, OnCloseCmd) + COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd) + END_MSG_MAP() -void AboutDialog::set_properties() -{ - // begin wxGlade: AboutDialog::set_properties - SetTitle("About Glide64"); - button_ok->SetDefault(); - // end wxGlade -} + LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) + { + CenterWindow(GetParent()); + return TRUE; + } -void AboutDialog::do_layout() -{ - // begin wxGlade: AboutDialog::do_layout - wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL); - wxBoxSizer* sizer_12 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_11 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_8 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_10 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_9 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_5 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_7 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_6 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_13 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_4 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_3 = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer* sizer_2 = new wxBoxSizer(wxHORIZONTAL); - - wxStaticText* label_1 = new wxStaticText(this, wxID_ANY, "authors:"); - sizer_1->Add(label_1, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, 5); - wxStaticText* label_2 = new wxStaticText(this, wxID_ANY, "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002."); - label_2->Enable(false); - sizer_2->Add(label_2, 0, 0, 0); - sizer_1->Add(sizer_2, 1, wxEXPAND, 0); - wxStaticText* label_3 = new wxStaticText(this, wxID_ANY, "Gugaman. Developer. Joined the project at winter 2002\n and left it at fall 2002."); - label_3->Enable(false); - sizer_3->Add(label_3, 0, 0, 0); - sizer_1->Add(sizer_3, 1, wxEXPAND, 0); - wxStaticText* label_4 = new wxStaticText(this, wxID_ANY, "Sergey 'Gonetz' Lipski. Joined the project at winter 2002.\nMain developer since fall of 2002."); - sizer_4->Add(label_4, 0, 0, 0); - sizer_1->Add(sizer_4, 1, wxEXPAND, 0); - wxStaticText* label_15 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii, Joined the project in 2007. "); - sizer_13->Add(label_15, 0, 0, 0); - sizer_1->Add(sizer_13, 1, wxEXPAND, 0); - wxStaticText* label_5 = new wxStaticText(this, wxID_ANY, "Glitch64 (the wrapper) authors:"); - sizer_1->Add(label_5, 0, wxBOTTOM | wxALIGN_CENTER_HORIZONTAL, 10); - wxStaticText* label_6 = new wxStaticText(this, wxID_ANY, "hacktarux"); - sizer_6->Add(label_6, 0, 0, 0); - sizer_5->Add(sizer_6, 1, wxEXPAND, 0); - wxStaticText* label_7 = new wxStaticText(this, wxID_ANY, "mudlord"); - sizer_7->Add(label_7, 0, 0, 0); - sizer_5->Add(sizer_7, 1, wxEXPAND, 0); - sizer_1->Add(sizer_5, 0, wxEXPAND, 0); - wxStaticText* label_8 = new wxStaticText(this, wxID_ANY, "ziggy"); - sizer_9->Add(label_8, 0, 0, 0); - sizer_8->Add(sizer_9, 1, wxEXPAND, 0); - wxStaticText* label_9 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii"); - sizer_10->Add(label_9, 0, 0, 0); - sizer_8->Add(sizer_10, 1, wxEXPAND, 0); - sizer_1->Add(sizer_8, 0, wxEXPAND, 0); - wxStaticText* label_10 = new wxStaticText(this, wxID_ANY, "GlideHQ author:"); - sizer_11->Add(label_10, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 10); - wxStaticText* label_11 = new wxStaticText(this, wxID_ANY, "Hiroshi 'KoolSmoky' Morii"); - sizer_11->Add(label_11, 0, wxALIGN_CENTER_VERTICAL, 0); - sizer_1->Add(sizer_11, 1, wxEXPAND, 0); - wxStaticText* label_12 = new wxStaticText(this, wxID_ANY, "beta tester:"); - sizer_12->Add(label_12, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 10); - wxStaticText* label_13 = new wxStaticText(this, wxID_ANY, "olivieryuyu"); - sizer_12->Add(label_13, 0, wxALIGN_CENTER_VERTICAL, 0); - sizer_1->Add(sizer_12, 1, wxEXPAND, 0); - wxStaticText* label_14 = new wxStaticText(this, wxID_ANY, "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.\nThanks to EmuXHaven for hosting my site:\nhttp://glide64.emuxhaven.net", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); - sizer_1->Add(label_14, 0, wxALIGN_CENTER_HORIZONTAL, 0); - sizer_1->Add(button_ok, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND | wxALIGN_CENTER_HORIZONTAL, 10); - SetSizer(sizer_1); - sizer_1->Fit(this); - Layout(); -#ifdef __WINDOWS__ - Centre(); + LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) + { + EndDialog(wID); + return 0; + } +}; #endif - // end wxGlade -} /****************************************************************** Function: DllAbout @@ -1233,28 +1220,11 @@ to give further information about the DLL. input: a handle to the window that calls this function output: none *******************************************************************/ -void CALL DllAbout(HWND hParent) +void CALL DllAbout(HWND /*hParent*/) { -#ifdef __WINDOWS__ - if (hostWindow == NULL) - hostWindow = new wxWindow(); - WXHWND hwnd = hParent; - hostWindow->SetHWND(hwnd); - // hostWindow->SubclassWin(hwnd); - hostWindow->Disable(); -#endif - - //translation - ReadSettings(); - - AboutDialog* AboutGlide64 = new AboutDialog(hostWindow, wxID_ANY, wxEmptyString); - AboutGlide64->ShowModal(); -#ifdef __WINDOWS__ - hostWindow->Enable(); - // hostWindow->UnsubclassWin(); - hostWindow->SetHWND(NULL); - delete hostWindow; - hostWindow = NULL; +#ifdef _WIN32 + CAboutDlg dlg; + dlg.DoModal(); #endif } #endif diff --git a/Source/Glide64/Config.h b/Source/Glide64/Config.h index 22d9072c9..7f02f31bd 100644 --- a/Source/Glide64/Config.h +++ b/Source/Glide64/Config.h @@ -46,6 +46,9 @@ #pragma once #ifdef _WIN32 +void ConfigInit(HINSTANCE hinst); +void ConfigCleanup(void); + #include #include // begin wxGlade: ::dependencies diff --git a/Source/Glide64/Glide64.rc b/Source/Glide64/Glide64.rc index ae5e7ef80..a2b500119 100644 --- a/Source/Glide64/Glide64.rc +++ b/Source/Glide64/Glide64.rc @@ -55,6 +55,49 @@ END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 200, 202 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About Glide64" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,71,181,50,14 + LTEXT "Authors:",IDC_STATIC,7,6,186,8 + LTEXT "Dave2001. Original author and former main developer.\nHe founded Glide64 project on Dec. 29th, 2001.\nLeft the project at fall of 2002.",IDC_STATIC,7,17,186,27 + LTEXT "Gugaman. Developer. Joined the project at winter 2002\n and left it at fall 2002.",IDC_STATIC,7,46,186,17 + LTEXT "Sergey 'Gonetz' Lipski. Joined the project at winter 2002.\nMain developer since fall of 2002.",IDC_STATIC,7,66,186,18 + LTEXT "Hiroshi 'KoolSmoky' Morii, Joined the project in 2007.",IDC_STATIC,7,86,186,8,SS_CENTERIMAGE + LTEXT "Glitch64 (the wrapper) authors:",IDC_STATIC,7,110,186,8,SS_CENTERIMAGE + LTEXT "hacktarux, mudlord, ziggy, Hiroshi 'KoolSmoky' Morii",IDC_STATIC,7,122,186,8,SS_CENTERIMAGE + LTEXT "GlideHQ author: Hiroshi 'KoolSmoky' Morii",IDC_STATIC,7,138,186,8,SS_CENTERIMAGE + LTEXT "beta tester: olivieryuyu",IDC_STATIC,7,153,186,8,SS_CENTERIMAGE + LTEXT "special thanks to:\n Orkin, Rice, Daniel Borca, Legend.",IDC_STATIC,7,167,186,8,SS_CENTERIMAGE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 193 + TOPMARGIN, 7 + BOTTOMMARGIN, 195 + END +END +#endif // APSTUDIO_INVOKED + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/Source/Glide64/Main.cpp b/Source/Glide64/Main.cpp index 7d67788c8..c7b05a425 100644 --- a/Source/Glide64/Main.cpp +++ b/Source/Glide64/Main.cpp @@ -1138,6 +1138,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser { g_ProcessDListCS = new CriticalSection(); } + ConfigInit(hinst); wxSetInstance(hinstDLL); return DllLoad(); } @@ -1147,6 +1148,7 @@ extern "C" int WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID /*lpReser { delete g_ProcessDListCS; } + ConfigCleanup(); return DllUnload(); } return TRUE; diff --git a/Source/Glide64/resource.h b/Source/Glide64/resource.h index 72a711aee..37772530e 100644 --- a/Source/Glide64/resource.h +++ b/Source/Glide64/resource.h @@ -1,12 +1,14 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Glide64.rc +// +#define IDD_ABOUTBOX 104 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101