diff --git a/workspace/all/nextui/nextui.c b/workspace/all/nextui/nextui.c index 4b6d306a6..8ebe6dce4 100644 --- a/workspace/all/nextui/nextui.c +++ b/workspace/all/nextui/nextui.c @@ -1485,18 +1485,11 @@ void initImageLoaderPool() { static int folderbgchanged=0; static int thumbchanged=0; -void startLoadFolderBackground(const char* rompath, int type, BackgroundLoadedCallback callback, void* userData) { +void startLoadFolderBackground(const char* imagePath, int type, BackgroundLoadedCallback callback, void* userData) { LoadBackgroundTask* task = malloc(sizeof(LoadBackgroundTask)); if (!task) return; - if (type == ENTRY_DIR) - snprintf(task->imagePath, sizeof(task->imagePath), "%s/.media/bg.png", rompath); - else if (type == ENTRY_ROM) - snprintf(task->imagePath, sizeof(task->imagePath), "%s/.media/bglist.png", rompath); - else { - free(task); - return; - } + snprintf(task->imagePath, sizeof(task->imagePath), "%s", imagePath); task->callback = callback; task->userData = userData; enqueueTask(task); @@ -2143,8 +2136,16 @@ int main (int argc, char *argv[]) { lastType = entry->type; if(folderbgbmp) SDL_FreeSurface(folderbgbmp); folderbgbmp = NULL; + char tmppath[512]; strncpy(folderBgPath, newBg, sizeof(folderBgPath) - 1); - startLoadFolderBackground(folderBgPath, entry->type, onBackgroundLoaded, NULL); + if (entry->type == ENTRY_DIR) + snprintf(tmppath, sizeof(tmppath), "%s/.media/bg.png", folderBgPath); + else if (entry->type == ENTRY_ROM) + snprintf(tmppath, sizeof(tmppath), "%s/.media/bglist.png", folderBgPath); + if(exists(tmppath)) + startLoadFolderBackground(tmppath, entry->type, onBackgroundLoaded, NULL); + else + GFX_clearLayers(1); } SDL_UnlockMutex(folderBgMutex); } @@ -2155,7 +2156,6 @@ int main (int argc, char *argv[]) { snprintf(thumbpath, sizeof(thumbpath), "%s/.media/%s.png", rompath, res_copy); had_thumb = 0; if (exists(thumbpath)) { - LOG_info("Load thumb\n"); startLoadThumb(thumbpath, onThumbLoaded, NULL); int max_w = (int)(screen->w - (screen->w * CFG_getGameArtWidth())); int max_h = (int)(screen->h * 0.6); @@ -2320,7 +2320,6 @@ int main (int argc, char *argv[]) { SDL_UnlockMutex(folderBgMutex); SDL_LockMutex(thumbMutex); if(thumbbmp && lastScreen == SCREEN_GAMELIST && thumbchanged) { - LOG_info("draw thumb\n"); int img_w = thumbbmp->w; int img_h = thumbbmp->h; double aspect_ratio = (double)img_h / img_w; @@ -2393,7 +2392,6 @@ int main (int argc, char *argv[]) { GFX_drawOnLayer(thumbbmp,target_x,center_y,new_w,new_h,1.0f,0,2); PLAT_GPU_Flip(); thumbchanged = 0; - LOG_info("second draw \n"); } SDL_UnlockMutex(thumbMutex);