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

48 lines
63 KiB
C
Raw Normal View History

/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 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 "lib/lz.h"
static const uint8_t s_splash[] = {0x01, 0x37, 0x39, 0x4C, 0x37, 0x39, 0x4C, 0x01, 0x06, 0x06, 0x01, 0x0C, 0x0C, 0x01, 0x18, 0x18, 0x01, 0x30, 0x30, 0x01, 0x60, 0x60, 0x01, 0x57, 0x57, 0x73, 0x74, 0x82, 0xB4, 0xB5, 0xBC, 0xC6, 0xC7, 0xCC, 0xD9, 0xD9, 0xDD, 0xEB, 0xEB, 0xED, 0xFB, 0xFB, 0xFC, 0x61, 0x62, 0x71, 0x01, 0x82, 0x17, 0x82, 0x2C, 0x01, 0x81, 0x4C, 0x81, 0x4C, 0x38, 0x3A, 0x4D, 0x7A, 0x7B, 0x88, 0xDA, 0xDB, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x04, 0x04, 0x01, 0x08, 0x08, 0xFF, 0xFF, 0x01, 0x0F, 0x84, 0x01, 0x3E, 0x3F, 0x52, 0x87, 0x88, 0x94, 0x01, 0x83, 0x4E, 0x83, 0x7E, 0x52, 0x54, 0x64, 0xDF, 0xDF, 0xE2, 0x01, 0x0F, 0x83, 0x78, 0xF9, 0xF9, 0xFA, 0x01, 0x12, 0x84, 0x01, 0x42, 0x44, 0x56, 0xCF, 0xD0, 0xD4, 0xFF, 0xFF, 0xFF, 0x96, 0x97, 0xA1, 0x01, 0x83, 0x48, 0x83, 0x7E, 0x4E, 0x50, 0x61, 0xE8, 0xE8, 0xEA, 0x01, 0x09, 0x83, 0x78, 0xB9, 0xBA, 0xC1, 0x78, 0x7A, 0x86, 0x4C, 0x4E, 0x5F, 0x95, 0x96, 0xA0, 0x01, 0x12, 0x84, 0x01, 0x67, 0x69, 0x77, 0xFE, 0xFE, 0xFE, 0x01, 0x06, 0x18, 0x65, 0x66, 0x75, 0x01, 0x83, 0x45, 0x84, 0x01, 0xC4, 0xC5, 0xCB, 0x01, 0x06, 0x83, 0x51, 0xEF, 0xEF, 0xF0, 0x76, 0x77, 0x84, 0x01, 0x09, 0x18, 0x01, 0x15, 0x84, 0x01, 0x37, 0x39, 0x4C, 0xAA, 0xAB, 0xB3, 0x01, 0x06, 0x18, 0xD3, 0xD3, 0xD7, 0x01, 0x83, 0x42, 0x83, 0x7E, 0x6C, 0x6D, 0x7B, 0x01, 0x06, 0x83, 0x4E, 0xFD, 0xFD, 0xFD, 0x5F, 0x60, 0x6F, 0x01, 0x0C, 0x1B, 0x01, 0x18, 0x84, 0x01, 0x3E, 0x40, 0x53, 0xE2, 0xE3, 0xE5, 0x01, 0x06, 0x1B, 0x69, 0x6A, 0x78, 0x01, 0x83, 0x3F, 0x84, 0x01, 0xB3, 0xB4, 0xBB, 0x01, 0x06, 0x83, 0x4B, 0xAB, 0xAB, 0xB3, 0x01, 0x0F, 0x1B, 0x01, 0x18, 0x84, 0x01, 0x37, 0x39, 0x4C, 0x83, 0x85, 0x90, 0x01, 0x06, 0x1B, 0xA6, 0xA7, 0xAF, 0x01, 0x83, 0x3F, 0x84, 0x01, 0xEE, 0xEE, 0xF0, 0x01, 0x06, 0x83, 0x4B, 0x46, 0x48, 0x5A, 0x01, 0x2A, 0x84, 0x01, 0x5D, 0x5F, 0x6E, 0x01, 0x06, 0x1B, 0xDE, 0xDF, 0xE2, 0x01, 0x83, 0x3C, 0x83, 0x7E, 0x44, 0x46, 0x57, 0x01, 0x06, 0x83, 0x48, 0xE9, 0xE9, 0xEB, 0x01, 0x12, 0x1E, 0x01, 0x1B, 0x84, 0x01, 0x3B, 0x3D, 0x50, 0xFB, 0xFB, 0xFB, 0xFF, 0xFF, 0xFF, 0xF7, 0xF8, 0xF8, 0x01, 0x83, 0x3C, 0x84, 0x01, 0x55, 0x57, 0x67, 0x01, 0x06, 0x83, 0x63, 0xC8, 0xC8, 0xCD, 0x01, 0x2D, 0x84, 0x01, 0x37, 0x39, 0x4C, 0x01, 0x09, 0xA0, 0x32, 0x41, 0x43, 0x55, 0x01, 0x83, 0x39, 0x84, 0x01, 0x5C, 0x5E, 0x6D, 0x01, 0x06, 0x83, 0x45, 0xB8, 0xB9, 0xBF, 0x01, 0x39, 0x84, 0x01, 0x49, 0x4B, 0x5C, 0x01, 0x83, 0x39, 0x84, 0x01, 0x4C, 0x4D, 0x5E, 0x01, 0x06, 0x83, 0x45, 0xD7, 0xD8, 0xDB, 0x01, 0x2D, 0x84, 0x01, 0x39, 0x3B, 0x4E, 0x01, 0x06, 0xA4, 0x27, 0xFE, 0xFE, 0xFE, 0x3A, 0x3C, 0x4E, 0x01, 0x83, 0x39, 0x84, 0x01, 0x3A, 0x3C, 0x4F, 0x01, 0x09, 0x8F, 0x4B, 0x38, 0x3A, 0x4D, 0x01, 0x2A, 0x84, 0x01, 0x54, 0x56, 0x66, 0x01, 0x06, 0x1B, 0xEC, 0xEC, 0xEE, 0x01, 0x83, 0x3F, 0x98, 0x06, 0xCC, 0xCC, 0xD1, 0x01, 0x06, 0x83, 0x4B, 0x6F, 0x70, 0x7E, 0x01, 0x2A, 0x84, 0x01, 0xA3, 0xA4, 0xAC, 0x01, 0x07, 0xA8, 0x37, 0xB9, 0xC0, 0x01, 0x83, 0x3F, 0x84, 0x01, 0x8E, 0x8F, 0x9A, 0x01, 0x06, 0x83, 0x4B, 0xE1, 0xE1, 0xE4, 0x3B, 0x3D, 0x50, 0x01, 0x24, 0x84, 0x01, 0x54, 0x55, 0x65, 0xFA, 0xFA, 0x01, 0x07, 0xB0, 0x27, 0x7C, 0x7D, 0x89, 0x01, 0x83, 0x3F, 0x84, 0x01, 0x3C, 0x3E, 0x50, 0xDE, 0x01, 0x08, 0xB4, 0x07, 0xA4, 0xA5, 0xAE, 0x01, 0x21, 0x84, 0x01, 0x45, 0x47, 0x59, 0xD1, 0xD1, 0xD6, 0x01, 0x06, 0x18, 0xD0, 0xD1, 0xD5, 0x01, 0x12, 0x8C, 0x39, 0x01, 0x83, 0x33, 0x84, 0x04, 0x62, 0x63, 0x72, 0xFD, 0xFD, 0xFD, 0x01, 0x06, 0x83, 0x54, 0xC4, 0xC4, 0xCA, 0x45, 0x46, 0x58, 0x01, 0x18, 0x84, 0x01, 0x5F, 0x61, 0x70, 0xE6, 0xE6, 0xE9, 0x01, 0x06, 0x15, 0xF8, 0xF8, 0xF9, 0x55, 0x57, 0x67, 0x01, 0x83, 0x48, 0xB8, 0x11, 0xA4, 0xA4, 0xAD, 0x01, 0x09, 0xB8, 0x0E, 0xEC, 0xED, 0xEE, 0xAC, 0xAD, 0xB5, 0x71, 0x73, 0x80, 0x9D, 0x9E, 0xA7, 0x01, 0x06, 0x12, 0x74, 0x75, 0x82, 0x85, 0x86, 0x92, 0xC3, 0xC3, 0xC9, 0x01, 0x09, 0x8B, 0x7A, 0xFF, 0xFF, 0xFF, 0x92, 0x93, 0x9E, 0x01, 0x83, 0x4B, 0xC0, 0x10, 0x3C, 0x3E, 0x50, 0xA5, 0xA6, 0xAE, 0xFC, 0xFC, 0xFC, 0x01, 0x12, 0xC4, 0x0E, 0x01, 0x12, 0x12, 0xFA, 0xFA, 0xFA, 0x9B, 0x9C, 0xA5, 0x39, 0x3B, 0x01, 0x83, 0x3A, 0x9B, 0x7E, 0x01, 0x18, 0x18, 0x5F, 0x61, 0x70, 0xDA, 0xDA, 0x01, 0x13, 0xC8, 0x12, 0x01, 0x0C
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();
size_t pos = 0;
for (size_t y = 496; y < (496 + 287); y++)
{
for (size_t x = 293; x < (293 + 171); x++)
{
fb[x + y*768] = splash[pos + 2] | (splash[pos + 1] << 8) | (splash[pos] << 16);
pos += 3;
}
}
}