diff --git a/Common/File/VFS/ZipFileReader.cpp b/Common/File/VFS/ZipFileReader.cpp index 4d3332ad48..7ff871ecbc 100644 --- a/Common/File/VFS/ZipFileReader.cpp +++ b/Common/File/VFS/ZipFileReader.cpp @@ -56,7 +56,7 @@ uint8_t *ZipFileReader::ReadFile(const char *path, size_t *size) { std::string temp_path = inZipPath_ + path; std::lock_guard guard(lock_); - // Figure out the file size first. + // Figure out the file size first. TODO: Can this part be done without locking the mutex? struct zip_stat zstat; int retval = zip_stat(zip_file_, temp_path.c_str(), ZIP_FL_NOCASE | ZIP_FL_UNCHANGED, &zstat); if (retval != 0) { diff --git a/Common/Render/AtlasGen.cpp b/Common/Render/AtlasGen.cpp index 085fc01204..ebb4cf58d4 100644 --- a/Common/Render/AtlasGen.cpp +++ b/Common/Render/AtlasGen.cpp @@ -15,10 +15,9 @@ #include "Common/Data/Format/ZIMSave.h" #include "Common/Data/Encoding/Utf8.h" +#include "Common/File/VFS/VFS.h" #include "Common/Render/AtlasGen.h" -using namespace std; - typedef unsigned short u16; void Image::copyfrom(const Image &img, int ox, int oy, Effect effect) { @@ -51,12 +50,6 @@ void Image::copyfrom(const Image &img, int ox, int oy, Effect effect) { set1(x + ox, y + oy, color); break; } - case Effect::FX_PINK_TO_ALPHA: - { - u32 val = img.get1(x, y); - set1(x + ox, y + oy, ((val & 0xFFFFFF) == 0xFF00FF) ? 0x00FFFFFF : (val | 0xFF000000)); - break; - } default: set1(x + ox, y + oy, 0xFFFF00FF); break; @@ -66,12 +59,21 @@ void Image::copyfrom(const Image &img, int ox, int oy, Effect effect) { } bool Image::LoadPNG(const char *png_name) { + size_t sz; + const uint8_t *file_data = g_VFS.ReadFile(png_name, &sz); + if (!file_data) { + printf("Failed to load png from VFS"); + return false; + } + unsigned char *img_data; int w, h; - if (1 != pngLoad(png_name, &w, &h, &img_data)) { + if (1 != pngLoadPtr(file_data, sz, &w, &h, &img_data)) { + delete[] file_data; printf("Failed to load %s\n", png_name); return false; } + delete[] file_data; resize(w, h); for (int y = 0; y < h; y++) { memcpy(dat.data() + y * w, img_data + 4 * y * w, 4 * w); @@ -157,7 +159,7 @@ std::vector Bucket::Resolve(int image_width, Image &dest) { } // Output the glyph data. - vector dats; + std::vector dats; for (int i = 0; i < (int)items.size(); i++) dats.push_back(items[i].second); return dats; @@ -187,11 +189,11 @@ bool LoadImage(const char *imagefile, Effect effect, Bucket *bucket, int &global dat.ex = (int)img.width(); dat.ey = (int)img.height(); dat.effect = (int)effect; - bucket->AddItem(img, dat); + bucket->AddItem(std::move(img), dat); return true; } -AtlasImage ImageDesc::ToAtlasImage(float tw, float th, const vector &results) const { +AtlasImage ImageDesc::ToAtlasImage(float tw, float th, const std::vector &results) const { AtlasImage img{}; int i = result_index; float toffx = 0.5f / tw; @@ -206,7 +208,7 @@ AtlasImage ImageDesc::ToAtlasImage(float tw, float th, const vector &resul return img; } -void ImageDesc::OutputSelf(FILE *fil, float tw, float th, const vector &results) const { +void ImageDesc::OutputSelf(FILE *fil, float tw, float th, const std::vector &results) const { int i = result_index; float toffx = 0.5f / tw; float toffy = 0.5f / th; diff --git a/Common/Render/AtlasGen.h b/Common/Render/AtlasGen.h index 9fd7ef5736..6d3aa4a7fa 100644 --- a/Common/Render/AtlasGen.h +++ b/Common/Render/AtlasGen.h @@ -16,7 +16,6 @@ enum class Effect { FX_RED_TO_ALPHA_SOLID_WHITE = 1, // for alpha fonts FX_RED_TO_INTENSITY_ALPHA_255 = 2, FX_PREMULTIPLY_ALPHA = 3, - FX_PINK_TO_ALPHA = 4, // for alpha fonts FX_INVALID = 5, }; @@ -96,8 +95,8 @@ inline bool operator<(const Data &lhs, const Data &rhs) { struct Bucket { std::vector > items; - void AddItem(const Image &img, const Data &dat) { - items.push_back(std::make_pair(img, dat)); + void AddItem(const Image &&img, const Data &dat) { + items.emplace_back(std::move(img), dat); } std::vector Resolve(int image_width, Image &dest); }; diff --git a/Common/Render/TextureAtlas.cpp b/Common/Render/TextureAtlas.cpp index 24eb22f63c..d30fe86c5f 100644 --- a/Common/Render/TextureAtlas.cpp +++ b/Common/Render/TextureAtlas.cpp @@ -51,18 +51,27 @@ private: size_t size_; }; -bool Atlas::Load(const uint8_t *data, size_t data_size) { +void Atlas::Clear() { + num_images = 0; + num_fonts = 0; + delete[] images; + delete[] fonts; + images = nullptr; + fonts = nullptr; +} + +bool Atlas::LoadMeta(const uint8_t *data, size_t data_size) { ByteReader reader(data, data_size); AtlasHeader header = reader.Read(); - num_images = header.numImages; - num_fonts = header.numFonts; if (header.magic != ATLAS_MAGIC) { return false; } - delete[] images; - delete[] fonts; + Clear(); + + num_images = header.numImages; + num_fonts = header.numFonts; images = reader.ReadMultipleAlloc(num_images, header.version >= 1); fonts = new AtlasFont[num_fonts]; diff --git a/Common/Render/TextureAtlas.h b/Common/Render/TextureAtlas.h index fe2a851e36..e9b778deda 100644 --- a/Common/Render/TextureAtlas.h +++ b/Common/Render/TextureAtlas.h @@ -128,10 +128,11 @@ struct AtlasHeader { struct Atlas { ~Atlas(); - bool Load(const uint8_t *data, size_t data_size); + bool LoadMeta(const uint8_t *data, size_t data_size); bool IsMetadataLoaded() const { return images != nullptr; } + void Clear(); AtlasFont *fonts = nullptr; int num_fonts = 0; diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index e4d6335b7f..5a14fc33c0 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -13,6 +13,11 @@ #include "Common/Log.h" #include "Common/TimeUtil.h" #include "Common/LogReporting.h" +#include "Common/Render/AtlasGen.h" + +// The generated atlas.. This is temporary. +std::vector genAtlasImages; +Atlas genAtlas; UIContext::UIContext() { fontStyle_ = new UI::FontStyle(); diff --git a/Common/UI/Context.h b/Common/UI/Context.h index ec8582d3ca..e5c4c9433c 100644 --- a/Common/UI/Context.h +++ b/Common/UI/Context.h @@ -128,6 +128,8 @@ public: void SetAtlasProvider(UIAtlasProviderFunc func) { atlasProvider_ = func; } private: + void GenerateUIAtlas(); + Draw::DrawContext *draw_ = nullptr; Bounds bounds_; diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index d83e90b5f1..0b3141ed1f 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -263,7 +263,7 @@ void __PPGeInit() { if (!g_ppge_atlas.IsMetadataLoaded()) { uint8_t *atlas_data = g_VFS.ReadFile("ppge_atlas.meta", &atlas_data_size); if (atlas_data) - g_ppge_atlas.Load(atlas_data, atlas_data_size); + g_ppge_atlas.LoadMeta(atlas_data, atlas_data_size); delete[] atlas_data; } } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e2179fb55e..c93e7a7b9b 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -848,8 +848,9 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { ui_draw2d.Init(g_draw, texColorPipeline); uiContext->Init(g_draw, texColorPipeline, colorPipeline, &ui_draw2d); - if (uiContext->Text()) + if (uiContext->Text()) { uiContext->Text()->SetFont("Tahoma", 20, 0); + } g_screenManager->setUIContext(uiContext); g_screenManager->setPostRenderCallback(&CallbackPostRender, nullptr); diff --git a/UI/Theme.cpp b/UI/Theme.cpp index 98e476cd2f..826a7956af 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -27,6 +27,8 @@ #include "Common/File/DirListing.h" #include "Common/Log/LogManager.h" #include "Common/Render/ManagedTexture.h" +#include "Common/Render/AtlasGen.h" +#include "Common/TimeUtil.h" #include "Core/Config.h" @@ -175,7 +177,7 @@ static UI::Style MakeStyle(uint32_t fg, uint32_t bg) { static void LoadAtlasMetadata(Atlas &metadata, const char *filename) { size_t atlas_data_size = 0; const uint8_t *atlas_data = g_VFS.ReadFile(filename, &atlas_data_size); - bool load_success = atlas_data != nullptr && metadata.Load(atlas_data, atlas_data_size); + bool load_success = atlas_data != nullptr && metadata.LoadMeta(atlas_data, atlas_data_size); if (!load_success) { ERROR_LOG(Log::G3D, "Failed to load %s - graphics may be broken", filename); // Stumble along with broken visuals instead of dying... @@ -278,16 +280,171 @@ std::vector GetThemeInfoNames() { return names; } +Draw::Texture *GenerateUIAtlas(Draw::DrawContext *draw, Atlas *atlas) { + // can't be const, yet... + ImageDesc images[] = { + {"I_SOLIDWHITE", "white.png"}, + {"I_CROSS", "cross.png"}, + {"I_CIRCLE", "circle.png"}, + {"I_SQUARE", "square.png"}, + {"I_TRIANGLE", "triangle.png"}, + {"I_SELECT", "select.png"}, + {"I_START", "start.png"}, + {"I_ARROW", "arrow.png"}, + {"I_DIR", "dir.png"}, + {"I_ROUND", "round.png"}, + {"I_RECT", "rect.png"}, + {"I_STICK", "stick.png"}, + {"I_STICK_BG", "stick_bg.png"}, + {"I_SHOULDER", "shoulder.png"}, + {"I_DIR_LINE", "dir_line.png"}, + {"I_ROUND_LINE", "round_line.png"}, + {"I_RECT_LINE", "rect_line.png"}, + {"I_SHOULDER_LINE", "shoulder_line.png"}, + {"I_STICK_LINE", "stick_line.png"}, + {"I_STICK_BG_LINE", "stick_bg_line.png"}, + {"I_CHECKEDBOX", "checkedbox.png"}, + {"I_BG", "background2.png"}, + {"I_L", "L.png"}, + {"I_R", "R.png"}, + {"I_DROP_SHADOW", "dropshadow.png"}, + {"I_LINES", "lines.png"}, + {"I_GRID", "grid.png"}, + {"I_LOGO", "logo.png"}, + {"I_ICON", "icon_regular_72.png"}, + {"I_ICONGOLD", "icon_gold_72.png"}, + {"I_FOLDER", "folder_line.png"}, + {"I_UP_DIRECTORY", "up_line.png"}, + {"I_GEAR", "gear.png"}, + {"I_1", "1.png"}, + {"I_2", "2.png"}, + {"I_3", "3.png"}, + {"I_4", "4.png"}, + {"I_5", "5.png"}, + {"I_6", "6.png"}, + {"I_PSP_DISPLAY", "psp_display.png"}, + {"I_FLAG_JP", "flag_jp.png"}, + {"I_FLAG_US", "flag_us.png"}, + {"I_FLAG_EU", "flag_eu.png"}, + {"I_FLAG_HK", "flag_hk.png"}, + {"I_FLAG_AS", "flag_as.png"}, + {"I_FLAG_KO", "flag_ko.png"}, + {"I_FULLSCREEN", "fullscreen.png"}, + {"I_RESTORE", "restore.png"}, + {"I_SDCARD", "sdcard.png"}, + {"I_HOME", "home.png"}, + {"I_A", "a.png"}, + {"I_B", "b.png"}, + {"I_C", "c.png"}, + {"I_D", "d.png"}, + {"I_E", "e.png"}, + {"I_F", "f.png"}, + {"I_SQUARE_SHAPE", "square_shape.png"}, + {"I_SQUARE_SHAPE_LINE", "square_shape_line.png"}, + {"I_FOLDER_OPEN", "folder_open_line.png"}, + {"I_WARNING", "warning.png"}, + {"I_TRASHCAN", "trashcan.png"}, + {"I_PLUS", "plus.png"}, + {"I_ROTATE_LEFT", "rotate_left.png"}, + {"I_ROTATE_RIGHT", "rotate_right.png"}, + {"I_ARROW_LEFT", "arrow_left.png"}, + {"I_ARROW_RIGHT", "arrow_right.png"}, + {"I_ARROW_UP", "arrow_up.png"}, + {"I_ARROW_DOWN", "arrow_down.png"}, + {"I_SLIDERS", "sliders.png"}, + {"I_THREE_DOTS", "three_dots.png"}, + {"I_INFO", "info.png"}, + {"I_RETROACHIEVEMENTS_LOGO", "retroachievements_logo.png"}, + {"I_CHECKMARK", "checkmark.png"}, + {"I_PLAY", "play.png"}, + {"I_STOP", "stop.png"}, + {"I_PAUSE", "pause.png"}, + {"I_FASTFORWARD", "fast_forward.png"}, + {"I_RECORD", "record.png"}, + {"I_SPEAKER", "speaker.png"}, + {"I_SPEAKER_MAX", "speaker_max.png"}, + {"I_SPEAKER_OFF", "speaker_off.png"}, + {"I_WINNER_CUP", "winner_cup.png"}, + {"I_EMPTY", "empty.png"}, + }; + int global_id = 0; + + Instant start = Instant::Now(); + + Bucket bucket; + + // Script fully read, now read images and rasterize the fonts. + std::vector resultIds; + resultIds.reserve(ARRAY_SIZE(images)); + for (auto &image : images) { + std::string name = "ui_images/"; + if (image.fileName == "white.png") { + name = "white.png"; + } else { + name.append(image.fileName); + } + image.result_index = (int)bucket.items.size(); + if (!LoadImage(name.c_str(), image.effect, &bucket, global_id)) { + ERROR_LOG(Log::G3D, "Failed to load image %s\n", image.fileName.c_str()); + } + } + INFO_LOG(Log::G3D, " - Loaded %zu images in %.2f ms\n", bucket.items.size(), start.ElapsedMs()); + + int image_width = 512; + Image dest; + + Instant now = Instant::Now(); + std::vector results = bucket.Resolve(image_width, dest); + INFO_LOG(Log::G3D, " - Bucketed %zu images in %.2f ms\n", results.size(), now.ElapsedMs()); + + // Need to sort the results by ID, after the bucket messed up the order. + sort(results.begin(), results.end()); + + // Fill out the atlas structure. + std::vector genAtlasImages; + genAtlasImages.reserve(ARRAY_SIZE(images)); + for (int i = 0; i < ARRAY_SIZE(images); i++) { + genAtlasImages.push_back(images[i].ToAtlasImage((float)dest.width(), (float)dest.height(), results)); + } + + atlas->Clear(); + atlas->images = new AtlasImage[genAtlasImages.size()]; + std::copy(genAtlasImages.begin(), genAtlasImages.end(), atlas->images); + atlas->num_images = (int)genAtlasImages.size(); + + // For debug, write out the atlas. + // dest.SavePNG("../gen.png"); + + // Then, create the texture too. + Draw::TextureDesc desc{}; + desc.width = image_width; + desc.height = dest.height(); + desc.depth = 1; + desc.mipLevels = 1; + desc.format = Draw::DataFormat::R8G8B8A8_UNORM; + desc.type = Draw::TextureType::LINEAR2D; + desc.initData.push_back((const u8 *)dest.data()); + desc.tag = "UIAtlas"; + + INFO_LOG(Log::G3D, "UI atlas generated in %.2f ms, size %dx%d with %zu images\n", start.ElapsedMs(), desc.width, desc.height, genAtlasImages.size()); + return draw->CreateTexture(desc); +} + AtlasData AtlasProvider(Draw::DrawContext *draw, AtlasChoice atlas) { switch (atlas) { case AtlasChoice::General: { + // Generate the atlas from scratch. + Draw::Texture *tex = GenerateUIAtlas(draw, &ui_atlas); + return { &ui_atlas, tex }; + // Load any missing atlas metadata (the images are loaded from UIContext). + /* LoadAtlasMetadata(ui_atlas, "ui_atlas.meta"); return { &ui_atlas, CreateTextureFromFile(draw, "ui_atlas.zim", ImageFileType::ZIM, false) - }; + };*/ } case AtlasChoice::Font: { diff --git a/assets/ui_images/1.png b/assets/ui_images/1.png new file mode 100644 index 0000000000..bc5bde2146 Binary files /dev/null and b/assets/ui_images/1.png differ diff --git a/assets/ui_images/2.png b/assets/ui_images/2.png new file mode 100644 index 0000000000..e10471d3e6 Binary files /dev/null and b/assets/ui_images/2.png differ diff --git a/assets/ui_images/3.png b/assets/ui_images/3.png new file mode 100644 index 0000000000..e08b7dd2be Binary files /dev/null and b/assets/ui_images/3.png differ diff --git a/assets/ui_images/4.png b/assets/ui_images/4.png new file mode 100644 index 0000000000..e3df9d7cca Binary files /dev/null and b/assets/ui_images/4.png differ diff --git a/assets/ui_images/5.png b/assets/ui_images/5.png new file mode 100644 index 0000000000..e3cf6338a0 Binary files /dev/null and b/assets/ui_images/5.png differ diff --git a/assets/ui_images/6.png b/assets/ui_images/6.png new file mode 100644 index 0000000000..35e7bdc457 Binary files /dev/null and b/assets/ui_images/6.png differ diff --git a/assets/ui_images/L.png b/assets/ui_images/L.png new file mode 100644 index 0000000000..1dc2c02bab Binary files /dev/null and b/assets/ui_images/L.png differ diff --git a/assets/ui_images/R.png b/assets/ui_images/R.png new file mode 100644 index 0000000000..4320da9d5b Binary files /dev/null and b/assets/ui_images/R.png differ diff --git a/assets/ui_images/a.png b/assets/ui_images/a.png new file mode 100644 index 0000000000..524904f292 Binary files /dev/null and b/assets/ui_images/a.png differ diff --git a/assets/ui_images/arrow.png b/assets/ui_images/arrow.png new file mode 100644 index 0000000000..87583fc644 Binary files /dev/null and b/assets/ui_images/arrow.png differ diff --git a/assets/ui_images/arrow_down.png b/assets/ui_images/arrow_down.png new file mode 100644 index 0000000000..d03afcc8d2 Binary files /dev/null and b/assets/ui_images/arrow_down.png differ diff --git a/assets/ui_images/arrow_left.png b/assets/ui_images/arrow_left.png new file mode 100644 index 0000000000..37454034bd Binary files /dev/null and b/assets/ui_images/arrow_left.png differ diff --git a/assets/ui_images/arrow_right.png b/assets/ui_images/arrow_right.png new file mode 100644 index 0000000000..5181723f98 Binary files /dev/null and b/assets/ui_images/arrow_right.png differ diff --git a/assets/ui_images/arrow_up.png b/assets/ui_images/arrow_up.png new file mode 100644 index 0000000000..1e9fb9714d Binary files /dev/null and b/assets/ui_images/arrow_up.png differ diff --git a/assets/ui_images/b.png b/assets/ui_images/b.png new file mode 100644 index 0000000000..48b1c2ab39 Binary files /dev/null and b/assets/ui_images/b.png differ diff --git a/assets/ui_images/background2.png b/assets/ui_images/background2.png new file mode 100644 index 0000000000..6e906473b9 Binary files /dev/null and b/assets/ui_images/background2.png differ diff --git a/assets/ui_images/c.png b/assets/ui_images/c.png new file mode 100644 index 0000000000..bcb7f503d5 Binary files /dev/null and b/assets/ui_images/c.png differ diff --git a/assets/ui_images/checkedbox.png b/assets/ui_images/checkedbox.png new file mode 100644 index 0000000000..72549ab5f7 Binary files /dev/null and b/assets/ui_images/checkedbox.png differ diff --git a/assets/ui_images/checkmark.png b/assets/ui_images/checkmark.png new file mode 100644 index 0000000000..4da8328ea0 Binary files /dev/null and b/assets/ui_images/checkmark.png differ diff --git a/assets/ui_images/circle.png b/assets/ui_images/circle.png new file mode 100644 index 0000000000..3c3afad8ec Binary files /dev/null and b/assets/ui_images/circle.png differ diff --git a/assets/ui_images/cross.png b/assets/ui_images/cross.png new file mode 100644 index 0000000000..ebdb00d702 Binary files /dev/null and b/assets/ui_images/cross.png differ diff --git a/assets/ui_images/d.png b/assets/ui_images/d.png new file mode 100644 index 0000000000..9ff0eb4a7d Binary files /dev/null and b/assets/ui_images/d.png differ diff --git a/assets/ui_images/dir.png b/assets/ui_images/dir.png new file mode 100644 index 0000000000..0a3bc6756e Binary files /dev/null and b/assets/ui_images/dir.png differ diff --git a/assets/ui_images/dir_line.png b/assets/ui_images/dir_line.png new file mode 100644 index 0000000000..9ca5c704c0 Binary files /dev/null and b/assets/ui_images/dir_line.png differ diff --git a/assets/ui_images/dropshadow.png b/assets/ui_images/dropshadow.png new file mode 100644 index 0000000000..92fad619d1 Binary files /dev/null and b/assets/ui_images/dropshadow.png differ diff --git a/assets/ui_images/e.png b/assets/ui_images/e.png new file mode 100644 index 0000000000..0d53463ba6 Binary files /dev/null and b/assets/ui_images/e.png differ diff --git a/assets/ui_images/empty.png b/assets/ui_images/empty.png new file mode 100644 index 0000000000..5d4d810576 Binary files /dev/null and b/assets/ui_images/empty.png differ diff --git a/assets/ui_images/f.png b/assets/ui_images/f.png new file mode 100644 index 0000000000..22e16b31e4 Binary files /dev/null and b/assets/ui_images/f.png differ diff --git a/assets/ui_images/fast_forward.png b/assets/ui_images/fast_forward.png new file mode 100644 index 0000000000..d7fb6ae6b4 Binary files /dev/null and b/assets/ui_images/fast_forward.png differ diff --git a/assets/ui_images/flag_as.png b/assets/ui_images/flag_as.png new file mode 100644 index 0000000000..a3465597b6 Binary files /dev/null and b/assets/ui_images/flag_as.png differ diff --git a/assets/ui_images/flag_eu.png b/assets/ui_images/flag_eu.png new file mode 100644 index 0000000000..5359e80388 Binary files /dev/null and b/assets/ui_images/flag_eu.png differ diff --git a/assets/ui_images/flag_hk.png b/assets/ui_images/flag_hk.png new file mode 100644 index 0000000000..779ffe0c15 Binary files /dev/null and b/assets/ui_images/flag_hk.png differ diff --git a/assets/ui_images/flag_jp.png b/assets/ui_images/flag_jp.png new file mode 100644 index 0000000000..9ed43631ec Binary files /dev/null and b/assets/ui_images/flag_jp.png differ diff --git a/assets/ui_images/flag_ko.png b/assets/ui_images/flag_ko.png new file mode 100644 index 0000000000..fbfa7f9e87 Binary files /dev/null and b/assets/ui_images/flag_ko.png differ diff --git a/assets/ui_images/flag_us.png b/assets/ui_images/flag_us.png new file mode 100644 index 0000000000..bac1608289 Binary files /dev/null and b/assets/ui_images/flag_us.png differ diff --git a/assets/ui_images/folder_line.png b/assets/ui_images/folder_line.png new file mode 100644 index 0000000000..1d950a4a16 Binary files /dev/null and b/assets/ui_images/folder_line.png differ diff --git a/assets/ui_images/folder_open_line.png b/assets/ui_images/folder_open_line.png new file mode 100644 index 0000000000..d6bbbe5f65 Binary files /dev/null and b/assets/ui_images/folder_open_line.png differ diff --git a/assets/ui_images/fullscreen.png b/assets/ui_images/fullscreen.png new file mode 100644 index 0000000000..4cf4350efa Binary files /dev/null and b/assets/ui_images/fullscreen.png differ diff --git a/assets/ui_images/gear.png b/assets/ui_images/gear.png new file mode 100644 index 0000000000..4702c920a8 Binary files /dev/null and b/assets/ui_images/gear.png differ diff --git a/assets/ui_images/grid.png b/assets/ui_images/grid.png new file mode 100644 index 0000000000..9b86cf581d Binary files /dev/null and b/assets/ui_images/grid.png differ diff --git a/assets/ui_images/home.png b/assets/ui_images/home.png new file mode 100644 index 0000000000..dc570a880b Binary files /dev/null and b/assets/ui_images/home.png differ diff --git a/assets/ui_images/icon_gold_72.png b/assets/ui_images/icon_gold_72.png new file mode 100644 index 0000000000..bbc99d3df6 Binary files /dev/null and b/assets/ui_images/icon_gold_72.png differ diff --git a/assets/ui_images/icon_regular_72.png b/assets/ui_images/icon_regular_72.png new file mode 100644 index 0000000000..5f52b44ea6 Binary files /dev/null and b/assets/ui_images/icon_regular_72.png differ diff --git a/assets/ui_images/info.png b/assets/ui_images/info.png new file mode 100644 index 0000000000..4b01a85801 Binary files /dev/null and b/assets/ui_images/info.png differ diff --git a/assets/ui_images/lines.png b/assets/ui_images/lines.png new file mode 100644 index 0000000000..4c66884517 Binary files /dev/null and b/assets/ui_images/lines.png differ diff --git a/assets/ui_images/logo.png b/assets/ui_images/logo.png new file mode 100644 index 0000000000..0017039d95 Binary files /dev/null and b/assets/ui_images/logo.png differ diff --git a/assets/ui_images/pause.png b/assets/ui_images/pause.png new file mode 100644 index 0000000000..b618a7ffd9 Binary files /dev/null and b/assets/ui_images/pause.png differ diff --git a/assets/ui_images/play.png b/assets/ui_images/play.png new file mode 100644 index 0000000000..d324c25b84 Binary files /dev/null and b/assets/ui_images/play.png differ diff --git a/assets/ui_images/plus.png b/assets/ui_images/plus.png new file mode 100644 index 0000000000..f65fb9c48c Binary files /dev/null and b/assets/ui_images/plus.png differ diff --git a/assets/ui_images/psp_display.png b/assets/ui_images/psp_display.png new file mode 100644 index 0000000000..32f65813d4 Binary files /dev/null and b/assets/ui_images/psp_display.png differ diff --git a/assets/ui_images/record.png b/assets/ui_images/record.png new file mode 100644 index 0000000000..05008ad253 Binary files /dev/null and b/assets/ui_images/record.png differ diff --git a/assets/ui_images/rect.png b/assets/ui_images/rect.png new file mode 100644 index 0000000000..ecd1fc942b Binary files /dev/null and b/assets/ui_images/rect.png differ diff --git a/assets/ui_images/rect_line.png b/assets/ui_images/rect_line.png new file mode 100644 index 0000000000..3c0aa7388c Binary files /dev/null and b/assets/ui_images/rect_line.png differ diff --git a/assets/ui_images/restore.png b/assets/ui_images/restore.png new file mode 100644 index 0000000000..143ef0779f Binary files /dev/null and b/assets/ui_images/restore.png differ diff --git a/assets/ui_images/retroachievements_logo.png b/assets/ui_images/retroachievements_logo.png new file mode 100644 index 0000000000..15bfa907a6 Binary files /dev/null and b/assets/ui_images/retroachievements_logo.png differ diff --git a/assets/ui_images/rotate_left.png b/assets/ui_images/rotate_left.png new file mode 100644 index 0000000000..b7c9f40db9 Binary files /dev/null and b/assets/ui_images/rotate_left.png differ diff --git a/assets/ui_images/rotate_right.png b/assets/ui_images/rotate_right.png new file mode 100644 index 0000000000..ddd4933fd6 Binary files /dev/null and b/assets/ui_images/rotate_right.png differ diff --git a/assets/ui_images/round.png b/assets/ui_images/round.png new file mode 100644 index 0000000000..8479d03fc9 Binary files /dev/null and b/assets/ui_images/round.png differ diff --git a/assets/ui_images/round_line.png b/assets/ui_images/round_line.png new file mode 100644 index 0000000000..f85bc94e02 Binary files /dev/null and b/assets/ui_images/round_line.png differ diff --git a/assets/ui_images/sdcard.png b/assets/ui_images/sdcard.png new file mode 100644 index 0000000000..ae7225c65e Binary files /dev/null and b/assets/ui_images/sdcard.png differ diff --git a/assets/ui_images/select.png b/assets/ui_images/select.png new file mode 100644 index 0000000000..529e279e1d Binary files /dev/null and b/assets/ui_images/select.png differ diff --git a/assets/ui_images/shoulder.png b/assets/ui_images/shoulder.png new file mode 100644 index 0000000000..b66ae48f7c Binary files /dev/null and b/assets/ui_images/shoulder.png differ diff --git a/assets/ui_images/shoulder_line.png b/assets/ui_images/shoulder_line.png new file mode 100644 index 0000000000..996e4fc63f Binary files /dev/null and b/assets/ui_images/shoulder_line.png differ diff --git a/assets/ui_images/sliders.png b/assets/ui_images/sliders.png new file mode 100644 index 0000000000..2ec872f0ff Binary files /dev/null and b/assets/ui_images/sliders.png differ diff --git a/assets/ui_images/speaker.png b/assets/ui_images/speaker.png new file mode 100644 index 0000000000..b043e5e631 Binary files /dev/null and b/assets/ui_images/speaker.png differ diff --git a/assets/ui_images/speaker_max.png b/assets/ui_images/speaker_max.png new file mode 100644 index 0000000000..8625b2b2ee Binary files /dev/null and b/assets/ui_images/speaker_max.png differ diff --git a/assets/ui_images/speaker_off.png b/assets/ui_images/speaker_off.png new file mode 100644 index 0000000000..b8b1e8e2bb Binary files /dev/null and b/assets/ui_images/speaker_off.png differ diff --git a/assets/ui_images/square.png b/assets/ui_images/square.png new file mode 100644 index 0000000000..e8619dbbc3 Binary files /dev/null and b/assets/ui_images/square.png differ diff --git a/assets/ui_images/square_shape.png b/assets/ui_images/square_shape.png new file mode 100644 index 0000000000..2cb47a7455 Binary files /dev/null and b/assets/ui_images/square_shape.png differ diff --git a/assets/ui_images/square_shape_line.png b/assets/ui_images/square_shape_line.png new file mode 100644 index 0000000000..c897cc17d1 Binary files /dev/null and b/assets/ui_images/square_shape_line.png differ diff --git a/assets/ui_images/start.png b/assets/ui_images/start.png new file mode 100644 index 0000000000..ba4736463a Binary files /dev/null and b/assets/ui_images/start.png differ diff --git a/assets/ui_images/stick.png b/assets/ui_images/stick.png new file mode 100644 index 0000000000..23a36d025c Binary files /dev/null and b/assets/ui_images/stick.png differ diff --git a/assets/ui_images/stick_bg.png b/assets/ui_images/stick_bg.png new file mode 100644 index 0000000000..7e62395bc8 Binary files /dev/null and b/assets/ui_images/stick_bg.png differ diff --git a/assets/ui_images/stick_bg_line.png b/assets/ui_images/stick_bg_line.png new file mode 100644 index 0000000000..db8848b993 Binary files /dev/null and b/assets/ui_images/stick_bg_line.png differ diff --git a/assets/ui_images/stick_line.png b/assets/ui_images/stick_line.png new file mode 100644 index 0000000000..9bfa4022ac Binary files /dev/null and b/assets/ui_images/stick_line.png differ diff --git a/assets/ui_images/stop.png b/assets/ui_images/stop.png new file mode 100644 index 0000000000..3860c5b38b Binary files /dev/null and b/assets/ui_images/stop.png differ diff --git a/assets/ui_images/three_dots.png b/assets/ui_images/three_dots.png new file mode 100644 index 0000000000..9001c4fc17 Binary files /dev/null and b/assets/ui_images/three_dots.png differ diff --git a/assets/ui_images/trashcan.png b/assets/ui_images/trashcan.png new file mode 100644 index 0000000000..d761236539 Binary files /dev/null and b/assets/ui_images/trashcan.png differ diff --git a/assets/ui_images/triangle.png b/assets/ui_images/triangle.png new file mode 100644 index 0000000000..aefd94d589 Binary files /dev/null and b/assets/ui_images/triangle.png differ diff --git a/assets/ui_images/up_line.png b/assets/ui_images/up_line.png new file mode 100644 index 0000000000..bfd658ee24 Binary files /dev/null and b/assets/ui_images/up_line.png differ diff --git a/assets/ui_images/warning.png b/assets/ui_images/warning.png new file mode 100644 index 0000000000..4db14b7f8d Binary files /dev/null and b/assets/ui_images/warning.png differ diff --git a/assets/ui_images/winner_cup.png b/assets/ui_images/winner_cup.png new file mode 100644 index 0000000000..27ba1ed945 Binary files /dev/null and b/assets/ui_images/winner_cup.png differ diff --git a/ext/native/tools/atlastool.cpp b/ext/native/tools/atlastool.cpp index a0571b5d11..9472510c34 100644 --- a/ext/native/tools/atlastool.cpp +++ b/ext/native/tools/atlastool.cpp @@ -221,8 +221,8 @@ void RasterizeFonts(const FontReferenceList &fontRefs, vector &ranges missing_chars++; } - Image img; if (!foundMatch || filtered || 0 != FT_Load_Char(font, kar, FT_LOAD_RENDER | FT_LOAD_MONOCHROME)) { + Image img; img.resize(1, 1); Data dat; @@ -238,9 +238,10 @@ void RasterizeFonts(const FontReferenceList &fontRefs, vector &ranges dat.voffset = 0; dat.charNum = kar; dat.effect = (int)Effect::FX_RED_TO_ALPHA_SOLID_WHITE; - bucket->AddItem(img, dat); + bucket->AddItem(std::move(img), dat); continue; } + Image img; // printf("%dx%d %p\n", font->glyph->bitmap.width, font->glyph->bitmap.rows, font->glyph->bitmap.buffer); const int bord = (128 + distmult - 1) / distmult + 1; @@ -295,7 +296,7 @@ void RasterizeFonts(const FontReferenceList &fontRefs, vector &ranges dat.charNum = kar; dat.effect = (int)Effect::FX_RED_TO_ALPHA_SOLID_WHITE; - bucket->AddItem(img, dat); + bucket->AddItem(std::move(img), dat); } } @@ -731,11 +732,11 @@ int GenerateFromScript(const char *script_file, const char *atlas_name, bool hig header.numImages = (int)images.size(); fwrite(&header, 1, sizeof(header), meta); // For each image - AtlasImage *atalas_images = new AtlasImage[images.size()]; + AtlasImage *atlas_images = new AtlasImage[images.size()]; for (int i = 0; i < (int)images.size(); i++) { - atalas_images[i] = images[i].ToAtlasImage((float)dest.width(), (float)dest.height(), results); + atlas_images[i] = images[i].ToAtlasImage((float)dest.width(), (float)dest.height(), results); } - WriteCompressed(atalas_images, sizeof(AtlasImage), images.size(), meta); + WriteCompressed(atlas_images, sizeof(AtlasImage), images.size(), meta); // For each font for (int i = 0; i < (int)fonts.size(); i++) { auto &font = fonts[i];