Compare commits

..

1 Commits

Author SHA1 Message Date
c6804dfc03 Codebase of 0.9.5 26.06.2024 found on my OneDrive 2025-02-18 10:26:51 +01:00
147 changed files with 39986 additions and 5081 deletions

50
.github/workflows/Docs.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: 📄
on:
push:
branches: [ "!*" ]
pull_request:
branches: [ "*" ]
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: branch
- name: Display branch name
shell: bash
run: echo ${{ steps.branch.outputs.branch }}
# Runs a single command using the runners shell
- name: Run a one-line script
run: |
git config --global user.email "tobid7@outlook.de"
git config --global user.name "Tobi-D7"
sudo apt-get install doxygen cmake -y
doxygen
echo done
ls -r
cd ..
git clone --depth 1 https://${{ secrets.TOKEN }}@github.com/NPI-D7/RenderD7.git RD7 -b gh-pages
mv -v RenderD7/doc/html/* RD7/
#rm -r doc
cd RD7
echo tobid7
git stage *
echo staged
git commit -m "Documentation1"
git tag doc
echo commited
git push origin gh-pages
echo pushed

50
.github/workflows/Update extlibs.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Extlibs
on:
push:
branches: [ '!*' ]
pull_request:
branches: [ '!*' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: update
run: |
#gl
cd ..
git clone https://github.com/lua/lua.git
cd RenderD7
mkdir -p extlibs/
mkdir -p extlibs/lua/
cp -r ../lua/*.c extlibs/lua/
cp -r ../lua/*.h extlibs/lua/
cp -r ../lua/*.md extlibs/lua/
#RenderD7
cd ..
git clone https://github.com/NPI-D7/RenderD7.git
cd lp-next-ctr
mkdir -p extlibs/
rm -r extlibs/RenderD7
mkdir -p extlibs/RenderD7/
cp -r ../RenderD7/*.c* extlibs/RenderD7/
cp -r ../RenderD7/*.h* extlibs/RenderD7/
cp -r ../RenderD7/*.md extlibs/RenderD7/
#config
git config --global user.email "tobid7@outlook.de"
git config --global user.name "Tobi-D7"
#commit
git stage *
git commit -m "update extlibs"
git push origin main

15
.gitignore vendored
View File

@ -1,11 +1,6 @@
release/
debug/
lib/
*.bz2
*.DS_Store*
.cache/
compile_commands.json
# DOCS
docs/*
!docs/javascripts
!docs/overrides
!docs/stylesheets
site/*
rd7le/
*.DS_Store*

10
.vscode/launch.json vendored
View File

@ -13,10 +13,7 @@
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
/// LINUX
//"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
/// WINDOWS
"miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe",
"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
"miDebuggerServerAddress": "192.168.2.220:4003",
"setupCommands": [
{
@ -38,10 +35,7 @@
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
/// LINUX
//"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
/// WINDOWS
"miDebuggerPath": "C:/devkitPro/devkitARM/bin/arm-none-eabi-gdb.exe",
"miDebuggerPath": "/opt/devkitPro/devkitARM/bin/arm-none-eabi-gdb",
"miDebuggerServerAddress": "localhost:4003",
"setupCommands": [
{

37
.vscode/tasks.json vendored
View File

@ -1,37 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "make",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/rd7tf/"
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": true
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Format",
"command": "python ${workspaceFolder}/clang-format.py",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/"
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": true
},
"problemMatcher": []
}
]
}

View File

@ -2,8 +2,9 @@
## 0.9.5
- Remove Npi Intro and NVID Api
- Replace Toasts System with Message
- Lots of Optimisations
- Added GetTime
- Move from Draw to Render2 Api
- Implement Draw2 Api
- Implement RD7Color and R7Vec2
- Add new Features to Color::RGBA
- Cleanup Code
@ -13,28 +14,13 @@
- Removed Old Font/Text Handlers
- Added UI7 (New UI Api)
- Remove Old UI Api
- Added Music Player (MP3, Vorbis)
- Rewrite of RenderD7::Image
- Internal Debugger/Database (IDB)
- Removed BitmapPrinter
- Added nimg and swr(render2nimg | SoftwareRender)
- Added nimg and nimg_engine
- Removed Old Error/Message Handler
- GetTextSize (extra buffer) + New TextShorter
- Require specific FLAG for MemTrack
- Replace all lodepng usage by stb_image
- Move Asset Generator into single python script
- Remove INI reader
- Python based clangformat script
- Move some Init code into functions to not use twice
- Added Font class
- Add LinearAllocator (for std)
- Fix Crash in FilsSystem
- Implement basic Theme System
- 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

2566
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

687
LICENSE
View File

@ -1,21 +1,674 @@
MIT License
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (c) 2024 tobid7
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Preamble
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

201
Makefile Normal file
View File

@ -0,0 +1,201 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/3ds_rules
export renderd7_MAJOR := 0
export renderd7_MINOR := 9
export renderd7_PATCH := 4
VERSION := $(renderd7_MAJOR).$(renderd7_MINOR).$(renderd7_PATCH)
# 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)
#---------------------------------------------------------------------------------
# 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 := renderd7
SOURCES := source source/external source/music
DATA := data
INCLUDES := include
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Wall -mword-relocations -save-temps\
-DV_RD7CSTRING=\"$(GIT_VER)\" \
-DV_RD7BTIME=\"$(TIME_TIME)\" \
-ffunction-sections -fdata-sections \
$(ARCH) $(BUILD_CFLAGS)
CFLAGS += $(INCLUDE) -D__3DS__ -D_GNU_SOURCE=1
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++20
ASFLAGS := -g $(ARCH) $(DEFINES)
#---------------------------------------------------------------------------------
# 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 VPATH := $(foreach dir,$(SOURCES),$(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)))
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
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
#---------------------------------------------------------------------------------
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) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I.
.PHONY: clean all doc
#---------------------------------------------------------------------------------
all: lib/librenderd7.a lib/librenderd7d.a
doc:
@doxygen Doxyfile
dist-bin: all
@tar --exclude=*~ -cjf $(TARGET).tar.bz2 include lib
dist-src:
@tar --exclude=*~ -cjf $(TARGET)-src.tar.bz2 include $(SOURCES) Makefile
dist: dist-src dist-bin
lib:
@[ -d $@ ] || mkdir -p $@
release:
@[ -d $@ ] || mkdir -p $@
debug:
@[ -d $@ ] || mkdir -p $@
lib/librenderd7.a : lib release $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DNDEBUG=1 -O2 -fomit-frame-pointer" \
DEPSDIR=$(CURDIR)/release \
--no-print-directory -C release \
-f $(CURDIR)/Makefile
lib/librenderd7d.a : lib debug $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DDEBUG=1 -Og" \
DEPSDIR=$(CURDIR)/debug \
--no-print-directory -C debug \
-f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr release debug lib includes
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SOURCES) : $(HFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# rules for assembling GPU shaders
#---------------------------------------------------------------------------------
define shader-as
$(eval CURBIN := $*.shbin)
$(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d)
echo "$(CURBIN).o: $< $1" > $(DEPSFILE)
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
picasso -o $(CURBIN) $1
bin2s $(CURBIN) | $(AS) -o $*.shbin.o
endef
%.shbin.o %_shbin.h : %.v.pica %.g.pica
@echo $(notdir $^)
@$(call shader-as,$^)
%.shbin.o %_shbin.h : %.v.pica
@echo $(notdir $<)
@$(call shader-as,$<)
%.shbin.o %_shbin.h : %.shlist
@echo $(notdir $<)
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file)))
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,26 +1,6 @@
# <img alt="LOGO" src="https://dev.npid7.de/tobid7/RenderD7/raw/branch/main/logo.png" height="90">
# RenderD7 as Submodule (0.9.5+)
To use RenderD7 just use this command: `git submodule add https://github.com/NPI-D7/RenderD7` and add `-b v0.9.5` for example for a specific version.
And in Your Project Makefile add this
```
# Make Sure to Change this paths if your Submodule
# is located somewhere else
RENDERD7_SRC := RenderD7/source RenderD7/external
RENDERD7_INC := RenderD7/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
```
Now you need to add it to your sources and includes
```
SOURCES := source $(RENDERD7_SRC)
INCLUDES := source $(RENDERD7_INC)
```
Example from rd7tf
### Installation (0.8.0-0.9.4) (OUTDATED)
# <img alt="LOGO" src="https://github.com/NPI-D7/RenderD7/raw/main/logo.png" height="90">
RenderD7 is now LibRenderD7.
### Installation
Download a Package From Releses Page
`https://github.com/NPI-D7/RenderD7/releases/download/v0.9.4/renderd7.tar.bz2 -o renderd7.tar.bz2`
Then Extract it to your Libraries Path
@ -52,6 +32,23 @@ Example-App
└── src
└── main.cpp
```
# Back to Old Usage aka Submodule (0.9.5+)
If you want to use RenderD7 as Submodule run
`git submodule add https://github.com/NPI-D7/RenderD7`
And to Use Add this to make file
```
# Make Sure to Change this paths if your Submodule
# is located somewhere else
RENDERD7_SRC := RenderD7/source RenderD7/external
RENDERD7_INC := RenderD7/include
```
Now you need to add it to your sources and includes
```
SOURCES := source $(RENDERD7_SRC)
INCLUDES := source $(RENDERD7_INC)
```
Example from rd7tf
# Credits
- NPI-D7
- Tobi-D7 Main Dev

31
assets/build_assets.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
echo "Create Directorys"
mkdir -p build
mkdir -p code
echo "Generating Spritesheets"
cd resources
for file in *.t3s
do
filename=$(basename "$file" .t3s).t3x
tex3ds -o "../build/$filename" -i "${file}"
done
echo "Converting Spritesheets into C++ Code"
cd ../code
for file in ../build/*.t3x
do
name="${file##*/}"
name="${name%.*}"
../../tools/bin/file2array "${file}" "${name}"
done
echo "Fix The Output of file2array"
for file in ./*.cpp
do
../../tools/bin/rd7f2afix "${file}" "renderd7"
done
echo "Finished!"

7
assets/clear_assets.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "Deleting Directorys"
rm -rf build
rm -rf code
echo "Finished!"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

8
cformat.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
find . -type f \( -name '*.h' -o -name '*.hpp' -o -name '*.hh' -o -name '*.ino' -o -name '*.cpp' -o -name '*.c' -o -name '*.cxx' -o -name '*.inl' \) -and -not -path './build/*' -not -path './base/external/*' -not -path './DPP/*' | while read file; do
if [[ "$file" != *"json.hpp" ]]; then
echo "Formatting $file..."
clang-format -i --style=LLVM $file
fi
done

View File

@ -1,27 +0,0 @@
import subprocess
import glob
from pathlib import Path
# Format script
def fmt_file(path):
if Path(path).is_dir():
return # Skip
try:
subprocess.run(['clang-format', '-i', path, '--style=Google'], check=True)
except subprocess.CalledProcessError as e:
print('Error for ' + Path(path).stem + ': ' + e)
def fmt_dir(path):
sources = glob.glob(path+'/*')
for file in sources:
fmt_file(file)
print('Formatting...')
fmt_dir('source')
fmt_dir('include')
fmt_dir('include/renderd7')
# Format LE and TF as well
fmt_dir('rd7tf/source')
#fmt_dir('rd7le/source')
print('Done')

View File

@ -1,18 +0,0 @@
<div class="md-copyright">
{% if config.copyright %}
<div class="md-copyright__highlight">
{{ config.copyright }}
</div>
{% endif %}
{% if not config.extra.generator == false %}
Made with
<a href="https://doxide.org" target="_blank" rel="noopener">
Doxide
</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
{% endif %}
</div>

View File

@ -1,18 +0,0 @@
<div class="md-copyright">
{% if config.copyright %}
<div class="md-copyright__highlight">
{{ config.copyright }}
</div>
{% endif %}
{% if not config.extra.generator == false %}
Made with
<a href="https://doxide.org" target="_blank" rel="noopener">
Doxide
</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
{% endif %}
</div>

View File

@ -1,49 +0,0 @@
:root {
--md-admonition-icon--variable: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.41 3c1.39 2.71 1.94 5.84 1.59 9-.2 3.16-1.3 6.29-3.17 9l-1.53-1c1.61-2.43 2.55-5.2 2.7-8 .34-2.8-.11-5.57-1.3-8l1.71-1M5.17 3 6.7 4C5.09 6.43 4.15 9.2 4 12c-.34 2.8.12 5.57 1.3 8l-1.69 1c-1.4-2.71-1.96-5.83-1.61-9 .2-3.16 1.3-6.29 3.17-9m6.91 7.68 2.32-3.23h2.53l-3.78 5 2.2 4.92h-2.26L11.71 14l-2.43 3.33H6.76l3.9-5.12-2.13-4.76h2.27l1.28 3.23Z"/></svg>');
--md-admonition-icon--function: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.6 5.29c-1.1-.1-2.07.71-2.17 1.82L13.18 10H16v2h-3l-.44 5.07a3.986 3.986 0 0 1-4.33 3.63 4.007 4.007 0 0 1-3.06-1.87l1.5-1.5c.24.74.9 1.31 1.73 1.38 1.1.1 2.07-.71 2.17-1.82L11 12H8v-2h3.17l.27-3.07c.19-2.2 2.13-3.83 4.33-3.63 1.31.11 2.41.84 3.06 1.87l-1.5 1.5c-.24-.74-.9-1.31-1.73-1.38Z"/></svg>');
--md-admonition-icon--concept: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.75 3.5a.25.25 0 0 0-.25.25v2.062a.75.75 0 1 1-1.5 0V3.75C2 2.783 2.783 2 3.75 2h2.062a.75.75 0 1 1 0 1.5Zm13.688-.75a.75.75 0 0 1 .75-.75h2.062c.966 0 1.75.783 1.75 1.75v2.062a.75.75 0 1 1-1.5 0V3.75a.25.25 0 0 0-.25-.25h-2.062a.75.75 0 0 1-.75-.75ZM2.75 17.438a.75.75 0 0 1 .75.75v2.062c0 .138.112.25.25.25h2.062a.75.75 0 1 1 0 1.5H3.75A1.75 1.75 0 0 1 2 20.25v-2.062a.75.75 0 0 1 .75-.75Zm18.5 0a.75.75 0 0 1 .75.75v2.062A1.75 1.75 0 0 1 20.25 22h-2.062a.75.75 0 1 1 0-1.5h2.062a.25.25 0 0 0 .25-.25v-2.062a.75.75 0 0 1 .75-.75Zm-18.5-8.25a.75.75 0 0 1 .75.75v4.124a.75.75 0 1 1-1.5 0V9.938a.75.75 0 0 1 .75-.75ZM9.188 2.75a.75.75 0 0 1 .75-.75h4.124a.75.75 0 1 1 0 1.5H9.938a.75.75 0 0 1-.75-.75Zm0 18.5a.75.75 0 0 1 .75-.75h4.124a.75.75 0 1 1 0 1.5H9.938a.75.75 0 0 1-.75-.75ZM21.25 9.188a.75.75 0 0 1 .75.75v4.124a.75.75 0 1 1-1.5 0V9.938a.75.75 0 0 1 .75-.75ZM3.75 8.25a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Zm5.5 0A.75.75 0 0 1 10 7.5h2A.75.75 0 0 1 12 9h-2a.75.75 0 0 1-.75-.75Zm-1-4.5A.75.75 0 0 1 9 4.5v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Zm0 5.5A.75.75 0 0 1 9 10v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Zm0 4.75a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-1.5 0v-4a.75.75 0 0 1 .75-.75ZM14 8.25a.75.75 0 0 1 .75-.75h4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.75-.75Z"/></svg>');
--md-admonition-icon--macro: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m5.41 21 .71-4h-4l.35-2h4l1.06-6h-4l.35-2h4l.71-4h2l-.71 4h6l.71-4h2l-.71 4h4l-.35 2h-4l-1.06 6h4l-.35 2h-4l-.71 4h-2l.71-4h-6l-.71 4h-2M9.53 9l-1.06 6h6l1.06-6h-6Z"/></svg>');
}
.md-typeset .admonition.variable, .md-typeset details.variable,
.md-typeset .admonition.function, .md-typeset details.function,
.md-typeset .admonition.concept, .md-typeset details.concept,
.md-typeset .admonition.macro, .md-typeset details.macro {
border-color: var(--md-default-fg-color--lighter);
}
.md-typeset .variable > .admonition-title, .md-typeset .variable > summary,
.md-typeset .function > .admonition-title, .md-typeset .function > summary,
.md-typeset .concept > .admonition-title, .md-typeset .concept > summary,
.md-typeset .macro > .admonition-title, .md-typeset .macro > summary {
background-color: var(--md-default-bg-color);
}
.md-typeset .variable > .admonition-title::before,
.md-typeset .variable > summary::before {
background-color: var(--md-default-fg-color--light);
-webkit-mask-image: var(--md-admonition-icon--variable);
mask-image: var(--md-admonition-icon--variable);
}
.md-typeset .function > .admonition-title::before,
.md-typeset .function > summary::before {
background-color: var(--md-default-fg-color--light);
-webkit-mask-image: var(--md-admonition-icon--function);
mask-image: var(--md-admonition-icon--function);
}
.md-typeset .concept > .admonition-title::before,
.md-typeset .concept > summary::before {
background-color: var(--md-default-fg-color--light);
-webkit-mask-image: var(--md-admonition-icon--concept);
mask-image: var(--md-admonition-icon--concept);
}
.md-typeset .macro > .admonition-title::before,
.md-typeset .macro > summary::before {
background-color: var(--md-default-fg-color--light);
-webkit-mask-image: var(--md-admonition-icon--macro);
mask-image: var(--md-admonition-icon--macro);
}

638
docsn.css Normal file
View File

@ -0,0 +1,638 @@
/* This doxygen theme is free to use. If you like this, please Star https://github.com/kcwongjoe/doxygen_theme_flat_design */
/* Color Pattern. You can change this pattern to design your theme. */
:root {
/* Content */
--bgcolor: #ffffff;
--bgfont: #303030;
--bgfont2: #f3c60a;
--bgfont-hover: #f3c60a;
--bgfont-hover-text-decoration: none;
--bgborder: #7d7d7d;
--bgborder2: #f6f6f6;
/* Main Header */
--bg1color: #303030;
--bg1font: #ffffff;
--bg1font2: #f3c60a;
/* Second header */
--bg2color: #E2E2E2;
--bg2font: #7D7D7D;
--bg2-hover-bg: #ffffff;
--bg2-hover-font: #303030;
--bg2-hover-topborder: #f3c60a;
/* Third header */
--bg3color: #f6f6f6;
--bg3font: #303030;
--bg3font2: #7D7D7D;
/* Code */
--code-bg: #f6f6f6;
--code-comment: #7D7D7D;
--code-keyword: #d73a49;
--code-preprocessor: #d73a49;
--code-keywordtype: #d73a49;
--code-text: #303030;
--code-code: #6f42c1;
--code-line: #7D7D7D;
--code-line-bg: #D8D8D8;
/* Namespace List, Class List icon */
--icon-bg: #303030;
--icon-font: #f3c60a;
/* Class Index */
--qindex-menu-bg: #303030;
--qindex-menu-font: #ffffff;
--qindex-menu-font-hover: #f3c60a;
--qindex-icon-bg: #f3c60a;
--qindex-icon-font: #303030;
/* Member table */
--mem-title-bg: #303030;
--mem-title-font: #ffffff;
--mem-subtitle-bg: #f3c60a;
--mem-subtitle-font: #303030;
--mem-subtitle-font-hover: #303030;
--mem-content-bg: #ffffff;
--mem-content-font: #303030;
--mem-content-border: #f6f6f6;
/* Nav Tree */
--nav-tree-bg: #E2E2E2;
--nav-tree-bg-hover: #ffffff;
--nav-tree-font: #7D7D7D;
--nav-tree-font-hover: #303030;
--nav-tree-bg-selected: #f3c60a;
--nav-tree-font-selected: #303030;
}
body, table, div, p, dl {
color: var(--bgfont);
background-color: var(--bgcolor);
line-height: 150%;
font: 14px/22px, Roboto, Arial;
}
div.contents {
margin: 20px 40px;
}
div.contents ul {
line-height: 200%;
}
/***********************************/
/********** Project header *********/
/***********************************/
#titlearea {
border-bottom: none;
padding-bottom: 20px;
padding-top: 20px;
}
#titlearea, #titlearea * {
color: var(--bg1font);
background-color: var(--bg1color);
}
#projectname {
padding: 0px 40px !important;
}
#projectbrief {
padding: 0px 40px !important;
}
#projectalign {
padding: 0px !important;
}
/***********************************/
/************ Main Menu ************/
/***********************************/
/* Margin */
#main-menu {
padding: 0px 30px;
}
#main-menu a, #main-menu a:hover {
padding-top: 10px;
padding-bottom: 10px;
}
/* Menu button */
#main-menu li a {
background-image: none;
font-family: Arial;
text-transform: uppercase;
text-shadow: none;
font-size: 14px;
font-weight: 700;
}
#main-menu, #main-menu>li>a {
background-image: none;
background-color: var(--bg2color);
color: var(--bg2font);
transition: 0.2s;
}
/* hover Effect */
#main-menu>li {
border-top: 5px solid var(--bg2color);
}
#main-menu>li:hover {
color: var(--bg2-hover-font);
background-color: var(--bg2-hover-bg);
border-top: 5px solid var(--bg2-hover-topborder);
}
#main-menu>li:hover, #main-menu>li>a:hover, #main-menu>li>a.highlighted {
color: var(--bg2-hover-font);
background-color: var(--bg2-hover-bg);
}
/* Search Bar */
#MSearchBox {
border-radius: 0;
box-shadow: none;
}
#MSearchBox>span {
margin: 10px;
}
#main-menu>li:last-child {
padding: 25px 0px;
}
/* Reset search hover color*/
#main-menu>li:last-child:hover {
color: var(--bg2font);
background-color: var(--bg2color);
border-top: 5px solid var(--bg2color);
}
#MSearchResultsWindow {
border: 1px solid var(--bg3font2);
background-color: var(--bg3color);
padding: 10px;
}
body.SRPage, body.SRPage * {
font-family: Arial;
}
/* Sub Menu */
#main-menu>li ul {
transition: max-height 0.2s ease-in-out;
padding: 0px;
border-radius: 0px !important;
}
#main-menu>li ul:before, #main-menu>li ul:after {
border-width: 0px;
}
#main-menu>li>ul li a, #main-menu>li>ul li {
background-color: var(--bgcolor);
color: var(--bgfont);
background-image: none;
}
#main-menu>li>ul li a:hover, #main-menu>li>ul li:hover {
background-color: var(--bgfont2);
color: var(--bgfont);
}
/***********************************/
/************** Header *************/
/***********************************/
div.headertitle {
padding: 5px 40px;
}
div.header, div.header * {
color: var(--bg3font);
background-color: var(--bg3color);
border-bottom: none;
}
div.summary {
padding-right: 40px;
}
/***********************************/
/************** Link *************/
/***********************************/
a, a:visited, a:active, .contents a:visited, body.SRPage a, body.SRPage a:visited, body.SRPage a:active {
color: var(--bgfont);
text-decoration: none;
}
a:hover, .contents a:hover, body.SRPage a:hover {
color: var(--bgfont-hover);
text-decoration: var(--bgfont-hover-text-decoration);
}
/***********************************/
/************ Nav-path ************/
/***********************************/
#nav-path, #nav-path ul {
background-image: none;
}
#nav-path ul {
padding: 5px 30px;
}
#nav-path, #nav-path * {
color: var(--bg3font2);
background-color: var(--bg3color);
border: none;
font-family: Arial;
}
li.navelem {
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnN2Z2pzPSJodHRwOi8vc3ZnanMuY29tL3N2Z2pzIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDI5Mi4zNTkgMjkyLjM1OSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgY2xhc3M9IiI+PGc+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+Cgk8cGF0aCBkPSJNMjIyLjk3OSwxMzMuMzMxTDk1LjA3Myw1LjQyNEM5MS40NTYsMS44MDcsODcuMTc4LDAsODIuMjI2LDBjLTQuOTUyLDAtOS4yMzMsMS44MDctMTIuODUsNS40MjQgICBjLTMuNjE3LDMuNjE3LTUuNDI0LDcuODk4LTUuNDI0LDEyLjg0N3YyNTUuODEzYzAsNC45NDgsMS44MDcsOS4yMzIsNS40MjQsMTIuODQ3YzMuNjIxLDMuNjE3LDcuOTAyLDUuNDI4LDEyLjg1LDUuNDI4ICAgYzQuOTQ5LDAsOS4yMy0xLjgxMSwxMi44NDctNS40MjhsMTI3LjkwNi0xMjcuOTA3YzMuNjE0LTMuNjEzLDUuNDI4LTcuODk3LDUuNDI4LTEyLjg0NyAgIEMyMjguNDA3LDE0MS4yMjksMjI2LjU5NCwxMzYuOTQ4LDIyMi45NzksMTMzLjMzMXoiIGZpbGw9IiM3ZDdkN2QiIGRhdGEtb3JpZ2luYWw9IiMwMDAwMDAiIHN0eWxlPSIiIGNsYXNzPSIiPjwvcGF0aD4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8L2c+CjxnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjwvZz4KPGcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPC9nPgo8L2c+PC9zdmc+);
background-size: 9px;
}
li.navelem a {
margin-right: 20px;
}
/***********************************/
/*************** mem ***************/
/***********************************/
.memtitle {
padding: 15px;
margin-top: 30px;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
.memtitle, .memtitle *, .memtitle a:visited {
border: none;
background-image: none;
color: var(--mem-title-font);
background-color: var(--mem-title-bg);
}
.memproto {
padding: 10px;
text-shadow: none;
padding: 20px;
border-top-right-radius: 0px;
-moz-border-radius-topright: 0px;
-webkit-border-top-right-radius: 0px;
}
.memproto, .memproto *, .memproto a:visited {
border: none;
background-image: none;
background-color: var(--mem-subtitle-bg);
color: var(--mem-subtitle-font);
font-size: inherit;
line-height: 100%
}
.memproto a:hover {
color: var(--mem-subtitle-font-hover);
}
.memdoc {
border-bottom: 1px solid var(--mem-content-border);
border-left: 1px solid var(--mem-content-border);
border-right: 1px solid var(--mem-content-border);
background-color: var(--mem-content-bg);
color: var(--mem-content-font);
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
-moz-border-radius-bottomleft: 0px;
-moz-border-radius-bottomright: 0px;
-webkit-border-bottom-left-radius: 0px;
-webkit-border-bottom-right-radius: 0px;
}
.memdoc p, .memdoc dt {
padding: 0px 20px;
}
/***********************************/
/************* Contents ************/
/***********************************/
a.anchor {
padding-top: 20px;
}
/***********************************/
/************* fragment ************/
/***********************************/
h2.groupheader {
color: #303030;
font-size: 200%;
font-weight: bold;
border-bottom: none;
padding-top: 20px;
padding-bottom: 20px;
}
div.fragment, pre.fragment {
border: none;
padding: 20px;
margin: none;
background-color: var(--code-bg);
}
div.line {
background-color: var(--code-bg);
}
span.comment {
color: var(--code-comment);
}
span.keyword {
color: var(--code-keyword);
}
span.preprocessor {
color: var(--code-preprocessor);
}
span.keywordtype {
color: var(--code-keywordtype);
}
span.mlabel {
background-color: var(--code-text);
color: var(--code-bg);
border-top: none;
border-left: none;
border-right: none;
border-bottom: none;
padding: 10px;
border-radius: 0px;
}
a.code {
color: var(--code-code);
}
span.lineno, span.lineno>* {
color: var(--code-line);
border-right: none;
background-color: var(--code-bg);
}
span.lineno a {
background-color: var(--code-line-bg);
}
span.lineno a:hover {
color: var(--bg3font);
background-color: var(--code-line-bg);
}
/***********************************/
/************* directory ***********/
/***********************************/
.directory tr.even {
background-color: inherit;
}
.iconfclosed {
background-image: url(closed-folder.png);
margin-right: 10px;
}
.iconfopen {
background-image: url(opened-folder.png);
margin-right: 10px;
}
.icondoc {
background-image: url(document.png);
margin-right: 10px;
}
.arrow {
color: #7d7d7d;
}
.icona {
vertical-align: middle;
margin-right: 5px;
}
.icon {
background-color: var(--icon-bg);
color: var(--icon-font);
display: table-cell;
vertical-align: middle;
height: 20px;
width: 20px;
}
div.ah {
background-color: var(--qindex-icon-bg);
color: var(--qindex-icon-font);
text-align: center;
background-image: none;
-webkit-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 0px;
border-radius: 0px;
border: none;
}
div.qindex {
background-color: var(--qindex-menu-bg);
border: none;
padding: 20px;
}
a.qindex {
color: var(--qindex-menu-font);
font-weight: normal;
font-size: 20px;
}
a:hover.qindex {
color: var(--qindex-menu-font-hover);
}
a:visited.qindex {
color: var(--qindex-menu-font);
}
table.classindex {
margin-top: 30px;
margin-bottom: 30px;
}
table.classindex a.el {
font-weight: normal;
}
/***********************************/
/************** footer *************/
/***********************************/
div.directory {
border-top: 1px solid var(--bgborder);
border-bottom: none;
margin: 20px 0px;
}
div.directory a.el {
font-weight: normal;
}
div.directory>table {
margin: 20px 0px;
}
hr.footer {
border: none;
}
.contents>hr {
border-top: 0px;
}
/***********************************/
/*********** memberdecls ***********/
/***********************************/
.memItemLeft, .memItemRight {
padding: 15px 30px;
background-color: inherit;
}
.mdescRight {
padding: 0px 30px 10px 30px;
}
.memberdecls * {
background-color: inherit;
}
.memSeparator {
border-bottom: 1px solid var(--bgborder2);
}
.memTemplParams {
color: var(--bgfont);
}
/***********************************/
/*********** nav-tree ***********/
/***********************************/
#nav-tree-contents {
background-color: var(--nav-tree-bg);
margin: 0px;
}
#side-nav, #nav-tree {
background-image: none;
background-color: var(--nav-tree-bg);
}
#nav-tree .item {
background-color: var(--nav-tree-bg);
font-family: Arial;
text-transform: uppercase;
text-shadow: none;
font-size: 14px;
font-weight: 700;
padding: 10px;
color: var(--nav-tree-font);
}
#nav-tree .arrow {
color: var(--nav-tree-font);
}
#nav-tree .selected {
background-image: none;
background-color: var(--nav-tree-bg-selected);
}
#nav-tree .selected a {
color: var(--nav-tree-font-selected);
}
#nav-tree .item:hover {
background-color: var(--nav-tree-bg-hover);
color: var(--nav-tree-font-hover);
}
#nav-tree .item a:hover {
color: var(--nav-tree-font-hover);
}
#side-nav .ui-resizable-e {
background-image: none;
background-color: var(--nav-tree-bg);
}
#nav-sync {
background-color: transparent;
}
#nav-sync>img {
content: url(off_sync.png);
}
#nav-sync.sync>img {
content: url(on_sync.png);
}
/***********************************/
/*********** Plant UML ***********/
/***********************************/
.plantumlgraph > img {
width: 80%;
}

View File

@ -1,9 +0,0 @@
title: RenderD7
description:
files:
- "include/*.hpp"
- "include/renderd7/*.hpp"
- "include/renderd7/music/*.hpp"
- "include/*.h"
- "include/renderd7/*.h"
- "include/renderd7/music/*.h"

23
envsetup.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
#Build Tools
echo "Build Tools..."
cd tools
./build_tools.sh
cd ..
#Setup asset-arrays
echo "Generate Asset-Arrays..."
cd assets
./build_assets.sh
echo "Update Files in RenderD7..."
cp -rf code/*.cpp ../source/
cp -rf code/*.hpp ../include/renderd7/
echo "Clean Assets..."
./clear_assets.sh
cd ..
#Clear Tools
echo "Clean Tools..."
cd tools
./clear_tools.sh
cd ..
#Finished
echo "Done!"

View File

@ -1,63 +0,0 @@
import os
import glob
import shutil
from pathlib import Path
# Simple Script to generate/update Assets
def file2array(path, custom_incluse_path):
print(path)
cip = len(custom_incluse_path)
sip = ''
if cip > 0:
sip = custom_incluse_path
name = Path(path).stem
filei = open(path, 'rb')
buf = filei.read()
filei.close()
fs = open(name + '.cpp', 'w')
fs.write("// THIS FILE WAS GENERATED BY generate_assets.py!!!\n\n")
fs.write('#include <'+ sip + name + '.hpp>\n\n')
fs.write('// clang-format off\n')
fs.write('unsigned char ' + name + '[] = {\n')
for byte in buf:
fs.write(hex(byte) + ', ')
fs.write('\n};\n')
fs.write('// clang-format on\n')
fs.write('size_t ' + name + '_size = ' + hex(len(buf)) + ';')
fs.close()
fh = open(name + '.hpp', 'w')
fh.write("// THIS FILE WAS GENERATED BY generate_assets.py!!!\n\n")
fh.write('#pragma once\n\n')
fh.write('#include <cstddef>\n\n')
fh.write('extern unsigned char ' + name + '[];\n')
fh.write('extern size_t ' + name + '_size;')
fh.close()
def tex3ds_build(path):
p = os.path.dirname(path)
n = Path(path).stem
os.system('tex3ds -o ' + p + '/' + n + '.t3x -i ' + path)
def cleanup():
t3x = glob.glob('assets/resources/*.t3x')
for f in t3x:
os.remove(f)
def install_code(what, where):
if Path(what).is_dir:
os.error('Must be a file!!!')
shutil.move(what, where + Path(what).name)
print("Generating...")
t3xtg = glob.glob('assets/resources/*.t3s')
for object in t3xtg:
name = Path(object).stem
bp = os.path.dirname(object)
tex3ds_build(object)
file2array(bp + '/' + name + '.t3x', 'renderd7/')
install_code(name + '.cpp', 'source/')
install_code(name + '.hpp', 'include/renderd7/')
cleanup()
print("Done")

View File

@ -1,19 +1,16 @@
#pragma once
#include <renderd7/Allocator.hpp>
#include <renderd7/Error.hpp>
#include <renderd7/FileSystem.hpp>
#include <renderd7/Hid.hpp>
#include <renderd7/Image.hpp>
#include <renderd7/Installer.hpp>
#include <renderd7/Message.hpp>
#include <renderd7/Net.hpp>
#include <renderd7/Overlays.hpp>
#include <renderd7/Sound.hpp>
#include <renderd7/Timer.hpp>
#include <renderd7/UI7.hpp>
#include <renderd7/global_db.hpp>
#include <renderd7/StealConsole.hpp>
#include <renderd7/renderd7.hpp>
#include <renderd7/swr.hpp>
namespace RD7 = RenderD7;
#include <renderd7/sound.hpp>
#include <renderd7/Message.hpp>
#include <renderd7/DrawV2.hpp>
#include <renderd7/Hid.hpp>
#include <renderd7/UI7.hpp>
#include <renderd7/FileSystem.hpp>
#include <renderd7/Image.hpp>
#include <renderd7/Timer.hpp>
#include <renderd7/music/Music.hpp>
#include <renderd7/nimg_engine.hpp>
#include <renderd7/global_db.hpp>
#include <renderd7/Error.hpp>

View File

@ -1,40 +0,0 @@
#pragma once
#include <3ds.h>
#include <memory>
#include <renderd7/Error.hpp>
// Write own LinearAllocator for learning
namespace RenderD7 {
template <typename T>
class LinearAllocator : public std::allocator<T> {
public:
typedef size_t size_type;
typedef T* pointer;
typedef const T* const_pointer;
template <typename T1>
struct rebind {
typedef LinearAllocator<T1> other;
};
pointer allocate(size_type n, const void* hint = nullptr) {
if (n > this->max_size()) {
RenderD7::Error(
"Linear Allocator: \nBad Alloc -> size is larger than free space!");
return nullptr;
}
return (pointer)linearAlloc(n * sizeof(T));
}
void deallocate(pointer p, size_type) { linearFree((void*)p); }
size_type max_size() { return linearSpaceFree(); }
LinearAllocator() throw() {}
LinearAllocator(const LinearAllocator<T>& a) throw() : std::allocator<T>(a) {}
~LinearAllocator() throw() {}
};
} // namespace RenderD7

View File

@ -2,21 +2,25 @@
#include <unistd.h>
#include <cstring>
#include <functional>
#include <memory>
#include <renderd7/smart_ctor.hpp>
#include <regex>
#include <sstream>
#include <string>
#include <vector>
#define UNPACK_RGBA(col) \
(unsigned char)(col >> 24), (col >> 16), (col >> 8), (col)
#define UNPACK_BGRA(col) \
(unsigned char)(col >> 8), (col >> 16), (col >> 24), (col)
inline unsigned int RGBA8(unsigned char r, unsigned char g, unsigned char b,
unsigned char a = 255) {
return (r | g << 8 | b << 16 | a << 24);
#define UNPACK_RGBA(col) (uint8_t)(col >> 24), (col >> 16), (col >> 8), (col)
#define UNPACK_BGRA(col) (uint8_t)(col >> 8), (col >> 16), (col >> 24), (col)
// it is actually not RGBA lol
inline uint32_t RGBA8(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255) {
#define ISIMPLEPAK(x, y) (((x) & 0xff) << y)
return (ISIMPLEPAK(r, 0) | ISIMPLEPAK(g, 8) | ISIMPLEPAK(b, 16) |
ISIMPLEPAK(a, 24));
}
/*#define RGBA8(r, g, b, a) \
((((r)&0xFF) << 0) | (((g)&0xFF) << 8) | (((b)&0xFF) << 16) | \
(((a)&0xFF) << 24))*/
typedef int RD7Color;
// MultiColor (Less FunctionNameLen)
@ -44,70 +48,33 @@ enum RD7Color_ {
RD7Color_TextDisabled, /// Text Disabled Color
RD7Color_Text2, ///< And This want for Texts on Dark Backgrounds
RD7Color_Background, ///< Your Bg Color
RD7Color_Header, ///< Header Color (if the header is dark text2 is used)
RD7Color_Selector, ///< Selector Color
RD7Color_SelectorFade, ///< Selector FadingTo Color
RD7Color_List0, ///< List Color1
RD7Color_List1, ///< List Color2
RD7Color_MessageBackground, ///< Message Background
RD7Color_Button, ///< Button Color
RD7Color_ButtonHovered, ///< Button Color if Hovered
RD7Color_ButtonDisabled, ///< Button Color if disabled
RD7Color_ButtonActive, ///< Button Colkor if Clicked
RD7Color_Checkmark, ///< Checkbox Checkmark Color
RD7Color_FrameBg, ///< Frame Background Color
RD7Color_FrameBgHovered, ///< Frame Background Color if hovered
RD7Color_Progressbar, ///< Progressbar Color
/// NON COLOR ///
RD7Color_Len, ///< Used to define the lengh of this list
RD7Color_Header, ///< Header Color (if the header is dark text2 is used)
RD7Color_Selector,
RD7Color_SelectorFade,
RD7Color_List0,
RD7Color_List1,
RD7Color_MessageBackground,
RD7Color_Button,
RD7Color_ButtonHovered,
RD7Color_ButtonDisabled,
RD7Color_ButtonActive,
RD7Color_Checkmark,
RD7Color_FrameBg,
RD7Color_FrameBgHovered,
RD7Color_Progressbar,
};
namespace RenderD7 {
class Theme {
public:
Theme() = default;
~Theme() = default;
void Load(const std::string &path);
void Default();
void Save(const std::string &path);
unsigned int Get(RD7Color clr);
void Set(RD7Color clr, unsigned int v);
void Swap(RD7Color a, RD7Color b);
bool Undo();
void UndoAll();
void TextBy(RD7Color bg);
RD7Color AutoText(RD7Color bg);
void ClearHistory() { changes.clear(); }
std::vector<unsigned int> &GetTableRef() { return clr_tab; }
// For Smart Pointer
RD7_SMART_CTOR(Theme);
// Loader method
void CopyOther(Theme::Ref theme);
private:
struct change {
change(RD7Color a, unsigned int f, unsigned int t)
: clr(a), from(f), to(t) {}
change(RD7Color a, RD7Color b, unsigned int f, unsigned int t)
: clr(a), clr2(b), from(f), to(t) {}
RD7Color clr;
RD7Color clr2 = 0; // Used if Swap
unsigned int from;
unsigned int to;
};
// Use a vector for faster access
std::vector<unsigned int> clr_tab;
std::vector<change> changes;
};
Theme::Ref ThemeActive();
/// @brief Change Theme Adress
/// @param theme your adress
void ThemeSet(Theme::Ref theme);
unsigned int StyleColor(RD7Color color);
void RedirectColor(RD7Color to, RD7Color from);
void TextColorByBg(RD7Color background);
/// @brief Customices a color until undone
/// For example with RebderD7::Color::Hex
void CustomizeColor(RD7Color color, unsigned int custom);
/// @brief Completly changes a theme color
void ColorNew(RD7Color color, unsigned int new_color);
void UndoColorEdit(RD7Color color);
void UndoAllColorEdits();
namespace Color {
/// @brief RGBA Class
class RGBA {
@ -117,7 +84,7 @@ class RGBA {
/// @param g
/// @param b
/// @param a
RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255)
RGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
: m_r(r), m_g(g), m_b(b), m_a(a) {}
/// @brief Construct
/// @param r
@ -134,8 +101,7 @@ class RGBA {
m_a = ISIMPLEUNPAK(in, 24);
}
RGBA(RD7Color in) {
if (!RenderD7::ThemeActive()) return;
unsigned int col = RenderD7::ThemeActive()->Get(in);
unsigned int col = RenderD7::StyleColor(in);
m_r = ISIMPLEUNPAK(col, 0);
m_g = ISIMPLEUNPAK(col, 8);
m_b = ISIMPLEUNPAK(col, 16);
@ -172,7 +138,7 @@ class RGBA {
/// @brief Get as Uint32
/// @return color
unsigned int toRGBA() const { return RGBA8(m_r, m_g, m_b, m_a); }
uint32_t toRGBA() const { return RGBA8(m_r, m_g, m_b, m_a); }
// Just calculate the "lightness" f.e. to use Text or Text2
float luminance() const {
@ -186,9 +152,8 @@ class RGBA {
return (luminance() >= 0.5);
}
unsigned char m_r = 0, m_g = 0, m_b = 0, m_a = 0;
uint8_t m_r, m_g, m_b, m_a;
};
std::string RGBA2Hex(unsigned int c32);
/// @brief Convert RGB to Hex
/// @param r
/// @param g
@ -199,6 +164,6 @@ std::string RGB2Hex(int r, int g, int b);
/// @param color
/// @param a
/// @return Color32
unsigned int Hex(const std::string &color, unsigned char a = 255);
uint32_t Hex(const std::string &color, uint8_t a = 255);
} // namespace Color
} // namespace RenderD7
} // namespace RenderD7

View File

@ -0,0 +1,51 @@
#pragma once
#include <citro2d.h>
#include <renderd7/Color.hpp>
#include <renderd7/R7Vec.hpp>
#include <renderd7/Image.hpp>
#include <string>
#define MAKEFLAG(x) (1 << x)
typedef unsigned int RD7TextFlags;
enum RD7TextFlags_ {
RD7TextFlags_None = 0, //< Align is Left and Other things are disabled
RD7TextFlags_AlignRight = MAKEFLAG(0),
RD7TextFlags_AlignMid = MAKEFLAG(1),
RD7TextFlags_Shaddow = MAKEFLAG(2), // TextBuf Killer lol (doubled Text)
RD7TextFlags_Wrap = MAKEFLAG(3),
RD7TextFlags_Short = MAKEFLAG(4),
RD7TextFlags_Scroll = MAKEFLAG(5),
};
namespace RenderD7 {
R7Vec2 GetTextDimensions(const std::string &text);
void CustomTextSize(float size);
void TextDefaultSize();
std::string TextShort(const std::string& in, int max_len);
// Overrite TextBox Size (by default Screenwidth x Text.h)
void TextMaxBox(R7Vec2 size);
void TextDefaultBox();
void TextFont(C2D_Font fnt);
void TextDefaultFont();
namespace Draw2 {
void Rect(R7Vec2 pos, R7Vec2 size, unsigned int color, int t = 1);
void RectFilled(R7Vec2 pos, R7Vec2 size, Color4 colors);
void RectFilledSolid(R7Vec2 pos, R7Vec2 size, unsigned int color);
// Wrapper of RectFilledSolid
inline void RFS(R7Vec2 pos, R7Vec2 size, unsigned int color) {
RectFilledSolid(pos, size, color);
}
void Line(R7Vec2 pos0, R7Vec2 pos1, unsigned int color, int t = 1);
void Triangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, Color3 colors);
void TriangleSolid(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, unsigned int color);
// Beta and Very unstable
void TriangleLined(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, unsigned int color,
int t = 1);
void Text(R7Vec2 pos, const std::string& text, RD7TextFlags flags = 0);
void Image(RenderD7::Image* img, const R7Vec2& pos = R7Vec2(0, 0), const R7Vec2& scale = R7Vec2(1, 1));
} // namespace Draw2
} // namespace RenderD7

View File

@ -3,16 +3,14 @@
#include <string>
namespace RenderD7 {
void Error(const std::string& msg);
inline void InlineError(const std::string& msg) {
std::string location = __FILE__ + std::string(":") + std::to_string(__LINE__);
Error("Error: \n" + location + "\n" + msg);
}
inline void InlineAssert(bool v, const std::string& msg) {
if (v == false) {
std::string location =
__FILE__ + std::string(":") + std::to_string(__LINE__);
Error("Assert Failed:\n" + location + "\n" + msg);
}
}
} // namespace RenderD7
void Error(const std::string& msg);
inline void InlineError(const std::string& msg) {
std::string location = __FILE__ + std::string(":") + std::to_string(__LINE__);
Error("Error: \n" + location + "\n" + msg);
}
inline void InlineAssert(bool v, const std::string& msg) {
std::string location = __FILE__ + std::string(":") + std::to_string(__LINE__);
if(v == false)
Error("Assert Failed:\n" + location + "\n" + msg);
}
}

View File

@ -18,7 +18,8 @@ struct Entry {
/// @return The Vector of found Entrys
std::vector<RenderD7::FileSystem::Entry> GetDirContent(std::string path);
std::string GetParentPath(std::string path, std::string mount_point);
std::vector<Entry> GetDirContentsExt(
std::string &path, const std::vector<std::string> &extensions);
} // namespace FileSystem
} // namespace RenderD7
std::vector<Entry>
GetDirContentsExt(std::string &path,
const std::vector<std::string> &extensions);
} // namespace FileSystem
} // namespace RenderD7

View File

@ -1,36 +0,0 @@
#pragma once
#include <citro2d.h>
#include <fstream>
#include <memory>
#include <renderd7/Error.hpp>
#include <renderd7/smart_ctor.hpp>
namespace RenderD7 {
class Font {
public:
Font() = default;
Font(const std::string& path) { Load(path); };
~Font() { Unload(); }
RD7_SMART_CTOR(Font)
void Load(const std::string& path) {
std::ifstream ft(path, std::ios::in | std::ios::binary);
bool io = ft.is_open();
ft.close();
RenderD7::InlineAssert(io, "File not Found!");
fnt = C2D_FontLoad(path.c_str());
RenderD7::InlineAssert(fnt, "Font could not be loaded!");
}
C2D_Font Ptr() { return fnt; }
void Unload() {
if (!fnt) return;
C2D_FontFree(fnt);
fnt = nullptr;
}
private:
C2D_Font fnt = nullptr;
};
} // namespace RenderD7

View File

@ -2,8 +2,9 @@
// Base includes
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
// 3ds does not support std::chrono
#include <3ds.h>
@ -17,14 +18,13 @@ namespace RenderD7 {
namespace Ftrace {
/// @brief Result of FTrace
struct FTRes {
std::string group; ///< Group of the Trace
std::string func_name; ///< Function Name
std::string group; ///< Group of the Trace
std::string func_name; ///< Function Name
uint64_t time_start; ///< when started
uint64_t time_end; ///< when stopped
float time_of; ///< stop - start (how long)
float time_ofm; ///< max time off
bool is_ovl; ///< is displayed in overlay?
uint64_t time_start; ///< when started
uint64_t time_end; ///< when stopped
float time_of; ///< stop - start (how long)
bool is_ovl; ///< is displayed in overlay?
};
/// @brief Map of Traces
@ -33,44 +33,21 @@ extern std::map<std::string, RenderD7::Ftrace::FTRes> rd7_traces;
/// @brief Set a Start TracePoint
/// @param group Set a Group Name
/// @param func_name Set a Function Name
inline void Beg(const std::string& group, const std::string& func_name) {
inline void Beg(std::string group, std::string func_name) {
std::string trace_id = scomb(group, func_name);
auto& trace = rd7_traces[trace_id];
trace.group = group;
trace.func_name = func_name;
trace.time_start = svcGetSystemTick();
rd7_traces[trace_id].group = group;
rd7_traces[trace_id].func_name = func_name;
rd7_traces[trace_id].time_start = svcGetSystemTick();
}
/// @brief Set an End TracePoint
/// @param group Set a Group Name
/// @param func_name Set a Function Name
inline void End(const std::string& group, const std::string& func_name) {
inline void End(std::string group, std::string func_name) {
std::string trace_id = scomb(group, func_name);
auto& trace = rd7_traces[trace_id];
trace.time_end = svcGetSystemTick();
if (trace.time_of > trace.time_ofm) trace.time_ofm = trace.time_of;
trace.time_of =
static_cast<float>(trace.time_end - trace.time_start) / TICKS_PER_MSEC;
rd7_traces[trace_id].time_end = svcGetSystemTick();
rd7_traces[trace_id].time_of = static_cast<float>(
rd7_traces[trace_id].time_end / (float)TICKS_PER_MSEC -
rd7_traces[trace_id].time_start / (float)TICKS_PER_MSEC);
}
/// @brief Trace a function execution
/// @param group Set a Group Name
/// @param name Set a Function Name
inline void Func(const std::string& group, const std::string& name,
std::function<void()> fun) {
if (!fun) return;
Beg(group, name);
fun();
End(group, name);
}
/// @brief This Starts an Ftrace and
/// end ist when going out of scope
struct ScopedTrace {
ScopedTrace(std::string g, std::string n) : group(g), name(n) {
Ftrace::Beg(g, n);
}
~ScopedTrace() { Ftrace::End(group, name); }
std::string group;
std::string name;
};
} // namespace Ftrace
} // namespace RenderD7
} // namespace Ftrace
} // namespace RenderD7

View File

@ -11,16 +11,13 @@ bool IsHeadphones();
/// @return true if System gets Charged
bool IsCharging();
/// @brief Check the Battery Percentage
/// @return Persentage as int
int GetBatteryPercentage();
/// @return Persentage as float
float GetBatteryPercentage();
/// @brief Get current State of 3d Slider
/// @return current 3dslider poition
float Get3dSliderLevel();
/// @brief Get Current state of Sound Slider
/// @return current SoundSlider state
float GetSoundSliderLevel();
/// @brief Get Current Wifi Level
/// @return current wifi level
int GetWifiLevel();
} // namespace Hardware
} // namespace RenderD7
} // namespace Hardware
} // namespace RenderD7

View File

@ -1,7 +1,7 @@
// WARNING
// THIS IS BETA STUFF
// ITS MAKE LIKE EXTERNAL BUT
// FOR RENDERD7 ITS INTEGRATED
/// WARNING
/// THIS IS BETA STUFF
/// ITS MAKE LIKE EXTERNAL BUT
/// FOR RENDERD7 ITS INTEGRATED
#pragma once
@ -32,11 +32,10 @@ void RegKeyEvent(const std::string &event, uint32_t key);
bool IsEvent(const std::string &event, Actions action);
R7Vec2 GetTouchPosition();
R7Vec2 GetLastTouchPosition();
R7Vec2 GetTouchDownPosition();
void Update();
// Lock/Unlock Input api for example for Keyboard
void Lock();
void Unlock();
void Clear();
} // namespace Hid
} // namespace RenderD7
} // namespace Hid
} // namespace RenderD7

View File

@ -1,33 +1,30 @@
#pragma once
#include <3ds.h>
#include <citro2d.h>
#include <3ds.h>
#include <renderd7/R7Vec.hpp>
#include <renderd7/nimg.hpp>
#include <renderd7/smart_ctor.hpp>
#include <string>
namespace RenderD7 {
class Image {
public:
Image() = default;
Image(C2D_Image img) { this->img = img; }
Image(const std::string& path) { this->Load(path); }
~Image() = default;
RD7_SMART_CTOR(Image)
void Load(const std::string& path);
void From_NIMG(const nimg& image);
void Delete();
class Image {
public:
Image();
~Image();
void load(const std::string& path);
void from_nimg(const nimg& image);
C2D_Image Get();
C2D_Image& GetRef();
void Set(const C2D_Image& i);
R7Vec2 GetSize();
bool Loadet();
C2D_Image get();
C2D_Image& get_ref();
void set(const C2D_Image& i);
R7Vec2 get_size();
bool loaded();
private:
bool ext = false;
C2D_Image img;
};
} // namespace RenderD7
private:
void safe_del();
bool ld = false;
C2D_Image img;
};
}

View File

@ -1,15 +0,0 @@
#pragma once
#include <string>
namespace RenderD7 {
struct InstallerInfo {
unsigned long long total;
unsigned long long current;
unsigned int mem_size = 0x80000;
bool active = false;
};
Result InstallCia(const std::string& path, bool self);
void InstallSetBuffersSize(unsigned int bytes);
InstallerInfo InstallGetInfo();
} // namespace RenderD7

View File

@ -1,35 +0,0 @@
#pragma once
#include <fstream>
#include <renderd7/smart_ctor.hpp>
#include <string>
#include <vector>
namespace RenderD7 {
/// @brief Logger base Class
class LoggerBase {
public:
/// @brief Constructor
LoggerBase() = default;
/// @brief Deconstructor
~LoggerBase();
RD7_SMART_CTOR(LoggerBase)
/// @brief Init the Logger
/// @param filename name[_date_time.txt]
void Init(const std::string& name, bool fileless = false);
/// @brief Write a String
/// @param debug_text string
/// @param lvl Logger LVL 0 = ERR, 1 =WARNING, >=2= Default
void Write(const std::string& debug_text, int lvl = 2);
void SetLvl(int lvl) { writelvl = lvl; }
const std::vector<std::string>& Lines();
private:
/// \param filename the name of the logfile
std::string filename;
std::string log_path;
std::ofstream _log;
int writelvl = 1; // Only log errors/Warnings
std::vector<std::string> lines;
};
} // namespace RenderD7

View File

@ -1,13 +1,14 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <memory>
namespace RenderD7 {
namespace Memory {
/// @brief Metriks struct For the Internal Tracker
struct memory_metrics {
uint32_t t_TotalAllocated = 0; ///< Total Allocated Memory
uint32_t t_TotalFreed = 0; ///< Total Deleted Memory
uint32_t t_TotalAllocated = 0; ///< Total Allocated Memory
uint32_t t_TotalFreed = 0; ///< Total Deleted Memory
/// @brief Gets the Currently Allocated Memory
uint32_t t_CurrentlyAllocated() { return t_TotalAllocated - t_TotalFreed; }
};
@ -20,5 +21,5 @@ size_t GetTotalFreed();
/// @brief Get Current Allocated Memory
/// @return Current Allocated Memory
size_t GetCurrent();
} // namespace Memory
} // namespace RenderD7
} // namespace Memory
} // namespace RenderD7

View File

@ -3,25 +3,22 @@
#include <string>
namespace RenderD7 {
struct Message {
Message(std::string t, std::string m) {
title = t;
message = m;
animationframe = 0;
}
struct Message {
Message(std::string t, std::string m) {
title = t;
message = m;
animationframe = 0;
}
std::string title;
std::string message;
int animationframe;
};
std::string title;
std::string message;
int animationframe;
};
void ProcessMessages();
void PushMessage(const Message& msg);
inline void PushMessage(const std::string& head, const std::string& msg) {
PushMessage(Message(head, msg));
}
// Config
void SetMessageIdleStartFrame(int frame);
void SetMessageTotalAnimationFrames(int total_frames);
void SetMessageFadeOutStartFrame(int frame);
} // namespace RenderD7
void ProcessMessages();
void PushMessage(const Message& msg);
// Config
void SetMessageIdleStartFrame(int frame);
void SetMessageTotalAnimationFrames(int total_frames);
void SetMessageFadeOutStartFrame(int frame);
}

View File

@ -1,42 +0,0 @@
#pragma once
#include <renderd7/external/json.hpp>
#include <string>
namespace RenderD7 {
namespace Net {
// Define List of Errors
enum Error_ {
Error_None, // Function Executed Successfully
Error_Memory, // Memory Allocation Error
Error_Write, // Unable to Write File
Error_StatusCode, // Error with Status Code
Error_Git, // Git Error
Error_CtrStatus, // 3ds Result Code
Error_Curl, // Curl Error
Error_Busy, // Another Download Taskl is already running
Error_Invalid, // Invalid Json struct
Error_NoWifi, // Console not connected to wifi
};
// Set an typedefine for Error code
using Error = unsigned long long;
// Extract Error_ from Error code
inline Error_ ErrorCode(Error err) {
return static_cast<Error_>(static_cast<unsigned int>(err & 0xffffffff));
}
// Extract Http Status code, Curl Error Code or Ctr Result Code
inline int StatusCode(Error err) {
Error_ c = ErrorCode(err);
if (c != Error_StatusCode && c != Error_CtrStatus && c != Error_Curl)
return 0;
return static_cast<unsigned int>(err >> 32);
}
Error Download(const std::string& url, std::string& data);
Error Download2File(const std::string& url, const std::string& path);
Error GitDownloadRelease(const std::string& url, const std::string& asset_name,
const std::string& path, bool prerelease = false);
Error JsonApiRequest(const std::string& api_url, nlohmann::json& res);
unsigned long long GetProgressCurrent();
unsigned long long GetProgressTotal();
} // namespace Net
} // namespace RenderD7

View File

@ -3,6 +3,46 @@
#include <renderd7/Ovl.hpp>
#include <string>
namespace RenderD7 {
class Ovl_Ftrace : public RenderD7::Ovl {
public:
/// @brief Constructor
Ovl_Ftrace(bool* is_enabled);
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
bool* i_is_enabled;
};
class Ovl_Metrik : public RenderD7::Ovl {
public:
/// @brief Constructor
Ovl_Metrik(bool* is_enabled, bool* screen, uint32_t* mt_color, uint32_t* txt_color, float* txt_size);
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
// Mutable internal values
mutable std::string mt_fps;
mutable std::string mt_cpu;
mutable std::string mt_gpu;
mutable std::string mt_cmd;
mutable std::string mt_lfr;
mutable std::string mt_tbs;
// Importand Adresses
bool* i_is_enabled;
bool* i_screen;
uint32_t* i_mt_color;
uint32_t* i_txt_color;
float* i_txt_size;
};
typedef int RD7Keyboard;
enum RD7Keyboard_ {
@ -11,60 +51,11 @@ enum RD7Keyboard_ {
RD7Keyboard_Password,
};
enum RD7KeyboardState {
RD7KeyboardState_None = 0,
RD7KeyboardState_Cancel = 1,
RD7KeyboardState_Confirm = 2,
};
namespace RenderD7 {
class Ovl_Ftrace : public RenderD7::Ovl {
public:
/// @brief Constructor
Ovl_Ftrace(bool* is_enabled);
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
bool* i_is_enabled;
};
class Ovl_Metrik : public RenderD7::Ovl {
public:
/// @brief Constructor
Ovl_Metrik(bool* is_enabled, bool* screen, uint32_t* mt_color,
uint32_t* txt_color, float* txt_size);
/// @brief Override for Draw
void Draw(void) const override;
/// @brief Override for Logic
void Logic() override;
private:
// Mutable internal values
mutable std::string mt_fps;
mutable std::string mt_cpu;
mutable std::string mt_gpu;
mutable std::string mt_cmd;
mutable std::string mt_lfr;
mutable std::string mt_tbs;
mutable std::string mt_mem;
// Importand Adresses
bool* i_is_enabled;
bool* i_screen;
uint32_t* i_mt_color;
uint32_t* i_txt_color;
float* i_txt_size;
};
class Ovl_Keyboard : public RenderD7::Ovl {
public:
public:
/// @brief Constructor
/// Keyboard Type not Supported for now
Ovl_Keyboard(std::string& ref, RD7KeyboardState& state,
const std::string& hint = "", RD7Keyboard type = 0);
Ovl_Keyboard(std::string& ref, const std::string& hint = "", RD7Keyboard type = 0);
/// @brief Deconstructor
~Ovl_Keyboard();
/// @brief Override for Draw
@ -72,14 +63,12 @@ class Ovl_Keyboard : public RenderD7::Ovl {
/// @brief Override for Logic
void Logic() override;
private:
mutable std::map<unsigned char, char> shared_data;
// Pointer to useres String
std::string* typed_text = nullptr;
std::string str_bak;
RD7KeyboardState* state;
RD7Keyboard type;
int mode = 0;
int ft3 = 0;
private:
mutable std::map<unsigned char, char> shared_data;
// Pointer to useres String
std::string *typed_text = nullptr;
std::string str_bak;
int mode = 0;
int ft3 = 0;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,11 +1,10 @@
#pragma once
#include <map>
#include <memory>
namespace RenderD7 {
/// @brief The Overlay Class (Used for Toasts for example)
class Ovl {
public:
public:
/// @brief Deconstructor
virtual ~Ovl() {}
/// @brief Function Called to Draw this
@ -18,11 +17,11 @@ class Ovl {
/// @brief Kill The Overlay
inline void Kill() { iskilled = true; }
private:
private:
/// @param iskilled For IsKilled();
bool iskilled = false;
};
/// @brief Add an Overlay to the Screen
/// @param scene Overlay to push to Screen
void AddOvl(std::unique_ptr<RenderD7::Ovl> scene);
} // namespace RenderD7
} // namespace RenderD7

View File

@ -16,7 +16,7 @@ struct R7Vec2 {
y += i.y;
return *this;
}
R7Vec2 operator+(const R7Vec2 &i) const { return R7Vec2(x + i.x, y + i.y); }
// Sub
@ -39,66 +39,4 @@ struct R7Vec2 {
// Internal Values
float x;
float y;
};
struct R7Vec4 {
// Init Funcs
R7Vec4() : x(0), y(0), z(0), w(0) {}
R7Vec4(float i0, float i1, float i2, float i3) : x(i0), y(i1), z(i2), w(i3) {}
R7Vec4(const R7Vec4 &i) {
x = i.x;
y = i.y;
z = i.z;
w = i.w;
}
R7Vec4(const R7Vec2 &i0, const R7Vec2 &i1) {
x = i0.x;
y = i0.y;
z = i1.x;
w = i1.y;
}
// Operators
// Add
R7Vec4 &operator+=(const R7Vec4 &i) {
x += i.x;
y += i.y;
z += i.z;
w += i.w;
return *this;
}
R7Vec4 operator+(const R7Vec4 &i) const {
return R7Vec4(x + i.x, y + i.y, z + i.z, w + i.w);
}
// Sub
R7Vec4 &operator-=(const R7Vec4 &i) {
x -= i.x;
y -= i.y;
z -= i.z;
w -= i.w;
return *this;
}
R7Vec4 operator-(const R7Vec4 &i) const {
return R7Vec4(x - i.x, y - i.y, z - i.z, w - i.w);
}
// Compare
bool operator==(const R7Vec4 &in) const {
return x == in.x && y == in.y && z == in.z && w == in.w;
}
bool operator!=(const R7Vec4 &in) const {
// use the first comparefuncs result
// and swap it lol
return !(*this == in);
}
// Internal Values
float x;
float y;
float z;
float w;
};

View File

@ -1,97 +0,0 @@
#pragma once
#include <map>
#include <renderd7/Color.hpp>
#include <renderd7/Font.hpp>
#include <renderd7/Image.hpp>
#include <renderd7/R7Vec.hpp>
#include <renderd7/Sprite.hpp>
#include <renderd7/smart_ctor.hpp>
#define MAKEFLAG(x) (1 << x)
typedef unsigned int RD7TextFlags;
enum RD7TextFlags_ {
RD7TextFlags_None = 0, //< Align is Left and Other things are disabled
RD7TextFlags_AlignRight = MAKEFLAG(0),
RD7TextFlags_AlignMid = MAKEFLAG(1),
RD7TextFlags_Shaddow = MAKEFLAG(2), // TextBuf Killer lol (doubled Text)
RD7TextFlags_Wrap = MAKEFLAG(3),
RD7TextFlags_Short = MAKEFLAG(4),
RD7TextFlags_Scroll = MAKEFLAG(5),
};
enum R2Screen {
R2Screen_Bottom,
R2Screen_Top,
// TopRight,
};
namespace RenderD7 {
class R2 {
public:
struct R2Cmd {
R7Vec2 pos; //< Position
R7Vec2 pszs; //< Position or (TextBox) Size
R7Vec2 ap; //< Additional Pos
unsigned int clr; //< Color
bool Screen; //< TopScreen
Image::Ref img; //< Image Reference
Sprite::Ref spr; //< Sprite Reference
// 0 = skip, 1 = rect, 2 = tri, 3 = text,
// 4 = image, 5 = sprite, 6 = Line
int type; //< Command Type
bool lined = false; //< Draw Lined Rect/Tri
// Text Specific
RD7TextFlags flags; // Text Flags
std::string text; // Text
RD7_SMART_CTOR(R2Cmd)
};
R2() = default;
~R2() = default;
static void Init();
// Settings
static void SetFont(Font::Ref fnt);
static Font::Ref GetFont();
static void DefaultFont();
static void DrawNextLined();
static void OnScreen(R2Screen screen);
static R2Screen GetCurrentScreen();
static void SetTextSize(float szs);
static void DefaultTextSize();
static float GetTextSize();
static R7Vec2 GetCurrentScreenSize();
// Processing
static void Process();
static R7Vec2 GetTextDimensions(const std::string& text);
static std::string WrapText(const std ::string& in, int maxlen);
static std::string ShortText(const std::string& in, int maxlen);
// Draw Functions
static void AddRect(R7Vec2 pos, R7Vec2 size, RD7Color clr);
static void AddRect(R7Vec2 pos, R7Vec2 size, unsigned int clr);
static void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr);
static void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2,
unsigned int clr);
static void AddText(R7Vec2 pos, const std::string& text, RD7Color clr,
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
static void AddText(R7Vec2 pos, const std::string& text, unsigned int clr,
RD7TextFlags flags = 0, R7Vec2 tmb = R7Vec2());
static void AddImage(R7Vec2 pos, Image::Ref img);
static void AddSprite(Sprite::Ref spr);
static void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, RD7Color clr, int t = 1);
static void AddLine(R7Vec2 pos_a, R7Vec2 pos_b, unsigned int clr, int t = 1);
private:
static const float default_text_size;
static float text_size;
static Font::Ref font;
static std::map<std::string, float> ts;
static std::map<std::string, int> mln;
static bool next_lined;
static std::vector<R2Cmd::Ref> commands;
static R2Screen current_screen;
};
} // namespace RenderD7

View File

@ -1,12 +1,11 @@
#pragma once
#include <3ds.h>
#include <string>
namespace RenderD7 {
/// @brief Decoder for 3ds Result Codes
class ResultDecoder {
public:
public:
/// @brief Constructor
ResultDecoder() {}
/// @brief Deconstructor
@ -47,8 +46,8 @@ class ResultDecoder {
/// @brief Write a Result log file to sd
void WriteLog(void);
private:
private:
/// @param m_rescode Result code
Result m_rescode;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -0,0 +1,16 @@
#pragma once
#include <citro2d.h>
#include <citro3d.h>
/// \param Top Tob-Screen Target
extern C3D_RenderTarget *Top;
/// \param TopRight Top-Right-Screen Target (Never atually used)
extern C3D_RenderTarget *TopRight;
/// \param Bottom Bottom-Screen Target
extern C3D_RenderTarget *Bottom;
namespace RenderD7 {
/// @brief Begin Drawing On Specific Screen
/// @param target The Screen Target (Top, Bottom or TopTight)
void OnScreen(C3D_RenderTarget *target);
} // namespace RenderD7

View File

@ -0,0 +1,60 @@
#pragma once
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
#include <3ds.h>
namespace RenderD7 {
namespace Init {
void Security();
}
class Security {
public:
/// @brief Security Levels
enum Level {
NONE, ///< Do Completly Nothing (excludes FrameEnd Security)
FULL, ///< Display Every Reports even Success
ERRORS, ///< Display Only Errors
WARNINGS, ///< Display Errors and Warnings
LOG, ///< Log Every Error with Detailed Information
};
Security();
~Security();
/// @brief Report an Output (For SafeTraceInit)
/// @param addr Adress of Pointer
/// @param result_ptr Pointer to the result
void Report(uint32_t addr, void *result_ptr);
/// @brief Set the Security Level
/// @param level Level to use
void SetLevel(Level level);
/// @brief Get Current Security Level
/// @return Security Level
Level GetLevel();
/// @brief Call a Function at Program Crash/Exit
/// @param exit_func Function to Call
void SafeExit(void (*exit_func)());
/// @brief SaveInit a Function and define a Exit Func
/// @param init_func Init Function
/// @param exit_func Exit Function
void SafeInit(void (*init_func)(), void (*exit_func)());
/// @brief SaveInit a Function and define a Exit Func
/// @param init_func Init Function
/// @param exit_func Exit Function
void SafeInit(Result (*init_func)(), void (*exit_func)());
/// @brief SaveInit a Function and define a Exit Func
/// @param init_func Init Function
/// @param exit_func Exit Function
void SafeInit(void (*init_func)(), Result (*exit_func)());
/// @brief SaveInit a Function and define a Exit Func
/// @param init_func Init Function
/// @param exit_func Exit Function
void SafeInit(Result (*init_func)(), Result (*exit_func)());
};
} // namespace RenderD7
/// @brief RenderD7 Security Object
extern RenderD7::Security *rd7_security;

View File

@ -1,35 +1,24 @@
#pragma once
#include <3ds.h> // Result
#include <citro2d.h>
#include <citro3d.h>
#include <renderd7/Image.hpp>
#include <renderd7/smart_ctor.hpp>
#include <3ds.h> // Result
#include <string>
namespace RenderD7 {
/// @brief SpriteSheet Class
class Sheet {
public:
public:
/// @brief Constructor
Sheet() = default;
Sheet(const std::string& path) { this->Load(path); }
Sheet();
/// @brief Deconstructor
~Sheet() {
if (spritesheet) Free();
}
RD7_SMART_CTOR(Sheet);
~Sheet();
/// @brief Load A Spritesheet File
/// @param path Path to the t3x
/// @return Result Code
Result Load(const std::string& path);
/// @brief Unload the Sheet
void Free();
C2D_Image GetImage(int idx);
C2D_SpriteSheet Get() { return this->spritesheet; }
private:
/// \param spritesheet The Sheet
C2D_SpriteSheet spritesheet;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -5,24 +5,22 @@
#include <renderd7/Image.hpp>
#include <renderd7/Sheet.hpp>
#include <renderd7/smart_ctor.hpp>
namespace RenderD7 {
/// @brief Sprite Class
class Sprite {
public:
public:
/// \brief Construct Sprite
Sprite() = default;
Sprite();
/// \brief Deconstruct Sprite
~Sprite() = default;
RD7_SMART_CTOR(Sprite)
~Sprite();
/// \brief Load a Sprite From SpriteSheet
/// \param sheet the Sheet to load from.(RenderD7::Sheet)
/// \param index the number of the Sprite in the Sheet
void FromSheet(RenderD7::Sheet::Ref sheet, size_t index);
void FromSheet(RenderD7::Sheet *sheet, size_t index);
/// \brief Load a Sprite From SpriteSheet
/// \param img the Image to load from.(RenderD7::Image)
void FromImage(RenderD7::Image::Ref img);
void FromImage(RenderD7::Image *img);
/// @brief Draw the Sprite
/// @return success ?
bool Draw();
@ -46,26 +44,21 @@ class Sprite {
void Rotate(float speed);
/// @brief Get Tje Sprite's Width
/// @return Width
float GetWidth();
float getWidth();
/// @brief Get the Sprite's Height
/// @return Height
float GetHeight();
float getHeight();
/// @brief Get The Sprite's X Position
/// @return X Position
float GetPosX();
float getPosX();
/// @brief Get the Sprite's Y Position
/// @return Y Position
float GetPosY();
R7Vec2 GetSize();
R7Vec2 GetPos();
void SetPos(R7Vec2 pos);
void SetScale(R7Vec2 scale);
void SetRotCenter(R7Vec2 percentage);
float getPosY();
private:
private:
/// @param tint ImageTint (unused)
C2D_ImageTint tint;
/// @param sprite The Sprite
C2D_Sprite sprite;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,34 +1,32 @@
#pragma once
#include <renderd7/Sheet.hpp>
#include <renderd7/Sprite.hpp>
#include <citro2d.h>
#include <citro3d.h>
#include <renderd7/Sheet.hpp>
#include <renderd7/Sprite.hpp>
#include <renderd7/smart_ctor.hpp>
namespace RenderD7 {
/// @brief SpriteSheetAnimation Class
class SpriteSheetAnimation : public RenderD7::Sprite {
public:
public:
/// @brief Constructor
SpriteSheetAnimation() = default;
SpriteSheetAnimation();
/// @brief Deconstructor
~SpriteSheetAnimation() = default;
RD7_SMART_CTOR(SpriteSheetAnimation);
~SpriteSheetAnimation();
/// @brief Setup an Animation
/// @param sheet Input Spritesheet
/// @param imagecount Count of Images
/// @param startimage Where to Start the Loop
/// @param frame_begin Current Time (Should be 0)
/// @param frame_finish Time Length
void Setup(RenderD7::Sheet::Ref sheet, size_t imagecount, size_t startimage,
void Setup(RenderD7::Sheet *sheet, size_t imagecount, size_t startimage,
float frame_begin, float frame_finish);
/// @brief Play the Animation
/// @param timespeed Speed of the animation
void Play(float timespeed);
private:
private:
/// @param images Count of Images
size_t images;
/// @param imgs Another Count of images ???
@ -36,8 +34,8 @@ class SpriteSheetAnimation : public RenderD7::Sprite {
/// @param D_totaltime Current Time
float D_totaltime;
/// @param sheet The Sheet of Images
RenderD7::Sheet::Ref sheet;
RenderD7::Sheet *sheet;
/// @param time Total Time from frame_finish
float time;
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -0,0 +1,21 @@
#pragma once
#include <sstream>
#include <string>
namespace RenderD7 {
/// @brief StealConsole Class
class StealConsole {
public:
/// @brief Constructor
StealConsole();
/// @brief Deconstructor
~StealConsole();
/// @brief The Stolen Stdout
/// @return Stdout as string
std::string GetStdout();
private:
/// @param stolen_stdout Stolen Stdout
std::stringstream stolen_stdout;
};
} // namespace RenderD7

View File

@ -1,13 +1,13 @@
#pragma once
#include <functional>
#include <3ds.h>
#include <vector>
namespace RenderD7 {
namespace Tasks {
/// @brief Push A Task
/// @param fun Function of Your Task
/// @return index
int Create(std::function<void()> fun);
/// @param entrypoint Function of Your Task
void create(ThreadFunc entrypoint);
/// @brief Destroy all Tasks
void DestroyAll();
} // namespace Tasks
} // namespace RenderD7
void destroy(void);
} // namespace Tasks
} // namespace RenderD7

View File

@ -1,29 +0,0 @@
#pragma once
#include <renderd7/renderd7.hpp>
namespace RenderD7 {
class ThemeEditor : public RenderD7::Scene {
public:
ThemeEditor();
~ThemeEditor();
void Draw(void) const override;
void Logic() override;
private:
Theme::Ref edit_theme;
// Placeholder to save active one to
Theme::Ref temp_theme;
// temp vars for samples
mutable bool cm;
mutable std::string inpt;
mutable int menu = 0;
// Keyboard
mutable RD7KeyboardState kbd_state;
mutable std::string kbd_text;
mutable std::vector<std::string> theme_list;
};
} // namespace RenderD7

View File

@ -10,4 +10,4 @@ std::string FormatString(std::string fmt_str, ...);
/// @brief Get Current Time as String
/// @return Time-String
std::string GetTimeStr(void);
} // namespace RenderD7
} // namespace RenderD7

View File

@ -2,25 +2,21 @@
#include <3ds.h>
#include <renderd7/smart_ctor.hpp>
namespace RenderD7 {
class Timer {
public:
Timer(bool autostart = true);
~Timer() {}
RD7_SMART_CTOR(Timer)
void Reset();
void Tick();
void Pause();
void Resume();
float Get();
float GetLive();
bool Running();
private:
uint64_t last = 0;
uint64_t current = 0;
bool is_running = false;
};
} // namespace RenderD7
class Timer {
public:
Timer(bool autostart = true);
~Timer() {}
void reset();
void tick();
void pause();
void resume();
float get();
float get_live();
bool running();
private:
uint64_t last = 0;
uint64_t current = 0;
bool is_running = false;
};
}

View File

@ -1,9 +1,10 @@
#pragma once
#include <renderd7/Image.hpp>
#include <algorithm>
#include <renderd7/R7Vec.hpp>
#include <renderd7/Render2.hpp>
#include <renderd7/smart_ctor.hpp>
#include <renderd7/DrawV2.hpp>
#include <string>
#include <vector>
// UI7: The new RenderD7 UI Standart based on
// Draw2 (based on Citro2D)
@ -16,34 +17,6 @@ enum UI7MenuFlags_ {
UI7MenuFlags_None = 0,
UI7MenuFlags_NoTitlebar = UI7MAKEFLAG(0),
UI7MenuFlags_TitleMid = UI7MAKEFLAG(1),
UI7MenuFlags_Scrolling = MAKEFLAG(2),
};
class DrawCmd;
class UI7DrawList {
public:
UI7DrawList() = default;
~UI7DrawList() = default;
void AddRectangle(R7Vec2 pos, R7Vec2 szs, RD7Color clr);
void AddRectangle(R7Vec2 pos, R7Vec2 szs, unsigned int clr);
void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, RD7Color clr);
void AddTriangle(R7Vec2 pos0, R7Vec2 pos1, R7Vec2 pos2, unsigned int clr);
void AddText(R7Vec2 pos, const std::string &text, RD7Color clr,
RD7TextFlags flags = 0, R7Vec2 box = R7Vec2());
void AddText(R7Vec2 pos, const std::string &text, unsigned int clr,
RD7TextFlags flags = 0, R7Vec2 box = R7Vec2());
void AddImage(R7Vec2 pos, RenderD7::Image::Ref img);
void AddCall(std::shared_ptr<DrawCmd> cmd);
void Process(bool auto_clear = true);
void Clear();
RD7_SMART_CTOR(UI7DrawList)
private:
void AddDebugCall(std::shared_ptr<DrawCmd> cmd);
std::vector<std::shared_ptr<DrawCmd>> list;
};
namespace UI7 {
@ -53,11 +26,6 @@ void Deinit();
void Update();
float GetTime();
float GetDeltaTime();
bool &IsDebugging();
// Internal Function
// Should not be used
void Debug();
bool &DebugMenu();
bool Button(const std::string &label, R7Vec2 size = R7Vec2(0, 0));
void Checkbox(const std::string &label, bool &c);
@ -65,41 +33,17 @@ void Label(const std::string &label, RD7TextFlags flags = 0);
void Progressbar(float value);
/// @brief Draw Image in Menu
/// @param img Pointer f.e to RenderD7::Image2
void Image(RenderD7::Image::Ref img);
void BrowserList(const std::vector<std::string> &entrys, int &selection,
RD7TextFlags txtflags = 0, R7Vec2 size = R7Vec2(0, 0),
int max_entrys = 13);
void Image(RenderD7::Image* img);
void BrowserList(const std::vector<std::string> &entrys, int &selection, RD7TextFlags txtflags = 0,
R7Vec2 size = R7Vec2(0, 0), int max_entrys = 13);
void InputText(const std::string &label, std::string &text,
const std::string &hint = "");
bool BeginMenu(const std::string &title, R7Vec2 size = R7Vec2(0, 0),
UI7MenuFlags flags = 0);
void EndMenu();
void Grid(const std::string &name, const R7Vec2 &size, const R7Vec2 &entry_size,
void (*display_func)(void *, R7Vec2), void **data_array,
size_t num_entrys);
void ColorSelector(const std::string &label, unsigned int &color);
bool BeginTree(const std::string &text);
void EndTree();
void Grid(const std::string& name, const R7Vec2 &size, R7Vec2(*display_func)(void*, R7Vec2), void**data_array, size_t num_entrys);
R7Vec2 GetCursorPos();
void SetCursorPos(R7Vec2 cp);
void RestoreCursor();
void SameLine();
// Internal API (For Creating Custom Objects)
bool InBox(R7Vec2 inpos, R7Vec2 boxpos, R7Vec2 boxsize);
void MoveCursor(R7Vec2 size);
bool HandleScrolling(R7Vec2 &pos, R7Vec2 size);
bool InMenu();
namespace Menu {
// All of them return the Main BG DrawList if Menu is null
UI7DrawList::Ref GetBackgroundList();
UI7DrawList::Ref GetList();
UI7DrawList::Ref GetForegroundList();
// Other Menu Specific Functions
float GetScrollingOffset();
void SetScrollingOffset(float off);
bool IsScrolling();
} // namespace Menu
// DrawLists
UI7DrawList::Ref GetForegroundList();
UI7DrawList::Ref GetBackgroundList();
} // namespace UI7
} // namespace UI7

12532
include/renderd7/external/dr_flac.h vendored Normal file

File diff suppressed because it is too large Load Diff

8668
include/renderd7/external/dr_wav.h vendored Normal file

File diff suppressed because it is too large Load Diff

2114
include/renderd7/external/lodepng.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +1,7 @@
#pragma once
#include <renderd7/external/json.hpp>
#include <renderd7/renderd7.hpp>
namespace RenderD7 {
namespace IDB {
void Start();
void Stop();
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,
};
#include <renderd7/external/json.hpp>
// Outdated HidApi (HidV2Patched)
extern u32 d7_hDown;
@ -27,12 +10,19 @@ extern u32 d7_hUp;
extern u32 d7_hRepeat; // Inofficial lol
extern touchPosition d7_touch;
// Outdated Screens
extern C3D_RenderTarget *Top;
extern C3D_RenderTarget *TopRight;
extern C3D_RenderTarget *Bottom;
// 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;

545
include/renderd7/ini.hpp Normal file
View File

@ -0,0 +1,545 @@
#ifndef INI_INI_H_
#define INI_INI_H_
#include <algorithm>
#include <cctype>
#include <fstream>
#include <memory>
#include <sstream>
#include <string>
#include <sys/stat.h>
#include <unordered_map>
#include <utility>
#include <vector>
namespace INI {
namespace INIStringUtil {
const char *const whitespaceDelimiters = " \t\n\r\f\v";
inline void trim(std::string &str) {
str.erase(str.find_last_not_of(whitespaceDelimiters) + 1);
str.erase(0, str.find_first_not_of(whitespaceDelimiters));
}
#ifndef INI_CASE_SENSITIVE
inline void toLower(std::string &str) {
std::transform(str.begin(), str.end(), str.begin(), [](const char c) {
return static_cast<const char>(std::tolower(c));
});
}
#endif
inline void replace(std::string &str, std::string const &a,
std::string const &b) {
if (!a.empty()) {
std::size_t pos = 0;
while ((pos = str.find(a, pos)) != std::string::npos) {
str.replace(pos, a.size(), b);
pos += b.size();
}
}
}
#ifdef _WIN32
const char *const endl = "\r\n";
#else
const char *const endl = "\n";
#endif
}; // namespace INIStringUtil
template <typename T> class INIMap {
private:
using T_DataIndexMap = std::unordered_map<std::string, std::size_t>;
using T_DataItem = std::pair<std::string, T>;
using T_DataContainer = std::vector<T_DataItem>;
using T_MultiArgs = typename std::vector<std::pair<std::string, T>>;
T_DataIndexMap dataIndexMap;
T_DataContainer data;
inline std::size_t setEmpty(std::string &key) {
std::size_t index = data.size();
dataIndexMap[key] = index;
data.emplace_back(key, T());
return index;
}
public:
using const_iterator = typename T_DataContainer::const_iterator;
INIMap() {}
INIMap(INIMap const &other) {
std::size_t data_size = other.data.size();
for (std::size_t i = 0; i < data_size; ++i) {
auto const &key = other.data[i].first;
auto const &obj = other.data[i].second;
data.emplace_back(key, obj);
}
dataIndexMap = T_DataIndexMap(other.dataIndexMap);
}
T &operator[](std::string key) {
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
bool hasIt = (it != dataIndexMap.end());
std::size_t index = (hasIt) ? it->second : setEmpty(key);
return data[index].second;
}
T get(std::string key) const {
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it == dataIndexMap.end()) {
return T();
}
return T(data[it->second].second);
}
bool has(std::string key) const {
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
return (dataIndexMap.count(key) == 1);
}
void set(std::string key, T obj) {
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it != dataIndexMap.end()) {
data[it->second].second = obj;
} else {
dataIndexMap[key] = data.size();
data.emplace_back(key, obj);
}
}
void set(T_MultiArgs const &multiArgs) {
for (auto const &it : multiArgs) {
auto const &key = it.first;
auto const &obj = it.second;
set(key, obj);
}
}
bool remove(std::string key) {
INIStringUtil::trim(key);
#ifndef INI_CASE_SENSITIVE
INIStringUtil::toLower(key);
#endif
auto it = dataIndexMap.find(key);
if (it != dataIndexMap.end()) {
std::size_t index = it->second;
data.erase(data.begin() + index);
dataIndexMap.erase(it);
for (auto &it2 : dataIndexMap) {
auto &vi = it2.second;
if (vi > index) {
vi--;
}
}
return true;
}
return false;
}
void clear() {
data.clear();
dataIndexMap.clear();
}
std::size_t size() const { return data.size(); }
const_iterator begin() const { return data.begin(); }
const_iterator end() const { return data.end(); }
};
using INIStructure = INIMap<INIMap<std::string>>;
namespace INIParser {
using T_ParseValues = std::pair<std::string, std::string>;
enum class PDataType : char {
PDATA_NONE,
PDATA_COMMENT,
PDATA_SECTION,
PDATA_KEYVALUE,
PDATA_UNKNOWN
};
inline PDataType parseLine(std::string line, T_ParseValues &parseData) {
parseData.first.clear();
parseData.second.clear();
INIStringUtil::trim(line);
if (line.empty()) {
return PDataType::PDATA_NONE;
}
char firstCharacter = line[0];
if (firstCharacter == ';') {
return PDataType::PDATA_COMMENT;
}
if (firstCharacter == '[') {
auto commentAt = line.find_first_of(';');
if (commentAt != std::string::npos) {
line = line.substr(0, commentAt);
}
auto closingBracketAt = line.find_last_of(']');
if (closingBracketAt != std::string::npos) {
auto section = line.substr(1, closingBracketAt - 1);
INIStringUtil::trim(section);
parseData.first = section;
return PDataType::PDATA_SECTION;
}
}
auto lineNorm = line;
INIStringUtil::replace(lineNorm, "\\=", " ");
auto equalsAt = lineNorm.find_first_of('=');
if (equalsAt != std::string::npos) {
auto key = line.substr(0, equalsAt);
INIStringUtil::trim(key);
INIStringUtil::replace(key, "\\=", "=");
auto value = line.substr(equalsAt + 1);
INIStringUtil::trim(value);
parseData.first = key;
parseData.second = value;
return PDataType::PDATA_KEYVALUE;
}
return PDataType::PDATA_UNKNOWN;
}
}; // namespace INIParser
class INIReader {
public:
using T_LineData = std::vector<std::string>;
using T_LineDataPtr = std::shared_ptr<T_LineData>;
private:
std::ifstream fileReadStream;
T_LineDataPtr lineData;
T_LineData readFile() {
std::string fileContents;
fileReadStream.seekg(0, std::ios::end);
fileContents.resize(fileReadStream.tellg());
fileReadStream.seekg(0, std::ios::beg);
std::size_t fileSize = fileContents.size();
fileReadStream.read(&fileContents[0], fileSize);
fileReadStream.close();
T_LineData output;
if (fileSize == 0) {
return output;
}
std::string buffer;
buffer.reserve(50);
for (std::size_t i = 0; i < fileSize; ++i) {
char &c = fileContents[i];
if (c == '\n') {
output.emplace_back(buffer);
buffer.clear();
continue;
}
if (c != '\0' && c != '\r') {
buffer += c;
}
}
output.emplace_back(buffer);
return output;
}
public:
INIReader(std::string const &filename, bool keepLineData = false) {
fileReadStream.open(filename, std::ios::in | std::ios::binary);
if (keepLineData) {
lineData = std::make_shared<T_LineData>();
}
}
~INIReader() {}
bool operator>>(INIStructure &data) {
if (!fileReadStream.is_open()) {
return false;
}
T_LineData fileLines = readFile();
std::string section;
bool inSection = false;
INIParser::T_ParseValues parseData;
for (auto const &line : fileLines) {
auto parseResult = INIParser::parseLine(line, parseData);
if (parseResult == INIParser::PDataType::PDATA_SECTION) {
inSection = true;
data[section = parseData.first];
} else if (inSection &&
parseResult == INIParser::PDataType::PDATA_KEYVALUE) {
auto const &key = parseData.first;
auto const &value = parseData.second;
data[section][key] = value;
}
if (lineData && parseResult != INIParser::PDataType::PDATA_UNKNOWN) {
if (parseResult == INIParser::PDataType::PDATA_KEYVALUE && !inSection) {
continue;
}
lineData->emplace_back(line);
}
}
return true;
}
T_LineDataPtr getLines() { return lineData; }
};
class INIGenerator {
private:
std::ofstream fileWriteStream;
public:
bool prettyPrint = false;
INIGenerator(std::string const &filename) {
fileWriteStream.open(filename, std::ios::out | std::ios::binary);
}
~INIGenerator() {}
bool operator<<(INIStructure const &data) {
if (!fileWriteStream.is_open()) {
return false;
}
if (!data.size()) {
return true;
}
auto it = data.begin();
for (;;) {
auto const &section = it->first;
auto const &collection = it->second;
fileWriteStream << "[" << section << "]";
if (collection.size()) {
fileWriteStream << INIStringUtil::endl;
auto it2 = collection.begin();
for (;;) {
auto key = it2->first;
INIStringUtil::replace(key, "=", "\\=");
auto value = it2->second;
INIStringUtil::trim(value);
fileWriteStream << key << ((prettyPrint) ? " = " : "=") << value;
if (++it2 == collection.end()) {
break;
}
fileWriteStream << INIStringUtil::endl;
}
}
if (++it == data.end()) {
break;
}
fileWriteStream << INIStringUtil::endl;
if (prettyPrint) {
fileWriteStream << INIStringUtil::endl;
}
}
return true;
}
};
class INIWriter {
private:
using T_LineData = std::vector<std::string>;
using T_LineDataPtr = std::shared_ptr<T_LineData>;
std::string filename;
T_LineData getLazyOutput(T_LineDataPtr const &lineData, INIStructure &data,
INIStructure &original) {
T_LineData output;
INIParser::T_ParseValues parseData;
std::string sectionCurrent;
bool parsingSection = false;
bool continueToNextSection = false;
bool discardNextEmpty = false;
bool writeNewKeys = false;
std::size_t lastKeyLine = 0;
for (auto line = lineData->begin(); line != lineData->end(); ++line) {
if (!writeNewKeys) {
auto parseResult = INIParser::parseLine(*line, parseData);
if (parseResult == INIParser::PDataType::PDATA_SECTION) {
if (parsingSection) {
writeNewKeys = true;
parsingSection = false;
--line;
continue;
}
sectionCurrent = parseData.first;
if (data.has(sectionCurrent)) {
parsingSection = true;
continueToNextSection = false;
discardNextEmpty = false;
output.emplace_back(*line);
lastKeyLine = output.size();
} else {
continueToNextSection = true;
discardNextEmpty = true;
continue;
}
} else if (parseResult == INIParser::PDataType::PDATA_KEYVALUE) {
if (continueToNextSection) {
continue;
}
if (data.has(sectionCurrent)) {
auto &collection = data[sectionCurrent];
auto const &key = parseData.first;
auto const &value = parseData.second;
if (collection.has(key)) {
auto outputValue = collection[key];
if (value == outputValue) {
output.emplace_back(*line);
} else {
INIStringUtil::trim(outputValue);
auto lineNorm = *line;
INIStringUtil::replace(lineNorm, "\\=", " ");
auto equalsAt = lineNorm.find_first_of('=');
auto valueAt = lineNorm.find_first_not_of(
INIStringUtil::whitespaceDelimiters, equalsAt + 1);
std::string outputLine = line->substr(0, valueAt);
if (prettyPrint && equalsAt + 1 == valueAt) {
outputLine += " ";
}
outputLine += outputValue;
output.emplace_back(outputLine);
}
lastKeyLine = output.size();
}
}
} else {
if (discardNextEmpty && line->empty()) {
discardNextEmpty = false;
} else if (parseResult != INIParser::PDataType::PDATA_UNKNOWN) {
output.emplace_back(*line);
}
}
}
if (writeNewKeys || std::next(line) == lineData->end()) {
T_LineData linesToAdd;
if (data.has(sectionCurrent) && original.has(sectionCurrent)) {
auto const &collection = data[sectionCurrent];
auto const &collectionOriginal = original[sectionCurrent];
for (auto const &it : collection) {
auto key = it.first;
if (collectionOriginal.has(key)) {
continue;
}
auto value = it.second;
INIStringUtil::replace(key, "=", "\\=");
INIStringUtil::trim(value);
linesToAdd.emplace_back(key + ((prettyPrint) ? " = " : "=") +
value);
}
}
if (!linesToAdd.empty()) {
output.insert(output.begin() + lastKeyLine, linesToAdd.begin(),
linesToAdd.end());
}
if (writeNewKeys) {
writeNewKeys = false;
--line;
}
}
}
for (auto const &it : data) {
auto const &section = it.first;
if (original.has(section)) {
continue;
}
if (prettyPrint && output.size() > 0 && !output.back().empty()) {
output.emplace_back();
}
output.emplace_back("[" + section + "]");
auto const &collection = it.second;
for (auto const &it2 : collection) {
auto key = it2.first;
auto value = it2.second;
INIStringUtil::replace(key, "=", "\\=");
INIStringUtil::trim(value);
output.emplace_back(key + ((prettyPrint) ? " = " : "=") + value);
}
}
return output;
}
public:
bool prettyPrint = false;
INIWriter(std::string const &filename) : filename(filename) {}
~INIWriter() {}
bool operator<<(INIStructure &data) {
struct stat buf;
bool fileExists = (stat(filename.c_str(), &buf) == 0);
if (!fileExists) {
INIGenerator generator(filename);
generator.prettyPrint = prettyPrint;
return generator << data;
}
INIStructure originalData;
T_LineDataPtr lineData;
bool readSuccess = false;
{
INIReader reader(filename, true);
if ((readSuccess = reader >> originalData)) {
lineData = reader.getLines();
}
}
if (!readSuccess) {
return false;
}
T_LineData output = getLazyOutput(lineData, data, originalData);
std::ofstream fileWriteStream(filename, std::ios::out | std::ios::binary);
if (fileWriteStream.is_open()) {
if (output.size()) {
auto line = output.begin();
for (;;) {
fileWriteStream << *line;
if (++line == output.end()) {
break;
}
fileWriteStream << INIStringUtil::endl;
}
}
return true;
}
return false;
}
};
class INIFile {
private:
std::string filename;
public:
INIFile(std::string const &filename) : filename(filename) {}
~INIFile() {}
bool read(INIStructure &data) const {
if (data.size()) {
data.clear();
}
if (filename.empty()) {
return false;
}
INIReader reader(filename);
return reader >> data;
}
bool generate(INIStructure const &data, bool pretty = false) const {
if (filename.empty()) {
return false;
}
INIGenerator generator(filename);
generator.prettyPrint = pretty;
return generator << data;
}
bool write(INIStructure &data, bool pretty = false) const {
if (filename.empty()) {
return false;
}
INIWriter writer(filename);
writer.prettyPrint = pretty;
return writer << data;
}
};
} // namespace INI
#endif

View File

@ -1,11 +1,9 @@
#pragma once
#include <renderd7/Net.hpp>
#include <renderd7/renderd7.hpp>
#include <renderd7/external/json.hpp>
#include <renderd7/global_db.hpp>
#include <renderd7/renderd7.hpp>
#define CFGVER "1"
#define THEMEVER "0"
#define CFGVER "0"
#ifndef V_RD7BTIME
#define V_RD7BTIME "SUBMODULE"
@ -14,11 +12,7 @@
#define V_RD7CSTRING "SUBMODULE"
#endif
// Base
extern bool rd7i_do_splash;
extern bool rd7i_enable_scene_system;
extern bool rd7i_debugging;
extern bool rd7i_enable_memtrack;
/// Base ///
extern std::string rd7i_app_name;
extern std::string rd7i_config_path;
extern nlohmann::json rd7i_config;
@ -43,13 +37,14 @@ extern bool rd7i_mt_screen;
extern float rd7i_mt_txtSize;
extern bool rd7i_metrikd;
extern bool rd7i_ftraced;
extern bool rd7i_current_screen;
extern u64 rd7i_delta_time;
extern u64 rd7i_last_tm;
extern float rd7i_dtm;
extern float rd7i_time;
extern bool rd7i_fadeout;
extern bool rd7i_fadein;
extern bool rd7i_fadeout2;
extern bool rd7i_fadeout2;
extern bool rd7i_fadein2;
extern int rd7i_fadealpha;
extern int rd7i_fadecolor;
@ -57,14 +52,4 @@ extern bool rd7i_wait_fade;
extern bool rd7i_fade_exit;
extern bool rd7i_fade_scene_wait;
extern bool rd7i_idb_running;
extern bool rd7i_graphics_on;
extern bool rd7i_amdt;
extern void* rd7i_soc_buf;
extern bool rd7i_is_am_init;
extern RenderD7::Theme::Ref rd7i_active_theme;
extern bool rd7i_lggrf;
// Use function for protection
RenderD7::LoggerBase::Ref _rd7i_logger();
RenderD7::Net::Error rd7i_soc_init();
void rd7i_soc_deinit();
extern bool rd7i_graphics_on;

View File

@ -8,17 +8,13 @@ namespace RenderD7 {
namespace Lang {
/// @brief Get 3ds System lang! [en] by default
/// @return Sytemlang as string
std::string GetSys();
std::string getSys();
/// @brief Get The Translation String
/// @param key Key of Translation
/// @return The Translated String
std::string Get(const std::string &key);
std::string get(const std::string &key);
/// @brief Load A Language json
/// @param lang The Language Key [en], [de], etc, or getSys()
void Load(const std::string &lang);
// New funcs
std::string GetName();
std::string GetAuthor();
std::string GetShortcut();
} // namespace Lang
} // namespace RenderD7
void load(const std::string &lang);
} // namespace Lang
} // namespace RenderD7

33
include/renderd7/log.hpp Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include <fstream>
#include <stdarg.h>
#include <string>
#include <time.h>
#include <unistd.h>
/// @brief Log Class
class Log {
public:
/// @brief Constructor
Log();
/// @brief Deconstructor
~Log();
/// @brief Init the Logger
/// @param filename Filename[_data_time.log]
void Init(const char *filename);
/// @brief Write a String to the File
/// @param debug_text string
void Write(std::string debug_text);
/// @brief Get the Date
/// @return Date as string fmt[data_time]
std::string logDate(void);
/// @brief Format a string like sprintf
/// @param fmt_str the string wich defines the fmt
/// @param ... Additional Data
/// @return Formatted String
std::string format(const std::string &fmt_str, ...);
private:
/// \param filename the name of the logfile
std::string filename;
};

View File

@ -0,0 +1,28 @@
#pragma once
#include <renderd7/music/Music.hpp>
#include <fstream>
#include <mpg123.h>
namespace RenderD7 {
class Mp3Decoder : public MusicDecoder {
public:
Mp3Decoder() {}
~Mp3Decoder() {}
int _init(const std::string& path, MusicMeta& meta) override;
unsigned int _getSampleRate() override;
unsigned char _getChannels() override;
size_t _getBufSize() override;
unsigned long long _decode(signed short* buf_addr) override;
void _deinit() override;
size_t _getFileSamples() override;
private:
mpg123_handle *hnd = nullptr;
size_t buf_size = 0;
long rate = 0;
int channels = 0;
};
}

View File

@ -0,0 +1,90 @@
// RenderD7 Music Backend
#pragma once
#include <string>
namespace RenderD7 {
class MusicMeta {
public:
MusicMeta() {
ititle = "Unknown";
ialbum = "Unknown";
iyear = "Unknown";
iname = "Unknown";
ipath = "Unknown";
iartist = "Unknown";
imdt = "Unknown";
}
~MusicMeta() {}
std::string name() { return iname; }
std::string album() { return ialbum; }
std::string year() { return iyear; }
std::string title() { return ititle; }
std::string path() { return ipath; }
std::string artist() { return iartist; }
std::string mdt() { return imdt; }
void name(std::string name) { iname = name; }
void album(std::string album) { ialbum = album; }
void year(std::string year) { iyear = year; }
void title(std::string title) { ititle = title; }
void path(std::string path) { ipath = path; }
void artist(std::string artist) { iartist = artist; }
void mdt(std::string mdt) { imdt = mdt; }
private:
std::string ititle = "";
std::string ialbum = "";
std::string iyear = "";
std::string iname = "";
std::string ipath = "";
std::string iartist = "";
std::string imdt = "";
};
// Template Class for Decoders
class MusicDecoder {
public:
MusicDecoder() = default;
virtual ~MusicDecoder() {}
static void LoadFile(const std::string &path);
static void CleanUp();
static int init(const std::string &path, MusicMeta &meta) {
return decoder->_init(path, meta);
}
static unsigned int getSampleRate() { return decoder->_getSampleRate(); }
static unsigned char getChannels() { return decoder->_getChannels(); }
static size_t getBufSize() { return decoder->_getBufSize(); }
static unsigned long long decode(signed short *buf_addr) {
return decoder->_decode(buf_addr);
}
static void deinit() { decoder->_deinit(); }
static size_t getFileSamples() { return decoder->_getFileSamples(); }
static MusicDecoder *decoder;
protected:
virtual int _init(const std::string &path, MusicMeta &meta) = 0;
virtual unsigned int _getSampleRate() = 0;
virtual unsigned char _getChannels() = 0;
virtual size_t _getBufSize() = 0;
virtual unsigned long long _decode(signed short *buf_addr) = 0;
virtual void _deinit() = 0;
virtual size_t _getFileSamples() = 0;
};
namespace MusicPlayer {
void PlayFile(const std::string &path);
void Play();
void Pause();
void Stop();
bool IsPlaying();
bool IsRunning();
int PosCurrent();
int Total();
int SampleRate();
MusicMeta GetMeta();
} // namespace MusicPlayer
} // namespace RenderD7

View File

@ -0,0 +1,29 @@
#pragma once
#include <renderd7/music/Music.hpp>
#include <fstream>
#include <tremor/ivorbiscodec.h>
#include <tremor/ivorbisfile.h>
namespace RenderD7 {
class VorbisDecoder : public MusicDecoder {
public:
VorbisDecoder() {}
~VorbisDecoder() {}
int _init(const std::string& path, MusicMeta& meta) override;
unsigned int _getSampleRate() override;
unsigned char _getChannels() override;
size_t _getBufSize() override;
unsigned long long _decode(signed short* buf_addr) override;
void _deinit() override;
size_t _getFileSamples() override;
private:
OggVorbis_File vorbis_file;
vorbis_info *vi;
FILE* f; // Only used cause required by lib
const size_t buf_size = 8 * 4096;
};
}

View File

@ -1,30 +1,47 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <cstdint>
#include <iostream>
#define NPI_NIMG_ (uint32_t)0x4e494d47 // Magic: NIMG
#define NPI_NIMG_ (uint32_t)0x4e494d47 // Magic: NIMG
namespace RenderD7 {
struct nimg {
unsigned int magic; // Magic number defaults do NPI_NIMG_
int width;
int height;
int format;
int compression;
std::vector<unsigned char> pixel_buffer;
/**
* NIMG Format Value Description
* int format
* 0 = rgba32
* 1 = rgb24 (3x8bit)
*/
nimg(int w = 0, int h = 0, int fmt = 0, int cmp = 0) {
magic = NPI_NIMG_;
width = w;
height = h;
format = fmt;
compression = cmp;
pixel_buffer.resize((w * h) * (format ? 3 : 4));
}
};
nimg NIMG_Load(std::string path);
nimg NIMG_LoadFromMem(unsigned char* buffer, size_t bf_size);
void NIMG_Save(nimg image, std::string path);
} // namespace RenderD7
/**
* NIMG Compression Value Description
* int compression
* 0 = no compression
* 1 = npi_simple_compress (RLE Style)
*/
namespace RenderD7
{
struct nimg
{
unsigned int magic; // Magic number defaults do NPI_NIMG_
int width;
int height;
int format;
int compression;
std::vector<unsigned char> pixel_buffer;
nimg(int w = 0, int h = 0, int fmt = 0, int cmp = 0)
{
magic = NPI_NIMG_;
width = w;
height = h;
format = fmt;
compression = cmp;
pixel_buffer.resize((w*h)*(format ? 3 : 4));
}
};
nimg NIMG_Load(std::string path);
nimg NIMG_LoadFromMem(unsigned char* buffer, size_t bf_size);
void NIMG_Save(nimg image, std::string path);
}

View File

@ -0,0 +1,26 @@
#pragma once
#include <renderd7/nimg.hpp>
namespace RenderD7
{
class NIMG_Engine
{
public:
NIMG_Engine(int w, int h);
NIMG_Engine();
~NIMG_Engine();
nimg& GetImage() { return image; }
void load_file(const std::string& path);
void load_nimg(const std::string& path);
// Rendering
void draw_pixel(int x, int y, unsigned int color);
void draw_rect(int x, int y, int w, int h, unsigned int color, int t = 1);
void draw_rect_solid(int x, int y, int w, int h, unsigned int color);
void flip(bool h, bool v);
private:
nimg image;
};
}

View File

@ -3,21 +3,18 @@
namespace RenderD7 {
class Parameter {
private:
private:
using id = size_t;
template <typename T>
struct type {
template <typename T> struct type {
static void id() {}
};
template <typename T>
static id type_id() {
template <typename T> static id type_id() {
return reinterpret_cast<id>(&type<T>::id);
}
template <typename T>
using decay = typename std::decay<T>::type;
template <typename T> using decay = typename std::decay<T>::type;
template <typename T>
using none =
@ -29,8 +26,7 @@ class Parameter {
virtual base *copy() const = 0;
} *p = nullptr;
template <typename T>
struct data : base, std::tuple<T> {
template <typename T> struct data : base, std::tuple<T> {
using std::tuple<T>::tuple;
T &get() & { return std::get<0>(*this); }
@ -40,27 +36,19 @@ class Parameter {
base *copy() const override { return new data{get()}; }
};
template <typename T>
T &stat() {
return static_cast<data<T> &>(*p).get();
}
template <typename T> T &stat() { return static_cast<data<T> &>(*p).get(); }
template <typename T>
T const &stat() const {
template <typename T> T const &stat() const {
return static_cast<data<T> const &>(*p).get();
}
template <typename T>
T &dyn() {
return dynamic_cast<data<T> &>(*p).get();
}
template <typename T> T &dyn() { return dynamic_cast<data<T> &>(*p).get(); }
template <typename T>
T const &dyn() const {
template <typename T> T const &dyn() const {
return dynamic_cast<data<T> const &>(*p).get();
}
public:
public:
/**
* @brief Default constructor
*/
@ -114,8 +102,7 @@ class Parameter {
* @tparam T The type to check
* @return Whether the Parameter has the given type or not
*/
template <typename T>
bool is() const {
template <typename T> bool is() const {
return p ? p->is(type_id<T>()) : false;
}
@ -126,9 +113,6 @@ class Parameter {
* @warning If the type of the Parameter doesn't match the type of it's stored
* value, it will result in undefined behaviour.
*/
template <typename T>
T &get() & {
return stat<T>();
}
template <typename T> T &get() & { return stat<T>(); }
};
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,10 +1,18 @@
#pragma once
/// c++ Includes
#include <algorithm>
#include <codecvt>
#include <cstring>
#include <filesystem>
#include <functional>
#include <iostream>
#include <locale>
#include <map>
#include <memory>
#include <random>
#include <stack>
#include <string>
#include <vector>
/// c includes
#include <dirent.h>
#include <stdio.h>
@ -19,17 +27,18 @@
#include <renderd7/Color.hpp>
#include <renderd7/FunctionTrace.hpp>
#include <renderd7/Hardware.hpp>
#include <renderd7/Logger.hpp>
#include <renderd7/Memory.hpp>
#include <renderd7/Overlays.hpp>
#include <renderd7/Ovl.hpp>
#include <renderd7/Render2.hpp>
#include <renderd7/ResultDecoder.hpp>
#include <renderd7/Screen.hpp>
#include <renderd7/Security.hpp>
#include <renderd7/Sheet.hpp>
#include <renderd7/Sprite.hpp>
#include <renderd7/SpriteAnimation.hpp>
#include <renderd7/Tasks.hpp>
#include <renderd7/Time.hpp>
#include <renderd7/external/lodepng.h>
#include <renderd7/ini.hpp>
#include <renderd7/lang.hpp>
#include <renderd7/parameter.hpp>
#include <renderd7/stringtool.hpp>
@ -39,21 +48,33 @@
#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;
/// RenderD7
namespace RenderD7 {
// Reference to the New Renderer
R2Base::Ref R2();
// Reference to Global Logger
LoggerBase::Ref Logger();
/// @brief Get Deltatime
/// @return Deltatime
float GetDeltaTime();
/// @brief A Button
struct TObject {
int x; ///< Position X
int y; ///< Position Y
int w; ///< Button Width
int h; ///< Button Height
std::string text = ""; ///< Text
float txtsize = 0.7f; ///< Set Text Size
};
/// @brief Scene Class
class Scene {
public:
public:
/// @brief Stack of the Scenes
static std::stack<std::unique_ptr<Scene>> scenes;
/// @brief Deconstructor
@ -74,15 +95,16 @@ class Scene {
/// @brief Integrated Setting Menu of RenderD7
class RSettings : public RenderD7::Scene {
private:
private:
/// @brief State (Define for Menus)
enum RState {
RSETTINGS, // Main Settings Menu
RIDB, // Internal Debugger
ROVERLAYS, // Overlay Settings
RFTRACE, // FTRace Menu
RUI7, // UI7 Menu
RLOGS, // Logs
RSETTINGS,
RINFO,
RSERVICES,
RMCONFIG,
RFTRACE,
RUI7,
RCREDITS
};
/// @param shared_request Defines requests from Draw to Logic
@ -101,12 +123,10 @@ class RSettings : public RenderD7::Scene {
/// @param mtscreenstate Screen the Overlay is Set to
std::string mtscreenstate = "Top";
std::string kbd_test;
RD7KeyboardState kbd_state;
bool statemtold = false;
bool stateftold = false;
float tmp_txt;
public:
public:
/// @brief Constructor
RSettings();
/// @brief Override for Draw
@ -119,8 +139,6 @@ class RSettings : public RenderD7::Scene {
/// @brief Show Up the RenderD7-Settings Menu
void LoadSettings();
/// @brief Show Up The Theme Editor
void LoadThemeEditor();
/// @brief Get's The Programs Time running
/// @return Time Running
float GetTime();
@ -133,6 +151,18 @@ int GetFps();
/// @param e To
/// @return Random Int
int GetRandomInt(int b, int e);
/// @brief DrawMetrikOvl (YOUR OWN RISK)
void DrawMetrikOvl();
/// @brief Draw Image from RenderD7 Sheet
/// @param sheet Spritesheet
/// @param index Image index Value
/// @param x Pos X
/// @param y Pos Y
/// @param scaleX Scale on X-Axis
/// @param scaleY Scale on Y-Axis
/// @return success ?
bool DrawImageFromSheet(RenderD7::Sheet *sheet, size_t index, float x, float y,
float scaleX = 1.0, float scaleY = 1.0);
/// @brief Fade In
/// @param duration Duration in Frames
void FadeIn();
@ -142,6 +172,11 @@ void FadeOut();
/// @brief Display Fade Effects
void FadeDisplay();
/// @brief Loads a font
/// @param path path to font (bcfnt)
/// @return link to C2D_Font Object
C2D_Font LoadFont(const std::string& path);
namespace Init {
/// @brief Init Default RenderD7
/// @param app_name Name of Your App
@ -158,14 +193,29 @@ Result Reload();
void Graphics();
/// @brief Init Ndsp for Sounds
void NdspFirm();
} // namespace Init
} // namespace Init
namespace Convert {
/// @brief Convert a String to Flaot
/// @param inp Input String
/// @return Float
inline float StringtoFloat(std::string inp) { return std::atof(inp.c_str()); }
/// @brief Convert String to Int
/// @param inp Input String
/// @return Int
inline int StringtoInt(std::string inp) { return std::atoi(inp.c_str()); }
/// @brief Convert a Float to Bool
/// @param inp Input Float
/// @return Bool
inline bool FloatToBool(float inp) { return (inp == 1 ? true : false); }
} // namespace Convert
namespace FS {
/// @brief Check if File exists
/// @param path Path to the File
/// @return exists or not
bool FileExist(const std::string &path);
} // namespace FS
} // namespace FS
/// @brief Check if Ndsp is Init
/// @return is or not
@ -190,7 +240,4 @@ void FrameEnd();
/// @brief Returns App Working Directory path
/// @return AppDir Path
std::string GetAppDirectory();
/// @brief returns path to the Data Directory
/// @return data dir path
std::string GetDataDirectory();
} // namespace RenderD7
} // namespace RenderD7

View File

@ -1,7 +1,4 @@
// THIS FILE WAS GENERATED BY generate_assets.py!!!
#pragma once
#include <cstddef>
extern unsigned char renderd7_logo[];

View File

@ -1,10 +0,0 @@
#pragma once
#include <memory>
#define RD7_SMART_CTOR(type) \
using Ref = std::shared_ptr<type>; \
template <typename... args> \
static Ref New(args&&... cargs) { \
return std::make_shared<type>(std::forward<args>(cargs)...); \
}

View File

@ -1,35 +1,30 @@
#pragma once
#include <3ds.h>
#include <renderd7/smart_ctor.hpp>
#include <string>
namespace RenderD7 {
/** Sound Class */
class Sound {
public:
/// \brief Construct new Soundeffect
/// \param path Path to the .wav file
/// \param channel the channel 1-23
/// \param toloop true:loop the sound, false: don't loop
Sound(const std::string &path, int channel = 1, bool toloop = false);
/// @brief Deconstructor
~Sound();
RD7_SMART_CTOR(Sound)
/// @brief Play the sound
void Play();
/// @brief Stop the sound
void Stop();
private:
/// \param dataSize Size of the filedata
u32 dataSize;
/// \param waveBuf For ndsp
ndspWaveBuf waveBuf;
/// \param data Memmory data of the sound
uint8_t *data = NULL;
/// \param chnl Channel of the sound
int chnl;
};
} // namespace RenderD7
#pragma once
#include <3ds.h>
#include <string>
/** Sound Class */
class sound {
public:
/// \brief Construct new Soundeffect
/// \param path Path to the .wav file
/// \param channel the channel 1-23
/// \param toloop true:loop the sound, false: don't loop
sound(const std::string &path, int channel = 1, bool toloop = false);
/// @brief Deconstructor
~sound();
/// @brief Play the sound
void play();
/// @brief Stop the sound
void stop();
private:
/// \param dataSize Size of the filedata
u32 dataSize;
/// \param waveBuf For ndsp
ndspWaveBuf waveBuf;
/// \param data Memmory data of the sound
uint8_t *data = NULL;
/// \param chnl Channel of the sound
int chnl;
};

View File

@ -1,25 +0,0 @@
#pragma once
#include <renderd7/nimg.hpp>
namespace RenderD7 {
class swr {
public:
swr(int w, int h);
swr();
~swr();
nimg& get_image() { return image; }
void load_file(const std::string& path);
void load_nimg(const std::string& path);
// Rendering
void draw_pixel(int x, int y, unsigned int color);
void draw_rect(int x, int y, int w, int h, unsigned int color, int t = 1);
void draw_rect_solid(int x, int y, int w, int h, unsigned int color);
void draw_line(int x1, int y1, int x2, int y2, unsigned int color, int t = 1);
void flip(bool h, bool v);
private:
nimg image;
};
} // namespace RenderD7

View File

@ -1,9 +1,9 @@
#pragma once
#include <3ds.h>
#include <atomic>
#include <functional>
#include <renderd7/parameter.hpp>
#include <string>
using CTRU_Thread = Thread;
@ -11,7 +11,7 @@ using CTRU_Thread = Thread;
namespace RenderD7 {
class Thread {
public:
public:
/**
* @brief Default constructor
* @note This should only be called when calling m3d::Thread::initialize()
@ -104,7 +104,7 @@ class Thread {
*/
static void sleep(int t_milliseconds);
private:
private:
struct ThreadData {
RenderD7::Parameter m_parameter;
std::function<void(RenderD7::Parameter)> m_function;
@ -119,4 +119,4 @@ class Thread {
RenderD7::Thread::ThreadData m_data;
CTRU_Thread m_thread;
};
} // namespace RenderD7
} // namespace RenderD7

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,44 +0,0 @@
site_name: RenderD7 Docs
site_description:
theme:
name: material
custom_dir: docs/overrides
features:
- navigation.indexes
palette:
# Palette toggle for light mode
- scheme: default
primary: red
accent: red
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- scheme: slate
primary: red
accent: red
toggle:
icon: material/brightness-4
name: Switch to light mode
markdown_extensions:
- def_list
- attr_list
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.arithmatex:
generic: true
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
plugins:
- search
extra_css:
- stylesheets/doxide.css
extra_javascript:
- javascripts/mathjax.js
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

52
not_functional/Flac.cpp Normal file
View File

@ -0,0 +1,52 @@
#include <renderd7/music/Flac.hpp>
#ifdef RENDERD7_MUSICDEC
#define DR_FLAC_IMPLEMENTATION
#include <renderd7/external/dr_flac.h>
int rd7i_check_flac(const std::string &path) {
int err = -1;
drflac* flac = drflac_open_file(path.c_str(), NULL);
if(flac != NULL)
err = 0;
drflac_close(flac);
return err;
}
namespace RenderD7 {
int FlacDecoder::_init(const std::string &path, MusicMeta& meta) {
meta.path(path);
if(path.find_last_of('/') != path.npos)
meta.name(path.substr(path.find_last_of('/')));
else
meta.name(path);
flac = drflac_open_file(path.c_str(), NULL);
return flac == NULL ? -1 : 0;
}
unsigned int FlacDecoder::_getSampleRate() { return flac->sampleRate; }
unsigned char FlacDecoder::_getChannels() { return flac->channels; }
size_t FlacDecoder::_getBufSize() { return buf_size; }
unsigned long long FlacDecoder::_decode(signed short*buf_addr) {
unsigned long long bsf = (unsigned long long)buf_size/(unsigned long long)flac->channels;
unsigned long long samples_read = drflac_read_pcm_frames_s16(flac, bsf, buf_addr);
samples_read *= (unsigned long long)flac->channels;
return samples_read;
}
void FlacDecoder::_deinit() {
drflac_close(flac);
}
size_t FlacDecoder::_getFileSamples() {
return flac->totalPCMFrameCount * (size_t)flac->channels;
}
} // namespace RenderD7
#endif

26
not_functional/Flac.hpp Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#include <renderd7/music/Music.hpp>
#include <fstream>
#include <renderd7/external/dr_flac.h>
namespace RenderD7 {
class FlacDecoder : public MusicDecoder {
public:
FlacDecoder() {}
~FlacDecoder() {}
int _init(const std::string& pat, MusicMeta& meta) override;
unsigned int _getSampleRate() override;
unsigned char _getChannels() override;
size_t _getBufSize() override;
unsigned long long _decode(signed short* buf_addr) override;
void _deinit() override;
size_t _getFileSamples() override;
private:
drflac* flac;
const size_t buf_size = 16 * 1024;
};
}

40
not_functional/MUSIC.md Normal file
View File

@ -0,0 +1,40 @@
# Copy of removed Music.cpp file loaders
```
#include <renderd7/music/Flac.hpp>
#include <renderd7/music/Wav.hpp>
// "RIFF"
/*case 0x46464952:
// "riff"
case 0x66666972:
// "RIFX"
case 0x58464952:
// "RF64"
case 0x34364652:
// "FORM"
case 0x4D524F46:
decoder = new WavDecoder();
if (init(path, rd7i_mp_internal_data.meta)) {
MusicDecoder::CleanUp();
return;
}
break;*/
// Flac
/*case 0x43614c66:
decoder = new FlacDecoder();
if (init(path, rd7i_mp_internal_data.meta)) {
RenderD7::PushMessage(
RenderD7::Message("Music Player", "Failed to load FLAC"));
MusicDecoder::CleanUp();
return;
}
break;*/
// The other one
/*else if (rd7i_check_flac(path) == 0) {
decoder = new FlacDecoder();
if (init(path, rd7i_mp_internal_data.meta)) {
MusicDecoder::CleanUp();
return;
}
}*/
```

41
not_functional/Wav.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <renderd7/music/Wav.hpp>
#ifdef RENDERD7_MUSICDEC
#define DR_WAV_IMPLEMENTATION
#include <renderd7/external/dr_wav.h>
namespace RenderD7 {
int WavDecoder::_init(const std::string &path, MusicMeta& meta) {
meta.path(path);
if(path.find_last_of('/') != path.npos)
meta.name(path.substr(path.find_last_of('/')));
else
meta.name(path);
return !drwav_init_file(&wav, path.c_str(), NULL);
}
unsigned int WavDecoder::_getSampleRate() { return wav.sampleRate; }
unsigned char WavDecoder::_getChannels() { return wav.channels; }
size_t WavDecoder::_getBufSize() { return buf_size; }
unsigned long long WavDecoder::_decode(signed short*buf_addr) {
unsigned long long bsf = (unsigned long long)buf_size/(unsigned long long)wav.channels;
unsigned long long samples_read = drwav_read_pcm_frames(&wav, bsf, buf_addr);
samples_read *= (unsigned long long)wav.channels;
return samples_read;
}
void WavDecoder::_deinit() {
drwav_uninit(&wav);
}
size_t WavDecoder::_getFileSamples() {
return wav.totalPCMFrameCount * (size_t)wav.channels;
}
} // namespace RenderD7
#endif

26
not_functional/Wav.hpp Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#include <renderd7/music/Music.hpp>
#include <fstream>
#include <renderd7/external/dr_wav.h>
namespace RenderD7 {
class WavDecoder : public MusicDecoder {
public:
WavDecoder() {}
~WavDecoder() {}
int _init(const std::string& path, MusicMeta& meta) override;
unsigned int _getSampleRate() override;
unsigned char _getChannels() override;
size_t _getBufSize() override;
unsigned long long _decode(signed short* buf_addr) override;
void _deinit() override;
size_t _getFileSamples() override;
private:
drwav wav;
const size_t buf_size = 16 * 1024;
};
}

278
rd7tf/Makefile Normal file
View File

@ -0,0 +1,278 @@
#---------------------------------------------------------------------------------
.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 ../source/music
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
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)
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
#---------------------------------------------------------------------------------------

BIN
rd7tf/app/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

9
rd7tf/clean.sh Executable file
View File

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

BIN
rd7tf/gfx/default_icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

BIN
rd7tf/gfx/folder.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
rd7tf/gfx/renderd7.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

6
rd7tf/gfx/sprites.t3s Executable file
View File

@ -0,0 +1,6 @@
--atlas -f rgba -z auto
renderd7.png
folder.png
default_icon.png
unk_icon.png

BIN
rd7tf/gfx/unk_icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

1
rd7tf/romfs/gfx/Leere Datei Executable file
View File

@ -0,0 +1 @@
vcx

BIN
rd7tf/romfs/gfx/bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
rd7tf/romfs/gfx/renderd7.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
rd7tf/romfs/gfx/sprites.t3x Executable file

Binary file not shown.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

5
rd7tf/romfs/lang/de/app.json Executable file
View File

@ -0,0 +1,5 @@
{
"LOADINGFILES": "Lade Dateien ...",
"MENU": "Menü",
"LOADING": "Lade ..."
}

5
rd7tf/romfs/lang/en/app.json Executable file
View File

@ -0,0 +1,5 @@
{
"LOADINGFILES": "Loading Files ...",
"MENU": "Menu",
"LOADING": "Loading ..."
}

Binary file not shown.

BIN
rd7tf/romfs/thesound.wav Normal file

Binary file not shown.

52
rd7tf/source/main.cpp Normal file
View File

@ -0,0 +1,52 @@
#include "scene.hpp"
#include "renderd7/music/Music.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();
//RenderD7::InlineAssert(1 == 2, "1 is not 2!");
//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;
}

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

@ -0,0 +1,132 @@
#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);
R7Vec2 grid_display_entry(void* data, R7Vec2 pos) {
auto img = reinterpret_cast<RenderD7::Image*>(data);
RenderD7::Draw2::Image(img, pos);
RenderD7::Draw2::RFS(pos, testv2, RenderD7::Color::Hex("#0000ff", 140));
return testv2;
}
std::vector<RenderD7::Image*> imgdb;
Sample::Sample() {
/*RenderD7::Image* im = new RenderD7::Image();
im->load("romfs:/icons/icon.png");
for(int i = 0; i < 64; i++)
imgdb.push_back(im);*/
auto t = RenderD7::FileSystem::GetDirContent("sdmc:/music/");
for(const auto& it : t)
names.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();
//UI7::Grid("Files", R7Vec2(390, 210), grid_display_entry, reinterpret_cast<void**>(imgdb.data()), imgdb.size());
UI7::BrowserList(names, sel);
UI7::EndMenu();
}
RenderD7::OnScreen(Bottom);
if (UI7::BeginMenu("Control Center")) {
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..."));
}
}
// Make sure to clear after processing!!!;
shared_requests.clear();
if (d7_hDown & KEY_B) debug_background = !debug_background;
}

Some files were not shown because too many files have changed in this diff Show More