re-add s upport for themes without an SMDH

Also change theme dump random color algo
This commit is contained in:
Alex Taber
2020-12-24 16:58:06 -05:00
parent bc2f4ec581
commit c9e1420a00
4 changed files with 9 additions and 12 deletions

View File

@@ -65,7 +65,7 @@ typedef struct {
u16 desc[0x81]; u16 desc[0x81];
u16 author[0x41]; u16 author[0x41];
// u32 placeholder_color; u32 placeholder_color;
u16 path[0x106]; u16 path[0x106];
bool is_zip; bool is_zip;

View File

@@ -719,24 +719,19 @@ void draw_interface(Entry_List_s* list, Instructions_s instructions)
C2D_DrawSpriteTinted(&sprite_installed, &tint); C2D_DrawSpriteTinted(&sprite_installed, &tint);
} }
// no icons not allowed anymore
/*
if(!current_entry->placeholder_color) if(!current_entry->placeholder_color)
{ {
*/
C2D_Image * image = NULL; C2D_Image * image = NULL;
if(list->entries_count > list->entries_loaded*ICONS_OFFSET_AMOUNT) if(list->entries_count > list->entries_loaded*ICONS_OFFSET_AMOUNT)
image = list->icons[ICONS_VISIBLE*list->entries_loaded + (i - list->scroll)]; image = list->icons[ICONS_VISIBLE*list->entries_loaded + (i - list->scroll)];
else else
image = list->icons[i]; image = list->icons[i];
C2D_DrawImageAt(*image, horizontal_offset, vertical_offset, 0.5f, NULL, 1.0f, 1.0f); C2D_DrawImageAt(*image, horizontal_offset, vertical_offset, 0.5f, NULL, 1.0f, 1.0f);
/*
} }
else else
{ {
C2D_DrawRectSolid(horizontal_offset, vertical_offset, 0.5f, list->entry_size, list->entry_size, current_entry->placeholder_color); C2D_DrawRectSolid(horizontal_offset, vertical_offset, 0.5f, list->entry_size, list->entry_size, current_entry->placeholder_color);
} }
*/
} }
char entries_count_str[0x20] = {0}; char entries_count_str[0x20] = {0};

View File

@@ -83,7 +83,7 @@ C2D_Image * loadTextureIcon(Icon_s *icon)
void parse_smdh(Icon_s *icon, Entry_s * entry, const u16 * fallback_name) void parse_smdh(Icon_s *icon, Entry_s * entry, const u16 * fallback_name)
{ {
/*
if(icon == NULL) if(icon == NULL)
{ {
memcpy(entry->name, fallback_name, 0x80); memcpy(entry->name, fallback_name, 0x80);
@@ -92,7 +92,7 @@ void parse_smdh(Icon_s *icon, Entry_s * entry, const u16 * fallback_name)
entry->placeholder_color = C2D_Color32(rand() % 255, rand() % 255, rand() % 255, 255); entry->placeholder_color = C2D_Color32(rand() % 255, rand() % 255, rand() % 255, 255);
return; return;
} }
*/
memcpy(entry->name, icon->name, 0x40*sizeof(u16)); memcpy(entry->name, icon->name, 0x40*sizeof(u16));
memcpy(entry->desc, icon->desc, 0x80*sizeof(u16)); memcpy(entry->desc, icon->desc, 0x80*sizeof(u16));
@@ -186,14 +186,12 @@ Result load_entries(const char * loading_path, Entry_List_s * list)
if (!strcmp(dir_entry.shortExt, "ZIP")) if (!strcmp(dir_entry.shortExt, "ZIP"))
{ {
u32 size = zip_file_to_buf("info.smdh", path, &buf); u32 size = zip_file_to_buf("info.smdh", path, &buf);
if (size == 0) continue;
} }
else else
{ {
const ssize_t len = strulen(path, 0x106); const ssize_t len = strulen(path, 0x106);
struacat(path, "/info.smdh"); struacat(path, "/info.smdh");
u32 size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &buf); u32 size = file_to_buf(fsMakePath(PATH_UTF16, path), ArchiveSD, &buf);
if (size == 0) continue;
memset(&path[len], 0, (0x106 - len) * sizeof(u16)); memset(&path[len], 0, (0x106 - len) * sizeof(u16));
} }

View File

@@ -393,7 +393,11 @@ Result dump_theme(void)
free(output_dir); free(output_dir);
u16 color = rand() % 65535; u8 r = rand() % 255;
u8 g = rand() % 255;
u8 b = rand() % 255;
u16 color = ((r & 0b11111000) << 8) | ((g & 0b11111100) << 3) | (b >> 3);
for (int i = 0x2040; i < 0x36c0; i += 2) for (int i = 0x2040; i < 0x36c0; i += 2)
{ {