From e70c4da227090b599f91ffebce49efc110aeae0a Mon Sep 17 00:00:00 2001 From: dgis Date: Wed, 6 Feb 2019 20:38:39 +0000 Subject: [PATCH] --- app/src/main/cpp/win32-layer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index f0a2e2c..10590f9 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -81,6 +81,20 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, if(!settingsPort2wr && (dwDesiredAccess & GENERIC_WRITE)) return (HANDLE) INVALID_HANDLE_VALUE; } + if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN && lpFileName[0] == '/') { + TCHAR * fileExtension = _tcsrchr(lpFileName, _T('.')); + if(fileExtension && ((fileExtension[0] == 'K' && fileExtension[1] == 'M' && fileExtension[2] == 'L') || + (fileExtension[0] == 'k' && fileExtension[1] == 'm' && fileExtension[2] == 'l') + )) { + _tcscpy(szEmuDirectory, lpFileName); + TCHAR * filename = _tcsrchr(szEmuDirectory, _T('/')); + if(filename) { + *filename = _T('\0'); + } + _tcscpy(szRomDirectory, szEmuDirectory); + SetCurrentDirectory(szEmuDirectory); + } + } if(!forceNormalFile && (szCurrentDirectorySet || _tcsncmp(lpFileName, assetsPrefix, assetsPrefixLength / sizeof(TCHAR)) == 0)) { TCHAR szFileName[MAX_PATH];