Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Raytwo committed Feb 12, 2020
1 parent a18c59e commit 8f9464f
Show file tree
Hide file tree
Showing 179 changed files with 43,409 additions and 2 deletions.
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# TODO (Khangaroo): Make this process a lot less hacky (no, export did not work)
# See MakefileNSO

.PHONY: all clean skyline skyline_patch send

CROSSVER ?= 111
IP ?= 192.168.1.8

all: skyline skyline_patch send

skyline:
$(MAKE) all -f MakefileNSO CROSSVER=$(CROSSVER)

skyline_patch: patches/*.slpatch patches/configs/$(CROSSVER).config patches/maps/$(CROSSVER)/*.map \
build$(CROSSVER)/$(shell basename $(CURDIR))$(CROSSVER).map scripts/genPatch.py
@rm -f aldebaran_patch_$(CROSSVER)/*.ips
python3 scripts/genPatch.py $(CROSSVER)

send: all
python3 scripts/sendPatch.py $(IP) $(CROSSVER)

clean:
$(MAKE) clean -f MakefileNSO
@rm -fr aldebaran_patch_*
194 changes: 194 additions & 0 deletions MakefileNSO
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#---------------------------------------------------------------------------------
# Starlight-specific
# CROSSVER is the target version of SSBU, but without the decimal points
# This can be changed by compiling for a different version (e.g. make 600)
# (used for C defines, filenames, etc)
# LINKERSCRIPTS is the directory where the function addresses for Splatoon 2 are
# stored
# Each script is stored as syms$(CROSSVER).ld
# (used for mapping SSBU functions to the proper address)
#---------------------------------------------------------------------------------

LINKERSCRIPTS := linkerscripts

#---------------------------------------------------------------------------------
#.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif

TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET ?= $(notdir $(CURDIR))$(CROSSVER)
BUILD ?= build$(CROSSVER)
SOURCES := source \
source/skyline \
source/skyline/nx \
source/skyline/nx/arm \
source/skyline/nx/kernel \
source/skyline/nx/runtime \
source/skyline/nx/sf \
source/skyline/inlinehook \
source/skyline/logger \
source/skyline/utils \
source/skyline/arc \
source/skyline/plugin
DATA := data
INCLUDES := include

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIC -ftls-model=local-exec

CFLAGS := -g -Wall -ffunction-sections \
$(ARCH) $(DEFINES)

CFLAGS += $(INCLUDE) -D__SWITCH__ -DCROSSVER=$(CROSSVER)

CXXFLAGS := $(CFLAGS) -fno-rtti -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -enable-libstdcxx-allocator=new -fpermissive

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=../switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) -Wl,--version-script=$(TOPDIR)/exported.txt -Wl,-init=__custom_init -Wl,-fini=__custom_fini -nostdlib


LIBS := -lgcc -lstdc++ -u malloc

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR ?= $(CURDIR)/$(BUILD)

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))

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

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif

ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif

ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
endif

.PHONY: $(BUILD) clean all

#---------------------------------------------------------------------------------

all: $(BUILD)

$(BUILD):
@echo "${SOURCES}"
@echo "${CPPFILES}"
@[ -d $@ ] || mkdir -p $@
@cp $(LINKERSCRIPTS)/syms$(CROSSVER).ld $(LINKERSCRIPTS)/symstemp.ld # This is required because you can't pass a variable to the .specs
$(MAKE) -C $(BUILD) -f $(CURDIR)/MakefileNSO
@rm -f $(LINKERSCRIPTS)/symstemp.ld

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr build* *.nso *.elf


#---------------------------------------------------------------------------------
else
.PHONY: all

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
%.nso: %.elf
@elf2nso $< $@
@echo built ... $(notdir $@)

%.nro: %.elf
@elf2nro $< $@ $(NROFLAGS)
@echo built ... $(notdir $@)

#---------------------------------------------------------------------------------
all : $(OUTPUT).nso

$(OUTPUT).elf : $(OFILES)


$(OFILES_SRC) : $(HFILES_BIN)

#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
# Aldebaran
????
# Aldebaran, based on [Skyline](https://github.com/shadowninja108/Skyline)
An environment for linking, runtime hooking and code patching in Fire Emblem Three Houses. Fork of Skyline, a modding framework for Super Smash Bros Ultimate.

# Why the rename?
To make sure people make the distinction between the original Skyline and the FETH fork. Also serves to make a distinction with Starfall, the previous modding environment based on Starlight.

# Current limitations
- Consider this WIP and rushed
- TCP logging needs to be configurable

# How to install
- Put the content of the archive at the root of your SD
- Put the files you want to replace in sd:/Aldebaran/forge/, with the entry ID as the name in decimal and no extension. (Like Starfall)

# Maintainers (Aldebaran)
- [Raytwo](https://github.com/Raytwo)

# Contributors (Skyline)
This project is derived from OdysseyReversed and Starlight
- [3096](https://github.com/3096)
- [khang06](https://github.com/khang06)
- [OatmealDome](https://github.com/OatmealDome)
- [Random0666](https://github.com/random0666)
- [shadowninja108](https://github.com/shadowninja108)
- [shibbo](https://github.com/shibbo) - Repo derived from their work on OdysseyReversed
- [Thog](https://github.com/Thog) - Expertise in how rtld is implemented
- [jakibaki ](https://github.com/jakibaki) - Advice with numerous things, including runtime hooking

# Credits
- devkitA64
- libnx - switch build rules
9 changes: 9 additions & 0 deletions exported.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
global:
__custom_init;
__custom_fini;
_init;


local: *;
};
Loading

0 comments on commit 8f9464f

Please sign in to comment.