| 23 | } |
| 24 | |
| 25 | bool menuEntryLoadExternalIcon(menuEntry_s* me, const char* filepath) { |
| 26 | FILE* iconFile = fopen(filepath, "rb"); |
| 27 | |
| 28 | if (!iconFile) |
| 29 | return false; |
| 30 | |
| 31 | if (!me->icon) |
| 32 | me->icon = &me->texture; |
| 33 | |
| 34 | Tex3DS_Texture texture = Tex3DS_TextureImportStdio(iconFile, me->icon, NULL, false); |
| 35 | fclose(iconFile); |
| 36 | |
| 37 | if (!texture) |
| 38 | return false; |
| 39 | |
| 40 | const Tex3DS_SubTexture* subTexture = Tex3DS_GetSubTexture(texture, 0); |
| 41 | |
| 42 | if (subTexture->width != 64 && subTexture->height != 64) { |
| 43 | C3D_TexDelete(me->icon); |
| 44 | me->icon = NULL; |
| 45 | Tex3DS_TextureFree(texture); |
| 46 | |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | // Delete the t3x object since we don't need it |
| 51 | Tex3DS_TextureFree(texture); |
| 52 | |
| 53 | return true; |
| 54 | } |
| 55 | |
| 56 | bool menuEntryImportIcon(menuEntry_s* me, C3D_Tex* texture) |
| 57 | { |
no outgoing calls
no test coverage detected