diff --git a/arm11/Makefile b/arm11/Makefile
index 70cc265..1ffe172 100644
--- a/arm11/Makefile
+++ b/arm11/Makefile
@@ -20,6 +20,7 @@
DEFINES := -DARM11 -D_3DS -DVERS_STRING=\"$(VERS_STRING)\" \
-DVERS_MAJOR=$(VERS_MAJOR) -DVERS_MINOR=$(VERS_MINOR)
DATA :=
+ASSETS := ../assets
LDNAME := arm11.ld
ifneq ($(strip $(NO_DEBUG)),)
@@ -66,12 +67,14 @@
export DEPSDIR := $(CURDIR)/$(BUILD)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
- $(foreach dir,$(DATA),$(CURDIR)/$(dir))
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
+ $(foreach dir,$(ASSETS),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
+ASSETFILES := $(foreach dir,$(ASSETS),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@@ -87,8 +90,15 @@
endif
#---------------------------------------------------------------------------------
-export OFILES := $(addsuffix .o,$(BINFILES)) \
- $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+
+export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(ASSETFILES:.png=.spla.o)
+
+export INTERMEDIATE_ASSETS := $(ASSETFILES:.png=.spla)
+
+export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
+
+export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
@@ -112,6 +122,8 @@
#---------------------------------------------------------------------------------
else
+.SECONDARY: $(INTERMEDIATE_ASSETS)
+
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
@@ -119,17 +131,34 @@
@$(OBJCOPY) --gap-fill 0xFF -O binary $< $@
@echo built ... $(notdir $@)
+$(OFILES_SOURCES) : $(HFILES)
+
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
-%.bin.o : %.bin
+%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
+%.spla : %.png
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @echo "$@: $<" > $(DEPSDIR)/$*.d
+ @splashtool -f RGB565 -r $< $@
+
+#---------------------------------------------------------------------------------
+%.spla.o %_spla.h : %.spla
+#---------------------------------------------------------------------------------
+ @echo $(notdir $<)
+ @echo "$*.spla.o: $<" > $(DEPSDIR)/$*.spla.d
+ @echo "$*_spla.h: $<" >> $(DEPSDIR)/$*.spla.d
+ @$(bin2o)
+
+#---------------------------------------------------------------------------------
%.elf:
#---------------------------------------------------------------------------------
@echo linking $(notdir $@)
diff --git a/arm9/Makefile b/arm9/Makefile
index d382564..469d3e7 100644
--- a/arm9/Makefile
+++ b/arm9/Makefile
@@ -20,7 +20,6 @@
DEFINES := -DARM9 -D_3DS -DVERS_STRING=\"$(VERS_STRING)\" \
-DVERS_MAJOR=$(VERS_MAJOR) -DVERS_MINOR=$(VERS_MINOR)
DATA := data
-ASSETS := ../assets
LDNAME := arm9.ld
ifneq ($(strip $(NO_DEBUG)),)
@@ -67,14 +66,12 @@
export DEPSDIR := $(CURDIR)/$(BUILD)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
- $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
- $(foreach dir,$(ASSETS),$(CURDIR)/$(dir))
+ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
-ASSETFILES := $(foreach dir,$(ASSETS),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@@ -90,15 +87,8 @@
endif
#---------------------------------------------------------------------------------
-export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
-
-export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(ASSETFILES:.png=.spla.o)
-
-export INTERMEDIATE_ASSETS := $(ASSETFILES:.png=.spla)
-
-export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
-
-export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
+export OFILES := $(addsuffix .o,$(BINFILES)) \
+ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
@@ -122,8 +112,6 @@
#---------------------------------------------------------------------------------
else
-.SECONDARY: $(INTERMEDIATE_ASSETS)
-
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
@@ -131,34 +119,17 @@
@$(OBJCOPY) --gap-fill 0xFF -O binary $< $@
@echo built ... $(notdir $@)
-$(OFILES_SOURCES) : $(HFILES)
-
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
-%.bin.o %_bin.h : %.bin
+%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
-%.spla : %.png
-#---------------------------------------------------------------------------------
- @echo $(notdir $<)
- @echo "$@: $<" > $(DEPSDIR)/$*.d
- @splashtool -f RGB565 -r $< $@
-
-#---------------------------------------------------------------------------------
-%.spla.o %_spla.h : %.spla
-#---------------------------------------------------------------------------------
- @echo $(notdir $<)
- @echo "$*.spla.o: $<" > $(DEPSDIR)/$*.spla.d
- @echo "$*_spla.h: $<" >> $(DEPSDIR)/$*.spla.d
- @$(bin2o)
-
-#---------------------------------------------------------------------------------
%.elf:
#---------------------------------------------------------------------------------
@echo linking $(notdir $@)
@@ -169,4 +140,4 @@
#---------------------------------------------------------------------------------------
endif
-#---------------------------------------------------------------------------------------
\ No newline at end of file
+#----------------------------------------------------------------------------------------
diff --git a/arm9/data/default_font.bin b/arm9/data/default_font.bin
deleted file mode 100644
index e3ae20b..0000000
--- a/arm9/data/default_font.bin
+++ /dev/null
Binary files differ
diff --git a/include/arm11/menu/splash.h b/include/arm11/menu/splash.h
new file mode 100644
index 0000000..339d385
--- /dev/null
+++ b/include/arm11/menu/splash.h
@@ -0,0 +1,48 @@
+#pragma once
+
+/*
+ * This file is part of fastboot 3DS
+ * Copyright (C) 2017 derrek, profi200
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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 .
+ */
+
+#include "types.h"
+
+
+#define FLAG_ROTATED (1u<<3)
+#define FLAG_COMPRESSED (1u<<4)
+#define FLAG_SWAPPED (1u<<5)
+
+
+enum
+{
+ FORMAT_RGB565 = 0,
+ FORMAT_RGB8 = 1,
+ FORMAT_RGBA8 = 2,
+ FORMAT_INVALID = 7
+};
+
+typedef struct
+{
+ u32 magic;
+ u16 width;
+ u16 height;
+ u32 flags;
+} SplashHeader;
+
+
+
+void getSplashDimensions(const void *const data, u32 *const width, u32 *const height);
+bool drawSplashscreen(const void *const data, s32 startX, s32 startY);
diff --git a/source/arm11/menu/splash.c b/source/arm11/menu/splash.c
new file mode 100644
index 0000000..b1c9c56
--- /dev/null
+++ b/source/arm11/menu/splash.c
@@ -0,0 +1,93 @@
+/*
+ * This file is part of fastboot 3DS
+ * Copyright (C) 2017 derrek, profi200
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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 .
+ */
+
+#include
+#include
+#include
+#include "types.h"
+#include "arm11/menu/splash.h"
+#include "hardware/gfx.h"
+
+
+
+void lz11Decompress(const void *in, void *out, u32 size);
+
+void getSplashDimensions(const void *const data, u32 *const width, u32 *const height)
+{
+ const SplashHeader *const header = (const SplashHeader *const)data;
+
+ if(width) *width = header->width;
+ if(height) *height = header->height;
+}
+
+static bool validateSplashHeader(const SplashHeader *const header)
+{
+ if(memcmp(&header->magic, "SPLA", 4)) return false;
+
+ const u32 width = header->width, height = header->height;
+ if(width == 0 || width > SCREEN_WIDTH_TOP || height == 0 || height > SCREEN_HEIGHT_TOP)
+ return false;
+
+ const u32 flags = header->flags;
+ if((flags & FORMAT_INVALID) != FORMAT_RGB565) return false;
+ if(!(flags & FLAG_ROTATED) || flags & FLAG_SWAPPED) return false;
+
+ return true;
+}
+
+bool drawSplashscreen(const void *const data, s32 startX, s32 startY)
+{
+ const SplashHeader *const header = (const SplashHeader *const)data;
+ if(!validateSplashHeader(header)) return false;
+
+ const u32 width = header->width, height = header->height;
+ const u32 flags = header->flags;
+ const bool isCompressed = flags & FLAG_COMPRESSED;
+
+ u16 *imgData;
+ if(isCompressed)
+ {
+ imgData = (u16*)malloc(width * height * 2);
+ if(!imgData) return false;
+ lz11Decompress(data + sizeof(SplashHeader), imgData, width * height * 2);
+ }
+ else imgData = (u16*)(data + sizeof(SplashHeader));
+
+ u32 xx, yy;
+ if(startX < 0 || (u32)startX > SCREEN_WIDTH_TOP - width) xx = (SCREEN_WIDTH_TOP - width) / 2;
+ else xx = (u32)startX;
+ if(startY < 0 || (u32)startY > SCREEN_HEIGHT_TOP - height) yy = (SCREEN_HEIGHT_TOP - height) / 2;
+ else yy = (u32)startY;
+
+ u16 *fb = (u16*)RENDERBUF_TOP;
+ for(u32 x = 0; x < width; x++)
+ {
+ for(u32 y = 0; y < height; y++)
+ {
+ fb[(x + xx) * SCREEN_HEIGHT_TOP + y + yy] = imgData[x * height + y];
+ }
+ }
+
+ if(isCompressed) free(imgData);
+
+ GX_textureCopy((u64*)RENDERBUF_TOP, 0, (u64*)GFX_getFramebuffer(SCREEN_TOP),
+ 0, SCREEN_SIZE_TOP + SCREEN_SIZE_SUB);
+ GFX_swapFramebufs();
+
+ return true;
+}