0.9.5 preview1

This commit is contained in:
2024-02-19 19:20:37 +01:00
parent a671631dde
commit 168614d579
132 changed files with 49337 additions and 63128 deletions

View File

@ -1,275 +1,279 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#nicetest
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITARM)/3ds_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
# GRAPHICS is a list of directories containing graphics files
# GFXBUILD is the directory where converted graphics files will be placed
# If set to $(BUILD), it will statically link in the converted
# files as if they were data files.
#
# NO_SMDH: if set to anything, no SMDH file is generated.
# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional)
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
# ICON is the filename of the icon (.png), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.png
# - icon.png
# - <libctru folder>/default_icon.png
#---------------------------------------------------------------------------------
# External tools
#---------------------------------------------------------------------------------
ifeq ($(OS),Windows_NT)
MAKEROM ?= C:/devkitpro/tools/bin/makerom.exe
BANNERTOOL ?= C:/devkitpro/tools/bin/bannertool.exe
else
MAKEROM ?= makerom
BANNERTOOL ?= bannertool
endif
# If on a tagged commit, use the tag instead of the commit
ifneq ($(shell echo $(shell git tag -l --points-at HEAD) | head -c 1),)
GIT_VER := $(shell git tag -l --points-at HEAD)
else
GIT_VER := $(shell git rev-parse --short HEAD)
endif
TIME_TIME := $(shell date --iso=seconds)
#---------------------------------------------------------------------------------
# Version number
#---------------------------------------------------------------------------------
VERSION_MAJOR := 1
VERSION_MINOR := 0
VERSION_MICRO := 0
#---------------------------------------------------------------------------------
# Make Sure to Change this paths if your Submodule
# is located somewhere else
# Using ../ cause rd7tf is shipped with the RenderD7
# Repository!
RENDERD7_SRC := ../source ../external
RENDERD7_INC := ../include
TARGET := rd7tf
BUILD := build
SOURCES := source $(RENDERD7_SRC)
DATA := data
INCLUDES := source $(RENDERD7_INC)
GRAPHICS := gfx
#GFXBUILD := $(BUILD)
ROMFS := romfs
GFXBUILD := $(ROMFS)/gfx
APP_AUTHOR := NPI-D7
APP_DESCRIPTION := RenderD7 Test Framework
ICON := app/icon.png
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Wall -Wno-psabi -O2 -mword-relocations \
-DV_STRING=\"$(GIT_VER)\" \
-DV_TIME=\"$(TIME_TIME)\" \
-fomit-frame-pointer -ffunction-sections \
$(ARCH)
CFLAGS += $(INCLUDE) -D__3DS__ -D_GNU_SOURCE=1
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lcurl -lstdc++ -lm -lz -lcitro2d -lcitro3d -lctru -ljpeg
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(CTRULIB)
#---------------------------------------------------------------------------------
# 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,$(GRAPHICS),$(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)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
GFXFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.t3s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
ifeq ($(GFXBUILD),$(BUILD))
#---------------------------------------------------------------------------------
export T3XFILES := $(GFXFILES:.t3s=.t3x)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export ROMFS_T3XFILES := $(patsubst %.t3s, $(GFXBUILD)/%.t3x, $(GFXFILES))
export T3XHFILES := $(patsubst %.t3s, $(BUILD)/%.h, $(GFXFILES))
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) \
$(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)
export _3DSXDEPS := $(if $(NO_SMDH),,$(OUTPUT).smdh)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.png)
ifneq (,$(findstring $(TARGET).png,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).png
else
ifneq (,$(findstring icon.png,$(icons)))
export APP_ICON := $(TOPDIR)/icon.png
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_SMDH)),)
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
endif
ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif
.PHONY: all clean
#---------------------------------------------------------------------------------
all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).3dsx $(TARGET).cia $(TARGET).smdh app/*.bin
@rm -fr $(OUTDIR)
#---------------------------------------------------------------------------------
send:
@3dslink -a $(IP) $(TARGET).3dsx
#---------------------------------------------------------------------------------
run:
@flatpak run org.citra_emu.citra $(TARGET).3dsx
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
3dsx: $(BUILD)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 3dsx
#---------------------------------------------------------------------------------
$(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(DEVKITPRO)/tools/bin/tex3ds -i $< -H $(BUILD)/$*.h -d $(DEPSDIR)/$*.d -o $(GFXBUILD)/$*.t3x
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all: $(OUTPUT).elf $(OUTPUT).3dsx
$(OUTPUT).elf : $(OFILES)
$(OUTPUT).3dsx : $(_3DSXDEPS)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
.PRECIOUS : %.t3x %.shbin
#---------------------------------------------------------------------------------
%.t3x.o %_t3x.h : %.t3x
#---------------------------------------------------------------------------------
$(SILENTMSG) $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
%.shbin.o %_shbin.h : %.shbin
#---------------------------------------------------------------------------------
$(SILENTMSG) $(notdir $<)
$(bin2o)
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
.SUFFIXES:
#nicetest
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITARM)/3ds_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
# GRAPHICS is a list of directories containing graphics files
# GFXBUILD is the directory where converted graphics files will be placed
# If set to $(BUILD), it will statically link in the converted
# files as if they were data files.
#
# NO_SMDH: if set to anything, no SMDH file is generated.
# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional)
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
# ICON is the filename of the icon (.png), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.png
# - icon.png
# - <libctru folder>/default_icon.png
#---------------------------------------------------------------------------------
# External tools
#---------------------------------------------------------------------------------
ifeq ($(OS),Windows_NT)
MAKEROM ?= C:/devkitpro/tools/bin/makerom.exe
BANNERTOOL ?= C:/devkitpro/tools/bin/bannertool.exe
else
MAKEROM ?= makerom
BANNERTOOL ?= bannertool
endif
# If on a tagged commit, use the tag instead of the commit
ifneq ($(shell echo $(shell git tag -l --points-at HEAD) | head -c 1),)
GIT_VER := $(shell git tag -l --points-at HEAD)
else
GIT_VER := $(shell git rev-parse --short HEAD)
endif
TIME_TIME := unk
#---------------------------------------------------------------------------------
# Version number
#---------------------------------------------------------------------------------
VERSION_MAJOR := 1
VERSION_MINOR := 0
VERSION_MICRO := 0
#---------------------------------------------------------------------------------
# Make Sure to Change this paths if your Submodule
# is located somewhere else
# Using ../ cause rd7tf is shipped with the RenderD7
# Repository!
RENDERD7_SRC := ../source ../external
RENDERD7_INC := ../include
# Libraries used for RenderD7
# if you already use -lm, -lctru etc place a # before -lm
RENDERD7_LIBS := -lcurl -lm -lcitro2dd -lcitro3d -lctru
RENDERD7_FLAGS := -DRENDERD7_MEMTRACK=1
TARGET := rd7tf
BUILD := build
SOURCES := source $(RENDERD7_SRC)
DATA := data
INCLUDES := source $(RENDERD7_INC)
GRAPHICS := gfx
#GFXBUILD := $(BUILD)
ROMFS := romfs
GFXBUILD := $(ROMFS)/gfx
APP_AUTHOR := NPI-D7
APP_DESCRIPTION := RenderD7 Test Framework
ICON := app/icon.png
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Wall -Wno-psabi -O2 -mword-relocations \
-DV_STRING=\"$(GIT_VER)\" \
-DV_TIME=\"$(TIME_TIME)\" \
-ffunction-sections \
$(ARCH) $(RENDERD7_FLAGS)
CFLAGS += $(INCLUDE) -D__3DS__ -D_GNU_SOURCE=1
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lstdc++ $(RENDERD7_LIBS)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(CTRULIB)
#---------------------------------------------------------------------------------
# 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,$(GRAPHICS),$(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)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
GFXFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.t3s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
ifeq ($(GFXBUILD),$(BUILD))
#---------------------------------------------------------------------------------
export T3XFILES := $(GFXFILES:.t3s=.t3x)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export ROMFS_T3XFILES := $(patsubst %.t3s, $(GFXBUILD)/%.t3x, $(GFXFILES))
export T3XHFILES := $(patsubst %.t3s, $(BUILD)/%.h, $(GFXFILES))
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) \
$(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)
export _3DSXDEPS := $(if $(NO_SMDH),,$(OUTPUT).smdh)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.png)
ifneq (,$(findstring $(TARGET).png,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).png
else
ifneq (,$(findstring icon.png,$(icons)))
export APP_ICON := $(TOPDIR)/icon.png
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_SMDH)),)
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
endif
ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif
.PHONY: all clean
#---------------------------------------------------------------------------------
all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).3dsx $(TARGET).cia $(TARGET).smdh app/*.bin
@rm -fr $(OUTDIR)
#---------------------------------------------------------------------------------
send:
@3dslink -a $(IP) $(TARGET).3dsx
#---------------------------------------------------------------------------------
run:
@flatpak run org.citra_emu.citra $(TARGET).3dsx
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
3dsx: $(BUILD)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 3dsx
#---------------------------------------------------------------------------------
$(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(DEVKITPRO)/tools/bin/tex3ds -i $< -H $(BUILD)/$*.h -d $(DEPSDIR)/$*.d -o $(GFXBUILD)/$*.t3x
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all: $(OUTPUT).elf $(OUTPUT).3dsx
$(OUTPUT).elf : $(OFILES)
$(OUTPUT).3dsx : $(_3DSXDEPS)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
.PRECIOUS : %.t3x %.shbin
#---------------------------------------------------------------------------------
%.t3x.o %_t3x.h : %.t3x
#---------------------------------------------------------------------------------
$(SILENTMSG) $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
%.shbin.o %_shbin.h : %.shbin
#---------------------------------------------------------------------------------
$(SILENTMSG) $(notdir $<)
$(bin2o)
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

8
rd7tf/README.md Normal file
View File

@ -0,0 +1,8 @@
# TAGLIB
```
git clone --recursive https://github.com/taglib/taglib.git
cd taglib
cmake -B 3dsbuild . --toolchain /opt/devkitpro/cmake/3DS:cmake
cmake --build 3dsbuild
```

View File

@ -1,9 +0,0 @@
#!/bin/bash
#Clean old build
echo "Cleaning..."
make clean
rm -rf libs/*
cd ..
make clean
echo "Done!"

BIN
rd7tf/romfs/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

View File

@ -1,27 +1,58 @@
#include <rd7.hpp>
int main() {
rd7_do_splash = true;
RenderD7::Ftrace::Beg("app", "app_init");
RenderD7::Init::Main("rd7tf");
RenderD7::Init::NdspFirm();
RenderD7::Ftrace::Beg("app", f2s(RenderD7::LoadSettings));
RenderD7::LoadSettings();
RenderD7::Ftrace::End("app", f2s(RenderD7::LoadSettings));
sound snd("romfs:/thesound.wav", 0);
snd.play();
RenderD7::PushMessage(RenderD7::Message(std::string("RenderD7 ") + RENDERD7VSTRING, "Testing the ToastsV2"));
RenderD7::Ftrace::End("app", "app_init");
while (RenderD7::MainLoop()) {
RenderD7::Ftrace::Beg("app", "app_mainloop");
if (d7_hDown & KEY_START)
RenderD7::ExitApp();
if(d7_hDown & KEY_A) {
RenderD7::PushMessage(RenderD7::Message(std::string("RenderD7 ") + RENDERD7VSTRING, "Testing the ToastsV2\nPressed A"));
}
RenderD7::FrameEnd();
RenderD7::Ftrace::End("app", "app_mainloop");
}
return 0;
#include "scene.hpp"
void ColorThemeSample() {
RenderD7::ColorNew(RD7Color_Text, RenderD7::Color::Hex("#000000", 255));
RenderD7::ColorNew(RD7Color_TextDisabled,
RenderD7::Color::Hex("#212121", 200));
RenderD7::ColorNew(RD7Color_Text2, RenderD7::Color::Hex("#ffffff", 255));
RenderD7::ColorNew(RD7Color_Background, RenderD7::Color::Hex("#eeeeee", 170));
RenderD7::ColorNew(RD7Color_Header, RenderD7::Color::Hex("#222222", 190));
RenderD7::ColorNew(RD7Color_Selector, RenderD7::Color::Hex("#4444dd", 200));
RenderD7::ColorNew(RD7Color_SelectorFade,
RenderD7::Color::Hex("#7777dd", 200));
RenderD7::ColorNew(RD7Color_List0, RenderD7::Color::Hex("#555555", 130));
RenderD7::ColorNew(RD7Color_List1, RenderD7::Color::Hex("#777777", 130));
RenderD7::ColorNew(RD7Color_MessageBackground,
RenderD7::Color::Hex("#222222", 180));
RenderD7::ColorNew(RD7Color_Button, RenderD7::Color::Hex("#4444dd", 150));
RenderD7::ColorNew(RD7Color_ButtonHovered,
RenderD7::Color::Hex("#6666dd", 150));
RenderD7::ColorNew(RD7Color_ButtonDisabled,
RenderD7::Color::Hex("#2222dd", 150));
RenderD7::ColorNew(RD7Color_ButtonActive,
RenderD7::Color::Hex("#7777dd", 150));
RenderD7::ColorNew(RD7Color_Checkmark, RenderD7::Color::Hex("#4444dd", 130));
RenderD7::ColorNew(RD7Color_FrameBg, RenderD7::Color::Hex("#555555", 160));
RenderD7::ColorNew(RD7Color_FrameBgHovered,
RenderD7::Color::Hex("#777777", 160));
RenderD7::ColorNew(RD7Color_Progressbar,
RenderD7::Color::Hex("#4444dd", 200));
}
extern void IdbServer();
int main() {
rd7_enable_memtrack = true;
rd7_do_splash = true;
RenderD7::Ftrace::Beg("app", "app_init");
RenderD7::Init::Main("rd7tf");
RenderD7::FadeIn();
// IdbServer();
ColorThemeSample();
RenderD7::Init::NdspFirm();
RenderD7::Scene::Load(std::make_unique<Sample>());
RenderD7::Ftrace::End("app", "app_init");
while (RenderD7::MainLoop()) {
RenderD7::OnScreen(Top);
RenderD7::Ftrace::Beg("app", "app_mainloop");
if (d7_hDown & KEY_START) {
RenderD7::FadeOut();
RenderD7::ExitApp();
}
RenderD7::OnScreen(Top);
RenderD7::FrameEnd();
RenderD7::Ftrace::End("app", "app_mainloop");
}
return 0;
}

131
rd7tf/source/scene.cpp Normal file
View File

@ -0,0 +1,131 @@
#include "scene.hpp"
#include <cmath>
static float MakeOffset(float x) {
float y = cos(x) * 42;
return y - floor(y);
}
static void Wave(int index, R7Vec2 position, R7Vec2 size, float time,
bool dbg) {
float offset = MakeOffset(index) * 62;
float x_position =
position.x + size.x / 8 * ((index % 11) - 1) + cos(offset + time) * 10;
float y_position = position.y + size.y / 8 * (index / 11) + 40 +
sin(offset + time) * 10 + 30;
float color_effect = 1 - exp(-(index / 11) / 3.0f);
// As this is 3ds dont go out of the box
int shrink = 0;
if (y_position >= position.y + size.y - 90) {
shrink = y_position - (position.y + size.y - 90);
}
// Just to make sure...
y_position = std::min(y_position, position.y + size.y - (90 - shrink));
if (dbg)
RenderD7::Draw2::TriangleLined(
R7Vec2(x_position, y_position),
R7Vec2(x_position + 300, y_position + (90 - shrink)),
R7Vec2(x_position - 300, y_position + (90 - shrink)),
RenderD7::Color::RGBA(.94f - .17f * color_effect,
.61f - .25f * color_effect,
.36f + .38f * color_effect)
.toRGBA());
else
RenderD7::Draw2::TriangleSolid(
R7Vec2(x_position, y_position),
R7Vec2(x_position + 300, y_position + (90 - shrink)),
R7Vec2(x_position - 300, y_position + (90 - shrink)),
RenderD7::Color::RGBA(.94f - .17f * color_effect,
.61f - .25f * color_effect,
.36f + .38f * color_effect)
.toRGBA());
}
void DrawWave(R7Vec2 position, R7Vec2 size, float time, bool dbg) {
RenderD7::Draw2::RectFilledSolid(position, size, 0xff64c9fd);
int i = 0;
for (; i < 44; i++) Wave(i, position, size, time, dbg);
}
R7Vec2 testv2 = R7Vec2(48, 48);
Sample::Sample() {
auto t = RenderD7::FileSystem::GetDirContent("sdmc:/music/");
for (const auto& it : t) {
names.push_back(it.name);
files.push_back(it.path);
}
}
Sample::~Sample() {
// Here you can clear your data
}
void Sample::Draw() const {
// Draw Things to Screen:
// Step 1 -> Select Screen
RenderD7::OnScreen(Top);
// Step 2 -> Draw Things
// The hbloader Triangle Wave
DrawWave(R7Vec2(0, 0), R7Vec2(400, 240), RenderD7::GetTime(),
debug_background);
// For Example A Rect with Draw2 and StyleColorApi
// And the RFS Wrapper for RectFilledSolid lol
/*RenderD7::Draw2::RFS(R7Vec2(0, 0), R7Vec2(400, 20),
RenderD7::StyleColor(RD7Color_Header));
// As the Top bar is Dark you need TextColor2
RenderD7::RedirectColor(RD7Color_Text, RD7Color_Text2);
RenderD7::Draw2::Text(R7Vec2(5, 2), "RenderD7 - Test Framework");
RenderD7::Draw2::Text(R7Vec2(395, 2), RENDERD7VSTRING,
RD7TextFlags_AlignRight);
RenderD7::UndoColorEdit(RD7Color_Text);*/
if (UI7::BeginMenu("RenderD7 Test Framework")) {
UI7::SetCursorPos(R7Vec2(395, 2));
UI7::Label(RenderD7::FormatBytes(RenderD7::Memory::GetCurrent()),
RD7TextFlags_AlignRight);
UI7::RestoreCursor();
if (state == State_Menu) {
UI7::Label("Test App");
}
UI7::EndMenu();
}
RenderD7::OnScreen(Bottom);
if (UI7::BeginMenu("Control Center")) {
if (state == State_Menu) {
if (UI7::Button("RenderD7 Settings"))
shared_requests[1U] = 1U; // Request a Toggle
UI7::SameLine();
if (UI7::Button("Test Message"))
shared_requests[2U] = 1U; // Request Test Msg
UI7::Checkbox("Debug BG", debug_background);
UI7::SameLine();
UI7::Checkbox("RD7-Debug", rd7_debugging);
UI7::InputText("Search", search__, "Tap Here");
}
UI7::EndMenu();
}
}
void Sample::Logic() {
for (const auto& it : shared_requests) {
if (it.first == 1U) {
if (it.second) RenderD7::LoadSettings();
} else if (it.first == 2U) {
if (it.second)
RenderD7::PushMessage(RenderD7::Message(
"Test Message", "Button Bressed\nBest Msg Handler..."));
} else if (it.first == 3U) {
state = (State)it.second;
}
}
if (d7_hDown & KEY_UP && sel > 0) sel--;
if (d7_hDown & KEY_DOWN && sel < ((int)files.size() - 1)) sel++;
// Make sure to clear after processing!!!;
shared_requests.clear();
if (d7_hDown & KEY_B) debug_background = !debug_background;
}

32
rd7tf/source/scene.hpp Normal file
View File

@ -0,0 +1,32 @@
#pragma once
#include <rd7.hpp>
class Sample : public RenderD7::Scene {
public:
enum State {
State_Menu,
};
Sample();
~Sample();
void Draw() const override;
void Logic() override;
private:
// Just as the RD7 Settings Shows here as example
// by using a mutale map you're able to process
// requests from the const Draw function in the
// Logic Function! you could also create lots of
// mutable bool or make all Variables mutable but
// i think seperating draw and logic is better
// editable map request_id data/operation
mutable std::map<unsigned int, unsigned int> shared_requests;
// For Checkbox its best to use mutable
mutable bool debug_background = false;
mutable std::string search__ = "";
mutable std::vector<std::string> names;
mutable std::vector<std::string> files;
mutable int sel;
State state = State_Menu;
};

View File

@ -1,22 +0,0 @@
#!/bin/bash
#Clean old build
echo "Cleaning..."
rm -rf libs/*
#Format to LLVM
echo "Format to LLVM"
cd ..
./cformat.sh
#Compile RenderD7
echo "Compiling RenderD7"
make
#Copy new build
echo "Copy New Build"
cp -r include rd7tf/libs/
cp -r lib rd7tf/libs/
#Build Test Framework
echo "Building Test Framework"
cd rd7tf
make
echo "Done!"