diff --git a/.clangd b/.clangd deleted file mode 100644 index 7ffa25f..0000000 --- a/.clangd +++ /dev/null @@ -1,2 +0,0 @@ -CompileFlags: - Add: [-I/opt/devkitpro/libctru/include, -I/opt/devkitpro/portlibs/3ds/include, -Iinclude, -Ird7tf/source] diff --git a/.gitignore b/.gitignore index 80e9a17..0f9b531 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ *.bz2 -rd7le/ *.DS_Store* -rd7tf/build -rd7tf/rd7tf.* .cache/ compile_commands.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 0656ef7..6ad5dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ - Remove Npi Intro and NVID Api - Replace Toasts System with Message - Added GetTime -- Implement Draw2 Api +- Move from Draw to Render2 Api - Implement RD7Color and R7Vec2 - Add new Features to Color::RGBA - Cleanup Code @@ -32,6 +32,9 @@ - Remove 0.9.4 Security - Tasks now based on std functional/thread - Add Network Support (Download Files, APi Requests) +- Remove RD7TF +- Add Cia Installer +- Move from Init bool values to flags ## 0.9.4 - Implement new Security System To prevent from crashes - Implement Functiontrace for better Timing Tests diff --git a/include/renderd7/global_db.hpp b/include/renderd7/global_db.hpp index a15c6c5..e0f84c1 100644 --- a/include/renderd7/global_db.hpp +++ b/include/renderd7/global_db.hpp @@ -29,6 +29,15 @@ void Restart(); } // namespace IDB } // namespace RenderD7 +using RD7Flags = int; +enum RD7Flags_ { + RD7Flags_None = 0, + RD7Flags_MemTrack = 1<<0, + RD7Flags_SceneSystem = 1<<1, + RD7Flags_ShowSplash = 1<<2, + RD7Flags_Default = RD7Flags_SceneSystem, +}; + // Outdated HidApi (HidV2Patched) extern u32 d7_hDown; extern u32 d7_hHeld; @@ -38,12 +47,10 @@ extern touchPosition d7_touch; // Modern Global Api extern int rd7_max_objects; -extern bool rd7_do_splash; -extern bool rd7_enable_scene_system; -extern bool rd7_debugging; extern C3D_RenderTarget *rd7_top; extern C3D_RenderTarget *rd7_top_right; extern C3D_RenderTarget *rd7_bottom; +extern RD7Flags rd7_flags; // Draw2 extern float rd7_draw2_tsm; \ No newline at end of file diff --git a/include/renderd7/internal_db.hpp b/include/renderd7/internal_db.hpp index f171765..e0cc2b0 100644 --- a/include/renderd7/internal_db.hpp +++ b/include/renderd7/internal_db.hpp @@ -33,6 +33,10 @@ #endif // Base +extern bool rd7i_do_splash; +extern bool rd7i_enable_scene_system; +extern bool rd7i_debugging; +extern bool rd7i_enable_memtrack; extern std::string rd7i_app_name; extern std::string rd7i_config_path; extern nlohmann::json rd7i_config; diff --git a/include/renderd7/renderd7.hpp b/include/renderd7/renderd7.hpp index 131aeb2..389625f 100644 --- a/include/renderd7/renderd7.hpp +++ b/include/renderd7/renderd7.hpp @@ -57,15 +57,8 @@ #define DEFAULT_CENTER 0.5f -/// @param rd7_do_splash Config Value To Enable RenderD7 Splash -extern bool rd7_do_splash; -/// @param rd7_enable_memtrack Config Value to Track Mem Allocations -extern bool rd7_enable_memtrack; /// @param rd7_max_objects Config Param for C2D Mac objects extern int rd7_max_objects; -/// @param rd7_enable_scene_system Enable/Disable Scene System (for example for -/// your own implementations) -extern bool rd7_enable_scene_system; namespace RenderD7 { // Reference to the New Renderer diff --git a/rd7tf/Makefile b/rd7tf/Makefile deleted file mode 100644 index 3252854..0000000 --- a/rd7tf/Makefile +++ /dev/null @@ -1,279 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#nicetest -#--------------------------------------------------------------------------------- - -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=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): -# - .png -# - icon.png -# - /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 -lmbedtls -lmbedx509 -lmbedcrypto -lz -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 -#--------------------------------------------------------------------------------------- diff --git a/rd7tf/README.md b/rd7tf/README.md deleted file mode 100644 index 730cabd..0000000 --- a/rd7tf/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# TAGLIB -``` -git clone --recursive https://github.com/taglib/taglib.git -cd taglib -cmake -B 3dsbuild . --toolchain /opt/devkitpro/cmake/3DS:cmake -cmake --build 3dsbuild - -``` \ No newline at end of file diff --git a/rd7tf/app/icon.png b/rd7tf/app/icon.png deleted file mode 100755 index 4ba3677..0000000 Binary files a/rd7tf/app/icon.png and /dev/null differ diff --git a/rd7tf/gfx/default_icon.png b/rd7tf/gfx/default_icon.png deleted file mode 100755 index b98b987..0000000 Binary files a/rd7tf/gfx/default_icon.png and /dev/null differ diff --git a/rd7tf/gfx/folder.png b/rd7tf/gfx/folder.png deleted file mode 100755 index 268d770..0000000 Binary files a/rd7tf/gfx/folder.png and /dev/null differ diff --git a/rd7tf/gfx/renderd7.png b/rd7tf/gfx/renderd7.png deleted file mode 100755 index fb8617f..0000000 Binary files a/rd7tf/gfx/renderd7.png and /dev/null differ diff --git a/rd7tf/gfx/sprites.t3s b/rd7tf/gfx/sprites.t3s deleted file mode 100755 index 7cc6714..0000000 --- a/rd7tf/gfx/sprites.t3s +++ /dev/null @@ -1,6 +0,0 @@ ---atlas -f rgba -z auto - -renderd7.png -folder.png -default_icon.png -unk_icon.png \ No newline at end of file diff --git a/rd7tf/gfx/unk_icon.png b/rd7tf/gfx/unk_icon.png deleted file mode 100755 index cda3a75..0000000 Binary files a/rd7tf/gfx/unk_icon.png and /dev/null differ diff --git a/rd7tf/romfs/gfx/bg.png b/rd7tf/romfs/gfx/bg.png deleted file mode 100755 index dc0b82e..0000000 Binary files a/rd7tf/romfs/gfx/bg.png and /dev/null differ diff --git a/rd7tf/romfs/gfx/renderd7.png b/rd7tf/romfs/gfx/renderd7.png deleted file mode 100755 index fb8617f..0000000 Binary files a/rd7tf/romfs/gfx/renderd7.png and /dev/null differ diff --git a/rd7tf/romfs/gfx/sprites.t3x b/rd7tf/romfs/gfx/sprites.t3x deleted file mode 100755 index eacc4eb..0000000 Binary files a/rd7tf/romfs/gfx/sprites.t3x and /dev/null differ diff --git a/rd7tf/romfs/icons/icon.png b/rd7tf/romfs/icons/icon.png deleted file mode 100644 index 4ba3677..0000000 Binary files a/rd7tf/romfs/icons/icon.png and /dev/null differ diff --git a/rd7tf/romfs/lang/de/app.json b/rd7tf/romfs/lang/de/app.json deleted file mode 100755 index 817a89f..0000000 --- a/rd7tf/romfs/lang/de/app.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "LOADINGFILES": "Lade Dateien ...", - "MENU": "MenĂ¼", - "LOADING": "Lade ..." -} \ No newline at end of file diff --git a/rd7tf/romfs/lang/en/app.json b/rd7tf/romfs/lang/en/app.json deleted file mode 100755 index b86d7f6..0000000 --- a/rd7tf/romfs/lang/en/app.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "LOADINGFILES": "Loading Files ...", - "MENU": "Menu", - "LOADING": "Loading ..." -} \ No newline at end of file diff --git a/rd7tf/romfs/roboto_bold.bcfnt b/rd7tf/romfs/roboto_bold.bcfnt deleted file mode 100644 index 4d023f6..0000000 Binary files a/rd7tf/romfs/roboto_bold.bcfnt and /dev/null differ diff --git a/rd7tf/romfs/thesound.wav b/rd7tf/romfs/thesound.wav deleted file mode 100644 index 9cf19fe..0000000 Binary files a/rd7tf/romfs/thesound.wav and /dev/null differ diff --git a/rd7tf/source/main.cpp b/rd7tf/source/main.cpp deleted file mode 100644 index 4adb75d..0000000 --- a/rd7tf/source/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file is part of RenderD7 - * Copyright (C) 2021-2024 NPI-D7, tobid7 - * - * 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 "scene.hpp" - -int main() { - rd7_enable_memtrack = true; - rd7_do_splash = true; - RD7::Ftrace::Beg("app", "app_init"); - RD7::Init::Main("rd7tf"); - RD7::FadeIn(); - // RD7::Init::NdspFirm(); - RD7::Scene::Load(std::make_unique()); - RD7::Ftrace::End("app", "app_init"); - while (RD7::MainLoop()) { - RD7::R2()->OnScreen(R2Screen_Bottom); - RD7::Ftrace::Beg("app", "app_mainloop"); - if (d7_hDown & KEY_START) { - RD7::FadeOut(); - RD7::ExitApp(); - } - RD7::R2()->OnScreen(R2Screen_Top); - RD7::FrameEnd(); - RD7::Ftrace::End("app", "app_mainloop"); - } - return 0; -} \ No newline at end of file diff --git a/rd7tf/source/scene.cpp b/rd7tf/source/scene.cpp deleted file mode 100644 index 60dc070..0000000 --- a/rd7tf/source/scene.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/** - * This file is part of RenderD7 - * Copyright (C) 2021-2024 NPI-D7, tobid7 - * - * 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 "scene.hpp" - -#include - -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)); - - RD7::R2()->AddTriangle( - R7Vec2(x_position, y_position), - R7Vec2(x_position + 300, y_position + (90 - shrink)), - R7Vec2(x_position - 300, y_position + (90 - shrink)), - RD7::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) { - RD7::R2()->AddRect(position, size, 0xff64c9fd); - int i = 0; - for (; i < 44; i++) Wave(i, position, size, time, dbg); -} - -R7Vec2 testv2 = R7Vec2(48, 48); -std::vector img; - -void display_icon(void* v, R7Vec2 p) { - UI7::Menu::GetList()->AddRectangle(p, testv2, 0xff00ffff); -} - -Sample::Sample() { - auto ti = new int; - ti[0] = 0; - for (int i = 0; i < 256; i++) { - img.push_back(ti); - } -} - -Sample::~Sample() { - delete img[0]; - // Here you can clear your data -} - -void Sample::Draw() const { - // Draw Things to Screen: - // Step 1 -> Select Screen - RD7::R2()->OnScreen(R2Screen_Top); - // Step 2 -> Draw Things - // The hbloader Triangle Wave - DrawWave(R7Vec2(0, 0), R7Vec2(400, 240), RD7::GetTime(), debug_background); - if (UI7::BeginMenu("RenderD7 Test Framework")) { - if (state == State_Menu) { - UI7::Label("SZS: " + std::to_string(img.size())); - UI7::Grid("Images", R7Vec2(390, 180), testv2, display_icon, - (void**)&img[0], img.size()); - } - UI7::EndMenu(); - } - RD7::R2()->OnScreen(R2Screen_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::SameLine(); - UI7::Checkbox("UI7-Debug", UI7::IsDebugging()); - UI7::InputText("Search", search__, "Tap Here"); - if (UI7::Button("def")) txt_size = 0.5; - UI7::Label("GridControl: "); - if (UI7::Button("icn++")) testv2 += R7Vec2(1, 1); - UI7::SameLine(); - if (UI7::Button("icn--")) testv2 -= R7Vec2(1, 1); - } - UI7::EndMenu(); - } -} - -void Sample::Logic() { - for (const auto& it : shared_requests) { - if (it.first == 1U) { - if (it.second) RD7::LoadSettings(); - } else if (it.first == 2U) { - if (it.second) - RD7::PushMessage(RD7::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; -} diff --git a/rd7tf/source/scene.hpp b/rd7tf/source/scene.hpp deleted file mode 100644 index d0fc2ad..0000000 --- a/rd7tf/source/scene.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This file is part of RenderD7 - * Copyright (C) 2021-2024 NPI-D7, tobid7 - * - * 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 . - */ - -#pragma once - -#include - -class Sample : public RD7::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 shared_requests; - // For Checkbox its best to use mutable - mutable bool debug_background = false; - mutable std::string search__ = ""; - mutable std::vector names; - mutable std::vector files; - mutable int sel; - mutable float txt_size = 0.5f; - State state = State_Menu; -}; \ No newline at end of file diff --git a/source/Memory.cpp b/source/Memory.cpp index ac0e952..ec04ce0 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -22,16 +22,16 @@ static RenderD7::Memory::memory_metrics metrics; -bool rd7_enable_memtrack; +bool rd7i_enable_memtrack; void *operator new(size_t size) { void *ptr = malloc(size); - if (rd7_enable_memtrack) metrics.t_TotalAllocated += size; + if (rd7i_enable_memtrack) metrics.t_TotalAllocated += size; return ptr; } void operator delete(void *memory, size_t size) { - if (rd7_enable_memtrack) metrics.t_TotalFreed += size; + if (rd7i_enable_memtrack) metrics.t_TotalFreed += size; free(memory); } @@ -41,7 +41,7 @@ std::map sizes; void *operator new[](size_t size) { void *ptr = malloc(size); - if (rd7_enable_memtrack) { + if (rd7i_enable_memtrack) { allocations++; total_size += size; sizes[ptr] = size; @@ -52,7 +52,7 @@ void *operator new[](size_t size) { } void operator delete[](void *ptr) { - if (rd7_enable_memtrack) { + if (rd7i_enable_memtrack) { allocations--; total_size -= sizes[ptr]; metrics.t_TotalFreed += sizes[ptr]; diff --git a/source/Message.cpp b/source/Message.cpp index 85311aa..2484a57 100644 --- a/source/Message.cpp +++ b/source/Message.cpp @@ -23,7 +23,7 @@ #include #include -extern bool rd7_debugging; +extern bool rd7i_debugging; static std::vector> msg_lst; static int fade_outs = 200; // Start of fadeout @@ -72,7 +72,7 @@ void ProcessMessages() { R2()->AddRect(pos, R7Vec2(150, 50), bgc); R2()->AddText(pos + R7Vec2(5, 1), msg_lst[i]->title, tc); R2()->AddText(pos + R7Vec2(5, 17), msg_lst[i]->message, tc); - if (rd7_debugging) + if (rd7i_debugging) R2()->AddText(pos + R7Vec2(155, 1), std::to_string(msg_lst[i]->animationframe), tc); // Why Frameadd? because Message uses int as frame and diff --git a/source/Overlays.cpp b/source/Overlays.cpp index b1ff5ab..d5b3b5a 100644 --- a/source/Overlays.cpp +++ b/source/Overlays.cpp @@ -341,7 +341,7 @@ void Ovl_Metrik::Draw(void) const { mt_tbs = "TextBuf: " + std::to_string(C2D_TextBufGetNumGlyphs(rd7i_text_buffer)) + "/4096"; - if (rd7_enable_memtrack) + if (rd7i_enable_memtrack) mt_mem = "Mem: " + RenderD7::FormatBytes(RenderD7::Memory::GetCurrent()) + " | " + RenderD7::FormatBytes(RenderD7::Memory::GetTotalAllocated()) + @@ -358,7 +358,7 @@ void Ovl_Metrik::Draw(void) const { (unsigned int)i_mt_color[0]); R2()->AddRect(R7Vec2(0, 50 + dim_y * 4), R2()->GetTextDimensions(mt_tbs), (unsigned int)i_mt_color[0]); - if (rd7_enable_memtrack) + if (rd7i_enable_memtrack) R2()->AddRect(R7Vec2(0, 50 + dim_y * 5), R2()->GetTextDimensions(mt_mem), (unsigned int)i_mt_color[0]); R2()->AddRect(R7Vec2(0, infoy), R2()->GetTextDimensions(info), @@ -373,7 +373,7 @@ void Ovl_Metrik::Draw(void) const { (unsigned int)i_txt_color[0]); R2()->AddText(R7Vec2(0, 50 + dim_y * 4), mt_tbs, (unsigned int)i_txt_color[0]); - if (rd7_enable_memtrack) + if (rd7i_enable_memtrack) R2()->AddText(R7Vec2(0, 50 + dim_y * 5), mt_mem, (unsigned int)i_txt_color[0]); R2()->AddText(R7Vec2(0, infoy), info, (unsigned int)i_txt_color[0]); diff --git a/source/Render2.cpp b/source/Render2.cpp index 5ba6a6c..f5b9f84 100644 --- a/source/Render2.cpp +++ b/source/Render2.cpp @@ -182,7 +182,7 @@ void R2Base::Process() { // Look into Old Draw2 Code // TODO: Create Code for this } - if (rd7_debugging) { + if (rd7i_debugging) { this->DrawNextLined(); this->AddRect(newpos, dim, 0xff0000ff); } diff --git a/source/internal_db.cpp b/source/internal_db.cpp index 74864c5..d2fd829 100644 --- a/source/internal_db.cpp +++ b/source/internal_db.cpp @@ -31,6 +31,7 @@ #include /// Base /// +RD7Flags rd7_flags = RD7Flags_Default; static RenderD7::Thread rd7i_idb_server; // Protected std::string rd7i_app_name; std::string rd7i_config_path; @@ -96,9 +97,9 @@ touchPosition d7_touch; // Modern Global Api int rd7_max_objects = C2D_DEFAULT_MAX_OBJECTS; -bool rd7_do_splash = false; -bool rd7_enable_scene_system = true; -bool rd7_debugging = false; +bool rd7i_do_splash = false; +bool rd7i_enable_scene_system = true; +bool rd7i_debugging = false; C3D_RenderTarget *rd7_top; C3D_RenderTarget *rd7_top_right; C3D_RenderTarget *rd7_bottom; diff --git a/source/renderd7.cpp b/source/renderd7.cpp index 36dd816..8dfcdc7 100644 --- a/source/renderd7.cpp +++ b/source/renderd7.cpp @@ -326,7 +326,7 @@ bool RenderD7::MainLoop() { C2D_TargetClear(rd7_top, C2D_Color32(0, 0, 0, 0)); C2D_TargetClear(rd7_bottom, C2D_Color32(0, 0, 0, 0)); frameloop(); - if (rd7_enable_scene_system) { + if (rd7i_enable_scene_system) { RenderD7::Scene::doDraw(); RenderD7::Scene::doLogic(); } @@ -353,6 +353,10 @@ Result RenderD7::Init::Main(std::string app_name) { rd7i_app_name = app_name; rd7i_logger = LoggerBase::New(); rd7i_glogger = LoggerBase::New(); + + rd7i_do_splash = (rd7_flags & RD7Flags_ShowSplash); + rd7i_enable_scene_system= (rd7_flags & RD7Flags_SceneSystem); + rd7i_enable_memtrack = (rd7_flags & RD7Flags_MemTrack); gfxInitDefault(); atexit(gfxExit); @@ -405,7 +409,7 @@ Result RenderD7::Init::Main(std::string app_name) { rd7i_graphics_on = true; rd7i_last_tm = svcGetSystemTick(); - if (rd7_do_splash) PushSplash(); + if (rd7i_do_splash) PushSplash(); rd7i_init_input(); rd7i_init_theme(); @@ -421,6 +425,10 @@ Result RenderD7::Init::Minimal(std::string app_name) { rd7i_logger = LoggerBase::New(); rd7i_glogger = LoggerBase::New(); + rd7i_do_splash = (rd7_flags & RD7Flags_ShowSplash); + rd7i_enable_scene_system= (rd7_flags & RD7Flags_SceneSystem); + rd7i_enable_memtrack = (rd7_flags & RD7Flags_MemTrack); + gfxInitDefault(); atexit(gfxExit); romfsInit(); @@ -462,7 +470,7 @@ Result RenderD7::Init::Minimal(std::string app_name) { rd7i_render2 = R2Base::New(); rd7i_graphics_on = true; - if (rd7_do_splash) PushSplash(); + if (rd7i_do_splash) PushSplash(); // Check if citra s64 citracheck = 0; @@ -533,7 +541,7 @@ void OvlHandler() { void RenderD7::FrameEnd() { Ftrace::ScopedTrace st("rd7-core", f2s(FrameEnd)); C3D_FrameBegin(2); - if (!rd7_enable_scene_system && rd7i_settings) { + if (!rd7i_enable_scene_system && rd7i_settings) { RenderD7::Scene::doDraw(); RenderD7::Scene::doLogic(); }