Download SMDH files for badges
Thanks to ThemePlaza for providing these to make browser icons work Also fixed badge previews by increasing tex size if the preview image is larger than 512 pixel high
This commit is contained in:
@@ -47,6 +47,12 @@ static const char * mode_switch_char[MODE_AMOUNT] = {
|
|||||||
"T",
|
"T",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char *remote_mode_switch_char[REMOTE_MODE_AMOUNT] = {
|
||||||
|
"T",
|
||||||
|
"S",
|
||||||
|
"B",
|
||||||
|
};
|
||||||
|
|
||||||
void init_screens(void)
|
void init_screens(void)
|
||||||
{
|
{
|
||||||
init_colors();
|
init_colors();
|
||||||
@@ -544,7 +550,7 @@ void draw_grid_interface(Entry_List_s * list, Instructions_s instructions, int e
|
|||||||
draw_image(sprites_exit_idx, 320-72, 0);
|
draw_image(sprites_exit_idx, 320-72, 0);
|
||||||
draw_image(sprites_preview_idx, 320-48, 0);
|
draw_image(sprites_preview_idx, 320-48, 0);
|
||||||
|
|
||||||
draw_text(320-24+2.5, -3, 0.6, 1.0f, 0.9f, colors[COLOR_WHITE], mode_switch_char[!current_mode]);
|
draw_text(320-24+2.5, -3, 0.6, 1.0f, 0.9f, colors[COLOR_WHITE], remote_mode_switch_char[current_mode]);
|
||||||
|
|
||||||
draw_image(sprites_arrow_left_idx, 3, 114);
|
draw_image(sprites_arrow_left_idx, 3, 114);
|
||||||
draw_image(sprites_arrow_right_idx, 308, 114);
|
draw_image(sprites_arrow_right_idx, 308, 114);
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ void load_icons_thread(void * void_arg)
|
|||||||
bool load_preview_from_buffer(char * row_pointers, u32 size, C2D_Image * preview_image, int * preview_offset, int height)
|
bool load_preview_from_buffer(char * row_pointers, u32 size, C2D_Image * preview_image, int * preview_offset, int height)
|
||||||
{
|
{
|
||||||
int width = (uint32_t)((size / 4) / height);
|
int width = (uint32_t)((size / 4) / height);
|
||||||
|
u32 tex_height = height > 512 ? 1024 : 512;
|
||||||
|
|
||||||
free_preview(*preview_image);
|
free_preview(*preview_image);
|
||||||
|
|
||||||
@@ -322,10 +323,10 @@ bool load_preview_from_buffer(char * row_pointers, u32 size, C2D_Image * preview
|
|||||||
subt3x->left = 0.0f;
|
subt3x->left = 0.0f;
|
||||||
subt3x->top = 1.0f;
|
subt3x->top = 1.0f;
|
||||||
subt3x->right = width/512.0f;
|
subt3x->right = width/512.0f;
|
||||||
subt3x->bottom = 1.0-(height/512.0f);
|
subt3x->bottom = 1.0-(height/tex_height);
|
||||||
preview_image->subtex = subt3x;
|
preview_image->subtex = subt3x;
|
||||||
|
|
||||||
C3D_TexInit(preview_image->tex, 512, 512, GPU_RGBA8);
|
C3D_TexInit(preview_image->tex, 512, tex_height, GPU_RGBA8);
|
||||||
|
|
||||||
memset(preview_image->tex->data, 0, preview_image->tex->size);
|
memset(preview_image->tex->data, 0, preview_image->tex->size);
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ static void free_icons(Entry_List_s * list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Unnecessary with ThemePlaza providing smdh files for badges
|
||||||
static void load_remote_metadata(Entry_s * entry)
|
static void load_remote_metadata(Entry_s * entry)
|
||||||
{
|
{
|
||||||
char *page_json = NULL;
|
char *page_json = NULL;
|
||||||
@@ -84,7 +85,7 @@ static void load_remote_metadata(Entry_s * entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
static void load_remote_smdh(Entry_s * entry, C3D_Tex * into_tex, const Entry_Icon_s * icon_info, bool ignore_cache)
|
static void load_remote_smdh(Entry_s * entry, C3D_Tex * into_tex, const Entry_Icon_s * icon_info, bool ignore_cache)
|
||||||
{
|
{
|
||||||
bool not_cached = true;
|
bool not_cached = true;
|
||||||
@@ -157,13 +158,7 @@ static void load_remote_entries(Entry_List_s * list, json_t * ids_array, bool ig
|
|||||||
utf8_to_utf16(current_entry->path, (u8 *)entry_path, 0x106);
|
utf8_to_utf16(current_entry->path, (u8 *)entry_path, 0x106);
|
||||||
free(entry_path);
|
free(entry_path);
|
||||||
|
|
||||||
if (mode != REMOTE_MODE_BADGES)
|
load_remote_smdh(current_entry, &list->icons_texture, &list->icons_info[i], ignore_cache);
|
||||||
load_remote_smdh(current_entry, &list->icons_texture, &list->icons_info[i], ignore_cache);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
list->entries[i].placeholder_color = C2D_Color32(rand() * 255, rand() * 255, rand() * 255, 255);
|
|
||||||
load_remote_metadata(current_entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user