Skip to content

Commit

Permalink
Fix issue #2772
Browse files Browse the repository at this point in the history
When building, the Config initialization was being inherited in a busted way from GlidNUI instead of GlideNUI-wtl, leading to a character of the rom name being interpretted as the current profile (I think)

This changes fixes the ability to read/write custom and user profile settings.

It also turns enables dependencies for GlideNUI and -wtl so they are built before GlideN64, preventing cases on windows where the libs for those weren't already built causing build failure.
  • Loading branch information
Squall-Leonhart authored and gonetz committed Oct 19, 2024
1 parent f4b0755 commit f9da98c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions projects/msvc/GLideN64.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GLideN64", "GLideN64.vcxproj", "{37D31D7F-C4E7-45B0-AEF6-D6824A243CF7}"
ProjectSection(ProjectDependencies) = postProject
{37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE} = {37CAB375-A7A6-3CAB-BD56-0E954D3FD2FE}
{7BF6F100-31DB-44AE-A2A5-5DDEED9A909C} = {7BF6F100-31DB-44AE-A2A5-5DDEED9A909C}
{9E05B70F-A294-44A9-A151-B2CC95AA884E} = {9E05B70F-A294-44A9-A151-B2CC95AA884E}
{DA965BCF-2219-47AF-ACE7-EAF76D5D4756} = {DA965BCF-2219-47AF-ACE7-EAF76D5D4756}
EndProjectSection
EndProject
Expand Down
15 changes: 7 additions & 8 deletions src/GLideNUI-wtl/GLideNUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Q_IMPORT_PLUGIN(QICOPlugin)

//#define RUN_DIALOG_IN_THREAD

static
int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy, bool & _accepted)
static int openConfigDialog(const wchar_t * _strFileName, const wchar_t * _strSharedFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy, bool & _accepted)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
Expand All @@ -40,22 +39,22 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, unsign
return 0;
}

bool runConfigThread(const wchar_t * _strFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
bool runConfigThread(const wchar_t * _strFileName, const wchar_t * _strSharedFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
{
bool accepted = false;
#ifdef RUN_DIALOG_IN_THREAD
std::thread configThread(openConfigDialog, _strFileName, _maxMSAALevel, std::ref(accepted));
configThread.join();
#else
openConfigDialog(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy, accepted);
openConfigDialog(_strFileName, _strSharedFileName, _romName, _maxMSAALevel, _maxAnisotropy, accepted);
#endif
return accepted;

}

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 wchar_t * _strSharedFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy)
{
return runConfigThread(_strFileName, _romName, _maxMSAALevel, _maxAnisotropy);
return runConfigThread(_strFileName, _strSharedFileName, _romName, _maxMSAALevel, _maxAnisotropy);
}

EXPORT int CALL RunAbout(const wchar_t * _strFileName)
Expand All @@ -73,7 +72,7 @@ EXPORT int CALL RunAbout(const wchar_t * _strFileName)
return 0;
}

EXPORT void CALL LoadConfig(const wchar_t * _strFileName)
EXPORT void CALL LoadConfig(const wchar_t * _strFileName, const wchar_t * _strSharedFileName)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
Expand All @@ -84,7 +83,7 @@ EXPORT void CALL LoadConfig(const wchar_t * _strFileName)
loadSettings(IniFolder.c_str());
}

EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName)
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const wchar_t * _strSharedFileName, const char * _romName)
{
std::string IniFolder;
uint32_t slength = WideCharToMultiByte(CP_ACP, 0, _strFileName, -1, NULL, 0, NULL, NULL);
Expand Down
8 changes: 4 additions & 4 deletions src/GLideNUI-wtl/GLideNUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ extern "C" {
#define CALL
#endif

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 void CALL LoadConfig(const wchar_t * _strFileName);
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const wchar_t * _strSharedFileName, const char * _romName, unsigned int _maxMSAALevel, unsigned int _maxAnisotropy);
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
EXPORT void CALL LoadConfig(const wchar_t * _strFileName, const wchar_t * _strSharedFileName);
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const wchar_t * _strSharedFileName, const char * _romName);

#if defined(__cplusplus)
}
Expand Down

0 comments on commit f9da98c

Please sign in to comment.