diff --git a/data/images/butauoff.png b/data/images/butauoff.png deleted file mode 100644 index 1f99f088..00000000 Binary files a/data/images/butauoff.png and /dev/null differ diff --git a/data/images/butauoffs.png b/data/images/butauoffs.png deleted file mode 100644 index 48e77d2e..00000000 Binary files a/data/images/butauoffs.png and /dev/null differ diff --git a/data/images/butdeoff.png b/data/images/butdeoff.png deleted file mode 100644 index f3095bc8..00000000 Binary files a/data/images/butdeoff.png and /dev/null differ diff --git a/data/images/butdeoffs.png b/data/images/butdeoffs.png deleted file mode 100644 index 7afc1e47..00000000 Binary files a/data/images/butdeoffs.png and /dev/null differ diff --git a/data/images/butenoff.png b/data/images/butenoff.png deleted file mode 100644 index ca42180a..00000000 Binary files a/data/images/butenoff.png and /dev/null differ diff --git a/data/images/butenoffs.png b/data/images/butenoffs.png deleted file mode 100644 index e3b3754f..00000000 Binary files a/data/images/butenoffs.png and /dev/null differ diff --git a/data/images/butesoff.png b/data/images/butesoff.png deleted file mode 100644 index 29b07b85..00000000 Binary files a/data/images/butesoff.png and /dev/null differ diff --git a/data/images/butesoffs.png b/data/images/butesoffs.png deleted file mode 100644 index 49aebf92..00000000 Binary files a/data/images/butesoffs.png and /dev/null differ diff --git a/data/images/butfroff.png b/data/images/butfroff.png deleted file mode 100644 index 7ea0ca70..00000000 Binary files a/data/images/butfroff.png and /dev/null differ diff --git a/data/images/butfroffs.png b/data/images/butfroffs.png deleted file mode 100644 index 2c1a39df..00000000 Binary files a/data/images/butfroffs.png and /dev/null differ diff --git a/data/images/butitoff.png b/data/images/butitoff.png deleted file mode 100644 index 8d4e6de7..00000000 Binary files a/data/images/butitoff.png and /dev/null differ diff --git a/data/images/butitoffs.png b/data/images/butitoffs.png deleted file mode 100644 index 2624de6e..00000000 Binary files a/data/images/butitoffs.png and /dev/null differ diff --git a/data/images/butjaoff.png b/data/images/butjaoff.png deleted file mode 100644 index 7a4e3b63..00000000 Binary files a/data/images/butjaoff.png and /dev/null differ diff --git a/data/images/butjaoffs.png b/data/images/butjaoffs.png deleted file mode 100644 index 84f75fe7..00000000 Binary files a/data/images/butjaoffs.png and /dev/null differ diff --git a/data/images/butkooff.png b/data/images/butkooff.png deleted file mode 100644 index 89440cdf..00000000 Binary files a/data/images/butkooff.png and /dev/null differ diff --git a/data/images/butkooffs.png b/data/images/butkooffs.png deleted file mode 100644 index 982dd4bf..00000000 Binary files a/data/images/butkooffs.png and /dev/null differ diff --git a/data/images/butnloff.png b/data/images/butnloff.png deleted file mode 100644 index dac53526..00000000 Binary files a/data/images/butnloff.png and /dev/null differ diff --git a/data/images/butnloffs.png b/data/images/butnloffs.png deleted file mode 100644 index af34a63d..00000000 Binary files a/data/images/butnloffs.png and /dev/null differ diff --git a/data/images/butptoff.png b/data/images/butptoff.png deleted file mode 100644 index 394403db..00000000 Binary files a/data/images/butptoff.png and /dev/null differ diff --git a/data/images/butptoffs.png b/data/images/butptoffs.png deleted file mode 100644 index ec981a3c..00000000 Binary files a/data/images/butptoffs.png and /dev/null differ diff --git a/data/images/butruoff.png b/data/images/butruoff.png deleted file mode 100644 index 04dbcf9e..00000000 Binary files a/data/images/butruoff.png and /dev/null differ diff --git a/data/images/butruoffs.png b/data/images/butruoffs.png deleted file mode 100644 index a885e869..00000000 Binary files a/data/images/butruoffs.png and /dev/null differ diff --git a/data/images/butzhcnoff.png b/data/images/butzhcnoff.png deleted file mode 100644 index bef2832a..00000000 Binary files a/data/images/butzhcnoff.png and /dev/null differ diff --git a/data/images/butzhcnoffs.png b/data/images/butzhcnoffs.png deleted file mode 100644 index b0c060b2..00000000 Binary files a/data/images/butzhcnoffs.png and /dev/null differ diff --git a/source/gui/texture.cpp b/source/gui/texture.cpp index bb23e7b3..a6aae2e4 100644 --- a/source/gui/texture.cpp +++ b/source/gui/texture.cpp @@ -435,7 +435,7 @@ TexErr STexture::fromJPG(TexData &dest, const u8 *buffer, const u32 buffer_size, return TE_OK; } -TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize) +TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize, bool reduce_alpha) { Cleanup(dest); u8 maxLODTmp = 0; @@ -583,9 +583,24 @@ TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, PNGU_ReleaseImageContext(ctx); } DCFlushRange(dest.data, dest.dataSize); + _reduceAlpha(dest, reduce_alpha); return TE_OK; } +void STexture::_reduceAlpha(TexData &dest, bool reduce_alpha) +{ + if(dest.format != GX_TF_RGBA8 || reduce_alpha == false) + return; + for(u32 y = 0; y < dest.height; ++y) + { + for(u32 x = 0; x < dest.width; ++x) + { + dest.data[coordsRGBA8(x, y, dest.width)] /= 2; + } + } + DCFlushRange(dest.data, dest.dataSize); +} + void STexture::_resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight) { float wc = (float)srcWidth / (float)dstWidth; diff --git a/source/gui/texture.hpp b/source/gui/texture.hpp index 412f1c98..35e76af8 100644 --- a/source/gui/texture.hpp +++ b/source/gui/texture.hpp @@ -31,11 +31,12 @@ public: // Get from PNG, if not found from JPG TexErr fromImageFile(TexData &dest, const char *filename, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); // This function doesn't use MEM2 if the PNG is loaded from memory and there's no mip mapping - TexErr fromPNG(TexData &dest, const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); + TexErr fromPNG(TexData &dest, const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0, bool reduce_alpha = false); TexErr fromJPG(TexData &dest, const u8 *buffer, const u32 buffer_size, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0); /* Just for THP */ TexErr fromTHP(TexData &dest, const u8 *buffer, u32 w, u32 h); private: + void _reduceAlpha(TexData &dest, bool reduce_alpha); void _resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight); void _resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight); u8 *_genMipMaps(u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height); diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index f3eaa4e4..3596d223 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -61,52 +61,28 @@ extern const u8 pbarcenters_png[]; extern const u8 pbarrights_png[]; extern const u8 butauon_png[]; extern const u8 butauons_png[]; -extern const u8 butauoff_png[]; -extern const u8 butauoffs_png[]; extern const u8 butenon_png[]; extern const u8 butenons_png[]; -extern const u8 butenoff_png[]; -extern const u8 butenoffs_png[]; extern const u8 butjaon_png[]; extern const u8 butjaons_png[]; -extern const u8 butjaoff_png[]; -extern const u8 butjaoffs_png[]; extern const u8 butfron_png[]; extern const u8 butfrons_png[]; -extern const u8 butfroff_png[]; -extern const u8 butfroffs_png[]; extern const u8 butdeon_png[]; extern const u8 butdeons_png[]; -extern const u8 butdeoff_png[]; -extern const u8 butdeoffs_png[]; extern const u8 buteson_png[]; extern const u8 butesons_png[]; -extern const u8 butesoff_png[]; -extern const u8 butesoffs_png[]; extern const u8 butiton_png[]; extern const u8 butitons_png[]; -extern const u8 butitoff_png[]; -extern const u8 butitoffs_png[]; extern const u8 butnlon_png[]; extern const u8 butnlons_png[]; -extern const u8 butnloff_png[]; -extern const u8 butnloffs_png[]; extern const u8 butpton_png[]; extern const u8 butptons_png[]; -extern const u8 butptoff_png[]; -extern const u8 butptoffs_png[]; extern const u8 butruon_png[]; extern const u8 butruons_png[]; -extern const u8 butruoff_png[]; -extern const u8 butruoffs_png[]; extern const u8 butkoon_png[]; extern const u8 butkoons_png[]; -extern const u8 butkooff_png[]; -extern const u8 butkooffs_png[]; extern const u8 butzhcnon_png[]; extern const u8 butzhcnons_png[]; -extern const u8 butzhcnoff_png[]; -extern const u8 butzhcnoffs_png[]; extern const u8 checkbox_png[]; extern const u8 checkboxs_png[]; extern const u8 checkboxhid_png[]; @@ -1018,114 +994,116 @@ void CMenu::_buildMenus(void) TexHandle.fromPNG(theme.btnTexCSH, buthscenter_png); theme.btnTexCSH = _texture("GENERAL", "button_texture_hlcenter_selected", theme.btnTexCSH); + /* Language Buttons */ TexHandle.fromPNG(theme.btnAUOn, butauon_png); theme.btnAUOn = _texture("GENERAL", "button_au_on", theme.btnAUOn); TexHandle.fromPNG(theme.btnAUOns, butauons_png); theme.btnAUOns = _texture("GENERAL", "button_au_on_selected", theme.btnAUOns); - TexHandle.fromPNG(theme.btnAUOff, butauoff_png); + TexHandle.fromPNG(theme.btnAUOff, butauon_png, GX_TF_RGBA8, 0, 0, true); theme.btnAUOff = _texture("GENERAL", "button_au_off", theme.btnAUOff); - TexHandle.fromPNG(theme.btnAUOffs, butauoffs_png); + TexHandle.fromPNG(theme.btnAUOffs, butauons_png, GX_TF_RGBA8, 0, 0, true); theme.btnAUOffs = _texture("GENERAL", "button_au_off_selected", theme.btnAUOffs); TexHandle.fromPNG(theme.btnENOn, butenon_png); theme.btnENOn = _texture("GENERAL", "button_en_on", theme.btnENOn); TexHandle.fromPNG(theme.btnENOns, butenons_png); theme.btnENOns = _texture("GENERAL", "button_en_on_selected", theme.btnENOns); - TexHandle.fromPNG(theme.btnENOff, butenoff_png); + TexHandle.fromPNG(theme.btnENOff, butenon_png, GX_TF_RGBA8, 0, 0, true); theme.btnENOff = _texture("GENERAL", "button_en_off", theme.btnENOff); - TexHandle.fromPNG(theme.btnENOffs, butenoffs_png); + TexHandle.fromPNG(theme.btnENOffs, butenons_png, GX_TF_RGBA8, 0, 0, true); theme.btnENOffs = _texture("GENERAL", "button_en_off_selected", theme.btnENOffs); TexHandle.fromPNG(theme.btnJAOn, butjaon_png); theme.btnJAOn = _texture("GENERAL", "button_ja_on", theme.btnJAOn); TexHandle.fromPNG(theme.btnJAOns, butjaons_png); theme.btnJAOns = _texture("GENERAL", "button_ja_on_selected", theme.btnJAOns); - TexHandle.fromPNG(theme.btnJAOff, butjaoff_png); + TexHandle.fromPNG(theme.btnJAOff, butjaon_png, GX_TF_RGBA8, 0, 0, true); theme.btnJAOff = _texture("GENERAL", "button_ja_off", theme.btnJAOff); - TexHandle.fromPNG(theme.btnJAOffs, butjaoffs_png); + TexHandle.fromPNG(theme.btnJAOffs, butjaons_png, GX_TF_RGBA8, 0, 0, true); theme.btnJAOffs = _texture("GENERAL", "button_ja_off_selected", theme.btnJAOffs); TexHandle.fromPNG(theme.btnFROn, butfron_png); theme.btnFROn = _texture("GENERAL", "button_fr_on", theme.btnFROn); TexHandle.fromPNG(theme.btnFROns, butfrons_png); theme.btnFROns = _texture("GENERAL", "button_fr_on_selected", theme.btnFROns); - TexHandle.fromPNG(theme.btnFROff, butfroff_png); + TexHandle.fromPNG(theme.btnFROff, butfron_png, GX_TF_RGBA8, 0, 0, true); theme.btnFROff = _texture("GENERAL", "button_fr_off", theme.btnFROff); - TexHandle.fromPNG(theme.btnFROffs, butfroffs_png); + TexHandle.fromPNG(theme.btnFROffs, butfrons_png, GX_TF_RGBA8, 0, 0, true); theme.btnFROffs = _texture("GENERAL", "button_fr_off_selected", theme.btnFROffs); TexHandle.fromPNG(theme.btnDEOn, butdeon_png); theme.btnDEOn = _texture("GENERAL", "button_de_on", theme.btnDEOn); TexHandle.fromPNG(theme.btnDEOns, butdeons_png); theme.btnDEOns = _texture("GENERAL", "button_de_on_selected", theme.btnDEOns); - TexHandle.fromPNG(theme.btnDEOff, butdeoff_png); + TexHandle.fromPNG(theme.btnDEOff, butdeon_png, GX_TF_RGBA8, 0, 0, true); theme.btnDEOff = _texture("GENERAL", "button_de_off", theme.btnDEOff); - TexHandle.fromPNG(theme.btnDEOffs, butdeoffs_png); + TexHandle.fromPNG(theme.btnDEOffs, butdeons_png, GX_TF_RGBA8, 0, 0, true); theme.btnDEOffs = _texture("GENERAL", "button_de_off_selected", theme.btnDEOffs); TexHandle.fromPNG(theme.btnESOn, buteson_png); theme.btnESOn = _texture("GENERAL", "button_es_on", theme.btnESOn); TexHandle.fromPNG(theme.btnESOns, butesons_png); theme.btnESOns = _texture("GENERAL", "button_es_on_selected", theme.btnESOns); - TexHandle.fromPNG(theme.btnESOff, butesoff_png); + TexHandle.fromPNG(theme.btnESOff, buteson_png, GX_TF_RGBA8, 0, 0, true); theme.btnESOff = _texture("GENERAL", "button_es_off", theme.btnESOff); - TexHandle.fromPNG(theme.btnESOffs, butesoffs_png); + TexHandle.fromPNG(theme.btnESOffs, butesons_png, GX_TF_RGBA8, 0, 0, true); theme.btnESOffs = _texture("GENERAL", "button_es_off_selected", theme.btnESOffs); TexHandle.fromPNG(theme.btnITOn, butiton_png); theme.btnITOn = _texture("GENERAL", "button_it_on", theme.btnITOn); TexHandle.fromPNG(theme.btnITOns, butitons_png); theme.btnITOns = _texture("GENERAL", "button_it_on_selected", theme.btnITOns); - TexHandle.fromPNG(theme.btnITOff, butitoff_png); + TexHandle.fromPNG(theme.btnITOff, butiton_png, GX_TF_RGBA8, 0, 0, true); theme.btnITOff = _texture("GENERAL", "button_it_off", theme.btnITOff); - TexHandle.fromPNG(theme.btnITOffs, butitoffs_png); + TexHandle.fromPNG(theme.btnITOffs, butitons_png, GX_TF_RGBA8, 0, 0, true); theme.btnITOffs = _texture("GENERAL", "button_it_off_selected", theme.btnITOffs); TexHandle.fromPNG(theme.btnNLOn, butnlon_png); theme.btnNLOn = _texture("GENERAL", "button_nl_on", theme.btnNLOn); TexHandle.fromPNG(theme.btnNLOns, butnlons_png); theme.btnNLOns = _texture("GENERAL", "button_nl_on_selected", theme.btnNLOns); - TexHandle.fromPNG(theme.btnNLOff, butnloff_png); + TexHandle.fromPNG(theme.btnNLOff, butnlon_png, GX_TF_RGBA8, 0, 0, true); theme.btnNLOff = _texture("GENERAL", "button_nl_off", theme.btnNLOff); - TexHandle.fromPNG(theme.btnNLOffs, butnloffs_png); + TexHandle.fromPNG(theme.btnNLOffs, butnlons_png, GX_TF_RGBA8, 0, 0, true); theme.btnNLOffs = _texture("GENERAL", "button_nl_off_selected", theme.btnNLOffs); TexHandle.fromPNG(theme.btnPTOn, butpton_png); theme.btnPTOn = _texture("GENERAL", "button_pt_on", theme.btnPTOn); TexHandle.fromPNG(theme.btnPTOns, butptons_png); theme.btnPTOns = _texture("GENERAL", "button_pt_on_selected", theme.btnPTOns); - TexHandle.fromPNG(theme.btnPTOff, butptoff_png); + TexHandle.fromPNG(theme.btnPTOff, butpton_png, GX_TF_RGBA8, 0, 0, true); theme.btnPTOff = _texture("GENERAL", "button_pt_off", theme.btnPTOff); - TexHandle.fromPNG(theme.btnPTOffs, butptoffs_png); + TexHandle.fromPNG(theme.btnPTOffs, butptons_png, GX_TF_RGBA8, 0, 0, true); theme.btnPTOffs = _texture("GENERAL", "button_pt_off_selected", theme.btnPTOffs); TexHandle.fromPNG(theme.btnRUOn, butruon_png); theme.btnRUOn = _texture("GENERAL", "button_ru_on", theme.btnRUOn); TexHandle.fromPNG(theme.btnRUOns, butruons_png); theme.btnRUOns = _texture("GENERAL", "button_ru_on_selected", theme.btnRUOns); - TexHandle.fromPNG(theme.btnRUOff, butruoff_png); + TexHandle.fromPNG(theme.btnRUOff, butruon_png, GX_TF_RGBA8, 0, 0, true); theme.btnRUOff = _texture("GENERAL", "button_ru_off", theme.btnRUOff); - TexHandle.fromPNG(theme.btnRUOffs, butruoffs_png); + TexHandle.fromPNG(theme.btnRUOffs, butruons_png, GX_TF_RGBA8, 0, 0, true); theme.btnRUOffs = _texture("GENERAL", "button_ru_off_selected", theme.btnRUOffs); TexHandle.fromPNG(theme.btnKOOn, butkoon_png); theme.btnKOOn = _texture("GENERAL", "button_ko_on", theme.btnKOOn); TexHandle.fromPNG(theme.btnKOOns, butkoons_png); theme.btnKOOns = _texture("GENERAL", "button_ko_on_selected", theme.btnKOOns); - TexHandle.fromPNG(theme.btnKOOff, butkooff_png); + TexHandle.fromPNG(theme.btnKOOff, butkoon_png, GX_TF_RGBA8, 0, 0, true); theme.btnKOOff = _texture("GENERAL", "button_ko_off", theme.btnKOOff); - TexHandle.fromPNG(theme.btnKOOffs, butkooffs_png); + TexHandle.fromPNG(theme.btnKOOffs, butkoons_png, GX_TF_RGBA8, 0, 0, true); theme.btnKOOffs = _texture("GENERAL", "button_ko_off_selected", theme.btnKOOffs); TexHandle.fromPNG(theme.btnZHCNOn, butzhcnon_png); theme.btnZHCNOn = _texture("GENERAL", "button_zhcn_on", theme.btnZHCNOn); TexHandle.fromPNG(theme.btnZHCNOns, butzhcnons_png); theme.btnZHCNOns = _texture("GENERAL", "button_zhcn_on_selected", theme.btnZHCNOns); - TexHandle.fromPNG(theme.btnZHCNOff, butzhcnoff_png); + TexHandle.fromPNG(theme.btnZHCNOff, butzhcnon_png, GX_TF_RGBA8, 0, 0, true); theme.btnZHCNOff = _texture("GENERAL", "button_zhcn_off", theme.btnZHCNOff); - TexHandle.fromPNG(theme.btnZHCNOffs, butzhcnoffs_png); + TexHandle.fromPNG(theme.btnZHCNOffs, butzhcnons_png, GX_TF_RGBA8, 0, 0, true); theme.btnZHCNOffs = _texture("GENERAL", "button_zhcn_off_selected", theme.btnZHCNOffs); + /* Default textures */ TexHandle.fromPNG(theme.checkboxoff, checkbox_png); theme.checkboxoff = _texture("GENERAL", "checkbox_off", theme.checkboxoff); TexHandle.fromPNG(theme.checkboxoffs, checkbox_png);