diff --git a/src/gui/menu_general.cpp b/src/gui/menu_general.cpp index 4f7614887..edced7574 100644 --- a/src/gui/menu_general.cpp +++ b/src/gui/menu_general.cpp @@ -686,13 +686,7 @@ void onSdManagerMenu(const char *result) memset(lfn+len, 0, sizeof(g_model.header.bitmap)-len); // TODO duplicated code memcpy(g_model.header.bitmap, lfn, sizeof(g_model.header.bitmap)); -#if defined(SIMU) - f_chdir(".."); -#endif LOAD_MODEL_BITMAP(); -#if defined(SIMU) - f_chdir(BITMAPS_PATH); -#endif memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap)); eeDirty(EE_MODEL); } @@ -979,7 +973,9 @@ void menuGeneralVersion(uint8_t event) lcd_putsLeft(2*FH, stamp1); lcd_putsLeft(3*FH, stamp2); lcd_putsLeft(4*FH, stamp3); -#if defined(PCBSKY9X) && !defined(REVA) +#if defined(PCBTARANIS) + lcd_putsLeft(5*FH, "VERS: opentx-x9d-v1.0.00"); +#elif defined(PCBSKY9X) && !defined(REVA) if (Coproc_valid == 1) { lcd_putsLeft(5*FH, PSTR("CoPr:")); lcd_outdez8(10*FW, 5*FH, Coproc_read); diff --git a/src/sdcard.h b/src/sdcard.h index 1786d3881..a8c2677bc 100644 --- a/src/sdcard.h +++ b/src/sdcard.h @@ -39,12 +39,7 @@ #include "FatFs/ff.h" -#ifdef SIMU - #define ROOT_PATH "./" -#else - #define ROOT_PATH "/" -#endif - +#define ROOT_PATH "/" #define MODELS_PATH ROOT_PATH "MODELS" #define LOGS_PATH ROOT_PATH "LOGS" // no trailing slash = important #define SOUNDS_PATH ROOT_PATH "SOUNDS/en" // no trailing slash = important diff --git a/src/simpgmspace.cpp b/src/simpgmspace.cpp index 1790857e9..45e61825b 100644 --- a/src/simpgmspace.cpp +++ b/src/simpgmspace.cpp @@ -85,6 +85,8 @@ Adc Adc0; #define EESIZE_SIMU EESIZE #endif +char simuSdDirectory[1024] = ""; + uint8_t eeprom[EESIZE_SIMU]; sem_t *eeprom_write_sem; @@ -323,6 +325,9 @@ void *main_thread(void *) pthread_t main_thread_pid; void StartMainThread(bool tests) { + if (strlen(simuSdDirectory) == 0) + getcwd(simuSdDirectory, 1024); + main_thread_running = (tests ? 1 : 2); pthread_create(&main_thread_pid, NULL, &main_thread, NULL); } @@ -434,12 +439,13 @@ namespace simu { FATFS g_FATFS_Obj; #endif -char simuSdDirectory[1024] = "."; - FRESULT f_stat (const TCHAR * name, FILINFO *) { char path[1024]; - sprintf(path, "%s%s", simuSdDirectory, name); + if (name[0] == '/') + sprintf(path, "%s%s", simuSdDirectory, name); + else + strcpy(path, name); struct stat tmp; // printf("f_stat(%s)\n", path); fflush(stdout); @@ -454,7 +460,10 @@ FRESULT f_mount (BYTE, FATFS*) FRESULT f_open (FIL * fil, const TCHAR *name, BYTE flag) { char path[1024]; - sprintf(path, "%s%s", simuSdDirectory, name); + if (name[0] == '/') + sprintf(path, "%s%s", simuSdDirectory, name); + else + strcpy(path, name); if (!(flag & FA_WRITE)) { struct stat tmp; @@ -498,7 +507,10 @@ FRESULT f_close (FIL * fil) FRESULT f_chdir (const TCHAR *name) { char path[1024]; - sprintf(path, "%s%s", simuSdDirectory, name); + if (name[0] == '/') + sprintf(path, "%s%s", simuSdDirectory, name); + else + strcpy(path, name); #if defined WIN32 || !defined __GNUC__ _chdir(path); @@ -511,7 +523,10 @@ FRESULT f_chdir (const TCHAR *name) FRESULT f_opendir (DIR * rep, const TCHAR * name) { char path[1024]; - sprintf(path, "%s%s", simuSdDirectory, name); + if (name[0] == '/') + sprintf(path, "%s%s", simuSdDirectory, name); + else + strcpy(path, name); rep->fs = (FATFS *)simu::opendir(path); return FR_OK; @@ -580,7 +595,7 @@ int f_printf (FIL *fil, const TCHAR * format, ...) FRESULT f_getcwd (TCHAR *path, UINT sz_path) { - strcpy(path, "."); + getcwd(path, sz_path); return FR_OK; }