mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Revert "GLideNUI: introduce Config{Init,Cleanup}"
This reverts commit 0ebc545c93
.
This commit is contained in:
parent
10b6817613
commit
ee9f47d077
|
@ -438,16 +438,13 @@ public:
|
||||||
|
|
||||||
GlideN64WtlModule * WtlModule = NULL;
|
GlideN64WtlModule * WtlModule = NULL;
|
||||||
|
|
||||||
extern "C"
|
void ConfigInit(void * hinst) {
|
||||||
{
|
|
||||||
EXPORT void CALL ConfigInit(void * hinst) {
|
|
||||||
WtlModule = new GlideN64WtlModule((HINSTANCE)hinst);
|
WtlModule = new GlideN64WtlModule((HINSTANCE)hinst);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL ConfigCleanup(void) {
|
void ConfigCleanup(void) {
|
||||||
if (WtlModule) {
|
if (WtlModule) {
|
||||||
delete WtlModule;
|
delete WtlModule;
|
||||||
WtlModule = NULL;
|
WtlModule = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -76,3 +76,8 @@ protected:
|
||||||
uint32_t m_TabLeft, m_ProfileLeft;
|
uint32_t m_TabLeft, m_ProfileLeft;
|
||||||
bool m_Saved;
|
bool m_Saved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
void ConfigInit(void * hinst);
|
||||||
|
void ConfigCleanup(void);
|
||||||
|
#endif
|
|
@ -13,8 +13,6 @@ extern "C" {
|
||||||
#define CALL
|
#define CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT void CALL ConfigInit(void * hinst);
|
|
||||||
EXPORT void CALL ConfigCleanup(void);
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
|
|
|
@ -20,22 +20,30 @@ Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
|
||||||
inline void initMyResource() { Q_INIT_RESOURCE(icon); }
|
inline void initMyResource() { Q_INIT_RESOURCE(icon); }
|
||||||
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
|
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
|
||||||
|
|
||||||
static std::unique_ptr<QApplication> s_pQApp;
|
|
||||||
static QCoreApplication* s_pAppInstance;
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, float _maxAnisotropy, bool & _accepted)
|
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, float _maxAnisotropy, bool & _accepted)
|
||||||
{
|
{
|
||||||
|
cleanMyResource();
|
||||||
|
initMyResource();
|
||||||
QString strIniFileName = QString::fromWCharArray(_strFileName);
|
QString strIniFileName = QString::fromWCharArray(_strFileName);
|
||||||
loadSettings(strIniFileName);
|
loadSettings(strIniFileName);
|
||||||
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
|
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
|
||||||
loadCustomRomSettings(strIniFileName, _romName);
|
loadCustomRomSettings(strIniFileName, _romName);
|
||||||
|
|
||||||
QTranslator translator;
|
std::unique_ptr<QApplication> pQApp;
|
||||||
if (translator.load(getTranslationFile(), strIniFileName)) {
|
QCoreApplication* pApp = QCoreApplication::instance();
|
||||||
s_pAppInstance->installTranslator(&translator);
|
|
||||||
|
if (pApp == nullptr) {
|
||||||
|
int argc = 0;
|
||||||
|
char * argv = 0;
|
||||||
|
pQApp.reset(new QApplication(argc, &argv));
|
||||||
|
pApp = pQApp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QTranslator translator;
|
||||||
|
if (translator.load(getTranslationFile(), strIniFileName))
|
||||||
|
pApp->installTranslator(&translator);
|
||||||
|
|
||||||
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint, _maxMSAALevel, _maxAnisotropy);
|
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint, _maxMSAALevel, _maxAnisotropy);
|
||||||
|
|
||||||
w.setIniPath(strIniFileName);
|
w.setIniPath(strIniFileName);
|
||||||
|
@ -43,7 +51,7 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsign
|
||||||
w.setTitle();
|
w.setTitle();
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
int res = s_pQApp ? s_pQApp->exec() : w.exec();
|
int res = pQApp ? pQApp->exec() : w.exec();
|
||||||
_accepted = w.isAccepted();
|
_accepted = w.isAccepted();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -51,13 +59,20 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsign
|
||||||
static
|
static
|
||||||
int openAboutDialog(const wchar_t * _strFileName)
|
int openAboutDialog(const wchar_t * _strFileName)
|
||||||
{
|
{
|
||||||
|
cleanMyResource();
|
||||||
|
initMyResource();
|
||||||
|
|
||||||
|
int argc = 0;
|
||||||
|
char * argv = 0;
|
||||||
|
QApplication a(argc, &argv);
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
if (translator.load(getTranslationFile(), QString::fromWCharArray(_strFileName)))
|
if (translator.load(getTranslationFile(), QString::fromWCharArray(_strFileName)))
|
||||||
s_pAppInstance->installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
AboutDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
AboutDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
||||||
w.show();
|
w.show();
|
||||||
return s_pQApp ? s_pQApp->exec() : w.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy) {
|
bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy) {
|
||||||
|
@ -82,26 +97,6 @@ int runAboutThread(const wchar_t * _strFileName) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL ConfigInit(void * hinst)
|
|
||||||
{
|
|
||||||
initMyResource();
|
|
||||||
|
|
||||||
s_pAppInstance = QCoreApplication::instance();
|
|
||||||
|
|
||||||
if (s_pAppInstance == nullptr) {
|
|
||||||
int argc = 0;
|
|
||||||
char * argv = 0;
|
|
||||||
s_pQApp.reset(new QApplication(argc, &argv));
|
|
||||||
s_pAppInstance = s_pQApp.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT void CALL ConfigCleanup(void)
|
|
||||||
{
|
|
||||||
cleanMyResource();
|
|
||||||
s_pQApp.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
|
||||||
{
|
{
|
||||||
return runConfigThread(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy);
|
return runConfigThread(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy);
|
||||||
|
|
|
@ -7,14 +7,12 @@ extern "C" {
|
||||||
|
|
||||||
#ifdef OS_WINDOWS
|
#ifdef OS_WINDOWS
|
||||||
#define EXPORT __declspec(dllexport)
|
#define EXPORT __declspec(dllexport)
|
||||||
#define CALL __cdecl
|
#define CALL __cdecl
|
||||||
#else
|
#else
|
||||||
#define EXPORT __attribute__((visibility("default")))
|
#define EXPORT __attribute__((visibility("default")))
|
||||||
#define CALL
|
#define CALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXPORT void CALL ConfigInit(void * hinst);
|
|
||||||
EXPORT void CALL ConfigCleanup(void);
|
|
||||||
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
|
|
|
@ -11,10 +11,6 @@
|
||||||
#define DLSYM(a, b) dlsym(a, b)
|
#define DLSYM(a, b) dlsym(a, b)
|
||||||
#endif // OS_WINDOWS
|
#endif // OS_WINDOWS
|
||||||
|
|
||||||
#ifdef M64P_GLIDENUI
|
|
||||||
#include "GLideNUI/GLideNUI.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr;
|
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr;
|
||||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = nullptr;
|
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = nullptr;
|
||||||
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = nullptr;
|
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = nullptr;
|
||||||
|
@ -107,8 +103,6 @@ m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
|
||||||
Config_SetDefault();
|
Config_SetDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
ConfigInit(nullptr);
|
|
||||||
#endif // M64P_GLIDENUI
|
#endif // M64P_GLIDENUI
|
||||||
|
|
||||||
return M64ERR_SUCCESS;
|
return M64ERR_SUCCESS;
|
||||||
|
@ -128,9 +122,6 @@ m64p_error PluginAPI::PluginShutdown()
|
||||||
_callAPICommand(acRomClosed);
|
_callAPICommand(acRomClosed);
|
||||||
delete m_pRspThread;
|
delete m_pRspThread;
|
||||||
m_pRspThread = nullptr;
|
m_pRspThread = nullptr;
|
||||||
#endif
|
|
||||||
#ifdef M64P_GLIDENUI
|
|
||||||
ConfigCleanup();
|
|
||||||
#endif
|
#endif
|
||||||
return M64ERR_SUCCESS;
|
return M64ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
#include "GLideN64_Windows.h"
|
#include "GLideN64_Windows.h"
|
||||||
#include "GLideNUI/GLideNUI.h"
|
|
||||||
|
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HWND hStatusBar;
|
HWND hStatusBar;
|
||||||
HWND hToolBar;
|
HWND hToolBar;
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
|
|
||||||
|
#ifdef WTL_UI
|
||||||
|
void ConfigInit(void * hinst);
|
||||||
|
void ConfigCleanup(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID /*lpvReserved*/)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID /*lpvReserved*/)
|
||||||
{
|
{
|
||||||
|
#ifdef WTL_UI
|
||||||
if (dwReason == DLL_PROCESS_ATTACH)
|
if (dwReason == DLL_PROCESS_ATTACH)
|
||||||
{
|
{
|
||||||
hInstance = hinstDLL;
|
hInstance = hinstDLL;
|
||||||
|
@ -17,5 +22,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID /*lpvReserved*/)
|
||||||
{
|
{
|
||||||
ConfigCleanup();
|
ConfigCleanup();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
hInstance = hinstDLL;
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user