mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
[UI-wtl] Fix texture dir saving
Also: Attempt to mkdir directory if typed/copied to the edit field (ported from 6d47fa5c48
)
Fixes issue #2330
This commit is contained in:
parent
3d5311d180
commit
af0b9382fe
|
@ -103,8 +103,8 @@ void _loadSettings(GlSettings & settings)
|
|||
config.textureFilter.txEnhancedTextureFileStorage = settings.value("txEnhancedTextureFileStorage", config.textureFilter.txEnhancedTextureFileStorage).toInt();
|
||||
config.textureFilter.txHiresTextureFileStorage = settings.value("txHiresTextureFileStorage", config.textureFilter.txHiresTextureFileStorage).toInt();
|
||||
wcscpy_s(config.textureFilter.txPath, ToUTF16(settings.value("txPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txPath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txCachePath, ToUTF16(settings.value("txCachePath", FromUTF16(config.textureFilter.txCachePath).c_str()).toString().c_str()).c_str());
|
||||
wcscpy_s(config.textureFilter.txDumpPath, ToUTF16(settings.value("txDumpPath", FromUTF16(config.textureFilter.txDumpPath).c_str()).toString().c_str()).c_str());
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup("font");
|
||||
|
@ -401,8 +401,8 @@ void saveCustomRomSettings(const char * _strIniFolder, const char * _strRomName)
|
|||
origConfig.G.S != settings.value(#S, config.G.S).toFloat()) \
|
||||
settings.setValue(#S, config.G.S)
|
||||
#define WriteCustomSettingS(S) \
|
||||
const std::string new##S = FromUTF16(config.textureFilter.txPath); \
|
||||
const std::string orig##S = FromUTF16(origConfig.textureFilter.txPath); \
|
||||
const std::string new##S = FromUTF16(config.textureFilter.S); \
|
||||
const std::string orig##S = FromUTF16(origConfig.textureFilter.S); \
|
||||
if (orig##S != new##S || \
|
||||
orig##S != settings.value(#S, new##S.c_str()).toString()) \
|
||||
settings.setValue(#S, new##S.c_str())
|
||||
|
|
|
@ -205,17 +205,28 @@ void CTextureEnhancementTab::SaveDirectory(int EditCtrl, wchar_t * txPath)
|
|||
int TxtLen = EditWnd.GetWindowTextLength();
|
||||
std::wstring Path;
|
||||
Path.resize(TxtLen + 1);
|
||||
EditWnd.GetWindowText((wchar_t *)Path.data(), static_cast<int>(Path.size()));
|
||||
EditWnd.GetWindowTextW((wchar_t *)Path.data(), static_cast<int>(Path.size()));
|
||||
|
||||
WIN32_FIND_DATA FindData;
|
||||
HANDLE hFindFile = FindFirstFile(Path.c_str(), &FindData);
|
||||
bool exists = (hFindFile != INVALID_HANDLE_VALUE);
|
||||
bool exists = osal_path_existsW(Path.data());
|
||||
|
||||
if (hFindFile != NULL)
|
||||
FindClose(hFindFile);
|
||||
|
||||
if (exists)
|
||||
wcscpy(txPath, Path.c_str());
|
||||
if (!exists) {
|
||||
if (osal_mkdirp(Path.data()) != 0) {
|
||||
switch (EditCtrl) {
|
||||
case IDC_TEX_PACK_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture pack folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
case IDC_TEX_CACHE_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture pack cache folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
case IDC_TEX_DUMP_PATH_EDIT:
|
||||
MessageBox(L"Failed to create the texture dump folder. Please change the folder or turn off texture packs.", L"GLideN64", MB_OK | MB_ICONWARNING);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
wcscpy(txPath, Path.c_str());
|
||||
}
|
||||
|
||||
void CTextureEnhancementTab::SaveSettings()
|
||||
|
@ -291,3 +302,4 @@ int CALLBACK CTextureEnhancementTab::SelectDirCallBack(HWND hwnd, uint32_t uMsg,
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "config-tab.h"
|
||||
#include "wtl-tooltip.h"
|
||||
#include "resource.h"
|
||||
#include "../osal/osal_files.h"
|
||||
|
||||
class CTextureEnhancementTab :
|
||||
public CConfigTab,
|
||||
|
|
Loading…
Reference in New Issue
Block a user