mirror of
https://github.com/dgis/emu48android
synced 2024-11-16 07:48:08 +01:00
Improve the error scenarios when loading the KML files and its dependencies.
- If the KML folder does not exist (like the first time), prompt the user to choose a new KML folder. - Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte. - Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
This commit is contained in:
parent
c5d135d73f
commit
85d8a6bb3e
8 changed files with 551 additions and 388 deletions
17
ReadMe.txt
17
ReadMe.txt
|
@ -63,6 +63,14 @@ LINKS
|
|||
|
||||
CHANGES
|
||||
|
||||
Version 1.9 (2020-09-XX)
|
||||
|
||||
- If the KML folder does not exist (like the first time), prompt the user to choose a new KML folder.
|
||||
- If the memory card file for the port 2 cannot be found, prompt the user to choose a new memory card file.
|
||||
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
|
||||
- Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
|
||||
|
||||
|
||||
Version 1.8 (2020-05-24)
|
||||
|
||||
- Intercept the ESC keyboard key to allow the use of the BACK soft key.
|
||||
|
@ -197,15 +205,6 @@ The Eric's Real scripts ("real*.kml" and "real*.bmp/png") are embedded in this a
|
|||
TODO
|
||||
|
||||
- Android 11 new storage issues :-(
|
||||
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
|
||||
* Need to set szEmuDirectory (and may be szRomDirectory for Emu48 only) in onFileNew() before NewDocument().
|
||||
* If the JSON settings contains the KML folder, we need to set szEmuDirectory (and may be szRomDirectory for Emu48 only) in onFileOpen() before OpenDocument().
|
||||
Else if NO JSON settings contains the KML folder, we can extract the variable szCurrentKml after OpenDocument().
|
||||
If szCurrentKml is using the old format, we remove the KML folder part in the variable szCurrentKml and set this KML folder in the JSON setting.
|
||||
Else if szCurrentKml does not contain the KML folder part, we should prompt the user to select the KML folder (It should solve the next issue).
|
||||
* Need to change the variable szCurrentKml before saving (in onFileSave()/onFileSaveAs() before SaveDocument()).
|
||||
* onViewScript should be change too!
|
||||
- If the KML folder does not exist (like the first time), prompt the user to choose a new KML folder.
|
||||
- ANR in NativeLib.buttonUp(), should make Win32::InvalidateRect() asynchronous (may be the cause of the lag and freeze).
|
||||
- Add the name of the file in the toast "State saved".
|
||||
- Bug: In Xiaomi mi A3 under Android10, the haptic feedback does not work (add an intensity setting).
|
||||
|
|
|
@ -35,6 +35,7 @@ TCHAR szKmlLog[10240];
|
|||
TCHAR szKmlLogBackup[10240];
|
||||
TCHAR szKmlTitle[10240];
|
||||
BOOL securityExceptionOccured;
|
||||
BOOL kmlFileNotFound = FALSE;
|
||||
BOOL settingsPort2en;
|
||||
BOOL settingsPort2wr;
|
||||
BOOL soundAvailable = FALSE;
|
||||
|
@ -192,32 +193,21 @@ void sendMenuItemCommand(int menuItem) {
|
|||
|
||||
TCHAR lastKMLFilename[MAX_PATH];
|
||||
|
||||
BOOL getFirstKMLFilenameForType(BYTE chipsetType, TCHAR * firstKMLFilename, size_t firstKMLFilenameSize) {
|
||||
if(firstKMLFilename) {
|
||||
JNIEnv *jniEnv = getJNIEnvironment();
|
||||
if(jniEnv) {
|
||||
jclass mainActivityClass = (*jniEnv)->GetObjectClass(jniEnv, mainActivity);
|
||||
if(mainActivityClass) {
|
||||
jmethodID midStr = (*jniEnv)->GetMethodID(jniEnv, mainActivityClass, "getFirstKMLFilenameForType", "(C)Ljava/lang/String;");
|
||||
jobject resultString = (*jniEnv)->CallObjectMethod(jniEnv, mainActivity, midStr, (char)chipsetType);
|
||||
(*jniEnv)->DeleteLocalRef(jniEnv, mainActivityClass);
|
||||
if (resultString) {
|
||||
const char *strReturn = (*jniEnv)->GetStringUTFChars(jniEnv, resultString, 0);
|
||||
if(_tcscmp(lastKMLFilename, strReturn) == 0) {
|
||||
(*jniEnv)->ReleaseStringUTFChars(jniEnv, resultString, strReturn);
|
||||
return FALSE;
|
||||
}
|
||||
_tcscpy(lastKMLFilename, strReturn);
|
||||
_tcsncpy(firstKMLFilename, strReturn, firstKMLFilenameSize);
|
||||
(*jniEnv)->ReleaseStringUTFChars(jniEnv, resultString, strReturn);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
BOOL getFirstKMLFilenameForType(BYTE chipsetType) {
|
||||
JNIEnv *jniEnv = getJNIEnvironment();
|
||||
if(jniEnv) {
|
||||
jclass mainActivityClass = (*jniEnv)->GetObjectClass(jniEnv, mainActivity);
|
||||
if(mainActivityClass) {
|
||||
jmethodID midStr = (*jniEnv)->GetMethodID(jniEnv, mainActivityClass, "getFirstKMLFilenameForType", "(C)I");
|
||||
int result = (*jniEnv)->CallIntMethod(jniEnv, mainActivity, midStr, (char)chipsetType);
|
||||
(*jniEnv)->DeleteLocalRef(jniEnv, mainActivityClass);
|
||||
return result ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void clipboardCopyText(const TCHAR * text) {
|
||||
JNIEnv *jniEnv = getJNIEnvironment();
|
||||
if(jniEnv) {
|
||||
|
@ -468,6 +458,29 @@ JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getKMLTitle(JNI
|
|||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getCurrentKml(JNIEnv *env, jobject thisz) {
|
||||
jstring result = (*env)->NewStringUTF(env, szCurrentKml);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setCurrentKml(JNIEnv *env, jobject thisz, jstring currentKml) {
|
||||
const char *currentKmlUTF8 = (*env)->GetStringUTFChars(env, currentKml, NULL);
|
||||
_tcscpy(szCurrentKml, currentKmlUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, currentKml, currentKmlUTF8);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getEmuDirectory(JNIEnv *env, jobject thisz) {
|
||||
jstring result = (*env)->NewStringUTF(env, szEmuDirectory);
|
||||
return result;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setEmuDirectory(JNIEnv *env, jobject thisz, jstring emuDirectory) {
|
||||
const char *emuDirectoryUTF8 = (*env)->GetStringUTFChars(env, emuDirectory, NULL);
|
||||
_tcscpy(szEmuDirectory, emuDirectoryUTF8);
|
||||
_tcscpy(szRomDirectory, emuDirectoryUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, emuDirectory, emuDirectoryUTF8);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_emulator_calculator_NativeLib_getPort1Plugged(JNIEnv *env, jobject thisz) {
|
||||
return (jboolean) ((Chipset.cards_status & PORT1_PRESENT) != 0);
|
||||
}
|
||||
|
@ -502,24 +515,21 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileNew(JNIEnv *
|
|||
_tcscpy(szChosenCurrentKml, filenameUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFilename, filenameUTF8);
|
||||
|
||||
TCHAR * documentScheme = _T("document:");
|
||||
TCHAR * urlSchemeFound = _tcsstr(szChosenCurrentKml, documentScheme);
|
||||
if(urlSchemeFound) {
|
||||
if(kmlFolder) {
|
||||
const char *kmlFolderUTF8 = (*env)->GetStringUTFChars(env, kmlFolder, NULL);
|
||||
// The folder URL is separated from the script filename and comes from the JSON settings in the state file.
|
||||
_tcscpy(szEmuDirectory, kmlFolderUTF8);
|
||||
_tcscpy(szRomDirectory, kmlFolderUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFolder, kmlFolderUTF8);
|
||||
} else {
|
||||
// Keep the compatibility by allowing to put the KML folder combined with the KML script filename with a document: scheme.
|
||||
_tcscpy(szEmuDirectory, szChosenCurrentKml + _tcslen(documentScheme) * sizeof(TCHAR));
|
||||
TCHAR * filename = _tcschr(szEmuDirectory, _T('|'));
|
||||
if(filename) {
|
||||
*filename = _T('\0');
|
||||
}
|
||||
_tcscpy(szRomDirectory, szEmuDirectory);
|
||||
}
|
||||
TCHAR * documentScheme = _T("document:");
|
||||
TCHAR * documentSchemeFound = _tcsstr(szChosenCurrentKml, documentScheme);
|
||||
if(kmlFolder) {
|
||||
const char *kmlFolderUTF8 = (*env)->GetStringUTFChars(env, kmlFolder, NULL);
|
||||
// The folder URL is separated from the script filename and comes from the JSON settings in the state file.
|
||||
_tcscpy(szEmuDirectory, kmlFolderUTF8);
|
||||
_tcscpy(szRomDirectory, kmlFolderUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFolder, kmlFolderUTF8);
|
||||
} else if(documentSchemeFound) {
|
||||
// Keep the compatibility by allowing to put the KML folder combined with the KML script filename with a document: scheme.
|
||||
_tcscpy(szEmuDirectory, szChosenCurrentKml + _tcslen(documentScheme) * sizeof(TCHAR));
|
||||
TCHAR * filename = _tcschr(szEmuDirectory, _T('|'));
|
||||
if(filename)
|
||||
*filename = _T('\0');
|
||||
_tcscpy(szRomDirectory, szEmuDirectory);
|
||||
} else {
|
||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||
|
@ -554,15 +564,23 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileOpen(JNIEnv
|
|||
_tcscpy(szBufferFilename, stateFilenameUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, stateFilename, stateFilenameUTF8);
|
||||
|
||||
chooseCurrentKmlMode = ChooseKmlMode_FILE_OPEN;
|
||||
if(kmlFolder) {
|
||||
const char *kmlFolderUTF8 = (*env)->GetStringUTFChars(env, kmlFolder, NULL);
|
||||
// The folder URL is separated from the script filename (not in the document: URL) and comes from the JSON settings in the state file.
|
||||
_tcscpy(szEmuDirectory, kmlFolderUTF8);
|
||||
_tcscpy(szRomDirectory, kmlFolderUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFolder, kmlFolderUTF8);
|
||||
chooseCurrentKmlMode = ChooseKmlMode_FILE_OPEN_WITH_FOLDER;
|
||||
} else {
|
||||
// We are loading a KML script from the embedded asset folder inside the Android App.
|
||||
// We directly set the variable "szEmuDirectory"/"szRomDirectory" and "szCurrentAssetDirectory" with the KML folder
|
||||
// which contain the script and its dependencies like the includes, the images and the ROMs.
|
||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||
}
|
||||
|
||||
chooseCurrentKmlMode = ChooseKmlMode_FILE_OPEN;
|
||||
kmlFileNotFound = FALSE;
|
||||
lastKMLFilename[0] = '\0';
|
||||
BOOL result = OpenDocument(szBufferFilename);
|
||||
if (result) {
|
||||
|
@ -580,6 +598,10 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileOpen(JNIEnv
|
|||
securityExceptionOccured = FALSE;
|
||||
result = -2;
|
||||
}
|
||||
if(kmlFileNotFound) {
|
||||
kmlFileNotFound = FALSE;
|
||||
result = -3;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileSave(JNIEnv *env, jobject thisz) {
|
||||
|
@ -707,16 +729,6 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onObjectLoad(JNIEn
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_emulator_calculator_NativeLib_getCurrentKml(JNIEnv *env, jobject thisz) {
|
||||
jstring result = (*env)->NewStringUTF(env, szCurrentKml);
|
||||
return result;
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_setCurrentKml(JNIEnv *env, jobject thisz, jstring currentKml) {
|
||||
const char *currentKmlUTF8 = (*env)->GetStringUTFChars(env, currentKml, NULL);
|
||||
_tcscpy(szCurrentKml, currentKmlUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, currentKml, currentKmlUTF8);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_emulator_calculator_NativeLib_getObjectsToSave(JNIEnv *env, jobject thisz) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -724,7 +736,6 @@ JNIEXPORT jobjectArray JNICALL Java_org_emulator_calculator_NativeLib_getObjects
|
|||
JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onObjectSave(JNIEnv *env, jobject thisz, jstring filename, jbooleanArray objectsToSaveItemChecked) {
|
||||
|
||||
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, filename , NULL) ;
|
||||
//OnObjectSave();
|
||||
|
||||
if (nState != SM_RUN)
|
||||
{
|
||||
|
@ -880,21 +891,27 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onViewScript(JNIEn
|
|||
// make a copy of the current KML script file name
|
||||
lstrcpyn(szKmlFile,szCurrentKml,ARRAYSIZEOF(szKmlFile));
|
||||
|
||||
const char *filenameUTF8 = (*env)->GetStringUTFChars(env, kmlFilename , NULL) ;
|
||||
const char * filenameUTF8 = (*env)->GetStringUTFChars(env, kmlFilename , NULL) ;
|
||||
_tcscpy(szCurrentKml, filenameUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFilename, filenameUTF8);
|
||||
|
||||
const char *kmlFolderUTF8 = (*env)->GetStringUTFChars(env, kmlFolder, NULL);
|
||||
if(kmlFolderUTF8) {
|
||||
if(kmlFolder) {
|
||||
const char * kmlFolderUTF8 = (*env)->GetStringUTFChars(env, kmlFolder, NULL);
|
||||
// The folder URL is separated from the script filename and comes from the JSON settings in the state file.
|
||||
_tcscpy(szEmuDirectory, kmlFolderUTF8);
|
||||
_tcscpy(szRomDirectory, kmlFolderUTF8);
|
||||
(*env)->ReleaseStringUTFChars(env, kmlFolder, kmlFolderUTF8);
|
||||
} else {
|
||||
// We are loading a KML script from the embedded asset folder inside the Android App.
|
||||
// We directly set the variable "szEmuDirectory"/"szRomDirectory" and "szCurrentAssetDirectory" with the KML folder
|
||||
// which contain the script and its dependencies like the includes, the images and the ROMs.
|
||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||
}
|
||||
|
||||
chooseCurrentKmlMode = ChooseKmlMode_CHANGE_KML;
|
||||
|
||||
BOOL bSucc = InitKML(szCurrentKml,FALSE);
|
||||
BOOL bSucc = InitKML(szCurrentKml, FALSE);
|
||||
|
||||
if(!bSucc) {
|
||||
// restore KML script file name
|
||||
|
@ -903,13 +920,13 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onViewScript(JNIEn
|
|||
_tcsncpy(szKmlLogBackup, szKmlLog, sizeof(szKmlLog) / sizeof(TCHAR));
|
||||
|
||||
// try to restore old KML script
|
||||
bSucc = InitKML(szCurrentKml,FALSE);
|
||||
bSucc = InitKML(szCurrentKml, FALSE);
|
||||
|
||||
_tcsncpy(szKmlLog, szKmlLogBackup, sizeof(szKmlLog) / sizeof(TCHAR));
|
||||
}
|
||||
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
||||
|
||||
if (bSucc) {
|
||||
if(bSucc) {
|
||||
if(hLcdDC && hLcdDC->selectedBitmap) {
|
||||
hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight = -abs(hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ size_t assetsPrefixLength;
|
|||
const TCHAR * contentScheme = _T("content://");
|
||||
size_t contentSchemeLength;
|
||||
const TCHAR * documentScheme = _T("document:");
|
||||
size_t documentSchemeLength;
|
||||
TCHAR szFilePathTmp[MAX_PATH];
|
||||
|
||||
|
||||
|
@ -64,6 +65,7 @@ void win32Init() {
|
|||
|
||||
assetsPrefixLength = _tcslen(assetsPrefix);
|
||||
contentSchemeLength = _tcslen(contentScheme);
|
||||
documentSchemeLength = _tcslen(documentScheme);
|
||||
}
|
||||
|
||||
int abs (int i) {
|
||||
|
@ -120,12 +122,13 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
|||
}
|
||||
#endif
|
||||
|
||||
TCHAR * foundDocumentScheme = _tcsstr(lpFileName, documentScheme);
|
||||
TCHAR * urlContentSchemeFound = _tcsstr(lpFileName, contentScheme);
|
||||
BOOL foundDocumentScheme = _tcsncmp(lpFileName, documentScheme, documentSchemeLength) == 0;
|
||||
BOOL urlContentSchemeFound = _tcsncmp(lpFileName, contentScheme, contentSchemeLength) == 0;
|
||||
|
||||
if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN || chooseCurrentKmlMode == ChooseKmlMode_CHANGE_KML) {
|
||||
if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN /*|| chooseCurrentKmlMode == ChooseKmlMode_CHANGE_KML*/) {
|
||||
// A E48 state file can contain a path to the KML script.
|
||||
if(foundDocumentScheme) {
|
||||
// Keep for compatibility:
|
||||
// When the state file is created or saved with this Android version,
|
||||
// an URL like: document:content://<KMLFolderURL>|content://<KMLFileURL>
|
||||
// is created and saved in the state file.
|
||||
|
@ -147,44 +150,13 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
|||
#endif
|
||||
SetCurrentDirectory(szFilePathTmp);
|
||||
}
|
||||
} else {
|
||||
TCHAR * fileExtension = _tcsrchr(lpFileName, _T('.'));
|
||||
if (fileExtension &&
|
||||
((fileExtension[1] == 'K' && fileExtension[2] == 'M' && fileExtension[3] == 'L') ||
|
||||
(fileExtension[1] == 'k' && fileExtension[2] == 'm' && fileExtension[3] == 'l')
|
||||
)) {
|
||||
if(lpFileName[0] == '/') {
|
||||
// We are loading a standard KML script from the folder inside the filesystem.
|
||||
// We directly set the variable "szEmuDirectory"/"szRomDirectory" and "szCurrentAssetDirectory" with the KML folder
|
||||
// which contain the script and its dependencies like the includes, the images and the ROMs.
|
||||
// Deprecated, not supported by Android >= 10.
|
||||
_tcscpy(szEmuDirectory, lpFileName);
|
||||
TCHAR * filename = _tcsrchr(szEmuDirectory, _T('/'));
|
||||
if(filename) {
|
||||
*filename = _T('\0');
|
||||
}
|
||||
#if EMUXX == 48
|
||||
_tcscpy(szRomDirectory, szEmuDirectory);
|
||||
#endif
|
||||
SetCurrentDirectory(szEmuDirectory);
|
||||
} else {
|
||||
// We are loading a KML script from the embedded asset folder inside the Android App.
|
||||
// We directly set the variable "szEmuDirectory"/"szRomDirectory" and "szCurrentAssetDirectory" with the KML folder
|
||||
// which contain the script and its dependencies like the includes, the images and the ROMs.
|
||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||
#if EMUXX == 48
|
||||
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||
#endif
|
||||
SetCurrentDirectory(szEmuDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!forceNormalFile
|
||||
&& (szCurrentAssetDirectory || _tcsncmp(lpFileName, assetsPrefix, assetsPrefixLength) == 0)
|
||||
&& foundDocumentScheme == NULL
|
||||
&& urlContentSchemeFound == NULL) {
|
||||
&& !foundDocumentScheme
|
||||
&& !urlContentSchemeFound) {
|
||||
// Loading a file from the Android asset folders (embedded in the app)
|
||||
TCHAR szFileName[MAX_PATH];
|
||||
AAsset * asset = NULL;
|
||||
|
@ -236,10 +208,9 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
|||
// Case of an absolute file with the scheme "content://".
|
||||
fd = openFileFromContentResolver(lpFileName, dwDesiredAccess);
|
||||
useOpenFileFromContentResolver = TRUE;
|
||||
if(fd < 0) {
|
||||
if(fd == -2) {
|
||||
FILE_LOGD("CreateFile() openFileFromContentResolver() %d", errno);
|
||||
if(fd == -2)
|
||||
securityExceptionOccured = TRUE;
|
||||
securityExceptionOccured = TRUE;
|
||||
}
|
||||
} else if(szCurrentContentDirectory) {
|
||||
// Case of a relative file to a folder with the scheme "content://".
|
||||
|
@ -2920,21 +2891,17 @@ PIDLIST_ABSOLUTE SHBrowseForFolderA(LPBROWSEINFOA lpbi) {
|
|||
#define IDD_USERCODE 121
|
||||
#endif
|
||||
INT_PTR DialogBoxParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
||||
//TODO
|
||||
if(lpTemplateName == MAKEINTRESOURCE(IDD_CHOOSEKML)) {
|
||||
if(chooseCurrentKmlMode == ChooseKmlMode_UNKNOWN) {
|
||||
} else if(chooseCurrentKmlMode == ChooseKmlMode_FILE_NEW) {
|
||||
lstrcpy(szCurrentKml, szChosenCurrentKml);
|
||||
} else if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN) {
|
||||
} else if(chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN || chooseCurrentKmlMode == ChooseKmlMode_FILE_OPEN_WITH_FOLDER) {
|
||||
// We are here because we open a state file and the embedded KML path is not reachable.
|
||||
// So, we try to find a correct KML file in the current Custom KML scripts folder.
|
||||
if(!getFirstKMLFilenameForType(Chipset.type, szCurrentKml, sizeof(szCurrentKml) / sizeof(szCurrentKml[0]))) {
|
||||
showAlert(_T("Cannot find the KML template file, sorry."), 0);
|
||||
if(!getFirstKMLFilenameForType(Chipset.type)) {
|
||||
kmlFileNotFound = TRUE;
|
||||
return -1;
|
||||
}
|
||||
// else {
|
||||
// showAlert(_T("Cannot find the KML template file, so, try another one."), 0); //TODO is it right?
|
||||
// }
|
||||
}
|
||||
} else if(lpTemplateName == MAKEINTRESOURCE(IDD_KMLLOG)) {
|
||||
lpDialogFunc(NULL, WM_INITDIALOG, 0, 0);
|
||||
|
@ -3149,3 +3116,4 @@ int win32_select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set
|
|||
}
|
||||
return select(__fd_count, __read_fds, __write_fds, __exception_fds, __timeout);
|
||||
}
|
||||
|