Atmosphere/sept/sept-secondary/src/splash.c

61 lines
82 KiB
C
Raw Normal View History

/*
* Copyright (c) 2018 CTCaer
* Copyright (c) 2018 xamanthas
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "splash.h"
#include "utils.h"
#include "../../../fusee/common/lz.h"
static const uint8_t s_splash[] = {0x00, 0x34, 0x36, 0x4B, 0x34, 0x36, 0x4B, 0x00, 0x06, 0x06, 0x00, 0x0C, 0x0C, 0x00, 0x18, 0x18, 0x00, 0x30, 0x30, 0x00, 0x60, 0x60, 0x00, 0x81, 0x40, 0x81, 0x40, 0x00, 0x83, 0x00, 0x83, 0x00, 0x00, 0x86, 0x00, 0x86, 0x00, 0x00, 0x8C, 0x00, 0x8C, 0x00, 0x00, 0x84, 0x46, 0x84, 0x46, 0x4D, 0x4F, 0x62, 0x8D, 0x8E, 0x9A, 0xB3, 0xB4, 0xBC, 0xCC, 0xCD, 0xD2, 0xA6, 0xA7, 0xB0, 0x00, 0x75, 0x81, 0x04, 0x67, 0x68, 0x78, 0xC0, 0xC0, 0xC7, 0xF2, 0xF2, 0xF4, 0xFF, 0xFF, 0xFF, 0x00, 0x09, 0x15, 0x73, 0x75, 0x83, 0x00, 0x86, 0x24, 0x87, 0x40, 0x5A, 0x5C, 0x6D, 0xCC, 0xCD, 0xD2, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x04, 0x00, 0x04, 0x04, 0xCC, 0xCD, 0xD2, 0x00, 0x15, 0x27, 0x00, 0x5D, 0x81, 0x07, 0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 0x87, 0x46, 0x41, 0x43, 0x56, 0xE6, 0xE6, 0xE9, 0x00, 0x86, 0x15, 0x87, 0x46, 0xE6, 0xE6, 0xE9, 0xFF, 0xFF, 0xFF, 0x00, 0x12, 0x95, 0x2A, 0x00, 0x18, 0x87, 0x46, 0x00, 0x06, 0x95, 0x78, 0xFF, 0xFF, 0xFF, 0x80, 0x81, 0x8F, 0x00, 0x51, 0x96, 0x4F, 0x00, 0x0C, 0x90, 0x0D, 0x00, 0x12, 0x87, 0x46, 0x00, 0x12, 0x12, 0x00, 0x86, 0x0C, 0x9E, 0x0F, 0x00, 0x15, 0x9D, 0x68, 0x00, 0x1B, 0x87, 0x46, 0x4D, 0x4F, 0x62, 0xFF, 0xFF, 0xFF, 0x00, 0x51, 0x95, 0x5D, 0x8D, 0x8E, 0x9A, 0x00, 0x0F, 0xAE, 0x16, 0x00, 0x86, 0x27, 0x8F, 0x0C, 0xC0, 0xC0, 0xC7, 0xFF, 0xFF, 0xFF, 0x00, 0x0C, 0x9D, 0x0B, 0x00, 0x24, 0x87, 0x46, 0x00, 0x06, 0x8F, 0x42, 0xF2, 0xF2, 0xF4, 0x00, 0x51, 0xAE, 0x25, 0x00, 0x0F, 0x87, 0x25, 0x00, 0x12, 0x9E, 0x18, 0x00, 0x86, 0x15, 0xAD, 0x27, 0xF2, 0xF2, 0xF4, 0x00, 0x18, 0x8D, 0x5E, 0x00, 0x1E, 0x87, 0x46, 0x00, 0x06, 0xB5, 0x14, 0x00, 0x51, 0x81, 0x10, 0xCC, 0xCD, 0xD2, 0x00, 0x0C, 0x97, 0x29, 0x00, 0x0F, 0xAD, 0x24, 0xE6, 0xE6, 0xE9, 0x00, 0x86, 0x15, 0xAD, 0x24, 0x00, 0x18, 0xBC, 0x15, 0x00, 0x21, 0x87, 0x46, 0xB3, 0xB4, 0xBC, 0xFF, 0xFF, 0xFF, 0x00, 0x51, 0xA5, 0x61, 0x00, 0x06, 0xB5, 0x4A, 0x00, 0x09, 0xAE, 0x01, 0x00, 0x09, 0x87, 0x46, 0x4D, 0x4F, 0x62, 0xCC, 0xCD, 0xD2, 0x00, 0x86, 0x15, 0x8F, 0x09, 0x5A, 0x5C, 0x6D, 0xFF, 0xFF, 0xFF, 0x00, 0x18, 0xCB, 0x21, 0x00, 0x1E, 0x87, 0x46, 0x00, 0x06, 0x97, 0x0B, 0x00, 0x57, 0x81, 0x16, 0xE6, 0xE6, 0xE9, 0xE6, 0xE6, 0xE9, 0x00, 0x06, 0x88, 0x29, 0x9A, 0x9B, 0xA5, 0x00, 0x06, 0xCB, 0x48, 0x00, 0x78, 0xCC, 0x49, 0x00, 0x85, 0x20, 0x87, 0x46, 0x41, 0x43, 0x56, 0x00, 0x1B, 0xA5, 0x25, 0x00, 0x75, 0x96, 0x52, 0x00, 0x0F, 0x9E, 0x03, 0x00, 0x06, 0x81, 0x04, 0x9A, 0x9B, 0xA5, 0x00, 0x15, 0x9F, 0x3A, 0x00, 0x86, 0x42, 0x96, 0x52, 0x00, 0x1B, 0x9E, 0x51, 0x00, 0x86, 0x72, 0xE1, 0x7C, 0x00, 0x06, 0xCB, 0x09, 0x00, 0x15, 0x9D, 0x5F, 0x00, 0x1B, 0x87, 0x46, 0x00, 0x06, 0xC4, 0x29, 0x00, 0x86, 0x21, 0xD9, 0x56, 0x00, 0x6F, 0xD2, 0x7C, 0x00, 0x15, 0xC3, 0x40, 0x00, 0x1B, 0x87, 0x46, 0x00, 0x06, 0x9E, 0x15, 0x00, 0x86, 0x27, 0xE8, 0x65, 0x00, 0x66, 0xF1, 0x08, 0x00, 0x18, 0xD2, 0x4F, 0x00, 0x18, 0x87, 0x46, 0x00, 0x06, 0x8F, 0x09, 0x00, 0x57, 0x96, 0x4F, 0x41, 0x43, 0x56, 0xB3, 0xB4, 0xBC, 0x00, 0x15, 0x90, 0x1C, 0x8D, 0x8E, 0x9A, 0x00, 0x51, 0xCC, 0x2E, 0x00, 0x85, 0x4A
static bool g_has_uncompressed = false;
static unsigned char *get_uncompressed_splash(void) {
unsigned char *splash = (unsigned char *)0xE0000000;
if (!g_has_uncompressed) {
LZ_Uncompress(s_splash, splash, sizeof(s_splash));
g_has_uncompressed = true;
}
return splash;
}
void draw_splash(volatile uint32_t *fb) {
unsigned char *splash = get_uncompressed_splash();
/* Set display background color. */
for (size_t i = 0; i < 1280 * 768; i++) {
fb[i] = 0x34364B;
}
/* Draw actual splash. */
const size_t x_res = 322;
const size_t y_res = 276;
2019-02-21 06:34:34 +00:00
const size_t x_start = (768 - x_res) / 2;
const size_t y_start = (1280 - y_res) / 2;
size_t pos = 0;
2019-02-21 06:34:34 +00:00
for (size_t y = y_start; y < (y_start + y_res); y++)
{
2019-02-21 06:34:34 +00:00
for (size_t x = x_start; x < (x_start + x_res); x++)
{
fb[x + y*768] = splash[pos + 2] | (splash[pos + 1] << 8) | (splash[pos] << 16);
pos += 3;
}
}
}