Final Release!

This commit is contained in:
rw-r-r_0644 2016-10-05 16:03:29 +02:00
commit 8d66b18495
189 changed files with 25281 additions and 0 deletions

281
GX2_template.cbp Normal file
View File

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="GX2_template" />
<Option makefile_is_custom="1" />
<Option pch_mode="2" />
<Option compiler="ppc-gcc" />
<Build>
<Target title="build">
<Option output="bin/Release/GX2_template" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="ppc-gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<MakeCommands>
<Build command="$make -f $makefile $target -j8" />
<CompileFile command="$make -f $makefile $file" />
<Clean command="make clean" />
<DistClean command="$make -f $makefile distclean$target" />
<AskRebuildNeeded command="$make -q -f $makefile $target" />
<SilentBuild command="$make -f $makefile $target -j8 &gt; $(CMD_NULL)" />
</MakeCommands>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="build/Application.d" />
<Unit filename="build/AsyncDeleter.d" />
<Unit filename="build/BufferCircle.d" />
<Unit filename="build/CFile.d" />
<Unit filename="build/CVideo.d" />
<Unit filename="build/ColorShader.d" />
<Unit filename="build/DirList.d" />
<Unit filename="build/FXAAShader.d" />
<Unit filename="build/FreeTypeGX.d" />
<Unit filename="build/GameBgImage.d" />
<Unit filename="build/GameIcon.d" />
<Unit filename="build/GridBackground.d" />
<Unit filename="build/GuiButton.d" />
<Unit filename="build/GuiCheckBox.d" />
<Unit filename="build/GuiDragListener.d" />
<Unit filename="build/GuiElement.d" />
<Unit filename="build/GuiFrame.d" />
<Unit filename="build/GuiImage.d" />
<Unit filename="build/GuiImageAsync.d" />
<Unit filename="build/GuiImageData.d" />
<Unit filename="build/GuiParticleImage.d" />
<Unit filename="build/GuiSelectBox.d" />
<Unit filename="build/GuiSound.d" />
<Unit filename="build/GuiSwitch.d" />
<Unit filename="build/GuiText.d" />
<Unit filename="build/GuiToggle.d" />
<Unit filename="build/GuiTrigger.d" />
<Unit filename="build/MainWindow.d" />
<Unit filename="build/MainWindowTV.d" />
<Unit filename="build/Mp3Decoder.d" />
<Unit filename="build/OggDecoder.d" />
<Unit filename="build/Resources.d" />
<Unit filename="build/Scrollbar.d" />
<Unit filename="build/Shader3D.d" />
<Unit filename="build/ShaderFractalColor.d" />
<Unit filename="build/SoundDecoder.d" />
<Unit filename="build/SoundHandler.d" />
<Unit filename="build/StringTools.d" />
<Unit filename="build/Texture2DShader.d" />
<Unit filename="build/WavDecoder.d" />
<Unit filename="build/acp_functions.d" />
<Unit filename="build/aoc_functions.d" />
<Unit filename="build/ax_functions.d" />
<Unit filename="build/curl_functions.d" />
<Unit filename="build/entry.d" />
<Unit filename="build/exception_handler.d" />
<Unit filename="build/fs_functions.d" />
<Unit filename="build/fs_utils.d" />
<Unit filename="build/gx2_functions.d" />
<Unit filename="build/logger.d" />
<Unit filename="build/main.d" />
<Unit filename="build/memory.d" />
<Unit filename="build/os_functions.d" />
<Unit filename="build/padscore_functions.d" />
<Unit filename="build/sd_fat_devoptab.d" />
<Unit filename="build/socket_functions.d" />
<Unit filename="build/sys_functions.d" />
<Unit filename="build/syshid_functions.d" />
<Unit filename="build/vpad_functions.d" />
<Unit filename="src/Application.cpp" />
<Unit filename="src/Application.h" />
<Unit filename="src/common/common.h" />
<Unit filename="src/common/os_defs.h" />
<Unit filename="src/common/types.h" />
<Unit filename="src/dynamic_libs/acp_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/acp_functions.h" />
<Unit filename="src/dynamic_libs/aoc_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/aoc_functions.h" />
<Unit filename="src/dynamic_libs/ax_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/ax_functions.h" />
<Unit filename="src/dynamic_libs/curl_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/curl_functions.h" />
<Unit filename="src/dynamic_libs/fs_defs.h" />
<Unit filename="src/dynamic_libs/fs_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/fs_functions.h" />
<Unit filename="src/dynamic_libs/gx2_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/gx2_functions.h" />
<Unit filename="src/dynamic_libs/gx2_types.h" />
<Unit filename="src/dynamic_libs/os_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/os_functions.h" />
<Unit filename="src/dynamic_libs/os_types.h" />
<Unit filename="src/dynamic_libs/padscore_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/padscore_functions.h" />
<Unit filename="src/dynamic_libs/socket_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/socket_functions.h" />
<Unit filename="src/dynamic_libs/sys_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/sys_functions.h" />
<Unit filename="src/dynamic_libs/syshid_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/syshid_functions.h" />
<Unit filename="src/dynamic_libs/vpad_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/dynamic_libs/vpad_functions.h" />
<Unit filename="src/entry.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/fs/CFile.cpp" />
<Unit filename="src/fs/CFile.hpp" />
<Unit filename="src/fs/DirList.cpp" />
<Unit filename="src/fs/DirList.h" />
<Unit filename="src/fs/fs_utils.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/fs/fs_utils.h" />
<Unit filename="src/fs/sd_fat_devoptab.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/fs/sd_fat_devoptab.h" />
<Unit filename="src/gui/FreeTypeGX.cpp" />
<Unit filename="src/gui/FreeTypeGX.h" />
<Unit filename="src/gui/GameBgImage.cpp" />
<Unit filename="src/gui/GameBgImage.h" />
<Unit filename="src/gui/GameIcon.cpp" />
<Unit filename="src/gui/GameIcon.h" />
<Unit filename="src/gui/GameIconModel.h" />
<Unit filename="src/gui/GridBackground.cpp" />
<Unit filename="src/gui/GridBackground.h" />
<Unit filename="src/gui/Gui.h" />
<Unit filename="src/gui/GuiButton.cpp" />
<Unit filename="src/gui/GuiButton.h" />
<Unit filename="src/gui/GuiCheckBox.cpp" />
<Unit filename="src/gui/GuiCheckBox.h" />
<Unit filename="src/gui/GuiController.h" />
<Unit filename="src/gui/GuiDragListener.cpp" />
<Unit filename="src/gui/GuiDragListener.h" />
<Unit filename="src/gui/GuiElement.cpp" />
<Unit filename="src/gui/GuiElement.h" />
<Unit filename="src/gui/GuiFrame.cpp" />
<Unit filename="src/gui/GuiFrame.h" />
<Unit filename="src/gui/GuiImage.cpp" />
<Unit filename="src/gui/GuiImage.h" />
<Unit filename="src/gui/GuiImageAsync.cpp" />
<Unit filename="src/gui/GuiImageAsync.h" />
<Unit filename="src/gui/GuiImageData.cpp" />
<Unit filename="src/gui/GuiImageData.h" />
<Unit filename="src/gui/GuiMainWindowScreen.h" />
<Unit filename="src/gui/GuiParticleImage.cpp" />
<Unit filename="src/gui/GuiParticleImage.h" />
<Unit filename="src/gui/GuiSelectBox.cpp" />
<Unit filename="src/gui/GuiSelectBox.h" />
<Unit filename="src/gui/GuiSound.cpp" />
<Unit filename="src/gui/GuiSound.h" />
<Unit filename="src/gui/GuiSwitch.cpp" />
<Unit filename="src/gui/GuiSwitch.h" />
<Unit filename="src/gui/GuiText.cpp" />
<Unit filename="src/gui/GuiText.h" />
<Unit filename="src/gui/GuiToggle.cpp" />
<Unit filename="src/gui/GuiToggle.h" />
<Unit filename="src/gui/GuiTrigger.cpp" />
<Unit filename="src/gui/GuiTrigger.h" />
<Unit filename="src/gui/Scrollbar.cpp" />
<Unit filename="src/gui/Scrollbar.h" />
<Unit filename="src/gui/VPadController.h" />
<Unit filename="src/gui/WPadController.h" />
<Unit filename="src/gui/sigslot.h" />
<Unit filename="src/kernel/kernel_functions.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/kernel/kernel_functions.h" />
<Unit filename="src/kernel/kernel_hooks.S" />
<Unit filename="src/kernel/syscalls.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/kernel/syscalls.h" />
<Unit filename="src/kernel/syscalls_asm.S" />
<Unit filename="src/main.cpp" />
<Unit filename="src/main.h" />
<Unit filename="src/menu/MainWindow.cpp" />
<Unit filename="src/menu/MainWindow.h" />
<Unit filename="src/menu/MainWindowTV.cpp" />
<Unit filename="src/menu/MainWindowTV.h" />
<Unit filename="src/resources/Resources.cpp" />
<Unit filename="src/resources/Resources.h" />
<Unit filename="src/resources/filelist.h" />
<Unit filename="src/sounds/BufferCircle.cpp" />
<Unit filename="src/sounds/BufferCircle.hpp" />
<Unit filename="src/sounds/Mp3Decoder.cpp" />
<Unit filename="src/sounds/Mp3Decoder.hpp" />
<Unit filename="src/sounds/OggDecoder.cpp" />
<Unit filename="src/sounds/OggDecoder.hpp" />
<Unit filename="src/sounds/SoundDecoder.cpp" />
<Unit filename="src/sounds/SoundDecoder.hpp" />
<Unit filename="src/sounds/SoundHandler.cpp" />
<Unit filename="src/sounds/SoundHandler.hpp" />
<Unit filename="src/sounds/Voice.h" />
<Unit filename="src/sounds/WavDecoder.cpp" />
<Unit filename="src/sounds/WavDecoder.hpp" />
<Unit filename="src/system/AsyncDeleter.cpp" />
<Unit filename="src/system/AsyncDeleter.h" />
<Unit filename="src/system/CMutex.h" />
<Unit filename="src/system/CThread.h" />
<Unit filename="src/system/exception_handler.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/system/exception_handler.h" />
<Unit filename="src/system/memory.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/system/memory.h" />
<Unit filename="src/utils/StringTools.cpp" />
<Unit filename="src/utils/StringTools.h" />
<Unit filename="src/utils/logger.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/utils/logger.h" />
<Unit filename="src/utils/utils.h" />
<Unit filename="src/video/CVideo.cpp" />
<Unit filename="src/video/CVideo.h" />
<Unit filename="src/video/shaders/ColorShader.cpp" />
<Unit filename="src/video/shaders/ColorShader.h" />
<Unit filename="src/video/shaders/FXAAShader.cpp" />
<Unit filename="src/video/shaders/FXAAShader.h" />
<Unit filename="src/video/shaders/FetchShader.h" />
<Unit filename="src/video/shaders/PixelShader.h" />
<Unit filename="src/video/shaders/Shader.h" />
<Unit filename="src/video/shaders/Shader3D.cpp" />
<Unit filename="src/video/shaders/Shader3D.h" />
<Unit filename="src/video/shaders/ShaderFractalColor.cpp" />
<Unit filename="src/video/shaders/ShaderFractalColor.h" />
<Unit filename="src/video/shaders/Texture2DShader.cpp" />
<Unit filename="src/video/shaders/Texture2DShader.h" />
<Unit filename="src/video/shaders/VertexShader.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
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 <http://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:
{project} Copyright (C) {year} {fullname}
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
<http://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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

227
Makefile Normal file
View File

@ -0,0 +1,227 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
export LIBOGC_INC := $(DEVKITPRO)/libogc/include
export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
PREFIX := powerpc-eabi-
export AS := $(PREFIX)as
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# 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
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := gx2_template
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src \
src/common \
src/dynamic_libs \
src/fs \
src/game \
src/gui \
src/menu \
src/resources \
src/sounds \
src/system \
src/utils \
src/video \
src/video/shaders
DATA := data \
data/images \
data/fonts \
data/sounds
INCLUDES := src
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
ASFLAGS := -mregnames
LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections
#---------------------------------------------------------------------------------
Q := @
MAKEFLAGS += --no-print-directory
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lgcc -lgd -lpng -ljpeg -lz -lfreetype -lmad -lvorbisidec
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) \
$(DEVKITPPC)/lib \
$(DEVKITPPC)/lib/gcc/powerpc-eabi/4.8.2
#---------------------------------------------------------------------------------
# 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 PROJECTDIR := $(CURDIR)
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
FILELIST := $(shell bash ./filelist.sh)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
TTFFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.ttf)))
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o) \
$(PNGFILES:.png=.png.o) $(addsuffix .o,$(BINFILES))
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
-I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean install
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(BUILD_DBG).elf
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.elf: link.ld $(OFILES)
@echo "linking ... $(TARGET).elf"
$(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS)
$(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@
../data/loader.bin:
$(MAKE) -C ../loader clean
$(MAKE) -C ../loader
#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
@echo $(notdir $@)
@rm -f $@
@$(AR) -rc $@ $^
#---------------------------------------------------------------------------------
%.o: %.cpp
@echo $(notdir $<)
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.c
@echo $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.S
@echo $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.png.o : %.png
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.bin.o : %.bin
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.wav.o : %.wav
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.mp3.o : %.mp3
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.ogg.o : %.ogg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

18
README.md Normal file
View File

@ -0,0 +1,18 @@
#Flappy Bird GX2#
A GX2 Flappy Bird port for WiiU
Assest from floppy bird HTML5 and original android game
#Usage#
Press A to begin the Game
Press A to jump
Press HOME to exit
Avoid the pipes and the flor!
#Building#
In order to build this application, you need the custom liboGC and portlibs modified/created by dimok. You can find them on the loadiine_gx2 repo (https://github.com/dimok789/loadiine_gx2/releases/tag/v0.2). Simply put the files in your devkit folder and run the Makefile.
#Credits:#
<b>dimok</b> - WiiU librabries, dynamic_libs, examples, Homebrew Launcher
<b>Maschell</b> - GX2_Example and coding help
<b>vgmoose</b> - Coding help
<b>pwsincd</b> - Icon

BIN
data/fonts/font.ttf Normal file

Binary file not shown.

BIN
data/images/bg_back.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
data/images/bg_front.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
data/images/flappy_bird_1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

BIN
data/images/flappy_bird_2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

BIN
data/images/flappy_bird_3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

BIN
data/images/flappy_bird_4.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

BIN
data/images/font_big_0.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

BIN
data/images/font_big_1.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

BIN
data/images/font_big_2.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

BIN
data/images/font_big_3.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

BIN
data/images/font_big_4.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

BIN
data/images/font_big_5.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

BIN
data/images/font_big_6.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
data/images/font_big_7.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

BIN
data/images/font_big_8.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

BIN
data/images/font_big_9.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
data/images/font_big_null.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

BIN
data/images/loose.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
data/images/pipe_down.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/images/pipe_up.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
data/images/splash.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
data/sounds/bgMusic.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sounds/sfx_die.ogg Executable file

Binary file not shown.

BIN
data/sounds/sfx_point.ogg Executable file

Binary file not shown.

BIN
data/sounds/sfx_swooshing.ogg Executable file

Binary file not shown.

BIN
data/sounds/sfx_wing.ogg Executable file

Binary file not shown.

83
filelist.sh Executable file
View File

@ -0,0 +1,83 @@
#! /bin/bash
#
# Automatic resource file list generation
# Created by Dimok
outFile="./src/resources/filelist.h"
count_old=$(cat $outFile 2>/dev/null | tr -d '\n\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
count=0
if [[ $OSTYPE == darwin* ]];
then
for i in $(gfind ./data/images/ ./data/sounds/ ./data/fonts/ -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f)
do
files[count]=$i
count=$((count+1))
done
else
for i in $(find ./data/images/ ./data/sounds/ ./data/fonts/ -maxdepth 1 -type f \( ! -printf "%f\n" \) | sort -f)
do
files[count]=$i
count=$((count+1))
done
fi
if [ "$count_old" != "$count" ] || [ ! -f $outFile ]
then
echo "Generating filelist.h for $count files." >&2
cat <<EOF > $outFile
/****************************************************************************
* Loadiine resource files.
* This file is generated automatically.
* Includes $count files.
*
* NOTE:
* Any manual modification of this file will be overwriten by the generation.
****************************************************************************/
#ifndef _FILELIST_H_
#define _FILELIST_H_
#include <gctypes.h>
typedef struct _RecourceFile
{
const char *filename;
const u8 *DefaultFile;
const u32 &DefaultFileSize;
u8 *CustomFile;
u32 CustomFileSize;
} RecourceFile;
EOF
for i in ${files[@]}
do
filename=${i%.*}
extension=${i##*.}
echo 'extern const u8 '$filename'_'$extension'[];' >> $outFile
echo 'extern const u32 '$filename'_'$extension'_size;' >> $outFile
echo '' >> $outFile
done
echo 'static RecourceFile RecourceList[] =' >> $outFile
echo '{' >> $outFile
for i in ${files[@]}
do
filename=${i%.*}
extension=${i##*.}
echo -e '\t{"'$i'", '$filename'_'$extension', '$filename'_'$extension'_size, NULL, 0},' >> $outFile
done
echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile
echo '};' >> $outFile
echo '' >> $outFile
echo '#endif' >> $outFile
fi

6
refresh.sh Executable file
View File

@ -0,0 +1,6 @@
rm src/resources/filelist.h
make clean
make -j4
rm /media/sf_con_mint/gx2_template.elf
cp gx2_template.elf /media/sf_con_mint/gx2_template.elf

198
src/Application.cpp Normal file
View File

@ -0,0 +1,198 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "Application.h"
#include "common/common.h"
#include "dynamic_libs/os_functions.h"
#include "gui/FreeTypeGX.h"
#include "gui/VPadController.h"
#include "gui/WPadController.h"
#include "resources/Resources.h"
#include "sounds/SoundHandler.hpp"
#include "utils/logger.h"
Application *Application::applicationInstance = NULL;
bool Application::exitApplication = false;
Application::Application()
: CThread(CThread::eAttributeAffCore1 | CThread::eAttributePinnedAff, 0, 0x20000)
, bgMusic(NULL)
, video(NULL)
, mainWindow(NULL)
, exitCode(EXIT_RELAUNCH_ON_LOAD)
{
controller[0] = new VPadController(GuiTrigger::CHANNEL_1);
controller[1] = new WPadController(GuiTrigger::CHANNEL_2);
controller[2] = new WPadController(GuiTrigger::CHANNEL_3);
controller[3] = new WPadController(GuiTrigger::CHANNEL_4);
controller[4] = new WPadController(GuiTrigger::CHANNEL_5);
//! create bgMusic
/*
bgMusic = new GuiSound(Resources::GetFile("bgMusic.ogg"), Resources::GetFileSize("bgMusic.ogg"));
bgMusic->SetLoop(true);
bgMusic->Play();
bgMusic->SetVolume(50);*/
exitApplication = false;
}
Application::~Application(){
log_printf("Destroy music\n");
delete bgMusic;
log_printf("Destroy controller\n");
for(int i = 0; i < 5; i++)
delete controller[i];
log_printf("Destroy async deleter\n");
AsyncDeleter::triggerDeleteProcess();
AsyncDeleter::destroyInstance();
log_printf("Clear resources\n");
Resources::Clear();
log_printf("Stop sound handler\n");
SoundHandler::DestroyInstance();
}
int Application::exec(){
//! start main GX2 thread
resumeThread();
//! now wait for thread to finish
shutdownThread();
return exitCode;
}
void Application::fadeOut(){
GuiImage fadeOut(video->getTvWidth(), video->getTvHeight(), (GX2Color){ 0, 0, 0, 255 });
for(int i = 0; i < 255; i += 10)
{
if(i > 255)
i = 255;
fadeOut.setAlpha(i / 255.0f);
//! start rendering DRC
video->prepareDrcRendering();
mainWindow->drawDrc(video);
GX2SetDepthOnlyControl(GX2_DISABLE, GX2_DISABLE, GX2_COMPARE_ALWAYS);
fadeOut.draw(video);
GX2SetDepthOnlyControl(GX2_ENABLE, GX2_ENABLE, GX2_COMPARE_LEQUAL);
video->drcDrawDone();
//! start rendering TV
video->prepareTvRendering();
mainWindow->drawTv(video);
GX2SetDepthOnlyControl(GX2_DISABLE, GX2_DISABLE, GX2_COMPARE_ALWAYS);
fadeOut.draw(video);
GX2SetDepthOnlyControl(GX2_ENABLE, GX2_ENABLE, GX2_COMPARE_LEQUAL);
video->tvDrawDone();
//! as last point update the effects as it can drop elements
mainWindow->updateEffects();
video->waitForVSync();
}
//! one last cleared black screen
video->prepareDrcRendering();
video->drcDrawDone();
video->prepareTvRendering();
video->tvDrawDone();
video->waitForVSync();
video->tvEnable(false);
video->drcEnable(false);
}
void Application::executeThread(void){
log_printf("Initialize video\n");
video = new CVideo(GX2_TV_SCAN_MODE_720P, GX2_DRC_SINGLE);
log_printf("Video size %i x %i\n", video->getTvWidth(), video->getTvHeight());
//! setup default Font
log_printf("Initialize main font system\n");
FreeTypeGX *fontSystem = new FreeTypeGX(Resources::GetFile("font.ttf"), Resources::GetFileSize("font.ttf"), true);
GuiText::setPresetFont(fontSystem);
log_printf("Initialize main window\n");
mainWindow = new MainWindow(video->getTvWidth(), video->getTvHeight());
log_printf("Entering main loop\n");
//! main GX2 loop (60 Hz cycle with max priority on core 1)
while(!exitApplication)
{
//! Read out inputs
for(int i = 0; i < 5; i++)
{
if(controller[i]->update(video->getTvWidth(), video->getTvHeight()) == false)
continue;
if(controller[i]->data.buttons_d & VPAD_BUTTON_HOME){
exitApplication = true;
}
//! update controller states
mainWindow->update(controller[i]);
}
mainWindow->process();
//! start rendering DRC
video->prepareDrcRendering();
mainWindow->drawDrc(video);
video->drcDrawDone();
//! start rendering TV
video->prepareTvRendering();
mainWindow->drawTv(video);
video->tvDrawDone();
//! enable screen after first frame render
if(video->getFrameCount() == 0) {
video->tvEnable(true);
video->drcEnable(true);
}
//! as last point update the effects as it can drop elements
mainWindow->updateEffects();
video->waitForVSync();
//! transfer elements to real delete list here after all processes are finished
//! the elements are transfered to another list to delete the elements in a separate thread
//! and avoid blocking the GUI thread
AsyncDeleter::triggerDeleteProcess();
}
fadeOut();
delete mainWindow;
delete fontSystem;
delete video;
}

73
src/Application.h Normal file
View File

@ -0,0 +1,73 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef _APPLICATION_H
#define _APPLICATION_H
#include "menu/MainWindow.h"
#include "video/CVideo.h"
#include "system/CThread.h"
class Application : public CThread
{
public:
static Application * instance() {
if(!applicationInstance)
applicationInstance = new Application();
return applicationInstance;
}
static void destroyInstance() {
if(applicationInstance) {
delete applicationInstance;
applicationInstance = NULL;
}
}
CVideo *getVideo(void) const {
return video;
}
MainWindow *getMainWindow(void) const {
return mainWindow;
}
GuiSound *getBgMusic(void) const {
return bgMusic;
}
int exec(void);
void fadeOut(void);
void quit(int code) {
exitCode = code;
exitApplication = true;
}
private:
Application();
virtual ~Application();
static Application *applicationInstance;
static bool exitApplication;
void executeThread(void);
GuiSound *bgMusic;
CVideo *video;
MainWindow *mainWindow;
GuiController *controller[5];
int exitCode;
};
#endif //_APPLICATION_H

59
src/common/common.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef COMMON_H
#define COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#include "os_defs.h"
#define CAFE_OS_SD_PATH "/vol/external01"
#define SD_PATH "sd:"
#define WIIU_PATH "/wiiu"
/* Macros for libs */
#define LIB_CORE_INIT 0
#define LIB_NSYSNET 1
#define LIB_GX2 2
#define LIB_AOC 3
#define LIB_AX 4
#define LIB_FS 5
#define LIB_OS 6
#define LIB_PADSCORE 7
#define LIB_SOCKET 8
#define LIB_SYS 9
#define LIB_VPAD 10
#define LIB_NN_ACP 11
#define LIB_SYSHID 12
#define LIB_VPADBASE 13
// functions types
#define STATIC_FUNCTION 0
#define DYNAMIC_FUNCTION 1
// none dynamic libs
#define LIB_LOADER 0x1001
#ifndef MEM_BASE
#define MEM_BASE (0x00800000)
#endif
#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00))
#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04))
#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00))
#define OS_FIRMWARE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x04))
#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500))
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#define EXIT_HBL_EXIT 0xFFFFFFFE
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD
#ifdef __cplusplus
}
#endif
#endif /* COMMON_H */

25
src/common/os_defs.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef __OS_DEFS_H_
#define __OS_DEFS_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _OsSpecifics
{
unsigned int addr_OSDynLoad_Acquire;
unsigned int addr_OSDynLoad_FindExport;
unsigned int addr_OSTitle_main_entry;
unsigned int addr_KernSyscallTbl1;
unsigned int addr_KernSyscallTbl2;
unsigned int addr_KernSyscallTbl3;
unsigned int addr_KernSyscallTbl4;
unsigned int addr_KernSyscallTbl5;
} OsSpecifics;
#ifdef __cplusplus
}
#endif
#endif // __OS_DEFS_H_

7
src/common/types.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef TYPES_H
#define TYPES_H
#include <gctypes.h>
#endif /* TYPES_H */

View File

@ -0,0 +1,2 @@
# dynamic_libs
Dynamic libs for WiiU homebrew

View File

@ -0,0 +1,40 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "acp_functions.h"
unsigned int acp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GetMetaXml, void * _ACPMetaXml);
void InitAcquireACP(void)
{
OSDynLoad_Acquire("nn_acp.rpl", &acp_handle);
}
void InitACPFunctionPointers(void)
{
InitAcquireACP();
OSDynLoad_FindExport(acp_handle,0,"GetMetaXml__Q2_2nn3acpFP11_ACPMetaXml",&GetMetaXml);
}

View File

@ -0,0 +1,42 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __ACP_FUNCTIONS_H_
#define __ACP_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
extern unsigned int acp_handle;
void InitACPFunctionPointers(void);
void InitAcquireACP(void);
#ifdef __cplusplus
}
#endif
#endif // __VPAD_FUNCTIONS_H_

View File

@ -0,0 +1,58 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "aoc_functions.h"
unsigned int aoc_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(s32, AOC_Initialize, void);
EXPORT_DECL(s32, AOC_Finalize, void);
EXPORT_DECL(u32, AOC_CalculateWorkBufferSize, u32 num_titles);
EXPORT_DECL(s32, AOC_ListTitle, u32 * num_titles, void * titles, u32 max_titles, void * buffer, u32 buffer_size);
EXPORT_DECL(s32, AOC_OpenTitle, char* aoc_path, void * title, void * buffer, u32 buffer_size);
EXPORT_DECL(s32, AOC_CloseTitle, void * title);
EXPORT_DECL(s32, AOC_DeleteContent, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void* buffer, u32 buffer_size);
EXPORT_DECL(s32, AOC_GetPurchaseInfo, u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size);
void InitAcquireAoc(void)
{
OSDynLoad_Acquire("nn_aoc.rpl", &aoc_handle);
}
void InitAocFunctionPointers(void)
{
InitAcquireAoc();
if(aoc_handle == 0)
return;
//! assigning those is not mandatory and it does not always work to load them
OSDynLoad_FindExport(aoc_handle, 0, "AOC_Initialize", &AOC_Initialize);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_Finalize", &AOC_Finalize);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_CalculateWorkBufferSize", &AOC_CalculateWorkBufferSize);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_ListTitle", &AOC_ListTitle);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_OpenTitle", &AOC_OpenTitle);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_CloseTitle", &AOC_CloseTitle);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_DeleteContent", &AOC_DeleteContent);
OSDynLoad_FindExport(aoc_handle, 0, "AOC_GetPurchaseInfo", &AOC_GetPurchaseInfo);
}

View File

@ -0,0 +1,58 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __AOC_FUNCTIONS_H_
#define __AOC_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int aoc_handle;
#define AOC_TITLE_SIZE 104
typedef struct {
u64 title_ID;
u32 group_ID;
u16 version;
char path[88];
} AOC_TitleListType;
void InitAocFunctionPointers(void);
void InitAcquireAoc(void);
extern s32 (* AOC_Initialize)(void);
extern s32 (* AOC_Finalize)(void);
extern u32 (* AOC_CalculateWorkBufferSize)(u32 num_titles);
extern s32 (* AOC_ListTitle)(u32 * num_titles, void * titles, u32 max_titles, void * buffer, u32 buffer_size);
extern s32 (* AOC_OpenTitle)(char* aoc_path, void * title, void * buffer, u32 buffer_size);
extern s32 (* AOC_CloseTitle)(void * title);
extern s32 (* AOC_DeleteContent)(u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size);
extern s32 (* AOC_GetPurchaseInfo)(u32 * bResult, u64 title_id, u16 contentIndexes[], u32 numberOfContent, void * buffer, u32 buffer_size);
#ifdef __cplusplus
}
#endif
#endif // __AOC_FUNCTIONS_H_

View File

@ -0,0 +1,118 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "common/common.h"
#include "os_functions.h"
#include "ax_functions.h"
unsigned int sound_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, AXInitWithParams, u32 * params);
EXPORT_DECL(void, AXInit, void);
EXPORT_DECL(void, AXQuit, void);
EXPORT_DECL(u32, AXGetInputSamplesPerSec, void);
EXPORT_DECL(u32, AXGetInputSamplesPerFrame, void);
EXPORT_DECL(s32, AXVoiceBegin, void *v);
EXPORT_DECL(s32, AXVoiceEnd, void *v);
EXPORT_DECL(void, AXSetVoiceType, void *v, u16 type);
EXPORT_DECL(void, AXSetVoiceOffsets, void *v, const void *buf);
EXPORT_DECL(void, AXSetVoiceSrcType, void *v, u32 type);
EXPORT_DECL(void, AXSetVoiceVe, void *v, const void *vol);
EXPORT_DECL(s32, AXSetVoiceDeviceMix, void *v, s32 device, u32 id, void *mix);
EXPORT_DECL(void, AXSetVoiceState, void *v, u16 state);
EXPORT_DECL(void, AXSetVoiceSrc, void *v, const void *src);
EXPORT_DECL(s32, AXSetVoiceSrcRatio, void *v,f32 ratio)
EXPORT_DECL(void *, AXAcquireVoice, u32 prio, void * callback, u32 arg);
EXPORT_DECL(void, AXFreeVoice, void *v);
EXPORT_DECL(void, AXRegisterFrameCallback, void * callback);
EXPORT_DECL(u32, AXGetVoiceLoopCount, void *v);
EXPORT_DECL(void, AXSetVoiceEndOffset, void *v, u32 offset);
EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset);
void InitAcquireAX(void)
{
unsigned int *funcPointer = 0;
if(OS_FIRMWARE >= 400)
{
AXInit = 0;
OSDynLoad_Acquire("sndcore2.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInitWithParams);
OS_FIND_EXPORT(sound_handle, AXGetInputSamplesPerSec);
}
else
{
AXInitWithParams = 0;
AXGetInputSamplesPerSec = 0;
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
OS_FIND_EXPORT(sound_handle, AXInit);
}
}
void InitAXFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireAX();
OS_FIND_EXPORT(sound_handle, AXQuit);
OS_FIND_EXPORT(sound_handle, AXVoiceBegin);
OS_FIND_EXPORT(sound_handle, AXVoiceEnd);
OS_FIND_EXPORT(sound_handle, AXSetVoiceType);
OS_FIND_EXPORT(sound_handle, AXSetVoiceOffsets);
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcType);
OS_FIND_EXPORT(sound_handle, AXSetVoiceVe);
OS_FIND_EXPORT(sound_handle, AXSetVoiceDeviceMix);
OS_FIND_EXPORT(sound_handle, AXSetVoiceState);
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrc);
OS_FIND_EXPORT(sound_handle, AXSetVoiceSrcRatio);
OS_FIND_EXPORT(sound_handle, AXAcquireVoice);
OS_FIND_EXPORT(sound_handle, AXFreeVoice);
OS_FIND_EXPORT(sound_handle, AXRegisterFrameCallback);
OS_FIND_EXPORT(sound_handle, AXGetVoiceLoopCount);
OS_FIND_EXPORT(sound_handle, AXSetVoiceEndOffset);
OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset);
}
void ProperlyEndTransitionAudio(void)
{
bool (* check_os_audio_transition_flag_old)(void);
void (* AXInit_old)(void);
void (* AXQuit_old)(void);
unsigned int *funcPointer = 0;
unsigned int sound_handle;
OSDynLoad_Acquire("snd_core.rpl", &sound_handle);
OS_FIND_EXPORT_EX(sound_handle, check_os_audio_transition_flag, check_os_audio_transition_flag_old);
OS_FIND_EXPORT_EX(sound_handle, AXInit, AXInit_old);
OS_FIND_EXPORT_EX(sound_handle, AXQuit, AXQuit_old);
if (check_os_audio_transition_flag_old())
{
AXInit_old();
AXQuit_old();
}
}

View File

@ -0,0 +1,64 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __AX_FUNCTIONS_H_
#define __AX_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
extern unsigned int sound_handle;
void InitAXFunctionPointers(void);
void InitAcquireAX(void);
void ProperlyEndTransitionAudio(void);
extern void (* AXInitWithParams)(u32 * params);
extern void (* AXInit)(void);
extern void (* AXQuit)(void);
extern u32 (* AXGetInputSamplesPerSec)(void);
extern s32 (* AXVoiceBegin)(void *v);
extern s32 (* AXVoiceEnd)(void *v);
extern void (* AXSetVoiceType)(void *v, u16 type);
extern void (* AXSetVoiceOffsets)(void *v, const void *buf);
extern void (* AXSetVoiceSrcType)(void *v, u32 type);
extern void (* AXSetVoiceVe)(void *v, const void *vol);
extern s32 (* AXSetVoiceDeviceMix)(void *v, s32 device, u32 id, void *mix);
extern void (* AXSetVoiceState)(void *v, u16 state);
extern void (* AXSetVoiceSrc)(void *v, const void *src);
extern s32 (* AXSetVoiceSrcRatio)(void *v, f32 ratio);
extern void * (* AXAcquireVoice)(u32 prio, void * callback, u32 arg);
extern void (* AXFreeVoice)(void *v);
extern void (* AXRegisterFrameCallback)(void * callback);
extern u32 (* AXGetVoiceLoopCount)(void * v);
extern void (* AXSetVoiceEndOffset)(void * v, u32 offset);
extern void (* AXSetVoiceLoopOffset)(void * v, u32 offset);
#ifdef __cplusplus
}
#endif
#endif // __VPAD_FUNCTIONS_H_

View File

@ -0,0 +1,54 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "curl_functions.h"
unsigned int libcurl_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(CURLcode, n_curl_global_init, long flags);
EXPORT_DECL(CURL *, n_curl_easy_init, void);
EXPORT_DECL(CURLcode, n_curl_easy_setopt, CURL *curl, CURLoption option, ...);
EXPORT_DECL(CURLcode, n_curl_easy_perform, CURL *curl);
EXPORT_DECL(void, n_curl_easy_cleanup, CURL *curl);
EXPORT_DECL(CURLcode, n_curl_easy_getinfo, CURL *curl, CURLINFO info, ...);
void InitAcquireCurl(void)
{
OSDynLoad_Acquire("nlibcurl", &libcurl_handle);
}
void InitCurlFunctionPointers(void)
{
InitAcquireCurl();
unsigned int *funcPointer = 0;
OS_FIND_EXPORT_EX(libcurl_handle, curl_global_init, n_curl_global_init);
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_init, n_curl_easy_init);
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_setopt, n_curl_easy_setopt);
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_perform, n_curl_easy_perform);
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_cleanup, n_curl_easy_cleanup);
OS_FIND_EXPORT_EX(libcurl_handle, curl_easy_getinfo, n_curl_easy_getinfo);
n_curl_global_init(CURL_GLOBAL_ALL);
}

View File

@ -0,0 +1,51 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __CURL_FUNCTIONS_H_
#define __CURL_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
#include "socket_functions.h"
typedef int socklen_t;
#include <curl/curl.h>
#include <curl/easy.h>
void InitCurlFunctionPointers(void);
void InitAcquireCurl(void);
extern CURLcode (* n_curl_global_init)(long flags);
extern CURL * (* n_curl_easy_init)(void);
extern CURLcode (* n_curl_easy_setopt)(CURL *curl, CURLoption option, ...);
extern CURLcode (* n_curl_easy_perform)(CURL *curl);
extern void (* n_curl_easy_cleanup)(CURL *curl);
extern CURLcode (* n_curl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
#ifdef __cplusplus
}
#endif
#endif // __CURL_FUNCTIONS_H_

View File

@ -0,0 +1,61 @@
#ifndef FS_DEFS_H
#define FS_DEFS_H
#include <gctypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/* FS defines and types */
#define FS_MAX_LOCALPATH_SIZE 511
#define FS_MAX_MOUNTPATH_SIZE 128
#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE)
#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE
#define FS_STATUS_OK 0
#define FS_RET_UNSUPPORTED_CMD 0x0400
#define FS_RET_NO_ERROR 0x0000
#define FS_RET_ALL_ERROR (unsigned int)(-1)
#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000
/* max length of file/dir name */
#define FS_MAX_ENTNAME_SIZE 256
#define FS_SOURCETYPE_EXTERNAL 0
#define FS_SOURCETYPE_HFIO 1
#define FS_MOUNT_SOURCE_SIZE 0x300
#define FS_CLIENT_SIZE 0x1700
#define FS_CMD_BLOCK_SIZE 0xA80
typedef struct
{
uint32_t flag;
uint32_t permission;
uint32_t owner_id;
uint32_t group_id;
uint32_t size;
uint32_t alloc_size;
uint64_t quota_size;
uint32_t ent_id;
uint64_t ctime;
uint64_t mtime;
uint8_t attributes[48];
} __attribute__((packed)) FSStat;
typedef struct
{
FSStat stat;
char name[FS_MAX_ENTNAME_SIZE];
} FSDirEntry;
#ifdef __cplusplus
}
#endif
#endif /* FS_DEFS_H */

View File

@ -0,0 +1,131 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "fs_functions.h"
#include "os_functions.h"
EXPORT_DECL(int, FSInit, void);
EXPORT_DECL(int, FSShutdown, void);
EXPORT_DECL(int, FSAddClientEx, void *pClient, int unk_zero_param, int errHandling);
EXPORT_DECL(int, FSDelClient, void *pClient);
EXPORT_DECL(void, FSInitCmdBlock, void *pCmd);
EXPORT_DECL(int, FSGetMountSource, void *pClient, void *pCmd, int type, void *source, int errHandling);
EXPORT_DECL(int, FSMount, void *pClient, void *pCmd, void *source, char *target, uint32_t bytes, int errHandling);
EXPORT_DECL(int, FSUnmount, void *pClient, void *pCmd, const char *target, int errHandling);
EXPORT_DECL(int, FSGetStat, void *pClient, void *pCmd, const char *path, FSStat *stats, int errHandling);
EXPORT_DECL(int, FSGetStatAsync, void *pClient, void *pCmd, const char *path, void *stats, int error, void *asyncParams);
EXPORT_DECL(int, FSRename, void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error);
EXPORT_DECL(int, FSRenameAsync, void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams);
EXPORT_DECL(int, FSRemove, void *pClient, void *pCmd, const char *path, int error);
EXPORT_DECL(int, FSRemoveAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
EXPORT_DECL(int, FSFlushQuota, void *pClient, void *pCmd, const char* path, int error);
EXPORT_DECL(int, FSFlushQuotaAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
EXPORT_DECL(int, FSGetFreeSpaceSize, void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error);
EXPORT_DECL(int, FSGetFreeSpaceSizeAsync, void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error, void *asyncParams);
EXPORT_DECL(int, FSRollbackQuota, void *pClient, void *pCmd, const char *path, int error);
EXPORT_DECL(int, FSRollbackQuotaAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
EXPORT_DECL(int, FSOpenDir, void *pClient, void *pCmd, const char *path, int *dh, int errHandling);
EXPORT_DECL(int, FSOpenDirAsync, void *pClient, void* pCmd, const char *path, int *handle, int error, void *asyncParams);
EXPORT_DECL(int, FSReadDir, void *pClient, void *pCmd, int dh, FSDirEntry *dir_entry, int errHandling);
EXPORT_DECL(int, FSRewindDir, void *pClient, void *pCmd, int dh, int errHandling);
EXPORT_DECL(int, FSCloseDir, void *pClient, void *pCmd, int dh, int errHandling);
EXPORT_DECL(int, FSChangeDir, void *pClient, void *pCmd, const char *path, int errHandling);
EXPORT_DECL(int, FSChangeDirAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
EXPORT_DECL(int, FSMakeDir, void *pClient, void *pCmd, const char *path, int errHandling);
EXPORT_DECL(int, FSMakeDirAsync, void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
EXPORT_DECL(int, FSOpenFile, void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling);
EXPORT_DECL(int, FSOpenFileAsync, void *pClient, void *pCmd, const char *path, const char *mode, int *handle, int error, const void *asyncParams);
EXPORT_DECL(int, FSReadFile, void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling);
EXPORT_DECL(int, FSCloseFile, void *pClient, void *pCmd, int fd, int errHandling);
EXPORT_DECL(int, FSFlushFile, void *pClient, void *pCmd, int fd, int error);
EXPORT_DECL(int, FSTruncateFile, void *pClient, void *pCmd, int fd, int error);
EXPORT_DECL(int, FSGetStatFile, void *pClient, void *pCmd, int fd, void *buffer, int error);
EXPORT_DECL(int, FSSetPosFile, void *pClient, void *pCmd, int fd, int pos, int error);
EXPORT_DECL(int, FSWriteFile, void *pClient, void *pCmd, const void *source, int block_size, int block_count, int fd, int flag, int error);
EXPORT_DECL(int, FSBindMount, void *pClient, void *pCmd, char *source, char *target, int error);
EXPORT_DECL(int, FSBindUnmount, void *pClient, void *pCmd, char *target, int error);
EXPORT_DECL(int, FSMakeQuota, void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling);
EXPORT_DECL(int, FSMakeQuotaAsync ,void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling,const void *asyncParams);
void InitFSFunctionPointers(void)
{
unsigned int *funcPointer = 0;
OS_FIND_EXPORT(coreinit_handle, FSInit);
OS_FIND_EXPORT(coreinit_handle, FSShutdown);
OS_FIND_EXPORT(coreinit_handle, FSAddClientEx);
OS_FIND_EXPORT(coreinit_handle, FSDelClient);
OS_FIND_EXPORT(coreinit_handle, FSInitCmdBlock);
OS_FIND_EXPORT(coreinit_handle, FSGetMountSource);
OS_FIND_EXPORT(coreinit_handle, FSMount);
OS_FIND_EXPORT(coreinit_handle, FSUnmount);
OS_FIND_EXPORT(coreinit_handle, FSGetStat);
OS_FIND_EXPORT(coreinit_handle, FSGetStatAsync);
OS_FIND_EXPORT(coreinit_handle, FSRename);
OS_FIND_EXPORT(coreinit_handle, FSRenameAsync);
OS_FIND_EXPORT(coreinit_handle, FSRemove);
OS_FIND_EXPORT(coreinit_handle, FSRemoveAsync);
OS_FIND_EXPORT(coreinit_handle, FSFlushQuota);
OS_FIND_EXPORT(coreinit_handle, FSFlushQuotaAsync);
OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSize);
OS_FIND_EXPORT(coreinit_handle, FSGetFreeSpaceSizeAsync);
OS_FIND_EXPORT(coreinit_handle, FSRollbackQuota);
OS_FIND_EXPORT(coreinit_handle, FSRollbackQuotaAsync);
OS_FIND_EXPORT(coreinit_handle, FSOpenDir);
OS_FIND_EXPORT(coreinit_handle, FSOpenDirAsync);
OS_FIND_EXPORT(coreinit_handle, FSReadDir);
OS_FIND_EXPORT(coreinit_handle, FSRewindDir);
OS_FIND_EXPORT(coreinit_handle, FSCloseDir);
OS_FIND_EXPORT(coreinit_handle, FSChangeDir);
OS_FIND_EXPORT(coreinit_handle, FSChangeDirAsync);
OS_FIND_EXPORT(coreinit_handle, FSMakeDir);
OS_FIND_EXPORT(coreinit_handle, FSMakeDirAsync);
OS_FIND_EXPORT(coreinit_handle, FSOpenFile);
OS_FIND_EXPORT(coreinit_handle, FSOpenFileAsync);
OS_FIND_EXPORT(coreinit_handle, FSReadFile);
OS_FIND_EXPORT(coreinit_handle, FSCloseFile);
OS_FIND_EXPORT(coreinit_handle, FSFlushFile);
OS_FIND_EXPORT(coreinit_handle, FSTruncateFile);
OS_FIND_EXPORT(coreinit_handle, FSGetStatFile);
OS_FIND_EXPORT(coreinit_handle, FSSetPosFile);
OS_FIND_EXPORT(coreinit_handle, FSWriteFile);
OS_FIND_EXPORT(coreinit_handle, FSBindMount);
OS_FIND_EXPORT(coreinit_handle, FSBindUnmount);
OS_FIND_EXPORT(coreinit_handle, FSMakeQuota);
OS_FIND_EXPORT(coreinit_handle, FSMakeQuotaAsync);
}

View File

@ -0,0 +1,95 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __FS_FUNCTIONS_H_
#define __FS_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
#include "fs_defs.h"
void InitFSFunctionPointers(void);
extern int (* FSInit)(void);
extern int (* FSShutdown)(void);
extern int (* FSAddClientEx)(void *pClient, int unk_zero_param, int errHandling);
extern int (* FSDelClient)(void *pClient);
extern void (* FSInitCmdBlock)(void *pCmd);
extern int (* FSGetMountSource)(void *pClient, void *pCmd, int type, void *source, int errHandling);
extern int (* FSMount)(void *pClient, void *pCmd, void *source, char *target, uint32_t bytes, int errHandling);
extern int (* FSUnmount)(void *pClient, void *pCmd, const char *target, int errHandling);
extern int (* FSRename)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error);
extern int (* FSRenameAsync)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams);
extern int (* FSRemove)(void *pClient, void *pCmd, const char *path, int error);
extern int (* FSRemoveAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSGetStat)(void *pClient, void *pCmd, const char *path, FSStat *stats, int errHandling);
extern int (* FSGetStatAsync)(void *pClient, void *pCmd, const char *path, void *stats, int error, void *asyncParams);
extern int (* FSRename)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error);
extern int (* FSRenameAsync)(void *pClient, void *pCmd, const char *oldPath, const char *newPath, int error, void *asyncParams);
extern int (* FSRemove)(void *pClient, void *pCmd, const char *path, int error);
extern int (* FSRemoveAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSFlushQuota)(void *pClient, void *pCmd, const char* path, int error);
extern int (* FSFlushQuotaAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSGetFreeSpaceSize)(void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error);
extern int (* FSGetFreeSpaceSizeAsync)(void *pClient, void *pCmd, const char *path, uint64_t *returnedFreeSize, int error, void *asyncParams);
extern int (* FSRollbackQuota)(void *pClient, void *pCmd, const char *path, int error);
extern int (* FSRollbackQuotaAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSOpenDir)(void *pClient, void *pCmd, const char *path, int *dh, int errHandling);
extern int (* FSOpenDirAsync)(void *pClient, void* pCmd, const char *path, int *handle, int error, void *asyncParams);
extern int (* FSReadDir)(void *pClient, void *pCmd, int dh, FSDirEntry *dir_entry, int errHandling);
extern int (* FSRewindDir)(void *pClient, void *pCmd, int dh, int errHandling);
extern int (* FSCloseDir)(void *pClient, void *pCmd, int dh, int errHandling);
extern int (* FSChangeDir)(void *pClient, void *pCmd, const char *path, int errHandling);
extern int (* FSChangeDirAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSMakeDir)(void *pClient, void *pCmd, const char *path, int errHandling);
extern int (* FSMakeDirAsync)(void *pClient, void *pCmd, const char *path, int error, void *asyncParams);
extern int (* FSOpenFile)(void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling);
extern int (* FSOpenFileAsync)(void *pClient, void *pCmd, const char *path, const char *mode, int *handle, int error, const void *asyncParams);
extern int (* FSReadFile)(void *pClient, void *pCmd, void *buffer, int size, int count, int fd, int flag, int errHandling);
extern int (* FSCloseFile)(void *pClient, void *pCmd, int fd, int errHandling);
extern int (* FSFlushFile)(void *pClient, void *pCmd, int fd, int error);
extern int (* FSTruncateFile)(void *pClient, void *pCmd, int fd, int error);
extern int (* FSGetStatFile)(void *pClient, void *pCmd, int fd, void *buffer, int error);
extern int (* FSSetPosFile)(void *pClient, void *pCmd, int fd, int pos, int error);
extern int (* FSWriteFile)(void *pClient, void *pCmd, const void *source, int block_size, int block_count, int fd, int flag, int error);
extern int (* FSBindMount)(void *pClient, void *pCmd, char *source, char *target, int error);
extern int (* FSBindUnmount)(void *pClient, void *pCmd, char *target, int error);
extern int (* FSMakeQuota)( void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling);
extern int (* FSMakeQuotaAsync)(void *pClient, void *pCmd, const char *path,u32 mode, u64 size, int errHandling,const void *asyncParams);
#ifdef __cplusplus
}
#endif
#endif // __FS_FUNCTIONS_H_

View File

@ -0,0 +1,173 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "gx2_types.h"
unsigned int gx2_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, GX2Init, u32 * init_attribs);
EXPORT_DECL(void, GX2Shutdown, void);
EXPORT_DECL(void, GX2Flush, void);
EXPORT_DECL(s32, GX2GetMainCoreId, void) ;
EXPORT_DECL(s32, GX2DrawDone, void);
EXPORT_DECL(void, GX2ClearColor, GX2ColorBuffer *colorBuffer, f32 r, f32 g, f32 b, f32 a);
EXPORT_DECL(void, GX2SetViewport, f32 x, f32 y, f32 w, f32 h, f32 nearZ, f32 farZ);
EXPORT_DECL(void, GX2SetScissor, u32 x_orig, u32 y_orig, u32 wd, u32 ht);
EXPORT_DECL(void, GX2SetContextState, const GX2ContextState* state);
EXPORT_DECL(void, GX2DrawEx, s32 primitive_type, u32 count, u32 first_vertex, u32 instances_count);
EXPORT_DECL(void, GX2DrawIndexedEx, s32 primitive_type, u32 count, s32 index_format, const void* idx, u32 first_vertex, u32 instances_count);
EXPORT_DECL(void, GX2ClearDepthStencilEx, GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value, s32 clear_mode);
EXPORT_DECL(void, GX2SetClearDepthStencil, GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value);
EXPORT_DECL(void, GX2CopyColorBufferToScanBuffer, const GX2ColorBuffer *colorBuffer, s32 scan_target);
EXPORT_DECL(void, GX2SwapScanBuffers, void);
EXPORT_DECL(void, GX2SetTVEnable, s32 enable);
EXPORT_DECL(void, GX2SetSwapInterval, u32 swap_interval);
EXPORT_DECL(u32, GX2GetSwapInterval, void);
EXPORT_DECL(void, GX2WaitForVsync, void);
EXPORT_DECL(void, GX2CalcTVSize, s32 tv_render_mode, s32 format, s32 buffering_mode, u32 * size, s32 * scale_needed);
EXPORT_DECL(void, GX2Invalidate, s32 invalidate_type, void * ptr, u32 buffer_size);
EXPORT_DECL(void, GX2SetTVBuffer, void *buffer, u32 buffer_size, s32 tv_render_mode, s32 format, s32 buffering_mode);
EXPORT_DECL(void, GX2CalcSurfaceSizeAndAlignment, GX2Surface *surface);
EXPORT_DECL(void, GX2InitDepthBufferRegs, GX2DepthBuffer *depthBuffer);
EXPORT_DECL(void, GX2InitColorBufferRegs, GX2ColorBuffer *colorBuffer);
EXPORT_DECL(void, GX2CalcColorBufferAuxInfo, GX2ColorBuffer *colorBuffer, u32 *size, u32 *align);
EXPORT_DECL(void, GX2CalcDepthBufferHiZInfo, GX2DepthBuffer *depthBuffer, u32 *size, u32 *align);
EXPORT_DECL(void, GX2InitDepthBufferHiZEnable, GX2DepthBuffer *depthBuffer, s32 hiZ_enable);
EXPORT_DECL(void, GX2SetupContextStateEx, GX2ContextState* state, s32 enable_profiling);
EXPORT_DECL(void, GX2SetColorBuffer, const GX2ColorBuffer *colorBuffer, s32 target);
EXPORT_DECL(void, GX2SetDepthBuffer, const GX2DepthBuffer *depthBuffer);
EXPORT_DECL(void, GX2SetAttribBuffer, u32 attr_index, u32 attr_size, u32 stride, const void* attr);
EXPORT_DECL(void, GX2InitTextureRegs, GX2Texture *texture);
EXPORT_DECL(void, GX2InitSampler, GX2Sampler *sampler, s32 tex_clamp, s32 min_mag_filter);
EXPORT_DECL(u32, GX2CalcFetchShaderSizeEx, u32 num_attrib, s32 fetch_shader_type, s32 tessellation_mode);
EXPORT_DECL(void, GX2InitFetchShaderEx, GX2FetchShader* fs, void* fs_buffer, u32 count, const GX2AttribStream* attribs, s32 fetch_shader_type, s32 tessellation_mode);
EXPORT_DECL(void, GX2SetFetchShader, const GX2FetchShader* fs);
EXPORT_DECL(void, GX2SetVertexUniformReg, u32 offset, u32 count, const void *values);
EXPORT_DECL(void, GX2SetPixelUniformReg, u32 offset, u32 count, const void *values);
EXPORT_DECL(void, GX2SetPixelTexture, const GX2Texture *texture, u32 texture_hw_location);
EXPORT_DECL(void, GX2SetVertexTexture, const GX2Texture *texture, u32 texture_hw_location);
EXPORT_DECL(void, GX2SetPixelSampler, const GX2Sampler *sampler, u32 sampler_hw_location);
EXPORT_DECL(void, GX2SetVertexSampler, const GX2Sampler *sampler, u32 sampler_hw_location);
EXPORT_DECL(void, GX2SetPixelShader, const GX2PixelShader* pixelShader);
EXPORT_DECL(void, GX2SetVertexShader, const GX2VertexShader* vertexShader);
EXPORT_DECL(void, GX2InitSamplerZMFilter, GX2Sampler *sampler, s32 z_filter, s32 mip_filter);
EXPORT_DECL(void, GX2SetColorControl, s32 lop, u8 blend_enable_mask, s32 enable_multi_write, s32 enable_color_buffer);
EXPORT_DECL(void, GX2SetDepthOnlyControl, s32 enable_depth, s32 enable_depth_write, s32 depth_comp_function);
EXPORT_DECL(void, GX2SetBlendControl, s32 target, s32 color_src_blend, s32 color_dst_blend, s32 color_combine, s32 separate_alpha_blend, s32 alpha_src_blend, s32 alpha_dst_blend, s32 alpha_combine);
EXPORT_DECL(void, GX2CalcDRCSize, s32 drc_mode, s32 format, s32 buffering_mode, u32 *size, s32 *scale_needed);
EXPORT_DECL(void, GX2SetDRCBuffer, void *buffer, u32 buffer_size, s32 drc_mode, s32 surface_format, s32 buffering_mode);
EXPORT_DECL(void, GX2SetDRCScale, u32 width, u32 height);
EXPORT_DECL(void, GX2SetDRCEnable, s32 enable);
EXPORT_DECL(void, GX2SetPolygonControl, s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset);
EXPORT_DECL(void, GX2SetCullOnlyControl, s32 front_face_mode, s32 cull_front, s32 cull_back);
EXPORT_DECL(void, GX2SetDepthStencilControl, s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable,
s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail,
s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail);
EXPORT_DECL(void, GX2SetStencilMask, u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back);
EXPORT_DECL(void, GX2SetLineWidth, f32 width);
EXPORT_DECL(void, GX2SetTVGamma, f32 val);
EXPORT_DECL(void, GX2SetDRCGamma, f32 gam);
EXPORT_DECL(s32, GX2GetSystemTVScanMode, void);
EXPORT_DECL(s32, GX2GetSystemDRCScanMode, void);
EXPORT_DECL(void, GX2RSetAllocator, void * (* allocFunc)(u32, u32, u32), void (* freeFunc)(u32, void*));
EXPORT_DECL(void, GX2CopySurface, GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice );
EXPORT_DECL(void, GX2ClearBuffersEx, GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,int clearFlags);
void InitAcquireGX2(void)
{
OSDynLoad_Acquire("gx2.rpl", &gx2_handle);
}
void InitGX2FunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireGX2();
OS_FIND_EXPORT(gx2_handle, GX2Init);
OS_FIND_EXPORT(gx2_handle, GX2Shutdown);
OS_FIND_EXPORT(gx2_handle, GX2Flush);
OS_FIND_EXPORT(gx2_handle, GX2GetMainCoreId);
OS_FIND_EXPORT(gx2_handle, GX2DrawDone);
OS_FIND_EXPORT(gx2_handle, GX2ClearColor);
OS_FIND_EXPORT(gx2_handle, GX2SetViewport);
OS_FIND_EXPORT(gx2_handle, GX2SetScissor);
OS_FIND_EXPORT(gx2_handle, GX2SetContextState);
OS_FIND_EXPORT(gx2_handle, GX2DrawEx);
OS_FIND_EXPORT(gx2_handle, GX2DrawIndexedEx);
OS_FIND_EXPORT(gx2_handle, GX2ClearDepthStencilEx);
OS_FIND_EXPORT(gx2_handle, GX2CopyColorBufferToScanBuffer);
OS_FIND_EXPORT(gx2_handle, GX2SwapScanBuffers);
OS_FIND_EXPORT(gx2_handle, GX2SetTVEnable);
OS_FIND_EXPORT(gx2_handle, GX2SetSwapInterval);
OS_FIND_EXPORT(gx2_handle, GX2GetSwapInterval);
OS_FIND_EXPORT(gx2_handle, GX2WaitForVsync);
OS_FIND_EXPORT(gx2_handle, GX2CalcTVSize);
OS_FIND_EXPORT(gx2_handle, GX2Invalidate);
OS_FIND_EXPORT(gx2_handle, GX2SetTVBuffer);
OS_FIND_EXPORT(gx2_handle, GX2CalcSurfaceSizeAndAlignment);
OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferRegs);
OS_FIND_EXPORT(gx2_handle, GX2InitColorBufferRegs);
OS_FIND_EXPORT(gx2_handle, GX2CalcColorBufferAuxInfo);
OS_FIND_EXPORT(gx2_handle, GX2CalcDepthBufferHiZInfo);
OS_FIND_EXPORT(gx2_handle, GX2InitDepthBufferHiZEnable);
OS_FIND_EXPORT(gx2_handle, GX2SetupContextStateEx);
OS_FIND_EXPORT(gx2_handle, GX2SetColorBuffer);
OS_FIND_EXPORT(gx2_handle, GX2SetDepthBuffer);
OS_FIND_EXPORT(gx2_handle, GX2SetAttribBuffer);
OS_FIND_EXPORT(gx2_handle, GX2InitTextureRegs);
OS_FIND_EXPORT(gx2_handle, GX2InitSampler);
OS_FIND_EXPORT(gx2_handle, GX2CalcFetchShaderSizeEx);
OS_FIND_EXPORT(gx2_handle, GX2InitFetchShaderEx);
OS_FIND_EXPORT(gx2_handle, GX2SetFetchShader);
OS_FIND_EXPORT(gx2_handle, GX2SetVertexUniformReg);
OS_FIND_EXPORT(gx2_handle, GX2SetPixelUniformReg);
OS_FIND_EXPORT(gx2_handle, GX2SetPixelTexture);
OS_FIND_EXPORT(gx2_handle, GX2SetVertexTexture);
OS_FIND_EXPORT(gx2_handle, GX2SetPixelSampler);
OS_FIND_EXPORT(gx2_handle, GX2SetVertexSampler);
OS_FIND_EXPORT(gx2_handle, GX2SetPixelShader);
OS_FIND_EXPORT(gx2_handle, GX2SetVertexShader);
OS_FIND_EXPORT(gx2_handle, GX2InitSamplerZMFilter);
OS_FIND_EXPORT(gx2_handle, GX2SetColorControl);
OS_FIND_EXPORT(gx2_handle, GX2SetDepthOnlyControl);
OS_FIND_EXPORT(gx2_handle, GX2SetBlendControl);
OS_FIND_EXPORT(gx2_handle, GX2CalcDRCSize);
OS_FIND_EXPORT(gx2_handle, GX2SetDRCBuffer);
OS_FIND_EXPORT(gx2_handle, GX2SetDRCScale);
OS_FIND_EXPORT(gx2_handle, GX2SetDRCEnable);
OS_FIND_EXPORT(gx2_handle, GX2SetPolygonControl);
OS_FIND_EXPORT(gx2_handle, GX2SetCullOnlyControl);
OS_FIND_EXPORT(gx2_handle, GX2SetDepthStencilControl);
OS_FIND_EXPORT(gx2_handle, GX2SetStencilMask);
OS_FIND_EXPORT(gx2_handle, GX2SetLineWidth);
OS_FIND_EXPORT(gx2_handle, GX2SetDRCGamma);
OS_FIND_EXPORT(gx2_handle, GX2SetTVGamma);
OS_FIND_EXPORT(gx2_handle, GX2GetSystemTVScanMode);
OS_FIND_EXPORT(gx2_handle, GX2GetSystemDRCScanMode);
OS_FIND_EXPORT(gx2_handle, GX2RSetAllocator);
OS_FIND_EXPORT(gx2_handle, GX2CopySurface);
OS_FIND_EXPORT(gx2_handle, GX2ClearBuffersEx);
OS_FIND_EXPORT(gx2_handle, GX2SetClearDepthStencil);
}

View File

@ -0,0 +1,211 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __GX2_FUNCTIONS_H_
#define __GX2_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "gx2_types.h"
extern unsigned int gx2_handle;
void InitGX2FunctionPointers(void);
void InitAcquireGX2(void);
extern void (* GX2Init)(u32 * init_attribs);
extern void (* GX2Shutdown)(void);
extern void (* GX2Flush)(void);
extern s32 (* GX2GetMainCoreId)(void) ;
extern s32 (* GX2DrawDone)(void);
extern void (* GX2ClearColor)(GX2ColorBuffer *colorBuffer, f32 r, f32 g, f32 b, f32 a);
extern void (* GX2SetViewport)(f32 x, f32 y, f32 w, f32 h, f32 nearZ, f32 farZ);
extern void (* GX2SetScissor)(u32 x_orig, u32 y_orig, u32 wd, u32 ht);
extern void (* GX2SetContextState)(const GX2ContextState* state);
extern void (* GX2DrawEx)(s32 primitive_type, u32 count, u32 first_vertex, u32 instances_count);
extern void (* GX2DrawIndexedEx)(s32 primitive_type, u32 count, s32 index_format, const void* idx, u32 first_vertex, u32 instances_count);
extern void (* GX2ClearDepthStencilEx)(GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value, s32 clear_mode);
extern void (* GX2SetClearDepthStencil)(GX2DepthBuffer *depthBuffer, f32 depth_value, u8 stencil_value);
extern void (* GX2CopyColorBufferToScanBuffer)(const GX2ColorBuffer *colorBuffer, s32 scan_target);
extern void (* GX2SwapScanBuffers)(void);
extern void (* GX2SetTVEnable)(s32 enable);
extern void (* GX2SetSwapInterval)(u32 swap_interval);
extern u32 (* GX2GetSwapInterval)(void);
extern void (* GX2WaitForVsync)(void);
extern void (* GX2CalcTVSize)(s32 tv_render_mode, s32 format, s32 buffering_mode, u32 * size, s32 * scale_needed);
extern void (* GX2Invalidate)(s32 invalidate_type, void * ptr, u32 buffer_size);
extern void (* GX2SetTVBuffer)(void *buffer, u32 buffer_size, s32 tv_render_mode, s32 format, s32 buffering_mode);
extern void (* GX2CalcSurfaceSizeAndAlignment)(GX2Surface *surface);
extern void (* GX2InitDepthBufferRegs)(GX2DepthBuffer *depthBuffer);
extern void (* GX2InitColorBufferRegs)(GX2ColorBuffer *colorBuffer);
extern void (* GX2CalcColorBufferAuxInfo)(GX2ColorBuffer *colorBuffer, u32 *size, u32 *align);
extern void (* GX2CalcDepthBufferHiZInfo)(GX2DepthBuffer *depthBuffer, u32 *size, u32 *align);
extern void (* GX2InitDepthBufferHiZEnable)(GX2DepthBuffer *depthBuffer, s32 hiZ_enable);
extern void (* GX2SetupContextStateEx)(GX2ContextState* state, s32 enable_profiling);
extern void (* GX2SetColorBuffer)(const GX2ColorBuffer *colorBuffer, s32 target);
extern void (* GX2SetDepthBuffer)(const GX2DepthBuffer *depthBuffer);
extern void (* GX2SetAttribBuffer)(u32 attr_index, u32 attr_size, u32 stride, const void* attr);
extern void (* GX2InitTextureRegs)(GX2Texture *texture);
extern void (* GX2InitSampler)(GX2Sampler *sampler, s32 tex_clamp, s32 min_mag_filter);
extern u32 (* GX2CalcFetchShaderSizeEx)(u32 num_attrib, s32 fetch_shader_type, s32 tessellation_mode);
extern void (* GX2InitFetchShaderEx)(GX2FetchShader* fs, void* fs_buffer, u32 count, const GX2AttribStream* attribs, s32 fetch_shader_type, s32 tessellation_mode);
extern void (* GX2SetFetchShader)(const GX2FetchShader* fs);
extern void (* GX2SetVertexUniformReg)(u32 offset, u32 count, const void *values);
extern void (* GX2SetPixelUniformReg)(u32 offset, u32 count, const void *values);
extern void (* GX2SetPixelTexture)(const GX2Texture *texture, u32 texture_hw_location);
extern void (* GX2SetVertexTexture)(const GX2Texture *texture, u32 texture_hw_location);
extern void (* GX2SetPixelSampler)(const GX2Sampler *sampler, u32 sampler_hw_location);
extern void (* GX2SetVertexSampler)(const GX2Sampler *sampler, u32 sampler_hw_location);
extern void (* GX2SetPixelShader)(const GX2PixelShader* pixelShader);
extern void (* GX2SetVertexShader)(const GX2VertexShader* vertexShader);
extern void (* GX2InitSamplerZMFilter)(GX2Sampler *sampler, s32 z_filter, s32 mip_filter);
extern void (* GX2SetColorControl)(s32 lop, u8 blend_enable_mask, s32 enable_multi_write, s32 enable_color_buffer);
extern void (* GX2SetDepthOnlyControl)(s32 enable_depth, s32 enable_depth_write, s32 depth_comp_function);
extern void (* GX2SetBlendControl)(s32 target, s32 color_src_blend, s32 color_dst_blend, s32 color_combine, s32 separate_alpha_blend, s32 alpha_src_blend, s32 alpha_dst_blend, s32 alpha_combine);
extern void (* GX2CalcDRCSize)(s32 drc_mode, s32 format, s32 buffering_mode, u32 *size, s32 *scale_needed);
extern void (* GX2SetDRCBuffer)(void *buffer, u32 buffer_size, s32 drc_mode, s32 surface_format, s32 buffering_mode);
extern void (* GX2SetDRCScale)(u32 width, u32 height);
extern void (* GX2SetDRCEnable)(s32 enable);
extern void (* GX2SetPolygonControl)(s32 front_face_mode, s32 cull_front, s32 cull_back, s32 enable_mode, s32 mode_font, s32 mode_back, s32 poly_offset_front, s32 poly_offset_back, s32 point_line_offset);
extern void (* GX2SetCullOnlyControl)(s32 front_face_mode, s32 cull_front, s32 cull_back);
extern void (* GX2SetDepthStencilControl)(s32 enable_depth_test, s32 enable_depth_write, s32 depth_comp_function, s32 stencil_test_enable, s32 back_stencil_enable,
s32 font_stencil_func, s32 front_stencil_z_pass, s32 front_stencil_z_fail, s32 front_stencil_fail,
s32 back_stencil_func, s32 back_stencil_z_pass, s32 back_stencil_z_fail, s32 back_stencil_fail);
extern void (* GX2SetStencilMask)(u8 mask_front, u8 write_mask_front, u8 ref_front, u8 mask_back, u8 write_mask_back, u8 ref_back);
extern void (* GX2SetLineWidth)(f32 width);
extern void (* GX2SetTVGamma)(f32 val);
extern void (* GX2SetDRCGamma)(f32 val);
extern s32 (* GX2GetSystemTVScanMode)(void);
extern s32 (* GX2GetSystemDRCScanMode)(void);
extern void (* GX2RSetAllocator)(void * (*allocFunc)(u32, u32, u32), void (*freeFunc)(u32, void*));
extern void (* GX2CopySurface)(GX2Surface * srcSurface,u32 srcMip,u32 srcSlice,GX2Surface * dstSurface,u32 dstMip,u32 dstSlice );
extern void (* GX2ClearBuffersEx)(GX2ColorBuffer * colorBuffer,GX2DepthBuffer * depthBuffer,f32 r, f32 g, f32 b, f32 a,f32 depthValue,u8 stencilValue,int clearFlags);
static inline void GX2InitDepthBuffer(GX2DepthBuffer *depthBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa)
{
depthBuffer->surface.dimension = dimension;
depthBuffer->surface.width = width;
depthBuffer->surface.height = height;
depthBuffer->surface.depth = depth;
depthBuffer->surface.num_mips = 1;
depthBuffer->surface.format = format;
depthBuffer->surface.aa = aa;
depthBuffer->surface.use = ((format==GX2_SURFACE_FORMAT_D_D24_S8_UNORM) || (format==GX2_SURFACE_FORMAT_D_D24_S8_FLOAT)) ? GX2_SURFACE_USE_DEPTH_BUFFER : GX2_SURFACE_USE_DEPTH_BUFFER_TEXTURE;
depthBuffer->surface.tile = GX2_TILE_MODE_DEFAULT;
depthBuffer->surface.swizzle = 0;
depthBuffer->view_mip = 0;
depthBuffer->view_first_slice = 0;
depthBuffer->view_slices_count = depth;
depthBuffer->clear_depth = 1.0f;
depthBuffer->clear_stencil = 0;
depthBuffer->hiZ_data = NULL;
depthBuffer->hiZ_size = 0;
GX2CalcSurfaceSizeAndAlignment(&depthBuffer->surface);
GX2InitDepthBufferRegs(depthBuffer);
}
static inline void GX2InitColorBuffer(GX2ColorBuffer *colorBuffer, s32 dimension, u32 width, u32 height, u32 depth, s32 format, s32 aa)
{
colorBuffer->surface.dimension = dimension;
colorBuffer->surface.width = width;
colorBuffer->surface.height = height;
colorBuffer->surface.depth = depth;
colorBuffer->surface.num_mips = 1;
colorBuffer->surface.format = format;
colorBuffer->surface.aa = aa;
colorBuffer->surface.use = GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE_FTV;
colorBuffer->surface.image_size = 0;
colorBuffer->surface.image_data = NULL;
colorBuffer->surface.mip_size = 0;
colorBuffer->surface.mip_data = NULL;
colorBuffer->surface.tile = GX2_TILE_MODE_DEFAULT;
colorBuffer->surface.swizzle = 0;
colorBuffer->surface.align = 0;
colorBuffer->surface.pitch = 0;
u32 i;
for(i = 0; i < 13; i++)
colorBuffer->surface.mip_offset[i] = 0;
colorBuffer->view_mip = 0;
colorBuffer->view_first_slice = 0;
colorBuffer->view_slices_count = depth;
colorBuffer->aux_data = NULL;
colorBuffer->aux_size = 0;
for(i = 0; i < 5; i++)
colorBuffer->regs[i] = 0;
GX2CalcSurfaceSizeAndAlignment(&colorBuffer->surface);
GX2InitColorBufferRegs(colorBuffer);
}
static inline void GX2InitAttribStream(GX2AttribStream* attr, u32 location, u32 buffer, u32 offset, s32 format)
{
attr->location = location;
attr->buffer = buffer;
attr->offset = offset;
attr->format = format;
attr->index_type = 0;
attr->divisor = 0;
attr->destination_selector = attribute_dest_comp_selector[format & 0xff];
attr->endian_swap = GX2_ENDIANSWAP_DEFAULT;
}
static inline void GX2InitTexture(GX2Texture *tex, u32 width, u32 height, u32 depth, u32 num_mips, s32 format, s32 dimension, s32 tile)
{
tex->surface.dimension = dimension;
tex->surface.width = width;
tex->surface.height = height;
tex->surface.depth = depth;
tex->surface.num_mips = num_mips;
tex->surface.format = format;
tex->surface.aa = GX2_AA_MODE_1X;
tex->surface.use = GX2_SURFACE_USE_TEXTURE;
tex->surface.image_size = 0;
tex->surface.image_data = NULL;
tex->surface.mip_size = 0;
tex->surface.mip_data = NULL;
tex->surface.tile = tile;
tex->surface.swizzle = 0;
tex->surface.align = 0;
tex->surface.pitch = 0;
u32 i;
for(i = 0; i < 13; i++)
tex->surface.mip_offset[i] = 0;
tex->view_first_mip = 0;
tex->view_mips_count = num_mips;
tex->view_first_slice = 0;
tex->view_slices_count = depth;
tex->component_selector = texture_comp_selector[format & 0x3f];
for(i = 0; i < 5; i++)
tex->regs[i] = 0;
GX2CalcSurfaceSizeAndAlignment(&tex->surface);
GX2InitTextureRegs(tex);
}
#ifdef __cplusplus
}
#endif
#endif // __GX2_FUNCTIONS_H_

View File

@ -0,0 +1,699 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef _GX2_TYPES_H_
#define _GX2_TYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
//!-----------------------------------------------------------------------------------------------------------------------
//! Constants
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_COMMAND_BUFFER_SIZE 0x400000
#define GX2_SCAN_BUFFER_ALIGNMENT 0x1000
#define GX2_SHADER_ALIGNMENT 0x100
#define GX2_CONTEXT_STATE_ALIGNMENT 0x100
#define GX2_DISPLAY_LIST_ALIGNMENT 0x20
#define GX2_VERTEX_BUFFER_ALIGNMENT 0x40
#define GX2_INDEX_BUFFER_ALIGNMENT 0x20
#define GX2_CONTEXT_STATE_SIZE 0xA100
#define GX2_AUX_BUFFER_CLEAR_VALUE 0xCC
//!-----------------------------------------------------------------------------------------------------------------------
//! Common
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_FALSE 0
#define GX2_TRUE 1
#define GX2_DISABLE 0
#define GX2_ENABLE 1
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2InitAttrib
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_INIT_ATTRIB_NULL 0
#define GX2_INIT_ATTRIB_CB_BASE 1
#define GX2_INIT_ATTRIB_CB_SIZE 2
#define GX2_INIT_ATTRIB_ARGC 7
#define GX2_INIT_ATTRIB_ARGV 8
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 compare functions
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_COMPARE_NEVER 0
#define GX2_COMPARE_LESS 1
#define GX2_COMPARE_EQUAL 2
#define GX2_COMPARE_LEQUAL 3
#define GX2_COMPARE_GREATER 4
#define GX2_COMPARE_NOTEQUAL 5
#define GX2_COMPARE_GEQUAL 6
#define GX2_COMPARE_ALWAYS 7
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 stencil functions
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_STENCIL_KEEP 0
#define GX2_STENCIL_ZERO 1
#define GX2_STENCIL_REPLACE 2
#define GX2_STENCIL_INCR 3
#define GX2_STENCIL_DECR 4
#define GX2_STENCIL_INVERT 5
#define GX2_STENCIL_INCR_WRAP 6
#define GX2_STENCIL_DECR_WRAP 7
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 logic op functions
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_LOGIC_OP_CLEAR 0x00
#define GX2_LOGIC_OP_NOR 0x11
#define GX2_LOGIC_OP_INVAND 0x22
#define GX2_LOGIC_OP_INVCOPY 0x33
#define GX2_LOGIC_OP_REVAND 0x44
#define GX2_LOGIC_OP_INV 0x55
#define GX2_LOGIC_OP_XOR 0x66
#define GX2_LOGIC_OP_NAND 0x77
#define GX2_LOGIC_OP_AND 0x88
#define GX2_LOGIC_OP_EQUIV 0x99
#define GX2_LOGIC_OP_NOOP 0xAA
#define GX2_LOGIC_OP_INVOR 0xBB
#define GX2_LOGIC_OP_COPY 0xCC
#define GX2_LOGIC_OP_REVOR 0xDD
#define GX2_LOGIC_OP_OR 0xEE
#define GX2_LOGIC_OP_SET 0xFF
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 blend combination functions
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_BLEND_COMBINE_ADD 0x00
#define GX2_BLEND_COMBINE_SRC_MINUS_DST 0x01
#define GX2_BLEND_COMBINE_MIN 0x02
#define GX2_BLEND_COMBINE_MAX 0x03
#define GX2_BLEND_COMBINE_DST_MINUS_SRC 0x04
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 blend functions
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_BLEND_ZERO 0x00
#define GX2_BLEND_ONE 0x01
#define GX2_BLEND_SRC_ALPHA 0x04
#define GX2_BLEND_ONE_MINUS_SRC_ALPHA 0x05
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 render targets
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_RENDER_TARGET_0 0
#define GX2_RENDER_TARGET_1 1
#define GX2_RENDER_TARGET_2 2
#define GX2_RENDER_TARGET_3 3
#define GX2_RENDER_TARGET_4 4
#define GX2_RENDER_TARGET_5 5
#define GX2_RENDER_TARGET_6 6
#define GX2_RENDER_TARGET_7 7
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 cull modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_FRONT_FACE_CCW 0
#define GX2_FRONT_FACE_CW 1
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 polygon modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_POLYGON_MODE_POINT 0
#define GX2_POLYGON_MODE_LINE 1
#define GX2_POLYGON_MODE_TRIANGLE 2
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 special states
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SPECIAL_STATE_CLEAR 0
#define GX2_SPECIAL_STATE_CLEAR_HIZ 1
#define GX2_SPECIAL_STATE_COPY 2
#define GX2_SPECIAL_STATE_EXPAND_COLOR 3
#define GX2_SPECIAL_STATE_EXPAND_DEPTH 4
#define GX2_SPECIAL_STATE_CONVERT_DEPTH 5
#define GX2_SPECIAL_STATE_CONVERT_AADEPTH 6
#define GX2_SPECIAL_STATE_RESOLVE_COLOR 7
#define GX2_SPECIAL_STATE_CLEAR_COLOR_AS_DEPTH 8
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 attribute formats
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_ATTRIB_FORMAT_8_UNORM 0x00000000
#define GX2_ATTRIB_FORMAT_4_4_UNORM 0x00000001
#define GX2_ATTRIB_FORMAT_16_UNORM 0x00000002
#define GX2_ATTRIB_FORMAT_8_8_UNORM 0x00000004
#define GX2_ATTRIB_FORMAT_16_16_UNORM 0x00000007
#define GX2_ATTRIB_FORMAT_8_8_8_8_UNORM 0x0000000A
#define GX2_ATTRIB_FORMAT_10_10_10_2_UNORM 0x0000000B
#define GX2_ATTRIB_FORMAT_16_16_16_16_UNORM 0x0000000E
#define GX2_ATTRIB_FORMAT_8_UINT 0x00000100
#define GX2_ATTRIB_FORMAT_16_UINT 0x00000102
#define GX2_ATTRIB_FORMAT_8_8_UINT 0x00000104
#define GX2_ATTRIB_FORMAT_32_UINT 0x00000105
#define GX2_ATTRIB_FORMAT_16_16_UINT 0x00000107
#define GX2_ATTRIB_FORMAT_8_8_8_8_UINT 0x0000010A
#define GX2_ATTRIB_FORMAT_10_10_10_2_UINT 0x0000010B
#define GX2_ATTRIB_FORMAT_32_32_UINT 0x0000010C
#define GX2_ATTRIB_FORMAT_16_16_16_16_UINT 0x0000010E
#define GX2_ATTRIB_FORMAT_32_32_32_UINT 0x00000110
#define GX2_ATTRIB_FORMAT_32_32_32_32_UINT 0x00000112
#define GX2_ATTRIB_FORMAT_8_SNORM 0x00000200
#define GX2_ATTRIB_FORMAT_16_SNORM 0x00000202
#define GX2_ATTRIB_FORMAT_8_8_SNORM 0x00000204
#define GX2_ATTRIB_FORMAT_16_16_SNORM 0x00000207
#define GX2_ATTRIB_FORMAT_8_8_8_8_SNORM 0x0000020A
#define GX2_ATTRIB_FORMAT_10_10_10_2_SNORM 0x0000020B
#define GX2_ATTRIB_FORMAT_16_16_16_16_SNORM 0x0000020E
#define GX2_ATTRIB_FORMAT_8_SINT 0x00000300
#define GX2_ATTRIB_FORMAT_16_SINT 0x00000303
#define GX2_ATTRIB_FORMAT_8_8_SINT 0x00000304
#define GX2_ATTRIB_FORMAT_32_SINT 0x00000305
#define GX2_ATTRIB_FORMAT_16_16_SINT 0x00000307
#define GX2_ATTRIB_FORMAT_8_8_8_8_SINT 0x0000030A
#define GX2_ATTRIB_FORMAT_10_10_10_2_SINT 0x0000030B
#define GX2_ATTRIB_FORMAT_32_32_SINT 0x0000030C
#define GX2_ATTRIB_FORMAT_16_16_16_16_SINT 0x0000030E
#define GX2_ATTRIB_FORMAT_32_32_32_SINT 0x00000310
#define GX2_ATTRIB_FORMAT_32_32_32_32_SINT 0x00000312
#define GX2_ATTRIB_FORMAT_8_UINT_TO_FLOAT 0x00000800
#define GX2_ATTRIB_FORMAT_16_UINT_TO_FLOAT 0x00000802
#define GX2_ATTRIB_FORMAT_16_FLOAT 0x00000803
#define GX2_ATTRIB_FORMAT_8_8_UINT_TO_FLOAT 0x00000804
#define GX2_ATTRIB_FORMAT_32_FLOAT 0x00000806
#define GX2_ATTRIB_FORMAT_16_16_UINT_TO_FLOAT 0x00000807
#define GX2_ATTRIB_FORMAT_16_16_FLOAT 0x00000808
#define GX2_ATTRIB_FORMAT_10_11_11_FLOAT 0x00000809
#define GX2_ATTRIB_FORMAT_8_8_8_8_UINT_TO_FLOAT 0x0000080A
#define GX2_ATTRIB_FORMAT_32_32_FLOAT 0x0000080D
#define GX2_ATTRIB_FORMAT_16_16_16_16_UINT_TO_FLOAT 0x0000080E
#define GX2_ATTRIB_FORMAT_16_16_16_16_FLOAT 0x0000080F
#define GX2_ATTRIB_FORMAT_32_32_32_FLOAT 0x00000811
#define GX2_ATTRIB_FORMAT_32_32_32_32_FLOAT 0x00000813
#define GX2_ATTRIB_FORMAT_8_SINT_TO_FLOAT 0x00000A00
#define GX2_ATTRIB_FORMAT_16_SINT_TO_FLOAT 0x00000A02
#define GX2_ATTRIB_FORMAT_8_8_SINT_TO_FLOAT 0x00000A04
#define GX2_ATTRIB_FORMAT_16_16_SINT_TO_FLOAT 0x00000A07
#define GX2_ATTRIB_FORMAT_8_8_8_8_SINT_TO_FLOAT 0x00000A0A
#define GX2_ATTRIB_FORMAT_16_16_16_16_SINT_TO_FLOAT 0x00000A0E
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 shader modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SHADER_MODE_UNIFORM_REGISTER 0
#define GX2_SHADER_MODE_UNIFORM_BLOCK 1
#define GX2_SHADER_MODE_GEOMETRY_SHADER 2
#define GX2_SHADER_MODE_COMPUTE_SHADER 3
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 shader modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_COMP_SEL_NONE 0x04040405
#define GX2_COMP_SEL_X001 0x00040405
#define GX2_COMP_SEL_XY01 0x00010405
#define GX2_COMP_SEL_XYZ1 0x00010205
#define GX2_COMP_SEL_XYZW 0x00010203
#define GX2_COMP_SEL_XXXX 0x00000000
#define GX2_COMP_SEL_YYYY 0x01010101
#define GX2_COMP_SEL_ZZZZ 0x02020202
#define GX2_COMP_SEL_WWWW 0x03030303
#define GX2_COMP_SEL_WZYX 0x03020100
#define GX2_COMP_SEL_WXYZ 0x03000102
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 variable types
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_VAR_TYPE_VOID 0
#define GX2_VAR_TYPE_BOOL 1
#define GX2_VAR_TYPE_INT 2
#define GX2_VAR_TYPE_UINT 3
#define GX2_VAR_TYPE_FLOAT 4
#define GX2_VAR_TYPE_DOUBLE 5
#define GX2_VAR_TYPE_VEC2 9
#define GX2_VAR_TYPE_VEC3 10
#define GX2_VAR_TYPE_VEC4 11
#define GX2_VAR_TYPE_MAT2 21
#define GX2_VAR_TYPE_MAT3 25
#define GX2_VAR_TYPE_MAT4 29
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 sample types
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SAMPLER_TYPE_2D 1
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 index formats
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_INDEX_FORMAT_U16 4
#define GX2_INDEX_FORMAT_U32 9
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 primitive types
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_PRIMITIVE_POINTS 0x01
#define GX2_PRIMITIVE_LINES 0x02
#define GX2_PRIMITIVE_LINE_STRIP 0x03
#define GX2_PRIMITIVE_TRIANGLES 0x04
#define GX2_PRIMITIVE_TRIANGLE_FAN 0x05
#define GX2_PRIMITIVE_TRIANGLE_STRIP 0x06
#define GX2_PRIMITIVE_RECTS 0x11
#define GX2_PRIMITIVE_QUADS 0x13
#define GX2_PRIMITIVE_QUAD_STRIP 0x14
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 clear modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_CLEAR_DEPTH 0x01
#define GX2_CLEAR_STENCIL 0x02
#define GX2_CLEAR_BOTH (GX2_CLEAR_DEPTH | GX2_CLEAR_STENCIL)
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 surface formats
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SURFACE_FORMAT_TC_R8_UNORM 0x00000001
#define GX2_SURFACE_FORMAT_T_R4_G4_UNORM 0x00000002
#define GX2_SURFACE_FORMAT_TCD_R16_UNORM 0x00000005
#define GX2_SURFACE_FORMAT_TC_R8_G8_UNORM 0x00000007
#define GX2_SURFACE_FORMAT_TCS_R5_G6_B5_UNORM 0x00000008
#define GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM 0x0000000a
#define GX2_SURFACE_FORMAT_TC_R4_G4_B4_A4_UNORM 0x0000000b
#define GX2_SURFACE_FORMAT_TC_A1_B5_G5_R5_UNORM 0x0000000c
#define GX2_SURFACE_FORMAT_TC_R16_G16_UNORM 0x0000000f
#define GX2_SURFACE_FORMAT_D_D24_S8_UNORM 0x00000011
#define GX2_SURFACE_FORMAT_T_R24_UNORM_X8 0x00000011
#define GX2_SURFACE_FORMAT_TCS_R10_G10_B10_A2_UNORM 0x00000019
#define GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_UNORM 0x0000001a
#define GX2_SURFACE_FORMAT_TCS_A2_B10_G10_R10_UNORM 0x0000001b
#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UNORM 0x0000001f
#define GX2_SURFACE_FORMAT_T_BC1_UNORM 0x00000031
#define GX2_SURFACE_FORMAT_T_BC2_UNORM 0x00000032
#define GX2_SURFACE_FORMAT_T_BC3_UNORM 0x00000033
#define GX2_SURFACE_FORMAT_T_BC4_UNORM 0x00000034
#define GX2_SURFACE_FORMAT_T_BC5_UNORM 0x00000035
#define GX2_SURFACE_FORMAT_T_NV12_UNORM 0x00000081
#define GX2_SURFACE_FORMAT_TC_R8_UINT 0x00000101
#define GX2_SURFACE_FORMAT_TC_R16_UINT 0x00000105
#define GX2_SURFACE_FORMAT_TC_R8_G8_UINT 0x00000107
#define GX2_SURFACE_FORMAT_TC_R32_UINT 0x0000010d
#define GX2_SURFACE_FORMAT_TC_R16_G16_UINT 0x0000010f
#define GX2_SURFACE_FORMAT_T_X24_G8_UINT 0x00000111
#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_UINT 0x00000119
#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_UINT 0x0000011a
#define GX2_SURFACE_FORMAT_TC_A2_B10_G10_R10_UINT 0x0000011b
#define GX2_SURFACE_FORMAT_T_X32_G8_UINT_X24 0x0000011c
#define GX2_SURFACE_FORMAT_TC_R32_G32_UINT 0x0000011d
#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_UINT 0x0000011f
#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_UINT 0x00000122
#define GX2_SURFACE_FORMAT_TC_R8_SNORM 0x00000201
#define GX2_SURFACE_FORMAT_TC_R16_SNORM 0x00000205
#define GX2_SURFACE_FORMAT_TC_R8_G8_SNORM 0x00000207
#define GX2_SURFACE_FORMAT_TC_R16_G16_SNORM 0x0000020f
#define GX2_SURFACE_FORMAT_T_R10_G10_B10_A2_SNORM 0x00000219
#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SNORM 0x00000219
#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SNORM 0x0000021a
#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SNORM 0x0000021f
#define GX2_SURFACE_FORMAT_T_BC4_SNORM 0x00000234
#define GX2_SURFACE_FORMAT_T_BC5_SNORM 0x00000235
#define GX2_SURFACE_FORMAT_TC_R8_SINT 0x00000301
#define GX2_SURFACE_FORMAT_TC_R16_SINT 0x00000305
#define GX2_SURFACE_FORMAT_TC_R8_G8_SINT 0x00000307
#define GX2_SURFACE_FORMAT_TC_R32_SINT 0x0000030d
#define GX2_SURFACE_FORMAT_TC_R16_G16_SINT 0x0000030f
#define GX2_SURFACE_FORMAT_TC_R10_G10_B10_A2_SINT 0x00000319
#define GX2_SURFACE_FORMAT_TC_R8_G8_B8_A8_SINT 0x0000031a
#define GX2_SURFACE_FORMAT_TC_R32_G32_SINT 0x0000031d
#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_SINT 0x0000031f
#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_SINT 0x00000322
#define GX2_SURFACE_FORMAT_TCS_R8_G8_B8_A8_SRGB 0x0000041a
#define GX2_SURFACE_FORMAT_T_BC1_SRGB 0x00000431
#define GX2_SURFACE_FORMAT_T_BC2_SRGB 0x00000432
#define GX2_SURFACE_FORMAT_T_BC3_SRGB 0x00000433
#define GX2_SURFACE_FORMAT_TC_R16_FLOAT 0x00000806
#define GX2_SURFACE_FORMAT_TCD_R32_FLOAT 0x0000080e
#define GX2_SURFACE_FORMAT_TC_R16_G16_FLOAT 0x00000810
#define GX2_SURFACE_FORMAT_D_D24_S8_FLOAT 0x00000811
#define GX2_SURFACE_FORMAT_TC_R11_G11_B10_FLOAT 0x00000816
#define GX2_SURFACE_FORMAT_D_D32_FLOAT_S8_UINT_X24 0x0000081c
#define GX2_SURFACE_FORMAT_T_R32_FLOAT_X8_X24 0x0000081c
#define GX2_SURFACE_FORMAT_TC_R32_G32_FLOAT 0x0000081e
#define GX2_SURFACE_FORMAT_TC_R16_G16_B16_A16_FLOAT 0x00000820
#define GX2_SURFACE_FORMAT_TC_R32_G32_B32_A32_FLOAT 0x00000823
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 tile modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TILE_MODE_DEFAULT 0x00000000
#define GX2_TILE_MODE_LINEAR_ALIGNED 0x00000001
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 surface use
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SURFACE_USE_TEXTURE 0x00000001
#define GX2_SURFACE_USE_COLOR_BUFFER 0x00000002
#define GX2_SURFACE_USE_DEPTH_BUFFER 0x00000004
#define GX2_SURFACE_USE_SCAN_BUFFER 0x00000008
#define GX2_SURFACE_USE_FTV 0x80000000
#define GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE (GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_TEXTURE)
#define GX2_SURFACE_USE_DEPTH_BUFFER_TEXTURE (GX2_SURFACE_USE_DEPTH_BUFFER | GX2_SURFACE_USE_TEXTURE)
#define GX2_SURFACE_USE_COLOR_BUFFER_FTV (GX2_SURFACE_USE_COLOR_BUFFER | GX2_SURFACE_USE_FTV)
#define GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE_FTV (GX2_SURFACE_USE_COLOR_BUFFER_TEXTURE | GX2_SURFACE_USE_FTV)
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 surface dim
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SURFACE_DIM_1D 0x00000000
#define GX2_SURFACE_DIM_2D 0x00000001
#define GX2_SURFACE_DIM_3D 0x00000002
#define GX2_SURFACE_DIM_CUBE 0x00000003
#define GX2_SURFACE_DIM_1D_ARRAY 0x00000004
#define GX2_SURFACE_DIM_2D_ARRAY 0x00000005
#define GX2_SURFACE_DIM_2D_MSAA 0x00000006
#define GX2_SURFACE_DIM_2D_MSAA_ARRAY 0x00000007
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 AA modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_AA_MODE_1X 0x00000000
#define GX2_AA_MODE_2X 0x00000001
#define GX2_AA_MODE_4X 0x00000002
#define GX2_AA_MODE_8X 0x00000003
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 texture clamp
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TEX_CLAMP_WRAP 0x00000000
#define GX2_TEX_CLAMP_MIRROR 0x00000001
#define GX2_TEX_CLAMP_CLAMP 0x00000002
#define GX2_TEX_CLAMP_MIRROR_ONCE 0x00000003
#define GX2_TEX_CLAMP_CLAMP_HALF_BORDER 0x00000004
#define GX2_TEX_CLAMP_MIRROR_ONCE_HALF_BORDER 0x00000005
#define GX2_TEX_CLAMP_CLAMP_BORDER 0x00000006
#define GX2_TEX_CLAMP_MIRROR_ONCE_BORDER 0x00000007
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 texture filter
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TEX_XY_FILTER_POINT 0x00000000
#define GX2_TEX_XY_FILTER_BILINEAR 0x00000001
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 TV scan modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TV_SCAN_MODE_NONE 0x00000000
#define GX2_TV_SCAN_MODE_576I 0x00000001
#define GX2_TV_SCAN_MODE_480I 0x00000002
#define GX2_TV_SCAN_MODE_480P 0x00000003
#define GX2_TV_SCAN_MODE_720P 0x00000004
#define GX2_TV_SCAN_MODE_1080I 0x00000006
#define GX2_TV_SCAN_MODE_1080P 0x00000007
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 TV render modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TV_RENDER_480_NARROW 0x00000001
#define GX2_TV_RENDER_480_WIDE 0x00000002
#define GX2_TV_RENDER_720 0x00000003
#define GX2_TV_RENDER_1080 0x00000005
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 DRC render modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_DRC_NONE 0x00000000
#define GX2_DRC_SINGLE 0x00000001
#define GX2_DRC_DOUBLE 0x00000002
#define GX2_DRC_SINGLE_30HZ 0x00000004
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 buffering mode
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_BUFFERING_SINGLE 0x00000001
#define GX2_BUFFERING_DOUBLE 0x00000002
#define GX2_BUFFERING_TRIPLE 0x00000003
#define GX2_BUFFERING_QUAD
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 scan targets
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_SCAN_TARGET_TV 0x00000001
#define GX2_SCAN_TARGET_DRC_FIRST 0x00000004
#define GX2_SCAN_TARGET_DRC_SECOND 0x00000008
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 invalidate types
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_INVALIDATE_ATTRIB_BUFFER 0x00000001
#define GX2_INVALIDATE_TEXTURE 0x00000002
#define GX2_INVALIDATE_UNIFORM_BLOCK 0x00000004
#define GX2_INVALIDATE_SHADER 0x00000008
#define GX2_INVALIDATE_COLOR_BUFFER 0x00000010
#define GX2_INVALIDATE_DEPTH_BUFFER 0x00000020
#define GX2_INVALIDATE_CPU 0x00000040
#define GX2_INVALIDATE_CPU_ATTRIB_BUFFER (GX2_INVALIDATE_CPU | GX2_INVALIDATE_ATTRIB_BUFFER)
#define GX2_INVALIDATE_CPU_TEXTURE (GX2_INVALIDATE_CPU | GX2_INVALIDATE_TEXTURE)
#define GX2_INVALIDATE_CPU_UNIFORM_BLOCK (GX2_INVALIDATE_CPU | GX2_INVALIDATE_UNIFORM_BLOCK)
#define GX2_INVALIDATE_CPU_SHADER (GX2_INVALIDATE_CPU | GX2_INVALIDATE_SHADER)
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 swap modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_ENDIANSWAP_DEFAULT 0x00000003
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 tessellation modes
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_TESSELLATION_MODE_DISCRETE 0x00000000
#define GX2_TESSELLATION_MODE_CONTINUOUS 0x00000001
#define GX2_TESSELLATION_MODE_ADAPTIVE 0x00000002
//!-----------------------------------------------------------------------------------------------------------------------
//! GX2 fetch shader types
//!-----------------------------------------------------------------------------------------------------------------------
#define GX2_FETCH_SHADER_TESSELATION_NONE 0x00000000
#define GX2_FETCH_SHADER_TESSELATION_LINES 0x00000001
#define GX2_FETCH_SHADER_TESSELATION_TRIANGLES 0x00000002
#define GX2_FETCH_SHADER_TESSELATION_QUADS 0x00000003
typedef struct _GX2ContextState {
u8 data[GX2_CONTEXT_STATE_SIZE];
} GX2ContextState;
typedef struct _GX2Surface {
s32 dimension;
u32 width;
u32 height;
u32 depth;
u32 num_mips;
s32 format;
s32 aa;
s32 use;
u32 image_size;
void *image_data;
u32 mip_size;
void *mip_data;
s32 tile;
u32 swizzle;
u32 align;
u32 pitch;
u32 mip_offset[13];
} GX2Surface;
typedef struct _GX2ColorBuffer {
GX2Surface surface;
u32 view_mip;
u32 view_first_slice;
u32 view_slices_count;
void *aux_data;
u32 aux_size;
u32 regs[5];
} GX2ColorBuffer;
typedef struct _GX2DepthBuffer {
GX2Surface surface;
u32 view_mip;
u32 view_first_slice;
u32 view_slices_count;
void *hiZ_data;
u32 hiZ_size;
f32 clear_depth;
u32 clear_stencil;
u32 regs[7];
} GX2DepthBuffer;
typedef struct _GX2Texture {
GX2Surface surface;
u32 view_first_mip;
u32 view_mips_count;
u32 view_first_slice;
u32 view_slices_count;
u32 component_selector;
u32 regs[5];
} GX2Texture;
typedef struct _GX2Sampler {
u32 regs[3];
} GX2Sampler;
typedef struct _GX2AttribStream {
u32 location;
u32 buffer;
u32 offset;
s32 format;
s32 index_type;
u32 divisor;
u32 destination_selector;
s32 endian_swap;
} GX2AttribStream;
typedef struct _GX2FetchShader {
s32 type;
u32 reg;
u32 shader_size;
void *shader_program;
u32 attributes_count;
u32 divisor[3];
} GX2FetchShader;
typedef struct _GX2AttribVar
{
const char *name;
s32 var_type;
u32 array_count;
u32 location;
} GX2AttribVar;
typedef struct _GX2UniformBlock {
const char *name;
u32 location;
u32 block_size;
} GX2UniformBlock;
typedef struct _GX2UniformInitialValue {
f32 value[4];
u32 offset;
} GX2UniformInitialValue;
typedef struct _GX2SamplerVar
{
const char *name;
s32 sampler_type;
u32 location;
} GX2SamplerVar;
typedef struct _GX2UniformVar
{
const char *name;
s32 var_type;
u32 array_count;
u32 offset;
u32 block_index;
} GX2UniformVar;
typedef struct _GX2VertexShader {
u32 regs[52];
u32 shader_size;
void *shader_data;
s32 shader_mode;
u32 uniform_blocks_count;
GX2UniformBlock *uniform_block;
u32 uniform_vars_count;
GX2UniformVar *uniform_var;
u32 initial_values_count;
GX2UniformInitialValue *initial_value;
u32 loops_count;
void *loops_data;
u32 sampler_vars_count;
GX2SamplerVar *sampler_var;
u32 attribute_vars_count;
GX2AttribVar *attribute_var;
u32 data[6];
u32 shader_program_buffer[16];
} GX2VertexShader;
typedef struct _GX2PixelShader {
u32 regs[41];
u32 shader_size;
void *shader_data;
s32 shader_mode;
u32 uniform_blocks_count;
GX2UniformBlock *uniform_block;
u32 uniform_vars_count;
GX2UniformVar *uniform_var;
u32 initial_values_count;
GX2UniformInitialValue *initial_value;
u32 loops_count;
void *loops_data;
u32 sampler_vars_count;
GX2SamplerVar *sampler_var;
u32 shader_program_buffer[16];
} GX2PixelShader;
static const u32 attribute_dest_comp_selector[20] = {
GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_X001,
GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW,
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1,
GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW
};
static const u32 texture_comp_selector[54] = {
GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_X001,
GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW,
GX2_COMP_SEL_WZYX, GX2_COMP_SEL_X001, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01, GX2_COMP_SEL_NONE,
GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE,
GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_WZYX, GX2_COMP_SEL_XY01, GX2_COMP_SEL_XY01,
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW,
GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_X001,
GX2_COMP_SEL_XY01, GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_NONE, GX2_COMP_SEL_XYZ1,
GX2_COMP_SEL_XYZ1, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_XYZW, GX2_COMP_SEL_X001, GX2_COMP_SEL_XY01
};
typedef struct _GX2Color {
u8 r, g, b, a;
} GX2Color;
typedef struct _GX2ColorF32 {
f32 r, g, b, a;
} GX2ColorF32;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,326 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "common/common.h"
#include "os_functions.h"
unsigned int coreinit_handle __attribute__((section(".data"))) = 0;
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle);
EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Security functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(int, OSGetSecurityLevel, void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Thread functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(int, OSCreateThread, void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
EXPORT_DECL(int, OSResumeThread, void *thread);
EXPORT_DECL(int, OSSuspendThread, void *thread);
EXPORT_DECL(int, OSIsThreadTerminated, void *thread);
EXPORT_DECL(int, OSIsThreadSuspended, void *thread);
EXPORT_DECL(int, OSSetThreadPriority, void * thread, int priority);
EXPORT_DECL(int, OSJoinThread, void * thread, int * ret_val);
EXPORT_DECL(void, OSDetachThread, void * thread);
EXPORT_DECL(void, OSSleepTicks, u64 ticks);
EXPORT_DECL(u64, OSGetTick, void);
EXPORT_DECL(u64, OSGetTime, void);
EXPORT_DECL(void, OSTicksToCalendarTime, u64 time, OSCalendarTime * calendarTime);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Mutex functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(void, OSInitMutex, void* mutex);
EXPORT_DECL(void, OSLockMutex, void* mutex);
EXPORT_DECL(void, OSUnlockMutex, void* mutex);
EXPORT_DECL(int, OSTryLockMutex, void* mutex);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! System functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(u64, OSGetTitleID, void);
EXPORT_DECL(void, OSGetArgcArgv, int* argc, char*** argv);
EXPORT_DECL(void, __Exit, void);
EXPORT_DECL(void, OSFatal, const char* msg);
EXPORT_DECL(void, OSSetExceptionCallback, u8 exceptionType, exception_callback newCallback);
EXPORT_DECL(void, DCFlushRange, const void *addr, u32 length);
EXPORT_DECL(void, ICInvalidateRange, const void *addr, u32 length);
EXPORT_DECL(void*, OSEffectiveToPhysical, const void*);
EXPORT_DECL(int, __os_snprintf, char* s, int n, const char * format, ...);
EXPORT_DECL(int *, __gh_errno_ptr, void);
EXPORT_DECL(void, OSScreenInit, void);
EXPORT_DECL(unsigned int, OSScreenGetBufferSizeEx, unsigned int bufferNum);
EXPORT_DECL(int, OSScreenSetBufferEx, unsigned int bufferNum, void * addr);
EXPORT_DECL(int, OSScreenClearBufferEx, unsigned int bufferNum, unsigned int temp);
EXPORT_DECL(int, OSScreenFlipBuffersEx, unsigned int bufferNum);
EXPORT_DECL(int, OSScreenPutFontEx, unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer);
EXPORT_DECL(int, OSScreenEnableEx, unsigned int bufferNum, int enable);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Memory functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_VAR(unsigned int *, pMEMAllocFromDefaultHeapEx);
EXPORT_VAR(unsigned int *, pMEMAllocFromDefaultHeap);
EXPORT_VAR(unsigned int *, pMEMFreeToDefaultHeap);
EXPORT_DECL(int, MEMGetBaseHeapHandle, int mem_arena);
EXPORT_DECL(unsigned int, MEMGetAllocatableSizeForFrmHeapEx, int heap, int align);
EXPORT_DECL(void *, MEMAllocFromFrmHeapEx, int heap, unsigned int size, int align);
EXPORT_DECL(void, MEMFreeToFrmHeap, int heap, int mode);
EXPORT_DECL(void *, MEMAllocFromExpHeapEx, int heap, unsigned int size, int align);
EXPORT_DECL(int , MEMCreateExpHeapEx, void* address, unsigned int size, unsigned short flags);
EXPORT_DECL(void *, MEMDestroyExpHeap, int heap);
EXPORT_DECL(void, MEMFreeToExpHeap, int heap, void* ptr);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! MCP functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(int, MCP_Open, void);
EXPORT_DECL(int, MCP_Close, int handle);
EXPORT_DECL(int, MCP_GetOwnTitleInfo, int handle, void * data);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Loader functions (not real rpl)
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(int, LiWaitIopComplete, int unknown_syscall_arg_r3, int * remaining_bytes);
EXPORT_DECL(int, LiWaitIopCompleteWithInterrupts, int unknown_syscall_arg_r3, int * remaining_bytes);
EXPORT_DECL(void, addr_LiWaitOneChunk, void);
EXPORT_DECL(void, addr_sgIsLoadingBuffer, void);
EXPORT_DECL(void, addr_gDynloadInitialized, void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Kernel function addresses
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(void, addr_PrepareTitle_hook, void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Other function addresses
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_DECL(void, DCInvalidateRange, void *buffer, uint32_t length);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Energy Saver functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Burn-in Reduction
EXPORT_DECL(int, IMEnableDim,void);
EXPORT_DECL(int, IMDisableDim,void);
EXPORT_DECL(int, IMIsDimEnabled,int * result);
//Auto power down
EXPORT_DECL(int, IMEnableAPD,void);
EXPORT_DECL(int, IMDisableAPD,void);
EXPORT_DECL(int, IMIsAPDEnabled,int * result);
EXPORT_DECL(int, IMIsAPDEnabledBySysSettings,int * result);
void InitAcquireOS(void)
{
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EXPORT_FUNC_WRITE(OSDynLoad_Acquire, (int (*)(const char*, unsigned *))OS_SPECIFICS->addr_OSDynLoad_Acquire);
EXPORT_FUNC_WRITE(OSDynLoad_FindExport, (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport);
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
}
void InitOSFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireOS();
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Security functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, OSGetSecurityLevel);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! System functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, OSFatal);
OS_FIND_EXPORT(coreinit_handle, OSGetTitleID);
OS_FIND_EXPORT(coreinit_handle, OSGetArgcArgv);
OS_FIND_EXPORT(coreinit_handle, OSSetExceptionCallback);
OS_FIND_EXPORT(coreinit_handle, DCFlushRange);
OS_FIND_EXPORT(coreinit_handle, ICInvalidateRange);
OS_FIND_EXPORT(coreinit_handle, OSEffectiveToPhysical);
OS_FIND_EXPORT(coreinit_handle, __os_snprintf);
OS_FIND_EXPORT(coreinit_handle, __gh_errno_ptr);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &__Exit);
OS_FIND_EXPORT(coreinit_handle, OSScreenInit);
OS_FIND_EXPORT(coreinit_handle, OSScreenGetBufferSizeEx);
OS_FIND_EXPORT(coreinit_handle, OSScreenSetBufferEx);
OS_FIND_EXPORT(coreinit_handle, OSScreenClearBufferEx);
OS_FIND_EXPORT(coreinit_handle, OSScreenFlipBuffersEx);
OS_FIND_EXPORT(coreinit_handle, OSScreenPutFontEx);
OS_FIND_EXPORT(coreinit_handle, OSScreenEnableEx);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Thread functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, OSCreateThread);
OS_FIND_EXPORT(coreinit_handle, OSResumeThread);
OS_FIND_EXPORT(coreinit_handle, OSSuspendThread);
OS_FIND_EXPORT(coreinit_handle, OSIsThreadTerminated);
OS_FIND_EXPORT(coreinit_handle, OSIsThreadSuspended);
OS_FIND_EXPORT(coreinit_handle, OSJoinThread);
OS_FIND_EXPORT(coreinit_handle, OSSetThreadPriority);
OS_FIND_EXPORT(coreinit_handle, OSDetachThread);
OS_FIND_EXPORT(coreinit_handle, OSSleepTicks);
OS_FIND_EXPORT(coreinit_handle, OSGetTick);
OS_FIND_EXPORT(coreinit_handle, OSGetTime);
OS_FIND_EXPORT(coreinit_handle, OSTicksToCalendarTime);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Mutex functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, OSInitMutex);
OS_FIND_EXPORT(coreinit_handle, OSLockMutex);
OS_FIND_EXPORT(coreinit_handle, OSUnlockMutex);
OS_FIND_EXPORT(coreinit_handle, OSTryLockMutex);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! MCP functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, MCP_Open);
OS_FIND_EXPORT(coreinit_handle, MCP_Close);
OS_FIND_EXPORT(coreinit_handle, MCP_GetOwnTitleInfo);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Memory functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &pMEMAllocFromDefaultHeapEx);
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeap", &pMEMAllocFromDefaultHeap);
OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &pMEMFreeToDefaultHeap);
OS_FIND_EXPORT(coreinit_handle, MEMGetBaseHeapHandle);
OS_FIND_EXPORT(coreinit_handle, MEMGetAllocatableSizeForFrmHeapEx);
OS_FIND_EXPORT(coreinit_handle, MEMAllocFromFrmHeapEx);
OS_FIND_EXPORT(coreinit_handle, MEMFreeToFrmHeap);
OS_FIND_EXPORT(coreinit_handle, MEMAllocFromExpHeapEx);
OS_FIND_EXPORT(coreinit_handle, MEMCreateExpHeapEx);
OS_FIND_EXPORT(coreinit_handle, MEMDestroyExpHeap);
OS_FIND_EXPORT(coreinit_handle, MEMFreeToExpHeap);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Other function addresses
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
OS_FIND_EXPORT(coreinit_handle, DCInvalidateRange);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Energy Saver functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Burn-in Reduction
OS_FIND_EXPORT(coreinit_handle, IMEnableDim);
OS_FIND_EXPORT(coreinit_handle, IMDisableDim);
OS_FIND_EXPORT(coreinit_handle, IMIsDimEnabled);
//Auto power down
OS_FIND_EXPORT(coreinit_handle, IMEnableAPD);
OS_FIND_EXPORT(coreinit_handle, IMDisableAPD);
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabled);
OS_FIND_EXPORT(coreinit_handle, IMIsAPDEnabledBySysSettings);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Special non library functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(OS_FIRMWARE == 532 || OS_FIRMWARE == 540)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FFA4); // loader.elf
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FE90); // loader.elf
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC); // loader.elf
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18558); // kernel.elf
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00); // loader.elf
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C); // loader.elf
}
else if(OS_FIRMWARE == 500 || OS_FIRMWARE == 510)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100FBC4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100FAB0);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007EC);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF18534);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19D00);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13C3C);
}
else if(OS_FIRMWARE == 410)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF166DC);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC);
}
else if(OS_FIRMWARE == 400) //same for 402 and 403
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100F78C);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100F678);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010007F8);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15E70);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19CC0);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13BFC);
}
else if(OS_FIRMWARE == 550)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x01010180);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0101006C);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x0100080C);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF184E4);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19E80);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE13DBC);
}
else if(OS_FIRMWARE == 310)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15A0C);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C);
}
else if(OS_FIRMWARE == 300)
{
EXPORT_FUNC_WRITE(LiWaitIopComplete, (int (*)(int, int *))0x0100C4E4);
EXPORT_FUNC_WRITE(LiWaitIopCompleteWithInterrupts, (int (*)(int, int *))0x0100C3D4);
EXPORT_FUNC_WRITE(addr_LiWaitOneChunk, (int (*)(int, int *))0x010004D8);
EXPORT_FUNC_WRITE(addr_PrepareTitle_hook, (int (*)(int, int *))0xFFF15974);
EXPORT_FUNC_WRITE(addr_sgIsLoadingBuffer, (int (*)(int, int *))0xEFE19340);
EXPORT_FUNC_WRITE(addr_gDynloadInitialized, (int (*)(int, int *))0xEFE1329C);
}
else
{
OSFatal("Missing all OS specific addresses.");
}
}

View File

@ -0,0 +1,174 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __OS_FUNCTIONS_H_
#define __OS_FUNCTIONS_H_
#include <gctypes.h>
#include "common/os_defs.h"
#include "os_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define BUS_SPEED 248625000
#define SECS_TO_TICKS(sec) (((unsigned long long)(sec)) * (BUS_SPEED/4))
#define MILLISECS_TO_TICKS(msec) (SECS_TO_TICKS(msec) / 1000)
#define MICROSECS_TO_TICKS(usec) (SECS_TO_TICKS(usec) / 1000000)
#define usleep(usecs) OSSleepTicks(MICROSECS_TO_TICKS(usecs))
#define sleep(secs) OSSleepTicks(SECS_TO_TICKS(secs))
#define FLUSH_DATA_BLOCK(addr) asm volatile("dcbf 0, %0; sync" : : "r"(((addr) & ~31)))
#define INVAL_DATA_BLOCK(addr) asm volatile("dcbi 0, %0; sync" : : "r"(((addr) & ~31)))
#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__) __attribute__((section(".data"))) = 0;
#define EXPORT_VAR(type, var) type var __attribute__((section(".data")));
#define EXPORT_FUNC_WRITE(func, val) *(u32*)(((u32)&func) + 0) = (u32)val
#define OS_FIND_EXPORT(handle, func) funcPointer = 0; \
OSDynLoad_FindExport(handle, 0, # func, &funcPointer); \
if(!funcPointer) \
OSFatal("Function " # func " is NULL"); \
EXPORT_FUNC_WRITE(func, funcPointer);
#define OS_FIND_EXPORT_EX(handle, func, func_p) \
funcPointer = 0; \
OSDynLoad_FindExport(handle, 0, # func, &funcPointer); \
if(!funcPointer) \
OSFatal("Function " # func " is NULL"); \
EXPORT_FUNC_WRITE(func_p, funcPointer);
#define OS_MUTEX_SIZE 44
/* Handle for coreinit */
extern unsigned int coreinit_handle;
void InitOSFunctionPointers(void);
void InitAcquireOS(void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Lib handle functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern int (* OSDynLoad_Acquire)(const char* rpl, u32 *handle);
extern int (* OSDynLoad_FindExport)(u32 handle, int isdata, const char *symbol, void *address);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Security functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern int (* OSGetSecurityLevel)(void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Thread functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern int (* OSCreateThread)(void *thread, s32 (*callback)(s32, void*), s32 argc, void *args, u32 stack, u32 stack_size, s32 priority, u32 attr);
extern int (* OSResumeThread)(void *thread);
extern int (* OSSuspendThread)(void *thread);
extern int (* OSIsThreadTerminated)(void *thread);
extern int (* OSIsThreadSuspended)(void *thread);
extern int (* OSJoinThread)(void * thread, int * ret_val);
extern int (* OSSetThreadPriority)(void * thread, int priority);
extern void (* OSDetachThread)(void * thread);
extern void (* OSSleepTicks)(u64 ticks);
extern u64 (* OSGetTick)(void);
extern u64 (* OSGetTime)(void);
extern void (*OSTicksToCalendarTime)(u64 time, OSCalendarTime *calendarTime);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Mutex functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern void (* OSInitMutex)(void* mutex);
extern void (* OSLockMutex)(void* mutex);
extern void (* OSUnlockMutex)(void* mutex);
extern int (* OSTryLockMutex)(void* mutex);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! System functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern u64 (* OSGetTitleID)(void);
extern void (* OSGetArgcArgv)(int* argc, char*** argv);
extern void (* __Exit)(void);
extern void (* OSFatal)(const char* msg);
extern void (* DCFlushRange)(const void *addr, u32 length);
extern void (* ICInvalidateRange)(const void *addr, u32 length);
extern void* (* OSEffectiveToPhysical)(const void*);
extern int (* __os_snprintf)(char* s, int n, const char * format, ...);
extern int * (* __gh_errno_ptr)(void);
extern void (*OSScreenInit)(void);
extern unsigned int (*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
extern int (*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr);
extern int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp);
extern int (*OSScreenFlipBuffersEx)(unsigned int bufferNum);
extern int (*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer);
extern int (*OSScreenEnableEx)(unsigned int bufferNum, int enable);
typedef unsigned char (*exception_callback)(void * interruptedContext);
extern void (* OSSetExceptionCallback)(u8 exceptionType, exception_callback newCallback);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! MCP functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern int (* MCP_Open)(void);
extern int (* MCP_Close)(int handle);
extern int (* MCP_GetOwnTitleInfo)(int handle, void * data);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! LOADER functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern int (* LiWaitIopComplete)(int unknown_syscall_arg_r3, int * remaining_bytes);
extern int (* LiWaitIopCompleteWithInterrupts)(int unknown_syscall_arg_r3, int * remaining_bytes);
extern void (* addr_LiWaitOneChunk)(void);
extern void (* addr_sgIsLoadingBuffer)(void);
extern void (* addr_gDynloadInitialized)(void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Kernel function addresses
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern void (* addr_PrepareTitle_hook)(void);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Other function addresses
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
extern void (*DCInvalidateRange)(void *buffer, uint32_t length);
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//! Energy Saver functions
//!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
////Burn-in Reduction
extern int (*IMEnableDim)(void);
extern int (*IMDisableDim)(void);
extern int (*IMIsDimEnabled)(int * result);
//Auto power down
extern int (*IMEnableAPD)(void);
extern int (*IMDisableAPD)(void);
extern int (*IMIsAPDEnabled)(int * result);
extern int (*IMIsAPDEnabledBySysSettings)(int * result);
#ifdef __cplusplus
}
#endif
#endif // __OS_FUNCTIONS_H_

View File

@ -0,0 +1,27 @@
#ifndef _OS_TYPES_H_
#define _OS_TYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
typedef struct _OSCalendarTime {
int sec;
int min;
int hour;
int mday;
int mon;
int year;
int wday;
int yday;
int msec;
int usec;
} OSCalendarTime;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,61 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "padscore_functions.h"
unsigned int padscore_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, KPADInit, void);
EXPORT_DECL(void, WPADInit, void);
EXPORT_DECL(s32, WPADProbe, s32 chan, u32 * pad_type);
EXPORT_DECL(s32, WPADSetDataFormat, s32 chan, s32 format);
EXPORT_DECL(void, WPADEnableURCC, s32 enable);
EXPORT_DECL(void, WPADRead, s32 chan, void * data);
EXPORT_DECL(s32, KPADRead, s32 chan, void * data, u32 size);
EXPORT_DECL(void,WPADSetAutoSleepTime,u8 minute);
EXPORT_DECL(void,WPADDisconnect,s32 chan);
void InitAcquirePadScore(void)
{
OSDynLoad_Acquire("padscore.rpl", &padscore_handle);
}
void InitPadScoreFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquirePadScore();
OS_FIND_EXPORT(padscore_handle, WPADInit);
OS_FIND_EXPORT(padscore_handle, KPADInit);
OS_FIND_EXPORT(padscore_handle, WPADProbe);
OS_FIND_EXPORT(padscore_handle, WPADSetDataFormat);
OS_FIND_EXPORT(padscore_handle, WPADEnableURCC);
OS_FIND_EXPORT(padscore_handle, WPADRead);
OS_FIND_EXPORT(padscore_handle, KPADRead);
OS_FIND_EXPORT(padscore_handle, WPADSetAutoSleepTime);
OS_FIND_EXPORT(padscore_handle, WPADDisconnect);
KPADInit();
WPADEnableURCC(1);
}

View File

@ -0,0 +1,171 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __PAD_SCORE_FUNCTIONS_H_
#define __PAD_SCORE_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "dynamic_libs/vpad_functions.h"
extern unsigned int padscore_handle;
#include <gctypes.h>
#define WPAD_BUTTON_LEFT 0x0001
#define WPAD_BUTTON_RIGHT 0x0002
#define WPAD_BUTTON_DOWN 0x0004
#define WPAD_BUTTON_UP 0x0008
#define WPAD_BUTTON_PLUS 0x0010
#define WPAD_BUTTON_2 0x0100
#define WPAD_BUTTON_1 0x0200
#define WPAD_BUTTON_B 0x0400
#define WPAD_BUTTON_A 0x0800
#define WPAD_BUTTON_MINUS 0x1000
#define WPAD_BUTTON_Z 0x2000
#define WPAD_BUTTON_C 0x4000
#define WPAD_BUTTON_HOME 0x8000
#define WPAD_CLASSIC_BUTTON_UP 0x0001
#define WPAD_CLASSIC_BUTTON_LEFT 0x0002
#define WPAD_CLASSIC_BUTTON_ZR 0x0004
#define WPAD_CLASSIC_BUTTON_X 0x0008
#define WPAD_CLASSIC_BUTTON_A 0x0010
#define WPAD_CLASSIC_BUTTON_Y 0x0020
#define WPAD_CLASSIC_BUTTON_B 0x0040
#define WPAD_CLASSIC_BUTTON_ZL 0x0080
#define WPAD_CLASSIC_BUTTON_R 0x0200
#define WPAD_CLASSIC_BUTTON_PLUS 0x0400
#define WPAD_CLASSIC_BUTTON_HOME 0x0800
#define WPAD_CLASSIC_BUTTON_MINUS 0x1000
#define WPAD_CLASSIC_BUTTON_L 0x2000
#define WPAD_CLASSIC_BUTTON_DOWN 0x4000
#define WPAD_CLASSIC_BUTTON_RIGHT 0x8000
#define WPAD_PRO_BUTTON_UP 0x00000001
#define WPAD_PRO_BUTTON_LEFT 0x00000002
#define WPAD_PRO_TRIGGER_ZR 0x00000004
#define WPAD_PRO_BUTTON_X 0x00000008
#define WPAD_PRO_BUTTON_A 0x00000010
#define WPAD_PRO_BUTTON_Y 0x00000020
#define WPAD_PRO_BUTTON_B 0x00000040
#define WPAD_PRO_TRIGGER_ZL 0x00000080
#define WPAD_PRO_RESERVED 0x00000100
#define WPAD_PRO_TRIGGER_R 0x00000200
#define WPAD_PRO_BUTTON_PLUS 0x00000400
#define WPAD_PRO_BUTTON_HOME 0x00000800
#define WPAD_PRO_BUTTON_MINUS 0x00001000
#define WPAD_PRO_TRIGGER_L 0x00002000
#define WPAD_PRO_BUTTON_DOWN 0x00004000
#define WPAD_PRO_BUTTON_RIGHT 0x00008000
#define WPAD_PRO_BUTTON_STICK_R 0x00010000
#define WPAD_PRO_BUTTON_STICK_L 0x00020000
#define WPAD_PRO_STICK_L_EMULATION_UP 0x00200000
#define WPAD_PRO_STICK_L_EMULATION_DOWN 0x00100000
#define WPAD_PRO_STICK_L_EMULATION_LEFT 0x00040000
#define WPAD_PRO_STICK_L_EMULATION_RIGHT 0x00080000
#define WPAD_PRO_STICK_R_EMULATION_UP 0x02000000
#define WPAD_PRO_STICK_R_EMULATION_DOWN 0x01000000
#define WPAD_PRO_STICK_R_EMULATION_LEFT 0x00400000
#define WPAD_PRO_STICK_R_EMULATION_RIGHT 0x00800000
typedef struct _KPADData
{
u32 btns_h;
u32 btns_d;
u32 btns_r;
u32 unused_1[5];
f32 pos_x;
f32 pos_y;
u32 unused_2[3];
f32 angle_x;
f32 angle_y;
u32 unused_3[8];
u8 device_type;
u8 wpad_error;
u8 pos_valid;
u8 format;
union
{
struct
{
f32 stick_x;
f32 stick_y;
} nunchuck;
struct
{
u32 btns_h;
u32 btns_d;
u32 btns_r;
f32 lstick_x;
f32 lstick_y;
f32 rstick_x;
f32 rstick_y;
f32 ltrigger;
f32 rtrigger;
} classic;
struct
{
u32 btns_h;
u32 btns_d;
u32 btns_r;
f32 lstick_x;
f32 lstick_y;
f32 rstick_x;
f32 rstick_y;
int charging;
int wired;
} pro;
u32 unused_6[20];
};
u32 unused_7[16];
} KPADData;
void InitPadScoreFunctionPointers(void);
void InitAcquirePadScore(void);
typedef void (* wpad_connect_callback_t)(s32 chan, s32 status);
extern void (* KPADInit)(void);
extern void (* WPADInit)(void);
extern s32 (* WPADProbe)(s32 chan, u32 * pad_type);
extern s32 (* WPADSetDataFormat)(s32 chan, s32 format);
extern void (* WPADEnableURCC)(s32 enable);
extern void (* WPADRead)(s32 chan, void * data);
extern s32 (* KPADRead)(s32 chan, void * data, u32 size);
extern s32 (* KPADReadEx)(s32 chan, KPADData * data, u32 size, s32 *error);
extern void (*WPADSetAutoSleepTime)(u8 time);
extern void (*WPADDisconnect)( s32 chan );
#ifdef __cplusplus
}
#endif
#endif // __PAD_SCORE_FUNCTIONS_H_

View File

@ -0,0 +1,81 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "socket_functions.h"
u32 hostIpAddress = 0;
unsigned int nsysnet_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, socket_lib_init, void);
EXPORT_DECL(int, socket, int domain, int type, int protocol);
EXPORT_DECL(int, socketclose, int s);
EXPORT_DECL(int, connect, int s, void *addr, int addrlen);
EXPORT_DECL(int, bind, s32 s,struct sockaddr *name,s32 namelen);
EXPORT_DECL(int, listen, s32 s,u32 backlog);
EXPORT_DECL(int, accept, s32 s,struct sockaddr *addr,s32 *addrlen);
EXPORT_DECL(int, send, int s, const void *buffer, int size, int flags);
EXPORT_DECL(int, recv, int s, void *buffer, int size, int flags);
EXPORT_DECL(int, recvfrom,int sockfd, void *buf, int len, int flags,struct sockaddr *src_addr, int *addrlen);
EXPORT_DECL(int, sendto, int s, const void *buffer, int size, int flags, const struct sockaddr *dest, int dest_len);
EXPORT_DECL(int, setsockopt, int s, int level, int optname, void *optval, int optlen);
EXPORT_DECL(char *, inet_ntoa, struct in_addr in);
EXPORT_DECL(int, inet_aton, const char *cp, struct in_addr *inp);
EXPORT_DECL(int, NSSLWrite, int connection, const void* buf, int len,int * written);
EXPORT_DECL(int, NSSLRead, int connection, const void* buf, int len,int * read);
EXPORT_DECL(int, NSSLCreateConnection, int context, const char* host, int hotlen,int options,int sock,int block);
void InitAcquireSocket(void)
{
OSDynLoad_Acquire("nsysnet.rpl", &nsysnet_handle);
}
void InitSocketFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireSocket();
OS_FIND_EXPORT(nsysnet_handle, socket_lib_init);
OS_FIND_EXPORT(nsysnet_handle, socket);
OS_FIND_EXPORT(nsysnet_handle, socketclose);
OS_FIND_EXPORT(nsysnet_handle, connect);
OS_FIND_EXPORT(nsysnet_handle, bind);
OS_FIND_EXPORT(nsysnet_handle, listen);
OS_FIND_EXPORT(nsysnet_handle, accept);
OS_FIND_EXPORT(nsysnet_handle, send);
OS_FIND_EXPORT(nsysnet_handle, recv);
OS_FIND_EXPORT(nsysnet_handle, recvfrom);
OS_FIND_EXPORT(nsysnet_handle, sendto);
OS_FIND_EXPORT(nsysnet_handle, setsockopt);
OS_FIND_EXPORT(nsysnet_handle, inet_ntoa);
OS_FIND_EXPORT(nsysnet_handle, inet_aton);
OS_FIND_EXPORT(nsysnet_handle, NSSLWrite);
OS_FIND_EXPORT(nsysnet_handle, NSSLRead);
OS_FIND_EXPORT(nsysnet_handle, NSSLCreateConnection);
socket_lib_init();
}

View File

@ -0,0 +1,108 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __SOCKET_FUNCTIONS_H_
#define __SOCKET_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int nsysnet_handle;
#include <gctypes.h>
#define INADDR_ANY 0
#define AF_INET 2
#define SOCK_STREAM 1
#define SOCK_DGRAM 2
#define IPPROTO_IP 0
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
#define TCP_NODELAY 0x2004
#define SOL_SOCKET -1
#define SO_REUSEADDR 0x0004
#define SO_NONBLOCK 0x1016
#define SO_MYADDR 0x1013
#define SO_RCVTIMEO 0x1006
#define SOL_SOCKET -1
#define MSG_DONTWAIT 32
#define htonl(x) x
#define htons(x) x
#define ntohl(x) x
#define ntohs(x) x
struct in_addr {
unsigned int s_addr;
};
struct sockaddr_in {
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
struct sockaddr
{
unsigned short sa_family;
char sa_data[14];
};
void InitSocketFunctionPointers(void);
void InitAcquireSocket(void);
extern void (*socket_lib_init)(void);
extern int (*socket)(int domain, int type, int protocol);
extern int (*socketclose)(int s);
extern int (*connect)(int s, void *addr, int addrlen);
extern int (*bind)(s32 s,struct sockaddr *name,s32 namelen);
extern int (*listen)(s32 s,u32 backlog);
extern int (*accept)(s32 s,struct sockaddr *addr,s32 *addrlen);
extern int (*send)(int s, const void *buffer, int size, int flags);
extern int (*recv)(int s, void *buffer, int size, int flags);
extern int (*recvfrom)(int sockfd, void *buf, int len, int flags,struct sockaddr *src_addr, int *addrlen);
extern int (*sendto)(int s, const void *buffer, int size, int flags, const struct sockaddr *dest, int dest_len);
extern int (*setsockopt)(int s, int level, int optname, void *optval, int optlen);
extern int (* NSSLWrite)(int connection, const void* buf, int len,int * written);
extern int (* NSSLRead)(int connection, const void* buf, int len,int * read);
extern int (* NSSLCreateConnection)(int context, const char* host, int hotlen,int options,int sock,int block);
extern char * (*inet_ntoa)(struct in_addr in);
extern int (*inet_aton)(const char *cp, struct in_addr *inp);
#ifdef __cplusplus
}
#endif
#endif // __SOCKET_FUNCTIONS_H_

View File

@ -0,0 +1,49 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
unsigned int sysapp_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(int, _SYSLaunchTitleByPathFromLauncher, const char* path, int len, int zero);
EXPORT_DECL(int, SYSRelaunchTitle, int argc, char** argv);
EXPORT_DECL(int, SYSLaunchMenu, void);
EXPORT_DECL(int, SYSCheckTitleExists, u64 titleId);
EXPORT_DECL(int, SYSLaunchTitle, u64 titleId);
void InitAcquireSys(void)
{
OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);
}
void InitSysFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireSys();
OS_FIND_EXPORT(sysapp_handle, _SYSLaunchTitleByPathFromLauncher);
OS_FIND_EXPORT(sysapp_handle, SYSRelaunchTitle);
OS_FIND_EXPORT(sysapp_handle, SYSLaunchMenu);
OS_FIND_EXPORT(sysapp_handle, SYSCheckTitleExists);
OS_FIND_EXPORT(sysapp_handle, SYSLaunchTitle);
}

View File

@ -0,0 +1,47 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __SYS_FUNCTIONS_H_
#define __SYS_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int sysapp_handle;
void InitSysFunctionPointers(void);
void InitAcquireSys(void);
extern int(*_SYSLaunchTitleByPathFromLauncher)(const char* path, int len, int zero);
extern int (* SYSRelaunchTitle)(int argc, char** argv);
extern int (* SYSLaunchMenu)(void);
extern int (* SYSCheckTitleExists)(u64 titleId);
extern int (* SYSLaunchTitle)(u64 titleId);
#ifdef __cplusplus
}
#endif
#endif // __SYS_FUNCTIONS_H_

View File

@ -0,0 +1,78 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "syshid_functions.h"
unsigned int syshid_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(int, HIDSetup,void);
EXPORT_DECL(int, HIDTeardown,void);
EXPORT_DECL(int, HIDAddClient,HIDClient *p_client, HIDAttachCallback attach_callback);
EXPORT_DECL(int, HIDDelClient,HIDClient *p_client);
EXPORT_DECL(int, HIDGetDescriptor,unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDSetDescriptor,unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDSetProtocol,unsigned int handle,u8 interface_index,u8 protocol, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDGetProtocol,unsigned int handle,u8 interface_index,u8 * protocol, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDGetReport,u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDSetReport,u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDSetIdle,unsigned int handle, u8 interface_index,u8 duration, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDRead,unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
EXPORT_DECL(int, HIDWrite,unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
void InitAcquireSysHID(void)
{
OSDynLoad_Acquire("nsyshid.rpl", &syshid_handle);
}
void InitSysHIDFunctionPointers(void)
{
InitAcquireSysHID();
if(syshid_handle == 0){
return;
}
unsigned int funcPointer = 0;
//! assigning those is not mandatory and it does not always work to load them
OS_FIND_EXPORT(syshid_handle, HIDSetup);
OS_FIND_EXPORT(syshid_handle, HIDTeardown);
OS_FIND_EXPORT(syshid_handle, HIDAddClient);
OS_FIND_EXPORT(syshid_handle, HIDDelClient);
OS_FIND_EXPORT(syshid_handle, HIDGetDescriptor);
OS_FIND_EXPORT(syshid_handle, HIDSetDescriptor);
OS_FIND_EXPORT(syshid_handle, HIDRead);
OS_FIND_EXPORT(syshid_handle, HIDWrite);
OS_FIND_EXPORT(syshid_handle, HIDSetProtocol);
OS_FIND_EXPORT(syshid_handle, HIDGetProtocol);
OS_FIND_EXPORT(syshid_handle, HIDSetIdle);
OS_FIND_EXPORT(syshid_handle, HIDGetReport);
OS_FIND_EXPORT(syshid_handle, HIDSetReport);
}

View File

@ -0,0 +1,90 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __SYSHID_FUNCTIONS_H_
#define __SYSHID_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int syshid_handle;
typedef struct
{
unsigned int handle;
unsigned int physical_device_inst;
unsigned short vid;
unsigned short pid;
unsigned char interface_index;
unsigned char sub_class;
unsigned char protocol;
unsigned short max_packet_size_rx;
unsigned short max_packet_size_tx;
} HIDDevice;
typedef struct _HIDClient HIDClient;
#define HID_DEVICE_DETACH 0
#define HID_DEVICE_ATTACH 1
typedef int (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,unsigned int attach);
struct _HIDClient
{
HIDClient *next;
HIDAttachCallback attach_cb;
};
typedef void (*HIDCallback)(unsigned int handle,int error,unsigned char *p_buffer,unsigned int bytes_transferred,void *p_user);
void InitSysHIDFunctionPointers(void);
void InitAcquireSysHID(void);
extern int(*HIDSetup)(void);
extern int(*HIDTeardown)(void);
extern int(*HIDAddClient)(HIDClient *p_client, HIDAttachCallback attach_callback);
extern int(*HIDDelClient)(HIDClient *p_client);
extern int(*HIDGetDescriptor)(unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
extern int(*HIDSetDescriptor)(unsigned int handle,u8 descriptor_type,u8 descriptor_index, u16 language_id, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
extern int(*HIDGetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
extern int(*HIDSetReport)(u32 handle, u8 report_type, u8 report_id, u8 *p_buffer, u32 buffer_length, HIDCallback hc, void *p_user);
extern int(*HIDSetIdle)(unsigned int handle, u8 interface_index,u8 duration, HIDCallback hc, void *p_user);
extern int(* HIDSetProtocol)(unsigned int handle,u8 interface_index,u8 protocol, HIDCallback hc, void *p_user);
extern int(* HIDGetProtocol)(unsigned int handle,u8 interface_index,u8 * protocol, HIDCallback hc, void *p_user);
extern int(*HIDRead)(unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
extern int(*HIDWrite)(unsigned int handle, unsigned char *p_buffer, unsigned int buffer_length, HIDCallback hc, void *p_user);
#ifdef __cplusplus
}
#endif
#endif // __SYSHID_FUNCTIONS_H_

View File

@ -0,0 +1,55 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#include "os_functions.h"
#include "vpad_functions.h"
unsigned int vpad_handle __attribute__((section(".data"))) = 0;
unsigned int vpadbase_handle __attribute__((section(".data"))) = 0;
EXPORT_DECL(void, VPADInit, void);
EXPORT_DECL(int, VPADRead, int chan, VPADData *buffer, u32 buffer_size, s32 *error);
EXPORT_DECL(int, VPADGetLcdMode, int padnum, int *lcdmode);
EXPORT_DECL(int, VPADSetLcdMode, int padnum, int lcdmode);
EXPORT_DECL(int, VPADBASEGetMotorOnRemainingCount, int padnum);
EXPORT_DECL(int, VPADBASESetMotorOnRemainingCount, int padnum, int counter);
void InitAcquireVPad(void)
{
OSDynLoad_Acquire("vpad.rpl", &vpad_handle);
OSDynLoad_Acquire("vpadbase.rpl", &vpadbase_handle);
}
void InitVPadFunctionPointers(void)
{
unsigned int *funcPointer = 0;
InitAcquireVPad();
OS_FIND_EXPORT(vpad_handle, VPADInit);
OS_FIND_EXPORT(vpad_handle, VPADRead);
OS_FIND_EXPORT(vpad_handle, VPADGetLcdMode);
OS_FIND_EXPORT(vpad_handle, VPADSetLcdMode);
OS_FIND_EXPORT(vpadbase_handle, VPADBASEGetMotorOnRemainingCount);
OS_FIND_EXPORT(vpadbase_handle, VPADBASESetMotorOnRemainingCount);
}

View File

@ -0,0 +1,114 @@
/****************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __VPAD_FUNCTIONS_H_
#define __VPAD_FUNCTIONS_H_
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned int vpad_handle;
extern unsigned int vpadbase_handle;
#include <gctypes.h>
#define VPAD_BUTTON_A 0x8000
#define VPAD_BUTTON_B 0x4000
#define VPAD_BUTTON_X 0x2000
#define VPAD_BUTTON_Y 0x1000
#define VPAD_BUTTON_LEFT 0x0800
#define VPAD_BUTTON_RIGHT 0x0400
#define VPAD_BUTTON_UP 0x0200
#define VPAD_BUTTON_DOWN 0x0100
#define VPAD_BUTTON_ZL 0x0080
#define VPAD_BUTTON_ZR 0x0040
#define VPAD_BUTTON_L 0x0020
#define VPAD_BUTTON_R 0x0010
#define VPAD_BUTTON_PLUS 0x0008
#define VPAD_BUTTON_MINUS 0x0004
#define VPAD_BUTTON_HOME 0x0002
#define VPAD_BUTTON_SYNC 0x0001
#define VPAD_BUTTON_STICK_R 0x00020000
#define VPAD_BUTTON_STICK_L 0x00040000
#define VPAD_BUTTON_TV 0x00010000
#define VPAD_STICK_R_EMULATION_LEFT 0x04000000
#define VPAD_STICK_R_EMULATION_RIGHT 0x02000000
#define VPAD_STICK_R_EMULATION_UP 0x01000000
#define VPAD_STICK_R_EMULATION_DOWN 0x00800000
#define VPAD_STICK_L_EMULATION_LEFT 0x40000000
#define VPAD_STICK_L_EMULATION_RIGHT 0x20000000
#define VPAD_STICK_L_EMULATION_UP 0x10000000
#define VPAD_STICK_L_EMULATION_DOWN 0x08000000
//! Own definitions
#define VPAD_BUTTON_TOUCH 0x00080000
#define VPAD_MASK_EMULATED_STICKS 0x7F800000
#define VPAD_MASK_BUTTONS ~VPAD_MASK_EMULATED_STICKS
typedef struct
{
f32 x,y;
} Vec2D;
typedef struct
{
u16 x, y; /* Touch coordinates */
u16 touched; /* 1 = Touched, 0 = Not touched */
u16 invalid; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */
} VPADTPData;
typedef struct
{
u32 btns_h; /* Held buttons */
u32 btns_d; /* Buttons that are pressed at that instant */
u32 btns_r; /* Released buttons */
Vec2D lstick, rstick; /* Each contains 4-byte X and Y components */
char unknown1c[0x52 - 0x1c]; /* Contains accelerometer and gyroscope data somewhere */
VPADTPData tpdata; /* Normal touchscreen data */
VPADTPData tpdata1; /* Modified touchscreen data 1 */
VPADTPData tpdata2; /* Modified touchscreen data 2 */
char unknown6a[0xa0 - 0x6a];
uint8_t volume;
uint8_t battery; /* 0 to 6 */
uint8_t unk_volume; /* One less than volume */
char unknowna4[0xac - 0xa4];
} VPADData;
void InitVPadFunctionPointers(void);
void InitAcquireVPad(void);
extern int (* VPADRead)(int chan, VPADData *buffer, u32 buffer_size, s32 *error);
extern int (* VPADGetLcdMode)(int padnum, int *lcdmode);
extern int (* VPADSetLcdMode)(int padnum, int lcdmode);
extern void (* VPADInit)(void);
extern int (* VPADBASEGetMotorOnRemainingCount)(int lcdmode);
extern int (* VPADBASESetMotorOnRemainingCount)(int lcdmode,int counter);
#ifdef __cplusplus
}
#endif
#endif // __VPAD_FUNCTIONS_H_

14
src/entry.c Normal file
View File

@ -0,0 +1,14 @@
#include <string.h>
#include "dynamic_libs/os_functions.h"
#include "dynamic_libs/sys_functions.h"
#include "common/common.h"
#include "utils/utils.h"
#include "main.h"
int __entry_menu(int argc, char **argv)
{
//! *******************************************************************
//! * Jump to our application *
//! *******************************************************************
return Menu_Main();
}

198
src/fs/CFile.cpp Normal file
View File

@ -0,0 +1,198 @@
#include <stdarg.h>
#include <stdlib.h>
#include "CFile.hpp"
CFile::CFile()
{
iFd = -1;
mem_file = NULL;
filesize = 0;
pos = 0;
}
CFile::CFile(const std::string & filepath, eOpenTypes mode)
{
iFd = -1;
this->open(filepath, mode);
}
CFile::CFile(const u8 * mem, int size)
{
iFd = -1;
this->open(mem, size);
}
CFile::~CFile()
{
this->close();
}
int CFile::open(const std::string & filepath, eOpenTypes mode)
{
this->close();
s32 openMode = 0;
switch(mode)
{
default:
case ReadOnly:
openMode = O_RDONLY;
break;
case WriteOnly:
openMode = O_WRONLY;
break;
case ReadWrite:
openMode = O_RDWR;
break;
case Append:
openMode = O_APPEND | O_WRONLY;
break;
}
//! Using fopen works only on the first launch as expected
//! on the second launch it causes issues because we don't overwrite
//! the .data sections which is needed for a normal application to re-init
//! this will be added with launching as RPX
iFd = ::open(filepath.c_str(), openMode);
if(iFd < 0)
return iFd;
filesize = ::lseek(iFd, 0, SEEK_END);
::lseek(iFd, 0, SEEK_SET);
return 0;
}
int CFile::open(const u8 * mem, int size)
{
this->close();
mem_file = mem;
filesize = size;
return 0;
}
void CFile::close()
{
if(iFd >= 0)
::close(iFd);
iFd = -1;
mem_file = NULL;
filesize = 0;
pos = 0;
}
int CFile::read(u8 * ptr, size_t size)
{
if(iFd >= 0)
{
int ret = ::read(iFd, ptr,size);
if(ret > 0)
pos += ret;
return ret;
}
int readsize = size;
if(readsize > (s64) (filesize-pos))
readsize = filesize-pos;
if(readsize <= 0)
return readsize;
if(mem_file != NULL)
{
memcpy(ptr, mem_file+pos, readsize);
pos += readsize;
return readsize;
}
return -1;
}
int CFile::write(const u8 * ptr, size_t size)
{
if(iFd >= 0)
{
size_t done = 0;
while(done < size)
{
int ret = ::write(iFd, ptr, size - done);
if(ret <= 0)
return ret;
ptr += ret;
done += ret;
pos += ret;
}
return done;
}
return -1;
}
int CFile::seek(long int offset, int origin)
{
int ret = 0;
s64 newPos = pos;
if(origin == SEEK_SET)
{
newPos = offset;
}
else if(origin == SEEK_CUR)
{
newPos += offset;
}
else if(origin == SEEK_END)
{
newPos = filesize+offset;
}
if(newPos < 0)
{
pos = 0;
}
else {
pos = newPos;
}
if(iFd >= 0)
ret = ::lseek(iFd, pos, SEEK_SET);
if(mem_file != NULL)
{
if(pos > filesize)
{
pos = filesize;
}
}
return ret;
}
int CFile::fwrite(const char *format, ...)
{
int result = -1;
char * tmp = NULL;
va_list va;
va_start(va, format);
if((vasprintf(&tmp, format, va) >= 0) && tmp)
{
result = this->write((u8 *)tmp, strlen(tmp));
}
va_end(va);
if(tmp)
free(tmp);
return result;
}

57
src/fs/CFile.hpp Normal file
View File

@ -0,0 +1,57 @@
#ifndef CFILE_HPP_
#define CFILE_HPP_
#include <stdio.h>
#include <string>
#include <string.h>
#include <fcntl.h>
#include <gctypes.h>
#include <unistd.h>
class CFile
{
public:
enum eOpenTypes
{
ReadOnly,
WriteOnly,
ReadWrite,
Append
};
CFile();
CFile(const std::string & filepath, eOpenTypes mode);
CFile(const u8 * memory, int memsize);
virtual ~CFile();
int open(const std::string & filepath, eOpenTypes mode);
int open(const u8 * memory, int memsize);
bool isOpen() const {
if(iFd >= 0)
return true;
if(mem_file)
return true;
return false;
}
void close();
int read(u8 * ptr, size_t size);
int write(const u8 * ptr, size_t size);
int fwrite(const char *format, ...);
int seek(long int offset, int origin);
u64 tell() { return pos; };
u64 size() { return filesize; };
void rewind() { this->seek(0, SEEK_SET); };
protected:
int iFd;
const u8 * mem_file;
u64 filesize;
u64 pos;
};
#endif

223
src/fs/DirList.cpp Normal file
View File

@ -0,0 +1,223 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* DirList Class
* for WiiXplorer 2010
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <algorithm>
#include <sys/stat.h>
#include <sys/dirent.h>
#include "DirList.h"
#include "utils/StringTools.h"
DirList::DirList()
{
Flags = 0;
Filter = 0;
}
DirList::DirList(const std::string & path, const char *filter, u32 flags)
{
this->LoadPath(path, filter, flags);
this->SortList();
}
DirList::~DirList()
{
ClearList();
}
bool DirList::LoadPath(const std::string & folder, const char *filter, u32 flags)
{
if(folder.empty()) return false;
Flags = flags;
Filter = filter;
std::string folderpath(folder);
u32 length = folderpath.size();
//! clear path of double slashes
RemoveDoubleSlashs(folderpath);
//! remove last slash if exists
if(length > 0 && folderpath[length-1] == '/')
folderpath.erase(length-1);
return InternalLoadPath(folderpath);
}
bool DirList::InternalLoadPath(std::string &folderpath)
{
if(folderpath.size() < 3)
return false;
struct dirent *dirent = NULL;
DIR *dir = NULL;
dir = opendir(folderpath.c_str());
if (dir == NULL)
return false;
while ((dirent = readdir(dir)) != 0)
{
bool isDir = dirent->d_type & DT_DIR;
const char *filename = dirent->d_name;
if(isDir)
{
if(strcmp(filename,".") == 0 || strcmp(filename,"..") == 0)
continue;
if(Flags & CheckSubfolders)
{
int length = folderpath.size();
if(length > 2 && folderpath[length-1] != '/')
folderpath += '/';
folderpath += filename;
InternalLoadPath(folderpath);
folderpath.erase(length);
}
if(!(Flags & Dirs))
continue;
}
else if(!(Flags & Files))
{
continue;
}
if(Filter)
{
char * fileext = strrchr(filename, '.');
if(!fileext)
continue;
if(strtokcmp(fileext, Filter, ",") == 0)
AddEntrie(folderpath, filename, isDir);
}
else
{
AddEntrie(folderpath, filename, isDir);
}
}
closedir(dir);
return true;
}
void DirList::AddEntrie(const std::string &filepath, const char * filename, bool isDir)
{
if(!filename)
return;
int pos = FileInfo.size();
FileInfo.resize(pos+1);
FileInfo[pos].FilePath = (char *) malloc(filepath.size()+strlen(filename)+2);
if(!FileInfo[pos].FilePath)
{
FileInfo.resize(pos);
return;
}
sprintf(FileInfo[pos].FilePath, "%s/%s", filepath.c_str(), filename);
FileInfo[pos].isDir = isDir;
}
void DirList::ClearList()
{
for(u32 i = 0; i < FileInfo.size(); ++i)
{
if(FileInfo[i].FilePath)
free(FileInfo[i].FilePath);
}
FileInfo.clear();
std::vector<DirEntry>().swap(FileInfo);
}
const char * DirList::GetFilename(int ind) const
{
if (!valid(ind))
return "";
return FullpathToFilename(FileInfo[ind].FilePath);
}
static bool SortCallback(const DirEntry & f1, const DirEntry & f2)
{
if(f1.isDir && !(f2.isDir)) return true;
if(!(f1.isDir) && f2.isDir) return false;
if(f1.FilePath && !f2.FilePath) return true;
if(!f1.FilePath) return false;
if(strcasecmp(f1.FilePath, f2.FilePath) > 0)
return false;
return true;
}
void DirList::SortList()
{
if(FileInfo.size() > 1)
std::sort(FileInfo.begin(), FileInfo.end(), SortCallback);
}
void DirList::SortList(bool (*SortFunc)(const DirEntry &a, const DirEntry &b))
{
if(FileInfo.size() > 1)
std::sort(FileInfo.begin(), FileInfo.end(), SortFunc);
}
u64 DirList::GetFilesize(int index) const
{
struct stat st;
const char *path = GetFilepath(index);
if(!path || stat(path, &st) != 0)
return 0;
return st.st_size;
}
int DirList::GetFileIndex(const char *filename) const
{
if(!filename)
return -1;
for (u32 i = 0; i < FileInfo.size(); ++i)
{
if (strcasecmp(GetFilename(i), filename) == 0)
return i;
}
return -1;
}

95
src/fs/DirList.h Normal file
View File

@ -0,0 +1,95 @@
/****************************************************************************
* Copyright (C) 2010
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
* DirList Class
* for WiiXplorer 2010
***************************************************************************/
#ifndef ___DIRLIST_H_
#define ___DIRLIST_H_
#include <vector>
#include <string>
#include <gctypes.h>
typedef struct
{
char * FilePath;
bool isDir;
} DirEntry;
class DirList
{
public:
//!Constructor
DirList(void);
//!\param path Path from where to load the filelist of all files
//!\param filter A fileext that needs to be filtered
//!\param flags search/filter flags from the enum
DirList(const std::string & path, const char *filter = NULL, u32 flags = Files | Dirs);
//!Destructor
virtual ~DirList();
//! Load all the files from a directory
bool LoadPath(const std::string & path, const char *filter = NULL, u32 flags = Files | Dirs);
//! Get a filename of the list
//!\param list index
const char * GetFilename(int index) const;
//! Get the a filepath of the list
//!\param list index
const char *GetFilepath(int index) const { if (!valid(index)) return ""; else return FileInfo[index].FilePath; }
//! Get the a filesize of the list
//!\param list index
u64 GetFilesize(int index) const;
//! Is index a dir or a file
//!\param list index
bool IsDir(int index) const { if(!valid(index)) return false; return FileInfo[index].isDir; };
//! Get the filecount of the whole list
int GetFilecount() const { return FileInfo.size(); };
//! Sort list by filepath
void SortList();
//! Custom sort command for custom sort functions definitions
void SortList(bool (*SortFunc)(const DirEntry &a, const DirEntry &b));
//! Get the index of the specified filename
int GetFileIndex(const char *filename) const;
//! Enum for search/filter flags
enum
{
Files = 0x01,
Dirs = 0x02,
CheckSubfolders = 0x08,
};
protected:
// Internal parser
bool InternalLoadPath(std::string &path);
//!Add a list entrie
void AddEntrie(const std::string &filepath, const char * filename, bool isDir);
//! Clear the list
void ClearList();
//! Check if valid pos is requested
inline bool valid(u32 pos) const { return (pos < FileInfo.size()); };
u32 Flags;
const char *Filter;
std::vector<DirEntry> FileInfo;
};
#endif

181
src/fs/fs_utils.c Normal file
View File

@ -0,0 +1,181 @@
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include "dynamic_libs/fs_defs.h"
#include "dynamic_libs/fs_functions.h"
int MountFS(void *pClient, void *pCmd, char **mount_path)
{
int result = -1;
void *mountSrc = malloc(FS_MOUNT_SOURCE_SIZE);
if(!mountSrc)
return -3;
char* mountPath = (char*) malloc(FS_MAX_MOUNTPATH_SIZE);
if(!mountPath) {
free(mountSrc);
return -4;
}
memset(mountSrc, 0, FS_MOUNT_SOURCE_SIZE);
memset(mountPath, 0, FS_MAX_MOUNTPATH_SIZE);
// Mount sdcard
if (FSGetMountSource(pClient, pCmd, FS_SOURCETYPE_EXTERNAL, mountSrc, -1) == 0)
{
result = FSMount(pClient, pCmd, mountSrc, mountPath, FS_MAX_MOUNTPATH_SIZE, -1);
if((result == 0) && mount_path) {
*mount_path = (char*)malloc(strlen(mountPath) + 1);
if(*mount_path)
strcpy(*mount_path, mountPath);
}
}
free(mountPath);
free(mountSrc);
return result;
}
int UmountFS(void *pClient, void *pCmd, const char *mountPath)
{
int result = -1;
result = FSUnmount(pClient, pCmd, mountPath, -1);
return result;
}
int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size)
{
//! always initialze input
*inbuffer = NULL;
if(size)
*size = 0;
int iFd = open(filepath, O_RDONLY);
if (iFd < 0)
return -1;
u32 filesize = lseek(iFd, 0, SEEK_END);
lseek(iFd, 0, SEEK_SET);
u8 *buffer = (u8 *) malloc(filesize);
if (buffer == NULL)
{
close(iFd);
return -2;
}
u32 blocksize = 0x4000;
u32 done = 0;
int readBytes = 0;
while(done < filesize)
{
if(done + blocksize > filesize) {
blocksize = filesize - done;
}
readBytes = read(iFd, buffer + done, blocksize);
if(readBytes <= 0)
break;
done += readBytes;
}
close(iFd);
if (done != filesize)
{
free(buffer);
return -3;
}
*inbuffer = buffer;
//! sign is optional input
if(size)
*size = filesize;
return filesize;
}
int CheckFile(const char * filepath)
{
if(!filepath)
return 0;
struct stat filestat;
char dirnoslash[strlen(filepath)+2];
snprintf(dirnoslash, sizeof(dirnoslash), "%s", filepath);
while(dirnoslash[strlen(dirnoslash)-1] == '/')
dirnoslash[strlen(dirnoslash)-1] = '\0';
char * notRoot = strrchr(dirnoslash, '/');
if(!notRoot)
{
strcat(dirnoslash, "/");
}
if (stat(dirnoslash, &filestat) == 0)
return 1;
return 0;
}
int CreateSubfolder(const char * fullpath)
{
if(!fullpath)
return 0;
int result = 0;
char dirnoslash[strlen(fullpath)+1];
strcpy(dirnoslash, fullpath);
int pos = strlen(dirnoslash)-1;
while(dirnoslash[pos] == '/')
{
dirnoslash[pos] = '\0';
pos--;
}
if(CheckFile(dirnoslash))
{
return 1;
}
else
{
char parentpath[strlen(dirnoslash)+2];
strcpy(parentpath, dirnoslash);
char * ptr = strrchr(parentpath, '/');
if(!ptr)
{
//!Device root directory (must be with '/')
strcat(parentpath, "/");
struct stat filestat;
if (stat(parentpath, &filestat) == 0)
return 1;
return 0;
}
ptr++;
ptr[0] = '\0';
result = CreateSubfolder(parentpath);
}
if(!result)
return 0;
if (mkdir(dirnoslash, 0777) == -1)
{
return 0;
}
return 1;
}

23
src/fs/fs_utils.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef __FS_UTILS_H_
#define __FS_UTILS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <gctypes.h>
int MountFS(void *pClient, void *pCmd, char **mount_path);
int UmountFS(void *pClient, void *pCmd, const char *mountPath);
int LoadFileToMem(const char *filepath, u8 **inbuffer, u32 *size);
//! todo: C++ class
int CreateSubfolder(const char * fullpath);
int CheckFile(const char * filepath);
#ifdef __cplusplus
}
#endif
#endif // __FS_UTILS_H_

1019
src/fs/sd_fat_devoptab.c Normal file

File diff suppressed because it is too large Load Diff

38
src/fs/sd_fat_devoptab.h Normal file
View File

@ -0,0 +1,38 @@
/***************************************************************************
* Copyright (C) 2015
* by Dimok
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any
* damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any
* purpose, including commercial applications, and to alter it and
* redistribute it freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you
* must not claim that you wrote the original software. If you use
* this software in a product, an acknowledgment in the product
* documentation would be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
***************************************************************************/
#ifndef __SD_FAT_DEVOPTAB_H_
#define __SD_FAT_DEVOPTAB_H_
#ifdef __cplusplus
extern "C" {
#endif
int mount_sd_fat(const char *path);
int unmount_sd_fat(const char *path);
#ifdef __cplusplus
}
#endif
#endif // __SD_FAT_DEVOPTAB_H_

81
src/game/Background.cpp Normal file
View File

@ -0,0 +1,81 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "Background.h"
#include "gui/GuiTrigger.h"
#include "gui/GuiController.h"
/**
* Constructor for the GuiButton class.
*/
Background::Background(char *picture, float scroll_speed)
{
loc_x=0.0f;
bgImg = Resources::GetImageData(picture);
bg = new GuiImage(bgImg);
bgs = new GuiImage(bgImg);
bg->setPosition(0, 0);
bgs->setPosition(-1280, 0);
speed=scroll_speed;
}
/**
* Destructor for the GuiButton class.
*/
Background::~Background()
{
speed=0.0f;
loc_x=0.0f;
delete(bgImg);
delete(bg);
delete(bgs);
}
void Background::setScrollSpeed(float scroll_speed)
{
speed=scroll_speed;
}
/**
* Draw the button on screen
*/
void Background::draw(CVideo *v)
{
if(speed>0.0f) {
loc_x-=speed;
if(loc_x<0.0f) loc_x=1280.0f;
bg->setPosition((int)loc_x, 0);
bgs->setPosition((int)loc_x-1280, 0);
}
if(!this->isVisible())
return;
// draw images
bg->draw(v);
bgs->draw(v);
}
void Background::update(GuiController * c)
{
}

44
src/game/Background.h Normal file
View File

@ -0,0 +1,44 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef BACKGROUND_H_
#define BACKGROUND_H_
#include "gui/GuiElement.h"
#include "gui/GuiText.h"
#include "gui/GuiController.h"
#include "gui/GuiImage.h"
#include "gui/GuiSound.h"
#include "gui/GuiTrigger.h"
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)
class Background : public GuiElement
{
public:
Background(char *picture, float scroll_speed);
virtual ~Background();
void setScrollSpeed(float scroll_speed);
void draw(CVideo *video);
void update(GuiController * c);
protected:
GuiImageData* bgImg;
GuiImage * bg;
GuiImage * bgs;
float speed;
float loc_x;
};
#endif

112
src/game/Pipe.cpp Normal file
View File

@ -0,0 +1,112 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "Pipe.h"
#include "gui/GuiTrigger.h"
#include "gui/GuiController.h"
/**
* Constructor for the GuiButton class.
*/
Pipe::Pipe(float x)
{
srand(OSGetTime());
loc_y=rand() % 250 - 125;
loc_x = x;
pipeBottomImg = Resources::GetImageData("pipe_down.png");
pipeTopImg = Resources::GetImageData("pipe_up.png");
pipebottom = new GuiImage(pipeBottomImg);
pipetop = new GuiImage(pipeTopImg);
pipebottom->setAlignment(ALIGN_CENTER | ALIGN_CENTER);
pipetop->setAlignment(ALIGN_CENTER | ALIGN_CENTER);
pipebottom->setPosition((int)loc_x,-410-loc_y);
pipetop->setPosition((int)loc_x,410-loc_y);
scroll_state=false;
}
/**
* Destructor for the GuiButton class.
*/
Pipe::~Pipe()
{
loc_x=0.0f;
loc_y=0.0f;
scroll_state=0;
delete(pipetop);
delete(pipebottom);
delete(pipeTopImg);
delete(pipeBottomImg);
}
void Pipe::setPosX(float x)
{
loc_x=x;
pipebottom->setPosition((int)loc_x,-410-loc_y);
pipetop->setPosition((int)loc_x,410-loc_y);
}
void Pipe::setScroll(bool state)
{
scroll_state=state;
}
int Pipe::checkCollision(GuiImage* check)
{
if((pipetop->getLeft()-pipetop->getWidth()/4.0f)<(check->getLeft()+check->getWidth()/2.0f) && (pipetop->getLeft()+pipetop->getWidth()/2)>(check->getLeft()-check->getWidth()/2.0f)) { //How can that thing work? No, really...
poss_collision=1;
if((check->getTop()+check->getHeight()/2.0f)>(pipetop->getTop()-720.0f) || ((check->getTop()-check->getHeight()/2.0f))<pipebottom->getTop()) {
poss_collision=0; //we already collided
return 1;
}
} else if (poss_collision==1) { //We just surpassed the problem
poss_collision=0;
return -1; //Add point
}
return 0;
}
/**
* Draw the button on screen
*/
void Pipe::draw(CVideo *v)
{
if(scroll_state==true) {
loc_x-=1.5f;
if (loc_x<-640.0f) {
loc_x=700.0f;
loc_y=rand() % 250 - 125;
}
pipebottom->setPosition((int)loc_x,-410-loc_y);
pipetop->setPosition((int)loc_x,410-loc_y);
}
if(!this->isVisible())
return;
// draw images
pipebottom->draw(v);
pipetop->draw(v);
}
void Pipe::update(GuiController * c)
{
}

49
src/game/Pipe.h Normal file
View File

@ -0,0 +1,49 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef PIPE_H_
#define PIPE_H_
#include "gui/GuiElement.h"
#include "gui/GuiText.h"
#include "gui/GuiController.h"
#include "gui/GuiImage.h"
#include "gui/GuiSound.h"
#include "gui/GuiTrigger.h"
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)
class Pipe : public GuiElement
{
public:
Pipe(float x);
virtual ~Pipe();
void setPosX(float x);
void setScroll(bool state);
int checkCollision(GuiImage* check);
void draw(CVideo *video);
void update(GuiController * c);
protected:
GuiImageData* pipeBottomImg;
GuiImageData* pipeTopImg;
GuiImage * pipebottom;
GuiImage * pipetop;
float loc_x;
int loc_y;
int poss_collision=0;
bool scroll_state;
};
#endif

87
src/game/ScoreImage.cpp Normal file
View File

@ -0,0 +1,87 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "ScoreImage.h"
#include "gui/GuiTrigger.h"
#include "gui/GuiController.h"
/**
* Constructor for the GuiButton class.
*/
ScoreImage::ScoreImage(int x, int y)
{
digitsImagesData[0] = Resources::GetImageData("font_big_0.png");
digitsImagesData[1] = Resources::GetImageData("font_big_1.png");
digitsImagesData[2] = Resources::GetImageData("font_big_2.png");
digitsImagesData[3] = Resources::GetImageData("font_big_3.png");
digitsImagesData[4] = Resources::GetImageData("font_big_4.png");
digitsImagesData[5] = Resources::GetImageData("font_big_5.png");
digitsImagesData[6] = Resources::GetImageData("font_big_6.png");
digitsImagesData[7] = Resources::GetImageData("font_big_7.png");
digitsImagesData[8] = Resources::GetImageData("font_big_8.png");
digitsImagesData[9] = Resources::GetImageData("font_big_9.png");
digitsImagesData[10] = Resources::GetImageData("font_big_null.png");
for (int i=0;i<3;i++) {
digitsImages[i] = new GuiImage(digitsImagesData[10]);
digitsImages[i]->setAlignment(ALIGN_CENTER | ALIGN_CENTER);
digitsImages[i]->setPosition(x+(i*36),y);
}
digitsImages[2]->setImageData(digitsImagesData[0]);
}
/**
* Destructor for the GuiButton class.
*/
ScoreImage::~ScoreImage()
{
//for (int i=0;i<11;i++) delete(digitsImagesData[i]);
}
void ScoreImage::setScore(int score)
{
//Yeah, that's hacky and there are unusefull functions :P
if (score>999) score=999; //That's unlikey but...
for(int a=0;a<3;a++) digits[a]=10; //Initialize digits to 10 (=don't draw)
digits[0]=(int)(score/pow(10, 0))%10;
if (score>9) digits[1]=(int)(score/pow(10, 1))%10;
if (score>99) digits[2]=(int)(score/pow(10, 2))%10;
for(int a=0; a<3; a++) digitsImages[a]->setImageData(digitsImagesData[digits[2-a]]);
}
/**
* Draw the button on screen
*/
void ScoreImage::draw(CVideo *v)
{
if(!this->isVisible())
return;
// draw images
digitsImages[0]->draw(v);
digitsImages[1]->draw(v);
digitsImages[2]->draw(v);
}
void ScoreImage::update(GuiController * c)
{
}

42
src/game/ScoreImage.h Normal file
View File

@ -0,0 +1,42 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef SCORE_IMG_H_
#define SCORE_IMG_H_
#include "gui/GuiElement.h"
#include "gui/GuiText.h"
#include "gui/GuiController.h"
#include "gui/GuiImage.h"
#include "gui/GuiSound.h"
#include "gui/GuiTrigger.h"
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)
class ScoreImage : public GuiElement
{
public:
ScoreImage(int x, int y);
virtual ~ScoreImage();
void setScore(int score);
void draw(CVideo *video);
void update(GuiController * c);
protected:
GuiImageData* digitsImagesData[11]; //Our 10 numers + 1 null digit :P
GuiImage * digitsImages[3];
int digits[3];
};
#endif

92
src/game/SplashScreen.cpp Normal file
View File

@ -0,0 +1,92 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "SplashScreen.h"
#include "gui/GuiTrigger.h"
#include "gui/GuiController.h"
/**
* Constructor for the GuiButton class.
*/
SplashScreen::SplashScreen(GuiImageData * img)
{
img_real = new GuiImage(img);
img_real->setAlignment(ALIGN_CENTER | ALIGN_CENTER);
img_real->setPosition(0, 0);
}
/**
* Destructor for the GuiButton class.
*/
SplashScreen::~SplashScreen()
{
state=0;
delete(img_real);
}
void SplashScreen::setSplashImageData(GuiImageData * img)
{
img_real->setImageData(img);
}
void SplashScreen::FadeExit()
{
trasparency=1.0f;
state=1;
img_real->setAlpha(trasparency);
}
void SplashScreen::FadeEnter()
{
trasparency=0.0f;
state=2;
img_real->setAlpha(trasparency);
}
/**
* Draw the button on screen
*/
void SplashScreen::draw(CVideo *v)
{
if(state!=0) {
switch(state) {
case 1:
if (trasparency>0.0f) {
trasparency=trasparency-0.05f;
img_real->setAlpha(trasparency);
} else state=0;
break;
case 2:
if (trasparency<1.0f) {
trasparency=trasparency+0.05f;
img_real->setAlpha(trasparency);
} else state=0;
break;
}
}
if(!this->isVisible())
return;
// draw images
img_real->draw(v);
}
void SplashScreen::update(GuiController * c)
{
}

45
src/game/SplashScreen.h Normal file
View File

@ -0,0 +1,45 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef SPLASHSCREEN_H_
#define SPLASHSCREEN_H_
#include "gui/GuiElement.h"
#include "gui/GuiText.h"
#include "gui/GuiController.h"
#include "gui/GuiImage.h"
#include "gui/GuiSound.h"
#include "gui/GuiTrigger.h"
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)
class SplashScreen : public GuiElement
{
public:
SplashScreen(GuiImageData * img);
virtual ~SplashScreen();
void setSplashImageData(GuiImageData * img);
void FadeExit();
void FadeEnter();
void draw(CVideo *video);
void update(GuiController * c);
protected:
GuiImage * img_real;
int state;
float trasparency=1.0f;
int tmp_xpos;
};
#endif

608
src/gui/FreeTypeGX.cpp Normal file
View File

@ -0,0 +1,608 @@
/*
* FreeTypeGX is a wrapper class for libFreeType which renders a compiled
* FreeType parsable font into a GX texture for Wii homebrew development.
* Copyright (C) 2008 Armin Tamzarian
* Modified by Dimok, 2015 for WiiU GX2
*
* This file is part of FreeTypeGX.
*
* FreeTypeGX is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTypeGX 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FreeTypeGX. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FreeTypeGX.h"
#include "video/CVideo.h"
#include "video/shaders/Texture2DShader.h"
#include "utils/logger.h"
using namespace std;
#define ALIGN4(x) (((x) + 3) & ~3)
/**
* Default constructor for the FreeTypeGX class for WiiXplorer.
*/
FreeTypeGX::FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize, bool lastFace)
{
int faceIndex = 0;
ftPointSize = 0;
GX2InitSampler(&ftSampler, GX2_TEX_CLAMP_CLAMP_BORDER, GX2_TEX_XY_FILTER_BILINEAR);
FT_Init_FreeType(&ftLibrary);
if(lastFace)
{
FT_New_Memory_Face(ftLibrary, (FT_Byte *)fontBuffer, bufferSize, -1, &ftFace);
faceIndex = ftFace->num_faces - 1; // Use the last face
FT_Done_Face(ftFace);
ftFace = NULL;
}
FT_New_Memory_Face(ftLibrary, (FT_Byte *) fontBuffer, bufferSize, faceIndex, &ftFace);
ftKerningEnabled = FT_HAS_KERNING(ftFace);
}
/**
* Default destructor for the FreeTypeGX class.
*/
FreeTypeGX::~FreeTypeGX()
{
unloadFont();
FT_Done_Face(ftFace);
FT_Done_FreeType(ftLibrary);
}
/**
* Convert a short char string to a wide char string.
*
* This routine converts a supplied short character string into a wide character string.
* Note that it is the user's responsibility to clear the returned buffer once it is no longer needed.
*
* @param strChar Character string to be converted.
* @return Wide character representation of supplied character string.
*/
wchar_t* FreeTypeGX::charToWideChar(const char* strChar)
{
if (!strChar) return NULL;
wchar_t *strWChar = new (std::nothrow) wchar_t[strlen(strChar) + 1];
if (!strWChar) return NULL;
int bt = mbstowcs(strWChar, strChar, strlen(strChar));
if (bt > 0)
{
strWChar[bt] = 0;
return strWChar;
}
wchar_t *tempDest = strWChar;
while ((*tempDest++ = *strChar++))
;
return strWChar;
}
char *FreeTypeGX::wideCharToUTF8(const wchar_t* strChar)
{
if(!strChar) {
return NULL;
}
size_t len = 0;
wchar_t wc;
for (size_t i = 0; strChar[i]; ++i)
{
wc = strChar[i];
if (wc < 0x80)
++len;
else if (wc < 0x800)
len += 2;
else if (wc < 0x10000)
len += 3;
else
len += 4;
}
char *pOut = new (std::nothrow) char[len];
if(!pOut)
return NULL;
size_t n = 0;
for (size_t i = 0; strChar[i]; ++i)
{
wc = strChar[i];
if (wc < 0x80)
pOut[n++] = (char)wc;
else if (wc < 0x800)
{
pOut[n++] = (char)((wc >> 6) | 0xC0);
pOut[n++] = (char)((wc & 0x3F) | 0x80);
}
else if (wc < 0x10000)
{
pOut[n++] = (char)((wc >> 12) | 0xE0);
pOut[n++] = (char)(((wc >> 6) & 0x3F) | 0x80);
pOut[n++] = (char)((wc & 0x3F) | 0x80);
}
else
{
pOut[n++] = (char)(((wc >> 18) & 0x07) | 0xF0);
pOut[n++] = (char)(((wc >> 12) & 0x3F) | 0x80);
pOut[n++] = (char)(((wc >> 6) & 0x3F) | 0x80);
pOut[n++] = (char)((wc & 0x3F) | 0x80);
}
}
return pOut;
}
/**
* Clears all loaded font glyph data.
*
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
*/
void FreeTypeGX::unloadFont()
{
map<int16_t, ftGX2Data >::iterator itr;
map<wchar_t, ftgxCharData>::iterator itr2;
for (itr = fontData.begin(); itr != fontData.end(); itr++)
{
for (itr2 = itr->second.ftgxCharMap.begin(); itr2 != itr->second.ftgxCharMap.end(); itr2++)
{
if(itr2->second.texture)
{
if(itr2->second.texture->surface.image_data)
free(itr2->second.texture->surface.image_data);
delete itr2->second.texture;
itr2->second.texture = NULL;
}
}
}
fontData.clear();
}
/**
* Caches the given font glyph in the instance font texture buffer.
*
* This routine renders and stores the requested glyph's bitmap and relevant information into its own quickly addressible
* structure within an instance-specific map.
*
* @param charCode The requested glyph's character code.
* @return A pointer to the allocated font structure.
*/
ftgxCharData * FreeTypeGX::cacheGlyphData(wchar_t charCode, int16_t pixelSize)
{
map<int16_t, ftGX2Data>::iterator itr = fontData.find(pixelSize);
if (itr != fontData.end())
{
map<wchar_t, ftgxCharData>::iterator itr2 = itr->second.ftgxCharMap.find(charCode);
if (itr2 != itr->second.ftgxCharMap.end())
{
return &itr2->second;
}
}
//!Cache ascender and decender as well
ftGX2Data *ftData = &fontData[pixelSize];
FT_UInt gIndex;
uint16_t textureWidth = 0, textureHeight = 0;
if (ftPointSize != pixelSize)
{
ftPointSize = pixelSize;
FT_Set_Pixel_Sizes(ftFace, 0, ftPointSize);
ftData->ftgxAlign.ascender = (int16_t) ftFace->size->metrics.ascender >> 6;
ftData->ftgxAlign.descender = (int16_t) ftFace->size->metrics.descender >> 6;
ftData->ftgxAlign.max = 0;
ftData->ftgxAlign.min = 0;
}
gIndex = FT_Get_Char_Index(ftFace, (FT_ULong) charCode);
if (gIndex != 0 && FT_Load_Glyph(ftFace, gIndex, FT_LOAD_DEFAULT | FT_LOAD_RENDER) == 0)
{
if (ftFace->glyph->format == FT_GLYPH_FORMAT_BITMAP)
{
FT_Bitmap *glyphBitmap = &ftFace->glyph->bitmap;
textureWidth = ALIGN4(glyphBitmap->width);
textureHeight = ALIGN4(glyphBitmap->rows);
if(textureWidth == 0)
textureWidth = 4;
if(textureHeight == 0)
textureHeight = 4;
ftgxCharData *charData = &ftData->ftgxCharMap[charCode];
charData->renderOffsetX = (int16_t) ftFace->glyph->bitmap_left;
charData->glyphAdvanceX = (uint16_t) (ftFace->glyph->advance.x >> 6);
charData->glyphAdvanceY = (uint16_t) (ftFace->glyph->advance.y >> 6);
charData->glyphIndex = (uint32_t) gIndex;
charData->renderOffsetY = (int16_t) ftFace->glyph->bitmap_top;
charData->renderOffsetMax = (int16_t) ftFace->glyph->bitmap_top;
charData->renderOffsetMin = (int16_t) glyphBitmap->rows - ftFace->glyph->bitmap_top;
//! Initialize texture
charData->texture = new GX2Texture;
GX2InitTexture(charData->texture, textureWidth, textureHeight, 1, 0, GX2_SURFACE_FORMAT_TC_R5_G5_B5_A1_UNORM, GX2_SURFACE_DIM_2D, GX2_TILE_MODE_LINEAR_ALIGNED);
loadGlyphData(glyphBitmap, charData);
return charData;
}
}
return NULL;
}
/**
* Locates each character in this wrapper's configured font face and proccess them.
*
* This routine locates each character in the configured font face and renders the glyph's bitmap.
* Each bitmap and relevant information is loaded into its own quickly addressible structure within an instance-specific map.
*/
uint16_t FreeTypeGX::cacheGlyphDataComplete(int16_t pixelSize)
{
uint32_t i = 0;
FT_UInt gIndex;
FT_ULong charCode = FT_Get_First_Char(ftFace, &gIndex);
while (gIndex != 0)
{
if (cacheGlyphData(charCode, pixelSize) != NULL) ++i;
charCode = FT_Get_Next_Char(ftFace, charCode, &gIndex);
}
return (uint16_t) (i);
}
/**
* Loads the rendered bitmap into the relevant structure's data buffer.
*
* This routine does a simple byte-wise copy of the glyph's rendered 8-bit grayscale bitmap into the structure's buffer.
* Each byte is converted from the bitmap's intensity value into the a uint32_t RGBA value.
*
* @param bmp A pointer to the most recently rendered glyph's bitmap.
* @param charData A pointer to an allocated ftgxCharData structure whose data represent that of the last rendered glyph.
*/
void FreeTypeGX::loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData)
{
charData->texture->surface.image_data = (uint8_t *) memalign(charData->texture->surface.align, charData->texture->surface.image_size);
if(!charData->texture->surface.image_data)
return;
memset(charData->texture->surface.image_data, 0x00, charData->texture->surface.image_size);
uint8_t *src = (uint8_t *)bmp->buffer;
uint16_t *dst = (uint16_t *)charData->texture->surface.image_data;
int32_t x, y;
for(y = 0; y < bmp->rows; y++)
{
for(x = 0; x < bmp->width; x++)
{
uint8_t intensity = src[y * bmp->width + x] >> 3;
dst[y * charData->texture->surface.pitch + x] = intensity ? ((intensity << 11) | (intensity << 6) | (intensity << 1) | 1) : 0;
}
}
GX2Invalidate(GX2_INVALIDATE_CPU_TEXTURE, charData->texture->surface.image_data, charData->texture->surface.image_size);
}
/**
* Determines the x offset of the rendered string.
*
* This routine calculates the x offset of the rendered string based off of a supplied positional format parameter.
*
* @param width Current pixel width of the string.
* @param format Positional format of the string.
*/
int16_t FreeTypeGX::getStyleOffsetWidth(uint16_t width, uint16_t format)
{
if (format & FTGX_JUSTIFY_LEFT)
return 0;
else if (format & FTGX_JUSTIFY_CENTER)
return -(width >> 1);
else if (format & FTGX_JUSTIFY_RIGHT) return -width;
return 0;
}
/**
* Determines the y offset of the rendered string.
*
* This routine calculates the y offset of the rendered string based off of a supplied positional format parameter.
*
* @param offset Current pixel offset data of the string.
* @param format Positional format of the string.
*/
int16_t FreeTypeGX::getStyleOffsetHeight(int16_t format, uint16_t pixelSize)
{
std::map<int16_t, ftGX2Data>::iterator itr = fontData.find(pixelSize);
if (itr == fontData.end()) return 0;
switch (format & FTGX_ALIGN_MASK)
{
case FTGX_ALIGN_TOP:
return itr->second.ftgxAlign.descender;
case FTGX_ALIGN_MIDDLE:
default:
return (itr->second.ftgxAlign.ascender + itr->second.ftgxAlign.descender + 1) >> 1;
case FTGX_ALIGN_BOTTOM:
return itr->second.ftgxAlign.ascender;
case FTGX_ALIGN_BASELINE:
return 0;
case FTGX_ALIGN_GLYPH_TOP:
return itr->second.ftgxAlign.max;
case FTGX_ALIGN_GLYPH_MIDDLE:
return (itr->second.ftgxAlign.max + itr->second.ftgxAlign.min + 1) >> 1;
case FTGX_ALIGN_GLYPH_BOTTOM:
return itr->second.ftgxAlign.min;
}
return 0;
}
/**
* Processes the supplied text string and prints the results at the specified coordinates.
*
* This routine processes each character of the supplied text string, loads the relevant preprocessed bitmap buffer,
* a texture from said buffer, and loads the resultant texture into the EFB.
*
* @param x Screen X coordinate at which to output the text.
* @param y Screen Y coordinate at which to output the text. Note that this value corresponds to the text string origin and not the top or bottom of the glyphs.
* @param text NULL terminated string to output.
* @param color Optional color to apply to the text characters. If not specified default value is ftgxWhite: (GXColor){0xff, 0xff, 0xff, 0xff}
* @param textStyle Flags which specify any styling which should be applied to the rendered string.
* @return The number of characters printed.
*/
uint16_t FreeTypeGX::drawText(CVideo *video, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 & color, uint16_t textStyle, uint16_t textWidth, const float &textBlur, const float & colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale)
{
if (!text)
return 0;
uint16_t fullTextWidth = (textWidth > 0) ? textWidth : getWidth(text, pixelSize);
uint16_t x_pos = x, printed = 0;
uint16_t x_offset = 0, y_offset = 0;
FT_Vector pairDelta;
if (textStyle & FTGX_JUSTIFY_MASK)
{
x_offset = getStyleOffsetWidth(fullTextWidth, textStyle);
}
if (textStyle & FTGX_ALIGN_MASK)
{
y_offset = getStyleOffsetHeight(textStyle, pixelSize);
}
int i = 0;
while (text[i])
{
ftgxCharData* glyphData = cacheGlyphData(text[i], pixelSize);
if (glyphData != NULL)
{
if (ftKerningEnabled && i > 0)
{
FT_Get_Kerning(ftFace, fontData[pixelSize].ftgxCharMap[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta);
x_pos += (pairDelta.x >> 6);
}
copyTextureToFramebuffer(video, glyphData->texture,x_pos + glyphData->renderOffsetX + x_offset, y + glyphData->renderOffsetY - y_offset, z, color, textBlur, colorBlurIntensity, blurColor,internalRenderingScale);
x_pos += glyphData->glyphAdvanceX;
++printed;
}
++i;
}
return printed;
}
/**
* Processes the supplied string and return the width of the string in pixels.
*
* This routine processes each character of the supplied text string and calculates the width of the entire string.
* Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
*
* @param text NULL terminated string to calculate.
* @return The width of the text string in pixels.
*/
uint16_t FreeTypeGX::getWidth(const wchar_t *text, int16_t pixelSize)
{
if (!text) return 0;
uint16_t strWidth = 0;
FT_Vector pairDelta;
int i = 0;
while (text[i])
{
ftgxCharData* glyphData = cacheGlyphData(text[i], pixelSize);
if (glyphData != NULL)
{
if (ftKerningEnabled && (i > 0))
{
FT_Get_Kerning(ftFace, fontData[pixelSize].ftgxCharMap[text[i - 1]].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta);
strWidth += pairDelta.x >> 6;
}
strWidth += glyphData->glyphAdvanceX;
}
++i;
}
return strWidth;
}
/**
* Single char width
*/
uint16_t FreeTypeGX::getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar)
{
uint16_t strWidth = 0;
ftgxCharData * glyphData = cacheGlyphData(wChar, pixelSize);
if (glyphData != NULL)
{
if (ftKerningEnabled && prevChar != 0x0000)
{
FT_Vector pairDelta;
FT_Get_Kerning(ftFace, fontData[pixelSize].ftgxCharMap[prevChar].glyphIndex, glyphData->glyphIndex, FT_KERNING_DEFAULT, &pairDelta);
strWidth += pairDelta.x >> 6;
}
strWidth += glyphData->glyphAdvanceX;
}
return strWidth;
}
/**
* Processes the supplied string and return the height of the string in pixels.
*
* This routine processes each character of the supplied text string and calculates the height of the entire string.
* Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
*
* @param text NULL terminated string to calculate.
* @return The height of the text string in pixels.
*/
uint16_t FreeTypeGX::getHeight(const wchar_t *text, int16_t pixelSize)
{
getOffset(text, pixelSize);
return fontData[pixelSize].ftgxAlign.max - fontData[pixelSize].ftgxAlign.min;
}
/**
* Get the maximum offset above and minimum offset below the font origin line.
*
* This function calculates the maximum pixel height above the font origin line and the minimum
* pixel height below the font origin line and returns the values in an addressible structure.
*
* @param text NULL terminated string to calculate.
* @param offset returns the max and min values above and below the font origin line
*
*/
void FreeTypeGX::getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit)
{
if (fontData.find(pixelSize) != fontData.end())
return;
int16_t strMax = 0, strMin = 9999;
uint16_t currWidth = 0;
int i = 0;
while (text[i])
{
if (widthLimit > 0 && currWidth >= widthLimit) break;
ftgxCharData* glyphData = cacheGlyphData(text[i], pixelSize);
if (glyphData != NULL)
{
strMax = glyphData->renderOffsetMax > strMax ? glyphData->renderOffsetMax : strMax;
strMin = glyphData->renderOffsetMin < strMin ? glyphData->renderOffsetMin : strMin;
currWidth += glyphData->glyphAdvanceX;
}
++i;
}
if (ftPointSize != pixelSize)
{
ftPointSize = pixelSize;
FT_Set_Pixel_Sizes(ftFace, 0, ftPointSize);
}
fontData[pixelSize].ftgxAlign.ascender = ftFace->size->metrics.ascender >> 6;
fontData[pixelSize].ftgxAlign.descender = ftFace->size->metrics.descender >> 6;
fontData[pixelSize].ftgxAlign.max = strMax;
fontData[pixelSize].ftgxAlign.min = strMin;
}
/**
* Copies the supplied texture quad to the EFB.
*
* This routine uses the in-built GX quad builder functions to define the texture bounds and location on the EFB target.
*
* @param texObj A pointer to the glyph's initialized texture object.
* @param texWidth The pixel width of the texture object.
* @param texHeight The pixel height of the texture object.
* @param screenX The screen X coordinate at which to output the rendered texture.
* @param screenY The screen Y coordinate at which to output the rendered texture.
* @param color Color to apply to the texture.
*/
void FreeTypeGX::copyTextureToFramebuffer(CVideo *pVideo, GX2Texture *texture, int16_t x, int16_t y, int16_t z, const glm::vec4 & color, const float & defaultBlur, const float & blurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale)
{
static const f32 imageAngle = 0.0f;
static const f32 blurScale = (2.0f/ (internalRenderingScale));
f32 offsetLeft = blurScale * ((f32)x + 0.5f * (f32)texture->surface.width) * (f32)pVideo->getWidthScaleFactor();
f32 offsetTop = blurScale * ((f32)y - 0.5f * (f32)texture->surface.height) * (f32)pVideo->getHeightScaleFactor();
f32 widthScale = blurScale * (f32)texture->surface.width * pVideo->getWidthScaleFactor();
f32 heightScale = blurScale * (f32)texture->surface.height * pVideo->getHeightScaleFactor();
glm::vec3 positionOffsets( offsetLeft, offsetTop, (f32)z );
//! blur doubles due to blur we have to scale the texture
glm::vec3 scaleFactor( widthScale, heightScale, 1.0f );
glm::vec3 blurDirection;
blurDirection[2] = 1.0f;
Texture2DShader::instance()->setShaders();
Texture2DShader::instance()->setAttributeBuffer();
Texture2DShader::instance()->setAngle(imageAngle);
Texture2DShader::instance()->setOffset(positionOffsets);
Texture2DShader::instance()->setScale(scaleFactor);
Texture2DShader::instance()->setTextureAndSampler(texture, &ftSampler);
if(blurIntensity > 0.0f)
{
//! glow blur color
Texture2DShader::instance()->setColorIntensity(blurColor);
//! glow blur horizontal
blurDirection[0] = blurIntensity;
blurDirection[1] = 0.0f;
Texture2DShader::instance()->setBlurring(blurDirection);
Texture2DShader::instance()->draw();
//! glow blur vertical
blurDirection[0] = 0.0f;
blurDirection[1] = blurIntensity;
Texture2DShader::instance()->setBlurring(blurDirection);
Texture2DShader::instance()->draw();
}
//! set text color
Texture2DShader::instance()->setColorIntensity(color);
//! blur horizontal
blurDirection[0] = defaultBlur;
blurDirection[1] = 0.0f;
Texture2DShader::instance()->setBlurring(blurDirection);
Texture2DShader::instance()->draw();
//! blur vertical
blurDirection[0] = 0.0f;
blurDirection[1] = defaultBlur;
Texture2DShader::instance()->setBlurring(blurDirection);
Texture2DShader::instance()->draw();
}

155
src/gui/FreeTypeGX.h Normal file
View File

@ -0,0 +1,155 @@
/*
* FreeTypeGX is a wrapper class for libFreeType which renders a compiled
* FreeType parsable font into a GX texture for Wii homebrew development.
* Copyright (C) 2008 Armin Tamzarian
* Modified by Dimok, 2015 for WiiU GX2
*
* This file is part of FreeTypeGX.
*
* FreeTypeGX is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTypeGX 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FreeTypeGX. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FREETYPEGX_H_
#define FREETYPEGX_H_
#include <gctypes.h>
#include <string>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
#include <malloc.h>
#include <string.h>
#include <wchar.h>
#include <map>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "dynamic_libs/gx2_functions.h"
/*! \struct ftgxCharData_
*
* Font face character glyph relevant data structure.
*/
typedef struct ftgxCharData_
{
int16_t renderOffsetX; /**< Texture X axis bearing offset. */
uint16_t glyphAdvanceX; /**< Character glyph X coordinate advance in pixels. */
uint16_t glyphAdvanceY; /**< Character glyph Y coordinate advance in pixels. */
uint32_t glyphIndex; /**< Charachter glyph index in the font face. */
int16_t renderOffsetY; /**< Texture Y axis bearing offset. */
int16_t renderOffsetMax; /**< Texture Y axis bearing maximum value. */
int16_t renderOffsetMin; /**< Texture Y axis bearing minimum value. */
GX2Texture * texture;
} ftgxCharData;
/*! \struct ftgxDataOffset_
*
* Offset structure which hold both a maximum and minimum value.
*/
typedef struct ftgxDataOffset_
{
int16_t ascender; /**< Maximum data offset. */
int16_t descender; /**< Minimum data offset. */
int16_t max; /**< Maximum data offset. */
int16_t min; /**< Minimum data offset. */
} ftgxDataOffset;
typedef struct ftgxCharData_ ftgxCharData;
typedef struct ftgxDataOffset_ ftgxDataOffset;
#define _TEXT(t) L ## t /**< Unicode helper macro. */
#define FTGX_NULL 0x0000
#define FTGX_JUSTIFY_LEFT 0x0001
#define FTGX_JUSTIFY_CENTER 0x0002
#define FTGX_JUSTIFY_RIGHT 0x0004
#define FTGX_JUSTIFY_MASK 0x000f
#define FTGX_ALIGN_TOP 0x0010
#define FTGX_ALIGN_MIDDLE 0x0020
#define FTGX_ALIGN_BOTTOM 0x0040
#define FTGX_ALIGN_BASELINE 0x0080
#define FTGX_ALIGN_GLYPH_TOP 0x0100
#define FTGX_ALIGN_GLYPH_MIDDLE 0x0200
#define FTGX_ALIGN_GLYPH_BOTTOM 0x0400
#define FTGX_ALIGN_MASK 0x0ff0
#define FTGX_STYLE_UNDERLINE 0x1000
#define FTGX_STYLE_STRIKE 0x2000
#define FTGX_STYLE_MASK 0xf000
/**< Constant color value used only to sanitize Doxygen documentation. */
static const GX2ColorF32 ftgxWhite = (GX2ColorF32){ 1.0f, 1.0f, 1.0f, 1.0f };
//! forward declaration
class CVideo;
/*! \class FreeTypeGX
* \brief Wrapper class for the libFreeType library with GX rendering.
* \author Armin Tamzarian
* \version 0.2.4
*
* FreeTypeGX acts as a wrapper class for the libFreeType library. It supports precaching of transformed glyph data into
* a specified texture format. Rendering of the data to the EFB is accomplished through the application of high performance
* GX texture functions resulting in high throughput of string rendering.
*/
class FreeTypeGX
{
private:
FT_Library ftLibrary; /**< FreeType FT_Library instance. */
FT_Face ftFace; /**< FreeType reusable FT_Face typographic object. */
int16_t ftPointSize; /**< Current set size of the rendered font. */
bool ftKerningEnabled; /**< Flag indicating the availability of font kerning data. */
uint8_t vertexIndex; /**< Vertex format descriptor index. */
GX2Sampler ftSampler;
typedef struct _ftGX2Data
{
ftgxDataOffset ftgxAlign;
std::map<wchar_t, ftgxCharData> ftgxCharMap;
} ftGX2Data;
std::map<int16_t, ftGX2Data> fontData; /**< Map which holds the glyph data structures for the corresponding characters in one size. */
int16_t getStyleOffsetWidth(uint16_t width, uint16_t format);
int16_t getStyleOffsetHeight(int16_t format, uint16_t pixelSize);
void unloadFont();
ftgxCharData *cacheGlyphData(wchar_t charCode, int16_t pixelSize);
uint16_t cacheGlyphDataComplete(int16_t pixelSize);
void loadGlyphData(FT_Bitmap *bmp, ftgxCharData *charData);
void copyTextureToFramebuffer(CVideo * pVideo, GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 & color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale);
public:
FreeTypeGX(const uint8_t* fontBuffer, FT_Long bufferSize, bool lastFace = false);
~FreeTypeGX();
uint16_t drawText(CVideo * pVideo, int16_t x, int16_t y, int16_t z, const wchar_t *text, int16_t pixelSize, const glm::vec4 & color,
uint16_t textStyling, uint16_t textWidth, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 & blurColor, const float & internalRenderingScale);
uint16_t getWidth(const wchar_t *text, int16_t pixelSize);
uint16_t getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar = 0x0000);
uint16_t getHeight(const wchar_t *text, int16_t pixelSize);
void getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widthLimit = 0);
static wchar_t* charToWideChar(const char* p);
static char* wideCharToUTF8(const wchar_t* strChar);
};
#endif /* FREETYPEGX_H_ */

42
src/gui/GameBgImage.cpp Normal file
View File

@ -0,0 +1,42 @@
#include "GameBgImage.h"
#include "video/CVideo.h"
#include "video/shaders/Shader3D.h"
GameBgImage::GameBgImage(const std::string & filename, GuiImageData *preloadImage)
: GuiImageAsync(filename, preloadImage)
{
identity = glm::mat4(1.0f);
alphaFadeOut = glm::vec4(1.0f, 0.075f, 5.305f, 2.0f);
}
GameBgImage::~GameBgImage()
{
}
void GameBgImage::draw(CVideo *pVideo)
{
if(!getImageData() || !getImageData()->getTexture())
return;
//! first setup 2D GUI positions
f32 currPosX = getCenterX();
f32 currPosY = getCenterY();
f32 currPosZ = getDepth();
f32 currScaleX = getScaleX() * (f32)getWidth() * pVideo->getWidthScaleFactor();
f32 currScaleY = getScaleY() * (f32)getHeight() * pVideo->getHeightScaleFactor();
f32 currScaleZ = getScaleZ() * (f32)getWidth() * pVideo->getDepthScaleFactor();
glm::mat4 m_modelView = glm::translate(identity, glm::vec3(currPosX,currPosY, currPosZ));
m_modelView = glm::scale(m_modelView, glm::vec3(currScaleX, currScaleY, currScaleZ));
Shader3D::instance()->setShaders();
Shader3D::instance()->setProjectionMtx(identity);
Shader3D::instance()->setViewMtx(identity);
Shader3D::instance()->setModelViewMtx(m_modelView);
Shader3D::instance()->setTextureAndSampler(getImageData()->getTexture(), getImageData()->getSampler());
Shader3D::instance()->setAlphaFadeOut(alphaFadeOut);
Shader3D::instance()->setDistanceFadeOut(0.0f);
Shader3D::instance()->setColorIntensity(glm::vec4(1.0f, 1.0f, 1.0f, getAlpha()));
Shader3D::instance()->setAttributeBuffer();
Shader3D::instance()->draw();
}

23
src/gui/GameBgImage.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef _GAME_BG_IMAGE_H_
#define _GAME_BG_IMAGE_H_
#include "GuiImageAsync.h"
#include "video/shaders/Shader3D.h"
class GameBgImage : public GuiImageAsync
{
public:
GameBgImage(const std::string & filename, GuiImageData *preloadImage);
virtual ~GameBgImage();
void setAlphaFadeOut(const glm::vec4 & a) {
alphaFadeOut = a;
}
void draw(CVideo *pVideo);
private:
glm::mat4 identity;
glm::vec4 alphaFadeOut;
};
#endif // _GAME_BG_IMAGE_H_

321
src/gui/GameIcon.cpp Normal file
View File

@ -0,0 +1,321 @@
#include "GameIcon.h"
#include "GameIconModel.h"
#include "Application.h"
#include "video/CVideo.h"
#include "video/shaders/Shader3D.h"
#include "video/shaders/ShaderFractalColor.h"
static const f32 cfIconMirrorScale = 1.15f;
static const f32 cfIconMirrorAlpha = 0.45f;
GameIcon::GameIcon(const std::string & filename, GuiImageData *preloadImage)
: GuiImageAsync(filename, preloadImage)
{
bSelected = false;
bRenderStroke = true;
bRenderReflection = false;
bIconLast = false;
strokeFractalEnable = 1;
strokeBlurBorder = 0.0f;
distanceFadeout = 0.0f;
rotationX = 0.0f;
reflectionAlpha = 0.4f;
strokeWidth = 2.35f;
colorIntensity = glm::vec4(1.0f);
colorIntensityMirror = colorIntensity;
alphaFadeOutNorm = glm::vec4(0.0f);
alphaFadeOutRefl = glm::vec4(-1.0f, 0.0f, 0.9f, 1.0f);
selectionBlurOuterColorIntensity = glm::vec4(0.09411764f * 1.15f, 0.56862745f * 1.15f, 0.96862745098f * 1.15f, 1.0f);
selectionBlurOuterSize = 1.65f;
selectionBlurOuterBorderSize = 0.5f;
selectionBlurInnerColorIntensity = glm::vec4(0.46666667f, 0.90588235f, 1.0f, 1.0f);
selectionBlurInnerSize = 1.45f;
selectionBlurInnerBorderSize = 0.95f;
vtxCount = sizeof(cfGameIconPosVtxs) / (Shader3D::cuVertexAttrSize);
//! texture and vertex coordinates
posVtxs = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, sizeof(cfGameIconPosVtxs));
texCoords = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, sizeof(cfGameIconTexCoords));
if(posVtxs)
{
memcpy((f32*)posVtxs, cfGameIconPosVtxs, sizeof(cfGameIconPosVtxs));
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, (f32*)posVtxs, sizeof(cfGameIconPosVtxs));
}
if(texCoords)
{
memcpy((f32*)texCoords, cfGameIconTexCoords, sizeof(cfGameIconTexCoords));
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, (f32*)texCoords, sizeof(cfGameIconTexCoords));
}
//! create vertexes for the mirror frame
texCoordsMirror = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, sizeof(cfGameIconTexCoords));
if(texCoordsMirror)
{
for(u32 i = 0; i < vtxCount; i++)
{
texCoordsMirror[i*2 + 0] = texCoords[i*2 + 0] * cfIconMirrorScale - ((cfIconMirrorScale - 1.0f) - (cfIconMirrorScale - 1.0f) * 0.5f);
texCoordsMirror[i*2 + 1] = texCoords[i*2 + 1] * cfIconMirrorScale - ((cfIconMirrorScale - 1.0f) - (cfIconMirrorScale - 1.0f) * 0.5f);
}
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, texCoordsMirror, sizeof(cfGameIconTexCoords));
}
//! setup stroke of the icon
strokePosVtxs = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, sizeof(cfGameIconStrokeVtxs));
if(strokePosVtxs)
{
memcpy(strokePosVtxs, cfGameIconStrokeVtxs, sizeof(cfGameIconStrokeVtxs));
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, strokePosVtxs, sizeof(cfGameIconStrokeVtxs));
}
strokeTexCoords = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, cuGameIconStrokeVtxCount * Shader::cuTexCoordAttrSize);
if(strokeTexCoords)
{
for(size_t i = 0, n = 0; i < cuGameIconStrokeVtxCount; n += 2, i += 3)
{
strokeTexCoords[n] = (1.0f + strokePosVtxs[i]) * 0.5f;
strokeTexCoords[n+1] = 1.0f - (1.0f + strokePosVtxs[i+1]) * 0.5f;
}
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, strokeTexCoords, cuGameIconStrokeVtxCount * Shader::cuTexCoordAttrSize);
}
strokeColorVtxs = (u8*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, cuGameIconStrokeVtxCount * Shader::cuColorAttrSize);
if(strokeColorVtxs)
{
for(size_t i = 0; i < (cuGameIconStrokeVtxCount * Shader::cuColorAttrSize); i++)
strokeColorVtxs[i] = 0xff;
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, strokeColorVtxs, cuGameIconStrokeVtxCount * Shader::cuColorAttrSize);
}
}
GameIcon::~GameIcon()
{
//! remove image so it can not be drawn anymore from this point on
imageData = NULL;
//! main image vertexes
if(posVtxs)
{
free((void*)posVtxs);
posVtxs = NULL;
}
if(texCoords)
{
free((void*)texCoords);
texCoords = NULL;
}
//! mirror image vertexes
if(texCoordsMirror)
{
free(texCoordsMirror);
texCoordsMirror = NULL;
}
//! stroke image vertexes
if(strokePosVtxs)
{
free(strokePosVtxs);
strokePosVtxs = NULL;
}
if(strokeTexCoords)
{
free(strokeTexCoords);
strokeTexCoords = NULL;
}
if(strokeColorVtxs)
{
free(strokeColorVtxs);
strokeColorVtxs = NULL;
}
}
bool GameIcon::checkRayIntersection(const glm::vec3 & rayOrigin, const glm::vec3 & rayDirFrac)
{
//! since we always face the camera we can just check the AABB intersection
//! otherwise an OOB intersection would be required
f32 currPosX = getCenterX() * Application::instance()->getVideo()->getWidthScaleFactor() * 2.0f;
f32 currPosY = getCenterY() * Application::instance()->getVideo()->getHeightScaleFactor() * 2.0f;
f32 currPosZ = getDepth() * Application::instance()->getVideo()->getDepthScaleFactor() * 2.0f;
f32 currScaleX = getScaleX() * (f32)getWidth() * Application::instance()->getVideo()->getWidthScaleFactor();
f32 currScaleY = getScaleY() * (f32)getHeight() * Application::instance()->getVideo()->getHeightScaleFactor();
f32 currScaleZ = getScaleZ() * (f32)getWidth() * Application::instance()->getVideo()->getDepthScaleFactor();
//! lb is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner
glm::vec3 lb(currPosX - currScaleX, currPosY - currScaleY, currPosZ - currScaleZ);
glm::vec3 rt(currPosX + currScaleX, currPosY + currScaleY, currPosZ + currScaleZ);
float t1 = (lb.x - rayOrigin.x) * rayDirFrac.x;
float t2 = (rt.x - rayOrigin.x) * rayDirFrac.x;
float t3 = (lb.y - rayOrigin.y) * rayDirFrac.y;
float t4 = (rt.y - rayOrigin.y) * rayDirFrac.y;
float t5 = (lb.z - rayOrigin.z) * rayDirFrac.z;
float t6 = (rt.z - rayOrigin.z) * rayDirFrac.z;
float tmin = std::max(std::max(std::min(t1, t2), std::min(t3, t4)), std::min(t5, t6));
float tmax = std::min(std::min(std::max(t1, t2), std::max(t3, t4)), std::max(t5, t6));
//! if tmax < 0, ray (line) is intersecting AABB, but whole AABB is behing us
if (tmax < 0)
{
//t = tmax;
return false;
}
//! if tmin > tmax, ray doesn't intersect AABB
if (tmin > tmax)
{
//t = tmax;
return false;
}
//t = tmin;
return true;
}
void GameIcon::draw(CVideo *pVideo, const glm::mat4 & projectionMtx, const glm::mat4 & viewMtx, const glm::mat4 & modelView)
{
//! first setup 2D GUI positions
f32 currPosX = getCenterX() * pVideo->getWidthScaleFactor() * 2.0f;
f32 currPosY = getCenterY() * pVideo->getHeightScaleFactor() * 2.0f;
f32 currPosZ = getDepth() * pVideo->getDepthScaleFactor() * 2.0f;
f32 currScaleX = getScaleX() * (f32)getWidth() * pVideo->getWidthScaleFactor();
f32 currScaleY = getScaleY() * (f32)getHeight() * pVideo->getHeightScaleFactor();
f32 currScaleZ = getScaleZ() * (f32)getWidth() * pVideo->getDepthScaleFactor();
f32 strokeScaleX = pVideo->getWidthScaleFactor() * strokeWidth * 0.25f + cfIconMirrorScale;
f32 strokeScaleY = pVideo->getHeightScaleFactor() * strokeWidth * 0.25f + cfIconMirrorScale;
for(int iDraw = 0; iDraw < 2; iDraw++)
{
glm::vec4 * alphaFadeOut;
glm::mat4 m_iconView;
glm::mat4 m_mirrorView;
glm::mat4 m_strokeView;
if(iDraw == RENDER_REFLECTION)
{
//! Reflection render
if(!bRenderReflection)
continue;
m_iconView = glm::translate(modelView, glm::vec3(currPosX, -currScaleY * 2.0f - currPosY, currPosZ + cosf(DegToRad(rotationX)) * currScaleZ * 2.0f));
m_iconView = glm::rotate(m_iconView, DegToRad(rotationX), glm::vec3(1.0f, 0.0f, 0.0f));
m_iconView = glm::scale(m_iconView, glm::vec3(currScaleX, -currScaleY, currScaleZ));
colorIntensity[3] = reflectionAlpha * getAlpha();
selectionBlurOuterColorIntensity[3] = colorIntensity[3] * 0.7f;
selectionBlurInnerColorIntensity[3] = colorIntensity[3] * 0.7f;
alphaFadeOut = &alphaFadeOutRefl;
GX2SetCullOnlyControl(GX2_FRONT_FACE_CCW, GX2_ENABLE, GX2_DISABLE);
}
else
{
//! Normal render
m_iconView = glm::translate(modelView, glm::vec3(currPosX,currPosY, currPosZ));
m_iconView = glm::rotate(m_iconView, DegToRad(rotationX), glm::vec3(1.0f, 0.0f, 0.0f));
m_iconView = glm::scale(m_iconView, glm::vec3(currScaleX, currScaleY, currScaleZ));
colorIntensity[3] = getAlpha();
selectionBlurOuterColorIntensity[3] = colorIntensity[3];
selectionBlurInnerColorIntensity[3] = colorIntensity[3];
alphaFadeOut = &alphaFadeOutNorm;
}
m_mirrorView = glm::scale(m_iconView, glm::vec3(cfIconMirrorScale, cfIconMirrorScale, cfIconMirrorScale));
colorIntensityMirror[3] = cfIconMirrorAlpha * colorIntensity[3];
if(!bIconLast)
{
Shader3D::instance()->setShaders();
Shader3D::instance()->setProjectionMtx(projectionMtx);
Shader3D::instance()->setViewMtx(viewMtx);
Shader3D::instance()->setTextureAndSampler(imageData->getTexture(), imageData->getSampler());
Shader3D::instance()->setAlphaFadeOut(*alphaFadeOut);
Shader3D::instance()->setDistanceFadeOut(distanceFadeout);
//! render the real symbol
Shader3D::instance()->setModelViewMtx(m_iconView);
Shader3D::instance()->setColorIntensity(colorIntensity);
Shader3D::instance()->setAttributeBuffer(vtxCount, posVtxs, texCoords);
Shader3D::instance()->draw(GX2_PRIMITIVE_QUADS, vtxCount);
}
if(bSelected)
{
strokeFractalEnable = 0;
GX2SetDepthOnlyControl(GX2_ENABLE, GX2_DISABLE, GX2_COMPARE_LEQUAL);
m_strokeView = glm::scale(m_iconView, glm::vec3(selectionBlurOuterSize, selectionBlurOuterSize, 0.0f));
ShaderFractalColor::instance()->setShaders();
ShaderFractalColor::instance()->setProjectionMtx(projectionMtx);
ShaderFractalColor::instance()->setViewMtx(viewMtx);
ShaderFractalColor::instance()->setModelViewMtx(m_strokeView);
ShaderFractalColor::instance()->setFractalColor(strokeFractalEnable);
ShaderFractalColor::instance()->setBlurBorder(selectionBlurOuterBorderSize);
ShaderFractalColor::instance()->setColorIntensity(selectionBlurOuterColorIntensity);
ShaderFractalColor::instance()->setAlphaFadeOut(*alphaFadeOut);
ShaderFractalColor::instance()->setAttributeBuffer();
ShaderFractalColor::instance()->draw();
m_strokeView = glm::scale(m_iconView, glm::vec3(selectionBlurInnerSize, selectionBlurInnerSize, 0.0f));
ShaderFractalColor::instance()->setBlurBorder(selectionBlurInnerBorderSize);
ShaderFractalColor::instance()->setColorIntensity(selectionBlurInnerColorIntensity);
ShaderFractalColor::instance()->draw();
GX2SetDepthOnlyControl(GX2_ENABLE, GX2_ENABLE, GX2_COMPARE_LEQUAL);
}
if(iDraw == RENDER_NORMAL && bRenderStroke)
{
strokeFractalEnable = 1;
//! now render the icon stroke
//! make the stroke a little bigger than the mirror, just by the line width on each side
m_strokeView = glm::scale(m_iconView, glm::vec3(strokeScaleX, strokeScaleY, cfIconMirrorScale));
ShaderFractalColor::instance()->setShaders();
ShaderFractalColor::instance()->setLineWidth(strokeWidth);
ShaderFractalColor::instance()->setProjectionMtx(projectionMtx);
ShaderFractalColor::instance()->setViewMtx(viewMtx);
ShaderFractalColor::instance()->setModelViewMtx(m_strokeView);
ShaderFractalColor::instance()->setFractalColor(strokeFractalEnable);
ShaderFractalColor::instance()->setBlurBorder(strokeBlurBorder);
ShaderFractalColor::instance()->setColorIntensity(colorIntensity);
ShaderFractalColor::instance()->setAlphaFadeOut(*alphaFadeOut);
ShaderFractalColor::instance()->setAttributeBuffer(cuGameIconStrokeVtxCount, strokePosVtxs, strokeTexCoords, strokeColorVtxs);
ShaderFractalColor::instance()->draw(GX2_PRIMITIVE_LINE_STRIP, cuGameIconStrokeVtxCount);
}
//! render the background mirror frame
Shader3D::instance()->setShaders();
Shader3D::instance()->setProjectionMtx(projectionMtx);
Shader3D::instance()->setViewMtx(viewMtx);
Shader3D::instance()->setTextureAndSampler(imageData->getTexture(), imageData->getSampler());
Shader3D::instance()->setAlphaFadeOut(*alphaFadeOut);
Shader3D::instance()->setDistanceFadeOut(distanceFadeout);
Shader3D::instance()->setModelViewMtx(m_mirrorView);
Shader3D::instance()->setColorIntensity(colorIntensityMirror);
Shader3D::instance()->setAttributeBuffer(vtxCount, posVtxs, texCoordsMirror);
Shader3D::instance()->draw(GX2_PRIMITIVE_QUADS, vtxCount);
if(bIconLast)
{
Shader3D::instance()->setShaders();
Shader3D::instance()->setProjectionMtx(projectionMtx);
Shader3D::instance()->setViewMtx(viewMtx);
Shader3D::instance()->setTextureAndSampler(imageData->getTexture(), imageData->getSampler());
Shader3D::instance()->setAlphaFadeOut(*alphaFadeOut);
Shader3D::instance()->setDistanceFadeOut(distanceFadeout);
//! render the real symbol
Shader3D::instance()->setModelViewMtx(m_iconView);
Shader3D::instance()->setColorIntensity(colorIntensity);
Shader3D::instance()->setAttributeBuffer(vtxCount, posVtxs, texCoords);
Shader3D::instance()->draw(GX2_PRIMITIVE_QUADS, vtxCount);
}
//! return back normal culling
if(iDraw == RENDER_REFLECTION)
{
GX2SetCullOnlyControl(GX2_FRONT_FACE_CCW, GX2_DISABLE, GX2_ENABLE);
}
}
}

85
src/gui/GameIcon.h Normal file
View File

@ -0,0 +1,85 @@
#ifndef _GAME_ICON_H_
#define _GAME_ICON_H_
#include "GuiImageAsync.h"
#include "video/shaders/Shader3D.h"
class GameIcon : public GuiImageAsync
{
public:
GameIcon(const std::string & filename, GuiImageData *preloadImage);
virtual ~GameIcon();
void setRotationX(f32 r) {
rotationX = r;
}
void setColorIntensity(const glm::vec4 & color) {
colorIntensity = color;
colorIntensityMirror = colorIntensity;
selectionBlurOuterColorIntensity = color * glm::vec4(0.09411764f * 1.15f, 0.56862745f * 1.15f, 0.96862745098f * 1.15f, 1.0f);
selectionBlurInnerColorIntensity = color * glm::vec4(0.46666667f, 0.90588235f, 1.0f, 1.0f);
}
const glm::vec4 & getColorIntensity() const {
return colorIntensity;
}
void setAlphaFadeOutNorm(const glm::vec4 & a) {
alphaFadeOutNorm = a;
}
void setAlphaFadeOutRefl(const glm::vec4 & a) {
alphaFadeOutRefl = a;
}
void setRenderReflection(bool enable) {
bRenderReflection = enable;
}
void setSelected(bool enable) {
bSelected = enable;
}
void setStrokeRender(bool enable) {
bRenderStroke = enable;
}
void setRenderIconLast(bool enable) {
bIconLast = enable;
}
void draw(CVideo *pVideo) {
static const glm::mat4 identity(1.0f);
draw(pVideo, identity, identity, identity);
}
void draw(CVideo *pVideo, const glm::mat4 & projection, const glm::mat4 & view, const glm::mat4 & modelView);
bool checkRayIntersection(const glm::vec3 & rayOrigin, const glm::vec3 & rayDirFrac);
private:
enum eRenderState
{
RENDER_REFLECTION,
RENDER_NORMAL
};
bool bSelected;
bool bRenderStroke;
bool bRenderReflection;
bool bIconLast;
glm::vec4 colorIntensity;
glm::vec4 colorIntensityMirror;
glm::vec4 alphaFadeOutNorm;
glm::vec4 alphaFadeOutRefl;
f32 reflectionAlpha;
f32 strokeWidth;
f32 rotationX;
f32 rgbReduction;
f32 distanceFadeout;
f32 *texCoordsMirror;
f32 *strokePosVtxs;
f32 *strokeTexCoords;
u8 *strokeColorVtxs;
int strokeFractalEnable;
f32 strokeBlurBorder;
glm::vec4 selectionBlurOuterColorIntensity;
f32 selectionBlurOuterSize;
f32 selectionBlurOuterBorderSize;
glm::vec4 selectionBlurInnerColorIntensity;
f32 selectionBlurInnerSize;
f32 selectionBlurInnerBorderSize;
};
#endif // _GAME_ICON_H_

760
src/gui/GameIconModel.h Normal file
View File

@ -0,0 +1,760 @@
#ifndef ICON_MODEL_H_
#define ICON_MODEL_H_
static const float cfGameIconPosVtxs[] = {
-0.844501f,-0.861263f,0.050154f,-0.802664f,-0.8797f,0.054004f,-0.809968f,-0.828995f,0.061777f,-0.864233f,-0.822169f,0.054004f,
-0.802664f,-0.8797f,0.054004f,-0.726455f,-0.89991f,0.058224f,-0.730326f,-0.842312f,0.067487f,-0.809968f,-0.828995f,0.061777f,
-0.809968f,-0.828995f,0.061777f,-0.730326f,-0.842312f,0.067487f,-0.738488f,-0.760488f,0.074426f,-0.824221f,-0.752861f,0.067487f,
-0.864233f,-0.822169f,0.054004f,-0.809968f,-0.828995f,0.061777f,-0.824221f,-0.752861f,0.067487f,-0.885862f,-0.749245f,0.058224f,
-0.726455f,-0.89991f,0.058224f,-0.612405f,-0.916988f,0.061789f,-0.614352f,-0.854962f,0.071886f,-0.730326f,-0.842312f,0.067487f,
-0.612405f,-0.916988f,0.061789f,-0.392243f,-0.928623f,0.064218f,-0.39312f,-0.8642f,0.074693f,-0.614352f,-0.854962f,0.071886f,
-0.614352f,-0.854962f,0.071886f,-0.39312f,-0.8642f,0.074693f,-0.395094f,-0.775509f,0.082561f,-0.618732f,-0.768902f,0.079479f,
-0.730326f,-0.842312f,0.067487f,-0.614352f,-0.854962f,0.071886f,-0.618732f,-0.768902f,0.079479f,-0.738488f,-0.760488f,0.074426f,
-0.738488f,-0.760488f,0.074426f,-0.618732f,-0.768902f,0.079479f,-0.624085f,-0.648442f,0.084918f,-0.747494f,-0.64344f,0.079479f,
-0.618732f,-0.768902f,0.079479f,-0.395094f,-0.775509f,0.082561f,-0.397505f,-0.652534f,0.088189f,-0.624085f,-0.648442f,0.084918f,
-0.624085f,-0.648442f,0.084918f,-0.397505f,-0.652534f,0.088189f,-0.399478f,-0.422739f,0.09157f,-0.628465f,-0.420911f,0.088189f,
-0.747494f,-0.64344f,0.079479f,-0.624085f,-0.648442f,0.084918f,-0.628465f,-0.420911f,0.088189f,-0.754564f,-0.418675f,0.082561f,
-0.885862f,-0.749245f,0.058224f,-0.824221f,-0.752861f,0.067487f,-0.837759f,-0.639347f,0.071886f,-0.90414f,-0.637528f,0.061789f,
-0.824221f,-0.752861f,0.067487f,-0.738488f,-0.760488f,0.074426f,-0.747494f,-0.64344f,0.079479f,-0.837759f,-0.639347f,0.071886f,
-0.837759f,-0.639347f,0.071886f,-0.747494f,-0.64344f,0.079479f,-0.754564f,-0.418675f,0.082561f,-0.847646f,-0.416846f,0.074693f,
-0.90414f,-0.637528f,0.061789f,-0.837759f,-0.639347f,0.071886f,-0.847646f,-0.416846f,0.074693f,-0.916591f,-0.416033f,0.064218f,
-0.399478f,-0.422739f,0.09157f,-0.397505f,-0.652534f,0.088189f,0.002274f,-0.653898f,0.089279f,0.002265f,-0.423349f,0.092698f,
-0.397505f,-0.652534f,0.088189f,-0.395094f,-0.775509f,0.082561f,0.002284f,-0.777711f,0.083588f,0.002274f,-0.653898f,0.089279f,
0.002274f,-0.653898f,0.089279f,0.002284f,-0.777711f,0.083588f,0.399509f,-0.775509f,0.082561f,0.401892f,-0.652534f,0.088189f,
0.002265f,-0.423349f,0.092698f,0.002274f,-0.653898f,0.089279f,0.401892f,-0.652534f,0.088189f,0.403842f,-0.422739f,0.09157f,
-0.395094f,-0.775509f,0.082561f,-0.39312f,-0.8642f,0.074693f,0.002293f,-0.867279f,0.075629f,0.002284f,-0.777711f,0.083588f,
-0.39312f,-0.8642f,0.074693f,-0.392243f,-0.928623f,0.064218f,0.002297f,-0.932501f,0.065028f,0.002293f,-0.867279f,0.075629f,
0.002293f,-0.867279f,0.075629f,0.002297f,-0.932501f,0.065028f,0.396693f,-0.928623f,0.064218f,0.397559f,-0.8642f,0.074693f,
0.002284f,-0.777711f,0.083588f,0.002293f,-0.867279f,0.075629f,0.397559f,-0.8642f,0.074693f,0.399509f,-0.775509f,0.082561f,
-0.399478f,-0.422739f,0.09157f,0.002265f,-0.423349f,0.092698f,0.002263f,-0.013572f,0.093837f,-0.400136f,-0.013589f,0.092698f,
0.002265f,-0.423349f,0.092698f,0.403842f,-0.422739f,0.09157f,0.404492f,-0.013589f,0.092698f,0.002263f,-0.013572f,0.093837f,
0.002263f,-0.013572f,0.093837f,0.404492f,-0.013589f,0.092698f,0.403842f,0.396564f,0.09157f,0.002265f,0.397221f,0.092698f,
-0.400136f,-0.013589f,0.092698f,0.002263f,-0.013572f,0.093837f,0.002265f,0.397221f,0.092698f,-0.399478f,0.396564f,0.09157f,
-0.754564f,0.392188f,0.082561f,-0.847646f,0.390218f,0.074693f,-0.850941f,-0.013754f,0.075629f,-0.756921f,-0.013703f,0.083588f,
-0.847646f,0.390218f,0.074693f,-0.916591f,0.389343f,0.064218f,-0.920742f,-0.013776f,0.065028f,-0.850941f,-0.013754f,0.075629f,
-0.850941f,-0.013754f,0.075629f,-0.920742f,-0.013776f,0.065028f,-0.916591f,-0.416033f,0.064218f,-0.847646f,-0.416846f,0.074693f,
-0.756921f,-0.013703f,0.083588f,-0.850941f,-0.013754f,0.075629f,-0.847646f,-0.416846f,0.074693f,-0.754564f,-0.418675f,0.082561f,
-0.754564f,0.392188f,0.082561f,-0.756921f,-0.013703f,0.083588f,-0.629925f,-0.01364f,0.089279f,-0.628465f,0.394595f,0.088189f,
-0.756921f,-0.013703f,0.083588f,-0.754564f,-0.418675f,0.082561f,-0.628465f,-0.420911f,0.088189f,-0.629925f,-0.01364f,0.089279f,
-0.629925f,-0.01364f,0.089279f,-0.628465f,-0.420911f,0.088189f,-0.399478f,-0.422739f,0.09157f,-0.400136f,-0.013589f,0.092698f,
-0.628465f,0.394595f,0.088189f,-0.629925f,-0.01364f,0.089279f,-0.400136f,-0.013589f,0.092698f,-0.399478f,0.396564f,0.09157f,
-0.844501f,0.846382f,0.050154f,-0.802664f,0.865969f,0.054004f,-0.814648f,0.914535f,0.037876f,-0.871108f,0.872793f,0.036675f,
-0.802664f,0.865969f,0.054004f,-0.726455f,0.887439f,0.058224f,-0.733131f,0.94538f,0.040237f,-0.814648f,0.914535f,0.037876f,
-0.814648f,0.914535f,0.037876f,-0.733131f,0.94538f,0.040237f,-0.74278f,0.982563f,0.019733f,-0.830745f,0.945555f,0.018815f,
-0.871108f,0.872793f,0.036675f,-0.814648f,0.914535f,0.037876f,-0.830745f,0.945555f,0.018815f,-0.894756f,0.896267f,0.018385f,
-0.726455f,0.887439f,0.058224f,-0.612405f,0.905582f,0.061789f,-0.615909f,0.968735f,0.042517f,-0.733131f,0.94538f,0.040237f,
-0.612405f,0.905582f,0.061789f,-0.392243f,0.917941f,0.064218f,-0.393822f,0.983443f,0.044197f,-0.615909f,0.968735f,0.042517f,
-0.615909f,0.968735f,0.042517f,-0.393822f,0.983443f,0.044197f,-0.396235f,1.025424f,0.021594f,-0.621266f,1.009264f,0.020771f,
-0.733131f,0.94538f,0.040237f,-0.615909f,0.968735f,0.042517f,-0.621266f,1.009264f,0.020771f,-0.74278f,0.982563f,0.019733f,
-0.621266f,1.009264f,0.020771f,-0.396235f,1.025424f,0.021594f,-0.398382f,1.047552f,0.0f,-0.626031f,1.030658f,0.0f,
-0.74278f,0.982563f,0.019733f,-0.621266f,1.009264f,0.020771f,-0.626031f,1.030658f,0.0f,-0.750636f,1.002556f,0.0f,
-0.830745f,0.945555f,0.018815f,-0.74278f,0.982563f,0.019733f,-0.750636f,1.002556f,0.0f,-0.842153f,0.963302f,0.0f,
-0.894756f,0.896267f,0.018385f,-0.830745f,0.945555f,0.018815f,-0.842153f,0.963302f,0.0f,-0.909674f,0.911075f,0.0f,
-0.398382f,1.047552f,0.0f,-0.396235f,1.025424f,0.021594f,0.002279f,1.030811f,0.021869f,0.00227f,1.053183f,0.0f,
0.002279f,1.030811f,0.021869f,-0.396235f,1.025424f,0.021594f,-0.393822f,0.983443f,0.044197f,0.00229f,0.988345f,0.044757f,
0.400637f,1.025424f,0.021594f,0.002279f,1.030811f,0.021869f,0.00229f,0.988345f,0.044757f,0.398253f,0.983443f,0.044197f,
0.00227f,1.053183f,0.0f,0.002279f,1.030811f,0.021869f,0.400637f,1.025424f,0.021594f,0.402758f,1.047552f,0.0f,
-0.393822f,0.983443f,0.044197f,-0.392243f,0.917941f,0.064218f,0.002297f,0.922061f,0.065028f,0.00229f,0.988345f,0.044757f,
0.00229f,0.988345f,0.044757f,0.002297f,0.922061f,0.065028f,0.396693f,0.917941f,0.064218f,0.398253f,0.983443f,0.044197f,
0.396693f,-0.928623f,0.064218f,0.002297f,-0.932501f,0.065028f,0.00229f,-0.994896f,0.044757f,0.398253f,-0.990281f,0.044197f,
0.002297f,-0.932501f,0.065028f,-0.392243f,-0.928623f,0.064218f,-0.393822f,-0.990281f,0.044197f,0.00229f,-0.994896f,0.044757f,
0.00229f,-0.994896f,0.044757f,-0.393822f,-0.990281f,0.044197f,-0.396235f,-1.0298f,0.021594f,0.002279f,-1.034871f,0.021869f,
0.398253f,-0.990281f,0.044197f,0.00229f,-0.994896f,0.044757f,0.002279f,-1.034871f,0.021869f,0.400637f,-1.0298f,0.021594f,
-0.396235f,-1.0298f,0.021594f,-0.398382f,-1.050629f,0.0f,0.00227f,-1.05593f,0.0f,0.002279f,-1.034871f,0.021869f,
0.002279f,-1.034871f,0.021869f,0.00227f,-1.05593f,0.0f,0.402758f,-1.050629f,0.0f,0.400637f,-1.0298f,0.021594f,
-0.909674f,-0.922159f,0.0f,-0.842153f,-0.971323f,0.0f,-0.830745f,-0.954616f,0.018815f,-0.894756f,-0.90822f,0.018385f,
-0.842153f,-0.971323f,0.0f,-0.750636f,-1.008273f,0.0f,-0.74278f,-0.989453f,0.019733f,-0.830745f,-0.954616f,0.018815f,
-0.830745f,-0.954616f,0.018815f,-0.74278f,-0.989453f,0.019733f,-0.733131f,-0.954452f,0.040237f,-0.814648f,-0.925416f,0.037876f,
-0.894756f,-0.90822f,0.018385f,-0.830745f,-0.954616f,0.018815f,-0.814648f,-0.925416f,0.037876f,-0.871108f,-0.886124f,0.036675f,
-0.750636f,-1.008273f,0.0f,-0.626031f,-1.034726f,0.0f,-0.621266f,-1.014588f,0.020771f,-0.74278f,-0.989453f,0.019733f,
-0.626031f,-1.034726f,0.0f,-0.398382f,-1.050629f,0.0f,-0.396235f,-1.0298f,0.021594f,-0.621266f,-1.014588f,0.020771f,
-0.621266f,-1.014588f,0.020771f,-0.396235f,-1.0298f,0.021594f,-0.393822f,-0.990281f,0.044197f,-0.615909f,-0.976437f,0.042517f,
-0.74278f,-0.989453f,0.019733f,-0.621266f,-1.014588f,0.020771f,-0.615909f,-0.976437f,0.042517f,-0.733131f,-0.954452f,0.040237f,
-0.615909f,-0.976437f,0.042517f,-0.393822f,-0.990281f,0.044197f,-0.392243f,-0.928623f,0.064218f,-0.612405f,-0.916988f,0.061789f,
-0.733131f,-0.954452f,0.040237f,-0.615909f,-0.976437f,0.042517f,-0.612405f,-0.916988f,0.061789f,-0.726455f,-0.89991f,0.058224f,
-0.814648f,-0.925416f,0.037876f,-0.733131f,-0.954452f,0.040237f,-0.726455f,-0.89991f,0.058224f,-0.802664f,-0.8797f,0.054004f,
-0.871108f,-0.886124f,0.036675f,-0.814648f,-0.925416f,0.037876f,-0.802664f,-0.8797f,0.054004f,-0.844501f,-0.861263f,0.050154f,
0.846982f,-0.861263f,0.050154f,0.87333f,-0.886124f,0.036675f,0.914973f,-0.833367f,0.037876f,0.866523f,-0.822169f,0.054004f,
0.914973f,-0.833367f,0.037876f,0.87333f,-0.886124f,0.036675f,0.896749f,-0.90822f,0.018385f,0.94592f,-0.848408f,0.018815f,
0.945745f,-0.755482f,0.040237f,0.914973f,-0.833367f,0.037876f,0.94592f,-0.848408f,0.018815f,0.982841f,-0.764498f,0.019733f,
0.866523f,-0.822169f,0.054004f,0.914973f,-0.833367f,0.037876f,0.945745f,-0.755482f,0.040237f,0.887941f,-0.749245f,0.058224f,
0.896749f,-0.90822f,0.018385f,0.911522f,-0.922159f,0.0f,0.963626f,-0.859068f,0.0f,0.94592f,-0.848408f,0.018815f,
0.94592f,-0.848408f,0.018815f,0.963626f,-0.859068f,0.0f,1.002787f,-0.771839f,0.0f,0.982841f,-0.764498f,0.019733f,
0.945745f,-0.755482f,0.040237f,0.982841f,-0.764498f,0.019733f,1.009478f,-0.645808f,0.020771f,0.969045f,-0.640802f,0.042517f,
0.982841f,-0.764498f,0.019733f,1.002787f,-0.771839f,0.0f,1.030822f,-0.650261f,0.0f,1.009478f,-0.645808f,0.020771f,
1.009478f,-0.645808f,0.020771f,1.030822f,-0.650261f,0.0f,1.047675f,-0.421723f,0.0f,1.025601f,-0.419734f,0.021594f,
1.009478f,-0.645808f,0.020771f,1.025601f,-0.419734f,0.021594f,0.983719f,-0.417497f,0.044197f,0.969045f,-0.640802f,0.042517f,
0.887941f,-0.749245f,0.058224f,0.945745f,-0.755482f,0.040237f,0.969045f,-0.640802f,0.042517f,0.906041f,-0.637528f,0.061789f,
0.906041f,-0.637528f,0.061789f,0.969045f,-0.640802f,0.042517f,0.983719f,-0.417497f,0.044197f,0.918372f,-0.416033f,0.064218f,
0.918372f,-0.416033f,0.064218f,0.983719f,-0.417497f,0.044197f,0.98861f,-0.013736f,0.044757f,0.922482f,-0.013776f,0.065028f,
0.98861f,-0.013736f,0.044757f,0.983719f,-0.417497f,0.044197f,1.025601f,-0.419734f,0.021594f,1.030975f,-0.013673f,0.021869f,
0.983719f,0.390919f,0.044197f,0.98861f,-0.013736f,0.044757f,1.030975f,-0.013673f,0.021869f,1.025601f,0.393327f,0.021594f,
0.922482f,-0.013776f,0.065028f,0.98861f,-0.013736f,0.044757f,0.983719f,0.390919f,0.044197f,0.918372f,0.389343f,0.064218f,
1.025601f,-0.419734f,0.021594f,1.047675f,-0.421723f,0.0f,1.053293f,-0.013618f,0.0f,1.030975f,-0.013673f,0.021869f,
1.030975f,-0.013673f,0.021869f,1.053293f,-0.013618f,0.0f,1.047675f,0.39547f,0.0f,1.025601f,0.393327f,0.021594f,
-0.909674f,-0.922159f,0.0f,-0.894756f,-0.90822f,0.018385f,-0.944409f,-0.848408f,0.018815f,-0.962289f,-0.859068f,0.0f,
-0.944409f,-0.848408f,0.018815f,-0.894756f,-0.90822f,0.018385f,-0.871108f,-0.886124f,0.036675f,-0.913159f,-0.833367f,0.037876f,
-0.981692f,-0.764498f,0.019733f,-0.944409f,-0.848408f,0.018815f,-0.913159f,-0.833367f,0.037876f,-0.944233f,-0.755482f,0.040237f,
-0.962289f,-0.859068f,0.0f,-0.944409f,-0.848408f,0.018815f,-0.981692f,-0.764498f,0.019733f,-1.001834f,-0.771839f,0.0f,
-0.871108f,-0.886124f,0.036675f,-0.844501f,-0.861263f,0.050154f,-0.864233f,-0.822169f,0.054004f,-0.913159f,-0.833367f,0.037876f,
-0.913159f,-0.833367f,0.037876f,-0.864233f,-0.822169f,0.054004f,-0.885862f,-0.749245f,0.058224f,-0.944233f,-0.755482f,0.040237f,
-0.981692f,-0.764498f,0.019733f,-0.944233f,-0.755482f,0.040237f,-0.967761f,-0.640802f,0.042517f,-1.008591f,-0.645808f,0.020771f,
-0.944233f,-0.755482f,0.040237f,-0.885862f,-0.749245f,0.058224f,-0.90414f,-0.637528f,0.061789f,-0.967761f,-0.640802f,0.042517f,
-0.967761f,-0.640802f,0.042517f,-0.90414f,-0.637528f,0.061789f,-0.916591f,-0.416033f,0.064218f,-0.982578f,-0.417497f,0.044197f,
-0.967761f,-0.640802f,0.042517f,-0.982578f,-0.417497f,0.044197f,-1.024871f,-0.419734f,0.021594f,-1.008591f,-0.645808f,0.020771f,
-1.001834f,-0.771839f,0.0f,-0.981692f,-0.764498f,0.019733f,-1.008591f,-0.645808f,0.020771f,-1.030143f,-0.650261f,0.0f,
-1.030143f,-0.650261f,0.0f,-1.008591f,-0.645808f,0.020771f,-1.024871f,-0.419734f,0.021594f,-1.047163f,-0.421723f,0.0f,
-1.047163f,0.39547f,0.0f,-1.052836f,-0.013618f,0.0f,-1.030298f,-0.013673f,0.021869f,-1.024871f,0.393327f,0.021594f,
-1.052836f,-0.013618f,0.0f,-1.047163f,-0.421723f,0.0f,-1.024871f,-0.419734f,0.021594f,-1.030298f,-0.013673f,0.021869f,
-1.030298f,-0.013673f,0.021869f,-1.024871f,-0.419734f,0.021594f,-0.982578f,-0.417497f,0.044197f,-0.987517f,-0.013736f,0.044757f,
-1.024871f,0.393327f,0.021594f,-1.030298f,-0.013673f,0.021869f,-0.987517f,-0.013736f,0.044757f,-0.982578f,0.390919f,0.044197f,
-0.982578f,-0.417497f,0.044197f,-0.916591f,-0.416033f,0.064218f,-0.920742f,-0.013776f,0.065028f,-0.987517f,-0.013736f,0.044757f,
-0.987517f,-0.013736f,0.044757f,-0.920742f,-0.013776f,0.065028f,-0.916591f,0.389343f,0.064218f,-0.982578f,0.390919f,0.044197f,
0.396693f,0.917941f,0.064218f,0.616423f,0.905582f,0.061789f,0.619893f,0.968735f,0.042517f,0.398253f,0.983443f,0.044197f,
0.616423f,0.905582f,0.061789f,0.729904f,0.887439f,0.058224f,0.736514f,0.94538f,0.040237f,0.619893f,0.968735f,0.042517f,
0.619893f,0.968735f,0.042517f,0.736514f,0.94538f,0.040237f,0.746069f,0.982563f,0.019733f,0.625198f,1.009264f,0.020771f,
0.400637f,1.025424f,0.021594f,0.398253f,0.983443f,0.044197f,0.619893f,0.968735f,0.042517f,0.625198f,1.009264f,0.020771f,
0.729904f,0.887439f,0.058224f,0.805551f,0.865969f,0.054004f,0.817418f,0.914535f,0.037876f,0.736514f,0.94538f,0.040237f,
0.805551f,0.865969f,0.054004f,0.846982f,0.846382f,0.050154f,0.87333f,0.872793f,0.036675f,0.817418f,0.914535f,0.037876f,
0.817418f,0.914535f,0.037876f,0.87333f,0.872793f,0.036675f,0.896749f,0.896267f,0.018385f,0.833359f,0.945555f,0.018815f,
0.736514f,0.94538f,0.040237f,0.817418f,0.914535f,0.037876f,0.833359f,0.945555f,0.018815f,0.746069f,0.982563f,0.019733f,
0.833359f,0.945555f,0.018815f,0.896749f,0.896267f,0.018385f,0.911522f,0.911075f,0.0f,0.844656f,0.963302f,0.0f,
0.746069f,0.982563f,0.019733f,0.833359f,0.945555f,0.018815f,0.844656f,0.963302f,0.0f,0.753849f,1.002556f,0.0f,
0.625198f,1.009264f,0.020771f,0.746069f,0.982563f,0.019733f,0.753849f,1.002556f,0.0f,0.629917f,1.030658f,0.0f,
0.400637f,1.025424f,0.021594f,0.625198f,1.009264f,0.020771f,0.629917f,1.030658f,0.0f,0.402758f,1.047552f,0.0f,
0.396693f,-0.928623f,0.064218f,0.398253f,-0.990281f,0.044197f,0.619893f,-0.976437f,0.042517f,0.616423f,-0.916988f,0.061789f,
0.619893f,-0.976437f,0.042517f,0.398253f,-0.990281f,0.044197f,0.400637f,-1.0298f,0.021594f,0.625198f,-1.014588f,0.020771f,
0.736514f,-0.954452f,0.040237f,0.619893f,-0.976437f,0.042517f,0.625198f,-1.014588f,0.020771f,0.746069f,-0.989453f,0.019733f,
0.616423f,-0.916988f,0.061789f,0.619893f,-0.976437f,0.042517f,0.736514f,-0.954452f,0.040237f,0.729904f,-0.89991f,0.058224f,
0.400637f,-1.0298f,0.021594f,0.402758f,-1.050629f,0.0f,0.629917f,-1.034726f,0.0f,0.625198f,-1.014588f,0.020771f,
0.625198f,-1.014588f,0.020771f,0.629917f,-1.034726f,0.0f,0.753849f,-1.008273f,0.0f,0.746069f,-0.989453f,0.019733f,
0.736514f,-0.954452f,0.040237f,0.746069f,-0.989453f,0.019733f,0.833359f,-0.954616f,0.018815f,0.817418f,-0.925416f,0.037876f,
0.746069f,-0.989453f,0.019733f,0.753849f,-1.008273f,0.0f,0.844656f,-0.971323f,0.0f,0.833359f,-0.954616f,0.018815f,
0.833359f,-0.954616f,0.018815f,0.844656f,-0.971323f,0.0f,0.911522f,-0.922159f,0.0f,0.896749f,-0.90822f,0.018385f,
0.833359f,-0.954616f,0.018815f,0.896749f,-0.90822f,0.018385f,0.87333f,-0.886124f,0.036675f,0.817418f,-0.925416f,0.037876f,
0.729904f,-0.89991f,0.058224f,0.736514f,-0.954452f,0.040237f,0.817418f,-0.925416f,0.037876f,0.805551f,-0.8797f,0.054004f,
0.805551f,-0.8797f,0.054004f,0.817418f,-0.925416f,0.037876f,0.87333f,-0.886124f,0.036675f,0.846982f,-0.861263f,0.050154f,
0.403842f,-0.422739f,0.09157f,0.401892f,-0.652534f,0.088189f,0.62799f,-0.648441f,0.084918f,0.632327f,-0.420911f,0.088189f,
0.401892f,-0.652534f,0.088189f,0.399509f,-0.775509f,0.082561f,0.622688f,-0.768902f,0.079479f,0.62799f,-0.648441f,0.084918f,
0.62799f,-0.648441f,0.084918f,0.622688f,-0.768902f,0.079479f,0.741819f,-0.760488f,0.074426f,0.750737f,-0.64344f,0.079479f,
0.632327f,-0.420911f,0.088189f,0.62799f,-0.648441f,0.084918f,0.750737f,-0.64344f,0.079479f,0.757739f,-0.418675f,0.082561f,
0.399509f,-0.775509f,0.082561f,0.397559f,-0.8642f,0.074693f,0.618351f,-0.854962f,0.071886f,0.622688f,-0.768902f,0.079479f,
0.397559f,-0.8642f,0.074693f,0.396693f,-0.928623f,0.064218f,0.616423f,-0.916988f,0.061789f,0.618351f,-0.854962f,0.071886f,
0.618351f,-0.854962f,0.071886f,0.616423f,-0.916988f,0.061789f,0.729904f,-0.89991f,0.058224f,0.733736f,-0.842312f,0.067487f,
0.622688f,-0.768902f,0.079479f,0.618351f,-0.854962f,0.071886f,0.733736f,-0.842312f,0.067487f,0.741819f,-0.760488f,0.074426f,
0.741819f,-0.760488f,0.074426f,0.733736f,-0.842312f,0.067487f,0.812784f,-0.828995f,0.061777f,0.826898f,-0.752861f,0.067487f,
0.733736f,-0.842312f,0.067487f,0.729904f,-0.89991f,0.058224f,0.805551f,-0.8797f,0.054004f,0.812784f,-0.828995f,0.061777f,
0.812784f,-0.828995f,0.061777f,0.805551f,-0.8797f,0.054004f,0.846982f,-0.861263f,0.050154f,0.866523f,-0.822169f,0.054004f,
0.826898f,-0.752861f,0.067487f,0.812784f,-0.828995f,0.061777f,0.866523f,-0.822169f,0.054004f,0.887941f,-0.749245f,0.058224f,
0.757739f,-0.418675f,0.082561f,0.750737f,-0.64344f,0.079479f,0.840305f,-0.639347f,0.071886f,0.850096f,-0.416846f,0.074693f,
0.750737f,-0.64344f,0.079479f,0.741819f,-0.760488f,0.074426f,0.826898f,-0.752861f,0.067487f,0.840305f,-0.639347f,0.071886f,
0.840305f,-0.639347f,0.071886f,0.826898f,-0.752861f,0.067487f,0.887941f,-0.749245f,0.058224f,0.906041f,-0.637528f,0.061789f,
0.850096f,-0.416846f,0.074693f,0.840305f,-0.639347f,0.071886f,0.906041f,-0.637528f,0.061789f,0.918372f,-0.416033f,0.064218f,
0.403842f,0.396564f,0.09157f,0.404492f,-0.013589f,0.092698f,0.633773f,-0.01364f,0.08928f,0.632327f,0.394595f,0.088189f,
0.404492f,-0.013589f,0.092698f,0.403842f,-0.422739f,0.09157f,0.632327f,-0.420911f,0.088189f,0.633773f,-0.01364f,0.08928f,
0.633773f,-0.01364f,0.08928f,0.632327f,-0.420911f,0.088189f,0.757739f,-0.418675f,0.082561f,0.760073f,-0.013703f,0.083588f,
0.632327f,0.394595f,0.088189f,0.633773f,-0.01364f,0.08928f,0.760073f,-0.013703f,0.083588f,0.757739f,0.392188f,0.082561f,
0.757739f,-0.418675f,0.082561f,0.850096f,-0.416846f,0.074693f,0.853359f,-0.013754f,0.075629f,0.760073f,-0.013703f,0.083588f,
0.850096f,-0.416846f,0.074693f,0.918372f,-0.416033f,0.064218f,0.922482f,-0.013776f,0.065028f,0.853359f,-0.013754f,0.075629f,
0.853359f,-0.013754f,0.075629f,0.922482f,-0.013776f,0.065028f,0.918372f,0.389343f,0.064218f,0.850096f,0.390218f,0.074693f,
0.760073f,-0.013703f,0.083588f,0.853359f,-0.013754f,0.075629f,0.850096f,0.390218f,0.074693f,0.757739f,0.392188f,0.082561f,
-1.047163f,0.39547f,0.0f,-1.024871f,0.393327f,0.021594f,-1.008591f,0.622221f,0.020771f,-1.030143f,0.626951f,0.0f,
-1.008591f,0.622221f,0.020771f,-1.024871f,0.393327f,0.021594f,-0.982578f,0.390919f,0.044197f,-0.967761f,0.616903f,0.042517f,
-0.981692f,0.744767f,0.019733f,-1.008591f,0.622221f,0.020771f,-0.967761f,0.616903f,0.042517f,-0.944233f,0.735189f,0.040237f,
-1.030143f,0.626951f,0.0f,-1.008591f,0.622221f,0.020771f,-0.981692f,0.744767f,0.019733f,-1.001834f,0.752565f,0.0f,
-0.982578f,0.390919f,0.044197f,-0.916591f,0.389343f,0.064218f,-0.90414f,0.613425f,0.061789f,-0.967761f,0.616903f,0.042517f,
-0.967761f,0.616903f,0.042517f,-0.90414f,0.613425f,0.061789f,-0.885862f,0.728563f,0.058224f,-0.944233f,0.735189f,0.040237f,
-0.981692f,0.744767f,0.019733f,-0.944233f,0.735189f,0.040237f,-0.913159f,0.816749f,0.037876f,-0.944409f,0.832727f,0.018815f,
-0.944233f,0.735189f,0.040237f,-0.885862f,0.728563f,0.058224f,-0.864233f,0.804853f,0.054004f,-0.913159f,0.816749f,0.037876f,
-0.913159f,0.816749f,0.037876f,-0.864233f,0.804853f,0.054004f,-0.844501f,0.846382f,0.050154f,-0.871108f,0.872793f,0.036675f,
-0.913159f,0.816749f,0.037876f,-0.871108f,0.872793f,0.036675f,-0.894756f,0.896267f,0.018385f,-0.944409f,0.832727f,0.018815f,
-1.001834f,0.752565f,0.0f,-0.981692f,0.744767f,0.019733f,-0.944409f,0.832727f,0.018815f,-0.962289f,0.844051f,0.0f,
-0.962289f,0.844051f,0.0f,-0.944409f,0.832727f,0.018815f,-0.894756f,0.896267f,0.018385f,-0.909674f,0.911075f,0.0f,
0.918372f,0.389343f,0.064218f,0.983719f,0.390919f,0.044197f,0.969045f,0.616903f,0.042517f,0.906041f,0.613425f,0.061789f,
0.969045f,0.616903f,0.042517f,0.983719f,0.390919f,0.044197f,1.025601f,0.393327f,0.021594f,1.009478f,0.622221f,0.020771f,
0.945745f,0.735189f,0.040237f,0.969045f,0.616903f,0.042517f,1.009478f,0.622221f,0.020771f,0.982841f,0.744767f,0.019733f,
0.906041f,0.613425f,0.061789f,0.969045f,0.616903f,0.042517f,0.945745f,0.735189f,0.040237f,0.887941f,0.728563f,0.058224f,
1.025601f,0.393327f,0.021594f,1.047675f,0.39547f,0.0f,1.030822f,0.626951f,0.0f,1.009478f,0.622221f,0.020771f,
1.009478f,0.622221f,0.020771f,1.030822f,0.626951f,0.0f,1.002787f,0.752565f,0.0f,0.982841f,0.744767f,0.019733f,
0.945745f,0.735189f,0.040237f,0.982841f,0.744767f,0.019733f,0.94592f,0.832727f,0.018815f,0.914973f,0.816749f,0.037876f,
0.982841f,0.744767f,0.019733f,1.002787f,0.752565f,0.0f,0.963626f,0.844051f,0.0f,0.94592f,0.832727f,0.018815f,
0.94592f,0.832727f,0.018815f,0.963626f,0.844051f,0.0f,0.911522f,0.911075f,0.0f,0.896749f,0.896267f,0.018385f,
0.94592f,0.832727f,0.018815f,0.896749f,0.896267f,0.018385f,0.87333f,0.872793f,0.036675f,0.914973f,0.816749f,0.037876f,
0.887941f,0.728563f,0.058224f,0.945745f,0.735189f,0.040237f,0.914973f,0.816749f,0.037876f,0.866523f,0.804853f,0.054004f,
0.866523f,0.804853f,0.054004f,0.914973f,0.816749f,0.037876f,0.87333f,0.872793f,0.036675f,0.846982f,0.846382f,0.050154f,
0.396693f,0.917941f,0.064218f,0.397559f,0.849503f,0.074693f,0.618351f,0.83969f,0.071886f,0.616423f,0.905582f,0.061789f,
0.397559f,0.849503f,0.074693f,0.399509f,0.756465f,0.082561f,0.622688f,0.749446f,0.079479f,0.618351f,0.83969f,0.071886f,
0.618351f,0.83969f,0.071886f,0.622688f,0.749446f,0.079479f,0.741819f,0.740507f,0.074426f,0.733736f,0.826251f,0.067487f,
0.616423f,0.905582f,0.061789f,0.618351f,0.83969f,0.071886f,0.733736f,0.826251f,0.067487f,0.729904f,0.887439f,0.058224f,
0.399509f,0.756465f,0.082561f,0.401892f,0.629367f,0.088189f,0.62799f,0.625019f,0.084918f,0.622688f,0.749446f,0.079479f,
0.401892f,0.629367f,0.088189f,0.403842f,0.396564f,0.09157f,0.632327f,0.394595f,0.088189f,0.62799f,0.625019f,0.084918f,
0.62799f,0.625019f,0.084918f,0.632327f,0.394595f,0.088189f,0.757739f,0.392188f,0.082561f,0.750737f,0.619705f,0.079479f,
0.622688f,0.749446f,0.079479f,0.62799f,0.625019f,0.084918f,0.750737f,0.619705f,0.079479f,0.741819f,0.740507f,0.074426f,
0.741819f,0.740507f,0.074426f,0.750737f,0.619705f,0.079479f,0.840305f,0.615357f,0.071886f,0.826898f,0.732405f,0.067487f,
0.750737f,0.619705f,0.079479f,0.757739f,0.392188f,0.082561f,0.850096f,0.390218f,0.074693f,0.840305f,0.615357f,0.071886f,
0.840305f,0.615357f,0.071886f,0.850096f,0.390218f,0.074693f,0.918372f,0.389343f,0.064218f,0.906041f,0.613425f,0.061789f,
0.826898f,0.732405f,0.067487f,0.840305f,0.615357f,0.071886f,0.906041f,0.613425f,0.061789f,0.887941f,0.728563f,0.058224f,
0.729904f,0.887439f,0.058224f,0.733736f,0.826251f,0.067487f,0.812784f,0.812104f,0.061777f,0.805551f,0.865969f,0.054004f,
0.733736f,0.826251f,0.067487f,0.741819f,0.740507f,0.074426f,0.826898f,0.732405f,0.067487f,0.812784f,0.812104f,0.061777f,
0.812784f,0.812104f,0.061777f,0.826898f,0.732405f,0.067487f,0.887941f,0.728563f,0.058224f,0.866523f,0.804853f,0.054004f,
0.805551f,0.865969f,0.054004f,0.812784f,0.812104f,0.061777f,0.866523f,0.804853f,0.054004f,0.846982f,0.846382f,0.050154f,
0.399509f,0.756465f,0.082561f,0.397559f,0.849503f,0.074693f,0.002293f,0.852774f,0.075629f,0.002284f,0.758804f,0.083588f,
0.397559f,0.849503f,0.074693f,0.396693f,0.917941f,0.064218f,0.002297f,0.922061f,0.065028f,0.002293f,0.852774f,0.075629f,
0.002293f,0.852774f,0.075629f,0.002297f,0.922061f,0.065028f,-0.392243f,0.917941f,0.064218f,-0.39312f,0.849503f,0.074693f,
0.002284f,0.758804f,0.083588f,0.002293f,0.852774f,0.075629f,-0.39312f,0.849503f,0.074693f,-0.395094f,0.756465f,0.082561f,
0.399509f,0.756465f,0.082561f,0.002284f,0.758804f,0.083588f,0.002274f,0.630816f,0.089279f,0.401892f,0.629367f,0.088189f,
0.002284f,0.758804f,0.083588f,-0.395094f,0.756465f,0.082561f,-0.397505f,0.629367f,0.088189f,0.002274f,0.630816f,0.089279f,
0.002274f,0.630816f,0.089279f,-0.397505f,0.629367f,0.088189f,-0.399478f,0.396564f,0.09157f,0.002265f,0.397221f,0.092698f,
0.401892f,0.629367f,0.088189f,0.002274f,0.630816f,0.089279f,0.002265f,0.397221f,0.092698f,0.403842f,0.396564f,0.09157f,
-0.916591f,0.389343f,0.064218f,-0.847646f,0.390218f,0.074693f,-0.837759f,0.615357f,0.071886f,-0.90414f,0.613425f,0.061789f,
-0.847646f,0.390218f,0.074693f,-0.754564f,0.392188f,0.082561f,-0.747494f,0.619705f,0.079479f,-0.837759f,0.615357f,0.071886f,
-0.837759f,0.615357f,0.071886f,-0.747494f,0.619705f,0.079479f,-0.738488f,0.740507f,0.074426f,-0.824221f,0.732405f,0.067487f,
-0.90414f,0.613425f,0.061789f,-0.837759f,0.615357f,0.071886f,-0.824221f,0.732405f,0.067487f,-0.885862f,0.728563f,0.058224f,
-0.754564f,0.392188f,0.082561f,-0.628465f,0.394595f,0.088189f,-0.624085f,0.625019f,0.084918f,-0.747494f,0.619705f,0.079479f,
-0.628465f,0.394595f,0.088189f,-0.399478f,0.396564f,0.09157f,-0.397505f,0.629367f,0.088189f,-0.624085f,0.625019f,0.084918f,
-0.624085f,0.625019f,0.084918f,-0.397505f,0.629367f,0.088189f,-0.395094f,0.756465f,0.082561f,-0.618732f,0.749446f,0.079479f,
-0.747494f,0.619705f,0.079479f,-0.624085f,0.625019f,0.084918f,-0.618732f,0.749446f,0.079479f,-0.738488f,0.740507f,0.074426f,
-0.738488f,0.740507f,0.074426f,-0.618732f,0.749446f,0.079479f,-0.614352f,0.83969f,0.071886f,-0.730326f,0.826251f,0.067487f,
-0.618732f,0.749446f,0.079479f,-0.395094f,0.756465f,0.082561f,-0.39312f,0.849503f,0.074693f,-0.614352f,0.83969f,0.071886f,
-0.614352f,0.83969f,0.071886f,-0.39312f,0.849503f,0.074693f,-0.392243f,0.917941f,0.064218f,-0.612405f,0.905582f,0.061789f,
-0.730326f,0.826251f,0.067487f,-0.614352f,0.83969f,0.071886f,-0.612405f,0.905582f,0.061789f,-0.726455f,0.887439f,0.058224f,
-0.885862f,0.728563f,0.058224f,-0.824221f,0.732405f,0.067487f,-0.809968f,0.812104f,0.061777f,-0.864233f,0.804853f,0.054004f,
-0.824221f,0.732405f,0.067487f,-0.738488f,0.740507f,0.074426f,-0.730326f,0.826251f,0.067487f,-0.809968f,0.812104f,0.061777f,
-0.809968f,0.812104f,0.061777f,-0.730326f,0.826251f,0.067487f,-0.726455f,0.887439f,0.058224f,-0.802664f,0.865969f,0.054004f,
-0.864233f,0.804853f,0.054004f,-0.809968f,0.812104f,0.061777f,-0.802664f,0.865969f,0.054004f,-0.844501f,0.846382f,0.050154f,
};
static const float cfGameIconTexCoords[] = {
0.098918f,0.907702f,0.118783f,0.916444f,0.115314f,0.892403f,0.089549f,0.889167f,
0.118783f,0.916444f,0.154967f,0.926026f,0.153129f,0.898717f,0.115314f,0.892403f,
0.115314f,0.892403f,0.153129f,0.898717f,0.149254f,0.859921f,0.108547f,0.856305f,
0.089549f,0.889167f,0.115314f,0.892403f,0.108547f,0.856305f,0.07928f,0.854591f,
0.154967f,0.926026f,0.209119f,0.934124f,0.208194f,0.904715f,0.153129f,0.898717f,
0.209119f,0.934124f,0.313652f,0.93964f,0.313236f,0.909095f,0.208194f,0.904715f,
0.208194f,0.904715f,0.313236f,0.909095f,0.312299f,0.867044f,0.206115f,0.863911f,
0.153129f,0.898717f,0.208194f,0.904715f,0.206115f,0.863911f,0.149254f,0.859921f,
0.149254f,0.859921f,0.206115f,0.863911f,0.203573f,0.806797f,0.144978f,0.804425f,
0.206115f,0.863911f,0.312299f,0.867044f,0.311154f,0.808737f,0.203573f,0.806797f,
0.203573f,0.806797f,0.311154f,0.808737f,0.310217f,0.699784f,0.201493f,0.698917f,
0.144978f,0.804425f,0.203573f,0.806797f,0.201493f,0.698917f,0.141621f,0.697857f,
0.07928f,0.854591f,0.108547f,0.856305f,0.102119f,0.802484f,0.070602f,0.801622f,
0.108547f,0.856305f,0.149254f,0.859921f,0.144978f,0.804425f,0.102119f,0.802484f,
0.102119f,0.802484f,0.144978f,0.804425f,0.141621f,0.697857f,0.097425f,0.69699f,
0.070602f,0.801622f,0.102119f,0.802484f,0.097425f,0.69699f,0.064689f,0.696604f,
0.310217f,0.699784f,0.311154f,0.808737f,0.500971f,0.809384f,0.500967f,0.700073f,
0.311154f,0.808737f,0.312299f,0.867044f,0.500976f,0.868088f,0.500971f,0.809384f,
0.500971f,0.809384f,0.500976f,0.868088f,0.68958f,0.867044f,0.690711f,0.808737f,
0.500967f,0.700073f,0.500971f,0.809384f,0.690711f,0.808737f,0.691637f,0.699784f,
0.312299f,0.867044f,0.313236f,0.909095f,0.50098f,0.910555f,0.500976f,0.868088f,
0.313236f,0.909095f,0.313652f,0.93964f,0.500982f,0.941479f,0.50098f,0.910555f,
0.50098f,0.910555f,0.500982f,0.941479f,0.688243f,0.93964f,0.688654f,0.909095f,
0.500976f,0.868088f,0.50098f,0.910555f,0.688654f,0.909095f,0.68958f,0.867044f,
0.310217f,0.699784f,0.500967f,0.700073f,0.500965f,0.505784f,0.309905f,0.505792f,
0.500967f,0.700073f,0.691637f,0.699784f,0.691946f,0.505792f,0.500965f,0.505784f,
0.500965f,0.505784f,0.691946f,0.505792f,0.691637f,0.311325f,0.500967f,0.311013f,
0.309905f,0.505792f,0.500965f,0.505784f,0.500967f,0.311013f,0.310217f,0.311325f,
0.141621f,0.3134f,0.097425f,0.314333f,0.09586f,0.50587f,0.140502f,0.505846f,
0.097425f,0.314333f,0.064689f,0.314748f,0.062719f,0.505881f,0.09586f,0.50587f,
0.09586f,0.50587f,0.062719f,0.505881f,0.064689f,0.696604f,0.097425f,0.69699f,
0.140502f,0.505846f,0.09586f,0.50587f,0.097425f,0.69699f,0.141621f,0.697857f,
0.141621f,0.3134f,0.140502f,0.505846f,0.2008f,0.505816f,0.201493f,0.312259f,
0.140502f,0.505846f,0.141621f,0.697857f,0.201493f,0.698917f,0.2008f,0.505816f,
0.2008f,0.505816f,0.201493f,0.698917f,0.310217f,0.699784f,0.309905f,0.505792f,
0.201493f,0.312259f,0.2008f,0.505816f,0.309905f,0.505792f,0.310217f,0.311325f,
0.098918f,0.098051f,0.118783f,0.088764f,0.115314f,0.070013f,0.089549f,0.088764f,
0.118783f,0.088764f,0.154967f,0.078585f,0.153129f,0.056238f,0.115314f,0.070013f,
0.115314f,0.070013f,0.153129f,0.056238f,0.14647f,0.030613f,0.104205f,0.048635f,
0.089549f,0.088764f,0.115314f,0.070013f,0.104205f,0.048635f,0.073229f,0.072587f,
0.154967f,0.078585f,0.209119f,0.069983f,0.208194f,0.045626f,0.153129f,0.056238f,
0.209119f,0.069983f,0.313652f,0.064123f,0.313236f,0.038853f,0.208194f,0.045626f,
0.208194f,0.045626f,0.313236f,0.038853f,0.31157f,0.009921f,0.204497f,0.017695f,
0.153129f,0.056238f,0.208194f,0.045626f,0.204497f,0.017695f,0.14647f,0.030613f,
0.204497f,0.017695f,0.31157f,0.009921f,0.269666f,0.0f,0.202648f,0.01068f,
0.14647f,0.030613f,0.204497f,0.017695f,0.202648f,0.01068f,0.135631f,0.02136f,
0.104205f,0.048635f,0.14647f,0.030613f,0.135631f,0.02136f,0.100033f,0.042615f,
0.073229f,0.072587f,0.104205f,0.048635f,0.100033f,0.042615f,0.064435f,0.06387f,
0.269666f,0.0f,0.31157f,0.009921f,0.500973f,0.007329f,0.500969f,0.0f,
0.500973f,0.007329f,0.31157f,0.009921f,0.313236f,0.038853f,0.50098f,0.036595f,
0.6903f,0.009921f,0.500973f,0.007329f,0.50098f,0.036595f,0.688654f,0.038853f,
0.500969f,0.0f,0.500973f,0.007329f,0.6903f,0.009921f,0.732272f,0.0f,
0.313236f,0.038853f,0.313652f,0.064123f,0.500982f,0.062169f,0.50098f,0.036595f,
0.50098f,0.036595f,0.500982f,0.062169f,0.688243f,0.064123f,0.688654f,0.038853f,
0.688243f,0.93964f,0.500982f,0.941479f,0.50098f,0.965553f,0.688654f,0.963427f,
0.500982f,0.941479f,0.313652f,0.93964f,0.313236f,0.963427f,0.50098f,0.965553f,
0.50098f,0.965553f,0.313236f,0.963427f,0.31157f,0.990661f,0.500973f,0.993101f,
0.688654f,0.963427f,0.50098f,0.965553f,0.500973f,0.993101f,0.6903f,0.990661f,
0.31157f,0.990661f,0.269666f,1.0f,0.500969f,1.0f,0.500973f,0.993101f,
0.500973f,0.993101f,0.500969f,1.0f,0.732272f,1.0f,0.6903f,0.990661f,
0.064435f,0.939877f,0.100033f,0.959885f,0.104205f,0.954218f,0.073229f,0.931672f,
0.100033f,0.959885f,0.135631f,0.979893f,0.14647f,0.971183f,0.104205f,0.954218f,
0.104205f,0.954218f,0.14647f,0.971183f,0.153129f,0.947062f,0.115314f,0.934095f,
0.073229f,0.931672f,0.104205f,0.954218f,0.115314f,0.934095f,0.089549f,0.916444f,
0.135631f,0.979893f,0.202648f,0.989946f,0.204497f,0.983343f,0.14647f,0.971183f,
0.202648f,0.989946f,0.269666f,1.0f,0.31157f,0.990661f,0.204497f,0.983343f,
0.204497f,0.983343f,0.31157f,0.990661f,0.313236f,0.963427f,0.208194f,0.957052f,
0.14647f,0.971183f,0.204497f,0.983343f,0.208194f,0.957052f,0.153129f,0.947062f,
0.208194f,0.957052f,0.313236f,0.963427f,0.313652f,0.93964f,0.209119f,0.934124f,
0.153129f,0.947062f,0.208194f,0.957052f,0.209119f,0.934124f,0.154967f,0.926026f,
0.115314f,0.934095f,0.153129f,0.947062f,0.154967f,0.926026f,0.118783f,0.916444f,
0.089549f,0.916444f,0.115314f,0.934095f,0.118783f,0.916444f,0.098918f,0.907702f,
0.902043f,0.907702f,0.91132f,0.916444f,0.930054f,0.892403f,0.91132f,0.889167f,
0.930054f,0.892403f,0.91132f,0.916444f,0.927482f,0.931672f,0.951411f,0.902768f,
0.943816f,0.856305f,0.930054f,0.892403f,0.951411f,0.902768f,0.969416f,0.862518f,
0.91132f,0.889167f,0.930054f,0.892403f,0.943816f,0.856305f,0.92149f,0.854591f,
0.927482f,0.931672f,0.93619f,0.939877f,0.957425f,0.906662f,0.951411f,0.902768f,
0.951411f,0.902768f,0.957425f,0.906662f,0.97866f,0.873446f,0.969416f,0.862518f,
0.943816f,0.856305f,0.969416f,0.862518f,0.982322f,0.805934f,0.954418f,0.802484f,
0.969416f,0.862518f,0.97866f,0.873446f,0.98933f,0.807659f,0.982322f,0.805934f,
0.982322f,0.805934f,0.98933f,0.807659f,1.0f,0.741872f,0.990089f,0.698531f,
0.982322f,0.805934f,0.990089f,0.698531f,0.961185f,0.69699f,0.954418f,0.802484f,
0.92149f,0.854591f,0.943816f,0.856305f,0.954418f,0.802484f,0.930084f,0.801622f,
0.930084f,0.801622f,0.954418f,0.802484f,0.961185f,0.69699f,0.935938f,0.696604f,
0.935938f,0.696604f,0.961185f,0.69699f,0.96344f,0.50587f,0.93789f,0.505881f,
0.96344f,0.50587f,0.961185f,0.69699f,0.990089f,0.698531f,0.992677f,0.505827f,
0.961185f,0.314333f,0.96344f,0.50587f,0.992677f,0.505827f,0.990089f,0.312674f,
0.93789f,0.505881f,0.96344f,0.50587f,0.961185f,0.314333f,0.935938f,0.314748f,
0.990089f,0.698531f,1.0f,0.741872f,1.0f,0.505805f,0.992677f,0.505827f,
0.992677f,0.505827f,1.0f,0.505805f,1.0f,0.269739f,0.990089f,0.312674f,
0.064435f,0.939877f,0.073229f,0.931672f,0.049066f,0.902768f,0.042992f,0.906662f,
0.049066f,0.902768f,0.073229f,0.931672f,0.089549f,0.916444f,0.070633f,0.892403f,
0.030884f,0.862518f,0.049066f,0.902768f,0.070633f,0.892403f,0.056735f,0.856305f,
0.042992f,0.906662f,0.049066f,0.902768f,0.030884f,0.862518f,0.021549f,0.873446f,
0.089549f,0.916444f,0.098918f,0.907702f,0.089549f,0.889167f,0.070633f,0.892403f,
0.070633f,0.892403f,0.089549f,0.889167f,0.07928f,0.854591f,0.056735f,0.856305f,
0.030884f,0.862518f,0.056735f,0.856305f,0.046029f,0.802484f,0.017852f,0.805934f,
0.056735f,0.856305f,0.07928f,0.854591f,0.070602f,0.801622f,0.046029f,0.802484f,
0.046029f,0.802484f,0.070602f,0.801622f,0.064689f,0.696604f,0.039196f,0.69699f,
0.046029f,0.802484f,0.039196f,0.69699f,0.010008f,0.698531f,0.017852f,0.805934f,
0.021549f,0.873446f,0.030884f,0.862518f,0.017852f,0.805934f,0.010774f,0.807659f,
0.010774f,0.807659f,0.017852f,0.805934f,0.010008f,0.698531f,0.0f,0.741872f,
0.0f,0.269739f,0.0f,0.505805f,0.007394f,0.505827f,0.010008f,0.312673f,
0.0f,0.505805f,0.0f,0.741872f,0.010008f,0.698531f,0.007394f,0.505827f,
0.007394f,0.505827f,0.010008f,0.698531f,0.039196f,0.69699f,0.036918f,0.50587f,
0.010008f,0.312673f,0.007394f,0.505827f,0.036918f,0.50587f,0.039196f,0.314333f,
0.039196f,0.69699f,0.064689f,0.696604f,0.062719f,0.505881f,0.036918f,0.50587f,
0.036918f,0.50587f,0.062719f,0.505881f,0.064689f,0.314748f,0.039196f,0.314333f,
0.688243f,0.064123f,0.792572f,0.069983f,0.793487f,0.045626f,0.688654f,0.038853f,
0.792572f,0.069983f,0.846453f,0.078585f,0.848273f,0.056238f,0.793487f,0.045626f,
0.793487f,0.045626f,0.848273f,0.056238f,0.854867f,0.030613f,0.797148f,0.017695f,
0.6903f,0.009921f,0.688654f,0.038853f,0.793487f,0.045626f,0.797148f,0.017695f,
0.846453f,0.078585f,0.882371f,0.088764f,0.885805f,0.070013f,0.848273f,0.056238f,
0.882371f,0.088764f,0.902043f,0.098051f,0.91132f,0.088764f,0.885805f,0.070013f,
0.885805f,0.070013f,0.91132f,0.088764f,0.927482f,0.072587f,0.896806f,0.048635f,
0.848273f,0.056238f,0.885805f,0.070013f,0.896806f,0.048635f,0.854867f,0.030613f,
0.896806f,0.048635f,0.927482f,0.072587f,0.93619f,0.06387f,0.900938f,0.042615f,
0.854867f,0.030613f,0.896806f,0.048635f,0.900938f,0.042615f,0.865686f,0.02136f,
0.797148f,0.017695f,0.854867f,0.030613f,0.865686f,0.02136f,0.798979f,0.01068f,
0.6903f,0.009921f,0.797148f,0.017695f,0.798979f,0.01068f,0.732272f,0.0f,
0.688243f,0.93964f,0.688654f,0.963427f,0.793487f,0.957052f,0.792572f,0.934124f,
0.793487f,0.957052f,0.688654f,0.963427f,0.6903f,0.990661f,0.797148f,0.983343f,
0.848273f,0.947062f,0.793487f,0.957052f,0.797148f,0.983343f,0.854867f,0.971183f,
0.792572f,0.934124f,0.793487f,0.957052f,0.848273f,0.947062f,0.846453f,0.926026f,
0.6903f,0.990661f,0.732272f,1.0f,0.798979f,0.989946f,0.797148f,0.983343f,
0.797148f,0.983343f,0.798979f,0.989946f,0.865686f,0.979893f,0.854867f,0.971183f,
0.848273f,0.947062f,0.854867f,0.971183f,0.896806f,0.954218f,0.885805f,0.934095f,
0.854867f,0.971183f,0.865686f,0.979893f,0.900938f,0.959885f,0.896806f,0.954218f,
0.896806f,0.954218f,0.900938f,0.959885f,0.93619f,0.939877f,0.927482f,0.931672f,
0.896806f,0.954218f,0.927482f,0.931672f,0.91132f,0.916444f,0.885805f,0.934095f,
0.846453f,0.926026f,0.848273f,0.947062f,0.885805f,0.934095f,0.882371f,0.916444f,
0.882371f,0.916444f,0.885805f,0.934095f,0.91132f,0.916444f,0.902043f,0.907702f,
0.691637f,0.699784f,0.690711f,0.808737f,0.798063f,0.806796f,0.800123f,0.698917f,
0.690711f,0.808737f,0.68958f,0.867044f,0.795546f,0.863911f,0.798063f,0.806796f,
0.798063f,0.806796f,0.795546f,0.863911f,0.85211f,0.859921f,0.856345f,0.804425f,
0.800123f,0.698917f,0.798063f,0.806796f,0.856345f,0.804425f,0.859669f,0.697857f,
0.68958f,0.867044f,0.688654f,0.909095f,0.793487f,0.904715f,0.795546f,0.863911f,
0.688654f,0.909095f,0.688243f,0.93964f,0.792572f,0.934124f,0.793487f,0.904715f,
0.793487f,0.904715f,0.792572f,0.934124f,0.846453f,0.926026f,0.848273f,0.898717f,
0.795546f,0.863911f,0.793487f,0.904715f,0.848273f,0.898717f,0.85211f,0.859921f,
0.85211f,0.859921f,0.848273f,0.898717f,0.885805f,0.892403f,0.892507f,0.856305f,
0.848273f,0.898717f,0.846453f,0.926026f,0.882371f,0.916444f,0.885805f,0.892403f,
0.885805f,0.892403f,0.882371f,0.916444f,0.902043f,0.907702f,0.91132f,0.889167f,
0.892507f,0.856305f,0.885805f,0.892403f,0.91132f,0.889167f,0.92149f,0.854591f,
0.859669f,0.697857f,0.856345f,0.804425f,0.898872f,0.802484f,0.903521f,0.69699f,
0.856345f,0.804425f,0.85211f,0.859921f,0.892507f,0.856305f,0.898872f,0.802484f,
0.898872f,0.802484f,0.892507f,0.856305f,0.92149f,0.854591f,0.930084f,0.801622f,
0.903521f,0.69699f,0.898872f,0.802484f,0.930084f,0.801622f,0.935938f,0.696604f,
0.691637f,0.311325f,0.691946f,0.505792f,0.800809f,0.505816f,0.800123f,0.312259f,
0.691946f,0.505792f,0.691637f,0.699784f,0.800123f,0.698917f,0.800809f,0.505816f,
0.800809f,0.505816f,0.800123f,0.698917f,0.859669f,0.697857f,0.860777f,0.505846f,
0.800123f,0.312259f,0.800809f,0.505816f,0.860777f,0.505846f,0.859669f,0.3134f,
0.859669f,0.697857f,0.903521f,0.69699f,0.90507f,0.50587f,0.860777f,0.505846f,
0.903521f,0.69699f,0.935938f,0.696604f,0.93789f,0.505881f,0.90507f,0.50587f,
0.90507f,0.50587f,0.93789f,0.505881f,0.935938f,0.314748f,0.903521f,0.314333f,
0.860777f,0.505846f,0.90507f,0.50587f,0.903521f,0.314333f,0.859669f,0.3134f,
0.0f,0.269739f,0.010008f,0.312673f,0.017852f,0.203923f,0.010774f,0.202091f,
0.017852f,0.203923f,0.010008f,0.312673f,0.039196f,0.314333f,0.046029f,0.207588f,
0.030884f,0.14549f,0.017852f,0.203923f,0.046029f,0.207588f,0.056735f,0.152091f,
0.010774f,0.202091f,0.017852f,0.203923f,0.030884f,0.14549f,0.021549f,0.134442f,
0.039196f,0.314333f,0.064689f,0.314748f,0.070602f,0.208504f,0.046029f,0.207588f,
0.046029f,0.207588f,0.070602f,0.208504f,0.07928f,0.153913f,0.056735f,0.152091f,
0.030884f,0.14549f,0.056735f,0.152091f,0.070632f,0.114303f,0.049066f,0.103292f,
0.056735f,0.152091f,0.07928f,0.153913f,0.089549f,0.117742f,0.070632f,0.114303f,
0.070632f,0.114303f,0.089549f,0.117742f,0.098918f,0.098051f,0.089549f,0.088764f,
0.070632f,0.114303f,0.089549f,0.088764f,0.073229f,0.072587f,0.049066f,0.103292f,
0.021549f,0.134442f,0.030884f,0.14549f,0.049066f,0.103292f,0.042992f,0.099156f,
0.042992f,0.099156f,0.049066f,0.103292f,0.073229f,0.072587f,0.064435f,0.06387f,
0.935938f,0.314748f,0.961185f,0.314333f,0.954418f,0.207588f,0.930084f,0.208504f,
0.954418f,0.207588f,0.961185f,0.314333f,0.990089f,0.312674f,0.982322f,0.203923f,
0.943816f,0.152092f,0.954418f,0.207588f,0.982322f,0.203923f,0.969416f,0.145491f,
0.930084f,0.208504f,0.954418f,0.207588f,0.943816f,0.152092f,0.92149f,0.153913f,
0.990089f,0.312674f,1.0f,0.269739f,0.98933f,0.202091f,0.982322f,0.203923f,
0.982322f,0.203923f,0.98933f,0.202091f,0.97866f,0.134442f,0.969416f,0.145491f,
0.943816f,0.152092f,0.969416f,0.145491f,0.951411f,0.103292f,0.930054f,0.114304f,
0.969416f,0.145491f,0.97866f,0.134442f,0.957425f,0.099156f,0.951411f,0.103292f,
0.951411f,0.103292f,0.957425f,0.099156f,0.93619f,0.06387f,0.927482f,0.072587f,
0.951411f,0.103292f,0.927482f,0.072587f,0.91132f,0.088764f,0.930054f,0.114304f,
0.92149f,0.153913f,0.943816f,0.152092f,0.930054f,0.114304f,0.91132f,0.117742f,
0.91132f,0.117742f,0.930054f,0.114304f,0.91132f,0.088764f,0.902043f,0.098051f,
0.688243f,0.064123f,0.688654f,0.096571f,0.793487f,0.101224f,0.792572f,0.069983f,
0.688654f,0.096571f,0.68958f,0.140684f,0.795546f,0.144012f,0.793487f,0.101224f,
0.793487f,0.101224f,0.795546f,0.144012f,0.85211f,0.14825f,0.848273f,0.107596f,
0.792572f,0.069983f,0.793487f,0.101224f,0.848273f,0.107596f,0.846453f,0.078585f,
0.68958f,0.140684f,0.690711f,0.200945f,0.798063f,0.203007f,0.795546f,0.144012f,
0.690711f,0.200945f,0.691637f,0.311325f,0.800123f,0.312259f,0.798063f,0.203007f,
0.798063f,0.203007f,0.800123f,0.312259f,0.859669f,0.3134f,0.856345f,0.205526f,
0.795546f,0.144012f,0.798063f,0.203007f,0.856345f,0.205526f,0.85211f,0.14825f,
0.85211f,0.14825f,0.856345f,0.205526f,0.898872f,0.207588f,0.892507f,0.152092f,
0.856345f,0.205526f,0.859669f,0.3134f,0.903521f,0.314333f,0.898872f,0.207588f,
0.898872f,0.207588f,0.903521f,0.314333f,0.935938f,0.314748f,0.930084f,0.208504f,
0.892507f,0.152092f,0.898872f,0.207588f,0.930084f,0.208504f,0.92149f,0.153913f,
0.846453f,0.078585f,0.848273f,0.107596f,0.885805f,0.114304f,0.882371f,0.088764f,
0.848273f,0.107596f,0.85211f,0.14825f,0.892507f,0.152092f,0.885805f,0.114304f,
0.885805f,0.114304f,0.892507f,0.152092f,0.92149f,0.153913f,0.91132f,0.117742f,
0.882371f,0.088764f,0.885805f,0.114304f,0.91132f,0.117742f,0.902043f,0.098051f,
0.68958f,0.140684f,0.688654f,0.096571f,0.50098f,0.095021f,0.500976f,0.139575f,
0.688654f,0.096571f,0.688243f,0.064123f,0.500982f,0.062169f,0.50098f,0.095021f,
0.50098f,0.095021f,0.500982f,0.062169f,0.313652f,0.064123f,0.313236f,0.096571f,
0.500976f,0.139575f,0.50098f,0.095021f,0.313236f,0.096571f,0.312299f,0.140684f,
0.68958f,0.140684f,0.500976f,0.139575f,0.500971f,0.200258f,0.690711f,0.200945f,
0.500976f,0.139575f,0.312299f,0.140684f,0.311154f,0.200945f,0.500971f,0.200258f,
0.500971f,0.200258f,0.311154f,0.200945f,0.310217f,0.311325f,0.500967f,0.311013f,
0.690711f,0.200945f,0.500971f,0.200258f,0.500967f,0.311013f,0.691637f,0.311325f,
0.064689f,0.314748f,0.097425f,0.314333f,0.102119f,0.207588f,0.070602f,0.208504f,
0.097425f,0.314333f,0.141621f,0.3134f,0.144978f,0.205526f,0.102119f,0.207588f,
0.102119f,0.207588f,0.144978f,0.205526f,0.149254f,0.14825f,0.108547f,0.152092f,
0.070602f,0.208504f,0.102119f,0.207588f,0.108547f,0.152092f,0.07928f,0.153913f,
0.141621f,0.3134f,0.201493f,0.312259f,0.203573f,0.203007f,0.144978f,0.205526f,
0.201493f,0.312259f,0.310217f,0.311325f,0.311154f,0.200945f,0.203573f,0.203007f,
0.203573f,0.203007f,0.311154f,0.200945f,0.312299f,0.140684f,0.206115f,0.144012f,
0.144978f,0.205526f,0.203573f,0.203007f,0.206115f,0.144012f,0.149254f,0.14825f,
0.149254f,0.14825f,0.206115f,0.144012f,0.208194f,0.101224f,0.153129f,0.107596f,
0.206115f,0.144012f,0.312299f,0.140684f,0.313236f,0.096571f,0.208194f,0.101224f,
0.208194f,0.101224f,0.313236f,0.096571f,0.313652f,0.064123f,0.209119f,0.069983f,
0.153129f,0.107596f,0.208194f,0.101224f,0.209119f,0.069983f,0.154967f,0.078585f,
0.07928f,0.153913f,0.108547f,0.152092f,0.115314f,0.114304f,0.089549f,0.117742f,
0.108547f,0.152092f,0.149254f,0.14825f,0.153129f,0.107596f,0.115314f,0.114304f,
0.115314f,0.114304f,0.153129f,0.107596f,0.154967f,0.078585f,0.118783f,0.088764f,
0.089549f,0.117742f,0.115314f,0.114304f,0.118783f,0.088764f,0.098918f,0.098051f,
};
static const float cfGameIconNormals[] = {
-0.210457f,-0.226211f,0.951071f,-0.137777f,-0.231234f,0.963093f,-0.113627f,-0.120055f,0.986243f,-0.216181f,-0.146015f,0.965373f,
-0.137777f,-0.231234f,0.963093f,-0.083714f,-0.234126f,0.968595f,-0.06603f,-0.119508f,0.990635f,-0.113627f,-0.120055f,0.986243f,
-0.113627f,-0.120055f,0.986243f,-0.06603f,-0.119508f,0.990635f,-0.062379f,-0.064577f,0.995961f,-0.113032f,-0.068284f,0.991242f,
-0.216181f,-0.146015f,0.965373f,-0.113627f,-0.120055f,0.986243f,-0.113032f,-0.068284f,0.991242f,-0.219508f,-0.086774f,0.971744f,
-0.083714f,-0.234126f,0.968595f,-0.036722f,-0.235389f,0.971207f,-0.028482f,-0.119193f,0.992463f,-0.06603f,-0.119508f,0.990635f,
-0.036722f,-0.235389f,0.971207f,-0.010823f,-0.235649f,0.971778f,-0.008321f,-0.119124f,0.992845f,-0.028482f,-0.119193f,0.992463f,
-0.028482f,-0.119193f,0.992463f,-0.008321f,-0.119124f,0.992845f,-0.007465f,-0.063717f,0.99794f,-0.026099f,-0.06375f,0.997625f,
-0.06603f,-0.119508f,0.990635f,-0.028482f,-0.119193f,0.992463f,-0.026099f,-0.06375f,0.997625f,-0.062379f,-0.064577f,0.995961f,
-0.062379f,-0.064577f,0.995961f,-0.026099f,-0.06375f,0.997625f,-0.025391f,-0.025563f,0.999351f,-0.061589f,-0.026301f,0.997755f,
-0.026099f,-0.06375f,0.997625f,-0.007465f,-0.063717f,0.99794f,-0.007172f,-0.02556f,0.999648f,-0.025391f,-0.025563f,0.999351f,
-0.025391f,-0.025563f,0.999351f,-0.007172f,-0.02556f,0.999648f,-0.007161f,-0.00707f,0.999949f,-0.025395f,-0.007088f,0.999652f,
-0.061589f,-0.026301f,0.997755f,-0.025391f,-0.025563f,0.999351f,-0.025395f,-0.007088f,0.999652f,-0.061548f,-0.00739f,0.998077f,
-0.219508f,-0.086774f,0.971744f,-0.113032f,-0.068284f,0.991242f,-0.112752f,-0.028685f,0.993209f,-0.22077f,-0.037047f,0.974622f,
-0.113032f,-0.068284f,0.991242f,-0.062379f,-0.064577f,0.995961f,-0.061589f,-0.026301f,0.997755f,-0.112752f,-0.028685f,0.993209f,
-0.112752f,-0.028685f,0.993209f,-0.061589f,-0.026301f,0.997755f,-0.061548f,-0.00739f,0.998077f,-0.112673f,-0.008234f,0.993598f,
-0.22077f,-0.037047f,0.974622f,-0.112752f,-0.028685f,0.993209f,-0.112673f,-0.008234f,0.993598f,-0.221f,-0.010721f,0.975215f,
-0.007161f,-0.00707f,0.999949f,-0.007172f,-0.02556f,0.999648f,0.0f,-0.025624f,0.999672f,0.0f,-0.007089f,0.999975f,
-0.007172f,-0.02556f,0.999648f,-0.007465f,-0.063717f,0.99794f,0.0f,-0.06378f,0.997964f,0.0f,-0.025624f,0.999672f,
0.0f,-0.025624f,0.999672f,0.0f,-0.06378f,0.997964f,0.007472f,-0.063716f,0.99794f,0.007179f,-0.025559f,0.999648f,
0.0f,-0.007089f,0.999975f,0.0f,-0.025624f,0.999672f,0.007179f,-0.025559f,0.999648f,0.007169f,-0.00707f,0.999949f,
-0.007465f,-0.063717f,0.99794f,-0.008321f,-0.119124f,0.992845f,0.0f,-0.119133f,0.992878f,0.0f,-0.06378f,0.997964f,
-0.008321f,-0.119124f,0.992845f,-0.010823f,-0.235649f,0.971778f,0.0f,-0.235564f,0.971859f,0.0f,-0.119133f,0.992878f,
0.0f,-0.119133f,0.992878f,0.0f,-0.235564f,0.971859f,0.010835f,-0.23565f,0.971778f,0.008329f,-0.119124f,0.992845f,
0.0f,-0.06378f,0.997964f,0.0f,-0.119133f,0.992878f,0.008329f,-0.119124f,0.992845f,0.007472f,-0.063716f,0.99794f,
-0.007161f,-0.00707f,0.999949f,0.0f,-0.007089f,0.999975f,0.0f,0.0f,1.0f,-0.007181f,0.0f,0.999974f,
0.0f,-0.007089f,0.999975f,0.007169f,-0.00707f,0.999949f,0.007189f,0.0f,0.999974f,0.0f,0.0f,1.0f,
0.0f,0.0f,1.0f,0.007189f,0.0f,0.999974f,0.00717f,0.007027f,0.99995f,0.0f,0.007045f,0.999975f,
-0.007181f,0.0f,0.999974f,0.0f,0.0f,1.0f,0.0f,0.007045f,0.999975f,-0.007163f,0.007027f,0.99995f,
-0.061553f,0.007347f,0.998077f,-0.112675f,0.008187f,0.993598f,-0.112665f,0.0f,0.993633f,-0.061598f,0.0f,0.998101f,
-0.112675f,0.008187f,0.993598f,-0.220997f,0.010655f,0.975216f,-0.220914f,-1.0E-6f,0.975293f,-0.112665f,0.0f,0.993633f,
-0.112665f,0.0f,0.993633f,-0.220914f,-1.0E-6f,0.975293f,-0.221f,-0.010721f,0.975215f,-0.112673f,-0.008234f,0.993598f,
-0.061598f,0.0f,0.998101f,-0.112665f,0.0f,0.993633f,-0.112673f,-0.008234f,0.993598f,-0.061548f,-0.00739f,0.998077f,
-0.061553f,0.007347f,0.998077f,-0.061598f,0.0f,0.998101f,-0.025456f,0.0f,0.999676f,-0.025398f,0.007046f,0.999653f,
-0.061598f,0.0f,0.998101f,-0.061548f,-0.00739f,0.998077f,-0.025395f,-0.007088f,0.999652f,-0.025456f,0.0f,0.999676f,
-0.025456f,0.0f,0.999676f,-0.025395f,-0.007088f,0.999652f,-0.007161f,-0.00707f,0.999949f,-0.007181f,0.0f,0.999974f,
-0.025398f,0.007046f,0.999653f,-0.025456f,0.0f,0.999676f,-0.007181f,0.0f,0.999974f,-0.007163f,0.007027f,0.99995f,
-0.211482f,0.213152f,0.953856f,-0.138447f,0.218126f,0.966051f,-0.198978f,0.347214f,0.916433f,-0.296456f,0.298724f,0.907126f,
-0.138447f,0.218126f,0.966051f,-0.084089f,0.221062f,0.971628f,-0.117212f,0.361162f,0.925107f,-0.198978f,0.347214f,0.916433f,
-0.198978f,0.347214f,0.916433f,-0.117212f,0.361162f,0.925107f,-0.168084f,0.541107f,0.823985f,-0.282777f,0.494303f,0.822011f,
-0.296456f,0.298724f,0.907126f,-0.198978f,0.347214f,0.916433f,-0.282777f,0.494303f,0.822011f,-0.402197f,0.405178f,0.821017f,
-0.084089f,0.221062f,0.971628f,-0.036885f,0.222305f,0.974279f,-0.050723f,0.367918f,0.928474f,-0.117212f,0.361162f,0.925107f,
-0.036885f,0.222305f,0.974279f,-0.010867f,0.22256f,0.974858f,-0.014805f,0.369601f,0.929073f,-0.050723f,0.367918f,0.928474f,
-0.050723f,0.367918f,0.928474f,-0.014805f,0.369601f,0.929073f,-0.020782f,0.568602f,0.822351f,-0.072149f,0.563165f,0.823189f,
-0.117212f,0.361162f,0.925107f,-0.050723f,0.367918f,0.928474f,-0.072149f,0.563165f,0.823189f,-0.168084f,0.541107f,0.823985f,
-0.072149f,0.563165f,0.823189f,-0.020782f,0.568602f,0.822351f,-0.025372f,0.696348f,0.717256f,-0.088478f,0.684053f,0.724047f,
-0.168084f,0.541107f,0.823985f,-0.072149f,0.563165f,0.823189f,-0.088478f,0.684053f,0.724047f,-0.20294f,0.64707f,0.734926f,
-0.282777f,0.494303f,0.822011f,-0.168084f,0.541107f,0.823985f,-0.20294f,0.64707f,0.734926f,-0.333245f,0.577074f,0.745609f,
-0.402197f,0.405178f,0.821017f,-0.282777f,0.494303f,0.822011f,-0.333245f,0.577074f,0.745609f,-0.466013f,0.469045f,0.75022f,
-0.025372f,0.696348f,0.717256f,-0.020782f,0.568602f,0.822351f,0.0f,0.568694f,0.822549f,-2.0E-6f,0.698486f,0.715623f,
0.0f,0.568694f,0.822549f,-0.020782f,0.568602f,0.822351f,-0.014805f,0.369601f,0.929073f,0.0f,0.369504f,0.929229f,
0.020804f,0.568602f,0.82235f,0.0f,0.568694f,0.822549f,0.0f,0.369504f,0.929229f,0.01482f,0.369601f,0.929072f,
-2.0E-6f,0.698486f,0.715623f,0.0f,0.568694f,0.822549f,0.020804f,0.568602f,0.82235f,0.025388f,0.696365f,0.717239f,
-0.014805f,0.369601f,0.929073f,-0.010867f,0.22256f,0.974858f,0.0f,0.222477f,0.974938f,0.0f,0.369504f,0.929229f,
0.0f,0.369504f,0.929229f,0.0f,0.222477f,0.974938f,0.010878f,0.222561f,0.974858f,0.01482f,0.369601f,0.929072f,
0.010835f,-0.23565f,0.971778f,0.0f,-0.235564f,0.971859f,0.0f,-0.389089f,0.9212f,0.014687f,-0.38921f,0.921032f,
0.0f,-0.235564f,0.971859f,-0.010823f,-0.235649f,0.971778f,-0.014671f,-0.38921f,0.921032f,0.0f,-0.389089f,0.9212f,
0.0f,-0.389089f,0.9212f,-0.014671f,-0.38921f,0.921032f,-0.020367f,-0.591835f,0.805802f,0.0f,-0.591896f,0.806014f,
0.014687f,-0.38921f,0.921032f,0.0f,-0.389089f,0.9212f,0.0f,-0.591896f,0.806014f,0.020387f,-0.591837f,0.8058f,
-0.020367f,-0.591835f,0.805802f,-0.024675f,-0.717705f,0.69591f,-2.0E-6f,-0.719788f,0.694194f,0.0f,-0.591896f,0.806014f,
0.0f,-0.591896f,0.806014f,-2.0E-6f,-0.719788f,0.694194f,0.02469f,-0.717725f,0.695889f,0.020387f,-0.591837f,0.8058f,
-0.46128f,-0.48965f,0.739908f,-0.32814f,-0.599132f,0.730319f,-0.27855f,-0.517113f,0.809323f,-0.397988f,-0.425903f,0.812534f,
-0.32814f,-0.599132f,0.730319f,-0.198659f,-0.669215f,0.716021f,-0.165045f,-0.564346f,0.808872f,-0.27855f,-0.517113f,0.809323f,
-0.27855f,-0.517113f,0.809323f,-0.165045f,-0.564346f,0.808872f,-0.116165f,-0.380579f,0.917423f,-0.197289f,-0.366449f,0.909281f,
-0.397988f,-0.425903f,0.812534f,-0.27855f,-0.517113f,0.809323f,-0.197289f,-0.366449f,0.909281f,-0.294472f,-0.315809f,0.901971f,
-0.198659f,-0.669215f,0.716021f,-0.086339f,-0.705672f,0.703258f,-0.070739f,-0.586438f,0.806899f,-0.165045f,-0.564346f,0.808872f,
-0.086339f,-0.705672f,0.703258f,-0.024675f,-0.717705f,0.69591f,-0.020367f,-0.591835f,0.805802f,-0.070739f,-0.586438f,0.806899f,
-0.070739f,-0.586438f,0.806899f,-0.020367f,-0.591835f,0.805802f,-0.014671f,-0.38921f,0.921032f,-0.050259f,-0.387507f,0.920496f,
-0.165045f,-0.564346f,0.808872f,-0.070739f,-0.586438f,0.806899f,-0.050259f,-0.387507f,0.920496f,-0.116165f,-0.380579f,0.917423f,
-0.050259f,-0.387507f,0.920496f,-0.014671f,-0.38921f,0.921032f,-0.010823f,-0.235649f,0.971778f,-0.036722f,-0.235389f,0.971207f,
-0.116165f,-0.380579f,0.917423f,-0.050259f,-0.387507f,0.920496f,-0.036722f,-0.235389f,0.971207f,-0.083714f,-0.234126f,0.968595f,
-0.197289f,-0.366449f,0.909281f,-0.116165f,-0.380579f,0.917423f,-0.083714f,-0.234126f,0.968595f,-0.137777f,-0.231234f,0.963093f,
-0.294472f,-0.315809f,0.901971f,-0.197289f,-0.366449f,0.909281f,-0.137777f,-0.231234f,0.963093f,-0.210457f,-0.226211f,0.951071f,
0.212501f,-0.226048f,0.950655f,0.297154f,-0.315494f,0.901201f,0.347306f,-0.209845f,0.913971f,0.218237f,-0.145906f,0.964927f,
0.347306f,-0.209845f,0.913971f,0.297154f,-0.315494f,0.901201f,0.401261f,-0.425239f,0.811271f,0.493682f,-0.297695f,0.817102f,
0.362206f,-0.121013f,0.924209f,0.347306f,-0.209845f,0.913971f,0.493682f,-0.297695f,0.817102f,0.542487f,-0.173678f,0.821915f,
0.218237f,-0.145906f,0.964927f,0.347306f,-0.209845f,0.913971f,0.362206f,-0.121013f,0.924209f,0.221558f,-0.086713f,0.971284f,
0.401261f,-0.425239f,0.811271f,0.464547f,-0.488911f,0.738351f,0.57643f,-0.348399f,0.739153f,0.493682f,-0.297695f,0.817102f,
0.493682f,-0.297695f,0.817102f,0.57643f,-0.348399f,0.739153f,0.648687f,-0.208869f,0.731832f,0.542487f,-0.173678f,0.821915f,
0.362206f,-0.121013f,0.924209f,0.542487f,-0.173678f,0.821915f,0.564441f,-0.072486f,0.822285f,0.368823f,-0.050932f,0.928103f,
0.542487f,-0.173678f,0.821915f,0.648687f,-0.208869f,0.731832f,0.685633f,-0.08861f,0.722534f,0.564441f,-0.072486f,0.822285f,
0.564441f,-0.072486f,0.822285f,0.685633f,-0.08861f,0.722534f,0.697362f,-0.024953f,0.716285f,0.569527f,-0.020487f,0.821717f,
0.564441f,-0.072486f,0.822285f,0.569527f,-0.020487f,0.821717f,0.370348f,-0.014597f,0.928778f,0.368823f,-0.050932f,0.928103f,
0.221558f,-0.086713f,0.971284f,0.362206f,-0.121013f,0.924209f,0.368823f,-0.050932f,0.928103f,0.222823f,-0.037022f,0.974156f,
0.222823f,-0.037022f,0.974156f,0.368823f,-0.050932f,0.928103f,0.370348f,-0.014597f,0.928778f,0.223053f,-0.010715f,0.974747f,
0.223053f,-0.010715f,0.974747f,0.370348f,-0.014597f,0.928778f,0.37024f,-1.0E-6f,0.928936f,0.222967f,-1.0E-6f,0.974826f,
0.37024f,-1.0E-6f,0.928936f,0.370348f,-0.014597f,0.928778f,0.569527f,-0.020487f,0.821717f,0.569586f,-1.0E-6f,0.821932f,
0.37035f,0.014508f,0.928779f,0.37024f,-1.0E-6f,0.928936f,0.569586f,-1.0E-6f,0.821932f,0.569522f,0.020364f,0.821724f,
0.222967f,-1.0E-6f,0.974826f,0.37024f,-1.0E-6f,0.928936f,0.37035f,0.014508f,0.928779f,0.223051f,0.010649f,0.974749f,
0.569527f,-0.020487f,0.821717f,0.697362f,-0.024953f,0.716285f,0.699353f,1.1E-5f,0.714776f,0.569586f,-1.0E-6f,0.821932f,
0.569586f,-1.0E-6f,0.821932f,0.699353f,1.1E-5f,0.714776f,0.697248f,0.024864f,0.716398f,0.569522f,0.020364f,0.821724f,
-0.46128f,-0.48965f,0.739908f,-0.397988f,-0.425903f,0.812534f,-0.490028f,-0.298377f,0.819051f,-0.572885f,-0.349196f,0.741529f,
-0.490028f,-0.298377f,0.819051f,-0.397988f,-0.425903f,0.812534f,-0.294472f,-0.315809f,0.901971f,-0.344264f,-0.210118f,0.915059f,
-0.538747f,-0.174169f,0.824268f,-0.490028f,-0.298377f,0.819051f,-0.344264f,-0.210118f,0.915059f,-0.359131f,-0.12118f,0.925386f,
-0.572885f,-0.349196f,0.741529f,-0.490028f,-0.298377f,0.819051f,-0.538747f,-0.174169f,0.824268f,-0.645088f,-0.209547f,0.734814f,
-0.294472f,-0.315809f,0.901971f,-0.210457f,-0.226211f,0.951071f,-0.216181f,-0.146015f,0.965373f,-0.344264f,-0.210118f,0.915059f,
-0.344264f,-0.210118f,0.915059f,-0.216181f,-0.146015f,0.965373f,-0.219508f,-0.086774f,0.971744f,-0.359131f,-0.12118f,0.925386f,
-0.538747f,-0.174169f,0.824268f,-0.359131f,-0.12118f,0.925386f,-0.365721f,-0.051004f,0.929326f,-0.560687f,-0.072708f,0.82483f,
-0.359131f,-0.12118f,0.925386f,-0.219508f,-0.086774f,0.971744f,-0.22077f,-0.037047f,0.974622f,-0.365721f,-0.051004f,0.929326f,
-0.365721f,-0.051004f,0.929326f,-0.22077f,-0.037047f,0.974622f,-0.221f,-0.010721f,0.975215f,-0.367244f,-0.014617f,0.93001f,
-0.365721f,-0.051004f,0.929326f,-0.367244f,-0.014617f,0.93001f,-0.565774f,-0.020551f,0.824304f,-0.560687f,-0.072708f,0.82483f,
-0.645088f,-0.209547f,0.734814f,-0.538747f,-0.174169f,0.824268f,-0.560687f,-0.072708f,0.82483f,-0.682094f,-0.088945f,0.725836f,
-0.682094f,-0.088945f,0.725836f,-0.560687f,-0.072708f,0.82483f,-0.565774f,-0.020551f,0.824304f,-0.69385f,-0.025062f,0.719683f,
-0.693736f,0.024972f,0.719796f,-0.695847f,1.1E-5f,0.71819f,-0.565837f,-1.0E-6f,0.824517f,-0.565768f,0.020427f,0.824311f,
-0.695847f,1.1E-5f,0.71819f,-0.69385f,-0.025062f,0.719683f,-0.565774f,-0.020551f,0.824304f,-0.565837f,-1.0E-6f,0.824517f,
-0.565837f,-1.0E-6f,0.824517f,-0.565774f,-0.020551f,0.824304f,-0.367244f,-0.014617f,0.93001f,-0.36714f,-1.0E-6f,0.930166f,
-0.565768f,0.020427f,0.824311f,-0.565837f,-1.0E-6f,0.824517f,-0.36714f,-1.0E-6f,0.930166f,-0.367245f,0.014528f,0.930011f,
-0.367244f,-0.014617f,0.93001f,-0.221f,-0.010721f,0.975215f,-0.220914f,-1.0E-6f,0.975293f,-0.36714f,-1.0E-6f,0.930166f,
-0.36714f,-1.0E-6f,0.930166f,-0.220914f,-1.0E-6f,0.975293f,-0.220997f,0.010655f,0.975216f,-0.367245f,0.014528f,0.930011f,
0.010878f,0.222561f,0.974858f,0.037001f,0.222307f,0.974274f,0.050884f,0.367932f,0.92846f,0.01482f,0.369601f,0.929072f,
0.037001f,0.222307f,0.974274f,0.084603f,0.221056f,0.971585f,0.117939f,0.361173f,0.92501f,0.050884f,0.367932f,0.92846f,
0.050884f,0.367932f,0.92846f,0.117939f,0.361173f,0.92501f,0.169134f,0.541105f,0.823771f,0.072381f,0.563194f,0.823149f,
0.020804f,0.568602f,0.82235f,0.01482f,0.369601f,0.929072f,0.050884f,0.367932f,0.92846f,0.072381f,0.563194f,0.823149f,
0.084603f,0.221056f,0.971585f,0.139597f,0.218066f,0.965898f,0.200629f,0.347092f,0.91612f,0.117939f,0.361173f,0.92501f,
0.139597f,0.218066f,0.965898f,0.213531f,0.212993f,0.953435f,0.299149f,0.298419f,0.906342f,0.200629f,0.347092f,0.91612f,
0.200629f,0.347092f,0.91612f,0.299149f,0.298419f,0.906342f,0.405489f,0.404531f,0.819716f,0.285031f,0.494036f,0.821393f,
0.117939f,0.361173f,0.92501f,0.200629f,0.347092f,0.91612f,0.285031f,0.494036f,0.821393f,0.169134f,0.541105f,0.823771f,
0.285031f,0.494036f,0.821393f,0.405489f,0.404531f,0.819716f,0.4693f,0.468325f,0.748619f,0.335556f,0.576804f,0.744781f,
0.169134f,0.541105f,0.823771f,0.285031f,0.494036f,0.821393f,0.335556f,0.576804f,0.744781f,0.204073f,0.64709f,0.734595f,
0.072381f,0.563194f,0.823149f,0.169134f,0.541105f,0.823771f,0.204073f,0.64709f,0.734595f,0.088715f,0.684119f,0.723955f,
0.020804f,0.568602f,0.82235f,0.072381f,0.563194f,0.823149f,0.088715f,0.684119f,0.723955f,0.025388f,0.696365f,0.717239f,
0.010835f,-0.23565f,0.971778f,0.014687f,-0.38921f,0.921032f,0.050418f,-0.38752f,0.920482f,0.036837f,-0.235391f,0.971203f,
0.050418f,-0.38752f,0.920482f,0.014687f,-0.38921f,0.921032f,0.020387f,-0.591837f,0.8058f,0.070967f,-0.586467f,0.806858f,
0.116885f,-0.380591f,0.917327f,0.050418f,-0.38752f,0.920482f,0.070967f,-0.586467f,0.806858f,0.166076f,-0.564345f,0.808662f,
0.036837f,-0.235391f,0.971203f,0.050418f,-0.38752f,0.920482f,0.116885f,-0.380591f,0.917327f,0.084225f,-0.234121f,0.968552f,
0.020387f,-0.591837f,0.8058f,0.02469f,-0.717725f,0.695889f,0.086571f,-0.705739f,0.703163f,0.070967f,-0.586467f,0.806858f,
0.070967f,-0.586467f,0.806858f,0.086571f,-0.705739f,0.703163f,0.199773f,-0.669232f,0.715695f,0.166076f,-0.564345f,0.808662f,
0.116885f,-0.380591f,0.917327f,0.166076f,-0.564345f,0.808662f,0.280776f,-0.516844f,0.808725f,0.198928f,-0.366325f,0.908974f,
0.166076f,-0.564345f,0.808662f,0.199773f,-0.669232f,0.715695f,0.33043f,-0.598851f,0.729516f,0.280776f,-0.516844f,0.808725f,
0.280776f,-0.516844f,0.808725f,0.33043f,-0.598851f,0.729516f,0.464547f,-0.488911f,0.738351f,0.401261f,-0.425239f,0.811271f,
0.280776f,-0.516844f,0.808725f,0.401261f,-0.425239f,0.811271f,0.297154f,-0.315494f,0.901201f,0.198928f,-0.366325f,0.908974f,
0.084225f,-0.234121f,0.968552f,0.116885f,-0.380591f,0.917327f,0.198928f,-0.366325f,0.908974f,0.138923f,-0.231173f,0.962943f,
0.138923f,-0.231173f,0.962943f,0.198928f,-0.366325f,0.908974f,0.297154f,-0.315494f,0.901201f,0.212501f,-0.226048f,0.950655f,
0.007169f,-0.00707f,0.999949f,0.007179f,-0.025559f,0.999648f,0.025473f,-0.02556f,0.999349f,0.025479f,-0.007087f,0.99965f,
0.007179f,-0.025559f,0.999648f,0.007472f,-0.063716f,0.99794f,0.02618f,-0.063744f,0.997623f,0.025473f,-0.02556f,0.999349f,
0.025473f,-0.02556f,0.999349f,0.02618f,-0.063744f,0.997623f,0.062764f,-0.064559f,0.995938f,0.061979f,-0.026292f,0.997731f,
0.025479f,-0.007087f,0.99965f,0.025473f,-0.02556f,0.999349f,0.061979f,-0.026292f,0.997731f,0.061944f,-0.007387f,0.998052f,
0.007472f,-0.063716f,0.99794f,0.008329f,-0.119124f,0.992845f,0.028568f,-0.119188f,0.992461f,0.02618f,-0.063744f,0.997623f,
0.008329f,-0.119124f,0.992845f,0.010835f,-0.23565f,0.971778f,0.036837f,-0.235391f,0.971203f,0.028568f,-0.119188f,0.992461f,
0.028568f,-0.119188f,0.992461f,0.036837f,-0.235391f,0.971203f,0.084225f,-0.234121f,0.968552f,0.066426f,-0.119489f,0.990611f,
0.02618f,-0.063744f,0.997623f,0.028568f,-0.119188f,0.992461f,0.066426f,-0.119489f,0.990611f,0.062764f,-0.064559f,0.995938f,
0.062764f,-0.064559f,0.995938f,0.066426f,-0.119489f,0.990611f,0.114563f,-0.120018f,0.98614f,0.113981f,-0.068259f,0.991135f,
0.066426f,-0.119489f,0.990611f,0.084225f,-0.234121f,0.968552f,0.138923f,-0.231173f,0.962943f,0.114563f,-0.120018f,0.98614f,
0.114563f,-0.120018f,0.98614f,0.138923f,-0.231173f,0.962943f,0.212501f,-0.226048f,0.950655f,0.218237f,-0.145906f,0.964927f,
0.113981f,-0.068259f,0.991135f,0.114563f,-0.120018f,0.98614f,0.218237f,-0.145906f,0.964927f,0.221558f,-0.086713f,0.971284f,
0.061944f,-0.007387f,0.998052f,0.061979f,-0.026292f,0.997731f,0.113708f,-0.028673f,0.9931f,0.113635f,-0.008231f,0.993489f,
0.061979f,-0.026292f,0.997731f,0.062764f,-0.064559f,0.995938f,0.113981f,-0.068259f,0.991135f,0.113708f,-0.028673f,0.9931f,
0.113708f,-0.028673f,0.9931f,0.113981f,-0.068259f,0.991135f,0.221558f,-0.086713f,0.971284f,0.222823f,-0.037022f,0.974156f,
0.113635f,-0.008231f,0.993489f,0.113708f,-0.028673f,0.9931f,0.222823f,-0.037022f,0.974156f,0.223053f,-0.010715f,0.974747f,
0.00717f,0.007027f,0.99995f,0.007189f,0.0f,0.999974f,0.025542f,0.0f,0.999674f,0.025482f,0.007044f,0.999651f,
0.007189f,0.0f,0.999974f,0.007169f,-0.00707f,0.999949f,0.025479f,-0.007087f,0.99965f,0.025542f,0.0f,0.999674f,
0.025542f,0.0f,0.999674f,0.025479f,-0.007087f,0.99965f,0.061944f,-0.007387f,0.998052f,0.061996f,0.0f,0.998076f,
0.025482f,0.007044f,0.999651f,0.025542f,0.0f,0.999674f,0.061996f,0.0f,0.998076f,0.061948f,0.007344f,0.998052f,
0.061944f,-0.007387f,0.998052f,0.113635f,-0.008231f,0.993489f,0.11363f,0.0f,0.993523f,0.061996f,0.0f,0.998076f,
0.113635f,-0.008231f,0.993489f,0.223053f,-0.010715f,0.974747f,0.222967f,-1.0E-6f,0.974826f,0.11363f,0.0f,0.993523f,
0.11363f,0.0f,0.993523f,0.222967f,-1.0E-6f,0.974826f,0.223051f,0.010649f,0.974749f,0.113637f,0.008184f,0.993489f,
0.061996f,0.0f,0.998076f,0.11363f,0.0f,0.993523f,0.113637f,0.008184f,0.993489f,0.061948f,0.007344f,0.998052f,
-0.693736f,0.024972f,0.719796f,-0.565768f,0.020427f,0.824311f,-0.560511f,0.071322f,0.82507f,-0.681667f,0.087549f,0.726406f,
-0.560511f,0.071322f,0.82507f,-0.565768f,0.020427f,0.824311f,-0.367245f,0.014528f,0.930011f,-0.365644f,0.050051f,0.929408f,
-0.53875f,0.167715f,0.825603f,-0.560511f,0.071322f,0.82507f,-0.365644f,0.050051f,0.929408f,-0.359059f,0.116722f,0.925987f,
-0.681667f,0.087549f,0.726406f,-0.560511f,0.071322f,0.82507f,-0.53875f,0.167715f,0.825603f,-0.644943f,0.202621f,0.736881f,
-0.367245f,0.014528f,0.930011f,-0.220997f,0.010655f,0.975216f,-0.220758f,0.036362f,0.974651f,-0.365644f,0.050051f,0.929408f,
-0.365644f,0.050051f,0.929408f,-0.220758f,0.036362f,0.974651f,-0.219543f,0.083629f,0.972012f,-0.359059f,0.116722f,0.925987f,
-0.53875f,0.167715f,0.825603f,-0.359059f,0.116722f,0.925987f,-0.34505f,0.199733f,0.917086f,-0.491757f,0.284219f,0.82304f,
-0.359059f,0.116722f,0.925987f,-0.219543f,0.083629f,0.972012f,-0.216564f,0.138788f,0.966353f,-0.34505f,0.199733f,0.917086f,
-0.34505f,0.199733f,0.917086f,-0.216564f,0.138788f,0.966353f,-0.211482f,0.213152f,0.953856f,-0.296456f,0.298724f,0.907126f,
-0.34505f,0.199733f,0.917086f,-0.296456f,0.298724f,0.907126f,-0.402197f,0.405178f,0.821017f,-0.491757f,0.284219f,0.82304f,
-0.644943f,0.202621f,0.736881f,-0.53875f,0.167715f,0.825603f,-0.491757f,0.284219f,0.82304f,-0.574618f,0.33479f,0.746813f,
-0.574618f,0.33479f,0.746813f,-0.491757f,0.284219f,0.82304f,-0.402197f,0.405178f,0.821017f,-0.466013f,0.469045f,0.75022f,
0.223051f,0.010649f,0.974749f,0.37035f,0.014508f,0.928779f,0.368745f,0.04998f,0.928186f,0.222811f,0.036337f,0.974184f,
0.368745f,0.04998f,0.928186f,0.37035f,0.014508f,0.928779f,0.569522f,0.020364f,0.821724f,0.564266f,0.071105f,0.822525f,
0.362133f,0.116561f,0.92481f,0.368745f,0.04998f,0.928186f,0.564266f,0.071105f,0.822525f,0.54249f,0.167243f,0.823246f,
0.222811f,0.036337f,0.974184f,0.368745f,0.04998f,0.928186f,0.362133f,0.116561f,0.92481f,0.221593f,0.083571f,0.971552f,
0.569522f,0.020364f,0.821724f,0.697248f,0.024864f,0.716398f,0.685209f,0.08722f,0.723105f,0.564266f,0.071105f,0.822525f,
0.564266f,0.071105f,0.822525f,0.685209f,0.08722f,0.723105f,0.648546f,0.20196f,0.733894f,0.54249f,0.167243f,0.823246f,
0.362133f,0.116561f,0.92481f,0.54249f,0.167243f,0.823246f,0.495412f,0.283564f,0.821071f,0.348093f,0.199473f,0.915992f,
0.54249f,0.167243f,0.823246f,0.648546f,0.20196f,0.733894f,0.578173f,0.334012f,0.744414f,0.495412f,0.283564f,0.821071f,
0.495412f,0.283564f,0.821071f,0.578173f,0.334012f,0.744414f,0.4693f,0.468325f,0.748619f,0.405489f,0.404531f,0.819716f,
0.495412f,0.283564f,0.821071f,0.405489f,0.404531f,0.819716f,0.299149f,0.298419f,0.906342f,0.348093f,0.199473f,0.915992f,
0.221593f,0.083571f,0.971552f,0.362133f,0.116561f,0.92481f,0.348093f,0.199473f,0.915992f,0.218621f,0.138683f,0.965905f,
0.218621f,0.138683f,0.965905f,0.348093f,0.199473f,0.915992f,0.299149f,0.298419f,0.906342f,0.213531f,0.212993f,0.953435f,
0.010878f,0.222561f,0.974858f,0.008351f,0.113056f,0.993554f,0.028645f,0.113157f,0.993164f,0.037001f,0.222307f,0.974274f,
0.008351f,0.113056f,0.993554f,0.007491f,0.061287f,0.998092f,0.026239f,0.061352f,0.997771f,0.028645f,0.113157f,0.993164f,
0.028645f,0.113157f,0.993164f,0.026239f,0.061352f,0.997771f,0.062873f,0.062197f,0.996082f,0.066588f,0.113508f,0.991303f,
0.037001f,0.222307f,0.974274f,0.028645f,0.113157f,0.993164f,0.066588f,0.113508f,0.991303f,0.084603f,0.221056f,0.971585f,
0.007491f,0.061287f,0.998092f,0.007187f,0.025058f,0.99966f,0.025494f,0.025072f,0.999361f,0.026239f,0.061352f,0.997771f,
0.007187f,0.025058f,0.99966f,0.00717f,0.007027f,0.99995f,0.025482f,0.007044f,0.999651f,0.025494f,0.025072f,0.999361f,
0.025494f,0.025072f,0.999361f,0.025482f,0.007044f,0.999651f,0.061948f,0.007344f,0.998052f,0.062015f,0.025807f,0.997742f,
0.026239f,0.061352f,0.997771f,0.025494f,0.025072f,0.999361f,0.062015f,0.025807f,0.997742f,0.062873f,0.062197f,0.996082f,
0.062873f,0.062197f,0.996082f,0.062015f,0.025807f,0.997742f,0.113738f,0.028159f,0.993112f,0.114097f,0.065833f,0.991286f,
0.062015f,0.025807f,0.997742f,0.061948f,0.007344f,0.998052f,0.113637f,0.008184f,0.993489f,0.113738f,0.028159f,0.993112f,
0.113738f,0.028159f,0.993112f,0.113637f,0.008184f,0.993489f,0.223051f,0.010649f,0.974749f,0.222811f,0.036337f,0.974184f,
0.114097f,0.065833f,0.991286f,0.113738f,0.028159f,0.993112f,0.222811f,0.036337f,0.974184f,0.221593f,0.083571f,0.971552f,
0.084603f,0.221056f,0.971585f,0.066588f,0.113508f,0.991303f,0.114794f,0.114134f,0.986811f,0.139597f,0.218066f,0.965898f,
0.066588f,0.113508f,0.991303f,0.062873f,0.062197f,0.996082f,0.114097f,0.065833f,0.991286f,0.114794f,0.114134f,0.986811f,
0.114794f,0.114134f,0.986811f,0.114097f,0.065833f,0.991286f,0.221593f,0.083571f,0.971552f,0.218621f,0.138683f,0.965905f,
0.139597f,0.218066f,0.965898f,0.114794f,0.114134f,0.986811f,0.218621f,0.138683f,0.965905f,0.213531f,0.212993f,0.953435f,
0.007491f,0.061287f,0.998092f,0.008351f,0.113056f,0.993554f,0.0f,0.113048f,0.99359f,0.0f,0.061335f,0.998117f,
0.008351f,0.113056f,0.993554f,0.010878f,0.222561f,0.974858f,0.0f,0.222477f,0.974938f,0.0f,0.113048f,0.99359f,
0.0f,0.113048f,0.99359f,0.0f,0.222477f,0.974938f,-0.010867f,0.22256f,0.974858f,-0.008343f,0.113057f,0.993554f,
0.0f,0.061335f,0.998117f,0.0f,0.113048f,0.99359f,-0.008343f,0.113057f,0.993554f,-0.007484f,0.061287f,0.998092f,
0.007491f,0.061287f,0.998092f,0.0f,0.061335f,0.998117f,0.0f,0.025116f,0.999685f,0.007187f,0.025058f,0.99966f,
0.0f,0.061335f,0.998117f,-0.007484f,0.061287f,0.998092f,-0.00718f,0.025059f,0.99966f,0.0f,0.025116f,0.999685f,
0.0f,0.025116f,0.999685f,-0.00718f,0.025059f,0.99966f,-0.007163f,0.007027f,0.99995f,0.0f,0.007045f,0.999975f,
0.007187f,0.025058f,0.99966f,0.0f,0.025116f,0.999685f,0.0f,0.007045f,0.999975f,0.00717f,0.007027f,0.99995f,
-0.220997f,0.010655f,0.975216f,-0.112675f,0.008187f,0.993598f,-0.112781f,0.02817f,0.993221f,-0.220758f,0.036362f,0.974651f,
-0.112675f,0.008187f,0.993598f,-0.061553f,0.007347f,0.998077f,-0.061625f,0.025816f,0.997765f,-0.112781f,0.02817f,0.993221f,
-0.112781f,0.02817f,0.993221f,-0.061625f,0.025816f,0.997765f,-0.062487f,0.062214f,0.996105f,-0.113147f,0.065858f,0.991393f,
-0.220758f,0.036362f,0.974651f,-0.112781f,0.02817f,0.993221f,-0.113147f,0.065858f,0.991393f,-0.219543f,0.083629f,0.972012f,
-0.061553f,0.007347f,0.998077f,-0.025398f,0.007046f,0.999653f,-0.025412f,0.025076f,0.999363f,-0.061625f,0.025816f,0.997765f,
-0.025398f,0.007046f,0.999653f,-0.007163f,0.007027f,0.99995f,-0.00718f,0.025059f,0.99966f,-0.025412f,0.025076f,0.999363f,
-0.025412f,0.025076f,0.999363f,-0.00718f,0.025059f,0.99966f,-0.007484f,0.061287f,0.998092f,-0.026157f,0.061358f,0.997773f,
-0.061625f,0.025816f,0.997765f,-0.025412f,0.025076f,0.999363f,-0.026157f,0.061358f,0.997773f,-0.062487f,0.062214f,0.996105f,
-0.062487f,0.062214f,0.996105f,-0.026157f,0.061358f,0.997773f,-0.028558f,0.113162f,0.993166f,-0.066192f,0.113526f,0.991328f,
-0.026157f,0.061358f,0.997773f,-0.007484f,0.061287f,0.998092f,-0.008343f,0.113057f,0.993554f,-0.028558f,0.113162f,0.993166f,
-0.028558f,0.113162f,0.993166f,-0.008343f,0.113057f,0.993554f,-0.010867f,0.22256f,0.974858f,-0.036885f,0.222305f,0.974279f,
-0.066192f,0.113526f,0.991328f,-0.028558f,0.113162f,0.993166f,-0.036885f,0.222305f,0.974279f,-0.084089f,0.221062f,0.971628f,
-0.219543f,0.083629f,0.972012f,-0.113147f,0.065858f,0.991393f,-0.113857f,0.11417f,0.986915f,-0.216564f,0.138788f,0.966353f,
-0.113147f,0.065858f,0.991393f,-0.062487f,0.062214f,0.996105f,-0.066192f,0.113526f,0.991328f,-0.113857f,0.11417f,0.986915f,
-0.113857f,0.11417f,0.986915f,-0.066192f,0.113526f,0.991328f,-0.084089f,0.221062f,0.971628f,-0.138447f,0.218126f,0.966051f,
-0.216564f,0.138788f,0.966353f,-0.113857f,0.11417f,0.986915f,-0.138447f,0.218126f,0.966051f,-0.211482f,0.213152f,0.953856f,
};
const float cfGameIconStrokeVtxs[] =
{
-0.376756459475,1.046143651009f,0.0f,
-0.512206375599f,1.039104461670f,0.0f,
-0.613150417805f,1.029256582260f,0.0f,
-0.688333272934f,1.016606807709f,0.0f,
-0.746499598026f,1.001162052155f,0.0f,
-0.796394228935f,0.982929229736,0.0f,
-0.839153468609,0.961680650711,0.0f,
-0.875913500786,0.93718868494,0.0f,
-0.907810747623,0.909225344658,0.0f,
-0.93598151207,0.877562940121,0.0f,
-0.960655272007,0.840993285179,0.0f,
-0.982061386108,0.79830801487,0.0f,
-1.00042927265,0.748299062252,0.0f,
-1.015988588333,0.689758002758,0.0f,
-1.028732180595,0.613717556,0.0f,
-1.038653135300,0.511210441589,0.0f,
-1.045744538307,0.373269081116,0.0f,
-1.049999356270,0.190926194191,0.0f,
-1.051417708397,-1.349482312799E-002,0.0f,
-1.049999356270,-0.217670500278,0.0f,
-1.04574441910,-0.399277359247,0.0f,
-1.038653135300,-0.535992026329,0.0f,
-1.028732180595,-0.636890649796,0.0f,
-1.015988588333,-0.711049556732,0.0f,
-1.00042927265,-0.767545044422,0.0f,
-0.982061386108,-0.815453350544,0.0f,
-0.960655212402,-0.856050789356,0.0f,
-0.93598151207,-0.890613555908,0.0f,
-0.907810747623,-0.920418143272,0.0f,
-0.875913500786,-0.946740865707,0.0f,
-0.839153468609,-0.969795942307,0.0f,
-0.796394228935,-0.989797830582,0.0f,
-0.746499598026,-1.006960868835,0.0f,
-0.688333272934,-1.021499633789,0.0f,
-0.613150477409,-1.033407211304,0.0f,
-0.512206375599,-1.042677521706,0.0f,
-0.376756429672,-1.049303770065,0.0f,
-0.19805586338,-1.053279519081,0.0f,
2.249561250210E-003,-1.054604768753,0.0f,
0.202514111996,-1.053279519081,0.0f,
0.381092041731,-1.049303770065,0.0f,
0.516337633133,-1.042677521706,0.0f,
0.617013633251,-1.033407211304,0.0f,
0.691882967949,-1.021499633789,0.0f,
0.749708354473,-1.006960868835,0.0f,
0.79925262928,-0.989797830582,0.0f,
0.841663658619,-0.969795942307,0.0f,
0.87808907032,-0.946740865707,0.0f,
0.909676492214,-0.920418143272,0.0f,
0.93757379055,-0.890613555908,0.0f,
0.962008118629,-0.856050789356,0.0f,
0.983206510544,-0.815453350544,0.0f,
1.001396179199,-0.767545044422,0.0f,
1.016804218292,-0.711049556732,0.0f,
1.029423952103,-0.636890649796,0.0f,
1.039248347282,-0.535992026329,0.0f,
1.046270728111,-0.399277359247,0.0f,
1.050484061241,-0.217670500278,0.0f,
1.051888465881,-1.349482685328E-002,0.0f,
1.050484061241,0.190926194191,0.0f,
1.046270728111,0.373269081116,0.0f,
1.039248347282,0.511210441589,0.0f,
1.029423952103,0.613717556,0.0f,
1.016804218292,0.689758002758,0.0f,
1.001396059990,0.748299002647,0.0f,
0.983206450939,0.79830801487,0.0f,
0.962008118629,0.840993225574,0.0f,
0.93757379055,0.877562940121,0.0f,
0.909676492214,0.909225344658,0.0f,
0.87808907032,0.93718868494,0.0f,
0.841663658619,0.961680650711,0.0f,
0.79925262928,0.982929229736,0.0f,
0.749708354473,1.001162052155,0.0f,
0.691882967949,1.016606807709,0.0f,
0.617013692856,1.029256582260,0.0f,
0.516337633133,1.039104580879,0.0f,
0.381092071533,1.046143770218,0.0f,
0.202514111996,1.050367355347,0.0f,
2.249561250210E-003,1.051775097847,0.0f,
-0.19805586338,1.050367236137,0.0f,
-0.376756459475,1.046143651009,0.0f
};
const unsigned int cuGameIconStrokeVtxCount = sizeof(cfGameIconStrokeVtxs) / (sizeof(float) * 3);
#endif

100
src/gui/GridBackground.cpp Normal file
View File

@ -0,0 +1,100 @@
#include "GridBackground.h"
#include "video/CVideo.h"
#include "video/shaders/Shader3D.h"
static const float bgRepeat = 1000.0f;
static const float bgTexRotate = 39.0f;
GridBackground::GridBackground(GuiImageData *img)
: GuiImage(img)
{
colorIntensity = glm::vec4(1.0f, 1.0f, 1.0f, 0.9f);
alphaFadeOut = glm::vec4(0.0f);
distanceFadeOut = 0.15f;
vtxCount = 4;
//! texture and vertex coordinates
f32 *m_posVtxs = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, vtxCount * Shader3D::cuVertexAttrSize);
f32 *m_texCoords = (f32*)memalign(GX2_VERTEX_BUFFER_ALIGNMENT, vtxCount * Shader3D::cuTexCoordAttrSize);
if(m_posVtxs)
{
int i = 0;
m_posVtxs[i++] = -1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = 1.0f;
m_posVtxs[i++] = 1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = 1.0f;
m_posVtxs[i++] = 1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = -1.0f;
m_posVtxs[i++] = -1.0f; m_posVtxs[i++] = 0.0f; m_posVtxs[i++] = -1.0f;
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, m_posVtxs, vtxCount * Shader3D::cuVertexAttrSize);
}
if(m_texCoords)
{
glm::vec2 texCoordVec[4];
texCoordVec[0][0] = -0.5f * bgRepeat; texCoordVec[0][1] = 0.5f * bgRepeat;
texCoordVec[1][0] = 0.5f * bgRepeat; texCoordVec[1][1] = 0.5f * bgRepeat;
texCoordVec[2][0] = 0.5f * bgRepeat; texCoordVec[2][1] = -0.5f * bgRepeat;
texCoordVec[3][0] = -0.5f * bgRepeat; texCoordVec[3][1] = -0.5f * bgRepeat;
const float cosRot = cosf(DegToRad(bgTexRotate));
const float sinRot = sinf(DegToRad(bgTexRotate));
glm::mat2 texRotateMtx({
cosRot, -sinRot,
sinRot, cosRot
});
for(int i = 0; i < 4; i++) {
texCoordVec[i] = texRotateMtx * texCoordVec[i];
m_texCoords[i*2 + 0] = texCoordVec[i][0];
m_texCoords[i*2 + 1] = texCoordVec[i][1];
}
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, m_texCoords, vtxCount * Shader3D::cuTexCoordAttrSize);
}
//! assign to internal variables which are const but oh well
posVtxs = m_posVtxs;
texCoords = m_texCoords;
}
GridBackground::~GridBackground()
{
//! remove image so it can not be drawn anymore from this point on
imageData = NULL;
//! main image vertexes
if(posVtxs)
{
free((void*)posVtxs);
posVtxs = NULL;
}
if(texCoords)
{
free((void*)texCoords);
texCoords = NULL;
}
}
void GridBackground::draw(CVideo *pVideo, const glm::mat4 & modelView)
{
//! first setup 2D GUI positions
f32 currScaleX = bgRepeat * scaleX * (f32)getWidth() * pVideo->getWidthScaleFactor();
f32 currScaleY = 1.0f;
f32 currScaleZ = bgRepeat * scaleZ * (f32)getHeight() * pVideo->getDepthScaleFactor();
m_modelView = glm::scale(modelView, glm::vec3(currScaleX, currScaleY, currScaleZ));
colorIntensity[3] = getAlpha();
Shader3D::instance()->setShaders();
Shader3D::instance()->setTextureAndSampler(imageData->getTexture(), imageData->getSampler());
Shader3D::instance()->setProjectionMtx(pVideo->getProjectionMtx());
Shader3D::instance()->setViewMtx(pVideo->getViewMtx());
Shader3D::instance()->setModelViewMtx(m_modelView);
Shader3D::instance()->setDistanceFadeOut(distanceFadeOut);
Shader3D::instance()->setAlphaFadeOut(alphaFadeOut);
Shader3D::instance()->setColorIntensity(colorIntensity);
Shader3D::instance()->setAttributeBuffer(vtxCount, posVtxs, texCoords);
Shader3D::instance()->draw(GX2_PRIMITIVE_QUADS, vtxCount);
}

30
src/gui/GridBackground.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef _GRID_BACKGROUND_H_
#define _GRID_BACKGROUND_H_
#include "GuiImage.h"
#include "video/shaders/Shader.h"
class GridBackground : public GuiImage
{
public:
GridBackground(GuiImageData *imgData);
virtual ~GridBackground();
void setColorIntensity(const glm::vec4 & color) {
colorIntensity = color;
}
const glm::vec4 & getColorIntensity() const {
return colorIntensity;
}
void setDistanceFadeOut(const float & a) {
distanceFadeOut = a;
}
void draw(CVideo *pVideo, const glm::mat4 & modelView);
private:
glm::mat4 m_modelView;
glm::vec4 colorIntensity;
glm::vec4 alphaFadeOut;
float distanceFadeOut;
};
#endif // _GRID_BACKGROUND_H_

30
src/gui/Gui.h Normal file
View File

@ -0,0 +1,30 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef __GUI_H
#define __GUI_H
#include "GuiElement.h"
#include "GuiImageData.h"
#include "GuiImage.h"
#include "GuiFrame.h"
#include "GuiController.h"
#include "GuiText.h"
#include "GuiSound.h"
#include "GuiButton.h"
#include "GuiTrigger.h"
#endif

301
src/gui/GuiButton.cpp Normal file
View File

@ -0,0 +1,301 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "GuiButton.h"
#include "GuiTrigger.h"
#include "GuiController.h"
/**
* Constructor for the GuiButton class.
*/
GuiButton::GuiButton(f32 w, f32 h)
{
width = w;
height = h;
image = NULL;
imageOver = NULL;
imageHold = NULL;
imageClick = NULL;
icon = NULL;
iconOver = NULL;
for(int i = 0; i < 4; i++)
{
label[i] = NULL;
labelOver[i] = NULL;
labelHold[i] = NULL;
labelClick[i] = NULL;
}
for(int i = 0; i < iMaxGuiTriggers; i++)
{
trigger[i] = NULL;
}
soundOver = NULL;
soundHold = NULL;
soundClick = NULL;
clickedTrigger = NULL;
heldTrigger = NULL;
selectable = true;
holdable = false;
clickable = true;
}
/**
* Destructor for the GuiButton class.
*/
GuiButton::~GuiButton()
{
}
void GuiButton::setImage(GuiImage* img)
{
image = img;
if(img) img->setParent(this);
}
void GuiButton::setImageOver(GuiImage* img)
{
imageOver = img;
if(img) img->setParent(this);
}
void GuiButton::setImageHold(GuiImage* img)
{
imageHold = img;
if(img) img->setParent(this);
}
void GuiButton::setImageClick(GuiImage* img)
{
imageClick = img;
if(img) img->setParent(this);
}
void GuiButton::setIcon(GuiImage* img)
{
icon = img;
if(img) img->setParent(this);
}
void GuiButton::setIconOver(GuiImage* img)
{
iconOver = img;
if(img) img->setParent(this);
}
void GuiButton::setLabel(GuiText* txt, int n)
{
label[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelOver(GuiText* txt, int n)
{
labelOver[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelHold(GuiText* txt, int n)
{
labelHold[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setLabelClick(GuiText* txt, int n)
{
labelClick[n] = txt;
if(txt) txt->setParent(this);
}
void GuiButton::setSoundOver(GuiSound * snd)
{
soundOver = snd;
}
void GuiButton::setSoundHold(GuiSound * snd)
{
soundHold = snd;
}
void GuiButton::setSoundClick(GuiSound * snd)
{
soundClick = snd;
}
void GuiButton::setTrigger(GuiTrigger * t, int idx)
{
if(idx >= 0 && idx < iMaxGuiTriggers)
{
trigger[idx] = t;
}
else
{
for(int i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
{
trigger[i] = t;
break;
}
}
}
}
void GuiButton::resetState(void)
{
clickedTrigger = NULL;
heldTrigger = NULL;
GuiElement::resetState();
}
/**
* Draw the button on screen
*/
void GuiButton::draw(CVideo *v)
{
if(!this->isVisible())
return;
// draw image
if((isDrawOverOnlyWhenSelected() && (isStateSet(STATE_SELECTED) && imageOver)) ||
(!isDrawOverOnlyWhenSelected() && (isStateSet(STATE_OVER | STATE_SELECTED | STATE_CLICKED | STATE_HELD) && imageOver)))
imageOver->draw(v);
else if(image)
image->draw(v);
if((isDrawOverOnlyWhenSelected() && (isStateSet(STATE_SELECTED) && iconOver)) ||
(!isDrawOverOnlyWhenSelected() && (isStateSet(STATE_OVER | STATE_SELECTED | STATE_CLICKED | STATE_HELD) && iconOver)))
iconOver->draw(v);
else if(icon)
icon->draw(v);
// draw text
for(int i = 0; i < 4; i++)
{
if(isStateSet(STATE_OVER | STATE_SELECTED | STATE_CLICKED | STATE_HELD) && labelOver[i])
labelOver[i]->draw(v);
else if(label[i])
label[i]->draw(v);
}
}
void GuiButton::update(GuiController * c)
{
if(!c || isStateSet(STATE_DISABLED|STATE_HIDDEN|STATE_DISABLE_INPUT, c->chan))
return;
else if(parentElement && (parentElement->isStateSet(STATE_DISABLED|STATE_HIDDEN|STATE_DISABLE_INPUT, c->chan)))
return;
if(selectable)
{
if(c->data.validPointer && this->isInside(c->data.x, c->data.y))
{
if(!isStateSet(STATE_OVER, c->chan))
{
setState(STATE_OVER, c->chan);
//if(this->isRumbleActive())
// this->rumble(t->chan);
if(soundOver)
soundOver->Play();
if(effectsOver && !effects)
{
// initiate effects
effects = effectsOver;
effectAmount = effectAmountOver;
effectTarget = effectTargetOver;
}
pointedOn(this, c);
}
}
else if(isStateSet(STATE_OVER, c->chan))
{
this->clearState(STATE_OVER, c->chan);
pointedOff(this, c);
if(effectTarget == effectTargetOver && effectAmount == effectAmountOver)
{
// initiate effects (in reverse)
effects = effectsOver;
effectAmount = -effectAmountOver;
effectTarget = 100;
}
}
}
for(int i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
continue;
// button triggers
if(clickable)
{
int isClicked = trigger[i]->clicked(c);
if( !clickedTrigger && (isClicked != GuiTrigger::CLICKED_NONE)
&& (trigger[i]->isClickEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chan) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y)))
{
if(soundClick)
soundClick->Play();
clickedTrigger = trigger[i];
if(!isStateSet(STATE_CLICKED, c->chan)){
if(isClicked == GuiTrigger::CLICKED_TOUCH){
setState(STATE_CLICKED_TOUCH, c->chan);
}else{
setState(STATE_CLICKED, c->chan);
}
}
clicked(this, c, trigger[i]);
}
else if((isStateSet(STATE_CLICKED, c->chan) || isStateSet(STATE_CLICKED_TOUCH, c->chan)) && (clickedTrigger == trigger[i]) && !isStateSet(STATE_HELD, c->chan) && !trigger[i]->held(c) && ((isClicked == GuiTrigger::CLICKED_NONE) || trigger[i]->released(c)))
{
if((isStateSet(STATE_CLICKED_TOUCH, c->chan) && this->isInside(c->data.x, c->data.y)) || (isStateSet(STATE_CLICKED, c->chan))){
clickedTrigger = NULL;
clearState(STATE_CLICKED, c->chan);
released(this, c, trigger[i]);
}
}
}
if(holdable)
{
bool isHeld = trigger[i]->held(c);
if( (!heldTrigger || heldTrigger == trigger[i]) && isHeld
&& (trigger[i]->isHoldEverywhere() || (isStateSet(STATE_SELECTED | STATE_OVER, c->chan) && trigger[i]->isSelectionClickEverywhere()) || this->isInside(c->data.x, c->data.y)))
{
heldTrigger = trigger[i];
if(!isStateSet(STATE_HELD, c->chan))
setState(STATE_HELD, c->chan);
held(this, c, trigger[i]);
}
else if(isStateSet(STATE_HELD, c->chan) && (heldTrigger == trigger[i]) && (!isHeld || trigger[i]->released(c)))
{
//! click is removed at this point and converted to held
if(clickedTrigger == trigger[i])
{
clickedTrigger = NULL;
clearState(STATE_CLICKED, c->chan);
}
heldTrigger = NULL;
clearState(STATE_HELD, c->chan);
released(this, c, trigger[i]);
}
}
}
}

117
src/gui/GuiButton.h Normal file
View File

@ -0,0 +1,117 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef GUI_BUTTON_H_
#define GUI_BUTTON_H_
#include "GuiElement.h"
#include "GuiText.h"
#include "GuiController.h"
#include "GuiImage.h"
#include "GuiSound.h"
#include "GuiTrigger.h"
//!Display, manage, and manipulate buttons in the GUI. Buttons can have images, icons, text, and sound set (all of which are optional)
class GuiButton : public GuiElement
{
public:
//!Constructor
//!\param w Width
//!\param h Height
GuiButton(f32 w, f32 h);
//!Destructor
virtual ~GuiButton();
//!Sets the button's image
//!\param i Pointer to GuiImage object
void setImage(GuiImage* i);
//!Sets the button's image on over
//!\param i Pointer to GuiImage object
void setImageOver(GuiImage* i);
void setIcon(GuiImage* i);
void setIconOver(GuiImage* i);
//!Sets the button's image on hold
//!\param i Pointer to GuiImage object
void setImageHold(GuiImage* i);
//!Sets the button's image on click
//!\param i Pointer to GuiImage object
void setImageClick(GuiImage* i);
//!Sets the button's label
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabel(GuiText* t, int n = 0);
//!Sets the button's label on over (eg: different colored text)
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelOver(GuiText* t, int n = 0);
//!Sets the button's label on hold
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelHold(GuiText* t, int n = 0);
//!Sets the button's label on click
//!\param t Pointer to GuiText object
//!\param n Index of label to set (optional, default is 0)
void setLabelClick(GuiText* t, int n = 0);
//!Sets the sound to play on over
//!\param s Pointer to GuiSound object
void setSoundOver(GuiSound * s);
//!Sets the sound to play on hold
//!\param s Pointer to GuiSound object
void setSoundHold(GuiSound * s);
//!Sets the sound to play on click
//!\param s Pointer to GuiSound object
void setSoundClick(GuiSound * s);
//!Set a new GuiTrigger for the element
//!\param i Index of trigger array to set
//!\param t Pointer to GuiTrigger
void setTrigger(GuiTrigger * t, int idx = -1);
//!
void resetState(void);
//!Constantly called to draw the GuiButton
void draw(CVideo *video);
//!Constantly called to allow the GuiButton to respond to updated input data
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
void update(GuiController * c);
sigslot::signal2<GuiButton *, const GuiController *> selected;
sigslot::signal2<GuiButton *, const GuiController *> deSelected;
sigslot::signal2<GuiButton *, const GuiController *> pointedOn;
sigslot::signal2<GuiButton *, const GuiController *> pointedOff;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> clicked;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> held;
sigslot::signal3<GuiButton *, const GuiController *, GuiTrigger *> released;
protected:
static const int iMaxGuiTriggers = 10;
GuiImage * image; //!< Button image (default)
GuiImage * imageOver; //!< Button image for STATE_SELECTED
GuiImage * imageHold; //!< Button image for STATE_HELD
GuiImage * imageClick; //!< Button image for STATE_CLICKED
GuiImage * icon;
GuiImage * iconOver;
GuiText * label[4]; //!< Label(s) to display (default)
GuiText * labelOver[4]; //!< Label(s) to display for STATE_SELECTED
GuiText * labelHold[4]; //!< Label(s) to display for STATE_HELD
GuiText * labelClick[4]; //!< Label(s) to display for STATE_CLICKED
GuiSound * soundOver; //!< Sound to play for STATE_SELECTED
GuiSound * soundHold; //!< Sound to play for STATE_HELD
GuiSound * soundClick; //!< Sound to play for STATE_CLICKED
GuiTrigger * trigger[iMaxGuiTriggers]; //!< GuiTriggers (input actions) that this element responds to
GuiTrigger * clickedTrigger;
GuiTrigger * heldTrigger;
};
#endif

63
src/gui/GuiCheckBox.cpp Normal file
View File

@ -0,0 +1,63 @@
/****************************************************************************
* Copyright (C) 2016 Maschell
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "GuiCheckBox.h"
#include "GuiImage.h"
#include "GuiImageData.h"
/**
* Constructor for the GuiCheckBox class.
*/
GuiCheckBox::GuiCheckBox(bool checked)
: GuiToggle(checked,50,50)
,checkbox_imgdata(Resources::GetImageData("checkbox.png"))
,checkbox_img(checkbox_imgdata)
,checkbox_selected_imgdata(Resources::GetImageData("checkbox_selected.png"))
,checkbox_selected_img(checkbox_selected_imgdata)
,highlighted_imgdata(Resources::GetImageData("checkbox_highlighted.png"))
,highlighted_img(highlighted_imgdata)
{
checkbox_selected_img.setScale(height/checkbox_selected_img.getHeight());
checkbox_img.setScale(height/checkbox_img.getHeight());
highlighted_img.setScale(height/highlighted_img.getHeight());
setImage(&checkbox_img);
setIconOver(&highlighted_img);
}
/**
* Destructor for the GuiButton class.
*/
GuiCheckBox::~GuiCheckBox()
{
Resources::RemoveImageData(checkbox_imgdata);
Resources::RemoveImageData(checkbox_selected_imgdata);
Resources::RemoveImageData(highlighted_imgdata);
}
void GuiCheckBox::update(GuiController * c){
if(bChanged){
if(selected){
GuiButton::setImage(&checkbox_selected_img);
}else{
GuiButton::setImage(&checkbox_img);
}
bChanged = false;
}
GuiToggle::update(c);
}

47
src/gui/GuiCheckBox.h Normal file
View File

@ -0,0 +1,47 @@
/****************************************************************************
* Copyright (C) 2016 Maschell
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef GUI_CHECKBOX_H_
#define GUI_CHECKBOX_H_
#include "GuiToggle.h"
#include "GuiImage.h"
#include "GuiImageData.h"
//!A simple CheckBox
class GuiCheckBox : public GuiToggle
{
public:
//!Constructor
//!\param checked Checked
GuiCheckBox(bool checked);
//!Destructor
virtual ~GuiCheckBox();
protected:
GuiImageData * checkbox_imgdata;
GuiImage checkbox_img;
GuiImageData * checkbox_selected_imgdata;
GuiImage checkbox_selected_img;
GuiImageData * highlighted_imgdata;
GuiImage highlighted_img;
void update(GuiController * c);
};
#endif

78
src/gui/GuiController.h Normal file
View File

@ -0,0 +1,78 @@
/****************************************************************************
* Copyright (C) 2015 Dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#ifndef GUI_CONTROLLER_H_
#define GUI_CONTROLLER_H_
#include <string.h>
#include "GuiTrigger.h"
class GuiController
{
public:
//!Constructor
GuiController(int channel)
: chan(channel)
{
memset(&lastData, 0, sizeof(lastData));
memset(&data, 0, sizeof(data));
switch(chan)
{
default:
case GuiTrigger::CHANNEL_1:
chanIdx = 0;
break;
case GuiTrigger::CHANNEL_2:
chanIdx = 1;
break;
case GuiTrigger::CHANNEL_3:
chanIdx = 2;
break;
case GuiTrigger::CHANNEL_4:
chanIdx = 3;
break;
case GuiTrigger::CHANNEL_5:
chanIdx = 4;
break;
}
}
//!Destructor
virtual ~GuiController() {}
virtual bool update(int width, int height) = 0;
typedef struct
{
unsigned int buttons_h;
unsigned int buttons_d;
unsigned int buttons_r;
bool validPointer;
bool touched;
float pointerAngle;
int x;
int y;
} PadData;
int chan;
int chanIdx;
PadData data;
PadData lastData;
};
#endif

View File

@ -0,0 +1,82 @@
/****************************************************************************
* Copyright (C) 2016 Maschell
* based on GuiButton by dimok
*
* 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 <http://www.gnu.org/licenses/>.
****************************************************************************/
#include "GuiDragListener.h"
#include "GuiController.h"
#include "utils/logger.h"
/**
* Constructor for the GuiDragListener class.
*/
GuiDragListener::GuiDragListener(f32 w,f32 h){
width = w;
height = h;
for(int i = 0; i < iMaxGuiTriggers; i++)
{
trigger[i] = NULL;
}
}
/**
* Destructor for the GuiDragListener class.
*/
GuiDragListener::~GuiDragListener(){
}
void GuiDragListener::setTrigger(GuiTrigger * t, int idx){
if(idx >= 0 && idx < iMaxGuiTriggers)
{
trigger[idx] = t;
}
else
{
for(int i = 0; i < iMaxGuiTriggers; i++)
{
if(!trigger[i])
{
trigger[i] = t;
break;
}
}
}
}
void GuiDragListener::update(GuiController * c){
if(!c || isStateSet(STATE_DISABLED|STATE_HIDDEN|STATE_DISABLE_INPUT, c->chan))
return;
else if(parentElement && (parentElement->isStateSet(STATE_DISABLED|STATE_HIDDEN|STATE_DISABLE_INPUT, c->chan)))
return;
for(int i = 0; i < iMaxGuiTriggers; i++){
if(!trigger[i]){
continue;
}
bool isHeld = trigger[i]->held(c);
if(isHeld && this->isInside(c->data.x, c->data.y)){
int dx = c->data.x - c->lastData.x;
int dy = c->data.y - c->lastData.y;
if(dx == 0 && dy == 0) continue;
dragged(this, c, trigger[i],dx,dy);
}
}
}

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