From 0d96c487ee6e652e4b4a5118f971ce5424ffc478 Mon Sep 17 00:00:00 2001 From: Steven Smith Date: Tue, 12 Apr 2016 18:44:24 -0700 Subject: [PATCH] Display DS icons 1:1. --- romfs/smdh_info_box.png | Bin 360 -> 339 bytes source/ui/ui.c | 42 ++++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/romfs/smdh_info_box.png b/romfs/smdh_info_box.png index 32ea1c37b21b39f0f84f1b54c731cdef00f1fb07..f13b65c398da861b340f2cd41f8fcdb7bc5b15d1 100644 GIT binary patch literal 339 zcmeAS@N?(olHy`uVBq!ia0y~yU~~Yo9XQy4WcKrQazKhL$=lrpNCUx7=iT){inG8Y zvY3H^TNs2H8D`Cq01C2~c>21sKVacy)G)kY%{>DsBw6AbQR1ARo120l_5c6? literal 360 zcmeAS@N?(olHy`uVBq!ia0y~yU~~Yo9XQy4WcKrQazKhL$=lrpNCUx7=iT){inG8Y zvY3H^TNs2H8D`Cq01C2~c>21sKVXz+<29+5)f5B@NtU=qlsM<-=BDPAFgO>bCYGe8 zD3oWGWGJ|M`UZqI@`(c#UGQ{q45_&F_SQmP1_d5hN3UJ~Pt6yc;IQMeX~>?C08b+Z zJCn5x0uBs}EC`|^{yp2OS1;LrJ>%E`l|Yt8C?uVQWD9Q14?6Dgs%%s}z{;V}z`%q= b6f9@$k>;umoiRNX=r;yWS3j3^P6smdhInfo.texture, smdhIconX, smdhIconY, 48, 48); + u32 smdhIconWidth; + u32 smdhIconHeight; + screen_get_texture_size(&smdhIconWidth, &smdhIconHeight, info->smdhInfo.texture); + + float smdhIconX = smdhInfoBoxX + (64 - smdhIconWidth) / 2; + float smdhIconY = smdhInfoBoxY + (smdhInfoBoxHeight - smdhIconHeight) / 2; + screen_draw_texture(info->smdhInfo.texture, smdhIconX, smdhIconY, smdhIconWidth, smdhIconHeight); float shortDescriptionHeight; screen_get_string_size(NULL, &shortDescriptionHeight, info->smdhInfo.shortDescription, 0.5f, 0.5f); @@ -253,9 +257,9 @@ void ui_draw_ext_save_data_info(ui_view* view, void* data, float x1, float y1, f float publisherHeight; screen_get_string_size(NULL, &publisherHeight, info->smdhInfo.publisher, 0.5f, 0.5f); - float smdhTextX = smdhIconX + 48 + 8; + float smdhTextX = smdhInfoBoxX + 64; - float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; + float smdhShortDescriptionY = smdhInfoBoxY + (64 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false); float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2; @@ -334,9 +338,13 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2, float smdhInfoBoxY = y1 + (y2 - y1) / 4 - smdhInfoBoxHeight / 2; screen_draw_texture(TEXTURE_SMDH_INFO_BOX, smdhInfoBoxX, smdhInfoBoxY, smdhInfoBoxWidth, smdhInfoBoxHeight); - float smdhIconX = smdhInfoBoxX + 8; - float smdhIconY = smdhInfoBoxY + 8; - screen_draw_texture(info->ciaInfo.smdhInfo.texture, smdhIconX, smdhIconY, 48, 48); + u32 smdhIconWidth; + u32 smdhIconHeight; + screen_get_texture_size(&smdhIconWidth, &smdhIconHeight, info->ciaInfo.smdhInfo.texture); + + float smdhIconX = smdhInfoBoxX + (64 - smdhIconWidth) / 2; + float smdhIconY = smdhInfoBoxY + (smdhInfoBoxHeight - smdhIconHeight) / 2; + screen_draw_texture(info->ciaInfo.smdhInfo.texture, smdhIconX, smdhIconY, smdhIconWidth, smdhIconHeight); float shortDescriptionHeight; screen_get_string_size(NULL, &shortDescriptionHeight, info->ciaInfo.smdhInfo.shortDescription, 0.5f, 0.5f); @@ -347,9 +355,9 @@ void ui_draw_file_info(ui_view* view, void* data, float x1, float y1, float x2, float publisherHeight; screen_get_string_size(NULL, &publisherHeight, info->ciaInfo.smdhInfo.publisher, 0.5f, 0.5f); - float smdhTextX = smdhIconX + 48 + 8; + float smdhTextX = smdhInfoBoxX + 64; - float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; + float smdhShortDescriptionY = smdhInfoBoxY + (64 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; screen_draw_string(info->ciaInfo.smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false); float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2; @@ -502,9 +510,13 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2, float smdhInfoBoxY = y1 + (y2 - y1) / 4 - smdhInfoBoxHeight / 2; screen_draw_texture(TEXTURE_SMDH_INFO_BOX, smdhInfoBoxX, smdhInfoBoxY, smdhInfoBoxWidth, smdhInfoBoxHeight); - float smdhIconX = smdhInfoBoxX + 8; - float smdhIconY = smdhInfoBoxY + 8; - screen_draw_texture(info->smdhInfo.texture, smdhIconX, smdhIconY, 48, 48); + u32 smdhIconWidth; + u32 smdhIconHeight; + screen_get_texture_size(&smdhIconWidth, &smdhIconHeight, info->smdhInfo.texture); + + float smdhIconX = smdhInfoBoxX + (64 - smdhIconWidth) / 2; + float smdhIconY = smdhInfoBoxY + (smdhInfoBoxHeight - smdhIconHeight) / 2; + screen_draw_texture(info->smdhInfo.texture, smdhIconX, smdhIconY, smdhIconWidth, smdhIconHeight); float shortDescriptionHeight; screen_get_string_size(NULL, &shortDescriptionHeight, info->smdhInfo.shortDescription, 0.5f, 0.5f); @@ -515,9 +527,9 @@ void ui_draw_title_info(ui_view* view, void* data, float x1, float y1, float x2, float publisherHeight; screen_get_string_size(NULL, &publisherHeight, info->smdhInfo.publisher, 0.5f, 0.5f); - float smdhTextX = smdhIconX + 48 + 8; + float smdhTextX = smdhInfoBoxX + 64; - float smdhShortDescriptionY = smdhIconY + (48 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; + float smdhShortDescriptionY = smdhInfoBoxY + (64 - shortDescriptionHeight - 2 - longDescriptionHeight - 2 - publisherHeight) / 2; screen_draw_string(info->smdhInfo.shortDescription, smdhTextX, smdhShortDescriptionY, 0.5f, 0.5f, COLOR_TEXT, false); float smdhLongDescriptionY = smdhShortDescriptionY + shortDescriptionHeight + 2;