mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Change theme endianess
This commit is contained in:
+42
-19
@@ -36,24 +36,24 @@
|
||||
struct ThemeInfo {
|
||||
std::string name;
|
||||
|
||||
uint32_t uItemStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemStyleBg = 0x55000000;
|
||||
uint32_t uItemStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemStyleBg = 0x00000055;
|
||||
uint32_t uItemFocusedStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemFocusedStyleBg = 0xFFEDC24C;
|
||||
uint32_t uItemFocusedStyleBg = 0x4CC2EDFF;
|
||||
uint32_t uItemDownStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uItemDownStyleBg = 0xFFBD9939;
|
||||
uint32_t uItemDisabledStyleFg = 0x80EEEEEE;
|
||||
uint32_t uItemDisabledStyleBg = 0x55000000;
|
||||
uint32_t uItemDownStyleBg = 0x3999BDFF;
|
||||
uint32_t uItemDisabledStyleFg = 0xEEEEEE80;
|
||||
uint32_t uItemDisabledStyleBg = 0x00000055;
|
||||
|
||||
uint32_t uHeaderStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uInfoStyleBg = 0x00000000;
|
||||
uint32_t uPopupTitleStyleFg = 0xFFE3BE59;
|
||||
uint32_t uPopupTitleStyleFg = 0x59BEE3FF;
|
||||
uint32_t uPopupStyleFg = 0xFFFFFFFF;
|
||||
uint32_t uPopupStyleBg = 0xFF303030;
|
||||
uint32_t uBackgroundColor = 0xFF754D24;
|
||||
uint32_t uPopupStyleBg = 0x303030FF;
|
||||
uint32_t uBackgroundColor = 0x244D75FF;
|
||||
|
||||
std::string UIAtlas;
|
||||
std::string sUIAtlas = "ui_atlas";
|
||||
|
||||
bool operator == (const std::string &other) {
|
||||
return name == other;
|
||||
@@ -69,11 +69,38 @@ static std::vector<ThemeInfo> themeInfos;
|
||||
static Atlas ui_atlas;
|
||||
static Atlas font_atlas;
|
||||
|
||||
static void FlipColorEndianess(ThemeInfo &info) {
|
||||
auto convert = [](uint32_t abgr) {
|
||||
int a = (abgr >> 24) & 0xff;
|
||||
int b = (abgr >> 16) & 0xff;
|
||||
int g = (abgr >> 8) & 0xff;
|
||||
int r = abgr & 0xff;
|
||||
return (r << 24) | (g << 16) | (b << 8) | a;
|
||||
};
|
||||
|
||||
info.uItemStyleFg = convert(info.uItemStyleFg);
|
||||
info.uItemStyleBg = convert(info.uItemStyleBg);
|
||||
info.uItemFocusedStyleFg = convert(info.uItemFocusedStyleFg);
|
||||
info.uItemFocusedStyleBg = convert(info.uItemFocusedStyleBg);
|
||||
info.uItemDownStyleFg = convert(info.uItemDownStyleFg);
|
||||
info.uItemDownStyleBg = convert(info.uItemDownStyleBg);
|
||||
info.uItemDisabledStyleFg = convert(info.uItemDisabledStyleFg);
|
||||
info.uItemDisabledStyleBg = convert(info.uItemDisabledStyleBg);
|
||||
|
||||
info.uHeaderStyleFg = convert(info.uHeaderStyleFg);
|
||||
info.uInfoStyleFg = convert(info.uInfoStyleFg);
|
||||
info.uInfoStyleBg = convert(info.uInfoStyleBg);
|
||||
info.uPopupTitleStyleFg = convert(info.uPopupTitleStyleFg);
|
||||
info.uPopupStyleFg = convert(info.uPopupStyleFg);
|
||||
info.uPopupStyleBg = convert(info.uPopupStyleBg);
|
||||
info.uBackgroundColor = convert(info.uBackgroundColor);
|
||||
}
|
||||
|
||||
static void LoadThemeInfo(const std::vector<Path> &directories) {
|
||||
themeInfos.clear();
|
||||
ThemeInfo def{};
|
||||
def.name = "Default";
|
||||
def.UIAtlas = "ui_atlas";
|
||||
FlipColorEndianess(def);
|
||||
themeInfos.push_back(def);
|
||||
|
||||
// This will update the theme if already present, as such default in assets/theme will get priority if exist
|
||||
@@ -145,15 +172,11 @@ static void LoadThemeInfo(const std::vector<Path> &directories) {
|
||||
|
||||
File::FileInfo tmpInfo;
|
||||
if (VFSGetFileInfo((tmpPath+".meta").c_str(), &tmpInfo) && VFSGetFileInfo((tmpPath+".zim").c_str(), &tmpInfo)) {
|
||||
info.UIAtlas = tmpPath;
|
||||
} else {
|
||||
// Files not found, fallback to default
|
||||
info.UIAtlas = "ui_atlas";
|
||||
info.sUIAtlas = tmpPath;
|
||||
}
|
||||
} else {
|
||||
info.UIAtlas = "ui_atlas";
|
||||
}
|
||||
|
||||
FlipColorEndianess(info);
|
||||
appendTheme(info);
|
||||
}
|
||||
}
|
||||
@@ -230,14 +253,14 @@ void UpdateTheme(UIContext *ctx) {
|
||||
ui_theme.backgroundColor = themeInfos[i].uBackgroundColor;
|
||||
|
||||
// Load any missing atlas metadata (the images are loaded from UIContext).
|
||||
LoadAtlasMetadata(ui_atlas, (themeInfos[i].UIAtlas + ".meta").c_str(), true);
|
||||
LoadAtlasMetadata(ui_atlas, (themeInfos[i].sUIAtlas + ".meta").c_str(), true);
|
||||
#if !(PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID))
|
||||
LoadAtlasMetadata(font_atlas, "font_atlas.meta", ui_atlas.num_fonts == 0);
|
||||
#else
|
||||
LoadAtlasMetadata(font_atlas, "asciifont_atlas.meta", ui_atlas.num_fonts == 0);
|
||||
#endif
|
||||
|
||||
ctx->setUIAtlas(themeInfos[i].UIAtlas + ".zim");
|
||||
ctx->setUIAtlas(themeInfos[i].sUIAtlas + ".zim");
|
||||
}
|
||||
|
||||
UI::Theme *GetTheme() {
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
[Default]
|
||||
Name = Default
|
||||
ItemStyleFg = 0xffffffff
|
||||
ItemStyleBg = 0x55000000
|
||||
ItemFocusedStyleFg = 0xffffffff
|
||||
ItemFocusedStyleBg = 0xffedc24c
|
||||
ItemDownStyleFg = 0xffffffff
|
||||
ItemDownStyleBg = 0xffbd9939
|
||||
ItemDisabledStyleFg = 0x80eeeeee
|
||||
ItemDisabledStyleBg = 0x55000000
|
||||
HeaderStyleFg = 0xffffffff
|
||||
InfoStyleFg = 0xffffffff
|
||||
ItemStyleFg = 0xFFFFFFFF
|
||||
ItemStyleBg = 0x00000055
|
||||
ItemFocusedStyleFg = 0xFFFFFFFF
|
||||
ItemFocusedStyleBg = 0x4CC2EDFF
|
||||
ItemDownStyleFg = 0xFFFFFFFF
|
||||
ItemDownStyleBg = 0x3999BDFF
|
||||
ItemDisabledStyleFg = 0xEEEEEE80
|
||||
ItemDisabledStyleBg = 0x00000055
|
||||
HeaderStyleFg = 0xFFFFFFFF
|
||||
InfoStyleFg = 0xFFFFFFFF
|
||||
InfoStyleBg = 0x00000000
|
||||
PopupTitleStyleFg = 0xffe3be59
|
||||
PopupStyleFg = 0xffffffff
|
||||
PopupStyleBg = 0xff303030
|
||||
BackgroundColor = 0xff754d24
|
||||
PopupTitleStyleFg = 0x59BEE3FF
|
||||
PopupStyleFg = 0xFFFFFFFF
|
||||
PopupStyleBg = 0x303030FF
|
||||
BackgroundColor = 0x244D75FF
|
||||
UIAtlas = ../ui_atlas
|
||||
|
||||
# Colors are in HEX RGBA
|
||||
# Atlas should be in the format path/to/filename where both filename.zim and filename.meta are
|
||||
# Unprovided entry will use the default value
|
||||
Reference in New Issue
Block a user