void themeClassicTitlebarUpdate(HWND wnd) { char title[1024]={0}; char title_old[1024]={0}; char baseName[128]; Properties* pProperties = propGetGlobalProperties(); if (!GetWindowText(wnd,(LPTSTR)title_old,1024)||!strlen(pProperties->emulation.machineName)) return; sprintf(title," blueMSX - %s",pProperties->emulation.machineName); if (createSaveFileBaseName(baseName, pProperties, 0)) { strcat(title," - "); strcat(title,baseName); } if (strcmp(title,title_old)) SetWindowText(wnd,title); }
void GuiDlgStateSelect::CreateStateFileList(Properties *properties, char *directory) { ArchGlob* glob; static char filename[512]; char baseName[128]; int numMod = 1; char filenameFormat[32] = "%s/%s%s_"; char destfileFormat[32]; int digits = 2; const char *prefix = ""; const char *extension = ".sta"; for (int i = 0; i < digits; i++) { strcat(filenameFormat, "?"); numMod *= 10; } strcat(filenameFormat, "%s"); sprintf(destfileFormat, "%%s/%%s%%s_%%0%di%%s", digits); createSaveFileBaseName(baseName, properties, 0); sprintf(filename, filenameFormat, directory, prefix, baseName, extension); glob = archGlob(filename, ARCH_GLOB_FILES); // Free old list if exists FreeStateFileList(); if (glob) { if (glob->count > 0) { for (int i = 0; i < glob->count; i++) { struct stat s; if( stat(glob->pathVector[i], &s) >= 0 ) { int j, k; time_t t = s.st_mtime; // libogc bug: year = 1929 struct tm * timeinfo; timeinfo = localtime(&t); #ifdef UNDER_CE char *str = (char*)malloc(80); sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d", timeinfo->tm_year, timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); #else timeinfo->tm_year += 80; t = mktime(timeinfo); // get date/time string and strip off milliseconds char *str = _strdup(ctime(&t)); #endif char *p = &str[strlen(str)-1]; while( *p != ' ' ) p--; *p = '\0'; // to get sorted list, find position where to store in list for(k = 0; k < num_states && filetimes[k] > t; k++); // shift all entries behind for(j = num_states; j > k; j--) { filetimes[j] = filetimes[j-1]; timestrings[j] = timestrings[j-1]; filenames[j] = filenames[j-1]; } // store in list filetimes[k] = t; timestrings[k] = str; filenames[k] = _strdup(glob->pathVector[i]); num_states++; } } } archGlobFree(glob); } }