Skip to content

Commit

Permalink
payload code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kronos2308 committed Oct 15, 2019
1 parent 26995fd commit 2ba81ef
Show file tree
Hide file tree
Showing 123 changed files with 39,365 additions and 60 deletions.
9 changes: 9 additions & 0 deletions Hakupayload/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Visual Studio Code
.vs/
.vscode/

# Build files
build/
output/
*.bin
*.rar
7 changes: 7 additions & 0 deletions Hakupayload/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build Docker image using: docker build . -t argon-nx-builder
# Run docker image using: docker run -a stdout -a stderr -v $(pwd)/output:/argon-nx/output argon-nx-builder

FROM devkitpro/devkitarm
WORKDIR /argon-nx
COPY . .
ENTRYPOINT ["make"]
674 changes: 674 additions & 0 deletions Hakupayload/LICENSE

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions Hakupayload/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/base_rules

TARGET := Bootmenu
BLVERSION_MAJOR := 0
BLVERSION_MINOR := 3
BUILD := build
OUTPUT := output
SOURCEDIR := src
DATA := data
SOURCES := src \
src/core \
src/ianos \
src/gfx \
src/libs/fatfs src/libs/elfload src/libs/compr \
src/mem \
src/menu/gui \
src/minerva \
src/panic \
src/power \
src/sec \
src/soc \
src/storage \
src/utils

INCLUDES := include
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

OFILES_BIN := $(addsuffix .o,$(BINFILES))
OFILES_SRC := $(SFILES:.s=.o) $(CFILES:.c=.o)
HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

OBJS = $(addprefix $(BUILD)/$(TARGET)/, $(OFILES_BIN) $(OFILES_SRC))


INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(BUILD)/$(TARGET)

ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
CFLAGS = $(INCLUDE) $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections


.PHONY: all clean

all: directories $(TARGET).bin
@echo $(HFILES_BIN)
@echo -n "Payload size is "
@wc -c < $(OUTPUT)/$(TARGET).bin
@echo "Max size is 126296 Bytes."
mv $(OUTPUT)/$(TARGET).bin payload.bin

directories:
@mkdir -p "$(BUILD)"
@mkdir -p "$(BUILD)/$(TARGET)"
@mkdir -p "$(OUTPUT)"

clean:
@rm -rf $(OBJS)
@rm -rf $(BUILD)
@rm -rf $(OUTPUT)
@rm -rf logo_bmp.h

$(MODULEDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)

$(TARGET).bin: $(BUILD)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
@printf ICTC$(BLVERSION_MAJOR)$(BLVERSION_MINOR) >> $(OUTPUT)/$@

$(BUILD)/$(TARGET)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@

$(BUILD)/$(TARGET)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

$(BUILD)/$(TARGET)/%.o: %.s
$(CC) $(CFLAGS) -c $< -o $@

$(OFILES_SRC) : $(HFILES_BIN)

$(BUILD)/$(TARGET)/%.bmp.o %_bmp.h: data/%.bmp
@echo $(notdir $<)
@$(bin2o)

7 changes: 7 additions & 0 deletions Hakupayload/compile.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
make
echo completado
echo %cd%

%systemroot%\system32\timeout.exe 10

43 changes: 43 additions & 0 deletions Hakupayload/include/core/custom-gui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2018 Guillem96
*
* 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/>.
*/
#ifndef _CUSTOM_GUI_H_
#define _CUSTOM_GUI_H_

#include "utils/types.h"

#define CUSTOM_BG_PATH "StarDust/background.bmp"
#define CUSTOM_TITLE_PATH "StarDust/title.bmp"

typedef struct {
u8* custom_bg;
u8* title_bmp;
} custom_gui_t;


custom_gui_t* custom_gui_load();

void custom_gui_end(custom_gui_t*);

/* Renders custom background, returns false if background.bmp does not exist */
bool render_custom_background(custom_gui_t*);

/* Renders custom title, returns false if title.bmp does not exist */
bool render_custom_title(custom_gui_t*);

/* Tool to take screenshots */
int screenshot(void* params);

#endif
21 changes: 21 additions & 0 deletions Hakupayload/include/core/launcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2018 Guillem96
*
* 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/>.
*/
#ifndef _LAUNCHER_H_
#define _LAUNCHER_H_

int launch_payload(char*);

#endif
34 changes: 34 additions & 0 deletions Hakupayload/include/core/payloads.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018 Guillem96
*
* 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/>.
*/
#ifndef _PAYLOADS_H_
#define _PAYLOADS_H_

#include "utils/types.h"

#define PAYBACK_DIR "StarDust/payback"

#define PAYLOADS_DIR "StarDust/payloads"
#define PAYLOADS_LOGOS_DIR "StarDust/logos"

/* Generate full pyload directory */
void payload_full_path(const char*, char*);
void payload_full_back(const char*, char*);

/* Get payload's logo from payload's name */
void payload_logo_path(const char*, char*);


#endif
Loading

0 comments on commit 2ba81ef

Please sign in to comment.