Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions workspace/all/nextui/nextui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Loading